bunqueue-dashboard 0.0.31 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/agent/db.ts +163 -22
  2. package/agent/dbQueryWorker.ts +14 -6
  3. package/agent/index.ts +4 -1
  4. package/agent/manager.ts +97 -12
  5. package/agent/server.ts +7 -1
  6. package/dist/.vite/manifest.json +76 -75
  7. package/dist/assets/AddJob-Dvpp--yq.js +3 -0
  8. package/dist/assets/{Alerts-70bxf-PT.js → Alerts-CR9jgCCs.js} +1 -1
  9. package/dist/assets/Benchmark-CkL-Ee-M.js +1 -0
  10. package/dist/assets/BulkAddJobs-wI6cRZnX.js +5 -0
  11. package/dist/assets/{CopilotPanel-DZUGIf1q.js → CopilotPanel-DPZV9opm.js} +3 -3
  12. package/dist/assets/{Cron-ltjSoTjj.js → Cron-gWVkYWad.js} +1 -1
  13. package/dist/assets/CronManager-BvfW219u.js +1 -0
  14. package/dist/assets/Database-D2T_ZIGA.js +3 -0
  15. package/dist/assets/Diagnostics-C2goqq5h.js +1 -0
  16. package/dist/assets/{Dlq-fZAKwQoC.js → Dlq-Q4TmmZrK.js} +1 -1
  17. package/dist/assets/{DlqControl-eTrrQCrn.js → DlqControl-C5BfE7Gq.js} +1 -1
  18. package/dist/assets/{DlqPro-CF79339e.js → DlqPro-ClPNmw-X.js} +1 -1
  19. package/dist/assets/Flows-DbhMbvSG.js +1 -0
  20. package/dist/assets/JobInspector-CO_zKjSX.js +2 -0
  21. package/dist/assets/{Jobs-DEqAc1A5.js → Jobs-D2rDHPM_.js} +1 -1
  22. package/dist/assets/JobsPro-Drdgdj3s.js +1 -0
  23. package/dist/assets/{Logs-DBTukPIX.js → Logs-DjwGuRLi.js} +1 -1
  24. package/dist/assets/{LogsPro-Wl_e6hZM.js → LogsPro-7uTBjPWX.js} +1 -1
  25. package/dist/assets/{McpServer-CnWJsKw7.js → McpServer-DAklQDB5.js} +1 -1
  26. package/dist/assets/{Metrics-DzeIhNL-.js → Metrics-Dup9Zinh.js} +1 -1
  27. package/dist/assets/{MetricsPro-O9eVJSH0.js → MetricsPro-PP3TymeP.js} +1 -1
  28. package/dist/assets/{Overview-Bnu7rWqt.js → Overview-C7RCDE6r.js} +1 -1
  29. package/dist/assets/{Pagination-D4ki-pGz.js → Pagination-B9JDi5MI.js} +1 -1
  30. package/dist/assets/QueueActions-DJTw0h2g.js +1 -0
  31. package/dist/assets/{QueueControl-DKqEXnkM.js → QueueControl-CxKjUjF-.js} +1 -1
  32. package/dist/assets/{QueueDetail-DLRow04B.js → QueueDetail-bf2n-r2h.js} +1 -1
  33. package/dist/assets/{QueueDetailPro-BYmOVd4T.js → QueueDetailPro-C-XLWFBa.js} +1 -1
  34. package/dist/assets/{Queues-CoyjRFN7.js → Queues-CMQW89J9.js} +1 -1
  35. package/dist/assets/{QueuesOverview-BeWdJpKi.js → QueuesOverview-x7-akDzf.js} +1 -1
  36. package/dist/assets/{S3Backup-BaLFgl9d.js → S3Backup-1jAySC9R.js} +1 -1
  37. package/dist/assets/{S3BackupPro-DJB4oWgz.js → S3BackupPro-BG_0OHW7.js} +1 -1
  38. package/dist/assets/{ServerControl-_0lVB33E.js → ServerControl-DohTB--h.js} +3 -3
  39. package/dist/assets/{Settings-zKFJTtnq.js → Settings-CnS5PjNe.js} +1 -1
  40. package/dist/assets/{Usage-CKGkvl0j.js → Usage-C3H0hMSA.js} +1 -1
  41. package/dist/assets/{UsagePro-B-TJ6fp4.js → UsagePro-CdnQkP9o.js} +1 -1
  42. package/dist/assets/Webhooks-CAwVmIEZ.js +1 -0
  43. package/dist/assets/{Workers-jKhhXl3W.js → Workers-lvujKZwF.js} +1 -1
  44. package/dist/assets/{WorkersPro-mvY5VX8I.js → WorkersPro-CIJKl7U1.js} +1 -1
  45. package/dist/assets/{connectionStore-Ci04lJmR.js → connectionStore-DO6xQY7h.js} +1 -1
  46. package/dist/assets/{exportFile-tdUeW5m5.js → exportFile-C7xhE8Yh.js} +1 -1
  47. package/dist/assets/{index-DWV3tgrk.css → index-DcVOpnSj.css} +1 -1
  48. package/dist/assets/index-r1ZMLIZ9.js +8 -0
  49. package/dist/assets/{install-DhTYJCUC.js → install-BIVfix28.js} +1 -1
  50. package/dist/assets/useThroughputSeries-CVKzWzdv.js +1 -0
  51. package/dist/index.html +3 -3
  52. package/package.json +1 -1
  53. package/scripts/embedded.gen.ts +112 -112
  54. package/scripts/serve.ts +299 -98
  55. package/dist/assets/AddJob-CAhdg38n.js +0 -3
  56. package/dist/assets/Benchmark-CFZ3WCvj.js +0 -1
  57. package/dist/assets/BulkAddJobs-BzgzpGg_.js +0 -5
  58. package/dist/assets/CronManager-BcFALDeT.js +0 -1
  59. package/dist/assets/Database-CV2yt5O2.js +0 -3
  60. package/dist/assets/Diagnostics-D-EK4GEi.js +0 -1
  61. package/dist/assets/Flows-Ba8G7mcC.js +0 -1
  62. package/dist/assets/JobInspector--d_8ca9p.js +0 -2
  63. package/dist/assets/JobsPro-BcaokZIf.js +0 -1
  64. package/dist/assets/QueueActions-DHoSkWRz.js +0 -1
  65. package/dist/assets/Webhooks-C3zmvY-_.js +0 -1
  66. package/dist/assets/index-BOcegTHa.js +0 -8
  67. package/dist/assets/useThroughputSeries-Chp5OLx3.js +0 -1
