bunqueue-dashboard 1.0.4 → 1.1.0

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 (68) hide show
  1. package/README.md +173 -360
  2. package/agent/queue/validation.ts +6 -3
  3. package/dist/.vite/manifest.json +177 -82
  4. package/dist/assets/AddJob-jmrtBSrz.js +3 -0
  5. package/dist/assets/{Alerts-Lyzbq0qw.js → Alerts-DrwYvhbk.js} +1 -1
  6. package/dist/assets/{Benchmark-B4NfYkAi.js → Benchmark-7ULYlqmK.js} +1 -1
  7. package/dist/assets/{BulkAddJobs-BAN5wT8A.js → BulkAddJobs-C2sxF-St.js} +3 -3
  8. package/dist/assets/{Cron-Bz46oVXB.js → Cron-BY9EGj2n.js} +1 -1
  9. package/dist/assets/{CronManager-Cl5RW2cB.js → CronManager-CZvC_uox.js} +1 -1
  10. package/dist/assets/Database-B1Dx5OV2.js +3 -0
  11. package/dist/assets/{Diagnostics-DuzTPfyb.js → Diagnostics-D1LEl6O4.js} +1 -1
  12. package/dist/assets/{Dlq-D8s-NhV2.js → Dlq-CPxeigKg.js} +1 -1
  13. package/dist/assets/{DlqControl-DDxRMM8i.js → DlqControl-Dhcz7LY7.js} +1 -1
  14. package/dist/assets/DlqPro-CW80tQdN.js +1 -0
  15. package/dist/assets/FailureDiagnostics-DkLd6szC.js +1 -0
  16. package/dist/assets/{Fleet-BAziMWfo.js → Fleet-CsscadVQ.js} +1 -1
  17. package/dist/assets/Flows-Bzq3onQ3.js +2 -0
  18. package/dist/assets/GlobalSearch-CeCvA6Tm.js +1 -0
  19. package/dist/assets/{JobInspector-BXuXxDwR.js → JobInspector-nTUU1VOU.js} +2 -2
  20. package/dist/assets/{Jobs-pQBmffni.js → Jobs-OwKndzhg.js} +1 -1
  21. package/dist/assets/{JobsPro-k20Pas24.js → JobsPro-CSHP2AYC.js} +1 -1
  22. package/dist/assets/{Logs-DA4JFvpM.js → Logs-CiYuY8ix.js} +1 -1
  23. package/dist/assets/{LogsPro-hna5L6sP.js → LogsPro-BA-wZ8Dr.js} +1 -1
  24. package/dist/assets/{McpServer-Cqem-L3z.js → McpServer-BvOGxNnE.js} +1 -1
  25. package/dist/assets/MetricHistory-Dmu-XqaO.js +1 -0
  26. package/dist/assets/{Metrics-CJ9dW0me.js → Metrics-BF38GgYm.js} +1 -1
  27. package/dist/assets/{MetricsPro-BslYrx1A.js → MetricsPro-DHPmT4Md.js} +1 -1
  28. package/dist/assets/MonitoringSetup-60_ib3rf.js +3 -0
  29. package/dist/assets/{Overview-Cmg_2NAt.js → Overview-DBLxV_vL.js} +1 -1
  30. package/dist/assets/{Pagination-WVfHLHDS.js → Pagination-CmVnmrFt.js} +1 -1
  31. package/dist/assets/{QueueActions-BQf1-g5m.js → QueueActions-uNol2MD7.js} +1 -1
  32. package/dist/assets/QueueControl-DbQwvvtX.js +1 -0
  33. package/dist/assets/{QueueDetail-DfRY4jS4.js → QueueDetail-CA33Kebs.js} +1 -1
  34. package/dist/assets/{QueueDetailPro-CpSMSo8A.js → QueueDetailPro-AUf6FktH.js} +1 -1
  35. package/dist/assets/{Queues-C5lElTjp.js → Queues-C_KeSyQs.js} +1 -1
  36. package/dist/assets/{QueuesOverview-DRohFtuC.js → QueuesOverview-DQ6ta4wA.js} +1 -1
  37. package/dist/assets/{S3Backup-DUHmp2Xw.js → S3Backup-BgPBXJVZ.js} +1 -1
  38. package/dist/assets/{S3BackupPro-Cr2ZJZkw.js → S3BackupPro-BUzcmhnj.js} +3 -3
  39. package/dist/assets/{ServerControl-m58ooJT2.js → ServerControl-WUZjdjPX.js} +1 -1
  40. package/dist/assets/{Settings-DXsjoOqD.js → Settings-Dwh79r-B.js} +1 -1
  41. package/dist/assets/{Usage-CY2uEJEu.js → Usage-DeWofLpa.js} +1 -1
  42. package/dist/assets/{UsagePro-DtlB1dJc.js → UsagePro-BQJWWwW3.js} +1 -1
  43. package/dist/assets/{Webhooks-B_GwTCBW.js → Webhooks-DS3xmbEi.js} +1 -1
  44. package/dist/assets/{Workers-Bu8aJlZf.js → Workers-DyAVvmbR.js} +1 -1
  45. package/dist/assets/{WorkersPro-C6gNYGfo.js → WorkersPro-BJgab7of.js} +1 -1
  46. package/dist/assets/Workflows-BLXlNIxO.js +1 -0
  47. package/dist/assets/bqQueueOperationsRepository-BXoBdFQc.js +1 -0
  48. package/dist/assets/exportFile-B6puuPQx.js +2 -0
  49. package/dist/assets/index-D7iDxOBp.css +1 -0
  50. package/dist/assets/index-DwsYIYdu.js +8 -0
  51. package/dist/assets/{install-hFu5e6YM.js → install-DVeS3d31.js} +2 -2
  52. package/dist/assets/{package-Bb3FkjoS.js → package-D11d0FBn.js} +1 -1
  53. package/dist/assets/targetClient-DvzvwnGp.js +1 -0
  54. package/dist/assets/useDiscovery-BbWXsy6R.js +1 -0
  55. package/dist/assets/{useThroughputSeries-BN5QmKPt.js → useThroughputSeries-DQo7JaT-.js} +1 -1
  56. package/dist/favicon.svg +11 -22
  57. package/dist/index.html +3 -2
  58. package/package.json +1 -1
  59. package/scripts/embedded.gen.ts +146 -132
  60. package/dist/assets/AddJob-Dgjlhzn2.js +0 -3
  61. package/dist/assets/Database-CeUKS6Nf.js +0 -3
  62. package/dist/assets/DlqPro-xj-MM6u8.js +0 -1
  63. package/dist/assets/Flows-BFUMTSWv.js +0 -2
  64. package/dist/assets/QueueControl-BiMM0jLp.js +0 -1
  65. package/dist/assets/Workflows-ClF4YzhW.js +0 -1
  66. package/dist/assets/exportFile-C7xhE8Yh.js +0 -2
  67. package/dist/assets/index-DR8flo6r.css +0 -1
  68. package/dist/assets/index-X_fHGbXZ.js +0 -8
@@ -4,142 +4,156 @@ import f0 from "../dist/favicon.svg" with { type: 'file' };
4
4
  import f1 from "../dist/og.png" with { type: 'file' };
5
5
  import f2 from "../dist/.vite/manifest.json" with { type: 'file' };
6
6
  import f3 from "../dist/assets/connectionStore-B946Fhuv.js" with { type: 'file' };
7
- import f4 from "../dist/assets/QueueActions-BQf1-g5m.js" with { type: 'file' };
8
- import f5 from "../dist/assets/classicJobsData-wdIr-E4y.js" with { type: 'file' };
9
- import f6 from "../dist/assets/Workers-Bu8aJlZf.js" with { type: 'file' };
10
- import f7 from "../dist/assets/UsagePro-DtlB1dJc.js" with { type: 'file' };
11
- import f8 from "../dist/assets/package-Bb3FkjoS.js" with { type: 'file' };
12
- import f9 from "../dist/assets/JobsPro-k20Pas24.js" with { type: 'file' };
13
- import f10 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
14
- import f11 from "../dist/assets/Workflows-ClF4YzhW.js" with { type: 'file' };
15
- import f12 from "../dist/assets/rolldown-runtime-XKyaHtl9.js" with { type: 'file' };
16
- import f13 from "../dist/assets/responses-YgpvqWEr.js" with { type: 'file' };
17
- import f14 from "../dist/assets/form-DBkslwzu.js" with { type: 'file' };
18
- import f15 from "../dist/assets/promisePool-BVfQ9n9Q.js" with { type: 'file' };
19
- import f16 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
20
- import f17 from "../dist/assets/index-DR8flo6r.css" with { type: 'file' };
21
- import f18 from "../dist/assets/Logs-DA4JFvpM.js" with { type: 'file' };
22
- import f19 from "../dist/assets/Overview-Cmg_2NAt.js" with { type: 'file' };
23
- import f20 from "../dist/assets/QueueDetailPro-CpSMSo8A.js" with { type: 'file' };
24
- import f21 from "../dist/assets/react-vendor-08inPAVO.js" with { type: 'file' };
25
- import f22 from "../dist/assets/Benchmark-B4NfYkAi.js" with { type: 'file' };
26
- import f23 from "../dist/assets/Dlq-D8s-NhV2.js" with { type: 'file' };
27
- import f24 from "../dist/assets/S3BackupPro-Cr2ZJZkw.js" with { type: 'file' };
28
- import f25 from "../dist/assets/Queues-C5lElTjp.js" with { type: 'file' };
29
- import f26 from "../dist/assets/StatusBadge-D-mexaga.js" with { type: 'file' };
30
- import f27 from "../dist/assets/exportFile-C7xhE8Yh.js" with { type: 'file' };
31
- import f28 from "../dist/assets/WorkersPro-C6gNYGfo.js" with { type: 'file' };
32
- import f29 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
33
- import f30 from "../dist/assets/Fleet-BAziMWfo.js" with { type: 'file' };
34
- import f31 from "../dist/assets/icons-BIT5aq1c.js" with { type: 'file' };
35
- import f32 from "../dist/assets/upstreamPaths-DQeKSxGc.js" with { type: 'file' };
36
- import f33 from "../dist/assets/index-X_fHGbXZ.js" with { type: 'file' };
37
- import f34 from "../dist/assets/S3Backup-DUHmp2Xw.js" with { type: 'file' };
38
- import f35 from "../dist/assets/BulkAddJobs-BAN5wT8A.js" with { type: 'file' };
39
- import f36 from "../dist/assets/AddJob-Dgjlhzn2.js" with { type: 'file' };
40
- import f37 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
41
- import f38 from "../dist/assets/Database-CeUKS6Nf.js" with { type: 'file' };
42
- import f39 from "../dist/assets/Webhooks-B_GwTCBW.js" with { type: 'file' };
43
- import f40 from "../dist/assets/LogsPro-hna5L6sP.js" with { type: 'file' };
44
- import f41 from "../dist/assets/Alerts-Lyzbq0qw.js" with { type: 'file' };
45
- import f42 from "../dist/assets/ServerControl-m58ooJT2.js" with { type: 'file' };
46
- import f43 from "../dist/assets/Metrics-CJ9dW0me.js" with { type: 'file' };
47
- import f44 from "../dist/assets/AreaChart-CSP0-00u.js" with { type: 'file' };
48
- import f45 from "../dist/assets/flowOperationPolicy-B2Etcb3f.js" with { type: 'file' };
49
- import f46 from "../dist/assets/Pagination-WVfHLHDS.js" with { type: 'file' };
50
- import f47 from "../dist/assets/controlConnectionEpoch-x9VjrWgN.js" with { type: 'file' };
51
- import f48 from "../dist/assets/Flows-BFUMTSWv.js" with { type: 'file' };
52
- import f49 from "../dist/assets/flowMutationSafety-YKTHxqKv.js" with { type: 'file' };
53
- import f50 from "../dist/assets/Diagnostics-DuzTPfyb.js" with { type: 'file' };
54
- import f51 from "../dist/assets/McpServer-Cqem-L3z.js" with { type: 'file' };
55
- import f52 from "../dist/assets/useThroughputSeries-BN5QmKPt.js" with { type: 'file' };
56
- import f53 from "../dist/assets/JobInspector-BXuXxDwR.js" with { type: 'file' };
57
- import f54 from "../dist/assets/Cron-Bz46oVXB.js" with { type: 'file' };
58
- import f55 from "../dist/assets/CronManager-Cl5RW2cB.js" with { type: 'file' };
59
- import f56 from "../dist/assets/QueueControl-BiMM0jLp.js" with { type: 'file' };
60
- import f57 from "../dist/assets/QueuesOverview-DRohFtuC.js" with { type: 'file' };
61
- import f58 from "../dist/assets/useServerActionGuard-uiZWD3dS.js" with { type: 'file' };
62
- import f59 from "../dist/assets/install-hFu5e6YM.js" with { type: 'file' };
63
- import f60 from "../dist/assets/DlqPro-xj-MM6u8.js" with { type: 'file' };
64
- import f61 from "../dist/assets/DlqControl-DDxRMM8i.js" with { type: 'file' };
65
- import f62 from "../dist/assets/QueueDetail-DfRY4jS4.js" with { type: 'file' };
66
- import f63 from "../dist/assets/Usage-CY2uEJEu.js" with { type: 'file' };
67
- import f64 from "../dist/assets/api-CCgfskjt.js" with { type: 'file' };
68
- import f65 from "../dist/assets/useControlActionGuard-Bx5MkufG.js" with { type: 'file' };
69
- import f66 from "../dist/assets/Jobs-pQBmffni.js" with { type: 'file' };
70
- import f67 from "../dist/assets/MetricsPro-BslYrx1A.js" with { type: 'file' };
71
- import f68 from "../dist/assets/Settings-DXsjoOqD.js" with { type: 'file' };
72
- import f69 from "../dist/index.html" with { type: 'file' };
7
+ import f4 from "../dist/assets/Dlq-CPxeigKg.js" with { type: 'file' };
8
+ import f5 from "../dist/assets/index-DwsYIYdu.js" with { type: 'file' };
9
+ import f6 from "../dist/assets/classicJobsData-wdIr-E4y.js" with { type: 'file' };
10
+ import f7 from "../dist/assets/BulkAddJobs-C2sxF-St.js" with { type: 'file' };
11
+ import f8 from "../dist/assets/index-D7iDxOBp.css" with { type: 'file' };
12
+ import f9 from "../dist/assets/Overview-DBLxV_vL.js" with { type: 'file' };
13
+ import f10 from "../dist/assets/bqQueueOperationsRepository-BXoBdFQc.js" with { type: 'file' };
14
+ import f11 from "../dist/assets/Pagination-CmVnmrFt.js" with { type: 'file' };
15
+ import f12 from "../dist/assets/Settings-Dwh79r-B.js" with { type: 'file' };
16
+ import f13 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
17
+ import f14 from "../dist/assets/S3BackupPro-BUzcmhnj.js" with { type: 'file' };
18
+ import f15 from "../dist/assets/targetClient-DvzvwnGp.js" with { type: 'file' };
19
+ import f16 from "../dist/assets/rolldown-runtime-XKyaHtl9.js" with { type: 'file' };
20
+ import f17 from "../dist/assets/responses-YgpvqWEr.js" with { type: 'file' };
21
+ import f18 from "../dist/assets/Flows-Bzq3onQ3.js" with { type: 'file' };
22
+ import f19 from "../dist/assets/form-DBkslwzu.js" with { type: 'file' };
23
+ import f20 from "../dist/assets/promisePool-BVfQ9n9Q.js" with { type: 'file' };
24
+ import f21 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
25
+ import f22 from "../dist/assets/JobsPro-CSHP2AYC.js" with { type: 'file' };
26
+ import f23 from "../dist/assets/Logs-CiYuY8ix.js" with { type: 'file' };
27
+ import f24 from "../dist/assets/MetricsPro-DHPmT4Md.js" with { type: 'file' };
28
+ import f25 from "../dist/assets/react-vendor-08inPAVO.js" with { type: 'file' };
29
+ import f26 from "../dist/assets/Cron-BY9EGj2n.js" with { type: 'file' };
30
+ import f27 from "../dist/assets/McpServer-BvOGxNnE.js" with { type: 'file' };
31
+ import f28 from "../dist/assets/StatusBadge-D-mexaga.js" with { type: 'file' };
32
+ import f29 from "../dist/assets/Jobs-OwKndzhg.js" with { type: 'file' };
33
+ import f30 from "../dist/assets/WorkersPro-BJgab7of.js" with { type: 'file' };
34
+ import f31 from "../dist/assets/Fleet-CsscadVQ.js" with { type: 'file' };
35
+ import f32 from "../dist/assets/ServerControl-WUZjdjPX.js" with { type: 'file' };
36
+ import f33 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
37
+ import f34 from "../dist/assets/Workers-DyAVvmbR.js" with { type: 'file' };
38
+ import f35 from "../dist/assets/Metrics-BF38GgYm.js" with { type: 'file' };
39
+ import f36 from "../dist/assets/install-DVeS3d31.js" with { type: 'file' };
40
+ import f37 from "../dist/assets/icons-BIT5aq1c.js" with { type: 'file' };
41
+ import f38 from "../dist/assets/Webhooks-DS3xmbEi.js" with { type: 'file' };
42
+ import f39 from "../dist/assets/QueueActions-uNol2MD7.js" with { type: 'file' };
43
+ import f40 from "../dist/assets/exportFile-B6puuPQx.js" with { type: 'file' };
44
+ import f41 from "../dist/assets/upstreamPaths-DQeKSxGc.js" with { type: 'file' };
45
+ import f42 from "../dist/assets/DlqControl-Dhcz7LY7.js" with { type: 'file' };
46
+ import f43 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
47
+ import f44 from "../dist/assets/AddJob-jmrtBSrz.js" with { type: 'file' };
48
+ import f45 from "../dist/assets/MetricHistory-Dmu-XqaO.js" with { type: 'file' };
49
+ import f46 from "../dist/assets/LogsPro-BA-wZ8Dr.js" with { type: 'file' };
50
+ import f47 from "../dist/assets/MonitoringSetup-60_ib3rf.js" with { type: 'file' };
51
+ import f48 from "../dist/assets/useThroughputSeries-DQo7JaT-.js" with { type: 'file' };
52
+ import f49 from "../dist/assets/QueueDetailPro-AUf6FktH.js" with { type: 'file' };
53
+ import f50 from "../dist/assets/useDiscovery-BbWXsy6R.js" with { type: 'file' };
54
+ import f51 from "../dist/assets/Diagnostics-D1LEl6O4.js" with { type: 'file' };
55
+ import f52 from "../dist/assets/package-D11d0FBn.js" with { type: 'file' };
56
+ import f53 from "../dist/assets/QueuesOverview-DQ6ta4wA.js" with { type: 'file' };
57
+ import f54 from "../dist/assets/AreaChart-CSP0-00u.js" with { type: 'file' };
58
+ import f55 from "../dist/assets/flowOperationPolicy-B2Etcb3f.js" with { type: 'file' };
59
+ import f56 from "../dist/assets/controlConnectionEpoch-x9VjrWgN.js" with { type: 'file' };
60
+ import f57 from "../dist/assets/QueueControl-DbQwvvtX.js" with { type: 'file' };
61
+ import f58 from "../dist/assets/Benchmark-7ULYlqmK.js" with { type: 'file' };
62
+ import f59 from "../dist/assets/flowMutationSafety-YKTHxqKv.js" with { type: 'file' };
63
+ import f60 from "../dist/assets/FailureDiagnostics-DkLd6szC.js" with { type: 'file' };
64
+ import f61 from "../dist/assets/Database-B1Dx5OV2.js" with { type: 'file' };
65
+ import f62 from "../dist/assets/Alerts-DrwYvhbk.js" with { type: 'file' };
66
+ import f63 from "../dist/assets/DlqPro-CW80tQdN.js" with { type: 'file' };
67
+ import f64 from "../dist/assets/Usage-DeWofLpa.js" with { type: 'file' };
68
+ import f65 from "../dist/assets/S3Backup-BgPBXJVZ.js" with { type: 'file' };
69
+ import f66 from "../dist/assets/CronManager-CZvC_uox.js" with { type: 'file' };
70
+ import f67 from "../dist/assets/UsagePro-BQJWWwW3.js" with { type: 'file' };
71
+ import f68 from "../dist/assets/JobInspector-nTUU1VOU.js" with { type: 'file' };
72
+ import f69 from "../dist/assets/useServerActionGuard-uiZWD3dS.js" with { type: 'file' };
73
+ import f70 from "../dist/assets/Workflows-BLXlNIxO.js" with { type: 'file' };
74
+ import f71 from "../dist/assets/api-CCgfskjt.js" with { type: 'file' };
75
+ import f72 from "../dist/assets/useControlActionGuard-Bx5MkufG.js" with { type: 'file' };
76
+ import f73 from "../dist/assets/GlobalSearch-CeCvA6Tm.js" with { type: 'file' };
77
+ import f74 from "../dist/assets/Queues-C_KeSyQs.js" with { type: 'file' };
78
+ import f75 from "../dist/assets/QueueDetail-CA33Kebs.js" with { type: 'file' };
79
+ import f76 from "../dist/index.html" with { type: 'file' };
73
80
 
