"use strict";(self["webpackChunkaw_webui"]=self["webpackChunkaw_webui"]||[]).push([[675],{27549:(t,e,r)=>{r.d(e,{P:()=>u});var a=r(50257),n=r(18446),i=r.n(n),s=(r(41539),r(70189),r(78783),r(33948),r(84944),r(33792),r(21249),r(26833),r(69600),r(57327),r(74916),r(23123),r(69826),r(68309),r(99679),r(3181)),o=r(86845);function u(t,e){var r=">>>",n=t;if(n){var u=new Set(Object.values(n).map((function(t){return t.cat_events.map((function(t){return t.data["$category"].join(r)}))})).flat()),c=(0,a.Z)(u).map((function(t){var a=(0,o.v)(),u=a.get_category(t.split(r));if(u){var c=Object.values(n).map((function(t){var e=t.cat_events.find((function(t){return i()(t.data["$category"],u.name)}));return e?Math.round(e.duration/3600*1e3)/1e3:null}));return{label:u.name.join(" > "),backgroundColor:(0,s.EB)(u,e),data:c}}console.error("missing category:",t)})).filter((function(t){return t}));return c}return[]}},99679:(t,e,r)=>{r.d(e,{j:()=>a});r(96026),r(21249),r(2707),r(83710),r(57658),r(30381),r(49492);function a(t,e){t=t.sort((function(t,e){return t.timestamp-e.timestamp})),e=e.sort((function(t,e){return t.timestamp-e.timestamp}));var r=0,a=0,n=[];while(r<t.length&&a<e.length){var i=t[r],s=e[a];if(t!==e||i!==s){var o=new Date(i.timestamp),u=new Date(s.timestamp),c=new Date(new Date(i.timestamp).valueOf()+1e3*i.duration),l=new Date(new Date(s.timestamp).valueOf()+1e3*s.duration);if(o<u&&u<c||o<l&&l<=c){var d={start:o,end:c,event:i},p={start:u,end:l,event:s};n.push([d,p])}s.timestamp+1e3*s.duration>i.timestamp+1e3*i.duration?r++:a++}else r++}return n.length>0&&console.warn("Overlapping events found",n),n}},40675:(t,e,r)=>{r.r(e),r.d(e,{default:()=>y});var a=function(){var t=this,e=t._self._c;return e("div",[e("h3",{staticClass:"mb-0"},[t._v("Trends for "+t._s(t._f("friendlyperiod")(t.timeperiod)))]),e("b-input-group",{attrs:{size:"sm"}},[e("b-form-select",{attrs:{label:"Host",options:t.bucketsStore.hosts,placeholder:"Select a hostname"},model:{value:t.host,callback:function(e){t.host=e},expression:"host"}})],1),e("div",{staticClass:"mb-2"},[e("ul",{staticClass:"list-group list-group-horizontal-md mb-3",staticStyle:{"font-size":"0.9em",opacity:"0.7"}},[e("li",{staticClass:"list-group-item pl-0 pr-3 py-0 border-0"},[e("b",[t._v("Host:")]),t._v(" "+t._s(t.host))])])]),e("b-alert",{staticStyle:{},attrs:{show:""}},[t._v("This feature is still in early development.")]),e("div",[e("aw-timeline-barchart",{attrs:{datasets:t.datasets,height:100}})],1),e("div",[e("hr"),e("h5",[t._v("Options")]),e("aw-devonly",[e("b-btn",{attrs:{id:"load-demo"},on:{click:t.load_demo}},[t._v("Load demo data")])],1)],1)],1)},n=[],i=r(51055),s=r(27981),o=r(30381),u=r.n(o),c=r(49492),l=r(27549),d=r(85711),p=r(86845),h=r(72195);const f={name:"Trends",props:{},data:function(){var t=(0,c.P4)(),e=7,r=u()(t).subtract(e,"days");return{bucketsStore:(0,d.U)(),categoryStore:(0,p.v)(),activityStore:(0,h.j)(),today:t,timeperiod:{start:r,length:[e,"day"]}}},computed:{host:function(){return this.$route.params.host},datasets:function(){return(0,l.P)(this.activityStore.category.by_period,this.categoryStore.classes)}},mounted:function(){var t=(0,s.Z)((0,i.Z)().mark((function t(){return(0,i.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return this.categoryStore.load(),t.next=3,this.refresh();case 3:case"end":return t.stop()}}),t,this)})));function e(){return t.apply(this,arguments)}return e}(),methods:{refresh:function(){var t=(0,s.Z)((0,i.Z)().mark((function t(e){var r;return(0,i.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return r={timeperiod:this.timeperiod,host:this.host,force:e,filter_afk:this.filter_afk,include_audible:this.include_audible,filter_categories:this.filter_categories,dont_query_inactive:!1},t.next=3,this.activityStore.query_category_time_by_period(r);case 3:case"end":return t.stop()}}),t,this)})));function e(e){return t.apply(this,arguments)}return e}(),load_demo:function(){var t=(0,s.Z)((0,i.Z)().mark((function t(){return(0,i.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:this.data={"2021-01":1e3,"2021-02":500};case 1:case"end":return t.stop()}}),t,this)})));function e(){return t.apply(this,arguments)}return e}()}},m=f;var v=r(1001),_=(0,v.Z)(m,a,n,!1,null,"7456416a",null);const y=_.exports}}]);
//# sourceMappingURL=675.222e81f2.js.map