@@ -0,0 +1,8 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CopilotPanel-DPZV9opm.js","assets/cn-CMFYpumL.js","assets/react-vendor-BcouBxpZ.js","assets/dist-DZL8soAh.js","assets/form-DGinTEEb.js","assets/AddJob-Dvpp--yq.js","assets/Benchmark-CkL-Ee-M.js","assets/connectionStore-DO6xQY7h.js","assets/AreaChart-2gM0YoZT.js","assets/BulkAddJobs-wI6cRZnX.js","assets/CronManager-BvfW219u.js","assets/Pagination-B9JDi5MI.js","assets/Database-D2T_ZIGA.js","assets/Diagnostics-C2goqq5h.js","assets/DlqControl-C5BfE7Gq.js","assets/exportFile-C7xhE8Yh.js","assets/DlqPro-ClPNmw-X.js","assets/promisePool-Daxkc1OB.js","assets/Flows-DbhMbvSG.js","assets/JobInspector-CO_zKjSX.js","assets/jobActions-CuOdMglt.js","assets/JobsPro-Drdgdj3s.js","assets/LogsPro-7uTBjPWX.js","assets/McpServer-DAklQDB5.js","assets/MetricsPro-PP3TymeP.js","assets/useThroughputSeries-CVKzWzdv.js","assets/QueueControl-CxKjUjF-.js","assets/QueueActions-DJTw0h2g.js","assets/QueueDetailPro-C-XLWFBa.js","assets/QueuesOverview-x7-akDzf.js","assets/S3BackupPro-BG_0OHW7.js","assets/ServerControl-DohTB--h.js","assets/UsagePro-CdnQkP9o.js","assets/Webhooks-CAwVmIEZ.js","assets/WorkersPro-CIJKl7U1.js","assets/Alerts-CR9jgCCs.js","assets/Cron-gWVkYWad.js","assets/Dlq-Q4TmmZrK.js","assets/Jobs-D2rDHPM_.js","assets/Logs-DjwGuRLi.js","assets/Metrics-Dup9Zinh.js","assets/Overview-C7RCDE6r.js","assets/QueueDetail-bf2n-r2h.js","assets/Queues-CMQW89J9.js","assets/S3Backup-1jAySC9R.js","assets/Settings-CnS5PjNe.js","assets/Usage-C3H0hMSA.js","assets/Workers-lvujKZwF.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,t}from"./cn-CMFYpumL.js";import{a as n,c as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./react-vendor-BcouBxpZ.js";import{a as h,i as g,n as _,o as v,r as y,t as ee}from"./connectionStore-DO6xQY7h.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var b=e(i(),1),x=s(),te=()=>`${Date.now().toString(36)}${Math.floor(Math.random()*1e6).toString(36)}`;function ne(e){return{channels:e.channels.map(e=>e.type===`email`?e:{...e,target:``}),rules:e.rules}}var re=v()(h(e=>({channels:[],rules:[],addChannel:(t,n)=>e(e=>({channels:[...e.channels,{id:te(),type:t,target:n}]})),removeChannel:t=>e(e=>({channels:e.channels.filter(e=>e.id!==t)})),addRule:t=>e(e=>({rules:[...e.rules,{...t,id:te()}]})),removeRule:t=>e(e=>({rules:e.rules.filter(e=>e.id!==t)})),toggleRule:t=>e(e=>({rules:e.rules.map(e=>e.id===t?{...e,enabled:!e.enabled}:e)}))}),{name:`bq-dash-alerts`,partialize:ne})),ie={error_rate:`error rate`,p99_latency:`p99 latency`,waiting:`waiting jobs`,failed:`failed jobs`,dlq:`DLQ size`},ae=1,S=v(e=>({toasts:[],push:({level:t,title:n,detail:r,ttlMs:i})=>{let a=ae++,o=i??(t===`error`?8e3:4e3);return e(e=>({toasts:[...e.toasts,{id:a,level:t,title:n,detail:r,ttlMs:o}].slice(-5)})),a},dismiss:t=>e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))})),C={success:(e,t)=>S.getState().push({level:`success`,title:e,detail:t}),error:(e,t)=>S.getState().push({level:`error`,title:e,detail:t}),info:(e,t)=>S.getState().push({level:`info`,title:e,detail:t})},w=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`BqError`}},oe=3e4;async function se(e,t,n,r,i=!0,a=`server`){let o;try{o=await fetch(e+t,{...r,headers:{"Content-Type":`application/json`,...n,...r?.headers},signal:r?.signal??AbortSignal.timeout(oe)})}catch(e){throw e?.name===`TimeoutError`?new w(`Request timed out`,0):e}if(!o.ok){let e=`HTTP ${o.status}`;try{let t=await o.json();t?.error&&(e=t.error)}catch{}throw o.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:a,auth:n.Authorization}})),new w(e,o.status)}if(o.status===204)return;let s=await o.text();if(!s)return;let c;try{c=JSON.parse(s)}catch{throw new w(`Invalid JSON response (HTTP ${o.status})`,o.status)}if(i&&c&&typeof c==`object`&&c.ok===!1){let e=c.error;throw new w(e??`Operation failed`,o.status)}return c}var T=(e,t,n=!0)=>se(y(),e,_(),t,n),ce=(globalThis.__BUNQUEUE_AGENT_URL__||`http://localhost:6800`).replace(/\/$/,``),E=(e,t)=>se(ce,e,ee(),t,!0,`agent`),D=e=>encodeURIComponent(e),O=(e,t)=>({method:e,body:t===void 0?void 0:JSON.stringify(t)}),le=3e5,ue=(e,t)=>({...O(e,t),signal:AbortSignal.timeout(le)}),de=[`job.pushed`,`job.started`,`job.completed`,`job.failed`,`job.progress`],k={overview:()=>T(`/dashboard`),queues:(e=500,t=0)=>T(`/dashboard/queues?limit=${e}&offset=${t}`),queuesSummary:()=>T(`/queues/summary`),queueDetail:(e,t=!0)=>T(`/dashboard/queues/${D(e)}?includeJobs=${t}`),stats:()=>T(`/stats`),storage:()=>T(`/storage`,void 0,!1),health:()=>T(`/health`,void 0,!1),ping:()=>T(`/ping`),prometheusUrl:()=>`${y()}/prometheus`,gc:()=>T(`/gc`,O(`POST`)),heapStats:()=>T(`/heapstats`),jobsList:(e,t,n=50,r=0)=>{let i=new URLSearchParams;return t?.length&&i.set(`states`,t.join(`,`)),i.set(`limit`,String(n)),i.set(`offset`,String(r)),T(`/queues/${D(e)}/jobs/list?${i}`)},job:e=>T(`/jobs/${D(e)}`),jobByCustomId:e=>T(`/jobs/custom/${D(e)}`),jobResult:e=>T(`/jobs/${D(e)}/result`),jobLogs:e=>T(`/jobs/${D(e)}/logs`),jobChildren:e=>T(`/jobs/${D(e)}/children`),addJob:(e,t)=>T(`/queues/${D(e)}/jobs`,O(`POST`,t)),addJobsBulk:(e,t)=>T(`/queues/${D(e)}/jobs/bulk`,ue(`POST`,{jobs:t})),pullBatch:(e,t)=>T(`/queues/${D(e)}/jobs/pull-batch`,O(`POST`,{count:t})),ackBatch:e=>T(`/jobs/ack-batch`,O(`POST`,{ids:e})),cancelJob:e=>T(`/jobs/${D(e)}`,{method:`DELETE`}),promoteJob:e=>T(`/jobs/${D(e)}/promote`,O(`POST`)),discardJob:e=>T(`/jobs/${D(e)}/discard`,O(`POST`)),retryJob:e=>T(`/jobs/${D(e)}/move-to-wait`,O(`POST`)),failJob:(e,t)=>T(`/jobs/${D(e)}/fail`,O(`POST`,{error:t})),updateJobData:(e,t)=>T(`/jobs/${D(e)}/data`,O(`PUT`,{data:t})),changePriority:(e,t)=>T(`/jobs/${D(e)}/priority`,O(`PUT`,{priority:t})),changeDelay:(e,t)=>T(`/jobs/${D(e)}/delay`,O(`PUT`,{delay:t})),moveToDelayed:(e,t)=>T(`/jobs/${D(e)}/move-to-delayed`,O(`POST`,{delay:t})),addJobLog:(e,t,n)=>T(`/jobs/${D(e)}/logs`,O(`POST`,{message:t,level:n})),clearJobLogs:e=>T(`/jobs/${D(e)}/logs`,{method:`DELETE`}),setJobProgress:(e,t,n)=>T(`/jobs/${D(e)}/progress`,O(`POST`,{progress:t,message:n})),counts:e=>T(`/queues/${D(e)}/counts`),pause:e=>T(`/queues/${D(e)}/pause`,O(`POST`)),resume:e=>T(`/queues/${D(e)}/resume`,O(`POST`)),drain:e=>T(`/queues/${D(e)}/drain`,ue(`POST`)),obliterate:e=>T(`/queues/${D(e)}/obliterate`,ue(`POST`)),clean:(e,t={})=>T(`/queues/${D(e)}/clean`,O(`POST`,t)),promoteJobs:(e,t)=>T(`/queues/${D(e)}/promote-jobs`,O(`POST`,t==null?void 0:{count:t})),retryCompleted:(e,t)=>T(`/queues/${D(e)}/retry-completed`,O(`POST`,t?{id:t}:void 0)),setRateLimit:(e,t)=>T(`/queues/${D(e)}/rate-limit`,O(`PUT`,{limit:t})),clearRateLimit:e=>T(`/queues/${D(e)}/rate-limit`,{method:`DELETE`}),setConcurrency:(e,t)=>T(`/queues/${D(e)}/concurrency`,O(`PUT`,{concurrency:t})),clearConcurrency:e=>T(`/queues/${D(e)}/concurrency`,{method:`DELETE`}),getStallConfig:e=>T(`/queues/${D(e)}/stall-config`),setStallConfig:(e,t)=>T(`/queues/${D(e)}/stall-config`,O(`PUT`,{config:t})),getDlqConfig:e=>T(`/queues/${D(e)}/dlq-config`),setDlqConfig:(e,t)=>T(`/queues/${D(e)}/dlq-config`,O(`PUT`,{config:t})),dlq:(e,t=100,n=0)=>T(`/queues/${D(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>T(`/queues/${D(e)}/dlq/stats`),retryDlq:(e,t)=>T(`/queues/${D(e)}/dlq/retry`,O(`POST`,t?{jobId:t}:void 0)),purgeDlq:e=>T(`/queues/${D(e)}/dlq/purge`,O(`POST`)),crons:()=>T(`/crons`),createCron:e=>T(`/crons`,O(`POST`,e)),deleteCron:e=>T(`/crons/${D(e)}`,{method:`DELETE`}),webhooks:()=>T(`/webhooks`),addWebhook:e=>T(`/webhooks`,O(`POST`,e)),removeWebhook:e=>T(`/webhooks/${D(e)}`,{method:`DELETE`}),setWebhookEnabled:(e,t)=>T(`/webhooks/${D(e)}/enabled`,O(`PUT`,{enabled:t})),workers:()=>T(`/workers`),unregisterWorker:e=>T(`/workers/${D(e)}`,{method:`DELETE`}),eventsUrl:e=>y()+(e?`/events/queues/${D(e)}`:`/events`),db:{info:()=>E(`/db/info`),tables:()=>E(`/db/tables`),schema:e=>E(`/db/tables/${D(e)}/schema`),rows:(e,t=50,n=0,r,i=`asc`,a)=>E(`/db/tables/${D(e)}?limit=${t}&offset=${n}`+(r?`&orderBy=${D(r)}&dir=${i}`:``)+(a?.value?`&fcol=${D(a.column)}&fop=${a.op}&fval=${D(a.value)}`:``)),cell:(e,t,n)=>E(`/db/tables/${D(e)}/cell?rowid=${t}&column=${D(n)}`),query:e=>E(`/db/query`,O(`POST`,{sql:e}))},agentBase:ce,control:{status:()=>E(`/control/status`),start:()=>E(`/control/start`,{method:`POST`}),stop:()=>E(`/control/stop`,{method:`POST`}),restart:()=>E(`/control/restart`,{method:`POST`}),logs:()=>E(`/control/logs`),getConfig:()=>E(`/control/config`),setConfig:e=>E(`/control/config`,O(`PUT`,e))}},fe=15e3,pe=6e4,me=3,he=v(e=>({breaching:[],setBreaching:t=>e({breaching:t})}));async function ge(){if(typeof Notification>`u`)return`denied`;if(Notification.permission===`granted`)return`granted`;try{return await Notification.requestPermission()}catch{return`denied`}}function _e(e,t,n){switch(t){case`>=`:return e>=n;case`>`:return e>n;case`<=`:return e<=n;case`<`:return e<n;default:return!1}}var ve=(e,t)=>{let n=e+t;return n>0?t/n*100:0};function ye(e,t){let n=e.queue.trim();switch(e.metric){case`waiting`:return t.summary?n?t.summary.find(e=>e.name===n)?.counts.waiting??null:t.summary.reduce((e,t)=>e+t.counts.waiting,0):null;case`failed`:return t.summary?n?t.summary.find(e=>e.name===n)?.counts.failed??null:t.summary.reduce((e,t)=>e+t.counts.failed,0):null;case`dlq`:return t.queues?n?t.queues.find(e=>e.name===n)?.dlq??null:t.queues.reduce((e,t)=>e+(t.dlq??0),0):null;case`error_rate`:if(!t.summary)return null;if(n){let e=t.summary.find(e=>e.name===n);return e?ve(e.counts.completed,e.counts.failed):null}return ve(t.summary.reduce((e,t)=>e+t.counts.completed,0),t.summary.reduce((e,t)=>e+t.counts.failed,0));case`p99_latency`:{let e=t.overview?.latency?.percentiles;if(!e)return null;let n=Object.values(e).map(e=>e.p99).filter(e=>Number.isFinite(e));return n.length?Math.max(...n):null}default:return null}}var be=e=>`${e.queue||`All queues`}: ${e.metricLabel} ${e.operator} ${e.threshold} (now ${Math.round(e.value)})`;function xe(e){if(typeof Notification<`u`&&Notification.permission===`granted`)try{new Notification(`bunqueue alert: ${e.ruleName}`,{body:be(e),tag:e.ruleId})}catch{}}function Se(e){C.error(`Alert: ${e.ruleName}`,be(e)),xe(e)}function Ce(e){if(e.length<=me){for(let t of e)Se(t);return}C.error(`${e.length} alert rules breaching`,e.map(e=>e.ruleName).join(`, `));for(let t of e)xe(t)}async function we(){try{let e=await k.queues(),t=[...e.queues],n=e.total??t.length;for(let e=0;t.length<n&&e<20;e++){let e=await k.queues(500,t.length);if(!e.queues.length)break;t.push(...e.queues)}return t}catch{return null}}function Te(){let e=re(e=>e.rules),t=he(e=>e.setBreaching),n=(0,b.useRef)(new Map),r=(0,b.useRef)(new Map),i=(0,b.useRef)(new Map),a=(0,b.useRef)(new Map),o=e.filter(e=>e.enabled).map(e=>`${e.id}:${e.metric}:${e.operator}:${e.threshold}:${e.queue}`).join(`|`);(0,b.useEffect)(()=>{if(!o){t([]),n.current.clear(),r.current.clear(),i.current.clear(),a.current.clear();return}let e=!1,s=!1,c=async()=>{if(!s){s=!0;try{let[o,s,c]=await Promise.all([k.queuesSummary().catch(()=>null),we(),k.overview().catch(()=>null)]);if(e)return;let l=re.getState().rules.filter(e=>e.enabled),u=new Set(l.map(e=>e.id));for(let e of[...n.current.keys()])u.has(e)||(n.current.delete(e),r.current.delete(e),i.current.delete(e),a.current.delete(e));if(!c){let e=he.getState().breaching,n=e.filter(e=>u.has(e.ruleId));n.length!==e.length&&t(n);return}let d={summary:o,queues:s,overview:c},f=Date.now(),p=[],m=[];for(let e of l){let t=ye(e,d);if(t==null){let t=n.current.get(e.id)?a.current.get(e.id):void 0;t&&p.push(t);continue}let o=_e(t,e.operator,e.threshold),s=n.current.get(e.id)??!1;if(o){let n=s?i.current.get(e.id)??f:f;i.current.set(e.id,n);let o={ruleId:e.id,ruleName:e.name,metricLabel:ie[e.metric],operator:e.operator,threshold:e.threshold,value:t,queue:e.queue,at:n};p.push(o),a.current.set(e.id,o);let c=r.current.get(e.id)??0;f-c>pe&&c<n&&(m.push(o),r.current.set(e.id,f))}else i.current.delete(e.id),a.current.delete(e.id);n.current.set(e.id,o)}Ce(m),t(p)}finally{s=!1}}};c();let l=setInterval(c,fe);return()=>{e=!0,clearInterval(l)}},[o,t])}function Ee(){return Te(),null}var A=p();function De(){let[e,t]=(0,b.useState)(!1),[n,r]=(0,b.useState)(`server`),[i,a]=(0,b.useState)(``),o=g(e=>e.baseUrl),s=g(e=>e.setToken),c=g(e=>e.setAgentToken),l=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let e=e=>{let n=e.detail?.scope;r(n===`agent`?`agent`:`server`),t(!0)};return window.addEventListener(`auth:required`,e),()=>window.removeEventListener(`auth:required`,e)},[]),(0,b.useEffect)(()=>{if(!e)return;let t=requestAnimationFrame(()=>l.current?.focus());return()=>cancelAnimationFrame(t)},[e]),e?(0,A.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,children:(0,A.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let r=i.trim();r&&(n===`agent`?c(r):s(r),a(``),t(!1))},role:`dialog`,"aria-modal":`true`,"aria-label":`Authentication required`,className:`w-full max-w-sm rounded-xl border border-line-strong bg-surface p-6 shadow-2xl`,children:[(0,A.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:`Authentication required`}),n===`agent`?(0,A.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[`The control agent at `,(0,A.jsx)(`span`,{className:`break-all font-mono text-fg`,children:k.agentBase}),` `,`rejected the request (401). Enter its`,` `,(0,A.jsx)(`span`,{className:`font-mono text-fg`,children:`AGENT_TOKEN`}),` to continue.`]}):(0,A.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[`The server at `,(0,A.jsx)(`span`,{className:`break-all font-mono text-fg`,children:o}),` rejected the request (401). Enter its bearer token to continue.`]}),(0,A.jsx)(`input`,{ref:l,type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:n===`agent`?`AGENT_TOKEN`:`Bearer token`,"aria-label":n===`agent`?`Agent token`:`Bearer token`,autoComplete:`off`,className:`mt-4 w-full rounded-lg border border-line bg-surface-2 px-3 py-2 text-sm text-fg outline-none placeholder:text-faint focus-visible:ring-2 focus-visible:ring-accent/50`}),(0,A.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-3`,children:[(0,A.jsx)(d,{to:`/settings`,onClick:()=>t(!1),className:`text-xs text-muted underline-offset-2 hover:text-fg hover:underline`,children:`Open Settings instead`}),(0,A.jsx)(`button`,{type:`submit`,disabled:!i.trim(),className:`rounded-lg bg-accent px-4 py-2 text-sm font-medium text-accent-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-50`,children:`Unlock`})]})]})}):null}function j(e){typeof document<`u`&&(document.documentElement.dataset.theme=e,document.documentElement.style.colorScheme=e)}var M=v()(h((e,t)=>({theme:`dark`,toggle:()=>{let n=t().theme===`dark`?`light`:`dark`;j(n),e({theme:n})},setTheme:t=>{j(t),e({theme:t})}}),{name:`bq-dash-theme`,onRehydrateStorage:()=>e=>{e&&j(e.theme)}}));function Oe(){j(M.getState().theme)}function N({children:e,...t}){return(0,A.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...t,children:e})}var ke=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M3 3v18h18`}),(0,A.jsx)(`rect`,{x:`7`,y:`12`,width:`3`,height:`6`}),(0,A.jsx)(`rect`,{x:`12`,y:`8`,width:`3`,height:`10`}),(0,A.jsx)(`rect`,{x:`17`,y:`5`,width:`3`,height:`13`})]}),P=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,A.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,A.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,A.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`}),(0,A.jsx)(`line`,{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`}),(0,A.jsx)(`line`,{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`})]}),F=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`2`,y:`7`,width:`20`,height:`14`,rx:`2`}),(0,A.jsx)(`path`,{d:`M16 7V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`})]}),I=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z`}),(0,A.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,A.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),Ae=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,A.jsx)(`polyline`,{points:`12 7 12 12 15 14`})]}),je=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M3 3v18h18`}),(0,A.jsx)(`path`,{d:`m19 9-5 5-4-4-3 3`})]}),L=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`8`,rx:`2`}),(0,A.jsx)(`rect`,{x:`4`,y:`14`,width:`16`,height:`6`,rx:`2`}),(0,A.jsx)(`line`,{x1:`8`,y1:`8`,x2:`8.01`,y2:`8`}),(0,A.jsx)(`line`,{x1:`8`,y1:`17`,x2:`8.01`,y2:`17`})]}),Me=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9`}),(0,A.jsx)(`path`,{d:`M13.73 21a2 2 0 0 1-3.46 0`})]}),Ne=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,A.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,A.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,A.jsx)(`path`,{d:`M3 6h.01M3 12h.01M3 18h.01`})]}),Pe=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M12 20V10`}),(0,A.jsx)(`path`,{d:`M18 20V4`}),(0,A.jsx)(`path`,{d:`M6 20v-4`})]}),Fe=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,A.jsx)(`path`,{d:`M4 5v6c0 1.66 3.58 3 8 3s8-1.34 8-3V5`}),(0,A.jsx)(`path`,{d:`M4 11v6c0 1.66 3.58 3 8 3s8-1.34 8-3v-6`})]}),Ie=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,A.jsx)(`path`,{d:`M3 10h18`}),(0,A.jsx)(`path`,{d:`M9 10v10`})]}),Le=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,A.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z`})]}),Re=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,A.jsx)(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41`})]}),ze=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z`})}),Be=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),Ve=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),He=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})}),Ue=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`}),(0,A.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`})]}),We=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,A.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]}),Ge=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`polyline`,{points:`23 4 23 10 17 10`}),(0,A.jsx)(`polyline`,{points:`1 20 1 14 7 14`}),(0,A.jsx)(`path`,{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`})]}),Ke=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,A.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),qe=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8Z`}),(0,A.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),R=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polygon`,{points:`13 2 3 14 12 14 11 22 21 10 12 10 13 2`})}),Je=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,A.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),Ye=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),Xe=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,A.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]}),Ze=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,A.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),Qe=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`3`,y1:`6`,x2:`21`,y2:`6`}),(0,A.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),(0,A.jsx)(`line`,{x1:`3`,y1:`18`,x2:`21`,y2:`18`})]}),$e=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,A.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,A.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]}),z=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`ApiError`}},et=3e4;async function B(e,t,n=!0){let r;try{r=await fetch(y()+e,{...t,headers:{"Content-Type":`application/json`,..._(),...t?.headers},signal:t?.signal??AbortSignal.timeout(et)})}catch(e){throw e?.name===`TimeoutError`?new z(`Request timed out`,0):e}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=await r.json();t?.error&&(e=t.error)}catch{}throw new z(e,r.status)}if(r.status===204)return;let i=await r.text();if(!i)return;let a;try{a=JSON.parse(i)}catch{throw new z(`Invalid JSON response (HTTP ${r.status})`,r.status)}if(n&&a&&typeof a==`object`&&a.ok===!1){let e=a.error;throw new z(e??`Operation failed`,r.status)}return a}var V=e=>encodeURIComponent(e),H=(e,t)=>B(e,{method:`POST`,body:t?JSON.stringify(t):void 0}),tt=(e,t)=>B(e,{method:`PUT`,body:t?JSON.stringify(t):void 0}),U=e=>B(e,{method:`DELETE`}),nt={overview:()=>B(`/dashboard`),queues:(e=200,t=0)=>B(`/dashboard/queues?limit=${e}&offset=${t}`),queueDetail:(e,t=!0)=>B(`/dashboard/queues/${V(e)}?includeJobs=${t}`),stats:()=>B(`/stats`),storage:()=>B(`/storage`,void 0,!1),health:()=>B(`/health`,void 0,!1),jobsList:(e,t={})=>{let n=new URLSearchParams;return t.states?.length&&n.set(`states`,t.states.join(`,`)),n.set(`limit`,String(t.limit??50)),n.set(`offset`,String(t.offset??0)),B(`/queues/${V(e)}/jobs/list?${n.toString()}`)},job:e=>B(`/jobs/${V(e)}`),cancelJob:e=>U(`/jobs/${V(e)}`),promoteJob:e=>H(`/jobs/${V(e)}/promote`),retryJob:e=>H(`/jobs/${V(e)}/move-to-wait`),pause:e=>H(`/queues/${V(e)}/pause`),resume:e=>H(`/queues/${V(e)}/resume`),drain:e=>H(`/queues/${V(e)}/drain`),obliterate:e=>H(`/queues/${V(e)}/obliterate`),clean:(e,t=0,n=1e3)=>H(`/queues/${V(e)}/clean`,{grace:t,limit:n}),retryCompleted:e=>H(`/queues/${V(e)}/retry-completed`),setRateLimit:(e,t)=>tt(`/queues/${V(e)}/rate-limit`,{limit:t}),clearRateLimit:e=>U(`/queues/${V(e)}/rate-limit`),setConcurrency:(e,t)=>tt(`/queues/${V(e)}/concurrency`,{concurrency:t}),clearConcurrency:e=>U(`/queues/${V(e)}/concurrency`),dlq:(e,t=50,n=0)=>B(`/queues/${V(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>B(`/queues/${V(e)}/dlq/stats`),retryDlq:e=>H(`/queues/${V(e)}/dlq/retry`),purgeDlq:e=>H(`/queues/${V(e)}/dlq/purge`),crons:()=>B(`/crons`),deleteCron:e=>U(`/crons/${V(e)}`),workers:()=>B(`/workers`),eventsUrl:e=>y()+(e?`/events/queues/${V(e)}`:`/events`)};function rt(e){let t=!0;return()=>t?(t=!1,!0):!e()}function it(e,t=[],n={}){let r=g(e=>e.refreshMs),i=n.intervalMs??r,[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(!0),d=(0,b.useRef)(e);d.current=e;let f=(0,b.useRef)(!0),p=(0,b.useRef)(0),m=(0,b.useRef)(void 0),h=(0,b.useRef)(!0),_=(0,b.useRef)(!1),v=(0,b.useCallback)(async()=>{let e=++p.current;try{let t=await d.current();if(!f.current||e!==p.current)return;let n;try{n=JSON.stringify(t)}catch{n=String(Math.random())}n!==m.current&&(m.current=n,o(t)),_.current&&(_.current=!1,c(null))}catch(t){if(!f.current||e!==p.current)return;_.current=!0,c(t)}finally{f.current&&e===p.current&&h.current&&(h.current=!1,u(!1))}},[]);return(0,b.useEffect)(()=>{f.current=!0,m.current=void 0,h.current=!0,u(!0),_.current&&(_.current=!1,c(null));let e=null,t=!1,n=!1,r=()=>typeof document<`u`&&document.hidden,a=rt(r),o=async()=>{if(!t){if(a()&&!n){n=!0;try{await v()}finally{n=!1}}t||(e=setTimeout(o,i))}};o();let s=()=>{r()||t||n||(e&&=(clearTimeout(e),null),o())};return typeof document<`u`&&document.addEventListener(`visibilitychange`,s),()=>{t=!0,f.current=!1,e&&clearTimeout(e),typeof document<`u`&&document.removeEventListener(`visibilitychange`,s)}},[i,v,...t]),{data:a,error:s,loading:l,refreshing:l,refetch:v}}function at(e){try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function ot({value:e,className:n}){let[r,i]=(0,b.useState)(`idle`),a=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,A.jsx)(`button`,{type:`button`,onClick:async()=>{let t=!1;if(navigator.clipboard)try{await navigator.clipboard.writeText(e),t=!0}catch{}t||=at(e),i(t?`copied`:`failed`),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(`idle`),1500)},"aria-label":`Copy to clipboard`,title:r===`failed`?`Copy failed`:`Copy to clipboard`,className:t(`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-faint transition-colors hover:bg-surface-2 hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,n),children:r===`copied`?(0,A.jsx)(Ye,{className:`size-3.5 text-success`}):r===`failed`?(0,A.jsx)(Je,{className:`size-3.5 text-danger`}):(0,A.jsx)(Ze,{className:`size-3.5`})})}var st;function W(){return st===void 0&&(st=ct()),st}function ct(){if(typeof window>`u`)return!1;let{search:e,hash:t}=window.location;return new URLSearchParams(e).has(`demo`)||t.replace(/^#/,``)===`demo`}var lt=`https://github.com/egeominotti/bunqueue-dashboard`,ut=`https://egeominotti.github.io/bunqueue-dashboard/docs/`,dt=`bunx bunqueue-dashboard`;function ft(){return(0,A.jsxs)(`div`,{className:`mx-3 mb-2 rounded-lg border border-accent/30 bg-accent/5 p-3`,children:[(0,A.jsx)(`p`,{className:`mb-2 text-[11px] font-medium leading-snug text-fg`,children:`Like it? Run it on your own bunqueue server.`}),(0,A.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 rounded-md border border-line bg-surface-2 px-2 py-1`,children:[(0,A.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-fg`,children:dt}),(0,A.jsx)(ot,{value:dt})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(`a`,{href:lt,target:`_blank`,rel:`noreferrer`,className:`flex flex-1 items-center justify-center gap-1 rounded-md bg-accent px-2 py-1.5 text-[11px] font-semibold text-accent-fg transition-opacity hover:opacity-90`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`★`}),` Star`]}),(0,A.jsx)(`a`,{href:ut,target:`_blank`,rel:`noreferrer`,className:`flex flex-1 items-center justify-center rounded-md border border-line px-2 py-1.5 text-[11px] font-medium text-muted transition-colors hover:bg-surface-2 hover:text-fg`,children:`Docs`})]})]})}function pt(){let e=g(e=>e.baseUrl),t=e===`/api`?`localhost:6790`:e.replace(/^https?:\/\//,``);return(0,A.jsxs)(A.Fragment,{children:[W()&&(0,A.jsx)(ft,{}),(0,A.jsxs)(`div`,{className:`mx-3 mb-3 flex items-center gap-2.5 rounded-lg border border-line bg-surface px-3 py-2`,children:[(0,A.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-accent to-fuchsia-600 text-[11px] font-bold text-white`,children:`bq`}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`truncate text-xs font-medium text-fg`,children:`bunqueue`}),(0,A.jsx)(`div`,{className:`truncate font-mono text-[10px] text-faint`,title:e,children:t})]}),(0,A.jsx)(d,{to:`/settings`,"aria-label":`Settings`,className:`text-faint transition-colors hover:text-fg`,children:(0,A.jsx)(Le,{className:`size-4`})})]})]})}var mt=[{section:null,items:[{to:`/`,label:`Overview`,icon:ke,end:!0}]},{section:`Queues`,items:[{to:`/queues`,label:`Queues`,icon:P},{to:`/jobs`,label:`Jobs`,icon:F},{to:`/dlq`,label:`Dead Letter Queue`,icon:I},{to:`/cron`,label:`Cron Jobs`,icon:Ae},{to:`/flows`,label:`Flows`,icon:Xe}]},{section:`Monitoring`,items:[{to:`/metrics`,label:`Metrics`,icon:je},{to:`/workers`,label:`Workers`,icon:L},{to:`/logs`,label:`Logs`,icon:Ne},{to:`/alerts`,label:`Alerts`,icon:Me}]},{section:`Control`,items:[{to:`/server`,label:`Server`,icon:L},{to:`/add-job`,label:`Add Job`,icon:F},{to:`/jobs/bulk-add`,label:`Bulk Add`,icon:F},{to:`/job`,label:`Job Inspector`,icon:qe},{to:`/queue-control`,label:`Queue Control`,icon:P},{to:`/dlq-control`,label:`DLQ Control`,icon:I},{to:`/webhooks`,label:`Webhooks`,icon:R},{to:`/diagnostics`,label:`Diagnostics`,icon:je},{to:`/benchmark`,label:`Benchmark`,icon:R}]},{section:`Management`,items:[{to:`/database`,label:`Database`,icon:Ie},{to:`/mcp`,label:`MCP`,icon:R},{to:`/usage`,label:`Usage`,icon:Pe},{to:`/s3`,label:`S3 Backup`,icon:Fe},{to:`/settings`,label:`Settings`,icon:Le}]}];function ht(){let e=g(e=>e.baseUrl),{data:n,error:r,loading:i}=it(async()=>({ok:(await nt.health()).ok}),[],{intervalMs:15e3}),a=!r&&n!=null&&n.ok!==!1,o=e.replace(/^https?:\/\//,``)||`local`;return(0,A.jsxs)(`div`,{className:`mx-3 mb-4 flex items-center gap-2 rounded-lg border border-line bg-surface px-3 py-1.5`,children:[(0,A.jsx)(`span`,{className:t(`size-1.5 rounded-full`,i?`bg-zinc-500`:a?`bg-emerald-400`:`bg-red-400`),title:i?`connecting`:a?`connected`:`offline`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted`,title:e,children:o}),(0,A.jsx)(`span`,{className:`sr-only`,children:i?`connecting`:a?`connected`:`offline`})]})}function gt(){let e=M(e=>e.theme),t=M(e=>e.toggle),n=e===`dark`;return(0,A.jsxs)(`button`,{type:`button`,onClick:t,className:`mx-3 mb-3 flex items-center gap-3 rounded-lg px-3 py-2 text-sm text-muted transition-colors hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[n?(0,A.jsx)(Re,{className:`size-4`}):(0,A.jsx)(ze,{className:`size-4`}),n?`Light Mode`:`Dark Mode`]})}function _t({open:e=!1,onClose:n}){return(0,A.jsxs)(A.Fragment,{children:[e&&(0,A.jsx)(`button`,{type:`button`,"aria-label":`Close navigation`,onClick:n,className:`fixed inset-0 z-40 bg-black/50 lg:hidden`}),(0,A.jsxs)(`aside`,{id:`app-nav`,className:t(`flex w-60 shrink-0 flex-col border-r border-line bg-sidebar`,`fixed inset-y-0 left-0 z-50 transition-[transform,visibility] lg:static lg:z-auto lg:translate-x-0`,e?`translate-x-0`:`-translate-x-full lg:translate-x-0 invisible lg:visible`),children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-5`,children:[(0,A.jsx)(`span`,{className:`text-lg font-bold tracking-tight text-fg`,children:`bunqueue`}),(0,A.jsx)(`span`,{className:`rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-accent`,children:`dash`}),(0,A.jsx)(`span`,{title:`Beta — under active development`,className:`rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-warning`,children:`beta`})]}),(0,A.jsx)(`nav`,{className:`flex-1 overflow-y-auto px-3 pb-4`,children:mt.map(e=>(0,A.jsxs)(`div`,{className:`mb-4`,children:[e.section&&(0,A.jsx)(`div`,{className:`px-2 pb-2 pt-1 text-[10px] font-semibold uppercase tracking-wider text-faint`,children:e.section}),(0,A.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.items.map(({to:e,label:n,icon:r,end:i})=>(0,A.jsx)(a,{to:e,end:i,className:({isActive:e})=>t(`group relative flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,e?`bg-surface-2 text-fg`:`text-muted hover:bg-surface-2/60 hover:text-fg`),children:({isActive:e})=>(0,A.jsxs)(A.Fragment,{children:[e&&(0,A.jsx)(`span`,{className:`absolute inset-y-1.5 left-0 w-0.5 rounded-full bg-accent`}),(0,A.jsx)(r,{className:`size-[18px] shrink-0`}),(0,A.jsx)(`span`,{className:`truncate`,children:n})]})},e))})]},e.section??`root`))}),(0,A.jsx)(ht,{}),(0,A.jsx)(gt,{}),(0,A.jsx)(pt,{})]})]})}var vt=`https://egeominotti.github.io/bunqueue-dashboard/docs/`;function yt(){let[e,t]=(0,b.useState)(!1),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(0),o=m(),s=M(e=>e.toggle),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useMemo)(()=>{let e=mt.flatMap(e=>e.items.map(t=>({id:`nav:${t.to}`,label:t.label,hint:e.section??`Home`,run:()=>o(t.to)}))),t=[{id:`act:theme`,label:`Toggle theme (dark / light)`,hint:`Action`,run:s},{id:`act:docs`,label:`Open documentation`,hint:`Action`,run:()=>window.open(vt,`_blank`,`noopener`)}];return[...e,...t]},[o,s]),d=(0,b.useMemo)(()=>{let e=n.trim().toLowerCase();return e?u.filter(t=>`${t.label} ${t.hint}`.toLowerCase().includes(e)):u},[u,n]);(0,b.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),t(e=>!e))},n=()=>t(!0);return window.addEventListener(`keydown`,e),window.addEventListener(`command-palette:open`,n),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`command-palette:open`,n)}},[]),(0,b.useEffect)(()=>{if(!e)return;let t=document.activeElement;r(``),a(0);let n=requestAnimationFrame(()=>c.current?.focus());return()=>{cancelAnimationFrame(n),t?.focus?.()}},[e]),(0,b.useEffect)(()=>{l.current?.querySelector(`[data-idx="${i}"]`)?.scrollIntoView({block:`nearest`})},[i]);let f=(0,b.useCallback)(()=>t(!1),[]),p=(0,b.useCallback)(e=>{e&&(e.run(),t(!1))},[]);return e?(0,A.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center p-4 pt-[12vh]`,children:[(0,A.jsx)(`button`,{type:`button`,"aria-label":`Close command palette`,onClick:f,className:`fixed inset-0 bg-black/50`}),(0,A.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,className:`relative z-10 w-full max-w-lg overflow-hidden rounded-xl border border-line-strong bg-surface shadow-2xl`,children:[(0,A.jsx)(`input`,{ref:c,value:n,onChange:e=>{r(e.target.value),a(0)},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),f()):e.key===`ArrowDown`?(e.preventDefault(),a(e=>Math.min(e+1,d.length-1))):e.key===`ArrowUp`?(e.preventDefault(),a(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),p(d[i]))},placeholder:`Search pages and actions…`,"aria-label":`Search pages and actions`,className:`w-full border-b border-line bg-transparent px-4 py-3 text-sm text-fg outline-none placeholder:text-faint`}),(0,A.jsxs)(`ul`,{ref:l,className:`max-h-80 overflow-y-auto py-2`,"aria-label":`Results`,children:[d.length===0&&(0,A.jsx)(`li`,{className:`px-4 py-6 text-center text-sm text-faint`,children:`No matches`}),d.map((e,t)=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{type:`button`,"data-idx":t,onMouseEnter:()=>a(t),onClick:()=>p(e),className:`flex w-full items-center justify-between gap-3 px-4 py-2 text-left text-sm transition-colors ${t===i?`bg-accent/15 text-fg`:`text-muted`}`,children:[(0,A.jsx)(`span`,{className:`truncate`,children:e.label}),(0,A.jsx)(`span`,{className:`shrink-0 text-xs text-faint`,children:e.hint})]})},e.id))]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-t border-line px-4 py-2 text-xs text-faint`,children:[(0,A.jsx)(`span`,{children:`↑↓ navigate · ↵ open · esc close`}),(0,A.jsx)(`span`,{className:`font-mono`,children:`⌘K`})]})]})]}):null}var bt=0,xt=()=>typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${(bt++).toString(36)}-${Math.random().toString(36).slice(2,8)}`,G=new Map,K=(e,t,n)=>e.map(e=>e.id===t?n(e):e);function St(e){return{config:{provider:e.config.provider,baseURL:e.config.baseURL,model:e.config.model}}}var q=v()(h(e=>({open:!1,config:{provider:`anthropic`,baseURL:``,model:`claude-opus-4-8`,apiKey:``},messages:[],pending:[],busy:!1,setOpen:t=>e({open:t}),toggle:()=>e(e=>({open:!e.open})),setConfig:t=>e(e=>({config:{...e.config,...t}})),clear:()=>{for(let e of G.values())e(!1);G.clear(),e({messages:[],pending:[]})},cancelPending:()=>{for(let e of G.values())e(!1);G.clear(),e({pending:[]})},setBusy:t=>e({busy:t}),addUser:t=>e(e=>({messages:[...e.messages,{id:xt(),role:`user`,content:t}]})),startAssistant:()=>{let t=xt();return e(e=>({messages:[...e.messages,{id:t,role:`assistant`,content:``,tools:[]}]})),t},appendAssistant:(t,n)=>e(e=>({messages:K(e.messages,t,e=>({...e,content:e.content+n}))})),finishAssistant:(t,n)=>e(e=>({messages:K(e.messages,t,e=>({...e,done:!0,error:!!n?.error,content:n?.error?e.content?`${e.content}\n\n${n.error}`:n.error:e.content}))})),addTool:(t,n)=>e(e=>({messages:K(e.messages,t,e=>({...e,tools:[...e.tools??[],n]}))})),updateTool:(t,n,r)=>e(e=>({messages:K(e.messages,t,e=>({...e,tools:(e.tools??[]).map(e=>e.id===n?{...e,...r}:e)}))})),requestConfirm:t=>new Promise(n=>{let r=xt();G.set(r,n),e(e=>({pending:[...e.pending,{...t,id:r}]}))}),resolveConfirm:(t,n)=>{let r=G.get(t);r&&(G.delete(t),r(n)),e(e=>({pending:e.pending.filter(e=>e.id!==t)}))}}),{name:`bq-dash-copilot`,partialize:e=>St(e),merge:(e,t)=>{let n=e??{};return{...t,config:{...t.config,...n.config??{},apiKey:``}}}})),Ct=(0,b.lazy)(()=>u(()=>import(`./CopilotPanel-DPZV9opm.js`).then(e=>({default:e.CopilotPanel})),__vite__mapDeps([0,1,2,3,4])));function wt({className:e}){return(0,A.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[(0,A.jsx)(`path`,{d:`M12 3l1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3z`,fill:`currentColor`}),(0,A.jsx)(`path`,{d:`M19 14l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8.8-2z`,fill:`currentColor`,opacity:`0.7`})]})}var Tt=class extends b.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,A.jsxs)(`div`,{className:`fixed inset-y-0 right-0 z-[60] flex w-full max-w-md flex-col items-center justify-center gap-3 border-l border-line bg-surface px-6 text-center`,children:[(0,A.jsx)(`p`,{className:`text-sm text-fg`,children:`Copilot failed to load.`}),(0,A.jsx)(`p`,{className:`text-xs text-muted`,children:`The panel is loaded on demand; the request failed. If the dashboard was just redeployed, reload the page. The rest of the dashboard is unaffected.`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>{this.setState({failed:!1}),this.props.onClose()},className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Close`})]}):this.props.children}};function Et(){let e=q(e=>e.open),t=q(e=>e.setOpen);return(0,A.jsxs)(A.Fragment,{children:[!e&&(0,A.jsxs)(`button`,{type:`button`,onClick:()=>t(!0),className:`fixed bottom-5 right-5 z-40 flex items-center gap-2 rounded-full border border-line bg-surface px-4 py-2.5 text-sm font-medium text-fg shadow-lg transition-colors hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,"aria-label":`Open Copilot`,children:[(0,A.jsx)(wt,{className:`size-4 text-accent`}),`Copilot`,(0,A.jsx)(`span`,{className:`rounded bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-accent`,children:`beta`})]}),e&&(0,A.jsx)(Tt,{onClose:()=>t(!1),children:(0,A.jsx)(b.Suspense,{fallback:(0,A.jsx)(`div`,{className:`fixed inset-y-0 right-0 z-[60] flex w-full max-w-md items-center justify-center border-l border-line bg-surface text-sm text-muted`,children:`Loading Copilot…`}),children:(0,A.jsx)(Ct,{})})})]})}var Dt={default:`border border-line bg-surface-2 text-fg hover:bg-surface-2/70 hover:border-line-strong`,ghost:`text-muted hover:text-fg hover:bg-surface-2`,accent:`bg-accent text-accent-fg hover:opacity-90 border border-transparent`,danger:`border border-red-500/30 text-danger hover:bg-red-500/10 hover:border-red-500/50`,warning:`border border-amber-500/30 text-warning hover:bg-amber-500/10 hover:border-amber-500/50`,success:`bg-emerald-500 text-white hover:bg-emerald-500/90 border border-transparent`},Ot={sm:`h-8 px-3 text-xs gap-1.5`,md:`h-9 px-4 text-sm gap-2`};function kt({children:e,variant:n=`default`,size:r=`md`,className:i,...a}){return(0,A.jsx)(`button`,{type:`button`,className:t(`inline-flex items-center justify-center rounded-lg font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,`disabled:cursor-not-allowed disabled:opacity-50`,Dt[n],Ot[r],i),...a,children:e})}function At({children:e,className:n,variant:r=`ghost`,...i}){return(0,A.jsx)(`button`,{type:`button`,className:t(`inline-flex size-8 items-center justify-center rounded-lg transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,`disabled:cursor-not-allowed disabled:opacity-50`,Dt[r],n),...i,children:e})}function J({children:e,className:n,padded:r=!0}){return(0,A.jsx)(`div`,{className:t(`rounded-xl border border-line bg-surface`,r&&`p-5`,n),children:e})}function jt({title:e,action:t,icon:n}){return(0,A.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[n,e]}),t]})}function Mt({className:e}){return(0,A.jsx)(`span`,{className:t(`inline-block size-4 animate-spin rounded-full border-2 border-current border-t-transparent`,e),role:`status`,"aria-label":`Loading`})}function Nt({label:e=`Loading…`}){return(0,A.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-16 text-sm text-muted`,children:[(0,A.jsx)(Mt,{}),e]})}function Pt({icon:e,title:t,hint:n,action:r}){return(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-line py-14 text-center`,children:[e&&(0,A.jsx)(`div`,{className:`text-faint [&>svg]:size-8`,children:e}),(0,A.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t}),n&&(0,A.jsx)(`div`,{className:`max-w-sm text-xs text-faint`,children:n}),r&&(0,A.jsx)(`div`,{className:`mt-2`,children:r})]})}function Ft({onRetry:e,message:t=`Not connected to the bunqueue server — showing empty data.`}){return(0,A.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-500/25 bg-amber-500/[0.06] px-4 py-2.5 text-sm`,children:[(0,A.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`text-amber-300/90 light:text-amber-700`,children:t}),e&&(0,A.jsx)(`button`,{type:`button`,onClick:e,className:`ml-auto shrink-0 rounded-md border border-amber-500/30 px-2.5 py-1 text-xs font-medium text-amber-200 light:text-amber-700 hover:border-amber-400/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`Retry`})]})}function It({error:e,onRetry:t}){return(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 rounded-xl border border-red-500/20 bg-red-500/5 py-14 text-center`,children:[(0,A.jsx)(`div`,{className:`text-sm font-medium text-danger`,children:`Something went wrong`}),(0,A.jsx)(`div`,{className:`max-w-md text-xs text-faint`,children:e.message}),t&&(0,A.jsx)(`button`,{type:`button`,onClick:t,className:`mt-1 rounded-lg border border-line bg-surface-2 px-3 py-1.5 text-xs font-medium text-fg hover:border-line-strong`,children:`Retry`})]})}var Lt=class extends b.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught an error`,e,t.componentStack)}componentDidUpdate(e){this.state.error&&e.resetKey!==this.props.resetKey&&this.setState({error:null})}render(){let{error:e}=this.state;return e?(0,A.jsx)(`div`,{className:`flex min-h-screen items-center justify-center p-6`,children:(0,A.jsxs)(J,{className:`w-full max-w-lg`,children:[(0,A.jsx)(It,{error:e}),(0,A.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,A.jsx)(kt,{onClick:()=>window.location.reload(),children:`Reload`})})]})}):this.props.children}},Rt={success:{bar:`bg-emerald-500`,title:`text-success`},error:{bar:`bg-red-500`,title:`text-danger`},info:{bar:`bg-accent`,title:`text-accent`}};function zt({toast:e,dismiss:n}){(0,b.useEffect)(()=>{let t=window.setTimeout(()=>n(e.id),e.ttlMs);return()=>window.clearTimeout(t)},[e.id,e.ttlMs,n]);let r=Rt[e.level];return(0,A.jsxs)(`div`,{className:`pointer-events-auto flex w-80 max-w-[calc(100vw-2rem)] overflow-hidden rounded-lg border border-line bg-surface shadow-lg`,children:[(0,A.jsx)(`span`,{className:t(`w-1 shrink-0`,r.bar),"aria-hidden":`true`}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 px-3 py-2.5`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:t(`text-sm font-medium`,r.title),children:e.title}),e.detail&&(0,A.jsx)(`div`,{className:`mt-0.5 break-words text-xs text-muted`,children:e.detail})]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>n(e.id),"aria-label":`Dismiss notification`,className:`-mr-1 shrink-0 rounded p-0.5 text-faint hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:(0,A.jsx)(Je,{className:`size-4`})})]})]})}function Bt(){let e=S(e=>e.toasts),t=S(e=>e.dismiss);return e.length===0?null:(0,A.jsx)(`section`,{className:`pointer-events-none fixed bottom-4 right-4 z-[60] flex flex-col gap-2`,"aria-label":`Notifications`,"aria-live":`polite`,children:e.map(e=>(0,A.jsx)(zt,{toast:e,dismiss:t},e.id))})}var Vt=W(),Ht={"/":`Overview`,"/queues":`Queues`,"/jobs":`Jobs`,"/dlq":`Dead Letter Queue`,"/cron":`Cron Jobs`,"/flows":`Flows`,"/metrics":`Metrics`,"/workers":`Workers`,"/logs":`Logs`,"/server":`Server`,"/add-job":`Add Job`,"/jobs/bulk-add":`Bulk Add Jobs`,"/job":`Job Inspector`,"/queue-control":`Queue Control`,"/dlq-control":`DLQ Control`,"/webhooks":`Webhooks`,"/diagnostics":`Diagnostics`,"/alerts":`Alerts`,"/benchmark":`Benchmark`,"/database":`Database`,"/mcp":`MCP`,"/usage":`Usage`,"/s3":`S3 Backup`,"/settings":`Settings`,"/overview-classic":`Overview (classic)`,"/queues-classic":`Queues (classic)`,"/jobs-classic":`Jobs (classic)`,"/dlq-classic":`DLQ (classic)`,"/metrics-classic":`Metrics (classic)`,"/logs-classic":`Logs (classic)`,"/s3-classic":`S3 Backup (classic)`};function Ut(e){if(Ht[e])return Ht[e];if(e.startsWith(`/queues/`)){let t=e.slice(8);try{t=decodeURIComponent(t)}catch{}return`${t} · Queue`}return`bunqueue`}function Wt({onMenu:e,navOpen:t=!1}){let{pathname:n}=o();return(0,A.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-14 items-center justify-between gap-3 border-b border-line bg-bg/80 px-4 backdrop-blur sm:px-6 lg:px-8`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(`button`,{type:`button`,"aria-label":`Open navigation`,"aria-expanded":t,"aria-controls":`app-nav`,onClick:e,className:`-ml-1 flex size-9 shrink-0 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 lg:hidden`,children:(0,A.jsx)(Qe,{className:`size-5`})}),(0,A.jsxs)(`div`,{className:`truncate text-sm text-muted`,children:[(0,A.jsx)(`span`,{className:`text-faint`,children:Ut(n)}),(0,A.jsx)(`span`,{className:`mx-2 hidden text-faint sm:inline`,children:`·`}),(0,A.jsx)(`span`,{className:`hidden text-faint sm:inline`,children:`bunqueue`})]})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[Vt&&(0,A.jsxs)(`span`,{title:`Showing canned sample data. No real bunqueue server is connected.`,className:`hidden items-center gap-1.5 rounded-full border border-accent/40 bg-accent/10 px-2.5 py-1 text-xs font-medium text-accent sm:inline-flex`,children:[(0,A.jsx)(`span`,{className:`size-1.5 rounded-full bg-accent`}),`Live demo`]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>window.dispatchEvent(new Event(`command-palette:open`)),title:`Command palette`,"aria-label":`Open command palette`,className:`flex size-9 shrink-0 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:hidden`,children:(0,A.jsx)(Ke,{className:`size-5`})}),(0,A.jsxs)(`button`,{type:`button`,onClick:()=>window.dispatchEvent(new Event(`command-palette:open`)),title:`Command palette (⌘K)`,"aria-label":`Open command palette`,className:`hidden items-center gap-2 rounded-lg border border-line px-2.5 py-1.5 text-xs text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:flex`,children:[(0,A.jsx)(`span`,{children:`Search`}),(0,A.jsx)(`kbd`,{className:`rounded border border-line bg-surface-2 px-1 font-mono text-[10px]`,children:`⌘K`})]}),(0,A.jsx)(d,{to:`/settings`,title:`Settings`,"aria-label":`Open settings`,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-accent to-fuchsia-600 text-xs font-bold text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`bq`})]})]})}function Gt(){let[e,n]=(0,b.useState)(!1),{pathname:r,key:i}=o();return(0,b.useEffect)(()=>n(!1),[r]),(0,b.useEffect)(()=>{let e=window.matchMedia(`(min-width: 1024px)`),t=()=>e.matches&&n(!1);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,b.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,b.useEffect)(()=>{if(!e)return;let t=document.activeElement,n=()=>{let e=document.getElementById(`app-nav`);return e?Array.from(e.querySelectorAll(`a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])`)):[]};n()[0]?.focus();let r=e=>{if(e.key!==`Tab`)return;let t=n();if(!t.length)return;let r=t[0],i=t[t.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),t?.focus?.()}},[e]),(0,A.jsx)(Lt,{children:(0,A.jsxs)(`div`,{className:`flex h-screen overflow-hidden bg-bg text-fg`,children:[(0,A.jsx)(`a`,{href:`#main`,className:`sr-only rounded-md bg-accent px-3 py-2 text-sm font-medium text-accent-fg shadow-lg focus:not-sr-only focus:absolute focus:left-4 focus:top-3 focus:z-50`,children:`Skip to content`}),(0,A.jsx)(_t,{open:e,onClose:()=>n(!1)}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,A.jsx)(Wt,{navOpen:e,onMenu:()=>n(!0)}),(0,A.jsx)(`main`,{id:`main`,tabIndex:-1,className:t(`flex-1 px-4 pt-5 pb-24 outline-none sm:px-6 lg:px-8 lg:pt-6`,e?`overflow-hidden`:`overflow-y-auto`),children:(0,A.jsx)(b.Suspense,{fallback:(0,A.jsx)(`div`,{className:`p-2 text-sm text-muted`,children:`Loading…`}),children:(0,A.jsx)(Lt,{resetKey:i,children:(0,A.jsx)(l,{})})})})]}),(0,A.jsx)(yt,{}),(0,A.jsx)(De,{}),(0,A.jsx)(Et,{}),(0,A.jsx)(Bt,{}),(0,A.jsx)(Ee,{})]})})}var Kt={completed:`text-success bg-emerald-500/10`,active:`text-blue-400 light:text-blue-700 bg-blue-500/10`,failed:`text-danger bg-red-500/10`,waiting:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`,prioritized:`text-violet-400 light:text-violet-700 bg-violet-500/10`,delayed:`text-warning bg-amber-500/10`,paused:`text-orange-400 light:text-orange-700 bg-orange-500/10`,"waiting-children":`text-cyan-400 light:text-cyan-700 bg-cyan-500/10`,stalled:`text-orange-400 light:text-orange-700 bg-orange-500/10`,enqueued:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`,started:`text-blue-400 light:text-blue-700 bg-blue-500/10`,finished:`text-success bg-emerald-500/10`,retry:`text-warning bg-amber-500/10`,cancelled:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`,default:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`};function qt({status:e}){let n=(e||``).toLowerCase();return(0,A.jsxs)(`span`,{className:t(`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium capitalize`,Kt[n]??Kt.default),children:[(0,A.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),e||`unknown`]})}function Jt({label:e,tone:n=`green`}){return(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-muted`,children:[(0,A.jsx)(`span`,{className:t(`size-1.5 rounded-full`,n===`green`?`bg-emerald-400`:n===`amber`?`bg-amber-400`:n===`red`?`bg-red-400`:`bg-zinc-400`)}),e]})}function Yt({title:e,description:t,live:n,actions:r,back:i}){return(0,A.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-start justify-between gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i,(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight text-fg`,children:e}),n&&(0,A.jsx)(Jt,{label:`Live`,tone:`green`})]}),t&&(0,A.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t})]})]}),r&&(0,A.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:r})]})}var Xt={default:`text-fg`,green:`text-success`,red:`text-danger`,blue:`text-blue-400 light:text-blue-700`,amber:`text-warning`,accent:`text-accent`};function Y({label:e,value:n,tone:r=`default`,hint:i,compact:a}){return(0,A.jsxs)(`div`,{className:t(`rounded-xl border border-line bg-surface`,a?`px-4 py-3`:`px-5 py-4`),children:[(0,A.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e}),(0,A.jsx)(`div`,{className:t(`mt-2 font-semibold tnum`,a?`text-xl`:`text-3xl`,Xt[r]),children:n}),i!=null&&(0,A.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:i})]})}var Zt=new Intl.NumberFormat(`de-DE`),Qt=new Intl.DateTimeFormat(`it-IT`,{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function X(e){return e==null||!Number.isFinite(e)?`0`:Zt.format(e)}function $t(e,t=2){return e==null||!Number.isFinite(e)?`0%`:`${(e*100).toFixed(t)}%`}function en(e,t){let n=e+t;return n>0?t/n:null}function tn(e){if(e==null||!Number.isFinite(e))return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:Qt.format(t)}function nn(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function rn(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;let t=Math.round(e);if(t<1e3)return`${t}ms`;let n=e/1e3;if(n<59.95)return`${n.toFixed(1)}s`;let r=Math.round(n);return`${Math.floor(r/60)}m ${r%60}s`}function an(e,t){if(e==null||t==null)return;let n=t-e;return n>=0?n:void 0}function on(e){if(e==null||!Number.isFinite(e))return`—`;let t=Math.max(0,Math.floor(e)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=[];return n&&a.push(`${n}d`),(r||n)&&a.push(`${r}h`),a.push(`${i}m`),a.join(` `)}function sn(e){return e==null||!Number.isFinite(e)?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?Number((e/1e3).toFixed(1))>=1e3?`${(e/1e6).toFixed(1)}M`:`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function cn(e){if(e==null||!Number.isFinite(e))return`—`;if(e>=1e3)return`${(e/1e3).toFixed(2)}s`;let t=+(e<10);return Number(e.toFixed(t))>=1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(t)}ms`}var ln=/(?:\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b[@-Z\\^_])/g;function un(e){return e.replace(ln,``)}function dn(e){if(e==null||!Number.isFinite(e))return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return r<t.length-1&&Number(n.toFixed(r===0?0:1))>=1024&&(n/=1024,r++),`${n.toFixed(r===0?0:1)} ${t[r]}`}function fn(e){return!0}function pn(e){let t=`message`,n,r=[];for(let i of e.split(`
3
+ `)){if(!i||i.startsWith(`:`))continue;let e=i.indexOf(`:`),a=e===-1?i:i.slice(0,e),o=e===-1?``:i.slice(e+1).replace(/^ /,``);a===`event`?t=o:a===`data`?r.push(o):a===`id`&&(n=o)}if(r.length===0)return null;let i=r.join(`
4
+ `),a=i;try{a=JSON.parse(i)}catch{}return{id:n,event:t,data:a}}var mn=45e3;async function hn(e,t,n,r=mn){let i=new AbortController,a=()=>i.abort(n.reason);n.aborted?i.abort(n.reason):n.addEventListener(`abort`,a,{once:!0});let o,s=()=>{clearTimeout(o),o=setTimeout(()=>i.abort(Error(`SSE idle timeout`)),r)};try{s();let n=await fetch(e,{headers:{Accept:`text/event-stream`,..._()},signal:i.signal});if(!n.ok||!n.body)throw await n.body?.cancel().catch(()=>{}),Error(n.ok?`SSE connect failed: empty response body`:`SSE connect failed: HTTP ${n.status}`);let r=n.body.getReader(),a=new TextDecoder,o=``;try{for(;;){let{done:e,value:n}=await r.read();if(e)break;for(s(),o+=a.decode(n,{stream:!0});;){let e=o.indexOf(`
5
+
6
+ `),n=o.indexOf(`\r
7
+ \r
8
+ `),r,i;if(e!==-1&&(n===-1||e<=n))r=e,i=2;else if(n!==-1)r=n,i=4;else break;let a=o.slice(0,r);o=o.slice(r+i);let s=pn(a.replace(/\r/g,``));s&&t(s)}}}finally{r.releaseLock()}}finally{clearTimeout(o),n.removeEventListener(`abort`,a),i.abort()}}var Z={total:0,completed:0,failed:0,waiting:0,active:0},gn=250,_n=()=>typeof performance<`u`?performance.now():Date.now();function vn(e){let t=e.includes(`:`)?e.split(`:`)[1]:e;switch(t){case`pushed`:case`added`:return`waiting`;case`pulled`:return`active`;case`progress`:return`active`;default:return t}}function yn(e){let t=g(e=>e.baseUrl),n=g(e=>e.token),[r,i]=(0,b.useState)([]),[a,o]=(0,b.useState)(Z),[s,c]=(0,b.useState)(0),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(null),p=(0,b.useRef)([]),m=(0,b.useRef)([]),h=(0,b.useRef)({...Z});return(0,b.useEffect)(()=>{let t=new AbortController,n=0,r=!1;i([]),o(Z),f(null),p.current=[],m.current=[],h.current={...Z};let a=e=>new Promise(n=>{let r=()=>{clearTimeout(i),n()},i=setTimeout(()=>{t.signal.removeEventListener(`abort`,r),n()},e);t.signal.addEventListener(`abort`,r,{once:!0})}),s=e=>{if(fn(e)&&(u(!0),f(null)),!e.event.startsWith(`job:`))return;let t=e.data??{},r=vn(e.event),i={seq:++n,event:e.event,queue:t.queue,jobId:t.jobId,name:t.name,status:r,timestamp:t.timestamp??Date.now(),error:t.error,progress:t.progress};m.current.push(i);let a=h.current;a.total+=1,r===`completed`?a.completed+=1:r===`failed`?a.failed+=1:r===`waiting`?a.waiting+=1:r===`active`&&(a.active+=1),p.current.push(_n())};(async()=>{let n=0;for(;!r;){let i=null;try{await hn(nt.eventsUrl(e),s,t.signal)}catch(e){i=e}if(r)break;u(!1),f(i),n=i?Math.min(n+1,8):0,await a(2e3*Math.max(1,n))}})();let c=setInterval(()=>{if(m.current.length){let e=m.current;m.current=[],e.reverse(),i(t=>[...e,...t].slice(0,gn))}let e=h.current;e.total&&(h.current={...Z},o(t=>({total:t.total+e.total,completed:t.completed+e.completed,failed:t.failed+e.failed,waiting:t.waiting+e.waiting,active:t.active+e.active})))},150);return()=>{r=!0,t.abort(),clearInterval(c),u(!1)}},[e,t,n]),(0,b.useEffect)(()=>{let e=setInterval(()=>{let e=_n();p.current=p.current.filter(t=>t<=e&&e-t<5e3),c(p.current.length/5)},1e3);return()=>clearInterval(e)},[]),{events:r,counters:a,throughput:s,connected:l,error:d}}var bn={overview:{stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},throughput:{pushPerSec:0,pullPerSec:0,completePerSec:0,failPerSec:0},memory:{heapUsed:0,heapTotal:0,rss:0},crons:{total:0}},queuesTotal:0,details:[],failedTotal:0},xn=100;function Sn(){let e=g(e=>e.baseUrl),n=(0,b.useRef)(null),{data:r,error:i,loading:a,refetch:o}=it(async()=>{let[e,t]=await Promise.all([k.overview(),k.queuesSummary()]),r=[...t].sort((e,t)=>(t.counts?.failed??0)-(e.counts?.failed??0)||(t.counts?.waiting??0)-(e.counts?.waiting??0)).slice(0,6).map(e=>({name:e.name,paused:e.paused,counts:e.counts})),i=t.reduce((e,t)=>e+(t.counts?.failed??0),0);return n.current=Date.now(),{overview:e,queuesTotal:t.length,details:r,failedTotal:i}},[]);if(a&&!r&&!i)return(0,A.jsx)(Nt,{label:`Loading overview…`});let{overview:s,queuesTotal:c,details:l,failedTotal:u}=r??bn,{stats:f,throughput:p,memory:m,crons:h}=s,_=en(f.completed,u),v=e===`/api`?`localhost:6790`:e.replace(/^https?:\/\//,``),y=f.uptime?on(f.uptime/1e3):`—`,ee=dn(m.rss*1024*1024),x=!!i;return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Yt,{title:`Overview`,description:`Real-time system health at a glance.`,live:!0}),i&&(0,A.jsx)(Ft,{onRetry:o}),(0,A.jsxs)(`div`,{className:t(`mb-6 flex flex-wrap items-center justify-between gap-y-2 rounded-xl border px-5 py-4`,x?`border-amber-500/25 bg-amber-500/[0.06]`:`border-emerald-500/25 bg-emerald-500/[0.06]`),children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,A.jsxs)(`span`,{className:`relative flex size-2.5`,children:[!x&&(0,A.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-emerald-400 opacity-60`}),(0,A.jsx)(`span`,{className:t(`relative inline-flex size-2.5 rounded-full`,x?`bg-amber-400`:`bg-emerald-400`)})]}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`div`,{className:t(`font-semibold`,x?`text-warning`:`text-success`),children:x?`Connection lost — showing last known data`:`bunqueue server connected`}),(0,A.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted`,children:[v,` · uptime `,y,` · `,ee,` RAM`,x&&(0,A.jsxs)(A.Fragment,{children:[` `,`· last updated `,n.current?nn(n.current):`never`]})]})]})]}),(0,A.jsx)(`span`,{className:t(`rounded-full px-3 py-1 text-xs font-medium`,x?`bg-amber-500/15 text-warning`:`bg-emerald-500/15 text-success`),children:x?`Stale`:`Online`})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-3`,children:[(0,A.jsx)(Y,{label:`Error Rate`,value:_==null?`—`:$t(_),tone:_==null?`default`:_>.05?`red`:`green`,hint:`failed / processed`}),(0,A.jsx)(Y,{label:`Failed`,value:X(u),tone:u?`red`:`default`,hint:`recorded across queues`}),(0,A.jsx)(Y,{label:`DLQ`,value:X(f.dlq),tone:f.dlq?`red`:`default`,hint:`dead-lettered jobs`})]}),(0,A.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,A.jsx)(Y,{label:`Completed`,value:X(f.completed),tone:`green`,compact:!0}),(0,A.jsx)(Y,{label:`Active`,value:X(f.active),tone:`blue`,compact:!0}),(0,A.jsx)(Y,{label:`Waiting`,value:X(f.waiting),tone:f.waiting>xn?`amber`:`default`,compact:!0}),(0,A.jsx)(Y,{label:`Push/sec`,value:p.pushPerSec.toFixed(1),tone:`accent`,hint:`${sn(f.totalPushed)} since restart`,compact:!0}),(0,A.jsx)(Y,{label:`Pull/sec`,value:p.pullPerSec.toFixed(1),tone:`accent`,hint:`${sn(f.totalPulled)} since restart`,compact:!0}),(0,A.jsx)(Y,{label:`Queues`,value:X(c),hint:`${h.total} cron active`,compact:!0})]}),(0,A.jsxs)(`div`,{className:`mt-8`,children:[(0,A.jsx)(wn,{title:`Queue Health — most loaded`,to:`/queues`}),l.length===0?(0,A.jsx)(J,{children:(0,A.jsx)(`p`,{className:`py-4 text-center text-sm text-faint`,children:`No queues yet.`})}):(0,A.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:l.map(e=>(0,A.jsxs)(d,{to:`/queues/${encodeURIComponent(e.name)}`,className:`rounded-xl border border-line bg-surface p-4 transition-colors hover:border-line-strong`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,A.jsx)(`span`,{className:`truncate font-mono text-sm font-medium text-accent`,children:e.name}),(0,A.jsx)(`span`,{className:t(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-success`),children:e.paused?`paused`:`active`})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs text-faint`,children:[(0,A.jsx)(Q,{label:`W`,value:e.counts?.waiting,tone:`text-warning`}),(0,A.jsx)(Q,{label:`A`,value:e.counts?.active,tone:`text-blue-400`}),(0,A.jsx)(Q,{label:`C`,value:e.counts?.completed,tone:`text-success`}),(0,A.jsx)(Q,{label:`F`,value:e.counts?.failed,tone:`text-danger`})]})]},e.name))})]}),(0,A.jsx)(Cn,{})]})}function Cn(){let{events:e,connected:n}=yn();return(0,A.jsxs)(`div`,{className:`mt-8`,children:[(0,A.jsx)(wn,{title:`Recent Activity`,to:`/logs`}),(0,A.jsxs)(J,{padded:!1,children:[!n&&e.length>0&&(0,A.jsx)(`p`,{className:`border-b border-line px-5 py-2 text-xs text-warning`,children:`Event stream disconnected — reconnecting…`}),e.length===0?(0,A.jsx)(`p`,{className:`py-8 text-center text-sm text-faint`,children:n?`Waiting for live activity…`:`Connecting to the event stream…`}):(0,A.jsx)(`ul`,{className:`divide-y divide-line`,children:e.slice(0,8).map(e=>(0,A.jsxs)(`li`,{className:`flex items-center justify-between px-5 py-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`span`,{className:t(`size-2 rounded-full`,Tn(e.status))}),(0,A.jsxs)(`div`,{className:`text-sm`,children:[(0,A.jsx)(`span`,{className:`font-mono font-medium text-fg`,children:e.queue||`—`}),(0,A.jsx)(`span`,{className:`text-faint`,children:` · `}),(0,A.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:e.jobId?e.jobId.slice(0,8):`—`}),(0,A.jsx)(`span`,{className:`text-faint`,children:` · `}),(0,A.jsx)(`span`,{className:`capitalize text-muted`,children:e.status})]})]}),(0,A.jsx)(`span`,{className:`text-xs text-faint`,children:nn(e.timestamp)})]},e.seq))})]})]})}function wn({title:e,to:t}){return(0,A.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,A.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:e}),(0,A.jsxs)(d,{to:t,className:`flex items-center gap-1 text-sm text-muted hover:text-fg`,children:[`View All `,(0,A.jsx)(Xe,{className:`size-3.5`})]})]})}function Q({label:e,value:n,tone:r}){return(0,A.jsxs)(`span`,{children:[e,` `,(0,A.jsx)(`span`,{className:t(`tnum font-semibold`,r),children:n==null?`—`:X(n)})]})}function Tn(e){switch(e){case`completed`:return`bg-emerald-400`;case`failed`:return`bg-red-400`;case`active`:return`bg-blue-400`;case`waiting`:return`bg-amber-400`;default:return`bg-accent`}}function En(){return(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 py-24 text-center`,children:[(0,A.jsx)(`div`,{className:`text-5xl font-bold text-faint`,children:`404`}),(0,A.jsx)(`p`,{className:`text-sm text-muted`,children:`This page does not exist.`}),(0,A.jsx)(d,{to:`/`,className:`rounded-lg border border-line bg-surface-2 px-4 py-2 text-sm font-medium text-fg hover:border-line-strong`,children:`Back to Overview`})]})}var Dn=(0,b.lazy)(()=>u(()=>import(`./AddJob-Dvpp--yq.js`).then(e=>({default:e.AddJob})),__vite__mapDeps([5,1,2,4]))),On=(0,b.lazy)(()=>u(()=>import(`./Benchmark-CkL-Ee-M.js`).then(e=>({default:e.Benchmark})),__vite__mapDeps([6,1,2,7,4,8]))),kn=(0,b.lazy)(()=>u(()=>import(`./BulkAddJobs-wI6cRZnX.js`).then(e=>({default:e.BulkAddJobs})),__vite__mapDeps([9,1,2,4]))),An=(0,b.lazy)(()=>u(()=>import(`./CronManager-BvfW219u.js`).then(e=>({default:e.CronManager})),__vite__mapDeps([10,1,2,4,11]))),jn=(0,b.lazy)(()=>u(()=>import(`./Database-D2T_ZIGA.js`).then(e=>({default:e.Database})),__vite__mapDeps([12,1,2,4,11]))),Mn=(0,b.lazy)(()=>u(()=>import(`./Diagnostics-C2goqq5h.js`).then(e=>({default:e.Diagnostics})),__vite__mapDeps([13,1,2]))),Nn=(0,b.lazy)(()=>u(()=>import(`./DlqControl-C5BfE7Gq.js`).then(e=>({default:e.DlqControl})),__vite__mapDeps([14,1,2,4,11,15]))),Pn=(0,b.lazy)(()=>u(()=>import(`./DlqPro-ClPNmw-X.js`).then(e=>({default:e.DlqPro})),__vite__mapDeps([16,1,2,4,11,15,17]))),Fn=(0,b.lazy)(()=>u(()=>import(`./Flows-DbhMbvSG.js`).then(e=>({default:e.Flows})),__vite__mapDeps([18,1,2]))),In=(0,b.lazy)(()=>u(()=>import(`./JobInspector-CO_zKjSX.js`).then(e=>({default:e.JobInspector})),__vite__mapDeps([19,1,2,4,20,15]))),Ln=(0,b.lazy)(()=>u(()=>import(`./JobsPro-Drdgdj3s.js`).then(e=>({default:e.JobsPro})),__vite__mapDeps([21,1,2,4,11,20,15]))),Rn=(0,b.lazy)(()=>u(()=>import(`./LogsPro-7uTBjPWX.js`).then(e=>({default:e.LogsPro})),__vite__mapDeps([22,1,2,4,11]))),zn=(0,b.lazy)(()=>u(()=>import(`./McpServer-DAklQDB5.js`).then(e=>({default:e.McpServer})),__vite__mapDeps([23,2,1]))),Bn=(0,b.lazy)(()=>u(()=>import(`./MetricsPro-PP3TymeP.js`).then(e=>({default:e.MetricsPro})),__vite__mapDeps([24,1,2,11,8,25,7]))),Vn=(0,b.lazy)(()=>u(()=>import(`./QueueControl-CxKjUjF-.js`).then(e=>({default:e.QueueControl})),__vite__mapDeps([26,1,2,4,27]))),Hn=(0,b.lazy)(()=>u(()=>import(`./QueueDetailPro-C-XLWFBa.js`).then(e=>({default:e.QueueDetailPro})),__vite__mapDeps([28,1,2,8,25,7,27,4]))),Un=(0,b.lazy)(()=>u(()=>import(`./QueuesOverview-x7-akDzf.js`).then(e=>({default:e.QueuesOverview})),__vite__mapDeps([29,1,2,11,17]))),Wn=(0,b.lazy)(()=>u(()=>import(`./S3BackupPro-BG_0OHW7.js`).then(e=>({default:e.S3BackupPro})),__vite__mapDeps([30,1,2,7,4]))),Gn=(0,b.lazy)(()=>u(()=>import(`./ServerControl-DohTB--h.js`).then(e=>({default:e.ServerControl})),__vite__mapDeps([31,1,2,4]))),Kn=(0,b.lazy)(()=>u(()=>import(`./UsagePro-CdnQkP9o.js`).then(e=>({default:e.UsagePro})),__vite__mapDeps([32,2,1]))),qn=(0,b.lazy)(()=>u(()=>import(`./Webhooks-CAwVmIEZ.js`).then(e=>({default:e.Webhooks})),__vite__mapDeps([33,1,2,4,11]))),Jn=(0,b.lazy)(()=>u(()=>import(`./WorkersPro-CIJKl7U1.js`).then(e=>({default:e.WorkersPro})),__vite__mapDeps([34,1,2]))),Yn=(0,b.lazy)(()=>u(()=>import(`./Alerts-CR9jgCCs.js`).then(e=>({default:e.Alerts})),__vite__mapDeps([35,1,2,4]))),Xn=(0,b.lazy)(()=>u(()=>import(`./Cron-gWVkYWad.js`).then(e=>({default:e.Cron})),__vite__mapDeps([36,1,2,11]))),Zn=(0,b.lazy)(()=>u(()=>import(`./Dlq-Q4TmmZrK.js`).then(e=>({default:e.Dlq})),__vite__mapDeps([37,1,2,4,11]))),Qn=(0,b.lazy)(()=>u(()=>import(`./Jobs-D2rDHPM_.js`).then(e=>({default:e.Jobs})),__vite__mapDeps([38,1,2,4,20]))),$n=(0,b.lazy)(()=>u(()=>import(`./Logs-DjwGuRLi.js`).then(e=>({default:e.Logs})),__vite__mapDeps([39,1,2,4,11]))),er=(0,b.lazy)(()=>u(()=>import(`./Metrics-Dup9Zinh.js`).then(e=>({default:e.Metrics})),__vite__mapDeps([40,2,1]))),tr=(0,b.lazy)(()=>u(()=>import(`./Overview-C7RCDE6r.js`).then(e=>({default:e.Overview})),__vite__mapDeps([41,2,1]))),nr=(0,b.lazy)(()=>u(()=>import(`./QueueDetail-bf2n-r2h.js`).then(e=>({default:e.QueueDetail})),__vite__mapDeps([42,1,2,4]))),rr=(0,b.lazy)(()=>u(()=>import(`./Queues-CMQW89J9.js`).then(e=>({default:e.Queues})),__vite__mapDeps([43,1,2,11]))),ir=(0,b.lazy)(()=>u(()=>import(`./S3Backup-1jAySC9R.js`).then(e=>({default:e.S3Backup})),__vite__mapDeps([44,2,1]))),ar=(0,b.lazy)(()=>u(()=>import(`./Settings-CnS5PjNe.js`).then(e=>({default:e.Settings})),__vite__mapDeps([45,1,2,7,4]))),or=(0,b.lazy)(()=>u(()=>import(`./Usage-C3H0hMSA.js`).then(e=>({default:e.Usage})),__vite__mapDeps([46,2,1]))),sr=(0,b.lazy)(()=>u(()=>import(`./Workers-lvujKZwF.js`).then(e=>({default:e.Workers})),__vite__mapDeps([47,1,2,11])));function cr(){return(0,A.jsx)(r,{children:(0,A.jsxs)(f,{element:(0,A.jsx)(Gt,{}),children:[(0,A.jsx)(f,{path:`/`,element:(0,A.jsx)(Sn,{})}),(0,A.jsx)(f,{path:`/overview-classic`,element:(0,A.jsx)(tr,{})}),(0,A.jsx)(f,{path:`/queues`,element:(0,A.jsx)(Un,{})}),(0,A.jsx)(f,{path:`/queues-classic`,element:(0,A.jsx)(rr,{})}),(0,A.jsx)(f,{path:`/queues/:name`,element:(0,A.jsx)(Hn,{})}),(0,A.jsx)(f,{path:`/queues-classic/:name`,element:(0,A.jsx)(nr,{})}),(0,A.jsx)(f,{path:`/jobs`,element:(0,A.jsx)(Ln,{})}),(0,A.jsx)(f,{path:`/jobs-classic`,element:(0,A.jsx)(Qn,{})}),(0,A.jsx)(f,{path:`/dlq`,element:(0,A.jsx)(Pn,{})}),(0,A.jsx)(f,{path:`/dlq-classic`,element:(0,A.jsx)(Zn,{})}),(0,A.jsx)(f,{path:`/cron`,element:(0,A.jsx)(An,{})}),(0,A.jsx)(f,{path:`/cron-classic`,element:(0,A.jsx)(Xn,{})}),(0,A.jsx)(f,{path:`/flows`,element:(0,A.jsx)(Fn,{})}),(0,A.jsx)(f,{path:`/metrics`,element:(0,A.jsx)(Bn,{})}),(0,A.jsx)(f,{path:`/metrics-classic`,element:(0,A.jsx)(er,{})}),(0,A.jsx)(f,{path:`/workers`,element:(0,A.jsx)(Jn,{})}),(0,A.jsx)(f,{path:`/workers-classic`,element:(0,A.jsx)(sr,{})}),(0,A.jsx)(f,{path:`/logs`,element:(0,A.jsx)(Rn,{})}),(0,A.jsx)(f,{path:`/logs-classic`,element:(0,A.jsx)($n,{})}),(0,A.jsx)(f,{path:`/server`,element:(0,A.jsx)(Gn,{})}),(0,A.jsx)(f,{path:`/add-job`,element:(0,A.jsx)(Dn,{})}),(0,A.jsx)(f,{path:`/jobs/bulk-add`,element:(0,A.jsx)(kn,{})}),(0,A.jsx)(f,{path:`/job`,element:(0,A.jsx)(In,{})}),(0,A.jsx)(f,{path:`/queue-control`,element:(0,A.jsx)(Vn,{})}),(0,A.jsx)(f,{path:`/cron-manager`,element:(0,A.jsx)(n,{to:`/cron`,replace:!0})}),(0,A.jsx)(f,{path:`/dlq-control`,element:(0,A.jsx)(Nn,{})}),(0,A.jsx)(f,{path:`/webhooks`,element:(0,A.jsx)(qn,{})}),(0,A.jsx)(f,{path:`/diagnostics`,element:(0,A.jsx)(Mn,{})}),(0,A.jsx)(f,{path:`/alerts`,element:(0,A.jsx)(Yn,{})}),(0,A.jsx)(f,{path:`/benchmark`,element:(0,A.jsx)(On,{})}),(0,A.jsx)(f,{path:`/database`,element:(0,A.jsx)(jn,{})}),(0,A.jsx)(f,{path:`/mcp`,element:(0,A.jsx)(zn,{})}),(0,A.jsx)(f,{path:`/usage`,element:(0,A.jsx)(Kn,{})}),(0,A.jsx)(f,{path:`/usage-classic`,element:(0,A.jsx)(or,{})}),(0,A.jsx)(f,{path:`/s3`,element:(0,A.jsx)(Wn,{})}),(0,A.jsx)(f,{path:`/s3-classic`,element:(0,A.jsx)(ir,{})}),(0,A.jsx)(f,{path:`/settings`,element:(0,A.jsx)(ar,{})}),(0,A.jsx)(f,{path:`*`,element:(0,A.jsx)(En,{})})]})})}Oe();var $=document.getElementById(`root`);if(!$)throw Error(`Root element #root not found`);function lr(){(0,x.createRoot)($).render((0,A.jsx)(b.StrictMode,{children:(0,A.jsx)(c,{basename:`/`,children:(0,A.jsx)(cr,{})})}))}function ur(e,t){let n=document.createElement(`div`);n.setAttribute(`role`,`alert`),n.style.cssText=`padding:2rem;font:14px/1.6 system-ui,sans-serif;max-width:44rem;margin:auto`;let r=document.createElement(`h1`);r.style.cssText=`font-size:1.1rem;font-weight:600;margin-bottom:.5rem`,r.textContent=`Demo data failed to load`;let i=document.createElement(`p`);i.textContent=`This build serves canned data from a bundled chunk that could not be fetched, so there is no backend to talk to. Reload the page (a hard refresh clears a stale cached index.html).`;let a=document.createElement(`p`);a.style.cssText=`margin-top:.75rem;opacity:.7;font-family:ui-monospace,monospace`,a.textContent=t instanceof Error?t.message:String(t),n.append(r,i,a),e.textContent=``,e.appendChild(n)}W()?u(()=>import(`./install-BIVfix28.js`).then(e=>{e.installDemo(),lr()}),[]).catch(e=>{console.error(`[demo] failed to load the demo backend`,e),ur($,e)}):lr();export{he as $,it as A,qe as B,jt as C,W as D,q as E,Ve as F,P as G,Ne as H,Je as I,Ke as J,Ge as K,Ae as L,Xe as M,Ye as N,ot as O,Be as P,ge as Q,I as R,J as S,At as T,Ue as U,R as V,He as W,L as X,We as Y,M as Z,Jt as _,tn as a,re as at,Nt as b,X as c,on as d,w as et,an as f,qt as g,Yt as h,sn as i,ie as it,nt as j,rt as k,$t as l,Y as m,en as n,k as nt,rn as o,un as p,Fe as q,dn as r,C as rt,cn as s,yn as t,de as tt,nn as u,Pt as v,kt as w,Ft as x,It as y,$e as z};
@@ -1,3 +1,3 @@
1
- var e={health:{ok:!0,status:`healthy`,uptime:133,version:`2.8.26`,queues:{waiting:13,active:2,delayed:6,completed:4,dlq:2},connections:{tcp:0,ws:0,sse:0},memory:{heapUsed:3,heapTotal:4,rss:68}},ping:{ok:!0,data:{pong:!0,time:1783035131368}},stats:{ok:!0,stats:{waiting:13,prioritized:7,delayed:6,active:2,dlq:2,completed:4,"waiting-children":0,totalPushed:34,totalPulled:8,totalCompleted:4,totalFailed:0,uptime:133882,cronJobs:2,cronPending:2,pushPerSec:.25,pullPerSec:.06,completePerSec:.03,failPerSec:0},memory:{heapUsed:3,heapTotal:4,rss:69,external:1,arrayBuffers:0},collections:{jobIndex:34,completedJobs:4,jobResults:0,jobLogs:0,customIdMap:0,jobLocks:0,clientJobs:0,clientJobsTotal:0,pendingDepChecks:0,stalledCandidates:0,processingTotal:2,queuedTotal:26,waitingDepsTotal:0,temporalIndexTotal:34,delayedHeapTotal:6}},storage:{ok:!0,data:{diskFull:!1,error:null,since:null}},dashboard:{ok:!0,stats:{waiting:13,active:2,delayed:6,completed:4,dlq:2,totalPushed:34,totalPulled:8,totalCompleted:4,totalFailed:0,uptime:133882},throughput:{pushPerSec:.25,pullPerSec:.06,completePerSec:.03,failPerSec:0},latency:{averages:{pushMs:.07645341176470588,pullMs:.3890205,ackMs:1.03645825},percentiles:{push:{p50:.1,p95:.5,p99:1},pull:{p50:.1,p95:1,p99:1},ack:{p50:2.5,p95:2.5,p99:2.5}}},memory:{heapUsed:3,heapTotal:4,rss:70},collections:{jobIndex:34,completedJobs:4,jobResults:0,jobLogs:0,customIdMap:0,jobLocks:0,clientJobs:0,clientJobsTotal:0,pendingDepChecks:0,stalledCandidates:0,processingTotal:2,queuedTotal:26,waitingDepsTotal:0,temporalIndexTotal:34,delayedHeapTotal:6},workers:{total:0,active:0,list:[],truncated:!1},crons:{total:2,list:[{name:`nightly-report`,queue:`reports`,schedule:`0 2 * * *`,repeatEvery:null,nextRun:17830368e5,executions:0},{name:`heartbeat`,queue:`notifications`,schedule:null,repeatEvery:6e4,nextRun:1783035191362,executions:0}],truncated:!1},storage:{diskFull:!1,error:null,since:null},timestamp:1783035131369},dashboardQueues:{ok:!0,queues:[{name:`emails`,waiting:2,delayed:0,active:0,dlq:2,paused:!1},{name:`image-processing`,waiting:7,delayed:0,active:2,dlq:0,paused:!1},{name:`reports`,waiting:0,delayed:6,active:0,dlq:0,paused:!1},{name:`notifications`,waiting:4,delayed:0,active:0,dlq:0,paused:!1}],total:4,limit:100,offset:0,timestamp:1783035131370},queuesSummary:[{name:`emails`,paused:!1,counts:{waiting:2,active:0,completed:4,failed:2,delayed:0}},{name:`image-processing`,paused:!1,counts:{waiting:7,active:2,completed:0,failed:0,delayed:0}},{name:`reports`,paused:!1,counts:{waiting:0,active:0,completed:0,failed:0,delayed:6}},{name:`notifications`,paused:!1,counts:{waiting:4,active:0,completed:0,failed:0,delayed:0}}],crons:{ok:!0,crons:[{name:`nightly-report`,queue:`reports`,schedule:`0 2 * * *`,repeatEvery:null,nextRun:17830368e5,executions:0,maxLimit:null,timezone:null},{name:`heartbeat`,queue:`notifications`,schedule:null,repeatEvery:6e4,nextRun:1783035191362,executions:0,maxLimit:null,timezone:null}]},webhooks:{ok:!0,data:{webhooks:[{id:`019f252c-f5e3-7000-883c-28cc5dc157a0`,url:`https://hooks.example.com/bunqueue`,events:[`job.completed`,`job.failed`],queue:null,createdAt:1783035131363,lastTriggered:178303512e4,successCount:42,failureCount:3,enabled:!0}],stats:{total:1,enabled:1}}},workers:{ok:!0,data:{workers:[],stats:{total:0,active:0,totalProcessed:0,totalFailed:0,activeJobs:0}}},dlqStats:{ok:!0,total:2,byQueue:{emails:2}},counts_emails:{ok:!0,counts:{waiting:2,prioritized:7,delayed:0,active:0,completed:4,failed:2,"waiting-children":0,paused:0}},dlq_emails:{ok:!0,entries:[{job:{id:`019f252b-8716-7000-bbec-d8c65e09f340`,queue:`emails`,data:{to:`user8@example.com`,subject:`Welcome 8`},createdAt:1783035037462,runAt:1783035037462,startedAt:1783035131364,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:3,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037462},{state:`active`,timestamp:1783035131364}]},enteredAt:1783035131367,reason:`timeout`,error:`Job exceeded its 30000 ms timeout while connecting to smtp.example.com`,attempts:[{attempt:0,startedAt:1783035131364,failedAt:1783035131367,reason:`timeout`,error:`Job exceeded its 30000 ms timeout while connecting to smtp.example.com`,duration:3}],retryCount:0,lastRetryAt:null,nextRetryAt:null,expiresAt:1783639931367},{job:{id:`019f252b-8750-7000-afa1-767720d8f433`,queue:`emails`,data:{to:`user13@example.com`,subject:`Welcome 13`},createdAt:1783035037520,runAt:1783035037520,startedAt:1783035131364,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:3,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037520},{state:`active`,timestamp:1783035131364}]},enteredAt:1783035131368,reason:`max_attempts`,error:`SMTP 550: mailbox unavailable (user13@example.com) — 3 of 3 attempts failed`,attempts:[{attempt:0,startedAt:1783035131364,failedAt:1783035131368,reason:`max_attempts`,error:`SMTP 550: mailbox unavailable (user13@example.com) — 3 of 3 attempts failed`,duration:4}],retryCount:0,lastRetryAt:null,nextRetryAt:null,expiresAt:1783639931368}],total:2},detail_emails:{ok:!0,name:`emails`,counts:{waiting:2,prioritized:7,delayed:0,active:0,completed:4,failed:2,"waiting-children":0,totalCompleted:4,totalFailed:0,paused:0},paused:!1,priorityCounts:{0:2,1:3,2:4},dlqPreview:[{id:`019f252b-8716-7000-bbec-d8c65e09f340`,data:{to:`user8@example.com`,subject:`Welcome 8`},attempts:0,createdAt:1783035037462},{id:`019f252b-8750-7000-afa1-767720d8f433`,data:{to:`user13@example.com`,subject:`Welcome 13`},attempts:0,createdAt:1783035037520}],timestamp:1783035131373,jobs:{waiting:[{id:`019f252b-86f2-7000-a45d-6e5e3dd4abf0`,priority:0,createdAt:1783035037426,runAt:1783035037426,attempts:0,progress:0},{id:`019f252b-872e-7000-91af-f820da905a23`,priority:0,createdAt:1783035037486,runAt:1783035037486,attempts:0,progress:0}],active:[],delayed:[],paused:[]}},"counts_image-processing":{ok:!0,counts:{waiting:7,prioritized:0,delayed:0,active:2,completed:0,failed:0,"waiting-children":0,paused:0}},"dlq_image-processing":{ok:!0,entries:[],total:0},"detail_image-processing":{ok:!0,name:`image-processing`,counts:{waiting:7,prioritized:0,delayed:0,active:2,completed:0,failed:0,"waiting-children":0,totalCompleted:0,totalFailed:0,paused:0},paused:!1,priorityCounts:{0:7},dlqPreview:[],timestamp:1783035131374,jobs:{waiting:[{id:`019f252b-8780-7000-9066-7f3a95bbb309`,priority:0,createdAt:1783035037568,runAt:1783035037568,attempts:0,progress:0},{id:`019f252b-878d-7000-9396-88a9de934b0c`,priority:0,createdAt:1783035037581,runAt:1783035037581,attempts:0,progress:0},{id:`019f252b-8799-7000-8433-2f4d874dfa3f`,priority:0,createdAt:1783035037593,runAt:1783035037593,attempts:0,progress:0},{id:`019f252b-87a5-7000-b3d2-48c6816be571`,priority:0,createdAt:1783035037605,runAt:1783035037605,attempts:0,progress:0}],active:[{id:`019f252b-8769-7000-bc44-cfc168232f53`,priority:0,createdAt:1783035037545,runAt:1783035037545,attempts:0,progress:0},{id:`019f252b-8775-7000-884a-63456175f48c`,priority:0,createdAt:1783035037557,runAt:1783035037557,attempts:0,progress:0}],delayed:[],paused:[]}},counts_reports:{ok:!0,counts:{waiting:0,prioritized:0,delayed:6,active:0,completed:0,failed:0,"waiting-children":0,paused:0}},dlq_reports:{ok:!0,entries:[],total:0},detail_reports:{ok:!0,name:`reports`,counts:{waiting:0,prioritized:0,delayed:6,active:0,completed:0,failed:0,"waiting-children":0,totalCompleted:0,totalFailed:0,paused:0},paused:!1,priorityCounts:{0:6},dlqPreview:[],timestamp:1783035131374,jobs:{waiting:[],active:[],delayed:[{id:`019f252b-87d8-7000-8f0c-e8ca5fec7d18`,priority:0,createdAt:1783035037656,runAt:1783035637656,attempts:0,progress:0},{id:`019f252b-87e3-7000-b0dc-18aac125e1ce`,priority:0,createdAt:1783035037667,runAt:1783035637667,attempts:0,progress:0},{id:`019f252b-87ee-7000-bb98-e9997d218441`,priority:0,createdAt:1783035037678,runAt:1783035637678,attempts:0,progress:0},{id:`019f252b-87fa-7000-9eb8-5b7a6d7aa7b4`,priority:0,createdAt:1783035037690,runAt:1783035637690,attempts:0,progress:0}],paused:[]}},counts_notifications:{ok:!0,counts:{waiting:4,prioritized:0,delayed:0,active:0,completed:0,failed:0,"waiting-children":0,paused:0}},dlq_notifications:{ok:!0,entries:[],total:0},detail_notifications:{ok:!0,name:`notifications`,counts:{waiting:4,prioritized:0,delayed:0,active:0,completed:0,failed:0,"waiting-children":0,totalCompleted:0,totalFailed:0,paused:0},paused:!1,priorityCounts:{0:4},dlqPreview:[],timestamp:1783035131375,jobs:{waiting:[{id:`019f252b-8823-7000-9455-de9cff6a56e2`,priority:0,createdAt:1783035037731,runAt:1783035037731,attempts:0,progress:0},{id:`019f252b-882e-7000-ae38-9c7fe01639d5`,priority:0,createdAt:1783035037742,runAt:1783035037742,attempts:0,progress:0},{id:`019f252b-883b-7000-8789-839b741a1011`,priority:0,createdAt:1783035037755,runAt:1783035037755,attempts:0,progress:0},{id:`019f252b-884d-7000-b703-96a357151ef4`,priority:0,createdAt:1783035037773,runAt:1783035037773,attempts:0,progress:0}],active:[],delayed:[],paused:[]}},emailsWaiting:{ok:!0,jobs:[{id:`019f252b-86c0-7000-a54e-3816c968ebf0`,queue:`emails`,data:{to:`user1@example.com`,subject:`Welcome 1`},createdAt:1783035037376,runAt:1783035037376,startedAt:null,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035037376,stallCount:0,priority:1,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037376}],_state:`prioritized`,state:`prioritized`},{id:`019f252b-86ce-7000-adfc-613a9495a6ef`,queue:`emails`,data:{to:`user2@example.com`,subject:`Welcome 2`},createdAt:1783035037390,runAt:1783035037390,startedAt:null,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035037390,stallCount:0,priority:2,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037390}],_state:`prioritized`,state:`prioritized`},{id:`019f252b-86fe-7000-894d-fe3ad935cc36`,queue:`emails`,data:{to:`user6@example.com`,subject:`Welcome 6`},createdAt:1783035037438,runAt:1783035037438,startedAt:null,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035037438,stallCount:0,priority:1,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037438}],_state:`prioritized`,state:`prioritized`},{id:`019f252b-870a-7000-91d2-ca4070505abe`,queue:`emails`,data:{to:`user7@example.com`,subject:`Welcome 7`},createdAt:1783035037450,runAt:1783035037450,startedAt:null,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035037450,stallCount:0,priority:2,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037450}],_state:`prioritized`,state:`prioritized`}]},emailsCompleted:{ok:!0,jobs:[{id:`019f252b-86da-7000-a9e3-6b1b74944d70`,queue:`emails`,data:{to:`user3@example.com`,subject:`Welcome 3`},createdAt:1783035037402,runAt:1783035037402,startedAt:1783035131364,completedAt:1783035131367,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:3,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037402},{state:`active`,timestamp:1783035131364},{state:`completed`,timestamp:1783035131367}],_state:`completed`,state:`completed`},{id:`019f252b-86e6-7000-a51e-e65a7cd2ce85`,queue:`emails`,data:{to:`user4@example.com`,subject:`Welcome 4`},createdAt:1783035037414,runAt:1783035037414,startedAt:1783035131364,completedAt:1783035131366,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:4,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037414},{state:`active`,timestamp:1783035131364},{state:`completed`,timestamp:1783035131366}],_state:`completed`,state:`completed`},{id:`019f252b-8722-7000-9270-14be63598def`,queue:`emails`,data:{to:`user9@example.com`,subject:`Welcome 9`},createdAt:1783035037474,runAt:1783035037474,startedAt:1783035131364,completedAt:1783035131366,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:4,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037474},{state:`active`,timestamp:1783035131364},{state:`completed`,timestamp:1783035131366}],_state:`completed`,state:`completed`},{id:`019f252b-875b-7000-8f4b-3d571d84663d`,queue:`emails`,data:{to:`user14@example.com`,subject:`Welcome 14`},createdAt:1783035037531,runAt:1783035037531,startedAt:1783035131364,completedAt:1783035131367,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:4,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037531},{state:`active`,timestamp:1783035131364},{state:`completed`,timestamp:1783035131367}],_state:`completed`,state:`completed`}]},oneJob:{ok:!0,job:{id:`019f252b-8716-7000-bbec-d8c65e09f340`,queue:`emails`,data:{to:`user8@example.com`,subject:`Welcome 8`},createdAt:1783035037462,runAt:1783035037462,startedAt:1783035131364,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:3,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037462},{state:`active`,timestamp:1783035131364}],state:`failed`}}},t={ok:!0,sqliteVersion:`3.45.1`,pageSize:4096,pageCount:640,journalMode:`wal`,freelistPages:8,tables:6,indexes:11,fileSize:2621440,walSize:49152},n={ok:!0,tables:[{name:`jobs`,rows:34,columns:6},{name:`queues`,rows:4,columns:4},{name:`dlq`,rows:2,columns:5},{name:`crons`,rows:2,columns:5},{name:`webhooks`,rows:1,columns:6},{name:`job_results`,rows:4,columns:3}]},r={jobs:{columns:[`id`,`queue`,`state`,`priority`,`attempts`,`created_at`],types:{id:`TEXT`,queue:`TEXT`,state:`TEXT`,priority:`INTEGER`,attempts:`INTEGER`,created_at:`INTEGER`},rows:[[`019f252b-86c0-7000-a54e-3816c968ebf0`,`emails`,`prioritized`,1,0,1783035037376],[`019f252b-8769-7000-bc44-cfc168232f53`,`image-processing`,`active`,0,0,1783035037545],[`019f252b-86da-7000-a9e3-6b1b74944d70`,`emails`,`completed`,3,0,1783035037402],[`019f252b-8716-7000-bbec-d8c65e09f340`,`emails`,`failed`,3,0,1783035037462],[`019f252b-87d8-7000-8f0c-e8ca5fec7d18`,`reports`,`delayed`,0,0,1783035037656]]},queues:{columns:[`name`,`paused`,`concurrency`,`rate_limit`],types:{name:`TEXT`,paused:`INTEGER`,concurrency:`INTEGER`,rate_limit:`INTEGER`},rows:[[`emails`,0,10,0],[`image-processing`,0,4,100],[`reports`,0,2,0],[`notifications`,0,8,0]]}};function i(e){let t=r[e],n=t?.columns??[`id`,`data`],i=t?.types??{};return{ok:!0,table:e,columns:n.map((e,t)=>({name:e,type:i[e]??`TEXT`,notNull:t===0,defaultValue:null,primaryKey:t===0})),indexes:[{name:`idx_${e}_${n[0]}`,unique:!0,columns:[n[0]]}],sql:`CREATE TABLE ${e} (${n.map(e=>`${e} ${i[e]??`TEXT`}`).join(`, `)})`,rowCount:t?.rows.length??0}}var a={"flow-order-9a3f":{id:`flow-order-9a3f`,queue:`orders`,state:`active`,priority:1,parentId:null,childrenIds:[`flow-charge-1`,`flow-ship-2`,`flow-notify-3`],dependsOn:[]},"flow-charge-1":{id:`flow-charge-1`,queue:`payments`,state:`completed`,priority:2,parentId:`flow-order-9a3f`,childrenIds:[],dependsOn:[]},"flow-ship-2":{id:`flow-ship-2`,queue:`shipping`,state:`active`,priority:1,parentId:`flow-order-9a3f`,childrenIds:[`flow-label-4`],dependsOn:[]},"flow-label-4":{id:`flow-label-4`,queue:`shipping`,state:`waiting`,priority:0,parentId:`flow-ship-2`,childrenIds:[],dependsOn:[]},"flow-notify-3":{id:`flow-notify-3`,queue:`emails`,state:`delayed`,priority:0,parentId:`flow-order-9a3f`,childrenIds:[],dependsOn:[`flow-charge-1`]}},o={command:`bunqueue start`,httpPort:6790,tcpPort:6791,dataPath:`./data/bunqueue.db`,extraEnv:{LOG_LEVEL:`info`}},s=()=>({status:`running`,pid:42317,startedAt:Date.now()-36e5,exitCode:null,healthy:!0,version:`2.8.26`,config:o,runningConfig:o,db:{path:o.dataPath,exists:!0,size:2621440,walSize:49152,shmSize:32768,totalSize:2703360,mtimeMs:Date.now()-12e3}}),c=()=>{let e=Date.now();return{ok:!0,data:{workers:[{id:`wrk-9f21c3d0`,name:`worker-emails-1`,queues:[`emails`,`notifications`],concurrency:10,hostname:`worker-01`,pid:3411,status:`active`,registeredAt:e-54e5,lastSeen:e-4e3,activeJobs:0,processedJobs:1284,failedJobs:6,currentJob:null,uptime:54e5},{id:`wrk-4b77aa19`,name:`worker-media-1`,queues:[`image-processing`],concurrency:4,hostname:`worker-02`,pid:3987,status:`active`,registeredAt:e-51e5,lastSeen:e-2e3,activeJobs:2,processedJobs:342,failedJobs:1,currentJob:`019f252b-8769-7000-bc44-cfc168232f53`,uptime:51e5},{id:`wrk-c05e881f`,name:`worker-batch-1`,queues:[`reports`],concurrency:2,hostname:`worker-02`,pid:4102,status:`stale`,registeredAt:e-9e6,lastSeen:e-12e5,activeJobs:0,processedJobs:57,failedJobs:0,currentJob:null,uptime:78e5}],stats:{total:3,active:2,totalProcessed:1683,totalFailed:7,activeJobs:2}}}},l=()=>{let e=Date.now(),t=(t,n,r,i)=>({seq:t,ts:e-n,stream:r,line:i});return{lines:[t(1,8e3,`sys`,`starting: bunqueue start`),t(2,7800,`stdout`,`bunqueue v2.8.26 — HTTP :6790, TCP :6791`),t(3,7600,`stdout`,`SQLite ready (WAL) at ./data/bunqueue.db`),t(4,5e3,`stdout`,`worker registered: image-processing`),t(5,1200,`stdout`,`health ok — 4 queues, 34 jobs`)]}};function u(e,t){let n=r[e],i=n?.columns??[`id`,`data`],a=n?.rows??[],o=new URLSearchParams(t);return{ok:!0,table:e,columns:i,rows:a,rowids:a.map((e,t)=>t+1),truncatedCells:a.map(e=>e.map(()=>!1)),total:a.length,limit:Number(o.get(`limit`)??50),offset:Number(o.get(`offset`)??0),orderBy:o.get(`orderBy`),dir:o.get(`dir`)===`desc`?`desc`:`asc`,filter:null}}var d=new Set([`events`,`health`,`ping`,`stats`,`storage`,`dashboard`,`queues`,`jobs`,`crons`,`webhooks`,`workers`,`dlq`,`control`,`db`,`gc`,`heapstats`]);function f(r,d,f){let p=r.replace(/\/+$/,``)||`/`,m=p.split(`/`).filter(Boolean);if(m[0]===`control`)return m[1]===`logs`?l():m[1]===`config`?o:s();if(d!==`GET`)return p===`/gc`?{ok:!0,before:{heapUsed:118,heapTotal:176,rss:214},after:{heapUsed:94,heapTotal:150,rss:181}}:p.endsWith(`/db/query`)?{ok:!0,columns:[`note`],rows:[[`This is the demo. Queries run against a static in-memory sample.`]],rowCount:1,truncated:!1,ms:.4}:p.endsWith(`/jobs`)||p.endsWith(`/jobs/bulk`)?{ok:!0,id:`demo-${m.join(`-`)}`,ids:[`demo-1`]}:{ok:!0};if(p===`/workers`)return c();if(p===`/heapstats`)return{ok:!0,memory:{heapUsed:94,heapTotal:150,rss:181},heap:{objectCount:486204,protectedCount:1284,globalCount:312},collections:{},topObjectTypes:[{type:`Structure`,count:42118},{type:`Object`,count:31064},{type:`Function`,count:18902},{type:`string`,count:12447},{type:`Array`,count:8021}]};let h={"/health":`health`,"/ping":`ping`,"/stats":`stats`,"/storage":`storage`,"/dashboard":`dashboard`,"/dashboard/queues":`dashboardQueues`,"/queues/summary":`queuesSummary`,"/crons":`crons`,"/webhooks":`webhooks`,"/dlq/stats":`dlqStats`};if(h[p])return e[h[p]];if(m[0]===`dashboard`&&m[1]===`queues`&&m[2])return e[`detail_${m[2]}`]??e.detail_emails;if(m[0]===`queues`&&m[1]){let t=decodeURIComponent(m[1]);if(m[2]===`counts`)return e[`counts_${t}`]??{ok:!0,counts:{}};if(m[2]===`dlq`&&m[3]===`stats`)return{ok:!0,stats:t===`emails`?{total:2,byReason:{timeout:1,max_attempts:1}}:{total:0,byReason:{}}};if(m[2]===`dlq`)return e[`dlq_${t}`]??{ok:!0,entries:[],total:0};if(m[2]===`stall-config`)return{ok:!0,config:{enabled:!0,stallInterval:3e4,maxStalls:3,gracePeriod:5e3}};if(m[2]===`dlq-config`)return{ok:!0,config:{autoRetry:!1,autoRetryInterval:6e4,maxAutoRetries:3,maxAge:null,maxEntries:1e3}};if(m[2]===`jobs`&&m[3]===`list`){let n=new URLSearchParams(f),r=(n.get(`states`)??n.get(`state`)??``).split(`,`).map(e=>e.trim()).filter(Boolean),i=t=>e[t]?.jobs??[],a=e.oneJob?.job,o=[...i(`emailsWaiting`),...i(`emailsCompleted`)];a&&o.push(a);let s=e=>r.length===0||r.includes(String(e))||r.includes(`waiting`)&&e===`prioritized`;return{ok:!0,jobs:o.filter(e=>s(e.state)).map((e,n)=>t===`emails`?e:{...e,id:`${t}-${String(e.id).slice(-12)}-${n}`,queue:t})}}}if(m[0]===`jobs`&&m[1]){let t=decodeURIComponent(m[1]);if(m[1]===`custom`&&m[2])return e.oneJob;if(m[2]===`result`)return{ok:!0,result:{sent:!0,provider:`demo`}};if(m[2]===`logs`){let e=[`[info] picked up by worker-emails-1`,`[info] connecting to smtp.example.com:587`,`[error] SMTP 550: mailbox unavailable — will retry with backoff`];return{ok:!0,data:{logs:e,count:e.length}}}if(!m[2])return a[t]?{ok:!0,job:a[t]}:e.oneJob}if(m[0]===`db`){if(m[1]===`info`)return t;if(m[1]===`tables`&&!m[2])return n;if(m[1]===`tables`&&m[2]){let e=decodeURIComponent(m[2]);return m[3]===`schema`?i(e):m[3]===`cell`?{ok:!0,value:`demo cell value`}:u(e,f)}}return{ok:!0}}var p=e=>new Response(JSON.stringify(e),{status:200,headers:{"Content-Type":`application/json`}});function m(e){let t=new TextEncoder,n=[`emails`,`image-processing`,`reports`,`notifications`],r=[`job:active`,`job:completed`,`job:completed`,`job:waiting`,`job:failed`,`job:active`],i=new ReadableStream({start(i){let a=0,o=!1,s,c=()=>{if(!o){o=!0,clearInterval(s);try{i.close()}catch{}}};i.enqueue(t.encode(`data: {"connected":true}
1
+ var e={health:{ok:!0,status:`healthy`,uptime:133,version:`2.8.26`,queues:{waiting:13,active:2,delayed:6,completed:4,dlq:2},connections:{tcp:0,ws:0,sse:0},memory:{heapUsed:3,heapTotal:4,rss:68}},ping:{ok:!0,data:{pong:!0,time:1783035131368}},stats:{ok:!0,stats:{waiting:13,prioritized:7,delayed:6,active:2,dlq:2,completed:4,"waiting-children":0,totalPushed:34,totalPulled:8,totalCompleted:4,totalFailed:0,uptime:133882,cronJobs:2,cronPending:2,pushPerSec:.25,pullPerSec:.06,completePerSec:.03,failPerSec:0},memory:{heapUsed:3,heapTotal:4,rss:69,external:1,arrayBuffers:0},collections:{jobIndex:34,completedJobs:4,jobResults:0,jobLogs:0,customIdMap:0,jobLocks:0,clientJobs:0,clientJobsTotal:0,pendingDepChecks:0,stalledCandidates:0,processingTotal:2,queuedTotal:26,waitingDepsTotal:0,temporalIndexTotal:34,delayedHeapTotal:6}},storage:{ok:!0,data:{diskFull:!1,error:null,since:null}},dashboard:{ok:!0,stats:{waiting:13,active:2,delayed:6,completed:4,dlq:2,totalPushed:34,totalPulled:8,totalCompleted:4,totalFailed:0,uptime:133882},throughput:{pushPerSec:.25,pullPerSec:.06,completePerSec:.03,failPerSec:0},latency:{averages:{pushMs:.07645341176470588,pullMs:.3890205,ackMs:1.03645825},percentiles:{push:{p50:.1,p95:.5,p99:1},pull:{p50:.1,p95:1,p99:1},ack:{p50:2.5,p95:2.5,p99:2.5}}},memory:{heapUsed:3,heapTotal:4,rss:70},collections:{jobIndex:34,completedJobs:4,jobResults:0,jobLogs:0,customIdMap:0,jobLocks:0,clientJobs:0,clientJobsTotal:0,pendingDepChecks:0,stalledCandidates:0,processingTotal:2,queuedTotal:26,waitingDepsTotal:0,temporalIndexTotal:34,delayedHeapTotal:6},workers:{total:0,active:0,list:[],truncated:!1},crons:{total:2,list:[{name:`nightly-report`,queue:`reports`,schedule:`0 2 * * *`,repeatEvery:null,nextRun:17830368e5,executions:0},{name:`heartbeat`,queue:`notifications`,schedule:null,repeatEvery:6e4,nextRun:1783035191362,executions:0}],truncated:!1},storage:{diskFull:!1,error:null,since:null},timestamp:1783035131369},dashboardQueues:{ok:!0,queues:[{name:`emails`,waiting:2,delayed:0,active:0,dlq:2,paused:!1},{name:`image-processing`,waiting:7,delayed:0,active:2,dlq:0,paused:!1},{name:`reports`,waiting:0,delayed:6,active:0,dlq:0,paused:!1},{name:`notifications`,waiting:4,delayed:0,active:0,dlq:0,paused:!1}],total:4,limit:100,offset:0,timestamp:1783035131370},queuesSummary:[{name:`emails`,paused:!1,counts:{waiting:2,active:0,completed:4,failed:2,delayed:0}},{name:`image-processing`,paused:!1,counts:{waiting:7,active:2,completed:0,failed:0,delayed:0}},{name:`reports`,paused:!1,counts:{waiting:0,active:0,completed:0,failed:0,delayed:6}},{name:`notifications`,paused:!1,counts:{waiting:4,active:0,completed:0,failed:0,delayed:0}}],crons:{ok:!0,crons:[{name:`nightly-report`,queue:`reports`,schedule:`0 2 * * *`,repeatEvery:null,nextRun:17830368e5,executions:0,maxLimit:null,timezone:null},{name:`heartbeat`,queue:`notifications`,schedule:null,repeatEvery:6e4,nextRun:1783035191362,executions:0,maxLimit:null,timezone:null}]},webhooks:{ok:!0,data:{webhooks:[{id:`019f252c-f5e3-7000-883c-28cc5dc157a0`,url:`https://hooks.example.com/bunqueue`,events:[`job.completed`,`job.failed`],queue:null,createdAt:1783035131363,lastTriggered:178303512e4,successCount:42,failureCount:3,enabled:!0}],stats:{total:1,enabled:1}}},workers:{ok:!0,data:{workers:[],stats:{total:0,active:0,totalProcessed:0,totalFailed:0,activeJobs:0}}},dlqStats:{ok:!0,total:2,byQueue:{emails:2}},counts_emails:{ok:!0,counts:{waiting:2,prioritized:7,delayed:0,active:0,completed:4,failed:2,"waiting-children":0,paused:0}},dlq_emails:{ok:!0,entries:[{job:{id:`019f252b-8716-7000-bbec-d8c65e09f340`,queue:`emails`,data:{to:`user8@example.com`,subject:`Welcome 8`},createdAt:1783035037462,runAt:1783035037462,startedAt:1783035131364,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:3,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037462},{state:`active`,timestamp:1783035131364}]},enteredAt:1783035131367,reason:`timeout`,error:`Job exceeded its 30000 ms timeout while connecting to smtp.example.com`,attempts:[{attempt:0,startedAt:1783035131364,failedAt:1783035131367,reason:`timeout`,error:`Job exceeded its 30000 ms timeout while connecting to smtp.example.com`,duration:3}],retryCount:0,lastRetryAt:null,nextRetryAt:null,expiresAt:1783639931367},{job:{id:`019f252b-8750-7000-afa1-767720d8f433`,queue:`emails`,data:{to:`user13@example.com`,subject:`Welcome 13`},createdAt:1783035037520,runAt:1783035037520,startedAt:1783035131364,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:3,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037520},{state:`active`,timestamp:1783035131364}]},enteredAt:1783035131368,reason:`max_attempts`,error:`SMTP 550: mailbox unavailable (user13@example.com) — 3 of 3 attempts failed`,attempts:[{attempt:0,startedAt:1783035131364,failedAt:1783035131368,reason:`max_attempts`,error:`SMTP 550: mailbox unavailable (user13@example.com) — 3 of 3 attempts failed`,duration:4}],retryCount:0,lastRetryAt:null,nextRetryAt:null,expiresAt:1783639931368}],total:2},detail_emails:{ok:!0,name:`emails`,counts:{waiting:2,prioritized:7,delayed:0,active:0,completed:4,failed:2,"waiting-children":0,totalCompleted:4,totalFailed:0,paused:0},paused:!1,priorityCounts:{0:2,1:3,2:4},dlqPreview:[{id:`019f252b-8716-7000-bbec-d8c65e09f340`,data:{to:`user8@example.com`,subject:`Welcome 8`},attempts:0,createdAt:1783035037462},{id:`019f252b-8750-7000-afa1-767720d8f433`,data:{to:`user13@example.com`,subject:`Welcome 13`},attempts:0,createdAt:1783035037520}],timestamp:1783035131373,jobs:{waiting:[{id:`019f252b-86f2-7000-a45d-6e5e3dd4abf0`,priority:0,createdAt:1783035037426,runAt:1783035037426,attempts:0,progress:0},{id:`019f252b-872e-7000-91af-f820da905a23`,priority:0,createdAt:1783035037486,runAt:1783035037486,attempts:0,progress:0}],active:[],delayed:[],paused:[]}},"counts_image-processing":{ok:!0,counts:{waiting:7,prioritized:0,delayed:0,active:2,completed:0,failed:0,"waiting-children":0,paused:0}},"dlq_image-processing":{ok:!0,entries:[],total:0},"detail_image-processing":{ok:!0,name:`image-processing`,counts:{waiting:7,prioritized:0,delayed:0,active:2,completed:0,failed:0,"waiting-children":0,totalCompleted:0,totalFailed:0,paused:0},paused:!1,priorityCounts:{0:7},dlqPreview:[],timestamp:1783035131374,jobs:{waiting:[{id:`019f252b-8780-7000-9066-7f3a95bbb309`,priority:0,createdAt:1783035037568,runAt:1783035037568,attempts:0,progress:0},{id:`019f252b-878d-7000-9396-88a9de934b0c`,priority:0,createdAt:1783035037581,runAt:1783035037581,attempts:0,progress:0},{id:`019f252b-8799-7000-8433-2f4d874dfa3f`,priority:0,createdAt:1783035037593,runAt:1783035037593,attempts:0,progress:0},{id:`019f252b-87a5-7000-b3d2-48c6816be571`,priority:0,createdAt:1783035037605,runAt:1783035037605,attempts:0,progress:0}],active:[{id:`019f252b-8769-7000-bc44-cfc168232f53`,priority:0,createdAt:1783035037545,runAt:1783035037545,attempts:0,progress:0},{id:`019f252b-8775-7000-884a-63456175f48c`,priority:0,createdAt:1783035037557,runAt:1783035037557,attempts:0,progress:0}],delayed:[],paused:[]}},counts_reports:{ok:!0,counts:{waiting:0,prioritized:0,delayed:6,active:0,completed:0,failed:0,"waiting-children":0,paused:0}},dlq_reports:{ok:!0,entries:[],total:0},detail_reports:{ok:!0,name:`reports`,counts:{waiting:0,prioritized:0,delayed:6,active:0,completed:0,failed:0,"waiting-children":0,totalCompleted:0,totalFailed:0,paused:0},paused:!1,priorityCounts:{0:6},dlqPreview:[],timestamp:1783035131374,jobs:{waiting:[],active:[],delayed:[{id:`019f252b-87d8-7000-8f0c-e8ca5fec7d18`,priority:0,createdAt:1783035037656,runAt:1783035637656,attempts:0,progress:0},{id:`019f252b-87e3-7000-b0dc-18aac125e1ce`,priority:0,createdAt:1783035037667,runAt:1783035637667,attempts:0,progress:0},{id:`019f252b-87ee-7000-bb98-e9997d218441`,priority:0,createdAt:1783035037678,runAt:1783035637678,attempts:0,progress:0},{id:`019f252b-87fa-7000-9eb8-5b7a6d7aa7b4`,priority:0,createdAt:1783035037690,runAt:1783035637690,attempts:0,progress:0}],paused:[]}},counts_notifications:{ok:!0,counts:{waiting:4,prioritized:0,delayed:0,active:0,completed:0,failed:0,"waiting-children":0,paused:0}},dlq_notifications:{ok:!0,entries:[],total:0},detail_notifications:{ok:!0,name:`notifications`,counts:{waiting:4,prioritized:0,delayed:0,active:0,completed:0,failed:0,"waiting-children":0,totalCompleted:0,totalFailed:0,paused:0},paused:!1,priorityCounts:{0:4},dlqPreview:[],timestamp:1783035131375,jobs:{waiting:[{id:`019f252b-8823-7000-9455-de9cff6a56e2`,priority:0,createdAt:1783035037731,runAt:1783035037731,attempts:0,progress:0},{id:`019f252b-882e-7000-ae38-9c7fe01639d5`,priority:0,createdAt:1783035037742,runAt:1783035037742,attempts:0,progress:0},{id:`019f252b-883b-7000-8789-839b741a1011`,priority:0,createdAt:1783035037755,runAt:1783035037755,attempts:0,progress:0},{id:`019f252b-884d-7000-b703-96a357151ef4`,priority:0,createdAt:1783035037773,runAt:1783035037773,attempts:0,progress:0}],active:[],delayed:[],paused:[]}},emailsWaiting:{ok:!0,jobs:[{id:`019f252b-86c0-7000-a54e-3816c968ebf0`,queue:`emails`,data:{to:`user1@example.com`,subject:`Welcome 1`},createdAt:1783035037376,runAt:1783035037376,startedAt:null,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035037376,stallCount:0,priority:1,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037376}],_state:`prioritized`,state:`prioritized`},{id:`019f252b-86ce-7000-adfc-613a9495a6ef`,queue:`emails`,data:{to:`user2@example.com`,subject:`Welcome 2`},createdAt:1783035037390,runAt:1783035037390,startedAt:null,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035037390,stallCount:0,priority:2,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037390}],_state:`prioritized`,state:`prioritized`},{id:`019f252b-86fe-7000-894d-fe3ad935cc36`,queue:`emails`,data:{to:`user6@example.com`,subject:`Welcome 6`},createdAt:1783035037438,runAt:1783035037438,startedAt:null,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035037438,stallCount:0,priority:1,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037438}],_state:`prioritized`,state:`prioritized`},{id:`019f252b-870a-7000-91d2-ca4070505abe`,queue:`emails`,data:{to:`user7@example.com`,subject:`Welcome 7`},createdAt:1783035037450,runAt:1783035037450,startedAt:null,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035037450,stallCount:0,priority:2,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037450}],_state:`prioritized`,state:`prioritized`}]},emailsCompleted:{ok:!0,jobs:[{id:`019f252b-86da-7000-a9e3-6b1b74944d70`,queue:`emails`,data:{to:`user3@example.com`,subject:`Welcome 3`},createdAt:1783035037402,runAt:1783035037402,startedAt:1783035131364,completedAt:1783035131367,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:3,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037402},{state:`active`,timestamp:1783035131364},{state:`completed`,timestamp:1783035131367}],_state:`completed`,state:`completed`},{id:`019f252b-86e6-7000-a51e-e65a7cd2ce85`,queue:`emails`,data:{to:`user4@example.com`,subject:`Welcome 4`},createdAt:1783035037414,runAt:1783035037414,startedAt:1783035131364,completedAt:1783035131366,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:4,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037414},{state:`active`,timestamp:1783035131364},{state:`completed`,timestamp:1783035131366}],_state:`completed`,state:`completed`},{id:`019f252b-8722-7000-9270-14be63598def`,queue:`emails`,data:{to:`user9@example.com`,subject:`Welcome 9`},createdAt:1783035037474,runAt:1783035037474,startedAt:1783035131364,completedAt:1783035131366,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:4,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037474},{state:`active`,timestamp:1783035131364},{state:`completed`,timestamp:1783035131366}],_state:`completed`,state:`completed`},{id:`019f252b-875b-7000-8f4b-3d571d84663d`,queue:`emails`,data:{to:`user14@example.com`,subject:`Welcome 14`},createdAt:1783035037531,runAt:1783035037531,startedAt:1783035131364,completedAt:1783035131367,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:4,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037531},{state:`active`,timestamp:1783035131364},{state:`completed`,timestamp:1783035131367}],_state:`completed`,state:`completed`}]},oneJob:{ok:!0,job:{id:`019f252b-8716-7000-bbec-d8c65e09f340`,queue:`emails`,data:{to:`user8@example.com`,subject:`Welcome 8`},createdAt:1783035037462,runAt:1783035037462,startedAt:1783035131364,completedAt:null,attempts:0,backoff:1e3,backoffConfig:null,dependsOn:[],childrenIds:[],childrenCompleted:0,tags:[],progress:0,progressMessage:null,stacktrace:null,repeat:null,lastHeartbeat:1783035131364,stallCount:0,priority:3,lifo:!1,maxAttempts:3,removeOnComplete:!1,removeOnFail:!1,ttl:null,timeout:null,uniqueKey:null,customId:null,parentId:null,groupId:null,stallTimeout:null,stackTraceLimit:10,keepLogs:null,sizeLimit:null,failParentOnFailure:!1,removeDependencyOnFailure:!1,continueParentOnFailure:!1,ignoreDependencyOnFailure:!1,deduplicationTtl:null,deduplicationExtend:!1,deduplicationReplace:!1,debounceId:null,debounceTtl:null,timeline:[{state:`prioritized`,timestamp:1783035037462},{state:`active`,timestamp:1783035131364}],state:`failed`}}},t={ok:!0,sqliteVersion:`3.45.1`,pageSize:4096,pageCount:640,journalMode:`wal`,freelistPages:8,tables:6,indexes:11,fileSize:2621440,walSize:49152},n={jobs:{columns:[`id`,`queue`,`state`,`priority`,`attempts`,`created_at`],types:{id:`TEXT`,queue:`TEXT`,state:`TEXT`,priority:`INTEGER`,attempts:`INTEGER`,created_at:`INTEGER`},rows:[[`019f252b-86c0-7000-a54e-3816c968ebf0`,`emails`,`prioritized`,1,0,1783035037376],[`019f252b-8769-7000-bc44-cfc168232f53`,`image-processing`,`active`,0,0,1783035037545],[`019f252b-86da-7000-a9e3-6b1b74944d70`,`emails`,`completed`,3,0,1783035037402],[`019f252b-8716-7000-bbec-d8c65e09f340`,`emails`,`failed`,3,0,1783035037462],[`019f252b-87d8-7000-8f0c-e8ca5fec7d18`,`reports`,`delayed`,0,0,1783035037656]]},queues:{columns:[`name`,`paused`,`concurrency`,`rate_limit`],types:{name:`TEXT`,paused:`INTEGER`,concurrency:`INTEGER`,rate_limit:`INTEGER`},rows:[[`emails`,0,10,0],[`image-processing`,0,4,100],[`reports`,0,2,0],[`notifications`,0,8,0]]},dlq:{columns:[`id`,`queue`,`reason`,`attempts`,`entered_at`],types:{id:`TEXT`,queue:`TEXT`,reason:`TEXT`,attempts:`INTEGER`,entered_at:`INTEGER`},rows:[[`019f252b-8716-7000-bbec-d8c65e09f340`,`emails`,`max attempts reached`,3,1783035037462],[`019f252b-8a02-7000-9b21-4c1f0b7e2a55`,`reports`,`handler threw`,5,1783035039101]]},crons:{columns:[`name`,`queue`,`pattern`,`tz`,`next_run`],types:{name:`TEXT`,queue:`TEXT`,pattern:`TEXT`,tz:`TEXT`,next_run:`INTEGER`},rows:[[`nightly-report`,`reports`,`0 2 * * *`,`UTC`,17830944e5],[`digest-email`,`emails`,`*/15 * * * *`,`UTC`,17830359e5]]},webhooks:{columns:[`id`,`url`,`events`,`active`,`failures`,`created_at`],types:{id:`TEXT`,url:`TEXT`,events:`TEXT`,active:`INTEGER`,failures:`INTEGER`,created_at:`INTEGER`},rows:[[`wh_9c31`,`https://hooks.example.com/bunqueue`,`job:completed,job:failed`,1,0,1783034e6]]},job_results:{columns:[`job_id`,`result`,`stored_at`],types:{job_id:`TEXT`,result:`TEXT`,stored_at:`INTEGER`},rows:[[`019f252b-86da-7000-a9e3-6b1b74944d70`,`{"messageId":"smtp-7712"}`,1783035037999],[`019f252b-8769-7000-bc44-cfc168232f53`,`{"bytes":184320}`,1783035038220],[`019f252b-87d8-7000-8f0c-e8ca5fec7d18`,`{"rows":128}`,1783035038511],[`019f252b-8a02-7000-9b21-4c1f0b7e2a55`,`{"error":"handler threw"}`,1783035039300]]}},r={ok:!0,tables:Object.entries(n).map(([e,t])=>({name:e,rows:t.rows.length,columns:t.columns.length}))};function i(e){let t=n[e],r=t?.columns??[`id`,`data`],i=t?.types??{};return{ok:!0,table:e,columns:r.map((e,t)=>({name:e,type:i[e]??`TEXT`,notNull:t===0,defaultValue:null,primaryKey:t===0})),indexes:[{name:`idx_${e}_${r[0]}`,unique:!0,columns:[r[0]]}],sql:`CREATE TABLE ${e} (${r.map(e=>`${e} ${i[e]??`TEXT`}`).join(`, `)})`,rowCount:t?.rows.length??0}}var a={"flow-order-9a3f":{id:`flow-order-9a3f`,queue:`orders`,state:`active`,priority:1,parentId:null,childrenIds:[`flow-charge-1`,`flow-ship-2`,`flow-notify-3`],dependsOn:[]},"flow-charge-1":{id:`flow-charge-1`,queue:`payments`,state:`completed`,priority:2,parentId:`flow-order-9a3f`,childrenIds:[],dependsOn:[]},"flow-ship-2":{id:`flow-ship-2`,queue:`shipping`,state:`active`,priority:1,parentId:`flow-order-9a3f`,childrenIds:[`flow-label-4`],dependsOn:[]},"flow-label-4":{id:`flow-label-4`,queue:`shipping`,state:`waiting`,priority:0,parentId:`flow-ship-2`,childrenIds:[],dependsOn:[]},"flow-notify-3":{id:`flow-notify-3`,queue:`emails`,state:`delayed`,priority:0,parentId:`flow-order-9a3f`,childrenIds:[],dependsOn:[`flow-charge-1`]}},o={command:`bunqueue start`,httpPort:6790,tcpPort:6791,dataPath:`./data/bunqueue.db`,extraEnv:{LOG_LEVEL:`info`}},s=()=>({status:`running`,pid:42317,startedAt:Date.now()-36e5,exitCode:null,healthy:!0,version:`2.8.26`,config:o,runningConfig:o,db:{path:o.dataPath,exists:!0,size:2621440,walSize:49152,shmSize:32768,totalSize:2703360,mtimeMs:Date.now()-12e3}}),c=()=>{let e=Date.now();return{ok:!0,data:{workers:[{id:`wrk-9f21c3d0`,name:`worker-emails-1`,queues:[`emails`,`notifications`],concurrency:10,hostname:`worker-01`,pid:3411,status:`active`,registeredAt:e-54e5,lastSeen:e-4e3,activeJobs:0,processedJobs:1284,failedJobs:6,currentJob:null,uptime:54e5},{id:`wrk-4b77aa19`,name:`worker-media-1`,queues:[`image-processing`],concurrency:4,hostname:`worker-02`,pid:3987,status:`active`,registeredAt:e-51e5,lastSeen:e-2e3,activeJobs:2,processedJobs:342,failedJobs:1,currentJob:`019f252b-8769-7000-bc44-cfc168232f53`,uptime:51e5},{id:`wrk-c05e881f`,name:`worker-batch-1`,queues:[`reports`],concurrency:2,hostname:`worker-02`,pid:4102,status:`stale`,registeredAt:e-9e6,lastSeen:e-12e5,activeJobs:0,processedJobs:57,failedJobs:0,currentJob:null,uptime:78e5}],stats:{total:3,active:2,totalProcessed:1683,totalFailed:7,activeJobs:2}}}},l=()=>{let e=Date.now(),t=(t,n,r,i)=>({seq:t,ts:e-n,stream:r,line:i});return{lines:[t(1,8e3,`sys`,`starting: bunqueue start`),t(2,7800,`stdout`,`bunqueue v2.8.26 — HTTP :6790, TCP :6791`),t(3,7600,`stdout`,`SQLite ready (WAL) at ./data/bunqueue.db`),t(4,5e3,`stdout`,`worker registered: image-processing`),t(5,1200,`stdout`,`health ok — 4 queues, 34 jobs`)]}};function u(e,t){let r=n[e],i=r?.columns??[`id`,`data`],a=r?.rows??[],o=new URLSearchParams(t),s=(e,t)=>{let n=Number(e);return e!==null&&Number.isFinite(n)&&n>=0?n:t},c=s(o.get(`limit`),50),l=s(o.get(`offset`),0),u=o.get(`orderBy`),d=o.get(`dir`)===`desc`?`desc`:`asc`,f=u?i.indexOf(u):-1,p=f>=0?[...a].sort((e,t)=>{let n=e[f],r=t[f],i=n<r?-1:+(n>r);return d===`desc`?-i:i}):a,m=p.slice(l,l+(c>0?c:p.length));return{ok:!0,table:e,columns:i,rows:m,rowids:m.map((e,t)=>l+t+1),truncatedCells:m.map(e=>e.map(()=>!1)),total:a.length,limit:c,offset:l,orderBy:u,dir:d,filter:null}}var d=new Set([`events`,`health`,`ping`,`stats`,`storage`,`dashboard`,`queues`,`jobs`,`crons`,`webhooks`,`workers`,`dlq`,`control`,`db`,`gc`,`heapstats`]);function f(n,d,f){let p=n.replace(/\/+$/,``)||`/`,m=p.split(`/`).filter(Boolean);if(m[0]===`control`)return m[1]===`logs`?l():m[1]===`config`?o:s();if(d!==`GET`)return p===`/gc`?{ok:!0,before:{heapUsed:118,heapTotal:176,rss:214},after:{heapUsed:94,heapTotal:150,rss:181}}:p.endsWith(`/db/query`)?{ok:!0,columns:[`note`],rows:[[`This is the demo. Queries run against a static in-memory sample.`]],rowCount:1,truncated:!1,ms:.4}:p.endsWith(`/jobs`)||p.endsWith(`/jobs/bulk`)?{ok:!0,id:`demo-${m.join(`-`)}`,ids:[`demo-1`]}:{ok:!0};if(p===`/workers`)return c();if(p===`/heapstats`)return{ok:!0,memory:{heapUsed:94,heapTotal:150,rss:181},heap:{objectCount:486204,protectedCount:1284,globalCount:312},collections:{},topObjectTypes:[{type:`Structure`,count:42118},{type:`Object`,count:31064},{type:`Function`,count:18902},{type:`string`,count:12447},{type:`Array`,count:8021}]};let h={"/health":`health`,"/ping":`ping`,"/stats":`stats`,"/storage":`storage`,"/dashboard":`dashboard`,"/dashboard/queues":`dashboardQueues`,"/queues/summary":`queuesSummary`,"/crons":`crons`,"/webhooks":`webhooks`,"/dlq/stats":`dlqStats`};if(h[p])return e[h[p]];if(m[0]===`dashboard`&&m[1]===`queues`&&m[2])return e[`detail_${m[2]}`]??e.detail_emails;if(m[0]===`queues`&&m[1]){let t=decodeURIComponent(m[1]);if(m[2]===`counts`)return e[`counts_${t}`]??{ok:!0,counts:{}};if(m[2]===`dlq`&&m[3]===`stats`)return{ok:!0,stats:t===`emails`?{total:2,byReason:{timeout:1,max_attempts:1}}:{total:0,byReason:{}}};if(m[2]===`dlq`)return e[`dlq_${t}`]??{ok:!0,entries:[],total:0};if(m[2]===`stall-config`)return{ok:!0,config:{enabled:!0,stallInterval:3e4,maxStalls:3,gracePeriod:5e3}};if(m[2]===`dlq-config`)return{ok:!0,config:{autoRetry:!1,autoRetryInterval:6e4,maxAutoRetries:3,maxAge:null,maxEntries:1e3}};if(m[2]===`jobs`&&m[3]===`list`){let n=new URLSearchParams(f),r=(n.get(`states`)??n.get(`state`)??``).split(`,`).map(e=>e.trim()).filter(Boolean),i=t=>e[t]?.jobs??[],a=e.oneJob?.job,o=[...i(`emailsWaiting`),...i(`emailsCompleted`)];a&&o.push(a);let s=e=>r.length===0||r.includes(String(e))||r.includes(`waiting`)&&e===`prioritized`;return{ok:!0,jobs:o.filter(e=>s(e.state)).map((e,n)=>t===`emails`?e:{...e,id:`${t}-${String(e.id).slice(-12)}-${n}`,queue:t})}}}if(m[0]===`jobs`&&m[1]){let t=decodeURIComponent(m[1]);if(m[1]===`custom`&&m[2])return e.oneJob;if(m[2]===`result`)return{ok:!0,result:{sent:!0,provider:`demo`}};if(m[2]===`logs`){let e=[`[info] picked up by worker-emails-1`,`[info] connecting to smtp.example.com:587`,`[error] SMTP 550: mailbox unavailable — will retry with backoff`];return{ok:!0,data:{logs:e,count:e.length}}}if(!m[2])return a[t]?{ok:!0,job:a[t]}:e.oneJob}if(m[0]===`db`){if(m[1]===`info`)return t;if(m[1]===`tables`&&!m[2])return r;if(m[1]===`tables`&&m[2]){let e=decodeURIComponent(m[2]);return m[3]===`schema`?i(e):m[3]===`cell`?{ok:!0,value:`demo cell value`}:u(e,f)}}return{ok:!0}}var p=e=>new Response(JSON.stringify(e),{status:200,headers:{"Content-Type":`application/json`}});function m(e){let t=new TextEncoder,n=[`emails`,`image-processing`,`reports`,`notifications`],r=[`job:active`,`job:completed`,`job:completed`,`job:waiting`,`job:failed`,`job:active`],i=new ReadableStream({start(i){let a=0,o=!1,s,c=()=>{if(!o){o=!0,clearInterval(s);try{i.close()}catch{}}};i.enqueue(t.encode(`data: {"connected":true}
2
2
 
3
3
  `)),s=setInterval(()=>{if(o)return;let e=r[a%r.length],s=n[a%n.length],l=JSON.stringify({queue:s,jobId:`demo-${a}`,name:s,timestamp:Date.now()});try{i.enqueue(t.encode(`event: ${e}\ndata: ${l}\n\n`))}catch{c()}a+=1},1400),e?.aborted?c():e?.addEventListener(`abort`,c,{once:!0})}});return new Response(i,{status:200,headers:{"Content-Type":`text/event-stream`}})}var h=!1;function g(){if(h||typeof window>`u`)return;h=!0;let e=window.fetch.bind(window),t=`/`.replace(/\/+$/,``);window.fetch=((n,r)=>{let i=n instanceof Request?n:null,a=typeof n==`string`?n:n instanceof URL?n.href:i?.url??``,o=(r?.method??i?.method??`GET`).toUpperCase(),s;try{s=new URL(a,window.location.origin)}catch{return e(n,r)}let c=s.pathname;t&&(c===t||c.startsWith(`${t}/`))&&(c=c.slice(t.length)||`/`),(c===`/api`||c.startsWith(`/api/`))&&(c=c.slice(4)||`/`);let l=c.split(`/`).filter(Boolean)[0];return!l||!d.has(l)?e(n,r):l===`events`?Promise.resolve(m(r?.signal??i?.signal)):Promise.resolve(p(f(c,o,s.search)))})}export{g as installDemo};
@@ -0,0 +1 @@
1
+ import{r as e}from"./cn-CMFYpumL.js";import{h as t}from"./react-vendor-BcouBxpZ.js";import{i as n}from"./connectionStore-DO6xQY7h.js";import{k as r,nt as i}from"./index-r1ZMLIZ9.js";var a=e(t(),1),o=1e3,s={push:[],complete:[],fail:[],depth:[]},c=()=>typeof performance<`u`?performance.now():Date.now(),l=(e,t)=>`${e}\u0000${t}`;function u(e=60){let t=n(e=>e.baseUrl),u=n(e=>e.token),[d,f]=(0,a.useState)(s),[p,m]=(0,a.useState)(null),[h,g]=(0,a.useState)(null),_=(0,a.useRef)(!0),v=(0,a.useRef)(!1),y=(0,a.useRef)(0),b=(0,a.useRef)(l(t,u));return(0,a.useEffect)(()=>{_.current=!0;let n=l(t,u);b.current!==n&&(b.current=n,f(s),m(null),g(null),y.current=0);let a=r(()=>typeof document<`u`&&document.hidden),d=async()=>{if(v.current||!a())return;v.current=!0;let t=c();try{let n=await i.overview();if(!_.current)return;let r=n?.stats,a=n?.throughput;if(!r||!a)throw Error(`malformed /dashboard body`);let c=(r.waiting??0)+(r.active??0)+(r.delayed??0),l=a.pushPerSec,u=a.completePerSec,d=a.failPerSec,p=y.current>0&&t-y.current>4*o;y.current=t,m(n),g(null),f(t=>{let n=p?s:t;return{push:[...n.push,l].slice(-e),complete:[...n.complete,u].slice(-e),fail:[...n.fail,d].slice(-e),depth:[...n.depth,c].slice(-e)}})}catch(e){_.current&&g(e)}finally{v.current=!1}};d();let p=setInterval(d,o);return()=>{_.current=!1,clearInterval(p)}},[e,t,u]),{...d,latest:p,error:h}}function d(e,t=o){if(e.length<2)return{slope:0,label:`steady`,draining:!1};let n=e.length,r=(n-1)/2,i=e.reduce((e,t)=>e+t,0)/n,a=0,s=0;for(let t=0;t<n;t++)a+=(t-r)*(e[t]-i),s+=(t-r)**2;let c=s===0?0:a/s,l=t>0?o/t*c:c,u=l<-.05;return{slope:l,label:u?`draining`:l>.05?`accumulating`:`steady`,draining:u}}export{u as n,d as t};
package/dist/index.html CHANGED
@@ -46,11 +46,11 @@
46
46
  content="Fully drive a bunqueue server from one UI: queues, jobs, DLQ, cron, webhooks, workers, and start/stop/restart. Live demo, no signup."
47
47
  />
48
48
  <meta name="twitter:image" content="https://egeominotti.github.io/bunqueue-dashboard/og.png" />
49
- <script type="module" crossorigin src="/assets/index-BOcegTHa.js"></script>
49
+ <script type="module" crossorigin src="/assets/index-r1ZMLIZ9.js"></script>
50
50
  <link rel="modulepreload" crossorigin href="/assets/cn-CMFYpumL.js">
51
51
  <link rel="modulepreload" crossorigin href="/assets/react-vendor-BcouBxpZ.js">
52
- <link rel="modulepreload" crossorigin href="/assets/connectionStore-Ci04lJmR.js">
53
- <link rel="stylesheet" crossorigin href="/assets/index-DWV3tgrk.css">
52
+ <link rel="modulepreload" crossorigin href="/assets/connectionStore-DO6xQY7h.js">
53
+ <link rel="stylesheet" crossorigin href="/assets/index-DcVOpnSj.css">
54
54
  </head>
55
55
  <body>
56
56
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunqueue-dashboard",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "type": "module",
5
5
  "description": "Web dashboard for a bunqueue server (queues, jobs, DLQ, cron, metrics, workers, live activity). Run with `bunx bunqueue-dashboard` (requires Bun).",
6
6
  "bin": {