"use strict";(self["webpackChunkaw_webui"]=self["webpackChunkaw_webui"]||[]).push([[7367],{7367:(t,e,n)=>{n.r(e),n.d(e,{default:()=>k});var i=function(){var t=this,e=t._self._c;return e("div")},a=[],r=n(3181),l=n(49492),s=require("d3"),o=require("color"),u=require("lodash"),c=require("moment");function d(t,e){var n=t.querySelector("#"+e),i=t.querySelector(".titleinfo-container");i.innerHTML=n.innerHTML,i.style.height=n.getAttribute("height")}function p(t){t.innerHTML="",s.select(t).append("svg").attr("class","apptimeline").attr("viewBox","0 0 100 10").attr("width","100%"),s.select(t).append("div").attr("class","titleinfo-list").attr("display","none");var e=document.createElement("div");e.style.width="100%",e.style.height="200px",e.style.overflowY="scroll",t.appendChild(e),s.select(e).append("div").attr("width","100%").attr("class","titleinfo-container")}function f(t,e){var n=t.querySelector(".apptimeline"),i=t.querySelector(".titleinfo-list"),a=t.querySelector(".titleinfo-container"),r=s.select(n);n.innerHTML="",i.innerHTML="",a.innerHTML="",r.append("text").attr("x","0").attr("y","3").text(e).attr("font-family","sans-serif").attr("font-size","3").attr("fill","black")}function h(t,e,n,i,a){var p=s.select(t.querySelector(".apptimeline")).html(null),h=s.select(t.querySelector(".titleinfo-list")).html(null);if(s.select(t.querySelector(".titleinfo-container")).html(null),!(e.length<=0)){var m=e[0],y=e[e.length-1],v=c(m.timestamp),w=c(y.timestamp).add(y.duration,"seconds"),x=u.sumBy(e,"duration"),k=w.diff(v,"seconds",!0),_=0;return u.each(e,(function(e,s){var f,m;if(n){var y=c(e.timestamp);f=y.diff(v,"seconds",!0)/k,f=100*f+"%",m=e.duration/k*100+"%"}else f=_,m=e.duration/x*100;var w=(0,r.T_)(i(e)),g=o(w).darken(.4).hex(),q=p.append("g").attr("id","timeline_event_"+s),b=q.append("rect").attr("x",f).attr("y",0).attr("width",m).attr("height",10).style("fill",w).on("mouseover",(function(){b.style("fill",g),d(t,"titleinfo_event_"+s)})).on("mouseout",(function(){b.style("fill",w)})),S=h.append("div").attr("id","titleinfo_event_"+s).style("display","none");S.append("h5").attr("x","10px").attr("y","20px").text(i(e)+" ("+(0,l.SI)(e.duration)+")").attr("font-family","sans-serif").attr("font-size","20px").attr("fill","black");var H=S.append("table");u.each(e.data.subevents,(function(t){var e=H.append("tr"),n=c(t.timestamp).format("HH:mm:ss");e.append("td").text(n);var i=(0,l.SI)(t.duration);e.append("td").text(i).style("padding-left","1em").style("text-align","right"),e.append("td").text(a(t)).style("padding-left","1em")})),_+=m})),t}f(t,"No data")}const m={create:p,update:h,set_status:f},y={name:"aw-timeline",props:{chunks:{type:Object},show_afk:{type:Boolean},chunkfunc:{type:Function},eventfunc:{type:Function}},watch:{chunks:function(){this.update()},show_afk:function(){this.update()}},mounted:function(){m.create(this.$el),this.update()},methods:{update:function(){null===this.chunks?m.set_status(this.$el,"Loading..."):m.update(this.$el,this.chunks,this.show_afk,this.chunkfunc,this.eventfunc)}}},v=y;var w=n(1001),x=(0,w.Z)(v,i,a,!1,null,"51a0712d",null);const k=x.exports}}]);
//# sourceMappingURL=7367.2839062b.js.map