// Underscore.js 1.3.3 // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore is freely distributable under the MIT license. // Portions of Underscore are inspired or borrowed from Prototype, // Oliver Steele's Functional, and John Resig's Micro-Templating. // For all details and documentation: // http://documentcloud.github.com/underscore function S4(){return((1+Math.random())*65536|0).toString(16).substring(1)}function guid(){return S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()}function js_beautify(e,t){function B(e){e=typeof e=="undefined"?!1:e;while(r.length&&(r[r.length-1]===" "||r[r.length-1]===c||r[r.length-1]===T||e&&(r[r.length-1]==="\n"||r[r.length-1]==="\r")))r.pop()}function j(e){return e.replace(/^\s\s*|\s\s*$/,"")}function F(e){e=e.replace(/\x0d/g,"");var t=[],n=e.indexOf("\n");while(n!==-1)t.push(e.substring(0,n)),e=e.substring(n+1),n=e.indexOf("\n");return e.length&&t.push(e),t}function I(){var e=_;_=!1,q(),_=e}function q(e,t){f.eat_next_space=!1;if(_&&V(f.mode))return;e=typeof e=="undefined"?!0:e,t=typeof t=="undefined"?!0:t,t&&(f.if_line=!1,f.chain_extra_indentation=0),B();if(!r.length)return;if(r[r.length-1]!=="\n"||!e)S=!0,r.push("\n");T&&r.push(T);for(var n=0;n0){var e=f.mode;f=l.pop(),f.previous_mode=e}}function K(e,t){for(var n=0;n=H)return 0;r=n.charAt(t)}return r}function Z(){var e,t;x=0;if(v>=H)return["","TK_EOF"];E=!1;var i=n.charAt(v);v+=1;var u=_&&V(f.mode);if(u){var a=0;while(G(i,h)){i==="\n"?(B(),r.push("\n"),S=!0,a=0):i===" "?a+=4:i!=="\r"&&(a+=1);if(v>=H)return["","TK_EOF"];i=n.charAt(v),v+=1}if(S)for(e=0;e=H)return["","TK_EOF"];i=n.charAt(v),v+=1}if(L&&x>1)for(e=0;e0}if(G(i,p)){if(v=H)break}return v+=2,y&&x===0?["/*"+m+"*/","TK_INLINE_COMMENT"]:["/*"+m+"*/","TK_BLOCK_COMMENT"]}if(n.charAt(v)==="/"){m=i;while(n.charAt(v)!=="\r"&&n.charAt(v)!=="\n"){m+=n.charAt(v),v+=1;if(v>=H)break}return E&&q(),[m,"TK_COMMENT"]}}if(i==="'"||i==='"'||i==="/"&&(s==="TK_WORD"&&Q(o)||o===")"&&G(f.previous_mode,["(COND-EXPRESSION)","(FOR-EXPRESSION)"])||s==="TK_COMMA"||s==="TK_COMMENT"||s==="TK_START_EXPR"||s==="TK_START_BLOCK"||s==="TK_END_BLOCK"||s==="TK_OPERATOR"||s==="TK_EQUALS"||s==="TK_EOF"||s==="TK_SEMICOLON")){var b=i,w=!1,T=0,N=0;t=i;if(v=H)return[t,"TK_STRING"]}}else while(w||n.charAt(v)!==b){t+=n.charAt(v),T&&T>=N&&(T=parseInt(t.substr(-N),16),T&&T>=32&&T<=126&&(T=String.fromCharCode(T),t=t.substr(0,t.length-N-2)+(T===b||T==="\\"?"\\":"")+T),T=0),T?T++:w?(w=!1,P&&(n.charAt(v)==="x"?(T++,N=2):n.charAt(v)==="u"&&(T++,N=4))):w=n.charAt(v)==="\\",v+=1;if(v>=H)return[t,"TK_STRING"]}v+=1,t+=b;if(b==="/")while(v")return f.in_html_comment=!1,v+=2,E&&q(),["-->","TK_COMMENT"];if(i===".")return[i,"TK_DOT"];if(G(i,d)){while(v=H)break}return i===","?[i,"TK_COMMA"]:i==="="?[i,"TK_EQUALS"]:[i,"TK_OPERATOR"]}return[i,"TK_UNKNOWN"]}var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T="";t=t?t:{};var N;t.space_after_anon_function!==undefined&&t.jslint_happy===undefined&&(t.jslint_happy=t.space_after_anon_function),t.braces_on_own_line!==undefined&&(N=t.braces_on_own_line?"expand":"collapse"),N=t.brace_style?t.brace_style:N?N:"collapse";var C=t.indent_size?t.indent_size:4,k=t.indent_char?t.indent_char:" ",L=typeof t.preserve_newlines=="undefined"?!0:t.preserve_newlines,A=typeof t.break_chained_methods=="undefined"?!1:t.break_chained_methods,O=typeof t.max_preserve_newlines=="undefined"?!1:t.max_preserve_newlines,M=t.jslint_happy==="undefined"?!1:t.jslint_happy,_=typeof t.keep_array_indentation=="undefined"?!1:t.keep_array_indentation,D=typeof t.space_before_conditional=="undefined"?!0:t.space_before_conditional,P=typeof t.unescape_strings=="undefined"?!1:t.unescape_strings;S=!1;var H=e.length;c="";while(C>0)c+=k,C-=1;while(e&&(e.charAt(0)===" "||e.charAt(0)===" "))T+=e.charAt(0),e=e.substring(1);n=e,a="",s="TK_START_EXPR",o="",u="",r=[],w=!1,h="\n\r ".split(""),p="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$".split(""),g="0123456789".split(""),d="+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::",d+=" <%= <% %> ",d=d.split(" "),m="continue,try,throw,return,var,if,switch,case,default,for,while,break,function".split(","),l=[],X("BLOCK"),v=0;for(;;){var et=Z();i=et[0],b=et[1];if(b==="TK_EOF")break;switch(b){case"TK_START_EXPR":if(i==="["){if(s==="TK_WORD"||o===")"){G(o,m)&&R(),X("(EXPRESSION)"),U();break}f.mode==="[EXPRESSION]"||f.mode==="[INDENTED-EXPRESSION]"?u==="]"&&o===","?(f.mode==="[EXPRESSION]"&&(f.mode="[INDENTED-EXPRESSION]",_||z()),X("[EXPRESSION]"),_||q()):o==="["?(f.mode==="[EXPRESSION]"&&(f.mode="[INDENTED-EXPRESSION]",_||z()),X("[EXPRESSION]"),_||q()):X("[EXPRESSION]"):X("[EXPRESSION]")}else a==="for"?X("(FOR-EXPRESSION)"):G(a,["if","while"])?X("(COND-EXPRESSION)"):X("(EXPRESSION)");o===";"||s==="TK_START_BLOCK"?q():s==="TK_END_EXPR"||s==="TK_START_EXPR"||s==="TK_END_BLOCK"||o==="."?E&&q():s!=="TK_WORD"&&s!=="TK_OPERATOR"?R():a==="function"||a==="typeof"?M&&R():(G(o,m)||o==="catch")&&D&&R(),U();break;case"TK_DOT":Q(o)?R():o===")"&&(A||E)&&(f.chain_extra_indentation=1,q(!0,!1)),U();break;case"TK_END_EXPR":if(i==="]")if(_){if(o==="}"){W(),U(),J();break}}else if(f.mode==="[INDENTED-EXPRESSION]"&&o==="]"){J(),q(),U();break}J(),U();break;case"TK_START_BLOCK":a==="do"?X("DO_BLOCK"):X("BLOCK");if(N==="expand"||N==="expand-strict"){var tt=!1;N==="expand-strict"?(tt=Y()==="}",tt||q(!0)):s!=="TK_OPERATOR"&&(o==="="||Q(o)&&o!=="else"?R():q(!0)),U(),tt||z()}else s!=="TK_OPERATOR"&&s!=="TK_START_EXPR"?s==="TK_START_BLOCK"?q():R():V(f.previous_mode)&&o===","&&(u==="}"?R():q()),z(),U();break;case"TK_END_BLOCK":J(),N==="expand"||N==="expand-strict"?(o!=="{"&&q(),U()):(s==="TK_START_BLOCK"?S?W():B():V(f.mode)&&_?(_=!1,q(),_=!0):q(),U());break;case"TK_WORD":if(w){R(),U(),R(),w=!1;break}y="NONE";if(i==="function"){f.var_line&&s!=="TK_EQUALS"&&(f.var_line_reindented=!0);if((S||o===";")&&o!=="{"&&s!=="TK_BLOCK_COMMENT"&&s!=="TK_COMMENT"){x=S?x:0,L||(x=1);for(var nt=0;nt<2-x;nt++)q(!1)}s==="TK_WORD"?o==="get"||o==="set"||o==="new"||o==="return"?R():q():s==="TK_OPERATOR"||o==="="?R():$(f.mode)||q(),U(),a=i;break}if(i==="case"||i==="default"&&f.in_case_statement){q(),f.case_body&&(f.indentation_level--,f.case_body=!1,W()),U(),f.in_case=!0,f.in_case_statement=!0;break}s==="TK_END_BLOCK"?G(i.toLowerCase(),["else","catch","finally"])?N==="expand"||N==="end-expand"||N==="expand-strict"?y="NEWLINE":(y="SPACE",R()):y="NEWLINE":s!=="TK_SEMICOLON"||f.mode!=="BLOCK"&&f.mode!=="DO_BLOCK"?s==="TK_SEMICOLON"&&$(f.mode)?y="SPACE":s==="TK_STRING"?y="NEWLINE":s==="TK_WORD"?(o==="else"&&B(!0),y="SPACE"):s==="TK_START_BLOCK"?y="NEWLINE":s==="TK_END_EXPR"&&(R(),y="NEWLINE"):y="NEWLINE",G(i,m)&&o!==")"&&(o==="else"?y="SPACE":y="NEWLINE"),f.if_line&&s==="TK_END_EXPR"&&(f.if_line=!1),G(i.toLowerCase(),["else","catch","finally"])?s!=="TK_END_BLOCK"||N==="expand"||N==="end-expand"||N==="expand-strict"?q():(B(!0),R()):y==="NEWLINE"?Q(o)?R():s!=="TK_END_EXPR"?(s!=="TK_START_EXPR"||i!=="var")&&o!==":"&&(i==="if"&&a==="else"&&o!=="{"?R():(f.var_line=!1,f.var_line_reindented=!1,q())):G(i,m)&&o!==")"&&(f.var_line=!1,f.var_line_reindented=!1,q()):V(f.mode)&&o===","&&u==="}"?q():y==="SPACE"&&R(),U(),a=i,i==="var"&&(f.var_line=!0,f.var_line_reindented=!1,f.var_line_tainted=!1),i==="if"&&(f.if_line=!0),i==="else"&&(f.if_line=!1);break;case"TK_SEMICOLON":U(),f.var_line=!1,f.var_line_reindented=!1,f.mode==="OBJECT"&&(f.mode="BLOCK");break;case"TK_STRING":s==="TK_END_EXPR"&&G(f.previous_mode,["(COND-EXPRESSION)","(FOR-EXPRESSION)"])?R():s==="TK_COMMENT"||s==="TK_STRING"||s==="TK_START_BLOCK"||s==="TK_END_BLOCK"||s==="TK_SEMICOLON"?q():s==="TK_WORD"?R():L&&E&&(q(),r.push(c)),U();break;case"TK_EQUALS":f.var_line&&(f.var_line_tainted=!0),R(),U(),R();break;case"TK_COMMA":if(f.var_line){if($(f.mode)||s==="TK_END_BLOCK")f.var_line_tainted=!1;if(f.var_line_tainted){U(),f.var_line_reindented=!0,f.var_line_tainted=!1,q();break}f.var_line_tainted=!1,U(),R();break}s==="TK_COMMENT"&&q(),s==="TK_END_BLOCK"&&f.mode!=="(EXPRESSION)"?(U(),f.mode==="OBJECT"&&o==="}"?q():R()):f.mode==="OBJECT"?(U(),q()):(U(),R());break;case"TK_OPERATOR":var rt=!0,it=!0;if(Q(o)){R(),U();break}if(i==="*"&&s==="TK_DOT"&&!u.match(/^\d+$/)){U();break}if(i===":"&&f.in_case){f.case_body=!0,z(),U(),q(),f.in_case=!1;break}if(i==="::"){U();break}G(i,["--","++","!"])||G(i,["-","+"])&&(G(s,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||G(o,m))?(rt=!1,it=!1,o===";"&&$(f.mode)&&(rt=!0),s==="TK_WORD"&&G(o,m)&&(rt=!0),f.mode==="BLOCK"&&(o==="{"||o===";")&&q()):i===":"?f.ternary_depth===0?(f.mode==="BLOCK"&&(f.mode="OBJECT"),rt=!1):f.ternary_depth-=1:i==="?"&&(f.ternary_depth+=1),rt&&R(),U(),it&&R();break;case"TK_BLOCK_COMMENT":var st=F(i),ot;if(K(st.slice(1),"*")){q(),r.push(st[0]);for(ot=1;ot1?q():s==="TK_END_BLOCK"?q():R();for(ot=0;ot2;e==null&&(e=[]);if(h&&e.reduce===h)return r&&(t=S.bind(t,r)),i?e.reduce(t,n):e.reduce(t);x(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},S.reduceRight=S.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduceRight===p)return r&&(t=S.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=S.toArray(e).reverse();return r&&!i&&(t=S.bind(t,r)),i?S.reduce(s,t,n,r):S.reduce(s,t)},S.find=S.detect=function(e,t,n){var r;return T(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},S.filter=S.select=function(e,t,n){var r=[];return e==null?r:d&&e.filter===d?e.filter(t,n):(x(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},S.reject=function(e,t,n){var r=[];return e==null?r:(x(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)},S.every=S.all=function(e,t,r){var i=!0;return e==null?i:v&&e.every===v?e.every(t,r):(x(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var T=S.some=S.any=function(e,t,r){t||(t=S.identity);var i=!1;return e==null?i:m&&e.some===m?e.some(t,r):(x(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};S.include=S.contains=function(e,t){var n=!1;return e==null?n:g&&e.indexOf===g?e.indexOf(t)!=-1:(n=T(e,function(e){return e===t}),n)},S.invoke=function(e,t){var n=o.call(arguments,2);return S.map(e,function(e){return(S.isFunction(t)?t||e:e[t]).apply(e,n)})},S.pluck=function(e,t){return S.map(e,function(e){return e[t]})},S.max=function(e,t,n){if(!t&&S.isArray(e)&&e[0]===+e[0])return Math.max.apply(Math,e);if(!t&&S.isEmpty(e))return-Infinity;var r={computed:-Infinity};return x(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},S.min=function(e,t,n){if(!t&&S.isArray(e)&&e[0]===+e[0])return Math.min.apply(Math,e);if(!t&&S.isEmpty(e))return Infinity;var r={computed:Infinity};return x(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;or?1:0}),"value")},S.groupBy=function(e,t){var n={},r=S.isFunction(t)?t:function(e){return e[t]};return x(e,function(e,t){var i=r(e,t);(n[i]||(n[i]=[])).push(e)}),n},S.sortedIndex=function(e,t,n){n||(n=S.identity);var r=0,i=e.length;while(r>1;n(e[s])=0})})},S.difference=function(e){var t=S.flatten(o.call(arguments,1),!0);return S.filter(e,function(e){return!S.include(t,e)})},S.zip=function(){var e=o.call(arguments),t=S.max(S.pluck(e,"length")),n=new Array(t);for(var r=0;r=0;n--)t=[e[n].apply(this,t)];return t[0]}},S.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},S.keys=w||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)S.has(e,n)&&(t[t.length]=n);return t},S.values=function(e){return S.map(e,S.identity)},S.functions=S.methods=function(e){var t=[];for(var n in e)S.isFunction(e[n])&&t.push(n);return t.sort()},S.extend=function(e){return x(o.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e},S.pick=function(e){var t={};return x(S.flatten(o.call(arguments,1)),function(n){n in e&&(t[n]=e[n])}),t},S.defaults=function(e){return x(o.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},S.clone=function(e){return S.isObject(e)?S.isArray(e)?e.slice():S.extend({},e):e},S.tap=function(e,t){return t(e),e},S.isEqual=function(e,t){return C(e,t,[])},S.isEmpty=function(e){if(e==null)return!0;if(S.isArray(e)||S.isString(e))return e.length===0;for(var t in e)if(S.has(e,t))return!1;return!0},S.isElement=function(e){return!!e&&e.nodeType==1},S.isArray=b||function(e){return a.call(e)=="[object Array]"},S.isObject=function(e){return e===Object(e)},S.isArguments=function(e){return a.call(e)=="[object Arguments]"},S.isArguments(arguments)||(S.isArguments=function(e){return!!e&&!!S.has(e,"callee")}),S.isFunction=function(e){return a.call(e)=="[object Function]"},S.isString=function(e){return a.call(e)=="[object String]"},S.isNumber=function(e){return a.call(e)=="[object Number]"},S.isFinite=function(e){return S.isNumber(e)&&isFinite(e)},S.isNaN=function(e){return e!==e},S.isBoolean=function(e){return e===!0||e===!1||a.call(e)=="[object Boolean]"},S.isDate=function(e){return a.call(e)=="[object Date]"},S.isRegExp=function(e){return a.call(e)=="[object RegExp]"},S.isNull=function(e){return e===null},S.isUndefined=function(e){return e===void 0},S.has=function(e,t){return f.call(e,t)},S.noConflict=function(){return e._=t,this},S.identity=function(e){return e},S.times=function(e,t,n){for(var r=0;r/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")},S.result=function(e,t){if(e==null)return null;var n=e[t];return S.isFunction(n)?n.call(e):n},S.mixin=function(e){x(S.functions(e),function(t){B(t,S[t]=e[t])})};var k=0;S.uniqueId=function(e){var t=k++;return e?e+t:t},S.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/.^/,A={"\\":"\\","'":"'",r:"\r",n:"\n",t:" ",u2028:"\u2028",u2029:"\u2029"};for(var O in A)A[A[O]]=O;var M=/\\|'|\r|\n|\t|\u2028|\u2029/g,_=/\\(\\|'|r|n|t|u2028|u2029)/g,D=function(e){return e.replace(_,function(e,t){return A[t]})};S.template=function(e,t,n){n=S.defaults(n||{},S.templateSettings);var r="__p+='"+e.replace(M,function(e){return"\\"+A[e]}).replace(n.escape||L,function(e,t){return"'+\n_.escape("+D(t)+")+\n'"}).replace(n.interpolate||L,function(e,t){return"'+\n("+D(t)+")+\n'"}).replace(n.evaluate||L,function(e,t){return"';\n"+D(t)+"\n;__p+='"})+"';\n";n.variable||(r="with(obj||{}){\n"+r+"}\n"),r="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+r+"return __p;\n";var i=new Function(n.variable||"obj","_",r);if(t)return i(t,S);var s=function(e){return i.call(this,e,S)};return s.source="function("+(n.variable||"obj")+"){\n"+r+"}",s},S.chain=function(e){return S(e).chain()};var P=function(e){this._wrapped=e};S.prototype=P.prototype;var H=function(e,t){return t?S(e).chain():e},B=function(e,t){P.prototype[e]=function(){var e=o.call(arguments);return u.call(e,this._wrapped),H(t.apply(S,e),this._chain)}};S.mixin(S),x(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];P.prototype[e]=function(){var n=this._wrapped;t.apply(n,arguments);var r=n.length;return(e=="shift"||e=="splice")&&r===0&&delete n[0],H(n,this._chain)}}),x(["concat","join","slice"],function(e){var t=r[e];P.prototype[e]=function(){return H(t.apply(this._wrapped,arguments),this._chain)}}),P.prototype.chain=function(){return this._chain=!0,this},P.prototype.value=function(){return this._wrapped}}).call(this),function(){var e=this,t=e.Backbone,n=Array.prototype.slice,r=Array.prototype.splice,i;typeof exports!="undefined"?i=exports:i=e.Backbone={},i.VERSION="0.9.2";var s=e._;!s&&typeof require!="undefined"&&(s=require("underscore"));var o=e.jQuery||e.Zepto||e.ender;i.setDomLibrary=function(e){o=e},i.noConflict=function(){return e.Backbone=t,this},i.emulateHTTP=!1,i.emulateJSON=!1;var u=/\s+/,a=i.Events={on:function(e,t,n){var r,i,s,o,a;if(!t)return this;e=e.split(u),r=this._callbacks||(this._callbacks={});while(i=e.shift())a=r[i],s=a?a.tail:{},s.next=o={},s.context=n,s.callback=t,r[i]={tail:o,next:a?a.next:s};return this},off:function(e,t,n){var r,i,o,a,f,l;if(!(i=this._callbacks))return;if(!(e||t||n))return delete this._callbacks,this;e=e?e.split(u):s.keys(i);while(r=e.shift()){o=i[r],delete i[r];if(!o||!t&&!n)continue;a=o.tail;while((o=o.next)!==a)f=o.callback,l=o.context,(t&&f!==t||n&&l!==n)&&this.on(r,f,l)}return this},trigger:function(e){var t,r,i,s,o,a,f;if(!(i=this._callbacks))return this;a=i.all,e=e.split(u),f=n.call(arguments,1);while(t=e.shift()){if(r=i[t]){s=r.tail;while((r=r.next)!==s)r.callback.apply(r.context||this,f)}if(r=a){s=r.tail,o=[t].concat(f);while((r=r.next)!==s)r.callback.apply(r.context||this,o)}}return this}};a.bind=a.on,a.unbind=a.off;var f=i.Model=function(e,t){var n;e||(e={}),t&&t.parse&&(e=this.parse(e));if(n=C(this,"defaults"))e=s.extend({},n,e);t&&t.collection&&(this.collection=t.collection),this.attributes={},this._escapedAttributes={},this.cid=s.uniqueId("c"),this.changed={},this._silent={},this._pending={},this.set(e,{silent:!0}),this.changed={},this._silent={},this._pending={},this._previousAttributes=s.clone(this.attributes),this.initialize.apply(this,arguments)};s.extend(f.prototype,a,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return s.clone(this.attributes)},get:function(e){return this.attributes[e]},escape:function(e){var t;if(t=this._escapedAttributes[e])return t;var n=this.get(e);return this._escapedAttributes[e]=s.escape(n==null?"":""+n)},has:function(e){return this.get(e)!=null},set:function(e,t,n){var r,i,o;s.isObject(e)||e==null?(r=e,n=t):(r={},r[e]=t),n||(n={});if(!r)return this;r instanceof f&&(r=r.attributes);if(n.unset)for(i in r)r[i]=void 0;if(!this._validate(r,n))return!1;this.idAttribute in r&&(this.id=r[this.idAttribute]);var u=n.changes={},a=this.attributes,l=this._escapedAttributes,c=this._previousAttributes||{};for(i in r){o=r[i];if(!s.isEqual(a[i],o)||n.unset&&s.has(a,i))delete l[i],(n.silent?this._silent:u)[i]=!0;n.unset?delete a[i]:a[i]=o,!s.isEqual(c[i],o)||s.has(a,i)!=s.has(c,i)?(this.changed[i]=o,n.silent||(this._pending[i]=!0)):(delete this.changed[i],delete this._pending[i])}return n.silent||this.change(n),this},unset:function(e,t){return(t||(t={})).unset=!0,this.set(e,null,t)},clear:function(e){return(e||(e={})).unset=!0,this.set(s.clone(this.attributes),e)},fetch:function(e){e=e?s.clone(e):{};var t=this,n=e.success;return e.success=function(r,i,s){if(!t.set(t.parse(r,s),e))return!1;n&&n(t,r)},e.error=i.wrapError(e.error,t,e),(this.sync||i.sync).call(this,"read",this,e)},save:function(e,t,n){var r,o;s.isObject(e)||e==null?(r=e,n=t):(r={},r[e]=t),n=n?s.clone(n):{};if(n.wait){if(!this._validate(r,n))return!1;o=s.clone(this.attributes)}var u=s.extend({},n,{silent:!0});if(r&&!this.set(r,n.wait?u:n))return!1;var a=this,f=n.success;n.success=function(e,t,i){var o=a.parse(e,i);n.wait&&(delete n.wait,o=s.extend(r||{},o));if(!a.set(o,n))return!1;f?f(a,e):a.trigger("sync",a,e,n)},n.error=i.wrapError(n.error,a,n);var l=this.isNew()?"create":"update",c=(this.sync||i.sync).call(this,l,this,n);return n.wait&&this.set(o,u),c},destroy:function(e){e=e?s.clone(e):{};var t=this,n=e.success,r=function(){t.trigger("destroy",t,t.collection,e)};if(this.isNew())return r(),!1;e.success=function(i){e.wait&&r(),n?n(t,i):t.trigger("sync",t,i,e)},e.error=i.wrapError(e.error,t,e);var o=(this.sync||i.sync).call(this,"delete",this,e);return e.wait||r(),o},url:function(){var e=C(this,"urlRoot")||C(this.collection,"url")||k();return this.isNew()?e:e+(e.charAt(e.length-1)=="/"?"":"/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},change:function(e){e||(e={});var t=this._changing;this._changing=!0;for(var n in this._silent)this._pending[n]=!0;var r=s.extend({},e.changes,this._silent);this._silent={};for(var n in r)this.trigger("change:"+n,this,this.get(n),e);if(t)return this;while(!s.isEmpty(this._pending)){this._pending={},this.trigger("change",this,e);for(var n in this.changed){if(this._pending[n]||this._silent[n])continue;delete this.changed[n]}this._previousAttributes=s.clone(this.attributes)}return this._changing=!1,this},hasChanged:function(e){return arguments.length?s.has(this.changed,e):!s.isEmpty(this.changed)},changedAttributes:function(e){if(!e)return this.hasChanged()?s.clone(this.changed):!1;var t,n=!1,r=this._previousAttributes;for(var i in e){if(s.isEqual(r[i],t=e[i]))continue;(n||(n={}))[i]=t}return n},previous:function(e){return!arguments.length||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return s.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(e,t){if(t.silent||!this.validate)return!0;e=s.extend({},this.attributes,e);var n=this.validate(e,t);return n?(t&&t.error?t.error(this,n,t):this.trigger("error",this,n,t),!1):!0}});var l=i.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,{silent:!0,parse:t.parse})};s.extend(l.prototype,a,{model:f,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},add:function(e,t){var n,i,o,u,a,f,l={},c={},h=[];t||(t={}),e=s.isArray(e)?e.slice():[e];for(n=0,o=e.length;n').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?o(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!r?o(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var i=window.location,u=i.pathname==this.options.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!u)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&u&&i.hash&&(this.fragment=this.getHash().replace(g,""),window.history.replaceState({},document.title,i.protocol+"//"+i.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},stop:function(){o(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),m.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t==this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t==this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(e){var t=this.fragment=this.getFragment(e),n=s.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0});return n},navigate:function(e,t){if(!m.started)return!1;if(!t||t===!0)t={trigger:t};var n=(e||"").replace(g,"");if(this.fragment==n)return;this._hasPushState?(n.indexOf(this.options.root)!=0&&(n=this.options.root+n),this.fragment=n,window.history[t.replace?"replaceState":"pushState"]({},document.title,n)):this._wantsHashChange?(this.fragment=n,this._updateHash(window.location,n,t.replace),this.iframe&&n!=this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,n,t.replace))):window.location.assign(this.options.root+e),t.trigger&&this.loadUrl(e)},_updateHash:function(e,t,n){n?e.replace(e.toString().replace(/(javascript:|#).*$/,"")+"#"+t):e.hash=t}});var b=i.View=function(e){this.cid=s.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},w=/^(\S+)\s*(.*)$/,E=["model","collection","el","id","attributes","className","tagName"];s.extend(b.prototype,a,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(e,t,n){var r=document.createElement(e);return t&&o(r).attr(t),n&&o(r).html(n),r},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof o?e:o(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=C(this,"events")))return;this.undelegateEvents();for(var t in e){var n=e[t];s.isFunction(n)||(n=this[e[t]]);if(!n)throw new Error('Method "'+e[t]+'" does not exist');var r=t.match(w),i=r[1],o=r[2];n=s.bind(n,this),i+=".delegateEvents"+this.cid,o===""?this.$el.bind(i,n):this.$el.delegate(o,i,n)}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(e){this.options&&(e=s.extend({},this.options,e));for(var t=0,n=E.length;t3?m.length%3:0;return h+(g?m.substr(0,g)+s.thousand:"")+m.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+s.thousand)+(o?s.decimal+d(Math.abs(e),o).split(".")[1]:"")},m=n.formatMoney=function(e,t,r,i,s,o){if(u(e))return l(e,function(e){return m(e,t,r,i,s,o)});e=p(e);var d=f(a(t)?t:{symbol:t,precision:r,thousand:i,decimal:s,format:o},n.settings.currency),g=h(d.format),y=e>0?g.pos:e<0?g.neg:g.zero;return y.replace("%s",d.symbol).replace("%v",v(Math.abs(e),c(d.precision),d.thousand,d.decimal))};n.formatColumn=function(e,t,r,i,s,d){if(!e)return[];var m=f(a(t)?t:{symbol:t,precision:r,thousand:i,decimal:s,format:d},n.settings.currency),g=h(m.format),y=g.pos.indexOf("%s")0?g.pos:e<0?g.neg:g.zero,i=r.replace("%s",m.symbol).replace("%v",v(Math.abs(e),c(m.precision),m.thousand,m.decimal));return i.length>b&&(b=i.length),i});return l(w,function(e,t){return o(e)&&e.lengththis.maxSize)throw"Max collection size exceeded";return e.id||(e.id=e.attributes.id=t()),this.data[e.id]=_.extend({},e),e},find:function(e){return this.data[e.id]},findAll:function(){return _.values(this.data)},update:function(e){return this.data[e.id]=_.extend({},e),e},destroy:function(e){return delete this.data[e.id],e}}),Backbone.sync=function(e,t,n,r){typeof n=="function"&&(n={success:n,error:r});var i,s=t.collection||t,o=s.noPersistence;_.isUndefined(o)&&(s.noPersistence=new bnp.NoPersistence,o=s.noPersistence);switch(e){case"read":i=t.id?o.find(t):o.findAll();break;case"create":i=o.create(t);break;case"update":i=o.update(t);break;case"delete":i=o.destroy(t)}i?n.success(i):n.error("Record not found")}}(),function(e){"use strict";var t,n,r;typeof window=="undefined"?(t=require("underscore"),n=require("backbone"),r=module.exports=n):(t=window._,n=window.Backbone,r=window),n.Relational={showWarnings:!0},n.Semaphore={_permitsAvailable:null,_permitsUsed:0,acquire:function(){if(this._permitsAvailable&&this._permitsUsed>=this._permitsAvailable)throw new Error("Max permits acquired");this._permitsUsed++},release:function(){if(this._permitsUsed===0)throw new Error("All permits released");this._permitsUsed--},isLocked:function(){return this._permitsUsed>0},setAvailablePermits:function(e){if(this._permitsUsed>e)throw new Error("Available permits cannot be less than used permits");this._permitsAvailable=e}},n.BlockingQueue=function(){this._queue=[]},t.extend(n.BlockingQueue.prototype,n.Semaphore,{_queue:null,add:function(e){this.isBlocked()?this._queue.push(e):e()},process:function(){while(this._queue&&this._queue.length)this._queue.shift()()},block:function(){this.acquire()},unblock:function(){this.release(),this.isBlocked()||this.process()},isBlocked:function(){return this.isLocked()}}),n.Relational.eventQueue=new n.BlockingQueue,n.Store=function(){this._collections=[],this._reverseRelations=[],this._subModels=[],this._modelScopes=[r]},t.extend(n.Store.prototype,n.Events,{addModelScope:function(e){this._modelScopes.push(e)},addSubModels:function(e,t){this._subModels.push({superModelType:t,subModels:e})},setupSuperModel:function(e){t.find(this._subModels,function(n){return t.find(n.subModels,function(t,r){var i=this.getObjectByName(t);if(e===i)return n.superModelType._subModels[r]=e,e._superModel=n.superModelType,e._subModelTypeValue=r,e._subModelTypeAttribute=n.superModelType.prototype.subModelTypeAttribute,!0},this)},this)},addReverseRelation:function(e){var n=t.any(this._reverseRelations,function(n){return t.all(e,function(e,t){return e===n[t]})});if(!n&&e.model&&e.type){this._reverseRelations.push(e);var r=function(e,n){e.prototype.relations||(e.prototype.relations=[]),e.prototype.relations.push(n),t.each(e._subModels,function(e){r(e,n)},this)};r(e.model,e),this.retroFitRelation(e)}},retroFitRelation:function(e){var t=this.getCollection(e.model);t.each(function(t){if(!(t instanceof e.model))return;new e.type(t,e)},this)},getCollection:function(e){e instanceof n.RelationalModel&&(e=e.constructor);var r=e;while(r._superModel)r=r._superModel;var i=t.detect(this._collections,function(e){return e.model===r});return i||(i=this._createCollection(r)),i},getObjectByName:function(e){var n=e.split("."),r=null;return t.find(this._modelScopes,function(e){r=t.reduce(n,function(e,t){return e[t]},e);if(r&&r!==e)return!0},this),r},_createCollection:function(e){var t;return e instanceof n.RelationalModel&&(e=e.constructor),e.prototype instanceof n.RelationalModel&&(t=new n.Collection,t.model=e,this._collections.push(t)),t},resolveIdForItem:function(e,r){var i=t.isString(r)||t.isNumber(r)?r:null;return i===null&&(r instanceof n.RelationalModel?i=r.id:t.isObject(r)&&(i=r[e.prototype.idAttribute])),!i&&i!==0&&(i=null),i},find:function(e,t){var n=this.resolveIdForItem(e,t),r=this.getCollection(e);if(r){var i=r.get(n);if(i instanceof e)return i}return null},register:function(e){var t=this.getCollection(e);if(t){if(t.get(e))throw new Error("Cannot instantiate more than one Backbone.RelationalModel with the same id per type!");var n=e.collection;t.add(e),e.bind("destroy",this.unregister,this),e.collection=n}},update:function(e){var t=this.getCollection(e);t._onModelEvent("change:"+e.idAttribute,e,t)},unregister:function(e){e.unbind("destroy",this.unregister);var t=this.getCollection(e);t&&t.remove(e)}}),n.Relational.store=new n.Store,n.Relation=function(e,r){this.instance=e,r=t.isObject(r)?r:{},this.reverseRelation=t.defaults(r.reverseRelation||{},this.options.reverseRelation),this.reverseRelation.type=t.isString(this.reverseRelation.type)?n[this.reverseRelation.type]||n.Relational.store.getObjectByName(this.reverseRelation.type):this.reverseRelation.type,this.model=r.model||this.instance.constructor,this.options=t.defaults(r,this.options,n.Relation.prototype.options),this.key=this.options.key,this.keySource=this.options.keySource||this.key,this.keyDestination=this.options.keyDestination||this.keySource||this.key,this.relatedModel=this.options.relatedModel,t.isString(this.relatedModel)&&(this.relatedModel=n.Relational.store.getObjectByName(this.relatedModel));if(!this.checkPreconditions())return!1;e&&(this.keyContents=this.instance.get(this.keySource),this.key!==this.keySource&&this.instance.unset(this.keySource,{silent:!0}),this.instance._relations.push(this)),!this.options.isAutoRelation&&this.reverseRelation.type&&this.reverseRelation.key&&n.Relational.store.addReverseRelation(t.defaults({isAutoRelation:!0,model:this.relatedModel,relatedModel:this.model,reverseRelation:this.options},this.reverseRelation)),t.bindAll(this,"_modelRemovedFromCollection","_relatedModelAdded","_relatedModelRemoved"),e&&(this.initialize(),n.Relational.store.getCollection(this.instance).bind("relational:remove",this._modelRemovedFromCollection),n.Relational.store.getCollection(this.relatedModel).bind("relational:add",this._relatedModelAdded).bind("relational:remove",this._relatedModelRemoved))},n.Relation.extend=n.Model.extend,t.extend(n.Relation.prototype,n.Events,n.Semaphore,{options:{createModels:!0,includeInJSON:!0,isAutoRelation:!1},instance:null,key:null,keyContents:null,relatedModel:null,reverseRelation:null,related:null,_relatedModelAdded:function(e,t,n){var r=this;e.queue(function(){r.tryAddRelated(e,n)})},_relatedModelRemoved:function(e,t,n){this.removeRelated(e,n)},_modelRemovedFromCollection:function(e){e===this.instance&&this.destroy()},checkPreconditions:function(){var e=this.instance,r=this.key,i=this.model,s=this.relatedModel,o=n.Relational.showWarnings&&typeof console!="undefined";if(!i||!r||!s)return o&&console.warn("Relation=%o; no model, key or relatedModel (%o, %o, %o)",this,i,r,s),!1;if(i.prototype instanceof n.RelationalModel){if(s.prototype instanceof n.RelationalModel){if(this instanceof n.HasMany&&this.reverseRelation.type===n.HasMany)return o&&console.warn("Relation=%o; relation is a HasMany, and the reverseRelation is HasMany as well.",this),!1;if(e&&e._relations.length){var u=t.any(e._relations,function(e){var t=this.reverseRelation.key&&e.reverseRelation.key;return e.relatedModel===s&&e.key===r&&(!t||this.reverseRelation.key===e.reverseRelation.key)},this);if(u)return o&&console.warn("Relation=%o between instance=%o.%s and relatedModel=%o.%s already exists",this,e,r,s,this.reverseRelation.key),!1}return!0}return o&&console.warn("Relation=%o; relatedModel does not inherit from Backbone.RelationalModel (%o)",this,s),!1}return o&&console.warn("Relation=%o; model does not inherit from Backbone.RelationalModel (%o)",this,e),!1},setRelated:function(e,n){this.related=e,this.instance.acquire(),this.instance.set(this.key,e,t.defaults(n||{},{silent:!0})),this.instance.release()},_isReverseRelation:function(e){return e.instance instanceof this.relatedModel&&this.reverseRelation.key===e.key&&this.key===e.reverseRelation.key?!0:!1},getReverseRelations:function(e){var n=[],r=t.isUndefined(e)?this.related&&(this.related.models||[this.related]):[e];return t.each(r,function(e){t.each(e.getRelations(),function(e){this._isReverseRelation(e)&&n.push(e)},this)},this),n},sanitizeOptions:function(e){return e=e?t.clone(e):{},e.silent&&(e.silentChange=!0,delete e.silent),e},unsanitizeOptions:function(e){return e=e?t.clone(e):{},e.silentChange&&(e.silent=!0,delete e.silentChange),e},destroy:function(){n.Relational.store.getCollection(this.instance).unbind("relational:remove",this._modelRemovedFromCollection),n.Relational.store.getCollection(this.relatedModel).unbind("relational:add",this._relatedModelAdded).unbind("relational:remove",this._relatedModelRemoved),t.each(this.getReverseRelations(),function(e){e.removeRelated(this.instance)},this)}}),n.HasOne=n.Relation.extend({options:{reverseRelation:{type:"HasMany"}},initialize:function(){t.bindAll(this,"onChange"),this.instance.bind("relational:change:"+this.key,this.onChange);var e=this.findRelated({silent:!0});this.setRelated(e),t.each(this.getReverseRelations(),function(e){e.addRelated(this.instance)},this)},findRelated:function(e){var t=this.keyContents,n=null;if(t instanceof this.relatedModel)n=t;else if(t||t===0)n=this.relatedModel.findOrCreate(t,{create:this.options.createModels});return n},onChange:function(e,r,i){if(this.isLocked())return;this.acquire(),i=this.sanitizeOptions(i);var s=t.isUndefined(i._related),o=s?this.related:i._related;if(s){this.keyContents=r;if(r instanceof this.relatedModel)this.related=r;else if(r){var u=this.findRelated(i);this.setRelated(u)}else this.setRelated(null)}o&&this.related!==o&&t.each(this.getReverseRelations(o),function(e){e.removeRelated(this.instance,i)},this),t.each(this.getReverseRelations(),function(e){e.addRelated(this.instance,i)},this);if(!i.silentChange&&this.related!==o){var a=this;n.Relational.eventQueue.add(function(){a.instance.trigger("update:"+a.key,a.instance,a.related,i)})}this.release()},tryAddRelated:function(e,r){if(this.related)return;r=this.sanitizeOptions(r);var i=this.keyContents;if(i||i===0){var s=n.Relational.store.resolveIdForItem(this.relatedModel,i);!t.isNull(s)&&e.id===s&&this.addRelated(e,r)}},addRelated:function(e,t){if(e!==this.related){var n=this.related||null;this.setRelated(e),this.onChange(this.instance,e,{_related:n})}},removeRelated:function(e,t){if(!this.related)return;if(e===this.related){var n=this.related||null;this.setRelated(null),this.onChange(this.instance,e,{_related:n})}}}),n.HasMany=n.Relation.extend({collectionType:null,options:{reverseRelation:{type:"HasOne"},collectionType:n.Collection,collectionKey:!0,collectionOptions:{}},initialize:function(){t.bindAll(this,"onChange","handleAddition","handleRemoval","handleReset"),this.instance.bind("relational:change:"+this.key,this.onChange),this.collectionType=this.options.collectionType,t.isString(this.collectionType)&&(this.collectionType=n.Relational.store.getObjectByName(this.collectionType));if(!this.collectionType.prototype instanceof n.Collection)throw new Error("collectionType must inherit from Backbone.Collection");this.keyContents instanceof n.Collection?this.setRelated(this._prepareCollection(this.keyContents)):this.setRelated(this._prepareCollection()),this.findRelated({silent:!0})},_getCollectionOptions:function(){return t.isFunction(this.options.collectionOptions)?this.options.collectionOptions(this.instance):this.options.collectionOptions},_prepareCollection:function(e){this.related&&this.related.unbind("relational:add",this.handleAddition).unbind("relational:remove",this.handleRemoval).unbind("relational:reset",this.handleReset);if(!e||!(e instanceof n.Collection))e=new this.collectionType([],this._getCollectionOptions());e.model=this.relatedModel;if(this.options.collectionKey){var t=this.options.collectionKey===!0?this.options.reverseRelation.key:this.options.collectionKey;e[t]&&e[t]!==this.instance?n.Relational.showWarnings&&typeof console!="undefined"&&console.warn("Relation=%o; collectionKey=%s already exists on collection=%o",this,t,this.options.collectionKey):t&&(e[t]=this.instance)}return e.bind("relational:add",this.handleAddition).bind("relational:remove",this.handleRemoval).bind("relational:reset",this.handleReset),e},findRelated:function(e){if(this.keyContents){var r=[];this.keyContents instanceof n.Collection?r=this.keyContents.models:(this.keyContents=t.isArray(this.keyContents)?this.keyContents:[this.keyContents],t.each(this.keyContents,function(e){var t=null;if(e instanceof this.relatedModel)t=e;else if(e||e===0)t=this.relatedModel.findOrCreate(e,{create:this.options.createModels});t&&!this.related.getByCid(t)&&!this.related.get(t)&&r.push(t)},this)),r.length&&(e=this.unsanitizeOptions(e),this.related.add(r,e))}},onChange:function(e,r,i){i=this.sanitizeOptions(i),this.keyContents=r,t.each(this.getReverseRelations(),function(e){e.removeRelated(this.instance,i)},this);if(r instanceof n.Collection)this._prepareCollection(r),this.related=r;else{var s;this.related instanceof n.Collection?(s=this.related,s.remove(s.models)):s=this._prepareCollection(),this.setRelated(s),this.findRelated(i)}t.each(this.getReverseRelations(),function(e){e.addRelated(this.instance,i)},this);var o=this;n.Relational.eventQueue.add(function(){!i.silentChange&&o.instance.trigger("update:"+o.key,o.instance,o.related,i)})},tryAddRelated:function(e,r){r=this.sanitizeOptions(r);if(!this.related.getByCid(e)&&!this.related.get(e)){var i=t.any(this.keyContents,function(r){var i=n.Relational.store.resolveIdForItem(this.relatedModel,r);return!t.isNull(i)&&i===e.id},this);i&&this.related.add(e,r)}},handleAddition:function(e,r,i){if(!(e instanceof n.Model))return;i=this.sanitizeOptions(i),t.each(this.getReverseRelations(e),function(e){e.addRelated(this.instance,i)},this);var s=this;n.Relational.eventQueue.add(function(){!i.silentChange&&s.instance.trigger("add:"+s.key,e,s.related,i)})},handleRemoval:function(e,r,i){if(!(e instanceof n.Model))return;i=this.sanitizeOptions(i),t.each(this.getReverseRelations(e),function(e){e.removeRelated(this.instance,i)},this);var s=this;n.Relational.eventQueue.add(function(){!i.silentChange&&s.instance.trigger("remove:"+s.key,e,s.related,i)})},handleReset:function(e,t){t=this.sanitizeOptions(t);var r=this;n.Relational.eventQueue.add(function(){!t.silentChange&&r.instance.trigger("reset:"+r.key,r.related,t)})},addRelated:function(e,t){var n=this;t=this.unsanitizeOptions(t),e.queue(function(){n.related&&!n.related.getByCid(e)&&!n.related.get(e)&&n.related.add(e,t)})},removeRelated:function(e,t){t=this.unsanitizeOptions(t),(this.related.getByCid(e)||this.related.get(e))&&this.related.remove(e,t)}}),n.RelationalModel=n.Model.extend({relations:null,_relations:null,_isInitialized:!1,_deferProcessing:!1,_queue:null,subModelTypeAttribute:"type",subModelTypes:null,constructor:function(e,r){var i=this;if(r&&r.collection){this._deferProcessing=!0;var s=function(e){e===i&&(i._deferProcessing=!1,i.processQueue(),r.collection.unbind("relational:add",s))};r.collection.bind("relational:add",s),t.defer(function(){s(i)})}this._queue=new n.BlockingQueue,this._queue.block(),n.Relational.eventQueue.block(),n.Model.apply(this,arguments),n.Relational.eventQueue.unblock()},trigger:function(e){if(e.length>5&&"change"===e.substr(0,6)){var t=this,r=arguments;n.Relational.eventQueue.add(function(){n.Model.prototype.trigger.apply(t,r)})}else n.Model.prototype.trigger.apply(this,arguments);return this},initializeRelations:function(){this.acquire(),this._relations=[],t.each(this.relations,function(e){var r=t.isString(e.type)?n[e.type]||n.Relational.store.getObjectByName(e.type):e.type;r&&r.prototype instanceof n.Relation?new r(this,e):n.Relational.showWarnings&&typeof console!="undefined"&&console.warn("Relation=%o; missing or invalid type!",e)},this),this._isInitialized=!0,this.release(),this.processQueue()},updateRelations:function(e){this._isInitialized&&!this.isLocked()&&t.each(this._relations,function(t){var n=this.attributes[t.keySource]||this.attributes[t.key];t.related!==n&&this.trigger("relational:change:"+t.key,this,n,e||{})},this)},queue:function(e){this._queue.add(e)},processQueue:function(){this._isInitialized&&!this._deferProcessing&&this._queue.isBlocked()&&this._queue.unblock()},getRelation:function(e){return t.detect(this._relations,function(t){if(t.key===e)return!0},this)},getRelations:function(){return this._relations},fetchRelated:function(e,r,i){r||(r={});var s,o=[],u=this.getRelation(e),a=u&&u.keyContents,f=a&&t.select(t.isArray(a)?a:[a],function(e){var r=n.Relational.store.resolveIdForItem(u.relatedModel,e);return!t.isNull(r)&&(i||!n.Relational.store.find(u.relatedModel,r))},this);if(f&&f.length){var l=t.map(f,function(e){var n;if(t.isObject(e))n=u.relatedModel.build(e);else{var r={};r[u.relatedModel.prototype.idAttribute]=e,n=u.relatedModel.build(r)}return n},this);u.related instanceof n.Collection&&t.isFunction(u.related.url)&&(s=u.related.url(l));if(s&&s!==u.related.url()){var c=t.defaults({error:function(){var e=arguments;t.each(l,function(t){t.trigger("destroy",t,t.collection,r),r.error&&r.error.apply(t,e)})},url:s},r,{add:!0});o=[u.related.fetch(c)]}else o=t.map(l,function(e){var n=t.defaults({error:function(){e.trigger("destroy",e,e.collection,r),r.error&&r.error.apply(e,arguments)}},r);return e.fetch(n)},this)}return o},set:function(e,r,i){n.Relational.eventQueue.block();var s;t.isObject(e)||e==null?(s=e,i=r):(s={},s[e]=r);var o=n.Model.prototype.set.apply(this,arguments);return!this._isInitialized&&!this.isLocked()?(this.constructor.initializeModelHierarchy(),n.Relational.store.register(this),this.initializeRelations()):s&&this.idAttribute in s&&n.Relational.store.update(this),s&&this.updateRelations(i),n.Relational.eventQueue.unblock(),o},unset:function(e,t){n.Relational.eventQueue.block();var r=n.Model.prototype.unset.apply(this,arguments);return this.updateRelations(t),n.Relational.eventQueue.unblock(),r},clear:function(e){n.Relational.eventQueue.block();var t=n.Model.prototype.clear.apply(this,arguments);return this.updateRelations(e),n.Relational.eventQueue.unblock(),t},change:function(e){var t=this,r=arguments;n.Relational.eventQueue.add(function(){n.Model.prototype.change.apply(t,r)})},clone:function(){var e=t.clone(this.attributes);return t.isUndefined(e[this.idAttribute])||(e[this.idAttribute]=null),t.each(this.getRelations(),function(t){delete e[t.key]}),new this.constructor(e)},toJSON:function(){if(this.isLocked())return this.id;this.acquire();var e=n.Model.prototype.toJSON.call(this);return this.constructor._superModel&&!(this.constructor._subModelTypeAttribute in e)&&(e[this.constructor._subModelTypeAttribute]=this.constructor._subModelTypeValue),t.each(this._relations,function(r){var i=e[r.key];if(r.options.includeInJSON===!0)i&&t.isFunction(i.toJSON)?e[r.keyDestination]=i.toJSON():e[r.keyDestination]=null;else if(t.isString(r.options.includeInJSON))i instanceof n.Collection?e[r.keyDestination]=i.pluck(r.options.includeInJSON):i instanceof n.Model?e[r.keyDestination]=i.get(r.options.includeInJSON):e[r.keyDestination]=null;else if(t.isArray(r.options.includeInJSON))if(i instanceof n.Collection){var s=[];i.each(function(e){var n={};t.each(r.options.includeInJSON,function(t){n[t]=e.get(t)}),s.push(n)}),e[r.keyDestination]=s}else if(i instanceof n.Model){var s={};t.each(r.options.includeInJSON,function(e){s[e]=i.get(e)}),e[r.keyDestination]=s}else e[r.keyDestination]=null;else delete e[r.key];r.keyDestination!==r.key&&delete e[r.key]}),this.release(),e}},{setup:function(e){return this.prototype.relations=(this.prototype.relations||[]).slice(0),this._subModels={},this._superModel=null,this.prototype.hasOwnProperty("subModelTypes")?n.Relational.store.addSubModels(this.prototype.subModelTypes,this):this.prototype.subModelTypes=null,t.each(this.prototype.relations,function(e){e.model||(e.model=this);if(e.reverseRelation&&e.model===this){var r=!0;if(t.isString(e.relatedModel)){var i=n.Relational.store.getObjectByName(e.relatedModel);r=i&&i.prototype instanceof n.RelationalModel}var s=t.isString(e.type)?n[e.type]||n.Relational.store.getObjectByName(e.type):e.type;r&&s&&s.prototype instanceof n.Relation&&new s(null,e)}},this),this},build:function(e,t){var n=this;this.initializeModelHierarchy();if(this._subModels&&this.prototype.subModelTypeAttribute in e){var r=e[this.prototype.subModelTypeAttribute],i=this._subModels[r];i&&(n=i)}return new n(e,t)},initializeModelHierarchy:function(){if(t.isUndefined(this._superModel)||t.isNull(this._superModel)){n.Relational.store.setupSuperModel(this);if(this._superModel){if(this._superModel.prototype.relations){var e=t.any(this.prototype.relations,function(e){return e.model&&e.model!==this},this);e||(this.prototype.relations=this._superModel.prototype.relations.concat(this.prototype.relations))}}else this._superModel=!1}this.prototype.subModelTypes&&t.keys(this.prototype.subModelTypes).length!==t.keys(this._subModels).length&&t.each(this.prototype.subModelTypes,function(e){var t=n.Relational.store.getObjectByName(e);t&&t.initializeModelHierarchy()})},findOrCreate:function(e,r){var i=n.Relational.store.find(this,e);if(t.isObject(e))if(i)i.set(i.parse?i.parse(e):e,r );else if(!r||r&&r.create!==!1)i=this.build(e,r);return i}}),t.extend(n.RelationalModel.prototype,n.Semaphore),n.Collection.prototype.__prepareModel=n.Collection.prototype._prepareModel,n.Collection.prototype._prepareModel=function(e,t){t||(t={});if(e instanceof n.Model)e.collection||(e.collection=this);else{var r=e;t.collection=this,typeof this.model.findOrCreate!="undefined"?e=this.model.findOrCreate(r,t):e=new this.model(r,t),e._validate(e.attributes,t)||(e=!1)}return e};var i=n.Collection.prototype.__add=n.Collection.prototype.add;n.Collection.prototype.add=function(e,r){r||(r={}),t.isArray(e)||(e=[e]);var s=[];return t.each(e,function(e){e instanceof n.Model||(e=n.Collection.prototype._prepareModel.call(this,e,r)),e instanceof n.Model&&!this.get(e)&&!this.getByCid(e)&&s.push(e)},this),s.length&&(i.call(this,s,r),t.each(s,function(e){this.trigger("relational:add",e,this,r)},this)),this};var s=n.Collection.prototype.__remove=n.Collection.prototype.remove;n.Collection.prototype.remove=function(e,r){return r||(r={}),t.isArray(e)?e=e.slice(0):e=[e],t.each(e,function(e){e=this.getByCid(e)||this.get(e),e instanceof n.Model&&(s.call(this,e,r),this.trigger("relational:remove",e,this,r))},this),this};var o=n.Collection.prototype.__reset=n.Collection.prototype.reset;n.Collection.prototype.reset=function(e,t){return o.call(this,e,t),this.trigger("relational:reset",this,t),this};var u=n.Collection.prototype.__sort=n.Collection.prototype.sort;n.Collection.prototype.sort=function(e){return u.call(this,e),this.trigger("relational:reset",this,e),this};var a=n.Collection.prototype.__trigger=n.Collection.prototype.trigger;n.Collection.prototype.trigger=function(e){if(e==="add"||e==="remove"||e==="reset"){var r=this,i=arguments;e==="add"&&(i=t.toArray(i),t.isObject(i[3])&&(i[3]=t.clone(i[3]))),n.Relational.eventQueue.add(function(){a.apply(r,i)})}else a.apply(this,arguments);return this},n.RelationalModel.extend=function(e,t){var r=n.Model.extend.apply(this,arguments);return r.setup(this),r}}(),window.Store=function(e){this.name=e;var t=localStorage.getItem(this.name);this.records=t&&t.split(",")||[]},_.extend(Store.prototype,{save:function(){localStorage.setItem(this.name,this.records.join(","))},create:function(e){return e.id||(e.id=e.attributes.id=guid()),localStorage.setItem(this.name+"-"+e.id,JSON.stringify(e)),this.records.push(e.id.toString()),this.save(),e},update:function(e){return localStorage.setItem(this.name+"-"+e.id,JSON.stringify(e)),_.include(this.records,e.id.toString())||this.records.push(e.id.toString()),this.save(),e},find:function(e){return JSON.parse(localStorage.getItem(this.name+"-"+e.id))},findAll:function(){return _.map(this.records,function(e){return JSON.parse(localStorage.getItem(this.name+"-"+e))},this)},destroy:function(e){return localStorage.removeItem(this.name+"-"+e.id),this.records=_.reject(this.records,function(t){return t==e.id.toString()}),this.save(),e}}),Backbone.localSync=function(e,t,n,r){typeof n=="function"&&(n={success:n,error:r});var i,s=t.localStorage||t.collection.localStorage;switch(e){case"read":i=t.id!=undefined?s.find(t):s.findAll();break;case"create":i=s.create(t);break;case"update":i=s.update(t);break;case"delete":i=s.destroy(t)}i?n.success(i):n.error("Record not found")},Backbone.ajaxSync=Backbone.sync,Backbone.sync=Backbone.localSync;var I18n=I18n||{};I18n.defaultLocale="en",I18n.fallbacks=!1,I18n.defaultSeparator=".",I18n.locale=null,I18n.PLACEHOLDER=/(?:\{\{|%\{)(.*?)(?:\}\}?)/gm,I18n.fallbackRules={},I18n.pluralizationRules={en:function(e){return e==0?["zero","none","other"]:e==1?"one":"other"}},I18n.getFallbacks=function(e){if(e===I18n.defaultLocale)return[];if(!I18n.fallbackRules[e]){var t=[],n=e.split("-");for(var r=1;r0)o=e.shift(),s=s[o];if(!s){if(I18n.fallbacks){var u=this.getFallbacks(i);for(var a=0;a11?1:0,l=e.getSeconds(),c=e.getMinutes(),h=e.getTimezoneOffset(),p=Math.floor(Math.abs(h/60)),d=Math.abs(h)-p*60,v=(h>0?"-":"+")+(p.toString().length<2?"0"+p:p)+(d.toString().length<2?"0"+d:d);a>12?a-=12:a===0&&(a=12);var m=function(e){var t="0"+e.toString();return t.substr(t.length-2)},g=t;return g=g.replace("%a",n.abbr_day_names[r]),g=g.replace("%A",n.day_names[r]),g=g.replace("%b",n.abbr_month_names[o]),g=g.replace("%B",n.month_names[o]),g=g.replace("%d",m(i)),g=g.replace("%e",i),g=g.replace("%-d",i),g=g.replace("%H",m(u)),g=g.replace("%-H",u),g=g.replace("%I",m(a)),g=g.replace("%-I",a),g=g.replace("%m",m(o)),g=g.replace("%-m",o),g=g.replace("%M",m(c)),g=g.replace("%-M",c),g=g.replace("%p",n.meridian[f]),g=g.replace("%S",m(l)),g=g.replace("%-S",l),g=g.replace("%w",r),g=g.replace("%y",m(s)),g=g.replace("%-y",m(s).replace(/^0+/,"")),g=g.replace("%Y",s),g=g.replace("%z",v),g},I18n.toNumber=function(e,t){t=this.prepareOptions(t,this.lookup("number.format"),{precision:3,separator:".",delimiter:",",strip_insignificant_zeros:!1});var n=e<0,r=Math.abs(e).toFixed(t.precision).toString(),i=r.split("."),s,o=[],u;e=i[0],s=i[1];while(e.length>0)o.unshift(e.substr(Math.max(0,e.length-3),3)),e=e.substr(0,e.length-3);u=o.join(t.delimiter),t.precision>0&&(u+=t.separator+i[1]),n&&(u="-"+u);if(t.strip_insignificant_zeros){var a={separator:new RegExp(t.separator.replace(/\./,"\\.")+"$"),zeros:/0+$/};u=u.replace(a.zeros,"").replace(a.separator,"")}return u},I18n.toCurrency=function(e,t){return t=this.prepareOptions(t,this.lookup("number.currency.format"),this.lookup("number.format"),{unit:"$",precision:2,format:"%u%n",delimiter:",",separator:"."}),e=this.toNumber(e,t),e=t.format.replace("%u",t.unit).replace("%n",e),e},I18n.toHumanSize=function(e,t){var n=1024,r=e,i=0,s,o;while(r>=n&&i<4)r/=n,i+=1;return i===0?(s=this.t("number.human.storage_units.units.byte",{count:r}),o=0):(s=this.t("number.human.storage_units.units."+[null,"kb","mb","gb","tb"][i]),o=r-Math.floor(r)===0?0:1),t=this.prepareOptions(t,{precision:o,format:"%n%u",delimiter:""}),e=this.toNumber(r,t),e=t.format.replace("%u",s).replace("%n",e),e},I18n.toPercentage=function(e,t){return t=this.prepareOptions(t,this.lookup("number.percentage.format"),this.lookup("number.format"),{precision:3,separator:".",delimiter:""}),e=this.toNumber(e,t),e+"%"},I18n.pluralizer=function(e){return pluralizer=this.pluralizationRules[e],pluralizer!==undefined?pluralizer:this.pluralizationRules.en},I18n.findAndTranslateValidNode=function(e,t){for(i=0;i= 1.0.0"},e.helpers={},e.partials={};var n=Object.prototype.toString,r="[object Function]",i="[object Object]";e.registerHelper=function(t,r,s){if(n.call(t)===i){if(s||r)throw new e.Exception("Arg not supported with multiple helpers");e.Utils.extend(this.helpers,t)}else s&&(r.not=s),this.helpers[t]=r},e.registerPartial=function(t,r){n.call(t)===i?e.Utils.extend(this.partials,t):this.partials[t]=r},e.registerHelper("helperMissing",function(e){if(arguments.length===2)return t;throw new Error("Missing helper: '"+e+"'")}),e.registerHelper("blockHelperMissing",function(t,i){var s=i.inverse||function(){},o=i.fn,u=n.call(t);return u===r&&(t=t.call(this)),t===!0?o(this):t===!1||t==null?s(this):u==="[object Array]"?t.length>0?e.helpers.each(t,i):s(this):o(t)}),e.K=function(){},e.createFrame=Object.create||function(t){e.K.prototype=t;var n=new e.K;return e.K.prototype=null,n},e.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(t,n){if(e.logger.level<=t){var r=e.logger.methodMap[t];typeof console!="undefined"&&console[r]&&console[r].call(console,n)}}},e.log=function(t,n){e.logger.log(t,n)},e.registerHelper("each",function(t,i){var s=i.fn,o=i.inverse,u=0,a="",f,l=n.call(t);l===r&&(t=t.call(this)),i.data&&(f=e.createFrame(i.data));if(t&&typeof t=="object")if(t instanceof Array)for(var c=t.length;u2&&k.push("'"+this.terminals_[T]+"'");this.lexer.showPosition?L="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+(this.terminals_[g]||g)+"'":L="Parse error on line "+(a+1)+": Unexpected "+(g==1?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(L,{text:this.lexer.match,token:this.terminals_[g]||g,line:this.lexer.yylineno,loc:p,expected:k})}}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case 1:r.push(g),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(w[1]),g=null,y?(g=y,y=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:N=this.productions_[w[1]][1],x.$=i[i.length-N],x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column},d&&(x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]),S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!="undefined")return S;N&&(r=r.slice(0,-1*N*2),i=i.slice(0,-1*N),s=s.slice(0,-1*N)),r.push(this.productions_[w[1]][0]),i.push(x.$),s.push(x._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(t,n){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,n)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r,i,s;this._more||(this.yytext="",this.match="");var o=this._currentRules();for(var u=0;ut[0].length)){t=n,r=u;if(!this.options.flex)break}}if(t){s=t[0].match(/(?:\r\n?|\n).*/g),s&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1);if(e)return e;return}return this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return typeof t!="undefined"?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return e.options={},e.performAction=function(t,n,r,i){var s=i;switch(r){case 0:return n.yytext="\\",14;case 1:n.yytext.slice(-1)!=="\\"&&this.begin("mu"),n.yytext.slice(-1)==="\\"&&(n.yytext=n.yytext.substr(0,n.yyleng-1),this.begin("emu"));if(n.yytext)return 14;break;case 2:return 14;case 3:return n.yytext.slice(-1)!=="\\"&&this.popState(),n.yytext.slice(-1)==="\\"&&(n.yytext=n.yytext.substr(0,n.yyleng-1)),14;case 4:return n.yytext=n.yytext.substr(0,n.yyleng-4),this.popState(),15;case 5:return 25;case 6:return 16;case 7:return 20;case 8:return 19;case 9:return 19;case 10:return 23;case 11:return 22;case 12:this.popState(),this.begin("com");break;case 13:return n.yytext=n.yytext.substr(3,n.yyleng-5),this.popState(),15;case 14:return 22;case 15:return 37;case 16:return 36;case 17:return 36;case 18:return 40;case 19:break;case 20:return this.popState(),24;case 21:return this.popState(),18;case 22:return n.yytext=n.yytext.substr(1,n.yyleng-2).replace(/\\"/g,'"'),31;case 23:return n.yytext=n.yytext.substr(1,n.yyleng-2).replace(/\\'/g,"'"),31;case 24:return 38;case 25:return 33;case 26:return 33;case 27:return 32;case 28:return 36;case 29:return n.yytext=n.yytext.substr(1,n.yyleng-2),36;case 30:return"INVALID";case 31:return 5}},e.rules=[/^(?:\\\\(?=(\{\{)))/,/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[}\/ ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:-?[0-9]+(?=[}\s]))/,/^(?:[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],e.conditions={mu:{rules:[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],inclusive:!1},emu:{rules:[3],inclusive:!1},com:{rules:[4],inclusive:!1},INITIAL:{rules:[0,1,2,31],inclusive:!0}},e}();return e.lexer=t,n.prototype=e,e.Parser=n,new n}();e.Parser=s,e.parse=function(t){return t.constructor===e.AST.ProgramNode?t:(e.Parser.yy=e.AST,e.Parser.parse(t))},e.AST={},e.AST.ProgramNode=function(t,n){this.type="program",this.statements=t,n&&(this.inverse=new e.AST.ProgramNode(n))},e.AST.MustacheNode=function(e,t,n){this.type="mustache",this.escaped=!n,this.hash=t;var r=this.id=e[0],i=this.params=e.slice(1),s=this.eligibleHelper=r.isSimple;this.isHelper=s&&(i.length||t)},e.AST.PartialNode=function(e,t){this.type="partial",this.partialName=e,this.context=t},e.AST.BlockNode=function(t,n,r,i){var s=function(t,n){if(t.original!==n.original)throw new e.Exception(t.original+" doesn't match "+n.original)};s(t.id,i),this.type="block",this.mustache=t,this.program=n,this.inverse=r,this.inverse&&!this.program&&(this.isInverse=!0)},e.AST.ContentNode=function(e){this.type="content",this.string=e},e.AST.HashNode=function(e){this.type="hash",this.pairs=e},e.AST.IdNode=function(t){this.type="ID";var n="",r=[],i=0;for(var s=0,o=t.length;s0)throw new e.Exception("Invalid path: "+n);u===".."?i++:this.isScoped=!0}else r.push(u)}this.original=n,this.parts=r,this.string=r.join("."),this.depth=i,this.isSimple=t.length===1&&!this.isScoped&&i===0,this.stringModeValue=this.string},e.AST.PartialNameNode=function(e){this.type="PARTIAL_NAME",this.name=e.original},e.AST.DataNode=function(e){this.type="DATA",this.id=e},e.AST.StringNode=function(e){this.type="STRING",this.original=this.string=this.stringModeValue=e},e.AST.IntegerNode=function(e){this.type="INTEGER",this.original=this.integer=e,this.stringModeValue=Number(e)},e.AST.BooleanNode=function(e){this.type="BOOLEAN",this.bool=e,this.stringModeValue=e==="true"},e.AST.CommentNode=function(e){this.type="comment",this.comment=e};var o=["description","fileName","lineNumber","message","name","number","stack"];e.Exception=function(e){var t=Error.prototype.constructor.apply(this,arguments);for(var n=0;n":">",'"':""","'":"'","`":"`"},a=/[&<>"'`]/g,f=/[&<>"'`]/,l=function(e){return u[e]||"&"};e.Utils={extend:function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},escapeExpression:function(t){return t instanceof e.SafeString?t.toString():t==null||t===!1?"":(t=t.toString(),f.test(t)?t.replace(a,l):t)},isEmpty:function(e){return!e&&e!==0?!0:n.call(e)==="[object Array]"&&e.length===0?!0:!1}};var c=e.Compiler=function(){},h=e.JavaScriptCompiler=function(){};c.prototype={compiler:c,disassemble:function(){var e=this.opcodes,t,n=[],r,i;for(var s=0,o=e.length;sthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;if(e.length){this.inlineStack=[];for(var t=0,n=e.length;ts(a,"width"),f?(v=s(a,"height")-s(g,"height"),d=a.offset().top+v):(v=s(a,"width")-s(g,"width"),d=a.offset().left)}function O(){A(),r.setValue(n.value!==undefined?n.value:n.min)}var r=this,u=n.css,a=e("
").data("rangeinput",r),f,l,c=!1,h=!1,p,d,v,m;t.before(a);var g=a.addClass(u.slider).find("a").addClass(u.handle),y=a.find("div").addClass(u.progress);e.each("min,max,step,value".split(","),function(e,r){var i=t.attr(r);parseFloat(i)&&(n[r]=parseFloat(i,10))});var b=n.max-n.min,w=n.step=="any"?0:n.step,E=n.precision;if(E===undefined)try{E=w.toString().split(".")[1].length}catch(S){E=0}if(t.attr("type")=="range"){var x=t.clone().wrap("
").parent().html(),T=e(x.replace(/type/i,"type=text data-orig-type"));T.val(n.value),t.replaceWith(T),t=T}t.addClass(u.input);var N=e(r).add(t),C=!0;e.extend(r,{getValue:function(){return l},getDisplayValue:function(){return p},setValue:function(t,n){return A(),k(n||e.Event("api"),undefined,t,!0)},getConf:function(){return n},updateFromInput:function(e){return L(e),this},suppressChangeValue:function(e){return typeof e=="boolean"&&(h=e),this},getProgress:function(){return y},getHandle:function(){return g},getInput:function(){return t},step:function(t,i){i=i||e.Event();var s=n.step=="any"?1:n.step;r.setValue(l+s*(t||1),i)},stepUp:function(e){return r.step(e||1)},stepDown:function(e){return r.step(-e||-1)}}),e.each("onSlide,change".split(","),function(t,i){e.isFunction(n[i])&&e(r).bind(i,n[i]),r[i]=function(t){return t&&e(r).bind(i,t),r}}),g.drag({drag:!1}).bind("dragStart",function(){A(),C=o(e(r))||o(t)}).bind("drag",function(e,n,r){if(t.is(":disabled"))return!1;k(e,f?n:r)}).bind("dragEnd",function(e){e.isDefaultPrevented()||(e.type="change",N.trigger(e,[l]),N.trigger("changeValue",[l]))}).click(function(e){return e.preventDefault()}),a.click(function(e){if(t.is(":disabled")||e.target==g[0])return e.preventDefault();A();var n=f?g.height()/2:g.width()/2;k(e,f?v-d-n+e.pageY:e.pageX-d-n)}),n.keyboard&&t.keydown(function(n){if(t.attr("readonly"))return;var i=n.keyCode,s=e([75,76,38,33,39]).index(i)!=-1,o=e([74,72,40,34,37]).index(i)!=-1;if((s||o)&&!(n.shiftKey||n.altKey||n.ctrlKey))return s?r.step(i==33?10:1,n):o&&r.step(i==34?-10:-1,n),n.preventDefault()}),t.blur(function(t){var i=e(this).val();i=n.parseValue?n.parseValue(i):i,i!==l&&r.setValue(i,t)}),e.extend(t[0],{stepUp:r.stepUp,stepDown:r.stepDown}),O(),v||e(window).load(O)}e.tools=e.tools||{version:"1.2.6.R8"};var t;t=e.tools.rangeinput={conf:{min:0,max:100,step:"any",steps:0,value:0,precision:undefined,vertical:0,keyboard:!0,progress:!1,speed:100,formatValue:null,parseValue:null,css:{input:"range",slider:"slider",progress:"progress",handle:"handle"}}};var n,r;e.fn.drag=function(t){return t=e.extend({x:!0,y:!0,drag:!0,_ie_disableDragStart:!0},t),e.browser.msie&&this.bind("dragstart",function(){return!1}),n=n||e(document).bind("mousedown mouseup touchstart touchend",function(i){var s=e(i.target);if(i.type!="mousedown"&&i.type!="touchstart"||!s.data("drag"))try{r&&r.trigger("dragEnd")}finally{n.unbind("mousemove.drag touchmove.drag"),r=null}else{var o,u;i.type=="touchstart"?(o=i.originalEvent.targetTouches[0].pageX,u=i.originalEvent.targetTouches[0].pageY):(o=i.pageX,u=i.pageY);var a=s.position(),f=o-a.left,l=u-a.top,c=!0;n.bind("mousemove.drag touchmove.drag",function(e){var n,i;e.type=="touchmove"?(n=e.originalEvent.targetTouches[0].pageX,i=e.originalEvent.targetTouches[0].pageY):(n=e.pageX,i=e.pageY);var o=n-f,u=i-l,a={};t.x&&(a.left=o),t.y&&(a.top=u),c&&(s.trigger("dragStart"),c=!1),t.drag&&s.css(a),s.trigger("drag",[u,o]),r=s}),i.preventDefault()}}),this.data("drag",!0)},e.expr[":"].range=function(t){var n=t.getAttribute("type");return n&&n=="range"||!!e(t).filter("input").data("rangeinput")},e.fn.rangeinput=function(n){if(this.data("rangeinput"))return this;n=e.extend(!0,{},t.conf,n);var r;return this.each(function(){var t=new u(e(this),e.extend(!0,{},n)),i=t.getInput().data("rangeinput",t);r=r?r.add(i):i}),r?r:this}}(jQuery),window.Modernizr=function(e,t,n){function r(e){p.cssText=e}function i(e,t){return r(m.join(e+";")+(t||""))}function s(e,t){return typeof e===t}function o(e,t){return!!~(""+e).indexOf(t)}function u(e,t,r){for(var i in e){var o=t[e[i]];if(o!==n)return r===!1?e[i]:s(o,"function")?o.bind(r||t):o}return!1}var a="2.6.2",f={},l=t.documentElement,c="modernizr",h=t.createElement(c),p=h.style,d,v={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),g={},y={},b={},w=[],E=w.slice,S,x=function(e,n,r,i){var s,o,u,a,f=t.createElement("div"),h=t.body,p=h||t.createElement("body");if(parseInt(r,10))while(r--)u=t.createElement("div"),u.id=i?i[r]:c+(r+1),f.appendChild(u);return s=["­",'"].join(""),f.id=c,(h?f:p).innerHTML+=s,p.appendChild(f),h||(p.style.background="",p.style.overflow="hidden",a=l.style.overflow,l.style.overflow="hidden",l.appendChild(p)),o=n(f,e),h?f.parentNode.removeChild(f):(p.parentNode.removeChild(p),l.style.overflow=a),!!o},T={}.hasOwnProperty,N;!s(T,"undefined")&&!s(T.call,"undefined")?N=function(e,t){return T.call(e,t)}:N=function(e,t){return t in e&&s(e.constructor.prototype[t],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!="function")throw new TypeError;var n=E.call(arguments,1),r=function(){if(this instanceof r){var i=function(){};i.prototype=t.prototype;var s=new i,o=t.apply(s,n.concat(E.call(arguments)));return Object(o)===o?o:s}return t.apply(e,n.concat(E.call(arguments)))};return r}),g.touch=function(){var n;return"ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch?n=!0:x(["@media (",m.join("touch-enabled),("),c,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(e){n=e.offsetTop===9}),n};for(var C in g)N(g,C)&&(S=C.toLowerCase(),f[S]=g[C](),w.push((f[S]?"":"no-")+S));return f.addTest=function(e,t){if(typeof e=="object")for(var r in e)N(e,r)&&f.addTest(r,e[r]);else{e=e.toLowerCase();if(f[e]!==n)return f;t=typeof t=="function"?t():t,typeof enableClasses!="undefined"&&enableClasses&&(l.className+=" "+(t?"":"no-")+e),f[e]=t}return f},r(""),h=d=null,f._version=a,f._prefixes=m,f.testStyles=x,f}(this,this.document),function(e){function n(t,n,r){var i=r.relative?t.position().top:t.offset().top,s=r.relative?t.position().left:t.offset().left,o=r.position[0];i-=n.outerHeight()-r.offset[0],s+=t.outerWidth()+r.offset[1],/iPad/i.test(navigator.userAgent)&&(i-=e(window).scrollTop());var u=n.outerHeight()+t.outerHeight();o=="center"&&(i+=u/2),o=="bottom"&&(i+=u),o=r.position[1];var a=n.outerWidth()+t.outerWidth();return o=="center"&&(s-=a/2),o=="left"&&(s-=a),{top:i,left:s}}function r(r,i){var s=this,o=r.add(s),u,a=0,f=0,l=r.attr("title"),c=r.attr("data-tooltip"),h=t[i.effect],p,d=r.is(":input"),v=d&&r.is(":checkbox, :radio, select, :button, :submit"),m=r.attr("type"),g=i.events[m]||i.events[d?v?"widget":"input":"def"];if(!h)throw'Nonexistent effect "'+i.effect+'"';g=g.split(/,\s*/);if(g.length!=2)throw"Tooltip: bad events configuration for "+m;r.bind(g[0],function(e){clearTimeout(a),i.predelay?f=setTimeout(function(){s.show(e)},i.predelay):s.show(e)}).bind(g[1],function(e){clearTimeout(f),i.delay?a=setTimeout(function(){s.hide(e)},i.delay):s.hide(e)}),l&&i.cancelDefault&&(r.removeAttr("title"),r.data("title",l)),e.extend(s,{show:function(t){if(!u){c?u=e(c):i.tip?u=e(i.tip).eq(0):l?u=e(i.layout).addClass(i.tipClass).appendTo(document.body).hide().append(l):(u=r.next(),u.length||(u=r.parent().next()));if(!u.length)throw"Cannot find tooltip for "+r}if(s.isShown())return s;u.stop(!0,!0);var d=n(r,u,i);i.tip&&u.html(r.data("title")),t=e.Event(),t.type="onBeforeShow",o.trigger(t,[d]);if(t.isDefaultPrevented())return s;d=n(r,u,i),u.css({position:"absolute",top:d.top,left:d.left}),p=!0,h[0].call(s,function(){t.type="onShow",p="full",o.trigger(t)});var v=i.events.tooltip.split(/,\s*/);return u.data("__set")||(u.unbind(v[0]).bind(v[0],function(){clearTimeout(a),clearTimeout(f)}),v[1]&&!r.is("input:not(:checkbox, :radio), textarea")&&u.unbind(v[1]).bind(v[1],function(e){e.relatedTarget!=r[0]&&r.trigger(g[1].split(" ")[0])}),i.tip||u.data("__set",!0)),s},hide:function(n){if(!u||!s.isShown())return s;n=e.Event(),n.type="onBeforeHide",o.trigger(n);if(n.isDefaultPrevented())return;return p=!1,t[i.effect][1].call(s,function(){n.type="onHide",o.trigger(n)}),s},isShown:function(e){return e?p=="full":p},getConf:function(){return i},getTip:function(){return u},getTrigger:function(){return r}}),e.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(t,n){e.isFunction(i[n])&&e(s).bind(n,i[n]),s[n]=function(t){return t&&e(s).bind(n,t),s}})}e.tools=e.tools||{version:"1.2.6.R8"},e.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"
",tipClass:"tooltip"},addEffect:function(e,n,r){t[e]=[n,r]}};var t={toggle:[function(e){var t=this.getConf(),n=this.getTip(),r=t.opacity;r<1&&n.css({opacity:r}),n.show(),e.call()},function(e){this.getTip().hide(),e.call()}],fade:[function(t){var n=this.getConf();!e.browser.msie||n.fadeIE?this.getTip().fadeTo(n.fadeInSpeed,n.opacity,t):(this.getTip().show(),t())},function(t){var n=this.getConf();!e.browser.msie||n.fadeIE?this.getTip().fadeOut(n.fadeOutSpeed,t):(this.getTip().hide(),t())}]};e.fn.tooltip=function(t){var n=this.data("tooltip");return n?n:(t=e.extend(!0,{},e.tools.tooltip.conf,t),typeof t.position=="string"&&(t.position=t.position.split(/,?\s/)),this.each(function(){n=new r(e(this),t),e(this).data("tooltip",n)}),t.api?n:this)}}(jQuery),function(e,t){function n(t,n){var i=t.nodeName.toLowerCase();if("area"===i){var s=t.parentNode,o=s.name,u;return!t.href||!o||s.nodeName.toLowerCase()!=="map"?!1:(u=e("img[usemap=#"+o+"]")[0],!!u&&r(u))}return(/input|select|textarea|button|object/.test(i)?!t.disabled:"a"==i?t.href||n:n)&&r(t)}function r(t){return!e(t).parents().andSelf().filter(function(){return e.curCSS(this,"visibility")==="hidden"||e.expr.filters.hidden(this)}).length}e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.8.21",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),e.fn.extend({propAttr:e.fn.prop||e.fn.attr,_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.curCSS(this,"position",1))&&/(auto|scroll)/.test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",1)+e.curCSS(this,"overflow-x",1))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",1)+e.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.each(["Width","Height"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.curCSS(t,"padding"+this,!0))||0,r&&(n-=parseFloat(e.curCSS(t,"border"+this+"Width",!0))||0),s&&(n-=parseFloat(e.curCSS(t,"margin"+this,!0))||0)}),n}var i=r==="Width"?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?o["inner"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?o["outer"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+"px")})}}),e.extend(e.expr[":"],{data:function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return n(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var r=e.attr(t,"tabindex"),i=isNaN(r);return(i||r>=0)&&n(t,!i)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement("div"));n.offsetHeight,e.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart="onselectstart"in n,t.removeChild(n).style.display="none"}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i=e.ui[t].prototype;for(var s in r)i.plugins[s]=i.plugins[s]||[],i.plugins[s].push([n,r[s]])},call:function(e,t,n){var r=e.plugins[t];if(!r||!e.element[0].parentNode)return;for(var i=0;i0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,i=r.primary&&r.secondary,s=[];r.primary||r.secondary?(this.options.text&&s.push("ui-button-text-icon"+(i?"s":r.primary?"-primary":"-secondary")),r.primary&&t.prepend(""),r.secondary&&t.append(""),this.options.text||(s.push(i?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",n))):s.push("ui-button-text-only"),t.addClass(s.join(" "))}}),e.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(t,n){t==="disabled"&&this.buttons.button("option",t,n),e.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var t=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().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.Widget.prototype.destroy.call(this)}})}(jQuery),function(e,t){e.ui=e.ui||{};var n=/left|center|right/,r=/top|center|bottom/,i="center",s={},o=e.fn.position,u=e.fn.offset;e.fn.position=function(t){if(!t||!t.of)return o.apply(this,arguments);t=e.extend({},t);var u=e(t.of),a=u[0],f=(t.collision||"flip").split(" "),l=t.offset?t.offset.split(" "):[0,0],c,h,p;return a.nodeType===9?(c=u.width(),h=u.height(),p={top:0,left:0}):a.setTimeout?(c=u.width(),h=u.height(),p={top:u.scrollTop(),left:u.scrollLeft()}):a.preventDefault?(t.at="left top",c=h=0,p={top:t.of.pageY,left:t.of.pageX}):(c=u.outerWidth(),h=u.outerHeight(),p=u.offset()),e.each(["my","at"],function(){var e=(t[this]||"").split(" ");e.length===1&&(e=n.test(e[0])?e.concat([i]):r.test(e[0])?[i].concat(e):[i,i]),e[0]=n.test(e[0])?e[0]:i,e[1]=r.test(e[1])?e[1]:i,t[this]=e}),f.length===1&&(f[1]=f[0]),l[0]=parseInt(l[0],10)||0,l.length===1&&(l[1]=l[0]),l[1]=parseInt(l[1],10)||0,t.at[0]==="right"?p.left+=c:t.at[0]===i&&(p.left+=c/2),t.at[1]==="bottom"?p.top+=h:t.at[1]===i&&(p.top+=h/2),p.left+=l[0],p.top+=l[1],this.each(function(){var n=e(this),r=n.outerWidth(),o=n.outerHeight(),u=parseInt(e.curCSS(this,"marginLeft",!0))||0,a=parseInt(e.curCSS(this,"marginTop",!0))||0,d=r+u+(parseInt(e.curCSS(this,"marginRight",!0))||0),v=o+a+(parseInt(e.curCSS(this,"marginBottom",!0))||0),m=e.extend({},p),g;t.my[0]==="right"?m.left-=r:t.my[0]===i&&(m.left-=r/2),t.my[1]==="bottom"?m.top-=o:t.my[1]===i&&(m.top-=o/2),s.fractions||(m.left=Math.round(m.left),m.top=Math.round(m.top)),g={left:m.left-u,top:m.top-a},e.each(["left","top"],function(n,i){e.ui.position[f[n]]&&e.ui.position[f[n]][i](m,{targetWidth:c,targetHeight:h,elemWidth:r,elemHeight:o,collisionPosition:g,collisionWidth:d,collisionHeight:v,offset:l,my:t.my,at:t.at})}),e.fn.bgiframe&&n.bgiframe(),n.offset(e.extend(m,{using:t.using}))})},e.ui.position={fit:{left:function(t,n){var r=e(window),i=n.collisionPosition.left+n.collisionWidth-r.width()-r.scrollLeft();t.left=i>0?t.left-i:Math.max(t.left-n.collisionPosition.left,t.left)},top:function(t,n){var r=e(window),i=n.collisionPosition.top+n.collisionHeight-r.height()-r.scrollTop();t.top=i>0?t.top-i:Math.max(t.top-n.collisionPosition.top,t.top)}},flip:{left:function(t,n){if(n.at[0]===i)return;var r=e(window),s=n.collisionPosition.left+n.collisionWidth-r.width()-r.scrollLeft(),o=n.my[0]==="left"?-n.elemWidth:n.my[0]==="right"?n.elemWidth:0,u=n.at[0]==="left"?n.targetWidth:-n.targetWidth,a=-2*n.offset[0];t.left+=n.collisionPosition.left<0?o+u+a:s>0?o+u+a:0},top:function(t,n){if(n.at[1]===i)return;var r=e(window),s=n.collisionPosition.top+n.collisionHeight-r.height()-r.scrollTop(),o=n.my[1]==="top"?-n.elemHeight:n.my[1]==="bottom"?n.elemHeight:0,u=n.at[1]==="top"?n.targetHeight:-n.targetHeight,a=-2*n.offset[1];t.top+=n.collisionPosition.top<0?o+u+a:s>0?o+u+a:0}}},e.offset.setOffset||(e.offset.setOffset=function(t,n){/static/.test(e.curCSS(t,"position"))&&(t.style.position="relative");var r=e(t),i=r.offset(),s=parseInt(e.curCSS(t,"top",!0),10)||0,o=parseInt(e.curCSS(t,"left",!0),10)||0,u={top:n.top-i.top+s,left:n.left-i.left+o};"using"in n?n.using.call(t,u):r.css(u)},e.fn.offset=function(t){var n=this[0];return!n||!n.ownerDocument?null:t?e.isFunction(t)?this.each(function(n){e(this).offset(t.call(this,n,e(this).offset()))}):this.each(function(){e.offset.setOffset(this,t)}):u.call(this)}),function(){var t=document.getElementsByTagName("body")[0],n=document.createElement("div"),r,i,o,u,a;r=document.createElement(t?"div":"body"),o={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},t&&e.extend(o,{position:"absolute",left:"-1000px",top:"-1000px"});for(var f in o)r.style[f]=o[f];r.appendChild(n),i=t||document.documentElement,i.insertBefore(r,i.firstChild),n.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",u=e(n).offset(function(e,t){return t}).offset(),r.innerHTML="",i.removeChild(r),a=u.top+u.left+(t?2e3:0),s.fractions=a>21&&a<22}()}(jQuery),function(e){e.widget("ui.selectmenu",{getter:"value",version:"1.9",eventPrefix:"selectmenu",options:{transferClasses:!0,typeAhead:1e3,style:"dropdown",positionOptions:{my:"left top",at:"left bottom",offset:null},width:null,menuWidth:null,handleWidth:26,maxHeight:null,icons:null,format:null,bgImage:function(){},wrapperElement:"
"},_create:function(){var t=this,n=this.options,r=(this.element.attr("id")||"ui-selectmenu-"+Math.random().toString(16).slice(2,10)).replace(":","\\:");this.ids=[r,r+"-button",r+"-menu"],this._safemouseup=!0,this.isOpen=!1,this.newelement=e("",{"class":this.widgetBaseClass+" ui-widget ui-state-default ui-corner-all",id:this.ids[1],role:"combobox","aria-labelledby":n.label,href:"#",tabindex:this.element.attr("disabled")?1:0,"aria-haspopup":!1,"aria-owns":this.ids[2]}),this.newelementWrap=e(n.wrapperElement).append(this.newelement).insertAfter(this.element);var i=this.element.attr("tabindex");i&&this.newelement.attr("tabindex",i),this.newelement.data("selectelement",this.element),this.selectmenuIcon=e('').prependTo(this.newelement),this.newelement.prepend(''),this.element.bind({"click.selectmenu":function(e){t.newelement.focus(),e.preventDefault()}}),this.newelement.bind("mousedown.selectmenu",function(e){return t._toggle(e,!0),n.style=="popup"&&(t._safemouseup=!1,setTimeout(function(){t._safemouseup=!0},300)),!1}).bind("click.selectmenu",function(){return!1}).bind("keydown.selectmenu",function(n){var r=!1;switch(n.keyCode){case e.ui.keyCode.ENTER:r=!0;break;case e.ui.keyCode.SPACE:t._toggle(n);break;case e.ui.keyCode.UP:n.altKey?t.open(n):t._moveSelection(-1);break;case e.ui.keyCode.DOWN:n.altKey?t.open(n):t._moveSelection(1);break;case e.ui.keyCode.LEFT:t._moveSelection(-1);break;case e.ui.keyCode.RIGHT:t._moveSelection(1);break;case e.ui.keyCode.TAB:r=!0;break;case e.ui.keyCode.HOME:t.index(0);break;default:r=!0}return r}).bind("keypress.selectmenu",function(e){return e.which>0&&t._typeAhead(e.which,"mouseup"),!0}).bind("mouseover.selectmenu focus.selectmenu",function(){n.disabled||e(this).addClass(t.widgetBaseClass+"-focus ui-state-hover")}).bind("mouseout.selectmenu blur.selectmenu",function(){n.disabled||e(this).removeClass(t.widgetBaseClass+"-focus ui-state-hover")}),e(document).bind("mousedown.selectmenu-"+this.ids[0],function(e){t.isOpen&&t.close(e)}),this.element.bind("click.selectmenu",function(){t._refreshValue()}).bind("focus.selectmenu",function(){t.newelement&&t.newelement[0].focus()}),n.width||(n.width=this.element.outerWidth()),this.newelement.width(n.width),this.element.hide(),this.list=e("
    ",{"class":"ui-widget ui-widget-content","aria-hidden":!0,role:"listbox","aria-labelledby":this.ids[1],id:this.ids[2]}),this.listWrap=e(n.wrapperElement).addClass(t.widgetBaseClass+"-menu").append(this.list).appendTo("body"),this.list.bind("keydown.selectmenu",function(n){var r=!1;switch(n.keyCode){case e.ui.keyCode.UP:n.altKey?t.close(n,!0):t._moveFocus(-1);break;case e.ui.keyCode.DOWN:n.altKey?t.close(n,!0):t._moveFocus(1);break;case e.ui.keyCode.LEFT:t._moveFocus(-1);break;case e.ui.keyCode.RIGHT:t._moveFocus(1);break;case e.ui.keyCode.HOME:t._moveFocus(":first");break;case e.ui.keyCode.PAGE_UP:t._scrollPage("up");break;case e.ui.keyCode.PAGE_DOWN:t._scrollPage("down");break;case e.ui.keyCode.END:t._moveFocus(":last");break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:t.close(n,!0),e(n.target).parents("li:eq(0)").trigger("mouseup");break;case e.ui.keyCode.TAB:r=!0,t.close(n,!0),e(n.target).parents("li:eq(0)").trigger("mouseup");break;case e.ui.keyCode.ESCAPE:t.close(n,!0);break;default:r=!0}return r}).bind("keypress.selectmenu",function(e){return e.which>0&&t._typeAhead(e.which,"focus"),!0}).bind("mousedown.selectmenu mouseup.selectmenu",function(){return!1}),e(window).bind("resize.selectmenu-"+this.ids[0],e.proxy(t.close,this))},_init:function(){var t=this,n=this.options,r=[];this.element.find("option").each(function(){var i=e(this);r.push({value:i.attr("value"),text:t._formatText(i.text()),selected:i.attr("selected"),disabled:i.attr("disabled"),classes:i.attr("class"),typeahead:i.attr("typeahead"),parentOptGroup:i.parent("optgroup"),bgImage:n.bgImage.call(i)})});var i=t.options.style=="popup"?" ui-state-active":"";this.list.html("");if(r.length)for(var s=0;s",u),f=e("
  • ",o).append(a).data("index",s).addClass(r[s].classes).data("optionClasses",r[s].classes||"").bind("mouseup.selectmenu",function(n){if(t._safemouseup&&!t._disabled(n.currentTarget)&&!t._disabled(e(n.currentTarget).parents("ul>li."+t.widgetBaseClass+"-group "))){var r=e(this).data("index")!=t._selectedIndex();t.index(e(this).data("index")),t.select(n),r&&t.change(n),t.close(n,!0)}return!1}).bind("click.selectmenu",function(){return!1}).bind("mouseover.selectmenu focus.selectmenu focusin.selectmenu",function(n){!e(n.currentTarget).hasClass(t.namespace+"-state-disabled")&&!e(n.currentTarget).parent("ul").parent("li").hasClass(t.namespace+"-state-disabled")&&(t._selectedOptionLi().addClass(i),t._focusedOptionLi().removeClass(t.widgetBaseClass+"-item-focus ui-state-hover"),e(this).removeClass("ui-state-active").addClass(t.widgetBaseClass+"-item-focus ui-state-hover"))}).bind("mouseout.selectmenu blur.selectmenu",function(){e(this).is(t._selectedOptionLi().selector)&&e(this).addClass(i),e(this).removeClass(t.widgetBaseClass+"-item-focus ui-state-hover")});if(r[s].parentOptGroup.length){var l=t.widgetBaseClass+"-group-"+this.element.find("optgroup").index(r[s].parentOptGroup);this.list.find("li."+l).length?this.list.find("li."+l+":last ul").append(f):e('
  • ").appendTo(this.list).find("ul").append(f)}else f.appendTo(this.list);if(n.icons)for(var c in n.icons)if(f.is(n.icons[c].find)){f.data("optionClasses",r[s].classes+" "+t.widgetBaseClass+"-hasIcon").addClass(t.widgetBaseClass+"-hasIcon");var h=n.icons[c].icon||"";f.find("a:eq(0)").prepend(''),r[s].bgImage&&f.find("span").css("background-image",r[s].bgImage)}}else e('
  • ').appendTo(this.list);var p=n.style=="dropdown";this.newelement.toggleClass(t.widgetBaseClass+"-dropdown",p).toggleClass(t.widgetBaseClass+"-popup",!p),this.list.toggleClass(t.widgetBaseClass+"-menu-dropdown ui-corner-bottom",p).toggleClass(t.widgetBaseClass+"-menu-popup ui-corner-all",!p).find("li:first").toggleClass("ui-corner-top",!p).end().find("li:last").addClass("ui-corner-bottom"),this.selectmenuIcon.toggleClass("ui-icon-triangle-1-s",p).toggleClass("ui-icon-triangle-2-n-s",!p);if(n.transferClasses){var d=this.element.attr("class")||"";this.newelement.add(this.list).addClass(d)}n.style=="dropdown"?this.list.width(n.menuWidth?n.menuWidth:n.width):this.list.width(n.menuWidth?n.menuWidth:n.width-n.handleWidth),this.list.css("height","auto");var v=this.listWrap.height();if(n.maxHeight&&n.maxHeightu){o=a;break}}else o=a}o!==null&&i.eq(o).trigger(t),n._typeAhead_timer=window.setTimeout(function(){n._typeAhead_timer=undefined,n._typeAhead_chars=undefined,n._typeAhead_cycling=undefined},n.options.typeAhead)},_uiHash:function(){var t=this.index();return{index:t,option:e("option",this.element).get(t),value:this.element[0].value}},open:function(e){var t=this,n=this.options;if(t.newelement.attr("aria-disabled")!="true"){t._trigger("opening",e,t._uiHash()),t._closeOthers(e),t.newelement.addClass("ui-state-active"),t.listWrap.appendTo(n.appendTo),t.list.attr("aria-hidden",!1),t.listWrap.addClass(t.widgetBaseClass+"-open");var r=this._selectedOptionLi();n.style=="dropdown"?t.newelement.removeClass("ui-corner-all").addClass("ui-corner-top"):this.list.css("left",-5e3).scrollTop(this.list.scrollTop()+r.position().top-this.list.outerHeight()/2+r.outerHeight()/2).css("left","auto"),t._refreshPosition();var i=r.find("a");i.length&&i[0].focus(),t.isOpen=!0,t._trigger("open",e,t._uiHash())}},close:function(e,t){this.newelement.is(".ui-state-active")&&(this.newelement.removeClass("ui-state-active"),this.listWrap.removeClass(this.widgetBaseClass+"-open"),this.list.attr("aria-hidden",!0),this.options.style=="dropdown"&&this.newelement.removeClass("ui-corner-top").addClass("ui-corner-all"),t&&this.newelement.focus(),this.isOpen=!1,this._trigger("close",e,this._uiHash()))},change:function(e){this.element.trigger("change"),this._trigger("change",e,this._uiHash())},select:function(e){if(this._disabled(e.currentTarget))return!1;this._trigger("select",e,this._uiHash())},_closeOthers:function(t){e("."+this.widgetBaseClass+".ui-state-active").not(this.newelement).each(function(){e(this).data("selectelement").selectmenu("close",t)}),e("."+this.widgetBaseClass+".ui-state-hover").trigger("mouseout")},_toggle:function(e,t){this.isOpen?this.close(e,t):this.open(e)},_formatText:function(e){return this.options.format?this.options.format(e):e},_selectedIndex:function(){return this.element[0].selectedIndex},_selectedOptionLi:function(){return this._optionLis.eq(this._selectedIndex())},_focusedOptionLi:function(){return this.list.find("."+this.widgetBaseClass+"-item-focus")},_moveSelection:function(e,t){if(!this.options.disabled){var n=parseInt(this._selectedOptionLi().data("index")||0,10),r=n+e;r<0&&(r=0),r>this._optionLis.size()-1&&(r=this._optionLis.size()-1);if(r===t)return!1;if(!this._optionLis.eq(r).hasClass(this.namespace+"-state-disabled"))return this._optionLis.eq(r).trigger("mouseup");e>0?++e:--e,this._moveSelection(e,r)}},_moveFocus:function(e,t){if(!isNaN(e))var n=parseInt(this._focusedOptionLi().data("index")||0,10),r=n+e;else var r=parseInt(this._optionLis.filter(e).data("index"),10);r<0&&(r=0),r>this._optionLis.size()-1&&(r=this._optionLis.size()-1);if(r===t)return!1;var i=this.widgetBaseClass+"-item-"+Math.round(Math.random()*1e3);this._focusedOptionLi().find("a:eq(0)").attr("id",""),this._optionLis.eq(r).hasClass(this.namespace+"-state-disabled")?(e>0?++e:--e,this._moveFocus(e,r)):this._optionLis.eq(r).find("a:eq(0)").attr("id",i).focus(),this.list.attr("aria-activedescendant",i)},_scrollPage:function(e){var t=Math.floor(this.list.outerHeight()/this.list.find("li:first").outerHeight());t=e=="up"?-t:t,this._moveFocus(t)},_setOption:function(e,t){this.options[e]=t,e=="disabled"&&(t&&this.close(),this.element.add(this.newelement).add(this.list)[t?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+this.namespace+"-state-disabled").attr("aria-disabled",t))},disable:function(e,t){typeof e=="undefined"?this._setOption("disabled",!0):t=="optgroup"?this._disableOptgroup(e):this._disableOption(e)},enable:function(e,t){typeof e=="undefined"?this._setOption("disabled",!1):t=="optgroup"?this._enableOptgroup(e):this._enableOption(e)},_disabled:function(t){return e(t).hasClass(this.namespace+"-state-disabled")},_disableOption:function(e){var t=this._optionLis.eq(e);t&&(t.addClass(this.namespace+"-state-disabled").find("a").attr("aria-disabled",!0),this.element.find("option").eq(e).attr("disabled","disabled"))},_enableOption:function(e){var t=this._optionLis.eq(e);t&&(t.removeClass(this.namespace+"-state-disabled").find("a").attr("aria-disabled",!1),this.element.find("option").eq(e).removeAttr("disabled"))},_disableOptgroup:function(e){var t=this.list.find("li."+this.widgetBaseClass+"-group-"+e);t&&(t.addClass(this.namespace+"-state-disabled").attr("aria-disabled",!0),this.element.find("optgroup").eq(e).attr("disabled","disabled"))},_enableOptgroup:function(e){var t=this.list.find("li."+this.widgetBaseClass+"-group-"+e);t&&(t.removeClass(this.namespace+"-state-disabled").attr("aria-disabled",!1),this.element.find("optgroup").eq(e).removeAttr("disabled"))},index:function(t){if(!arguments.length)return this._selectedIndex();if(!!this._disabled(e(this._optionLis[t])))return!1;this.element[0].selectedIndex=t,this._refreshValue()},value:function(e){if(!arguments.length)return this.element[0].value;this.element[0].value=e,this._refreshValue()},_refreshValue:function(){var e=this.options.style=="popup"?" ui-state-active":"",t=this.widgetBaseClass+"-item-"+Math.round(Math.random()*1e3);this.list.find("."+this.widgetBaseClass+"-item-selected").removeClass(this.widgetBaseClass+"-item-selected"+e).find("a").attr("aria-selected","false").attr("id",""),this._selectedOptionLi().addClass(this.widgetBaseClass+"-item-selected"+e).find("a").attr("aria-selected","true").attr("id",t);var n=this.newelement.data("optionClasses")?this.newelement.data("optionClasses"):"",r=this._selectedOptionLi().data("optionClasses")?this._selectedOptionLi().data("optionClasses"):"";this.newelement.removeClass(n).data("optionClasses",r).addClass(r).find("."+this.widgetBaseClass+"-status").html(this._selectedOptionLi().find("a:eq(0)").html()),this.list.attr("aria-activedescendant",t)},_refreshPosition:function(){var e=this.options;if(e.style=="popup"&&!e.positionOptions.offset)var t=this._selectedOptionLi(),n="0 "+(this.list.offset().top-t.offset().top-(this.newelement.outerHeight()+t.outerHeight())/2);this.listWrap.zIndex(this.element.zIndex()+1).position({of:e.positionOptions.of||this.newelement,my:e.positionOptions.my,at:e.positionOptions.at,offset:e.positionOptions.offset||n,collision:e.positionOptions.collision||"flip"})}})}(jQuery),function(e,t){var n=!1;e(document).mouseup(function(e){n=!1}),e.widget("ui.mouse",{options:{cancel:":input,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(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(n)return;this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var r=this,i=t.which==1,s=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!i||s||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),n=!0,!0},_mouseMove:function(t){return!e.browser.msie||document.documentMode>=9||!!t.button?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):this._mouseUp(t)},_mouseUp:function(t){return e(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)),!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(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})}(jQuery),function(e,t){e.widget("ui.draggable",e.ui.mouse,{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},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(t){var n=this.options;return this.helper||n.disabled||e(t.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(t),this.handle?(n.iframeFix&&e(n.iframeFix===!0?"iframe":n.iframeFix).each(function(){e('
    ').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var n=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(),this.offset=this.positionAbs=this.element.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.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),n.containment&&this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,n){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute");if(!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1);var r=this.element[0],i=!1;while(r&&(r=r.parentNode))r==document&&(i=!0);if(!i&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!n||this.options.revert=="valid"&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)){var s=this;e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){s._trigger("stop",t)!==!1&&s._clear()})}else this._trigger("stop",t)!==!1&&this._clear();return!1},_mouseUp:function(t){return this.options.iframeFix===!0&&e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),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){var n=!this.options.handle||!e(this.options.handle,this.element).length?!0:!1;return e(this.options.handle,this.element).find("*").andSelf().each(function(){this==t.target&&(n=!0)}),n},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t])):n.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo(n.appendTo=="parent"?this.element[0].parentNode:n.appendTo),r[0]!=this.element[0]&&!/(fixed|absolute)/.test(r.css("position"))&&r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(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();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&e.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&e.browser.msie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var e=this.element.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.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=this.options;t.containment=="parent"&&(t.containment=this.helper[0].parentNode);if(t.containment=="document"||t.containment=="window")this.containment=[t.containment=="document"?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t.containment=="document"?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(t.containment=="document"?0:e(window).scrollLeft())+e(t.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(t.containment=="document"?0:e(window).scrollTop())+(e(t.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(t.containment)&&t.containment.constructor!=Array){var n=e(t.containment),r=n[0];if(!r)return;var i=n.offset(),s=e(r).css("overflow")!="hidden";this.containment=[(parseInt(e(r).css("borderLeftWidth"),10)||0)+(parseInt(e(r).css("paddingLeft"),10)||0),(parseInt(e(r).css("borderTopWidth"),10)||0)+(parseInt(e(r).css("paddingTop"),10)||0),(s?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(e(r).css("borderLeftWidth"),10)||0)-(parseInt(e(r).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(s?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(e(r).css("borderTopWidth"),10)||0)-(parseInt(e(r).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=n}else t.containment.constructor==Array&&(this.containment=t.containment)},_convertPositionTo:function(t,n){n||(n=this.position);var r=t=="absolute"?1:-1,i=this.options,s=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():o?0:s.scrollTop())*r),left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(e.browser.safari&&e.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*r)}},_generatePosition:function(t){var n=this.options,r=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.ui.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(r[0].tagName),s=t.pageX,o=t.pageY;if(this.originalPosition){var u;if(this.containment){if(this.relative_container){var a=this.relative_container.offset();u=[this.containment[0]+a.left,this.containment[1]+a.top,this.containment[2]+a.left,this.containment[3]+a.top]}else u=this.containment;t.pageX-this.offset.click.leftu[2]&&(s=u[2]+this.offset.click.left),t.pageY-this.offset.click.top>u[3]&&(o=u[3]+this.offset.click.top)}if(n.grid){var f=n.grid[1]?this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY;o=u?f-this.offset.click.topu[3]?f-this.offset.click.topu[2]?l-this.offset.click.left=0;l--){var c=r.snapElements[l].left,h=c+r.snapElements[l].width,p=r.snapElements[l].top,d=p+r.snapElements[l].height;if(!(c-s
",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(!0)},_setOption:function(e,t){if(e=="selected"){if(this.options.collapsible&&t==this.options.selected)return;this.select(t)}else this.options[e]=t,this._tabify()},_tabId:function(e){return e.title&&e.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+i()},_sanitizeSelector:function(e){return e.replace(/:/g,"\\:")},_cookie:function(){var t=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+s());return e.cookie.apply(null,[t].concat(e.makeArray(arguments)))},_ui:function(e,t){return{tab:e,panel:t,index:this.anchors.index(e)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var t=e(this);t.html(t.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){function h(t,n){t.css("display",""),!e.support.opacity&&n.opacity&&t[0].style.removeAttribute("filter")}var r=this,i=this.options,s=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=e(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return e("a",this)[0]}),this.panels=e([]),this.anchors.each(function(t,n){var o=e(n).attr("href"),u=o.split("#")[0],a;u&&(u===location.toString().split("#")[0]||(a=e("base")[0])&&u===a.href)&&(o=n.hash,n.href=o);if(s.test(o))r.panels=r.panels.add(r.element.find(r._sanitizeSelector(o)));else if(o&&o!=="#"){e.data(n,"href.tabs",o),e.data(n,"load.tabs",o.replace(/#.*$/,""));var f=r._tabId(n);n.href="#"+f;var l=r.element.find("#"+f);l.length||(l=e(i.panelTemplate).attr("id",f).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(r.panels[t-1]||r.list),l.data("destroy.tabs",!0)),r.panels=r.panels.add(l)}else i.disabled.push(t)}),n?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),i.selected===t?(location.hash&&this.anchors.each(function(e,t){if(t.hash==location.hash)return i.selected=e,!1}),typeof i.selected!="number"&&i.cookie&&(i.selected=parseInt(r._cookie(),10)),typeof i.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(i.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),i.selected=i.selected||(this.lis.length?0:-1)):i.selected===null&&(i.selected=-1),i.selected=i.selected>=0&&this.anchors[i.selected]||i.selected<0?i.selected:0,i.disabled=e.unique(i.disabled.concat(e.map(this.lis.filter(".ui-state-disabled"),function(e,t){return r.lis.index(e)}))).sort(),e.inArray(i.selected,i.disabled)!=-1&&i.disabled.splice(e.inArray(i.selected,i.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),i.selected>=0&&this.anchors.length&&(r.element.find(r._sanitizeSelector(r.anchors[i.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(i.selected).addClass("ui-tabs-selected ui-state-active"),r.element.queue("tabs",function(){r._trigger("show",null,r._ui(r.anchors[i.selected],r.element.find(r._sanitizeSelector(r.anchors[i.selected].hash))[0]))}),this.load(i.selected)),e(window).bind("unload",function(){r.lis.add(r.anchors).unbind(".tabs"),r.lis=r.anchors=r.panels=null})):i.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[i.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),i.cookie&&this._cookie(i.selected,i.cookie);for(var o=0,u;u=this.lis[o];o++)e(u)[e.inArray(o,i.disabled)!=-1&&!e(u).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");i.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(i.event!=="mouseover"){var a=function(e,t){t.is(":not(.ui-state-disabled)")&&t.addClass("ui-state-"+e)},f=function(e,t){t.removeClass("ui-state-"+e)};this.lis.bind("mouseover.tabs",function(){a("hover",e(this))}),this.lis.bind("mouseout.tabs",function(){f("hover",e(this))}),this.anchors.bind("focus.tabs",function(){a("focus",e(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){f("focus",e(this).closest("li"))})}var l,c;i.fx&&(e.isArray(i.fx)?(l=i.fx[0],c=i.fx[1]):l=c=i.fx);var p=c?function(t,n){e(t).closest("li").addClass("ui-tabs-selected ui-state-active"),n.hide().removeClass("ui-tabs-hide").animate(c,c.duration||"normal",function(){h(n,c),r._trigger("show",null,r._ui(t,n[0]))})}:function(t,n){e(t).closest("li").addClass("ui-tabs-selected ui-state-active"),n.removeClass("ui-tabs-hide"),r._trigger("show",null,r._ui(t,n[0]))},d=l?function(e,t){t.animate(l,l.duration||"normal",function(){r.lis.removeClass("ui-tabs-selected ui-state-active"),t.addClass("ui-tabs-hide"),h(t,l),r.element.dequeue("tabs")})}:function(e,t,n){r.lis.removeClass("ui-tabs-selected ui-state-active"),t.addClass("ui-tabs-hide"),r.element.dequeue("tabs")};this.anchors.bind(i.event+".tabs",function(){var t=this,n=e(t).closest("li"),s=r.panels.filter(":not(.ui-tabs-hide)"),o=r.element.find(r._sanitizeSelector(t.hash));if(n.hasClass("ui-tabs-selected")&&!i.collapsible||n.hasClass("ui-state-disabled")||n.hasClass("ui-state-processing")||r.panels.filter(":animated").length||r._trigger("select",null,r._ui(this,o[0]))===!1)return this.blur(),!1;i.selected=r.anchors.index(this),r.abort();if(i.collapsible){if(n.hasClass("ui-tabs-selected"))return i.selected=-1,i.cookie&&r._cookie(i.selected,i.cookie),r.element.queue("tabs",function(){d(t,s)}).dequeue("tabs"),this.blur(),!1;if(!s.length)return i.cookie&&r._cookie(i.selected,i.cookie),r.element.queue("tabs",function(){p(t,o)}),r.load(r.anchors.index(this)),this.blur(),!1}i.cookie&&r._cookie(i.selected,i.cookie);if(!o.length)throw"jQuery UI Tabs: Mismatching fragment identifier.";s.length&&r.element.queue("tabs",function(){d(t,s)}),r.element.queue("tabs",function(){p(t,o)}),r.load(r.anchors.index(this)),e.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(e){return typeof e=="string"&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},destroy:function(){var t=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var t=e.data(this,"href.tabs");t&&(this.href=t);var n=e(this).unbind(".tabs");e.each(["href","load","cache"],function(e,t){n.removeData(t+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){e.data(this,"destroy.tabs")?e(this).remove():e(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),t.cookie&&this._cookie(null,t.cookie),this},add:function(n,r,i){i===t&&(i=this.anchors.length);var s=this,o=this.options,u=e(o.tabTemplate.replace(/#\{href\}/g,n).replace(/#\{label\}/g,r)),a=n.indexOf("#")?this._tabId(e("a",u)[0]):n.replace("#","");u.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var f=s.element.find("#"+a);return f.length||(f=e(o.panelTemplate).attr("id",a).data("destroy.tabs",!0)),f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),i>=this.lis.length?(u.appendTo(this.list),f.appendTo(this.list[0].parentNode)):(u.insertBefore(this.lis[i]),f.insertBefore(this.panels[i])),o.disabled=e.map(o.disabled,function(e,t){return e>=i?++e:e}),this._tabify(),this.anchors.length==1&&(o.selected=0,u.addClass("ui-tabs-selected ui-state-active"),f.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){s._trigger("show",null,s._ui(s.anchors[0],s.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[i],this.panels[i])),this},remove:function(t){t=this._getIndex(t);var n=this.options,r=this.lis.eq(t).remove(),i=this.panels.eq(t).remove();return r.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(t+(t+1=t?--e:e}),this._tabify(),this._trigger("remove",null,this._ui(r.find("a")[0],i[0])),this},enable:function(t){t=this._getIndex(t);var n=this.options;if(e.inArray(t,n.disabled)==-1)return;return this.lis.eq(t).removeClass("ui-state-disabled"),n.disabled=e.grep(n.disabled,function(e,n){return e!=t}),this._trigger("enable",null,this._ui(this.anchors[t],this.panels[t])),this},disable:function(e){e=this._getIndex(e);var t=this,n=this.options;return e!=n.selected&&(this.lis.eq(e).addClass("ui-state-disabled"),n.disabled.push(e),n.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[e],this.panels[e]))),this},select:function(e){e=this._getIndex(e);if(e==-1){if(!this.options.collapsible||this.options.selected==-1)return this;e=this.options.selected}return this.anchors.eq(e).trigger(this.options.event+".tabs"),this},load:function(t){t=this._getIndex(t);var n=this,r=this.options,i=this.anchors.eq(t)[0],s=e.data(i,"load.tabs");this.abort();if(!s||this.element.queue("tabs").length!==0&&e.data(i,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(t).addClass("ui-state-processing");if(r.spinner){var o=e("span",i);o.data("label.tabs",o.html()).html(r.spinner)}return this.xhr=e.ajax(e.extend({},r.ajaxOptions,{url:s,success:function(s,o){n.element.find(n._sanitizeSelector(i.hash)).html(s),n._cleanup(),r.cache&&e.data(i,"cache.tabs",!0),n._trigger("load",null,n._ui(n.anchors[t],n.panels[t]));try{r.ajaxOptions.success(s,o)}catch(u){}},error:function(e,s,o){n._cleanup(),n._trigger("load",null,n._ui(n.anchors[t],n.panels[t]));try{r.ajaxOptions.error(e,s,t,i)}catch(o){}}})),n.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(e,t){return this.anchors.eq(e).removeData("cache.tabs").data("load.tabs",t),this},length:function(){return this.anchors.length}}),e.extend(e.ui.tabs,{version:"1.8.21"}),e.extend(e.ui.tabs.prototype,{rotation:null,rotate:function(e,t){var n=this,r=this.options,i=n._rotate||(n._rotate=function(t){clearTimeout(n.rotation),n.rotation=setTimeout(function(){var e=r.selected;n.select(++e-1?e.split(".")[1].length:0}function Rt(e,t,n,r){var i=O.lang,s=e,o=t===-1?qt(e):isNaN(t=f(t))?2:t,u=n===undefined?i.decimalPoint:n,a=r===undefined?i.thousandsSep:r,l=s<0?"-":"",c=String(Nt(s=f(+s||0).toFixed(o))),h=c.length>3?c.length%3:0;return l+(h?c.substr(0,h)+a:"")+c.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?u+f(s-c).toFixed(o).slice(2):"")}function Ut(e,t){return(new Array((t||2)+1-String(e).length)).join(0)+e}function zt(e,t,n){var r=e[t];e[t]=function(){var e=Array.prototype.slice.call(arguments);return e.unshift(r),n.apply(this,e)}}function Wt(e,t,n,r){var i,s;n=Bt(n,1),i=e/n,t||(t=[1,2,2.5,5,10],r&&r.allowDecimals===!1&&(n===1?t=[1,2,5,10]:n<=.1&&(t=[1/n])));for(s=0;s=P[Y]&&(l.setMilliseconds(0),l.setSeconds(c>=P[Z]?0:h*s(l.getSeconds()/h))),c>=P[Z]&&l[gt](c>=P[et]?0:h*s(l[ct]()/h)),c>=P[et]&&l[yt](c>=P[tt]?0:h*s(l[ht]()/h)),c>=P[tt]&&l[bt](c>=P[rt]?1:h*s(l[dt]()/h)),c>=P[rt]&&(l[wt](c>=P[it]?0:h*s(l[vt]()/h)),f=l[mt]()),c>=P[it]&&(f-=f%h,l[Et](f)),c===P[nt]&&l[bt](l[dt]()-l[pt]()+Bt(r,1)),o=1,f=l[mt]();var p=l.getTime(),d=l[vt](),v=l[dt](),m=a?0:(864e5+l.getTimezoneOffset()*60*1e3)%864e5;while(pn&&(n=e[t]);return n}function Gt(e,t){var n;for(n in e)e[n]&&e[n]!==t&&e[n].destroy&&e[n].destroy(),delete e[n]}function Yt(e){A||(A=Ft(j)),e&&A.appendChild(e),A.innerHTML=""}function Zt(e,t){var r="Highcharts error #"+e+": www.highcharts.com/errors/"+e;if(t)throw r;n.console&&console.log(r)}function en(e){return parseFloat(e.toPrecision(14))}function tn(e,t){_=Bt(e,t.animation)}function Sn(){var e=O.global.useUTC,t=e?"getUTC":"get",n=e?"setUTC":"set";lt=e?Date.UTC:function(e,t,n,r,i,s){return(new Date(e,t,Bt(n,1),Bt(r,0),Bt(i,0),Bt(s,0))).getTime()},ct=t+"Minutes",ht=t+"Hours",pt=t+"Day",dt=t+"Date",vt=t+"Month",mt=t+"FullYear",gt=n+"Minutes",yt=n+"Hours",bt=n+"Date",wt=n+"Month",Et=n+"FullYear"}function xn(e){return O=hn(O,e),Sn(),O}function Tn(){return O}function Cn(){}function Dn(e,t,n){this.axis=e,this.pos=t,this.type=n||"",this.isNew=!0,n||this.addLabel()}function Pn(e,t){return this.axis=e,t&&(this.options=t,this.id=t.id),this}function Hn(e,t,n,r,i,s){var o=e.chart.inverted;this.axis=e,this.isNegative=n,this.options=t,this.x=r,this.stack=i,this.percent=s==="percent",this.alignOptions={align:t.align||(o?n?"left" :"right":"center"),verticalAlign:t.verticalAlign||(o?"middle":n?"bottom":"top"),y:Bt(t.y,o?4:n?14:-6),x:Bt(t.x,o?n?-6:6:0)},this.textAlign=t.textAlign||(o?n?"right":"left":"center")}function Bn(){this.init.apply(this,arguments)}function jn(e,t){var n=t.borderWidth,r=t.style,i=Nt(r.padding);this.chart=e,this.options=t,this.crosshairs=[],this.now={x:0,y:0},this.isHidden=!0,this.label=e.renderer.label("",0,0,t.shape,null,null,t.useHTML,null,"tooltip").attr({padding:i,fill:t.backgroundColor,"stroke-width":n,r:t.borderRadius,zIndex:8}).css(r).css({padding:0}).hide().add(),T||this.label.shadow(t.shadow),this.shared=t.shared}function Fn(e,t){var n=T?"":t.chart.zoomType;this.zoomX=/x/.test(n),this.zoomY=/y/.test(n),this.options=t,this.chart=e,this.init(e,t.tooltip)}function In(e){this.init(e)}function qn(){this.init.apply(this,arguments)}var e,t=document,n=window,r=Math,i=r.round,s=r.floor,o=r.ceil,u=r.max,a=r.min,f=r.abs,l=r.cos,c=r.sin,h=r.PI,p=h*2/360,d=navigator.userAgent,v=n.opera,m=/msie/i.test(d)&&!v,g=t.documentMode===8,y=/AppleWebKit/.test(d),b=/Firefox/.test(d),w=/(Mobile|Android|Windows Phone)/.test(d),E="http://www.w3.org/2000/svg",S=!!t.createElementNS&&!!t.createElementNS(E,"svg").createSVGRect,x=b&&parseInt(d.split("Firefox/")[1],10)<4,T=!S&&!m&&!!t.createElement("canvas").getContext,N,C=t.documentElement.ontouchstart!==e,k={},L=0,A,O,M,_,D,P,H=function(){},B=[],j="div",F="absolute",I="relative",q="hidden",R="highcharts-",U="visible",z="px",W="none",X="M",V="L",$="rgba(192,192,192,"+(S?1e-4:.002)+")",J="",K="hover",Q="select",G="millisecond",Y="second",Z="minute",et="hour",tt="day",nt="week",rt="month",it="year",st="fill",ot="linearGradient",ut="stops",at="stroke",ft="stroke-width",lt,ct,ht,pt,dt,vt,mt,gt,yt,bt,wt,Et,St={};n.Highcharts={},M=function(e,t,n){if(!Dt(t)||isNaN(t))return"Invalid date";e=Bt(e,"%Y-%m-%d %H:%M:%S");var r=new Date(t),s,o=r[ht](),u=r[pt](),a=r[dt](),f=r[vt](),l=r[mt](),c=O.lang,h=c.weekdays,p={a:h[u].substr(0,3),A:h[u],d:Ut(a),e:a,b:c.shortMonths[f],B:c.months[f],m:Ut(f+1),y:l.toString().substr(2,2),Y:l,H:Ut(o),I:Ut(o%12||12),l:o%12||12,M:Ut(r[ct]()),p:o<12?"AM":"PM",P:o<12?"am":"pm",S:Ut(r.getSeconds()),L:Ut(i(t%1e3),3)};for(s in p)while(e.indexOf("%"+s)!==-1)e=e.replace("%"+s,p[s]);return n?e.substr(0,1).toUpperCase()+e.substr(1):e},$t.prototype={wrapColor:function(e){this.color>=e&&(this.color=0)},wrapSymbol:function(e){this.symbol>=e&&(this.symbol=0)}},P=Tt(G,1,Y,1e3,Z,6e4,et,36e5,tt,864e5,nt,6048e5,rt,26784e5,it,31556952e3),D={init:function(e,t,n){t=t||"";var r=e.shift,i=t.indexOf("C")>-1,s=i?7:3,o,u,a,f=t.split(" "),l=[].concat(n),c,h,p=function(e){a=e.length;while(a--)e[a]===X&&e.splice(a+1,0,e[a+1],e[a+2],e[a+1],e[a+2])};i&&(p(f),p(l)),e.isArea&&(c=f.splice(f.length-6,6),h=l.splice(l.length-6,6));if(r<=l.length/s)while(r--)l=[].concat(l).splice(0,s).concat(l);e.shift=0;if(f.length){o=l.length;while(f.length{point.key}
    ',pointFormat:'{series.name}: {point.y}
    ',shadow:!0,shared:T,snap:w?25:10,style:{color:"#333333",fontSize:"12px",padding:"5px",whiteSpace:"nowrap"}},credits:{enabled:!0,text:"Highcharts.com",href:"http://www.highcharts.com",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#909090",fontSize:"10px"}}};var wn=O.plotOptions,En=wn.line;Sn();var Nn=function(e){function r(e){n=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(e),n?t=[Nt(n[1]),Nt(n[2]),Nt(n[3]),parseFloat(n[4],10)]:(n=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e),n&&(t=[Nt(n[1],16),Nt(n[2],16),Nt(n[3],16),1]))}function i(n){var r;return t&&!isNaN(t[0])?n==="rgb"?r="rgb("+t[0]+","+t[1]+","+t[2]+")":n==="a"?r=t[3]:r="rgba("+t.join(",")+")":r=e,r}function s(e){if(At(e)&&e!==0){var n;for(n=0;n<3;n++)t[n]+=Nt(e*255),t[n]<0&&(t[n]=0),t[n]>255&&(t[n]=255)}return this}function o(e){return t[3]=e,this}var t=[],n;return r(e),{get:i,brighten:s,setOpacity:o}};Cn.prototype={init:function(e,n){var r=this;r.element=n==="span"?Ft(n):t.createElementNS(E,n),r.renderer=e,r.attrSetters={}},animate:function(e,t,n){var r=Bt(t,_,!0);yn(this),r?(r=hn(r),n&&(r.complete=n),gn(this,e,r)):(this.attr(e),n&&n())},attr:function(n,r){var i=this,s,o,a,f,l,c=i.element,h=c.nodeName.toLowerCase(),p=i.renderer,d,v,m=i.attrSetters,g=i.shadows,b,w,S=i;Ct(n)&&Dt(r)&&(s=n,n={},n[s]=r);if(Ct(n))s=n,h==="circle"?s={x:"cx",y:"cy"}[s]||s:s==="strokeWidth"&&(s="stroke-width"),S=Pt(c,s)||i[s]||0,s!=="d"&&s!=="visibility"&&(S=parseFloat(S));else for(s in n){d=!1,o=n[s],a=m[s]&&m[s].call(i,o,s);if(a!==!1){a!==e&&(o=a);if(s==="d")o&&o.join&&(o=o.join(" ")),/(NaN| {2}|^$)/.test(o)&&(o="M 0 0");else if(s==="x"&&h==="text"){for(f=0;fC&&/[ \-]/.test(n.textContent||n.innerText)&&(jt(n,{width:C+z,display:"block",whiteSpace:"normal"}),d=C),E=t.fontMetrics(n.style.fontSize).b,k=x<0&&-d,L=T<0&&-g,N=x*T<0,k+=T*E*(N?1-a:a),L-=x*E*(w?N?a:1-a:1),f&&(k-=d*a*(x<0?-1:1),w&&(L-=g*a*(T<0?-1:1)),jt(n,{textAlign:u})),e.xCorr=k,e.yCorr=L),jt(n,{left:s+k+z,top:o+L+z}),y&&(g=n.offsetHeight),e.cTT=A}},updateTransform:function(){var e=this,t=e.translateX||0,n=e.translateY||0,r=e.inverted,i=e.rotation,s=[];r&&(t+=e.attr("width"),n+=e.attr("height")),(t||n)&&s.push("translate("+t+","+n+")"),r?s.push("rotate(90) scale(-1,1)"):i&&s.push("rotate("+i+" "+(e.x||0)+" "+(e.y||0)+")"),s.length&&Pt(e.element,"transform",s.join(" "))},toFront:function(){var e=this.element;return e.parentNode.appendChild(e),this},align:function(e,t,n){var r=this;e?(r.alignOptions=e,r.alignByTranslate=t,n||r.renderer.alignedObjects.push(r)):(e=r.alignOptions,t=r.alignByTranslate),n=Bt(n,r.renderer);var s=e.align,o=e.verticalAlign,u=(n.x||0)+(e.x||0),a=(n.y||0)+(e.y||0),f={};if(s==="right"||s==="center")u+=(n.width-(e.width||0))/{right:1,center:2}[s];f[t?"translateX":"x"]=i(u);if(o==="bottom"||o==="middle")a+=(n.height-(e.height||0))/({bottom:1,middle:2}[o]||1);return f[t?"translateY":"y"]=i(a),r[r.placed?"animate":"attr"](f),r.placed=!0,r.alignAttr=f,r},getBBox:function(){var e=this,t=e.bBox,n=e.renderer,r,i,s=e.rotation,o=e.element,u=e.styles,a=s*p;if(!t){if(o.namespaceURI===E||n.forExport){try{t=o.getBBox?xt({},o.getBBox()):{width:o.offsetWidth,height:o.offsetHeight}}catch(h){}if(!t||t.width<0)t={width:0,height:0}}else t=e.htmlGetBBox();n.isSVG&&(r=t.width,i=t.height,m&&u&&u.fontSize==="11px"&&i===22.700000762939453&&(t.height=i=14),s&&(t.width=f(i*c(a))+f(r*l(a)),t.height=f(i*l(a))+f(r*c(a)))),e.bBox=t}return t},show:function(){return this.attr({visibility:U})},hide:function(){return this.attr({visibility:q})},add:function(e){var t=this.renderer,n=e||t,r=n.element||t.box,i=r.childNodes,s=this.element,o=Pt(s,"zIndex"),u,a,f,l;e&&(this.parentGroup=e),this.parentInverted=e&&e.inverted,this.textStr!==undefined&&t.buildText(this),o&&(n.handleZ=!0,o=Nt(o));if(n.handleZ)for(f=0;fo||!Dt(o)&&Dt(a))){r.insertBefore(s,u),l=!0;break}}return l||r.appendChild(s),this.added=!0,vn(this,"add"),this},safeRemoveChild:function(e){var t=e.parentNode;t&&t.removeChild(e)},destroy:function(){var e=this,t=e.element||{},n=e.shadows,r,i;t.onclick=t.onmouseout=t.onmouseover=t.onmousemove=null,yn(e),e.clipPath&&(e.clipPath=e.clipPath.destroy());if(e.stops){for(i=0;i/g,'').replace(/<(i|em)>/g,'').replace(//g,"").split(//g),o=r.childNodes,u=/style="([^"]+)"/,a=/href="([^"]+)"/,f=Pt(r,"x"),l=e.styles,c=l&&l.width&&Nt(l.width),h=l&&l.lineHeight,p,d="getComputedStyle",v=o.length,m=[];while(v--)r.removeChild(o[v]);c&&!e.added&&this.box.appendChild(r),s[s.length-1]===""&&s.pop(),an(s,function(i,s){var o,l=0,v;i=i.replace(//g,"|||"),o=i.split("|||"),an(o,function(i){if(i!==""||o.length===1){var m={},y=t.createElementNS(E,"tspan"),b;u.test(i)&&(b=i.match(u)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),Pt(y,"style",b)),a.test(i)&&(Pt(y,"onclick",'location.href="'+i.match(a)[1]+'"'),jt(y,{cursor:"pointer"})),i=(i.replace(/<(.|\n)*?>/g,"")||" ").replace(/</g,"<").replace(/>/g,">"),y.appendChild(t.createTextNode(i)),l?m.dx=3:m.x=f;if(!l){if(s){!S&&e.renderer.forExport&&jt(y,{display:"block"}),v=n[d]&&Nt(n[d](p,null).getPropertyValue("line-height"));if(!v||isNaN(v))v=h||p.offsetHeight||g(s)||18;Pt(y,"dy",v)}p=y}Pt(y,m),r.appendChild(y),l++;if(c){var w=i.replace(/([^\^])-/g,"$1- ").split(" "),x,T,N=[];while(w.length||N.length)delete e.bBox,T=e.getBBox().width,x=T>c,!x||w.length===1?(w=N,N=[],w.length&&(y=t.createElementNS(E,"tspan"),Pt(y,{dy:h||16,x:f}),b&&Pt(y,"style",b),r.appendChild(y),T>c&&(c=T))):(y.removeChild(y.firstChild),N.unshift(w.pop())),w.length&&y.appendChild(t.createTextNode(w.join(" ").replace(/- /g,"-")))}}})})},button:function(e,t,n,r,i,s,o){var u=this.label(e,t,n),a=0,f,l,c,h,p,d="style",v={x1:0,y1:0,x2:0,y2:1};return i=hn(Tt(ft,1,at,"#999",st,Tt(ot,v,ut,[[0,"#FFF"],[1,"#DDD"]]),"r",3,"padding",3,d,Tt("color","black")),i),c=i[d],delete i[d],s=hn(i,Tt(at,"#68A",st,Tt(ot,v,ut,[[0,"#FFF"],[1,"#ACF"]])),s),h=s[d],delete s[d],o=hn(i,Tt(at,"#68A",st,Tt(ot,v,ut,[[0,"#9BD"],[1,"#CDF"]])),o),p=o[d],delete o[d],pn(u.element,"mouseenter",function(){u.attr(s).css(h)}),pn(u.element,"mouseleave",function(){f=[i,s,o][a],l=[c,h,p][a],u.attr(f).css(l)}),u.setState=function(e){a=e,e?e===2&&u.attr(o).css(p):u.attr(i).css(c)},u.on("click",function(){r.call(u)}).attr(i).css(xt({cursor:"default"},c))},crispLine:function(e,t){return e[1]===e[4]&&(e[1]=e[4]=i(e[1])-t%2/2),e[2]===e[5]&&(e[2]=e[5]=i(e[2])+t%2/2),e},path:function(e){var t={fill:W};return Lt(e)?t.d=e:kt(e)&&xt(t,e),this.createElement("path").attr(t)},circle:function(e,t,n){var r=kt(e)?e:{x:e,y:t,r:n};return this.createElement("circle").attr(r)},arc:function(e,t,n,r,i,s){return kt(e)&&(t=e.y,n=e.r,r=e.innerR,i=e.start,s=e.end,e=e.x),this.symbol("arc",e||0,t||0,n||0,n||0,{innerR:r||0,start:i||0,end:s||0})},rect:function(e,t,n,r,i,s){i=kt(e)?e.r:i;var o=this.createElement("rect").attr({rx:i,ry:i,fill:W});return o.attr(kt(e)?e:o.crisp(s,e,t,u(n,0),u(r,0)))},setSize:function(e,t,n){var r=this,i=r.alignedObjects,s=i.length;r.width=e,r.height=t,r.boxWrapper[Bt(n,!0)?"animate":"attr"]({width:e,height:t});while(s--)i[s].align()},g:function(e){var t=this.createElement("g");return Dt(e)?t.attr({"class":R+e}):t},image:function(e,t,n,r,i){var s={preserveAspectRatio:W},o;return arguments.length>1&&xt(s,{x:t,y:n,width:r,height:i}),o=this.createElement("image").attr(s),o.element.setAttributeNS?o.element.setAttributeNS("http://www.w3.org/1999/xlink","href",e):o.element.setAttribute("hc-svg-href",e),o},symbol:function(e,t,n,r,s,o){var u,a=this.symbols[e],f=a&&a(i(t),i(n),r,s,o),l,c=/^url\((.*?)\)$/,h,p,d;return f?(u=this.path(f),xt(u,{symbolName:e,x:t,y:n,width:r,height:s}),o&&xt(u,o)):c.test(e)&&(d=function(e,t){e.element&&(e.attr({width:t[0],height:t[1]}),e.alignByTranslate||e.translate(i((r-t[0])/2),i((s-t[1])/2)))},h=e.match(c)[1],p=k[h],u=this.image(h).attr({x:t,y:n}),p?d(u,p):(u.attr({width:0,height:0}),l=Ft("img",{onload:function(){d(u,k[h]=[this.width,this.height])},src:h}))),u},symbols:{circle:function(e,t,n,r){var i=.166*n;return[X,e+n/2,t,"C",e+n+i,t,e+n+i,t+r,e+n/2,t+r,"C",e-i,t+r,e-i,t,e+n/2,t,"Z"]},square:function(e,t,n,r){return[X,e,t,V,e+n,t,e+n,t+r,e,t+r,"Z"]},triangle:function(e,t,n,r){return[X,e+n/2,t,V,e+n,t+r,e,t+r,"Z"]},"triangle-down":function(e,t,n,r){return[X,e,t,V,e+n,t,e+n/2,t+r,"Z"]},diamond:function(e,t,n,r){return[X,e+n/2,t,V,e+n,t+r/2,e+n/2,t+r,e,t+r/2,"Z"]},arc:function(e,t,n,r,i){var s=i.start,o=i.r||n||r,u=i.end-1e-6,a=i.innerR,f=i.open,p=l(s),d=c(s),v=l(u),m=c(u),g=i.end-s'),t&&(r=t===j||t==="span"||t==="img"?r.join(""):e.prepVML(r),n.element=Ft(r)),n.renderer=e,n.attrSetters={}},add:function(e){var t=this,n=t.renderer,r=t.element,i=n.box,s=e&&e.inverted,o=e?e.element||e:i;return s&&n.invertChild(r,o),o.appendChild(r),t.added=!0,t.alignOnAdd&&!t.deferUpdateTransform&&t.updateTransform(),vn(t,"add"),t},updateTransform:Cn.prototype.htmlUpdateTransform,attr:function(t,n){var r=this,s,o,a,f,h=r.element||{},d=h.style,v=h.nodeName,m=r.renderer,y=r.symbolName,b,w=r.shadows,E,S=r.attrSetters,x=r;Ct(t)&&Dt(n)&&(s=t,t={},t[s]=n);if(Ct(t))s=t,s==="strokeWidth"||s==="stroke-width"?x=r.strokeweight:x=r[s];else for(s in t){o=t[s],E=!1,f=S[s]&&S[s].call(r,o,s);if(f!==!1&&o!==null){f!==e&&(o=f);if(y&&/^(x|y|r|start|end|width|height|innerR|anchorX|anchorY)/.test(s))b||(r.symbolAttr(t),b=!0),E=!0;else if(s==="d"){o=o||[],r.d=o.join(" "),a=o.length;var T=[];while(a--)At(o[a])?T[a]=i(o[a]*10)-5:o[a]==="Z"?T[a]="x":T[a]=o[a];o=T.join(" ")||"x",h.path=o;if(w){a=w.length;while(a--)w[a].path=w[a].cutOff?this.cutOffPath(o,w[a].cutOff):o}E=!0}else if(s==="visibility"){if(w){a=w.length;while(a--)w[a].style[s]=o}v==="DIV"&&(o=o===q?"-999em":0,s="top"),d[s]=o,E=!0}else if(s==="zIndex")o&&(d[s]=o),E=!0;else if(s==="width"||s==="height")o=u(0,o),this[s]=o,r.updateClipping?(r[s]=o,r.updateClipping()):d[s]=o,E=!0;else if(s==="x"||s==="y")r[s]=o,d[{x:"left",y:"top"}[s]]=o;else if(s==="class")h.className=o;else if(s==="stroke")o=m.color(o,h,s),s="strokecolor";else if(s==="stroke-width"||s==="strokeWidth")h.stroked=o?!0:!1,s="strokeweight",r[s]=o,At(o)&&(o+=z);else if(s==="dashstyle"){var N=h.getElementsByTagName("stroke")[0]||Ft(m.prepVML([""]),null,null,h);N[s]=o||"solid",r.dashstyle=o,E=!0}else s==="fill"?v==="SPAN"?d.color=o:v!=="IMG"&&(h.filled=o!==W?!0:!1,o=m.color(o,h,s,r),s="fillcolor"):v==="shape"&&s==="rotation"?(r[s]=o,h.style.left=-i(c(o*p)+1)+z,h.style.top=i(l(o*p))+z):s==="translateX"||s==="translateY"||s==="rotation"?(r[s]=o,r.updateTransform(),E=!0):s==="text"&&(this.bBox=null,h.innerHTML=o,E=!0);E||(g?h[s]=o:Pt(h,s,o))}}return x},clip:function(e){var t=this,n,r=t.element,i=r.parentNode,s;return e?(n=e.members,_t(n,t),n.push(t),t.destroyClip=function(){_t(n,t)},i&&i.className==="highcharts-tracker"&&!g&&jt(r,{visibility:q}),s=e.getCSS(t)):(t.destroyClip&&t.destroyClip(),s={clip:g?"inherit":"rect(auto)"}),t.css(s)},css:Cn.prototype.htmlCss,safeRemoveChild:function(e){e.parentNode&&Yt(e)},destroy:function(){return this.destroyClip&&this.destroyClip(),Cn.prototype.destroy.apply(this)},empty:function(){var e=this.element,t=e.childNodes,n=t.length,r;while(n--)r=t[n],r.parentNode.removeChild(r)},on:function(e,t){return this.element["on"+e]=function(){var e=n.event;e.target=e.srcElement,t(e)},this},cutOffPath:function(e,t){var n;e=e.split(/[ ,]/),n=e.length;if(n===9||n===11)e[n-4]=e[n-2]=Nt(e[n-2])-10*t;return e.join(" ")},shadow:function(e,t,n){var r=[],i,s=this.element,o=this.renderer,u,a=s.style,f,l=s.path,c,h,p,d;l&&typeof l.value!="string"&&(l="x"),h=l;if(e){p=Bt(e.width,3),d=(e.opacity||.15)/p;for(i=1;i<=3;i++)c=p*2+1-2*i,n&&(h=this.cutOffPath(l.value,c+.5)),f=[''],u=Ft(o.prepVML(f),null,{left:Nt(a.left)+Bt(e.offsetX,1),top:Nt(a.top)+Bt(e.offsetY,1)}),n&&(u.cutOff=c+1),f=[''],Ft(o.prepVML(f),null,null,u),t?t.element.appendChild(u):s.parentNode.insertBefore(u,s),r.push(u);this.shadows=r}return this}};An=It(Cn,An);var On={Element:An,isIE8:d.indexOf("MSIE 8.0")>-1,init:function(e,n,r){var i=this,s,o;i.alignedObjects=[],s=i.createElement(j),o=s.element,o.style.position=I,e.appendChild(s.element),i.box=o,i.boxWrapper=s,i.setSize(n,r,!1),t.namespaces.hcv||(t.namespaces.add("hcv","urn:schemas-microsoft-com:vml"),t.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } ")},isHidden:function(){return!this.box.offsetWidth},clipRect:function(e,t,n,r){var s=this.createElement(),o=kt(e);return xt(s,{members:[],left:o?e.x:e,top:o?e.y:t,width:o?e.width:n,height:o?e.height:r,getCSS:function(e){var t=e.inverted,n=this,r=n.top,s=n.left,o=s+n.width,u=r+n.height,a={clip:"rect("+i(t?s:r)+"px,"+i(t?u:o)+"px,"+i(t?o:u)+"px,"+i(t?r:s)+"px)"};return!t&&g&&e.element.nodeName!=="IMG"&&xt(a,{width:o+z,height:u+z}),a},updateClipping:function(){an(s.members,function(e){e.css(s.getCSS(e))})}})},color:function(e,t,n,i){var s=this,o,u=/^rgba/,a,f,l=W;e&&e.linearGradient?f="gradient":e&&e.radialGradient&&(f="pattern");if(f){var c,p,d=e.linearGradient||e.radialGradient ,v,m,g,y,b,w,E,S,x="",T=e.stops,N,C,k=[],L=function(){a=[''],Ft(s.prepVML(a),null,null,t)};N=T[0],C=T[T.length-1],N[0]>0&&T.unshift([0,N[1]]),C[0]<1&&T.push([1,C[1]]),an(T,function(e,t){u.test(e[1])?(o=Nn(e[1]),c=o.get("rgb"),p=o.get("a")):(c=e[1],p=1),k.push(e[0]*100+"% "+c),t?(w=p,E=c):(b=p,S=c)});if(n==="fill")if(f==="gradient")v=d.x1||d[0]||0,m=d.y1||d[1]||0,g=d.x2||d[2]||0,y=d.y2||d[3]||0,x='angle="'+(90-r.atan((y-m)/(g-v))*180/h)+'"',L();else{var A=d.r,M=A*2,_=A*2,D=d.cx,P=d.cy,H=t.radialReference,B,j=function(){H&&(B=i.getBBox(),D+=(H[0]-B.x)/B.width-.5,P+=(H[1]-B.y)/B.height-.5,M*=H[2]/B.width,_*=H[2]/B.height),x='src="'+O.global.VMLRadialGradientURL+'" '+'size="'+M+","+_+'" '+'origin="0.5,0.5" '+'position="'+D+","+P+'" '+'color2="'+S+'" ',L()};i.added?j():pn(i,"add",j),l=E}else l=c}else if(u.test(e)&&t.tagName!=="IMG")o=Nn(e),a=["<",n,' opacity="',o.get("a"),'"/>'],Ft(this.prepVML(a),null,null,t),l=o.get("rgb");else{var F=t.getElementsByTagName(n);F.length&&(F[0].opacity=1),l=e}return l},prepVML:function(e){var t="display:inline-block;behavior:url(#default#VML);",n=this.isIE8;return e=e.join(""),n?(e=e.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),e.indexOf('style="')===-1?e=e.replace("/>",' style="'+t+'" />'):e=e.replace('style="','style="'+t)):e=e.replace("<","1&&s.attr({x:t,y:n,width:r,height:i}),s},rect:function(e,t,n,r,i,s){kt(e)&&(t=e.y,n=e.width,r=e.height,s=e.strokeWidth,e=e.x);var o=this.symbol("rect");return o.r=i,o.attr(o.crisp(s,e,t,u(n,0),u(r,0)))},invertChild:function(e,t){var n=t.style;jt(e,{flip:"x",left:Nt(n.width)-1,top:Nt(n.height)-1,rotation:-90})},symbols:{arc:function(e,t,n,r,i){var s=i.start,o=i.end,u=i.r||n||r,a=l(s),f=c(s),p=l(o),d=c(o),v=i.innerR,m=.08/u,g=v&&.1/v||0,y;return o-s===0?["x"]:(2*h-o+sm&&(n=!1)):u+h>d&&(u=d-h,v&&u+c0&&t.height>0?(s=hn({align:n&&h&&"center",x:n?!h&&4:10,verticalAlign:!n&&h&&"middle",y:n?h?16:10:h?6:-4,rotation:n&&!h&&90},s),o||(e.label=o=k.text(s.text,0,0).attr({align:s.textAlign||s.align,rotation:s.rotation,zIndex:T}).css(s.style).add()),b=[m[1],m[4],Bt(m[6],m[1])],w=[m[2],m[5],Bt(m[7],m[2])],E=Kt(b),S=Kt(w),o.align(s,!1,{x:E,y:S,width:Qt(b)-E,height:Qt(w)-S}),o.show()):o&&o.hide(),e},destroy:function(){var e=this,t=e.axis;_t(t.plotLinesAndBands,e),Gt(e,this.axis)}},Hn.prototype={destroy:function(){Gt(this,this.axis)},setTotal:function(e){this.total=e,this.cum=e},render:function(e){var t=this.options.formatter.call(this);this.label?this.label.attr({text:t,visibility:q}):this.label=this.axis.chart.renderer.text(t,0,0).css(this.options.style).attr({align:this.textAlign,rotation:this.options.rotation,visibility:q}).add(e)},setOffset:function(e,t){var n=this,r=n.axis,i=r.chart,s=i.inverted,o=this.isNegative,u=r.translate(this.percent?100:this.total,0,0,0,1),a=r.translate(0),l=f(u-a),c=i.xAxis[0].translate(this.x)+e,h=i.plotHeight,p={x:s?o?u:u-l:c,y:s?h-c-t:o?h-u-l:h-u,width:s?l:t,height:s?t:l},d=this.label,v;d&&(d.align(this.alignOptions,null,p),v=d.alignAttr,d.attr({visibility:this.options.crop===!1||i.isInsidePlot(v.x,v.y)?S?"inherit":U:q}))}},Bn.prototype={defaultOptions:{dateTimeLabelFormats:{millisecond:"%H:%M:%S.%L",second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,gridLineColor:"#C0C0C0",labels:bn,lineColor:"#C0D0E0",lineWidth:1,minPadding:.01,maxPadding:.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1,minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:5,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#6D869F",fontWeight:"bold"}},type:"linear"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{align:"right",x:-8,y:3},lineWidth:0,maxPadding:.05,minPadding:.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:"Y-values"},stackLabels:{enabled:!1,formatter:function(){return this.total},style:bn.style}},defaultLeftAxisOptions:{labels:{align:"right",x:-8,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{align:"left",x:8,y:null},title:{rotation:90}},defaultBottomAxisOptions:{labels:{align:"center",x:0,y:14},title:{rotation:0}},defaultTopAxisOptions:{labels:{align:"center",x:0,y:-5},title:{rotation:0}},init:function(t,n){var r=n.isX,i=this;i.horiz=t.inverted?!r:r,i.isXAxis=r,i.xOrY=r?"x":"y",i.opposite=n.opposite,i.side=i.horiz?i.opposite?0:2:i.opposite?1:3,i.setOptions(n);var s=this.options,o=s.type,u=o==="datetime";i.labelFormatter=s.labels.formatter||i.defaultLabelFormatter,i.staggerLines=i.horiz&&s.labels.staggerLines,i.userOptions=n,i.minPixelPadding=0,i.chart=t,i.reversed=s.reversed,i.categories=s.categories,i.isLog=o==="logarithmic",i.isLinked=Dt(s.linkedTo),i.isDatetimeAxis=u,i.tickmarkOffset=s.categories&&s.tickmarkPlacement==="between"?.5:0,i.ticks={},i.minorTicks={},i.plotLinesAndBands=[],i.alternateBands={},i.len=0,i.minRange=i.userMinRange=s.minRange||s.maxZoom,i.range=s.range,i.offset=s.offset||0,i.stacks={},i.max=null,i.min=null;var a,f=i.options.events;t.axes.push(i),t[r?"xAxis":"yAxis"].push(i),i.series=[],t.inverted&&r&&i.reversed===e&&(i.reversed=!0),i.removePlotBand=i.removePlotBandOrLine,i.removePlotLine=i.removePlotBandOrLine,i.addPlotBand=i.addPlotBandOrLine,i.addPlotLine=i.addPlotBandOrLine;for(a in f)pn(i,a,f[a]);i.isLog&&(i.val2lin=Ot,i.lin2val=Mt)},setOptions:function(e){this.options=hn(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],hn(O[this.isXAxis?"xAxis":"yAxis"],e))},defaultLabelFormatter:function(){var t=this.axis,n=this.value,r=t.categories,i=this.dateTimeLabelFormat,s=O.lang.numericSymbols,o=s&&s.length,u,a,f=t.isLog?n:t.tickInterval;if(r)a=n;else if(i)a=M(i,n);else if(o&&f>=1e3)while(o--&&a===e)u=Math.pow(1e3,o+1),f>=u&&s[o]!==null&&(a=Rt(n/u,-1)+s[o]);return a===e&&(n>=1e3?a=Rt(n,0):a=Rt(n,-1)),a},getSeriesExtremes:function(){var t=this,n=t.chart,r=t.stacks,i=[],s=[],o;t.hasVisibleSeries=!1,t.dataMin=t.dataMax=null,an(t.series,function(f){if(f.visible||!n.options.chart.ignoreHiddenSeries){var l=f.options,c,h,p,d,v,m,g,y,b,w,E=l.threshold,S,x=[],T=0;t.hasVisibleSeries=!0,t.isLog&&E<=0&&(E=l.threshold=null);if(t.isXAxis)g=f.xData,g.length&&(t.dataMin=a(Bt(t.dataMin,g[0]),Kt(g)),t.dataMax=u(Bt(t.dataMax,g[0]),Qt(g)));else{var N,C,k,L=f.cropped,A=f.xAxis.getExtremes(),O,M=!!f.modifyValue;c=l.stacking,t.usePercentage=c==="percent",c&&(v=l.stack,d=f.type+Bt(v,""),m="-"+d,f.stackKey=d,h=i[d]||[],i[d]=h,p=s[m]||[],s[m]=p),t.usePercentage&&(t.dataMin=0,t.dataMax=99),g=f.processedXData,y=f.processedYData,S=y.length;for(o=0;o=A.min&&(g[o-1]||b)<=A.max){O=w.length;if(O)while(O--)w[O]!==null&&(x[T++]=w[O]);else x[T++]=w}}}!t.usePercentage&&x.length&&(t.dataMin=a(Bt(t.dataMin,x[0]),Kt(x)),t.dataMax=u(Bt(t.dataMax,x[0]),Qt(x))),Dt(E)&&(t.dataMin>=E?(t.dataMin=E,t.ignoreMinPadding=!0):t.dataMaxo+r.width)v=!0}else{a=o,l=d-r.right;if(fu+r.height)v=!0}return v?null:s.renderer.crispLine([X,a,f,V,l,c],t||0)},getPlotBandPath:function(e,t){var n=this.getPlotLinePath(t),r=this.getPlotLinePath(e);return r&&n?r.push(n[4],n[5],n[1],n[2]):r=null,r},getLinearTickPositions:function(e,t,n){var r,i,u=en(s(t/e)*e),a=en(o(n/e)*e),f=[];r=u;while(r<=a){f.push(r),r=en(r+e);if(r===i)break;i=r}return f},getLogTickPositions:function(e,t,n,o){var u=this,a=u.options,f=u.len,l=[];o||(u._minorAutoInterval=null);if(e>=.5)e=i(e),l=u.getLinearTickPositions(e,t,n);else if(e>=.08){var c=s(t),h,p,d,v,m,g,y;e>.3?h=[1,2,4]:e>.15?h=[1,2,4,6,8]:h=[1,2,3,4,5,6,7,8,9];for(p=c;pt&&l.push(g),g>n&&(y=!0),g=m}}else{var b=Mt(t),w=Mt(n),E=a[o?"minorTickInterval":"tickInterval"],S=E==="auto"?null:E,x=a.tickPixelInterval/(o?5:1),T=o?f/u.tickPositions.length:f;e=Bt(S,u._minorAutoInterval,(w-b)*x/(T||1)),e=Wt(e,null,r.pow(10,s(r.log(e)/r.LN10))),l=cn(u.getLinearTickPositions(e,b,w),Ot),o||(u._minorAutoInterval=e/5)}return o||(u.tickInterval=e),l},getMinorTickPositions:function(){var e=this,t=e.options,n=e.tickPositions,r=e.minorTickInterval,i=[],s,o,u;if(e.isLog){u=n.length;for(o=1;o=t.minRange,u,f,l,c,h,p,d;t.isXAxis&&t.minRange===e&&!t.isLog&&(Dt(n.min)||Dt(n.max)?t.minRange=null:(an(t.series,function(t){c=t.xData,h=t.xIncrement?1:c.length-1;for(f=h;f>0;f--){l=c[f]-c[f-1];if(u===e||l0||!t.ignoreMaxPadding)&&(t.max+=m*d))),t.min===t.max||t.min===undefined||t.max===undefined?t.tickInterval=1:c&&!y&&w===t.linkedParent.options.tickPixelInterval?t.tickInterval=t.linkedParent.tickInterval:t.tickInterval=Bt(y,S?1:(t.max-t.min)*w/(t.len||1)),l&&!e&&an(t.series,function(e){e.processData(t.min!==t.oldMin||t.max!==t.oldMax)}),t.setAxisTranslation(e),t.beforeSetTickPositions&&t.beforeSetTickPositions(),t.postProcessTickInterval&&(t.tickInterval=t.postProcessTickInterval(t.tickInterval)),!y&&t.tickIntervalx&&E.shift(),i.endOnTick?t.max=T:t.max+Nt[r]&&this.options.alignTicks!==!1&&(t[r]=n.length),e.maxTicks=t},adjustTickAmount:function(){var e=this,t=e.chart,n=e.xOrY,r=e.tickPositions,i=t.maxTicks;if(i&&i[n]&&!e.isDatetimeAxis&&!e.categories&&!e.isLinked&&e.options.alignTicks!==!1){var s=e.tickAmount,o=r.length,u;e.tickAmount=u=i[n];if(oe||e===null?e=r:i=t.min&&e<=t.max)l[e]||(l[e]=new Dn(t,e)),b&&l[e].isNew&&l[e].render(n,!0),l[e].isActive=!0,l[e].render(n)}),d&&an(u,function(n,r){r%2===0&&n1||f(t-s.y)>1)&&(clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){i&&i.move(e,t,n,r)},32))},hide:function(){if(!this.isHidden){var e=this.chart.hoverPoints;this.label.hide(),e&&an(e,function(e){e.setState()}),this.chart.hoverPoints=null,this.isHidden=!0}},hideCrosshairs:function(){an(this.crosshairs,function(e){e&&e.hide()})},getAnchor:function(e,t){var n,r=this.chart,s=r.inverted,o=0,u=0,a;return e=Ht(e),n=e[0].tooltipPos,n||(an(e,function(e){a=e.series.yAxis,o+=e.plotX,u+=(e.plotLow?(e.plotLow+e.plotHigh)/2:e.plotY)+(!s&&a?a.top-r.plotTop:0)}),o/=e.length,u/=e.length,n=[s?r.plotWidth-u:o,this.shared&&!s&&e.length>1&&t?t.chartY-r.plotTop:s?r.plotHeight-o:u]),cn(n,i)},getPosition:function(e,t,n){var r=this.chart,i=r.plotLeft,s=r.plotTop,o=r.plotWidth,a=r.plotHeight,f=Bt(this.options.distance,12),l=n.plotX,c=n.plotY,h=l+i+(r.inverted?f:-e-f),p=c-t+s+15,d;return h<7&&(h=i+u(l,0)+f),h+e>i+o&&(h-=h+e-(i+o),p=c-t+s-f,d=!0),p=p&&c<=p+t&&(p=c+s+f)),p+t>s+a&&(p=u(s,s+a-t-f)),{x:h,y:p}},refresh:function(e,t){function u(){var e=this,t=e.points||Ht(e),n=t[0].series,r;return r=[n.tooltipHeaderFormatter(t[0].key)],an(t,function(e){n=e.series,r.push(n.tooltipFormatter&&n.tooltipFormatter(e)||e.point.tooltipFormatter(n.tooltipOptions.pointFormat))}),r.push(o.footerFormat||""),r.join("")}var n=this,r=n.chart,s=n.label,o=n.options,a,f,l,c,h={},p,d=[],v=o.formatter||u,m=r.hoverPoints,g,y,b=o.crosshairs,w=n.shared,E;c=n.getAnchor(e,t),a=c[0],f=c[1],w&&(!e.series||!e.series.noSharedTooltip)?(r.hoverPoints=e,m&&an(m,function(e){e.setState()}),an(e,function(e){e.setState(K),d.push(e.getLabelConfig())}),h={x:e[0].category,y:e[0].y},h.points=d,e=e[0]):h=e.getLabelConfig(),p=v.call(h),E=e.series,l=w||!E.isCartesian||E.tooltipOutsidePlot||r.isInsidePlot(a,f),p===!1||!l?this.hide():(n.isHidden&&s.show(),s.attr({text:p}),y=o.borderColor||e.color||E.color||"#606060",s.attr({stroke:y}),g=(o.positioner||n.getPosition).call(n,s.width,s.height,{plotX:a,plotY:f}),n.move(i(g.x),i(g.y),a+r.plotLeft,f+r.plotTop),n.isHidden=!1);if(b){b=Ht(b);var S,x=b.length,T,N;while(x--)N=e.series[x?"yAxis":"xAxis"],b[x]&&N&&(S=N.getPlotLinePath(x?Bt(e.stackY,e.y):e.x,1),n.crosshairs[x]?n.crosshairs[x].attr({d:S,visibility:U}):(T={"stroke-width":b[x].width||1,stroke:b[x].color||"#C0C0C0",zIndex:b[x].zIndex||2},b[x].dashStyle&&(T.dashstyle=b[x].dashStyle),n.crosshairs[x]=r.renderer.path(S).attr(T).add()))}vn(r,"tooltipRefresh",{text:p,x:a+r.plotLeft,y:f+r.plotTop,borderColor:y})}},Fn.prototype={normalizeMouseEvent:function(t){var r,s,o,u;return t=t||n.event,t.target||(t.target=t.srcElement),t=mn(t),u=t.touches?t.touches.item(0):t,this.chartPosition=r=ln(this.chart.container),u.pageX===e?(s=t.x,o=t.y):(s=u.pageX-r.left,o=u.pageY-r.top),xt(t,{chartX:i(s),chartY:i(o)})},getMouseCoordinates:function(e){var t={xAxis:[],yAxis:[]},n=this.chart;return an(n.axes,function(r){var i=r.isXAxis,s=n.inverted?!i:i;t[i?"xAxis":"yAxis"].push({axis:r,value:r.translate((s?e.chartX-n.plotLeft:r.top+r.len-e.chartY)-r.minPixelPadding,!0)})}),t},getIndex:function(e){var t=this.chart;return t.inverted?t.plotHeight+t.plotTop-e.chartY:e.chartX-t.plotLeft},onmousemove:function(e){var t=this,n=t.chart,r=n.series,i=n.tooltip,s,o,u=n.hoverPoint,l=n.hoverSeries,c,h,p=n.chartWidth,d=t.getIndex(e);if(i&&t.options.tooltip.shared&&(!l||!l.noSharedTooltip)){o=[],c=r.length;for(h=0;hp&&o.splice(c,1);o.length&&o[0].plotX!==t.hoverX&&(i.refresh(o,e),t.hoverX=o[0].plotX)}l&&l.tracker&&(s=l.tooltipPoints[d],s&&s!==u&&s.onMouseOver())},resetTracker:function(t){var n=this,r=n.chart,i=r.hoverSeries,s=r.hoverPoint,o=r.tooltip,u=o&&o.shared?r.hoverPoints:s;t=t&&o&&u,t&&Ht(u)[0].plotX===e&&(t=!1),t?o.refresh(u):(s&&s.onMouseOut(),i&&i.onMouseOut(),o&&(o.hide(),o.hideCrosshairs()),n.hoverX=null)},setDOMEvents:function(){function c(){if(n.selectionMarker){var e={xAxis:[],yAxis:[]},o=n.selectionMarker.getBBox(),f=o.x-r.plotLeft,l=o.y-r.plotTop,h;s&&(an(r.axes,function(t){if(t.options.zoomEnabled!==!1){var n=t.isXAxis,i=r.inverted?!n:n,s=t.translate(i?f:r.plotHeight-l-o.height,!0,0,0,1),c=t.translate((i?f+o.width:r.plotHeight-l)-2*t.minPixelPadding,!0,0,0,1);!isNaN(s)&&!isNaN(c)&&(e[n?"xAxis":"yAxis"].push({axis:t,min:a(s,c),max:u(s,c)}),h=!0)}}),h&&vn(r,"selection",e,function(e){r.zoom(e)})),n.selectionMarker=n.selectionMarker.destroy()}r&&(jt(i,{cursor:"auto"}),r.cancelClick=s,r.mouseIsDown=s=!1),dn(t,"mouseup",c),C&&dn(t,"touchend",c)}var e=!0,n=this,r=n.chart,i=r.container,s,o=n.zoomX&&!r.inverted||n.zoomY&&r.inverted,l=n.zoomY&&!r.inverted||n.zoomX&&r.inverted;n.hideTooltipOnMouseMove=function(e){e=mn(e),n.chartPosition&&r.hoverSeries&&r.hoverSeries.isCartesian&&!r.isInsidePlot(e.pageX-n.chartPosition.left-r.plotLeft,e.pageY-n.chartPosition.top-r.plotTop)&&n.resetTracker()},n.hideTooltipOnMouseLeave=function(){n.resetTracker(),n.chartPosition=null},i.onmousedown=function(e){e=n.normalizeMouseEvent(e),e.type.indexOf("touch")===-1&&e.preventDefault&&e.preventDefault(),r.mouseIsDown=!0,r.cancelClick=!1,r.mouseDownX=n.mouseDownX=e.chartX,n.mouseDownY=e.chartY,pn(t,"mouseup",c),C&&pn(t,"touchend",c)};var h=function(t){if(t&&t.touches&&t.touches.length>1)return;t=n.normalizeMouseEvent(t);var i=t.type,u=t.chartX,a=t.chartY,c=!r.isInsidePlot(u-r.plotLeft,a-r.plotTop);i.indexOf("touch")===-1&&(t.returnValue=!1),i==="touchstart"&&(Pt(t.target,"isTracker")?r.runTrackerClick||t.preventDefault():!r.runChartClick&&!c&&t.preventDefault()),c&&(ur.plotLeft+r.plotWidth&&(u=r.plotLeft+r.plotWidth),ar.plotTop+r.plotHeight&&(a=r.plotTop+r.plotHeight));if(r.mouseIsDown&&i!=="touchstart"){s=Math.sqrt(Math.pow(n.mouseDownX-u,2)+Math.pow(n.mouseDownY-a,2));if(s>10){var h=r.isInsidePlot(n.mouseDownX-r.plotLeft,n.mouseDownY-r.plotTop);r.hasCartesianSeries&&(n.zoomX||n.zoomY)&&h&&(n.selectionMarker||(n.selectionMarker=r.renderer.rect(r.plotLeft,r.plotTop,o?1:r.plotWidth,l?1:r.plotHeight,0).attr({fill:n.options.chart.selectionMarkerFill||"rgba(69,114,167,0.25)",zIndex:7}).add()));if(n.selectionMarker&&o){var p=u-n.mouseDownX;n.selectionMarker.attr({width:f(p),x:(p>0?0:p)+n.mouseDownX})}if(n.selectionMarker&&l){var d=a-n.mouseDownY;n.selectionMarker.attr({height:f(d),y:(d>0?0:d)+n.mouseDownY})}h&&!n.selectionMarker&&n.options.chart.panning&&r.pan(u)}}return c||n.onmousemove(t),e=c,c||!r.hasCartesianSeries};/Android 4\.0/.test(d)||(i.onmousemove=h),pn(i,"mouseleave",n.hideTooltipOnMouseLeave),C||pn(t,"mousemove",n.hideTooltipOnMouseMove),i.ontouchstart=function(e){(n.zoomX||n.zoomY)&&i.onmousedown(e),h(e)},i.ontouchmove=h,i.ontouchend=function(){s&&n.resetTracker()},i.onclick=function(e){var t=r.hoverPoint,i,s;e=n.normalizeMouseEvent(e),e.cancelBubble=!0,r.cancelClick||(t&&(Pt(e.target,"isTracker")||Pt(e.target.parentNode,"isTracker"))?(i=t.plotX,s=t.plotY,xt(t,{pageX:n.chartPosition.left+r.plotLeft+(r.inverted?r.plotWidth-s:i),pageY:n.chartPosition.top+r.plotTop+(r.inverted?r.plotHeight-i:s)}),vn(t.series,"click",xt(e,{point:t})),t.firePointEvent("click",e)):(xt(e,n.getMouseCoordinates(e)),r.isInsidePlot(e.chartX-r.plotLeft,e.chartY-r.plotTop)&&vn(r,"click",e)))}},destroy:function(){var e=this,n=e.chart,r=n.container;n.trackerGroup&&(n.trackerGroup=n.trackerGroup.destroy()),dn(r,"mouseleave",e.hideTooltipOnMouseLeave),dn(t,"mousemove",e.hideTooltipOnMouseMove),r.onclick=r.onmousedown=r.onmousemove=r.ontouchstart=r.ontouchend=r.ontouchmove=null,clearInterval(this.tooltipTimeout)},init:function(e,t){e.trackerGroup||(e.trackerGroup=e.renderer.g("tracker").attr({zIndex:9 }).add()),t.enabled&&(e.tooltip=new jn(e,t)),this.setDOMEvents()}},In.prototype={init:function(e){var t=this,n=t.options=e.options.legend;if(!n.enabled)return;var r=n.itemStyle,i=Bt(n.padding,8),s=n.itemMarginTop||0;t.baseline=Nt(r.fontSize)+3+s,t.itemStyle=r,t.itemHiddenStyle=hn(r,n.itemHiddenStyle),t.itemMarginTop=s,t.padding=i,t.initialItemX=i,t.initialItemY=i-5,t.maxItemWidth=0,t.chart=e,t.itemHeight=0,t.lastLineHeight=0,t.render(),pn(t.chart,"endResize",function(){t.positionCheckboxes()})},colorizeItem:function(t,n){var r=this,i=r.options,s=t.legendItem,o=t.legendLine,u=t.legendSymbol,a=r.itemHiddenStyle.color,f=n?i.itemStyle.color:a,l=n?t.color:a,c=t.options&&t.options.marker,h={stroke:l,fill:l},p,d;s&&s.css({fill:f}),o&&o.attr({stroke:l});if(u){if(c){c=t.convertAttribs(c);for(p in c)d=c[p],d!==e&&(h[p]=d)}u.attr(h)}},positionItem:function(e){var t=this,n=t.options,r=n.symbolPadding,i=!n.rtl,s=e._legendItemPos,o=s[0],u=s[1],a=e.checkbox;e.legendGroup&&e.legendGroup.translate(i?o:t.legendWidth-o-2*r-4,u),a&&(a.x=o,a.y=u)},destroyItem:function(e){var t=e.checkbox;an(["legendItem","legendLine","legendSymbol","legendGroup"],function(t){e[t]&&e[t].destroy()}),t&&Yt(e.checkbox)},destroy:function(){var e=this,t=e.group,n=e.box;n&&(e.box=n.destroy()),t&&(e.group=t.destroy())},positionCheckboxes:function(e){var t=this.group.alignAttr,n,r=this.clipHeight||this.legendHeight;t&&(n=t.translateY,an(this.allItems,function(i){var s=i.checkbox,o;s&&(o=n+s.y+(e||0)+3,jt(s,{left:t.translateX+i.legendItemWidth+s.x-20+z,top:o+z,display:o>n-6&&o(d||n.chartWidth-2*c-g)&&(t.itemX=g,t.itemY+=m+t.lastLineHeight+v,t.lastLineHeight=0),t.maxItemWidth=u(t.maxItemWidth,b),t.lastItemY=m+t.itemY+v,t.lastLineHeight=u(p,t.lastLineHeight),e._legendItemPos=[t.itemX,t.itemY],s?t.itemX+=b:(t.itemY+=m+p+v,t.lastLineHeight=p),t.offsetWidth=d||u(s?t.itemX-g:b,t.offsetWidth)},render:function(){var e=this,t=e.chart,n=t.renderer,r=e.group,i,s,o,u,a=e.box,f=e.options,l=e.padding,c=f.borderWidth,h=f.backgroundColor;e.itemX=e.initialItemX,e.itemY=e.initialItemY,e.offsetWidth=0,e.lastItemY=0,r||(e.group=r=n.g("legend").attr({zIndex:7}).add(),e.contentGroup=n.g().attr({zIndex:1}).add(r),e.scrollGroup=n.g().add(e.contentGroup),e.clipRect=n.clipRect(0,0,9999,t.chartHeight),e.contentGroup.clip(e.clipRect)),i=[],an(t.series,function(e){var t=e.options;if(!t.showInLegend)return;i=i.concat(e.legendItems||(t.legendType==="point"?e.data:e))}),Jt(i,function(e,t){return(e.options&&e.options.legendIndex||0)-(t.options&&t.options.legendIndex||0)}),f.reversed&&i.reverse(),e.allItems=i,e.display=s=!!i.length,an(i,function(t){e.renderItem(t)}),o=f.width||e.offsetWidth,u=e.lastItemY+e.lastLineHeight,u=e.handleOverflow(u);if(c||h)o+=l,u+=l,a?o>0&&u>0&&(a[a.isNew?"attr":"animate"](a.crisp(null,null,null,o,u)),a.isNew=!1):(e.box=a=n.rect(0,0,o,u,f.borderRadius,c||0).attr({stroke:f.borderColor,"stroke-width":c||0,fill:h||W}).add(r).shadow(f.shadow),a.isNew=!0),a[s?"show":"hide"]();e.legendWidth=o,e.legendHeight=u,an(i,function(t){e.positionItem(t)}),s&&r.align(xt({width:o,height:u},f),!0,t.spacingBox),t.isResizing||this.positionCheckboxes()},handleOverflow:function(e){var t=this,n=this.chart,r=n.renderer,i,s=this.options,u=s.y,f=s.verticalAlign==="top",l=n.spacingBox.height+(f?-u:u)-this.padding,c=s.maxHeight,h,p=this.clipRect,d=s.navigation,v=Bt(d.animation,!0),m=d.arrowSize||12,g=this.nav;return s.layout==="horizontal"&&(l/=2),c&&(l=a(l,c)),e>l?(this.clipHeight=h=l-20,this.pageCount=i=o(e/h),this.currentPage=Bt(this.currentPage,1),this.fullHeight=e,p.attr({height:h}),g||(this.nav=g=r.g().attr({zIndex:1}).add(this.group),this.up=r.symbol("triangle",0,0,m,m).on("click",function(){t.scroll(-1,v)}).add(g),this.pager=r.text("",15,10).css(d.style).add(g),this.down=r.symbol("triangle-down",0,0,m,m).on("click",function(){t.scroll(1,v)}).add(g)),t.scroll(0),e=l):g&&(p.attr({height:n.chartHeight}),g.hide(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0),e},scroll:function(t,n){var r=this.pageCount,i=this.currentPage+t,s=this.clipHeight,o=this.options.navigation,u=o.activeColor,f=o.inactiveColor,l=this.pager,c=this.padding,h;i>r&&(i=r),i>0&&(n!==e&&tn(n,this.chart),this.nav.attr({translateX:c,translateY:s+7,visibility:U}),this.up.attr({fill:i===1?f:u}).css({cursor:i===1?"default":"pointer"}),l.attr({text:i+"/"+this.pageCount}),this.down.attr({x:18+this.pager.getBBox().width,fill:i===r?f:u}).css({cursor:i===r?"default":"pointer"}),h=-a(s*(i-1),this.fullHeight-s+c)+1,this.scrollGroup.animate({translateY:h}),l.attr({text:i+"/"+r}),this.currentPage=i,this.positionCheckboxes(h))}},qn.prototype={init:function(e,t){var n,r=e.series;e.series=null,n=hn(O,e),n.series=e.series=r;var i=n.chart,s=i.margin,o=kt(s)?s:[s,s,s,s];this.optionsMarginTop=Bt(i.marginTop,o[0]),this.optionsMarginRight=Bt(i.marginRight,o[1]),this.optionsMarginBottom=Bt(i.marginBottom,o[2]),this.optionsMarginLeft=Bt(i.marginLeft,o[3]);var u=i.events;this.runChartClick=u&&!!u.click,this.callback=t,this.isResizing=0,this.options=n,this.axes=[],this.series=[],this.hasCartesianSeries=i.showAxes;var a=this,f;a.index=B.length,B.push(a),i.reflow!==!1&&pn(a,"load",a.initReflow);if(u)for(f in u)pn(a,f,u[f]);a.xAxis=[],a.yAxis=[],a.animation=T?!1:Bt(i.animation,!0),a.pointCount=0,a.counters=new $t,a.firstRender()},initSeries:function(e){var t=this,n=t.options.chart,r=e.type||n.type||n.defaultSeriesType,i=new St[r];return i.init(this,e),i},addSeries:function(e,t,n){var r,i=this;return e&&(tn(n,i),t=Bt(t,!0),vn(i,"addSeries",{options:e},function(){r=i.initSeries(e),i.isDirtyLegend=!0,t&&i.redraw()})),r},isInsidePlot:function(e,t,n){var r=n?t:e,i=n?e:t;return r>=0&&r<=this.plotWidth&&i>=0&&i<=this.plotHeight},adjustTickAmounts:function(){this.options.chart.alignTicks!==!1&&an(this.axes,function(e){e.adjustTickAmount()}),this.maxTicks=null},redraw:function(e){var t=this,n=t.axes,r=t.series,i=t.tracker,s=t.legend,o=t.isDirtyLegend,u,a=t.isDirtyBox,f=r.length,l=f,c,h=t.renderer,p=h.isHidden(),d=[];tn(e,t),p&&t.cloneRenderTo();while(l--){c=r[l];if(c.isDirty&&c.options.stacking){u=!0;break}}if(u){l=f;while(l--)c=r[l],c.options.stacking&&(c.isDirty=!0)}an(r,function(e){e.isDirty&&e.options.legendType==="point"&&(o=!0)}),o&&s.options.enabled&&(s.render(),t.isDirtyLegend=!1),t.hasCartesianSeries&&(t.isResizing||(t.maxTicks=null,an(n,function(e){e.setScale()})),t.adjustTickAmounts(),t.getMargins(),an(n,function(e){e.isDirtyExtremes&&(e.isDirtyExtremes=!1,d.push(function(){vn(e,"afterSetExtremes",e.getExtremes())}));if(e.isDirty||a||u)e.redraw(),a=!0})),a&&t.drawChartBox(),an(r,function(e){e.isDirty&&e.visible&&(!e.isCartesian||e.xAxis)&&e.redraw()}),i&&i.resetTracker&&i.resetTracker(!0),h.draw(),vn(t,"redraw"),p&&t.cloneRenderTo(!0),an(d,function(e){e.call()})},showLoading:function(e){var t=this,n=t.options,r=t.loadingDiv,i=n.loading;r||(t.loadingDiv=r=Ft(j,{className:R+"loading"},xt(i.style,{left:t.plotLeft+z,top:t.plotTop+z,width:t.plotWidth+z,height:t.plotHeight+z,zIndex:10,display:W}),t.container),t.loadingSpan=Ft("span",null,i.labelStyle,r)),t.loadingSpan.innerHTML=e||n.lang.loading,t.loadingShown||(jt(r,{opacity:0,display:""}),gn(r,{opacity:i.style.opacity},{duration:i.showDuration||0}),t.loadingShown=!0)},hideLoading:function(){var e=this.options,t=this.loadingDiv;t&&gn(t,{opacity:0},{duration:e.loading.hideDuration||100,complete:function(){jt(t,{display:W})}}),this.loadingShown=!1},get:function(e){var t=this,n=t.axes,r=t.series,i,s,o;for(i=0;ia(s.dataMin,s.min)&&f19?e.containerHeight:400))},cloneRenderTo:function(e){var n=this.renderToClone,r=this.container;e?n&&(this.renderTo.appendChild(r),Yt(n),delete this.renderToClone):(r&&this.renderTo.removeChild(r),this.renderToClone=n=this.renderTo.cloneNode(0),jt(n,{position:F,top:"-9999px",display:"block"}),t.body.appendChild(n),r&&n.appendChild(r))},getContainer:function(){var e=this,n,r=e.options.chart,i,s,o,u="data-highcharts-chart",a,f;e.renderTo=o=r.renderTo,f=R+L++,Ct(o)&&(e.renderTo=o=t.getElementById(o)),o||Zt(13,!0),a=Nt(Pt(o,u)),!isNaN(a)&&B[a]&&B[a].destroy(),Pt(o,u,e.index),o.innerHTML="",o.offsetWidth||e.cloneRenderTo(),e.getChartSize(),i=e.chartWidth,s=e.chartHeight,e.container=n=Ft(j,{className:R+"container"+(r.className?" "+r.className:""),id:f},xt({position:I,overflow:q,width:i+z,height:s+z,textAlign:"left",lineHeight:"normal",zIndex:0},r.style),e.renderToClone||o),e.renderer=r.forExport?new kn(n,i,s,!0):new N(n,i,s),T&&e.renderer.create(e,n,i,s)},getMargins:function(){var e=this,t=e.options.chart,n=t.spacingTop,r=t.spacingRight,i=t.spacingBottom,s=t.spacingLeft,o,a=e.legend,f=e.optionsMarginTop,l=e.optionsMarginLeft,c=e.optionsMarginRight,h=e.optionsMarginBottom,p=e.chartTitleOptions,d=e.chartSubtitleOptions,v=e.options.legend,m=Bt(v.margin,10),g=v.x,y=v.y,b=v.align,w=v.verticalAlign,E;e.resetMargins(),o=e.axisOffset,(e.title||e.subtitle)&&!Dt(e.optionsMarginTop)&&(E=u(e.title&&!p.floating&&!p.verticalAlign&&p.y||0,e.subtitle&&!d.floating&&!d.verticalAlign&&d.y||0),E&&(e.plotTop=u(e.plotTop,E+Bt(p.margin,15)+n))),a.display&&!v.floating&&(b==="right"?Dt(c)||(e.marginRight=u(e.marginRight,a.legendWidth-g+m+r)):b==="left"?Dt(l)||(e.plotLeft=u(e.plotLeft,a.legendWidth+g+m+s)):w==="top"?Dt(f)||(e.plotTop=u(e.plotTop,a.legendHeight+y+m+n)):w==="bottom"&&(Dt(h)||(e.marginBottom=u(e.marginBottom,a.legendHeight-y+m+i)))),e.extraBottomMargin&&(e.marginBottom+=e.extraBottomMargin),e.extraTopMargin&&(e.plotTop+=e.extraTopMargin),e.hasCartesianSeries&&an(e.axes,function(e){e.getOffset()}),Dt(l)||(e.plotLeft+=o[3]),Dt(f)||(e.plotTop+=o[0]),Dt(h)||(e.marginBottom+=o[2]),Dt(c)||(e.marginRight+=o[1]),e.setChartSize()},initReflow:function(){function o(o){var u=r.width||sn(i,"width"),a=r.height||sn(i,"height"),f=o?o.target:n;if(!e.hasUserSize&&u&&a&&(f===n||f===t)){if(u!==e.containerWidth||a!==e.containerHeight)clearTimeout(s),e.reflowTimeout=s=setTimeout(function(){e.container&&(e.setSize(u,a,!1),e.hasUserSize=null)},100);e.containerWidth=u,e.containerHeight=a}}var e=this,r=e.options.chart,i=e.renderTo,s;pn(n,"resize",o),pn(e,"destroy",function(){dn(n,"resize",o)})},setSize:function(e,t,n){var r=this,s,o,a,f=r.resetZoomButton,l=r.title,c=r.subtitle,h;r.isResizing+=1,h=function(){r&&vn(r,"endResize",null,function(){r.isResizing-=1})},tn(n,r),r.oldChartHeight=r.chartHeight,r.oldChartWidth=r.chartWidth,Dt(e)&&(r.chartWidth=s=u(0,i(e)),r.hasUserSize=!!s),Dt(t)&&(r.chartHeight=o=u(0,i(t))),jt(r.container,{width:s+z,height:o+z}),r.renderer.setSize(s,o,n),r.plotWidth=s-r.plotLeft-r.marginRight,r.plotHeight=o-r.plotTop-r.marginBottom,r.maxTicks=null,an(r.axes,function(e){e.isDirty=!0,e.setScale()}),an(r.series,function(e){e.isDirty=!0}),r.isDirtyLegend=!0,r.isDirtyBox=!0,r.getMargins(),a=r.spacingBox,l&&l.align(null,null,a),c&&c.align(null,null,a),f&&f.align&&f.align(null,null,r[f.alignTo]),r.redraw(n),r.oldChartHeight=null,vn(r,"resize"),_===!1?h():setTimeout(h,_&&_.duration||500)},setChartSize:function(){var e=this,t=e.inverted,n=e.chartWidth,r=e.chartHeight,s=e.options.chart,o=s.spacingTop,a=s.spacingRight,f=s.spacingBottom,l=s.spacingLeft,c,h,p,d,v;e.plotLeft=c=i(e.plotLeft),e.plotTop=h=i(e.plotTop),e.plotWidth=p=u(0,i(n-c-e.marginRight)),e.plotHeight=d=u(0,i(r-h-e.marginBottom)),e.plotSizeX=t?d:p,e.plotSizeY=t?p:d,e.plotBorderWidth=v=s.plotBorderWidth||0,e.spacingBox={x:l,y:o,width:n-l-a,height:r-o-f},e.plotBox={x:c,y:h,width:p,height:d},e.clipBox={x:v/2,y:v/2,width:e.plotSizeX-v,height:e.plotSizeY-v},an(e.axes,function(e){e.setAxisSize(),e.setAxisTranslation()})},resetMargins:function(){var e=this,t=e.options.chart,n=t.spacingTop,r=t.spacingRight,i=t.spacingBottom,s=t.spacingLeft;e.plotTop=Bt(e.optionsMarginTop,n),e.marginRight=Bt(e.optionsMarginRight,r),e.marginBottom=Bt(e.optionsMarginBottom,i),e.plotLeft=Bt(e.optionsMarginLeft,s),e.axisOffset=[0,0,0,0]},drawChartBox:function(){var e=this,t=e.options.chart,n=e.renderer,r=e.chartWidth,i=e.chartHeight,s=e.chartBackground,o=e.plotBackground,u=e.plotBorder,a=e.plotBGImage,f=t.borderWidth||0,l=t.backgroundColor,c=t.plotBackgroundColor,h=t.plotBackgroundImage,p=t.plotBorderWidth||0,d,v,m=e.plotLeft,g=e.plotTop,y=e.plotWidth,b=e.plotHeight,w=e.plotBox,E=e.clipRect,S=e.clipBox;d=f+(t.shadow?8:0);if(f||l)s?s.animate(s.crisp(null,null,null,r-d,i-d)):(v={fill:l||W},f&&(v.stroke=t.borderColor,v["stroke-width"]=f),e.chartBackground=n.rect(d/2,d/2,r-d,i-d,t.borderRadius,f).attr(v).add().shadow(t.shadow));c&&(o?o.animate(w):e.plotBackground=n.rect(m,g,y,b,0).attr({fill:c}).add().shadow(t.plotShadow)),h&&(a?a.animate(w):e.plotBGImage=n.image(h,m,g,y,b).add()),E?E.animate({width:S.width,height:S.height}):e.clipRect=n.clipRect(S),p&&(u?u.animate(u.crisp(null,m,g,y,b)):e.plotBorder=n.rect(m,g,y,b,0,p).attr({stroke:t.plotBorderColor,"stroke-width":p,zIndex:1}).add()),e.isDirtyBox=!1},propFromSeries:function(){var e=this,t=e.options.chart,n,r=e.options.series,i,s;an(["inverted","angular","polar"],function(o){n=St[t.type||t.defaultSeriesType],s=e[o]||t[o]||n&&n.prototype[o],i=r&&r.length;while(!s&&i--)n=St[r[i].type],n&&n.prototype[o]&&(s=!0);e[o]=s})},render:function(){var e=this,t=e.axes,n=e.renderer,r=e.options,i=r.labels,s=r.credits,o;e.setTitle(),e.legend=new In(e),an(t,function(e){e.setScale()}),e.getMargins(),e.maxTicks=null,an(t,function(e){e.setTickPositions(!0),e.setMaxTicks()}),e.adjustTickAmounts(),e.getMargins(),e.drawChartBox(),e.hasCartesianSeries&&an(t,function(e){e.render()}),e.seriesGroup||(e.seriesGroup=n.g("series-group").attr({zIndex:3}).add()),an(e.series,function(e){e.translate(),e.setTooltipPoints(),e.render()}),i.items&&an(i.items,function(t){var r=xt(i.style,t.style),s=Nt(r.left)+e.plotLeft,o=Nt(r.top)+e.plotTop+12;delete r.left,delete r.top,n.text(t.html,s,o).attr({zIndex:2}).css(r).add()}),s.enabled&&!e.credits&&(o=s.href,e.credits=n.text(s.text,0,0).on("click",function(){o&&(location.href=o)}).attr({align:s.position.align,zIndex:8}).css(s.style).add().align(s.position)),e.hasRendered=!0},destroy:function(){var t=this,n=t.axes,r=t.series,i=t.container,s,o=i&&i.parentNode;vn(t,"destroy"),B[t.index]=e,t.renderTo.removeAttribute("data-highcharts-chart"),dn(t),s=n.length;while(s--)n[s]=n[s].destroy();s=r.length;while(s--)r[s]=r[s].destroy();an(["title","subtitle","chartBackground","plotBackground","plotBGImage","plotBorder","seriesGroup","clipRect","credits","tracker","scroller","rangeSelector","legend","resetZoomButton","tooltip","renderer"],function(e){var n=t[e];n&&n.destroy&&(t[e]=n.destroy())}),i&&(i.innerHTML="",dn(i),o&&Yt(i));for(s in t)delete t[s]},isReadyToRender:function(){var e=this;return!S&&n==n.top&&t.readyState!=="complete"||T&&!n.canvg?(T?_n.push(function(){e.firstRender()},e.options.global.canvasToolsURL):t.attachEvent("onreadystatechange",function(){t.detachEvent("onreadystatechange",e.firstRender),t.readyState==="complete"&&e.firstRender()}),!1):!0},firstRender:function(){var e=this,t=e.options,n=e.callback;if(!e.isReadyToRender())return;e.getContainer(),vn(e,"init"),Highcharts.RangeSelector&&t.rangeSelector.enabled&&(e.rangeSelector=new Highcharts.RangeSelector(e)),e.resetMargins(),e.setChartSize(),e.propFromSeries(),e.getAxes(),an(t.series||[],function(t){e.initSeries(t)}),Highcharts.Scroller&&(t.navigator.enabled||t.scrollbar.enabled)&&(e.scroller=new Highcharts.Scroller(e)),e.tracker=new Fn(e,t),e.render(),e.renderer.draw(),n&&n.apply(e,[e]),an(e.callbacks,function(t){t.apply(e,[e])}),e.cloneRenderTo(!0),vn(e,"load")}},qn.prototype.callbacks=[];var Rn=function(){};Rn.prototype={init:function(e,t,n){var r=this,i=e.chart.counters,s;return r.series=e,r.applyOptions(t,n),r.pointAttr={},e.options.colorByPoint&&(s=e.chart.options.colors,r.color=r.color||s[i.color++],i.wrapColor(s.length)),e.chart.pointCount++,r},applyOptions:function(t,n){var r=this,i=r.series,s=typeof t;r.config=t,s==="number"||t===null?r.y=t:typeof t[0]=="number"?(r.x=t[0],r.y=t[1]):s==="object"&&typeof t.length!="number"?(xt(r,t),r.options=t,t.dataLabels&&(i._hasPointLabels=!0),t.marker&&(i._hasPointMarkers=!0)):typeof t[0]=="string"&&(r.name=t[0],r.y=t[1]),r.x===e&&(r.x=n===e?i.autoIncrement():n)},destroy:function(){var e=this,t=e.series,n=t.chart,r=n.hoverPoints,i;n.pointCount--,r&&(e.setState(),_t(r,e),r.length||(n.hoverPoints=null)),e===n.hoverPoint&&e.onMouseOut();if(e.graphic||e.dataLabel)dn(e),e.destroyElements();e.legendItem&&n.legend.destroyItem(e);for(i in e)e[i]=null},destroyElements:function(){var e=this,t=["graphic","tracker","dataLabel","dataLabelUpper","group","connector","shadowGroup"],n,r=6;while(r--)n=t[r],e[n]&&(e[n]=e[n].destroy())},getLabelConfig:function(){var e=this;return{x:e.category,y:e.y,key:e.name||e.category,series:e.series,point:e,percentage:e.percentage,total:e.total||e.stackTotal}},select:function(e,t){var n=this,r=n.series,i=r.chart;e=Bt(e,!n.selected),n.firePointEvent(e?"select":"unselect",{accumulate:t},function(){n.selected=e,n.setState(e&&Q),t||an(i.getSelectedPoints(),function(e){e.selected&&e!==n&&(e.selected=!1,e.setState(J),e.firePointEvent("unselect"))})})},onMouseOver:function(){var e=this,t=e.series,n=t.chart,r=n.tooltip,i=n.hoverPoint;i&&i!==e&&i.onMouseOut(),e.firePointEvent("mouseOver"),r&&(!r.shared||t.noSharedTooltip)&&r.refresh(e),e.setState(K),n.hoverPoint=e},onMouseOut:function(){var e=this.series.chart,t=e.hoverPoints;if(!t||un(this,t)===-1)this.firePointEvent("mouseOut"),this.setState(),e.hoverPoint=null},tooltipFormatter:function(e){var t=this,n=t.series,r=n.tooltipOptions,i=e.match(/\{(series|point)\.[a-zA-Z]+\}/g),s=/[{\.}]/,o,u,a,f,l,c,h,p={y:0,open:0,high:0,low:0,close:0,percentage:1,total:1};r.valuePrefix=r.valuePrefix||r.yPrefix,r.valueDecimals=Bt(r.valueDecimals,r.yDecimals),r.valueSuffix=r.valueSuffix||r.ySuffix;for(h in i)u=i[h],Ct(u)&&u!==e&&(l=(" "+u).split(s),o={point:t,series:n}[l[1]],c=l[2],o===t&&p.hasOwnProperty(c)?(f=p[c]?c:"value",a=(r[f+"Prefix"]||"")+Rt(t[c],Bt(r[f+"Decimals"],-1))+(r[f+"Suffix"]||"")):a=o[c],e=e.replace(u,a));return e},update:function(e,t,n){var r=this,i=r.series,s=r.graphic,o,u=i.data,a=u.length,f=i.chart;t=Bt(t,!0),r.firePointEvent("update",{options:e},function(){r.applyOptions(e),kt(e)&&(i.getAttribs(),s&&s.attr(r.pointAttr[i.state]));for(o=0;ot+1&&n.push(i.slice(t+1,r)),t=r):r===s-1&&n.push(i.slice(t+1,r+1))});e.segments=n},setOptions:function(e){var t=this.chart,n=t.options,r=n.plotOptions,i=r[this.type],s=e.data,o;return e.data=null,o=hn(i,r.series,e),o.data=e.data=s,this.tooltipOptions=hn(n.tooltip,o.tooltip),i.marker===null&&delete o.marker,o},getColor:function(){var e=this.options,t=this.chart.options.colors,n=this.chart.counters;this.color=e.color||!e.colorByPoint&&t[n.color++]||"gray",n.wrapColor(t.length)},getSymbol:function(){var e=this,t=e.options.marker,n=e.chart,r=n.options.symbols,i=n.counters;e.symbol=t.symbol||r[i.symbol++],/^url/.test(e.symbol)&&(t.radius=0),i.wrapSymbol(r.length)},drawLegendSymbol:function(e){var t=this.options,n=t.marker,r,i=e.options,s,o=i.symbolWidth,u=this.chart.renderer,a=this.legendGroup,f=e.baseline,l;t.lineWidth&&(l={"stroke-width":t.lineWidth},t.dashStyle&&(l.dashstyle=t.dashStyle),this.legendLine=u.path([X,0,f-4,V,o,f-4]).attr(l).add(a)),n&&n.enabled&&(r=n.radius,this.legendSymbol=s=u.symbol(this.symbol,o/2-r,f-4-r,2*r,2*r).add(a))},addPoint:function(e,t,n,r){var i=this,s=i.options,o=i.data,u=i.graph,a=i.area,f=i.chart,l=i.xData,c=i.yData,h=u&&u.shift||0,p=s.data,d,v=i.pointClass.prototype;tn(r,f),u&&n&&(u.shift=h+1),a&&(n&&(a.shift=h+1),a.isArea=!0),t=Bt(t,!0),d={series:i},v.applyOptions.apply(d,[e]),l.push(d.x),c.push(v.toYData?v.toYData.call(d):d.y),p.push(e),s.legendType==="point"&&i.generatePoints(),n&&(o[0]&&o[0].remove?o[0].remove(!1):(o.shift(),l.shift(),c.shift(),p.shift())),i.getAttribs(),i.isDirty=!0,i.isDirtyData=!0,t&&f.redraw()},setData:function(e,t){var n=this,r=n.points,i=n.options,s=n.initialColor,o=n.chart,u=null,a=n.xAxis,f,l=n.pointClass.prototype;n.xIncrement=null,n.pointRange=a&&a.categories?1:i.pointRange,Dt(s)&&(o.counters.color=s);var c=[],h=[],p=e?e.length:[],d=i.turboThreshold||1e3,v,m=n.pointArrayMap,g=m&&m.length;if(p>d){f=0;while(u===null&&f1&&c[1]v||n.forceCrop)){var g=h.getExtremes(),y=g.min,b=g.max;if(r[s-1]b)r=[],i=[];else if(r[0]b){for(p=0;p=y){o=u(0,p-1);break}for(;pb){a=p+1;break}r=r.slice(o,a),i=i.slice(o,a),f=!0}}for(p=r.length-1;p>0;p--)l=r[p]-r[p-1],l>0&&(c===e||l=0&&i<=o)p[i++]=c}t.tooltipPoints=p},tooltipHeaderFormatter:function(e){var t=this,n=t.tooltipOptions,r=n.xDateFormat,i=t.xAxis,s=i&&i.options.type==="datetime",o;if(s&&!r)for(o in P)if(P[o]>=i.closestPointRange){r=n.dateTimeLabelFormats[o];break}return n.headerFormat.replace("{point.key}",s&&At(e)?M(r,e):e).replace("{series.name}",t.name).replace("{series.color}",t.color)},onMouseOver:function(){var e=this,t=e.chart,n=t.hoverSeries;n&&n!==e&&n.onMouseOut(),e.options.events.mouseOver&&vn(e,"mouseOver"),e.setState(K),t.hoverSeries=e},onMouseOut:function(){var e=this,t=e.options,n=e.chart,r=n.tooltip,i=n.hoverPoint;i&&i.onMouseOut(),e&&t.events.mouseOut&&vn(e,"mouseOut"),r&&!t.stickyTracking&&!r.shared&&r.hide(),e.setState(),n.hoverSeries=null},animate:function(e){var t=this,n=t.chart,r=n.renderer,i,s,o=t.options.animation,u=n.clipBox,a=n.inverted,f;o&&!kt(o)&&(o=wn[t.type].animation),f="_sharedClip"+o.duration+o.easing,e?(i=n[f],s=n[f+"m"],i||(n[f]=i=r.clipRect(xt(u,{width:0})),n[f+"m"]=s=r.clipRect(-99,a?-n.plotLeft:-n.plotTop,99,a?n.chartWidth:n.chartHeight)),t.group.clip(i),t.markerGroup.clip(s),t.sharedClipKey=f):(i=n[f],i&&(i.animate({width:n.plotSizeX},o),n[f+"m"].animate({width:n.plotSizeX+99},o)),t.animate=null,t.animationTimeout=setTimeout(function(){t.afterAnimate()},o.duration))},afterAnimate:function(){var e=this.chart,t=this.sharedClipKey,n=this.group,r=this.trackerGroup;n&&this.options.clip!==!1&&(n.clip(e.clipRect),r&&r.clip(e.clipRect),this.markerGroup.clip()),setTimeout(function(){t&&e[t]&&(e[t]=e[t].destroy(),e[t+"m"]=e[t+"m"].destroy())},100)},drawPoints:function(){var t=this,n,r=t.points,i=t.chart,s,o,u,a,f,l,c,h,p=t.options,d=p.marker,v,m,g,y=t.markerGroup;if(d.enabled||t._hasPointMarkers){u=r.length;while(u--)a=r[u],s=a.plotX,o=a.plotY,h=a.graphic,v=a.marker||{},m=d.enabled&&v.enabled===e||v.enabled,g=i.isInsidePlot(s,o,i.inverted),m&&o!==e&&!isNaN(o)?(n=a.pointAttr[a.selected?Q:J],f=n.r,l=Bt(v.symbol,t.symbol),c=l.indexOf("url")===0,h?h.attr({visibility:g?S?"inherit":U:q}).animate(xt({x:s-f,y:o-f},h.symbolName?{width:2*f,height:2*f}:{})):g&&(f>0||c)&&(a.graphic=h=i.renderer.symbol(l,s-f,o-f,2*f,2*f).attr(n).add(y))):h&&(a.graphic=h.destroy())}},convertAttribs:function(e,t,n,r){var i=this.pointAttrToOptions,s,o,u={};e=e||{},t=t||{},n=n||{},r=r||{};for(s in i)o=i[s],u[s]=Bt(e[o],t[s],n[s],r[s]);return u},getAttribs:function(){var e=this,t=wn[e.type].marker?e.options.marker:e.options,n=t.states,r=n[K],i,s=e.color,o={stroke:s,fill:s},u=e.points||[],a,f,l=[],c,h=e.pointAttrToOptions,p,d;e.options.marker?(r.radius=r.radius||t.radius+2,r.lineWidth=r.lineWidth||t.lineWidth+1):r.color=r.color||Nn(r.color||s).brighten(r.brightness).get(),l[J]=e.convertAttribs(t,o),an([K,Q],function(t){l[t]=e.convertAttribs(n[t],l[J])}),e.pointAttr=l,a=u.length;while(a--){f= u[a],t=f.options&&f.options.marker||f.options,t&&t.enabled===!1&&(t.radius=0),p=e.options.colorByPoint;if(f.options)for(d in h)Dt(t[h[d]])&&(p=!0);p?(t=t||{},c=[],n=t.states||{},i=n[K]=n[K]||{},e.options.marker||(i.color=Nn(i.color||f.color).brighten(i.brightness||r.brightness).get()),c[J]=e.convertAttribs(xt({color:f.color},t),l[J]),c[K]=e.convertAttribs(n[K],l[K],c[J]),c[Q]=e.convertAttribs(n[Q],l[Q],c[J])):c=l,f.pointAttr=c}},destroy:function(){var e=this,t=e.chart,n=/AppleWebKit\/533/.test(d),r,i,s=e.data||[],o,u,a;vn(e,"destroy"),dn(e),an(["xAxis","yAxis"],function(t){a=e[t],a&&(_t(a.series,e),a.isDirty=!0)}),e.legendItem&&e.chart.legend.destroyItem(e),i=s.length;while(i--)o=s[i],o&&o.destroy&&o.destroy();e.points=null,clearTimeout(e.animationTimeout),an(["area","graph","dataLabelsGroup","group","markerGroup","tracker","trackerGroup"],function(t){e[t]&&(r=n&&t==="group"?"hide":"destroy",e[t][r]())}),t.hoverSeries===e&&(t.hoverSeries=null),_t(t.series,e);for(u in e)delete e[u]},drawDataLabels:function(){var t=this,n=t.options,r=n.dataLabels,i=t.points,s,o,u,a;if(r.enabled||t._hasPointLabels)t.dlProcessOptions&&t.dlProcessOptions(r),a=t.plotGroup("dataLabelsGroup","data-labels",t.visible?U:q,r.zIndex||6),o=r,an(i,function(n){var i,f=n.dataLabel,l,c,h,p=!0;s=n.options&&n.options.dataLabels,i=o.enabled||s&&s.enabled;if(f&&!i)n.dataLabel=f.destroy();else if(i){h=r.rotation,r=hn(o,s),u=r.formatter.call(n.getLabelConfig(),r),r.style.color=Bt(r.color,r.style.color,t.color,"black");if(f)f.attr({text:u}),p=!1;else if(Dt(u)){l={fill:r.backgroundColor,stroke:r.borderColor,"stroke-width":r.borderWidth,r:r.borderRadius||0,rotation:h,padding:r.padding,zIndex:1};for(c in l)l[c]===e&&delete l[c];f=n.dataLabel=t.chart.renderer[h?"text":"label"](u,0,-999,null,null,null,r.useHTML).attr(l).css(r.style).add(a).shadow(r.shadow)}f&&t.alignDataLabel(n,f,r,null,p)}})},alignDataLabel:function(e,t,n,r,s){var o=this.chart,u=o.inverted,a=Bt(e.plotX,-999),f=Bt(e.plotY,-999),l=t.getBBox(),c;r=xt({x:u?o.plotWidth-f:a,y:i(u?o.plotHeight-a:f),width:0,height:0},r),xt(n,{width:l.width,height:l.height}),n.rotation?(c={align:n.align,x:r.x+n.x+r.width/2,y:r.y+n.y+r.height/2},t[s?"attr":"animate"](c)):(t.align(n,null,r),c=t.alignAttr),t.attr({visibility:n.crop===!1||o.isInsidePlot(c.x,c.y)||o.isInsidePlot(a,f,u)?o.renderer.isSVG?"inherit":U:q})},getSegmentPath:function(e){var t=this,n=[],r=t.options.step;return an(e,function(i,s){var o=i.plotX,u=i.plotY,a;t.getPointSpline?n.push.apply(n,t.getPointSpline(e,i,s)):(n.push(s?V:X),r&&s&&(a=e[s-1],r==="right"?n.push(a.plotX,u):r==="center"?n.push((a.plotX+o)/2,a.plotY,(a.plotX+o)/2,u):n.push(o,a.plotY)),n.push(i.plotX,i.plotY))}),n},getGraphPath:function(){var e=this,t=[],n,r=[];return an(e.segments,function(i){n=e.getSegmentPath(i),i.length>1?t=t.concat(n):r.push(i[0])}),e.singlePoints=r,e.graphPath=t,t},drawGraph:function(){var e=this.options,t=this.graph,n=this.group,r=e.lineColor||this.color,i=e.lineWidth,s=e.dashStyle,o,u=this.getGraphPath();t?(yn(t),t.animate({d:u})):i&&(o={stroke:r,"stroke-width":i,zIndex:1},s&&(o.dashstyle=s),this.graph=this.chart.renderer.path(u).attr(o).add(n).shadow(e.shadow))},invertGroups:function(){function n(){var t={width:e.yAxis.len,height:e.xAxis.len};an(["group","trackerGroup","markerGroup"],function(n){e[n]&&e[n].attr(t).invert()})}var e=this,t=e.chart;pn(t,"resize",n),pn(e,"destroy",function(){dn(t,"resize",n)}),n(),e.invertGroups=n},plotGroup:function(e,t,n,r,i){var s=this[e],o=this.chart,u=this.xAxis,a=this.yAxis;return s||(this[e]=s=o.renderer.g(t).attr({visibility:n,zIndex:r||.1}).add(i)),s.translate(u?u.left:o.plotLeft,a?a.top:o.plotTop),s},render:function(){var e=this,t=e.chart,n,r=e.options,i=r.animation,s=i&&!!e.animate,o=e.visible?U:q,u=r.zIndex,a=e.hasRendered,f=t.seriesGroup;n=e.plotGroup("group","series",o,u,f),e.markerGroup=e.plotGroup("markerGroup","markers",o,u,f),s&&e.animate(!0),e.getAttribs(),n.inverted=t.inverted,e.drawGraph&&e.drawGraph(),e.drawPoints(),e.drawDataLabels(),e.options.enableMouseTracking!==!1&&e.drawTracker(),t.inverted&&e.invertGroups(),r.clip!==!1&&!e.sharedClipKey&&!a&&(n.clip(t.clipRect),this.trackerGroup&&this.trackerGroup.clip(t.clipRect)),s?e.animate():a||e.afterAnimate(),e.isDirty=e.isDirtyData=!1,e.hasRendered=!0},redraw:function(){var e=this,t=e.chart,n=e.isDirtyData,r=e.group;r&&(t.inverted&&r.attr({width:t.plotWidth,height:t.plotHeight}),r.animate({translateX:e.xAxis.left,translateY:e.yAxis.top})),e.translate(),e.setTooltipPoints(!0),e.render(),n&&vn(e,"updatedData")},setState:function(e){var t=this,n=t.options,r=t.graph,i=n.states,s=n.lineWidth;e=e||J;if(t.state!==e){t.state=e;if(i[e]&&i[e].enabled===!1)return;e&&(s=i[e].lineWidth||s+1),r&&!r.dashstyle&&r.attr({"stroke-width":s},e?0:500)}},setVisible:function(t,n){var r=this,i=r.chart,s=r.legendItem,o=r.group,u=r.tracker,a=r.dataLabelsGroup,f=r.markerGroup,l,c,h=r.points,p,d=i.options.chart.ignoreHiddenSeries,v=r.visible;r.visible=t=t===e?!v:t,l=t?"show":"hide",o&&o[l](),f&&f[l]();if(u)u[l]();else if(h){c=h.length;while(c--)p=h[c],p.tracker&&p.tracker[l]()}i.hoverSeries===r&&r.onMouseOut(),a&&a[l](),s&&i.legend.colorizeItem(r,t),r.isDirty=!0,r.options.stacking&&an(i.series,function(e){e.options.stacking&&e.visible&&(e.isDirty=!0)}),d&&(i.isDirtyBox=!0),n!==!1&&i.redraw(),vn(r,l)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(t){var n=this;n.selected=t=t===e?!n.selected:t,n.checkbox&&(n.checkbox.checked=t),vn(n,t?"select":"unselect")},drawTracker:function(){var e=this,t=e.options,n=t.trackByArea,r=[].concat(n?e.areaPath:e.graphPath),i=r.length,s=e.chart,o=s.renderer,u=s.options.tooltip.snap,a=e.tracker,f=t.cursor,l=f&&{cursor:f},c=e.singlePoints,h=this.isCartesian&&this.plotGroup("trackerGroup",null,U,t.zIndex||1,s.trackerGroup),p,d,v=function(){s.hoverSeries!==e&&e.onMouseOver()},m=function(){t.stickyTracking||e.onMouseOut()};if(i&&!n){d=i+1;while(d--)r[d]===X&&r.splice(d+1,0,r[d+1]-u,r[d+2],V),(d&&r[d]===X||d===i)&&r.splice(d,0,V,r[d-2]+u,r[d-1])}for(d=0;d=0;r--)rg&&h>o?(h=u(g,o),d=2*o-h):hb&&d>o?(d=u(b,o),h=2*o-d):dO?l-O:A-(r<=A?O:0)),e.barX=c,e.pointWidth=T,e.shapeType="rect",e.shapeArgs=m=n.renderer.Element.prototype.crisp.call(0,s,c,p,N,d),s%2&&(m.y-=1,m.height+=1),e.trackerArgs=f(d)<3&&hn(e.shapeArgs,{height:6,y:p-3})})},getSymbol:H,drawLegendSymbol:Wn.prototype.drawLegendSymbol,drawGraph:H,drawPoints:function(){var t=this,n=t.options,r=t.chart.renderer,i;an(t.points,function(s){var o=s.plotY,u=s.graphic;o!==e&&!isNaN(o)&&s.y!==null?(i=s.shapeArgs,u?(yn(u),u.animate(hn(i))):s.graphic=u=r[s.shapeType](i).attr(s.pointAttr[s.selected?Q:J]).add(t.group).shadow(n.shadow,null,n.stacking&&!n.borderRadius)):u&&(s.graphic=u.destroy())})},drawTracker:function(){var t=this,n=t.chart,r=n.renderer,i,s,o=+(new Date),u=t.options,a=u.cursor,f=a&&{cursor:a},l=t.isCartesian&&t.plotGroup("trackerGroup",null,U,u.zIndex||1,n.trackerGroup),c,h,p,d=t.points,v,m=d.length,g=function(e){c=e.relatedTarget||e.fromElement,n.hoverSeries!==t&&Pt(c,"isTracker")!==o&&t.onMouseOver(),d[e.target._i].onMouseOver()},y=function(e){u.stickyTracking||(c=e.relatedTarget||e.toElement,Pt(c,"isTracker")!==o&&t.onMouseOut())};while(m--)v=d[m],s=v.tracker,i=v.trackerArgs||v.shapeArgs,h=v.plotY,p=!t.isCartesian||h!==e&&!isNaN(h),delete i.strokeWidth,v.y!==null&&p&&(s?s.attr(i):(v.tracker=s=r[v.shapeType](i).attr({isTracker:o,fill:$,visibility:t.visible?U:q}).on("mouseover",g).on("mouseout",y).css(f).add(v.group||l),C&&s.on("touchstart",g)),s.element._i=m)},alignDataLabel:function(e,t,n,r,i){var s=this.chart,o=s.inverted,u=e.below||e.plotY>Bt(this.translatedThreshold,s.plotSizeY),a=this.options.stacking||n.inside;e.shapeArgs&&(r=hn(e.shapeArgs),o&&(r={x:s.plotWidth-r.y-r.height,y:s.plotHeight-r.x-r.width,width:r.height,height:r.width}),a||(o?(r.x+=u?0:r.width,r.width=0):(r.y+=u?r.height:0,r.height=0))),n.align=Bt(n.align,!o||a?"center":u?"right":"left"),n.verticalAlign=Bt(n.verticalAlign,o||a?"middle":u?"top":"bottom"),Un.prototype.alignDataLabel.call(this,e,t,n,r,i)},animate:function(e){var t=this,n=t.points,r=t.options;e||(an(n,function(e){var n=e.graphic,i=e.shapeArgs,s=t.yAxis,o=r.threshold;n&&(n.attr({height:0,y:Dt(o)?s.getThreshold(o):s.translate(s.getExtremes().min,0,1,0,1)}),n.animate({height:i.height,y:i.y},r.animation))}),t.animate=null)},remove:function(){var e=this,t=e.chart;t.hasRendered&&an(t.series,function(t){t.type===e.type&&(t.isDirty=!0)}),Un.prototype.remove.apply(e,arguments)}});St.column=Jn,wn.bar=hn(wn.column);var Kn=It(Jn,{type:"bar",inverted:!0});St.bar=Kn,wn.scatter=hn(En,{lineWidth:0,states:{hover:{lineWidth:0}},tooltip:{headerFormat:'{series.name}
    ',pointFormat:"x: {point.x}
    y: {point.y}
    "}});var Qn=It(Un,{type:"scatter",sorted:!1,requireSorting:!1,translate:function(){var e=this;Un.prototype.translate.apply(e),an(e.points,function(t){t.shapeType="circle",t.shapeArgs={x:t.plotX,y:t.plotY,r:e.chart.options.tooltip.snap}})},drawTracker:function(){var t=this,n=t.options.cursor,r=n&&{cursor:n},i=t.points,s=i.length,o,u=t.markerGroup,a=function(n){t.onMouseOver(),n.target._i!==e&&i[n.target._i].onMouseOver()},f=function(){t.options.stickyTracking||t.onMouseOut()};while(s--)o=i[s].graphic,o&&(o.element._i=s);t._hasTracking?t._hasTracking=!0:(u.attr({isTracker:!0}).on("mouseover",a).on("mouseout",f).css(r),C&&u.on("touchstart",a))},setTooltipPoints:H});St.scatter=Qn,wn.pie=hn(En,{borderColor:"#FFFFFF",borderWidth:1,center:["50%","50%"],colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name}},legendType:"point",marker:null,size:"75%",showInLegend:!1,slicedOffset:10,states:{hover:{brightness:.1,shadow:!1}}});var Gn=It(Rn,{init:function(){Rn.prototype.init.apply(this,arguments);var e=this,t;return xt(e,{visible:e.visible!==!1,name:Bt(e.name,"Slice")}),t=function(){e.slice()},pn(e,"select",t),pn(e,"unselect",t),e},setVisible:function(t){var n=this,r=n.series,i=r.chart,s=n.tracker,o=n.dataLabel,u=n.connector,a=n.shadowGroup,f;n.visible=t=t===e?!n.visible:t,f=t?"show":"hide",n.group[f](),s&&s[f](),o&&o[f](),u&&u[f](),a&&a[f](),n.legendItem&&i.legend.colorizeItem(n,t),!r.isDirty&&r.options.ignoreHiddenPoint&&(r.isDirty=!0,i.redraw())},slice:function(e,t,n){var r=this,i=r.series,s=i.chart,o=r.slicedTranslation,u;tn(n,s),t=Bt(t,!0),e=r.sliced=Dt(e)?e:!r.sliced,u={translateX:e?o[0]:s.plotLeft,translateY:e?o[1]:s.plotTop},r.group.animate(u),r.shadowGroup&&r.shadowGroup.animate(u)}}),Yn={type:"pie",isCartesian:!1,pointClass:Gn,requireSorting:!1,pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},getColor:function(){this.initialColor=this.chart.counters.color},animate:function(){var e=this,t=e.points,n=e.startAngleRad;an(t,function(t){var r=t.graphic,i=t.shapeArgs;r&&(r.attr({r:e.center[3]/2,start:n,end:n}),r.animate({r:i.r,start:i.start,end:i.end},e.options.animation))}),e.animate=null},setData:function(e,t){Un.prototype.setData.call(this,e,!1),this.processData(),this.generatePoints(),Bt(t,!0)&&this.chart.redraw()},getCenter:function(){var e=this.options,t=this.chart,n=t.plotWidth,r=t.plotHeight,i=e.center.concat([e.size,e.innerSize||0]),s=a(n,r),o;return cn(i,function(e,t){return o=/%$/.test(e),o?[n,r,s,s][t]*Nt(e)/100:e})},translate:function(){this.generatePoints();var e=0,t=this,n=0,s=1e3,o=t.options,u=o.slicedOffset,a=u+o.borderWidth,f,p=t.chart,d,v,m,g=t.startAngleRad=h/180*((o.startAngle||0)%360-90),y=t.points,b=2*h,w,E,S,x=o.dataLabels.distance,T=o.ignoreHiddenPoint,N,C=y.length,k;t.center=f=t.getCenter(),t.getX=function(e,t){return m=r.asin((e-f[1])/(f[2]/2+x)),f[0]+(t?-1:1)*l(m)*(f[2]/2+x)};for(N=0;N.75*b&&(m-=2*h),k.slicedTranslation=cn([l(m)*u+p.plotLeft,c(m)*u+p.plotTop],i),E=l(m)*f[2]/2,S=c(m)*f[2]/2,k.tooltipPos=[f[0]+E*.7,f[1]+S*.7],k.half=m0,m,g,y,b=[[],[]],w,E,S,x,T=2,N,C=function(e,t){return t.y-e.y},k=function(e,t){e.sort(function(e,n){return(n.angle-e.angle)*t})};if(!i.enabled&&!e._hasPointLabels)return;Un.prototype.drawDataLabels.apply(e),an(t,function(e){e.dataLabel&&b[e.half].push(e)}),y=b[0][0]&&b[0][0].dataLabel&&(b[0][0].dataLabel.getBBox().height||21);while(T--){var L=[],A,O=[],M=b[T],_,D=M.length,P;k(M,T-.5);if(c>0){for(_=d-p-c;_<=d+p+c;_+=y)L.push(_);A=L.length;if(D>A){x=[].concat(M),x.sort(C),N=D;while(N--)x[N].rank=N;N=D;while(N--)M[N].rank>=A&&M.splice(N,1);D=M.length}for(N=0;N0){F=O.pop(),P=F.i,E=F.y;if(I>E&&L[P+1]!==null||I
    '),f.prepend(a)),a.click(function(e){s.close(e)}),i.load&&s.load()}e.tools=e.tools||{version:"1.2.6.R4"},e.tools.overlay={addEffect:function(e,t,r){n[e]=[t,r]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:!e.browser.msie||e.browser.version>6,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var t=[],n={};e.tools.overlay.addEffect("default",function(t,n){var r=this.getConf(),i=e(window);r.fixed||(t.top+=i.scrollTop(),t.left+=i.scrollLeft()),t.position=r.fixed?"fixed":"absolute",this.getOverlay().css(t).fadeIn(r.speed,n)},function(e){this.getOverlay().fadeOut(this.getConf().closeSpeed,e)}),e.fn.overlay=function(n){var i=this.data("overlay");return i?i:(e.isFunction(n)&&(n={onBeforeLoad:n}),n=e.extend(!0,{},e.tools.overlay.conf,n),this.each(function(){i=new r(e(this),n),t.push(i),e(this).data("overlay",i)}),n.api?i:this)}}(jQuery),function(e){function n(){if(e.browser.msie){var t=e(document).height(),n=e(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t-n<20?n:t]}return[e(document).width(),e(document).height()]}function r(t){if(t)return t.call(e.mask)}e.tools=e.tools||{version:"1.2.6.R4"};var t;t=e.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:!0,closeOnEsc:!0,zIndex:9998,opacity:.8,startOpacity:0,color:"#fff",onLoad:null,onClose:null}};var i,s,o,u,a;e.mask={load:function(f,l){if(o)return this;typeof f=="string"&&(f={color:f}),f=f||u,u=f=e.extend(e.extend({},t.conf),f),i=e("#"+f.maskId),i.length||(i=e("
    ").attr("id",f.maskId),e("body").append(i));var c=n();return i.css({position:"absolute",top:0,left:0,width:c[0],height:c[1],display:"none",opacity:f.startOpacity,zIndex:f.zIndex}),f.color&&i.css("backgroundColor",f.color),r(f.onBeforeLoad)===!1?this:(f.closeOnEsc&&e(document).bind("keydown.mask",function(t){t.keyCode==27&&e.mask.close(t)}),f.closeOnClick&&i.bind("click.mask",function(t){e.mask.close(t)}),e(window).bind("resize.mask",function(){e.mask.fit()}),l&&l.length&&(a=l.eq(0).css("zIndex"),e.each(l,function(){var t=e(this);/relative|absolute|fixed/i.test(t.css("position"))||t.css("position","relative")}),s=l.css({zIndex:Math.max(f.zIndex+1,a=="auto"?0:a)})),i.css({display:"block"}).fadeTo(f.loadSpeed,f.opacity,function(){e.mask.fit(),r(f.onLoad),o="full"}),o=!0,this)},close:function(){if(o){if(r(u.onBeforeClose)===!1)return this;i.fadeOut(u.closeSpeed,function(){r(u.onClose),s&&s.css({zIndex:a}),o=!1}),e(document).unbind("keydown.mask"),i.unbind("click.mask"),e(window).unbind("resize.mask")}return this},fit:function(){if(o){var e=n();i.css({width:e[0],height:e[1]})}},getMask:function(){return i},isLoaded:function(e){return e?o=="full":o},getConf:function(){return u},getExposed:function(){return s}},e.fn.mask=function(t){return e.mask.load(t),this},e.fn.expose=function(t){return e.mask.load(t,this),this}}(jQuery);var JSON;JSON||(JSON={}),function(){function k(e){return e<10?"0"+e:e}function o(e){return p.lastIndex=0,p.test(e)?'"'+e.replace(p,function(e){var t=r[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function l(t,r){var s,u,a,f,c=e,h,p=r[t];p&&typeof p=="object"&&typeof p.toJSON=="function"&&(p=p.toJSON(t)),typeof i=="function"&&(p=i.call(r,t,p));switch(typeof p){case"string":return o(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":return String(p);case"object":if(!p)return"null";e+=n,h=[];if(Object.prototype.toString.apply(p)==="[object Array]"){f=p.length;for(s=0;s>0,s=arguments[2];while(rt.startPeriod&&e<=t.endPeriod},this.invoke=function(e,t){var n=0,r=this.getConfig(),i=null,s=this.operatorProperties,o=s.length;for(n=0;nt.startPeriod&&e<=t.endPeriod;return t.active&&(n||r)},this.invoke=function(e,t){},this.updateResults=function(e,t,n){var r=!0,i=this.getConfig(),s=i.frequencyTest;typeof s=="function"&&(r=s.call(this,e,t.inValues));if(!r)return;var o=t.outValues,i=this.getConfig();o.ongoingFee=o.ongoingFee?o.ongoingFee+i.ongoingFee:i.ongoingFee,o.totals.ongoingFee=o.totals.ongoingFee?o.totals.ongoingFee+i.ongoingFee:i.ongoingFee,t.outValues=o;var u=n.getStorage(this.type),a=u.feeList=u.feeList||[];a.push({period:e,fee:i.ongoingFee,type:"ongoingFee"})},this.reset=function(){}},n.OngoingFeeOperator.prototype=t.LoanOperator,n.normaliseStartupParams=function(e,t,n){n=$.extend({},{active:!0,includeInPrincipal:!1},n);if(!n.startupFee)throw new Error("Invalid fees configuration. Requires 'startupFee' property.");return this.normaliseStartupFees(e,t,n),n},n.normaliseStartupFees=function(e,t,n){var r=[{termName:"term",periodName:"period",fallbackValue:0}];e.convertTerms(t,n,r)},n.normaliseOngoingParams=function(e,t,n){n=$.extend({},{active:!0,applyInInitialPeriod:!1},n);if(!n.ongoingFee)throw new Error("Invalid fees configuration. Requires 'ongoingFee' property.");return this.normaliseOngoingFees(e,t,n),n},n.normaliseOngoingFees=function(e,t,n){var r=[{termName:"startTerm",periodName:"startPeriod",fallbackValue:0},{termName:"endTerm",periodName:"endPeriod",fallbackValue:Number.POSITIVE_INFINITY}];e.convertTerms(t,n,r)},e.fn.startupFee=function(e){if(e==null)return this;var t=this.squashState({processOperators:!1});e=n.normaliseStartupParams(this,t,e);var r=this.createOperator(n.StartupFeeOperator,e);return this.pushOperator(r),r},e.fn.ongoingFee=function(e){if(e==null)return this;var t=this.squashState({processOperators:!1});e=n.normaliseOngoingParams(this,t,e);var r=this.createOperator(n.OngoingFeeOperator,e);return this.pushOperator(r),r}}(gbst.calculator),function(e){var t=gbst.module("gbst.calculator.loan"),n=gbst.module("gbst.calculator.loan.offset");n.OffsetOperator=function(e){this.type="offset",this.setConfig(e),this.originalConsideredPV=0,this.offsetBalance=0,this.newConsideredPV=0,this.operatorProperties=["consideredPV"],this.isActivePeriod=function(e){var t=this.getConfig();return t.active&&e>=t.startPeriod&&e<=t.endPeriod},this.invoke=function(e,t){var n=this.getConfig(),r=0;this.originalConsideredPV=t.consideredPV,this.offsetBalance=n.offsetBalance,r=this.originalConsideredPV-this.offsetBalance,r=Math.max(r,0),this.newConsideredPV=r,t.consideredPV=r},this.updateResults=function(e,t,n){var r=n.getStorage(this.type),i=r.pmtList=r.pmtList||[];i.push({period:e,originalConsideredPV:this.originalConsideredPV,offsetBalance:this.offsetBalance,newConsideredPV:this.newConsideredPV})},this.reset=function(){}},n.normaliseParams=function(e,t,n){n=$.extend({},{active:!0},n);if(!n.hasOwnProperty("offsetBalance"))throw new Error("Invalid configuration. Requires 'offsetBalance' property.");return this.normaliseOffsetBalance(e,t,n),this.normalisePeriods(e,t,n),n},n.normaliseOffsetBalance=function(e,t,n){var r="offsetBalance",i={},s=parseFloat(n[r],10);if(isNaN(s)||!isFinite(s))throw new Error("Invalid configuration. Expected '"+r+"' to be a finite number but got: '"+n[r]+"'");i[r]=s,$.extend(n,i)},n.normalisePeriods=function(e,t,n){var r=[{termName:"startTerm",periodName:"startPeriod",fallbackValue:0},{termName:"endTerm",periodName:"endPeriod",fallbackValue:Number.POSITIVE_INFINITY}];e.convertTerms(t,n,r)},e.fn.offset=function(e){if(e==null)return this;var t=this.squashState({processOperators:!1});e=n.normaliseParams(this,t,e);var r=this.createOperator(n.OffsetOperator,e);return this.pushOperator(r),r}}(gbst.calculator),function(e){var t=gbst.module("gbst.calculator.loan"),n=gbst.module("gbst.calculator.loan.extrarepayment");n.ExtraRepaymentOperator=function(e){this.type="extraRepayment",this.setConfig(e),this.originalPmt=0,this.newPmt=0,this.operatorProperties=["pmt"],this.isActivePeriod=function(e){var t=this.getConfig();return t.active&&e>t.startPeriod&&e<=t.endPeriod},this.invoke=function(e,t){var n=this.getConfig(),r=n.type;this.originalPmt=t.pmt,this.newPmt=0;if(r=="pmt")this.newPmt=n.pmt;else{if(r!="pmtDiff")throw new Error("Invalid extra-repayment configuration. Expected 'type' to be either 'pmt' or 'pmtDiff' but received: type='"+r+"'");this.newPmt=this.originalPmt+n.pmtDiff}t.pmt=this.newPmt},this.updateResults=function(e,t,n){var r=n.getStorage(this.type),i=r.pmtList=r.pmtList||[],s=this.getConfig(),o=s.type;i.push({period:e,originalPmt:this.originalPmt,type:o,pmt:this.newPmt,pmtDiff:this.newPmt-this.originalPmt})},this.reset=function(){}},n.normaliseParams=function(e,t,n){n=$.extend({},{active:!0},n);if(!n.pmt&&!n.pmtDiff)throw new Error("Invalid configuration. Requires 'pmt' or 'pmtDiff' property.");return this.normaliseRepayment(e,t,n),this.normalisePeriods(e,t,n),n},n.normaliseRepayment=function(e,t,n){var r="pmt",i="pmt";n.hasOwnProperty(r)||(i=r="pmtDiff");var s=parseFloat(n[r],10);if(isNaN(s)||!isFinite(s))throw new Error("Invalid configuration. Expected '"+r+"' to be a finite number but got: '"+n[r]+"'");var o={type:i};o[r]=s,$.extend(n,o)},n.normalisePeriods=function(e,t,n){var r=[{termName:"startTerm",periodName:"startPeriod",fallbackValue:0},{termName:"endTerm",periodName:"endPeriod",fallbackValue:Number.POSITIVE_INFINITY}];e.convertTerms(t,n,r)},e.fn.extraRepayment=function(e){if(e==null)return this;var t=this.squashState({processOperators:!1});e=n.normaliseParams(this,t,e);var r=this.createOperator(n.ExtraRepaymentOperator,e);return this.pushOperator(r),r}}(gbst.calculator),function(e){var t=gbst.module("gbst.loan.shared.view");t.Events={CONTROL_CHANGE:"view.controlchange"},t.SliderView=Backbone.View.extend({templateId:null,model:null,dispatcher:null,controlConfig:null,viewDirty:!0,rangeInput:null,rangeList:null,configFormatters:null,initialize:function(e){this.model=e.model,this.dispatcher=e.dispatcher,this.setControlConfig(e.controlConfig)},setControlConfig:function(e){var t=_.extend({},e.controlData.sliderData);this.controlConfig=_.extend({},e),this.controlConfig.controlData.sliderData=t,this.templateId=this.controlConfig.templateId;var n=_.pick(e,["modelToControlFormatter","controlToModelFormatter"]);return _.defaults(n,{modelToControlFormatter:function(e){return e},controlToModelFormatter:function(e){return e}}),this.configFormatters=n,this},invalidateView:function(){return this.viewDirty=!0,this},render:function(){var t=this.controlConfig,n=null,r=null;if(this.viewDirty){var i=this.prepareContext(t);r=HandlebarsTemplates[this.templateId](i),this.$el.empty().append(r);var s=t.controlData.sliderData;s.max==s.min?(s.oldMax=s.max,s.max=s.max+.01):s.oldMax&&(s.max=s.oldMax),this.rangeList=this.setupRangeInput(this.$el,t);var o=this.$el.find(".rawRange");this.viewDirty=!1,this.rangeInput=o.eq(0).data("rangeinput"),this.initRangeControlBehaviour(o),o.bind("changeValue",e.proxy(this.inputChange_handler,this)),this.controlConfig.emptyValue&&(e(o).focusin(e.proxy(this.clearValue,this)),e(o).focusout(e.proxy(this.restoreValue,this)))}return n=this.model.get(t.name),this.setControlValue(n),this},clearValue:function(t){e(t.target).val("")},restoreValue:function(t){var n=this.model.get(this.controlConfig.name);e(t.target).val(this.controlConfig.formatter(n))},prepareContext:function(e){var t={};return t.name=e.name,t.templateData=_.extend({},e.templateData),t.templateData.title=I18n.t(e.templateData.title),t},setControlValue:function(e){var t=this.configFormatters.modelToControlFormatter(e);this.rangeInput.suppressChangeValue(!0),this.rangeInput.setValue(t),this.rangeInput.suppressChangeValue(!1)},disable:function(e){var t=this.rangeInput.getInput(),n=this.rangeInput.getHandle();e?(t.attr("disabled","disabled"),n.attr("aria-disabled","true")):(t.removeAttr("disabled"),n.attr("aria-disabled","false"))},setValue:function(e){this.rangeInput.setValue(e)},getMaxValue:function(){var e=this.controlConfig,t=e.controlData.sliderData;return t.max},getMinValue:function(){var e=this.controlConfig,t=e.controlData.sliderData;return t.min},resetMaxValue:function(e){var t=this.controlConfig,n=t.controlData.sliderData;n.max=e,typeof n.oldMax!="undefined"&&delete n.oldMax;var r=this.model.get(t.name);r>e&&this.setValue(e)},resetMinValue:function(e){var t=this.controlConfig,n=t.controlData.sliderData;n.min=e;var r=this.model.get(t.name);r";this.controlConfig.sliderFirst!==!1?(u.after(p),this.controlConfig.inputLabelClass&&u.next("label").addClass(this.controlConfig.inputLabelClass)):(u.before(p),this.controlConfig.inputLabelClass&&u.prev("label").addClass(this.controlConfig.inputLabelClass))}var d=this.$el.find(".tooltip-container");if(d&&this.controlConfig.templateData.tooltipBeforeSlider){var v=d.detach();v.insertBefore(h)}var m=this.$el.find(".rangeInputLabel");if(m&&this.controlConfig.rangeInputLabelBeforeInput){var v=m.detach();v.insertBefore(u)}}}})}(jQuery),function(e){var t=gbst.module("gbst.loan.shared.view");t.Events={CONTROL_CHANGE:"view.controlchange"},t.RadiogroupView=Backbone.View.extend({templateId:null,model:null,dispatcher:null,controlConfig:null,viewDirty:!0,configFormatters:null,initialize:function(e){this.model=e.model,this.dispatcher=e.dispatcher,this.setControlConfig(e.controlConfig)},setControlConfig:function(e){this.controlConfig=e,this.templateId=this.controlConfig.templateId;var t=_.pick(e,["modelToControlFormatter","controlToModelFormatter"]);return _.defaults(t,{modelToControlFormatter:function(e){return e},controlToModelFormatter:function(e){return e}}),this.configFormatters=t,this},invalidateView:function(){return this.viewDirty=!0,this},render:function(){var t=this.controlConfig,n=null,r=null;if(this.viewDirty){var i=this.prepareContext(t);r=HandlebarsTemplates[this.templateId](i),this.$el.empty().append(r);var s=this.elements=this.$el.find("fieldset");t.templateData.vertical?s.buttonsetv():s.buttonset(),this.viewDirty=!1,s.bind("change",e.proxy(this.inputChange_handler,this))}return n=this.model.get(t.name),this.setControlValue(n),this},prepareContext:function(e){var t=_.extend({},e);return t.templateData=_.extend({},e.templateData),e.templateData.title&&(t.templateData.title=I18n.t(e.templateData.title)),e.templateData.legend&&(t.templateData.legend=I18n.t(e.templateData.legend)),t},refreshValue:function(){var e=this.model.get(this.controlConfig.name);this.setControlValue(e)},setControlValue:function(e){var t=this.configFormatters.modelToControlFormatter(e),n=this.$el.find(":radio");n.val([t]),n.button("refresh")},inputChange_handler:function(n){var r=e(n.target),i=r.val(),s=i;s=this.configFormatters.controlToModelFormatter(i);var o=this.controlConfig.name;this.model.set(o,s),this.dispatcher.trigger(t.Events.CONTROL_CHANGE,{name:o,value:s,control:this})}})}(jQuery),function(e){e.fn.buttonsetv=function(){e(":radio, :checkbox",this).wrap('
    '),e(this).buttonset(),e("label:first",this).removeClass("ui-corner-left").addClass("ui-corner-top"),e("label:last",this).removeClass("ui-corner-right").addClass("ui-corner-bottom"),mw=0,e("label",this).each(function(t){w=e(this).width(),w>mw&&(mw=w)}),e("label",this).each(function(t){e(this).width(mw)})}}(jQuery),function(e){var t=gbst.module("gbst.loan.shared.view");t.Events={CONTROL_CHANGE:"view.controlchange"},t.StandardInputView=Backbone.View.extend({templateId:null,model:null,dispatcher:null,controlConfig:null,controlsInitialised:!1,input:null,initialize:function(t){this.model=t.model,this.dispatcher=e(t.dispatcher),this.controlConfig=t.controlConfig,this.templateId=this.controlConfig.templateId},render:function(){var t=this.controlConfig,n=null,r=null,i=null;if(!this.controlsInitialised){var s=this.prepareContext(t);i=HandlebarsTemplates[this.templateId](s),this.$el.append(i),this.suppressSliderChange(!0),this.rangeList=this.setupRangeInput(this.$el,t),this.suppressSliderChange(!1);var o=this.$el.find(":range");this.viewDirty=!1,this.rangeInput=o.eq(0).data("rangeinput"),this.initRangeControlBehaviour(o),o.bind("changeValue",e.proxy(this.inputChange_handler,this)),this.input=this.$el.find(":input"),this.controlConfig.emptyValue&&(e(this.input).focusin(e.proxy(this.clearValue,this)),e(this.input).focusout(e.proxy(this.restoreValue,this))),this.controlsInitialised=!0}n=this.model.get(t.name),this.setControlValue(n)},clearValue:function(t){e(t.target).val("")},restoreValue:function(t){e(t.target).val(this.model.get(this.controlConfig.name))},prepareContext:function(e){var t={};return t.name=e.name,t.templateData=_.extend({},e.templateData),e.templateData.disableTranslation||(t.templateData.title=I18n.t(e.templateData.title)),t.controlData=_.extend({},e.controlData),t},suppressSliderChange:function(e){this.ignoreChangeEvents=e,this.rangeInput&&this.rangeInput.suppressChangeValue(e)},setControlValue:function(e){var t=this.controlConfig.formatter,n=e;t&&_.isFunction(t)&&(n=t(e)),this.input.val(n),this.rangeInput.suppressChangeValue(!0),this.rangeInput.setValue(e),this.rangeInput.suppressChangeValue(!1)},inputChange_handler:function(e){var n=this.controlConfig.parser,r=this.input.val(),i={};n&&(r=n(r)),i[this.controlConfig.name]=r,this.model.set(i),this.dispatcher.trigger(t.Events.CONTROL_CHANGE,{name:this.controlConfig.name,value:r,control:this})},setupRangeInput:function(t,n){var r=t.find("input"),i=[],s=n.controlData,o=n.formatter,u=n.parser;return r.each(function(t,n){var r={formatValue:o,parseValue:u,progress:!0};e.extend(r,s.inputData);var a=e(n).rangeinput(r);i.push(a)}),i},initRangeControlBehaviour:function(t){var n=function(e){var t=e.data.api;t.updateFromInput(e)},r=function(e){var t=e.data.api,n=e.data.direction;return e.type!="mousedown"&&(n>0?t.stepUp():t.stepDown()),e.preventDefault(),!1},i=function(t){var n=e(this).parent().data("rangeinput");switch(t.keyCode){case 38:case 39:n.stepUp(),t.preventDefault();break;case 40:case 37:n.stepDown(),t.preventDefault();break;case 33:n.stepUp(10),t.preventDefault();break;case 34:n.stepDown(10),t.preventDefault()}},s=function(t){e(this).focus()},o=0,u=t.length,a=null,f=null,l=null,c=null,h=null,p=null,d=null,v=null;for(o=0;o
    '),this},prepareContext:function(e){var t=_.extend({},e);return t.templateData=_.extend({},e.templateData),t.templateData.titleString=I18n.t(e.templateData.title),t},rebuild:function(t){var n=this.input.selectmenu("index");if(n===-1||n>=t.length)n=t.length-1;this.controlConfig.controlData.listData=t,this.input.empty();for(var r=0,i=t.length;r").attr("value",t[r].value).text(t[r].label));var s=this.input.data("selectmenu");s&&(s.list.height("auto"),this.input.selectmenu(),this.input.selectmenu("index",n))},setControlValue:function(e){var t=this.input.val(),n=t!==e;return this.input.val([e]),n},inputChange_handler:function(e){var n=this.input.val(),r={};r[this.controlConfig.name]=n,this.model.set(r),this.dispatcher.trigger(t.Events.CONTROL_CHANGE,{name:this.controlConfig.name,value:n,control:this})}})}(jQuery),function(e){var t=gbst.module("gbst.loan.shared.view");t.Events={CONTROL_CHANGE:"view.controlchange"},t.CheckBoxInputView=Backbone.View.extend({templateId:null,model:null,dispatcher:null,controlConfig:null,controlsInitialised:!1,input:null,events:{"change input":"checkboxChange_handler","dblclick .checkbox-label":"dblclick_handler"},initialize:function(e){this.model=e.model,this.dispatcher=e.dispatcher;var t=this.controlConfig=e.controlConfig;this.templateId=t.templateId},render:function(){var e=this.controlConfig,t=null,n=this.input,r=null;if(!this.controlsInitialised){var i=this.prepareContext(e);r=HandlebarsTemplates[this.templateId](i),this.$el.append(r),n=this.input=this.$el.find("input"),this.controlsInitialised=!0}t=this.model.get(e.name);var s=null;t==1&&(s=e.name),this.setControlValue(s),n.button()},prepareContext:function(e){var t={};return t.name=e.name,t.templateData=_.extend({},e.templateData),t.templateData.titleString=I18n.t(e.templateData.title),t},setControlValue:function(e){this.input.val([e])},checkboxChange_handler:function(e){var n=this.input[0].checked,r={};r[this.controlConfig.name]=n,this.model.set(r),this.dispatcher.trigger(t.Events.CONTROL_CHANGE,{name:this.controlConfig.name,value:n,control:this})},dblclick_handler:function(){this.input.button("refresh")}})}(jQuery);