mirror of
https://github.com/flarum/framework.git
synced 2024-12-14 16:13:50 +08:00
2 lines
57 KiB
JavaScript
2 lines
57 KiB
JavaScript
module.exports=function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=50)}([function(t,e){var i=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=i)},function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e,i){t.exports=!i(5)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,i){var s=i(4);t.exports=function(t){if(!s(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=flarum.core.compat["utils/abbreviateNumber"]},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var s=i(29),n=i(13);t.exports=Object.keys||function(t){return s(t,n)}},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){var s=i(30),n=i(7);t.exports=function(t){return s(n(t))}},function(t,e){var i=Math.ceil,s=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?s:i)(t)}},function(t,e,i){var s=i(35)("keys"),n=i(37);t.exports=function(t){return s[t]||(s[t]=n(t))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,i){var s=i(1),n=i(0),a=i(39),r=i(41),o=i(9),l=function(t,e,i){var h,c,d,u=t&l.F,p=t&l.G,f=t&l.S,m=t&l.P,g=t&l.B,y=t&l.W,b=p?n:n[e]||(n[e]={}),x=b.prototype,v=p?s:f?s[e]:(s[e]||{}).prototype;for(h in p&&(i=e),i)(c=!u&&v&&void 0!==v[h])&&o(b,h)||(d=c?v[h]:i[h],b[h]=p&&"function"!=typeof v[h]?i[h]:g&&c?a(d,s):y&&v[h]==d?function(t){var e=function(e,i,s){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,s)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(d):m&&"function"==typeof d?a(Function.call,d):d,m&&((b.virtual||(b.virtual={}))[h]=d,t&l.R&&x&&!x[h]&&r(x,h,d)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,t.exports=l},function(t,e,i){var s=i(3),n=i(42),a=i(43),r=Object.defineProperty;e.f=i(2)?Object.defineProperty:function(t,e,i){if(s(t),e=a(e,!0),s(i),n)try{return r(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var s=i(4),n=i(1).document,a=s(n)&&s(n.createElement);t.exports=function(t){return a?n.createElement(t):{}}},function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat["components/DashboardPage"]},function(t,e,i){t.exports=i(26)},function(t,e,i){t.exports=i(45)},function(t,e){t.exports=flarum.core.compat["components/DashboardWidget"]},function(t,e){t.exports=flarum.core.compat["components/SelectDropdown"]},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e,i){i(27),t.exports=i(0).Object.keys},function(t,e,i){var s=i(28),n=i(8);i(38)("keys",function(){return function(t){return n(s(t))}})},function(t,e,i){var s=i(7);t.exports=function(t){return Object(s(t))}},function(t,e,i){var s=i(9),n=i(10),a=i(32)(!1),r=i(12)("IE_PROTO");t.exports=function(t,e){var i,o=n(t),l=0,h=[];for(i in o)i!=r&&s(o,i)&&h.push(i);for(;e.length>l;)s(o,i=e[l++])&&(~a(h,i)||h.push(i));return h}},function(t,e,i){var s=i(31);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==s(t)?t.split(""):Object(t)}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e,i){var s=i(10),n=i(33),a=i(34);t.exports=function(t){return function(e,i,r){var o,l=s(e),h=n(l.length),c=a(r,h);if(t&&i!=i){for(;h>c;)if((o=l[c++])!=o)return!0}else for(;h>c;c++)if((t||c in l)&&l[c]===i)return t||c||0;return!t&&-1}}},function(t,e,i){var s=i(11),n=Math.min;t.exports=function(t){return t>0?n(s(t),9007199254740991):0}},function(t,e,i){var s=i(11),n=Math.max,a=Math.min;t.exports=function(t,e){return(t=s(t))<0?n(t+e,0):a(t,e)}},function(t,e,i){var s=i(0),n=i(1),a=n["__core-js_shared__"]||(n["__core-js_shared__"]={});(t.exports=function(t,e){return a[t]||(a[t]=void 0!==e?e:{})})("versions",[]).push({version:s.version,mode:i(36)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports=!0},function(t,e){var i=0,s=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+s).toString(36))}},function(t,e,i){var s=i(14),n=i(0),a=i(5);t.exports=function(t,e){var i=(n.Object||{})[t]||Object[t],r={};r[t]=e(i),s(s.S+s.F*a(function(){i(1)}),"Object",r)}},function(t,e,i){var s=i(40);t.exports=function(t,e,i){if(s(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,s){return t.call(e,i,s)};case 3:return function(i,s,n){return t.call(e,i,s,n)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,i){var s=i(15),n=i(44);t.exports=i(2)?function(t,e,i){return s.f(t,e,n(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){t.exports=!i(2)&&!i(5)(function(){return 7!=Object.defineProperty(i(16)("div"),"a",{get:function(){return 7}}).a})},function(t,e,i){var s=i(4);t.exports=function(t,e){if(!s(t))return t;var i,n;if(e&&"function"==typeof(i=t.toString)&&!s(n=i.call(t)))return n;if("function"==typeof(i=t.valueOf)&&!s(n=i.call(t)))return n;if(!e&&"function"==typeof(i=t.toString)&&!s(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,i){i(46);var s=i(0).Object;t.exports=function(t,e){return s.create(t,e)}},function(t,e,i){var s=i(14);s(s.S,"Object",{create:i(47)})},function(t,e,i){var s=i(3),n=i(48),a=i(13),r=i(12)("IE_PROTO"),o=function(){},l=function(){var t,e=i(16)("iframe"),s=a.length;for(e.style.display="none",i(49).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),l=t.F;s--;)delete l.prototype[a[s]];return l()};t.exports=Object.create||function(t,e){var i;return null!==t?(o.prototype=s(t),i=new o,o.prototype=null,i[r]=t):i=l(),void 0===e?i:n(i,e)}},function(t,e,i){var s=i(15),n=i(3),a=i(8);t.exports=i(2)?Object.defineProperties:function(t,e){n(t);for(var i,r=a(e),o=r.length,l=0;o>l;)s.f(t,i=r[l++],e[i]);return t}},function(t,e,i){var s=i(1).document;t.exports=s&&s.documentElement},function(t,e,i){"use strict";i.r(e);var s=i(17),n=i.n(s),a=i(18),r=i(19),o=i.n(r),l=i(20),h=i.n(l),c=i(21),d=i.n(c);var u=i(22),p=i.n(u),f=i(23),g=i.n(f),y=i(24),b=i.n(y),x=i(25),v=i.n(x),w=i(6),P=i.n(w);function A(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function k(t){let e=t.getBoundingClientRect();return{top:e.top+(document.documentElement.scrollTop||document.body.scrollTop),left:e.left+(document.documentElement.scrollLeft||document.body.scrollLeft)}}A.create=((t,e)=>{var i=document.createElement(t);for(var s in e){var n=e[s];if("inside"===s)A(n).appendChild(i);else if("around"===s){var a=A(n);a.parentNode.insertBefore(i,a),i.appendChild(a)}else"styles"===s?"object"==typeof n&&Object.keys(n).map(t=>{i.style[t]=n[t]}):s in i?i[s]=n:i.setAttribute(s,n)}return i});const T={margins:{top:10,bottom:10,left:20,right:20},paddings:{top:20,bottom:40,left:30,right:10},baseHeight:240,titleHeight:20,legendHeight:30,titleFontSize:12};function C(t){return t.titleHeight+t.margins.top+t.paddings.top}function D(t){return t.margins.left+t.paddings.left}function L(t){return t.margins.top+t.margins.bottom+t.paddings.top+t.paddings.bottom+t.titleHeight+t.legendHeight}function M(t){return t.margins.left+t.margins.right+t.paddings.left+t.paddings.right}const O=700,N=400,E=["line","bar"],S=100,z=.5,$=.01,W=4,j=20,F=2,H=5,_=10,I=7,R=5,Y=["light-blue","blue","violet","red","orange","yellow","green","light-green","purple","magenta","light-grey","dark-grey"],B={bar:Y,line:Y,pie:Y,percentage:Y,heatmap:["#ebedf0","#c6e48b","#7bc96f","#239a3b","#196127"]},V=Math.PI/180,U=360;class G{constructor({parent:t=null,colors:e=[]}){this.parent=t,this.colors=e,this.titleName="",this.titleValue="",this.listValues=[],this.titleValueFirst=0,this.x=0,this.y=0,this.top=0,this.left=0,this.setup()}setup(){this.makeTooltip()}refresh(){this.fill(),this.calcPosition()}makeTooltip(){this.container=A.create("div",{inside:this.parent,className:"graph-svg-tip comparison",innerHTML:'<span class="title"></span>\n\t\t\t\t<ul class="data-point-list"></ul>\n\t\t\t\t<div class="svg-pointer"></div>'}),this.hideTip(),this.title=this.container.querySelector(".title"),this.dataPointList=this.container.querySelector(".data-point-list"),this.parent.addEventListener("mouseleave",()=>{this.hideTip()})}fill(){let t;this.index&&this.container.setAttribute("data-point-index",this.index),t=this.titleValueFirst?`<strong>${this.titleValue}</strong>${this.titleName}`:`${this.titleName}<strong>${this.titleValue}</strong>`,this.title.innerHTML=t,this.dataPointList.innerHTML="",this.listValues.map((t,e)=>{const i=this.colors[e]||"black";let s=0===t.formatted||t.formatted?t.formatted:t.value,n=A.create("li",{styles:{"border-top":`3px solid ${i}`},innerHTML:`<strong style="display: block;">${0===s||s?s:""}</strong>\n\t\t\t\t\t${t.title?t.title:""}`});this.dataPointList.appendChild(n)})}calcPosition(){let t=this.container.offsetWidth;this.top=this.y-this.container.offsetHeight-R,this.left=this.x-t/2;let e=this.parent.offsetWidth-t,i=this.container.querySelector(".svg-pointer");if(this.left<0)i.style.left=`calc(50% - ${-1*this.left}px)`,this.left=0;else if(this.left>e){let t=`calc(50% + ${this.left-e}px)`;i.style.left=t,this.left=e}else i.style.left="50%"}setValues(t,e,i={},s=[],n=-1){this.titleName=i.name,this.titleValue=i.value,this.listValues=s,this.x=t,this.y=e,this.titleValueFirst=i.valueFirst||0,this.index=n,this.refresh()}hideTip(){this.container.style.top="0px",this.container.style.left="0px",this.container.style.opacity="0"}showTip(){this.container.style.top=this.top+"px",this.container.style.left=this.left+"px",this.container.style.opacity="1"}}function q(t){return parseFloat(t.toFixed(2))}function X(t,e,i,s=!1){i||(i=s?t[0]:t[t.length-1]);let n=new Array(Math.abs(e)).fill(i);return t=s?n.concat(t):t.concat(n)}function J(t,e){return(t+"").length*e}function K(t,e){return{x:Math.sin(t*V)*e,y:Math.cos(t*V)*e}}function Q(t,e){let i,s;return t<=e?(i=e-t,s=t):(i=t-e,s=e),[i,s]}function Z(t,e,i=e.length-t.length){return i>0?t=X(t,i):e=X(e,i),[t,e]}const tt={"light-blue":"#7cd6fd",blue:"#5e64ff",violet:"#743ee2",red:"#ff5858",orange:"#ffa00a",yellow:"#feef72",green:"#28a745","light-green":"#98d85b",purple:"#b554ff",magenta:"#ffa3ef",black:"#36114C",grey:"#bdd3e6","light-grey":"#f0f4f7","dark-grey":"#b8c2cc"};function et(t){return t>255?255:t<0?0:t}function it(t,e){let i=st(t),s=!1;"#"==i[0]&&(i=i.slice(1),s=!0);let n=parseInt(i,16),a=et((n>>16)+e),r=et((n>>8&255)+e),o=et((255&n)+e);return(s?"#":"")+(o|r<<8|a<<16).toString(16)}const st=t=>tt[t]||t,nt=6,at=4,rt=10,ot="#dadada",lt="#555b51";function ht(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function ct(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg",t);for(var s in e){var n=e[s];if("inside"===s)ht(n).appendChild(i);else if("around"===s){var a=ht(n);a.parentNode.insertBefore(i,a),i.appendChild(a)}else"styles"===s?"object"==typeof n&&Object.keys(n).map(t=>{i.style[t]=n[t]}):("className"===s&&(s="class"),"innerHTML"===s?i.textContent=n:i.setAttribute(s,n))}return i}function dt(t,e,i,s){return ct("stop",{inside:t,style:`stop-color: ${i}`,offset:e,"stop-opacity":s})}function ut(t,e="",i){let s={className:t,transform:e};return i&&(s.inside=i),ct("g",s)}function pt(t,e="",i="none",s="none"){return ct("path",{className:e,d:t,styles:{stroke:i,fill:s}})}function ft(t,e,i=!1){let s="path-fill-gradient-"+e+"-"+(i?"lighter":"default"),n=function(t,e){return ct("linearGradient",{inside:t,id:e,x1:0,x2:0,y1:0,y2:1})}(t,s),a=[1,.6,.2];return i&&(a=[.4,.2,0]),dt(n,"0%",e,a[0]),dt(n,"50%",e,a[1]),dt(n,"100%",e,a[2]),s}function mt(t,e,i,s,n="none",a={}){let r={className:t,x:e,y:i,width:s,height:s,fill:n};return Object.keys(a).map(t=>{r[t]=a[t]}),ct("rect",r)}function gt(t,e,i,s,n={}){let a=n.fontSize||rt;return ct("text",{className:t,x:e,y:i,dy:(void 0!==n.dy?n.dy:a/2)+"px","font-size":a+"px",fill:n.fill||lt,"text-anchor":n.textAnchor||"start",innerHTML:s})}function yt(t,e,i,s,n={}){n.stroke||(n.stroke=ot),n.lineType||(n.lineType="");let a=ct("line",{className:"line-horizontal "+n.className+("dashed"===n.lineType?"dashed":""),x1:i,x2:s,y1:0,y2:0,styles:{stroke:n.stroke}}),r=ct("text",{x:i<s?i-at:i+at,y:0,dy:rt/2-2+"px","font-size":rt+"px","text-anchor":i<s?"end":"start",innerHTML:e+""}),o=ct("g",{transform:`translate(0, ${t})`,"stroke-opacity":1});return 0!==r&&"0"!==r||(o.style.stroke="rgba(27, 31, 35, 0.6)"),o.appendChild(a),o.appendChild(r),o}function bt(t,e,i,s={}){s.pos||(s.pos="bottom"),s.offset||(s.offset=0),s.mode||(s.mode="span"),s.stroke||(s.stroke=ot),s.className||(s.className="");let n=i+nt,a="span"===s.mode?-1*nt:i;return"tick"===s.mode&&"top"===s.pos&&(n=-1*nt,a=0),function(t,e,i,s,n={}){n.stroke||(n.stroke=ot);let a=ct("line",{className:"line-vertical "+n.className,x1:0,x2:0,y1:i,y2:s,styles:{stroke:n.stroke}}),r=ct("text",{x:0,y:i>s?i+at:i-at-rt,dy:rt+"px","font-size":rt+"px","text-anchor":"middle",innerHTML:e+""}),o=ct("g",{transform:`translate(${t}, 0)`});return o.appendChild(a),o.appendChild(r),o}(t,e,n,a,{stroke:s.stroke,className:s.className,lineType:s.lineType})}let xt={bar:t=>{let e;"rect"!==t.nodeName&&(e=t.getAttribute("transform"),t=t.childNodes[0]);let i=t.cloneNode();return i.style.fill="#000000",i.style.opacity="0.4",e&&i.setAttribute("transform",e),i},dot:t=>{let e;"circle"!==t.nodeName&&(e=t.getAttribute("transform"),t=t.childNodes[0]);let i=t.cloneNode(),s=t.getAttribute("r"),n=t.getAttribute("fill");return i.setAttribute("r",parseInt(s)+4),i.setAttribute("fill",n),i.style.opacity="0.6",e&&i.setAttribute("transform",e),i},heat_square:t=>{let e;"circle"!==t.nodeName&&(e=t.getAttribute("transform"),t=t.childNodes[0]);let i=t.cloneNode(),s=t.getAttribute("r"),n=t.getAttribute("fill");return i.setAttribute("r",parseInt(s)+4),i.setAttribute("fill",n),i.style.opacity="0.6",e&&i.setAttribute("transform",e),i}},vt={bar:(t,e)=>{let i;"rect"!==t.nodeName&&(i=t.getAttribute("transform"),t=t.childNodes[0]);let s=["x","y","width","height"];Object.values(t.attributes).filter(t=>s.includes(t.name)&&t.specified).map(t=>{e.setAttribute(t.name,t.nodeValue)}),i&&e.setAttribute("transform",i)},dot:(t,e)=>{let i;"circle"!==t.nodeName&&(i=t.getAttribute("transform"),t=t.childNodes[0]);let s=["cx","cy"];Object.values(t.attributes).filter(t=>s.includes(t.name)&&t.specified).map(t=>{e.setAttribute(t.name,t.nodeValue)}),i&&e.setAttribute("transform",i)},heat_square:(t,e)=>{let i;"circle"!==t.nodeName&&(i=t.getAttribute("transform"),t=t.childNodes[0]);let s=["cx","cy"];Object.values(t.attributes).filter(t=>s.includes(t.name)&&t.specified).map(t=>{e.setAttribute(t.name,t.nodeValue)}),i&&e.setAttribute("transform",i)}};const wt=350,Pt=350,At=wt,kt=250,Tt="easein";function Ct(t,e,i,s){let n="string"==typeof e?e:e.join(", ");return[t,{transform:i.join(", ")},s,Tt,"translate",{transform:n}]}function Dt(t,e,i){return Ct(t,[0,i],[0,e],At)}const Lt={ease:"0.25 0.1 0.25 1",linear:"0 0 1 1",easein:"0.1 0.8 0.2 1",easeout:"0 0 0.58 1",easeinout:"0.42 0 0.58 1"};function Mt(t,e){t.style.transform=e,t.style.webkitTransform=e,t.style.msTransform=e,t.style.mozTransform=e,t.style.oTransform=e}function Ot(t,e){let i=[],s=[];e.map(t=>{let e,n,a=t[0],r=a.parentNode;t[0]=a,[e,n]=function(t,e,i,s="linear",n,a={}){let r=t.cloneNode(!0),o=t.cloneNode(!0);for(var l in e){let c;c="transform"===l?document.createElementNS("http://www.w3.org/2000/svg","animateTransform"):document.createElementNS("http://www.w3.org/2000/svg","animate");let d=a[l]||t.getAttribute(l),u=e[l],p={attributeName:l,from:d,to:u,begin:"0s",dur:i/1e3+"s",values:d+";"+u,keySplines:Lt[s],keyTimes:"0;1",calcMode:"spline",fill:"freeze"};for(var h in n&&(p.type=n),p)c.setAttribute(h,p[h]);r.appendChild(c),n?o.setAttribute(l,`translate(${u})`):o.setAttribute(l,u)}return[r,o]}(...t),i.push(n),s.push([e,r]),r.replaceChild(e,a)});let n=t.cloneNode(!0);return s.map((t,s)=>{t[1].replaceChild(i[s],t[0]),e[s][0]=i[s]}),n}const Nt=".chart-container{position:relative;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Roboto','Oxygen','Ubuntu','Cantarell','Fira Sans','Droid Sans','Helvetica Neue',sans-serif}.chart-container .axis,.chart-container .chart-label{fill:#555b51}.chart-container .axis line,.chart-container .chart-label line{stroke:#dadada}.chart-container .dataset-units circle{stroke:#fff;stroke-width:2}.chart-container .dataset-units path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container .dataset-path{stroke-width:2px}.chart-container .path-group path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container line.dashed{stroke-dasharray:5,3}.chart-container .axis-line .specific-value{text-anchor:start}.chart-container .axis-line .y-line{text-anchor:end}.chart-container .axis-line .x-line{text-anchor:middle}.chart-container .legend-dataset-text{fill:#6c7680;font-weight:600}.graph-svg-tip{position:absolute;z-index:99999;padding:10px;font-size:12px;color:#959da5;text-align:center;background:rgba(0,0,0,.8);border-radius:3px}.graph-svg-tip ul{padding-left:0;display:flex}.graph-svg-tip ol{padding-left:0;display:flex}.graph-svg-tip ul.data-point-list li{min-width:90px;flex:1;font-weight:600}.graph-svg-tip strong{color:#dfe2e5;font-weight:600}.graph-svg-tip .svg-pointer{position:absolute;height:5px;margin:0 0 0 -5px;content:' ';border:5px solid transparent;border-top-color:rgba(0,0,0,.8)}.graph-svg-tip.comparison{padding:0;text-align:left;pointer-events:none}.graph-svg-tip.comparison .title{display:block;padding:10px;margin:0;font-weight:600;line-height:1;pointer-events:none}.graph-svg-tip.comparison ul{margin:0;white-space:nowrap;list-style:none}.graph-svg-tip.comparison li{display:inline-block;padding:5px 10px}";let Et;class St{constructor(t,e){if(this.parent="string"==typeof t?document.querySelector(t):t,!(this.parent instanceof HTMLElement))throw new Error("No `parent` element to render on was provided.");this.rawChartArgs=e,this.title=e.title||"",this.type=e.type||"",this.realData=this.prepareData(e.data),this.data=this.prepareFirstData(this.realData),this.colors=this.validateColors(e.colors,this.type),this.config={showTooltip:1,showLegend:1,isNavigable:e.isNavigable||0,animate:1},this.measures=JSON.parse(JSON.stringify(T));let i=this.measures;this.setMeasures(e),this.title.length||(i.titleHeight=0),this.config.showLegend||(i.legendHeight=0),this.argHeight=e.height||i.baseHeight,this.state={},this.options={},this.initTimeout=O,this.config.isNavigable&&(this.overlays=[]),this.configure(e)}prepareData(t){return t}prepareFirstData(t){return t}validateColors(t,e){const i=[];return(t=(t||[]).concat(B[e])).forEach(t=>{const e=st(t);!function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}(e)?console.warn('"'+t+'" is not a valid color.'):i.push(e)}),i}setMeasures(){}configure(){let t=this.argHeight;this.baseHeight=t,this.height=t-L(this.measures),Et=this.boundDrawFn.bind(this),window.addEventListener("resize",Et),window.addEventListener("orientationchange",this.boundDrawFn.bind(this))}boundDrawFn(){this.draw(!0)}unbindWindowEvents(){window.removeEventListener("resize",Et),window.removeEventListener("orientationchange",this.boundDrawFn.bind(this))}setup(){this.makeContainer(),this.updateWidth(),this.makeTooltip(),this.draw(!1,!0)}makeContainer(){this.parent.innerHTML="";let t={inside:this.parent,className:"chart-container"};this.independentWidth&&(t.styles={width:this.independentWidth+"px"}),this.container=A.create("div",t)}makeTooltip(){this.tip=new G({parent:this.container,colors:this.colors}),this.bindTooltip()}bindTooltip(){}draw(t=!1,e=!1){this.updateWidth(),this.calc(t),this.makeChartArea(),this.setupComponents(),this.components.forEach(t=>t.setup(this.drawArea)),this.render(this.components,!1),e&&(this.data=this.realData,setTimeout(()=>{this.update(this.data)},this.initTimeout)),this.renderLegend(),this.setupNavigation(e)}calc(){}updateWidth(){this.baseWidth=function(t){var e=window.getComputedStyle(t),i=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight);return t.clientWidth-i}(this.parent),this.width=this.baseWidth-M(this.measures)}makeChartArea(){this.svg&&this.container.removeChild(this.svg);let t=this.measures;this.svg=function(t,e,i,s){return ct("svg",{className:e,inside:t,width:i,height:s})}(this.container,"frappe-chart chart",this.baseWidth,this.baseHeight),this.svgDefs=function(t){return ct("defs",{inside:t})}(this.svg),this.title.length&&(this.titleEL=gt("title",t.margins.left,t.margins.top,this.title,{fontSize:t.titleFontSize,fill:"#666666",dy:t.titleFontSize}));let e=C(t);this.drawArea=ut(this.type+"-chart chart-draw-area",`translate(${D(t)}, ${e})`),this.config.showLegend&&(e+=this.height+t.paddings.bottom,this.legendArea=ut("chart-legend",`translate(${D(t)}, ${e})`)),this.title.length&&this.svg.appendChild(this.titleEL),this.svg.appendChild(this.drawArea),this.config.showLegend&&this.svg.appendChild(this.legendArea),this.updateTipOffset(D(t),C(t))}updateTipOffset(t,e){this.tip.offset={x:t,y:e}}setupComponents(){this.components=new Map}update(t){t||console.error("No data to update."),this.data=this.prepareData(t),this.calc(),this.render()}render(t=this.components,e=!0){this.config.isNavigable&&this.overlays.map(t=>t.parentNode.removeChild(t));let i=[];t.forEach(t=>{i=i.concat(t.update(e))}),i.length>0?(!function(t,e,i){if(0===i.length)return;let s=Ot(e,i);e.parentNode==t&&(t.removeChild(e),t.appendChild(s)),setTimeout(()=>{s.parentNode==t&&(t.removeChild(s),t.appendChild(e))},kt)}(this.container,this.svg,i),setTimeout(()=>{t.forEach(t=>t.make()),this.updateNav()},N)):(t.forEach(t=>t.make()),this.updateNav())}updateNav(){this.config.isNavigable&&(this.makeOverlay(),this.bindUnits())}renderLegend(){}setupNavigation(t=!1){this.config.isNavigable&&t&&(this.bindOverlay(),this.keyActions={13:this.onEnterKey.bind(this),37:this.onLeftArrow.bind(this),38:this.onUpArrow.bind(this),39:this.onRightArrow.bind(this),40:this.onDownArrow.bind(this)},document.addEventListener("keydown",t=>{(function(t){var e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)})(this.container)&&(t=t||window.event,this.keyActions[t.keyCode]&&this.keyActions[t.keyCode]())}))}makeOverlay(){}updateOverlay(){}bindOverlay(){}bindUnits(){}onLeftArrow(){}onRightArrow(){}onUpArrow(){}onDownArrow(){}onEnterKey(){}addDataPoint(){}removeDataPoint(){}getDataPoint(){}setCurrentDataPoint(){}updateDataset(){}export(){let t=function(t){let e=t.cloneNode(!0);e.classList.add("chart-container"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");let i=A.create("style",{innerHTML:Nt});e.insertBefore(i,e.firstChild);let s=A.create("div");return s.appendChild(e),s.innerHTML}(this.svg);!function(t,e){var i=document.createElement("a");i.style="display: none";var s=new Blob(e,{type:"image/svg+xml; charset=utf-8"}),n=window.URL.createObjectURL(s);i.href=n,i.download=t,document.body.appendChild(i),i.click(),setTimeout(function(){document.body.removeChild(i),window.URL.revokeObjectURL(n)},300)}(this.title||"Chart",[t])}}class zt extends St{constructor(t,e){super(t,e)}configure(t){super.configure(t),this.config.maxSlices=t.maxSlices||20,this.config.maxLegendPoints=t.maxLegendPoints||20}calc(){let t=this.state,e=this.config.maxSlices;t.sliceTotals=[];let i=this.data.labels.map((t,e)=>{let i=0;return this.data.datasets.map(t=>{i+=t.values[e]}),[i,t]}).filter(t=>t[0]>=0),s=i;if(i.length>e){i.sort((t,e)=>e[0]-t[0]),s=i.slice(0,e-1);let t=0;i.slice(e-1).map(e=>{t+=e[0]}),s.push([t,"Rest"]),this.colors[e-1]="grey"}t.labels=[],s.map(e=>{t.sliceTotals.push(e[0]),t.labels.push(e[1])}),t.grandTotal=t.sliceTotals.reduce((t,e)=>t+e,0),this.center={x:this.width/2,y:this.height/2}}renderLegend(){let t=this.state;this.legendArea.textContent="",this.legendTotals=t.sliceTotals.slice(0,this.config.maxLegendPoints);let e=0,i=0;this.legendTotals.map((s,n)=>{let a=Math.floor((this.width-M(this.measures))/110);e>a&&(e=0,i+=20);let r=function(t,e,i,s="none",n){let a={className:"legend-dot",cx:0,cy:0,r:i,fill:s},r=ct("text",{className:"legend-dataset-text",x:0,y:0,dx:rt+"px",dy:rt/3+"px","font-size":1.2*rt+"px","text-anchor":"start",fill:lt,innerHTML:n}),o=ct("g",{transform:`translate(${t}, ${e})`});return o.appendChild(ct("circle",a)),o.appendChild(r),o}(110*e+5,i,5,this.colors[n],`${t.labels[n]}: ${s}`);this.legendArea.appendChild(r),e++})}}const $t=12,Wt=7,jt=1e3,Ft=86400,Ht=["January","February","March","April","May","June","July","August","September","October","November","December"],_t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function It(t){let e=new Date(t);return e.setMinutes(e.getMinutes()-e.getTimezoneOffset()),e}function Rt(t){let e=t.getDate(),i=t.getMonth()+1;return[t.getFullYear(),(i>9?"":"0")+i,(e>9?"":"0")+e].join("-")}function Yt(t){return new Date(t.getTime())}function Bt(t,e){let i=qt(t);return Math.ceil(function(t,e){let i=Ft*jt;return(It(e)-It(t))/i}(i,e)/Wt)}function Vt(t,e){return t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}function Ut(t,e=!1){let i=Ht[t];return e?i.slice(0,3):i}function Gt(t,e){return new Date(e,t+1,0)}function qt(t){let e=Yt(t);const i=e.getDay();return 0!==i&&Xt(e,-1*i),e}function Xt(t,e){t.setDate(t.getDate()+e)}class Jt{constructor({layerClass:t="",layerTransform:e="",constants:i,getData:s,makeElements:n,animateElements:a}){this.layerTransform=e,this.constants=i,this.makeElements=n,this.getData=s,this.animateElements=a,this.store=[],this.labels=[],this.layerClass=t,this.layerClass="function"==typeof this.layerClass?this.layerClass():this.layerClass,this.refresh()}refresh(t){this.data=t||this.getData()}setup(t){this.layer=ut(this.layerClass,this.layerTransform,t)}make(){this.render(this.data),this.oldData=this.data}render(t){this.store=this.makeElements(t),this.layer.textContent="",this.store.forEach(t=>{this.layer.appendChild(t)}),this.labels.forEach(t=>{this.layer.appendChild(t)})}update(t=!0){this.refresh();let e=[];return t&&(e=this.animateElements(this.data)||[]),e}}let Kt={pieSlices:{layerClass:"pie-slices",makeElements:t=>t.sliceStrings.map((e,i)=>{let s=pt(e,"pie-path","none",t.colors[i]);return s.style.transition="transform .3s;",s}),animateElements(t){return this.store.map((e,i)=>(function(t,e){return[t,{d:e},wt,Tt]})(e,t.sliceStrings[i]))}},percentageBars:{layerClass:"percentage-bars",makeElements(t){return t.xPositions.map((e,i)=>{return function(t,e,i,s,n=F,a="none"){return ct("rect",{className:"percentage-bar",x:t,y:e,width:i,height:s,fill:a,styles:{stroke:it(a,-25),"stroke-dasharray":`0, ${s+i}, ${i}, ${s}`,"stroke-width":n}})}(e,0,t.widths[i],this.constants.barHeight,this.constants.barDepth,t.colors[i])})},animateElements(t){if(t)return[]}},yAxis:{layerClass:"y axis",makeElements(t){return t.positions.map((e,i)=>(function(t,e,i,s={}){s.pos||(s.pos="left"),s.offset||(s.offset=0),s.mode||(s.mode="span"),s.stroke||(s.stroke=ot),s.className||(s.className="");let n=-1*nt,a="span"===s.mode?i+nt:0;return"tick"===s.mode&&"right"===s.pos&&(n=i+nt,a=i),yt(t,e,n+=s.offset,a+=s.offset,{stroke:s.stroke,className:s.className,lineType:s.lineType})})(e,t.labels[i],this.constants.width,{mode:this.constants.mode,pos:this.constants.pos}))},animateElements(t){let e=t.positions,i=t.labels,s=this.oldData.positions,n=this.oldData.labels;return[s,e]=Z(s,e),[n,i]=Z(n,i),this.render({positions:s,labels:i}),this.store.map((t,i)=>Dt(t,e[i],s[i]))}},xAxis:{layerClass:"x axis",makeElements(t){return t.positions.map((e,i)=>bt(e,t.calcLabels[i],this.constants.height,{mode:this.constants.mode,pos:this.constants.pos}))},animateElements(t){let e=t.positions,i=t.calcLabels,s=this.oldData.positions,n=this.oldData.calcLabels;return[s,e]=Z(s,e),[n,i]=Z(n,i),this.render({positions:s,calcLabels:i}),this.store.map((t,i)=>(function(t,e,i){return Ct(t,[i,0],[e,0],At)})(t,e[i],s[i]))}},yMarkers:{layerClass:"y-markers",makeElements(t){return t.map(t=>(function(t,e,i,s={}){s.labelPos||(s.labelPos="right");let n=ct("text",{className:"chart-label",x:"left"===s.labelPos?at:i-J(e,5)-at,y:0,dy:rt/-2+"px","font-size":rt+"px","text-anchor":"start",innerHTML:e+""}),a=yt(t,"",0,i,{stroke:s.stroke||ot,className:s.className||"",lineType:s.lineType});return a.appendChild(n),a})(t.position,t.label,this.constants.width,{labelPos:t.options.labelPos,mode:"span",lineType:"dashed"}))},animateElements(t){[this.oldData,t]=Z(this.oldData,t);let e=t.map(t=>t.position),i=t.map(t=>t.label),s=t.map(t=>t.options),n=this.oldData.map(t=>t.position);return this.render(n.map((t,e)=>({position:n[e],label:i[e],options:s[e]}))),this.store.map((t,i)=>Dt(t,e[i],n[i]))}},yRegions:{layerClass:"y-regions",makeElements(t){return t.map(t=>(function(t,e,i,s,n={}){let a=t-e,r=ct("rect",{className:"bar mini",styles:{fill:"rgba(228, 234, 239, 0.49)",stroke:ot,"stroke-dasharray":`${i}, ${a}`},x:0,y:0,width:i,height:a});n.labelPos||(n.labelPos="right");let o=ct("text",{className:"chart-label",x:"left"===n.labelPos?at:i-J(s+"",4.5)-at,y:0,dy:rt/-2+"px","font-size":rt+"px","text-anchor":"start",innerHTML:s+""}),l=ct("g",{transform:`translate(0, ${e})`});return l.appendChild(r),l.appendChild(o),l})(t.startPos,t.endPos,this.constants.width,t.label,{labelPos:t.options.labelPos}))},animateElements(t){[this.oldData,t]=Z(this.oldData,t);let e=t.map(t=>t.endPos),i=t.map(t=>t.label),s=t.map(t=>t.startPos),n=t.map(t=>t.options),a=this.oldData.map(t=>t.endPos),r=this.oldData.map(t=>t.startPos);this.render(a.map((t,e)=>({startPos:r[e],endPos:a[e],label:i[e],options:n[e]})));let o=[];return this.store.map((t,i)=>{o=o.concat(function(t,e,i,s){let n=e-i,a=t.childNodes[0];return[[a,{height:n,"stroke-dasharray":`${a.getAttribute("width")}, ${n}`},At,Tt],Ct(t,[0,s],[0,i],At)]}(t,s[i],e[i],a[i]))}),o}},heatDomain:{layerClass:function(){return"heat-domain domain-"+this.constants.index},makeElements(t){let{index:e,colWidth:i,rowHeight:s,squareSize:n,xTranslate:a}=this.constants,r=a,o=0;return this.serializedSubDomains=[],t.cols.map((t,a)=>{1===a&&this.labels.push(gt("domain-name",r,-12,Ut(e,!0).toUpperCase(),{fontSize:9})),t.map((t,e)=>{if(t.fill){let i={"data-date":t.yyyyMmDd,"data-value":t.dataValue,"data-day":e},s=mt("day",r,o,n,t.fill,i);this.serializedSubDomains.push(s)}o+=s}),o=0,r+=i}),this.serializedSubDomains},animateElements(t){if(t)return[]}},barGraph:{layerClass:function(){return"dataset-units dataset-bars dataset-"+this.constants.index},makeElements(t){let e=this.constants;return this.unitType="bar",this.units=t.yPositions.map((i,s)=>(function(t,e,i,s,n="",a=0,r=0,o={}){let[l,h]=Q(e,o.zeroLine);h-=r,0===l&&(l=o.minHeight,h-=o.minHeight);let c=ct("rect",{className:"bar mini",style:`fill: ${s}`,"data-point-index":a,x:t,y:h,width:i,height:l});if((n+="")||n.length){c.setAttribute("y",0),c.setAttribute("x",0);let e=ct("text",{className:"data-point-value",x:i/2,y:0,dy:rt/2*-1+"px","font-size":rt+"px","text-anchor":"middle",innerHTML:n}),s=ct("g",{"data-point-index":a,transform:`translate(${t}, ${h})`});return s.appendChild(c),s.appendChild(e),s}return c})(t.xPositions[s],i,t.barWidth,e.color,t.labels[s],s,t.offsets[s],{zeroLine:t.zeroLine,barsWidth:t.barsWidth,minHeight:e.minHeight})),this.units},animateElements(t){let e=t.xPositions,i=t.yPositions,s=t.offsets,n=t.labels,a=this.oldData.xPositions,r=this.oldData.yPositions,o=this.oldData.offsets,l=this.oldData.labels;[a,e]=Z(a,e),[r,i]=Z(r,i),[o,s]=Z(o,s),[l,n]=Z(l,n),this.render({xPositions:a,yPositions:r,offsets:o,labels:n,zeroLine:this.oldData.zeroLine,barsWidth:this.oldData.barsWidth,barWidth:this.oldData.barWidth});let h=[];return this.store.map((n,a)=>{h=h.concat(function(t,e,i,s,n=0,a={}){let[r,o]=Q(i,a.zeroLine);if(o-=n,"rect"!==t.nodeName)return[[t.childNodes[0],{width:s,height:r},wt,Tt],Ct(t,t.getAttribute("transform").split("(")[1].slice(0,-1),[e,o],At)];return[[t,{width:s,height:r,x:e,y:o},wt,Tt]]}(n,e[a],i[a],t.barWidth,s[a],{zeroLine:t.zeroLine}))}),h}},lineGraph:{layerClass:function(){return"dataset-units dataset-line dataset-"+this.constants.index},makeElements(t){let e=this.constants;return this.unitType="dot",this.paths={},e.hideLine||(this.paths=function(t,e,i,s={},n={}){let a=e.map((e,i)=>t[i]+","+e).join("L"),r=pt("M"+a,"line-graph-path",i);if(s.heatline){let t=ft(n.svgDefs,i);r.style.stroke=`url(#${t})`}let o={path:r};if(s.regionFill){let e=ft(n.svgDefs,i,!0),s="M"+`${t[0]},${n.zeroLine}L`+a+`L${t.slice(-1)[0]},${n.zeroLine}`;o.region=pt(s,"region-fill","none",`url(#${e})`)}return o}(t.xPositions,t.yPositions,e.color,{heatline:e.heatline,regionFill:e.regionFill},{svgDefs:e.svgDefs,zeroLine:t.zeroLine})),this.units=[],e.hideDots||(this.units=t.yPositions.map((i,s)=>(function(t,e,i,s,n="",a=0){let r=ct("circle",{style:`fill: ${s}`,"data-point-index":a,cx:t,cy:e,r:i});if((n+="")||n.length){r.setAttribute("cy",0),r.setAttribute("cx",0);let s=ct("text",{className:"data-point-value",x:0,y:0,dy:rt/2*-1-i+"px","font-size":rt+"px","text-anchor":"middle",innerHTML:n}),o=ct("g",{"data-point-index":a,transform:`translate(${t}, ${e})`});return o.appendChild(r),o.appendChild(s),o}return r})(t.xPositions[s],i,t.radius,e.color,e.valuesOverPoints?t.values[s]:"",s))),Object.values(this.paths).concat(this.units)},animateElements(t){let e=t.xPositions,i=t.yPositions,s=t.values,n=this.oldData.xPositions,a=this.oldData.yPositions,r=this.oldData.values;[n,e]=Z(n,e),[a,i]=Z(a,i),[r,s]=Z(r,s),this.render({xPositions:n,yPositions:a,values:s,zeroLine:this.oldData.zeroLine,radius:this.oldData.radius});let o=[];return Object.keys(this.paths).length&&(o=o.concat(function(t,e,i,s){let n=[],a=i.map((t,i)=>e[i]+","+t).join("L");const r=[t.path,{d:"M"+a},Pt,Tt];if(n.push(r),t.region){let i=`${e[0]},${s}L`,r=`L${e.slice(-1)[0]}, ${s}`;const o=[t.region,{d:"M"+i+a+r},Pt,Tt];n.push(o)}return n}(this.paths,e,i,t.zeroLine))),this.units.length&&this.units.map((t,s)=>{o=o.concat(function(t,e,i){if("circle"!==t.nodeName)return[Ct(t,t.getAttribute("transform").split("(")[1].slice(0,-1),[e,i],At)];return[[t,{cx:e,cy:i},wt,Tt]]}(t,e[s],i[s]))}),o}}};function Qt(t,e,i){let s=Object.keys(Kt).filter(e=>t.includes(e)),n=Kt[s[0]];return Object.assign(n,{constants:e,getData:i}),new Jt(n)}function Zt(t){if(0===t)return[0,0];if(isNaN(t))return{mantissa:-6755399441055744,exponent:972};var e=t>0?1:-1;if(!isFinite(t))return{mantissa:4503599627370496*e,exponent:972};t=Math.abs(t);var i=Math.floor(Math.log10(t));return[e*(t/Math.pow(10,i)),i]}function te(t,e=0){let[i,s]=Zt(t),n=e?e/Math.pow(10,s):0,a=function(t,e=0){let i=Math.ceil(t),s=Math.floor(e),n=i-s,a=n,r=1;n>5&&(n%2!=0&&(n=++i-s),a=n/2,r=2),n<=2&&(r=n/(a=4)),0===n&&(a=5,r=1);let o=[];for(var l=0;l<=a;l++)o.push(s+r*l);return o}(i=i.toFixed(6),n);return a=a.map(t=>t*Math.pow(10,s))}function ee(t){return t[1]-t[0]}function ie(t,e){return q(e.zeroLine-t*e.scaleMultiplier)}const se=_+2,ne=se;class ae extends St{constructor(t,e){super(t,e),this.barOptions=e.barOptions||{},this.lineOptions=e.lineOptions||{},this.type=e.type||"line",this.init=1,this.setup()}setMeasures(){this.data.datasets.length<=1&&(this.config.showLegend=0,this.measures.paddings.bottom=30)}configure(t){super.configure(t),t.axisOptions=t.axisOptions||{},t.tooltipOptions=t.tooltipOptions||{},this.config.xAxisMode=t.axisOptions.xAxisMode||"span",this.config.yAxisMode=t.axisOptions.yAxisMode||"span",this.config.xIsSeries=t.axisOptions.xIsSeries||0,this.config.formatTooltipX=t.tooltipOptions.formatTooltipX,this.config.formatTooltipY=t.tooltipOptions.formatTooltipY,this.config.valuesOverPoints=t.valuesOverPoints}prepareData(t=this.data){return function(t,e){t.labels=t.labels||[];let i=t.labels.length,s=t.datasets,n=new Array(i).fill(0);return s||(s=[{values:n}]),s.map(t=>{if(t.values){let e=t.values;e=(e=e.map(t=>isNaN(t)?0:t)).length>i?e.slice(0,i):X(e,i-e.length,0)}else t.values=n;t.chartType||(E.includes(e),t.chartType=e)}),t.yRegions&&t.yRegions.map(t=>{t.end<t.start&&([t.start,t.end]=[t.end,t.start])}),t}(t,this.type)}prepareFirstData(t=this.data){return function(t){let e=t.labels.length,i=new Array(e).fill(0),s={labels:t.labels.slice(0,-1),datasets:t.datasets.map(t=>({name:"",values:i.slice(0,-1),chartType:t.chartType}))};return t.yMarkers&&(s.yMarkers=[{value:0,label:""}]),t.yRegions&&(s.yRegions=[{start:0,end:0,label:""}]),s}(t)}calc(t=!1){this.calcXPositions(),t||this.calcYAxisParameters(this.getAllYValues(),"line"===this.type),this.makeDataByIndex()}calcXPositions(){let t=this.state,e=this.data.labels;t.datasetLength=e.length,t.unitWidth=this.width/t.datasetLength,t.xOffset=t.unitWidth/2,t.xAxis={labels:e,positions:e.map((e,i)=>q(t.xOffset+i*t.unitWidth))}}calcYAxisParameters(t,e="false"){const i=function(t,e=!1){let i=Math.max(...t),s=Math.min(...t),n=0,a=[];function r(t,e){let i=te(t),s=i[1]-i[0],n=0;for(var a=1;n<e;a++)n+=s,i.unshift(-1*n);return i}if(i>=0&&s>=0)n=Zt(i)[1],a=e?te(i,s):te(i);else if(i>0&&s<0){let t=Math.abs(s);i>=t?(n=Zt(i)[1],a=r(i,t)):(n=Zt(t)[1],a=r(t,i).map(t=>-1*t))}else if(i<=0&&s<=0){let t=Math.abs(s),r=Math.abs(i);n=Zt(t)[1],a=(a=e?te(t,r):te(t)).reverse().map(t=>-1*t)}return a}(t,e),s=this.height/function(t){return t[t.length-1]-t[0]}(i),n=ee(i)*s,a=this.height-function(t){let e,i=ee(t);e=t.indexOf(0)>=0?t.indexOf(0):t[0]>0?-1*t[0]/i:-1*t[t.length-1]/i+(t.length-1);return e}(i)*n;this.state.yAxis={labels:i,positions:i.map(t=>a-t*s),scaleMultiplier:s,zeroLine:a},this.calcDatasetPoints(),this.calcYExtremes(),this.calcYRegions()}calcDatasetPoints(){let t=this.state,e=e=>e.map(e=>ie(e,t.yAxis));t.datasets=this.data.datasets.map((t,i)=>{let s=t.values,n=t.cumulativeYs||[];return{name:t.name,index:i,chartType:t.chartType,values:s,yPositions:e(s),cumulativeYs:n,cumulativeYPos:e(n)}})}calcYExtremes(){let t=this.state;this.barOptions.stacked?t.yExtremes=t.datasets[t.datasets.length-1].cumulativeYPos:(t.yExtremes=new Array(t.datasetLength).fill(9999),t.datasets.map(e=>{e.yPositions.map((e,i)=>{e<t.yExtremes[i]&&(t.yExtremes[i]=e)})}))}calcYRegions(){let t=this.state;this.data.yMarkers&&(this.state.yMarkers=this.data.yMarkers.map(e=>(e.position=ie(e.value,t.yAxis),e.options||(e.options={}),e))),this.data.yRegions&&(this.state.yRegions=this.data.yRegions.map(e=>(e.startPos=ie(e.start,t.yAxis),e.endPos=ie(e.end,t.yAxis),e.options||(e.options={}),e)))}getAllYValues(){let t="values";if(this.barOptions.stacked){t="cumulativeYs";let e=new Array(this.state.datasetLength).fill(0);this.data.datasets.map((i,s)=>{let n=this.data.datasets[s].values;i[t]=e=e.map((t,e)=>t+n[e])})}let e=this.data.datasets.map(e=>e[t]);return this.data.yMarkers&&e.push(this.data.yMarkers.map(t=>t.value)),this.data.yRegions&&this.data.yRegions.map(t=>{e.push([t.end,t.start])}),[].concat(...e)}setupComponents(){let t=[["yAxis",{mode:this.config.yAxisMode,width:this.width},function(){return this.state.yAxis}.bind(this)],["xAxis",{mode:this.config.xAxisMode,height:this.height},function(){let t=this.state;return t.xAxis.calcLabels=function(t,e=[],i=!0){let s=t/e.length;s<=0&&(s=1);let n=s/I;return e.map((t,e)=>((t+="").length>n&&(i?e%Math.ceil(t.length/n)!=0&&(t=""):t=n-3>0?t.slice(0,n-3)+" ...":t.slice(0,n)+".."),t))}(this.width,t.xAxis.labels,this.config.xIsSeries),t.xAxis}.bind(this)],["yRegions",{width:this.width,pos:"right"},function(){return this.state.yRegions}.bind(this)]],e=this.state.datasets.filter(t=>"bar"===t.chartType),i=this.state.datasets.filter(t=>"line"===t.chartType),s=e.map(t=>{let i=t.index;return["barGraph-"+t.index,{index:i,color:this.colors[i],stacked:this.barOptions.stacked,valuesOverPoints:this.config.valuesOverPoints,minHeight:this.height*$},function(){let t=this.state,s=t.datasets[i],n=this.barOptions.stacked,a=this.barOptions.spaceRatio||z,r=t.unitWidth*(1-a),o=r/(n?1:e.length),l=t.xAxis.positions.map(t=>t-r/2);n||(l=l.map(t=>t+o*i));let h=new Array(t.datasetLength).fill("");this.config.valuesOverPoints&&(h=n&&s.index===t.datasets.length-1?s.cumulativeYs:s.values);let c=new Array(t.datasetLength).fill(0);return n&&(c=s.yPositions.map((t,e)=>t-s.cumulativeYPos[e])),{xPositions:l,yPositions:s.yPositions,offsets:c,labels:h,zeroLine:t.yAxis.zeroLine,barsWidth:r,barWidth:o}}.bind(this)]}),n=i.map(t=>{let e=t.index;return["lineGraph-"+t.index,{index:e,color:this.colors[e],svgDefs:this.svgDefs,heatline:this.lineOptions.heatline,regionFill:this.lineOptions.regionFill,hideDots:this.lineOptions.hideDots,hideLine:this.lineOptions.hideLine,valuesOverPoints:this.config.valuesOverPoints},function(){let t=this.state,i=t.datasets[e],s=t.yAxis.positions[0]<t.yAxis.zeroLine?t.yAxis.positions[0]:t.yAxis.zeroLine;return{xPositions:t.xAxis.positions,yPositions:i.yPositions,values:i.values,zeroLine:s,radius:this.lineOptions.dotSize||W}}.bind(this)]}),a=[["yMarkers",{width:this.width,pos:"right"},function(){return this.state.yMarkers}.bind(this)]];t=t.concat(s,n,a);let r=["yMarkers","yRegions"];this.dataUnitComponents=[],this.components=new Map(t.filter(t=>!r.includes(t[0])||this.state[t[0]]).map(t=>{let e=Qt(...t);return(t[0].includes("lineGraph")||t[0].includes("barGraph"))&&this.dataUnitComponents.push(e),[t[0],e]}))}makeDataByIndex(){this.dataByIndex={};let t=this.state,e=this.config.formatTooltipX,i=this.config.formatTooltipY;t.xAxis.labels.map((s,n)=>{let a=this.state.datasets.map((t,e)=>{let s=t.values[n];return{title:t.name,value:s,yPos:t.yPositions[n],color:this.colors[e],formatted:i?i(s):s}});this.dataByIndex[n]={label:s,formattedLabel:e?e(s):s,xPos:t.xAxis.positions[n],values:a,yExtreme:t.yExtremes[n]}})}bindTooltip(){this.container.addEventListener("mousemove",t=>{let e=this.measures,i=k(this.container),s=t.pageX-i.left-D(e),n=t.pageY-i.top;n<this.height+C(e)&&n>C(e)?this.mapTooltipXPosition(s):this.tip.hideTip()})}mapTooltipXPosition(t){let e=this.state;if(!e.yExtremes)return;let i=function(t,e,i=!1){let s=e.reduce(function(e,i){return Math.abs(i-t)<Math.abs(e-t)?i:e});return i?e.indexOf(s):s}(t,e.xAxis.positions,!0),s=this.dataByIndex[i];this.tip.setValues(s.xPos+this.tip.offset.x,s.yExtreme+this.tip.offset.y,{name:s.formattedLabel,value:""},s.values,i),this.tip.showTip()}renderLegend(){let t=this.data;t.datasets.length>1&&(this.legendArea.textContent="",t.datasets.map((t,e)=>{let i=function(t,e,i,s="none",n){let a={className:"legend-bar",x:0,y:0,width:i,height:"2px",fill:s},r=ct("text",{className:"legend-dataset-text",x:0,y:0,dy:2*rt+"px","font-size":1.2*rt+"px","text-anchor":"start",fill:lt,innerHTML:n}),o=ct("g",{transform:`translate(${t}, ${e})`});return o.appendChild(ct("rect",a)),o.appendChild(r),o}(S*e,"0",S,this.colors[e],t.name);this.legendArea.appendChild(i)}))}makeOverlay(){this.init?this.init=0:(this.overlayGuides&&this.overlayGuides.forEach(t=>{let e=t.overlay;e.parentNode.removeChild(e)}),this.overlayGuides=this.dataUnitComponents.map(t=>({type:t.unitType,overlay:void 0,units:t.units})),void 0===this.state.currentIndex&&(this.state.currentIndex=this.state.datasetLength-1),this.overlayGuides.map(t=>{let e=t.units[this.state.currentIndex];t.overlay=xt[t.type](e),this.drawArea.appendChild(t.overlay)}))}updateOverlayGuides(){this.overlayGuides&&this.overlayGuides.forEach(t=>{let e=t.overlay;e.parentNode.removeChild(e)})}bindOverlay(){this.parent.addEventListener("data-select",()=>{this.updateOverlay()})}bindUnits(){this.dataUnitComponents.map(t=>{t.units.map(t=>{t.addEventListener("click",()=>{let e=t.getAttribute("data-point-index");this.setCurrentDataPoint(e)})})}),this.tip.container.addEventListener("click",()=>{let t=this.tip.container.getAttribute("data-point-index");this.setCurrentDataPoint(t)})}updateOverlay(){this.overlayGuides.map(t=>{let e=t.units[this.state.currentIndex];vt[t.type](e,t.overlay)})}onLeftArrow(){this.setCurrentDataPoint(this.state.currentIndex-1)}onRightArrow(){this.setCurrentDataPoint(this.state.currentIndex+1)}getDataPoint(t=this.state.currentIndex){let e=this.state;return{index:t,label:e.xAxis.labels[t],values:e.datasets.map(e=>e.values[t])}}setCurrentDataPoint(t){let e=this.state;(t=parseInt(t))<0&&(t=0),t>=e.xAxis.labels.length&&(t=e.xAxis.labels.length-1),t!==e.currentIndex&&(e.currentIndex=t,function(t,e,i){var s=document.createEvent("HTMLEvents");for(var n in s.initEvent(e,!0,!0),i)s[n]=i[n];t.dispatchEvent(s)}(this.parent,"data-select",this.getDataPoint()))}addDataPoint(t,e,i=this.state.datasetLength){super.addDataPoint(t,e,i),this.data.labels.splice(i,0,t),this.data.datasets.map((t,s)=>{t.values.splice(i,0,e[s])}),this.update(this.data)}removeDataPoint(t=this.state.datasetLength-1){this.data.labels.length<=1||(super.removeDataPoint(t),this.data.labels.splice(t,1),this.data.datasets.map(e=>{e.values.splice(t,1)}),this.update(this.data))}updateDataset(t,e=0){this.data.datasets[e].values=t,this.update(this.data)}updateDatasets(t){this.data.datasets.map((e,i)=>{t[i]&&(e.values=t[i])}),this.update(this.data)}}const re={bar:ae,line:ae,percentage:class extends zt{constructor(t,e){super(t,e),this.type="percentage",this.setup()}setMeasures(t){let e=this.measures;this.barOptions=t.barOptions||{};let i=this.barOptions;i.height=i.height||j,i.depth=i.depth||F,e.paddings.right=30,e.legendHeight=80,e.baseHeight=8*(i.height+.5*i.depth)}setupComponents(){let t=this.state,e=[["percentageBars",{barHeight:this.barOptions.height,barDepth:this.barOptions.depth},function(){return{xPositions:t.xPositions,widths:t.widths,colors:this.colors}}.bind(this)]];this.components=new Map(e.map(t=>{let e=Qt(...t);return[t[0],e]}))}calc(){super.calc();let t=this.state;t.xPositions=[],t.widths=[];let e=0;t.sliceTotals.map(i=>{let s=this.width*i/t.grandTotal;t.widths.push(s),t.xPositions.push(e),e+=s})}makeDataByIndex(){}bindTooltip(){let t=this.state;this.container.addEventListener("mousemove",e=>{let i=this.components.get("percentageBars").store,s=e.target;if(i.includes(s)){let e=i.indexOf(s),n=k(this.container),a=k(s),r=a.left-n.left+parseInt(s.getAttribute("width"))/2,o=a.top-n.top,l=(this.formattedLabels&&this.formattedLabels.length>0?this.formattedLabels[e]:this.state.labels[e])+": ",h=t.sliceTotals[e]/t.grandTotal;this.tip.setValues(r,o,{name:l,value:(100*h).toFixed(1)+"%"}),this.tip.showTip()}})}},heatmap:class extends St{constructor(t,e){super(t,e),this.type="heatmap",this.countLabel=e.countLabel||"";let i=["Sunday","Monday"],s=i.includes(e.startSubDomain)?e.startSubDomain:"Sunday";this.startSubDomainIndex=i.indexOf(s),this.setup()}setMeasures(t){let e=this.measures;this.discreteDomains=0===t.discreteDomains?0:1,e.paddings.top=3*ne,e.paddings.bottom=0,e.legendHeight=2*ne,e.baseHeight=ne*Wt+L(e);let i=this.data,s=this.discreteDomains?$t:0;this.independentWidth=(Bt(i.start,i.end)+s)*se+M(e)}updateWidth(){let t=this.discreteDomains?$t:0,e=this.state.noOfWeeks?this.state.noOfWeeks:52;this.baseWidth=(e+t)*se+M(this.measures)}prepareData(t=this.data){if(t.start&&t.end&&t.start>t.end)throw new Error("Start date cannot be greater than end date.");if(t.start||(t.start=new Date,t.start.setFullYear(t.start.getFullYear()-1)),t.end||(t.end=new Date),t.dataPoints=t.dataPoints||{},parseInt(Object.keys(t.dataPoints)[0])>1e5){let e={};Object.keys(t.dataPoints).forEach(i=>{let s=new Date(i*jt);e[Rt(s)]=t.dataPoints[i]}),t.dataPoints=e}return t}calc(){let t=this.state;t.start=Yt(this.data.start),t.end=Yt(this.data.end),t.firstWeekStart=Yt(t.start),t.noOfWeeks=Bt(t.start,t.end),t.distribution=function(t,e){let i=Math.max(...t),s=1/(e-1),n=[];for(var a=0;a<e;a++){let t=i*(s*a);n.push(t)}return n}(Object.values(this.data.dataPoints),H),t.domainConfigs=this.getDomains()}setupComponents(){let t=this.state,e=this.discreteDomains?0:1,i=t.domainConfigs.map((i,s)=>["heatDomain",{index:i.index,colWidth:se,rowHeight:ne,squareSize:_,xTranslate:t.domainConfigs.filter((t,e)=>e<s).map(t=>t.cols.length-e).reduce((t,e)=>t+e,0)*se},function(){return t.domainConfigs[s]}.bind(this)]);this.components=new Map(i.map((t,e)=>{let i=Qt(...t);return[t[0]+"-"+e,i]}));let s=0;_t.forEach((t,e)=>{if([1,3,5].includes(e)){let e=gt("subdomain-name",-se/2,s,t,{fontSize:_,dy:8,textAnchor:"end"});this.drawArea.appendChild(e)}s+=ne})}update(t){t||console.error("No data to update."),this.data=this.prepareData(t),this.draw(),this.bindTooltip()}bindTooltip(){this.container.addEventListener("mousemove",t=>{this.components.forEach(e=>{let i=e.store,s=t.target;if(i.includes(s)){let e=s.getAttribute("data-value"),i=s.getAttribute("data-date").split("-"),n=Ut(parseInt(i[1])-1,!0),a=this.container.getBoundingClientRect(),r=s.getBoundingClientRect(),o=parseInt(t.target.getAttribute("width")),l=r.left-a.left+o/2,h=r.top-a.top,c=e+" "+this.countLabel,d=" on "+n+" "+i[0]+", "+i[2];this.tip.setValues(l,h,{name:d,value:c,valueFirst:1},[]),this.tip.showTip()}})})}renderLegend(){this.legendArea.textContent="";let t=0,e=ne,i=gt("subdomain-name",t,e,"Less",{fontSize:_+1,dy:9});t=2*se+se/2,this.legendArea.appendChild(i),this.colors.slice(0,H).map((i,s)=>{const n=mt("heatmap-legend-unit",t+(se+3)*s,e,_,i);this.legendArea.appendChild(n)});let s=gt("subdomain-name",t+H*(se+3)+se/4,e,"More",{fontSize:_+1,dy:9});this.legendArea.appendChild(s)}getDomains(){let t=this.state;const[e,i]=[t.start.getMonth(),t.start.getFullYear()],[s,n]=[t.end.getMonth(),t.end.getFullYear()],a=s-e+1+12*(n-i);let r=[],o=Yt(t.start);for(var l=0;l<a;l++){let e=t.end;if(!Vt(o,t.end)){let[t,i]=[o.getMonth(),o.getFullYear()];e=Gt(t,i)}r.push(this.getDomainConfig(o,e)),Xt(e,1),o=e}return r}getDomainConfig(t,e=""){let[i,s]=[t.getMonth(),t.getFullYear()],n=qt(t),a={index:i,cols:[]};Xt(e=Yt(e)||Gt(i,s),1);let r,o=Bt(n,e),l=[];for(var h=0;h<o;h++)r=this.getCol(n,i),l.push(r),Xt(n=new Date(r[Wt-1].yyyyMmDd),1);return void 0!==r[Wt-1].dataValue&&(Xt(n,1),l.push(this.getCol(n,i,!0))),a.cols=l,a}getCol(t,e,i=!1){let s=this.state,n=Yt(t),a=[];for(var r=0;r<Wt;r++,Xt(n,1)){let t={},r=n>=s.start&&n<=s.end;i||n.getMonth()!==e||!r?t.yyyyMmDd=Rt(n):t=this.getSubDomainConfig(n),a.push(t)}return a}getSubDomainConfig(t){let e=Rt(t),i=this.data.dataPoints[e];return{yyyyMmDd:e,dataValue:i||0,fill:this.colors[function(t,e){return e.filter(e=>e<t).length}(i,this.state.distribution)]}}},pie:class extends zt{constructor(t,e){super(t,e),this.type="pie",this.initTimeout=0,this.init=1,this.setup()}configure(t){super.configure(t),this.mouseMove=this.mouseMove.bind(this),this.mouseLeave=this.mouseLeave.bind(this),this.hoverRadio=t.hoverRadio||.1,this.config.startAngle=t.startAngle||0,this.clockWise=t.clockWise||!1}calc(){super.calc();let t=this.state;this.radius=this.height>this.width?this.center.x:this.center.y;const{radius:e,clockWise:i}=this,s=t.slicesProperties||[];t.sliceStrings=[],t.slicesProperties=[];let n=180-this.config.startAngle;t.sliceTotals.map((a,r)=>{const o=n,l=a/t.grandTotal*U,h=i?-l:l,c=n+=h,d=K(o,e),u=K(c,e),p=this.init&&s[r];let f,m;this.init?(f=p?p.startPosition:d,m=p?p.endPosition:d):(f=d,m=u);const g=function(t,e,i,s,n=1){let[a,r]=[i.x+t.x,i.y+t.y],[o,l]=[i.x+e.x,i.y+e.y];return`M${i.x} ${i.y}\n\t\tL${a} ${r}\n\t\tA ${s} ${s} 0 0 ${n?1:0}\n\t\t${o} ${l} z`}(f,m,this.center,this.radius,this.clockWise);t.sliceStrings.push(g),t.slicesProperties.push({startPosition:d,endPosition:u,value:a,total:t.grandTotal,startAngle:o,endAngle:c,angle:h})}),this.init=0}setupComponents(){let t=this.state,e=[["pieSlices",{},function(){return{sliceStrings:t.sliceStrings,colors:this.colors}}.bind(this)]];this.components=new Map(e.map(t=>{let e=Qt(...t);return[t[0],e]}))}calTranslateByAngle(t){const{radius:e,hoverRadio:i}=this,s=K(t.startAngle+t.angle/2,e);return`translate3d(${s.x*i}px,${s.y*i}px,0)`}hoverSlice(t,e,i,s){if(!t)return;const n=this.colors[e];if(i){Mt(t,this.calTranslateByAngle(this.state.slicesProperties[e])),t.style.fill=it(n,50);let i=k(this.svg),a=s.pageX-i.left+10,r=s.pageY-i.top-10,o=(this.formatted_labels&&this.formatted_labels.length>0?this.formatted_labels[e]:this.state.labels[e])+": ",l=(100*this.state.sliceTotals[e]/this.state.grandTotal).toFixed(1);this.tip.setValues(a,r,{name:o,value:l+"%"}),this.tip.showTip()}else Mt(t,"translate3d(0,0,0)"),this.tip.hideTip(),t.style.fill=n}bindTooltip(){this.container.addEventListener("mousemove",this.mouseMove),this.container.addEventListener("mouseleave",this.mouseLeave)}mouseMove(t){const e=t.target;let i=this.components.get("pieSlices").store,s=this.curActiveSliceIndex,n=this.curActiveSlice;if(i.includes(e)){let a=i.indexOf(e);this.hoverSlice(n,s,!1),this.curActiveSlice=e,this.curActiveSliceIndex=a,this.hoverSlice(e,a,!0,t)}else this.mouseLeave()}mouseLeave(){this.hoverSlice(this.curActiveSlice,this.curActiveSliceIndex,!1)}}};var oe=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=d()(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var i=e.prototype;return i.init=function(){t.prototype.init.call(this);var e=new Date;e.setTime(e.getTime()+1e3*app.data.statistics.timezoneOffset),e.setUTCHours(0,0,0,0),e.setTime(e.getTime()-1e3*app.data.statistics.timezoneOffset),e/=1e3,this.entities=["users","discussions","posts"],this.periods={today:{start:e,end:e+86400,step:3600},last_7_days:{start:e-604800,end:e,step:86400},last_28_days:{start:e-2419200,end:e,step:86400},last_12_months:{start:e-31449600,end:e,step:604800}},this.selectedEntity="users",this.selectedPeriod="last_7_days"},i.className=function(){return"StatisticsWidget"},i.content=function(){var t=this,e=this.periods[this.selectedPeriod];return m("div",{className:"StatisticsWidget-table"},m("div",{className:"StatisticsWidget-labels"},m("div",{className:"StatisticsWidget-label"},app.translator.trans("flarum-statistics.admin.statistics.total_label")),m("div",{className:"StatisticsWidget-label"},m(g.a,{buttonClassName:"Button Button--text",caretIcon:"fas fa-caret-down"},h()(this.periods).map(function(e){return m(b.a,{active:e===t.selectedPeriod,onclick:t.changePeriod.bind(t,e),icon:e!==t.selectedPeriod||"fas fa-check"},app.translator.trans("flarum-statistics.admin.statistics."+e+"_label"))})))),this.entities.map(function(i){var s=t.getTotalCount(i),n=t.getPeriodCount(i,e),a=t.getPeriodCount(i,t.getLastPeriod(e)),r=a>0&&(n-a)/a*100;return m("a",{className:"StatisticsWidget-entity"+(t.selectedEntity===i?" active":""),onclick:t.changeEntity.bind(t,i)},m("h3",{className:"StatisticsWidget-heading"},app.translator.trans("flarum-statistics.admin.statistics."+i+"_heading")),m("div",{className:"StatisticsWidget-total",title:s},P()(s)),m("div",{className:"StatisticsWidget-period",title:n},P()(n)," ",r?m("span",{className:"StatisticsWidget-change StatisticsWidget-change--"+(r>0?"up":"down")},v()("fas fa-arrow-"+(r>0?"up":"down")),Math.abs(r.toFixed(1)),"%"):""))}),m("div",{className:"StatisticsWidget-chart",config:this.drawChart.bind(this)}))},i.drawChart=function(t,e,i){if(!i.chart||i.entity!==this.selectedEntity||i.period!==this.selectedPeriod){for(var s=app.data.statistics.timezoneOffset,n=this.periods[this.selectedPeriod],a=n.end-n.start,r=[],o=[],l=[],h=n.start;h<n.end;h+=n.step){var c=void 0;n.step<86400?c=moment.unix(h+s).utc().format("h A"):(c=moment.unix(h+s).utc().format("D MMM"),n.step>86400&&(c+=" - "+moment.unix(h+s+n.step-1).utc().format("D MMM"))),r.push(c),o.push(this.getPeriodCount(this.selectedEntity,{start:h,end:h+n.step})),l.push(this.getPeriodCount(this.selectedEntity,{start:h-a,end:h-a+n.step}))}var d={labels:r,datasets:[{values:l},{values:o}]};i.chart?i.chart.update(d):i.chart=new class{constructor(t,e){return function(t="line",e,i){return"axis-mixed"===t?(i.type="line",new ae(e,i)):re[t]?new re[t](e,i):void console.error("Undefined chart type: "+t)}(e.type,t,e)}}(t,{data:d,type:"line",height:280,axisOptions:{xAxisMode:"tick",yAxisMode:"span",xIsSeries:!0},lineOptions:{hideDots:1},colors:["black",app.forum.attribute("themePrimaryColor")]}),i.entity=this.selectedEntity,i.period=this.selectedPeriod}},i.changeEntity=function(t){this.selectedEntity=t},i.changePeriod=function(t){this.selectedPeriod=t},i.getTotalCount=function(t){return app.data.statistics[t].total},i.getPeriodCount=function(t,e){var i=app.data.statistics[t].timed,s=0;for(var n in i)n>=e.start&&n<e.end&&(s+=i[n]);return s},i.getLastPeriod=function(t){return{start:t.start-(t.end-t.start),end:t.start}},e}(p.a);n.a.initializers.add("flarum-statistics",function(){Object(a.extend)(o.a.prototype,"availableWidgets",function(t){t.push(m(oe,null))})})}]);
|
|
//# sourceMappingURL=admin.js.map
|