74
81
  export const ASSETS: Record<string, string> = {
75
82
  "/favicon.svg": f0,
76
83
  "/og.png": f1,
77
84
  "/.vite/manifest.json": f2,
78
85
  "/assets/connectionStore-B946Fhuv.js": f3,
79
- "/assets/QueueActions-BQf1-g5m.js": f4,
80
- "/assets/classicJobsData-wdIr-E4y.js": f5,
81
- "/assets/Workers-Bu8aJlZf.js": f6,
82
- "/assets/UsagePro-DtlB1dJc.js": f7,
83
- "/assets/package-Bb3FkjoS.js": f8,
84
- "/assets/JobsPro-k20Pas24.js": f9,
85
- "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f10,
86
- "/assets/Workflows-ClF4YzhW.js": f11,
87
- "/assets/rolldown-runtime-XKyaHtl9.js": f12,
88
- "/assets/responses-YgpvqWEr.js": f13,
89
- "/assets/form-DBkslwzu.js": f14,
90
- "/assets/promisePool-BVfQ9n9Q.js": f15,
91
- "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f16,
92
- "/assets/index-DR8flo6r.css": f17,
93
- "/assets/Logs-DA4JFvpM.js": f18,
94
- "/assets/Overview-Cmg_2NAt.js": f19,
95
- "/assets/QueueDetailPro-CpSMSo8A.js": f20,
96
- "/assets/react-vendor-08inPAVO.js": f21,
97
- "/assets/Benchmark-B4NfYkAi.js": f22,
98
- "/assets/Dlq-D8s-NhV2.js": f23,
99
- "/assets/S3BackupPro-Cr2ZJZkw.js": f24,
100
- "/assets/Queues-C5lElTjp.js": f25,
101
- "/assets/StatusBadge-D-mexaga.js": f26,
102
- "/assets/exportFile-C7xhE8Yh.js": f27,
103
- "/assets/WorkersPro-C6gNYGfo.js": f28,
104
- "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f29,
105
- "/assets/Fleet-BAziMWfo.js": f30,
106
- "/assets/icons-BIT5aq1c.js": f31,
107
- "/assets/upstreamPaths-DQeKSxGc.js": f32,
108
- "/assets/index-X_fHGbXZ.js": f33,
109
- "/assets/S3Backup-DUHmp2Xw.js": f34,
110
- "/assets/BulkAddJobs-BAN5wT8A.js": f35,
111
- "/assets/AddJob-Dgjlhzn2.js": f36,
112
- "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f37,
113
- "/assets/Database-CeUKS6Nf.js": f38,
114
- "/assets/Webhooks-B_GwTCBW.js": f39,
115
- "/assets/LogsPro-hna5L6sP.js": f40,
116
- "/assets/Alerts-Lyzbq0qw.js": f41,
117
- "/assets/ServerControl-m58ooJT2.js": f42,
118
- "/assets/Metrics-CJ9dW0me.js": f43,
119
- "/assets/AreaChart-CSP0-00u.js": f44,
120
- "/assets/flowOperationPolicy-B2Etcb3f.js": f45,
121
- "/assets/Pagination-WVfHLHDS.js": f46,
122
- "/assets/controlConnectionEpoch-x9VjrWgN.js": f47,
123
- "/assets/Flows-BFUMTSWv.js": f48,
124
- "/assets/flowMutationSafety-YKTHxqKv.js": f49,
125
- "/assets/Diagnostics-DuzTPfyb.js": f50,
126
- "/assets/McpServer-Cqem-L3z.js": f51,
127
- "/assets/useThroughputSeries-BN5QmKPt.js": f52,
128
- "/assets/JobInspector-BXuXxDwR.js": f53,
129
- "/assets/Cron-Bz46oVXB.js": f54,
130
- "/assets/CronManager-Cl5RW2cB.js": f55,
131
- "/assets/QueueControl-BiMM0jLp.js": f56,
132
- "/assets/QueuesOverview-DRohFtuC.js": f57,
133
- "/assets/useServerActionGuard-uiZWD3dS.js": f58,
134
- "/assets/install-hFu5e6YM.js": f59,
135
- "/assets/DlqPro-xj-MM6u8.js": f60,
136
- "/assets/DlqControl-DDxRMM8i.js": f61,
137
- "/assets/QueueDetail-DfRY4jS4.js": f62,
138
- "/assets/Usage-CY2uEJEu.js": f63,
139
- "/assets/api-CCgfskjt.js": f64,
140
- "/assets/useControlActionGuard-Bx5MkufG.js": f65,
141
- "/assets/Jobs-pQBmffni.js": f66,
142
- "/assets/MetricsPro-BslYrx1A.js": f67,
143
- "/assets/Settings-DXsjoOqD.js": f68,
144
- "/index.html": f69,
86
+ "/assets/Dlq-CPxeigKg.js": f4,
87
+ "/assets/index-DwsYIYdu.js": f5,
88
+ "/assets/classicJobsData-wdIr-E4y.js": f6,
89
+ "/assets/BulkAddJobs-C2sxF-St.js": f7,
90
+ "/assets/index-D7iDxOBp.css": f8,
91
+ "/assets/Overview-DBLxV_vL.js": f9,
92
+ "/assets/bqQueueOperationsRepository-BXoBdFQc.js": f10,
93
+ "/assets/Pagination-CmVnmrFt.js": f11,
94
+ "/assets/Settings-Dwh79r-B.js": f12,
95
+ "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f13,
96
+ "/assets/S3BackupPro-BUzcmhnj.js": f14,
97
+ "/assets/targetClient-DvzvwnGp.js": f15,
98
+ "/assets/rolldown-runtime-XKyaHtl9.js": f16,
99
+ "/assets/responses-YgpvqWEr.js": f17,
100
+ "/assets/Flows-Bzq3onQ3.js": f18,
101
+ "/assets/form-DBkslwzu.js": f19,
102
+ "/assets/promisePool-BVfQ9n9Q.js": f20,
103
+ "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f21,
104
+ "/assets/JobsPro-CSHP2AYC.js": f22,
105
+ "/assets/Logs-CiYuY8ix.js": f23,
106
+ "/assets/MetricsPro-DHPmT4Md.js": f24,
107
+ "/assets/react-vendor-08inPAVO.js": f25,
108
+ "/assets/Cron-BY9EGj2n.js": f26,
109
+ "/assets/McpServer-BvOGxNnE.js": f27,
110
+ "/assets/StatusBadge-D-mexaga.js": f28,
111
+ "/assets/Jobs-OwKndzhg.js": f29,
112
+ "/assets/WorkersPro-BJgab7of.js": f30,
113
+ "/assets/Fleet-CsscadVQ.js": f31,
114
+ "/assets/ServerControl-WUZjdjPX.js": f32,
115
+ "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f33,
116
+ "/assets/Workers-DyAVvmbR.js": f34,
117
+ "/assets/Metrics-BF38GgYm.js": f35,
118
+ "/assets/install-DVeS3d31.js": f36,
119
+ "/assets/icons-BIT5aq1c.js": f37,
120
+ "/assets/Webhooks-DS3xmbEi.js": f38,
121
+ "/assets/QueueActions-uNol2MD7.js": f39,
122
+ "/assets/exportFile-B6puuPQx.js": f40,
123
+ "/assets/upstreamPaths-DQeKSxGc.js": f41,
124
+ "/assets/DlqControl-Dhcz7LY7.js": f42,
125
+ "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f43,
126
+ "/assets/AddJob-jmrtBSrz.js": f44,
127
+ "/assets/MetricHistory-Dmu-XqaO.js": f45,
128
+ "/assets/LogsPro-BA-wZ8Dr.js": f46,
129
+ "/assets/MonitoringSetup-60_ib3rf.js": f47,
130
+ "/assets/useThroughputSeries-DQo7JaT-.js": f48,
131
+ "/assets/QueueDetailPro-AUf6FktH.js": f49,
132
+ "/assets/useDiscovery-BbWXsy6R.js": f50,
133
+ "/assets/Diagnostics-D1LEl6O4.js": f51,
134
+ "/assets/package-D11d0FBn.js": f52,
135
+ "/assets/QueuesOverview-DQ6ta4wA.js": f53,
136
+ "/assets/AreaChart-CSP0-00u.js": f54,
137
+ "/assets/flowOperationPolicy-B2Etcb3f.js": f55,
138
+ "/assets/controlConnectionEpoch-x9VjrWgN.js": f56,
139
+ "/assets/QueueControl-DbQwvvtX.js": f57,
140
+ "/assets/Benchmark-7ULYlqmK.js": f58,
141
+ "/assets/flowMutationSafety-YKTHxqKv.js": f59,
142
+ "/assets/FailureDiagnostics-DkLd6szC.js": f60,
143
+ "/assets/Database-B1Dx5OV2.js": f61,
144
+ "/assets/Alerts-DrwYvhbk.js": f62,
145
+ "/assets/DlqPro-CW80tQdN.js": f63,
146
+ "/assets/Usage-DeWofLpa.js": f64,
147
+ "/assets/S3Backup-BgPBXJVZ.js": f65,
148
+ "/assets/CronManager-CZvC_uox.js": f66,
149
+ "/assets/UsagePro-BQJWWwW3.js": f67,
150
+ "/assets/JobInspector-nTUU1VOU.js": f68,
151
+ "/assets/useServerActionGuard-uiZWD3dS.js": f69,
152
+ "/assets/Workflows-BLXlNIxO.js": f70,
153
+ "/assets/api-CCgfskjt.js": f71,
154
+ "/assets/useControlActionGuard-Bx5MkufG.js": f72,
155
+ "/assets/GlobalSearch-CeCvA6Tm.js": f73,
156
+ "/assets/Queues-C_KeSyQs.js": f74,
157
+ "/assets/QueueDetail-CA33Kebs.js": f75,
158
+ "/index.html": f76,
145
159
  };
