@venizia/vulcan 0.4.9-5 → 0.4.9-6

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.
@@ -0,0 +1,4697 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Board</title>
7
+ <style>
8
+ /* One screen: a top bar, then tabs. Luồng = flow list (left) + flow detail (right). Venizia tokens; bronze is the one data hue. */
9
+ :root {
10
+ --font: 'Inter Display','Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
11
+ --mono: 'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
12
+ --r: 4px;
13
+ --gap: 8px;
14
+ --bar: 56px;
15
+ --ease-out: cubic-bezier(.22,1,.36,1);
16
+ --ground: #f5f5f5;
17
+ --bg: #ffffff;
18
+ --head: #fafafa;
19
+ --soft: #f2f2f2;
20
+ --sunk: #f7f7f7;
21
+ --line: #0000001a;
22
+ --line-2: #00000033;
23
+ --ink: #000000;
24
+ --body: #4b4b4b;
25
+ --muted: #6b6b6b;
26
+ --accent: #8a5a20;
27
+ --accent-soft: #f5ecdf;
28
+ --accent-ink: #ffffff;
29
+ --fail: #b42318;
30
+ --fail-soft: #fdecea;
31
+ --ok: #067647;
32
+ --ok-soft: #e7f5ee;
33
+ --wait: #8a4b00;
34
+ --wait-soft: #fdf1dc;
35
+ --focus: #8a5a20;
36
+ color-scheme: light;
37
+ --stroke-strong: #101010;
38
+ --t-p0: #ececef;
39
+ --t-p1: #fbe1d8;
40
+ --t-p2: #f7e9c6;
41
+ --t-p3: #f1e3cf;
42
+ --t-p4: #d9efe9;
43
+ --t-other: #ededed;
44
+ --face-ink: #18181b;
45
+ --face-line: #00000040;
46
+ --cheek: #e8a8a0;
47
+ }
48
+ @media (prefers-color-scheme: dark) {
49
+ :root:not([data-theme='light']):not([data-board-theme='light']) {
50
+ --ground: #121214;
51
+ --bg: #1b1b1b;
52
+ --head: #202024;
53
+ --soft: #26262b;
54
+ --sunk: #232327;
55
+ --line: #ffffff1a;
56
+ --line-2: #ffffff33;
57
+ --ink: #ffffff;
58
+ --body: #ffffffb3;
59
+ --muted: #ffffff8c;
60
+ --accent: #dead6a;
61
+ --accent-soft: #33281a;
62
+ --accent-ink: #1a1200;
63
+ --fail: #f97066;
64
+ --fail-soft: #3a1d1a;
65
+ --ok: #47cd89;
66
+ --ok-soft: #14291f;
67
+ --wait: #fdb022;
68
+ --wait-soft: #33270f;
69
+ --focus: #dead6a;
70
+ color-scheme: dark;
71
+ --stroke-strong: #ffffff4d;
72
+ --t-p0: #3a3a40;
73
+ --t-p1: #4f2c23;
74
+ --t-p2: #4a3c1c;
75
+ --t-p3: #4a3a25;
76
+ --t-p4: #1f3d37;
77
+ --t-other: #333336;
78
+ --face-ink: #f4f4f5;
79
+ --face-line: #ffffff4d;
80
+ --cheek: #b8706a;
81
+ }
82
+ }
83
+ :root[data-theme='dark'] {
84
+ --ground: #121214;
85
+ --bg: #1b1b1b;
86
+ --head: #202024;
87
+ --soft: #26262b;
88
+ --sunk: #232327;
89
+ --line: #ffffff1a;
90
+ --line-2: #ffffff33;
91
+ --ink: #ffffff;
92
+ --body: #ffffffb3;
93
+ --muted: #ffffff8c;
94
+ --accent: #dead6a;
95
+ --accent-soft: #33281a;
96
+ --accent-ink: #1a1200;
97
+ --fail: #f97066;
98
+ --fail-soft: #3a1d1a;
99
+ --ok: #47cd89;
100
+ --ok-soft: #14291f;
101
+ --wait: #fdb022;
102
+ --wait-soft: #33270f;
103
+ --focus: #dead6a;
104
+ color-scheme: dark;
105
+ --stroke-strong: #ffffff4d;
106
+ --t-p0: #3a3a40;
107
+ --t-p1: #4f2c23;
108
+ --t-p2: #4a3c1c;
109
+ --t-p3: #4a3a25;
110
+ --t-p4: #1f3d37;
111
+ --t-other: #333336;
112
+ --face-ink: #f4f4f5;
113
+ --face-line: #ffffff4d;
114
+ --cheek: #b8706a;
115
+ }
116
+ :root[data-board-theme='dark'] {
117
+ --ground: #121214;
118
+ --bg: #1b1b1b;
119
+ --head: #202024;
120
+ --soft: #26262b;
121
+ --sunk: #232327;
122
+ --line: #ffffff1a;
123
+ --line-2: #ffffff33;
124
+ --ink: #ffffff;
125
+ --body: #ffffffb3;
126
+ --muted: #ffffff8c;
127
+ --accent: #dead6a;
128
+ --accent-soft: #33281a;
129
+ --accent-ink: #1a1200;
130
+ --fail: #f97066;
131
+ --fail-soft: #3a1d1a;
132
+ --ok: #47cd89;
133
+ --ok-soft: #14291f;
134
+ --wait: #fdb022;
135
+ --wait-soft: #33270f;
136
+ --focus: #dead6a;
137
+ color-scheme: dark;
138
+ --stroke-strong: #ffffff4d;
139
+ --t-p0: #3a3a40;
140
+ --t-p1: #4f2c23;
141
+ --t-p2: #4a3c1c;
142
+ --t-p3: #4a3a25;
143
+ --t-p4: #1f3d37;
144
+ --t-other: #333336;
145
+ --face-ink: #f4f4f5;
146
+ --face-line: #ffffff4d;
147
+ --cheek: #b8706a;
148
+ }
149
+ :root[data-board-theme='light'] {
150
+ --ground: #f5f5f5;
151
+ --bg: #ffffff;
152
+ --head: #fafafa;
153
+ --soft: #f2f2f2;
154
+ --sunk: #f7f7f7;
155
+ --line: #0000001a;
156
+ --line-2: #00000033;
157
+ --ink: #000000;
158
+ --body: #4b4b4b;
159
+ --muted: #6b6b6b;
160
+ --accent: #8a5a20;
161
+ --accent-soft: #f5ecdf;
162
+ --accent-ink: #ffffff;
163
+ --fail: #b42318;
164
+ --fail-soft: #fdecea;
165
+ --ok: #067647;
166
+ --ok-soft: #e7f5ee;
167
+ --wait: #8a4b00;
168
+ --wait-soft: #fdf1dc;
169
+ --focus: #8a5a20;
170
+ color-scheme: light;
171
+ --stroke-strong: #101010;
172
+ --t-p0: #ececef;
173
+ --t-p1: #fbe1d8;
174
+ --t-p2: #f7e9c6;
175
+ --t-p3: #f1e3cf;
176
+ --t-p4: #d9efe9;
177
+ --t-other: #ededed;
178
+ --face-ink: #18181b;
179
+ --face-line: #00000040;
180
+ --cheek: #e8a8a0;
181
+ }
182
+ html,
183
+ body {
184
+ height: 100%;
185
+ }
186
+ body {
187
+ background: var(--ground);
188
+ color: var(--body);
189
+ font: 400 13px/1.45 var(--font);
190
+ overflow: hidden;
191
+ transition:
192
+ background-color 0.2s,
193
+ color 0.2s;
194
+ }
195
+ body::before {
196
+ content: '';
197
+ position: fixed;
198
+ inset: 0 0 auto;
199
+ height: env(safe-area-inset-top, 0px);
200
+ z-index: 10;
201
+ background: var(--ground);
202
+ }
203
+ button {
204
+ font: inherit;
205
+ color: inherit;
206
+ }
207
+ .app {
208
+ height: 100%;
209
+ box-sizing: border-box;
210
+ display: flex;
211
+ flex-direction: column;
212
+ padding-left: max(16px, env(safe-area-inset-left, 0px));
213
+ padding-right: max(16px, env(safe-area-inset-right, 0px));
214
+ padding-block: 0 12px;
215
+ gap: var(--gap);
216
+ }
217
+ .bar {
218
+ flex: none;
219
+ min-height: var(--bar);
220
+ display: flex;
221
+ align-items: center;
222
+ gap: 12px;
223
+ min-width: 0;
224
+ }
225
+ .mark {
226
+ display: block;
227
+ line-height: 0;
228
+ flex: none;
229
+ }
230
+ .mark svg {
231
+ display: block;
232
+ width: 97.6px;
233
+ height: auto;
234
+ }
235
+ .brule {
236
+ flex: none;
237
+ width: 1px;
238
+ height: 24px;
239
+ background: var(--stroke-strong);
240
+ }
241
+ h1 {
242
+ margin: 0;
243
+ font-size: 15px;
244
+ font-weight: 600;
245
+ color: var(--ink);
246
+ white-space: nowrap;
247
+ }
248
+ .tabs {
249
+ display: flex;
250
+ gap: 2px;
251
+ margin-left: 8px;
252
+ }
253
+ .tab {
254
+ height: 32px;
255
+ white-space: nowrap;
256
+ padding: 0 12px;
257
+ border: 1px solid transparent;
258
+ border-radius: var(--r);
259
+ background: none;
260
+ cursor: pointer;
261
+ color: var(--muted);
262
+ font-weight: 500;
263
+ font-size: 13px;
264
+ }
265
+ .tab[aria-selected='true'] {
266
+ color: var(--ink);
267
+ background: var(--bg);
268
+ border-color: var(--line-2);
269
+ }
270
+ .tab:hover {
271
+ color: var(--ink);
272
+ }
273
+ .spacer {
274
+ flex: 1;
275
+ min-width: 0;
276
+ }
277
+ .since {
278
+ display: flex;
279
+ align-items: center;
280
+ gap: 8px;
281
+ color: var(--body);
282
+ white-space: nowrap;
283
+ min-width: 0;
284
+ overflow: hidden;
285
+ text-overflow: ellipsis;
286
+ }
287
+ .since b {
288
+ color: var(--ink);
289
+ font-weight: 600;
290
+ }
291
+ .fresh {
292
+ display: flex;
293
+ align-items: center;
294
+ gap: 6px;
295
+ color: var(--muted);
296
+ font-size: 12px;
297
+ white-space: nowrap;
298
+ }
299
+ .fresh .st {
300
+ color: var(--wait);
301
+ font-weight: 600;
302
+ }
303
+ .btn {
304
+ height: 32px;
305
+ box-sizing: border-box;
306
+ padding: 0 12px;
307
+ border-radius: var(--r);
308
+ border: 1px solid var(--line-2);
309
+ background: var(--bg);
310
+ cursor: pointer;
311
+ font-weight: 500;
312
+ font-size: 13px;
313
+ line-height: 1;
314
+ display: inline-flex;
315
+ align-items: center;
316
+ justify-content: center;
317
+ gap: 6px;
318
+ white-space: nowrap;
319
+ color: var(--ink);
320
+ }
321
+ .btn:hover {
322
+ background: var(--soft);
323
+ }
324
+ .btn.primary {
325
+ background: var(--ink);
326
+ color: var(--bg);
327
+ border-color: var(--ink);
328
+ }
329
+ .btn.primary:hover {
330
+ opacity: 0.88;
331
+ }
332
+ .btn[disabled] {
333
+ opacity: 0.5;
334
+ cursor: default;
335
+ }
336
+ .btn.sq {
337
+ width: 32px;
338
+ padding: 0;
339
+ }
340
+
341
+ .seg {
342
+ display: inline-flex;
343
+ border: 1px solid var(--line-2);
344
+ border-radius: var(--r);
345
+ overflow: hidden;
346
+ flex: none;
347
+ }
348
+ .seg button {
349
+ height: 28px;
350
+ padding: 0 10px;
351
+ border: 0;
352
+ background: var(--bg);
353
+ color: var(--muted);
354
+ font-weight: 500;
355
+ font-size: 12.5px;
356
+ cursor: pointer;
357
+ transition:
358
+ background-color 0.15s,
359
+ color 0.15s;
360
+ }
361
+ .seg button + button {
362
+ border-left: 1px solid var(--line-2);
363
+ }
364
+ .seg button[aria-checked='true'] {
365
+ background: var(--ink);
366
+ color: var(--bg);
367
+ }
368
+ .seg button:not([aria-checked='true']):hover {
369
+ color: var(--ink);
370
+ background: var(--soft);
371
+ }
372
+ .kb {
373
+ display: flex;
374
+ gap: var(--gap);
375
+ padding: 10px;
376
+ height: 100%;
377
+ box-sizing: border-box;
378
+ overflow-x: auto;
379
+ align-items: stretch;
380
+ }
381
+ .kc {
382
+ flex: 0 0 200px;
383
+ display: flex;
384
+ flex-direction: column;
385
+ min-height: 0;
386
+ background: var(--head);
387
+ border: 1px solid var(--line);
388
+ border-radius: var(--r);
389
+ }
390
+ .kc .kh {
391
+ display: flex;
392
+ align-items: center;
393
+ gap: 6px;
394
+ padding: 8px 10px;
395
+ border-bottom: 1px solid var(--line);
396
+ font-weight: 600;
397
+ color: var(--ink);
398
+ font-size: 12.5px;
399
+ }
400
+ .kc .kh .n {
401
+ color: var(--muted);
402
+ font-weight: 400;
403
+ font-variant-numeric: tabular-nums;
404
+ }
405
+ .kc .kh .hot {
406
+ margin-left: auto;
407
+ height: 18px;
408
+ padding: 0 6px;
409
+ border-radius: 999px;
410
+ font-size: 11.5px;
411
+ font-weight: 600;
412
+ display: inline-flex;
413
+ align-items: center;
414
+ background: var(--wait-soft);
415
+ color: var(--wait);
416
+ }
417
+ .kc .kh .hot.bad {
418
+ background: var(--fail-soft);
419
+ color: var(--fail);
420
+ }
421
+ .kc .kl {
422
+ flex: 1;
423
+ min-height: 0;
424
+ overflow: auto;
425
+ padding: 8px;
426
+ display: grid;
427
+ gap: 8px;
428
+ align-content: start;
429
+ }
430
+ .kcard {
431
+ display: grid;
432
+ gap: 4px;
433
+ padding: 8px 10px;
434
+ background: var(--bg);
435
+ border: 1px solid var(--line-2);
436
+ border-radius: var(--r);
437
+ cursor: pointer;
438
+ text-align: left;
439
+ transition:
440
+ border-color 0.15s,
441
+ transform 0.15s var(--ease-out);
442
+ }
443
+ .kcard:hover {
444
+ border-color: var(--ink);
445
+ transform: translateY(-1px);
446
+ }
447
+ .kcard.you {
448
+ border-color: var(--wait);
449
+ box-shadow: inset 3px 0 0 var(--wait);
450
+ }
451
+ .kcard.blocked {
452
+ border-color: var(--fail);
453
+ box-shadow: inset 3px 0 0 var(--fail);
454
+ }
455
+ .kcard[aria-current='true'] {
456
+ outline: 2px solid var(--accent);
457
+ outline-offset: 1px;
458
+ }
459
+ .kcard .kt {
460
+ color: var(--ink);
461
+ font-weight: 500;
462
+ font-size: 12.5px;
463
+ line-height: 1.35;
464
+ display: -webkit-box;
465
+ -webkit-line-clamp: 2;
466
+ -webkit-box-orient: vertical;
467
+ overflow: hidden;
468
+ }
469
+ .kcard .km {
470
+ display: flex;
471
+ gap: 6px;
472
+ align-items: center;
473
+ font-size: 12px;
474
+ color: var(--muted);
475
+ min-width: 0;
476
+ }
477
+ .kcard .km .holder {
478
+ font-size: 12px;
479
+ }
480
+ .kempty {
481
+ color: var(--muted);
482
+ font-size: 12px;
483
+ padding: 4px 2px;
484
+ }
485
+ .dg {
486
+ padding: 12px 16px 4px;
487
+ overflow-x: auto;
488
+ }
489
+ .dg svg {
490
+ display: block;
491
+ }
492
+ .dg .blk rect {
493
+ fill: var(--bg);
494
+ stroke: var(--line-2);
495
+ stroke-width: 1;
496
+ }
497
+ .dg .blk.done rect {
498
+ fill: var(--soft);
499
+ }
500
+ .dg .blk.cur rect {
501
+ stroke: var(--accent);
502
+ stroke-width: 2;
503
+ fill: var(--accent-soft);
504
+ }
505
+ .dg .blk.you rect {
506
+ stroke: var(--wait);
507
+ stroke-width: 2.5;
508
+ fill: var(--wait-soft);
509
+ }
510
+ .dg .blk.blocked rect {
511
+ stroke: var(--fail);
512
+ stroke-width: 2.5;
513
+ fill: var(--fail-soft);
514
+ }
515
+ .dg .blk .nm {
516
+ fill: var(--ink);
517
+ font: 600 12.5px var(--font);
518
+ }
519
+ .dg .blk .who {
520
+ fill: var(--body);
521
+ font: 500 11.5px var(--mono);
522
+ }
523
+ .dg .blk .att {
524
+ fill: var(--muted);
525
+ font: 500 11.5px var(--font);
526
+ }
527
+ .dg .blk .att .x {
528
+ fill: var(--fail);
529
+ }
530
+ .dg .blk .att .v {
531
+ fill: var(--ok);
532
+ }
533
+ .dg .arr {
534
+ stroke: var(--line-2);
535
+ stroke-width: 1.5;
536
+ fill: none;
537
+ }
538
+ .dg .arr.hand {
539
+ stroke: var(--accent);
540
+ }
541
+ .dg .loop {
542
+ stroke: var(--wait);
543
+ stroke-width: 1.5;
544
+ fill: none;
545
+ stroke-dasharray: 4 3;
546
+ }
547
+ .dg .lab {
548
+ fill: var(--muted);
549
+ font: 500 11px var(--font);
550
+ }
551
+ .dg .lab.hand {
552
+ fill: var(--accent);
553
+ }
554
+ .dg .lab.loop {
555
+ fill: var(--wait);
556
+ font-weight: 600;
557
+ }
558
+ .dg .blk {
559
+ cursor: default;
560
+ }
561
+ .dg .blk.you,
562
+ .dg .blk.blocked {
563
+ animation: none;
564
+ }
565
+ .dg .blk.you rect {
566
+ animation: glow 1.8s ease-in-out infinite;
567
+ }
568
+ @keyframes glow {
569
+ 0%,
570
+ 100% {
571
+ stroke-opacity: 1;
572
+ }
573
+ 50% {
574
+ stroke-opacity: 0.45;
575
+ }
576
+ }
577
+ .graphp {
578
+ flex: 1 1 68%;
579
+ }
580
+ .gside {
581
+ flex: 1 1 32%;
582
+ min-width: 280px;
583
+ }
584
+ .gwrap {
585
+ position: relative;
586
+ overflow: hidden;
587
+ }
588
+ .graph {
589
+ width: 100%;
590
+ height: 100%;
591
+ display: block;
592
+ }
593
+ .graph .edge {
594
+ fill: none;
595
+ stroke: var(--line-2);
596
+ stroke-linecap: round;
597
+ cursor: pointer;
598
+ transition:
599
+ stroke 0.2s,
600
+ stroke-width 0.2s;
601
+ }
602
+ .graph .edge:hover,
603
+ .graph .edge.sel {
604
+ stroke: var(--accent);
605
+ }
606
+ .graph .edge.active {
607
+ stroke: var(--accent);
608
+ stroke-dasharray: 6 6;
609
+ animation: flow 1.1s linear infinite;
610
+ }
611
+ @keyframes flow {
612
+ to {
613
+ stroke-dashoffset: -12;
614
+ }
615
+ }
616
+ .graph .ehit {
617
+ fill: none;
618
+ stroke: transparent;
619
+ stroke-width: 16;
620
+ cursor: pointer;
621
+ }
622
+ .graph .ehit:focus-visible + .edge,
623
+ .graph .ehit:focus {
624
+ outline: none;
625
+ }
626
+ .graph .ehit:focus-visible {
627
+ stroke: var(--focus);
628
+ stroke-opacity: 0.25;
629
+ }
630
+ .graph .ecount {
631
+ fill: var(--muted);
632
+ font: 600 11px var(--font);
633
+ pointer-events: none;
634
+ }
635
+ .graph .node {
636
+ cursor: pointer;
637
+ transition: transform 0.45s var(--ease-out);
638
+ }
639
+ .graph .node .ring {
640
+ fill: var(--bg);
641
+ stroke: var(--line-2);
642
+ stroke-width: 1.2;
643
+ }
644
+ .graph .node:hover .ring,
645
+ .graph .node:focus-visible .ring,
646
+ .graph .node.sel .ring {
647
+ stroke: var(--ink);
648
+ stroke-width: 2;
649
+ }
650
+ .graph .node:focus {
651
+ outline: none;
652
+ }
653
+ .graph .node.working .ring {
654
+ stroke: var(--accent);
655
+ }
656
+ .graph .node.you .ring {
657
+ stroke: var(--wait);
658
+ stroke-width: 2.5;
659
+ }
660
+ .graph .node.blocked .ring {
661
+ stroke: var(--fail);
662
+ stroke-width: 2.5;
663
+ }
664
+ .graph .node .gname {
665
+ fill: var(--ink);
666
+ font: 600 12px var(--mono);
667
+ }
668
+ .graph .node .gst {
669
+ font: 600 11px var(--font);
670
+ }
671
+ .graph .node.working .gst {
672
+ fill: var(--accent);
673
+ }
674
+ .graph .node.you .gst {
675
+ fill: var(--wait);
676
+ }
677
+ .graph .node.blocked .gst {
678
+ fill: var(--fail);
679
+ }
680
+ .graph .node.idle .gst {
681
+ fill: var(--muted);
682
+ }
683
+ .graph .node.working .pulse {
684
+ fill: none;
685
+ stroke: var(--accent);
686
+ stroke-width: 1.5;
687
+ transform-box: fill-box;
688
+ transform-origin: center;
689
+ animation: ripple 2.2s ease-out infinite;
690
+ }
691
+ @keyframes ripple {
692
+ 0% {
693
+ transform: scale(1);
694
+ opacity: 0.6;
695
+ }
696
+ 100% {
697
+ transform: scale(1.35);
698
+ opacity: 0;
699
+ }
700
+ }
701
+ .graph .node.me .ring {
702
+ fill: var(--ink);
703
+ }
704
+ .graph .node.me .gname {
705
+ fill: var(--ink);
706
+ }
707
+ .glegend {
708
+ display: flex;
709
+ gap: 12px;
710
+ font-size: 12px;
711
+ color: var(--muted);
712
+ }
713
+ .glegend i {
714
+ display: inline-block;
715
+ width: 18px;
716
+ height: 0;
717
+ border-top: 2px solid var(--line-2);
718
+ vertical-align: middle;
719
+ margin-right: 4px;
720
+ }
721
+ .glegend i.a {
722
+ border-top: 2px dashed var(--accent);
723
+ }
724
+ .reas {
725
+ display: flex;
726
+ gap: 8px;
727
+ align-items: center;
728
+ flex-wrap: wrap;
729
+ }
730
+ .reas select {
731
+ height: 32px;
732
+ border: 1px solid var(--line-2);
733
+ border-radius: var(--r);
734
+ background: var(--bg);
735
+ color: var(--ink);
736
+ font: 500 13px var(--font);
737
+ padding: 0 8px;
738
+ }
739
+ @media (max-width: 900px) {
740
+ .gside {
741
+ display: none;
742
+ }
743
+ .kc {
744
+ flex-basis: 170px;
745
+ }
746
+ }
747
+
748
+ .btn.lang {
749
+ min-width: 40px;
750
+ padding: 0 10px;
751
+ font-weight: 600;
752
+ letter-spacing: 0.02em;
753
+ }
754
+ .btn.chip {
755
+ height: 24px;
756
+ padding: 0 8px;
757
+ font-size: 12px;
758
+ margin: 0 4px 4px 0;
759
+ }
760
+ :focus-visible {
761
+ outline: 2px solid var(--focus);
762
+ outline-offset: 2px;
763
+ }
764
+ .view {
765
+ flex: 1;
766
+ min-height: 0;
767
+ display: none;
768
+ }
769
+ .view.on {
770
+ display: flex;
771
+ gap: var(--gap);
772
+ }
773
+ .pane {
774
+ background: var(--bg);
775
+ border: 1px solid var(--line-2);
776
+ border-radius: var(--r);
777
+ display: flex;
778
+ flex-direction: column;
779
+ min-width: 0;
780
+ min-height: 0;
781
+ overflow: hidden;
782
+ }
783
+ .ph {
784
+ flex: none;
785
+ height: 44px;
786
+ box-sizing: border-box;
787
+ display: flex;
788
+ align-items: center;
789
+ gap: 10px;
790
+ padding: 0 14px;
791
+ border-bottom: 1px solid var(--line);
792
+ background: var(--head);
793
+ }
794
+ .ph h2 {
795
+ margin: 0;
796
+ font-size: 13px;
797
+ font-weight: 600;
798
+ color: var(--ink);
799
+ }
800
+ .ph .n {
801
+ color: var(--muted);
802
+ font-variant-numeric: tabular-nums;
803
+ font-size: 12px;
804
+ }
805
+ .pb {
806
+ flex: 1;
807
+ min-height: 0;
808
+ overflow: auto;
809
+ }
810
+ .list {
811
+ flex: 0 0 calc(var(--split, 58%) - 4px);
812
+ min-width: 280px;
813
+ }
814
+ .detail {
815
+ flex: 1 1 0;
816
+ min-width: 300px;
817
+ }
818
+ .view.on#vFlows {
819
+ gap: 0;
820
+ }
821
+ .split {
822
+ flex: none;
823
+ width: 8px;
824
+ cursor: col-resize;
825
+ position: relative;
826
+ touch-action: none;
827
+ }
828
+ .split::after {
829
+ content: '';
830
+ position: absolute;
831
+ left: 3px;
832
+ top: 50%;
833
+ width: 2px;
834
+ height: 40px;
835
+ margin-top: -20px;
836
+ border-radius: 1px;
837
+ background: var(--line-2);
838
+ transition:
839
+ background-color 0.15s,
840
+ height 0.2s var(--ease-out);
841
+ }
842
+ .split:hover::after,
843
+ .split.drag::after,
844
+ .split:focus-visible::after {
845
+ background: var(--accent);
846
+ height: 64px;
847
+ margin-top: -32px;
848
+ }
849
+ .grp {
850
+ border-bottom: 1px solid var(--line);
851
+ }
852
+ .grp:last-child {
853
+ border-bottom: 0;
854
+ }
855
+ .gh {
856
+ position: sticky;
857
+ top: 0;
858
+ z-index: 1;
859
+ display: flex;
860
+ align-items: center;
861
+ gap: 8px;
862
+ width: 100%;
863
+ height: 36px;
864
+ padding: 0 14px;
865
+ background: var(--head);
866
+ border: 0;
867
+ border-bottom: 1px solid var(--line);
868
+ cursor: pointer;
869
+ text-align: left;
870
+ color: var(--ink);
871
+ font-weight: 600;
872
+ font-size: 13px;
873
+ }
874
+ .gh .n {
875
+ color: var(--muted);
876
+ font-weight: 400;
877
+ font-variant-numeric: tabular-nums;
878
+ }
879
+ .gh .chev {
880
+ width: 12px;
881
+ height: 12px;
882
+ color: var(--muted);
883
+ transition: transform 0.15s;
884
+ }
885
+ .gh[aria-expanded='false'] .chev {
886
+ transform: rotate(-90deg);
887
+ }
888
+ .gh .sw {
889
+ width: 8px;
890
+ height: 8px;
891
+ border-radius: 2px;
892
+ }
893
+ .row {
894
+ display: grid;
895
+ grid-template-columns: 10px 44px minmax(0, 1fr) 112px 76px;
896
+ align-items: center;
897
+ column-gap: 10px;
898
+ row-gap: 6px;
899
+ padding: 10px 12px;
900
+ border-bottom: 1px solid var(--line);
901
+ cursor: pointer;
902
+ position: relative;
903
+ }
904
+ .row > :first-child {
905
+ grid-column: 1;
906
+ grid-row: 1;
907
+ }
908
+ .row > .code {
909
+ grid-column: 2;
910
+ grid-row: 1;
911
+ }
912
+ .row > .tt {
913
+ grid-column: 3;
914
+ grid-row: 1;
915
+ }
916
+ .row > .holder {
917
+ grid-column: 4;
918
+ grid-row: 1;
919
+ }
920
+ .row > .age {
921
+ grid-column: 5;
922
+ grid-row: 1;
923
+ }
924
+ .row > .acts {
925
+ grid-row: 3;
926
+ }
927
+ .row:last-child {
928
+ border-bottom: 0;
929
+ }
930
+ .row:hover {
931
+ background: var(--sunk);
932
+ }
933
+ .row[aria-selected='true'] {
934
+ background: var(--accent-soft);
935
+ }
936
+ .row.flash {
937
+ animation: flash 1.4s ease-out;
938
+ }
939
+ @keyframes flash {
940
+ 0% {
941
+ background: var(--accent-soft);
942
+ }
943
+ 100% {
944
+ background: transparent;
945
+ }
946
+ }
947
+ .unread {
948
+ width: 8px;
949
+ height: 8px;
950
+ border-radius: 50%;
951
+ background: var(--accent);
952
+ }
953
+ .code {
954
+ font-family: var(--mono);
955
+ font-size: 12px;
956
+ color: var(--muted);
957
+ white-space: nowrap;
958
+ }
959
+ .tt {
960
+ min-width: 0;
961
+ }
962
+ .tt .t {
963
+ color: var(--ink);
964
+ font-weight: 500;
965
+ white-space: nowrap;
966
+ overflow: hidden;
967
+ text-overflow: ellipsis;
968
+ }
969
+ .tt .sub {
970
+ display: flex;
971
+ gap: 8px;
972
+ align-items: center;
973
+ margin-top: 2px;
974
+ color: var(--muted);
975
+ font-size: 13px;
976
+ min-width: 0;
977
+ }
978
+ .tt .sub .last {
979
+ white-space: nowrap;
980
+ overflow: hidden;
981
+ text-overflow: ellipsis;
982
+ min-width: 0;
983
+ }
984
+ .repo {
985
+ font-size: 13px;
986
+ font-weight: 600;
987
+ color: var(--body);
988
+ flex: none;
989
+ }
990
+ .strip {
991
+ display: flex;
992
+ gap: 2px;
993
+ align-items: center;
994
+ flex-wrap: wrap;
995
+ row-gap: 2px;
996
+ grid-column: 3/-1;
997
+ grid-row: 2;
998
+ }
999
+ .sg {
1000
+ height: 24px;
1001
+ box-sizing: border-box;
1002
+ padding: 0 7px;
1003
+ display: inline-flex;
1004
+ align-items: center;
1005
+ gap: 3px;
1006
+ border-radius: 3px;
1007
+ font-size: 12px;
1008
+ white-space: nowrap;
1009
+ background: var(--soft);
1010
+ color: var(--muted);
1011
+ }
1012
+ .sg.past {
1013
+ color: var(--body);
1014
+ }
1015
+ .sg.cur {
1016
+ background: var(--accent);
1017
+ color: var(--accent-ink);
1018
+ font-weight: 600;
1019
+ }
1020
+ .sg.cur.you {
1021
+ background: var(--ink);
1022
+ color: var(--bg);
1023
+ }
1024
+ .sg.cur.blocked {
1025
+ background: var(--fail);
1026
+ color: #fff;
1027
+ }
1028
+ .mk {
1029
+ width: 10px;
1030
+ height: 10px;
1031
+ flex: none;
1032
+ }
1033
+ .mk.x {
1034
+ color: var(--fail);
1035
+ }
1036
+ .mk.v {
1037
+ color: var(--ok);
1038
+ }
1039
+ .sg .x {
1040
+ color: var(--fail);
1041
+ font-weight: 600;
1042
+ }
1043
+ .sg .v {
1044
+ color: var(--ok);
1045
+ font-weight: 600;
1046
+ }
1047
+ .sg.cur .x,
1048
+ .sg.cur .v,
1049
+ .sg.cur .mk {
1050
+ color: inherit;
1051
+ }
1052
+ .holder {
1053
+ font-family: var(--mono);
1054
+ font-size: 13px;
1055
+ color: var(--body);
1056
+ white-space: nowrap;
1057
+ overflow: hidden;
1058
+ text-overflow: ellipsis;
1059
+ }
1060
+ .age {
1061
+ text-align: right;
1062
+ font-variant-numeric: tabular-nums;
1063
+ color: var(--muted);
1064
+ font-size: 13px;
1065
+ white-space: nowrap;
1066
+ }
1067
+ .age.hot {
1068
+ color: var(--wait);
1069
+ font-weight: 600;
1070
+ }
1071
+ .acts {
1072
+ grid-column: 3/-1;
1073
+ display: flex;
1074
+ gap: 8px;
1075
+ margin-top: 2px;
1076
+ }
1077
+ .empty {
1078
+ margin: 0;
1079
+ padding: 14px 12px;
1080
+ color: var(--muted);
1081
+ }
1082
+ .dh {
1083
+ padding: 14px 16px;
1084
+ border-bottom: 1px solid var(--line);
1085
+ display: grid;
1086
+ gap: 10px;
1087
+ }
1088
+ .dh .top {
1089
+ display: flex;
1090
+ gap: 8px;
1091
+ align-items: center;
1092
+ min-width: 0;
1093
+ }
1094
+ .dh h3 {
1095
+ margin: 0;
1096
+ font-size: 16px;
1097
+ font-weight: 600;
1098
+ color: var(--ink);
1099
+ line-height: 1.3;
1100
+ }
1101
+ .meta {
1102
+ display: flex;
1103
+ flex-wrap: wrap;
1104
+ gap: 6px 14px;
1105
+ color: var(--muted);
1106
+ font-size: 12px;
1107
+ min-width: 0;
1108
+ }
1109
+ .meta > * {
1110
+ min-width: 0;
1111
+ overflow-wrap: anywhere;
1112
+ }
1113
+ .dh,
1114
+ .dh h3 {
1115
+ min-width: 0;
1116
+ overflow-wrap: anywhere;
1117
+ }
1118
+ .dlabel {
1119
+ margin: 0;
1120
+ padding: 12px 16px 0;
1121
+ font-size: 12px;
1122
+ font-weight: 600;
1123
+ color: var(--muted);
1124
+ }
1125
+ .meta b {
1126
+ color: var(--ink);
1127
+ font-weight: 500;
1128
+ }
1129
+ .pill {
1130
+ height: 22px;
1131
+ padding: 0 8px;
1132
+ border-radius: 3px;
1133
+ font-size: 12px;
1134
+ font-weight: 600;
1135
+ display: inline-flex;
1136
+ align-items: center;
1137
+ }
1138
+ .pill.you {
1139
+ background: var(--ink);
1140
+ color: var(--bg);
1141
+ }
1142
+ .pill.blocked {
1143
+ background: var(--fail-soft);
1144
+ color: var(--fail);
1145
+ }
1146
+ .pill.running {
1147
+ background: var(--accent-soft);
1148
+ color: var(--accent);
1149
+ }
1150
+ .pill.done {
1151
+ background: var(--ok-soft);
1152
+ color: var(--ok);
1153
+ }
1154
+ .pill.parked {
1155
+ background: var(--soft);
1156
+ color: var(--muted);
1157
+ }
1158
+ .dacts {
1159
+ display: flex;
1160
+ gap: 8px;
1161
+ flex-wrap: wrap;
1162
+ align-items: center;
1163
+ }
1164
+ .ask {
1165
+ padding: 10px 12px;
1166
+ background: var(--soft);
1167
+ border-radius: var(--r);
1168
+ color: var(--ink);
1169
+ }
1170
+ .dtabs {
1171
+ display: flex;
1172
+ gap: 2px;
1173
+ padding: 10px 16px 0;
1174
+ }
1175
+ .tl {
1176
+ list-style: none;
1177
+ margin: 0;
1178
+ padding: 8px 16px 16px;
1179
+ }
1180
+ .st {
1181
+ display: grid;
1182
+ grid-template-columns: 16px minmax(0, 1fr);
1183
+ column-gap: 10px;
1184
+ padding: 8px 0;
1185
+ position: relative;
1186
+ }
1187
+ .st::before {
1188
+ content: '';
1189
+ position: absolute;
1190
+ left: 7px;
1191
+ top: 28px;
1192
+ bottom: -8px;
1193
+ width: 1px;
1194
+ background: var(--line-2);
1195
+ }
1196
+ .st:last-child::before {
1197
+ display: none;
1198
+ }
1199
+ .st .k {
1200
+ width: 15px;
1201
+ height: 15px;
1202
+ border-radius: 50%;
1203
+ border: 2px solid var(--line-2);
1204
+ background: var(--bg);
1205
+ margin-top: 2px;
1206
+ box-sizing: border-box;
1207
+ }
1208
+ .st.done .k {
1209
+ background: var(--body);
1210
+ border-color: var(--body);
1211
+ }
1212
+ .st.cur .k {
1213
+ background: var(--accent);
1214
+ border-color: var(--accent);
1215
+ }
1216
+ .st.fail .k {
1217
+ border-color: var(--fail);
1218
+ background: var(--fail-soft);
1219
+ }
1220
+ .st .h {
1221
+ display: flex;
1222
+ align-items: center;
1223
+ gap: 8px;
1224
+ flex-wrap: wrap;
1225
+ }
1226
+ .st .h .nm {
1227
+ color: var(--ink);
1228
+ font-weight: 600;
1229
+ }
1230
+ .st .h .tm {
1231
+ color: var(--muted);
1232
+ font-size: 12px;
1233
+ font-variant-numeric: tabular-nums;
1234
+ }
1235
+ .att {
1236
+ display: flex;
1237
+ gap: 4px;
1238
+ margin: 6px 0 2px;
1239
+ flex-wrap: wrap;
1240
+ }
1241
+ .att button {
1242
+ height: 24px;
1243
+ box-sizing: border-box;
1244
+ padding: 0 8px;
1245
+ border-radius: 3px;
1246
+ border: 1px solid var(--line-2);
1247
+ background: var(--bg);
1248
+ cursor: pointer;
1249
+ font-size: 12px;
1250
+ display: inline-flex;
1251
+ align-items: center;
1252
+ gap: 4px;
1253
+ }
1254
+ .att button[aria-pressed='true'] {
1255
+ border-color: var(--ink);
1256
+ color: var(--ink);
1257
+ font-weight: 600;
1258
+ }
1259
+ .att .x {
1260
+ color: var(--fail);
1261
+ }
1262
+ .att .v {
1263
+ color: var(--ok);
1264
+ }
1265
+ .evs {
1266
+ list-style: none;
1267
+ margin: 6px 0 0;
1268
+ padding: 0;
1269
+ display: grid;
1270
+ gap: 8px;
1271
+ }
1272
+ .ev {
1273
+ display: grid;
1274
+ grid-template-columns: 48px minmax(0, 1fr);
1275
+ column-gap: 10px;
1276
+ font-size: 13px;
1277
+ }
1278
+ .ev .tm {
1279
+ color: var(--muted);
1280
+ font-size: 13px;
1281
+ font-variant-numeric: tabular-nums;
1282
+ padding-top: 1px;
1283
+ }
1284
+ .ev .who {
1285
+ font-size: 13px;
1286
+ color: var(--muted);
1287
+ }
1288
+ .ev .who b {
1289
+ font-family: var(--mono);
1290
+ font-size: 12.5px;
1291
+ }
1292
+ .ev .who b {
1293
+ color: var(--ink);
1294
+ font-weight: 500;
1295
+ }
1296
+ .ev .sm {
1297
+ color: var(--body);
1298
+ }
1299
+ .ev.fail .sm {
1300
+ color: var(--fail);
1301
+ }
1302
+ .ev .lk {
1303
+ font-size: 12px;
1304
+ color: var(--accent);
1305
+ text-decoration: none;
1306
+ word-break: break-all;
1307
+ }
1308
+ .ev .lk:hover {
1309
+ text-decoration: underline;
1310
+ }
1311
+ .ev .src {
1312
+ font-size: 12px;
1313
+ color: var(--muted);
1314
+ }
1315
+ .draw > .st {
1316
+ opacity: 0;
1317
+ transform: translateY(6px);
1318
+ animation: draw 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
1319
+ }
1320
+ @keyframes draw {
1321
+ to {
1322
+ opacity: 1;
1323
+ transform: none;
1324
+ }
1325
+ }
1326
+ .placeholder {
1327
+ padding: 24px 16px;
1328
+ color: var(--muted);
1329
+ max-width: 44ch;
1330
+ }
1331
+ .back {
1332
+ display: none;
1333
+ }
1334
+ .tbl {
1335
+ width: 100%;
1336
+ border-collapse: collapse;
1337
+ }
1338
+ .tbl th {
1339
+ text-align: left;
1340
+ font-weight: 500;
1341
+ font-size: 12px;
1342
+ color: var(--muted);
1343
+ padding: 10px 12px;
1344
+ border-bottom: 1px solid var(--line);
1345
+ position: sticky;
1346
+ top: 0;
1347
+ background: var(--head);
1348
+ }
1349
+ .tbl td {
1350
+ padding: 10px 12px;
1351
+ border-bottom: 1px solid var(--line);
1352
+ vertical-align: top;
1353
+ }
1354
+ .tbl td.num {
1355
+ text-align: right;
1356
+ font-variant-numeric: tabular-nums;
1357
+ white-space: nowrap;
1358
+ }
1359
+ .tbl .mono {
1360
+ font-family: var(--mono);
1361
+ font-size: 12px;
1362
+ color: var(--ink);
1363
+ white-space: nowrap;
1364
+ }
1365
+ .stt {
1366
+ display: inline-flex;
1367
+ align-items: center;
1368
+ gap: 6px;
1369
+ font-size: 12px;
1370
+ white-space: nowrap;
1371
+ }
1372
+ .stt i {
1373
+ width: 8px;
1374
+ height: 8px;
1375
+ border-radius: 50%;
1376
+ background: var(--line-2);
1377
+ }
1378
+ .stt.working i {
1379
+ background: var(--accent);
1380
+ }
1381
+ .stt.blocked i {
1382
+ background: var(--fail);
1383
+ }
1384
+ .rel {
1385
+ display: grid;
1386
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1387
+ gap: var(--gap);
1388
+ flex: 1;
1389
+ min-height: 0;
1390
+ }
1391
+ .rel .pb {
1392
+ padding: 12px;
1393
+ }
1394
+ .rel h3 {
1395
+ margin: 0 0 8px;
1396
+ font-size: 13px;
1397
+ color: var(--ink);
1398
+ font-weight: 600;
1399
+ }
1400
+ .kv {
1401
+ display: grid;
1402
+ grid-template-columns: auto 1fr;
1403
+ gap: 6px 12px;
1404
+ margin: 0 0 14px;
1405
+ }
1406
+ .kv dt {
1407
+ color: var(--muted);
1408
+ font-size: 12px;
1409
+ }
1410
+ .kv dd {
1411
+ margin: 0;
1412
+ font-family: var(--mono);
1413
+ font-size: 12px;
1414
+ color: var(--ink);
1415
+ }
1416
+ .ul {
1417
+ list-style: none;
1418
+ margin: 0;
1419
+ padding: 0;
1420
+ display: grid;
1421
+ gap: 6px;
1422
+ }
1423
+ .ul li {
1424
+ display: grid;
1425
+ grid-template-columns: 44px minmax(0, 1fr);
1426
+ gap: 8px;
1427
+ }
1428
+ .keys {
1429
+ position: fixed;
1430
+ right: max(16px, env(safe-area-inset-right, 0px));
1431
+ top: calc(var(--bar) + 12px + env(safe-area-inset-top, 0px));
1432
+ z-index: 20;
1433
+ background: var(--bg);
1434
+ border: 1px solid var(--line-2);
1435
+ border-radius: var(--r);
1436
+ box-shadow: 0 8px 24px #00000026; /* taste-skill-ignore: a floating dialog */
1437
+ padding: 12px 14px;
1438
+ width: 260px;
1439
+ }
1440
+ .keys h2 {
1441
+ margin: 0 0 8px;
1442
+ font-size: 13px;
1443
+ color: var(--ink);
1444
+ }
1445
+ .keys dl {
1446
+ display: grid;
1447
+ grid-template-columns: 52px 1fr;
1448
+ gap: 6px 10px;
1449
+ margin: 0;
1450
+ }
1451
+ .keys dt {
1452
+ font-family: var(--mono);
1453
+ font-size: 12px;
1454
+ color: var(--ink);
1455
+ }
1456
+ .keys dd {
1457
+ margin: 0;
1458
+ }
1459
+ .dock {
1460
+ flex: none;
1461
+ display: flex;
1462
+ gap: var(--gap);
1463
+ min-width: 0;
1464
+ overflow-x: auto;
1465
+ overscroll-behavior-x: contain;
1466
+ scrollbar-width: thin;
1467
+ padding-top: 2px;
1468
+ }
1469
+ .dock-lbl {
1470
+ flex: none;
1471
+ display: flex;
1472
+ flex-direction: column;
1473
+ justify-content: center;
1474
+ padding: 0 6px 0 2px;
1475
+ color: var(--muted);
1476
+ font-size: 12px;
1477
+ white-space: nowrap;
1478
+ }
1479
+ .dock-lbl b {
1480
+ color: var(--ink);
1481
+ font-weight: 600;
1482
+ font-size: 13px;
1483
+ }
1484
+ .cell {
1485
+ flex: 1 1 0;
1486
+ min-width: 196px;
1487
+ max-width: 340px;
1488
+ height: 74px;
1489
+ box-sizing: border-box;
1490
+ display: grid;
1491
+ grid-template-columns: 40px minmax(0, 1fr);
1492
+ column-gap: 10px;
1493
+ align-items: center;
1494
+ padding: 0 12px 0 10px;
1495
+ border: 1px solid var(--line-2);
1496
+ border-radius: var(--r);
1497
+ background: var(--bg);
1498
+ cursor: pointer;
1499
+ text-align: left;
1500
+ position: relative;
1501
+ transition:
1502
+ border-color 0.15s,
1503
+ background-color 0.15s,
1504
+ transform 0.15s var(--ease-out);
1505
+ }
1506
+ .cell:hover {
1507
+ border-color: var(--ink);
1508
+ }
1509
+ .cell:active {
1510
+ transform: translateY(1px);
1511
+ }
1512
+ .cell.compact {
1513
+ flex: 0 0 auto;
1514
+ min-width: 0;
1515
+ max-width: none;
1516
+ grid-template-columns: 40px auto;
1517
+ padding-right: 14px;
1518
+ }
1519
+ .cell.compact .tk,
1520
+ .cell.compact .nm .fc,
1521
+ .cell.compact .ft .ag {
1522
+ display: none;
1523
+ }
1524
+ .cell[aria-expanded='true'] {
1525
+ border-color: var(--accent);
1526
+ box-shadow: inset 0 0 0 1px var(--accent);
1527
+ }
1528
+ .cell .nm {
1529
+ display: flex;
1530
+ align-items: center;
1531
+ gap: 8px;
1532
+ min-width: 0;
1533
+ }
1534
+ .cell .nm b {
1535
+ font-family: var(--mono);
1536
+ font-size: 12.5px;
1537
+ font-weight: 500;
1538
+ color: var(--ink);
1539
+ white-space: nowrap;
1540
+ overflow: hidden;
1541
+ text-overflow: ellipsis;
1542
+ min-width: 0;
1543
+ }
1544
+ .spill {
1545
+ flex: none;
1546
+ height: 20px;
1547
+ padding: 0 7px;
1548
+ border-radius: 999px;
1549
+ font-size: 11.5px;
1550
+ font-weight: 600;
1551
+ display: inline-flex;
1552
+ align-items: center;
1553
+ gap: 5px;
1554
+ white-space: nowrap;
1555
+ }
1556
+ .spill::before {
1557
+ content: '';
1558
+ width: 6px;
1559
+ height: 6px;
1560
+ border-radius: 50%;
1561
+ background: currentColor;
1562
+ }
1563
+ .spill.working {
1564
+ background: var(--accent-soft);
1565
+ color: var(--accent);
1566
+ }
1567
+ .spill.you {
1568
+ background: var(--wait-soft);
1569
+ color: var(--wait);
1570
+ }
1571
+ .spill.idle {
1572
+ background: var(--soft);
1573
+ color: var(--muted);
1574
+ }
1575
+ .spill.blocked {
1576
+ background: var(--fail-soft);
1577
+ color: var(--fail);
1578
+ }
1579
+ .cell.working .spill::before {
1580
+ animation: led 1.6s ease-in-out infinite;
1581
+ }
1582
+ @keyframes led {
1583
+ 0%,
1584
+ 100% {
1585
+ opacity: 1;
1586
+ }
1587
+ 50% {
1588
+ opacity: 0.35;
1589
+ }
1590
+ }
1591
+ .cell .tk {
1592
+ display: flex;
1593
+ align-items: center;
1594
+ gap: 6px;
1595
+ min-width: 0;
1596
+ margin-top: 2px;
1597
+ font-size: 12px;
1598
+ color: var(--body);
1599
+ overflow: hidden;
1600
+ }
1601
+ .cell .tk .fc {
1602
+ flex: none;
1603
+ font-family: var(--mono);
1604
+ font-size: 12px;
1605
+ color: var(--accent);
1606
+ font-weight: 500;
1607
+ }
1608
+ .cell .tk .tx {
1609
+ white-space: nowrap;
1610
+ overflow: hidden;
1611
+ text-overflow: ellipsis;
1612
+ min-width: 0;
1613
+ }
1614
+ .cell .ft {
1615
+ display: flex;
1616
+ align-items: center;
1617
+ gap: 8px;
1618
+ margin-top: 4px;
1619
+ min-width: 0;
1620
+ overflow: hidden;
1621
+ }
1622
+ .cell .ft .ag {
1623
+ overflow: hidden;
1624
+ text-overflow: ellipsis;
1625
+ }
1626
+ .cell .ft .ag {
1627
+ color: var(--muted);
1628
+ font-size: 12px;
1629
+ font-variant-numeric: tabular-nums;
1630
+ white-space: nowrap;
1631
+ }
1632
+ .cell .nm .fc {
1633
+ margin-left: auto;
1634
+ flex: none;
1635
+ font-family: var(--mono);
1636
+ font-size: 12px;
1637
+ color: var(--accent);
1638
+ font-weight: 500;
1639
+ }
1640
+ .cell.blocked .tk .tx {
1641
+ color: var(--fail);
1642
+ }
1643
+ .cell.idle .tk {
1644
+ color: var(--muted);
1645
+ }
1646
+ .tk.in .tx {
1647
+ animation: tickin 0.32s var(--ease-out);
1648
+ }
1649
+ @keyframes tickin {
1650
+ from {
1651
+ transform: translateY(8px);
1652
+ opacity: 0;
1653
+ }
1654
+ to {
1655
+ transform: none;
1656
+ opacity: 1;
1657
+ }
1658
+ }
1659
+ .cell.hop .bot {
1660
+ animation: hop 0.46s var(--ease-out);
1661
+ }
1662
+ @keyframes hop {
1663
+ 0% {
1664
+ transform: translateY(0);
1665
+ }
1666
+ 35% {
1667
+ transform: translateY(-7px) scaleY(1.04);
1668
+ }
1669
+ 65% {
1670
+ transform: translateY(0) scaleY(0.96);
1671
+ }
1672
+ 100% {
1673
+ transform: none;
1674
+ }
1675
+ }
1676
+ .bot {
1677
+ width: 40px;
1678
+ height: 40px;
1679
+ display: block;
1680
+ overflow: visible;
1681
+ }
1682
+ .bot .body,
1683
+ .bot .ant {
1684
+ transform-box: fill-box;
1685
+ }
1686
+ .bot .body {
1687
+ transform-origin: 50% 100%;
1688
+ }
1689
+ .bot .ant {
1690
+ transform-origin: 50% 100%;
1691
+ }
1692
+ .bot .eyes {
1693
+ transform-box: fill-box;
1694
+ transform-origin: 50% 50%;
1695
+ }
1696
+ .bot .shell {
1697
+ stroke: var(--face-ink);
1698
+ stroke-width: 1.5;
1699
+ stroke-linejoin: round;
1700
+ }
1701
+ .bot .shade {
1702
+ fill: var(--face-ink);
1703
+ opacity: 0.09;
1704
+ }
1705
+ .bot .acc,
1706
+ .bot .spark {
1707
+ fill: var(--accent);
1708
+ }
1709
+ .bot .acc-stroke {
1710
+ fill: none;
1711
+ stroke: var(--accent);
1712
+ stroke-width: 1.5;
1713
+ stroke-linecap: round;
1714
+ stroke-linejoin: round;
1715
+ }
1716
+ .bot .core {
1717
+ fill: var(--bg);
1718
+ opacity: 0.6;
1719
+ }
1720
+ .bot .speck {
1721
+ fill: var(--accent);
1722
+ opacity: 0.75;
1723
+ }
1724
+ .bot .facet {
1725
+ fill: none;
1726
+ stroke: var(--face-ink);
1727
+ stroke-width: 1;
1728
+ opacity: 0.35;
1729
+ stroke-linecap: round;
1730
+ }
1731
+ .bot .stem {
1732
+ fill: none;
1733
+ stroke: var(--face-ink);
1734
+ stroke-width: 1.8;
1735
+ stroke-linecap: round;
1736
+ }
1737
+ .bot .tip {
1738
+ fill: var(--face-ink);
1739
+ }
1740
+ .bot .band {
1741
+ fill: none;
1742
+ stroke: var(--accent);
1743
+ stroke-width: 1.8;
1744
+ stroke-linecap: round;
1745
+ }
1746
+ .bot .brow {
1747
+ stroke-width: 1.3;
1748
+ }
1749
+ .bot .sweat {
1750
+ fill: var(--bg);
1751
+ stroke: var(--face-ink);
1752
+ stroke-width: 1;
1753
+ }
1754
+ .bot .mark {
1755
+ fill: var(--fail);
1756
+ }
1757
+ .bot .mark-ink {
1758
+ stroke: #fff;
1759
+ stroke-width: 1.4;
1760
+ stroke-linecap: round;
1761
+ }
1762
+ .bot .mark-dot {
1763
+ fill: #fff;
1764
+ }
1765
+ .bot .z2 {
1766
+ font-size: 5.5px;
1767
+ }
1768
+ .bot .hand {
1769
+ transform-box: fill-box;
1770
+ transform-origin: 0% 100%;
1771
+ }
1772
+ .cell.you .hand {
1773
+ animation: wave 1.8s ease-in-out infinite;
1774
+ }
1775
+ @keyframes wave {
1776
+ 0%,
1777
+ 100% {
1778
+ transform: rotate(0);
1779
+ }
1780
+ 50% {
1781
+ transform: rotate(-12deg);
1782
+ }
1783
+ }
1784
+ .bot .ink {
1785
+ fill: var(--face-ink);
1786
+ }
1787
+ .bot .glint {
1788
+ fill: var(--bg);
1789
+ }
1790
+ .bot .stroke {
1791
+ fill: none;
1792
+ stroke: var(--face-ink);
1793
+ stroke-width: 1.6;
1794
+ stroke-linecap: round;
1795
+ stroke-linejoin: round;
1796
+ }
1797
+ .bot .cheek {
1798
+ fill: var(--cheek);
1799
+ opacity: 0.55;
1800
+ }
1801
+ .bot .badge {
1802
+ fill: var(--wait);
1803
+ }
1804
+ .bot .badge-ink {
1805
+ fill: var(--bg);
1806
+ font: 700 7px/1 var(--font);
1807
+ }
1808
+ .bot .z {
1809
+ fill: var(--muted);
1810
+ font: 600 7.5px/1 var(--font);
1811
+ }
1812
+ .bot .dot {
1813
+ fill: var(--face-ink);
1814
+ }
1815
+ .cell.working .body {
1816
+ animation: bob 1.8s ease-in-out infinite;
1817
+ }
1818
+ @keyframes bob {
1819
+ 0%,
1820
+ 100% {
1821
+ transform: translateY(0);
1822
+ }
1823
+ 50% {
1824
+ transform: translateY(-1.5px);
1825
+ }
1826
+ }
1827
+ .cell.working .ant {
1828
+ animation: wiggle 1.4s ease-in-out infinite;
1829
+ }
1830
+ @keyframes wiggle {
1831
+ 0%,
1832
+ 100% {
1833
+ transform: rotate(0);
1834
+ }
1835
+ 25% {
1836
+ transform: rotate(-12deg);
1837
+ }
1838
+ 75% {
1839
+ transform: rotate(12deg);
1840
+ }
1841
+ }
1842
+ .cell.working .eyes {
1843
+ animation: blink 4.2s infinite;
1844
+ }
1845
+ @keyframes blink {
1846
+ 0%,
1847
+ 92%,
1848
+ 100% {
1849
+ transform: scaleY(1);
1850
+ }
1851
+ 95% {
1852
+ transform: scaleY(0.1);
1853
+ }
1854
+ }
1855
+ .cell.working .dot,
1856
+ .cell.working .spark {
1857
+ animation: typing 1.2s infinite;
1858
+ }
1859
+ .cell.working .spark + .spark {
1860
+ animation-delay: 0.3s;
1861
+ }
1862
+ .cell.working .dot:nth-of-type(2) {
1863
+ animation-delay: 0.15s;
1864
+ }
1865
+ .cell.working .dot:nth-of-type(3) {
1866
+ animation-delay: 0.3s;
1867
+ }
1868
+ @keyframes typing {
1869
+ 0%,
1870
+ 60%,
1871
+ 100% {
1872
+ opacity: 0.25;
1873
+ transform: none;
1874
+ }
1875
+ 30% {
1876
+ opacity: 1;
1877
+ transform: translateY(-1.5px);
1878
+ }
1879
+ }
1880
+ .cell.idle .body {
1881
+ animation: breathe 4s ease-in-out infinite;
1882
+ }
1883
+ @keyframes breathe {
1884
+ 0%,
1885
+ 100% {
1886
+ transform: scale(1);
1887
+ }
1888
+ 50% {
1889
+ transform: scale(0.97);
1890
+ }
1891
+ }
1892
+ .cell.idle .z {
1893
+ animation: zz 3s ease-in-out infinite;
1894
+ }
1895
+ @keyframes zz {
1896
+ 0% {
1897
+ opacity: 0;
1898
+ transform: translate(0, 2px);
1899
+ }
1900
+ 40% {
1901
+ opacity: 1;
1902
+ }
1903
+ 100% {
1904
+ opacity: 0;
1905
+ transform: translate(3px, -4px);
1906
+ }
1907
+ }
1908
+ .cell.you .badge-g {
1909
+ transform-box: fill-box;
1910
+ transform-origin: 50% 50%;
1911
+ animation: pulse 1.6s ease-in-out infinite;
1912
+ }
1913
+ @keyframes pulse {
1914
+ 0%,
1915
+ 100% {
1916
+ transform: scale(1);
1917
+ }
1918
+ 50% {
1919
+ transform: scale(1.15);
1920
+ }
1921
+ }
1922
+ .cell.shake .bot {
1923
+ animation: shake 0.42s ease-in-out;
1924
+ }
1925
+ @keyframes shake {
1926
+ 0%,
1927
+ 100% {
1928
+ transform: none;
1929
+ }
1930
+ 20% {
1931
+ transform: translateX(-2px);
1932
+ }
1933
+ 40% {
1934
+ transform: translateX(2px);
1935
+ }
1936
+ 60% {
1937
+ transform: translateX(-1.5px);
1938
+ }
1939
+ 80% {
1940
+ transform: translateX(1px);
1941
+ }
1942
+ }
1943
+ .bot .mouth-bad {
1944
+ stroke: var(--fail);
1945
+ }
1946
+ .pop {
1947
+ position: fixed;
1948
+ z-index: 30;
1949
+ width: 380px;
1950
+ max-width: calc(100vw - 32px);
1951
+ max-height: min(560px, calc(100vh - 120px));
1952
+ box-sizing: border-box;
1953
+ display: flex;
1954
+ flex-direction: column;
1955
+ background: var(--bg);
1956
+ border: 1px solid var(--line-2);
1957
+ border-radius: var(--r);
1958
+ box-shadow: 0 12px 32px #00000033; /* taste-skill-ignore: a floating popover */
1959
+ opacity: 0;
1960
+ transform: translateY(6px) scale(0.98);
1961
+ transform-origin: 50% 100%;
1962
+ transition:
1963
+ opacity 0.16s var(--ease-out),
1964
+ transform 0.2s var(--ease-out);
1965
+ }
1966
+ .pop.on {
1967
+ opacity: 1;
1968
+ transform: none;
1969
+ }
1970
+ .pop .phd {
1971
+ display: grid;
1972
+ grid-template-columns: 48px minmax(0, 1fr) 32px;
1973
+ gap: 12px;
1974
+ align-items: center;
1975
+ padding: 14px 14px 12px;
1976
+ border-bottom: 1px solid var(--line);
1977
+ background: var(--head);
1978
+ }
1979
+ .pop .phd .bot {
1980
+ width: 48px;
1981
+ height: 48px;
1982
+ }
1983
+ .pop .phd h2 {
1984
+ margin: 0;
1985
+ font: 600 15px/1.2 var(--mono);
1986
+ color: var(--ink);
1987
+ overflow: hidden;
1988
+ text-overflow: ellipsis;
1989
+ white-space: nowrap;
1990
+ }
1991
+ .pop .phd .sub {
1992
+ display: flex;
1993
+ gap: 8px;
1994
+ align-items: center;
1995
+ margin-top: 6px;
1996
+ color: var(--muted);
1997
+ font-size: 12px;
1998
+ flex-wrap: wrap;
1999
+ }
2000
+ .pop .pbd {
2001
+ overflow: auto;
2002
+ padding: 4px 14px 12px;
2003
+ flex: 1;
2004
+ min-height: 0;
2005
+ }
2006
+ .pop h3 {
2007
+ margin: 12px 0 6px;
2008
+ font-size: 12px;
2009
+ font-weight: 600;
2010
+ color: var(--muted);
2011
+ }
2012
+ .pop .now {
2013
+ display: flex;
2014
+ gap: 8px;
2015
+ align-items: center;
2016
+ padding: 10px 12px;
2017
+ background: var(--soft);
2018
+ border-radius: var(--r);
2019
+ margin-top: 10px;
2020
+ color: var(--ink);
2021
+ }
2022
+ .pop .now .tx {
2023
+ min-width: 0;
2024
+ overflow: hidden;
2025
+ text-overflow: ellipsis;
2026
+ white-space: nowrap;
2027
+ }
2028
+ .pop .pevs {
2029
+ list-style: none;
2030
+ margin: 0;
2031
+ padding: 0;
2032
+ display: grid;
2033
+ gap: 6px;
2034
+ }
2035
+ .pop .pevs li {
2036
+ display: grid;
2037
+ grid-template-columns: 44px minmax(0, 1fr);
2038
+ gap: 8px;
2039
+ font-size: 12.5px;
2040
+ }
2041
+ .pop .pevs .tm {
2042
+ color: var(--muted);
2043
+ font-variant-numeric: tabular-nums;
2044
+ }
2045
+ .pop .pevs .sm {
2046
+ color: var(--body);
2047
+ overflow: hidden;
2048
+ text-overflow: ellipsis;
2049
+ display: -webkit-box;
2050
+ -webkit-line-clamp: 2;
2051
+ -webkit-box-orient: vertical;
2052
+ }
2053
+ .pop .pevs .fl {
2054
+ font-family: var(--mono);
2055
+ font-size: 12px;
2056
+ color: var(--accent);
2057
+ margin-right: 6px;
2058
+ }
2059
+ .pop .prs {
2060
+ list-style: none;
2061
+ margin: 0;
2062
+ padding: 0;
2063
+ display: grid;
2064
+ gap: 4px;
2065
+ }
2066
+ .pop .prs a {
2067
+ display: flex;
2068
+ gap: 8px;
2069
+ align-items: center;
2070
+ color: var(--ink);
2071
+ text-decoration: none;
2072
+ font-size: 12.5px;
2073
+ padding: 4px 0;
2074
+ }
2075
+ .pop .prs a:hover {
2076
+ color: var(--accent);
2077
+ }
2078
+ .pop .none {
2079
+ color: var(--muted);
2080
+ font-size: 12.5px;
2081
+ margin: 0;
2082
+ }
2083
+ .pop .pft {
2084
+ border-top: 1px solid var(--line);
2085
+ padding: 12px 14px;
2086
+ display: grid;
2087
+ gap: 8px;
2088
+ background: var(--head);
2089
+ }
2090
+ .pop textarea {
2091
+ width: 100%;
2092
+ box-sizing: border-box;
2093
+ min-height: 56px;
2094
+ resize: vertical;
2095
+ padding: 8px 10px;
2096
+ border: 1px solid var(--line-2);
2097
+ border-radius: var(--r);
2098
+ background: var(--bg);
2099
+ color: var(--ink);
2100
+ font: 400 13px/1.4 var(--font);
2101
+ }
2102
+ .pop textarea:focus {
2103
+ outline: 2px solid var(--focus);
2104
+ outline-offset: 0;
2105
+ border-color: transparent;
2106
+ }
2107
+ .pop .row2 {
2108
+ display: flex;
2109
+ gap: 8px;
2110
+ flex-wrap: wrap;
2111
+ }
2112
+ .toast {
2113
+ position: fixed;
2114
+ left: 50%;
2115
+ bottom: calc(92px + env(safe-area-inset-bottom, 0px));
2116
+ z-index: 40;
2117
+ transform: translate(-50%, 8px);
2118
+ opacity: 0;
2119
+ pointer-events: none;
2120
+ max-width: calc(100vw - 32px);
2121
+ padding: 10px 14px;
2122
+ border-radius: var(--r);
2123
+ background: var(--ink);
2124
+ color: var(--bg);
2125
+ font-weight: 500;
2126
+ font-size: 13px;
2127
+ box-shadow: 0 8px 24px #00000033; /* taste-skill-ignore: a floating toast */
2128
+ transition:
2129
+ opacity 0.18s,
2130
+ transform 0.24s var(--ease-out);
2131
+ }
2132
+ .toast.on {
2133
+ opacity: 1;
2134
+ transform: translate(-50%, 0);
2135
+ }
2136
+ .toast.warn {
2137
+ background: var(--wait-soft);
2138
+ color: var(--ink);
2139
+ border: 1px solid var(--wait);
2140
+ }
2141
+ .theme {
2142
+ position: relative;
2143
+ }
2144
+ .theme svg {
2145
+ width: 18px;
2146
+ height: 18px;
2147
+ transition:
2148
+ transform 0.4s var(--ease-out),
2149
+ opacity 0.25s;
2150
+ }
2151
+ .filter-chip {
2152
+ display: inline-flex;
2153
+ align-items: center;
2154
+ gap: 6px;
2155
+ height: 24px;
2156
+ padding: 0 8px;
2157
+ border-radius: 3px;
2158
+ background: var(--soft);
2159
+ border: 1px solid var(--line-2);
2160
+ font-size: 12px;
2161
+ color: var(--ink);
2162
+ cursor: pointer;
2163
+ }
2164
+ .filter-chip b {
2165
+ font-family: var(--mono);
2166
+ font-weight: 500;
2167
+ }
2168
+ .sg.cur {
2169
+ position: relative;
2170
+ overflow: hidden;
2171
+ }
2172
+ .sg.cur.sweep::before {
2173
+ content: '';
2174
+ position: absolute;
2175
+ inset: 0;
2176
+ background: currentColor;
2177
+ opacity: 0.28;
2178
+ transform-origin: left center;
2179
+ animation: sweep 0.56s var(--ease-out) forwards;
2180
+ pointer-events: none;
2181
+ }
2182
+ @keyframes sweep {
2183
+ from {
2184
+ transform: scaleX(0);
2185
+ opacity: 0.34;
2186
+ }
2187
+ to {
2188
+ transform: scaleX(1);
2189
+ opacity: 0;
2190
+ }
2191
+ }
2192
+ .unread.pop {
2193
+ animation: pop 0.36s var(--ease-out);
2194
+ }
2195
+ @keyframes pop {
2196
+ 0% {
2197
+ transform: scale(0);
2198
+ }
2199
+ 70% {
2200
+ transform: scale(1.35);
2201
+ }
2202
+ 100% {
2203
+ transform: scale(1);
2204
+ }
2205
+ }
2206
+ .row.glide {
2207
+ transition: transform 0.28s var(--ease-out);
2208
+ }
2209
+ @media (max-width: 1599px) {
2210
+ .dock-lbl {
2211
+ display: none;
2212
+ }
2213
+ }
2214
+ @media (max-width: 640px) {
2215
+ .cell {
2216
+ flex: 0 0 230px;
2217
+ min-width: 230px;
2218
+ }
2219
+ .dock-lbl {
2220
+ display: none;
2221
+ }
2222
+ .pop {
2223
+ left: 16px !important;
2224
+ right: 16px;
2225
+ width: auto;
2226
+ bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
2227
+ top: auto !important;
2228
+ }
2229
+ }
2230
+ @media (max-width: 900px) {
2231
+ .split {
2232
+ display: none;
2233
+ }
2234
+ .list {
2235
+ flex: 1 1 auto;
2236
+ }
2237
+ .detail {
2238
+ position: fixed;
2239
+ inset: 0;
2240
+ z-index: 15;
2241
+ max-width: none;
2242
+ border-radius: 0;
2243
+ border: 0;
2244
+ padding-top: env(safe-area-inset-top, 0px);
2245
+ padding-left: env(safe-area-inset-left, 0px);
2246
+ padding-right: env(safe-area-inset-right, 0px);
2247
+ }
2248
+ .detail:not(.open) {
2249
+ display: none;
2250
+ }
2251
+ .detail .pb {
2252
+ flex: 1;
2253
+ }
2254
+ .back {
2255
+ display: inline-flex;
2256
+ }
2257
+ .fresh {
2258
+ display: none;
2259
+ }
2260
+ }
2261
+ @media (max-width: 640px) {
2262
+ .bar {
2263
+ flex-wrap: wrap;
2264
+ padding-block: 8px;
2265
+ row-gap: 8px;
2266
+ }
2267
+ .brule {
2268
+ display: none;
2269
+ }
2270
+ .mark svg {
2271
+ width: 80px;
2272
+ }
2273
+ .since {
2274
+ order: 4;
2275
+ width: 100%;
2276
+ white-space: normal;
2277
+ }
2278
+ .tabs {
2279
+ order: 3;
2280
+ width: 100%;
2281
+ margin-left: 0;
2282
+ }
2283
+ .tab {
2284
+ flex: 1;
2285
+ }
2286
+ .row {
2287
+ grid-template-columns: 10px minmax(0, 1fr) 64px;
2288
+ row-gap: 4px;
2289
+ }
2290
+ .row .code {
2291
+ display: none;
2292
+ }
2293
+ .row .tt {
2294
+ grid-column: 2;
2295
+ grid-row: 1;
2296
+ }
2297
+ .row .age {
2298
+ grid-column: 3;
2299
+ grid-row: 1;
2300
+ }
2301
+ .row .strip {
2302
+ grid-column: 2/-1;
2303
+ grid-row: 2;
2304
+ }
2305
+ .row .holder {
2306
+ grid-column: 2/-1;
2307
+ grid-row: 3;
2308
+ }
2309
+ .acts {
2310
+ grid-column: 2/-1;
2311
+ }
2312
+ .tt .sub,
2313
+ .holder,
2314
+ .age,
2315
+ .ev .who,
2316
+ .ev .tm,
2317
+ .ev .src,
2318
+ .meta,
2319
+ .st .h .tm {
2320
+ font-size: 13px;
2321
+ }
2322
+ .tt .t {
2323
+ white-space: normal;
2324
+ }
2325
+ .rel {
2326
+ grid-template-columns: 1fr;
2327
+ overflow: auto;
2328
+ }
2329
+ .rel .pane {
2330
+ min-height: 220px;
2331
+ }
2332
+ .tbl .hide-s {
2333
+ display: none;
2334
+ }
2335
+ }
2336
+ @media (prefers-reduced-motion: reduce) {
2337
+ *,
2338
+ *::before,
2339
+ *::after {
2340
+ animation: none !important;
2341
+ transition: none !important;
2342
+ }
2343
+ .draw > .st {
2344
+ opacity: 1;
2345
+ transform: none;
2346
+ }
2347
+ }
2348
+ .mark img {
2349
+ display: block;
2350
+ height: 28px;
2351
+ width: auto;
2352
+ }
2353
+ .mark:empty,
2354
+ .mark:empty + .brule {
2355
+ display: none;
2356
+ }
2357
+ </style>
2358
+ </head>
2359
+ <body>
2360
+ <div class="app">
2361
+ <header class="bar">
2362
+ <span class="mark" id="mark"></span><span class="brule" aria-hidden="true"></span>
2363
+ <h1 id="boardTitle"></h1>
2364
+ <div class="tabs" role="tablist" aria-label="Màn hình" data-i18n-aria-label="Màn hình">
2365
+ <button
2366
+ class="tab"
2367
+ role="tab"
2368
+ id="tFlows"
2369
+ aria-selected="true"
2370
+ aria-controls="vFlows"
2371
+ type="button"
2372
+ >
2373
+ <span data-i18n="Luồng">Luồng</span>
2374
+ </button>
2375
+ <button
2376
+ class="tab"
2377
+ role="tab"
2378
+ id="tAgents"
2379
+ aria-selected="false"
2380
+ aria-controls="vAgents"
2381
+ type="button"
2382
+ >
2383
+ Agent
2384
+ </button>
2385
+ </div>
2386
+ <span class="spacer"></span>
2387
+ <span class="since" id="since"
2388
+ ><span id="sinceTxt"><span data-i18n="Đang tải">Đang tải</span></span></span
2389
+ >
2390
+ <button class="btn" type="button" id="bSeen">
2391
+ <span data-i18n="Đánh dấu đã xem">Đánh dấu đã xem</span>
2392
+ </button>
2393
+ <span class="fresh" id="fresh"></span>
2394
+ <button class="btn lang" type="button" id="bLang"></button>
2395
+ <button
2396
+ class="btn sq theme"
2397
+ type="button"
2398
+ id="bTheme"
2399
+ aria-label="Giao diện: sáng"
2400
+ data-i18n-aria-label="Giao diện: sáng"
2401
+ ></button>
2402
+ <button
2403
+ class="btn sq"
2404
+ type="button"
2405
+ id="bKeys"
2406
+ aria-label="Phím tắt"
2407
+ data-i18n-aria-label="Phím tắt"
2408
+ aria-expanded="false"
2409
+ >
2410
+ ?
2411
+ </button>
2412
+ </header>
2413
+
2414
+ <main class="view on" id="vFlows" role="tabpanel" aria-labelledby="tFlows">
2415
+ <section
2416
+ class="pane list"
2417
+ aria-label="Danh sách luồng"
2418
+ data-i18n-aria-label="Danh sách luồng"
2419
+ >
2420
+ <div class="ph">
2421
+ <h2><span data-i18n="Luồng việc">Luồng việc</span></h2>
2422
+ <span class="n" id="flowN"></span><span class="spacer"></span>
2423
+ <div
2424
+ class="seg"
2425
+ role="radiogroup"
2426
+ id="vmode"
2427
+ data-i18n-aria-label="vm.label"
2428
+ aria-label="vm.label"
2429
+ >
2430
+ <button type="button" role="radio" data-mode="list">
2431
+ <span data-i18n="vm.list">vm.list</span></button
2432
+ ><button type="button" role="radio" data-mode="diagram">
2433
+ <span data-i18n="vm.diagram">vm.diagram</span></button
2434
+ ><button type="button" role="radio" data-mode="board">
2435
+ <span data-i18n="vm.board">vm.board</span>
2436
+ </button>
2437
+ </div>
2438
+ </div>
2439
+ <div class="pb" id="groups">
2440
+ <p class="empty">
2441
+ <span
2442
+ data-i18n="Đang tải luồng việc. Luồng nào có sự kiện sẽ hiện ở đây, việc cần anh lên trước."
2443
+ >Đang tải luồng việc. Luồng nào có sự kiện sẽ hiện ở đây, việc cần anh lên
2444
+ trước.</span
2445
+ >
2446
+ </p>
2447
+ </div>
2448
+ </section>
2449
+ <div
2450
+ class="split"
2451
+ id="split"
2452
+ role="separator"
2453
+ aria-orientation="vertical"
2454
+ tabindex="0"
2455
+ data-i18n-aria-label="split"
2456
+ aria-label="split"
2457
+ aria-valuemin="25"
2458
+ aria-valuemax="75"
2459
+ ></div>
2460
+ <section
2461
+ class="pane detail"
2462
+ id="detail"
2463
+ aria-label="Chi tiết luồng"
2464
+ data-i18n-aria-label="Chi tiết luồng"
2465
+ data-comment-target
2466
+ >
2467
+ <div class="pb">
2468
+ <div id="dEmpty">
2469
+ <div class="dh">
2470
+ <h3><span data-i18n="Hôm nay">Hôm nay</span></h3>
2471
+ <p class="meta" id="sumLine"><span data-i18n="Đang tải">Đang tải</span></p>
2472
+ <p class="meta">
2473
+ <span
2474
+ data-i18n="Chọn một luồng ở bên trái để xem từng bước, từng vòng review và tin nhắn. Phím j, k để chuyển, Enter để mở."
2475
+ >Chọn một luồng ở bên trái để xem từng bước, từng vòng review và tin nhắn. Phím
2476
+ j, k để chuyển, Enter để mở.</span
2477
+ >
2478
+ </p>
2479
+ </div>
2480
+ <h4 class="dlabel"><span data-i18n="Sự kiện mới nhất">Sự kiện mới nhất</span></h4>
2481
+ <ul class="evs" id="recent" style="padding: 8px 16px 16px"></ul>
2482
+ </div>
2483
+ <div id="dBody" hidden></div>
2484
+ </div>
2485
+ </section>
2486
+ </main>
2487
+
2488
+ <main class="view" id="vAgents" role="tabpanel" aria-labelledby="tAgents">
2489
+ <section class="pane graphp" aria-label="Agent graph">
2490
+ <div class="ph">
2491
+ <h2><span data-i18n="gr.title">gr.title</span></h2>
2492
+ <span class="n" id="agN"></span><span class="spacer"></span
2493
+ ><span class="glegend" id="gLegend"></span>
2494
+ </div>
2495
+ <div class="pb gwrap" id="gWrap">
2496
+ <svg id="graph" class="graph" role="group" aria-label="graph"></svg>
2497
+ </div>
2498
+ </section>
2499
+ <section class="pane gside" aria-label="Pair">
2500
+ <div class="ph">
2501
+ <h2 id="gSideT"><span data-i18n="gr.pick">gr.pick</span></h2>
2502
+ </div>
2503
+ <div class="pb" id="gSide"><p class="empty" data-i18n="gr.hint">gr.hint</p></div>
2504
+ </section>
2505
+ </main>
2506
+
2507
+ <footer
2508
+ class="dock"
2509
+ id="dock"
2510
+ aria-label="Các agent đang chạy"
2511
+ data-i18n-aria-label="Các agent đang chạy"
2512
+ >
2513
+ <div class="dock-lbl">
2514
+ <b id="dockN">Agent</b
2515
+ ><span id="dockSum"><span data-i18n="đang tải">đang tải</span></span>
2516
+ </div>
2517
+ </footer>
2518
+ </div>
2519
+
2520
+ <div
2521
+ class="pop"
2522
+ id="pop"
2523
+ hidden
2524
+ role="dialog"
2525
+ aria-modal="false"
2526
+ aria-labelledby="popName"
2527
+ ></div>
2528
+ <div class="toast" id="toast" role="status" aria-live="polite"></div>
2529
+ <div
2530
+ class="keys"
2531
+ id="keys"
2532
+ hidden
2533
+ role="dialog"
2534
+ aria-label="Phím tắt"
2535
+ data-i18n-aria-label="Phím tắt"
2536
+ >
2537
+ <h2><span data-i18n="Phím tắt">Phím tắt</span></h2>
2538
+ <dl>
2539
+ <dt>j / k</dt>
2540
+ <dd><span data-i18n="Luồng sau / trước">Luồng sau / trước</span></dd>
2541
+ <dt>Enter</dt>
2542
+ <dd><span data-i18n="Mở chi tiết">Mở chi tiết</span></dd>
2543
+ <dt>e</dt>
2544
+ <dd><span data-i18n="Các bước hoặc mọi sự kiện">Các bước hoặc mọi sự kiện</span></dd>
2545
+ <dt>Esc</dt>
2546
+ <dd><span data-i18n="Đóng">Đóng</span></dd>
2547
+ <dt>?</dt>
2548
+ <dd><span data-i18n="Bảng này">Bảng này</span></dd>
2549
+ </dl>
2550
+ </div>
2551
+
2552
+ <!--BOARD_DATA-->
2553
+ <script>
2554
+ const DICT = {
2555
+ en: {
2556
+ ' (giờ ước lượng)': ' (estimated time)',
2557
+ ' (luồng ': ' (flow ',
2558
+ ' bị chặn': ' blocked',
2559
+ ' bị chặn · ': ' blocked · ',
2560
+ ' chờ anh': ' waiting on you',
2561
+ ' giờ': ' h',
2562
+ ' luồng': ' flows',
2563
+ ' luồng cần anh · ': ' need you · ',
2564
+ ' lúc ': ' at ',
2565
+ ' lần ': ' try ',
2566
+ ' ngày': ' d',
2567
+ ' phút': ' min',
2568
+ ' rảnh': ' idle',
2569
+ ' sự kiện': ' events',
2570
+ ' sự kiện mới': ' new events',
2571
+ ' trước': ' ago',
2572
+ ' vòng review': ' review rounds',
2573
+ ' xong hôm nay': ' done today',
2574
+ ' đang chạy · ': ' running · ',
2575
+ ' đang làm': ' working',
2576
+ ', luồng ': ', flow ',
2577
+ '. Bấm để đổi': '. Click to change',
2578
+ '5 sự kiện gần nhất': 'Last 5 events',
2579
+ 'Chi tiết luồng': 'Flow detail',
2580
+ 'Các agent đang chạy': 'Running agents',
2581
+ 'Danh sách luồng': 'Flow list',
2582
+ 'Giao diện: sáng': 'Theme: light',
2583
+ 'Màn hình': 'Screens',
2584
+ 'Phím tắt': 'Shortcuts',
2585
+ 'Anh đã chọn ': 'You chose ',
2586
+ 'Bàn giao': 'Handoff',
2587
+ 'Bắt đầu': 'Started',
2588
+ 'Bị chặn': 'Blocked',
2589
+ 'Bị chặn / Lỗi': 'Blocked',
2590
+ 'Bỏ lọc luồng': 'Clear flow filter',
2591
+ 'Bỏ lọc theo ': 'Clear filter for ',
2592
+ 'Chưa có luồng nào. Bật events.log, hoặc ghi một dòng bằng vulcan event add.':
2593
+ 'No flows yet. Turn on events.log, or write a line with vulcan event add.',
2594
+ 'Chưa có sự kiện nào của agent này.': 'No events from this agent yet.',
2595
+ 'Chờ anh': 'Waiting on you',
2596
+ 'Các bước': 'Stages',
2597
+ 'Cần anh': 'Needs you',
2598
+ 'Của ': 'By ',
2599
+ Duyệt: 'Approve',
2600
+ 'Giao diện: ': 'Theme: ',
2601
+ 'Bảng này': 'This panel',
2602
+ 'Chọn một luồng ở bên trái để xem từng bước, từng vòng review và tin nhắn. Phím j, k để chuyển, Enter để mở.':
2603
+ 'Pick a flow on the left to see each stage, each review round and the messages. j and k move, Enter opens.',
2604
+ 'Các bước hoặc mọi sự kiện': 'Stages or all events',
2605
+ 'Cách đây': 'Ago',
2606
+ 'Hôm nay': 'Today',
2607
+ Luồng: 'Flows',
2608
+ 'Luồng sau / trước': 'Next / previous flow',
2609
+ 'Luồng việc': 'Flows',
2610
+ Máy: 'Host',
2611
+ 'Mở chi tiết': 'Open detail',
2612
+ 'Sự kiện cuối': 'Last event',
2613
+ 'Sự kiện mới nhất': 'Latest events',
2614
+ 'Trạng thái': 'State',
2615
+ 'Đang giữ': 'Holder',
2616
+ 'Đang tải': 'Loading',
2617
+ 'Đang tải luồng việc. Luồng nào có sự kiện sẽ hiện ở đây, việc cần anh lên trước.':
2618
+ 'Loading flows. Flows with events show here, the ones that need you first.',
2619
+ 'Đánh dấu đã xem': 'Mark as seen',
2620
+ Đóng: 'Close',
2621
+ 'Để sau': 'Park',
2622
+ 'đang tải': 'loading',
2623
+ 'Không có': 'None',
2624
+ 'Không có PR nào đang mở.': 'No open pull requests.',
2625
+ 'Không có gì chờ anh.': 'Nothing waits on you.',
2626
+ 'Không có tin nào đang chờ.': 'No message is waiting.',
2627
+ 'Lọc luồng': 'Filter flows',
2628
+ 'Mọi sự kiện (': 'All events (',
2629
+ 'Mở trên GitHub': 'Open on GitHub',
2630
+ 'PR đang mở (': 'Open pull requests (',
2631
+ 'Quay lại': 'Back',
2632
+ Rảnh: 'Idle',
2633
+ 'Sự kiện': 'Events',
2634
+ 'Sự kiện cuối lúc ': 'Last event at ',
2635
+ 'Thiết kế': 'Design',
2636
+ 'Tin nhắn chưa có trả lời (': 'Unanswered messages (',
2637
+ 'Trống.': 'Empty.',
2638
+ 'Từ lần xem trước lúc ': 'Since your last visit at ',
2639
+ 'Vòng ': 'Round ',
2640
+ 'Vòng của ': 'Rounds of ',
2641
+ 'Xong hôm nay': 'Done today',
2642
+ 'bàn giao': 'handoff',
2643
+ 'bị chặn': 'blocked',
2644
+ 'chưa có agent': 'no agents yet',
2645
+ 'chưa có việc': 'no work yet',
2646
+ 'chế độ này không gửi được': 'this view cannot send',
2647
+ 'chỉ người sửa được artifact mới gửi được': 'only editors of this artifact can send',
2648
+ 'chờ anh': 'waiting on you',
2649
+ 'chờ anh: ': 'waiting on you: ',
2650
+ cũ: 'stale',
2651
+ 'ghi chú': 'note',
2652
+ 'giao việc': 'assign',
2653
+ 'giờ ước lượng': 'estimated time',
2654
+ 'không có phiên nào đang mở': 'no session is open',
2655
+ 'kiểm lúc ': 'checked at ',
2656
+ lỗi: 'error',
2657
+ 'phát hành': 'release',
2658
+ 'quyết định': 'decision',
2659
+ rảnh: 'idle',
2660
+ sáng: 'light',
2661
+ sửa: 'fix',
2662
+ 'theo máy': 'system',
2663
+ 'thiết kế': 'design',
2664
+ 'tin nhắn': 'message',
2665
+ tối: 'dark',
2666
+ 'từ ': 'since ',
2667
+ 'vừa xong': 'just now',
2668
+ 'Đang chạy': 'Running',
2669
+ 'Đang làm': 'Working',
2670
+ 'Đã merge, chưa phát hành (': 'Merged, not released (',
2671
+ 'Đề xuất': 'Proposal',
2672
+ 'đang làm': 'working',
2673
+ đạt: 'pass',
2674
+ 'đề xuất': 'proposal',
2675
+ đỏ: 'red',
2676
+ xanh: 'green',
2677
+ 'sửa ': 'fix ',
2678
+ Code: 'Code',
2679
+ 'PR + CI': 'PR + CI',
2680
+ Review: 'Review',
2681
+ Merge: 'Merge',
2682
+ },
2683
+ vi: {},
2684
+ };
2685
+ DICT.en['g.you'] = 'Needs you';
2686
+ DICT.vi['g.you'] = 'Cần anh';
2687
+ DICT.en['g.blocked'] = 'Blocked';
2688
+ DICT.vi['g.blocked'] = 'Bị chặn / Lỗi';
2689
+ DICT.en['g.running'] = 'Running';
2690
+ DICT.vi['g.running'] = 'Đang chạy';
2691
+ DICT.en['g.parked'] = 'Parked';
2692
+ DICT.vi['g.parked'] = 'Để sau';
2693
+ DICT.en['g.done'] = 'Done today';
2694
+ DICT.vi['g.done'] = 'Xong hôm nay';
2695
+ DICT.en['rảnh · '] = 'idle · ';
2696
+ DICT.vi['rảnh · '] = 'rảnh · ';
2697
+ DICT.en['Xong'] = 'Done';
2698
+ DICT.vi['Xong'] = 'Xong';
2699
+ DICT.en['st.parked'] = 'Parked';
2700
+ DICT.vi['st.parked'] = 'Để sau';
2701
+ DICT.en['lang.en'] = 'English';
2702
+ DICT.vi['lang.en'] = 'English';
2703
+ DICT.en['lang.vi'] = 'Tiếng Việt';
2704
+ DICT.vi['lang.vi'] = 'Tiếng Việt';
2705
+ DICT.en['lang.label'] = 'Language';
2706
+ DICT.vi['lang.label'] = 'Ngôn ngữ';
2707
+ DICT.en['split'] = 'Resize the flow list and the detail';
2708
+ DICT.vi['split'] = 'Kéo để đổi độ rộng danh sách và chi tiết';
2709
+ DICT.en['gr.title'] = 'Agent graph';
2710
+ DICT.vi['gr.title'] = 'Sơ đồ agent';
2711
+ DICT.en['gr.pick'] = 'Pick a link';
2712
+ DICT.vi['gr.pick'] = 'Chọn một đường nối';
2713
+ DICT.en['gr.hint'] =
2714
+ 'Click a line between two agents to see what passed between them and the flows it touched. Click an agent for its details.';
2715
+ DICT.vi['gr.hint'] =
2716
+ 'Bấm một đường nối giữa hai agent để xem họ đã trao đổi gì và những luồng liên quan. Bấm một agent để xem chi tiết.';
2717
+ DICT.en['gr.active'] = 'active in the last 30 min';
2718
+ DICT.vi['gr.active'] = 'có hoạt động trong 30 phút qua';
2719
+ DICT.en['gr.events'] = 'events';
2720
+ DICT.vi['gr.events'] = 'sự kiện';
2721
+ DICT.en['gr.flows'] = 'Flows';
2722
+ DICT.vi['gr.flows'] = 'Luồng';
2723
+ DICT.en['vm.label'] = 'View';
2724
+ DICT.vi['vm.label'] = 'Cách xem';
2725
+ DICT.en['vm.list'] = 'List';
2726
+ DICT.vi['vm.list'] = 'Danh sách';
2727
+ DICT.en['vm.diagram'] = 'Flow diagram';
2728
+ DICT.vi['vm.diagram'] = 'Sơ đồ luồng';
2729
+ DICT.en['vm.board'] = 'Board';
2730
+ DICT.vi['vm.board'] = 'Bảng';
2731
+ DICT.en['rounds'] = 'rounds';
2732
+ DICT.vi['rounds'] = 'vòng';
2733
+ DICT.en['Reassign'] = 'Reassign';
2734
+ DICT.vi['Reassign'] = 'Giao lại';
2735
+ DICT.en['to'] = 'to';
2736
+ DICT.vi['to'] = 'cho';
2737
+ DICT.en['kb.empty'] = 'No flow here';
2738
+ DICT.vi['kb.empty'] = 'Không có luồng';
2739
+ DICT.en['kb.wait'] = 'waiting';
2740
+ DICT.vi['kb.wait'] = 'chờ';
2741
+ DICT.en['kb.block'] = 'blocked';
2742
+ DICT.vi['kb.block'] = 'chặn';
2743
+ DICT.en['dg.title'] = 'Flow diagram';
2744
+ DICT.vi['dg.title'] = 'Sơ đồ luồng';
2745
+ DICT.en['n.agents'] = 'agents';
2746
+ DICT.vi['n.agents'] = 'agent';
2747
+ DICT.en['Anh duyệt'] = 'Approval';
2748
+ DICT.en['Phát hành'] = 'Release';
2749
+ const DATA = JSON.parse(document.getElementById('board-data').textContent);
2750
+ const OWNER = DATA.owner;
2751
+ const LS_PREFIX = 'board:' + DATA.key + ':';
2752
+ const LANG_LS = LS_PREFIX + 'lang';
2753
+ let lang = (() => {
2754
+ try {
2755
+ return localStorage.getItem(LANG_LS) || 'en';
2756
+ } catch {
2757
+ return 'en';
2758
+ }
2759
+ })();
2760
+ if (lang !== 'en' && lang !== 'vi') lang = 'en';
2761
+ const t = (k) =>
2762
+ k == null ? k : ((DICT[lang] && DICT[lang][k]) ?? (lang === 'en' ? (DICT.en[k] ?? k) : k));
2763
+
2764
+ const STAGES = [
2765
+ 'Đề xuất',
2766
+ 'Anh duyệt',
2767
+ 'Thiết kế',
2768
+ 'Code',
2769
+ 'PR + CI',
2770
+ 'Review',
2771
+ 'Merge',
2772
+ 'Phát hành',
2773
+ 'Bàn giao',
2774
+ ];
2775
+ const GROUPS = [
2776
+ { key: 'you', label: 'g.you', sw: 'var(--ink)', open: true },
2777
+ { key: 'blocked', label: 'g.blocked', sw: 'var(--fail)', open: true },
2778
+ { key: 'running', label: 'g.running', sw: 'var(--accent)', open: true },
2779
+ { key: 'parked', label: 'g.parked', sw: 'var(--line-2)', open: false },
2780
+ { key: 'done', label: 'g.done', sw: 'var(--ok)', open: false },
2781
+ ];
2782
+ const STATE_TXT = {
2783
+ you: 'Cần anh',
2784
+ blocked: 'Bị chặn',
2785
+ running: 'Đang chạy',
2786
+ parked: 'st.parked',
2787
+ done: 'Xong',
2788
+ };
2789
+ const KIND_TXT = {
2790
+ request: 'đề xuất',
2791
+ decision: 'quyết định',
2792
+ assign: 'giao việc',
2793
+ note: 'ghi chú',
2794
+ design: 'thiết kế',
2795
+ commit: 'code',
2796
+ pr: 'PR',
2797
+ ci: 'CI',
2798
+ review: 'review',
2799
+ fix: 'sửa',
2800
+ merge: 'merge',
2801
+ release: 'phát hành',
2802
+ handoff: 'bàn giao',
2803
+ msg: 'tin nhắn',
2804
+ };
2805
+ const LS = LS_PREFIX + 'lastSeen';
2806
+ const $ = (id) => document.getElementById(id);
2807
+ const el = (t, c, x) => {
2808
+ const e = document.createElement(t);
2809
+ if (c) e.className = c;
2810
+ if (x != null) e.textContent = x;
2811
+ return e;
2812
+ };
2813
+ const lsGet = (k) => {
2814
+ try {
2815
+ return localStorage.getItem(k);
2816
+ } catch {
2817
+ return null;
2818
+ }
2819
+ };
2820
+ const lsSet = (k, v) => {
2821
+ try {
2822
+ localStorage.setItem(k, v);
2823
+ } catch {}
2824
+ };
2825
+ const hhmm = (iso) => {
2826
+ const d = new Date(iso);
2827
+ return isNaN(d)
2828
+ ? '--:--'
2829
+ : d.toLocaleTimeString('vi-VN', { hour: '2-digit', minute: '2-digit', hour12: false });
2830
+ };
2831
+ const ago = (iso) => {
2832
+ const m = Math.max(0, Math.round((Date.now() - new Date(iso)) / 60000));
2833
+ if (m < 1) return t('vừa xong');
2834
+ if (m < 60) return m + t(' phút');
2835
+ const h = Math.floor(m / 60);
2836
+ if (h < 24) return h + t(' giờ') + (m % 60 ? ' ' + (m % 60) + t(' phút') : '');
2837
+ return Math.floor(h / 24) + t(' ngày');
2838
+ };
2839
+ const isApprox = (e) => /ước lượng/.test(e.source || '');
2840
+ const sameDay = (iso) => new Date(iso).toDateString() === new Date().toDateString();
2841
+ const NS = 'http://www.w3.org/2000/svg';
2842
+ function mk(bad) {
2843
+ const s = document.createElementNS(NS, 'svg');
2844
+ s.setAttribute('viewBox', '0 0 10 10');
2845
+ s.setAttribute('class', 'mk ' + (bad ? 'x' : 'v'));
2846
+ s.setAttribute('role', 'img');
2847
+ s.setAttribute('aria-label', bad ? t('lỗi') : t('đạt'));
2848
+ const p = document.createElementNS(NS, 'path');
2849
+ p.setAttribute('d', bad ? 'M2.5 2.5l5 5M7.5 2.5l-5 5' : 'M2 5.4l2 2 4-4.8');
2850
+ p.setAttribute('fill', 'none');
2851
+ p.setAttribute('stroke', 'currentColor');
2852
+ p.setAttribute('stroke-width', '1.6');
2853
+ p.setAttribute('stroke-linecap', 'round');
2854
+ p.setAttribute('stroke-linejoin', 'round');
2855
+ s.append(p);
2856
+ return s;
2857
+ }
2858
+ const STAGE_OF = {
2859
+ request: 0,
2860
+ decision: 1,
2861
+ design: 2,
2862
+ commit: 3,
2863
+ code: 3,
2864
+ pr: 4,
2865
+ ci: 4,
2866
+ review: 5,
2867
+ fix: 5,
2868
+ merge: 6,
2869
+ release: 7,
2870
+ handoff: 8,
2871
+ };
2872
+ const normEv = (e) =>
2873
+ typeof e.stage === 'number'
2874
+ ? e
2875
+ : { ...e, stage: STAGE_OF[e.stage] ?? STAGE_OF[e.kind] ?? 0 };
2876
+ const byTs = (a, b) => (a.ts < b.ts ? -1 : a.ts > b.ts ? 1 : (a.stage || 0) - (b.stage || 0));
2877
+
2878
+ let flowsDoc = {},
2879
+ events = [],
2880
+ decisions = {},
2881
+ agentsDoc = {},
2882
+ releases = [];
2883
+ let selected = null,
2884
+ showAll = false,
2885
+ attemptSel = {},
2886
+ openGroups = {},
2887
+ lastTsSeen = {},
2888
+ drawn = new Set(),
2889
+ FL = [];
2890
+ let agentFilter = null,
2891
+ prevUnread = null;
2892
+ const VM_LS = LS_PREFIX + 'view';
2893
+ let viewMode = (() => {
2894
+ try {
2895
+ return localStorage.getItem(VM_LS) || 'list';
2896
+ } catch {
2897
+ return 'list';
2898
+ }
2899
+ })();
2900
+ if (!['list', 'diagram', 'board'].includes(viewMode)) viewMode = 'list';
2901
+ const RM = () => {
2902
+ try {
2903
+ return matchMedia('(prefers-reduced-motion: reduce)').matches;
2904
+ } catch {
2905
+ return false;
2906
+ }
2907
+ };
2908
+ const replay = (node, cls) => {
2909
+ if (!node || RM()) return;
2910
+ node.classList.remove(cls);
2911
+ void node.offsetWidth;
2912
+ node.classList.add(cls);
2913
+ };
2914
+ let lastSeen = lsGet(LS);
2915
+ if (!lastSeen) {
2916
+ lastSeen = new Date().toISOString();
2917
+ lsSet(LS, lastSeen);
2918
+ }
2919
+ for (const g of GROUPS) openGroups[g.key] = g.open;
2920
+
2921
+ function fold() {
2922
+ const out = [];
2923
+ for (const f of DATA.flows) {
2924
+ const evs = f.events.map(normEv).sort(byTs);
2925
+ const last = evs.find((e) => e.id === f.lastId) || evs[evs.length - 1];
2926
+ const lastAsk = f.askId ? evs.find((e) => e.id === f.askId) : undefined;
2927
+ const att = {};
2928
+ for (const e of evs) {
2929
+ if (e.kind === 'ci' || e.kind === 'review' || e.kind === 'release')
2930
+ (att[e.stage] || (att[e.stage] = [])).push(e);
2931
+ }
2932
+ const fresh = evs.filter((e) => e.ts > lastSeen);
2933
+ out.push({
2934
+ id: f.id,
2935
+ f: { title: f.title, repo: f.repo },
2936
+ evs,
2937
+ last,
2938
+ state: f.state,
2939
+ holder: f.holder,
2940
+ stages: f.stages,
2941
+ cur: f.cur,
2942
+ att,
2943
+ lastAsk,
2944
+ dec: DATA.decisions[f.id],
2945
+ unread: fresh.length > 0,
2946
+ newCount: fresh.length,
2947
+ approxLast: isApprox(last),
2948
+ });
2949
+ }
2950
+ return out;
2951
+ }
2952
+
2953
+ function stripOf(fl) {
2954
+ const s = el('div', 'strip');
2955
+ for (const k of fl.stages) {
2956
+ const cur = k === fl.cur;
2957
+ const g = el(
2958
+ 'span',
2959
+ 'sg' +
2960
+ (k < fl.cur ? ' past' : '') +
2961
+ (cur
2962
+ ? ' cur' + (fl.state === 'you' ? ' you' : fl.state === 'blocked' ? ' blocked' : '')
2963
+ : ''),
2964
+ );
2965
+ const a = fl.att[k] || [];
2966
+ const ci = a.filter((e) => e.kind === 'ci' || e.kind === 'release'),
2967
+ rv = a.filter((e) => e.kind === 'review');
2968
+ g.append(t(STAGES[k]));
2969
+ if (ci.length) {
2970
+ for (const e of ci.slice(-4)) g.append(mk(e.status === 'fail'));
2971
+ }
2972
+ if (rv.length > 1) g.append(el('span', null, '×' + rv.length));
2973
+ else if (rv.length === 1 && rv[0].status === 'fail') g.append(mk(true));
2974
+ g.title =
2975
+ t(STAGES[k]) +
2976
+ (ci.length
2977
+ ? ' · CI ' + ci.map((e) => (e.status === 'fail' ? t('đỏ') : 'xanh')).join(', ')
2978
+ : '') +
2979
+ (rv.length ? ' · ' + rv.length + t(' vòng review') : '');
2980
+ s.append(g);
2981
+ }
2982
+ return s;
2983
+ }
2984
+
2985
+ // A pull request link only when it is an https address, or can be made from `owner/name` and the number.
2986
+ const prHref = (p) =>
2987
+ /^https:\/\//.test(p.link || '')
2988
+ ? p.link
2989
+ : /^[\w.-]+\/[\w.-]+$/.test(p.repo || '') && p.n
2990
+ ? 'https://github.com/' + p.repo + '/pull/' + p.n
2991
+ : '';
2992
+ const involves = (x, n) => x.holder === n || x.evs.some((e) => e.actor === n || e.to === n);
2993
+ function renderList() {
2994
+ FL = fold();
2995
+ const groups = $('groups');
2996
+ const before = {};
2997
+ for (const r of groups.querySelectorAll('.row'))
2998
+ before[r.dataset.id] = r.getBoundingClientRect().top;
2999
+ groups.replaceChildren();
3000
+ const fn = $('flowN');
3001
+ fn.replaceChildren(FL.length + t(' luồng'));
3002
+ if (agentFilter) {
3003
+ const c = el('button', 'filter-chip');
3004
+ c.type = 'button';
3005
+ c.setAttribute('aria-label', t('Bỏ lọc theo ') + agentFilter);
3006
+ c.append(t('Của '), el('b', null, agentFilter), ' ×');
3007
+ c.addEventListener('click', () => setAgentFilter(null));
3008
+ fn.append(' · ', c);
3009
+ }
3010
+ const unreadNow = new Set();
3011
+ if (viewMode === 'board' && FL.length) {
3012
+ renderBoardKb(groups);
3013
+ prevUnread = new Set();
3014
+ finishList();
3015
+ return;
3016
+ }
3017
+ if (!FL.length) {
3018
+ groups.append(
3019
+ el(
3020
+ 'p',
3021
+ 'empty',
3022
+ t('Chưa có luồng nào. Bật events.log, hoặc ghi một dòng bằng vulcan event add.'),
3023
+ ),
3024
+ );
3025
+ } else
3026
+ for (const g of GROUPS) {
3027
+ const items = FL.filter(
3028
+ (x) =>
3029
+ x.state === g.key &&
3030
+ (g.key !== 'done' || sameDay(x.last.ts)) &&
3031
+ (!agentFilter || involves(x, agentFilter)),
3032
+ ).sort((a, b) =>
3033
+ g.key === 'you' || g.key === 'blocked' ? byTs(a.last, b.last) : byTs(b.last, a.last),
3034
+ );
3035
+ const sec = el('section', 'grp');
3036
+ const h = el('button', 'gh');
3037
+ h.type = 'button';
3038
+ h.setAttribute('aria-expanded', String(openGroups[g.key]));
3039
+ h.innerHTML =
3040
+ '<svg class="chev" viewBox="0 0 12 12" aria-hidden="true"><path d="M3 4.5l3 3 3-3" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>';
3041
+ const sw = el('span', 'sw');
3042
+ sw.style.background = g.sw;
3043
+ h.append(sw, el('span', null, t(g.label)), el('span', 'n', String(items.length)));
3044
+ h.addEventListener('click', () => {
3045
+ openGroups[g.key] = !openGroups[g.key];
3046
+ renderList();
3047
+ });
3048
+ sec.append(h);
3049
+ if (openGroups[g.key]) {
3050
+ if (!items.length)
3051
+ sec.append(
3052
+ el('p', 'empty', g.key === 'you' ? t('Không có gì chờ anh.') : t('Trống.')),
3053
+ );
3054
+ for (const fl of items) {
3055
+ const r = el('div', 'row');
3056
+ r.tabIndex = 0;
3057
+ r.dataset.id = fl.id;
3058
+ r.setAttribute('role', 'button');
3059
+ r.dataset.commentTarget = '';
3060
+ r.setAttribute('aria-selected', String(selected === fl.id));
3061
+ const dot = fl.unread ? el('span', 'unread') : el('span');
3062
+ if (fl.unread) {
3063
+ dot.title = fl.newCount + t(' sự kiện mới');
3064
+ dot.setAttribute('aria-label', fl.newCount + t(' sự kiện mới'));
3065
+ unreadNow.add(fl.id);
3066
+ if (prevUnread && !prevUnread.has(fl.id)) replay(dot, 'pop');
3067
+ }
3068
+ r.append(dot, el('span', 'code', fl.id === 'Unsorted' ? '-' : fl.id));
3069
+ const tt = el('div', 'tt');
3070
+ tt.append(el('div', 't', fl.f.title));
3071
+ const sub = el('div', 'sub');
3072
+ sub.append(
3073
+ el('span', 'repo', fl.f.repo),
3074
+ el(
3075
+ 'span',
3076
+ 'last',
3077
+ fl.state === 'you' && fl.lastAsk ? fl.lastAsk.summary : fl.last.summary,
3078
+ ),
3079
+ );
3080
+ tt.append(sub);
3081
+ r.append(tt, stripOf(fl), el('span', 'holder', fl.holder));
3082
+ const ag = el(
3083
+ 'span',
3084
+ 'age' + (fl.state === 'you' || fl.state === 'blocked' ? ' hot' : ''),
3085
+ (fl.approxLast ? '≈ ' : '') + ago(fl.last.ts),
3086
+ );
3087
+ ag.title =
3088
+ t('Sự kiện cuối lúc ') +
3089
+ hhmm(fl.last.ts) +
3090
+ (fl.approxLast ? t(' (giờ ước lượng)') : '');
3091
+ r.append(ag);
3092
+ r.addEventListener('click', () => select(fl.id, true));
3093
+ r.addEventListener('keydown', (ev) => {
3094
+ if (ev.key === 'Enter' && ev.target === r) {
3095
+ ev.preventDefault();
3096
+ select(fl.id, true);
3097
+ }
3098
+ });
3099
+ if (lastTsSeen[fl.id] && lastTsSeen[fl.id] !== fl.last.ts) {
3100
+ r.classList.add('flash');
3101
+ const cur = r.querySelector('.sg.cur');
3102
+ if (cur && !RM()) cur.classList.add('sweep');
3103
+ }
3104
+ lastTsSeen[fl.id] = fl.last.ts;
3105
+ sec.append(r);
3106
+ }
3107
+ }
3108
+ groups.append(sec);
3109
+ }
3110
+ prevUnread = unreadNow;
3111
+ if (!RM())
3112
+ for (const r of groups.querySelectorAll('.row')) {
3113
+ const was = before[r.dataset.id];
3114
+ if (was === undefined) continue;
3115
+ const dy = was - r.getBoundingClientRect().top;
3116
+ if (Math.abs(dy) < 1) continue;
3117
+ r.style.transform = 'translateY(' + dy + 'px)';
3118
+ void r.offsetWidth;
3119
+ r.classList.add('glide');
3120
+ r.style.transform = '';
3121
+ r.addEventListener('transitionend', () => r.classList.remove('glide'), { once: true });
3122
+ }
3123
+ finishList();
3124
+ }
3125
+ function finishList() {
3126
+ const n = FL.reduce((s, x) => s + x.newCount, 0);
3127
+ $('sinceTxt').replaceChildren(
3128
+ t('Từ lần xem trước lúc '),
3129
+ el('b', null, hhmm(lastSeen)),
3130
+ ': ',
3131
+ el('b', null, String(n)),
3132
+ t(' sự kiện mới'),
3133
+ );
3134
+ const gh = events
3135
+ .filter((e) => e.source === 'github')
3136
+ .map((e) => e.checkedAt)
3137
+ .filter(Boolean)
3138
+ .sort()
3139
+ .at(-1);
3140
+ const fr = $('fresh');
3141
+ fr.replaceChildren();
3142
+ if (gh) {
3143
+ fr.append('GitHub ' + hhmm(gh));
3144
+ if (Date.now() - new Date(gh) > 30 * 60000) fr.append(el('span', 'st', t('cũ')));
3145
+ }
3146
+ const cnt = (k) =>
3147
+ FL.filter((x) => x.state === k && (k !== 'done' || sameDay(x.last.ts))).length;
3148
+ $('sumLine').textContent =
3149
+ cnt('you') +
3150
+ t(' luồng cần anh · ') +
3151
+ cnt('blocked') +
3152
+ t(' bị chặn · ') +
3153
+ cnt('running') +
3154
+ t(' đang chạy · ') +
3155
+ cnt('done') +
3156
+ t(' xong hôm nay');
3157
+ const rec = $('recent');
3158
+ rec.replaceChildren();
3159
+ for (const e of events.slice().sort(byTs).reverse().slice(0, 14)) {
3160
+ const li = evItem(e);
3161
+ const f = flowsDoc[e.flowId];
3162
+ const tag = el('button', 'btn chip', e.flowId);
3163
+ tag.type = 'button';
3164
+ tag.title = f ? f.title : '';
3165
+ tag.addEventListener('click', () => select(e.flowId, true));
3166
+ li.children[1].prepend(tag);
3167
+ rec.append(li);
3168
+ }
3169
+ if (selected) renderDetail(false);
3170
+ }
3171
+
3172
+ function select(id, open) {
3173
+ selected = id;
3174
+ document
3175
+ .querySelectorAll('.row')
3176
+ .forEach((r) => r.setAttribute('aria-selected', String(r.dataset.id === id)));
3177
+ const r = document.querySelector('.row[data-id="' + id + '"]');
3178
+ if (r) r.scrollIntoView({ block: 'nearest' });
3179
+ if (open) $('detail').classList.add('open');
3180
+ renderDetail(true);
3181
+ }
3182
+ function closeDetail() {
3183
+ $('detail').classList.remove('open');
3184
+ const r = document.querySelector('.row[data-id="' + selected + '"]');
3185
+ if (r) r.focus();
3186
+ }
3187
+
3188
+ function evItem(e) {
3189
+ const li = el('li', 'ev' + (e.status === 'fail' || e.status === 'blocked' ? ' fail' : ''));
3190
+ li.append(el('span', 'tm', (isApprox(e) ? '≈' : '') + hhmm(e.ts)));
3191
+ const body = el('div');
3192
+ const who = el('div', 'who');
3193
+ who.append(el('b', null, e.actor));
3194
+ if (e.to) who.append(' → ', el('b', null, e.to));
3195
+ who.append(
3196
+ ' · ' + (t(KIND_TXT[e.kind]) || e.kind) + (e.attempt > 1 ? t(' lần ') + e.attempt : ''),
3197
+ );
3198
+ body.append(who, el('div', 'sm', e.summary));
3199
+ const meta = el('div');
3200
+ if (e.link && /^https:\/\//.test(e.link)) {
3201
+ const l = el('a', 'lk', e.link.replace(/^https:\/\/github\.com\//, ''));
3202
+ l.href = e.link;
3203
+ l.target = '_blank';
3204
+ l.rel = 'noopener';
3205
+ meta.append(l, ' · ');
3206
+ }
3207
+ meta.append(
3208
+ el(
3209
+ 'span',
3210
+ 'src',
3211
+ isApprox(e) ? t('giờ ước lượng') : e.source === 'github' ? 'GitHub' : e.source || '',
3212
+ ),
3213
+ );
3214
+ body.append(meta);
3215
+ li.append(body);
3216
+ return li;
3217
+ }
3218
+
3219
+ function renderDetail(fresh) {
3220
+ const fl = FL.find((x) => x.id === selected);
3221
+ const box = $('dBody');
3222
+ if (!fl) {
3223
+ box.hidden = true;
3224
+ $('dEmpty').hidden = false;
3225
+ return;
3226
+ }
3227
+ $('dEmpty').hidden = true;
3228
+ box.hidden = false;
3229
+ box.replaceChildren();
3230
+ const dh = el('div', 'dh');
3231
+ const top = el('div', 'top');
3232
+ const back = el('button', 'btn back', t('Quay lại'));
3233
+ back.type = 'button';
3234
+ back.addEventListener('click', closeDetail);
3235
+ top.append(
3236
+ back,
3237
+ el('span', 'code', fl.id === 'Unsorted' ? '-' : fl.id),
3238
+ el('span', 'repo', fl.f.repo),
3239
+ el('span', 'pill ' + fl.state, t(STATE_TXT[fl.state])),
3240
+ );
3241
+ dh.append(top, el('h3', null, fl.f.title));
3242
+ const meta = el('div', 'meta');
3243
+ const m = (k, v) => {
3244
+ const s = el('span');
3245
+ s.append(k + ' ', el('b', null, v));
3246
+ meta.append(s);
3247
+ };
3248
+ m(t('Đang giữ'), fl.holder);
3249
+ m(t('Sự kiện cuối'), (fl.approxLast ? '≈ ' : '') + ago(fl.last.ts) + t(' trước'));
3250
+ m(t('Bắt đầu'), hhmm(fl.evs[0].ts));
3251
+ m(t('Sự kiện'), String(fl.evs.length));
3252
+ dh.append(meta);
3253
+ if (fl.state === 'you' && fl.lastAsk) dh.append(el('div', 'ask', fl.lastAsk.summary));
3254
+ if (fl.dec && (!fl.lastAsk || fl.dec.at > fl.lastAsk.ts))
3255
+ dh.append(
3256
+ el(
3257
+ 'div',
3258
+ 'meta',
3259
+ t('Anh đã chọn ') +
3260
+ (fl.dec.choice === 'approve' ? t('Duyệt') : t('Để sau')) +
3261
+ t(' lúc ') +
3262
+ hhmm(fl.dec.at),
3263
+ ),
3264
+ );
3265
+ box.append(dh);
3266
+ if (viewMode === 'diagram') box.append(renderDiagram(fl));
3267
+ const tabs = el('div', 'dtabs');
3268
+ tabs.setAttribute('role', 'tablist');
3269
+ const t1 = el('button', 'tab', t('Các bước')),
3270
+ t2 = el('button', 'tab', t('Mọi sự kiện (') + fl.evs.length + ')');
3271
+ t1.type = t2.type = 'button';
3272
+ t1.setAttribute('role', 'tab');
3273
+ t2.setAttribute('role', 'tab');
3274
+ t1.setAttribute('aria-selected', String(!showAll));
3275
+ t2.setAttribute('aria-selected', String(showAll));
3276
+ t1.addEventListener('click', () => {
3277
+ showAll = false;
3278
+ renderDetail(false);
3279
+ });
3280
+ t2.addEventListener('click', () => {
3281
+ showAll = true;
3282
+ renderDetail(false);
3283
+ });
3284
+ tabs.append(t1, t2);
3285
+ box.append(tabs);
3286
+ if (showAll) {
3287
+ const ul = el('ul', 'evs');
3288
+ ul.style.padding = '8px 16px 16px';
3289
+ for (const e of fl.evs) ul.append(evItem(e));
3290
+ box.append(ul);
3291
+ return;
3292
+ }
3293
+ const ol = el('ol', 'tl');
3294
+ for (const k of fl.stages) {
3295
+ const evs = fl.evs.filter((e) => e.stage === k);
3296
+ const le = evs[evs.length - 1];
3297
+ const bad = le.status === 'fail' || le.status === 'blocked';
3298
+ const li = el(
3299
+ 'li',
3300
+ 'st ' +
3301
+ (k === fl.cur ? 'cur' : k < fl.cur ? 'done' : '') +
3302
+ (bad && k === fl.cur ? ' fail' : ''),
3303
+ );
3304
+ li.append(el('span', 'k'));
3305
+ const body = el('div');
3306
+ const h = el('div', 'h');
3307
+ h.append(
3308
+ el('span', 'nm', t(STAGES[k])),
3309
+ el(
3310
+ 'span',
3311
+ 'tm',
3312
+ (evs.some(isApprox) ? '≈' : '') +
3313
+ hhmm(evs[0].ts) +
3314
+ (evs.length > 1 ? '–' + hhmm(le.ts) : ''),
3315
+ ),
3316
+ el('span', 'tm', evs.length + t(' sự kiện')),
3317
+ );
3318
+ body.append(h);
3319
+ const rounds = [...new Set(evs.map((e) => e.attempt || 1))].sort((a, b) => a - b);
3320
+ let show = evs;
3321
+ if (rounds.length > 1) {
3322
+ const key = fl.id + ':' + k;
3323
+ const sel = attemptSel[key] ?? rounds[rounds.length - 1];
3324
+ const att = el('div', 'att');
3325
+ att.setAttribute('role', 'group');
3326
+ att.setAttribute('aria-label', t('Vòng của ') + t(STAGES[k]));
3327
+ for (const r of rounds) {
3328
+ const re = evs.filter((e) => (e.attempt || 1) === r);
3329
+ const rb = re.some((e) => e.status === 'fail' || e.status === 'blocked');
3330
+ const b = el('button', null, t('Vòng ') + r + ' ');
3331
+ b.type = 'button';
3332
+ b.setAttribute('aria-pressed', String(r === sel));
3333
+ b.append(mk(rb));
3334
+ b.addEventListener('click', () => {
3335
+ attemptSel[key] = r;
3336
+ renderDetail(false);
3337
+ });
3338
+ att.append(b);
3339
+ }
3340
+ body.append(att);
3341
+ show = evs.filter((e) => (e.attempt || 1) === sel);
3342
+ }
3343
+ const ul = el('ul', 'evs');
3344
+ for (const e of show) ul.append(evItem(e));
3345
+ body.append(ul);
3346
+ li.append(body);
3347
+ ol.append(li);
3348
+ }
3349
+ if (fresh && !drawn.has(fl.id)) {
3350
+ ol.classList.add('draw');
3351
+ [...ol.children].forEach((c, i) => (c.style.animationDelay = i * 60 + 'ms'));
3352
+ drawn.add(fl.id);
3353
+ }
3354
+ box.append(ol);
3355
+ }
3356
+
3357
+ function renderBoardKb(groups) {
3358
+ const kb = el('div', 'kb');
3359
+ const items = FL.filter(
3360
+ (x) =>
3361
+ (x.state !== 'done' || sameDay(x.last.ts)) &&
3362
+ (!agentFilter || involves(x, agentFilter)),
3363
+ );
3364
+ STAGES.forEach((nm, k) => {
3365
+ const col = el('section', 'kc');
3366
+ const mine = items
3367
+ .filter((x) => x.cur === k)
3368
+ .sort(
3369
+ (a, b) =>
3370
+ ({ you: 0, blocked: 1, running: 2, parked: 3, done: 4 })[a.state] -
3371
+ { you: 0, blocked: 1, running: 2, parked: 3, done: 4 }[b.state],
3372
+ );
3373
+ const kh = el('div', 'kh');
3374
+ kh.append(el('span', null, t(nm)), el('span', 'n', String(mine.length)));
3375
+ const w = mine.filter((x) => x.state === 'you').length,
3376
+ bl = mine.filter((x) => x.state === 'blocked').length;
3377
+ if (bl) kh.append(el('span', 'hot bad', bl + ' ' + t('kb.block')));
3378
+ else if (w) kh.append(el('span', 'hot', w + ' ' + t('kb.wait')));
3379
+ col.append(kh);
3380
+ const kl = el('div', 'kl');
3381
+ if (!mine.length) kl.append(el('div', 'kempty', t('kb.empty')));
3382
+ for (const fl of mine) {
3383
+ const c = el('button', 'kcard ' + fl.state);
3384
+ c.type = 'button';
3385
+ c.dataset.id = fl.id;
3386
+ c.setAttribute('aria-current', String(selected === fl.id));
3387
+ const top = el('div', 'km');
3388
+ top.append(
3389
+ el('span', 'code', fl.id === 'Unsorted' ? '-' : fl.id),
3390
+ el('span', 'repo', fl.f.repo),
3391
+ );
3392
+ if (fl.unread) top.append(el('span', 'unread'));
3393
+ const ft = el('div', 'km');
3394
+ ft.append(
3395
+ el('span', 'holder', fl.holder),
3396
+ el('span', 'spacer'),
3397
+ el('span', 'pill ' + fl.state, t(STATE_TXT[fl.state])),
3398
+ );
3399
+ c.append(top, el('div', 'kt', fl.f.title), ft);
3400
+ c.addEventListener('click', () => select(fl.id, true));
3401
+ kl.append(c);
3402
+ }
3403
+ col.append(kl);
3404
+ kb.append(col);
3405
+ });
3406
+ groups.append(kb);
3407
+ }
3408
+ function renderDiagram(fl) {
3409
+ const wrap = el('div', 'dg');
3410
+ const BW = 128,
3411
+ BH = 74,
3412
+ GAP = 38,
3413
+ PADT = 34;
3414
+ const ks = fl.stages;
3415
+ const W = ks.length * BW + (ks.length - 1) * GAP + 8,
3416
+ H = BH + PADT + 40;
3417
+ const s = sv('svg', {
3418
+ width: W,
3419
+ height: H,
3420
+ viewBox: '0 0 ' + W + ' ' + H,
3421
+ role: 'img',
3422
+ 'aria-label': t('dg.title') + ' ' + fl.id,
3423
+ });
3424
+ const defs = sv('defs', {}, s);
3425
+ const mkA = (id, c) => {
3426
+ const m = sv(
3427
+ 'marker',
3428
+ {
3429
+ id,
3430
+ viewBox: '0 0 10 10',
3431
+ refX: 9,
3432
+ refY: 5,
3433
+ markerWidth: 7,
3434
+ markerHeight: 7,
3435
+ orient: 'auto-start-reverse',
3436
+ },
3437
+ defs,
3438
+ );
3439
+ sv('path', { d: 'M0 0L10 5L0 10z', fill: c }, m);
3440
+ };
3441
+ mkA('ah', 'var(--line-2)');
3442
+ mkA('ahh', 'var(--accent)');
3443
+ mkA('ahl', 'var(--wait)');
3444
+ const xOf = (i) => 4 + i * (BW + GAP);
3445
+ const holderOf = (k) => {
3446
+ const evs = fl.evs.filter((e) => e.stage === k);
3447
+ const w = [...evs].reverse().find((e) => e.actor !== 'CI' && e.actor !== 'reviewer');
3448
+ return w ? (w.to && w.kind !== 'review' ? w.to : w.actor) : '';
3449
+ };
3450
+ ks.forEach((k, i) => {
3451
+ const evs = fl.evs.filter((e) => e.stage === k);
3452
+ const le = evs[evs.length - 1];
3453
+ const isCur = k === fl.cur;
3454
+ const bad = isCur && fl.state === 'blocked';
3455
+ const you = isCur && fl.state === 'you';
3456
+ const g = sv(
3457
+ 'g',
3458
+ {
3459
+ class:
3460
+ 'blk ' + (you ? 'you' : bad ? 'blocked' : isCur ? 'cur' : k < fl.cur ? 'done' : ''),
3461
+ transform: 'translate(' + xOf(i) + ',' + PADT + ')',
3462
+ },
3463
+ s,
3464
+ );
3465
+ sv('rect', { width: BW, height: BH, rx: 4 }, g);
3466
+ const nm = sv('text', { x: 10, y: 20, class: 'nm' }, g);
3467
+ nm.textContent = t(STAGES[k]);
3468
+ const who = sv('text', { x: 10, y: 40, class: 'who' }, g);
3469
+ who.textContent = (you ? OWNER : holderOf(k)).slice(0, 18);
3470
+ const a = fl.att[k] || [];
3471
+ const ci = a.filter((e) => e.kind === 'ci' || e.kind === 'release'),
3472
+ rv = a.filter((e) => e.kind === 'review');
3473
+ const at = sv('text', { x: 10, y: 60, class: 'att' }, g);
3474
+ let ax = 10;
3475
+ if (ci.length) {
3476
+ at.textContent = 'CI';
3477
+ ax = 30;
3478
+ for (const e of ci.slice(-4)) {
3479
+ const bad = e.status === 'fail';
3480
+ const m = sv(
3481
+ 'path',
3482
+ {
3483
+ d: bad
3484
+ ? 'M' + ax + ' 52l6 6M' + (ax + 6) + ' 52l-6 6'
3485
+ : 'M' + ax + ' 55.5l2.2 2.2 4.3-4.8',
3486
+ fill: 'none',
3487
+ stroke: bad ? 'var(--fail)' : 'var(--ok)',
3488
+ 'stroke-width': 1.7,
3489
+ 'stroke-linecap': 'round',
3490
+ 'stroke-linejoin': 'round',
3491
+ transform: 'translate(0,0)',
3492
+ },
3493
+ g,
3494
+ );
3495
+ ax += 11;
3496
+ }
3497
+ }
3498
+ if (rv.length) {
3499
+ const r2 = sv('text', { x: ci.length ? ax + 6 : 10, y: 60, class: 'att' }, g);
3500
+ r2.textContent = t('Review') + ' ×' + rv.length;
3501
+ }
3502
+ if (!ci.length && !rv.length) {
3503
+ at.textContent = evs.length + ' ' + t('gr.events');
3504
+ }
3505
+ if (i > 0) {
3506
+ const pk = ks[i - 1];
3507
+ const prevH = holderOf(pk),
3508
+ curH = you ? OWNER : holderOf(k);
3509
+ const hand = prevH && curH && prevH !== curH;
3510
+ const x1 = xOf(i - 1) + BW,
3511
+ x2 = xOf(i),
3512
+ y = PADT + BH / 2;
3513
+ sv(
3514
+ 'path',
3515
+ {
3516
+ d: 'M' + x1 + ' ' + y + 'H' + (x2 - 2),
3517
+ class: 'arr' + (hand ? ' hand' : ''),
3518
+ 'marker-end': hand ? 'url(#ahh)' : 'url(#ah)',
3519
+ },
3520
+ s,
3521
+ );
3522
+ if (hand) {
3523
+ const first = evs[0];
3524
+ const lb = sv(
3525
+ 'text',
3526
+ { x: (x1 + x2) / 2, y: y - 8, 'text-anchor': 'middle', class: 'lab hand' },
3527
+ s,
3528
+ );
3529
+ lb.textContent = t(KIND_TXT[first.kind]) || first.kind;
3530
+ }
3531
+ }
3532
+ });
3533
+ const ri = ks.indexOf(5),
3534
+ ci2 = ks.indexOf(3);
3535
+ const rounds = (fl.att[5] || []).filter((e) => e.kind === 'review').length;
3536
+ if (ri > 0 && rounds > 1) {
3537
+ const from = ci2 >= 0 ? ci2 : ri - 1;
3538
+ const xa = xOf(ri) + BW / 2,
3539
+ xb = xOf(from) + BW / 2,
3540
+ y = PADT;
3541
+ sv(
3542
+ 'path',
3543
+ {
3544
+ d:
3545
+ 'M' +
3546
+ xa +
3547
+ ' ' +
3548
+ y +
3549
+ 'C' +
3550
+ xa +
3551
+ ' ' +
3552
+ (y - 30) +
3553
+ ' ' +
3554
+ xb +
3555
+ ' ' +
3556
+ (y - 30) +
3557
+ ' ' +
3558
+ xb +
3559
+ ' ' +
3560
+ (y - 2),
3561
+ class: 'loop',
3562
+ 'marker-end': 'url(#ahl)',
3563
+ },
3564
+ s,
3565
+ );
3566
+ const lb = sv(
3567
+ 'text',
3568
+ { x: (xa + xb) / 2, y: y - 20, 'text-anchor': 'middle', class: 'lab loop' },
3569
+ s,
3570
+ );
3571
+ lb.textContent = t('Review') + ' → ' + t('sửa') + ' ×' + rounds + ' ' + t('rounds');
3572
+ }
3573
+ wrap.append(s);
3574
+ return wrap;
3575
+ }
3576
+ function renderAgents() {
3577
+ const svg = $('graph');
3578
+ const box = $('gWrap').getBoundingClientRect();
3579
+ const W = Math.max(320, box.width),
3580
+ H = Math.max(260, box.height);
3581
+ svg.setAttribute('viewBox', '0 0 ' + W + ' ' + H);
3582
+ const rows = agentRows();
3583
+ const names = [OWNER, ...rows.map((r) => r.n)];
3584
+ const st = Object.fromEntries(rows.map((r) => [r.n, r.st]));
3585
+ st[OWNER] = FL.some((x) => x.state === 'you') ? 'you' : 'idle';
3586
+ $('agN').textContent = rows.length + ' ' + t('n.agents');
3587
+ const cx = W / 2,
3588
+ cy = H / 2,
3589
+ R = Math.min(W, H) / 2 - 70;
3590
+ const pos = { [OWNER]: [cx, cy] };
3591
+ rows.forEach((r, i) => {
3592
+ const a = -Math.PI / 2 + (i * 2 * Math.PI) / rows.length;
3593
+ pos[r.n] = [cx + R * Math.cos(a) * (W > H ? 1.25 : 1), cy + R * Math.sin(a)];
3594
+ });
3595
+ const pairs = {};
3596
+ const now = Date.now();
3597
+ for (const e of events) {
3598
+ const a = e.actor,
3599
+ b = e.to;
3600
+ if (!a || !b || a === b || !(a in pos) || !(b in pos)) continue;
3601
+ const k = [a, b].sort().join('|');
3602
+ const p = pairs[k] || (pairs[k] = { a, b, n: 0, last: '', evs: [] });
3603
+ p.n++;
3604
+ p.evs.push(e);
3605
+ if (e.ts > p.last) p.last = e.ts;
3606
+ }
3607
+ for (const fl of FL) {
3608
+ if (fl.holder === OWNER) continue;
3609
+ const ask = fl.lastAsk;
3610
+ if (ask && fl.state === 'you' && ask.actor in pos) {
3611
+ const k = [ask.actor, OWNER].sort().join('|');
3612
+ const p = pairs[k] || (pairs[k] = { a: ask.actor, b: OWNER, n: 0, last: '', evs: [] });
3613
+ if (!p.evs.includes(ask)) {
3614
+ p.n++;
3615
+ p.evs.push(ask);
3616
+ if (ask.ts > p.last) p.last = ask.ts;
3617
+ }
3618
+ }
3619
+ }
3620
+ for (const e of events) {
3621
+ if (e.kind === 'decision' && e.actor === OWNER) {
3622
+ const fl = FL.find((x) => x.id === e.flowId);
3623
+ const h = fl && fl.evs.find((x) => x.needsOwner);
3624
+ if (h && h.actor in pos) {
3625
+ const k = [h.actor, OWNER].sort().join('|');
3626
+ const p = pairs[k] || (pairs[k] = { a: OWNER, b: h.actor, n: 0, last: '', evs: [] });
3627
+ if (!p.evs.includes(e)) {
3628
+ p.n++;
3629
+ p.evs.push(e);
3630
+ if (e.ts > p.last) p.last = e.ts;
3631
+ }
3632
+ }
3633
+ }
3634
+ }
3635
+ const keep = new Set();
3636
+ let eg = svg.querySelector('g.edges');
3637
+ if (!eg) {
3638
+ eg = sv('g', { class: 'edges' }, svg);
3639
+ }
3640
+ let ng = svg.querySelector('g.nodes');
3641
+ if (!ng) {
3642
+ ng = sv('g', { class: 'nodes' }, svg);
3643
+ }
3644
+ for (const [k, p] of Object.entries(pairs)) {
3645
+ keep.add('e:' + k);
3646
+ let g = eg.querySelector('[data-k="' + CSS.escape(k) + '"]');
3647
+ if (!g) {
3648
+ g = sv('g', { 'data-k': k }, eg);
3649
+ sv('path', { class: 'edge' }, g);
3650
+ const hit = sv('path', { class: 'ehit', tabindex: 0, role: 'button' }, g);
3651
+ sv('text', { class: 'ecount', 'text-anchor': 'middle' }, g);
3652
+ const open = () => showPair(k);
3653
+ hit.addEventListener('click', open);
3654
+ hit.addEventListener('keydown', (ev) => {
3655
+ if (ev.key === 'Enter' || ev.key === ' ') {
3656
+ ev.preventDefault();
3657
+ open();
3658
+ }
3659
+ });
3660
+ }
3661
+ const [x1, y1] = pos[p.a],
3662
+ [x2, y2] = pos[p.b];
3663
+ const mx = (x1 + x2) / 2,
3664
+ my = (y1 + y2) / 2;
3665
+ const dx = x2 - x1,
3666
+ dy = y2 - y1;
3667
+ const off = 0.2;
3668
+ const qx = mx - dy * off,
3669
+ qy = my + dx * off;
3670
+ const d =
3671
+ 'M' +
3672
+ x1.toFixed(1) +
3673
+ ' ' +
3674
+ y1.toFixed(1) +
3675
+ 'Q' +
3676
+ qx.toFixed(1) +
3677
+ ' ' +
3678
+ qy.toFixed(1) +
3679
+ ' ' +
3680
+ x2.toFixed(1) +
3681
+ ' ' +
3682
+ y2.toFixed(1);
3683
+ const ed = g.querySelector('.edge');
3684
+ ed.setAttribute('d', d);
3685
+ ed.setAttribute('stroke-width', String(Math.min(7, 1.2 + Math.log2(p.n + 1) * 1.3)));
3686
+ ed.classList.toggle('active', now - Date.parse(p.last) < 30 * 60000);
3687
+ ed.classList.toggle('sel', gPair === k);
3688
+ g.querySelector('.ehit').setAttribute('d', d);
3689
+ g.querySelector('.ehit').setAttribute(
3690
+ 'aria-label',
3691
+ p.a + ' ↔ ' + p.b + ', ' + p.n + ' ' + t('gr.events'),
3692
+ );
3693
+ const tx = g.querySelector('.ecount');
3694
+ tx.setAttribute('x', ((mx + qx) / 2).toFixed(1));
3695
+ tx.setAttribute('y', ((my + qy) / 2 - 4).toFixed(1));
3696
+ tx.textContent = String(p.n);
3697
+ }
3698
+ for (const g of [...eg.children]) if (!keep.has('e:' + g.dataset.k)) g.remove();
3699
+ for (const n of names) {
3700
+ keep.add('n:' + n);
3701
+ let g = ng.querySelector('[data-n="' + CSS.escape(n) + '"]');
3702
+ const state = st[n] || 'idle';
3703
+ if (!g) {
3704
+ g = sv('g', { 'data-n': n, class: 'node', tabindex: 0, role: 'button' }, ng);
3705
+ const act = () => {
3706
+ if (n === OWNER) return;
3707
+ if (popFor === n) closePop();
3708
+ else openPop(n, g);
3709
+ };
3710
+ g.addEventListener('click', act);
3711
+ g.addEventListener('keydown', (ev) => {
3712
+ if (ev.key === 'Enter' || ev.key === ' ') {
3713
+ ev.preventDefault();
3714
+ act();
3715
+ }
3716
+ });
3717
+ }
3718
+ if (g.dataset.st !== state || g.dataset.lang !== lang) {
3719
+ g.replaceChildren();
3720
+ g.dataset.st = state;
3721
+ g.dataset.lang = lang;
3722
+ if (state === 'working') sv('circle', { r: 30, class: 'pulse' }, g);
3723
+ sv('circle', { r: 30, class: 'ring' }, g);
3724
+ if (n === OWNER) {
3725
+ const tx = sv(
3726
+ 'text',
3727
+ {
3728
+ 'text-anchor': 'middle',
3729
+ y: 5,
3730
+ fill: 'var(--bg)',
3731
+ style: 'font:700 15px var(--font)',
3732
+ },
3733
+ g,
3734
+ );
3735
+ tx.textContent = 'P';
3736
+ g.classList.add('me');
3737
+ } else {
3738
+ const f = face(state, tintOf(n), n);
3739
+ f.setAttribute('x', -20);
3740
+ f.setAttribute('y', -21);
3741
+ f.setAttribute('width', 40);
3742
+ f.setAttribute('height', 40);
3743
+ g.append(f);
3744
+ }
3745
+ const nm = sv('text', { class: 'gname', 'text-anchor': 'middle', y: 48 }, g);
3746
+ nm.textContent = n;
3747
+ const sl = sv('text', { class: 'gst', 'text-anchor': 'middle', y: 63 }, g);
3748
+ sl.textContent =
3749
+ n === OWNER ? (state === 'you' ? t('Chờ anh') : '') : t(STATE_PILL[state]);
3750
+ }
3751
+ g.classList.remove('working', 'you', 'idle', 'blocked');
3752
+ g.classList.add(state);
3753
+ g.classList.toggle('sel', popFor === n);
3754
+ g.setAttribute('aria-label', n + ', ' + (n === OWNER ? '' : t(STATE_PILL[state])));
3755
+ const [x, y] = pos[n];
3756
+ g.style.transform = 'translate(' + x.toFixed(1) + 'px,' + y.toFixed(1) + 'px)';
3757
+ }
3758
+ for (const g of [...ng.children]) if (!keep.has('n:' + g.dataset.n)) g.remove();
3759
+ $('gLegend').replaceChildren();
3760
+ const l1 = el('span');
3761
+ l1.append(el('i', 'a'), t('gr.active'));
3762
+ $('gLegend').append(l1);
3763
+ gPairs = pairs;
3764
+ if (gPair) showPair(gPair, true);
3765
+ }
3766
+ let gPairs = {},
3767
+ gPair = null;
3768
+ function showPair(k, quiet) {
3769
+ const p = gPairs[k];
3770
+ gPair = k;
3771
+ const side = $('gSide');
3772
+ side.replaceChildren();
3773
+ for (const e of $('graph').querySelectorAll('.edge'))
3774
+ e.classList.toggle('sel', e.parentNode.dataset.k === k);
3775
+ if (!p) {
3776
+ $('gSideT').textContent = t('gr.pick');
3777
+ return;
3778
+ }
3779
+ $('gSideT').textContent = p.a + ' ↔ ' + p.b + ' · ' + p.n + ' ' + t('gr.events');
3780
+ const flows = [...new Set(p.evs.map((e) => e.flowId).filter(Boolean))];
3781
+ const fh = el('div', 'dh');
3782
+ const fr = el('div', 'dacts');
3783
+ for (const id of flows) {
3784
+ const b = el('button', 'btn chip', id);
3785
+ b.type = 'button';
3786
+ b.title = (flowsDoc[id] || {}).title || '';
3787
+ b.addEventListener('click', () => {
3788
+ showTab('Flows');
3789
+ select(id, true);
3790
+ });
3791
+ fr.append(b);
3792
+ }
3793
+ fh.append(el('div', 'meta', t('gr.flows') + ': ' + flows.length), fr);
3794
+ side.append(fh);
3795
+ const ul = el('ul', 'evs');
3796
+ ul.style.padding = '8px 16px 16px';
3797
+ for (const e of p.evs.slice().sort(byTs).reverse()) ul.append(evItem(e));
3798
+ side.append(ul);
3799
+ }
3800
+
3801
+ const AGENT_RE = { test: (n) => !!n && n !== OWNER && n !== 'CI' && n !== 'reviewer' };
3802
+ // A tint from a fixed neutral palette, chosen by a hash of the name: the same agent has the same colour everywhere.
3803
+ const tintOf = (n) => {
3804
+ let h = 0;
3805
+ for (const c of String(n)) h = (h * 31 + c.charCodeAt(0)) >>> 0;
3806
+ return '--t-p' + (h % 5);
3807
+ };
3808
+ const STATE_WORD = { working: 'đang làm', you: 'chờ anh', idle: 'rảnh', blocked: 'bị chặn' };
3809
+ const STATE_PILL = { working: 'Đang làm', you: 'Chờ anh', idle: 'Rảnh', blocked: 'Bị chặn' };
3810
+ const ORDER = {};
3811
+ const cells = new Map();
3812
+ function sv(tag, attrs, parent) {
3813
+ const n = document.createElementNS(NS, tag);
3814
+ for (const k in attrs) n.setAttribute(k, attrs[k]);
3815
+ if (parent) parent.append(n);
3816
+ return n;
3817
+ }
3818
+ const FACE_SHAPES = {
3819
+ bun: {
3820
+ d: 'M6 30C6 18.5 12.4 12 20 12s14 6.5 14 18c0 3.3-2.2 5-5 5H11c-2.8 0-5-1.7-5-5z',
3821
+ shade: 'M25.6 13.6c5 2.4 8.4 8 8.4 16.4 0 3.3-2.2 5-5 5h-5.6c4.6-2 7-9.4 2.2-21.4z',
3822
+ eyes: [
3823
+ [15, 23.4],
3824
+ [25, 23.4],
3825
+ ],
3826
+ mouth: [20, 28.4],
3827
+ cheeks: [
3828
+ [11.4, 27.2],
3829
+ [28.6, 27.2],
3830
+ ],
3831
+ top: [20, 12],
3832
+ hand: [33.4, 24],
3833
+ band: 'M8.2 19.6q11.8-4.6 23.6 0',
3834
+ knot: [31.8, 19.6],
3835
+ detail: (s) => {
3836
+ const g = sv('g', { class: 'ant' }, s);
3837
+ sv('path', { d: star(20, 6.4, 3.6), class: 'acc' }, g);
3838
+ sv('path', { d: star(26.6, 8.6, 1.6), class: 'acc' }, g);
3839
+ },
3840
+ },
3841
+ flame: {
3842
+ d: 'M20 4.5c2.2 5.2 6.4 7.6 9.6 12.2 2.6 3.7 3.9 7 3.9 10.3 0 5.6-5.6 9-13.5 9S6.5 32.6 6.5 27c0-4.2 2-7.6 4.6-10.4.6 2.4 1.8 3.8 3.4 4.4-.6-6.4 1.8-11.6 5.5-16.5z',
3843
+ shade:
3844
+ 'M27.6 15.4c3.8 4.2 5.9 7.8 5.9 11.6 0 5-4.4 8.4-10.8 8.9 4.6-2.4 7.8-9.4 4.9-20.5z',
3845
+ eyes: [
3846
+ [15.2, 25.4],
3847
+ [24.8, 25.4],
3848
+ ],
3849
+ mouth: [20, 30],
3850
+ cheeks: [
3851
+ [11.4, 28.8],
3852
+ [28.6, 28.8],
3853
+ ],
3854
+ top: [20, 5],
3855
+ hand: [33, 26],
3856
+ band: 'M9.6 21.2q10.4-4.2 20.8 0',
3857
+ knot: [30.4, 21.2],
3858
+ detail: (s) => {
3859
+ sv(
3860
+ 'path',
3861
+ {
3862
+ d: 'M20 9.6c1 2.2 2.6 3.4 2.6 5.4a2.6 2.6 0 0 1-5.2 0c0-2 1.6-3.2 2.6-5.4z',
3863
+ class: 'core',
3864
+ },
3865
+ s,
3866
+ );
3867
+ },
3868
+ },
3869
+ ember: {
3870
+ d: 'M7.5 27.5c0-8 5.8-13.5 12.8-13.5S33 19.6 33 26.8c0 5.6-5 8.7-12.6 8.7S7.5 33 7.5 27.5z',
3871
+ shade: 'M25.4 15c4.6 1.8 7.6 6 7.6 11.8 0 5.2-4.4 8.2-11 8.6 5-2.6 7.6-10.4 3.4-20.4z',
3872
+ eyes: [
3873
+ [15.4, 25.2],
3874
+ [25, 25.2],
3875
+ ],
3876
+ mouth: [20.2, 29.8],
3877
+ cheeks: [
3878
+ [11.6, 28.6],
3879
+ [28.8, 28.6],
3880
+ ],
3881
+ top: [20.4, 14],
3882
+ hand: [32.6, 25],
3883
+ band: 'M9.2 21.6q11.2-4.4 22.4 0',
3884
+ knot: [31.6, 21.6],
3885
+ detail: (s) => {
3886
+ const g = sv('g', { class: 'ant' }, s);
3887
+ sv(
3888
+ 'path',
3889
+ { d: 'M13.6 10.8l-1.4-2.6M20.4 9.6V6.6M27.2 10.8l1.4-2.6', class: 'acc-stroke' },
3890
+ g,
3891
+ );
3892
+ sv('circle', { cx: 11.8, cy: 31.4, r: 0.9, class: 'speck' }, s);
3893
+ sv('circle', { cx: 27.6, cy: 32.2, r: 0.8, class: 'speck' }, s);
3894
+ },
3895
+ },
3896
+ rock: {
3897
+ d: 'M8.5 31.5 6.8 23.6l4.4-8.2 8-4.2 9.2 2.2 5 7.2v8.6l-4.8 6.3H13.2z',
3898
+ shade: 'M28.4 13.4l5 7.2v8.6l-4.8 6.3h-5.4l5-6.8-.6-9.4z',
3899
+ eyes: [
3900
+ [15, 24.6],
3901
+ [24.6, 24.6],
3902
+ ],
3903
+ mouth: [19.8, 29.4],
3904
+ cheeks: [
3905
+ [11, 28.2],
3906
+ [28.4, 28.2],
3907
+ ],
3908
+ top: [19.4, 11.2],
3909
+ hand: [33.4, 25],
3910
+ band: 'M8.4 20.8q10.8-4.4 22.4-.4',
3911
+ knot: [30.8, 20.4],
3912
+ detail: (s) => {
3913
+ sv('path', { d: 'M28.2 13.8l-1.9 3.4 1.8 1.8-1.4 2.6', class: 'acc-stroke crack' }, s);
3914
+ sv('path', { d: 'M11.4 15.6l3 5', class: 'facet' }, s);
3915
+ },
3916
+ },
3917
+ banana: {
3918
+ d: 'M5.6 18.6c-.9-2 1.6-3.6 3.2-2.2 3.4 3.2 7.2 4.6 11.2 4.6s7.8-1.4 11.2-4.6c1.6-1.4 4.1.2 3.2 2.2-3 8.4-8.6 14.4-14.4 14.4S8.6 27 5.6 18.6z',
3919
+ shade:
3920
+ 'M28.6 23.4c1.4-1.4 2.6-3.2 3.6-5.2 1.2-.6 2.4-.4 2.6.4-2.6 7.4-7.4 12.8-12.6 14.2 2.8-2 4.8-5.6 6.4-9.4z',
3921
+ eyes: [
3922
+ [15.4, 25.6],
3923
+ [24.6, 25.6],
3924
+ ],
3925
+ mouth: [20, 29.4],
3926
+ cheeks: [
3927
+ [11.8, 27.6],
3928
+ [28.2, 27.6],
3929
+ ],
3930
+ top: [20, 20],
3931
+ hand: [33.2, 20.6],
3932
+ band: null,
3933
+ knot: null,
3934
+ detail: (s) => {
3935
+ const g = sv('g', { class: 'ant' }, s);
3936
+ sv('path', { d: 'M33 16.8q.6-2.6 2.4-4', class: 'stem' }, g);
3937
+ sv('circle', { cx: 6.4, cy: 17.8, r: 1, class: 'tip' }, s);
3938
+ },
3939
+ },
3940
+ person: {
3941
+ d: 'M7 36c0-7 5.8-11.4 13-11.4S33 29 33 36z',
3942
+ head: { cx: 20, cy: 15.4, r: 7.6 },
3943
+ shade: null,
3944
+ eyes: [
3945
+ [17, 15.4],
3946
+ [23, 15.4],
3947
+ ],
3948
+ mouth: [20, 19],
3949
+ cheeks: [
3950
+ [14.6, 18.2],
3951
+ [25.4, 18.2],
3952
+ ],
3953
+ top: [20, 7.8],
3954
+ hand: [31, 28],
3955
+ band: null,
3956
+ knot: null,
3957
+ detail: () => {},
3958
+ },
3959
+ };
3960
+ function star(x, y, r) {
3961
+ const q = r * 0.32;
3962
+ return `M${x} ${y - r}Q${x + q} ${y - q} ${x + r} ${y}Q${x + q} ${y + q} ${x} ${y + r}Q${x - q} ${y + q} ${x - r} ${y}Q${x - q} ${y - q} ${x} ${y - r}z`;
3963
+ }
3964
+ // The owner is a person; an agent has the default face unless the config gives its name another.
3965
+ const shapeOf = (n) =>
3966
+ n === OWNER ? 'person' : FACE_SHAPES[DATA.shapes[n]] ? DATA.shapes[n] : 'bun';
3967
+ function face(state, tint, name) {
3968
+ const S = FACE_SHAPES[shapeOf(name)];
3969
+ const s = sv('svg', { viewBox: '0 0 40 40', class: 'bot', 'aria-hidden': 'true' });
3970
+ const body = sv('g', { class: 'body' }, s);
3971
+ if (S.head) {
3972
+ sv('path', { d: S.d, fill: 'var(--t-other)', class: 'shell' }, body);
3973
+ sv(
3974
+ 'circle',
3975
+ { cx: S.head.cx, cy: S.head.cy, r: S.head.r, fill: 'var(--t-other)', class: 'shell' },
3976
+ body,
3977
+ );
3978
+ } else {
3979
+ sv('path', { d: S.d, fill: 'var(' + tint + ')', class: 'shell' }, body);
3980
+ if (S.shade) sv('path', { d: S.shade, class: 'shade' }, body);
3981
+ }
3982
+ S.detail(body);
3983
+ if (/^pnt-/.test(name || '') && S.band) {
3984
+ sv('path', { d: S.band, class: 'band' }, body);
3985
+ const [kx, ky] = S.knot;
3986
+ sv('path', { d: `M${kx} ${ky}l2.4-1.8M${kx} ${ky}l2.6.9`, class: 'band' }, body);
3987
+ }
3988
+ const eyes = sv('g', { class: 'eyes' }, body);
3989
+ for (const [i, [x, y]] of S.eyes.entries()) {
3990
+ if (state === 'idle') {
3991
+ sv('path', { d: `M${x - 2} ${y}q2 1.7 4 0`, class: 'stroke' }, eyes);
3992
+ continue;
3993
+ }
3994
+ if (state === 'working') {
3995
+ sv('ellipse', { cx: x, cy: y, rx: 2.1, ry: 1.65, class: 'ink' }, eyes);
3996
+ sv('circle', { cx: x + 0.7, cy: y - 0.6, r: 0.6, class: 'glint' }, eyes);
3997
+ continue;
3998
+ }
3999
+ const yy = state === 'you' ? y - 0.4 : y;
4000
+ sv('circle', { cx: x, cy: yy, r: 2.3, class: 'ink' }, eyes);
4001
+ sv(
4002
+ 'circle',
4003
+ { cx: x + 0.7, cy: state === 'you' ? yy - 1.3 : yy - 0.8, r: 0.75, class: 'glint' },
4004
+ eyes,
4005
+ );
4006
+ if (state === 'blocked') {
4007
+ const inner = i === 0 ? 1 : -1;
4008
+ sv(
4009
+ 'path',
4010
+ {
4011
+ d: `M${x - 2.2 * inner} ${y - 3.2}L${x + 1.8 * inner} ${y - 4.6}`,
4012
+ class: 'stroke brow',
4013
+ },
4014
+ eyes,
4015
+ );
4016
+ }
4017
+ }
4018
+ if (state !== 'blocked')
4019
+ for (const [x, y] of S.cheeks)
4020
+ sv('ellipse', { cx: x, cy: y, rx: 1.7, ry: 1.1, class: 'cheek' }, body);
4021
+ const [mx, my] = S.mouth;
4022
+ if (state === 'working')
4023
+ sv('path', { d: `M${mx - 1.8} ${my}q1.8 1.5 3.6 0`, class: 'stroke' }, body);
4024
+ else if (state === 'you')
4025
+ sv('ellipse', { cx: mx, cy: my + 0.3, rx: 1.3, ry: 1.5, class: 'ink' }, body);
4026
+ else if (state === 'blocked')
4027
+ sv(
4028
+ 'path',
4029
+ { d: `M${mx - 2.8} ${my + 0.8}q1.4-1.5 2.8 0t2.8 0`, class: 'stroke mouth-bad' },
4030
+ body,
4031
+ );
4032
+ else sv('path', { d: `M${mx - 1.4} ${my}h2.8`, class: 'stroke' }, body);
4033
+ const [tx, ty] = S.top;
4034
+ if (state === 'working') {
4035
+ sv('path', { d: star(33.4, 9.4, 2.2), class: 'spark' }, s);
4036
+ sv('path', { d: star(36.6, 15, 1.4), class: 'spark' }, s);
4037
+ }
4038
+ if (state === 'you') {
4039
+ const [hx, hy] = S.hand;
4040
+ const h = sv('g', { class: 'hand' }, s);
4041
+ sv(
4042
+ 'rect',
4043
+ {
4044
+ x: hx - 1.9,
4045
+ y: hy - 9.4,
4046
+ width: 3.8,
4047
+ height: 6.8,
4048
+ rx: 1.9,
4049
+ transform: `rotate(24 ${hx} ${hy - 2.6})`,
4050
+ fill: 'var(' + tint + ')',
4051
+ class: 'shell',
4052
+ },
4053
+ h,
4054
+ );
4055
+ const g = sv('g', { class: 'badge-g' }, s);
4056
+ sv('circle', { cx: 7, cy: 7.4, r: 5, class: 'badge' }, g);
4057
+ const t = sv('text', { x: 7, y: 9.9, 'text-anchor': 'middle', class: 'badge-ink' }, g);
4058
+ t.textContent = '!';
4059
+ }
4060
+ if (state === 'idle') {
4061
+ const t = sv('text', { x: 31.6, y: 9.6, class: 'z' }, s);
4062
+ t.textContent = 'z';
4063
+ const t2 = sv('text', { x: 35.4, y: 5.4, class: 'z z2' }, s);
4064
+ t2.textContent = 'z';
4065
+ }
4066
+ if (state === 'blocked') {
4067
+ sv(
4068
+ 'path',
4069
+ { d: 'M7.6 13.4c1.3 1.8 2 2.8 2 3.8a2 2 0 0 1-4 0c0-1 .7-2 2-3.8z', class: 'sweat' },
4070
+ s,
4071
+ );
4072
+ sv('circle', { cx: 34, cy: 7.4, r: 3.2, class: 'mark' }, s);
4073
+ sv('path', { d: 'M34 5.6v2.2', class: 'mark-ink' }, s);
4074
+ sv('circle', { cx: 34, cy: 9.3, r: 0.45, class: 'mark-dot' }, s);
4075
+ }
4076
+ return s;
4077
+ }
4078
+ function agentRows() {
4079
+ const names = new Set(Object.keys(agentsDoc).filter((n) => AGENT_RE.test(n)));
4080
+ for (const e of events)
4081
+ if (e.source !== 'github' && e.actor && AGENT_RE.test(e.actor)) names.add(e.actor);
4082
+ const rows = [];
4083
+ for (const n of names) {
4084
+ const doc = agentsDoc[n] || {};
4085
+ const mine = events.filter((e) => e.actor === n).sort(byTs);
4086
+ const lastE = mine.at(-1);
4087
+ const youFlow = FL.find(
4088
+ (x) =>
4089
+ x.state === 'you' &&
4090
+ ([...x.evs].reverse().find((e) => e.actor !== OWNER) || {}).actor === n,
4091
+ );
4092
+ const blockedFlow = FL.find((x) => x.state === 'blocked' && x.holder === n);
4093
+ const runFlow = FL.find((x) => x.state === 'running' && x.holder === n);
4094
+ const st =
4095
+ doc.state === 'blocked' || blockedFlow
4096
+ ? 'blocked'
4097
+ : youFlow
4098
+ ? 'you'
4099
+ : doc.state === 'working' || runFlow
4100
+ ? 'working'
4101
+ : 'idle';
4102
+ const T = (v) => (v ? Date.parse(v) || 0 : 0);
4103
+ const docNewer = !!doc.current && (!lastE || T(doc.checkedAt) > T(lastE.ts));
4104
+ const flow =
4105
+ (blockedFlow || youFlow || {}).id ||
4106
+ doc.flow ||
4107
+ (runFlow || {}).id ||
4108
+ (!doc.external && lastE && lastE.flowId) ||
4109
+ null;
4110
+ let text,
4111
+ ts,
4112
+ approx = false;
4113
+ if (st === 'you' && youFlow && youFlow.lastAsk) {
4114
+ text = t('chờ anh: ') + youFlow.lastAsk.summary;
4115
+ ts = youFlow.lastAsk.ts;
4116
+ approx = isApprox(youFlow.lastAsk);
4117
+ } else if (docNewer) {
4118
+ text = doc.current;
4119
+ ts = doc.since || doc.checkedAt;
4120
+ } else if (lastE) {
4121
+ text = lastE.summary;
4122
+ ts = lastE.ts;
4123
+ approx = isApprox(lastE);
4124
+ } else {
4125
+ text = doc.current || t('chưa có việc');
4126
+ ts = doc.since || null;
4127
+ }
4128
+ const compact = st === 'idle';
4129
+ if (st === 'idle' && !/^rảnh/.test(text)) text = t('rảnh · ') + text;
4130
+ rows.push({
4131
+ n,
4132
+ host: doc.host || '',
4133
+ st,
4134
+ flow,
4135
+ text,
4136
+ ts,
4137
+ approx,
4138
+ compact,
4139
+ key:
4140
+ (lastE ? lastE.id || lastE.ts : '') +
4141
+ '|' +
4142
+ (doc.checkedAt || '') +
4143
+ '|' +
4144
+ (doc.current || ''),
4145
+ });
4146
+ }
4147
+ rows.sort((a, b) => (ORDER[a.n] ?? 9) - (ORDER[b.n] ?? 9) || a.n.localeCompare(b.n));
4148
+ return rows;
4149
+ }
4150
+ function setAgentFilter(n) {
4151
+ agentFilter = n;
4152
+ showTab('Flows');
4153
+ renderList();
4154
+ }
4155
+ function renderDock() {
4156
+ const dock = $('dock');
4157
+ const rows = agentRows();
4158
+ const seen = new Set();
4159
+ const cnt = { working: 0, you: 0, idle: 0, blocked: 0 };
4160
+ for (const r of rows) {
4161
+ cnt[r.st]++;
4162
+ seen.add(r.n);
4163
+ let c = cells.get(r.n);
4164
+ if (!c) {
4165
+ const b = el('button', 'cell');
4166
+ b.type = 'button';
4167
+ b.dataset.agent = r.n;
4168
+ const fw = el('span', 'fw');
4169
+ const info = el('span');
4170
+ info.style.minWidth = '0';
4171
+ const nm = el('span', 'nm');
4172
+ const nb = el('b', null, r.n);
4173
+ const fc = el('span', 'fc');
4174
+ nm.append(nb, fc);
4175
+ const tk = el('span', 'tk');
4176
+ const tx = el('span', 'tx');
4177
+ tk.append(tx);
4178
+ const ft = el('span', 'ft');
4179
+ const pl = el('span', 'spill');
4180
+ const ag = el('span', 'ag');
4181
+ ft.append(pl, ag);
4182
+ info.append(nm, tk, ft);
4183
+ b.append(fw, info);
4184
+ b.setAttribute('aria-haspopup', 'dialog');
4185
+ b.setAttribute('aria-expanded', 'false');
4186
+ b.addEventListener('click', () => {
4187
+ if (popFor === r.n) closePop();
4188
+ else openPop(r.n, b);
4189
+ });
4190
+ dock.append(b);
4191
+ c = { el: b, fw, tk, fc, tx, ag, pl, st: null, key: null };
4192
+ cells.set(r.n, c);
4193
+ }
4194
+ if (c.st !== r.st) {
4195
+ c.fw.replaceChildren(face(r.st, tintOf(r.n), r.n));
4196
+ c.el.classList.remove('working', 'you', 'idle', 'blocked');
4197
+ c.el.classList.add(r.st);
4198
+ c.pl.className = 'spill ' + r.st;
4199
+ c.pl.textContent = t(STATE_PILL[r.st]);
4200
+ if (c.st !== null && r.st === 'blocked') replay(c.el, 'shake');
4201
+ c.st = r.st;
4202
+ }
4203
+ c.el.classList.toggle('compact', r.compact);
4204
+ c.fc.textContent = r.flow || '';
4205
+ c.fc.hidden = !r.flow;
4206
+ c.ag.textContent = r.ts ? (r.approx ? '≈ ' : '') + ago(r.ts) : '';
4207
+ if (c.tx.textContent !== r.text) c.tx.textContent = r.text;
4208
+ c.el.title =
4209
+ r.n +
4210
+ (r.host ? ' (' + r.host + ')' : '') +
4211
+ ' · ' +
4212
+ t(STATE_WORD[r.st]) +
4213
+ (r.flow ? ' · ' + r.flow : '') +
4214
+ ' · ' +
4215
+ r.text;
4216
+ c.el.setAttribute(
4217
+ 'aria-label',
4218
+ r.n +
4219
+ ', ' +
4220
+ t(STATE_WORD[r.st]) +
4221
+ (r.flow ? t(', luồng ') + r.flow : '') +
4222
+ '. ' +
4223
+ r.text,
4224
+ );
4225
+ if (c.key !== null && c.key !== r.key) {
4226
+ replay(c.el, 'hop');
4227
+ replay(c.tk, 'in');
4228
+ }
4229
+ c.key = r.key;
4230
+ }
4231
+ for (const [k, c] of cells)
4232
+ if (!seen.has(k)) {
4233
+ c.el.remove();
4234
+ cells.delete(k);
4235
+ }
4236
+ $('dockN').textContent = rows.length + ' ' + t('n.agents');
4237
+ $('dockSum').textContent =
4238
+ [
4239
+ cnt.working && cnt.working + t(' đang làm'),
4240
+ cnt.you && cnt.you + t(' chờ anh'),
4241
+ cnt.blocked && cnt.blocked + t(' bị chặn'),
4242
+ cnt.idle && cnt.idle + t(' rảnh'),
4243
+ ]
4244
+ .filter(Boolean)
4245
+ .join(' · ') || t('chưa có agent');
4246
+ }
4247
+ let popFor = null,
4248
+ popReturn = null,
4249
+ toastT = 0;
4250
+ function toast(msg, warn) {
4251
+ const t = $('toast');
4252
+ t.textContent = msg;
4253
+ t.classList.toggle('warn', !!warn);
4254
+ t.classList.add('on');
4255
+ clearTimeout(toastT);
4256
+ toastT = setTimeout(() => t.classList.remove('on'), warn ? 5200 : 2600);
4257
+ }
4258
+ function agentInfo(n) {
4259
+ const row = agentRows().find((r) => r.n === n) || {
4260
+ n,
4261
+ st: 'idle',
4262
+ text: '',
4263
+ ts: null,
4264
+ flow: null,
4265
+ host: '',
4266
+ };
4267
+ const mine = events.filter((e) => e.actor === n).sort(byTs);
4268
+ const prs = {};
4269
+ for (const e of events) {
4270
+ if (!e.ref || !e.ref.pr) continue;
4271
+ const k = (e.ref.repo || '') + '#' + e.ref.pr;
4272
+ const p =
4273
+ prs[k] ||
4274
+ (prs[k] = {
4275
+ repo: e.ref.repo,
4276
+ n: e.ref.pr,
4277
+ by: null,
4278
+ merged: false,
4279
+ closed: false,
4280
+ ci: null,
4281
+ link: null,
4282
+ flow: e.flowId,
4283
+ });
4284
+ if (e.kind === 'pr' && !p.by) p.by = e.actor;
4285
+ if (e.kind === 'merge') p.merged = true;
4286
+ if (e.status === 'closed') p.closed = true;
4287
+ if (e.kind === 'ci') p.ci = e.status;
4288
+ if (e.link && /^https:\/\/.+\/pull\//.test(e.link)) p.link = e.link;
4289
+ }
4290
+ const open = Object.values(prs).filter((p) => p.by === n && !p.merged && !p.closed);
4291
+ const msgs = events
4292
+ .filter((e) => e.kind === 'msg' && (e.to === n || e.actor === n))
4293
+ .sort(byTs);
4294
+ const pending = msgs.filter((m) => {
4295
+ const other = m.to === n ? n : m.to;
4296
+ return !events.some(
4297
+ (e) => e.ts > m.ts && e.actor === other && (!m.flowId || e.flowId === m.flowId),
4298
+ );
4299
+ });
4300
+ return { row, mine, open, pending };
4301
+ }
4302
+ function renderPop() {
4303
+ const n = popFor;
4304
+ if (!n) return;
4305
+ const box = $('pop');
4306
+ const { row, mine, open, pending } = agentInfo(n);
4307
+ box.replaceChildren();
4308
+ const hd = el('div', 'phd');
4309
+ hd.append(face(row.st, tintOf(n), n));
4310
+ const ti = el('div');
4311
+ const h = el('h2', null, n);
4312
+ h.id = 'popName';
4313
+ const sub = el('div', 'sub');
4314
+ const pl = el('span', 'spill ' + row.st, t(STATE_PILL[row.st]));
4315
+ sub.append(pl);
4316
+ if (row.host) sub.append(el('span', null, row.host));
4317
+ if (row.ts)
4318
+ sub.append(
4319
+ el(
4320
+ 'span',
4321
+ null,
4322
+ t('từ ') + hhmm(row.ts) + ' · ' + (row.approx ? '≈ ' : '') + ago(row.ts),
4323
+ ),
4324
+ );
4325
+ ti.append(h, sub);
4326
+ const x = el('button', 'btn sq', '×');
4327
+ x.type = 'button';
4328
+ x.setAttribute('aria-label', t('Đóng'));
4329
+ x.addEventListener('click', closePop);
4330
+ hd.append(ti, x);
4331
+ box.append(hd);
4332
+ const bd = el('div', 'pbd');
4333
+ const now = el('div', 'now');
4334
+ if (row.flow) {
4335
+ const fb = el('button', 'btn chip', row.flow);
4336
+ fb.type = 'button';
4337
+ fb.style.margin = '0';
4338
+ fb.title = (flowsDoc[row.flow] || {}).title || '';
4339
+ fb.addEventListener('click', () => {
4340
+ closePop();
4341
+ showTab('Flows');
4342
+ select(row.flow, true);
4343
+ });
4344
+ now.append(fb);
4345
+ }
4346
+ now.append(el('span', 'tx', row.text || t('chưa có việc')));
4347
+ bd.append(now);
4348
+ bd.append(el('h3', null, t('5 sự kiện gần nhất')));
4349
+ if (!mine.length) bd.append(el('p', 'none', t('Chưa có sự kiện nào của agent này.')));
4350
+ else {
4351
+ const ul = el('ul', 'pevs');
4352
+ for (const e of mine.slice(-5).reverse()) {
4353
+ const li = el('li');
4354
+ li.append(el('span', 'tm', (isApprox(e) ? '≈' : '') + hhmm(e.ts)));
4355
+ const sm = el('span', 'sm');
4356
+ if (e.flowId) sm.append(el('span', 'fl', e.flowId));
4357
+ sm.append(e.summary || '');
4358
+ li.append(sm);
4359
+ ul.append(li);
4360
+ }
4361
+ bd.append(ul);
4362
+ }
4363
+ bd.append(el('h3', null, t('PR đang mở (') + open.length + ')'));
4364
+ if (!open.length) bd.append(el('p', 'none', t('Không có PR nào đang mở.')));
4365
+ else {
4366
+ const ul = el('ul', 'prs');
4367
+ for (const p of open) {
4368
+ const li = el('li');
4369
+ const a = el('a');
4370
+ const href = prHref(p);
4371
+ if (href) a.href = href;
4372
+ a.target = '_blank';
4373
+ a.rel = 'noopener';
4374
+ a.append(el('span', 'code', (p.repo || '') + '#' + p.n));
4375
+ if (p.ci) a.append(mk(p.ci === 'fail'));
4376
+ a.append(el('span', null, p.flow || ''));
4377
+ li.append(a);
4378
+ ul.append(li);
4379
+ }
4380
+ bd.append(ul);
4381
+ }
4382
+ bd.append(el('h3', null, t('Tin nhắn chưa có trả lời (') + pending.length + ')'));
4383
+ if (!pending.length) bd.append(el('p', 'none', t('Không có tin nào đang chờ.')));
4384
+ else {
4385
+ const ul = el('ul', 'pevs');
4386
+ for (const m of pending.slice(-5).reverse()) {
4387
+ const li = el('li');
4388
+ li.append(el('span', 'tm', (isApprox(m) ? '≈' : '') + hhmm(m.ts)));
4389
+ const sm = el('span', 'sm');
4390
+ sm.append((m.actor === n ? '→ ' + m.to : '← ' + m.actor) + ': ' + (m.summary || ''));
4391
+ li.append(sm);
4392
+ ul.append(li);
4393
+ }
4394
+ bd.append(ul);
4395
+ }
4396
+ box.append(bd);
4397
+ const ft = el('div', 'pft');
4398
+ const r1 = el('div', 'row2');
4399
+ const fbtn = el('button', 'btn', agentFilter === n ? t('Bỏ lọc luồng') : t('Lọc luồng'));
4400
+ fbtn.type = 'button';
4401
+ fbtn.addEventListener('click', () => {
4402
+ setAgentFilter(agentFilter === n ? null : n);
4403
+ closePop();
4404
+ });
4405
+ r1.append(fbtn);
4406
+ const gh = open[0] && prHref(open[0]);
4407
+ if (gh) {
4408
+ const a = el('a', 'btn', t('Mở trên GitHub'));
4409
+ a.href = gh;
4410
+ a.target = '_blank';
4411
+ a.rel = 'noopener';
4412
+ r1.append(a);
4413
+ }
4414
+ ft.append(r1);
4415
+ box.append(ft);
4416
+ }
4417
+ function placePop() {
4418
+ const box = $('pop');
4419
+ const c = popReturn && popReturn.isConnected ? popReturn : (cells.get(popFor) || {}).el;
4420
+ if (!c || box.hidden) return;
4421
+ if (matchMedia('(max-width:640px)').matches) {
4422
+ box.style.left = '';
4423
+ box.style.top = '';
4424
+ box.style.bottom = '';
4425
+ return;
4426
+ }
4427
+ const r = c.getBoundingClientRect();
4428
+ const w = box.offsetWidth,
4429
+ h = box.offsetHeight;
4430
+ const left = Math.max(16, Math.min(innerWidth - w - 16, r.left + r.width / 2 - w / 2));
4431
+ const above = r.top - h - 8;
4432
+ const top = above >= 12 ? above : Math.min(innerHeight - h - 12, r.bottom + 8);
4433
+ box.style.left = left + 'px';
4434
+ box.style.top = Math.max(12, top) + 'px';
4435
+ box.style.bottom = 'auto';
4436
+ }
4437
+ function openPop(n, anchor) {
4438
+ if (popFor && popFor !== n) {
4439
+ const prev = (cells.get(popFor) || {}).el;
4440
+ if (prev) prev.setAttribute('aria-expanded', 'false');
4441
+ }
4442
+ popFor = n;
4443
+ popReturn = anchor;
4444
+ const box = $('pop');
4445
+ box.hidden = false;
4446
+ renderPop();
4447
+ placePop();
4448
+ anchor.setAttribute('aria-expanded', 'true');
4449
+ requestAnimationFrame(() => {
4450
+ box.classList.add('on');
4451
+ const f = box.querySelector('textarea') || box.querySelector('button');
4452
+ if (f) f.focus({ preventScroll: true });
4453
+ });
4454
+ }
4455
+ function closePop() {
4456
+ if (!popFor) return;
4457
+ const box = $('pop');
4458
+ box.classList.remove('on');
4459
+ box.hidden = true;
4460
+ const c = (cells.get(popFor) || {}).el;
4461
+ if (c) c.setAttribute('aria-expanded', 'false');
4462
+ popFor = null;
4463
+ if (popReturn && popReturn.isConnected) popReturn.focus();
4464
+ popReturn = null;
4465
+ }
4466
+ document.addEventListener('pointerdown', (ev) => {
4467
+ if (!popFor) return;
4468
+ const t = ev.target;
4469
+ if ($('pop').contains(t) || (t.closest && t.closest('.cell,.node'))) return;
4470
+ closePop();
4471
+ });
4472
+ addEventListener('resize', () => placePop());
4473
+ const THEME_LS = LS_PREFIX + 'theme';
4474
+ const THEME_ICON = {
4475
+ light:
4476
+ '<svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="3.6" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M10 1.8v2M10 16.2v2M1.8 10h2M16.2 10h2M4.2 4.2l1.4 1.4M14.4 14.4l1.4 1.4M4.2 15.8l1.4-1.4M14.4 5.6l1.4-1.4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',
4477
+ dark: '<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M16.5 12.4A7 7 0 0 1 7.6 3.5a7 7 0 1 0 8.9 8.9Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>',
4478
+ system:
4479
+ '<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="2.5" y="3.5" width="15" height="10" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M7 17h6M10 13.5V17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',
4480
+ };
4481
+ const THEME_NAME = { light: 'sáng', dark: 'tối', system: 'theo máy' };
4482
+ function applyTheme(m) {
4483
+ const r = document.documentElement;
4484
+ if (m === 'system') r.removeAttribute('data-board-theme');
4485
+ else r.setAttribute('data-board-theme', m);
4486
+ const b = $('bTheme');
4487
+ b.innerHTML = THEME_ICON[m];
4488
+ b.setAttribute('aria-label', t('Giao diện: ') + t(THEME_NAME[m]) + t('. Bấm để đổi'));
4489
+ b.title = t('Giao diện: ') + t(THEME_NAME[m]);
4490
+ }
4491
+ let theme = lsGet(THEME_LS) || 'light';
4492
+ if (!THEME_ICON[theme]) theme = 'light';
4493
+ applyTheme(theme);
4494
+ applyLang();
4495
+ $('bTheme').addEventListener('click', () => {
4496
+ theme = { light: 'dark', dark: 'system', system: 'light' }[theme];
4497
+ lsSet(THEME_LS, theme);
4498
+ document.body.style.transition = 'background-color .2s,color .2s';
4499
+ applyTheme(theme);
4500
+ });
4501
+
4502
+ function applyLang() {
4503
+ document.documentElement.lang = lang;
4504
+ for (const e of document.querySelectorAll('[data-i18n]')) e.textContent = t(e.dataset.i18n);
4505
+ for (const a of ['aria-label', 'title', 'placeholder'])
4506
+ for (const e of document.querySelectorAll('[data-i18n-' + a + ']'))
4507
+ e.setAttribute(a, t(e.getAttribute('data-i18n-' + a)));
4508
+ const b = $('bLang');
4509
+ b.textContent = lang === 'en' ? 'VI' : 'EN';
4510
+ b.setAttribute('aria-label', t('lang.label') + ': ' + t('lang.' + lang));
4511
+ b.title = b.getAttribute('aria-label');
4512
+ if (typeof applyTheme === 'function') applyTheme(theme);
4513
+ }
4514
+ $('bLang').addEventListener('click', () => {
4515
+ lang = lang === 'en' ? 'vi' : 'en';
4516
+ lsSet(LANG_LS, lang);
4517
+ for (const [k, c] of cells) c.el.remove();
4518
+ cells.clear();
4519
+ applyLang();
4520
+ schedule();
4521
+ });
4522
+ const SPLIT_LS = LS_PREFIX + 'split';
4523
+ function setSplit(pct, save) {
4524
+ pct = Math.max(25, Math.min(75, Math.round(pct)));
4525
+ const v = $('vFlows');
4526
+ v.style.setProperty('--split', pct + '%');
4527
+ $('split').setAttribute('aria-valuenow', String(pct));
4528
+ if (save) lsSet(SPLIT_LS, String(pct));
4529
+ }
4530
+ {
4531
+ const sv = parseFloat(lsGet(SPLIT_LS));
4532
+ setSplit(isFinite(sv) ? sv : 58, false);
4533
+ const sp = $('split');
4534
+ let drag = false;
4535
+ sp.addEventListener('pointerdown', (ev) => {
4536
+ drag = true;
4537
+ sp.setPointerCapture(ev.pointerId);
4538
+ sp.classList.add('drag');
4539
+ ev.preventDefault();
4540
+ });
4541
+ sp.addEventListener('pointermove', (ev) => {
4542
+ if (!drag) return;
4543
+ const r = $('vFlows').getBoundingClientRect();
4544
+ setSplit(((ev.clientX - r.left) / r.width) * 100, false);
4545
+ });
4546
+ const end = () => {
4547
+ if (!drag) return;
4548
+ drag = false;
4549
+ sp.classList.remove('drag');
4550
+ setSplit(parseFloat(sp.getAttribute('aria-valuenow')), true);
4551
+ placePop();
4552
+ };
4553
+ sp.addEventListener('pointerup', end);
4554
+ sp.addEventListener('pointercancel', end);
4555
+ sp.addEventListener('dblclick', () => {
4556
+ try {
4557
+ localStorage.removeItem(SPLIT_LS);
4558
+ } catch {}
4559
+ setSplit(58, false);
4560
+ });
4561
+ sp.addEventListener('keydown', (ev) => {
4562
+ const cur = parseFloat(sp.getAttribute('aria-valuenow'));
4563
+ const step = ev.shiftKey ? 10 : 2;
4564
+ if (ev.key === 'ArrowLeft') {
4565
+ ev.preventDefault();
4566
+ setSplit(cur - step, true);
4567
+ } else if (ev.key === 'ArrowRight') {
4568
+ ev.preventDefault();
4569
+ setSplit(cur + step, true);
4570
+ } else if (ev.key === 'Home') {
4571
+ ev.preventDefault();
4572
+ setSplit(25, true);
4573
+ } else if (ev.key === 'End') {
4574
+ ev.preventDefault();
4575
+ setSplit(75, true);
4576
+ }
4577
+ });
4578
+ }
4579
+
4580
+ function applyViewMode() {
4581
+ for (const b of document.querySelectorAll('#vmode button'))
4582
+ b.setAttribute('aria-checked', String(b.dataset.mode === viewMode));
4583
+ $('detail').classList.toggle('dgmode', viewMode === 'diagram');
4584
+ }
4585
+ for (const b of document.querySelectorAll('#vmode button'))
4586
+ b.addEventListener('click', () => {
4587
+ viewMode = b.dataset.mode;
4588
+ lsSet(VM_LS, viewMode);
4589
+ applyViewMode();
4590
+ if (viewMode === 'diagram' && !selected && FL.length) {
4591
+ const f =
4592
+ FL.find((x) => x.state === 'you') ||
4593
+ FL.find((x) => x.state === 'blocked') ||
4594
+ FL.find((x) => x.state === 'running') ||
4595
+ FL[0];
4596
+ selected = f.id;
4597
+ }
4598
+ renderList();
4599
+ if (selected) renderDetail(true);
4600
+ });
4601
+ applyViewMode();
4602
+ new ResizeObserver(() => {
4603
+ if ($('vAgents').classList.contains('on')) renderAgents();
4604
+ }).observe($('gWrap'));
4605
+ let raf = 0;
4606
+ function schedule() {
4607
+ if (raf) return;
4608
+ raf = requestAnimationFrame(() => {
4609
+ raf = 0;
4610
+ renderList();
4611
+ renderAgents();
4612
+ renderDock();
4613
+ if (popFor) {
4614
+ renderPop();
4615
+ placePop();
4616
+ }
4617
+ });
4618
+ }
4619
+ function showTab(k) {
4620
+ for (const x of ['Flows', 'Agents']) {
4621
+ $('t' + x).setAttribute('aria-selected', String(x === k));
4622
+ $('v' + x).classList.toggle('on', x === k);
4623
+ }
4624
+ if (k === 'Agents') requestAnimationFrame(renderAgents);
4625
+ }
4626
+ $('tFlows').addEventListener('click', () => showTab('Flows'));
4627
+ $('tAgents').addEventListener('click', () => showTab('Agents'));
4628
+ $('bSeen').addEventListener('click', () => {
4629
+ lastSeen = new Date().toISOString();
4630
+ lsSet(LS, lastSeen);
4631
+ schedule();
4632
+ });
4633
+ const toggleKeys = (v) => {
4634
+ const k = $('keys');
4635
+ k.hidden = v === undefined ? !k.hidden : !v;
4636
+ $('bKeys').setAttribute('aria-expanded', String(!k.hidden));
4637
+ };
4638
+ $('bKeys').addEventListener('click', () => toggleKeys());
4639
+
4640
+ document.addEventListener('keydown', (ev) => {
4641
+ const t = ev.target;
4642
+ if (ev.key === 'Escape' && popFor) {
4643
+ ev.preventDefault();
4644
+ closePop();
4645
+ return;
4646
+ }
4647
+ if (t && t.closest && t.closest('input,textarea,select,[contenteditable="true"]')) return;
4648
+ if (ev.metaKey || ev.ctrlKey || ev.altKey) return;
4649
+ const rows = [...document.querySelectorAll('.row,.kcard')];
4650
+ const i = rows.findIndex((r) => r.dataset.id === selected);
4651
+ if (ev.key === 'j' || ev.key === 'k') {
4652
+ ev.preventDefault();
4653
+ showTab('Flows');
4654
+ if (!rows.length) return;
4655
+ const n =
4656
+ ev.key === 'j' ? Math.min(rows.length - 1, i + 1) : Math.max(0, i < 0 ? 0 : i - 1);
4657
+ select(rows[n].dataset.id, false);
4658
+ rows[n].focus();
4659
+ } else if (
4660
+ ev.key === 'Enter' &&
4661
+ selected &&
4662
+ !(t && t.closest && t.closest('button,a,.row'))
4663
+ ) {
4664
+ ev.preventDefault();
4665
+ select(selected, true);
4666
+ } else if (ev.key === 'e' && selected) {
4667
+ showAll = !showAll;
4668
+ renderDetail(false);
4669
+ } else if (ev.key === 'Escape') {
4670
+ if (popFor) closePop();
4671
+ else if (!$('keys').hidden) toggleKeys(false);
4672
+ else closeDetail();
4673
+ } else if (ev.key === '?') {
4674
+ toggleKeys();
4675
+ }
4676
+ });
4677
+ setInterval(schedule, 60000);
4678
+
4679
+ (() => {
4680
+ document.title = DATA.title;
4681
+ $('boardTitle').textContent = DATA.title;
4682
+ if (DATA.logo) {
4683
+ const img = document.createElement('img');
4684
+ img.src = DATA.logo;
4685
+ img.alt = '';
4686
+ $('mark').append(img);
4687
+ }
4688
+ events = DATA.flows.flatMap((f) => f.events).map(normEv);
4689
+ decisions = DATA.decisions;
4690
+ agentsDoc = DATA.agents;
4691
+ releases = [];
4692
+ $('since').title = DATA.sources.join('\n');
4693
+ schedule();
4694
+ })();
4695
+ </script>
4696
+ </body>
4697
+ </html>