!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n.gel=n.gel||{},n.gel.dataviz={}))}(this,function(n){"use strict";function kt(n,t){var i=n+"|"+t,r;return bt[i]?bt[i]:(sr.font=t,r=Math.ceil(sr.measureText(n).width),bt[i]=r,r)}function si(n,t){for(var i=0,u=void 0,r=0;ri&&(i=u);return i}function k(n,t,i){var u=t-t*(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0),r=[];return n.split("\n").forEach(function(n){var t=void 0;n.trim().split(" ").forEach(function(n,f){0===f?t=n:kt(t+" "+n,i)1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],u=function(n){return Math.max(Math.floor(Math.log(Math.abs(n))*Math.LOG10E),0)+1}(n),t=n,f=e,i="",r;return o&&(u>12?(t/=Math.pow(10,12),i="T"):u>9?(t/=Math.pow(10,9),i="B"):u>6&&(t/=Math.pow(10,6),i="M"),f=ot(t)),r=(null!==f?t.toFixed(f):t.toString()).split("."),r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),""+r.join(".")+i}function lu(n,t,i,r,u,f){var e=i+u,o=r+f,h=void 0,c,l,a,v,s;return h=i<=n&&n<=e?n:Math.abs(i-n)2&&void 0!==arguments[2]?arguments[2]:0;return!(n.right+it.right+i||n.bottom+it.bottom+i)}function gt(n,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return void 0!==n&&null!==n?t>0?n.toString().slice(0,t):n.toString():i}function ni(n,t,i){return i.indexOf(n)===t}function hi(n,t){return n.x-t.x}function lr(n){return Math.ceil((n+1)/3)}function yu(n){return n.getFullYear()+" "+st[n.getMonth()]+" "+n.getDate()}function it(n){var t=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());return Math.floor(Math.abs(ci-t)/vu)*(n1&&void 0!==arguments[1]&&arguments[1],t=n.getFullYear().toString();return i?"'"+t.substr(2):t}function yi(n,t){return t.getFullYear()-n.getFullYear()>=4?"year":n.getFullYear()===t.getFullYear()&&t.getMonth()-n.getMonth()<4?"day":"month"}function pi(n,t,i){var r=n.indexOf("_yy")>-1;switch(n.replace("_yy","")){case"auto":return pi(yi(t,i)+(r?"_yy":""),t,i);case"year":return function(n){return ti(n,r)};case"quarter":return function(n){return"Q"+lr(n.getMonth())+" "+ti(n,r)};case"month":return i.getFullYear()-t.getFullYear()>0?function(n){return st[n.getMonth()]+" "+ti(n,r)}:function(n){return st[n.getMonth()]};case"day":default:return i.getFullYear()-t.getFullYear()>0?function(n){return ti(n,r)+" "+st[n.getMonth()]+" "+n.getDate()}:function(n){return st[n.getMonth()]+" "+n.getDate()}}}function ii(n){var t=n.toString().trim();return ai.test(t)?new Date(t):li.test(t)?new Date(t+" 1"):vi.test(t)?new Date(t.substr(t.indexOf("-")+1)):null}function vr(n,t){var o=t.indexOf("_yy")>-1,i=ii(n[0].text),r=ii(n[n.length-1].text),u=void 0,f=void 0,e=void 0;switch(t.replace("_yy","")){case"auto":return vr(n,yi(i,r)+(o?"_yy":""));case"year":e=function(n){return n.setFullYear(n.getFullYear()+1)};f=new Date(r.getFullYear(),0,1);u=i.getFullYear()-1?t:(lt.push(n),ut&&(ut.innerHTML=lt.filter(function(n){return null!==n}).join("\n")),lt.length-1)}function kr(n){if(n.length){if("x"in n[0]&&"y"in n[0])return n.map(function(n){return[n.x,n.y]});if(!(n[0]instanceof Array))return n.map(function(n,t){return[t,n]})}return n}function i(n){for(var i=arguments.length,r=Array(i>1?i-1:0),t=1;t2&&void 0!==arguments[2]?arguments[2]:-1,r=n.metadata.axisX,i=r.valuesByLine[h]||r.values,u=t*(r.axisRange/n.dom.plotArea.width())+r.axisMin,o;if(i.indexOf(u)>-1)return u;if(at)return t;for(var e=i[0],s=Math.abs(e-u),f=1;f3&&void 0!==arguments[3]?arguments[3]:null,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,l=.08*(t-n),f=null!==h,e=null!==c,r=f?h:n-l,u=Math.max(e?c:t+l,t+l),a,v;r===u?(a=Math.max(hr(r),1),r=f?h:r-2*a,u=e?c:u+2*a):u5?10*r:e>2?5*r:e>1?2*r:r,t&&n%f!=0)&&(o=n/(i-1),f=ot(u)>ot(o)?o:u),f}(u-r,f&&e,i),p=f?r:function(n,t){return 0===t?0:Math.floor(n/t)*t}(r,o),w=e?u:function(n,t){return 0===t?0:Math.ceil(n/t)*t}(u,o),b=ot(o),y=[],s=p;s<=w;s+=o)y.push({value:s,text:dt(s,b,!0)});return y}function ou(n){var h=n.data,c=n.state,l=n.metadata,t=l.axisX,v=l.axisY,u=[],f=t.labels||h.labels,s;if(i(n,w))return u.push(f[0]),u.push(f[f.length-1]),u;var a=(c.innerWidth-v.width-r-2*t.plotOffset)*c.zoomLevel/(t.maxLabelWidth+c.labelSpacing),e=void 0,o=void 0;for(t.labels?(o=t.labels.length-1,e=Math.ceil(t.labels.length/a)):(o=Math.min(h.labels.length-1,t.max),e=Math.max(Math.ceil(h.labels.length/a),1)),s=o%e;s<=o;s+=e)u.push(f[s]);return u}function tr(n,t){var i=n.data.labelsLookup[t];return i?"date_range"===n.data.labelType?function(n){var i=n.split("-"),t,r;return i.length<2?n:(t=i.map(function(n){return n.split(" ")}),r=void 0,r=t[0][0]!==t[1][0]?t[1].join(" "):t[0][1]!==t[1][1]?t[1][1]+t[1][2]:t[1][2],i[0]+"–"+r)}(i):i:t.toString()}function su(n){return n instanceof Array&&n.length}var ur,ei,fr,er,c,l,ut,lt,bi,ui,ir,rr,tt,hu;Array.prototype.find||(Array.prototype.find=function(n){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof n)throw new TypeError("predicate must be a function");for(var i,r=Object(this),u=r.length>>>0,f=arguments[1],t=0;t0?1:-1)*Math.floor(Math.abs(t)):t}(n);return Math.min(Math.max(t,0),fr)},function(n){var o=Object(n),f,t;if(null==n)throw new TypeError("Array.from requires an array-like object - not null or undefined");if(t=arguments.length>1?arguments[1]:void 0,void 0!==t){if(!ei(t))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(f=arguments[2])}for(var r,u=er(o.length),e=ei(this)?Object(new this(u)):new Array(u),i=0;i1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.emit("warn",{code:t,message:n,extras:i})}},{key:"error",value:function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.emit("error",{code:t,message:n,extras:i})}}]),n}();b(s,{ERROR_GENERIC:0,ERROR_INVALID_DATA:1,ERROR_INCOMPLETE_DATA:2});var t={line_chart:"dv-line-chart",chart_zoomed:"dv-zoomed",chart_panning:"dv-panning",chart_viewport_hover:"dv-viewport-hover",header:"dv-header",title:"dv-title",subtitle:"dv-subtitle",legend:"dv-legend",legend_item:"dv-legend-item",plot_area:"dv-plot-area",plot_bg:"dv-plot-background",viewport:"dv-viewport",lines_group:"dv-lines-group",line:"dv-line",point:"dv-point",point_label:"dv-point-label",point_label_line:"dv-point-label-line",annotation:"dv-annotation",annotation_bg:"dv-annotation-bg",x_axis:"dv-x-axis",y_axis:"dv-y-axis",axis_line:"dv-axis-line",axis_at_zero:"dv-axis-at-zero",tick:"dv-tick",grid_line:"dv-grid-line",x_axis_grid_lines:"dv-grid-lines-v",y_axis_grid_lines:"dv-grid-lines-h",footer:"dv-footer",footnote:"dv-footnote",source:"dv-source",tooltip:"dv-tooltip",tooltip_left:"dv-tooltip-left",tooltip_right:"dv-tooltip-right",group_tooltip:"dv-group-tooltip",tooltip_label:"dv-tooltip-label",tooltip_value:"dv-tooltip-value",tooltip_line_label:"dv-tooltip-line-label",tooltip_hidden:"dv-hidden",tooltip_point:"dv-tooltip-point",label_editor:"dv-label-editor",label_editor_closing:"dv-editor-closing",selected_point:"dv-selected-point",label_handle:"dv-label-handle",placeholder:"dv-placeholder",no_select:"dv-no-select"},sr=document.createElement("canvas").getContext("2d"),bt={};var st=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],vu=864e5,ci=Date.UTC(1970,0,1);var li=/^\d{2,4} (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)$/i,ai=/^\d{2,4} (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) \d{1,2}$/i,vi=/^\d{2,4} (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) \d{1,2}-\d{2,4} (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) \d{1,2}$/i;var y={gallup:["#009d4f","#002169","#238dc1","#b14c59"],polcategorical:["#009d4f","#0065a1","#009383","#002169"],democratic:["#002169","#0065a1","#005d83","#238dc1"],republican:["#f32735","#aa182c","#ce0e2d","#51232d"],independent:["#6a8c89","#244445","#5e7775","#062a30"],disapproval:["#b14c59","#aa182c","#d96931","#ae821f"],approvalFlexchart:["#005850","#d96931"]},rt={gallup:[null,null,"5 5","2 2"],polcategorical:[null,"5 5",null,"2 2"],democratic:[null,null,"5 5","2 2"],republican:[null,"5 5","2 2",null],independent:[null,"5 5","2 2",null],approvalFlexchart:[null,"5 5"]},pu="Gallup",wu=150,bu=40,ku=50;c={};!function n(){for(var r,i=Object.keys(c),t=0;t"+n+"<\/svg>",t=i.children[0]);t.firstChild;)this.appendChild(t.firstChild);return this}}]),n}(),ki=function(){function n(){return u(this,n),f(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return e(n,ft),o(n,[{key:"x",value:function(n){return this.attr("x",n)}},{key:"y",value:function(n){return this.attr("y",n)}},{key:"move",value:function(n,t){return this.x(n),this.y(t),this}},{key:"cx",value:function(n){var t=this.bbox().width/2;return void 0===n?this.x()+t:this.x(n-t)}},{key:"cy",value:function(n){var t=this.bbox().height/2;return void 0===n?this.y()+t:this.y(n-t)}}]),n}(),fi=function(){function n(){return u(this,n),f(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return e(n,ki),o(n,[{key:"width",value:function(n){return this.attr("width",n)}},{key:"height",value:function(n){return this.attr("height",n)}},{key:"size",value:function(){return arguments.length?(this.width(arguments.length<=0?void 0:arguments[0]).height(arguments.length<=1?void 0:arguments[1]),this):{width:this.width(),height:this.height()}}}]),n}(),dr=function(){function n(){return u(this,n),f(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return e(n,ft),o(n,[{key:"cx",value:function(n){return this.attr("cx",n)}},{key:"cy",value:function(n){return this.attr("cy",n)}}]),n}(),di=function(){function n(t,i){u(this,n);var r=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t));return r.points=[],void 0!==i&&r.setPoints(i),r}return e(n,ft),o(n,[{key:"setPoints",value:function(n){return this.points=kr(n),this.attr("points",this.points.map(function(n){return n.x+","+n.y}).join(" ")),this}}]),n}(),gr=function(){function n(){return u(this,n),f(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return e(n,ki),o(n,[{key:"dx",value:function(n){return this.attr("dx",n)}},{key:"dy",value:function(n){return this.attr("dy",n)}}]),n}(),tf=function(){function n(){u(this,n);var t=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"svg"));return t.attr("xmlns",ui),t.attr("id","dv-svg-"+du++),t.createDefs(),t}return e(n,fi),o(n,[{key:"createDefs",value:function(){return this.defs=new ft("defs"),this.appendChild(this.defs),this}},{key:"addDef",value:function(n){return this.defs.appendChild(n),this}},{key:"removeDef",value:function(n){return this.defs.removeChild(n),this}},{key:"removeAllChildren",value:function(){for(;this.node.firstChild;)this.removeChild(this.node.firstChild);return this.createDefs(),this}}]),n}(),v=function(){function n(){return u(this,n),f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"svg"))}return e(n,fi),n}(),et=function(){function n(t,i){u(this,n);var r=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"rect"));return r.width(t).height(i),r}return e(n,fi),o(n,[{key:"rx",value:function(n){return this.attr("rx",n)}},{key:"ry",value:function(n){return this.attr("ry",n)}}]),n}(),nu=function(){function n(t){u(this,n);var i=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"circle"));return i.r(t),i}return e(n,dr),o(n,[{key:"r",value:function(n){return this.attr("r",n)}}]),n}(),rf=(function(){function n(){return u(this,n),f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"ellipse"))}e(n,dr);o(n,[{key:"rx",value:function(n){return this.attr("rx",n)}},{key:"ry",value:function(n){return this.attr("ry",n)}}])}(),function(){function n(t){u(this,n);var i=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"tspan"));return i.text(t),i}return e(n,gr),o(n,[{key:"text",value:function(n){return void 0===n?this.node.textContent:(this.node.textContent=n,this)}}]),n}()),d=function(){function n(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i;return u(this,n),i=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"text")),i.leading(r),i.lines=[],i.text(t),i}return e(n,gr),o(n,[{key:"clear",value:function(){for(;this.node.firstChild;)this.removeChild(this.node.firstChild);return this.lines=[],this}},{key:"text",value:function(n){var t=this;return void 0===n?this.textContent:(this.clear(),n.split("\n").forEach(function(n,i){t.lines.push(new rf(n.length?n:" ").x(t.x()).dy(t.getLineOffset(0===i)).appendTo(t))}),this)}},{key:"x",value:function(n){return void 0===n?this.attr("x"):(this.attr("x",n),this.lines.forEach(function(t){return t.x(n)}),this)}},{key:"getLines",value:function(){return this.lines}},{key:"leading",value:function(n){return void 0===n?this.textLeading:(this.textLeading=n,this)}},{key:"getLineOffset",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?.8+(this.textLeading-1)/2+"em":this.textLeading+"em"}}]),n}(),g=function(){function n(){u(this,n);var t=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"g"));return t.translateX=0,t.translateY=0,t}return e(n,ft),o(n,[{key:"x",value:function(n){return void 0===n?this.translateX:(this.translateX=n,this.attr("transform","translate("+this.translateX+", "+this.translateY+")"))}},{key:"y",value:function(n){return void 0===n?this.translateY:(this.translateY=n,this.attr("transform","translate("+this.translateX+", "+this.translateY+")"))}},{key:"bbox",value:function(){var n=this.x(),t=this.y(),i=this.node.getBBox(),r=i.width,u=i.height;return{x:n,y:t,width:r,height:u,left:n,top:t,right:n+r,bottom:t+u}}},{key:"children",value:function(){return this.node.children||[].concat(wt(this.node.childNodes)).filter(function(n){return n instanceof SVGElement})}},{key:"child",value:function(n){return this.children()[n]}}]),n}(),gi=function(){function n(t,i,r,e){u(this,n);var o=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"line"));return 0!==t&&o.attr("x1",t),0!==i&&o.attr("y1",i),0!==r&&o.attr("x2",r),0!==e&&o.attr("y2",e),o}return e(n,ft),n}(),tu=(function(){function n(t){return u(this,n),f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"polyline",t))}e(n,di)}(),function(){function n(t){return u(this,n),f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"polygon",t))}e(n,di)}(),function(){function n(t){return u(this,n),f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"path",t))}return e(n,di),o(n,[{key:"setPoints",value:function(n){return this.points=kr(n),this.attr("d",function(n){var t="";return n instanceof Array&&n.length&&n.forEach(function(n,i){t+=" "+n[0]+" "+n[1];0===i&&(t="M"+t+" L")}),t}(this.points)),this}}]),n}()),uf=function(){function n(){u(this,n);var t=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"clipPath"));return t.attr("id","svg-cp"+gu++),t}return e(n,ki),n}(),w=(function(){function n(){u(this,n);var t=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,"mask"));return t.attr("id","svg-mask"+nf++),t}e(n,fi)}(),"tile"),iu={mode:"article",width:"100%",height:"100%",showHeader:!0,showFooter:!0,showLegend:!0,yAxisPosition:"right",showPointLabels:!0,pointLabels:{},dateFormat:"day",ticks:null,zoomLevel:1,x_axis_min:null,x_axis_max:null,y_axis_min:null,y_axis_max:null,y_precision:null,unitFormat:null,embedStylesheet:!0,displayTooltips:!0,strictModeTooltips:!1,wrapAxisLabels:!1,enableValidation:!1,strictValidation:!1,forceMultilineLegend:!1,tooltipLabel:null,tooltipLineLabel:null,groupTooltipLabel:null},r=10,a='11px "aktiv-grotesk", "aktiv-grotesk-std", Arial, Helvetica, sans-serif',ff=or.mutate.bind(or),nt=[],ru=function(n){var i=document.createElement("div");if(n in i.style)return!0;for(var r=["Khtml","Ms","O","Moz","Webkit"],u=n.replace(/^[a-z]/,function(n){return n.toUpperCase()}),t=0;t2&&void 0!==arguments[2]?arguments[2]:{},r,o;return(u(this,n),r=f(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),(r.container="string"==typeof t?document.querySelector(t):t,r.options=b({},iu,e),r.dom={},r.metadata={},r.state={},r.zoomFadeId="zoom-fade-"+(document.querySelectorAll("[id*='zoom-fade']").length+1),r.dom.chart=(new tf).appendTo(r.container),r.el=r.dom.chart.node,r.el.dvInstance=r,r.on("mouseenter",r.mouseEnter.bind(r)).on("mousedown",r.mouseDown.bind(r)).on("touchstart",r.touchStart.bind(r)).on("mousemove",r.mouseMove.bind(r)).on("touchmove",r.touchMove.bind(r)).on("mouseup",r.mouseUp.bind(r)).on("touchend",r.touchEnd.bind(r)).on("mouseleave",r.mouseLeave.bind(r)).on("dragstart",function(n){return n.preventDefault()}).on("focus",r.focusStart.bind(r)).on("blur",r.focusEnd.bind(r)).on("keydown",r.keyDown.bind(r)),e.enableValidation)&&!yr(i).valid&&e.strictValidation)?f(r):(o="approvalFlexChart"===r.container.parentElement.dataset.codename,r.data=pr(i,o),r.init(),r)}return e(n,s),o(n,[{key:"init",value:function(){var u=this.options,f=this.dom,n=this.state;switch(this.el.parentNode||this.container.appendChild(this.el),f.chart.attr("class",t.line_chart+" dv-"+this.options.mode+"-mode"),n.chartPadding=i(this,"interactive")?r:2*r,n.chartTicks=i(this,"interactive")?3:5,n.maxLines=1/0,n.tooltipsEnabled=u.displayTooltips,n.headerShown=u.showHeader&&!i(this,"interactive"),n.zoomLevel=i(this,"interactive","custom")?u.zoomLevel:1,n.labelSpacing=i(this,"interactive")?30:10,u.mode){case"article":f.chart.size(720,350);n.maxLines=4;break;case w:f.chart.size(300,300);break;case"interactive":case"custom":default:f.chart.size(u.width,u.height)}return n.svgRect=this.el.getBoundingClientRect(),n.innerWidth=n.svgRect.width-2*n.chartPadding,n.innerHeight=n.svgRect.height-2*n.chartPadding,n.textWrap=i(this,"article")?530:n.innerWidth,n.zoomLevel>1&&f.chart.addClass(t.chart_zoomed),u.embedStylesheet?this.embedStyles():br(bi),this.createMetadata().draw().emit("init"),nt.push(this),this}},{key:"createMetadata",value:function(){var f=this.data,u=this.options,g=this.dom,y=this.state,o,l,s,h,w,b,k,d,c;if(this.metadata={axisX:{height:0,plotOffset:20},axisY:{width:0}},!f.lines.length&&!f.labels.length)return this;var p=this.metadata,n=p.axisX,e=p.axisY;if(f.lines=f.lines.slice(0,y.maxLines),"date"===f.labelType||"date_range"===f.labelType)n.labels=vr(f.labels,u.dateFormat);else if("number"===f.labelType)for(n.labels=[],o=f.labels[0].x;o<=f.labels[f.labels.length-1].x;o++)n.labels.push({x:o,text:o.toString()});if(l=f.lines.map(function(n){return n.points}),s=l.reduce(function(n,t){return n.concat(t)},[]),!s.length&&f.labels.length&&(s=f.labels.map(function(n){return{x:n.x,y:0}})),n.values=s.map(function(n){return n.x}).filter(ni).sort(function(n,t){return n-t}),n.valuesByLine=l.map(function(n){return n.map(function(n){return n.x})}),n.min=n.values[0],n.max=n.values[n.values.length-1],n.range=n.max-n.min,!f.labels.length){if(!n.values.length)return this;f.labels=n.values.map(function(n){return{x:n,text:n.toString()}})}if(h=n.labels||f.labels,(n.axisMin=null!==u.x_axis_min?u.x_axis_min:Math.min(n.min,h[0].x),n.axisMax=null!==u.x_axis_max?u.x_axis_max:Math.max(n.max,h[h.length-1].x),n.axisRange=n.axisMax-n.axisMin,u.ticks&&u.ticks.length)&&(isNaN(u.ticks[0])?ii(u.ticks[0])&&("date"===f.labelType||"date_range"===f.labelType)?(w=ar(n.min),b=ar(n.max),n.ticks=u.ticks.map(function(n){return function n(t,i,r,u){var e=i.indexOf("_yy")>-1,f=void 0;switch(i.replace("_yy","")){case"auto":return n(t,yi(r,u)+(e?"_yy":""),r,u);case"year":f=new Date(t.getFullYear(),0,1);break;case"quarter":f=new Date(t.getFullYear(),3*(lr(t.getMonth())-1),1);break;case"month":f=new Date(t.getFullYear(),t.getMonth(),1);break;case"day":default:f=new Date(t)}return{x:it(f),text:pi(i,r,u)(f)}}(ii(n),u.dateFormat,w,b)}).filter(function(n,t,i){return i.indexOf(n)===t})):n.ticks="string"==typeof u.ticks[0]?u.ticks.filter(function(n,t,i){return i.indexOf(n)===t}).map(function(n){return f.labels.find(function(t){return t.text===n})}).filter(function(n){return!!n}):u.ticks:n.ticks=u.ticks.filter(function(n,t,i){return i.indexOf(n)===t}).map(function(n){return{x:n,text:f.labels[n]?f.labels[n].text:n.toString()}}),n.ticks.sort(hi)),e.values=s.map(function(n){return n.y}).filter(ni).sort(function(n,t){return n-t}),e.valuesByLine=l.map(function(n){return n.map(function(n){return n.y})}),e.min=e.values[0],e.max=e.values[e.values.length-1],e.decimalPlaces=Math.max.apply(Math,wt(e.values.map(function(n){return ot(n)}))),null!==u.y_axis_min&&null!==u.y_axis_max&&u.y_axis_min===u.y_axis_max)throw new Error("Y-axis range cannot be zero.");return(e.ticks=ef(e.min,e.max,y.chartTicks,u.y_axis_min,u.y_axis_max).map(function(n){return{y:n.value,text:u.unitFormat?u.unitFormat.replace("{y}",n.text):n.text,hideLabel:null!==u.y_precision&&Number(n.value.toFixed(u.y_precision))!==n.value}}),e.axisMin=e.ticks[0].y,e.axisMax=e.ticks[e.ticks.length-1].y,e.axisRange=e.axisMax-e.axisMin,"hidden"!==u.yAxisPosition)&&(k=e.ticks.filter(function(n){return!n.hideLabel}).map(function(n){return n.text}),e.width=si(k,a)),d=(n.ticks||h).map(function(n){return n.text.toUpperCase()}),n.maxLabelWidth=si(d,a),n.ticks=n.ticks||ou(this),n.maxShownLabelWidth=si(n.ticks.map(function(n){return n.text.toUpperCase()}),a),n.plotOffset=i(this,"interactive")?5:Math.max(Math.ceil(n.maxShownLabelWidth/2)+2,20),c=(new v).appendTo(g.chart).addClass(t.x_axis),i(this,"interactive")?c.appendRawSVG('\n \n \n Example<\/text>\n <\/g>\n '):c.appendRawSVG('\n \n \n Example<\/text>\n <\/g>\n '),n.height=c.bbox().height,c.remove(),this}},{key:"draw",value:function(){var n=this.options;return this.drawHeader().drawLegend().drawFooter().drawPlotArea().drawXAxis().drawYAxis().drawLines().layout(),n.displayTooltips&&this.drawTooltips(),this.emit("draw"),this}},{key:"layout",value:function(){var e=this.metadata,n=this.dom,s=this.state,o=this.options,t=s.chartPadding,u=t,f=t;return n.header&&(n.header.x(t).y(t),f=n.header.y()+n.header.height()+2*r),n.legend&&(n.legend.x(t).y(f),f=n.legend.y()+n.legend.height()+1.5*r),n.axisY.y(f),"hidden"===o.yAxisPosition?n.axisY.hide():"left"===o.yAxisPosition?(n.axisY.x(t),u=n.axisY.x(),i(this,"interactive")||(u+=e.axisY.width+r)):n.axisY.x(n.plotBackground.width()+t+(i(this,"interactive")?-e.axisY.width:r)),n.plotBackground.x(u).y(f),u=n.plotBackground.x(),f=n.plotBackground.y(),n.viewportClip.x(u).y(f),n.viewport.x(u).y(f),u=e.axisX.plotOffset,i(this,"interactive")&&"left"===o.yAxisPosition&&(u+=r+e.axisY.width),n.plotArea.x(u),n.axisX.x(u).y(n.plotArea.height()),f=i(this,"interactive")?n.plotBackground.y()+n.plotBackground.height()+t:n.viewport.y()+n.viewportClipRect.height()+t,n.footer&&n.footer.x(t).y(f),n.viewport.front(),i(this,"article")&&n.chart.height(n.chart.bbox().height+2*t),s.plotAreaOffset=n.plotArea.node.getBoundingClientRect(),this}},{key:"drawHeader",value:function(){var n=this.data,u=this.dom,e=this.state,f,o,h,s;return!e.headerShown||!n.title&&!n.subtitle?(u.header=null,this):(u.header=(new v).appendTo(u.chart).addClass(t.header),f=void 0,n.title&&(o=void 0,o=i(this,w)?k(n.title.toUpperCase(),e.textWrap,a,.1):k(n.title,e.textWrap,'18px "aktiv-grotesk", "aktiv-grotesk-std", Arial, Helvetica, sans-serif'),f=new d(o,1.3).appendTo(u.header).addClass(t.title).y("-"+(1.3-1)/2+"em")),n.subtitle&&(h=new d(k(n.subtitle,e.textWrap,a),1.3).appendTo(u.header).addClass(t.subtitle),f&&h.y(f.bbox().y+f.bbox().height+r)),s=u.header.bbox(),u.header.attr({width:s.width,height:s.height}),this)}},{key:"drawLegend",value:function(){var s=this.data,i=this.dom,o=this.options,f=this.state,n,u,e;return o.showLegend?(i.legend=(new v).appendTo(i.chart).addClass(t.legend),n=0,u=0,s.lines.forEach(function(e,s){var h=(new g).appendTo(i.legend).addClass(t.legend_item).x(n).y(u),c,l;new tu([{x:0,y:5},{x:14,y:5}]).appendTo(h).addClass(t.line).attr({fill:"none",stroke:e.color,"data-line-id":e.id,"stroke-dasharray":e.strokeDashArray||""});c=void 0;"title"in e&&(c=new d(e.title).appendTo(h).x(14+r/2));l=h.bbox().width;(n>0&&n+l>f.textWrap||o.forceMultilineLegend&&s>0)&&(n=0,u=h.bbox().bottom+r/2,h.x(n).y(u));0===n&&n+l>f.textWrap&&c&&c.text(k(e.title,f.textWrap-c.x(),a));n+=l+r}),e=i.legend.bbox(),i.legend.attr({width:e.width,height:e.height}),this):(i.legend=null,this)}},{key:"drawFooter",value:function(){var u=this.data,l=this.options,n=this.dom,h=this.state,e,f,o,c,s;return!1===l.showFooter||!u.footnote&&!u.source?(n.footer=null,this):(n.footer=(new v).appendTo(n.chart).addClass(t.footer),e=0,f=void 0,(u.footnote&&(f=new d(k(u.footnote,h.textWrap,a),1.3).appendTo(n.footer).addClass(t.footnote)),u.source)&&(o=k(u.source.toUpperCase(),h.textWrap,a,.1),i(this,w)&&o.indexOf("\n")<0&&(e=11),c=new d(o).appendTo(n.footer).addClass(t.source),f&&!i(this,w)&&c.y(f.bbox().y+f.bbox().height+r)),s=n.footer.bbox(),n.footer.attr({width:s.width,height:s.height+e}),this)}},{key:"drawPlotArea",value:function(){var u=this.metadata,f=this.state,n=this.dom,o="hidden"!==this.options.yAxisPosition?Math.max(f.innerWidth-r-u.axisY.width,0):f.innerWidth,c=Math.max(o*f.zoomLevel-2*u.axisX.plotOffset,0),e=void 0,s,h,l;return e=i(this,"article")?175:Math.max(f.innerHeight-(n.header?n.header.height()+r:0)-(n.legend?n.legend.height()+r:0)-u.axisX.height-(n.footer?f.chartPadding+n.footer.height():0),0),s=i(this,"interactive")?f.innerWidth:o,h=e+(i(this,"interactive")?u.axisX.height:0),n.plotBackground=(new v).appendTo(n.chart).addClass(t.plot_bg).size(s,h),new et(0,0).appendTo(n.plotBackground).addClass(t.placeholder).size(s,h),n.viewportClip=new uf,n.chart.addDef(n.viewportClip),n.viewportClipRect=new et(0,0).appendTo(n.viewportClip).attr("fill","transparent").size(o,e+u.axisX.height),i(this,"interactive")&&1===f.zoomLevel&&(n.viewportClipRect2=new et(0,0).appendTo(n.viewportClip).attr("fill","transparent").size(s,u.axisX.height).y(e)),n.chart.defs.appendRawSVG('\n \n \n \n \n \n <\/linearGradient>\n '),n.zoomFade=this.el.getElementById(this.zoomFadeId),n.viewport=(new v).appendTo(n.chart).addClass(t.viewport).clip(n.viewportClip),n.plotArea=(new v).appendTo(n.viewport).addClass(t.plot_area).size(c,e),new et(c,e).appendTo(n.plotArea).addClass(t.placeholder),l="url(#"+this.zoomFadeId+")",n.zoomOverlay=new et(o,e+u.axisX.height).appendTo(n.viewport).attr("fill",l),this.updateZoomFade(),this}},{key:"drawLines",value:function(){var u=this,o=this.data,s=this.metadata,e=this.options,c=this.dom,l=(new g).appendTo(c.plotArea).addClass(t.lines_group),f,n;return(o.lines.forEach(function(n){if(!(n.points.length<2)){for(var i,f=n.points,e=[],r=0;r10&&(ot=function(n,t,i,r,u,f){var e=i+u,o=r+f,h=void 0,s;return h=i<=n&&n<=e?Math.round(i+u/2):Math.abs(i-n)f-10&&0===c&&(e=15),s=f+kt(i.text||""),c=e);u+='\n \n '+(i.text||"")+"<\/text>\n <\/g>";new gi(f,0,f,n.plotBackground.height()).appendTo(a).addClass(t.grid_line)})}else u=f.ticks.map(function(n){return'\n \n \n '+(n.text||"")+"<\/text>\n <\/g>\n "}).join("");return n.axisX.appendRawSVG(u),e=n.axisX.bbox(),n.axisX.attr({width:e.width,height:e.height}),this}},{key:"drawYAxis",value:function(){var f=this,u=this.metadata,n=this.dom,e;return(n.axisY=(new v).appendTo(n.chart).addClass(t.y_axis),!u.axisY.ticks)?this:(e=(new g).appendTo(n.plotBackground).addClass(t.y_axis_grid_lines),u.axisY.ticks.forEach(function(o,s){var c=vt(f,o.y),l=(new g).appendTo(n.axisY).addClass(t.tick).x(u.axisY.width).y(c),h;o.hideLabel||(h=new d(o.text).appendTo(l),i(f,"interactive")?0===s?h.y(-1.5*r):h.y(r/2):h.y("-0.5em"));new gi(0,c,n.plotBackground.x()+n.plotBackground.width(),c).appendTo(e).addClass(0===o.y?t.axis_line:t.grid_line);0===o.y&&0===s&&n.axisX.addClass(t.axis_at_zero)}),this)}},{key:"drawTooltips",value:function(){var f=this,n=this.dom,e=this.data,r=this.metadata,i,u;return n.groupTooltip=document.createElement("div"),i=n.groupTooltip,i.className=t.tooltip+" "+t.group_tooltip,ct(i,this.el.id),n.groupTooltipLabel=document.createElement("p"),u=n.groupTooltipLabel,u.className=t.tooltip_label,u.innerHTML=" ",i.appendChild(u),n.groupTooltipLines=[],n.tooltips=[],r.tooltips=[],n.tooltipPoints=(new g).appendTo(n.viewport).x(n.plotArea.x()),e.lines.forEach(function(u){var e=document.createElement("div"),o;e.className=t.tooltip;e.innerHTML='\n  <\/span>\n  <\/span>\n ';ct(e,f.el.id);n.tooltips.push(e);r.tooltipHeight||(r.tooltipHeight=e.clientHeight);e.style.marginTop="-"+(r.tooltipHeight+10)+"px";o=document.createElement("p");o.innerHTML='\n  <\/span>\n  <\/span>\n ';i.appendChild(o);n.groupTooltipLines.push(o);new nu(5).appendTo(n.tooltipPoints).addClass(t.point+" "+t.tooltip_point).attr({fill:u.color,style:"visibility: hidden;"})}),i.style.marginTop="-"+(i.clientHeight+10)+"px",this}},{key:"getTooltipMetadata",value:function(n){var r=this.options,t=this.metadata,tt=this.data,it=this.state,y=void 0,c,k,f,ht,l,nt;r.strictModeTooltips&&(y=fu(this,n),t.lastTooltipXValue=y);for(var rt=!1,e=1/0,o=-1/0,ut=0,p=1/0,w=void 0,i=0;io&&(o=u),!t.tooltips[i]||t.tooltips[i].x!==u){rt=!0;c=s.points[ft].y;t.tooltips[i]={x:u,y:c};k=r.unitFormat?r.unitFormat.replace("{y}",dt(c,t.axisY.decimalPlaces)):dt(c,t.axisY.decimalPlaces);f=tr(this,u);r.tooltipLabel&&(f=r.tooltipLabel(s,u,f));var ct=r.tooltipLineLabel?r.tooltipLineLabel(s,u,f):s.title,d=kt(f.toUpperCase(),a)+8+6.5*k.length+20,et=h(this,u),ot=vt(this,c),v=Math.round(it.plotAreaOffset.left+et),st=Math.round(window.pageYOffset+it.plotAreaOffset.top+ot),g="top";v-d/2<0?g="right":v+d/2>window.innerWidth&&(g="left");ht={top:st,left:v,bottom:st+t.tooltipHeight+15,right:v+d};b(t.tooltips[i],{label:f,lineLabel:ct,value:k,plottedX:et,plottedY:ot,rect:ht,position:g,color:s.color})}t.tooltips[i]&&t.tooltips[i].rect.top'+r.value+'<\/span>\n '+r.lineLabel+"<\/span>\n "),i.tooltips[e].style.visibility="hidden",r.plottedY&&(l.setAttribute("cx",r.plottedX),l.setAttribute("cy",r.plottedY),l.style.visibility="visible");var y=a[f.tooltips[0].position],k=y.cls,p=y.translate;i.groupTooltipLabel.innerHTML=u.gtLabel;i.groupTooltip.className=t.tooltip+" "+t.group_tooltip+" "+k;i.groupTooltip.style.transform=ru?"translate3d("+u.gtLeft+"px, "+u.gtTop+"px, 0) "+p:"translate("+u.gtLeft+"px, "+u.gtTop+"px) "+p;i.groupTooltip.style.visibility="visible"}else{for(o=0;o'+n.label+'<\/span>\n '+n.value+"<\/span>\n ";c.style.transform=ru?"translate3d("+n.rect.left+"px, "+n.rect.top+"px, 0) "+b:"translate("+n.rect.left+"px, "+n.rect.top+"px "+b;c.style.visibility="visible";v.setAttribute("cx",n.plottedX);v.setAttribute("cy",n.plottedY);v.style.visibility="visible"}else!1===n&&(c.style.visibility="hidden",v.style.visibility="hidden")}i.groupTooltip.style.visibility="hidden"}s.viewportHover&&document.documentElement.classList.add(t.chart_viewport_hover)}),this.emit("tooltipsupdated"),this):void 0}},{key:"changeData",value:function(n){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.options.enableValidation&&!yr(n).valid&&this.options.strictValidation?this:(this.data=pr(t?n:b({},this.data,n)),this.redraw(!0).emit("datachanged"),this)}},{key:"addLine",value:function(n){return this.data.lines.length1&&void 0!==arguments[1]&&arguments[1];return this.options=b({},t?iu:this.options,n),this.destroy().init().emit("optionschanged"),this}},{key:"redraw",value:function(){return!0===(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.createMetadata(),wr(this.el.id),this.clearSvg().draw().emit("redraw"),this}},{key:"scrollTo",value:function(n){var i=this.dom,t=-n;return i.plotArea.x(t),i.tooltipPoints.x(t),i.axisX.x(t),this.state.viewportOffset=t,this.updateZoomFade(),this}},{key:"scrollToPoint",value:function(n){return this.scrollTo(h(this,n)-this.metadata.axisX.plotOffset),this}},{key:"zoom",value:function(n){return i(this,"interactive","custom")&&this.changeOptions({zoomLevel:n}),this}},{key:"zoomToRange",value:function(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.data.labels.length,t=this.data.labels,r=this.metadata.axisX,u=n>=0?Math.min(n,t.length-1):Math.max(t.length+n,0),f=i>=0?Math.min(i,t.length-1):Math.max(t.length+i,0),s=Math.max(f-u,1),e=t[u].x,c=t[f].x,o;return this.zoom(r.range/s),o=h(this,c)-h(this,e)+2*r.plotOffset,this.zoom(this.dom.viewport.bbox().width/o),this.scrollToPoint(e),this}},{key:"zoomTimePeriod",value:function(n){if("date"===this.data.labelType||"date_range"===this.data.labelType){var t=new Date;t.setDate(t.getDate()+n);this.zoom(this.metadata.axisX.range/(t-new Date))}return this}},{key:"updateZoomFade",value:function(){var n=this.dom,t=n.plotArea.x()<0,i=n.plotArea.x()>n.viewportClipRect.width()-n.plotArea.width();return n.zoomFade.setAttribute("class",(t?"fade-start ":"")+(i?"fade-end":"")),n.zoomOverlay.front(),this}},{key:"getPointPosition",value:function(n){return{left:h(this,n.x),top:vt(this,n.y)}}},{key:"embedStyles",value:function(){var n=this.dom;return n.stylesheet=document.createElement("style"),n.stylesheet.innerHTML=bi.replace(new RegExp("."+t.chart,"g"),"#"+this.el.id),n.chart.appendChild(n.stylesheet),this}},{key:"clearSvg",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.dom;return n.chart.removeAllChildren(),t&&n.stylesheet&&n.chart.appendChild(n.stylesheet),this}},{key:"destroy",value:function(){return this.emit("destroy"),this.clearSvg(!1),this.dom.chart.remove(),wr(this.el.id),this.dom={chart:this.dom.chart},this.metadata={},this.state={},nt.splice(nt.indexOf(this),1),this}},{key:"resize",value:function(){var i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.metadata,u=this.options,n=this.state,f=this.dom,t=this.el.getBoundingClientRect();t.width===n.svgRect.width&&!0!==i||(n.svgRect=t,n.innerWidth=t.width-2*n.chartPadding,n.innerHeight=t.height-2*n.chartPadding,n.tooltipCachedCursorX=null,u.ticks||(r.axisX.ticks=ou(this)),this.redraw().emit("resize"));n.plotAreaOffset=f.plotArea.node.getBoundingClientRect()}},{key:"scroll",value:function(){var t=this.dom,n=this.state;n.svgRect=this.el.getBoundingClientRect();n.plotAreaOffset=t.plotArea.node.getBoundingClientRect()}},{key:"scrollViewport",value:function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state.dragLastEvent,t=this.state,i=this.dom;i.plotArea.x(n);i.tooltipPoints.x(n);i.axisX.x(n);this.updateZoomFade();t.tooltipsEnabled&&r?(t.plotAreaOffset=i.plotArea.node.getBoundingClientRect(),this.updateTooltips(r.clientX)):t.tooltipsEnabled&&t.viewportFocused&&(t.plotAreaOffset=i.plotArea.node.getBoundingClientRect())}},{key:"autoScroll",value:function(){var r=this,n=this.state,i,t;(n.autoScrolling=!0,n.lastAutoScrollID=n.autoScrollID,n.dragAmplitude)?(i=Date.now()-n.dragLastTime,t=-n.dragAmplitude*Math.exp(-i/325),t>1||t<-1?(this.scrollViewport(n.dragAutoTarget+t),n.autoScrollID="autoScroll"+Math.random(),p(function(){ht(n.lastAutoScrollID);r.autoScroll()},this.state.autoScrollID)):(this.scrollViewport(n.dragAutoTarget),n.autoScrolling=!1)):n.autoScrolling=!1}},{key:"resetVelocityTracker",value:function(){var t=this.dom,n=this.state;n.autoScrolling=!1;ht(n.autoScrollID);ht(n.lastAutoScrollID);this.stopVelocityTracker();n.autoScrolling=!1;n.dragVelocity=0;n.dragAmplitude=0;n.dragLastX=t.plotArea.x();n.dragLastTime=Date.now()}},{key:"startVelocityTracker",value:function(){var n=this;this.resetVelocityTracker();uu=setInterval(function(){return n.trackVelocity()},100)}},{key:"stopVelocityTracker",value:function(){this.state.dragVelocity=0;clearInterval(uu)}},{key:"startAutoScroll",value:function(){var t=this.dom,n=this.state;Math.abs(n.dragVelocity)>10&&!n.autoScrolling&&(ht("panning_update"),n.dragAmplitude=.8*n.dragVelocity,this.stopVelocityTracker(),n.dragAutoTarget=this.clampViewportX(t.plotArea.x()+n.dragAmplitude),n.autoScrollID="autoScroll"+Math.random(),p(this.autoScroll.bind(this),n.autoScrollID))}},{key:"clampViewportX",value:function(n){var t=this.metadata,i=this.dom;return Math.max(Math.min(n,t.axisX.plotOffset),i.viewportClipRect.width()-i.plotArea.width()-t.axisX.plotOffset)}},{key:"trackVelocity",value:function(){var i=this.dom,n=this.state;if(n.panning){var t=i.plotArea.x(),r=Date.now()-(n.dragLastTime||Date.now()),u=1e3*(t-(n.dragLastX||0))/(1+r);n.dragVelocity=.8*u+.2*n.dragVelocity;n.dragLastTime=Date.now();n.dragLastX=t}}},{key:"mouseEnter",value:function(){var n=this.state,t=this.dom;n.svgRect=this.el.getBoundingClientRect();n.plotAreaOffset=t.plotArea.node.getBoundingClientRect()}},{key:"mouseMove",value:function(n){var o=this,r=this.state,u=this.dom,s,h,c,l,a,v,f,e;at=!1;f={x:n.clientX-r.svgRect.left,y:n.clientY-r.svgRect.top};e=(s=f.x,h=f.y,c=u.viewport.x(),l=u.viewport.y(),a=u.viewport.x()+u.viewportClipRect.width(),v=u.viewport.y()+u.viewportClipRect.height(),s>=c&&s<=a&&h>=l&&h<=v);r.viewportHover=e;(e||i(this,"interactive","custom"))&&(r.tooltipsEnabled&&!r.leftMouseDown?(this.state.dragLastEvent=n,wi(function(){o.updateTooltips(n.clientX)},"tooltip_update")):1!==r.zoomLevel&&(r.panning=!0,u.chart.addClass(t.chart_panning),r.dragLastEvent=n,p(function(){var t=o.clampViewportX(f.x-r.viewportOffset);o.scrollViewport(t,n)},"panning_update")));e||(ht("tooltip_update"),document.documentElement.classList.remove(t.chart_viewport_hover))}},{key:"touchMove",value:function(n){this.mouseMove({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY})}},{key:"mouseLeave",value:function(n){i(this,"interactive","custom")&&1!==this.state.zoomLevel&&this.state.leftMouseDown&&(this.state.dragLastEvent=n,this.startAutoScroll())}},{key:"mouseDown",value:function(n){var t=this.state,r=this.dom;0===n.button&&(t.leftMouseDown=!0,i(this,"interactive","custom")&&1!==t.zoomLevel&&this.startVelocityTracker());t.viewportOffset=function(n){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.target).getBoundingClientRect();return{x:n.clientX-t.left,y:n.clientY-t.top}}(n,this.el).x-r.plotArea.x()}},{key:"touchStart",value:function(n){this.state.leftMouseDown=!0;this.mouseDown({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY})}},{key:"mouseUp",value:function(n){var r=this.state,u=this.dom;0===n.button&&(r.leftMouseDown=!1);r.panning=!1;i(this,"interactive","custom")&&1!==r.zoomLevel&&(r.dragLastEvent=n,this.startAutoScroll());u.chart.removeClass(t.chart_panning)}},{key:"touchEnd",value:function(){this.mouseUp({button:0})}},{key:"focusStart",value:function(){var i=this,n=this.state,t;(n.viewportFocused=!0,!n.viewportHover&&n.tooltipsEnabled)&&(n.viewportHover=!0,n.focusIndex=0,nr&&(at=!0),this.scrollViewport(this.metadata.axisX.plotOffset),t=eu(this,0),wi(function(){i.updateTooltips(t)},"tooltip_update"))}},{key:"focusEnd",value:function(){var n=this.state;n.viewportFocused=!1;n.viewportHover=!1}},{key:"keyDown",value:function(n){var e=this,t=this.state,u=this.metadata.axisX,r,i,f;t.viewportFocused&&(r=void 0,"ArrowLeft"===n.key?r=t.focusIndex-1:"ArrowRight"===n.key&&(r=t.focusIndex+1),t.focusIndex=(r%u.values.length+u.values.length)%u.values.length,nr&&(at=!0),i=h(this,t.focusIndex),nr&&(i=h(this,this.metadata.axisX.values[t.focusIndex])),0===t.focusIndex?this.scrollViewport(this.metadata.axisX.plotOffset):-(i-this.metadata.axisX.plotOffset)>this.dom.plotArea.x()?this.scrollViewport(-(i-this.metadata.axisX.plotOffset)):i+this.dom.plotArea.x()>this.dom.viewportClipRect.width()-this.metadata.axisX.plotOffset&&this.scrollViewport(-i+this.dom.viewportClipRect.width()-this.metadata.axisX.plotOffset),f=eu(this,t.focusIndex),wi(function(){e.updateTooltips(f)},"tooltip_update"))}}]),n}();b(ir,{MODE_ARTICLE:"article",MODE_TILE:w,MODE_INTERACTIVE:"interactive",MODE_CUSTOM:"custom"});window.addEventListener("resize",function(){p(function(){nt.forEach(function(n){return n.resize()})},"resize_update")});window.addEventListener("scroll",function(){p(function(){nt.forEach(function(n){return n.scroll()})},"scroll_update")});window.addEventListener("blur",function(){document.documentElement.classList.remove(t.chart_viewport_hover)});document.addEventListener("mouseup",function(n){nt.forEach(function(t){0===n.button&&(t.state.leftMouseDown=!1)})});document.addEventListener("DOMContentLoaded",function(){document.body.addEventListener("typekitLoaded",function(){bt={};nt.forEach(function(n){return n.redraw(!0)})})});rr=["above","below","left","right"];tt=[];hu=function(){function n(t){u(this,n);this.chart=t;this.selectedPoint={};this.init()}return o(n,[{key:"init",value:function(){var n=this,i=this.chart,r,u;this.build();i.data.lines.forEach(function(t,i){var r=document.createElement("option");r.value=i;r.textContent=t.title;n.lineSelect.appendChild(r)});r=function(){var t=i.data.lines[n.lineSelect.value];if(t){for(;n.pointSelect.firstChild;)n.pointSelect.removeChild(n.pointSelect.firstChild);t.points.forEach(function(t){var u=i.data.labels.find(function(n){return n.x===t.x}),r;u&&(r=document.createElement("option"),r.value=t.x,r.textContent=u.text,n.pointSelect.appendChild(r),"x"in n.selectedPoint&&n.selectedPoint.x===t.x&&(r.selected=!0))})}};u=function(){n.annotationChars.textContent=n.annotation.value.length};r();this.lineSelect.addEventListener("change",r);this.lineSelect.addEventListener("change",this.updateControls.bind(this));this.pointSelect.addEventListener("change",this.updateControls.bind(this));this.showLabel.addEventListener("change",this.updateChart.bind(this));this.labelPosition.addEventListener("change",function(){"manual"===n.labelPosition.value&&(n.labelTop=-20,n.labelLeft=0);n.updateChart()});this.showOnTile.addEventListener("change",this.updateChart.bind(this));this.annotation.addEventListener("keyup",u);this.annotation.addEventListener("change",function(){u();n.updateChart()});this.closeButton.addEventListener("click",this.close.bind(this));this.labelHandle.addEventListener("mousedown",function(i){n.draggingLabel=!0;var r=n.labelHandle.getBoundingClientRect();n.labelHandleOffset={x:Math.round(i.clientX-r.left),y:Math.round(i.clientY-r.top),width:r.width};document.body.classList.add(t.no_select)});i.on("dv.draw",this.reposition.bind(this)).on("dv.datachanged",this.close.bind(this)).on("dv.destroy",this.destroy.bind(this));tt.push(this);this.updateControls()}},{key:"build",value:function(){br('.dv-label-editor{position:absolute;display:-webkit-box;display:-ms-flexbox;display:flex;width:250px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:4px 8px;margin-left:-250px;font-family:aktiv-grotesk,aktiv-grotesk-std,Arial,Helvetica,sans-serif;font-size:13px;color:#e0e0e0;letter-spacing:0;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;background-color:#404040;-webkit-transform-origin:right;-ms-transform-origin:right;transform-origin:right;-webkit-animation:a .3s;animation:a .3s}.dv-label-editor.dv-editor-closing{-webkit-animation:b .3s;animation:b .3s}.dv-label-editor p{margin:0;line-height:1.65}.dv-label-editor label,.dv-label-editor select{font-size:12px}.dv-label-editor select,.dv-label-editor textarea{color:#e0e0e0;background-color:#404040;border:0}.dv-label-editor select:focus,.dv-label-editor textarea:focus{outline:none}.dv-label-editor textarea{padding:4px 0;line-height:1.4;-webkit-box-shadow:0 2px 0 #bbb;box-shadow:0 2px 0 #bbb}.dv-label-editor textarea:focus{-webkit-box-shadow:0 2px 0 #009d4e;box-shadow:0 2px 0 #009d4e}.dv-label-editor select{max-width:210px;height:20px;margin:0 -4px;border-bottom:2px solid transparent;-webkit-box-shadow:0 6px 0 -4px #bbb;box-shadow:0 6px 0 -4px #bbb}.dv-label-editor select:focus{outline:none;-webkit-box-shadow:0 0 0 1px #009d4e;box-shadow:0 0 0 1px #009d4e}.dv-label-editor .dv-editor-label-position{height:17px;margin-top:1px;margin-left:1px}.dv-editor-row{-ms-flex-wrap:wrap;flex-wrap:wrap}.dv-editor-column,.dv-editor-row{display:-webkit-box;display:-ms-flexbox;display:flex}.dv-editor-column{margin:8px 12px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.dv-smallcaps{font-size:11px;color:#e0e0e0;text-transform:uppercase;letter-spacing:.1em}.dv-editor-line{width:100%}.dv-editor-point-value{color:#009d4e}.dv-editor-point-options label,.dv-editor-point-options select{float:left}.dv-editor-point-options label{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.dv-editor-point-options input[type=checkbox]{margin:0 6px 0 0}.dv-editor-annotation-row,.dv-editor-annotation-row .dv-editor-column,.dv-editor-annotation-row textarea{-webkit-box-flex:1;-ms-flex:1;flex:1}.dv-editor-annotation-row .dv-editor-column{display:-webkit-box;display:-ms-flexbox;display:flex}.dv-annotation-chars{margin-top:3px;font-size:11px}.dv-selected-point{width:7px;height:7px;border:3px solid #e4f2e1;border-radius:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.dv-label-handle,.dv-selected-point{position:absolute;-webkit-box-sizing:content-box;box-sizing:content-box}.dv-label-handle{display:none;padding:4px;margin:-4px;cursor:move;border-radius:3px}.dv-label-handle:hover{background-color:rgba(0,0,0,.1)}.dv-editor-close{position:absolute;top:8px;right:8px;width:18px;height:18px;padding:0;background-color:transparent;border:0}.dv-editor-close:after,.dv-editor-close:before{position:absolute;display:block;width:18px;height:2px;content:"";background-color:#009d4e}.dv-editor-close:before{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.dv-editor-close:after{-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.dv-no-select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@-webkit-keyframes a{0%{opacity:0;-webkit-transform:perspective(1000px) rotateY(-90deg);transform:perspective(1000px) rotateY(-90deg)}to{opacity:1;-webkit-transform:perspective(1000px) rotateY(0deg);transform:perspective(1000px) rotateY(0deg)}}@keyframes a{0%{opacity:0;-webkit-transform:perspective(1000px) rotateY(-90deg);transform:perspective(1000px) rotateY(-90deg)}to{opacity:1;-webkit-transform:perspective(1000px) rotateY(0deg);transform:perspective(1000px) rotateY(0deg)}}@-webkit-keyframes b{0%{opacity:1;-webkit-transform:perspective(1000px) rotateY(0deg);transform:perspective(1000px) rotateY(0deg)}to{opacity:0;-webkit-transform:perspective(1000px) rotateY(-90deg);transform:perspective(1000px) rotateY(-90deg)}}@keyframes b{0%{opacity:1;-webkit-transform:perspective(1000px) rotateY(0deg);transform:perspective(1000px) rotateY(0deg)}to{opacity:0;-webkit-transform:perspective(1000px) rotateY(-90deg);transform:perspective(1000px) rotateY(-90deg)}}');this.container=document.createElement("div");var n=this.container;n.className=t.label_editor;n.innerHTML='\n
\n