@@ -1,3 +0,0 @@
1
- import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{h as n,l as r,r as i,t as a}from"./react-vendor-08inPAVO.js";import{i as o}from"./upstreamPaths-DQeKSxGc.js";import{C as s,F as c,I as l,O as u,R as d,S as f,g as p,x as m}from"./index-X_fHGbXZ.js";import{a as h,n as g,o as _,t as v}from"./form-DBkslwzu.js";import{r as y}from"./useServerActionGuard-uiZWD3dS.js";import{a as b,c as x,d as S,f as C,h as w,i as T,l as E,m as D,n as O,o as k,r as A,s as j,t as M,u as N}from"./responses-YgpvqWEr.js";var P=t(n(),1),F=a();function I({values:e,setValue:t,queueNames:n,queueDiscoveryError:r,onRetryQueues:i,jsonError:a,setJsonError:o}){return(0,F.jsxs)(m,{children:[(0,F.jsx)(f,{title:`Job`}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsxs)(v,{label:`Queue`,children:[(0,F.jsx)(g,{list:`queue-options`,"aria-label":`Queue`,name:`target-queue`,autoComplete:`off`,value:e.queue,onChange:e=>t(`queue`,e.target.value),placeholder:`queue name (existing or new)`}),(0,F.jsx)(`datalist`,{id:`queue-options`,children:n.map(e=>(0,F.jsx)(`option`,{value:e},e))})]}),(0,F.jsx)(v,{label:`Job name`,hint:`Worker routing name in Bunqueue 2.9.3; separate from the JSON payload.`,children:(0,F.jsx)(g,{name:`job-name`,autoComplete:`off`,maxLength:256,value:e.name,onChange:e=>t(`name`,e.target.value),placeholder:`default`})}),r&&(0,F.jsxs)(`p`,{role:`status`,className:`-mt-2 text-xs text-warning`,children:[`Existing queue suggestions unavailable — `,r.message,`. You can still enter a queue name manually.`,` `,(0,F.jsx)(`button`,{type:`button`,onClick:i,className:`font-medium underline underline-offset-2 hover:text-fg`,children:`Retry`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(v,{label:`Data (JSON)`,children:(0,F.jsx)(`textarea`,{name:`job-data`,value:e.dataText,onChange:e=>t(`dataText`,e.target.value),onBlur:()=>{let t=w(e.dataText);o(t.ok?null:t.msg)},maxLength:D,spellCheck:!1,rows:7,className:`w-full rounded-lg border border-line bg-surface-2 p-3 font-mono text-sm text-fg focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})}),a&&(0,F.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:a})]})]})]})}function L({values:e,setValue:t}){return(0,F.jsxs)(m,{children:[(0,F.jsx)(f,{title:`Options`}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3`,children:[(0,F.jsx)(B,{label:e.groupId.trim()?`Group priority`:`Priority`,hint:e.groupId.trim()?`0 is highest within this group`:void 0,name:`priority`,value:e.priority,min:e.groupId.trim()?0:-1e6,max:e.groupId.trim()?k:1e6,placeholder:`0`,onChange:e=>t(`priority`,e)}),(0,F.jsx)(B,{label:`Delay (ms)`,name:`delay`,value:e.delay,min:0,max:T,placeholder:`0`,disabled:e.runAt.trim()!==``,onChange:e=>t(`delay`,e)}),(0,F.jsx)(v,{label:`Run at`,hint:e.runAt.trim()?`Overrides Delay — derived from this time (local time).`:`(local time)`,children:(0,F.jsx)(g,{type:`datetime-local`,name:`run-at`,value:e.runAt,onChange:e=>t(`runAt`,e.target.value)})}),(0,F.jsx)(B,{label:`Max attempts`,hint:`blank = server default`,name:`max-attempts`,value:e.maxAttempts,min:1,max:1e3,placeholder:`3`,onChange:e=>t(`maxAttempts`,e)}),(0,F.jsx)(B,{label:`Backoff (ms)`,hint:`blank = server default`,name:`backoff`,value:e.backoff,min:0,max:b,placeholder:`1000`,onChange:e=>t(`backoff`,e)}),(0,F.jsx)(v,{label:`Backoff strategy`,hint:`flat delay unless set`,children:(0,F.jsxs)(h,{name:`backoff-strategy`,value:e.backoffType,onChange:e=>t(`backoffType`,e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:`flat`}),(0,F.jsx)(`option`,{value:`fixed`,children:`fixed`}),(0,F.jsx)(`option`,{value:`exponential`,children:`exponential`})]})}),(0,F.jsx)(B,{label:`Timeout (ms)`,name:`timeout`,value:e.timeout,min:0,max:b,placeholder:`—`,onChange:e=>t(`timeout`,e)}),(0,F.jsx)(B,{label:`TTL (ms)`,hint:`blank = no expiry`,name:`ttl`,value:e.ttl,min:0,max:T,placeholder:`—`,onChange:e=>t(`ttl`,e)}),(0,F.jsx)(v,{label:`Custom job ID`,children:(0,F.jsx)(g,{name:`custom-job-id`,value:e.jobId,onChange:e=>t(`jobId`,e.target.value),placeholder:`idempotency key`})})]}),(0,F.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-6`,children:[(0,F.jsx)(V,{label:`removeOnComplete`,checked:e.removeOnComplete,onChange:e=>t(`removeOnComplete`,e)}),(0,F.jsx)(V,{label:`removeOnFail`,checked:e.removeOnFail,onChange:e=>t(`removeOnFail`,e)}),(0,F.jsx)(V,{label:`durable`,checked:e.durable,onChange:e=>t(`durable`,e)}),(0,F.jsx)(V,{label:`lifo`,checked:e.lifo,onChange:e=>t(`lifo`,e)})]}),(0,F.jsx)(R,{values:e,setValue:t})]})}function R({values:e,setValue:t}){return(0,F.jsxs)(`div`,{className:`mt-4 border-t border-line pt-4`,children:[(0,F.jsx)(`div`,{className:`mb-3 text-[11px] uppercase tracking-wider text-faint`,children:`Advanced`}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3`,children:[(0,F.jsx)(z,{label:`Tags`,hint:`comma-separated`,name:`tags`,value:e.tags,placeholder:`email, urgent`,onChange:e=>t(`tags`,e)}),(0,F.jsx)(z,{label:`Group ID`,name:`group-id`,value:e.groupId,placeholder:`—`,onChange:e=>t(`groupId`,e)}),(0,F.jsx)(B,{label:`Group max size`,hint:`Atomic pending-job cap (2.9.3)`,name:`group-max-size`,value:e.groupMaxSize,min:1,max:2**53-1,placeholder:`—`,onChange:e=>t(`groupMaxSize`,e)}),(0,F.jsx)(z,{label:`Unique key`,hint:`dedup key`,name:`unique-key`,value:e.uniqueKey,placeholder:`—`,onChange:e=>t(`uniqueKey`,e)}),(0,F.jsx)(z,{label:`Depends on`,hint:`parent job ids, comma-separated`,name:`depends-on`,value:e.dependsOn,placeholder:`job-id-1, job-id-2`,onChange:e=>t(`dependsOn`,e)}),(0,F.jsx)(`div`,{className:`col-span-2 md:col-span-3`,children:(0,F.jsx)(v,{label:`Repeat policy (JSON)`,hint:`v2.9.3-safe form: e.g. {"every":60000,"limit":10}. Use Cron Manager for cron patterns.`,children:(0,F.jsx)(`textarea`,{name:`repeat-policy`,value:e.repeatText,onChange:e=>t(`repeatText`,e.target.value),rows:2,spellCheck:!1,placeholder:`{"every": 60000}`,className:`w-full rounded-lg border border-line bg-surface-2 px-3 py-2 font-mono text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})})})]})]})}function z({label:e,hint:t,name:n,value:r,placeholder:i,onChange:a}){return(0,F.jsx)(v,{label:e,hint:t,children:(0,F.jsx)(g,{name:n,value:r,onChange:e=>a(e.target.value),placeholder:i})})}function B({label:e,hint:t,name:n,value:r,min:i,max:a,placeholder:o,disabled:s,onChange:c}){return(0,F.jsx)(v,{label:e,hint:t,children:(0,F.jsx)(g,{type:`number`,min:i,max:a,step:1,name:n,value:r,onChange:e=>c(e.target.value),placeholder:o,disabled:s})})}function V({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(_,{checked:t,onChange:n,label:e}),(0,F.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:e})]})}function H(e){let t=e?.options??{},n=j(t);return{queue:e?.queue??``,name:e?.name??`default`,dataText:e?.dataText??`{
2
- "hello": "world"
3
- }`,count:`1`,priority:x(t.priority),delay:``,runAt:``,maxAttempts:x(t.maxAttempts),backoff:n.backoff,timeout:x(t.timeout),ttl:n.ttl,jobId:``,removeOnComplete:t.removeOnComplete??!1,removeOnFail:t.removeOnFail??!1,durable:!1,lifo:!1,backoffType:n.backoffType,tags:n.tags,groupId:n.groupId,groupMaxSize:``,dependsOn:``,uniqueKey:``,repeatText:``}}function U(e,t=Date.now()){let n=e.queue.trim(),r=S(n);if(r)return W(r);let i=e.name.trim();if(!i||i.length>256)return W(`Job name must be a non-empty string of at most 256 characters`);let a=w(e.dataText);if(!a.ok)return{ok:!1,msg:a.msg,field:a.kind===`json`?`data`:`result`};let s=e.groupId.trim();if(s.length>256||s.includes(`\0`))return W(`Group ID must contain 1–256 characters and no NUL`);let c=E({priority:e.priority,delay:e.runAt.trim()?``:e.delay,maxAttempts:e.maxAttempts,backoff:e.backoff,timeout:e.timeout,ttl:e.ttl,groupMaxSize:e.groupMaxSize},!!s);if(!c.ok)return W(c.msg);if(c.options.groupMaxSize!==void 0&&!s)return W(`Group max size requires a Group ID`);let l=c.options.delay;if(e.runAt.trim()){let n=new Date(e.runAt).getTime();if(!Number.isFinite(n))return W(`Run at is not a valid date/time`);if(l=Math.max(0,n-t),l>31536e6)return W(`Run at must be within the next 365 days`)}let u=C(c.options.backoff,e.backoffType);if(!u.ok)return W(u.msg);let d=G(e.tags),f=G(e.dependsOn),p=e.jobId.trim();if(p){let e=o(p);if(e)return W(`Job ID: ${e}`)}for(let e of f){let t=o(e);if(t)return W(`Dependency ID "${e}": ${t}`)}let m=N(e.repeatText);if(!m.ok)return W(m.msg);let h=Number(e.count);return!Number.isSafeInteger(h)||h<1||h>1e4?W(`Count must be a whole number from 1 to 10000`):{ok:!0,target:n,count:h,body:{name:i,data:a.data,priority:c.options.priority,delay:l,maxAttempts:c.options.maxAttempts,backoff:u.backoff,timeout:c.options.timeout,ttl:c.options.ttl,jobId:p||void 0,removeOnComplete:e.removeOnComplete||void 0,removeOnFail:e.removeOnFail||void 0,durable:e.durable||void 0,lifo:e.lifo||void 0,tags:d.length?d:void 0,groupId:s||void 0,groupMaxSize:c.options.groupMaxSize,dependsOn:f.length?f:void 0,uniqueKey:e.uniqueKey.trim()||void 0,repeat:m.repeat}}}var W=e=>({ok:!1,msg:e,field:`result`}),G=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),K=e({AddJob:()=>q,MAX_JOB_DATA_BYTES:()=>MAX_JOB_DATA_BYTES,MAX_JOB_DATA_CHARS:()=>D});function q(){let{data:e,error:t,refetch:n}=u(()=>l.queues(),[],{intervalMs:3e4}),a=r().state?.clone,[o,f]=(0,P.useState)(()=>H(a)),[m,h]=(0,P.useState)(!1),[_,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(null),C=y(`add-job`),w=(e,t)=>f(n=>({...n,[e]:t}));(0,P.useEffect)(()=>{h(!1),b(null),S(null)},[C.scopeKey]);let T=async()=>{b(null),S(null);let e=U(o);if(!e.ok){e.field===`data`?S(e.msg):b({ok:!1,msg:e.msg});return}let t=C.begin();if(!t)return;h(!0);let{target:n,body:r,count:i}=e;try{if(i===1&&r.groupMaxSize===void 0){let e=await l.addJob(n,r),i=O(e);if(!t.isCurrent())return;b({ok:!0,msg:`Accepted job ID ${i} (it may be an existing deduplicated job)`}),c.success(`Job submission accepted`,`${n} · ${i}`)}else{let e=Array.from({length:i},()=>r),a=d(e);if(a){t.isCurrent()&&b({ok:!1,msg:a});return}let o=await l.addJobsBulk(n,e),s=M(o,i);if(!t.isCurrent())return;let u=A(new Set(s).size,i);b(u),c.success(u.msg,`in ${n}`)}}catch(e){if(!t.isCurrent())return;b({ok:!1,msg:e.message}),c.error(`Add job failed`,e.message)}finally{t.finish()&&h(!1)}};return(0,F.jsxs)(`div`,{children:[(0,F.jsx)(p,{title:`Add Job`,description:`Enqueue a job with full options.`,actions:(0,F.jsx)(i,{to:`/jobs/bulk-add`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Bulk import`})}),a&&(0,F.jsx)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-accent/30 bg-accent/[0.06] px-4 py-2 text-sm text-accent`,children:`Pre-filled from an existing job. Review the data and options, then enqueue a fresh job.`}),(0,F.jsxs)(`form`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,onSubmit:e=>{e.preventDefault(),T()},children:[(0,F.jsx)(I,{values:o,setValue:w,queueNames:(e?.queues??[]).map(e=>e.name),queueDiscoveryError:t,onRetryQueues:()=>void n(),jsonError:x,setJsonError:S}),(0,F.jsx)(L,{values:o,setValue:w}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3 lg:col-span-2`,children:[(0,F.jsx)(`div`,{className:`w-28`,children:(0,F.jsx)(v,{label:`Count`,hint:`1–10000`,children:(0,F.jsx)(g,{type:`number`,min:1,max:1e4,step:1,name:`count`,value:o.count,onChange:e=>w(`count`,e.target.value)})})}),(0,F.jsx)(s,{type:`submit`,variant:`accent`,disabled:m,children:m?`Adding…`:`Add job`}),_&&(0,F.jsx)(`span`,{role:_.ok?`status`:`alert`,className:_.ok?`text-sm text-success`:`text-sm text-danger`,children:_.msg})]})]})]})}export{K as t};
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{h as t,m as n,t as r}from"./react-vendor-08inPAVO.js";import{o as i}from"./connectionStore-B946Fhuv.js";import{T as a,o}from"./icons-BIT5aq1c.js";import{r as s}from"./StatusBadge-D-mexaga.js";import{A as c,B as l,C as u,E as d,F as f,I as p,O as m,S as h,_ as g,b as _,g as v,h as y,i as b,j as x,l as S,v as C,x as w,y as T,z as E}from"./index-X_fHGbXZ.js";import{a as D}from"./form-DBkslwzu.js";import{t as ee}from"./Pagination-WVfHLHDS.js";var O=e(n(),1),k=e(t(),1),A=r();function j({columns:e,filter:t,onChange:n}){let[r,i]=(0,k.useState)(t?.column??``),[o,s]=(0,k.useState)(t?.op??`contains`),[c,l]=(0,k.useState)(t?.value??``),d=r||e[0]||``,f=()=>n(c.trim()?{column:d,op:o,value:c.trim()}:null);return e.length===0?null:(0,A.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`div`,{className:`w-40`,children:(0,A.jsx)(D,{value:d,"aria-label":`Filter column`,name:`database-filter-column`,autoComplete:`off`,onChange:e=>i(e.target.value),children:e.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))})}),(0,A.jsx)(`div`,{className:`w-32`,children:(0,A.jsxs)(D,{value:o,"aria-label":`Filter operator`,name:`database-filter-operator`,autoComplete:`off`,onChange:e=>s(e.target.value),children:[(0,A.jsx)(`option`,{value:`contains`,children:`contains`}),(0,A.jsx)(`option`,{value:`eq`,children:`=`}),(0,A.jsx)(`option`,{value:`ne`,children:`≠`})]})}),(0,A.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,A.jsx)(a,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),(0,A.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&f(),"aria-label":`Filter value`,name:`database-filter-value`,autoComplete:`off`,placeholder:`value — Enter to filter`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-8 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,A.jsx)(u,{size:`sm`,onClick:f,disabled:!c.trim(),children:`Filter`}),t&&(0,A.jsx)(u,{size:`sm`,variant:`ghost`,onClick:()=>{l(``),n(null)},children:`Clear`}),(0,A.jsx)(`span`,{className:`text-[11px] text-faint`,children:`filters the whole table, server-side`})]})}var M=`bq-dash-db-history`,N=10,te=2e4,P=100;function F(e){let t=e==null?``:String(e),n=typeof e==`string`&&/^[=+\-@\t\r]/.test(e)?`'${e}`:t;return/[",\r\n]/.test(n)?`"${n.replaceAll(`"`,`""`)}"`:n}function I(e,t){return[e.map(F).join(`,`),...t.map(e=>e.map(F).join(`,`))].join(`
2
- `)}function L(e,t,n){let r=URL.createObjectURL(new Blob([n],{type:t})),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),0)}function R(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e.slice(0,P))if(!(typeof r!=`string`||r.length===0||r.length>te||n.has(r))&&(n.add(r),t.push(r),t.length===N))break;return t}function z(){try{return R(JSON.parse(localStorage.getItem(M)??`[]`))}catch{return[]}}function B(e){let t=R(e);try{localStorage.setItem(M,JSON.stringify(t))}catch{}return t}function V(e){return B([e,...z().filter(t=>t!==e)].slice(0,N))}function H(e){if(e==null)return`NULL`;let t=typeof e==`string`?e:String(e),n=t.trimStart();if(n.startsWith(`{`)||n.startsWith(`[`))try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return t}async function U(e,t=p.captureAgentRequestTarget(),n){let r=Object.freeze({table:e.table,orderBy:e.orderBy,dir:e.dir,filter:e.filter?Object.freeze({...e.filter}):void 0});return p.getDbExportAtTarget(t,r,n)}var W=e=>JSON.stringify([e.activeProfileId,e.baseUrl,e.agentBaseUrl,e.token,e.agentToken]);function G({value:e,align:t}){if(e==null)return(0,A.jsx)(`span`,{className:`italic text-faint`,children:`NULL`});let n=typeof e==`string`?e:String(e);return(0,A.jsx)(`span`,{className:s(`block max-w-[24rem] truncate`,t===`right`&&`text-right tabular-nums`),title:n,children:n})}function K({columns:e,rows:t,truncatedCells:n,colMeta:r,sort:i,onSort:a,onRowClick:o,dimmed:c}){let l=(0,k.useMemo)(()=>e.map((e,n)=>{let i=r?.[e]?.type?.toUpperCase()??``;if(/INT|REAL|NUM|DEC|DOUB|FLOA/.test(i))return!0;let a=!1;for(let e of t){let t=e[n];if(t!=null&&(a=!0,typeof t!=`number`))return!1}return a}),[e,t,r]);return(0,A.jsx)(`div`,{className:s(`max-h-[70vh] overflow-auto rounded-xl border border-line bg-surface transition-opacity`,c&&`pointer-events-none opacity-50`),children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`text-left text-[11px] uppercase tracking-wider text-faint`,children:[o&&(0,A.jsx)(`th`,{className:`sticky top-0 z-10 whitespace-nowrap border-b border-line bg-surface px-4 py-3 font-medium`,children:(0,A.jsx)(`span`,{className:`sr-only`,children:`Row actions`})}),e.map((e,t)=>{let n=r?.[e];return(0,A.jsx)(`th`,{className:s(`sticky top-0 z-10 whitespace-nowrap border-b border-line bg-surface px-4 py-3 font-medium`,l[t]&&`text-right`),"aria-sort":i?.col===e?i.dir===`asc`?`ascending`:`descending`:a?`none`:void 0,children:a?(0,A.jsxs)(`button`,{type:`button`,onClick:()=>a(e),"aria-label":`Sort by ${e}`,className:`inline-flex items-center gap-1 uppercase tracking-wider hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[e,n?.primaryKey&&(0,A.jsx)(`span`,{className:`rounded bg-accent/15 px-1 py-0.5 text-[9px] font-semibold text-accent`,children:`PK`}),n?.type&&(0,A.jsx)(`span`,{className:`text-faint/70`,children:n.type.toLowerCase()}),(0,A.jsx)(`span`,{"aria-hidden":`true`,className:i?.col===e?`text-accent`:`text-faint/60`,children:i?.col===e?i.dir===`asc`?`▲`:`▼`:`↕`})]}):e},e)})]})}),(0,A.jsx)(`tbody`,{children:t.map((e,t)=>(0,A.jsxs)(`tr`,{className:`border-b border-line font-mono text-xs last:border-0 hover:bg-surface-2/40`,children:[o&&(0,A.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2`,children:(0,A.jsx)(`button`,{type:`button`,"aria-label":`View row ${t+1} details`,onClick:()=>o(t),className:`rounded-md border border-line px-2 py-1 font-sans text-[11px] font-medium text-muted transition-colors hover:border-line-strong hover:text-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,children:`View`})}),e.map((e,r)=>(0,A.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2 text-muted`,children:(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(G,{value:e,align:l[r]?`right`:`left`}),n?.[t]?.[r]&&(0,A.jsx)(`span`,{title:`Value truncated — use the row's View action to read it in full`,className:`shrink-0 rounded bg-warning/15 px-1 text-[9px] font-semibold text-warning`,children:`…`})]})},r))]},t))})]})})}function q(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed database query response.`);let t=e;if(t.ok!==!0||!Array.isArray(t.columns)||t.columns.some(e=>typeof e!=`string`)||!Array.isArray(t.rows)||t.rows.length>500||t.rows.some(e=>!Array.isArray(e)||e.length!==t.columns.length)||!Number.isSafeInteger(t.rowCount)||t.rowCount!==t.rows.length||typeof t.truncated!=`boolean`||typeof t.ms!=`number`||!Number.isFinite(t.ms)||t.ms<0)throw Error(`Malformed database query response.`);return{columns:[...t.columns],rows:t.rows.map(e=>[...e]),rowCount:t.rowCount,truncated:t.truncated,ms:t.ms}}function ne({sql:e,setSql:t,editorRef:n}){let r=i(W),[a,o]=(0,k.useState)(null),[s,c]=(0,k.useState)(null),[l,d]=(0,k.useState)(z),[f,m]=(0,k.useState)(null),g=(0,k.useRef)(0),_=(0,k.useRef)(null),v=(0,k.useRef)(r);v.current!==r&&(v.current=r,g.current++,_.current=null),(0,k.useEffect)(()=>(g.current++,_.current=null,o(null),c(null),m(null),()=>{g.current++,_.current=null}),[r]);let y=a===r,b=s?.target===r?s.message:null,x=f?.target===r?f:null,C=async(t=e,n=!0)=>{let a=t.trim();if(!a||_.current?.target===r)return;let s=++g.current,l=r;_.current={generation:s,target:l},o(l),c(null);try{let e=q(await p.db.query(t));if(s!==g.current||W(i.getState())!==l)return;m({...e,target:l}),n&&d(V(a))}catch(e){if(s!==g.current||W(i.getState())!==l)return;m(null),c({target:l,message:e.message})}finally{_.current?.generation===s&&(_.current=null),s===g.current&&o(null)}};return(0,A.jsxs)(w,{className:`mt-6`,children:[(0,A.jsx)(h,{title:`Query`,action:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(u,{size:`sm`,disabled:y||!e.trim(),onClick:()=>{let t=e.trim();t&&C(`EXPLAIN QUERY PLAN ${t}`,!1)},children:`Explain`}),(0,A.jsx)(u,{size:`sm`,variant:`accent`,disabled:y||!e.trim(),onClick:()=>C(),children:y?`Running…`:`Run`})]})}),(0,A.jsx)(`textarea`,{name:`database-sql-query`,autoComplete:`off`,ref:n,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&C()},rows:3,spellCheck:!1,"aria-label":`SQL query`,placeholder:`SELECT … — read-only: writes are rejected by the engine`,className:`w-full resize-y rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),(0,A.jsx)(`p`,{className:`mt-1 text-[11px] text-faint`,children:`⌘/Ctrl+Enter runs. Connection is read-only.`}),l.length>0&&(0,A.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`History`}),l.map(e=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>t(e),title:e,className:`max-w-56 truncate rounded-md border border-line bg-surface-2 px-2 py-1 font-mono text-[11px] text-muted transition-colors hover:border-line-strong hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:e},e)),(0,A.jsx)(`button`,{type:`button`,onClick:()=>{B([]),d([])},className:`rounded-md px-2 py-1 text-[11px] text-faint transition-colors hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`Clear`})]}),(0,A.jsxs)(`div`,{"aria-live":`polite`,children:[b&&(0,A.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:b}),x&&!b&&(0,A.jsxs)(`div`,{className:`mt-4`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-3`,children:[(0,A.jsxs)(`p`,{className:`text-xs text-faint`,children:[x.truncated?`≥ `:``,S(x.rowCount),` row`,x.rowCount===1?``:`s`,` · `,S(x.ms),` ms`,x.truncated&&(0,A.jsxs)(`span`,{className:`text-warning`,children:[` — showing first `,x.rows.length]})]}),x.rows.length>0&&(0,A.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,A.jsx)(u,{size:`sm`,onClick:()=>L(`query-results.csv`,`text/csv`,I(x.columns,x.rows)),children:`CSV`}),(0,A.jsx)(u,{size:`sm`,onClick:()=>L(`query-results.json`,`application/json`,JSON.stringify(x.rows.map(e=>Object.fromEntries(x.columns.map((t,n)=>[t,e[n]]))),null,2)),children:`JSON`})]})]}),x.rows.length>0?(0,A.jsx)(K,{columns:x.columns,rows:x.rows}):(0,A.jsx)(`p`,{className:`text-xs text-faint`,children:`Query returned no rows.`})]})]})]})}var J=(e,t)=>t?e?.column===t.column&&e.op===t.op&&e.value===t.value:e===null;function Y(e,t){return e.table===t.table&&e.limit===t.limit&&e.offset===t.offset&&e.orderBy===(t.orderBy??null)&&e.dir===t.dir&&J(e.filter,t.filter)}var X=-(1n<<63n),re=(1n<<63n)-1n;function Z(e){if(e===null)return!0;if(typeof e==`number`)return Number.isSafeInteger(e);if(typeof e!=`string`||!/^-?(?:0|[1-9]\d*)$/.test(e)||e.length>20)return!1;try{let t=BigInt(e);return t>=X&&t<=re}catch{return!1}}var ie=e=>e===null||typeof e==`string`||typeof e==`number`&&Number.isFinite(e);function ae(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed database rows response.`);let n=e,r=n.columns,i=n.rows,a=n.rowids,o=n.truncatedCells,s=n.filter,c=s===null||typeof s==`object`&&!!s&&!Array.isArray(s)&&typeof s.column==`string`&&(s.op===`contains`||s.op===`eq`||s.op===`ne`)&&typeof s.value==`string`;if(n.ok!==!0||typeof n.table!=`string`||!Array.isArray(r)||r.length===0||r.length>2e3||r.some(e=>typeof e!=`string`||!e)||new Set(r).size!==r.length||!Array.isArray(i)||i.length>t.limit||i.some(e=>!Array.isArray(e)||e.length!==r.length||e.some(e=>!ie(e)))||!Array.isArray(a)||a.length!==i.length||a.some(e=>!Z(e))||!Array.isArray(o)||o.length!==i.length||o.some(e=>!Array.isArray(e)||e.length!==r.length||e.some(e=>typeof e!=`boolean`))||!Number.isSafeInteger(n.total)||n.total<0||!Number.isSafeInteger(n.limit)||!Number.isSafeInteger(n.offset)||n.offset<0||n.orderBy!==null&&typeof n.orderBy!=`string`||n.dir!==`asc`&&n.dir!==`desc`||!c)throw Error(`Malformed database rows response.`);let l={ok:!0,table:n.table,columns:[...r],rows:i.map(e=>[...e]),rowids:[...a],truncatedCells:o.map(e=>[...e]),total:n.total,limit:n.limit,offset:n.offset,orderBy:n.orderBy,dir:n.dir,filter:s===null?null:{...s}};if(!Y(l,t))throw Error(`Database rows identity mismatch: requested table "${t.table}" at offset ${t.offset}.`);let u=Math.min(l.limit,Math.max(0,l.total-l.offset));if(l.rows.length!==u)throw Error(`Malformed database rows response: row count does not match pagination metadata.`);return l}function oe(e,t){let n=e.rows[t],r=e.truncatedCells[t],i=e.rowids[t];return!n||!r||i===void 0||t<0?null:{index:t,table:e.table,columns:[...e.columns],row:[...n],rowid:i,truncated:[...r]}}var Q=(e,t)=>e.length===t.length&&e.every((e,n)=>Object.is(e,t[n]));function se(e,t){let n=oe(t,e.index);return n!==null&&n.table===e.table&&n.rowid===e.rowid&&Q(n.columns,e.columns)&&Q(n.row,e.row)&&Q(n.truncated,e.truncated)}function ce({schema:e}){return(0,A.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,A.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Column`}),(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Type`}),(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Constraints`}),(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Default`})]})}),(0,A.jsx)(`tbody`,{children:e.columns.map(e=>(0,A.jsxs)(`tr`,{className:`border-b border-line last:border-0`,children:[(0,A.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-fg`,children:e.name}),(0,A.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-muted`,children:e.type}),(0,A.jsxs)(`td`,{className:`px-4 py-2 text-xs`,children:[e.primaryKey&&(0,A.jsx)(`span`,{className:`mr-1 rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold text-accent`,children:`PK`}),e.notNull&&(0,A.jsx)(`span`,{className:`rounded-md bg-surface-2 px-1.5 py-0.5 text-[10px] font-semibold text-muted`,children:`NOT NULL`})]}),(0,A.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-faint`,children:e.defaultValue??`—`})]},e.name))})]})}),(0,A.jsxs)(w,{children:[(0,A.jsx)(h,{title:`Indexes (${e.indexes.length})`}),e.indexes.length===0?(0,A.jsx)(`p`,{className:`text-xs text-faint`,children:`No indexes on this table.`}):(0,A.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.indexes.map(e=>(0,A.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2 font-mono text-xs`,children:[(0,A.jsx)(`span`,{className:`text-fg`,children:e.name}),e.unique&&(0,A.jsx)(`span`,{className:`rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold text-accent`,children:`UNIQUE`}),(0,A.jsxs)(`span`,{className:`text-faint`,children:[`(`,e.columns.join(`, `),`)`]})]},e.name))})]}),e.sql&&(0,A.jsxs)(w,{children:[(0,A.jsx)(h,{title:`DDL`,action:(0,A.jsx)(d,{value:e.sql})}),(0,A.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:e.sql})]})]})}function le({db:e}){let{anyTruncated:t,colMeta:n,cycleSort:r,data:i,dbMissing:a,detail:o,editorRef:c,exportBusy:l,exportPage:d,exportTable:f,filter:p,info:m,infoError:h,msg:x,page:E,pageSize:D,queryThisTable:O,refetchInfo:k,refetchRows:M,refetchSchema:N,refetchTables:te,requestModal:P,rowsLoading:F,schema:I,schemaError:L,selectTable:R,selected:z,setDetailSelection:B,setFilter:V,setPage:H,setSql:U,setTab:W,sort:G,sql:q,tab:J,tables:Y,tablesError:X,tablesLoading:re,visibleRowsError:Z}=e;return(0,A.jsxs)(`div`,{"data-database-background":``,inert:o?!0:void 0,"aria-hidden":o?!0:void 0,children:[(0,A.jsx)(v,{title:`Database`,description:`SQLite inspector — schema, data and queries over a read-only connection.`,actions:(0,A.jsx)(`span`,{className:`rounded-full bg-emerald-500/10 px-2.5 py-1 text-[11px] font-medium text-success`,children:`read-only`})}),X&&!a&&(0,A.jsx)(_,{message:`Could not read the database — ${X.message}`,onRetry:te}),h&&!a&&(0,A.jsx)(_,{message:`Could not read database metadata — ${h.message}`,onRetry:k}),m&&(0,A.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-5`,children:[(0,A.jsx)(y,{label:`SQLite`,value:m.sqliteVersion,compact:!0}),(0,A.jsx)(y,{label:`On disk`,value:b(m.fileSize+m.walSize),compact:!0}),(0,A.jsx)(y,{label:`Journal`,value:m.journalMode.toUpperCase(),compact:!0}),(0,A.jsx)(y,{label:`Tables`,value:S(m.tables),compact:!0}),(0,A.jsx)(y,{label:`Indexes`,value:S(m.indexes),compact:!0})]}),a?(0,A.jsx)(g,{title:`No database yet`,hint:X.message}):re&&Y.length===0?(0,A.jsx)(T,{label:`Reading database…`}):(0,A.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-4`,children:[(0,A.jsxs)(w,{padded:!1,className:`self-start overflow-hidden`,children:[(0,A.jsxs)(`div`,{className:`border-b border-line px-4 py-3 text-[11px] font-medium uppercase tracking-wider text-faint`,children:[`Tables (`,Y.length,`)`]}),(0,A.jsxs)(`ul`,{className:`max-h-[28rem] overflow-y-auto`,children:[Y.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{type:`button`,onClick:()=>R(e.name),className:s(`flex w-full items-center justify-between gap-2 px-4 py-2 text-left text-sm transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,z===e.name?`bg-surface-2 text-fg`:`text-muted hover:bg-surface-2/60 hover:text-fg`),children:[(0,A.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.name}),(0,A.jsx)(`span`,{className:`shrink-0 text-[11px] text-faint tabular-nums`,children:S(e.rows)})]})},e.name)),Y.length===0&&(0,A.jsx)(`li`,{className:`px-4 py-6 text-center text-xs text-faint`,children:`No tables.`})]})]}),(0,A.jsx)(`div`,{className:`min-w-0 lg:col-span-3`,children:Y.length===0?(0,A.jsx)(g,{title:`No tables`,hint:`This database has no user tables yet.`}):(0,A.jsxs)(A.Fragment,{children:[z&&(0,A.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-sm text-fg`,title:z,children:z}),(0,A.jsx)(u,{size:`sm`,variant:`ghost`,onClick:O,children:`Query`}),(0,A.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-lg border border-line bg-surface p-1`,children:[`data`,`schema`].map(e=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>W(e),"aria-pressed":J===e,className:s(`rounded-md px-3 py-1 text-xs font-medium capitalize transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,J===e?`bg-surface-2 text-fg`:`text-muted hover:text-fg`),children:e},e))}),J===`data`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(u,{size:`sm`,disabled:!i||i.rows.length===0,title:i?`Exports the ${i.rows.length} rows on this page only`:void 0,onClick:d,children:[`Export page`,i?` (${i.rows.length})`:``]}),(0,A.jsx)(u,{size:`sm`,variant:`accent`,disabled:l||!i||i.total===0,onClick:f,children:l?`Exporting…`:`Export table${i?` (${S(i.total)})`:``}`})]})]}),J===`data`&&z&&(0,A.jsx)(j,{columns:i?.columns??I?.columns.map(e=>e.name)??[],filter:p,onChange:e=>{V(e),H(0),B(null)}},z),x&&(0,A.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:x}),J===`schema`?L?(0,A.jsx)(g,{title:`Could not read schema`,hint:L.message,action:(0,A.jsx)(u,{size:`sm`,onClick:N,children:`Retry`})}):I?.table===z?(0,A.jsx)(ce,{schema:I}):(0,A.jsx)(T,{label:`Reading schema of ${z}…`}):Z?(0,A.jsx)(C,{error:Z,onRetry:M}):F&&!i?(0,A.jsx)(T,{label:`Reading ${z}…`}):i?i.total===0?(0,A.jsx)(g,{title:p?`No matching rows`:`Empty table`,hint:p?`No rows match the current filter.`:`"${i.table}" has no rows.`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(K,{columns:i.columns,rows:i.rows,truncatedCells:i.truncatedCells,colMeta:n,sort:G,onSort:r,onRowClick:e=>{let t=oe(i,e);t&&P(`database-row`)&&B(t)},dimmed:F&&!i}),t&&(0,A.jsx)(`p`,{className:`mt-2 text-[11px] text-faint`,children:`Cells over 2000 chars and BLOBs are abbreviated in the grid and CSV — use the row's View action to read the full value.`}),(0,A.jsx)(ee,{page:E,pageSize:D,total:i.total,onPageChange:e=>{H(e),B(null)},label:`rows`})]}):(0,A.jsx)(g,{title:`Select a table`,hint:`Pick a table on the left to browse its rows.`}),(0,A.jsx)(ne,{sql:q,setSql:U,editorRef:c})]})})]})]})}var ue=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;function de({table:e,columns:t,row:n,rowid:r,truncated:i,onClose:a}){let[s,l]=(0,k.useState)({}),[u,f]=(0,k.useState)({}),m=(0,k.useRef)(null),h=(0,k.useRef)(null),g=(0,k.useRef)(a);g.current=a,(0,k.useEffect)(()=>{let e=document.activeElement,t=m.current,n=()=>t?Array.from(t.querySelectorAll(ue)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`):[],r=(e=!1)=>{let r=n();(e?r.at(-1):r[0])?.focus(),r.length===0&&t?.focus()},i=e=>{if(e.key===`Escape`){e.preventDefault(),g.current();return}if(e.key!==`Tab`)return;let r=n();if(r.length===0){e.preventDefault(),t?.focus();return}let i=document.activeElement,a=r[0],o=r[r.length-1];e.shiftKey&&(i===a||!i||!t?.contains(i))?(e.preventDefault(),o.focus()):e.shiftKey||i!==o&&i&&t?.contains(i)||(e.preventDefault(),a.focus())},a=e=>{t&&!t.contains(e.target)&&r()};return h.current?.focus(),document.activeElement!==h.current&&t?.focus(),document.addEventListener(`keydown`,i,!0),document.addEventListener(`focusin`,a),()=>{document.removeEventListener(`keydown`,i,!0),document.removeEventListener(`focusin`,a),c(`database-row`)&&e?.isConnected&&e.focus()}},[]);let _=JSON.stringify(t.filter((e,t)=>i[t]));return(0,k.useEffect)(()=>{l({}),f({});let t=JSON.parse(_);if(r==null||t.length===0)return;let n=!1;return Promise.all(t.map(async t=>{try{let i=await p.db.cell(e,r,t);if(!i||typeof i!=`object`||!Object.hasOwn(i,`value`))throw Error(`Malformed full-cell response.`);n||l(e=>({...e,[t]:i.value}))}catch(e){if(!n){let n=e instanceof Error?e.message:String(e);f(e=>({...e,[t]:n.slice(0,300)}))}}})),()=>{n=!0}},[e,r,_]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{type:`button`,"aria-label":`Close row detail`,onClick:a,className:`fixed inset-0 z-40 bg-black/50`}),(0,A.jsxs)(`aside`,{ref:m,role:`dialog`,"aria-modal":`true`,"aria-label":`${e} row ${r??`detail`}`,tabIndex:-1,className:`fixed inset-y-0 right-0 z-50 flex w-full max-w-xl flex-col border-l border-line bg-surface shadow-xl focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-5 py-4`,children:[(0,A.jsxs)(`h2`,{className:`font-mono text-sm text-fg`,children:[e,` · row detail`]}),(0,A.jsx)(`button`,{ref:h,type:`button`,"aria-label":`Close`,onClick:a,className:`flex size-8 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`,children:(0,A.jsx)(o,{className:`size-4`})})]}),(0,A.jsx)(`div`,{className:`flex-1 overscroll-contain overflow-y-auto p-5`,children:(0,A.jsx)(`dl`,{className:`flex flex-col gap-4`,children:t.map((e,t)=>{let a=Object.hasOwn(s,e),o=a?s[e]:n[t],c=H(o),l=c.includes(`
3
- `)||c.length>80;return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`dt`,{className:`mb-1 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-faint`,children:[e,o!=null&&(0,A.jsx)(d,{value:String(o)}),i[t]&&!a&&(r==null?(0,A.jsx)(`span`,{className:`normal-case text-warning`,children:`(truncated — full value unavailable: this table has no rowid to fetch it by)`}):Object.hasOwn(u,e)?(0,A.jsxs)(`span`,{role:`alert`,className:`normal-case text-danger`,children:[`(full value unavailable — `,u[e],`)`]}):(0,A.jsx)(`span`,{className:`text-warning`,children:`(loading full value…)`}))]}),(0,A.jsx)(`dd`,{children:o==null?(0,A.jsx)(`span`,{className:`italic text-faint`,children:`NULL`}):l?(0,A.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:c}):(0,A.jsx)(`span`,{className:`break-words font-mono text-sm text-fg`,children:c})})]},e)})})})]})]})}function fe({data:e,filter:t,page:n,selected:r,sort:a}){let o=i(W),[s,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(null),d=(0,k.useRef)(!1),m=(0,k.useRef)(null);return(0,k.useEffect)(()=>(m.current?.abort(),m.current=null,d.current=!1,c(!1),u(null),()=>{m.current?.abort(),m.current=null,d.current=!1}),[o]),{exportBusy:s,exportPage:()=>{e&&L(`${e.table}-page${n+1}.csv`,`text/csv`,I(e.columns,e.rows))},exportTable:async()=>{if(!r||d.current)return;d.current=!0;let e=W(i.getState()),n={table:r,orderBy:a?.col,dir:a?.dir??`asc`,filter:t?{...t}:void 0},o=p.captureAgentRequestTarget(),s=new AbortController;m.current=s,c(!0),u(null);try{let t=await U(n,o,s.signal);if(s.signal.aborted||W(i.getState())!==e)return;L(`${n.table}.csv`,`text/csv;charset=utf-8`,t.content);let r=t.cap===`rows`?`Exported the first ${S(t.rowCount)} rows (row cap reached)`:t.cap===`bytes`?`Exported ${S(t.rowCount)} rows (${b(E)} byte cap reached)`:`Exported ${S(t.rowCount)} rows`;u(r),f.success(`Export of ${n.table} complete`,r)}catch(t){if(s.signal.aborted||W(i.getState())!==e)return;u(`Export failed: ${t.message}`),f.error(`Export of ${n.table} failed`,t.message)}finally{m.current===s&&(m.current=null,d.current=!1,s.signal.aborted||c(!1))}},msg:l}}var $=50;function pe(){let[e,t]=(0,k.useState)(``),[n,r]=(0,k.useState)(0),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(`data`),[c,u]=(0,k.useState)(null),[d,f]=(0,k.useState)(null),h=x(e=>e.active),g=x(e=>e.request),_=x(e=>e.release),[v,y]=(0,k.useState)(`SELECT name FROM sqlite_master WHERE type = 'table'`),b=(0,k.useRef)(null);(0,k.useEffect)(()=>{d===null?_(`database-row`):h!==`database-row`&&f(null)},[d,h,_]),(0,k.useEffect)(()=>()=>{x.getState().release(`database-row`)},[]);let{data:S,error:C,loading:w,refetch:T}=m(()=>p.db.tables(),[],{intervalMs:1e4}),E=(0,k.useMemo)(()=>S?.tables??[],[S]),D=C instanceof l&&C.status===404,{data:ee,error:O,refetch:A}=m(()=>D?Promise.resolve(null):p.db.info(),[D],{intervalMs:15e3}),j=e||E[0]?.name||``;(0,k.useEffect)(()=>{!e&&E[0]&&t(E[0].name)},[e,E]);let{data:M,error:N,refetch:te}=m(()=>j?p.db.schema(j):Promise.resolve(null),[j],{intervalMs:3e4}),P=(0,k.useMemo)(()=>{let e={};if(M?.table===j)for(let t of M.columns)e[t.name]={type:t.type,primaryKey:t.primaryKey};return e},[M,j]),F=c?JSON.stringify([c.column,c.op,c.value]):``,I=(0,k.useCallback)(async()=>{if(!j)return null;let e={table:j,limit:$,offset:n*$,orderBy:i?.col,dir:i?.dir??`asc`,filter:c??void 0};return ae(await p.db.rows(j,$,e.offset,i?.col,i?.dir,c??void 0),e)},[j,n,i,c]),{data:L,error:R,loading:z,refetch:B}=m(I,[j,n,i,F],{intervalMs:6e3}),V={table:j,limit:$,offset:n*$,orderBy:i?.col,dir:i?.dir??`asc`,filter:c??void 0},H=!!L&&Y(L,V),U=R??(L&&!H?Error(`Database rows identity no longer matches the selected table and page.`):null),W=!U&&H?L:null,G=d!==null&&W!==null&&se(d,W),K=G?d:null;(0,k.useEffect)(()=>{d&&!G&&f(null)},[d,G]),(0,k.useEffect)(()=>{W&&W.total>0&&W.rows.length===0&&n>0&&r(Math.max(0,Math.ceil(W.total/$)-1))},[W,n]);let q=()=>{r(0),a(null),u(null),f(null)},ne=e=>{t(e),s(`data`),q()},J=e=>{r(0),f(null),a(t=>t?.col===e?t.dir===`asc`?{col:e,dir:`desc`}:null:{col:e,dir:`asc`})},X=()=>{let e=`SELECT * FROM "${j.replaceAll(`"`,`""`)}" LIMIT 100`;y(e),requestAnimationFrame(()=>{b.current?.focus(),b.current?.scrollIntoView({behavior:`smooth`,block:`center`})})},re=!!W?.truncatedCells.some(e=>e.some(Boolean)),{exportBusy:Z,exportPage:ie,exportTable:oe,msg:Q}=fe({data:W,filter:c,page:n,selected:j,sort:i});return{activeModal:h,anyTruncated:re,colMeta:P,cycleSort:J,data:W,dbMissing:D,detail:K,editorRef:b,exportBusy:Z,exportPage:ie,exportTable:oe,filter:c,info:ee,infoError:O,msg:Q,page:n,pageSize:$,queryThisTable:X,refetchInfo:A,refetchRows:B,refetchSchema:te,refetchTables:T,requestModal:g,rowsLoading:z,schema:M,schemaError:N,selectTable:ne,selected:j,setDetailSelection:f,setFilter:u,setPage:r,setSql:y,setTab:s,sort:i,sql:v,tab:o,tables:E,tablesError:C,tablesLoading:w,visibleRowsError:U}}function me(){let e=pe(),{activeModal:t,detail:n,setDetailSelection:r}=e;return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(le,{db:e}),n&&t===`database-row`&&(0,O.createPortal)((0,A.jsx)(de,{table:n.table,columns:n.columns,row:n.row,rowid:n.rowid,truncated:n.truncated,onClose:()=>r(null)}),document.body)]})}export{me as Database};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{f as t,h as n,r,t as i}from"./react-vendor-08inPAVO.js";import{C as a,d as o,u as s}from"./icons-BIT5aq1c.js";import{r as c}from"./StatusBadge-D-mexaga.js";import{C as l,F as u,I as d,O as f,_ as p,b as m,d as h,g as ee,l as g,v as _,w as v,x as y,y as b}from"./index-X_fHGbXZ.js";import{a as x}from"./form-DBkslwzu.js";import{t as te}from"./Pagination-WVfHLHDS.js";import{r as S,t as C}from"./flowMutationSafety-YKTHxqKv.js";import{t as w}from"./exportFile-C7xhE8Yh.js";import{t as T}from"./QueueControl-BiMM0jLp.js";var E=e(n(),1),D=i();function O({total:e,discoveryError:t,healthy:n,statsError:r,queue:i,topReason:a,pendingRetry:o,reasonCount:s}){return(0,D.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,D.jsxs)(y,{children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Total in DLQ`}),(0,D.jsx)(`span`,{className:c(`rounded-full px-2 py-0.5 text-[11px] font-medium`,t?`bg-amber-500/10 text-warning`:e==null?`bg-surface-2 text-muted`:n?`bg-emerald-500/10 text-success`:`bg-red-500/10 text-danger`),children:t?`Unavailable`:e==null?`Loading`:n?`Healthy`:`Attention`})]}),(0,D.jsx)(`div`,{className:c(`mt-2 text-3xl font-bold tnum`,e==null||t?`text-muted`:n?`text-success`:`text-danger`),children:e==null?`—`:g(e)})]}),(0,D.jsxs)(y,{children:[(0,D.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Top Reason`}),(0,D.jsx)(`div`,{className:`mt-2 text-lg font-semibold text-fg`,children:t||r?`Unavailable`:i?a??`No failures`:`Select a queue`})]}),(0,D.jsxs)(y,{children:[(0,D.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Pending Retry`}),(0,D.jsx)(`div`,{className:`mt-2 text-3xl font-bold tnum text-fg`,children:o==null?`—`:g(o)}),(0,D.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:i?`in this queue`:`awaiting retry`})]}),(0,D.jsxs)(y,{children:[(0,D.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Failure Types`}),(0,D.jsx)(`div`,{className:`mt-2 text-3xl font-bold tnum text-fg`,children:s==null?`—`:g(s)}),(0,D.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`distinct reasons`})]})]})}function k({queues:e,queue:t,onSelect:n}){return e.length===0?null:(0,D.jsxs)(y,{className:`mb-6`,children:[(0,D.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,D.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`DLQ by queue`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsxs)(l,{size:`sm`,disabled:!0,title:C,children:[(0,D.jsx)(a,{className:`size-3.5`}),` Retry all (`,e.length,` queues)`]}),(0,D.jsxs)(l,{variant:`danger`,size:`sm`,disabled:!0,title:S,children:[`Purge all (`,e.length,` queues)`]})]})]}),(0,D.jsx)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-4 xl:grid-cols-5`,children:e.map(e=>(0,D.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:c(`rounded-lg border p-3 text-left transition-colors`,t===e.name?`border-accent/50 bg-surface-2`:`border-line hover:border-line-strong`),children:[(0,D.jsx)(`div`,{className:`truncate font-mono text-xs text-muted`,children:e.name}),(0,D.jsx)(`div`,{className:`mt-1 text-xl font-bold tnum text-danger`,children:e.dlq})]},e.name))})]})}function A({queue:e,queues:t,reason:n,reasons:r,sort:i,search:s,pageScoped:c,onQueue:u,onReason:d,onSort:f,onSearch:p,onExport:m}){return(0,D.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`w-48`,children:(0,D.jsxs)(x,{value:e,"aria-label":`Queue`,name:`dlq-queue`,autoComplete:`off`,onChange:e=>u(e.target.value),children:[(0,D.jsx)(`option`,{value:``,children:`Select a queue…`}),t.map(e=>(0,D.jsxs)(`option`,{value:e.name,children:[e.name,e.dlq?` (${e.dlq})`:``]},e.name))]})}),(0,D.jsx)(`div`,{className:`w-40`,children:(0,D.jsxs)(x,{value:n,onChange:e=>d(e.target.value),"aria-label":`Filter by reason`,name:`dlq-reason-filter`,autoComplete:`off`,children:[(0,D.jsx)(`option`,{value:`all`,children:`All Reasons`}),r.map(e=>(0,D.jsx)(`option`,{value:e,children:e},e))]})}),(0,D.jsx)(`div`,{className:`w-36`,children:(0,D.jsxs)(x,{value:i,onChange:e=>f(e.target.value),"aria-label":c?`Sort this page`:`Sort`,name:`dlq-sort`,autoComplete:`off`,children:[(0,D.jsxs)(`option`,{value:`newest`,children:[`Newest First`,c?` (this page)`:``]}),(0,D.jsxs)(`option`,{value:`oldest`,children:[`Oldest First`,c?` (this page)`:``]})]})}),(0,D.jsx)(`input`,{value:s,onChange:e=>p(e.target.value),placeholder:`Filter this page by job ID…`,"aria-label":`Filter this page by job ID`,name:`dlq-job-filter`,autoComplete:`off`,className:`h-9 min-w-40 flex-1 rounded-lg border border-line bg-surface px-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),(0,D.jsxs)(l,{size:`sm`,disabled:!0,title:C,children:[(0,D.jsx)(a,{className:`size-3.5`}),` Retry All`]}),(0,D.jsx)(l,{variant:`danger`,size:`sm`,disabled:!0,title:S,children:`Purge All`}),(0,D.jsxs)(l,{size:`sm`,title:`Exports the visible rows in their displayed order; other pages are not included.`,disabled:!e,onClick:m,children:[(0,D.jsx)(o,{className:`size-3.5`}),` Export page CSV`]})]})}function j({entries:e,expanded:t,onToggle:n}){return(0,D.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,D.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,D.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,D.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,D.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Reason`}),(0,D.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Error`}),(0,D.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Entered`}),(0,D.jsx)(`th`,{className:`w-16 px-5 py-3`})]})}),(0,D.jsx)(`tbody`,{children:e.map(e=>{let i=`${e.job.id}-${e.enteredAt}`;return(0,D.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,D.jsx)(`td`,{className:`px-5 py-3`,children:(0,D.jsx)(r,{to:`/job?id=${encodeURIComponent(e.job.id)}`,className:`font-mono text-xs text-accent hover:underline`,children:e.job.id})}),(0,D.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.job.name??`default`}),(0,D.jsx)(`td`,{className:`px-5 py-3`,children:(0,D.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs text-danger`,children:e.reason})}),(0,D.jsx)(`td`,{className:`max-w-md px-5 py-3 text-xs text-danger/80`,children:e.error?(0,D.jsx)(`button`,{type:`button`,title:e.error,"aria-expanded":t.has(i),onClick:()=>n(i),className:c(`block w-full break-words text-left`,!t.has(i)&&`line-clamp-2`),children:e.error}):`—`}),(0,D.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:h(e.enteredAt)}),(0,D.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,D.jsx)(v,{"aria-label":`Retry unavailable`,disabled:!0,title:C,children:(0,D.jsx)(a,{className:`size-3.5`})})})]},i)})})]})})}var M=25,N=[];function P(){let[e,n]=t(),[r,i]=(0,E.useState)(``),[a,o]=(0,E.useState)(`all`),[c,l]=(0,E.useState)(`newest`),[h,g]=(0,E.useState)(``),[v,y]=(0,E.useState)(0),[x,S]=(0,E.useState)(new Set),{data:P,error:F,loading:I,refetch:ne}=f(T,[],{intervalMs:1e4}),L=P?.queues??N,R=P?L.reduce((e,t)=>e+t.dlq,0):null,re=(0,E.useCallback)(async()=>{if(!r)return{queue:r,page:v,entries:[],entriesTotal:0,stats:null,statsError:null};let[e,t]=await Promise.all([d.dlq(r,M,v*M),d.dlqStats(r).then(e=>({stats:e.stats,error:null})).catch(e=>({stats:null,error:e.message||`Unknown error`}))]);return{queue:r,page:v,entries:e.entries??[],entriesTotal:e.total??0,stats:t.stats,statsError:t.error}},[r,v]),{data:z,error:B,loading:V,refetch:H}=f(re,[r,v]),U=z?.queue===r&&z.page===v?z:null;(0,E.useEffect)(()=>{if(!U)return;let e=U.entriesTotal??0;v>0&&v*M>=e&&y(Math.max(0,Math.ceil(e/M)-1))},[U,v]);let W=()=>{let e=Q.map(e=>({jobId:e.job.id,reason:e.reason,error:e.error??``,enteredAt:new Date(e.enteredAt).toISOString(),attempts:e.attempts?.length??0}));e.length===0?u.info(`Nothing to export on this page`):w(`dlq-${r}-page-${v+1}`,e,[`jobId`,`reason`,`error`,`enteredAt`,`attempts`])},G=e=>{X.current=!0,i(e),y(0),o(`all`),n(e?{queue:e}:{},{replace:!0})};(0,E.useEffect)(()=>{a!==`all`&&U&&((U.stats?.byReason?.[a]??0)>0||o(`all`))},[U,a]);let K=U?.stats?.byReason??{},q=Object.keys(K).filter(e=>K[e]>0),J=[...q].sort((e,t)=>(K[t]??0)-(K[e]??0))[0],Y=(0,E.useMemo)(()=>L.filter(e=>e.dlq>0).sort((e,t)=>t.dlq-e.dlq),[L]),X=(0,E.useRef)(!1),Z=e.get(`queue`);(0,E.useEffect)(()=>{if(!(X.current||r)){if(Z){if(L.some(e=>e.name===Z)){X.current=!0,i(Z),y(0),o(`all`);return}if(L.length===0)return}Y.length!==0&&(X.current=!0,i(Y[0].name),y(0),o(`all`))}},[r,L,Y,Z]);let Q=(0,E.useMemo)(()=>{let e=U?.entries??[];a!==`all`&&(e=e.filter(e=>e.reason===a));let t=h.trim().toLowerCase();return t&&(e=e.filter(e=>e.job.id.toLowerCase().includes(t))),[...e].sort((e,t)=>c===`newest`?t.enteredAt-e.enteredAt:e.enteredAt-t.enteredAt)},[U,a,h,c]),ie=R===0&&!F,$=a!==`all`||h.trim()!==``,ae=(U?.entriesTotal??0)>M;return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(ee,{title:`Dead Letter Queue`,description:`Jobs that failed after exhausting all retries. Inspect and export entries without mutating flow topology.`,live:!!r&&!!U&&!U.statsError&&!B&&!F}),B&&U&&(0,D.jsx)(m,{message:`DLQ refresh failed — showing the last successful page.`,onRetry:H}),F&&(0,D.jsx)(m,{onRetry:ne,message:`Could not discover queue DLQ totals — ${F.message}. Health status is unavailable.`}),U?.statsError&&(0,D.jsx)(m,{message:`DLQ statistics are unavailable — ${U.statsError}. The entry list may still be current.`,onRetry:H}),(0,D.jsx)(O,{total:R,discoveryError:!!F,healthy:ie,statsError:!!U?.statsError,queue:r,topReason:J,pendingRetry:U?.stats?.pendingRetry,reasonCount:U?.stats?q.length:void 0}),(0,D.jsx)(k,{queues:Y,queue:r,onSelect:G}),(0,D.jsx)(A,{queue:r,queues:L,reason:a,reasons:q,sort:c,search:h,pageScoped:ae,onQueue:G,onReason:o,onSort:l,onSearch:g,onExport:W}),(0,D.jsx)(`p`,{className:`mb-4 text-xs text-warning`,children:C}),B&&!U?(0,D.jsx)(_,{error:B,onRetry:H}):I&&!P&&!r&&!F?(0,D.jsx)(b,{label:`Discovering queues…`}):V&&!U&&!B?(0,D.jsx)(b,{label:`Loading DLQ…`}):F&&!r?(0,D.jsx)(p,{icon:(0,D.jsx)(s,{}),title:`Could not discover queues`,hint:`${F.message}. Retry the queue discovery request above.`}):r?Q.length===0?(0,D.jsx)(p,{icon:(0,D.jsx)(s,{}),title:$?`No matches on this page`:`No dead letter entries`,hint:$?`No entries on this page match your filter — the filter is page-scoped. Use the pager below to check other pages.`:`This queue has no dead letter entries.`}):(0,D.jsx)(j,{entries:Q,expanded:x,onToggle:e=>S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}):(0,D.jsx)(p,{icon:(0,D.jsx)(s,{}),title:`Select a queue`,hint:`Choose a queue from the dropdown to view its dead letter queue entries.`}),r&&U&&(0,D.jsx)(te,{page:v,pageSize:M,total:U.entriesTotal,onPageChange:y,label:`entries`})]})}export{P as DlqPro};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{f as t,h as n,r,t as i}from"./react-vendor-08inPAVO.js";import{a,o}from"./connectionStore-B946Fhuv.js";import{i as s}from"./upstreamPaths-DQeKSxGc.js";import{r as c}from"./StatusBadge-D-mexaga.js";import{B as l,G as u,H as d,K as f,T as p,b as m,g as h,v as g,x as _,y as v}from"./index-X_fHGbXZ.js";import{n as y,t as b}from"./controlConnectionEpoch-x9VjrWgN.js";import{t as x}from"./useControlActionGuard-Bx5MkufG.js";import{n as S,r as C}from"./flowOperationPolicy-B2Etcb3f.js";var w={nodeWidth:168,nodeHeight:60},ee=`flow-order-9a3f`,T={completed:`border-success/50 bg-success/10 text-success`,failed:`border-danger/50 bg-danger/10 text-danger`,active:`border-blue-400/60 bg-blue-400/10 text-blue-400`,delayed:`border-accent/50 bg-accent/10 text-accent`,waiting:`border-warning/50 bg-warning/10 text-warning`,prioritized:`border-warning/50 bg-warning/10 text-warning`,"waiting-children":`border-cyan-400/60 bg-cyan-400/10 text-cyan-400`},E=e=>e&&T[e]||`border-line bg-surface-2 text-muted`,D=e=>e.length>12?`${e.slice(0,6)}…${e.slice(-4)}`:e,O=class extends Error{constructor(e,t){super(e,t),this.name=`FlowSnapshotError`}};function k(e,t,n){if(!Array.isArray(e)||e.some(e=>typeof e!=`string`||s(e)!==null))throw new O(`Job ${n} returned an invalid ${t} list`);return e}function A(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new O(`GET /jobs/${t} returned an invalid response`);let n=e;if(n.ok!==!0)throw new O(`GET /jobs/${t} returned an invalid success envelope`);let r=n.job;if(typeof r!=`object`||!r||Array.isArray(r))throw new O(`GET /jobs/${t} returned no job snapshot`);let i=r;if(i.id!==t)throw new O(`GET /jobs/${t} returned the wrong job id (${String(i.id)})`);if(typeof i.queue!=`string`||i.queue.length===0)throw new O(`Job ${t} returned an invalid queue`);if(typeof i.state!=`string`||i.state.length===0)throw new O(`Job ${t} returned an invalid state`);if(!Object.hasOwn(i,`parentId`)||i.parentId!==null&&(typeof i.parentId!=`string`||s(i.parentId)!==null))throw new O(`Job ${t} returned an invalid parentId`);return{...r,parentId:i.parentId,childrenIds:k(i.childrenIds,`childrenIds`,t),dependsOn:k(i.dependsOn,`dependsOn`,t)}}async function j(e,t,n){n?.throwIfAborted();let r=await f(e,t,n);return n?.throwIfAborted(),A(r,t)}function M(e){let t=s(e);return t?`Job ID: ${t}`:null}async function te(e,t={}){let n=M(e);if(n)throw new O(n);let r=t.target??u(),{signal:i}=t,a=e,o=new Set([e]),s=[];for(let e=0;;e++){i?.throwIfAborted();let t;try{t=await j(r,a,i)}catch(t){if(i?.throwIfAborted(),e===0)throw t;if(t instanceof l&&t.status===404){let e=s.at(-1);if(!e)throw t;return{id:e.id,job:e,hops:Math.max(0,s.length-1),path:s,missingParent:a}}throw new O(`Could not resolve the flow root because parent ${a} could not be loaded: ${t instanceof Error?t.message:String(t)}`,{cause:t})}s.push(t);let n=t.parentId;if(!n)return{id:a,job:t,hops:e,path:s};if(o.has(n))throw new O(`Flow parent cycle detected at job ${n}`);if(e>=100)throw new O(`Flow parent chain exceeds the Bunqueue 2.9.3 limit of 100 levels`);o.add(n),a=n}}function N(e,t){let n=new Set(e),r=new Map(e.map(e=>[e,[]]));for(let e of t)n.has(e.from)&&n.has(e.to)&&r.get(e.from)?.push(e.to);let i=new Map,a=[],o=e=>{i.set(e,1),a.push(e);for(let t of r.get(e)??[]){if(i.get(t)===1){let e=a.lastIndexOf(t);return[...a.slice(Math.max(0,e)),t]}if(i.get(t)!==2){let e=o(t);if(e)return e}}return a.pop(),i.set(e,2),null};for(let t of e)if(!i.has(t)){let e=o(t);if(e)return e}return null}var ne=[`failParentOnFailure`,`removeDependencyOnFailure`,`continueParentOnFailure`,`ignoreDependencyOnFailure`];function P(e){return ne.filter(t=>e[t]===!0)}function F(e,t){if(e?.parentId!==t)return null;let n=P(e);return n.length===1?n[0]===`continueParentOnFailure`?{scope:`parent`,policy:`continueParentOnFailure`}:n[0]===`removeDependencyOnFailure`?{scope:`child`,policy:`removeDependencyOnFailure`}:n[0]===`ignoreDependencyOnFailure`?{scope:`child`,policy:`ignoreDependencyOnFailure`}:null:null}async function re(e,t,n={}){let r=M(e);if(r)throw new O(r);let i=n.target??u(),{signal:a}=n,o=new Map,s=[],c=[],l=new Set,d=new Set,f=new Map,p=new Set,m=new Set,h=new Set(n.limitations??[]),g=[{id:e,depth:0}],_=new Set([e]),v=new Map;t&&v.set(e,A({ok:!0,job:t},e));let y=[...n.seedPath??[]].reverse(),b=!1;if(y.length>0&&y[0]?.id!==e)throw new O(`Resolved seed path does not start at the requested flow root`);for(let[e,t]of y.entries()){let n=A({ok:!0,job:t},t.id);v.set(n.id,n),e!==0&&(e>100||_.size>=500?b=!0:_.has(n.id)||(_.add(n.id),g.push({id:n.id,depth:e})))}let x=new Set,S=b;for(;g.length;){a?.throwIfAborted();let{id:t,depth:n}=g.shift();if(x.has(t))continue;x.add(t);let r=null;try{r=v.get(t)??await j(i,t,a)}catch(n){if(a?.throwIfAborted(),t===e)throw n;f.set(t,n instanceof Error?n.message:String(n))}if(o.set(t,r??{id:t,state:`unknown`}),!r)continue;if(n>=100){(r.childrenIds?.length??0)+(r.dependsOn?.length??0)>0&&(S=!0);continue}let u=e=>_.has(e)?!0:_.size>=500?(S=!0,!1):(_.add(e),g.push({id:e,depth:n+1}),!0),m=(e,t,n,r)=>{if(!u(r))return;let i=`${e}->${t}:${n}`;l.has(i)||(l.add(i),s.push({from:e,to:t,kind:n}))},h=r.childrenIds??[],y=r.dependsOn??[],b=new Set(h),C=new Set(y);b.size!==h.length&&p.add(`Job ${t} lists a child more than once`),C.size!==y.length&&p.add(`Job ${t} lists a dependency more than once`);for(let e of h)m(t,e,`child`,e);for(let e of y)if(u(e)){let n=`${e}->${t}`;d.has(n)||(d.add(n),c.push({from:e,to:t,kind:`depends`})),b.has(e)||m(e,t,`depends`,e)}}for(let[e,t]of o)!f.has(e)&&P(t).length>1&&p.add(`Job ${e} enables mutually exclusive failure policies`);for(let e of s){if(e.kind!==`child`||f.has(e.to))continue;let t=o.get(e.to);t&&t.parentId!==e.from&&p.add(`Child ${e.to} points to parent ${String(t.parentId??`none`)}, not ${e.from}`)}for(let[e,t]of o){if(f.has(e))continue;let n=t.childrenIds??[];if(n.some(e=>!o.has(e)||f.has(e)))continue;let r=n.map(t=>({childId:t,release:F(o.get(t),e)})).find(({release:e})=>e?.scope===`parent`);for(let i of n){if(t.dependsOn?.includes(i))continue;if(r?.release?.scope===`parent`){m.add(`Parent ${e} is missing dependency ${i}; ${r.release.policy} on child ${r.childId} may have released all parent dependencies, but the HTTP snapshot cannot prove whether the policy fired`);continue}let n=F(o.get(i),e);n?.scope===`child`?m.add(`Parent ${e} is missing dependency ${i}; ${n.policy} may have released it, but the HTTP snapshot cannot prove whether the policy fired`):p.add(`Parent ${e} lists child ${i} without the matching dependency`)}}for(let[e,t]of o){if(f.has(e)||!t.parentId)continue;let n=o.get(t.parentId);n&&!f.has(t.parentId)&&(n.childrenIds?.includes(e)||p.add(`Parent ${t.parentId} does not list child ${e}`))}let C=N([...o.keys()],c);return{jobs:o,edges:s,truncated:S,failed:f.size,failures:f,issues:[...p],policyNotes:[...m],cycle:C,limitations:[...h]}}var ie=`bq-dash-recent-flows`,ae=8;function oe(e){return`${ie}:${encodeURIComponent(e.trim()||`/api`)}`}function se(e,t){if(!t)return[];try{let t=JSON.parse(localStorage.getItem(oe(e))??`[]`);return Array.isArray(t)?t.filter(e=>typeof e?.root==`string`&&e.root.length>0&&e.root.length<=1024&&Number.isSafeInteger(e?.nodes)&&e.nodes>1&&e.nodes<=500&&Number.isFinite(e?.at)&&e.at>=0).slice(0,ae):[]}catch{return[]}}function ce(e,t,n,r){let i=[n,...t.filter(e=>e.root!==n.root)].slice(0,ae);if(!r)return i;try{localStorage.setItem(oe(e),JSON.stringify(i))}catch{}return i}var I=e(n(),1),le=new Set([`explore`,`create`,`operations`]);function ue(e,t=``){let n=e.get(`root`),r=R(n)?n:t,i=e.get(`mode`),a=le.has(i)?i:`explore`,o=e.get(`node`);return{root:r,mode:a,node:r&&R(o)?o:null}}function L(e){let t=new URLSearchParams;return e.root&&t.set(`root`,e.root),e.mode!==`explore`&&t.set(`mode`,e.mode),e.root&&e.node&&t.set(`node`,e.node),t}function de(e,t,n=``){return L({...ue(e,n),...t})}function R(e){return!!(e&&M(e)===null)}function fe(){let[e,n]=t(),r=p()?ee:``,i=e.toString(),s=(0,I.useMemo)(()=>ue(new URLSearchParams(i),r),[r,i]),c=s.root,l=o(e=>e.baseUrl),d=o(e=>e.token),f=a(),[m,h]=(0,I.useState)(c),[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(!!c),[b,x]=(0,I.useState)(null),[S,C]=(0,I.useState)(()=>se(f,d.length===0)),w=(0,I.useRef)(0),T=(0,I.useRef)(null),E=(0,I.useRef)(!1),D=(0,I.useRef)(z()),k=g?.seed===c?g.graph:null,A=k?s.node&&k.jobs.has(s.node)?s.node:g?.defaultSelected??null:null,j=(0,I.useCallback)((e,t=!1)=>{n(t=>de(t,e,r),{replace:t})},[r,n]),N=(0,I.useCallback)(async e=>{let t=o.getState();if(t.baseUrl!==l||t.token!==d)return;T.current?.abort(),T.current=null;let n=++w.current,r=e.trim();if(_(null),x(null),!r)return y(!1);let i=M(r);if(i)return x(new O(i)),y(!1);let a=u(),s=z(),c=new AbortController;T.current=c;let f=()=>E.current&&n===w.current&&!c.signal.aborted&&s===z();y(!0);try{let e={target:a,signal:c.signal},t=await te(r,e),n=t.missingParent?[`Ancestor ${t.missingParent} is no longer available. The graph starts at the oldest surviving node.`]:[],i=await re(t.id,t.job,{...e,seedPath:t.path,limitations:n});if(!f())return;_({seed:r,graph:i,defaultSelected:t.id}),i.jobs.size>1&&C(e=>ce(a.baseUrl,e,{root:t.id,nodes:i.jobs.size,at:Date.now()},o.getState().token.length===0))}catch(e){f()&&x(e instanceof Error?e:Error(`Failed to load flow`))}finally{T.current===c&&(T.current=null),f()&&y(!1)}},[l,d]);return(0,I.useEffect)(()=>{E.current=!0,D.current=z();let e=o.subscribe(()=>{let e=z();e!==D.current&&(D.current=e,w.current+=1,T.current?.abort(),T.current=null,E.current&&(_(null),x(null),y(!1)))});return()=>{E.current=!1,e(),w.current+=1,T.current?.abort()}},[]),(0,I.useEffect)(()=>C(d?[]:se(f,!0)),[f,d]),(0,I.useEffect)(()=>{let e={...s};!k||e.node&&k.jobs.has(e.node)||(e.node=g?.defaultSelected??null);let t=L(e).toString();t!==i&&n(t,{replace:!0})},[k,i,n,g?.defaultSelected,s]),(0,I.useEffect)(()=>{h(c),N(c)},[c,N]),{input:m,setInput:h,rootParam:c,mode:s.mode,setMode:e=>j({mode:e}),graph:k,selected:A,setSelected:e=>{k?.jobs.has(e)&&j({node:e})},loading:v,error:b,recent:S,load:N,submit:e=>{e.preventDefault();let t=m.trim();if(t){if(M(t))return void N(t);t===c?N(t):j({root:t,mode:`explore`,node:null})}},openRecent:e=>{if(h(e),M(e))return void N(e);let t=e===c;j({root:e,mode:`explore`,node:null}),t&&N(e)}}}function z(){let{token:e}=o.getState();return JSON.stringify([a(),e])}function pe(e){return e instanceof l&&e.status===0||[`TypeError`,`AbortError`,`TimeoutError`].includes(e.name)}var B=e=>({method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),me=new Set([`removeChildDependency`,`removeUnprocessedChildren`,`removeDeduplicationKey`,`retry`,`promote`,`remove`]),he=e=>e+5e3,V={create:(e,t)=>d(`/flows/create?target=${encodeURIComponent(a())}`,B({operation:e,...t})),getFlow:e=>{let t=new URLSearchParams({id:e.id,queueName:e.queueName,target:a()});return e.depth!==void 0&&t.set(`depth`,String(e.depth)),e.maxChildren!==void 0&&t.set(`maxChildren`,String(e.maxChildren)),d(`/flows/tree?${t}`)},inspect:(e,t)=>d(`/flows/jobs/${encodeURIComponent(e.id)}/${t}?${new URLSearchParams({queueName:e.queueName,target:a()})}`),getParentResult:e=>d(`/flows/results?target=${encodeURIComponent(a())}`,B({operation:`getParentResult`,parentId:e})),getParentResults:e=>d(`/flows/results?target=${encodeURIComponent(a())}`,B({operation:`getParentResults`,parentIds:e})),waitUntilFinished:(e,t)=>d(`/flows/jobs/${encodeURIComponent(e.id)}/waitUntilFinished?${new URLSearchParams({queueName:e.queueName,target:a(),ttl:String(t)})}`,void 0,he(t)),mutate:(e,t,n)=>(S(t),d(`/flows/jobs/${encodeURIComponent(e.id)}/${t}?${new URLSearchParams({queueName:e.queueName,target:a()})}`,me.has(t)?{method:`POST`}:B(n??{})))},H=i();function U({value:e}){return(0,H.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-md border border-line bg-bg p-3 font-mono text-xs text-muted`,children:JSON.stringify(e,null,2)})}function W(...e){return JSON.stringify(e)}function G(e,t=`shared`){let n=y(),r=`flow-exclusive:${t}`,i=x(r),a=(0,I.useMemo)(()=>({key:e,connectionEpoch:n}),[n,e]),o=(0,I.useRef)(a),s=(0,I.useRef)(void 0),c=(0,I.useRef)(void 0),l=(0,I.useRef)(void 0),u=(0,I.useRef)(0),d=(0,I.useRef)(!0),[f,p]=(0,I.useState)(),[m,h]=(0,I.useState)(),[g,_]=(0,I.useState)();return(0,I.useLayoutEffect)(()=>{o.current.connectionEpoch!==a.connectionEpoch&&(c.current=void 0),o.current=a,s.current=void 0,l.current=void 0},[a]),(0,I.useEffect)(()=>(d.current=!0,()=>{d.current=!1,s.current=void 0,c.current=void 0,l.current=void 0}),[]),{busy:f?.exclusive&&f.identity.connectionEpoch===a.connectionEpoch||f?.identity===a?f.label:``,error:g?.identity===a?g.message:``,result:m?.identity===a?m.value:void 0,reject:e=>{c.current||b()!==a.connectionEpoch||(l.current=void 0,s.current=void 0,p(void 0),h(void 0),_({identity:a,message:e}))},run:async(e,t,n={})=>{let f=n.exclusive===!0;if(c.current||s.current?.identity===a||b()!==a.connectionEpoch)return;let m=i.begin(r);if(!m)return;f||m.finish();let g={id:++u.current,identity:a};f?c.current=g:s.current=g,l.current=g,p({...g,exclusive:f,label:e}),h(void 0),_(void 0);try{let e=await t();d.current&&o.current===a&&b()===a.connectionEpoch&&l.current===g&&h({identity:a,value:e})}catch(e){d.current&&o.current===a&&b()===a.connectionEpoch&&l.current===g&&_({identity:a,message:ge(e)})}finally{f&&m.finish(),c.current===g&&(c.current=void 0),s.current===g&&(s.current=void 0),d.current&&p(e=>e?.id===g.id?void 0:e)}}}}function ge(e){return e instanceof Error?e.message:String(e)}var K={add:{flow:{name:`aggregate`,queueName:`reports`,data:{},children:[{name:`fetch`,queueName:`io`,data:{source:`orders`}}]},options:{queuesOptions:{io:{attempts:3,backoff:1e3}}}},addBulk:{flows:[{name:`report-a`,queueName:`reports`,data:{region:`eu`}},{name:`report-b`,queueName:`reports`,data:{region:`us`}}]},addChain:{steps:[{name:`extract`,queueName:`pipeline`,data:{}},{name:`transform`,queueName:`pipeline`,data:{}},{name:`load`,queueName:`pipeline`,data:{}}]},addBulkThen:{parallel:[{name:`part-a`,queueName:`parallel`,data:{}},{name:`part-b`,queueName:`parallel`,data:{}}],final:{name:`merge`,queueName:`final`,data:{}}},addTree:{root:{name:`root`,queueName:`tree`,data:{},children:[{name:`child`,queueName:`tree`,data:{}}]}}};function _e({repository:e=V,onOpen:t}){let[n,r]=(0,I.useState)(`add`),[i,a]=(0,I.useState)(()=>JSON.stringify(K.add,null,2)),o=G(W(n,i),`creator`),s=!!o.busy,c=e=>{r(e),a(JSON.stringify(K[e],null,2))},l=async t=>{t.preventDefault();let r;try{r=JSON.parse(i)}catch{return o.reject(`The definition must be valid JSON.`)}if(!r||typeof r!=`object`||Array.isArray(r))return o.reject(`The definition must be a JSON object.`);let a=n;await o.run(a,()=>e.create(a,r),{exclusive:!0})},u=ve(o.result);return(0,H.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(300px,0.7fr)]`,children:[(0,H.jsxs)(`form`,{onSubmit:l,className:`rounded-lg border border-line bg-surface p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,H.jsxs)(`label`,{className:`text-xs text-faint`,children:[`FlowProducer method`,(0,H.jsx)(`select`,{"aria-label":`FlowProducer method`,value:n,onChange:e=>c(e.target.value),className:`mt-1 block h-9 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`,children:Object.keys(K).map(e=>(0,H.jsx)(`option`,{children:e},e))})]}),(0,H.jsx)(`button`,{type:`submit`,disabled:s,className:`rounded-lg bg-accent px-4 py-2 text-sm font-medium text-accent-fg disabled:opacity-50`,children:s?`Creating…`:`Run ${n}`})]}),(0,H.jsxs)(`label`,{className:`mt-4 block text-xs text-faint`,children:[`Definition`,(0,H.jsx)(`textarea`,{"aria-label":`Flow definition JSON`,spellCheck:!1,value:i,onChange:e=>a(e.target.value),className:`mt-1 min-h-80 w-full resize-y rounded-lg border border-line bg-bg p-3 font-mono text-xs text-fg outline-none focus:ring-2 focus:ring-accent/50`})]})]}),(0,H.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-4`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Atomic commit result`}),(0,H.jsx)(`p`,{className:`mt-1 mb-4 text-xs text-faint`,children:`Validation is performed by Bunqueue before the graph is committed.`}),o.error&&(0,H.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-danger`,children:o.error}),o.result===void 0?(0,H.jsx)(`p`,{className:`text-sm text-muted`,children:`No flow created in this session.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(U,{value:o.result}),u&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>t(u),className:`mt-3 rounded-lg border border-line px-3 py-2 text-xs text-fg`,children:`Open created flow`})]})]})]})}function ve(e){let t=e,n=t?.result?.root?.id??t?.result?.roots?.[0]?.id??t?.result?.finalId??t?.result?.jobIds?.at(-1);return typeof n==`string`?n:null}function ye({recent:e,onOpen:t}){return(0,H.jsx)(_,{children:(0,H.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted`,children:`No flow loaded.`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`Enter a job ID, or choose “View flow” from Job Inspector.`}),e.length>0&&(0,H.jsxs)(`div`,{className:`mt-6`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Recently viewed`}),(0,H.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:e.map(e=>(0,H.jsxs)(`button`,{type:`button`,title:e.root,onClick:()=>t(e.root),className:`min-h-10 rounded-lg border border-line bg-surface-2 px-3 py-1.5 font-mono text-xs text-muted hover:text-fg`,children:[(0,H.jsx)(`span`,{translate:`no`,children:D(e.root)}),(0,H.jsxs)(`span`,{className:`ml-2 text-faint`,children:[e.nodes,` nodes`]})]},e.root))})]})]})})}function q({target:e,onChange:t}){return(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,H.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Job ID`,(0,H.jsx)(`input`,{"aria-label":`Flow job ID`,value:e.id,onChange:n=>t({...e,id:n.target.value}),className:`mt-1 h-9 w-full rounded-lg border border-line bg-surface-2 px-3 font-mono text-sm text-fg`})]}),(0,H.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Queue name`,(0,H.jsx)(`input`,{"aria-label":`Flow queue name`,value:e.queueName,onChange:n=>t({...e,queueName:n.target.value}),className:`mt-1 h-9 w-full rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`})]})]})}var be=[`getChildrenValues`,`getDependencies`,`getDependenciesCount`,`getFailedChildrenValues`,`getIgnoredChildrenFailures`],xe=[{id:`removeChildDependency`,label:`Release dependency`,dangerous:!0},{id:`removeUnprocessedChildren`,label:`Remove unprocessed children`,dangerous:!0},{id:`retry`,label:`Retry job`},{id:`promote`,label:`Promote delayed job`},{id:`remove`,label:`Remove job`,dangerous:!0}];function Se({repository:e=V,initialTarget:t={id:``,queueName:``},target:n,onTargetChange:r,showTarget:i=!0}){let[a,o]=(0,I.useState)(t),s=n??a,c=r??o,l=G(W(s.id,s.queueName),`dependency-console`),u=l.busy,d=!!(s.id.trim()&&s.queueName.trim()),f=t=>{let n=Ce(s);l.run(t,()=>e.inspect(n,t))},p=t=>{let n=C(t);if(n)return l.reject(n);let r=Ce(s);window.confirm(`${t} on ${r.id} in ${r.queueName}? This changes durable queue state and has no compare-and-swap precondition.`)&&l.run(t,()=>e.mutate(r,t),{exclusive:!0})};return(0,H.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(360px,0.8fr)_minmax(0,1.2fr)]`,children:[(0,H.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-4`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Dependency control`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`Run the official Flow Job dependency methods against the managed server TCP endpoint.`}),i&&(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(q,{target:s,onChange:c})}),(0,H.jsx)(`p`,{className:`mt-3 text-xs text-muted`,children:`Payload replacement, retry and removal are unavailable because they can damage flow dependencies or restart active work.`}),(0,H.jsx)(`h3`,{className:`mt-5 mb-2 text-[10px] font-semibold uppercase tracking-wider text-faint`,children:`Inspect`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:be.map(e=>(0,H.jsx)(`button`,{type:`button`,disabled:!d||!!u,onClick:()=>f(e),className:`rounded-md border border-line px-2.5 py-1.5 font-mono text-[11px] text-muted disabled:opacity-40`,children:e},e))}),(0,H.jsx)(`h3`,{className:`mt-5 mb-2 text-[10px] font-semibold uppercase tracking-wider text-faint`,children:`Mutate`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:xe.map(e=>(0,H.jsx)(`button`,{type:`button`,disabled:!d||!!u||!!C(e.id),title:C(e.id)??void 0,onClick:()=>p(e.id),className:e.dangerous?`rounded-md border border-danger/40 px-2.5 py-1.5 text-xs text-danger disabled:opacity-40`:`rounded-md border border-line px-2.5 py-1.5 text-xs text-muted disabled:opacity-40`,children:e.label},e.id))})]}),(0,H.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-4`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Operation result`}),(0,H.jsx)(`p`,{className:`mt-1 mb-4 text-xs text-faint`,children:u?`Running ${u}…`:`The last authoritative broker response appears here.`}),l.error&&(0,H.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-danger`,children:l.error}),l.result===void 0?(0,H.jsx)(`p`,{className:`text-sm text-muted`,children:`Choose an inspection or mutation.`}):(0,H.jsx)(U,{value:l.result})]})]})}var Ce=e=>({id:e.id.trim(),queueName:e.queueName.trim()});function we({repository:e=V,initialIds:t=``}){let[n,r]=(0,I.useState)(t),i=G(W(n)),a=i.busy,o=Te(n),s=async t=>{if(o.length===0)return;let n=[...o];await i.run(t,async()=>t===`one`?await e.getParentResult(n[0]):await e.getParentResults(n))};return(0,H.jsxs)(`section`,{className:`grid gap-5 rounded-lg border border-line bg-surface p-4 xl:grid-cols-[minmax(320px,0.8fr)_minmax(0,1.2fr)]`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Parent results`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`Resolve completed parent values through the official FlowProducer result API.`}),(0,H.jsxs)(`label`,{className:`mt-4 block text-xs text-faint`,children:[`Parent IDs, one per line`,(0,H.jsx)(`textarea`,{"aria-label":`Flow parent IDs`,value:n,onChange:e=>r(e.target.value),placeholder:`parent-job-id
2
- another-parent-id`,className:`mt-1 min-h-28 w-full resize-y rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs text-fg`})]}),(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:o.length===0||!!a,onClick:()=>void s(`one`),className:`rounded-md border border-line px-3 py-1.5 font-mono text-xs text-muted disabled:opacity-40`,children:`getParentResult`}),(0,H.jsxs)(`button`,{type:`button`,disabled:o.length===0||!!a,onClick:()=>void s(`many`),className:`rounded-md border border-line px-3 py-1.5 font-mono text-xs text-muted disabled:opacity-40`,children:[`getParentResults (`,o.length,`)`]})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:`Resolved values`}),(0,H.jsx)(`p`,{className:`mt-1 mb-4 text-xs text-faint`,children:a?`Reading durable results…`:`Falsy values and input ordering are preserved.`}),i.error&&(0,H.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-danger`,children:i.error}),i.result===void 0?(0,H.jsx)(`p`,{className:`text-sm text-muted`,children:`No parent result requested.`}):(0,H.jsx)(U,{value:i.result})]})]})}function Te(e){return e.split(/[,\n]/).map(e=>e.trim()).filter(Boolean).slice(0,1e3)}function Ee({repository:e=V,target:t,onTargetChange:n}){let[r,i]=(0,I.useState)(`10`),[a,o]=(0,I.useState)(`100`),s=G(W(t.id,t.queueName,r,a)),c=!!s.busy,l=!!(t.id.trim()&&t.queueName.trim())&&je(r)&&je(a),u=async()=>{if(!l)return;let n={target:{id:t.id.trim(),queueName:t.queueName.trim()},depth:Number(r),maxChildren:Number(a)};await s.run(`getFlow`,async()=>{let t=await e.getFlow({...n.target,depth:n.depth,maxChildren:n.maxChildren});return{...n,value:t}})};return(0,H.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`FlowProducer.getFlow`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`Read the broker-native tree with explicit traversal limits. Results are bound to the target and limits that produced them.`})]}),(0,H.jsx)(`button`,{type:`button`,disabled:!l||c,onClick:()=>void u(),className:`rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:c?`Loading tree...`:`Load getFlow tree`})]}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(q,{target:t,onChange:n})}),(0,H.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)(De,{label:`Depth`,value:r,onChange:i}),(0,H.jsx)(De,{label:`Children per level`,value:a,onChange:o})]}),(0,H.jsx)(`p`,{className:`mt-2 text-[11px] text-faint`,children:`Both limits accept integers from 0 to 500.`}),s.error&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:s.error}),s.result&&(0,H.jsx)(Oe,{loaded:s.result})]})}function De({label:e,value:t,onChange:n}){return(0,H.jsxs)(`label`,{className:`text-xs text-faint`,children:[e,(0,H.jsx)(`input`,{"aria-label":`getFlow ${e}`,type:`number`,min:`0`,max:`500`,step:`1`,value:t,onChange:e=>n(e.target.value),className:`mt-1 h-9 w-full rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`})]})}function Oe({loaded:e}){let t=ke(e.value),n=t?Ae(t):[];return(0,H.jsxs)(`div`,{className:`mt-4 border-t border-line pt-4`,"aria-live":`polite`,children:[(0,H.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2 text-xs`,children:[(0,H.jsxs)(`span`,{className:`font-mono text-fg`,children:[e.target.queueName,`/`,e.target.id]}),(0,H.jsxs)(`span`,{className:`text-faint`,children:[`depth `,e.depth,`, max children `,e.maxChildren]})]}),t===null?(0,H.jsx)(`p`,{className:`rounded-md border border-line bg-bg p-3 text-sm text-muted`,children:`Bunqueue returned no flow for this target.`}):n.length>0?(0,H.jsx)(`ul`,{"aria-label":`getFlow tree result`,className:`max-h-72 overflow-auto rounded-md border border-line bg-bg`,children:n.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-max items-center gap-2 border-b border-line/60 px-3 py-2 last:border-b-0`,style:{paddingLeft:`${12+Math.min(e.level,20)*18}px`},children:[(0,H.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] ${E(e.state)}`,children:e.state}),(0,H.jsx)(`span`,{className:`font-mono text-xs text-fg`,children:e.id}),(0,H.jsx)(`span`,{className:`text-xs text-muted`,children:e.name}),(0,H.jsx)(`span`,{className:`text-[11px] text-faint`,children:e.queueName})]},e.id))}):(0,H.jsx)(`p`,{role:`alert`,className:`rounded-md border border-warning/40 p-3 text-sm text-warning`,children:`The agent returned an unrecognized getFlow payload. Inspect the raw JSON below.`}),(0,H.jsxs)(`details`,{className:`mt-3`,open:!0,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted`,children:`Raw getFlow JSON`}),(0,H.jsx)(`div`,{className:`mt-2`,children:(0,H.jsx)(U,{value:e.value})})]})]})}function ke(e){let t=J(e),n=J(t?.result)??t;if(n&&Object.hasOwn(n,`flow`))return n.flow===null?null:J(n.flow)}function Ae(e){let t=[],n=[{node:e,level:0}],r=new WeakSet;for(;n.length>0&&t.length<1e3;){let e=n.shift();if(!e||r.has(e.node))continue;r.add(e.node),t.push({id:Y(e.node.id,`(missing id)`),name:Y(e.node.name,`(unnamed)`),queueName:Y(e.node.queueName,`(missing queue)`),state:Y(e.node.state,`unknown`),level:e.level});let i=Array.isArray(e.node.children)?e.node.children:[];n.unshift(...i.map(J).filter(e=>e!==void 0).map(t=>({node:t,level:e.level+1})))}return t}var je=e=>/^\d+$/.test(e)&&Number(e)<=500,J=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:void 0,Y=(e,t)=>typeof e==`string`&&e.length>0?e:t,Me=[`getState`,`isWaiting`,`isActive`,`isDelayed`,`isCompleted`,`isFailed`,`isWaitingChildren`,`toJSON`,`asJSON`],X={updateData:{data:{}},updateProgress:{progress:50,message:`Halfway`},log:{message:`Operator note`},changeDelay:{delay:1e3},changePriority:{priority:1,lifo:!1},clearLogs:{keepLogs:0},removeDeduplicationKey:{}},Ne={progress:{stage:`hydrate`,completed:4,total:10}};function Pe({repository:e=V,initialTarget:t={id:``,queueName:``}}){let[n,r]=(0,I.useState)(t),[i,a]=(0,I.useState)(`updateProgress`),[o,s]=(0,I.useState)(JSON.stringify(X.updateProgress,null,2)),[c,l]=(0,I.useState)(`30000`),u=G(W(n.id,n.queueName,i,o,c),`job-toolkit`),d=u.busy,f=!!(n.id.trim()&&n.queueName.trim()),p=e=>{a(e),s(JSON.stringify(X[e],null,2))};return(0,H.jsxs)(`div`,{className:`space-y-5`,children:[(0,H.jsx)(Ee,{repository:e,target:n,onTargetChange:r}),(0,H.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Flow Job methods`}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`State predicates, serialization, bounded waiting, and durable mutations from Bunqueue 2.9.4.`})]}),d&&(0,H.jsxs)(`span`,{className:`font-mono text-xs text-accent`,children:[d,`…`]})]}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(q,{target:n,onChange:r})}),(0,H.jsx)(`p`,{className:`mt-3 text-xs text-muted`,children:`Payload replacement, retry and removal are unavailable because they can damage flow dependencies or restart active work.`}),(0,H.jsx)(`h3`,{className:`mt-5 mb-2 text-[10px] font-semibold uppercase tracking-wider text-faint`,children:`Inspect state and wire JSON`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Me.map(t=>(0,H.jsx)(`button`,{type:`button`,disabled:!f||!!d,onClick:()=>{let r=Z(n);u.run(t,()=>e.inspect(r,t))},className:`rounded-md border border-line px-2.5 py-1.5 font-mono text-[11px] text-muted disabled:opacity-40`,children:t},t))}),(0,H.jsxs)(`div`,{className:`mt-5 grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(300px,0.7fr)]`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,H.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Mutation`,(0,H.jsx)(`select`,{"aria-label":`Flow Job mutation`,value:i,onChange:e=>p(e.target.value),className:`mt-1 block h-9 rounded-lg border border-line bg-surface-2 px-3 font-mono text-xs text-fg`,children:Object.keys(X).map(e=>(0,H.jsx)(`option`,{disabled:!!C(e),children:e},e))})]}),(0,H.jsx)(`button`,{type:`button`,disabled:!f||!!d||!!C(i),title:C(i)??void 0,onClick:()=>{let t=C(i);if(t)return u.reject(t);let r;try{r=JSON.parse(o)}catch{return u.reject(`Mutation payload must be valid JSON.`)}if(!r||typeof r!=`object`||Array.isArray(r))return u.reject(`Mutation payload must be a JSON object.`);let a=Z(n),s=i;window.confirm(`${s} on ${a.id}? This writes durable job state without a compare-and-swap precondition.`)&&u.run(s,()=>e.mutate(a,s,r),{exclusive:!0})},className:`h-9 rounded-md border border-warning/40 px-3 text-xs text-warning disabled:opacity-40`,children:`Apply mutation`}),i===`updateProgress`&&(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(JSON.stringify(X.updateProgress,null,2)),className:`h-9 rounded-md border border-line px-3 text-xs text-muted`,children:`Numeric progress`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(JSON.stringify(Ne,null,2)),className:`h-9 rounded-md border border-line px-3 text-xs text-muted`,children:`Object progress`})]})]}),(0,H.jsx)(`textarea`,{"aria-label":`Flow Job mutation JSON`,value:o,onChange:e=>s(e.target.value),className:`mt-3 min-h-32 w-full resize-y rounded-lg border border-line bg-bg p-3 font-mono text-xs text-fg`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`label`,{className:`text-xs text-faint`,children:[`waitUntilFinished TTL (ms)`,(0,H.jsx)(`input`,{"aria-label":`Flow wait TTL`,type:`number`,min:`1`,max:`60000`,value:c,onChange:e=>l(e.target.value),className:`mt-1 block h-9 w-full rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`})]}),(0,H.jsx)(`button`,{type:`button`,disabled:!f||!!d||!Fe(c),onClick:()=>{let t=Z(n),r=Number(c);u.run(`waitUntilFinished`,()=>e.waitUntilFinished(t,r))},className:`mt-3 rounded-md border border-line px-3 py-2 font-mono text-xs text-muted disabled:opacity-40`,children:`waitUntilFinished`}),(0,H.jsx)(`p`,{className:`mt-3 text-[11px] leading-5 text-faint`,children:`Lease-only methods are not forged here: extendLock and worker state transitions require the active worker token; discard is process-local and non-awaitable.`})]})]}),u.error&&(0,H.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:u.error}),u.result!==void 0&&(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(U,{value:u.result})})]}),(0,H.jsx)(Se,{repository:e,target:n,onTargetChange:r,showTarget:!1}),(0,H.jsx)(we,{repository:e})]})}var Z=e=>({id:e.id.trim(),queueName:e.queueName.trim()}),Fe=e=>Number.isSafeInteger(Number(e))&&Number(e)>=1&&Number(e)<=6e4;function Ie({input:e,loading:t,onInput:n,onSubmit:r}){return(0,H.jsxs)(_,{className:`mb-6`,children:[(0,H.jsxs)(`form`,{onSubmit:r,className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(`input`,{name:`flow-job-id`,autoComplete:`off`,spellCheck:!1,maxLength:1024,value:e,onChange:e=>n(e.target.value),placeholder:`Flow job ID`,"aria-label":`Root job ID`,"aria-describedby":`flow-input-help`,className:`min-w-0 flex-1 rounded-lg border border-line bg-surface-2 px-3 py-2 font-mono text-sm text-fg outline-none placeholder:text-faint focus-visible:ring-2 focus-visible:ring-accent/50`}),(0,H.jsx)(`button`,{type:`submit`,disabled:t||!e.trim(),className:`rounded-lg bg-accent px-4 py-2 text-sm font-medium text-accent-fg disabled:opacity-50`,children:t?`Loading…`:`Load Flow`})]}),(0,H.jsxs)(`p`,{id:`flow-input-help`,className:`mt-2 text-xs text-faint`,children:[`Start from any surviving structural node. Bunqueue 2.9.3 flow topology is resolved from durable parent, children, and dependency contracts. Up to `,500,` nodes are rendered.`]})]})}var Le={nodeWidth:168,nodeHeight:60,colGap:72,rowGap:20,padding:24};function Re(e,t){let n=new Map,r=new Map;for(let t of e)n.set(t,0),r.set(t,[]);for(let e of t)n.has(e.from)&&n.has(e.to)&&e.from!==e.to&&r.get(e.from)?.push(e.to);let i=ze(e,r),a=new Map;for(let t of e)a.set(t,0);for(let e of i.values())for(let t of e)a.set(t,(a.get(t)??0)+1);let o=[...n.keys()].filter(e=>(a.get(e)??0)===0);for(let e=0;e<o.length;e++){let t=o[e];for(let e of i.get(t)??[]){n.set(e,Math.max(n.get(e)??0,(n.get(t)??0)+1));let r=(a.get(e)??0)-1;a.set(e,r),r===0&&o.push(e)}}return n}function ze(e,t){let n=new Map;for(let t of e)n.set(t,[]);let r=new Set,i=new Set;for(let a of e){if(i.has(a))continue;i.add(a),r.add(a);let e=[{id:a,next:0}];for(;e.length;){let a=e[e.length-1],o=t.get(a.id)??[];if(a.next>=o.length){r.delete(a.id),e.pop();continue}let s=o[a.next++];r.has(s)||(n.get(a.id)?.push(s),!i.has(s)&&(i.add(s),r.add(s),e.push({id:s,next:0})))}}return n}function Be(e,t,n={}){let r={...Le,...n},i=Re(e,t),a=new Map,o=0;for(let t of e){let e=i.get(t)??0;o=Math.max(o,e);let n=a.get(e);n?n.push(t):a.set(e,[t])}let s=0;for(let e of a.values())s=Math.max(s,e.length);let c=s*r.nodeHeight+Math.max(0,s-1)*r.rowGap,l=[];for(let e=0;e<=o;e++){let t=a.get(e)??[],n=t.length*r.nodeHeight+Math.max(0,t.length-1)*r.rowGap,i=r.padding+(c-n)/2;t.forEach((t,n)=>{l.push({id:t,layer:e,x:r.padding+e*(r.nodeWidth+r.colGap),y:i+n*(r.nodeHeight+r.rowGap)})})}return{nodes:l,width:r.padding*2+(o+1)*r.nodeWidth+o*r.colGap,height:r.padding*2+c}}function Ve({graph:e,layout:t,selected:n,onSelect:r}){let i=new Map(t.nodes.map(e=>[e.id,e]));return(0,H.jsxs)(_,{padded:!1,className:`max-h-[70vh] overflow-auto overscroll-contain p-4`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Flow Graph`}),(0,H.jsx)(`ul`,{className:`sr-only`,"aria-label":`Flow relationships`,children:e.edges.map(e=>(0,H.jsx)(`li`,{children:e.kind===`child`?`${e.from} has child ${e.to}`:`${e.to} depends on ${e.from}`},`accessible-${e.from}-${e.to}-${e.kind}`))}),(0,H.jsxs)(`div`,{className:`relative`,style:{width:t.width,height:t.height},children:[(0,H.jsxs)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 text-line`,width:t.width,height:t.height,children:[(0,H.jsxs)(`defs`,{children:[(0,H.jsx)(`marker`,{id:`flow-arrow-child`,markerWidth:`6`,markerHeight:`6`,refX:`5`,refY:`3`,orient:`auto`,children:(0,H.jsx)(`path`,{d:`M0,0 L6,3 L0,6 Z`,fill:`currentColor`})}),(0,H.jsx)(`marker`,{id:`flow-arrow-dependency`,markerWidth:`6`,markerHeight:`6`,refX:`5`,refY:`3`,orient:`auto`,children:(0,H.jsx)(`path`,{d:`M0,0 L6,3 L0,6 Z`,fill:`currentColor`})})]}),e.edges.map(e=>{let t=i.get(e.from),n=i.get(e.to);return!t||!n?null:(0,H.jsx)(`path`,{d:Ue(t,n),fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeDasharray:e.kind===`depends`?`4 4`:void 0,markerEnd:`url(#flow-arrow-${e.kind===`depends`?`dependency`:`child`})`,opacity:.5},`${e.from}-${e.to}-${e.kind}`)})]}),t.nodes.map(t=>{let i=e.jobs.get(t.id),a=e.failures.has(t.id)?`unavailable`:i?.state??`unknown`;return(0,H.jsxs)(`button`,{type:`button`,"data-flow-node":t.id,onClick:()=>r(t.id),"aria-pressed":n===t.id,"aria-label":`${t.id}, queue ${i?.queue??`unknown`}, state ${a}`,title:t.id,style:{left:t.x,top:t.y,width:168,height:60},className:c(`absolute flex flex-col justify-center gap-0.5 rounded-lg border px-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/70`,E(i?.state),n===t.id&&`ring-2 ring-accent`),children:[(0,H.jsx)(`span`,{translate:`no`,className:`truncate font-mono text-xs text-fg`,children:D(t.id)}),(0,H.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[11px]`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:i?.queue??`—`}),(0,H.jsx)(`span`,{className:`font-medium`,children:a})]})]},t.id)})]})]})}function He(e,t,n,r){let i=(e+n)/2;return`M${e},${t} C${i},${t} ${i},${r} ${n},${r}`}function Ue(e,t){return e.x<=t.x?He(e.x+168,e.y+30,t.x,t.y+30):He(e.x,e.y+30,t.x+168,t.y+30)}function We({graph:e,selected:t}){let n=t?e.jobs.get(t):void 0,r=t?e.failures.get(t):void 0;return(0,H.jsx)(`aside`,{"aria-label":`Selected job details`,"aria-live":`polite`,children:(0,H.jsxs)(_,{children:[n?(0,H.jsx)(Ge,{job:n,failure:r}):(0,H.jsx)(`p`,{className:`text-sm text-muted`,children:`Select a node to inspect it.`}),(0,H.jsx)(Ke,{graph:e})]})})}function Ge({job:e,failure:t}){return(0,H.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-xs text-faint`,children:`Job`}),(0,H.jsx)(`div`,{translate:`no`,className:`break-all font-mono text-xs text-fg`,children:e.id})]}),t&&(0,H.jsxs)(`p`,{role:`alert`,className:`break-words text-xs text-warning`,children:[`Snapshot unavailable: `,t]}),(0,H.jsx)($,{label:`Queue`,value:e.queue??`—`}),(0,H.jsx)($,{label:`State`,value:t?`unavailable`:e.state??`unknown`}),(0,H.jsx)($,{label:`Priority`,value:e.priority===void 0?`—`:String(e.priority)}),(0,H.jsx)($,{label:`Parent`,value:e.parentId??`—`}),(0,H.jsx)($,{label:`Children`,value:t?`—`:String(e.childrenIds?.length??0)}),(0,H.jsx)($,{label:`Depends on`,value:t?`—`:String(e.dependsOn?.length??0)}),(0,H.jsx)(r,{to:`/job?id=${encodeURIComponent(e.id)}`,className:`inline-block rounded-lg border border-line px-3 py-1.5 text-xs text-muted hover:bg-surface-2 hover:text-fg`,children:`Open in Job Inspector`})]})}function Ke({graph:e}){return(0,H.jsxs)(`div`,{className:`mt-4 border-t border-line pt-3 text-xs text-faint`,"aria-live":`polite`,children:[e.truncated&&(0,H.jsxs)(`div`,{className:`mb-1 text-warning`,children:[`Graph truncated at `,500,` nodes / depth `,100,`.`]}),(0,H.jsx)(Q,{label:`known snapshot limitation`,pluralLabel:`known snapshot limitations`,values:e.limitations,tone:`text-warning`}),(0,H.jsx)(Q,{label:`unavailable node`,pluralLabel:`unavailable nodes`,values:[...e.failures].map(([e,t])=>`${e}: ${t}`),tone:`text-warning`}),e.cycle&&(0,H.jsxs)(`div`,{className:`mb-1 break-words text-danger`,children:[`Dependency cycle: `,(0,H.jsx)(`span`,{className:`font-mono`,children:e.cycle.join(` → `)})]}),(0,H.jsx)(Q,{label:`snapshot inconsistency`,pluralLabel:`snapshot inconsistencies`,values:e.issues,tone:`text-warning`}),e.policyNotes.length>0&&(0,H.jsx)(`p`,{className:`mb-1 text-muted`,children:`Failure-policy notes are informational; the HTTP snapshot cannot prove that a policy fired.`}),(0,H.jsx)(Q,{label:`failure-policy ambiguity`,pluralLabel:`failure-policy ambiguities`,values:e.policyNotes,tone:`text-muted`}),(0,H.jsxs)(`div`,{className:`mb-1`,children:[e.jobs.size,` nodes · `,e.edges.length,` edges`]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`inline-block h-px w-4 bg-current`}),` child`]}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`inline-block h-px w-4 border-t border-dashed border-current`}),` depends`]})]})]})}function Q({label:e,pluralLabel:t,values:n,tone:r}){return n.length?(0,H.jsxs)(`details`,{className:`mb-1 ${r}`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer`,children:[n.length,` `,n.length===1?e:t]}),(0,H.jsx)(`ul`,{className:`mt-1 space-y-1 pl-3`,children:n.map(e=>(0,H.jsx)(`li`,{className:`break-words`,children:e},e))})]}):null}function $({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-faint`,children:e}),(0,H.jsx)(`span`,{className:`min-w-0 break-all text-right text-fg`,children:t})]})}function qe({graph:e,selected:t,onSelect:n}){let r=(0,I.useMemo)(()=>Be([...e.jobs.keys()],e.edges,w),[e]);return(0,H.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,H.jsx)(Ve,{graph:e,layout:r,selected:t,onSelect:n}),(0,H.jsx)(We,{graph:e,selected:t})]})}function Je(){let e=fe();return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(h,{title:`Job Flows`,description:`Inspect Bunqueue 2.9.3 parent, child, and dependency topology as an operational DAG.`,actions:e.graph&&(0,H.jsx)(`button`,{type:`button`,disabled:e.loading,onClick:()=>void e.load(e.rootParam),className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg disabled:opacity-50`,children:`Refresh`})}),(0,H.jsx)(`nav`,{"aria-label":`Job Flow tools`,className:`mb-5 flex border-b border-line`,children:[`explore`,`create`,`operations`].map(t=>(0,H.jsx)(`button`,{type:`button`,"aria-pressed":e.mode===t,onClick:()=>e.setMode(t),className:e.mode===t?`border-b-2 border-accent px-4 py-2 text-sm capitalize text-fg`:`border-b-2 border-transparent px-4 py-2 text-sm capitalize text-faint hover:text-fg`,children:t===`operations`?`Job methods`:t},t))}),e.mode===`create`&&(0,H.jsx)(_e,{onOpen:e.openRecent}),e.mode===`operations`&&(0,H.jsx)(Pe,{initialTarget:p()?{id:`flow-order-9a3f`,queueName:`orders`}:void 0}),e.mode===`explore`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ie,{input:e.input,loading:e.loading,onInput:e.setInput,onSubmit:e.submit}),(0,H.jsxs)(`div`,{"aria-live":`polite`,children:[e.error&&(pe(e.error)?(0,H.jsx)(m,{message:`Could not load the flow — ${e.error.message}`,onRetry:()=>void e.load(e.rootParam)}):(0,H.jsx)(g,{error:e.error,onRetry:()=>void e.load(e.rootParam)})),e.loading&&(0,H.jsx)(v,{label:`Loading flow…`})]}),!e.loading&&!e.graph&&!e.error&&(0,H.jsx)(ye,{recent:e.recent,onOpen:e.openRecent}),e.graph&&(0,H.jsx)(qe,{graph:e.graph,selected:e.selected,onSelect:e.setSelected})]})]})}export{Je as Flows};