vart,n,e;(function(){vart,n;t=classextendsOS.application.BaseService{constructor(t){super("SysmondService",t),this.text=__("{0}%",(0).toString()),this.iconclass="fa fa-android",this.app=void0,this.onmenuselect=t=>this.openApp()}setting(){returnthis.systemsetting.applications.SystemControl}init(){vart;returnt=()=>{if(Antunnel.tunnel){if(!this.setting().topic)return;returnthis.tunnel=Antunnel.tunnel,this.sub=newAntunnel.Subscriber(this.setting().topic),this.sub.onopen=()=>console.log("Subscribed to notification channel"),this.sub.onerror=t=>this.error(__("Error: {0}",newTextDecoder("utf-8").decode(t.data)),t),this.sub.onmessage=t=>{varn;returnt.data&&(n=JSON.parse(newTextDecoder("utf-8").decode(t.data))),this.text=__("{0}%",Math.round(n.battery_percent).toString()),this.app&&this.app.feed(n),this.update()},this.sub.onclose=()=>(this.sub=void0,this.notify(__("Unsubscribed to the notification service")),this.quit()),Antunnel.tunnel.subscribe(this.sub)}returnthis.error(__("The Antunnel service is not started, please start it first")),this._gui.pushService("Antunnel/AntunnelService").catch(t=>this.error(t.toString(),t)),this.quit()},this.setting().topic?t():(console.log("Open dialog"),this._gui.openDialog("PromptDialog",{title:__("Enter topic name"),label:__("Please enter topic name")}).then(n=>(this.setting().topic=n,t())))}openApp(){if(!this.app)returnthis._gui.launch("SystemControl",[])}execute(t){}awake(){}cleanup(){if(this.app&&this.app.quit(),this.sub)returnthis.sub.close()}},this.OS.register("SysmondService",t),(n=classextendsthis.OS.application.BaseApplication{constructor(t){super("SystemControl",t)}main(){returnthis.max_net_range=2048,this.diskchart=$(this.find("disk-area")).epoch({type:"time.gauge",value:0}),this.on("resize",()=>{vart;if(t=this.find("cpu-area"),this.cpu&&($(t).children().hide(),this.cpu.option("width",$(t).width()),this.cpu.option("height",$(t).height()),$(t).children().show()),t=this.find("battery-area"),t=this.find("memory-area"),this.memory&&($(t).children().hide(),this.memory.option("width",$(t).width()),this.memory.option("height",$(t).height()),$(t).children().show()),t=this.find("network-area"),this.network&&($(t).children().hide(),this.network.option("width",$(t).width()),this.network.option("height",$(t).height()),$(t).children().show()),t=this.find("temp-area"),this.temp&&($(t).children().hide(),this.temp.option("width",$(t).width()),this.temp.option("height",$(t).height()),$(t).children().show()),t=this.find("battery-area"),this.battery)return$(t).children().hide(),this.battery.option("width",$(t).width()),this.battery.option("height",$(t).height()),$(t).children().show()}),this._gui.pushService("SystemControl/SysmondService",[]).then(t=>(this.service=t,t.app=this)).catch(t=>this.error(__("Unable to start sysmond service"),t))}streamline(t,n,e,r){vari,o,a,u,s,l,c,h,f;if(o=0,l=$(this.find(t+"-text")),!this[t]){for(f={type:"time.line",axes:["bottom","left","right"]},e&&(f.range=e),i=[],u=0,c=n.length;u<c;u++)a=n[u],i.push({label:"label-"+o,values:[]}),$("<div>").addClass("legend-color").addClass("ref").addClass("category"+(o+1)).appendTo(l),$("<div>").addClass("legend-label").appendTo(l).text(r?r[o]:`${t}-${o}`),$("<div>").addClass("legend-value").appendTo(l),o+=1;f.data=i,this[t]=$(this.find(t+"-area")).epoch(f)}for(s=0,h=n.length;s<h;s++)a=n[s],$(l.children()[3*o+2]).text(a.y.toString()),o+=1;returnthis[t].push(n)}feed(t){varn,e,r,i,o,a,u,s,l,c,h,f,p,g,d,y,v,m,x,_,w;for(r=t.disk_total-t.disk_free,this.diskchart.push(r/t.disk_total),this.find("disk-text").text="Disk: "+Math.round(r/1024/1024/1024)+"/"+Math.round(t.disk_total/1024/1024/1024)+" GB",p=t.stamp_sec,t.cpu_usages.shift(),e=function(){varn,e,r,i;for(i=[],n=0,e=(r=t.cpu_usages).length;n<e;n++)w=r[n],i.push({time:p,y:w.toFixed(2)});returni}(),this.streamline("cpu",e,[0,100]),v=t.mem_total/1024/1024,x=t.mem_used/1024/1024,m=t.mem_swap_total/1024/1024,_=(t.mem_swap_total-t.mem_swap_free)/1024/1024,s=[{time:p,y:x.toFixed(3)},{time:p,y:_.toFixed(3)}],l=[0,v>m?v:m],this.streamline("memory",s,l,["RAM (GB)","SWA