import{u as D}from"./widget-jbnupkVY.js";import{B as C,Y as B,Z as L,a0 as x,_ as V}from"./app-QjDgb7aF.js";import{n as a}from"./number-BJeYzK3l.js";import{b as A,o as N,p as u,q as n,J as f,H as w,x as d,D as l,u as s,r as y,j as p}from"./vue-Cm77DuTi.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const Q={class:"inbox"},W={class:"label"},I={key:0,class:"ph-warning ph-bold ph-lg icon"},M={class:"values"},z={class:"deliver"},E={class:"label"},H={key:0,class:"ph-warning ph-bold ph-lg icon"},J={class:"values"},P="jobQueue",U=A({__name:"job-queue",props:{widget:{}},emits:["updateProps"],setup(S,{expose:k,emit:T}){const _={transparent:{type:"boolean",default:!1},sound:{type:"boolean",default:!1}},c=S,j=T,{widgetProps:b,configure:q}=D(P,_,c,j),v=C.useChannel("queueStats"),i=y({inbox:{activeSincePrevTick:0,active:0,waiting:0,delayed:0},deliver:{activeSincePrevTick:0,active:0,waiting:0,delayed:0}}),t=y({}),g=B(L("syuilo/queue-jammed"),1);for(const o of["inbox","deliver"])t[o]=x(i[o]);const r=o=>{for(const e of["inbox","deliver"])t[e]=x(i[e]),i[e].activeSincePrevTick=o[e].activeSincePrevTick,i[e].active=o[e].active,i[e].waiting=o[e].waiting,i[e].delayed=o[e].delayed,i[e].waiting>0&&b.sound&&g.paused&&g.play()},m=o=>{for(const e of[...o].reverse())r(e)};return v.on("stats",r),v.on("statsLog",m),v.send("requestLog",{id:Math.random().toString().substr(2,8),length:1}),N(()=>{v.off("stats",r),v.off("statsLog",m),v.dispose()}),k({name:P,configure:q,id:c.widget?c.widget.id:null}),(o,e)=>(p(),u("div",{class:d(["mkw-jobQueue _monospace",{_panel:!s(b).transparent}])},[n("div",Q,[n("div",W,[e[0]||(e[0]=f(" Inbox queue",-1)),i.inbox.waiting>0?(p(),u("i",I)):w("",!0)]),n("div",M,[n("div",null,[e[1]||(e[1]=n("div",null,"Process",-1)),n("div",{class:d({inc:i.inbox.activeSincePrevTick>t.inbox.activeSincePrevTick,dec:i.inbox.activeSincePrevTick<t.inbox.activeSincePrevTick})},l(s(a)(i.inbox.activeSincePrevTick)),3)]),n("div",null,[e[2]||(e[2]=n("div",null,"Active",-1)),n("div",{class:d({inc:i.inbox.active>t.inbox.active,dec:i.inbox.active<t.inbox.active})},l(s(a)(i.inbox.active)),3)]),n("div",null,[e[3]||(e[3]=n("div",null,"Delayed",-1)),n("div",{class:d({inc:i.inbox.delayed>t.inbox.delayed,dec:i.inbox.delayed<t.inbox.delayed})},l(s(a)(i.inbox.delayed)),3)]),n("div",null,[e[4]||(e[4]=n("div",null,"Waiting",-1)),n("div",{class:d({inc:i.inbox.waiting>t.inbox.waiting,dec:i.inbox.waiting<t.inbox.waiting})},l(s(a)(i.inbox.waiting)),3)])])]),n("div",z,[n("div",E,[e[5]||(e[5]=f(" Deliver queue",-1)),i.deliver.waiting>0?(p(),u("i",H)):w("",!0)]),n("div",J,[n("div",null,[e[6]||(e[6]=n("div",null,"Process",-1)),n("div",{class:d({inc:i.deliver.activeSincePrevTick>t.deliver.activeSincePrevTick,dec:i.deliver.activeSincePrevTick<t.deliver.activeSincePrevTick})},l(s(a)(i.deliver.activeSincePrevTick)),3)]),n("div",null,[e[7]||(e[7]=n("div",null,"Active",-1)),n("div",{class:d({inc:i.deliver.active>t.deliver.active,dec:i.deliver.active<t.deliver.active})},l(s(a)(i.deliver.active)),3)]),n("div",null,[e[8]||(e[8]=n("div",null,"Delayed",-1)),n("div",{class:d({inc:i.deliver.delayed>t.deliver.delayed,dec:i.deliver.delayed<t.deliver.delayed})},l(s(a)(i.deliver.delayed)),3)]),n("div",null,[e[9]||(e[9]=n("div",null,"Waiting",-1)),n("div",{class:d({inc:i.deliver.waiting>t.deliver.waiting,dec:i.deliver.waiting<t.deliver.waiting})},l(s(a)(i.deliver.waiting)),3)])])])],2))}}),R=V(U,[["__scopeId","data-v-077f1618"]]);export{R as default};
//# sourceMappingURL=job-queue-Boe1hox4.js.map
