diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ee98170cc..5e347c1c1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -17,7 +17,6 @@ //= require d3.min //= require clipper //= require concavehull.min -//= require graham_scan.min //= require leaflet.freedraw //= require smart_listing //= require turf-area diff --git a/app/assets/javascripts/old_design/action_btn_rules.js b/app/assets/javascripts/old_design/action_btn_rules.js deleted file mode 100644 index 7ade4a9f9..000000000 --- a/app/assets/javascripts/old_design/action_btn_rules.js +++ /dev/null @@ -1,12 +0,0 @@ -$(document).on('turbolinks:load', init_action_btn_rules); - -function init_action_btn_rules() { - $('.btn-send').click(function () { - $(this).addClass("disabled"); - this.addEventListener("click", lock_btn); - }); - - function lock_btn(event) { - event.preventDefault(); - } -} diff --git a/app/assets/javascripts/old_design/address_typeahead.js b/app/assets/javascripts/old_design/address_typeahead.js deleted file mode 100644 index 26925f476..000000000 --- a/app/assets/javascripts/old_design/address_typeahead.js +++ /dev/null @@ -1,22 +0,0 @@ -function address_type_init() { - display = 'label'; - - var bloodhound = new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.whitespace(display), - queryTokenizer: Bloodhound.tokenizers.whitespace, - - remote: { - url: '/ban/search?request=%QUERY', - wildcard: '%QUERY' - } - }); - bloodhound.initialize(); - - $("input[type='address']").typeahead({ - minLength: 1 - }, { - display: display, - source: bloodhound, - limit: 5 - }); -} diff --git a/app/assets/javascripts/old_design/new-description.js b/app/assets/javascripts/old_design/new-description.js deleted file mode 100644 index 3b32782c4..000000000 --- a/app/assets/javascripts/old_design/new-description.js +++ /dev/null @@ -1,36 +0,0 @@ -(function() { - var showNotFound = function() { - $('.dossier-link .text-info').hide(); - $('.dossier-link .text-warning').show(); - }; - - var showData = function(data) { - $('.dossier-link .dossier-text-summary').text(data.textSummary); - $('.dossier-link .text-info').show(); - $('.dossier-link .text-warning').hide(); - }; - - var hideEverything = function() { - $('.dossier-link .text-info').hide(); - $('.dossier-link .text-warning').hide(); - }; - - var fetchProcedureLibelle = function(e) { - var dossierId = $(e.target).val(); - if(dossierId) { - $.get('/users/dossiers/' + dossierId + '/text_summary') - .done(showData) - .fail(showNotFound); - } else { - hideEverything(); - } - }; - - var timeOut = null; - var debounceFetchProcedureLibelle = function(e) { - if(timeOut){ clearTimeout(timeOut); } - timeOut = setTimeout(function() { fetchProcedureLibelle(e); }, 300); - }; - - $(document).on('input', '[data-type=dossier-link]', debounceFetchProcedureLibelle); -})(); diff --git a/app/assets/javascripts/old_design/pref_list_dossier.js b/app/assets/javascripts/old_design/pref_list_dossier.js deleted file mode 100644 index 1e81e3eee..000000000 --- a/app/assets/javascripts/old_design/pref_list_dossier.js +++ /dev/null @@ -1,32 +0,0 @@ -$(document).on('turbolinks:load', pref_list_dossier_actions); - -function pref_list_dossier_actions() { - pref_list_dossier_open_action(); - pref_list_dossier_close_action(); -} - -function pref_list_dossier_open_action() { - $("#pref-list-dossier-open-action").on('click', function () { - $("#pref-list-menu").css('display', 'block'); - $("#pref-list-menu").css('visibility', 'visible'); - - $("#pref-list-menu").animate({ - right: 0 - }, 250); - }); -} - -function pref_list_dossier_close_action() { - $("#pref-list-dossier-close-action").on('click', function () { - $("#pref-list-menu").animate({ - right: parseInt($("#pref-list-menu").css('width'), 10)*(-1)+'px' - },{ - duration: 250, - complete: function () { - $("#pref-list-menu").css('display', 'none'); - $("#pref-list-menu").css('visibility', 'hidden'); - } - } - ) - }); -} diff --git a/app/assets/javascripts/old_design/search.js b/app/assets/javascripts/old_design/search.js deleted file mode 100644 index eb61ae055..000000000 --- a/app/assets/javascripts/old_design/search.js +++ /dev/null @@ -1,59 +0,0 @@ -$(document).on('turbolinks:load', init_search_anim); - -function init_search_anim(){ - $("#search-area").on('click', search_fadeIn); -} - -function search_fadeIn(){ - var search_area = $("#search-area"); - var body_dom = $('body'); - var positions = search_area.position(); - var width = search_area.width(); - - search_area.css('position', 'fixed'); - search_area.css('top', positions.top + $('.navbar').height()); - search_area.css('left', positions.left); - search_area.css('z-index', 300); - search_area.css('width', width); - search_area.find('#q').animate({ height: '50px' }); - search_area.find('#search-button').animate({ height: '50px' }); - - body_dom.append(search_area); - $('#mask-search').fadeIn(200); - - var body_width = body_dom.width(); - - var search_area_width = body_width/2.5; - - search_area.animate({ - width: search_area_width, - left: (body_width/2 - search_area_width/2 + 40) - }, 400, function() { - search_area.off(); - $("#search-area input").focus(); - - $('#mask-search').on('click', search_fadeOut) - }); -} - -function search_fadeOut(){ - var search_area = $("#search-area"); - - $('#mask-search').fadeOut(200); - - search_area.fadeOut(200, function(){ - search_area.css('position', 'static'); - search_area.css('top', ''); - search_area.css('left', ''); - search_area.css('z-index', ''); - search_area.css('width', 'auto'); - search_area.find('#q').css('height', 34); - search_area.find('#search-button').css('height', 34); - - $('#search-block').append(search_area); - search_area.fadeIn(200); - - init_search_anim(); - }); - -} diff --git a/app/assets/javascripts/old_design/start.js b/app/assets/javascripts/old_design/start.js deleted file mode 100644 index c261ae1fc..000000000 --- a/app/assets/javascripts/old_design/start.js +++ /dev/null @@ -1,3 +0,0 @@ -function show_dossier_id_input (){ - $("#btn_show_dossier_id_input").hide() -} diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 53796fe13..254969445 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -33,7 +33,6 @@ // = require navbar // = require pieces_justificatives_fields // = require pj_modal -// = require pref_list_menu // = require print // = require procedure // = require recapitulatif diff --git a/app/assets/stylesheets/pref_list_menu.scss b/app/assets/stylesheets/pref_list_menu.scss deleted file mode 100644 index 11920ade8..000000000 --- a/app/assets/stylesheets/pref_list_menu.scss +++ /dev/null @@ -1,15 +0,0 @@ -#pref-list-menu { - z-index: 100; - display: none; - position: fixed; - visibility: hidden; - top: 10px; - right: -470px; - background-color: rgba(255, 255, 255, 0.95); - border-left: solid 1px #D3D3D3; - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); - width: 470px; - height: calc(100% - 25px); - padding: 15px; - overflow-y: scroll; -} diff --git a/app/javascript/packs/application-old.js b/app/javascript/packs/application-old.js index 32ecd1f03..dcd3293db 100644 --- a/app/javascript/packs/application-old.js +++ b/app/javascript/packs/application-old.js @@ -15,6 +15,7 @@ import 'typeahead.js'; import '../shared/sentry'; import '../shared/rails-ujs-fix'; +import '../shared/champs/address'; // Start Rails helpers Chartkick.addAdapter(Highcharts); diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index e94c60e8d..8c777832c 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -15,12 +15,12 @@ import 'typeahead.js'; import '../shared/sentry'; import '../shared/rails-ujs-fix'; +import '../shared/champs/address'; import '../new_design/buttons'; import '../new_design/form-validation'; import '../new_design/carto'; -import '../new_design/champs/address'; import '../new_design/champs/dossier-link'; import '../new_design/champs/linked-drop-down-list'; import '../new_design/champs/multiple-drop-down-list'; diff --git a/app/javascript/new_design/champs/address.js b/app/javascript/shared/champs/address.js similarity index 88% rename from app/javascript/new_design/champs/address.js rename to app/javascript/shared/champs/address.js index c368c6321..e7bf9cfd1 100644 --- a/app/javascript/new_design/champs/address.js +++ b/app/javascript/shared/champs/address.js @@ -16,7 +16,7 @@ const bloodhound = new Bloodhound({ bloodhound.initialize(); function bindTypeahead() { - $('input[data-address="true"]').typeahead( + $('input[data-address="true"], input[type="address"]').typeahead( { minLength: 1 }, diff --git a/vendor/assets/javascripts/graham_scan.min.js b/vendor/assets/javascripts/graham_scan.min.js deleted file mode 100644 index 075e53dd8..000000000 --- a/vendor/assets/javascripts/graham_scan.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Graham's Scan Convex Hull Algorithm - * Author: Brian Barnett, brian@3kb.co.uk, http://brianbar.net/ || http://3kb.co.uk/ - * Date: 14/06/13 - * Updated: 25/01/14 - * Description: An implementation of the Graham's Scan Convex Hull algorithm in Javascript.*/ -function ConvexHullGrahamScan(){this.anchorPoint=undefined;this.reverse=false;this.points=[]}ConvexHullGrahamScan.prototype={constructor:ConvexHullGrahamScan,Point:function(e,t){this.x=e;this.y=t},_findPolarAngle:function(e,t){var n=57.295779513082;var r=t.x-e.x;var i=t.y-e.y;if(r==0&&i==0){return 0}var s=Math.atan2(i,r)*n;if(this.reverse){if(s<=0){s+=360}}else{if(s>=0){s+=360}}return s},addPoint:function(e,t){if(this.anchorPoint===undefined){this.anchorPoint=new this.Point(e,t)}else if(this.anchorPoint.y>t||this.anchorPoint.y==t&&this.anchorPoint.x>e){this.anchorPoint.y=t;this.anchorPoint.x=e;this.points.unshift(new this.Point(e,t));return}this.points.push(new this.Point(e,t))},_sortPoints:function(){var e=this;return this.points.sort(function(t,n){var r=e._findPolarAngle(e.anchorPoint,t);var i=e._findPolarAngle(e.anchorPoint,n);if(ri){return 1}return 0})},_checkPoints:function(e,t,n){var r;var i=this._findPolarAngle(e,t);var s=this._findPolarAngle(e,n);if(i>s){r=i-s;return!(r>180)}else if(i180}return false},getHull:function(){var e=[],t,n;this.reverse=this.points.every(function(e){return e.x<0&&e.y<0});t=this._sortPoints();n=t.length;if(n<4){return t}e.push(t.shift(),t.shift());while(true){var r,i,s;e.push(t.shift());r=e[e.length-3];i=e[e.length-2];s=e[e.length-1];if(this._checkPoints(r,i,s)){e.splice(e.length-2,1)}if(t.length==0){if(n==e.length){return e}t=e;n=t.length;e=[];e.push(t.shift(),t.shift())}}}} diff --git a/vendor/assets/javascripts/highcharts.js b/vendor/assets/javascripts/highcharts.js deleted file mode 100644 index 6bd0efc23..000000000 --- a/vendor/assets/javascripts/highcharts.js +++ /dev/null @@ -1,396 +0,0 @@ -/* - Highcharts JS v5.0.11 (2017-05-04) - - (c) 2009-2016 Torstein Honsi - - License: www.highcharts.com/license -*/ -(function(L,S){"object"===typeof module&&module.exports?module.exports=L.document?S(L):S:L.Highcharts=S(L)})("undefined"!==typeof window?window:this,function(L){L=function(){var a=window,D=a.document,A=a.navigator&&a.navigator.userAgent||"",G=D&&D.createElementNS&&!!D.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,F=/(edge|msie|trident)/i.test(A)&&!window.opera,n=!G,f=/Firefox/.test(A),h=f&&4>parseInt(A.split("Firefox/")[1],10);return a.Highcharts?a.Highcharts.error(16,!0):{product:"Highcharts", -version:"5.0.11",deg2rad:2*Math.PI/360,doc:D,hasBidiBug:h,hasTouch:D&&void 0!==D.documentElement.ontouchstart,isMS:F,isWebKit:/AppleWebKit/.test(A),isFirefox:f,isTouchDevice:/(Mobile|Android|Windows Phone)/.test(A),SVG_NS:"http://www.w3.org/2000/svg",chartCount:0,seriesTypes:{},symbolSizes:{},svg:G,vml:n,win:a,marginNames:["plotTop","marginRight","marginBottom","plotLeft"],noop:function(){},charts:[]}}();(function(a){var D=[],A=a.charts,G=a.doc,F=a.win;a.error=function(n,f){n=a.isNumber(n)?"Highcharts error #"+ -n+": www.highcharts.com/errors/"+n:n;if(f)throw Error(n);F.console&&console.log(n)};a.Fx=function(a,f,h){this.options=f;this.elem=a;this.prop=h};a.Fx.prototype={dSetter:function(){var a=this.paths[0],f=this.paths[1],h=[],l=this.now,w=a.length,t;if(1===l)h=this.toD;else if(w===f.length&&1>l)for(;w--;)t=parseFloat(a[w]),h[w]=isNaN(t)?a[w]:l*parseFloat(f[w]-t)+t;else h=f;this.elem.attr("d",h,null,!0)},update:function(){var a=this.elem,f=this.prop,h=this.now,l=this.options.step;if(this[f+"Setter"])this[f+ -"Setter"]();else a.attr?a.element&&a.attr(f,h,null,!0):a.style[f]=h+this.unit;l&&l.call(a,h,this)},run:function(a,f,h){var n=this,w=function(a){return w.stopped?!1:n.step(a)},t;this.startTime=+new Date;this.start=a;this.end=f;this.unit=h;this.now=this.start;this.pos=0;w.elem=this.elem;w.prop=this.prop;w()&&1===D.push(w)&&(w.timerId=setInterval(function(){for(t=0;t=e+this.startTime?(this.now=this.end,this.pos=1,this.update(),h=d[this.prop]=!0,a.objectEach(d,function(a){!0!==a&&(h=!1)}),h&&t&&t.call(w),n=!1):(this.pos=l.easing((f-this.startTime)/e),this.now=this.start+(this.end-this.start)*this.pos,this.update(),n=!0);return n},initPath:function(n,f,h){function l(a){var b,c;for(u=a.length;u--;)b="M"===a[u]||"L"===a[u],c=/[a-zA-Z]/.test(a[u+3]),b&&c&&a.splice(u+1,0,a[u+1],a[u+2],a[u+1],a[u+2])} -function w(a,c){for(;a.lengtht?"AM":"PM",P:12>t?"am":"pm",S:u(w.getSeconds()),L:u(Math.round(f%1E3),3)},a.dateFormats);a.objectEach(l,function(a,b){for(;-1!==n.indexOf("%"+b);)n=n.replace("%"+b,"function"===typeof a?a(f):a)});return h?n.substr(0,1).toUpperCase()+n.substr(1):n};a.formatSingle=function(n,f){var h=/\.([0-9])/,l=a.defaultOptions.lang;/f$/.test(n)?(h=(h= -n.match(h))?h[1]:-1,null!==f&&(f=a.numberFormat(f,h,l.decimalPoint,-1=h&&(f=[1/h])));for(l=0;l=n||!w&&t<=(f[l]+(f[l+1]||f[l]))/2);l++);return e=a.correctFloat(e*h,-Math.round(Math.log(.001)/Math.LN10))};a.stableSort=function(a,f){var h=a.length,l,n;for(n=0;nh&&(h=a[f]);return h};a.destroyObjectProperties=function(n,f){a.objectEach(n,function(a,l){a&&a!==f&&a.destroy&&a.destroy();delete n[l]})};a.discardElement=function(n){var f=a.garbageBin;f||(f=a.createElement("div"));n&&f.appendChild(n);f.innerHTML=""};a.correctFloat=function(a,f){return parseFloat(a.toPrecision(f|| -14))};a.setAnimation=function(n,f){f.renderer.globalAnimation=a.pick(n,f.options.chart.animation,!0)};a.animObject=function(n){return a.isObject(n)?a.merge(n):{duration:n?500:0}};a.timeUnits={millisecond:1,second:1E3,minute:6E4,hour:36E5,day:864E5,week:6048E5,month:24192E5,year:314496E5};a.numberFormat=function(n,f,h,l){n=+n||0;f=+f;var w=a.defaultOptions.lang,t=(n.toString().split(".")[1]||"").length,e,d;-1===f?f=Math.min(t,20):a.isNumber(f)||(f=2);d=(Math.abs(n)+Math.pow(10,-Math.max(f,t)-1)).toFixed(f); -t=String(a.pInt(d));e=3n?"-":"")+(e?t.substr(0,e)+l:"");n+=t.substr(e).replace(/(\d{3})(?=\d)/g,"$1"+l);f&&(n+=h+d.slice(-f));return n};Math.easeInOutSine=function(a){return-.5*(Math.cos(Math.PI*a)-1)};a.getStyle=function(n,f,h){if("width"===f)return Math.min(n.offsetWidth,n.scrollWidth)-a.getStyle(n,"padding-left")-a.getStyle(n,"padding-right");if("height"===f)return Math.min(n.offsetHeight,n.scrollHeight)-a.getStyle(n, -"padding-top")-a.getStyle(n,"padding-bottom");if(n=F.getComputedStyle(n,void 0))n=n.getPropertyValue(f),a.pick(h,!0)&&(n=a.pInt(n));return n};a.inArray=function(a,f){return f.indexOf?f.indexOf(a):[].indexOf.call(f,a)};a.grep=function(a,f){return[].filter.call(a,f)};a.find=function(a,f){return[].find.call(a,f)};a.map=function(a,f){for(var h=[],l=0,n=a.length;l>16,(f&65280)>>8,f&255,1]:4===h&&(l=[(f&3840)>>4|(f&3840)>>8,(f&240)>>4|f&240,(f&15)<<4|f&15,1])),!l)for(n=this.parsers.length;n--&&!l;)t=this.parsers[n],(h=t.regex.exec(f))&&(l=t.parse(h));this.rgba=l||[]},get:function(a){var f=this.input,l=this.rgba, -n;this.stops?(n=F(f),n.stops=[].concat(n.stops),D(this.stops,function(f,e){n.stops[e]=[n.stops[e][0],f.get(a)]})):n=l&&A(l[0])?"rgb"===a||!a&&1===l[3]?"rgb("+l[0]+","+l[1]+","+l[2]+")":"a"===a?l[3]:"rgba("+l.join(",")+")":f;return n},brighten:function(a){var f,l=this.rgba;if(this.stops)D(this.stops,function(f){f.brighten(a)});else if(A(a)&&0!==a)for(f=0;3>f;f++)l[f]+=n(255*a),0>l[f]&&(l[f]=0),255v.width)v={width:0,height:0}}else v=this.htmlGetBBox();r.isSVG&&(a=v.width,r=v.height,q&&"11px"===q.fontSize&&17===Math.round(r)&&(v.height=r=14),g&&(v.width=Math.abs(r*Math.sin(c))+Math.abs(a*Math.cos(c)),v.height=Math.abs(r*Math.cos(c))+Math.abs(a*Math.sin(c))));if(y&&0]*>/g,"")))},textSetter:function(a){a!==this.textStr&&(delete this.bBox,this.textStr=a,this.added&&this.renderer.buildText(this))},fillSetter:function(a,g,b){"string"===typeof a?b.setAttribute(g,a):a&&this.colorGradient(a,g,b)},visibilitySetter:function(a,g,b){"inherit"===a?b.removeAttribute(g):b.setAttribute(g,a)},zIndexSetter:function(a,b){var v=this.renderer, -r=this.parentGroup,c=(r||v).element||v.box,k,q=this.element,p;k=this.added;var d;t(a)&&(q.zIndex=a,a=+a,this[b]===a&&(k=!1),this[b]=a);if(k){(a=this.zIndex)&&r&&(r.handleZ=!0);b=c.childNodes;for(d=0;da||!t(a)&&t(k)||0>a&&!t(k)&&c!==v.box)&&(c.insertBefore(q,r),p=!0);p||c.appendChild(q)}return p},_defaultSetter:function(a,g,b){b.setAttribute(g,a)}};D.prototype.yGetter=D.prototype.xGetter;D.prototype.translateXSetter=D.prototype.translateYSetter=D.prototype.rotationSetter= -D.prototype.verticalAlignSetter=D.prototype.scaleXSetter=D.prototype.scaleYSetter=function(a,g){this[g]=a;this.doTransform=!0};D.prototype["stroke-widthSetter"]=D.prototype.strokeSetter=function(a,g,b){this[g]=a;this.stroke&&this["stroke-width"]?(D.prototype.fillSetter.call(this,this.stroke,"stroke",b),b.setAttribute("stroke-width",this["stroke-width"]),this.hasStroke=!0):"stroke-width"===g&&0===a&&this.hasStroke&&(b.removeAttribute("stroke"),this.hasStroke=!1)};A=a.SVGRenderer=function(){this.init.apply(this, -arguments)};A.prototype={Element:D,SVG_NS:N,init:function(a,g,b,r,c,q){var v;r=this.createElement("svg").attr({version:"1.1","class":"highcharts-root"}).css(this.getStyle(r));v=r.element;a.appendChild(v);-1===a.innerHTML.indexOf("xmlns")&&n(v,"xmlns",this.SVG_NS);this.isSVG=!0;this.box=v;this.boxWrapper=r;this.alignedObjects=[];this.url=(k||M)&&m.getElementsByTagName("base").length?P.location.href.replace(/#.*?$/,"").replace(/<[^>]*>/g,"").replace(/([\('\)])/g,"\\$1").replace(/ /g,"%20"):"";this.createElement("desc").add().element.appendChild(m.createTextNode("Created with Highcharts 5.0.11")); -this.defs=this.createElement("defs").add();this.allowHTML=q;this.forExport=c;this.gradients={};this.cache={};this.cacheKeys=[];this.imgCount=0;this.setSize(g,b,!1);var p;k&&a.getBoundingClientRect&&(g=function(){l(a,{left:0,top:0});p=a.getBoundingClientRect();l(a,{left:Math.ceil(p.left)-p.left+"px",top:Math.ceil(p.top)-p.top+"px"})},g(),this.unSubPixelFix=G(P,"resize",g))},getStyle:function(a){return this.style=b({fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif',fontSize:"12px"}, -a)},setStyle:function(a){this.boxWrapper.css(this.getStyle(a))},isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var a=this.defs;this.box=null;this.boxWrapper=this.boxWrapper.destroy();d(this.gradients||{});this.gradients=null;a&&(this.defs=a.destroy());this.unSubPixelFix&&this.unSubPixelFix();return this.alignedObjects=null},createElement:function(a){var g=new this.Element;g.init(this,a);return g},draw:y,getRadialAttr:function(a,g){return{cx:a[0]-a[2]/2+g.cx*a[2],cy:a[1]- -a[2]/2+g.cy*a[2],r:g.r*a[2]}},getSpanWidth:function(a,g){var b=a.getBBox(!0).width;!J&&this.forExport&&(b=this.measureSpanWidth(g.firstChild.data,a.styles));return b},applyEllipsis:function(a,g,b,r){var v=this.getSpanWidth(a,g),c=v>r,v=b,k,q=0,p=b.length,d=function(a){g.removeChild(g.firstChild);a&&g.appendChild(m.createTextNode(a))};if(c){for(;q<=p;)k=Math.ceil((q+p)/2),v=b.substring(0,k)+"\u2026",d(v),v=this.getSpanWidth(a,g),q===p?q=p+1:v>r?p=k-1:q=k;0===p&&d("")}return c},buildText:function(a){var b= -a.element,r=this,v=r.forExport,k=K(a.textStr,"").toString(),q=-1!==k.indexOf("\x3c"),p=b.childNodes,d,e,u,y,x=n(b,"x"),E=a.styles,z=a.textWidth,f=E&&E.lineHeight,H=E&&E.textOutline,B=E&&"ellipsis"===E.textOverflow,h=E&&"nowrap"===E.whiteSpace,t=E&&E.fontSize,R,w,M=p.length,E=z&&!a.added&&this.box,I=function(a){var v;v=/(px|em)$/.test(a&&a.style.fontSize)?a.style.fontSize:t||r.style.fontSize||12;return f?g(f):r.fontMetrics(v,a.getAttribute("style")?a:b).h};R=[k,B,h,f,H,t,z].join();if(R!==a.textCache){for(a.textCache= -R;M--;)b.removeChild(p[M]);q||H||B||z||-1!==k.indexOf(" ")?(d=/<.*class="([^"]+)".*>/,e=/<.*style="([^"]+)".*>/,u=/<.*href="(http[^"]+)".*>/,E&&E.appendChild(b),k=q?k.replace(/<(b|strong)>/g,'\x3cspan style\x3d"font-weight:bold"\x3e').replace(/<(i|em)>/g,'\x3cspan style\x3d"font-style:italic"\x3e').replace(//g,"\x3c/span\x3e").split(//g):[k],k=c(k,function(a){return""!==a}),C(k,function(g,c){var k,q=0;g=g.replace(/^\s+|\s+$/g,"").replace(//g,"\x3c/span\x3e|||");k=g.split("|||");C(k,function(g){if(""!==g||1===k.length){var p={},E=m.createElementNS(r.SVG_NS,"tspan"),f,H;d.test(g)&&(f=g.match(d)[1],n(E,"class",f));e.test(g)&&(H=g.match(e)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),n(E,"style",H));u.test(g)&&!v&&(n(E,"onclick",'location.href\x3d"'+g.match(u)[1]+'"'),l(E,{cursor:"pointer"}));g=(g.replace(/<(.|\n)*?>/g,"")||" ").replace(/</g,"\x3c").replace(/>/g,"\x3e");if(" "!==g){E.appendChild(m.createTextNode(g)); -q?p.dx=0:c&&null!==x&&(p.x=x);n(E,p);b.appendChild(E);!q&&w&&(!J&&v&&l(E,{display:"block"}),n(E,"dy",I(E)));if(z){p=g.replace(/([^\^])-/g,"$1- ").split(" ");f=1z,void 0===y&&(y=g),g&&1!==p.length?(E.removeChild(E.firstChild),C.unshift(p.pop())):(p=C,C=[],p.length&&!h&&(E=m.createElementNS(N,"tspan"),n(E,{dy:t,x:x}),H&&n(E,"style",H),b.appendChild(E)), -Q>z&&(z=Q)),p.length&&E.appendChild(m.createTextNode(p.join(" ").replace(/- /g,"-")));a.rotation=R}q++}}});w=w||b.childNodes.length}),y&&a.attr("title",a.textStr),E&&E.removeChild(b),H&&a.applyTextOutline&&a.applyTextOutline(H)):b.appendChild(m.createTextNode(k.replace(/</g,"\x3c").replace(/>/g,"\x3e")))}},getContrast:function(a){a=h(a).rgba;return 510b?c>g+q&&cp?c>g+q&&cr&&p>a+q&&pc&&p>a+q&&pa?a+3:Math.round(1.2*a);return{h:b,b:Math.round(.8*b),f:a}},rotCorr:function(a,g,b){var r=a;g&&b&&(r=Math.max(r*Math.cos(g*e),4));return{x:-a/3*Math.sin(g*e),y:r}},label:function(g,c,k,p,d,e,E,u,m){var v=this,y=v.g("button"!==m&&"label"),x=y.text=v.text("",0,0,E).attr({zIndex:1}),z,J,f=0,H=3,l=0,B,h,n,R,w,M={},I,N,K=/^url\((.*?)\)$/.test(p),Q=K,U,T,O,P;m&&y.addClass("highcharts-"+m);Q=K;U=function(){return(I|| -0)%2/2};T=function(){var a=x.element.style,g={};J=(void 0===B||void 0===h||w)&&t(x.textStr)&&x.getBBox();y.width=(B||J.width||0)+2*H+l;y.height=(h||J.height||0)+2*H;N=H+v.fontMetrics(a&&a.fontSize,x).b;Q&&(z||(y.box=z=v.symbols[p]||K?v.symbol(p):v.rect(),z.addClass(("button"===m?"":"highcharts-label-box")+(m?" highcharts-"+m+"-box":"")),z.add(y),a=U(),g.x=a,g.y=(u?-N:0)+a),g.width=Math.round(y.width),g.height=Math.round(y.height),z.attr(b(g,M)),M={})};O=function(){var a=l+H,g;g=u?0:N;t(B)&&J&&("center"=== -w||"right"===w)&&(a+={center:.5,right:1}[w]*(B-J.width));if(a!==x.x||g!==x.y)x.attr("x",a),void 0!==g&&x.attr("y",g);x.x=a;x.y=g};P=function(a,g){z?z.attr(a,g):M[a]=g};y.onAdd=function(){x.add(y);y.attr({text:g||0===g?g:"",x:c,y:k});z&&t(d)&&y.attr({anchorX:d,anchorY:e})};y.widthSetter=function(g){B=a.isNumber(g)?g:null};y.heightSetter=function(a){h=a};y["text-alignSetter"]=function(a){w=a};y.paddingSetter=function(a){t(a)&&a!==H&&(H=y.padding=a,O())};y.paddingLeftSetter=function(a){t(a)&&a!==l&& -(l=a,O())};y.alignSetter=function(a){a={left:0,center:.5,right:1}[a];a!==f&&(f=a,J&&y.attr({x:n}))};y.textSetter=function(a){void 0!==a&&x.textSetter(a);T();O()};y["stroke-widthSetter"]=function(a,g){a&&(Q=!0);I=this["stroke-width"]=a;P(g,a)};y.strokeSetter=y.fillSetter=y.rSetter=function(a,g){"fill"===g&&a&&(Q=!0);P(g,a)};y.anchorXSetter=function(a,g){d=y.anchorX=a;P(g,Math.round(a)-U()-n)};y.anchorYSetter=function(a,g){e=y.anchorY=a;P(g,a-R)};y.xSetter=function(a){y.x=a;f&&(a-=f*((B||J.width)+2* -H));n=Math.round(a);y.attr("translateX",n)};y.ySetter=function(a){R=y.y=Math.round(a);y.attr("translateY",R)};var V=y.css;return b(y,{css:function(a){if(a){var g={};a=q(a);C(y.textProps,function(b){void 0!==a[b]&&(g[b]=a[b],delete a[b])});x.css(g)}return V.call(y,a)},getBBox:function(){return{width:J.width+2*H,height:J.height+2*H,x:J.x-H,y:J.y-H}},shadow:function(a){a&&(T(),z&&z.shadow(a));return y},destroy:function(){r(y.element,"mouseenter");r(y.element,"mouseleave");x&&(x=x.destroy());z&&(z=z.destroy()); -D.prototype.destroy.call(y);y=v=T=O=P=null}})}};a.Renderer=A})(L);(function(a){var D=a.attr,A=a.createElement,G=a.css,F=a.defined,n=a.each,f=a.extend,h=a.isFirefox,l=a.isMS,w=a.isWebKit,t=a.pInt,e=a.SVGRenderer,d=a.win,m=a.wrap;f(a.SVGElement.prototype,{htmlCss:function(a){var b=this.element;if(b=a&&"SPAN"===b.tagName&&a.width)delete a.width,this.textWidth=b,this.updateTransform();a&&"ellipsis"===a.textOverflow&&(a.whiteSpace="nowrap",a.overflow="hidden");this.styles=f(this.styles,a);G(this.element, -a);return this},htmlGetBBox:function(){var a=this.element;"text"===a.nodeName&&(a.style.position="absolute");return{x:a.offsetLeft,y:a.offsetTop,width:a.offsetWidth,height:a.offsetHeight}},htmlUpdateTransform:function(){if(this.added){var a=this.renderer,b=this.element,d=this.translateX||0,c=this.translateY||0,e=this.x||0,m=this.y||0,f=this.textAlign||"left",k={left:0,center:.5,right:1}[f],E=this.styles;G(b,{marginLeft:d,marginTop:c});this.shadows&&n(this.shadows,function(a){G(a,{marginLeft:d+1,marginTop:c+ -1})});this.inverted&&n(b.childNodes,function(c){a.invertChild(c,b)});if("SPAN"===b.tagName){var p=this.rotation,z=t(this.textWidth),l=E&&E.whiteSpace,q=[p,f,b.innerHTML,this.textWidth,this.textAlign].join();q!==this.cTT&&(E=a.fontMetrics(b.style.fontSize).b,F(p)&&this.setSpanRotation(p,k,E),G(b,{width:"",whiteSpace:l||"nowrap"}),b.offsetWidth>z&&/[ \-]/.test(b.textContent||b.innerText)&&G(b,{width:z+"px",display:"block",whiteSpace:l||"normal"}),this.getSpanCorrection(b.offsetWidth,E,k,p,f));G(b,{left:e+ -(this.xCorr||0)+"px",top:m+(this.yCorr||0)+"px"});w&&(E=b.offsetHeight);this.cTT=q}}else this.alignOnAdd=!0},setSpanRotation:function(a,b,e){var c={},u=l?"-ms-transform":w?"-webkit-transform":h?"MozTransform":d.opera?"-o-transform":"";c[u]=c.transform="rotate("+a+"deg)";c[u+(h?"Origin":"-origin")]=c.transformOrigin=100*b+"% "+e+"px";G(this.element,c)},getSpanCorrection:function(a,b,d){this.xCorr=-a*d;this.yCorr=-b}});f(e.prototype,{html:function(a,b,d){var c=this.createElement("span"),e=c.element, -x=c.renderer,l=x.isSVG,k=function(a,b){n(["opacity","visibility"],function(c){m(a,c+"Setter",function(a,c,k,p){a.call(this,c,k,p);b[k]=c})})};c.textSetter=function(a){a!==e.innerHTML&&delete this.bBox;e.innerHTML=this.textStr=a;c.htmlUpdateTransform()};l&&k(c,c.element.style);c.xSetter=c.ySetter=c.alignSetter=c.rotationSetter=function(a,b){"align"===b&&(b="textAlign");c[b]=a;c.htmlUpdateTransform()};c.attr({text:a,x:Math.round(b),y:Math.round(d)}).css({fontFamily:this.style.fontFamily,fontSize:this.style.fontSize, -position:"absolute"});e.style.whiteSpace="nowrap";c.css=c.htmlCss;l&&(c.add=function(a){var b,d=x.box.parentNode,m=[];if(this.parentGroup=a){if(b=a.div,!b){for(;a;)m.push(a),a=a.parentGroup;n(m.reverse(),function(a){var p,q=D(a.element,"class");q&&(q={className:q});b=a.div=a.div||A("div",q,{position:"absolute",left:(a.translateX||0)+"px",top:(a.translateY||0)+"px",display:a.display,opacity:a.opacity,pointerEvents:a.styles&&a.styles.pointerEvents},b||d);p=b.style;f(a,{on:function(){c.on.apply({element:m[0].div}, -arguments);return a},translateXSetter:function(b,g){p.left=b+"px";a[g]=b;a.doTransform=!0},translateYSetter:function(b,g){p.top=b+"px";a[g]=b;a.doTransform=!0}});k(a,p)})}}else b=d;b.appendChild(e);c.added=!0;c.alignOnAdd&&c.htmlUpdateTransform();return c});return c}})})(L);(function(a){var D,A,G=a.createElement,F=a.css,n=a.defined,f=a.deg2rad,h=a.discardElement,l=a.doc,w=a.each,t=a.erase,e=a.extend;D=a.extendClass;var d=a.isArray,m=a.isNumber,C=a.isObject,b=a.merge;A=a.noop;var x=a.pick,c=a.pInt, -u=a.SVGElement,B=a.SVGRenderer,I=a.win;a.svg||(A={docMode8:l&&8===l.documentMode,init:function(a,b){var c=["\x3c",b,' filled\x3d"f" stroked\x3d"f"'],k=["position: ","absolute",";"],d="div"===b;("shape"===b||d)&&k.push("left:0;top:0;width:1px;height:1px;");k.push("visibility: ",d?"hidden":"visible");c.push(' style\x3d"',k.join(""),'"/\x3e');b&&(c=d||"span"===b||"img"===b?c.join(""):a.prepVML(c),this.element=G(c));this.renderer=a},add:function(a){var b=this.renderer,c=this.element,k=b.box,d=a&&a.inverted, -k=a?a.element||a:k;a&&(this.parentGroup=a);d&&b.invertChild(c,k);k.appendChild(c);this.added=!0;this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform();if(this.onAdd)this.onAdd();this.className&&this.attr("class",this.className);return this},updateTransform:u.prototype.htmlUpdateTransform,setSpanRotation:function(){var a=this.rotation,b=Math.cos(a*f),c=Math.sin(a*f);F(this.element,{filter:a?["progid:DXImageTransform.Microsoft.Matrix(M11\x3d",b,", M12\x3d",-c,", M21\x3d",c,", M22\x3d", -b,", sizingMethod\x3d'auto expand')"].join(""):"none"})},getSpanCorrection:function(a,b,c,d,e){var k=d?Math.cos(d*f):1,p=d?Math.sin(d*f):0,m=x(this.elemHeight,this.element.offsetHeight),u;this.xCorr=0>k&&-a;this.yCorr=0>p&&-m;u=0>k*p;this.xCorr+=p*b*(u?1-c:c);this.yCorr-=k*b*(d?u?c:1-c:1);e&&"left"!==e&&(this.xCorr-=a*c*(0>k?-1:1),d&&(this.yCorr-=m*c*(0>p?-1:1)),F(this.element,{textAlign:e}))},pathToVML:function(a){for(var b=a.length,c=[];b--;)m(a[b])?c[b]=Math.round(10*a[b])-5:"Z"===a[b]?c[b]="x": -(c[b]=a[b],!a.isArc||"wa"!==a[b]&&"at"!==a[b]||(c[b+5]===c[b+7]&&(c[b+7]+=a[b+7]>a[b+5]?1:-1),c[b+6]===c[b+8]&&(c[b+8]+=a[b+8]>a[b+6]?1:-1)));return c.join(" ")||"x"},clip:function(a){var b=this,c;a?(c=a.members,t(c,b),c.push(b),b.destroyClip=function(){t(c,b)},a=a.getCSS(b)):(b.destroyClip&&b.destroyClip(),a={clip:b.docMode8?"inherit":"rect(auto)"});return b.css(a)},css:u.prototype.htmlCss,safeRemoveChild:function(a){a.parentNode&&h(a)},destroy:function(){this.destroyClip&&this.destroyClip();return u.prototype.destroy.apply(this)}, -on:function(a,b){this.element["on"+a]=function(){var a=I.event;a.target=a.srcElement;b(a)};return this},cutOffPath:function(a,b){var k;a=a.split(/[ ,]/);k=a.length;if(9===k||11===k)a[k-4]=a[k-2]=c(a[k-2])-10*b;return a.join(" ")},shadow:function(a,b,d){var k=[],p,q=this.element,e=this.renderer,m,u=q.style,g,r=q.path,f,J,E,l;r&&"string"!==typeof r.value&&(r="x");J=r;if(a){E=x(a.width,3);l=(a.opacity||.15)/E;for(p=1;3>=p;p++)f=2*E+1-2*p,d&&(J=this.cutOffPath(r.value,f+.5)),g=['\x3cshape isShadow\x3d"true" strokeweight\x3d"', -f,'" filled\x3d"false" path\x3d"',J,'" coordsize\x3d"10 10" style\x3d"',q.style.cssText,'" /\x3e'],m=G(e.prepVML(g),null,{left:c(u.left)+x(a.offsetX,1),top:c(u.top)+x(a.offsetY,1)}),d&&(m.cutOff=f+1),g=['\x3cstroke color\x3d"',a.color||"#000000",'" opacity\x3d"',l*p,'"/\x3e'],G(e.prepVML(g),null,null,m),b?b.element.appendChild(m):q.parentNode.insertBefore(m,q),k.push(m);this.shadows=k}return this},updateShadows:A,setAttr:function(a,b){this.docMode8?this.element[a]=b:this.element.setAttribute(a,b)}, -classSetter:function(a){(this.added?this.element:this).className=a},dashstyleSetter:function(a,b,c){(c.getElementsByTagName("stroke")[0]||G(this.renderer.prepVML(["\x3cstroke/\x3e"]),null,null,c))[b]=a||"solid";this[b]=a},dSetter:function(a,b,c){var k=this.shadows;a=a||[];this.d=a.join&&a.join(" ");c.path=a=this.pathToVML(a);if(k)for(c=k.length;c--;)k[c].path=k[c].cutOff?this.cutOffPath(a,k[c].cutOff):a;this.setAttr(b,a)},fillSetter:function(a,b,c){var k=c.nodeName;"SPAN"===k?c.style.color=a:"IMG"!== -k&&(c.filled="none"!==a,this.setAttr("fillcolor",this.renderer.color(a,c,b,this)))},"fill-opacitySetter":function(a,b,c){G(this.renderer.prepVML(["\x3c",b.split("-")[0],' opacity\x3d"',a,'"/\x3e']),null,null,c)},opacitySetter:A,rotationSetter:function(a,b,c){c=c.style;this[b]=c[b]=a;c.left=-Math.round(Math.sin(a*f)+1)+"px";c.top=Math.round(Math.cos(a*f))+"px"},strokeSetter:function(a,b,c){this.setAttr("strokecolor",this.renderer.color(a,c,b,this))},"stroke-widthSetter":function(a,b,c){c.stroked=!!a; -this[b]=a;m(a)&&(a+="px");this.setAttr("strokeweight",a)},titleSetter:function(a,b){this.setAttr(b,a)},visibilitySetter:function(a,b,c){"inherit"===a&&(a="visible");this.shadows&&w(this.shadows,function(c){c.style[b]=a});"DIV"===c.nodeName&&(a="hidden"===a?"-999em":0,this.docMode8||(c.style[b]=a?"visible":"hidden"),b="top");c.style[b]=a},xSetter:function(a,b,c){this[b]=a;"x"===b?b="left":"y"===b&&(b="top");this.updateClipping?(this[b]=a,this.updateClipping()):c.style[b]=a},zIndexSetter:function(a, -b,c){c.style[b]=a}},A["stroke-opacitySetter"]=A["fill-opacitySetter"],a.VMLElement=A=D(u,A),A.prototype.ySetter=A.prototype.widthSetter=A.prototype.heightSetter=A.prototype.xSetter,A={Element:A,isIE8:-1C[0]&&b.push([1,C[1]]);w(b,function(g,b){p.test(g[1])?(q=a.color(g[1]), -r=q.get("rgb"),x=q.get("a")):(r=g[1],x=1);h.push(100*g[0]+"% "+r);b?(l=x,v=r):(z=x,B=r)});if("fill"===d)if("gradient"===u)d=J.x1||J[0]||0,b=J.y1||J[1]||0,f=J.x2||J[2]||0,J=J.y2||J[3]||0,E='angle\x3d"'+(90-180*Math.atan((J-b)/(f-d))/Math.PI)+'"',t();else{var g=J.r,n=2*g,I=2*g,A=J.cx,D=J.cy,F=c.radialReference,L,g=function(){F&&(L=e.getBBox(),A+=(F[0]-L.x)/L.width-.5,D+=(F[1]-L.y)/L.height-.5,n*=F[2]/L.width,I*=F[2]/L.height);E='src\x3d"'+a.getOptions().global.VMLRadialGradientURL+'" size\x3d"'+n+","+ -I+'" origin\x3d"0.5,0.5" position\x3d"'+A+","+D+'" color2\x3d"'+B+'" ';t()};e.added?g():e.onAdd=g;g=v}else g=r}else p.test(b)&&"IMG"!==c.tagName?(q=a.color(b),e[d+"-opacitySetter"](q.get("a"),d,c),g=q.get("rgb")):(g=c.getElementsByTagName(d),g.length&&(g[0].opacity=1,g[0].type="solid"),g=b);return g},prepVML:function(a){var b=this.isIE8;a=a.join("");b?(a=a.replace("/\x3e",' xmlns\x3d"urn:schemas-microsoft-com:vml" /\x3e'),a=-1===a.indexOf('style\x3d"')?a.replace("/\x3e",' style\x3d"display:inline-block;behavior:url(#default#VML);" /\x3e'): -a.replace('style\x3d"','style\x3d"display:inline-block;behavior:url(#default#VML);')):a=a.replace("\x3c","\x3chcv:");return a},text:B.prototype.html,path:function(a){var b={coordsize:"10 10"};d(a)?b.d=a:C(a)&&e(b,a);return this.createElement("shape").attr(b)},circle:function(a,b,c){var d=this.symbol("circle");C(a)&&(c=a.r,b=a.y,a=a.x);d.isCircle=!0;d.r=c;return d.attr({x:a,y:b})},g:function(a){var b;a&&(b={className:"highcharts-"+a,"class":"highcharts-"+a});return this.createElement("div").attr(b)}, -image:function(a,b,c,d,e){var q=this.createElement("img").attr({src:a});1b&&t-x*cd&&(k=Math.round((e-t)/Math.cos(b*h)));else if(e=t+(1-x)*c,t-x*cd&&(B=d-a.x+B*x,n=-1),B=Math.min(u,B),BB||l.autoRotation&&(C.styles||{}).width)k=B;k&&(E.width=k,(l.options.labels.style||{}).textOverflow||(E.textOverflow="ellipsis"),C.css(E))},getPosition:function(a,f,h,e){var d=this.axis,m=d.chart, -l=e&&m.oldChartHeight||m.chartHeight;return{x:a?d.translate(f+h,null,null,e)+d.transB:d.left+d.offset+(d.opposite?(e&&m.oldChartWidth||m.chartWidth)-d.right-d.left:0),y:a?l-d.bottom+d.offset-(d.opposite?d.height:0):l-d.translate(f+h,null,null,e)-d.transB}},getLabelPosition:function(a,f,n,e,d,m,C,b){var x=this.axis,c=x.transA,u=x.reversed,l=x.staggerLines,t=x.tickRotCorr||{x:0,y:0},k=d.y;A(k)||(k=0===x.side?n.rotation?-8:-n.getBBox().height:2===x.side?t.y+8:Math.cos(n.rotation*h)*(t.y-n.getBBox(!1, -0).height/2));a=a+d.x+t.x-(m&&e?m*c*(u?-1:1):0);f=f+k-(m&&!e?m*c*(u?1:-1):0);l&&(n=C/(b||1)%l,x.opposite&&(n=l-n-1),f+=x.labelOffset/l*n);return{x:a,y:Math.round(f)}},getMarkPath:function(a,f,h,e,d,m){return m.crispLine(["M",a,f,"L",a+(d?0:-h),f+(d?h:0)],e)},renderGridLine:function(a,f,h){var e=this.axis,d=e.options,m=this.gridLine,l={},b=this.pos,x=this.type,c=e.tickmarkOffset,u=e.chart.renderer,B=x?x+"Grid":"grid",n=d[B+"LineWidth"],k=d[B+"LineColor"],d=d[B+"LineDashStyle"];m||(l.stroke=k,l["stroke-width"]= -n,d&&(l.dashstyle=d),x||(l.zIndex=1),a&&(l.opacity=0),this.gridLine=m=u.path().attr(l).addClass("highcharts-"+(x?x+"-":"")+"grid-line").add(e.gridGroup));if(!a&&m&&(a=e.getPlotLinePath(b+c,m.strokeWidth()*h,a,!0)))m[this.isNew?"attr":"animate"]({d:a,opacity:f})},renderMark:function(a,h,n){var e=this.axis,d=e.options,m=e.chart.renderer,l=this.type,b=l?l+"Tick":"tick",x=e.tickSize(b),c=this.mark,u=!c,B=a.x;a=a.y;var t=f(d[b+"Width"],!l&&e.isXAxis?1:0),d=d[b+"Color"];x&&(e.opposite&&(x[0]=-x[0]),u&& -(this.mark=c=m.path().addClass("highcharts-"+(l?l+"-":"")+"tick").add(e.axisGroup),c.attr({stroke:d,"stroke-width":t})),c[u?"attr":"animate"]({d:this.getMarkPath(B,a,x[0],c.strokeWidth()*n,e.horiz,m),opacity:h}))},renderLabel:function(a,h,n,e){var d=this.axis,m=d.horiz,l=d.options,b=this.label,x=l.labels,c=x.step,u=d.tickmarkOffset,B=!0,t=a.x;a=a.y;b&&F(t)&&(b.xy=a=this.getLabelPosition(t,a,b,m,x,u,e,c),this.isFirst&&!this.isLast&&!f(l.showFirstLabel,1)||this.isLast&&!this.isFirst&&!f(l.showLastLabel, -1)?B=!1:!m||d.isRadial||x.step||x.rotation||h||0===n||this.handleOverflow(a),c&&e%c&&(B=!1),B&&F(a.y)?(a.opacity=n,b[this.isNew?"attr":"animate"](a)):b.attr("y",-9999),this.isNew=!1)},render:function(a,h,n){var e=this.axis,d=e.horiz,m=this.getPosition(d,this.pos,e.tickmarkOffset,h),l=m.x,b=m.y,e=d&&l===e.pos+e.len||!d&&b===e.pos?-1:1;n=f(n,1);this.isActive=!0;this.renderGridLine(h,n,e);this.renderMark(m,n,e);this.renderLabel(m,h,n,a)},destroy:function(){G(this,this.axis)}}})(L);var S=function(a){var D= -a.addEvent,A=a.animObject,G=a.arrayMax,F=a.arrayMin,n=a.color,f=a.correctFloat,h=a.defaultOptions,l=a.defined,w=a.deg2rad,t=a.destroyObjectProperties,e=a.each,d=a.extend,m=a.fireEvent,C=a.format,b=a.getMagnitude,x=a.grep,c=a.inArray,u=a.isArray,B=a.isNumber,I=a.isString,k=a.merge,E=a.normalizeTickInterval,p=a.objectEach,z=a.pick,M=a.removeEvent,q=a.splat,y=a.syncTimeout,H=a.Tick,K=function(){this.init.apply(this,arguments)};a.extend(K.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,labels:{enabled:!0,style:{color:"#666666",cursor:"default",fontSize:"11px"},x:0},minPadding:.01,maxPadding:.01,minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickLength:10,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",title:{align:"middle",style:{color:"#666666"}},type:"linear",minorGridLineColor:"#f2f2f2",minorGridLineWidth:1,minorTickColor:"#999999", -lineColor:"#ccd6eb",lineWidth:1,gridLineColor:"#e6e6e6",tickColor:"#ccd6eb"},defaultYAxisOptions:{endOnTick:!0,tickPixelInterval:72,showLastLabel:!0,labels:{x:-8},maxPadding:.05,minPadding:.05,startOnTick:!0,title:{rotation:270,text:"Values"},stackLabels:{enabled:!1,formatter:function(){return a.numberFormat(this.total,-1)},style:{fontSize:"11px",fontWeight:"bold",color:"#000000",textOutline:"1px contrast"}},gridLineWidth:1,lineWidth:0},defaultLeftAxisOptions:{labels:{x:-15},title:{rotation:270}}, -defaultRightAxisOptions:{labels:{x:15},title:{rotation:90}},defaultBottomAxisOptions:{labels:{autoRotation:[-45],x:0},title:{rotation:0}},defaultTopAxisOptions:{labels:{autoRotation:[-45],x:0},title:{rotation:0}},init:function(a,b){var g=b.isX,r=this;r.chart=a;r.horiz=a.inverted?!g:g;r.isXAxis=g;r.coll=r.coll||(g?"xAxis":"yAxis");r.opposite=b.opposite;r.side=b.side||(r.horiz?r.opposite?0:2:r.opposite?1:3);r.setOptions(b);var d=this.options,k=d.type;r.labelFormatter=d.labels.formatter||r.defaultLabelFormatter; -r.userOptions=b;r.minPixelPadding=0;r.reversed=d.reversed;r.visible=!1!==d.visible;r.zoomEnabled=!1!==d.zoomEnabled;r.hasNames="category"===k||!0===d.categories;r.categories=d.categories||r.hasNames;r.names=r.names||[];r.plotLinesAndBandsGroups={};r.isLog="logarithmic"===k;r.isDatetimeAxis="datetime"===k;r.positiveValuesOnly=r.isLog&&!r.allowNegativeLog;r.isLinked=l(d.linkedTo);r.ticks={};r.labelEdge=[];r.minorTicks={};r.plotLinesAndBands=[];r.alternateBands={};r.len=0;r.minRange=r.userMinRange=d.minRange|| -d.maxZoom;r.range=d.range;r.offset=d.offset||0;r.stacks={};r.oldStacks={};r.stacksTouched=0;r.max=null;r.min=null;r.crosshair=z(d.crosshair,q(a.options.tooltip.crosshairs)[g?0:1],!1);b=r.options.events;-1===c(r,a.axes)&&(g?a.axes.splice(a.xAxis.length,0,r):a.axes.push(r),a[r.coll].push(r));r.series=r.series||[];a.inverted&&g&&void 0===r.reversed&&(r.reversed=!0);p(b,function(a,b){D(r,b,a)});r.lin2log=d.linearToLogConverter||r.lin2log;r.isLog&&(r.val2lin=r.log2lin,r.lin2val=r.lin2log)},setOptions:function(a){this.options= -k(this.defaultOptions,"yAxis"===this.coll&&this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],k(h[this.coll],a))},defaultLabelFormatter:function(){var b=this.axis,c=this.value,d=b.categories,q=this.dateTimeLabelFormat,k=h.lang,e=k.numericSymbols,k=k.numericSymbolMagnitude||1E3,p=e&&e.length,v,m=b.options.labels.format,b=b.isLog?Math.abs(c):b.tickInterval;if(m)v=C(m,this);else if(d)v=c;else if(q)v= -a.dateFormat(q,c);else if(p&&1E3<=b)for(;p--&&void 0===v;)d=Math.pow(k,p+1),b>=d&&0===10*c%d&&null!==e[p]&&0!==c&&(v=a.numberFormat(c/d,-1)+e[p]);void 0===v&&(v=1E4<=Math.abs(c)?a.numberFormat(c,-1):a.numberFormat(c,-1,void 0,""));return v},getSeriesExtremes:function(){var a=this,b=a.chart;a.hasVisibleSeries=!1;a.dataMin=a.dataMax=a.threshold=null;a.softThreshold=!a.isXAxis;a.buildStacks&&a.buildStacks();e(a.series,function(g){if(g.visible||!b.options.chart.ignoreHiddenSeries){var c=g.options,r=c.threshold, -d;a.hasVisibleSeries=!0;a.positiveValuesOnly&&0>=r&&(r=null);if(a.isXAxis)c=g.xData,c.length&&(g=F(c),B(g)||g instanceof Date||(c=x(c,function(a){return B(a)}),g=F(c)),a.dataMin=Math.min(z(a.dataMin,c[0]),g),a.dataMax=Math.max(z(a.dataMax,c[0]),G(c)));else if(g.getExtremes(),d=g.dataMax,g=g.dataMin,l(g)&&l(d)&&(a.dataMin=Math.min(z(a.dataMin,g),g),a.dataMax=Math.max(z(a.dataMax,d),d)),l(r)&&(a.threshold=r),!c.softThreshold||a.positiveValuesOnly)a.softThreshold=!1}})},translate:function(a,b,c,d,q, -k){var g=this.linkedParent||this,r=1,e=0,p=d?g.oldTransA:g.transA;d=d?g.oldMin:g.min;var m=g.minPixelPadding;q=(g.isOrdinal||g.isBroken||g.isLog&&q)&&g.lin2val;p||(p=g.transA);c&&(r*=-1,e=g.len);g.reversed&&(r*=-1,e-=r*(g.sector||g.len));b?(a=(a*r+e-m)/p+d,q&&(a=g.lin2val(a))):(q&&(a=g.val2lin(a)),a=r*(a-d)*p+e+r*m+(B(k)?p*k:0));return a},toPixels:function(a,b){return this.translate(a,!1,!this.horiz,null,!0)+(b?0:this.pos)},toValue:function(a,b){return this.translate(a-(b?0:this.pos),!0,!this.horiz, -null,!0)},getPlotLinePath:function(a,b,c,d,q){var g=this.chart,r=this.left,k=this.top,e,p,m=c&&g.oldChartHeight||g.chartHeight,u=c&&g.oldChartWidth||g.chartWidth,y;e=this.transB;var x=function(a,b,g){if(ag)d?a=Math.min(Math.max(b,a),g):y=!0;return a};q=z(q,this.translate(a,null,null,c));a=c=Math.round(q+e);e=p=Math.round(m-q-e);B(q)?this.horiz?(e=k,p=m-this.bottom,a=c=x(a,r,r+this.width)):(a=r,c=u-this.right,e=p=x(e,k,k+this.height)):y=!0;return y&&!d?null:g.renderer.crispLine(["M",a,e,"L", -c,p],b||1)},getLinearTickPositions:function(a,b,c){var g,r=f(Math.floor(b/a)*a);c=f(Math.ceil(c/a)*a);var d=[];if(this.single)return[b];for(b=r;b<=c;){d.push(b);b=f(b+a);if(b===g)break;g=b}return d},getMinorTickPositions:function(){var a=this,b=a.options,c=a.tickPositions,d=a.minorTickInterval,q=[],k=a.pointRangePadding||0,p=a.min-k,k=a.max+k,v=k-p;if(v&&v/d=this.minRange,k,p,v,m,u,y;this.isXAxis&&void 0===this.minRange&&!this.isLog&&(l(a.min)||l(a.max)?this.minRange=null:(e(this.series,function(a){m=a.xData;for(p=u=a.xIncrement?1:m.length-1;0=t?(K=t,H=0):c.dataMax<=t&&(w=t,x=0)),c.min=z(M,K,c.dataMin),c.max=z(A,w,c.dataMax));k&&(c.positiveValuesOnly&&!g&&0>=Math.min(c.min, -z(c.dataMin,c.min))&&a.error(10,1),c.min=f(p(c.min),15),c.max=f(p(c.max),15));c.range&&l(c.max)&&(c.userMin=c.min=M=Math.max(c.min,c.minFromRange()),c.userMax=A=c.max,c.range=null);m(c,"foundExtremes");c.beforePadding&&c.beforePadding();c.adjustForMinRange();!(C||c.axisPointRange||c.usePercentage||y)&&l(c.min)&&l(c.max)&&(p=c.max-c.min)&&(!l(M)&&H&&(c.min-=p*H),!l(A)&&x&&(c.max+=p*x));B(q.softMin)&&(c.min=Math.min(c.min,q.softMin));B(q.softMax)&&(c.max=Math.max(c.max,q.softMax));B(q.floor)&&(c.min= -Math.max(c.min,q.floor));B(q.ceiling)&&(c.max=Math.min(c.max,q.ceiling));I&&l(c.dataMin)&&(t=t||0,!l(M)&&c.min=t?c.min=t:!l(A)&&c.max>t&&c.dataMax<=t&&(c.max=t));c.tickInterval=c.min===c.max||void 0===c.min||void 0===c.max?1:y&&!h&&n===c.linkedParent.options.tickPixelInterval?h=c.linkedParent.tickInterval:z(h,this.tickAmount?(c.max-c.min)/Math.max(this.tickAmount-1,1):void 0,C?1:(c.max-c.min)*n/Math.max(c.len,n));v&&!g&&e(c.series,function(a){a.processData(c.min!==c.oldMin||c.max!== -c.oldMax)});c.setAxisTranslation(!0);c.beforeSetTickPositions&&c.beforeSetTickPositions();c.postProcessTickInterval&&(c.tickInterval=c.postProcessTickInterval(c.tickInterval));c.pointRange&&!h&&(c.tickInterval=Math.max(c.pointRange,c.tickInterval));g=z(q.minTickInterval,c.isDatetimeAxis&&c.closestPointRange);!h&&c.tickIntervalc.tickInterval&&1E3c.max)),!!this.tickAmount)); -this.tickAmount||(c.tickInterval=c.unsquish());this.setTickPositions()},setTickPositions:function(){var a=this.options,b,c=a.tickPositions,d=a.tickPositioner,q=a.startOnTick,k=a.endOnTick;this.tickmarkOffset=this.categories&&"between"===a.tickmarkPlacement&&1===this.tickInterval?.5:0;this.minorTickInterval="auto"===a.minorTickInterval&&this.tickInterval?this.tickInterval/5:a.minorTickInterval;this.single=this.min===this.max&&l(this.min)&&!this.tickAmount&&(parseInt(this.min,10)===this.min||!1!==a.allowDecimals); -this.tickPositions=b=c&&c.slice();!b&&(b=this.isDatetimeAxis?this.getTimeTicks(this.normalizeTimeTickInterval(this.tickInterval,a.units),this.min,this.max,a.startOfWeek,this.ordinalPositions,this.closestPointRange,!0):this.isLog?this.getLogTickPositions(this.tickInterval,this.min,this.max):this.getLinearTickPositions(this.tickInterval,this.min,this.max),b.length>this.len&&(b=[b[0],b.pop()]),this.tickPositions=b,d&&(d=d.apply(this,[this.min,this.max])))&&(this.tickPositions=b=d);this.paddedTicks=b.slice(0); -this.trimTicks(b,q,k);this.isLinked||(this.single&&(this.min-=.5,this.max+=.5),c||d||this.adjustTickAmount())},trimTicks:function(a,b,c){var g=a[0],d=a[a.length-1],q=this.minPointOffset||0;if(!this.isLinked){if(b&&-Infinity!==g)this.min=g;else for(;this.min-q>a[0];)a.shift();if(c)this.max=d;else for(;this.max+qb&&(this.finalTickAmt=b,b=5);this.tickAmount=b},adjustTickAmount:function(){var a=this.tickInterval,b=this.tickPositions,c=this.tickAmount, -d=this.finalTickAmt,q=b&&b.length;if(qc&&(this.tickInterval*=2,this.setTickPositions());if(l(d)){for(a=c=b.length;a--;)(3===d&&1===a%2||2>=d&&0d&&(a=d)),l(g)&&(bd&&(b=d))),this.displayBtn=void 0!==a||void 0!==b,this.setExtremes(a,b,!1,void 0,{trigger:"zoom"});return!0},setAxisSize:function(){var a=this.chart, -b=this.options,c=b.offsets||[0,0,0,0],d=this.horiz,q=z(b.width,a.plotWidth-c[3]+c[1]),k=z(b.height,a.plotHeight-c[0]+c[2]),p=z(b.top,a.plotTop+c[0]),b=z(b.left,a.plotLeft+c[3]),c=/%$/;c.test(k)&&(k=Math.round(parseFloat(k)/100*a.plotHeight));c.test(p)&&(p=Math.round(parseFloat(p)/100*a.plotHeight+a.plotTop));this.left=b;this.top=p;this.width=q;this.height=k;this.bottom=a.chartHeight-k-p;this.right=a.chartWidth-q-b;this.len=Math.max(d?q:k,0);this.pos=d?b:p},getExtremes:function(){var a=this.isLog, -b=this.lin2log;return{min:a?f(b(this.min)):this.min,max:a?f(b(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(a){var b=this.isLog,c=this.lin2log,g=b?c(this.min):this.min,b=b?c(this.max):this.max;null===a?a=g:g>a?a=g:ba?"right":195a?"left":"center"},tickSize:function(a){var b=this.options,c=b[a+ -"Length"],g=z(b[a+"Width"],"tick"===a&&this.isXAxis?1:0);if(g&&c)return"inside"===b[a+"Position"]&&(c=-c),[c,g]},labelMetrics:function(){return this.chart.renderer.fontMetrics(this.options.labels.style&&this.options.labels.style.fontSize,this.ticks[0]&&this.ticks[0].label)},unsquish:function(){var a=this.options.labels,b=this.horiz,c=this.tickInterval,d=c,q=this.len/(((this.categories?1:0)+this.max-this.min)/c),k,p=a.rotation,v=this.labelMetrics(),m,u=Number.MAX_VALUE,y,x=function(a){a/=q||1;a=1< -a?Math.ceil(a):1;return a*c};b?(y=!a.staggerLines&&!a.step&&(l(p)?[p]:q=a)m=x(Math.abs(v.h/Math.sin(w*a))),b=m+Math.abs(a/360),b(c.step||0)&&!c.rotation&& -(this.staggerLines||1)*this.len/d||!b&&(q&&q-a.spacing[3]||.33*a.chartWidth)},renderUnsquish:function(){var a=this.chart,b=a.renderer,c=this.tickPositions,d=this.ticks,q=this.options.labels,p=this.horiz,m=this.getSlotWidth(),v=Math.max(1,Math.round(m-2*(q.padding||5))),u={},y=this.labelMetrics(),x=q.style&&q.style.textOverflow,f,H=0,h,l;I(q.rotation)||(u.rotation=q.rotation||0);e(c,function(a){(a=d[a])&&a.labelLength>H&&(H=a.labelLength)});this.maxLabelLength=H;if(this.autoRotation)H>v&&H>y.h?u.rotation= -this.labelRotation:this.labelRotation=0;else if(m&&(f={width:v+"px"},!x))for(f.textOverflow="clip",h=c.length;!p&&h--;)if(l=c[h],v=d[l].label)v.styles&&"ellipsis"===v.styles.textOverflow?v.css({textOverflow:"clip"}):d[l].labelLength>m&&v.css({width:m+"px"}),v.getBBox().height>this.len/c.length-(y.h-y.f)&&(v.specCss={textOverflow:"ellipsis"});u.rotation&&(f={width:(H>.5*a.chartHeight?.33*a.chartHeight:a.chartHeight)+"px"},x||(f.textOverflow="ellipsis"));if(this.labelAlign=q.align||this.autoLabelAlign(this.labelRotation))u.align= -this.labelAlign;e(c,function(a){var b=(a=d[a])&&a.label;b&&(b.attr(u),f&&b.css(k(f,b.specCss)),delete b.specCss,a.rotation=u.rotation)});this.tickRotCorr=b.rotCorr(y.b,this.labelRotation||0,0!==this.side)},hasData:function(){return this.hasVisibleSeries||l(this.min)&&l(this.max)&&!!this.tickPositions},addTitle:function(a){var b=this.chart.renderer,c=this.horiz,g=this.opposite,d=this.options.title,q;this.axisTitle||((q=d.textAlign)||(q=(c?{low:"left",middle:"center",high:"right"}:{low:g?"right":"left", -middle:"center",high:g?"left":"right"})[d.align]),this.axisTitle=b.text(d.text,0,0,d.useHTML).attr({zIndex:7,rotation:d.rotation||0,align:q}).addClass("highcharts-axis-title").css(d.style).add(this.axisGroup),this.axisTitle.isNew=!0);this.axisTitle[a?"show":"hide"](!0)},generateTick:function(a){var b=this.ticks;b[a]?b[a].addLabel():b[a]=new H(this,a)},getOffset:function(){var a=this,b=a.chart,c=b.renderer,d=a.options,q=a.tickPositions,k=a.ticks,m=a.horiz,v=a.side,u=b.inverted?[1,0,3,2][v]:v,y,x,f= -0,H,h=0,B=d.title,n=d.labels,E=0,C=b.axisOffset,b=b.clipOffset,t=[-1,1,1,-1][v],I=d.className,K=a.axisParent,w=this.tickSize("tick");y=a.hasData();a.showAxis=x=y||z(d.showEmpty,!0);a.staggerLines=a.horiz&&n.staggerLines;a.axisGroup||(a.gridGroup=c.g("grid").attr({zIndex:d.gridZIndex||1}).addClass("highcharts-"+this.coll.toLowerCase()+"-grid "+(I||"")).add(K),a.axisGroup=c.g("axis").attr({zIndex:d.zIndex||2}).addClass("highcharts-"+this.coll.toLowerCase()+" "+(I||"")).add(K),a.labelGroup=c.g("axis-labels").attr({zIndex:n.zIndex|| -7}).addClass("highcharts-"+a.coll.toLowerCase()+"-labels "+(I||"")).add(K));y||a.isLinked?(e(q,function(b,c){a.generateTick(b,c)}),a.renderUnsquish(),!1===n.reserveSpace||0!==v&&2!==v&&{1:"left",3:"right"}[v]!==a.labelAlign&&"center"!==a.labelAlign||e(q,function(a){E=Math.max(k[a].getLabelSize(),E)}),a.staggerLines&&(E*=a.staggerLines,a.labelOffset=E*(a.opposite?-1:1))):p(k,function(a,b){a.destroy();delete k[b]});B&&B.text&&!1!==B.enabled&&(a.addTitle(x),x&&!1!==B.reserveSpace&&(a.titleOffset=f=a.axisTitle.getBBox()[m? -"height":"width"],H=B.offset,h=l(H)?0:z(B.margin,m?5:10)));a.renderLine();a.offset=t*z(d.offset,C[v]);a.tickRotCorr=a.tickRotCorr||{x:0,y:0};c=0===v?-a.labelMetrics().h:2===v?a.tickRotCorr.y:0;h=Math.abs(E)+h;E&&(h=h-c+t*(m?z(n.y,a.tickRotCorr.y+8*t):n.x));a.axisTitleMargin=z(H,h);C[v]=Math.max(C[v],a.axisTitleMargin+f+t*a.offset,h,y&&q.length&&w?w[0]+t*a.offset:0);d=d.offset?0:2*Math.floor(a.axisLine.strokeWidth()/2);b[u]=Math.max(b[u],d)},getLinePath:function(a){var b=this.chart,c=this.opposite, -g=this.offset,d=this.horiz,q=this.left+(c?this.width:0)+g,g=b.chartHeight-this.bottom-(c?this.height:0)+g;c&&(a*=-1);return b.renderer.crispLine(["M",d?this.left:q,d?g:this.top,"L",d?b.chartWidth-this.right:q,d?g:b.chartHeight-this.bottom],a)},renderLine:function(){this.axisLine||(this.axisLine=this.chart.renderer.path().addClass("highcharts-axis-line").add(this.axisGroup),this.axisLine.attr({stroke:this.options.lineColor,"stroke-width":this.options.lineWidth,zIndex:7}))},getTitlePosition:function(){var a= -this.horiz,b=this.left,c=this.top,d=this.len,q=this.options.title,k=a?b:c,p=this.opposite,e=this.offset,m=q.x||0,u=q.y||0,y=this.chart.renderer.fontMetrics(q.style&&q.style.fontSize,this.axisTitle).f,d={low:k+(a?0:d),middle:k+d/2,high:k+(a?d:0)}[q.align],b=(a?c+this.height:b)+(a?1:-1)*(p?-1:1)*this.axisTitleMargin+(2===this.side?y:0);return{x:a?d+m:b+(p?this.width:0)+e+m,y:a?b+u-(p?this.height:0)+e:d+u}},renderMinorTick:function(a){var b=this.chart.hasRendered&&B(this.oldMin),c=this.minorTicks;c[a]|| -(c[a]=new H(this,a,"minor"));b&&c[a].isNew&&c[a].render(null,!0);c[a].render(null,!1,1)},renderTick:function(a,b){var c=this.isLinked,g=this.ticks,d=this.chart.hasRendered&&B(this.oldMin);if(!c||a>=this.min&&a<=this.max)g[a]||(g[a]=new H(this,a)),d&&g[a].isNew&&g[a].render(b,!0,.1),g[a].render(b)},render:function(){var b=this,c=b.chart,d=b.options,q=b.isLog,k=b.lin2log,m=b.isLinked,u=b.tickPositions,v=b.axisTitle,x=b.ticks,f=b.minorTicks,h=b.alternateBands,l=d.stackLabels,B=d.alternateGridColor,z= -b.tickmarkOffset,n=b.axisLine,E=b.showAxis,C=A(c.renderer.globalAnimation),t,I;b.labelEdge.length=0;b.overlap=!1;e([x,f,h],function(a){p(a,function(a){a.isActive=!1})});if(b.hasData()||m)b.minorTickInterval&&!b.categories&&e(b.getMinorTickPositions(),function(a){b.renderMinorTick(a)}),u.length&&(e(u,function(a,c){b.renderTick(a,c)}),z&&(0===b.min||b.single)&&(x[-1]||(x[-1]=new H(b,-1,null,!0)),x[-1].render(-1))),B&&e(u,function(g,d){I=void 0!==u[d+1]?u[d+1]+z:b.max-z;0===d%2&&g=d.second?0:z*Math.floor(k.getMilliseconds()/z));if(p>=d.second)k[A.hcSetSeconds](p>=d.minute?0:z*Math.floor(k.getSeconds()/z));if(p>=d.minute)k[A.hcSetMinutes](p>=d.hour?0:z*Math.floor(k[A.hcGetMinutes]()/z));if(p>=d.hour)k[A.hcSetHours](p>=d.day?0:z*Math.floor(k[A.hcGetHours]()/z));if(p>=d.day)k[A.hcSetDate](p>= -d.month?1:z*Math.floor(k[A.hcGetDate]()/z));p>=d.month&&(k[A.hcSetMonth](p>=d.year?0:z*Math.floor(k[A.hcGetMonth]()/z)),t=k[A.hcGetFullYear]());if(p>=d.year)k[A.hcSetFullYear](t-t%z);if(p===d.week)k[A.hcSetDate](k[A.hcGetDate]()-k[A.hcGetDay]()+e(x,1));t=k[A.hcGetFullYear]();x=k[A.hcGetMonth]();var q=k[A.hcGetDate](),y=k[A.hcGetHours]();if(A.hcTimezoneOffset||A.hcGetTimezoneOffset)C=(!B||!!A.hcGetTimezoneOffset)&&(b-l>4*d.month||w(l)!==w(b)),k=k.getTime(),k=new A(k+w(k));B=k.getTime();for(l=1;Bc.length&&f(c,function(a){0===a%18E5&&"000000000"===G("%H%M%S%L",a)&&(m[a]="day")})}c.info=h(a,{higherRanks:m,totalRange:p*z});return c};D.prototype.normalizeTimeTickInterval=function(a,e){var b=e||[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day", -[1,2]],["week",[1,2]],["month",[1,2,3,4,6]],["year",null]];e=b[b.length-1];var m=d[e[0]],c=e[1],u;for(u=0;uh&&(!w||u<=l)&&void 0!==u&&C.push(u),u>l&&(B=!0),u=c;else h=d(h),l=d(l),a=f[w?"minorTickInterval":"tickInterval"],a=n("auto"===a?null:a,this._minorAutoInterval,f.tickPixelInterval/(w?5:1)*(l-h)/((w?e/this.tickPositions.length: -e)||1)),a=F(a,null,A(a)),C=G(this.getLinearTickPositions(a,h,l),m),w||(this._minorAutoInterval=a/5);w||(this.tickInterval=a);return C};D.prototype.log2lin=function(a){return Math.log(a)/Math.LN10};D.prototype.lin2log=function(a){return Math.pow(10,a)}})(L);(function(a,D){var A=a.arrayMax,G=a.arrayMin,F=a.defined,n=a.destroyObjectProperties,f=a.each,h=a.erase,l=a.merge,w=a.pick;a.PlotLineOrBand=function(a,e){this.axis=a;e&&(this.options=e,this.id=e.id)};a.PlotLineOrBand.prototype={render:function(){var f= -this,e=f.axis,d=e.horiz,m=f.options,h=m.label,b=f.label,x=m.to,c=m.from,u=m.value,B=F(c)&&F(x),n=F(u),k=f.svgElem,E=!k,p=[],z=m.color,M=w(m.zIndex,0),q=m.events,p={"class":"highcharts-plot-"+(B?"band ":"line ")+(m.className||"")},y={},H=e.chart.renderer,K=B?"bands":"lines",g=e.log2lin;e.isLog&&(c=g(c),x=g(x),u=g(u));n?(p={stroke:z,"stroke-width":m.width},m.dashStyle&&(p.dashstyle=m.dashStyle)):B&&(z&&(p.fill=z),m.borderWidth&&(p.stroke=m.borderColor,p["stroke-width"]=m.borderWidth));y.zIndex=M;K+= -"-"+M;(z=e.plotLinesAndBandsGroups[K])||(e.plotLinesAndBandsGroups[K]=z=H.g("plot-"+K).attr(y).add());E&&(f.svgElem=k=H.path().attr(p).add(z));if(n)p=e.getPlotLinePath(u,k.strokeWidth());else if(B)p=e.getPlotBandPath(c,x,m);else return;E&&p&&p.length?(k.attr({d:p}),q&&a.objectEach(q,function(a,b){k.on(b,function(a){q[b].apply(f,[a])})})):k&&(p?(k.show(),k.animate({d:p})):(k.hide(),b&&(f.label=b=b.destroy())));h&&F(h.text)&&p&&p.length&&0this.max&&e>this.max;m&&d?(a&&(m.flat=m.toString()===d.toString(),b=0),m.push(f&&d[4]===m[4]?d[4]+b:d[4],f||d[5]!==m[5]?d[5]:d[5]+b,f&&d[1]===m[1]?d[1]+b:d[1],f||d[2]!==m[2]?d[2]:d[2]+b)):m=null;return m}, -addPlotBand:function(a){return this.addPlotBandOrLine(a,"plotBands")},addPlotLine:function(a){return this.addPlotBandOrLine(a,"plotLines")},addPlotBandOrLine:function(f,e){var d=(new a.PlotLineOrBand(this,f)).render(),m=this.userOptions;d&&(e&&(m[e]=m[e]||[],m[e].push(f)),this.plotLinesAndBands.push(d));return d},removePlotBandOrLine:function(a){for(var e=this.plotLinesAndBands,d=this.options,m=this.userOptions,l=e.length;l--;)e[l].id===a&&e[l].destroy();f([d.plotLines||[],m.plotLines||[],d.plotBands|| -[],m.plotBands||[]],function(b){for(l=b.length;l--;)b[l].id===a&&h(b,b[l])})},removePlotBand:function(a){this.removePlotBandOrLine(a)},removePlotLine:function(a){this.removePlotBandOrLine(a)}})})(L,S);(function(a){var D=a.dateFormat,A=a.each,G=a.extend,F=a.format,n=a.isNumber,f=a.map,h=a.merge,l=a.pick,w=a.splat,t=a.syncTimeout,e=a.timeUnits;a.Tooltip=function(){this.init.apply(this,arguments)};a.Tooltip.prototype={init:function(a,e){this.chart=a;this.options=e;this.crosshairs=[];this.now={x:0,y:0}; -this.isHidden=!0;this.split=e.split&&!a.inverted;this.shared=e.shared||this.split},cleanSplit:function(a){A(this.chart.series,function(d){var e=d&&d.tt;e&&(!e.isActive||a?d.tt=e.destroy():e.isActive=!1)})},getLabel:function(){var a=this.chart.renderer,e=this.options;this.label||(this.split?this.label=a.g("tooltip"):(this.label=a.label("",0,0,e.shape||"callout",null,null,e.useHTML,null,"tooltip").attr({padding:e.padding,r:e.borderRadius}),this.label.attr({fill:e.backgroundColor,"stroke-width":e.borderWidth}).css(e.style).shadow(e.shadow)), -this.label.attr({zIndex:8}).add());return this.label},update:function(a){this.destroy();h(!0,this.chart.options.tooltip.userOptions,a);this.init(this.chart,h(!0,this.options,a))},destroy:function(){this.label&&(this.label=this.label.destroy());this.split&&this.tt&&(this.cleanSplit(this.chart,!0),this.tt=this.tt.destroy());clearTimeout(this.hideTimer);clearTimeout(this.tooltipTimeout)},move:function(a,e,f,b){var d=this,c=d.now,u=!1!==d.options.animation&&!d.isHidden&&(1y-u?y:y-u);else if(m)c[a]=Math.max(k,g+u+q>b?g:g+u);else return!1},z=function(a,b,q,g){var k;gb-d?k=!1:c[a]=gb-q/2? -b-q-2:g-q/2;return k},t=function(a){var b=h;h=k;k=b;m=a},q=function(){!1!==p.apply(0,h)?!1!==z.apply(0,k)||m||(t(!0),q()):m?c.x=c.y=0:(t(!0),q())};(b.inverted||1q&&(u= -!1);a=(d.series&&d.series.yAxis&&d.series.yAxis.pos)+(d.plotY||0);a-=m.plotTop;b.push({target:d.isHeader?m.plotHeight+n:a,rank:d.isHeader?1:0,size:p.tt.getBBox().height+1,point:d,x:q,tt:x})});this.cleanSplit();a.distribute(b,m.plotHeight+n);A(b,function(a){var b=a.point,c=b.series;a.tt.attr({visibility:void 0===a.pos?"hidden":"inherit",x:u||b.isHeader?a.x:b.plotX+m.plotLeft+l(h.distance,16),y:a.pos+m.plotTop,anchorX:b.isHeader?b.plotX+m.plotLeft:b.plotX+c.xAxis.pos,anchorY:b.isHeader?a.pos+m.plotTop- -15:b.plotY+c.yAxis.pos})})},updatePosition:function(a){var d=this.chart,e=this.getLabel(),e=(this.options.positioner||this.getPosition).call(this,e.width,e.height,a);this.move(Math.round(e.x),Math.round(e.y||0),a.plotX+d.plotLeft,a.plotY+d.plotTop)},getDateFormat:function(a,f,h,b){var d=D("%m-%d %H:%M:%S.%L",f),c,u,m={millisecond:15,second:12,minute:9,hour:6,day:3},l="millisecond";for(u in e){if(a===e.week&&+D("%w",f)===h&&"00:00:00.000"===d.substr(6)){u="week";break}if(e[u]>a){u=l;break}if(m[u]&& -d.substr(m[u])!=="01-01 00:00:00.000".substr(m[u]))break;"week"!==u&&(l=u)}u&&(c=b[u]);return c},getXDateFormat:function(a,e,f){e=e.dateTimeLabelFormats;var b=f&&f.closestPointRange;return(b?this.getDateFormat(b,a.x,f.options.startOfWeek,e):e.day)||e.year},tooltipFooterHeaderFormatter:function(a,e){var d=e?"footer":"header";e=a.series;var b=e.tooltipOptions,f=b.xDateFormat,c=e.xAxis,u=c&&"datetime"===c.options.type&&n(a.key),d=b[d+"Format"];u&&!f&&(f=this.getXDateFormat(a,b,c));u&&f&&(d=d.replace("{point.key}", -"{point.key:"+f+"}"));return F(d,{point:a,series:e})},bodyFormatter:function(a){return f(a,function(a){var d=a.series.tooltipOptions;return(d.pointFormatter||a.point.tooltipFormatter).call(a.point,d.pointFormat)})}}})(L);(function(a){var D=a.addEvent,A=a.attr,G=a.charts,F=a.color,n=a.css,f=a.defined,h=a.doc,l=a.each,w=a.extend,t=a.fireEvent,e=a.offset,d=a.pick,m=a.removeEvent,C=a.splat,b=a.Tooltip,x=a.win;a.Pointer=function(a,b){this.init(a,b)};a.Pointer.prototype={init:function(a,e){this.options= -e;this.chart=a;this.runChartClick=e.chart.events&&!!e.chart.events.click;this.pinchDown=[];this.lastValidTouch={};b&&e.tooltip.enabled&&(a.tooltip=new b(a,e.tooltip),this.followTouchMove=d(e.tooltip.followTouchMove,!0));this.setDOMEvents()},zoomOption:function(a){var b=this.chart,c=b.options.chart,e=c.zoomType||"",b=b.inverted;/touch/.test(a.type)&&(e=d(c.pinchType,e));this.zoomX=a=/x/.test(e);this.zoomY=e=/y/.test(e);this.zoomHor=a&&!b||e&&b;this.zoomVert=e&&!b||a&&b;this.hasZoom=a||e},normalize:function(a, -b){var c,d;a=a||x.event;a.target||(a.target=a.srcElement);d=a.touches?a.touches.length?a.touches.item(0):a.changedTouches[0]:a;b||(this.chartPosition=b=e(this.chart.container));void 0===d.pageX?(c=Math.max(a.x,a.clientX-b.left),b=a.y):(c=d.pageX-b.left,b=d.pageY-b.top);return w(a,{chartX:Math.round(c),chartY:Math.round(b)})},getCoordinates:function(a){var b={xAxis:[],yAxis:[]};l(this.chart.axes,function(c){b[c.isXAxis?"xAxis":"yAxis"].push({axis:c,value:c.toValue(a[c.horiz?"chartX":"chartY"])})}); -return b},getKDPoints:function(a,b,e){var c=[],k,f,p;l(a,function(a){k=a.noSharedTooltip&&b;f=!b&&a.directTouch;a.visible&&!f&&d(a.options.enableMouseTracking,!0)&&(p=a.searchPoint(e,!k&&0>a.options.findNearestPointBy.indexOf("y")))&&p.series&&c.push(p)});c.sort(function(a,c){var d=a.distX-c.distX,e=a.dist-c.dist,k=(c.series.group&&c.series.group.zIndex)-(a.series.group&&a.series.group.zIndex);return 0!==d&&b?d:0!==e?e:0!==k?k:a.series.index>c.series.index?-1:1});if(b&&c[0]&&!c[0].series.noSharedTooltip)for(a= -c.length;a--;)(c[a].x!==c[0].x||c[a].series.noSharedTooltip)&&c.splice(a,1);return c},getPointFromEvent:function(a){a=a.target;for(var b;a&&!b;)b=a.point,a=a.parentNode;return b},getHoverData:function(b,e,f,m,k,x){var c=b,u=e,h;m?k?(h=[],l(f,function(a){var b=a.noSharedTooltip&&k,q=!k&&a.directTouch;a.visible&&!b&&!q&&d(a.options.enableMouseTracking,!0)&&(a=a.searchKDTree({clientX:c.clientX,plotY:c.plotY},!b&&1===a.kdDimensions))&&a.series&&h.push(a)}),0===h.length&&(h=[c])):h=[c]:u&&!u.stickyTracking? -(k||(f=[u]),h=this.getKDPoints(f,k,x),c=a.find(h,function(a){return a.series===u})):(b=a.grep(f,function(a){return a.stickyTracking}),h=this.getKDPoints(b,k,x),u=(c=h[0])&&c.series,k&&(h=this.getKDPoints(f,k,x)));h.sort(function(a,b){return a.series.index-b.series.index});return{hoverPoint:c,hoverSeries:u,hoverPoints:h}},runPointActions:function(b,e){var c=this.chart,f=c.tooltip,k=f?f.shared:!1,m=e||c.hoverPoint,p=m&&m.series||c.hoverSeries;e=this.getHoverData(m,p,c.series,!!e||p&&p.directTouch,k, -b);var u,x,m=e.hoverPoint;u=(p=e.hoverSeries)&&p.tooltipOptions.followPointer;x=(k=k&&m&&!m.series.noSharedTooltip)?e.hoverPoints:m?[m]:[];if(m&&(m!==c.hoverPoint||f&&f.isHidden)){l(c.hoverPoints||[],function(b){-1===a.inArray(b,x)&&b.setState()});l(x||[],function(a){a.setState("hover")});if(c.hoverSeries!==p)p.onMouseOver();p&&!p.directTouch&&(c.hoverPoint&&c.hoverPoint.firePointEvent("mouseOut"),m.firePointEvent("mouseOver"));c.hoverPoints=x;c.hoverPoint=m;f&&f.refresh(k?x:m,b)}else u&&f&&!f.isHidden&& -(p=f.getAnchor([{}],b),f.updatePosition({plotX:p[0],plotY:p[1]}));this.unDocMouseMove||(this.unDocMouseMove=D(h,"mousemove",function(b){var c=G[a.hoverChartIndex];if(c)c.pointer.onDocumentMouseMove(b)}));l(c.axes,function(c){d(c.crosshair.snap,!0)?a.find(x,function(a){return a.series[c.coll]===c})?c.drawCrosshair(b,m):c.hideCrosshair():c.drawCrosshair(b)})},reset:function(a,b){var c=this.chart,d=c.hoverSeries,e=c.hoverPoint,f=c.hoverPoints,p=c.tooltip,m=p&&p.shared?f:e;a&&m&&l(C(m),function(b){b.series.isCartesian&& -void 0===b.plotX&&(a=!1)});if(a)p&&m&&(p.refresh(m),e&&(e.setState(e.state,!0),l(c.axes,function(a){a.crosshair&&a.drawCrosshair(null,e)})));else{if(e)e.onMouseOut();f&&l(f,function(a){a.setState()});if(d)d.onMouseOut();p&&p.hide(b);this.unDocMouseMove&&(this.unDocMouseMove=this.unDocMouseMove());l(c.axes,function(a){a.hideCrosshair()});this.hoverX=c.hoverPoints=c.hoverPoint=null}},scaleGroups:function(a,b){var c=this.chart,d;l(c.series,function(e){d=a||e.getPlotBox();e.xAxis&&e.xAxis.zoomEnabled&& -e.group&&(e.group.attr(d),e.markerGroup&&(e.markerGroup.attr(d),e.markerGroup.clip(b?c.clipRect:null)),e.dataLabelsGroup&&e.dataLabelsGroup.attr(d))});c.clipRect.attr(b||c.clipBox)},dragStart:function(a){var b=this.chart;b.mouseIsDown=a.type;b.cancelClick=!1;b.mouseDownX=this.mouseDownX=a.chartX;b.mouseDownY=this.mouseDownY=a.chartY},drag:function(a){var b=this.chart,c=b.options.chart,d=a.chartX,e=a.chartY,f=this.zoomHor,p=this.zoomVert,m=b.plotLeft,x=b.plotTop,q=b.plotWidth,y=b.plotHeight,h,l=this.selectionMarker, -g=this.mouseDownX,r=this.mouseDownY,n=c.panKey&&a[c.panKey+"Key"];l&&l.touch||(dm+q&&(d=m+q),ex+y&&(e=x+y),this.hasDragged=Math.sqrt(Math.pow(g-d,2)+Math.pow(r-e,2)),10M.max&&(f= -M.max-k,r=!0);r?(H-=.8*(H-m[x][0]),q||(g-=.8*(g-m[x][1])),n()):m[x]=[H,g];z||(d[x]=E-w,d[l]=k);d=z?1/p:p;e[l]=k;e[x]=f;t[z?a?"scaleY":"scaleX":"scale"+c]=p;t["translate"+c]=d*w+(H-d*y)},pinch:function(a){var h=this,w=h.chart,t=h.pinchDown,e=a.touches,d=e.length,m=h.lastValidTouch,C=h.hasZoom,b=h.selectionMarker,x={},c=1===d&&(h.inClass(a.target,"highcharts-tracker")&&w.runTrackerClick||h.runChartClick),u={};1c-6&&m(y||b.spacingBox.width-2*h-d.x)&&(this.itemX=h,this.itemY+=K+this.lastLineHeight+l,this.lastLineHeight=0);this.maxItemWidth=Math.max(this.maxItemWidth,f);this.lastItemY=K+this.itemY+l;this.lastLineHeight= -Math.max(k,this.lastLineHeight);a._legendItemPos=[this.itemX,this.itemY];e?this.itemX+=f:(this.itemY+=K+k+l,this.lastLineHeight=k);this.offsetWidth=y||Math.max((e?this.itemX-h-n:f)+h,this.offsetWidth)},getAllItems:function(){var a=[];f(this.chart.series,function(b){var c=b&&b.options;b&&t(c.showInLegend,n(c.linkedTo)?!1:void 0,!0)&&(a=a.concat(b.legendItems||("point"===c.legendType?b.data:b)))});return a},adjustMargins:function(a,d){var b=this.chart,e=this.options,m=e.align.charAt(0)+e.verticalAlign.charAt(0)+ -e.layout.charAt(0);e.floating||f([/(lth|ct|rth)/,/(rtv|rm|rbv)/,/(rbh|cb|lbh)/,/(lbv|lm|ltv)/],function(c,k){c.test(m)&&!n(a[k])&&(b[l[k]]=Math.max(b[l[k]],b.legend[(k+1)%2?"legendHeight":"legendWidth"]+[1,-1,-1,1][k]*e[k%2?"x":"y"]+t(e.margin,12)+d[k]))})},render:function(){var a=this,e=a.chart,c=e.renderer,m=a.group,h,n,k,l,p=a.box,z=a.options,t=a.padding;a.itemX=t;a.itemY=a.initialItemY;a.offsetWidth=0;a.lastItemY=0;m||(a.group=m=c.g("legend").attr({zIndex:7}).add(),a.contentGroup=c.g().attr({zIndex:1}).add(m), -a.scrollGroup=c.g().add(a.contentGroup));a.renderTitle();h=a.getAllItems();d(h,function(a,b){return(a.options&&a.options.legendIndex||0)-(b.options&&b.options.legendIndex||0)});z.reversed&&h.reverse();a.allItems=h;a.display=n=!!h.length;a.lastLineHeight=0;f(h,function(b){a.renderItem(b)});k=(z.width||a.offsetWidth)+t;l=a.lastItemY+a.lastLineHeight+a.titleHeight;l=a.handleOverflow(l);l+=t;p||(a.box=p=c.rect().addClass("highcharts-legend-box").attr({r:z.borderRadius}).add(m),p.isNew=!0);p.attr({stroke:z.borderColor, -"stroke-width":z.borderWidth||0,fill:z.backgroundColor||"none"}).shadow(z.shadow);0c&&!1!==l.enabled?(this.clipHeight=h=Math.max(c-20-this.titleHeight- -k,0),this.currentPage=t(this.currentPage,1),this.fullHeight=a,f(g,function(a,b){var c=a._legendItemPos[1];a=Math.round(a.legendItem.getBBox().height);var d=H.length;if(!d||c-H[d-1]>h&&(K||c)!==H[d-1])H.push(K||c),d++;b===g.length-1&&c+a-H[d-1]>h&&H.push(c);c!==K&&(K=c)}),p||(p=b.clipRect=d.clipRect(0,k,9999,0),b.contentGroup.clip(p)),r(h),y||(this.nav=y=d.g().attr({zIndex:1}).add(this.group),this.up=d.symbol("triangle",0,0,q,q).on("click",function(){b.scroll(-1,n)}).add(y),this.pager=d.text("",15, -10).addClass("highcharts-legend-navigation").css(l.style).add(y),this.down=d.symbol("triangle-down",0,0,q,q).on("click",function(){b.scroll(1,n)}).add(y)),b.scroll(0),a=c):y&&(r(),this.nav=y.destroy(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0);return a},scroll:function(a,d){var b=this.pages,f=b.length;a=this.currentPage+a;var m=this.clipHeight,h=this.options.navigation,k=this.pager,l=this.padding;a>f&&(a=f);0n&&(e=typeof a[0],"string"===e?d.name= -a[0]:"number"===e&&(d.x=a[0]),c++);u=h.value;)h=d[++f];h&&h.color&&!this.options.color&&(this.color=h.color);return h},destroy:function(){var a=this.series.chart,d=a.hoverPoints,f;a.pointCount--;d&&(this.setState(),F(d,this),d.length||(a.hoverPoints=null));if(this===a.hoverPoint)this.onMouseOut();if(this.graphic||this.dataLabel)t(this),this.destroyElements();this.legendItem&& -a.legend.destroyItem(this);for(f in this)this[f]=null},destroyElements:function(){for(var a=["graphic","dataLabel","dataLabelUpper","connector","shadowGroup"],d,f=6;f--;)d=a[f],this[d]&&(this[d]=this[d].destroy())},getLabelConfig:function(){return{x:this.category,y:this.y,color:this.color,colorIndex:this.colorIndex,key:this.name||this.category,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},tooltipFormatter:function(a){var d=this.series,e=d.tooltipOptions, -h=w(e.valueDecimals,""),b=e.valuePrefix||"",l=e.valueSuffix||"";A(d.pointArrayMap||["y"],function(c){c="{point."+c;if(b||l)a=a.replace(c+"}",b+c+"}"+l);a=a.replace(c+"}",c+":,."+h+"f}")});return f(a,{point:this,series:this.series})},firePointEvent:function(a,d,f){var e=this,b=this.series.options;(b.point.events[a]||e.options&&e.options.events&&e.options.events[a])&&this.importEvents();"click"===a&&b.allowPointSelect&&(f=function(a){e.select&&e.select(null,a.ctrlKey||a.metaKey||a.shiftKey)});n(this, -a,d,f)},visible:!0}})(L);(function(a){var D=a.addEvent,A=a.animObject,G=a.arrayMax,F=a.arrayMin,n=a.correctFloat,f=a.Date,h=a.defaultOptions,l=a.defaultPlotOptions,w=a.defined,t=a.each,e=a.erase,d=a.extend,m=a.fireEvent,C=a.grep,b=a.isArray,x=a.isNumber,c=a.isString,u=a.merge,B=a.objectEach,I=a.pick,k=a.removeEvent,E=a.splat,p=a.SVGElement,z=a.syncTimeout,M=a.win;a.Series=a.seriesType("line",null,{lineWidth:2,allowPointSelect:!1,showCheckbox:!1,animation:{duration:1E3},events:{},marker:{lineWidth:0, -lineColor:"#ffffff",radius:4,states:{hover:{animation:{duration:50},enabled:!0,radiusPlus:2,lineWidthPlus:1},select:{fillColor:"#cccccc",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:{align:"center",formatter:function(){return null===this.y?"":a.numberFormat(this.y,-1)},style:{fontSize:"11px",fontWeight:"bold",color:"contrast",textOutline:"1px contrast"},verticalAlign:"bottom",x:0,y:0,padding:5},cropThreshold:300,pointRange:0,softThreshold:!0,states:{hover:{animation:{duration:50}, -lineWidthPlus:1,marker:{},halo:{size:10,opacity:.25}},select:{marker:{}}},stickyTracking:!0,turboThreshold:1E3,findNearestPointBy:"x"},{isCartesian:!0,pointClass:a.Point,sorted:!0,requireSorting:!0,directTouch:!1,axisTypes:["xAxis","yAxis"],colorCounter:0,parallelArrays:["x","y"],coll:"series",init:function(a,b){var c=this,e,g=a.series,q;c.chart=a;c.options=b=c.setOptions(b);c.linkedSeries=[];c.bindAxes();d(c,{name:b.name,state:"",visible:!1!==b.visible,selected:!0===b.selected});e=b.events;B(e,function(a, -b){D(c,b,a)});if(e&&e.click||b.point&&b.point.events&&b.point.events.click||b.allowPointSelect)a.runTrackerClick=!0;c.getColor();c.getSymbol();t(c.parallelArrays,function(a){c[a+"Data"]=[]});c.setData(b.data,!1);c.isCartesian&&(a.hasCartesianSeries=!0);g.length&&(q=g[g.length-1]);c._i=I(q&&q._i,-1)+1;a.orderSeries(this.insert(g))},insert:function(a){var b=this.options.index,c;if(x(b)){for(c=a.length;c--;)if(b>=I(a[c].options.index,a[c]._i)){a.splice(c+1,0,this);break}-1===c&&a.unshift(this);c+=1}else a.push(this); -return I(c,a.length-1)},bindAxes:function(){var b=this,c=b.options,d=b.chart,e;t(b.axisTypes||[],function(g){t(d[g],function(a){e=a.options;if(c[g]===e.index||void 0!==c[g]&&c[g]===e.id||void 0===c[g]&&0===e.index)b.insert(a.series),b[g]=a,a.isDirty=!0});b[g]||b.optionalAxis===g||a.error(18,!0)})},updateParallelArrays:function(a,b){var c=a.series,d=arguments,g=x(b)?function(d){var g="y"===d&&c.toYData?c.toYData(a):a[d];c[d+"Data"][b]=g}:function(a){Array.prototype[b].apply(c[a+"Data"],Array.prototype.slice.call(d, -2))};t(c.parallelArrays,g)},autoIncrement:function(){var a=this.options,b=this.xIncrement,c,d=a.pointIntervalUnit,b=I(b,a.pointStart,0);this.pointInterval=c=I(this.pointInterval,a.pointInterval,1);d&&(a=new f(b),"day"===d?a=+a[f.hcSetDate](a[f.hcGetDate]()+c):"month"===d?a=+a[f.hcSetMonth](a[f.hcGetMonth]()+c):"year"===d&&(a=+a[f.hcSetFullYear](a[f.hcGetFullYear]()+c)),c=a-b);this.xIncrement=b+c;return b},setOptions:function(a){var b=this.chart,c=b.options,d=c.plotOptions,g=(b.userOptions||{}).plotOptions|| -{},e=d[this.type];this.userOptions=a;b=u(e,d.series,a);this.tooltipOptions=u(h.tooltip,h.plotOptions.series&&h.plotOptions.series.tooltip,h.plotOptions[this.type].tooltip,c.tooltip.userOptions,d.series&&d.series.tooltip,d[this.type].tooltip,a.tooltip);this.stickyTracking=I(a.stickyTracking,g[this.type]&&g[this.type].stickyTracking,g.series&&g.series.stickyTracking,this.tooltipOptions.shared&&!this.noSharedTooltip?!0:b.stickyTracking);null===e.marker&&delete b.marker;this.zoneAxis=b.zoneAxis;a=this.zones= -(b.zones||[]).slice();!b.negativeColor&&!b.negativeFillColor||b.zones||a.push({value:b[this.zoneAxis+"Threshold"]||b.threshold||0,className:"highcharts-negative",color:b.negativeColor,fillColor:b.negativeFillColor});a.length&&w(a[a.length-1].value)&&a.push({color:this.color,fillColor:this.fillColor});return b},getCyclic:function(a,b,c){var d,g=this.chart,e=this.userOptions,q=a+"Index",f=a+"Counter",k=c?c.length:I(g.options.chart[a+"Count"],g[a+"Count"]);b||(d=I(e[q],e["_"+q]),w(d)||(g.series.length|| -(g[f]=0),e["_"+q]=d=g[f]%k,g[f]+=1),c&&(b=c[d]));void 0!==d&&(this[q]=d);this[a]=b},getColor:function(){this.options.colorByPoint?this.options.color=null:this.getCyclic("color",this.options.color||l[this.type].color,this.chart.options.colors)},getSymbol:function(){this.getCyclic("symbol",this.options.marker.symbol,this.chart.options.symbols)},drawLegendSymbol:a.LegendSymbolMixin.drawLineMarker,setData:function(d,e,f,k){var g=this,q=g.points,m=q&&q.length||0,p,h=g.options,y=g.chart,l=null,n=g.xAxis, -u=h.turboThreshold,z=this.xData,H=this.yData,w=(p=g.pointArrayMap)&&p.length;d=d||[];p=d.length;e=I(e,!0);if(!1!==k&&p&&m===p&&!g.cropped&&!g.hasGroupedData&&g.visible)t(d,function(a,b){q[b].update&&a!==h.data[b]&&q[b].update(a,!1,null,!1)});else{g.xIncrement=null;g.colorCounter=0;t(this.parallelArrays,function(a){g[a+"Data"].length=0});if(u&&p>u){for(f=0;null===l&&fm||this.forceCrop))if(c[e-1]x)c=[],d=[];else if(c[0]x)g=this.cropData(this.xData,this.yData,u,x),c=g.xData,d=g.yData,g=g.start,f=!0;for(m=c.length|| -1;--m;)e=n?p(c[m])-p(c[m-1]):c[m]-c[m-1],0e&&this.requireSorting&&a.error(15);this.cropped=f;this.cropStart=g;this.processedXData=c;this.processedYData=d;this.closestPointRange=q},cropData:function(a,b,c,d){var g=a.length,e=0,f=g,q=I(this.cropShoulder,1),k;for(k=0;k=c){e=Math.max(0,k-q);break}for(c=k;cd){f=c+q;break}return{xData:a.slice(e,f),yData:b.slice(e,f),start:e,end:f}},generatePoints:function(){var a=this.options,b=a.data,c=this.data, -d,g=this.processedXData,e=this.processedYData,f=this.pointClass,k=g.length,m=this.cropStart||0,p,h=this.hasGroupedData,a=a.keys,l,n=[],u;c||h||(c=[],c.length=b.length,c=this.data=c);a&&h&&(this.options.keys=!1);for(u=0;u=q&&(d[l]||p)<=k,m&&p)if(m=h.length)for(;m--;)null!==h[m]&&(g[f++]=h[m]);else g[f++]=h;this.dataMin= -F(g);this.dataMax=G(g)},translate:function(){this.processedXData||this.processData();this.generatePoints();var a=this.options,b=a.stacking,c=this.xAxis,d=c.categories,g=this.yAxis,e=this.points,f=e.length,k=!!this.modifyValue,m=a.pointPlacement,p="between"===m||x(m),h=a.threshold,l=a.startFromThreshold?h:0,u,z,t,E,C=Number.MAX_VALUE;"between"===m&&(m=.5);x(m)&&(m*=I(a.pointRange||c.pointRange));for(a=0;a=A&&(B.isNull=!0);B.plotX=u=n(Math.min(Math.max(-1E5,c.translate(M,0,0,0,1,m,"flags"===this.type)),1E5));b&&this.visible&&!B.isNull&&D&&D[M]&&(E=this.getStackIndicator(E,M,this.index),F=D[M],A=F.points[E.key],z=A[0],A=A[1],z===l&&E.key===D[M].base&&(z=I(h,g.min)),g.positiveValuesOnly&&0>=z&&(z=null),B.total=B.stackTotal=F.total,B.percentage=F.total&&B.y/F.total*100,B.stackY=A,F.setOffset(this.pointXOffset||0,this.barW||0));B.yBottom=w(z)?g.translate(z,0,1,0,1): -null;k&&(A=this.modifyValue(A,B));B.plotY=z="number"===typeof A&&Infinity!==A?Math.min(Math.max(-1E5,g.translate(A,0,1,0,1)),1E5):void 0;B.isInside=void 0!==z&&0<=z&&z<=g.len&&0<=u&&u<=c.len;B.clientX=p?n(c.translate(M,0,0,0,1,m)):u;B.negative=B.y<(h||0);B.category=d&&void 0!==d[B.x]?d[B.x]:B.x;B.isNull||(void 0!==t&&(C=Math.min(C,Math.abs(u-t))),t=u);B.zone=this.zones.length&&B.getZone()}this.closestPointRangePx=C},getValidPoints:function(a,b){var c=this.chart;return C(a||this.points||[],function(a){return b&& -!c.isInsidePlot(a.plotX,a.plotY,c.inverted)?!1:!a.isNull})},setClip:function(a){var b=this.chart,c=this.options,d=b.renderer,g=b.inverted,e=this.clipBox,f=e||b.clipBox,q=this.sharedClipKey||["_sharedClip",a&&a.duration,a&&a.easing,f.height,c.xAxis,c.yAxis].join(),k=b[q],m=b[q+"m"];k||(a&&(f.width=0,b[q+"m"]=m=d.clipRect(-99,g?-b.plotLeft:-b.plotTop,99,g?b.chartWidth:b.chartHeight)),b[q]=k=d.clipRect(f),k.count={length:0});a&&!k.count[this.index]&&(k.count[this.index]=!0,k.count.length+=1);!1!==c.clip&& -(this.group.clip(a||e?k:b.clipRect),this.markerGroup.clip(m),this.sharedClipKey=q);a||(k.count[this.index]&&(delete k.count[this.index],--k.count.length),0===k.count.length&&q&&b[q]&&(e||(b[q]=b[q].destroy()),b[q+"m"]&&(b[q+"m"]=b[q+"m"].destroy())))},animate:function(a){var b=this.chart,c=A(this.options.animation),d;a?this.setClip(c):(d=this.sharedClipKey,(a=b[d])&&a.animate({width:b.plotSizeX},c),b[d+"m"]&&b[d+"m"].animate({width:b.plotSizeX+99},c),this.animate=null)},afterAnimate:function(){this.setClip(); -m(this,"afterAnimate")},drawPoints:function(){var a=this.points,b=this.chart,c,d,g,e,f=this.options.marker,k,m,p,h,l=this[this.specialGroup]||this.markerGroup,n=I(f.enabled,this.xAxis.isRadial?!0:null,this.closestPointRangePx>=2*f.radius);if(!1!==f.enabled||this._hasPointMarkers)for(d=0;de&&b.shadow));f&&(f.startX=c.xMap,f.isArea=c.isArea)})},applyZones:function(){var a=this,b=this.chart,c=b.renderer, -d=this.zones,g,e,f=this.clips||[],k,m=this.graph,p=this.area,h=Math.max(b.chartWidth,b.chartHeight),l=this[(this.zoneAxis||"y")+"Axis"],n,u,x=b.inverted,z,E,w,B,C=!1;d.length&&(m||p)&&l&&void 0!==l.min&&(u=l.reversed,z=l.horiz,m&&m.hide(),p&&p.hide(),n=l.getExtremes(),t(d,function(d,q){g=u?z?b.plotWidth:0:z?0:l.toPixels(n.min);g=Math.min(Math.max(I(e,g),0),h);e=Math.min(Math.max(Math.round(l.toPixels(I(d.value,n.max),!0)),0),h);C&&(g=e=l.toPixels(n.max));E=Math.abs(g-e);w=Math.min(g,e);B=Math.max(g, -e);l.isXAxis?(k={x:x?B:w,y:0,width:E,height:h},z||(k.x=b.plotHeight-k.x)):(k={x:0,y:x?B:w,width:h,height:E},z&&(k.y=b.plotWidth-k.y));x&&c.isVML&&(k=l.isXAxis?{x:0,y:u?w:B,height:k.width,width:b.chartWidth}:{x:k.y-b.plotLeft-b.spacingBox.x,y:0,width:k.height,height:b.chartHeight});f[q]?f[q].animate(k):(f[q]=c.clipRect(k),m&&a["zone-graph-"+q].clip(f[q]),p&&a["zone-area-"+q].clip(f[q]));C=d.value>n.max}),this.clips=f)},invertGroups:function(a){function b(){t(["group","markerGroup"],function(b){c[b]&& -(d.renderer.isVML&&c[b].attr({width:c.yAxis.len,height:c.xAxis.len}),c[b].width=c.yAxis.len,c[b].height=c.xAxis.len,c[b].invert(a))})}var c=this,d=c.chart,g;c.xAxis&&(g=D(d,"resize",b),D(c,"destroy",g),b(a),c.invertGroups=b)},plotGroup:function(a,b,c,d,g){var e=this[a],f=!e;f&&(this[a]=e=this.chart.renderer.g().attr({zIndex:d||.1}).add(g));e.addClass("highcharts-"+b+" highcharts-series-"+this.index+" highcharts-"+this.type+"-series highcharts-color-"+this.colorIndex+" "+(this.options.className||""), -!0);e.attr({visibility:c})[f?"attr":"animate"](this.getPlotBox());return e},getPlotBox:function(){var a=this.chart,b=this.xAxis,c=this.yAxis;a.inverted&&(b=c,c=this.xAxis);return{translateX:b?b.left:a.plotLeft,translateY:c?c.top:a.plotTop,scaleX:1,scaleY:1}},render:function(){var a=this,b=a.chart,c,d=a.options,g=!!a.animate&&b.renderer.isSVG&&A(d.animation).duration,e=a.visible?"inherit":"hidden",f=d.zIndex,k=a.hasRendered,m=b.seriesGroup,p=b.inverted;c=a.plotGroup("group","series",e,f,m);a.markerGroup= -a.plotGroup("markerGroup","markers",e,f,m);g&&a.animate(!0);c.inverted=a.isCartesian?p:!1;a.drawGraph&&(a.drawGraph(),a.applyZones());a.drawDataLabels&&a.drawDataLabels();a.visible&&a.drawPoints();a.drawTracker&&!1!==a.options.enableMouseTracking&&a.drawTracker();a.invertGroups(p);!1===d.clip||a.sharedClipKey||k||c.clip(b.clipRect);g&&a.animate();k||(a.animationTimeout=z(function(){a.afterAnimate()},g));a.isDirty=!1;a.hasRendered=!0},redraw:function(){var a=this.chart,b=this.isDirty||this.isDirtyData, -c=this.group,d=this.xAxis,g=this.yAxis;c&&(a.inverted&&c.attr({width:a.plotWidth,height:a.plotHeight}),c.animate({translateX:I(d&&d.left,a.plotLeft),translateY:I(g&&g.top,a.plotTop)}));this.translate();this.render();b&&delete this.kdTree},kdAxisArray:["clientX","plotY"],searchPoint:function(a,b){var c=this.xAxis,d=this.yAxis,g=this.chart.inverted;return this.searchKDTree({clientX:g?c.len-a.chartY+c.pos:a.chartX-c.pos,plotY:g?d.len-a.chartX+d.pos:a.chartY-d.pos},b)},buildKDTree:function(){function a(c, -d,e){var g,f;if(f=c&&c.length)return g=b.kdAxisArray[d%e],c.sort(function(a,b){return a[g]-b[g]}),f=Math.floor(f/2),{point:c[f],left:a(c.slice(0,f),d+1,e),right:a(c.slice(f+1),d+1,e)}}this.buildingKdTree=!0;var b=this,c=-1q?"left":"right";l=0>q?"right":"left";b[h]&&(h=c(a,b[h],g+1,m),n=h[k]u;)n--;this.updateParallelArrays(m,"splice",n,0,0);this.updateParallelArrays(m,n);g&&m.name&&(g[u]=m.name);h.splice(n,0,a);q&&(this.data.splice(n,0,null),this.processData());"point"===f.legendType&&this.generatePoints();d&&(k[0]&&k[0].remove?k[0].remove(!1):(k.shift(),this.updateParallelArrays(m,"shift"),h.shift()));this.isDirtyData=this.isDirty=!0;b&&p.redraw(e)},removePoint:function(a,b,d){var e=this,f=e.data,p=f[a],h=e.points, -g=e.chart,m=function(){h&&h.length===f.length&&h.splice(a,1);f.splice(a,1);e.options.data.splice(a,1);e.updateParallelArrays(p||{series:e},"splice",a,1);p&&p.destroy();e.isDirty=!0;e.isDirtyData=!0;b&&g.redraw()};k(d,g);b=c(b,!0);p?p.firePointEvent("remove",null,m):m()},remove:function(a,b,d){function e(){f.destroy();k.isDirtyLegend=k.isDirtyBox=!0;k.linkSeries();c(a,!0)&&k.redraw(b)}var f=this,k=f.chart;!1!==d?t(f,"remove",null,e):e()},update:function(a,d){var e=this,f=e.chart,k=e.userOptions,p= -e.oldType||e.type,m=a.type||k.type||f.options.chart.type,g=I[p].prototype,l=["group","markerGroup","dataLabelsGroup"],n;if(m&&m!==p||void 0!==a.zIndex)l.length=0;h(l,function(a){l[a]=e[a];delete e[a]});a=b(k,{animation:!1,index:e.index,pointStart:e.xData[0]},{data:e.options.data},a);e.remove(!1,null,!1);for(n in g)e[n]=void 0;w(e,I[m||p].prototype);h(l,function(a){e[a]=l[a]});e.init(f,a);e.oldType=p;f.linkSeries();c(d,!0)&&f.redraw(!1)}});w(G.prototype,{update:function(a,d){var e=this.chart;a=e.options[this.coll][this.options.index]= -b(this.userOptions,a);this.destroy(!0);this.init(e,w(a,{events:void 0}));e.isDirtyBox=!0;c(d,!0)&&e.redraw()},remove:function(a){for(var b=this.chart,d=this.coll,e=this.series,f=e.length;f--;)e[f]&&e[f].remove(!1);l(b.axes,this);l(b[d],this);C(b.options[d])?b.options[d].splice(this.options.index,1):delete b.options[d];h(b[d],function(a,b){a.options.index=b});this.destroy();b.isDirtyBox=!0;c(a,!0)&&b.redraw()},setTitle:function(a,b){this.update({title:a},b)},setCategories:function(a,b){this.update({categories:a}, -b)}})})(L);(function(a){var D=a.color,A=a.each,G=a.map,F=a.pick,n=a.Series,f=a.seriesType;f("area","line",{softThreshold:!1,threshold:0},{singleStacks:!1,getStackPoints:function(){var f=[],l=[],n=this.xAxis,t=this.yAxis,e=t.stacks[this.stackKey],d={},m=this.points,C=this.index,b=t.series,x=b.length,c,u=F(t.options.reversedStacks,!0)?1:-1,B;if(this.options.stacking){for(B=0;Ba&&w>f?(w=Math.max(a,f),e=2*f-w):wF&&e>f?(e=Math.max(F,f),w=2*f-e):e=Math.abs(d)&&.5a.closestPointRange*a.xAxis.transA,n=a.borderWidth=h(f.borderWidth,n?0:1),b=a.yAxis,x=a.translatedThreshold=b.getThreshold(f.threshold),c=h(f.minPointLength,5),u=a.getColumnMetrics(),t=u.width,w=a.barW=Math.max(t,1+2*n),k=a.pointXOffset=u.offset; -d.inverted&&(x-=.5);f.pointPadding&&(w=Math.ceil(w));l.prototype.translate.apply(a);G(a.points,function(e){var f=h(e.yBottom,x),m=999+Math.abs(f),m=Math.min(Math.max(-m,e.plotY),b.len+m),l=e.plotX+k,q=w,n=Math.min(m,f),u,E=Math.max(m,f)-n;Math.abs(E)c?f-c:x-(u?c:0));e.barX=l;e.pointWidth=t;e.tooltipPos=d.inverted?[b.len+b.pos-d.plotLeft-m,a.xAxis.len-l-q/2,E]:[l+q/2,m+b.pos-d.plotTop,E];e.shapeType="rect";e.shapeArgs=a.crispCol.apply(a, -e.isNull?[l,x,q,0]:[l,n,q,E])})},getSymbol:a.noop,drawLegendSymbol:a.LegendSymbolMixin.drawRectangle,drawGraph:function(){this.group[this.dense?"addClass":"removeClass"]("highcharts-dense-data")},pointAttribs:function(a,d){var e=this.options,h,b=this.pointAttrToOptions||{};h=b.stroke||"borderColor";var l=b["stroke-width"]||"borderWidth",c=a&&a.color||this.color,n=a[h]||e[h]||this.color||c,t=a[l]||e[l]||this[l]||0,b=e.dashStyle;a&&this.zones.length&&(c=a.getZone(),c=a.options.color||c&&c.color||this.color); -d&&(a=f(e.states[d],a.options.states&&a.options.states[d]||{}),d=a.brightness,c=a.color||void 0!==d&&A(c).brighten(a.brightness).get()||c,n=a[h]||n,t=a[l]||t,b=a.dashStyle||b);h={fill:c,stroke:n,"stroke-width":t};e.borderRadius&&(h.r=e.borderRadius);b&&(h.dashstyle=b);return h},drawPoints:function(){var a=this,d=this.chart,h=a.options,l=d.renderer,b=h.animationLimit||250,t;G(a.points,function(c){var e=c.graphic;if(n(c.plotY)&&null!==c.y){t=c.shapeArgs;if(e)e[d.pointCountw;++w)t=h[w],a=2>w||2===w&&/%$/.test(t),h[w]=A(t,[f,F,l,h[2]][w])+(a?n:0);h[3]>h[2]&&(h[3]=h[2]);return h}}})(L);(function(a){var D=a.addEvent,A=a.defined,G=a.each,F=a.extend,n=a.inArray,f=a.noop,h=a.pick,l=a.Point,w=a.Series,t=a.seriesType,e=a.setAnimation;t("pie","line",{center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.isNull?void 0:this.point.name}, -x:0},ignoreHiddenPoint:!0,legendType:"point",marker:null,size:null,showInLegend:!1,slicedOffset:10,stickyTracking:!1,tooltip:{followPointer:!0},borderColor:"#ffffff",borderWidth:1,states:{hover:{brightness:.1,shadow:!1}}},{isCartesian:!1,requireSorting:!1,directTouch:!0,noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],axisTypes:[],pointAttribs:a.seriesTypes.column.prototype.pointAttribs,animate:function(a){var d=this,e=d.points,b=d.startAngleRad;a||(G(e,function(a){var c=a.graphic,e=a.shapeArgs; -c&&(c.attr({r:a.startR||d.center[3]/2,start:b,end:b}),c.animate({r:e.r,start:e.start,end:e.end},d.options.animation))}),d.animate=null)},updateTotals:function(){var a,e=0,f=this.points,b=f.length,h,c=this.options.ignoreHiddenPoint;for(a=0;a1.5*Math.PI?n-=2*Math.PI:n<-Math.PI/2&&(n+=2*Math.PI);y.slicedTranslation={translateX:Math.round(Math.cos(n)*b),translateY:Math.round(Math.sin(n)*b)};l=Math.cos(n)*a[2]/2;p=Math.sin(n)*a[2]/2;y.tooltipPos=[a[0]+ -.7*l,a[1]+.7*p];y.half=n<-Math.PI/2||n>Math.PI/2?1:0;y.angle=n;c=Math.min(f,y.labelDistance/5);y.labelPos=[a[0]+l+Math.cos(n)*y.labelDistance,a[1]+p+Math.sin(n)*y.labelDistance,a[0]+l+Math.cos(n)*c,a[1]+p+Math.sin(n)*c,a[0]+l,a[1]+p,0>y.labelDistance?"center":y.half?"right":"left",n]}},drawGraph:null,drawPoints:function(){var a=this,e=a.chart.renderer,f,b,h,c,l=a.options.shadow;l&&!a.shadowGroup&&(a.shadowGroup=e.g("shadow").add(a.group));G(a.points,function(d){if(!d.isNull){b=d.graphic;c=d.shapeArgs; -f=d.getTranslate();var m=d.shadowGroup;l&&!m&&(m=d.shadowGroup=e.g("shadow").add(a.shadowGroup));m&&m.attr(f);h=a.pointAttribs(d,d.selected&&"select");b?b.setRadialReference(a.center).attr(h).animate(F(c,f)):(d.graphic=b=e[d.shapeType](c).setRadialReference(a.center).attr(f).add(a.group),d.visible||b.attr({visibility:"hidden"}),b.attr(h).attr({"stroke-linejoin":"round"}).shadow(l,m));b.addClass(d.getClassName())}})},searchPoint:f,sortByAngle:function(a,e){a.sort(function(a,b){return void 0!==a.angle&& -(b.angle-a.angle)*e})},drawLegendSymbol:a.LegendSymbolMixin.drawRectangle,getCenter:a.CenteredSeriesMixin.getCenter,getSymbol:f},{init:function(){l.prototype.init.apply(this,arguments);var a=this,e;a.name=h(a.name,"Slice");e=function(d){a.slice("select"===d.type)};D(a,"select",e);D(a,"unselect",e);return a},isValid:function(){return a.isNumber(this.y,!0)&&0<=this.y},setVisible:function(a,e){var d=this,b=d.series,f=b.chart,c=b.options.ignoreHiddenPoint;e=h(e,c);a!==d.visible&&(d.visible=d.options.visible= -a=void 0===a?!d.visible:a,b.options.data[n(d,b.data)]=d.options,G(["graphic","dataLabel","connector","shadowGroup"],function(b){if(d[b])d[b][a?"show":"hide"](!0)}),d.legendItem&&f.legend.colorizeItem(d,a),a||"hover"!==d.state||d.setState(""),c&&(b.isDirty=!0),e&&f.redraw())},slice:function(a,f,l){var b=this.series;e(l,b.chart);h(f,!0);this.sliced=this.options.sliced=A(a)?a:!this.sliced;b.options.data[n(this,b.data)]=this.options;this.graphic.animate(this.getTranslate());this.shadowGroup&&this.shadowGroup.animate(this.getTranslate())}, -getTranslate:function(){return this.sliced?this.slicedTranslation:{translateX:0,translateY:0}},haloPath:function(a){var d=this.shapeArgs;return this.sliced||!this.visible?[]:this.series.chart.renderer.symbols.arc(d.x,d.y,d.r+a,d.r+a,{innerR:this.shapeArgs.r,start:d.start,end:d.end})}})})(L);(function(a){var D=a.addEvent,A=a.arrayMax,G=a.defined,F=a.each,n=a.extend,f=a.format,h=a.map,l=a.merge,w=a.noop,t=a.pick,e=a.relativeLength,d=a.Series,m=a.seriesTypes,C=a.stableSort;a.distribute=function(a,d){function b(a, -b){return a.target-b.target}var e,f=!0,l=a,k=[],n;n=0;for(e=a.length;e--;)n+=a[e].size;if(n>d){C(a,function(a,b){return(b.rank||0)-(a.rank||0)});for(n=e=0;n<=d;)n+=a[e].size,e++;k=a.splice(e-1,a.length)}C(a,b);for(a=h(a,function(a){return{size:a.size,targets:[a.target]}});f;){for(e=a.length;e--;)f=a[e],n=(Math.min.apply(0,f.targets)+Math.max.apply(0,f.targets))/2,f.pos=Math.min(Math.max(0,n-f.size/2),d-f.size);e=a.length;for(f=!1;e--;)0a[e].pos&&(a[e-1].size+=a[e].size, -a[e-1].targets=a[e-1].targets.concat(a[e].targets),a[e-1].pos+a[e-1].size>d&&(a[e-1].pos=d-a[e-1].size),a.splice(e,1),f=!0)}e=0;F(a,function(a){var b=0;F(a.targets,function(){l[e].pos=a.pos+b;b+=l[e].size;e++})});l.push.apply(l,k);C(l,b)};d.prototype.drawDataLabels=function(){var b=this,d=b.options,c=d.dataLabels,e=b.points,h,n,k=b.hasRendered||0,m,p,z=t(c.defer,!0),w=b.chart.renderer;if(c.enabled||b._hasPointLabels)b.dlProcessOptions&&b.dlProcessOptions(c),p=b.plotGroup("dataLabelsGroup","data-labels", -z&&!k?"hidden":"visible",c.zIndex||6),z&&(p.attr({opacity:+k}),k||D(b,"afterAnimate",function(){b.visible&&p.show(!0);p[d.animation?"animate":"attr"]({opacity:1},{duration:200})})),n=c,F(e,function(e){var k,q=e.dataLabel,u,g,r=e.connector,x=!q,z;h=e.dlOptions||e.options&&e.options.dataLabels;if(k=t(h&&h.enabled,n.enabled)&&null!==e.y)c=l(n,h),u=e.getLabelConfig(),m=c.format?f(c.format,u):c.formatter.call(u,c),z=c.style,u=c.rotation,z.color=t(c.color,z.color,b.color,"#000000"),"contrast"===z.color&& -(e.contrastColor=w.getContrast(e.color||b.color),z.color=c.inside||0>t(e.labelDistance,c.distance)||d.stacking?e.contrastColor:"#000000"),d.cursor&&(z.cursor=d.cursor),g={fill:c.backgroundColor,stroke:c.borderColor,"stroke-width":c.borderWidth,r:c.borderRadius||0,rotation:u,padding:c.padding,zIndex:1},a.objectEach(g,function(a,b){void 0===a&&delete g[b]});!q||k&&G(m)?k&&G(m)&&(q?g.text=m:(q=e.dataLabel=w[u?"text":"label"](m,0,-9999,c.shape,null,null,c.useHTML,null,"data-label"),q.addClass("highcharts-data-label-color-"+ -e.colorIndex+" "+(c.className||"")+(c.useHTML?"highcharts-tracker":""))),q.attr(g),q.css(z).shadow(c.shadow),q.added||q.add(p),b.alignDataLabel(e,q,c,null,x)):(e.dataLabel=q=q.destroy(),r&&(e.connector=r.destroy()))})};d.prototype.alignDataLabel=function(a,d,c,e,f){var b=this.chart,k=b.inverted,h=t(a.plotX,-9999),p=t(a.plotY,-9999),l=d.getBBox(),m,q=c.rotation,u=c.align,x=this.visible&&(a.series.forceDL||b.isInsidePlot(h,Math.round(p),k)||e&&b.isInsidePlot(h,k?e.x+1:e.y+e.height-1,k)),w="justify"=== -t(c.overflow,"justify");if(x&&(m=c.style.fontSize,m=b.renderer.fontMetrics(m,d).b,e=n({x:k?b.plotWidth-p:h,y:Math.round(k?b.plotHeight-h:p),width:0,height:0},e),n(c,{width:l.width,height:l.height}),q?(w=!1,h=b.renderer.rotCorr(m,q),h={x:e.x+c.x+e.width/2+h.x,y:e.y+c.y+{top:0,middle:.5,bottom:1}[c.verticalAlign]*e.height},d[f?"attr":"animate"](h).attr({align:u}),p=(q+720)%360,p=180p,"left"===u?h.y-=p?l.height:0:"center"===u?(h.x-=l.width/2,h.y-=l.height/2):"right"===u&&(h.x-=l.width,h.y-=p? -0:l.height)):(d.align(c,null,e),h=d.alignAttr),w?a.isLabelJustified=this.justifyDataLabel(d,c,h,l,e,f):t(c.crop,!0)&&(x=b.isInsidePlot(h.x,h.y)&&b.isInsidePlot(h.x+l.width,h.y+l.height)),c.shape&&!q))d[f?"attr":"animate"]({anchorX:k?b.plotWidth-a.plotY:a.plotX,anchorY:k?b.plotHeight-a.plotX:a.plotY});x||(d.attr({y:-9999}),d.placed=!1)};d.prototype.justifyDataLabel=function(a,d,c,e,f,h){var b=this.chart,l=d.align,p=d.verticalAlign,n,m,q=a.box?0:a.padding||0;n=c.x+q;0>n&&("right"===l?d.align="left": -d.x=-n,m=!0);n=c.x+e.width-q;n>b.plotWidth&&("left"===l?d.align="right":d.x=b.plotWidth-n,m=!0);n=c.y+q;0>n&&("bottom"===p?d.verticalAlign="top":d.y=-n,m=!0);n=c.y+e.height-q;n>b.plotHeight&&("top"===p?d.verticalAlign="bottom":d.y=b.plotHeight-n,m=!0);m&&(a.placed=!h,a.align(d,null,f));return m};m.pie&&(m.pie.prototype.drawDataLabels=function(){var b=this,e=b.data,c,f=b.chart,h=b.options.dataLabels,l=t(h.connectorPadding,10),k=t(h.connectorWidth,1),n=f.plotWidth,p=f.plotHeight,m,w=b.center,q=w[2]/ -2,y=w[1],C,D,g,r,L=[[],[]],J,N,O,P,v=[0,0,0,0];b.visible&&(h.enabled||b._hasPointLabels)&&(F(e,function(a){a.dataLabel&&a.visible&&a.dataLabel.shortened&&(a.dataLabel.attr({width:"auto"}).css({width:"auto",textOverflow:"clip"}),a.dataLabel.shortened=!1)}),d.prototype.drawDataLabels.apply(b),F(e,function(a){a.dataLabel&&a.visible&&(L[a.half].push(a),a.dataLabel._pos=null)}),F(L,function(d,e){var k,m,t=d.length,u=[],x;if(t)for(b.sortByAngle(d,e-.5),0c.bottom-2?k:N,e,c),C._attr={visibility:O,align:g[6]},C._pos={x:J+h.x+({left:l,right:-l}[g[6]]||0),y:N+h.y-10},g.x=J,g.y=N,null===b.options.size&&(D=C.getBBox().width,k=null,J-Dn-l&&(k=Math.round(J+D-n+l),v[1]=Math.max(k,v[1])),0>N-r/2?v[0]=Math.max(Math.round(-N+r/2),v[0]):N+r/2>p&&(v[2]=Math.max(Math.round(N+r/2-p),v[2])),C.sideOverflow=k)}),0===A(v)||this.verifyDataLabelOverflow(v))&& -(this.placeDataLabels(),k&&F(this.points,function(a){var c;m=a.connector;if((C=a.dataLabel)&&C._pos&&a.visible&&0t(this.translatedThreshold,k.yAxis.len)),n=t(c.inside,!!this.options.stacking);m&&(f=l(m),0>f.y&&(f.height+=f.y,f.y=0),m=f.y+f.height-k.yAxis.len,0a+d||f+lb+e||h+mthis.pointCount))}, -pan:function(a,b){var c=this,d=c.hoverPoints,e;d&&h(d,function(a){a.setState()});h("xy"===b?[1,0]:[1],function(b){b=c[b?"xAxis":"yAxis"][0];var d=b.horiz,f=a[d?"chartX":"chartY"],d=d?"mouseDownX":"mouseDownY",h=c[d],g=(b.pointRange||0)/2,k=b.getExtremes(),l=b.toValue(h-f,!0)+g,g=b.toValue(h+b.len-f,!0)-g,m=g=f(l.minWidth,0)&&this.chartHeight>=f(l.minHeight,0)}).call(this)&&h.push(a._id)};D.prototype.currentOptions=function(f){function l(e,d,f,t){var b;a.objectEach(e,function(a,c){if(!t&&-1= this.maxSize) { - this.list.remove(tailItem); - delete this.hash[tailItem.key]; - this.size--; - } - if (node = this.hash[key]) { - node.val = val; - this.list.moveToFront(node); - } else { - node = new Node(key, val); - this.list.add(node); - this.hash[key] = node; - this.size++; - } - }, - get: function get(key) { - var node = this.hash[key]; - if (node) { - this.list.moveToFront(node); - return node.val; - } - }, - reset: function reset() { - this.size = 0; - this.hash = {}; - this.list = new List(); - } - }); - function List() { - this.head = this.tail = null; - } - _.mixin(List.prototype, { - add: function add(node) { - if (this.head) { - node.next = this.head; - this.head.prev = node; - } - this.head = node; - this.tail = this.tail || node; - }, - remove: function remove(node) { - node.prev ? node.prev.next = node.next : this.head = node.next; - node.next ? node.next.prev = node.prev : this.tail = node.prev; - }, - moveToFront: function(node) { - this.remove(node); - this.add(node); - } - }); - function Node(key, val) { - this.key = key; - this.val = val; - this.prev = this.next = null; - } - return LruCache; - }(); - var PersistentStorage = function() { - "use strict"; - var LOCAL_STORAGE; - try { - LOCAL_STORAGE = window.localStorage; - LOCAL_STORAGE.setItem("~~~", "!"); - LOCAL_STORAGE.removeItem("~~~"); - } catch (err) { - LOCAL_STORAGE = null; - } - function PersistentStorage(namespace, override) { - this.prefix = [ "__", namespace, "__" ].join(""); - this.ttlKey = "__ttl__"; - this.keyMatcher = new RegExp("^" + _.escapeRegExChars(this.prefix)); - this.ls = override || LOCAL_STORAGE; - !this.ls && this._noop(); - } - _.mixin(PersistentStorage.prototype, { - _prefix: function(key) { - return this.prefix + key; - }, - _ttlKey: function(key) { - return this._prefix(key) + this.ttlKey; - }, - _noop: function() { - this.get = this.set = this.remove = this.clear = this.isExpired = _.noop; - }, - _safeSet: function(key, val) { - try { - this.ls.setItem(key, val); - } catch (err) { - if (err.name === "QuotaExceededError") { - this.clear(); - this._noop(); - } - } - }, - get: function(key) { - if (this.isExpired(key)) { - this.remove(key); - } - return decode(this.ls.getItem(this._prefix(key))); - }, - set: function(key, val, ttl) { - if (_.isNumber(ttl)) { - this._safeSet(this._ttlKey(key), encode(now() + ttl)); - } else { - this.ls.removeItem(this._ttlKey(key)); - } - return this._safeSet(this._prefix(key), encode(val)); - }, - remove: function(key) { - this.ls.removeItem(this._ttlKey(key)); - this.ls.removeItem(this._prefix(key)); - return this; - }, - clear: function() { - var i, keys = gatherMatchingKeys(this.keyMatcher); - for (i = keys.length; i--; ) { - this.remove(keys[i]); - } - return this; - }, - isExpired: function(key) { - var ttl = decode(this.ls.getItem(this._ttlKey(key))); - return _.isNumber(ttl) && now() > ttl ? true : false; - } - }); - return PersistentStorage; - function now() { - return new Date().getTime(); - } - function encode(val) { - return JSON.stringify(_.isUndefined(val) ? null : val); - } - function decode(val) { - return $.parseJSON(val); - } - function gatherMatchingKeys(keyMatcher) { - var i, key, keys = [], len = LOCAL_STORAGE.length; - for (i = 0; i < len; i++) { - if ((key = LOCAL_STORAGE.key(i)).match(keyMatcher)) { - keys.push(key.replace(keyMatcher, "")); - } - } - return keys; - } - }(); - var Transport = function() { - "use strict"; - var pendingRequestsCount = 0, pendingRequests = {}, maxPendingRequests = 6, sharedCache = new LruCache(10); - function Transport(o) { - o = o || {}; - this.cancelled = false; - this.lastReq = null; - this._send = o.transport; - this._get = o.limiter ? o.limiter(this._get) : this._get; - this._cache = o.cache === false ? new LruCache(0) : sharedCache; - } - Transport.setMaxPendingRequests = function setMaxPendingRequests(num) { - maxPendingRequests = num; - }; - Transport.resetCache = function resetCache() { - sharedCache.reset(); - }; - _.mixin(Transport.prototype, { - _fingerprint: function fingerprint(o) { - o = o || {}; - return o.url + o.type + $.param(o.data || {}); - }, - _get: function(o, cb) { - var that = this, fingerprint, jqXhr; - fingerprint = this._fingerprint(o); - if (this.cancelled || fingerprint !== this.lastReq) { - return; - } - if (jqXhr = pendingRequests[fingerprint]) { - jqXhr.done(done).fail(fail); - } else if (pendingRequestsCount < maxPendingRequests) { - pendingRequestsCount++; - pendingRequests[fingerprint] = this._send(o).done(done).fail(fail).always(always); - } else { - this.onDeckRequestArgs = [].slice.call(arguments, 0); - } - function done(resp) { - cb(null, resp); - that._cache.set(fingerprint, resp); - } - function fail() { - cb(true); - } - function always() { - pendingRequestsCount--; - delete pendingRequests[fingerprint]; - if (that.onDeckRequestArgs) { - that._get.apply(that, that.onDeckRequestArgs); - that.onDeckRequestArgs = null; - } - } - }, - get: function(o, cb) { - var resp, fingerprint; - cb = cb || $.noop; - o = _.isString(o) ? { - url: o - } : o || {}; - fingerprint = this._fingerprint(o); - this.cancelled = false; - this.lastReq = fingerprint; - if (resp = this._cache.get(fingerprint)) { - cb(null, resp); - } else { - this._get(o, cb); - } - }, - cancel: function() { - this.cancelled = true; - } - }); - return Transport; - }(); - var SearchIndex = window.SearchIndex = function() { - "use strict"; - var CHILDREN = "c", IDS = "i"; - function SearchIndex(o) { - o = o || {}; - if (!o.datumTokenizer || !o.queryTokenizer) { - $.error("datumTokenizer and queryTokenizer are both required"); - } - this.identify = o.identify || _.stringify; - this.datumTokenizer = o.datumTokenizer; - this.queryTokenizer = o.queryTokenizer; - this.reset(); - } - _.mixin(SearchIndex.prototype, { - bootstrap: function bootstrap(o) { - this.datums = o.datums; - this.trie = o.trie; - }, - add: function(data) { - var that = this; - data = _.isArray(data) ? data : [ data ]; - _.each(data, function(datum) { - var id, tokens; - that.datums[id = that.identify(datum)] = datum; - tokens = normalizeTokens(that.datumTokenizer(datum)); - _.each(tokens, function(token) { - var node, chars, ch; - node = that.trie; - chars = token.split(""); - while (ch = chars.shift()) { - node = node[CHILDREN][ch] || (node[CHILDREN][ch] = newNode()); - node[IDS].push(id); - } - }); - }); - }, - get: function get(ids) { - var that = this; - return _.map(ids, function(id) { - return that.datums[id]; - }); - }, - search: function search(query) { - var that = this, tokens, matches; - tokens = normalizeTokens(this.queryTokenizer(query)); - _.each(tokens, function(token) { - var node, chars, ch, ids; - if (matches && matches.length === 0) { - return false; - } - node = that.trie; - chars = token.split(""); - while (node && (ch = chars.shift())) { - node = node[CHILDREN][ch]; - } - if (node && chars.length === 0) { - ids = node[IDS].slice(0); - matches = matches ? getIntersection(matches, ids) : ids; - } else { - matches = []; - return false; - } - }); - return matches ? _.map(unique(matches), function(id) { - return that.datums[id]; - }) : []; - }, - all: function all() { - var values = []; - for (var key in this.datums) { - values.push(this.datums[key]); - } - return values; - }, - reset: function reset() { - this.datums = {}; - this.trie = newNode(); - }, - serialize: function serialize() { - return { - datums: this.datums, - trie: this.trie - }; - } - }); - return SearchIndex; - function normalizeTokens(tokens) { - tokens = _.filter(tokens, function(token) { - return !!token; - }); - tokens = _.map(tokens, function(token) { - return token.toLowerCase(); - }); - return tokens; - } - function newNode() { - var node = {}; - node[IDS] = []; - node[CHILDREN] = {}; - return node; - } - function unique(array) { - var seen = {}, uniques = []; - for (var i = 0, len = array.length; i < len; i++) { - if (!seen[array[i]]) { - seen[array[i]] = true; - uniques.push(array[i]); - } - } - return uniques; - } - function getIntersection(arrayA, arrayB) { - var ai = 0, bi = 0, intersection = []; - arrayA = arrayA.sort(); - arrayB = arrayB.sort(); - var lenArrayA = arrayA.length, lenArrayB = arrayB.length; - while (ai < lenArrayA && bi < lenArrayB) { - if (arrayA[ai] < arrayB[bi]) { - ai++; - } else if (arrayA[ai] > arrayB[bi]) { - bi++; - } else { - intersection.push(arrayA[ai]); - ai++; - bi++; - } - } - return intersection; - } - }(); - var Prefetch = function() { - "use strict"; - var keys; - keys = { - data: "data", - protocol: "protocol", - thumbprint: "thumbprint" - }; - function Prefetch(o) { - this.url = o.url; - this.ttl = o.ttl; - this.cache = o.cache; - this.prepare = o.prepare; - this.transform = o.transform; - this.transport = o.transport; - this.thumbprint = o.thumbprint; - this.storage = new PersistentStorage(o.cacheKey); - } - _.mixin(Prefetch.prototype, { - _settings: function settings() { - return { - url: this.url, - type: "GET", - dataType: "json" - }; - }, - store: function store(data) { - if (!this.cache) { - return; - } - this.storage.set(keys.data, data, this.ttl); - this.storage.set(keys.protocol, location.protocol, this.ttl); - this.storage.set(keys.thumbprint, this.thumbprint, this.ttl); - }, - fromCache: function fromCache() { - var stored = {}, isExpired; - if (!this.cache) { - return null; - } - stored.data = this.storage.get(keys.data); - stored.protocol = this.storage.get(keys.protocol); - stored.thumbprint = this.storage.get(keys.thumbprint); - isExpired = stored.thumbprint !== this.thumbprint || stored.protocol !== location.protocol; - return stored.data && !isExpired ? stored.data : null; - }, - fromNetwork: function(cb) { - var that = this, settings; - if (!cb) { - return; - } - settings = this.prepare(this._settings()); - this.transport(settings).fail(onError).done(onResponse); - function onError() { - cb(true); - } - function onResponse(resp) { - cb(null, that.transform(resp)); - } - }, - clear: function clear() { - this.storage.clear(); - return this; - } - }); - return Prefetch; - }(); - var Remote = function() { - "use strict"; - function Remote(o) { - this.url = o.url; - this.prepare = o.prepare; - this.transform = o.transform; - this.transport = new Transport({ - cache: o.cache, - limiter: o.limiter, - transport: o.transport - }); - } - _.mixin(Remote.prototype, { - _settings: function settings() { - return { - url: this.url, - type: "GET", - dataType: "json" - }; - }, - get: function get(query, cb) { - var that = this, settings; - if (!cb) { - return; - } - query = query || ""; - settings = this.prepare(query, this._settings()); - return this.transport.get(settings, onResponse); - function onResponse(err, resp) { - err ? cb([]) : cb(that.transform(resp)); - } - }, - cancelLastRequest: function cancelLastRequest() { - this.transport.cancel(); - } - }); - return Remote; - }(); - var oParser = function() { - "use strict"; - return function parse(o) { - var defaults, sorter; - defaults = { - initialize: true, - identify: _.stringify, - datumTokenizer: null, - queryTokenizer: null, - sufficient: 5, - sorter: null, - local: [], - prefetch: null, - remote: null - }; - o = _.mixin(defaults, o || {}); - !o.datumTokenizer && $.error("datumTokenizer is required"); - !o.queryTokenizer && $.error("queryTokenizer is required"); - sorter = o.sorter; - o.sorter = sorter ? function(x) { - return x.sort(sorter); - } : _.identity; - o.local = _.isFunction(o.local) ? o.local() : o.local; - o.prefetch = parsePrefetch(o.prefetch); - o.remote = parseRemote(o.remote); - return o; - }; - function parsePrefetch(o) { - var defaults; - if (!o) { - return null; - } - defaults = { - url: null, - ttl: 24 * 60 * 60 * 1e3, - cache: true, - cacheKey: null, - thumbprint: "", - prepare: _.identity, - transform: _.identity, - transport: null - }; - o = _.isString(o) ? { - url: o - } : o; - o = _.mixin(defaults, o); - !o.url && $.error("prefetch requires url to be set"); - o.transform = o.filter || o.transform; - o.cacheKey = o.cacheKey || o.url; - o.thumbprint = VERSION + o.thumbprint; - o.transport = o.transport ? callbackToDeferred(o.transport) : $.ajax; - return o; - } - function parseRemote(o) { - var defaults; - if (!o) { - return; - } - defaults = { - url: null, - cache: true, - prepare: null, - replace: null, - wildcard: null, - limiter: null, - rateLimitBy: "debounce", - rateLimitWait: 300, - transform: _.identity, - transport: null - }; - o = _.isString(o) ? { - url: o - } : o; - o = _.mixin(defaults, o); - !o.url && $.error("remote requires url to be set"); - o.transform = o.filter || o.transform; - o.prepare = toRemotePrepare(o); - o.limiter = toLimiter(o); - o.transport = o.transport ? callbackToDeferred(o.transport) : $.ajax; - delete o.replace; - delete o.wildcard; - delete o.rateLimitBy; - delete o.rateLimitWait; - return o; - } - function toRemotePrepare(o) { - var prepare, replace, wildcard; - prepare = o.prepare; - replace = o.replace; - wildcard = o.wildcard; - if (prepare) { - return prepare; - } - if (replace) { - prepare = prepareByReplace; - } else if (o.wildcard) { - prepare = prepareByWildcard; - } else { - prepare = idenityPrepare; - } - return prepare; - function prepareByReplace(query, settings) { - settings.url = replace(settings.url, query); - return settings; - } - function prepareByWildcard(query, settings) { - settings.url = settings.url.replace(wildcard, encodeURIComponent(query)); - return settings; - } - function idenityPrepare(query, settings) { - return settings; - } - } - function toLimiter(o) { - var limiter, method, wait; - limiter = o.limiter; - method = o.rateLimitBy; - wait = o.rateLimitWait; - if (!limiter) { - limiter = /^throttle$/i.test(method) ? throttle(wait) : debounce(wait); - } - return limiter; - function debounce(wait) { - return function debounce(fn) { - return _.debounce(fn, wait); - }; - } - function throttle(wait) { - return function throttle(fn) { - return _.throttle(fn, wait); - }; - } - } - function callbackToDeferred(fn) { - return function wrapper(o) { - var deferred = $.Deferred(); - fn(o, onSuccess, onError); - return deferred; - function onSuccess(resp) { - _.defer(function() { - deferred.resolve(resp); - }); - } - function onError(err) { - _.defer(function() { - deferred.reject(err); - }); - } - }; - } - }(); - var Bloodhound = function() { - "use strict"; - var old; - old = window && window.Bloodhound; - function Bloodhound(o) { - o = oParser(o); - this.sorter = o.sorter; - this.identify = o.identify; - this.sufficient = o.sufficient; - this.local = o.local; - this.remote = o.remote ? new Remote(o.remote) : null; - this.prefetch = o.prefetch ? new Prefetch(o.prefetch) : null; - this.index = new SearchIndex({ - identify: this.identify, - datumTokenizer: o.datumTokenizer, - queryTokenizer: o.queryTokenizer - }); - o.initialize !== false && this.initialize(); - } - Bloodhound.noConflict = function noConflict() { - window && (window.Bloodhound = old); - return Bloodhound; - }; - Bloodhound.tokenizers = tokenizers; - _.mixin(Bloodhound.prototype, { - __ttAdapter: function ttAdapter() { - var that = this; - return this.remote ? withAsync : withoutAsync; - function withAsync(query, sync, async) { - return that.search(query, sync, async); - } - function withoutAsync(query, sync) { - return that.search(query, sync); - } - }, - _loadPrefetch: function loadPrefetch() { - var that = this, deferred, serialized; - deferred = $.Deferred(); - if (!this.prefetch) { - deferred.resolve(); - } else if (serialized = this.prefetch.fromCache()) { - this.index.bootstrap(serialized); - deferred.resolve(); - } else { - this.prefetch.fromNetwork(done); - } - return deferred.promise(); - function done(err, data) { - if (err) { - return deferred.reject(); - } - that.add(data); - that.prefetch.store(that.index.serialize()); - deferred.resolve(); - } - }, - _initialize: function initialize() { - var that = this, deferred; - this.clear(); - (this.initPromise = this._loadPrefetch()).done(addLocalToIndex); - return this.initPromise; - function addLocalToIndex() { - that.add(that.local); - } - }, - initialize: function initialize(force) { - return !this.initPromise || force ? this._initialize() : this.initPromise; - }, - add: function add(data) { - this.index.add(data); - return this; - }, - get: function get(ids) { - ids = _.isArray(ids) ? ids : [].slice.call(arguments); - return this.index.get(ids); - }, - search: function search(query, sync, async) { - var that = this, local; - local = this.sorter(this.index.search(query)); - sync(this.remote ? local.slice() : local); - if (this.remote && local.length < this.sufficient) { - this.remote.get(query, processRemote); - } else if (this.remote) { - this.remote.cancelLastRequest(); - } - return this; - function processRemote(remote) { - var nonDuplicates = []; - _.each(remote, function(r) { - !_.some(local, function(l) { - return that.identify(r) === that.identify(l); - }) && nonDuplicates.push(r); - }); - async && async(nonDuplicates); - } - }, - all: function all() { - return this.index.all(); - }, - clear: function clear() { - this.index.reset(); - return this; - }, - clearPrefetchCache: function clearPrefetchCache() { - this.prefetch && this.prefetch.clear(); - return this; - }, - clearRemoteCache: function clearRemoteCache() { - Transport.resetCache(); - return this; - }, - ttAdapter: function ttAdapter() { - return this.__ttAdapter(); - } - }); - return Bloodhound; - }(); - return Bloodhound; -}); - -(function(root, factory) { - if (typeof define === "function" && define.amd) { - define("typeahead.js", [ "jquery" ], function(a0) { - return factory(a0); - }); - } else if (typeof exports === "object") { - module.exports = factory(require("jquery")); - } else { - factory(jQuery); - } -})(this, function($) { - var _ = function() { - "use strict"; - return { - isMsie: function() { - return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false; - }, - isBlankString: function(str) { - return !str || /^\s*$/.test(str); - }, - escapeRegExChars: function(str) { - return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); - }, - isString: function(obj) { - return typeof obj === "string"; - }, - isNumber: function(obj) { - return typeof obj === "number"; - }, - isArray: $.isArray, - isFunction: $.isFunction, - isObject: $.isPlainObject, - isUndefined: function(obj) { - return typeof obj === "undefined"; - }, - isElement: function(obj) { - return !!(obj && obj.nodeType === 1); - }, - isJQuery: function(obj) { - return obj instanceof $; - }, - toStr: function toStr(s) { - return _.isUndefined(s) || s === null ? "" : s + ""; - }, - bind: $.proxy, - each: function(collection, cb) { - $.each(collection, reverseArgs); - function reverseArgs(index, value) { - return cb(value, index); - } - }, - map: $.map, - filter: $.grep, - every: function(obj, test) { - var result = true; - if (!obj) { - return result; - } - $.each(obj, function(key, val) { - if (!(result = test.call(null, val, key, obj))) { - return false; - } - }); - return !!result; - }, - some: function(obj, test) { - var result = false; - if (!obj) { - return result; - } - $.each(obj, function(key, val) { - if (result = test.call(null, val, key, obj)) { - return false; - } - }); - return !!result; - }, - mixin: $.extend, - identity: function(x) { - return x; - }, - clone: function(obj) { - return $.extend(true, {}, obj); - }, - getIdGenerator: function() { - var counter = 0; - return function() { - return counter++; - }; - }, - templatify: function templatify(obj) { - return $.isFunction(obj) ? obj : template; - function template() { - return String(obj); - } - }, - defer: function(fn) { - setTimeout(fn, 0); - }, - debounce: function(func, wait, immediate) { - var timeout, result; - return function() { - var context = this, args = arguments, later, callNow; - later = function() { - timeout = null; - if (!immediate) { - result = func.apply(context, args); - } - }; - callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - if (callNow) { - result = func.apply(context, args); - } - return result; - }; - }, - throttle: function(func, wait) { - var context, args, timeout, result, previous, later; - previous = 0; - later = function() { - previous = new Date(); - timeout = null; - result = func.apply(context, args); - }; - return function() { - var now = new Date(), remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0) { - clearTimeout(timeout); - timeout = null; - previous = now; - result = func.apply(context, args); - } else if (!timeout) { - timeout = setTimeout(later, remaining); - } - return result; - }; - }, - stringify: function(val) { - return _.isString(val) ? val : JSON.stringify(val); - }, - noop: function() {} - }; - }(); - var WWW = function() { - "use strict"; - var defaultClassNames = { - wrapper: "twitter-typeahead", - input: "tt-input", - hint: "tt-hint", - menu: "tt-menu", - dataset: "tt-dataset", - suggestion: "tt-suggestion", - selectable: "tt-selectable", - empty: "tt-empty", - open: "tt-open", - cursor: "tt-cursor", - highlight: "tt-highlight" - }; - return build; - function build(o) { - var www, classes; - classes = _.mixin({}, defaultClassNames, o); - www = { - css: buildCss(), - classes: classes, - html: buildHtml(classes), - selectors: buildSelectors(classes) - }; - return { - css: www.css, - html: www.html, - classes: www.classes, - selectors: www.selectors, - mixin: function(o) { - _.mixin(o, www); - } - }; - } - function buildHtml(c) { - return { - wrapper: '', - menu: '
' - }; - } - function buildSelectors(classes) { - var selectors = {}; - _.each(classes, function(v, k) { - selectors[k] = "." + v; - }); - return selectors; - } - function buildCss() { - var css = { - wrapper: { - position: "relative", - display: "inline-block" - }, - hint: { - position: "absolute", - top: "0", - left: "0", - borderColor: "transparent", - boxShadow: "none", - opacity: "1" - }, - input: { - position: "relative", - verticalAlign: "top", - backgroundColor: "transparent" - }, - inputWithNoHint: { - position: "relative", - verticalAlign: "top" - }, - menu: { - position: "absolute", - top: "100%", - left: "0", - zIndex: "100", - display: "none" - }, - ltr: { - left: "0", - right: "auto" - }, - rtl: { - left: "auto", - right: " 0" - } - }; - if (_.isMsie()) { - _.mixin(css.input, { - backgroundImage: "url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)" - }); - } - return css; - } - }(); - var EventBus = function() { - "use strict"; - var namespace, deprecationMap; - namespace = "typeahead:"; - deprecationMap = { - render: "rendered", - cursorchange: "cursorchanged", - select: "selected", - autocomplete: "autocompleted" - }; - function EventBus(o) { - if (!o || !o.el) { - $.error("EventBus initialized without el"); - } - this.$el = $(o.el); - } - _.mixin(EventBus.prototype, { - _trigger: function(type, args) { - var $e; - $e = $.Event(namespace + type); - (args = args || []).unshift($e); - this.$el.trigger.apply(this.$el, args); - return $e; - }, - before: function(type) { - var args, $e; - args = [].slice.call(arguments, 1); - $e = this._trigger("before" + type, args); - return $e.isDefaultPrevented(); - }, - trigger: function(type) { - var deprecatedType; - this._trigger(type, [].slice.call(arguments, 1)); - if (deprecatedType = deprecationMap[type]) { - this._trigger(deprecatedType, [].slice.call(arguments, 1)); - } - } - }); - return EventBus; - }(); - var EventEmitter = function() { - "use strict"; - var splitter = /\s+/, nextTick = getNextTick(); - return { - onSync: onSync, - onAsync: onAsync, - off: off, - trigger: trigger - }; - function on(method, types, cb, context) { - var type; - if (!cb) { - return this; - } - types = types.split(splitter); - cb = context ? bindContext(cb, context) : cb; - this._callbacks = this._callbacks || {}; - while (type = types.shift()) { - this._callbacks[type] = this._callbacks[type] || { - sync: [], - async: [] - }; - this._callbacks[type][method].push(cb); - } - return this; - } - function onAsync(types, cb, context) { - return on.call(this, "async", types, cb, context); - } - function onSync(types, cb, context) { - return on.call(this, "sync", types, cb, context); - } - function off(types) { - var type; - if (!this._callbacks) { - return this; - } - types = types.split(splitter); - while (type = types.shift()) { - delete this._callbacks[type]; - } - return this; - } - function trigger(types) { - var type, callbacks, args, syncFlush, asyncFlush; - if (!this._callbacks) { - return this; - } - types = types.split(splitter); - args = [].slice.call(arguments, 1); - while ((type = types.shift()) && (callbacks = this._callbacks[type])) { - syncFlush = getFlush(callbacks.sync, this, [ type ].concat(args)); - asyncFlush = getFlush(callbacks.async, this, [ type ].concat(args)); - syncFlush() && nextTick(asyncFlush); - } - return this; - } - function getFlush(callbacks, context, args) { - return flush; - function flush() { - var cancelled; - for (var i = 0, len = callbacks.length; !cancelled && i < len; i += 1) { - cancelled = callbacks[i].apply(context, args) === false; - } - return !cancelled; - } - } - function getNextTick() { - var nextTickFn; - if (window.setImmediate) { - nextTickFn = function nextTickSetImmediate(fn) { - setImmediate(function() { - fn(); - }); - }; - } else { - nextTickFn = function nextTickSetTimeout(fn) { - setTimeout(function() { - fn(); - }, 0); - }; - } - return nextTickFn; - } - function bindContext(fn, context) { - return fn.bind ? fn.bind(context) : function() { - fn.apply(context, [].slice.call(arguments, 0)); - }; - } - }(); - var highlight = function(doc) { - "use strict"; - var defaults = { - node: null, - pattern: null, - tagName: "strong", - className: null, - wordsOnly: false, - caseSensitive: false - }; - return function hightlight(o) { - var regex; - o = _.mixin({}, defaults, o); - if (!o.node || !o.pattern) { - return; - } - o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ]; - regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly); - traverse(o.node, hightlightTextNode); - function hightlightTextNode(textNode) { - var match, patternNode, wrapperNode; - if (match = regex.exec(textNode.data)) { - wrapperNode = doc.createElement(o.tagName); - o.className && (wrapperNode.className = o.className); - patternNode = textNode.splitText(match.index); - patternNode.splitText(match[0].length); - wrapperNode.appendChild(patternNode.cloneNode(true)); - textNode.parentNode.replaceChild(wrapperNode, patternNode); - } - return !!match; - } - function traverse(el, hightlightTextNode) { - var childNode, TEXT_NODE_TYPE = 3; - for (var i = 0; i < el.childNodes.length; i++) { - childNode = el.childNodes[i]; - if (childNode.nodeType === TEXT_NODE_TYPE) { - i += hightlightTextNode(childNode) ? 1 : 0; - } else { - traverse(childNode, hightlightTextNode); - } - } - } - }; - function getRegex(patterns, caseSensitive, wordsOnly) { - var escapedPatterns = [], regexStr; - for (var i = 0, len = patterns.length; i < len; i++) { - escapedPatterns.push(_.escapeRegExChars(patterns[i])); - } - regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")"; - return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i"); - } - }(window.document); - var Input = function() { - "use strict"; - var specialKeyCodeMap; - specialKeyCodeMap = { - 9: "tab", - 27: "esc", - 37: "left", - 39: "right", - 13: "enter", - 38: "up", - 40: "down" - }; - function Input(o, www) { - o = o || {}; - if (!o.input) { - $.error("input is missing"); - } - www.mixin(this); - this.$hint = $(o.hint); - this.$input = $(o.input); - this.query = this.$input.val(); - this.queryWhenFocused = this.hasFocus() ? this.query : null; - this.$overflowHelper = buildOverflowHelper(this.$input); - this._checkLanguageDirection(); - if (this.$hint.length === 0) { - this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop; - } - } - Input.normalizeQuery = function(str) { - return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " "); - }; - _.mixin(Input.prototype, EventEmitter, { - _onBlur: function onBlur() { - this.resetInputValue(); - this.trigger("blurred"); - }, - _onFocus: function onFocus() { - this.queryWhenFocused = this.query; - this.trigger("focused"); - }, - _onKeydown: function onKeydown($e) { - var keyName = specialKeyCodeMap[$e.which || $e.keyCode]; - this._managePreventDefault(keyName, $e); - if (keyName && this._shouldTrigger(keyName, $e)) { - this.trigger(keyName + "Keyed", $e); - } - }, - _onInput: function onInput() { - this._setQuery(this.getInputValue()); - this.clearHintIfInvalid(); - this._checkLanguageDirection(); - }, - _managePreventDefault: function managePreventDefault(keyName, $e) { - var preventDefault; - switch (keyName) { - case "up": - case "down": - preventDefault = !withModifier($e); - break; - - default: - preventDefault = false; - } - preventDefault && $e.preventDefault(); - }, - _shouldTrigger: function shouldTrigger(keyName, $e) { - var trigger; - switch (keyName) { - case "tab": - trigger = !withModifier($e); - break; - - default: - trigger = true; - } - return trigger; - }, - _checkLanguageDirection: function checkLanguageDirection() { - var dir = (this.$input.css("direction") || "ltr").toLowerCase(); - if (this.dir !== dir) { - this.dir = dir; - this.$hint.attr("dir", dir); - this.trigger("langDirChanged", dir); - } - }, - _setQuery: function setQuery(val, silent) { - var areEquivalent, hasDifferentWhitespace; - areEquivalent = areQueriesEquivalent(val, this.query); - hasDifferentWhitespace = areEquivalent ? this.query.length !== val.length : false; - this.query = val; - if (!silent && !areEquivalent) { - this.trigger("queryChanged", this.query); - } else if (!silent && hasDifferentWhitespace) { - this.trigger("whitespaceChanged", this.query); - } - }, - bind: function() { - var that = this, onBlur, onFocus, onKeydown, onInput; - onBlur = _.bind(this._onBlur, this); - onFocus = _.bind(this._onFocus, this); - onKeydown = _.bind(this._onKeydown, this); - onInput = _.bind(this._onInput, this); - this.$input.on("blur.tt", onBlur).on("focus.tt", onFocus).on("keydown.tt", onKeydown); - if (!_.isMsie() || _.isMsie() > 9) { - this.$input.on("input.tt", onInput); - } else { - this.$input.on("keydown.tt keypress.tt cut.tt paste.tt", function($e) { - if (specialKeyCodeMap[$e.which || $e.keyCode]) { - return; - } - _.defer(_.bind(that._onInput, that, $e)); - }); - } - return this; - }, - focus: function focus() { - this.$input.focus(); - }, - blur: function blur() { - this.$input.blur(); - }, - getLangDir: function getLangDir() { - return this.dir; - }, - getQuery: function getQuery() { - return this.query || ""; - }, - setQuery: function setQuery(val, silent) { - this.setInputValue(val); - this._setQuery(val, silent); - }, - hasQueryChangedSinceLastFocus: function hasQueryChangedSinceLastFocus() { - return this.query !== this.queryWhenFocused; - }, - getInputValue: function getInputValue() { - return this.$input.val(); - }, - setInputValue: function setInputValue(value) { - this.$input.val(value); - this.clearHintIfInvalid(); - this._checkLanguageDirection(); - }, - resetInputValue: function resetInputValue() { - this.setInputValue(this.query); - }, - getHint: function getHint() { - return this.$hint.val(); - }, - setHint: function setHint(value) { - this.$hint.val(value); - }, - clearHint: function clearHint() { - this.setHint(""); - }, - clearHintIfInvalid: function clearHintIfInvalid() { - var val, hint, valIsPrefixOfHint, isValid; - val = this.getInputValue(); - hint = this.getHint(); - valIsPrefixOfHint = val !== hint && hint.indexOf(val) === 0; - isValid = val !== "" && valIsPrefixOfHint && !this.hasOverflow(); - !isValid && this.clearHint(); - }, - hasFocus: function hasFocus() { - return this.$input.is(":focus"); - }, - hasOverflow: function hasOverflow() { - var constraint = this.$input.width() - 2; - this.$overflowHelper.text(this.getInputValue()); - return this.$overflowHelper.width() >= constraint; - }, - isCursorAtEnd: function() { - var valueLength, selectionStart, range; - valueLength = this.$input.val().length; - selectionStart = this.$input[0].selectionStart; - if (_.isNumber(selectionStart)) { - return selectionStart === valueLength; - } else if (document.selection) { - range = document.selection.createRange(); - range.moveStart("character", -valueLength); - return valueLength === range.text.length; - } - return true; - }, - destroy: function destroy() { - this.$hint.off(".tt"); - this.$input.off(".tt"); - this.$overflowHelper.remove(); - this.$hint = this.$input = this.$overflowHelper = $("
"); - } - }); - return Input; - function buildOverflowHelper($input) { - return $('').css({ - position: "absolute", - visibility: "hidden", - whiteSpace: "pre", - fontFamily: $input.css("font-family"), - fontSize: $input.css("font-size"), - fontStyle: $input.css("font-style"), - fontVariant: $input.css("font-variant"), - fontWeight: $input.css("font-weight"), - wordSpacing: $input.css("word-spacing"), - letterSpacing: $input.css("letter-spacing"), - textIndent: $input.css("text-indent"), - textRendering: $input.css("text-rendering"), - textTransform: $input.css("text-transform") - }).insertAfter($input); - } - function areQueriesEquivalent(a, b) { - return Input.normalizeQuery(a) === Input.normalizeQuery(b); - } - function withModifier($e) { - return $e.altKey || $e.ctrlKey || $e.metaKey || $e.shiftKey; - } - }(); - var Dataset = function() { - "use strict"; - var keys, nameGenerator; - keys = { - val: "tt-selectable-display", - obj: "tt-selectable-object" - }; - nameGenerator = _.getIdGenerator(); - function Dataset(o, www) { - o = o || {}; - o.templates = o.templates || {}; - o.templates.notFound = o.templates.notFound || o.templates.empty; - if (!o.source) { - $.error("missing source"); - } - if (!o.node) { - $.error("missing node"); - } - if (o.name && !isValidName(o.name)) { - $.error("invalid dataset name: " + o.name); - } - www.mixin(this); - this.highlight = !!o.highlight; - this.name = o.name || nameGenerator(); - this.limit = o.limit || 5; - this.displayFn = getDisplayFn(o.display || o.displayKey); - this.templates = getTemplates(o.templates, this.displayFn); - this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source; - this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async; - this._resetLastSuggestion(); - this.$el = $(o.node).addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name); - } - Dataset.extractData = function extractData(el) { - var $el = $(el); - if ($el.data(keys.obj)) { - return { - val: $el.data(keys.val) || "", - obj: $el.data(keys.obj) || null - }; - } - return null; - }; - _.mixin(Dataset.prototype, EventEmitter, { - _overwrite: function overwrite(query, suggestions) { - suggestions = suggestions || []; - if (suggestions.length) { - this._renderSuggestions(query, suggestions); - } else if (this.async && this.templates.pending) { - this._renderPending(query); - } else if (!this.async && this.templates.notFound) { - this._renderNotFound(query); - } else { - this._empty(); - } - this.trigger("rendered", this.name, suggestions, false); - }, - _append: function append(query, suggestions) { - suggestions = suggestions || []; - if (suggestions.length && this.$lastSuggestion.length) { - this._appendSuggestions(query, suggestions); - } else if (suggestions.length) { - this._renderSuggestions(query, suggestions); - } else if (!this.$lastSuggestion.length && this.templates.notFound) { - this._renderNotFound(query); - } - this.trigger("rendered", this.name, suggestions, true); - }, - _renderSuggestions: function renderSuggestions(query, suggestions) { - var $fragment; - $fragment = this._getSuggestionsFragment(query, suggestions); - this.$lastSuggestion = $fragment.children().last(); - this.$el.html($fragment).prepend(this._getHeader(query, suggestions)).append(this._getFooter(query, suggestions)); - }, - _appendSuggestions: function appendSuggestions(query, suggestions) { - var $fragment, $lastSuggestion; - $fragment = this._getSuggestionsFragment(query, suggestions); - $lastSuggestion = $fragment.children().last(); - this.$lastSuggestion.after($fragment); - this.$lastSuggestion = $lastSuggestion; - }, - _renderPending: function renderPending(query) { - var template = this.templates.pending; - this._resetLastSuggestion(); - template && this.$el.html(template({ - query: query, - dataset: this.name - })); - }, - _renderNotFound: function renderNotFound(query) { - var template = this.templates.notFound; - this._resetLastSuggestion(); - template && this.$el.html(template({ - query: query, - dataset: this.name - })); - }, - _empty: function empty() { - this.$el.empty(); - this._resetLastSuggestion(); - }, - _getSuggestionsFragment: function getSuggestionsFragment(query, suggestions) { - var that = this, fragment; - fragment = document.createDocumentFragment(); - _.each(suggestions, function getSuggestionNode(suggestion) { - var $el, context; - context = that._injectQuery(query, suggestion); - $el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable); - fragment.appendChild($el[0]); - }); - this.highlight && highlight({ - className: this.classes.highlight, - node: fragment, - pattern: query - }); - return $(fragment); - }, - _getFooter: function getFooter(query, suggestions) { - return this.templates.footer ? this.templates.footer({ - query: query, - suggestions: suggestions, - dataset: this.name - }) : null; - }, - _getHeader: function getHeader(query, suggestions) { - return this.templates.header ? this.templates.header({ - query: query, - suggestions: suggestions, - dataset: this.name - }) : null; - }, - _resetLastSuggestion: function resetLastSuggestion() { - this.$lastSuggestion = $(); - }, - _injectQuery: function injectQuery(query, obj) { - return _.isObject(obj) ? _.mixin({ - _query: query - }, obj) : obj; - }, - update: function update(query) { - var that = this, canceled = false, syncCalled = false, rendered = 0; - this.cancel(); - this.cancel = function cancel() { - canceled = true; - that.cancel = $.noop; - that.async && that.trigger("asyncCanceled", query); - }; - this.source(query, sync, async); - !syncCalled && sync([]); - function sync(suggestions) { - if (syncCalled) { - return; - } - syncCalled = true; - suggestions = (suggestions || []).slice(0, that.limit); - rendered = suggestions.length; - that._overwrite(query, suggestions); - if (rendered < that.limit && that.async) { - that.trigger("asyncRequested", query); - } - } - function async(suggestions) { - suggestions = suggestions || []; - if (!canceled && rendered < that.limit) { - that.cancel = $.noop; - rendered += suggestions.length; - that._append(query, suggestions.slice(0, that.limit)); - that.async && that.trigger("asyncReceived", query); - } - } - }, - cancel: $.noop, - clear: function clear() { - this._empty(); - this.cancel(); - this.trigger("cleared"); - }, - isEmpty: function isEmpty() { - return this.$el.is(":empty"); - }, - destroy: function destroy() { - this.$el = $("
"); - } - }); - return Dataset; - function getDisplayFn(display) { - display = display || _.stringify; - return _.isFunction(display) ? display : displayFn; - function displayFn(obj) { - return obj[display]; - } - } - function getTemplates(templates, displayFn) { - return { - notFound: templates.notFound && _.templatify(templates.notFound), - pending: templates.pending && _.templatify(templates.pending), - header: templates.header && _.templatify(templates.header), - footer: templates.footer && _.templatify(templates.footer), - suggestion: templates.suggestion || suggestionTemplate - }; - function suggestionTemplate(context) { - return $("
").text(displayFn(context)); - } - } - function isValidName(str) { - return /^[_a-zA-Z0-9-]+$/.test(str); - } - }(); - var Menu = function() { - "use strict"; - function Menu(o, www) { - var that = this; - o = o || {}; - if (!o.node) { - $.error("node is required"); - } - www.mixin(this); - this.$node = $(o.node); - this.query = null; - this.datasets = _.map(o.datasets, initializeDataset); - function initializeDataset(oDataset) { - var node = that.$node.find(oDataset.node).first(); - oDataset.node = node.length ? node : $("
").appendTo(that.$node); - return new Dataset(oDataset, www); - } - } - _.mixin(Menu.prototype, EventEmitter, { - _onSelectableClick: function onSelectableClick($e) { - this.trigger("selectableClicked", $($e.currentTarget)); - }, - _onRendered: function onRendered(type, dataset, suggestions, async) { - this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty()); - this.trigger("datasetRendered", dataset, suggestions, async); - }, - _onCleared: function onCleared() { - this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty()); - this.trigger("datasetCleared"); - }, - _propagate: function propagate() { - this.trigger.apply(this, arguments); - }, - _allDatasetsEmpty: function allDatasetsEmpty() { - return _.every(this.datasets, isDatasetEmpty); - function isDatasetEmpty(dataset) { - return dataset.isEmpty(); - } - }, - _getSelectables: function getSelectables() { - return this.$node.find(this.selectors.selectable); - }, - _removeCursor: function _removeCursor() { - var $selectable = this.getActiveSelectable(); - $selectable && $selectable.removeClass(this.classes.cursor); - }, - _ensureVisible: function ensureVisible($el) { - var elTop, elBottom, nodeScrollTop, nodeHeight; - elTop = $el.position().top; - elBottom = elTop + $el.outerHeight(true); - nodeScrollTop = this.$node.scrollTop(); - nodeHeight = this.$node.height() + parseInt(this.$node.css("paddingTop"), 10) + parseInt(this.$node.css("paddingBottom"), 10); - if (elTop < 0) { - this.$node.scrollTop(nodeScrollTop + elTop); - } else if (nodeHeight < elBottom) { - this.$node.scrollTop(nodeScrollTop + (elBottom - nodeHeight)); - } - }, - bind: function() { - var that = this, onSelectableClick; - onSelectableClick = _.bind(this._onSelectableClick, this); - this.$node.on("click.tt", this.selectors.selectable, onSelectableClick); - _.each(this.datasets, function(dataset) { - dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that); - }); - return this; - }, - isOpen: function isOpen() { - return this.$node.hasClass(this.classes.open); - }, - open: function open() { - this.$node.addClass(this.classes.open); - }, - close: function close() { - this.$node.removeClass(this.classes.open); - this._removeCursor(); - }, - setLanguageDirection: function setLanguageDirection(dir) { - this.$node.attr("dir", dir); - }, - selectableRelativeToCursor: function selectableRelativeToCursor(delta) { - var $selectables, $oldCursor, oldIndex, newIndex; - $oldCursor = this.getActiveSelectable(); - $selectables = this._getSelectables(); - oldIndex = $oldCursor ? $selectables.index($oldCursor) : -1; - newIndex = oldIndex + delta; - newIndex = (newIndex + 1) % ($selectables.length + 1) - 1; - newIndex = newIndex < -1 ? $selectables.length - 1 : newIndex; - return newIndex === -1 ? null : $selectables.eq(newIndex); - }, - setCursor: function setCursor($selectable) { - this._removeCursor(); - if ($selectable = $selectable && $selectable.first()) { - $selectable.addClass(this.classes.cursor); - this._ensureVisible($selectable); - } - }, - getSelectableData: function getSelectableData($el) { - return $el && $el.length ? Dataset.extractData($el) : null; - }, - getActiveSelectable: function getActiveSelectable() { - var $selectable = this._getSelectables().filter(this.selectors.cursor).first(); - return $selectable.length ? $selectable : null; - }, - getTopSelectable: function getTopSelectable() { - var $selectable = this._getSelectables().first(); - return $selectable.length ? $selectable : null; - }, - update: function update(query) { - var isValidUpdate = query !== this.query; - if (isValidUpdate) { - this.query = query; - _.each(this.datasets, updateDataset); - } - return isValidUpdate; - function updateDataset(dataset) { - dataset.update(query); - } - }, - empty: function empty() { - _.each(this.datasets, clearDataset); - this.query = null; - this.$node.addClass(this.classes.empty); - function clearDataset(dataset) { - dataset.clear(); - } - }, - destroy: function destroy() { - this.$node.off(".tt"); - this.$node = $("
"); - _.each(this.datasets, destroyDataset); - function destroyDataset(dataset) { - dataset.destroy(); - } - } - }); - return Menu; - }(); - var DefaultMenu = function() { - "use strict"; - var s = Menu.prototype; - function DefaultMenu() { - Menu.apply(this, [].slice.call(arguments, 0)); - } - _.mixin(DefaultMenu.prototype, Menu.prototype, { - open: function open() { - !this._allDatasetsEmpty() && this._show(); - return s.open.apply(this, [].slice.call(arguments, 0)); - }, - close: function close() { - this._hide(); - return s.close.apply(this, [].slice.call(arguments, 0)); - }, - _onRendered: function onRendered() { - if (this._allDatasetsEmpty()) { - this._hide(); - } else { - this.isOpen() && this._show(); - } - return s._onRendered.apply(this, [].slice.call(arguments, 0)); - }, - _onCleared: function onCleared() { - if (this._allDatasetsEmpty()) { - this._hide(); - } else { - this.isOpen() && this._show(); - } - return s._onCleared.apply(this, [].slice.call(arguments, 0)); - }, - setLanguageDirection: function setLanguageDirection(dir) { - this.$node.css(dir === "ltr" ? this.css.ltr : this.css.rtl); - return s.setLanguageDirection.apply(this, [].slice.call(arguments, 0)); - }, - _hide: function hide() { - this.$node.hide(); - }, - _show: function show() { - this.$node.css("display", "block"); - } - }); - return DefaultMenu; - }(); - var Typeahead = function() { - "use strict"; - function Typeahead(o, www) { - var onFocused, onBlurred, onEnterKeyed, onTabKeyed, onEscKeyed, onUpKeyed, onDownKeyed, onLeftKeyed, onRightKeyed, onQueryChanged, onWhitespaceChanged; - o = o || {}; - if (!o.input) { - $.error("missing input"); - } - if (!o.menu) { - $.error("missing menu"); - } - if (!o.eventBus) { - $.error("missing event bus"); - } - www.mixin(this); - this.eventBus = o.eventBus; - this.minLength = _.isNumber(o.minLength) ? o.minLength : 1; - this.input = o.input; - this.menu = o.menu; - this.enabled = true; - this.active = false; - this.input.hasFocus() && this.activate(); - this.dir = this.input.getLangDir(); - this._hacks(); - this.menu.bind().onSync("selectableClicked", this._onSelectableClicked, this).onSync("asyncRequested", this._onAsyncRequested, this).onSync("asyncCanceled", this._onAsyncCanceled, this).onSync("asyncReceived", this._onAsyncReceived, this).onSync("datasetRendered", this._onDatasetRendered, this).onSync("datasetCleared", this._onDatasetCleared, this); - onFocused = c(this, "activate", "open", "_onFocused"); - onBlurred = c(this, "deactivate", "_onBlurred"); - onEnterKeyed = c(this, "isActive", "isOpen", "_onEnterKeyed"); - onTabKeyed = c(this, "isActive", "isOpen", "_onTabKeyed"); - onEscKeyed = c(this, "isActive", "_onEscKeyed"); - onUpKeyed = c(this, "isActive", "open", "_onUpKeyed"); - onDownKeyed = c(this, "isActive", "open", "_onDownKeyed"); - onLeftKeyed = c(this, "isActive", "isOpen", "_onLeftKeyed"); - onRightKeyed = c(this, "isActive", "isOpen", "_onRightKeyed"); - onQueryChanged = c(this, "_openIfActive", "_onQueryChanged"); - onWhitespaceChanged = c(this, "_openIfActive", "_onWhitespaceChanged"); - this.input.bind().onSync("focused", onFocused, this).onSync("blurred", onBlurred, this).onSync("enterKeyed", onEnterKeyed, this).onSync("tabKeyed", onTabKeyed, this).onSync("escKeyed", onEscKeyed, this).onSync("upKeyed", onUpKeyed, this).onSync("downKeyed", onDownKeyed, this).onSync("leftKeyed", onLeftKeyed, this).onSync("rightKeyed", onRightKeyed, this).onSync("queryChanged", onQueryChanged, this).onSync("whitespaceChanged", onWhitespaceChanged, this).onSync("langDirChanged", this._onLangDirChanged, this); - } - _.mixin(Typeahead.prototype, { - _hacks: function hacks() { - var $input, $menu; - $input = this.input.$input || $("
"); - $menu = this.menu.$node || $("
"); - $input.on("blur.tt", function($e) { - var active, isActive, hasActive; - active = document.activeElement; - isActive = $menu.is(active); - hasActive = $menu.has(active).length > 0; - if (_.isMsie() && (isActive || hasActive)) { - $e.preventDefault(); - $e.stopImmediatePropagation(); - _.defer(function() { - $input.focus(); - }); - } - }); - $menu.on("mousedown.tt", function($e) { - $e.preventDefault(); - }); - }, - _onSelectableClicked: function onSelectableClicked(type, $el) { - this.select($el); - }, - _onDatasetCleared: function onDatasetCleared() { - this._updateHint(); - }, - _onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) { - this._updateHint(); - this.eventBus.trigger("render", suggestions, async, dataset); - }, - _onAsyncRequested: function onAsyncRequested(type, dataset, query) { - this.eventBus.trigger("asyncrequest", query, dataset); - }, - _onAsyncCanceled: function onAsyncCanceled(type, dataset, query) { - this.eventBus.trigger("asynccancel", query, dataset); - }, - _onAsyncReceived: function onAsyncReceived(type, dataset, query) { - this.eventBus.trigger("asyncreceive", query, dataset); - }, - _onFocused: function onFocused() { - this._minLengthMet() && this.menu.update(this.input.getQuery()); - }, - _onBlurred: function onBlurred() { - if (this.input.hasQueryChangedSinceLastFocus()) { - this.eventBus.trigger("change", this.input.getQuery()); - } - }, - _onEnterKeyed: function onEnterKeyed(type, $e) { - var $selectable; - if ($selectable = this.menu.getActiveSelectable()) { - this.select($selectable) && $e.preventDefault(); - } - }, - _onTabKeyed: function onTabKeyed(type, $e) { - var $selectable; - if ($selectable = this.menu.getActiveSelectable()) { - this.select($selectable) && $e.preventDefault(); - } else if ($selectable = this.menu.getTopSelectable()) { - this.autocomplete($selectable) && $e.preventDefault(); - } - }, - _onEscKeyed: function onEscKeyed() { - this.close(); - }, - _onUpKeyed: function onUpKeyed() { - this.moveCursor(-1); - }, - _onDownKeyed: function onDownKeyed() { - this.moveCursor(+1); - }, - _onLeftKeyed: function onLeftKeyed() { - if (this.dir === "rtl" && this.input.isCursorAtEnd()) { - this.autocomplete(this.menu.getTopSelectable()); - } - }, - _onRightKeyed: function onRightKeyed() { - if (this.dir === "ltr" && this.input.isCursorAtEnd()) { - this.autocomplete(this.menu.getTopSelectable()); - } - }, - _onQueryChanged: function onQueryChanged(e, query) { - this._minLengthMet(query) ? this.menu.update(query) : this.menu.empty(); - }, - _onWhitespaceChanged: function onWhitespaceChanged() { - this._updateHint(); - }, - _onLangDirChanged: function onLangDirChanged(e, dir) { - if (this.dir !== dir) { - this.dir = dir; - this.menu.setLanguageDirection(dir); - } - }, - _openIfActive: function openIfActive() { - this.isActive() && this.open(); - }, - _minLengthMet: function minLengthMet(query) { - query = _.isString(query) ? query : this.input.getQuery() || ""; - return query.length >= this.minLength; - }, - _updateHint: function updateHint() { - var $selectable, data, val, query, escapedQuery, frontMatchRegEx, match; - $selectable = this.menu.getTopSelectable(); - data = this.menu.getSelectableData($selectable); - val = this.input.getInputValue(); - if (data && !_.isBlankString(val) && !this.input.hasOverflow()) { - query = Input.normalizeQuery(val); - escapedQuery = _.escapeRegExChars(query); - frontMatchRegEx = new RegExp("^(?:" + escapedQuery + ")(.+$)", "i"); - match = frontMatchRegEx.exec(data.val); - match && this.input.setHint(val + match[1]); - } else { - this.input.clearHint(); - } - }, - isEnabled: function isEnabled() { - return this.enabled; - }, - enable: function enable() { - this.enabled = true; - }, - disable: function disable() { - this.enabled = false; - }, - isActive: function isActive() { - return this.active; - }, - activate: function activate() { - if (this.isActive()) { - return true; - } else if (!this.isEnabled() || this.eventBus.before("active")) { - return false; - } else { - this.active = true; - this.eventBus.trigger("active"); - return true; - } - }, - deactivate: function deactivate() { - if (!this.isActive()) { - return true; - } else if (this.eventBus.before("idle")) { - return false; - } else { - this.active = false; - this.close(); - this.eventBus.trigger("idle"); - return true; - } - }, - isOpen: function isOpen() { - return this.menu.isOpen(); - }, - open: function open() { - if (!this.isOpen() && !this.eventBus.before("open")) { - this.menu.open(); - this._updateHint(); - this.eventBus.trigger("open"); - } - return this.isOpen(); - }, - close: function close() { - if (this.isOpen() && !this.eventBus.before("close")) { - this.menu.close(); - this.input.clearHint(); - this.input.resetInputValue(); - this.eventBus.trigger("close"); - } - return !this.isOpen(); - }, - setVal: function setVal(val) { - this.input.setQuery(_.toStr(val)); - }, - getVal: function getVal() { - return this.input.getQuery(); - }, - select: function select($selectable) { - var data = this.menu.getSelectableData($selectable); - if (data && !this.eventBus.before("select", data.obj)) { - this.input.setQuery(data.val, true); - this.eventBus.trigger("select", data.obj); - this.close(); - return true; - } - return false; - }, - autocomplete: function autocomplete($selectable) { - var query, data, isValid; - query = this.input.getQuery(); - data = this.menu.getSelectableData($selectable); - isValid = data && query !== data.val; - if (isValid && !this.eventBus.before("autocomplete", data.obj)) { - this.input.setQuery(data.val); - this.eventBus.trigger("autocomplete", data.obj); - return true; - } - return false; - }, - moveCursor: function moveCursor(delta) { - var query, $candidate, data, payload, cancelMove; - query = this.input.getQuery(); - $candidate = this.menu.selectableRelativeToCursor(delta); - data = this.menu.getSelectableData($candidate); - payload = data ? data.obj : null; - cancelMove = this._minLengthMet() && this.menu.update(query); - if (!cancelMove && !this.eventBus.before("cursorchange", payload)) { - this.menu.setCursor($candidate); - if (data) { - this.input.setInputValue(data.val); - } else { - this.input.resetInputValue(); - this._updateHint(); - } - this.eventBus.trigger("cursorchange", payload); - return true; - } - return false; - }, - destroy: function destroy() { - this.input.destroy(); - this.menu.destroy(); - } - }); - return Typeahead; - function c(ctx) { - var methods = [].slice.call(arguments, 1); - return function() { - var args = [].slice.call(arguments); - _.each(methods, function(method) { - return ctx[method].apply(ctx, args); - }); - }; - } - }(); - (function() { - "use strict"; - var old, keys, methods; - old = $.fn.typeahead; - keys = { - www: "tt-www", - attrs: "tt-attrs", - typeahead: "tt-typeahead" - }; - methods = { - initialize: function initialize(o, datasets) { - var www; - datasets = _.isArray(datasets) ? datasets : [].slice.call(arguments, 1); - o = o || {}; - www = WWW(o.classNames); - return this.each(attach); - function attach() { - var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, typeahead, MenuConstructor; - _.each(datasets, function(d) { - d.highlight = !!o.highlight; - }); - $input = $(this); - $wrapper = $(www.html.wrapper); - $hint = $elOrNull(o.hint); - $menu = $elOrNull(o.menu); - defaultHint = o.hint !== false && !$hint; - defaultMenu = o.menu !== false && !$menu; - defaultHint && ($hint = buildHintFromInput($input, www)); - defaultMenu && ($menu = $(www.html.menu).css(www.css.menu)); - $hint && $hint.val(""); - $input = prepInput($input, www); - if (defaultHint || defaultMenu) { - $wrapper.css(www.css.wrapper); - $input.css(defaultHint ? www.css.input : www.css.inputWithNoHint); - $input.wrap($wrapper).parent().prepend(defaultHint ? $hint : null).append(defaultMenu ? $menu : null); - } - MenuConstructor = defaultMenu ? DefaultMenu : Menu; - eventBus = new EventBus({ - el: $input - }); - input = new Input({ - hint: $hint, - input: $input - }, www); - menu = new MenuConstructor({ - node: $menu, - datasets: datasets - }, www); - typeahead = new Typeahead({ - input: input, - menu: menu, - eventBus: eventBus, - minLength: o.minLength - }, www); - $input.data(keys.www, www); - $input.data(keys.typeahead, typeahead); - } - }, - isEnabled: function isEnabled() { - var enabled; - ttEach(this.first(), function(t) { - enabled = t.isEnabled(); - }); - return enabled; - }, - enable: function enable() { - ttEach(this, function(t) { - t.enable(); - }); - return this; - }, - disable: function disable() { - ttEach(this, function(t) { - t.disable(); - }); - return this; - }, - isActive: function isActive() { - var active; - ttEach(this.first(), function(t) { - active = t.isActive(); - }); - return active; - }, - activate: function activate() { - ttEach(this, function(t) { - t.activate(); - }); - return this; - }, - deactivate: function deactivate() { - ttEach(this, function(t) { - t.deactivate(); - }); - return this; - }, - isOpen: function isOpen() { - var open; - ttEach(this.first(), function(t) { - open = t.isOpen(); - }); - return open; - }, - open: function open() { - ttEach(this, function(t) { - t.open(); - }); - return this; - }, - close: function close() { - ttEach(this, function(t) { - t.close(); - }); - return this; - }, - select: function select(el) { - var success = false, $el = $(el); - ttEach(this.first(), function(t) { - success = t.select($el); - }); - return success; - }, - autocomplete: function autocomplete(el) { - var success = false, $el = $(el); - ttEach(this.first(), function(t) { - success = t.autocomplete($el); - }); - return success; - }, - moveCursor: function moveCursoe(delta) { - var success = false; - ttEach(this.first(), function(t) { - success = t.moveCursor(delta); - }); - return success; - }, - val: function val(newVal) { - var query; - if (!arguments.length) { - ttEach(this.first(), function(t) { - query = t.getVal(); - }); - return query; - } else { - ttEach(this, function(t) { - t.setVal(newVal); - }); - return this; - } - }, - destroy: function destroy() { - ttEach(this, function(typeahead, $input) { - revert($input); - typeahead.destroy(); - }); - return this; - } - }; - $.fn.typeahead = function(method) { - if (methods[method]) { - return methods[method].apply(this, [].slice.call(arguments, 1)); - } else { - return methods.initialize.apply(this, arguments); - } - }; - $.fn.typeahead.noConflict = function noConflict() { - $.fn.typeahead = old; - return this; - }; - function ttEach($els, fn) { - $els.each(function() { - var $input = $(this), typeahead; - (typeahead = $input.data(keys.typeahead)) && fn(typeahead, $input); - }); - } - function buildHintFromInput($input, www) { - return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop("readonly", true).removeAttr("id name placeholder required").attr({ - autocomplete: "off", - spellcheck: "false", - tabindex: -1 - }); - } - function prepInput($input, www) { - $input.data(keys.attrs, { - dir: $input.attr("dir"), - autocomplete: $input.attr("autocomplete"), - spellcheck: $input.attr("spellcheck"), - style: $input.attr("style") - }); - $input.addClass(www.classes.input).attr({ - autocomplete: "off", - spellcheck: false - }); - try { - !$input.attr("dir") && $input.attr("dir", "auto"); - } catch (e) {} - return $input; - } - function getBackgroundStyles($el) { - return { - backgroundAttachment: $el.css("background-attachment"), - backgroundClip: $el.css("background-clip"), - backgroundColor: $el.css("background-color"), - backgroundImage: $el.css("background-image"), - backgroundOrigin: $el.css("background-origin"), - backgroundPosition: $el.css("background-position"), - backgroundRepeat: $el.css("background-repeat"), - backgroundSize: $el.css("background-size") - }; - } - function revert($input) { - var www, $wrapper; - www = $input.data(keys.www); - $wrapper = $input.parent().filter(www.selectors.wrapper); - _.each($input.data(keys.attrs), function(val, key) { - _.isUndefined(val) ? $input.removeAttr(key) : $input.attr(key, val); - }); - $input.removeData(keys.typeahead).removeData(keys.www).removeData(keys.attr).removeClass(www.classes.input); - if ($wrapper.length) { - $input.detach().insertAfter($wrapper); - $wrapper.remove(); - } - } - function $elOrNull(obj) { - var isValid, $el; - isValid = _.isJQuery(obj) || _.isElement(obj); - $el = isValid ? $(obj).first() : []; - return $el.length ? $el : null; - } - })(); -});