text: (window.webpackJsonp=window.webpackJsonp||[]).push([[15],{1070:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTextDimension=i,t.getTextWidth=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"14px Roboto";return i({text:e,style:{font:t}}).width},t.computeMaxFontSize=function(e){var t=e.text,r=e.idealFontSize,n=e.maxWidth,o=e.maxHeight,l=e.className,u=e.style,d=e.container,s=r;if(!a(r)){if(!a(o))throw new Error("You must specify at least one of maxHeight or idealFontSize");s=Math.floor(o)}function c(e){return i({text:t,className:l,style:Object.assign({},u,{fontSize:e}),container:d})}var f=c(s);if(a(n))for(;f.width>n;)f=c(s-=1);if(a(o))for(;f.height>o;)f=c(s-=1);return s};var n="http://www.w3.org/2000/svg";function a(e){return null!=e}function i(e){var t=e.text,r=e.className,i=e.style,o=e.container,l=void 0===o?document.body:o,u=document.createElementNS(n,"text");u.textContent=t,a(r)&&u.setAttribute("class",r),a(i)&&["font","fontWeight","fontStyle","fontSize","fontFamily","letterSpacing"].filter((function(e){return a(i[e])})).forEach((function(e){u.style[e]=i[e]}));var d=document.createElementNS(n,"svg");d.style.position="absolute",d.style.opacity=0,d.appendChild(u),l.appendChild(d);var s=void 0;if(u.getBBox){var c=u.getBBox();s={width:Math.ceil(c.width),height:Math.ceil(c.height)}}else s={width:100,height:100};return l.removeChild(d),s}},2826:function(e,t,r){},661:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(n=(o=l.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{!n&&l.return&&l.return()}finally{if(a)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=h(r(1)),o=h(r(0)),l=h(r(13)),u=r(3290),d=r(244),s=r(31),c=r(52),f=r(1070);function h(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}r(2826);var b={top:4,right:4,bottom:4,left:4},y=.6,g=.2,v=.5,w=.2,x=.3;function _(e){return function(t){var r=t.datum,n=r.x,a=r.y,o=(0,c.formatDateVerbose)(n),l=e(a);return i.default.createElement("div",{style:{padding:"4px 8px"}},o,i.default.createElement("br",null),i.default.createElement("strong",null,l))}}function N(e){return e}var C={className:o.default.string,width:o.default.number.isRequired,height:o.default.number.isRequired,bigNumber:o.default.number.isRequired,formatBigNumber:o.default.func,subheader:o.default.string,showTrendline:o.default.bool,startYAxisAtZero:o.default.bool,trendlineData:o.default.array,mainColor:o.default.string,gradientId:o.default.string,renderTooltip:o.default.func},E={className:"",formatBigNumber:N,subheader:"",showTrendline:!1,startYAxisAtZero:!0,trendlineData:null,mainColor:d.brandColor,gradientId:"",renderTooltip:_(N)},S=function(e){function t(){return m(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"getClassName",value:function(){var e=this.props,t="big_number "+e.className;return e.showTrendline?t:t+" no_trendline"}},{key:"createTemporaryContainer",value:function(){var e=document.createElement("div");return e.className=this.getClassName(),e.style.position="absolute",e.style.opacity=0,e}},{key:"renderHeader",value:function(e){var t=this.props,r=t.bigNumber,n=t.formatBigNumber,a=t.width,o=n(r),l=this.createTemporaryContainer();document.body.appendChild(l);var u=(0,f.computeMaxFontSize)({text:o,maxWidth:a,maxHeight:e,className:"header_line",container:l});return document.body.removeChild(l),i.default.createElement("div",{className:"header_line",style:{fontSize:u,height:e}},i.default.createElement("span",null,o))}},{key:"renderSubheader",value:function(e){var t=this.props,r=t.subheader,n=t.width,a=0;if(r){var o=this.createTemporaryContainer();document.body.appendChild(o),a=(0,f.computeMaxFontSize)({text:r,maxWidth:n,maxHeight:e,className:"subheader_line",container:o}),document.body.removeChild(o)}return i.default.createElement("div",{className:"subheader_line",style:{fontSize:a,height:e}},r)}},{key:"renderTrendline",value:function(e){var t=this.props,r=t.width,n=t.trendlineData,a=t.mainColor,o=t.subheader,l=t.renderTooltip,d=t.gradientId,s=t.startYAxisAtZero;return i.default.createElement(u.XYChart,{ariaLabel:"Big number visualization "+o,xScale:{type:"timeUtc"},yScale:{type:"linear",includeZero:s},width:r,height:e,margin:b,renderTooltip:l,snapTooltipToDataX:!0},i.default.createElement(u.LinearGradient,{id:d,from:a,to:"#fff"}),i.default.createElement(u.AreaSeries,{data:n,fill:"url(#"+d+")",stroke:a}),i.default.createElement(u.CrossHair,{stroke:a,circleFill:a,circleStroke:"#fff",showHorizontalLine:!1,fullHeight:!0,strokeDasharray:"5,2"}))}},{key:"render",value:function(){var e=this.props,t=e.showTrendline,r=e.height,n=this.getClassName();if(t){var a=Math.floor(x*r),o=r-a;return i.default.createElement("div",{className:n},i.default.createElement("div",{className:"text_container",style:{height:o}},this.renderHeader(Math.ceil(v*r)),this.renderSubheader(Math.ceil(w*r))),this.renderTrendline(a))}return i.default.createElement("div",{className:n,style:{height:r}},this.renderHeader(Math.ceil(y*r)),this.renderSubheader(Math.ceil(g*r)))}}]),t}(i.default.Component);S.propTypes=C,S.defaultProps=E,t.default=function(e,t){var r=e.formData,a=e.containerId,o=t.data,u=o.data,c=o.subheader,f=o.compare_suffix,h=Number(t.data.compare_lag),m="big_number"===r.viz_type,p=m&&r.show_trend_line,b=r.start_y_axis_at_zero,y=(0,s.d3FormatPreset)(r.y_axis_format),g=m?u[u.length-1][1]:u[0][0],v=0,w=c;if(m&&h>0){var x=u.length-(h+1);if(x>=0){var N=u[x][1];v=0===N?0:(g-N)/Math.abs(N),w=d3.format("+.1%")(v)+" "+f}}var C=p?u.map((function(e){var t=n(e,2);return{x:t[0],y:t[1]}})):null,E="";v>0?E="positive":v<0&&(E="negative"),l.default.render(i.default.createElement(S,{className:E,width:e.width(),height:e.height(),bigNumber:g,formatBigNumber:y,subheader:w,showTrendline:p,startYAxisAtZero:b,trendlineData:C,mainColor:d.brandColor,gradientId:"big_number_"+a,renderTooltip:_(y)}),document.getElementById(a))}}}]);