@nivaro/react 0.3.45 → 0.3.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +290 -23
  4. package/dist/index.js +679 -659
  5. package/dist/shared/components/BaseMap.js +149 -103
  6. package/dist/shared/components/CollectionBrowserView.js +813 -826
  7. package/dist/shared/components/ErrorNotice.js +169 -0
  8. package/dist/shared/components/ErrorSurface.js +23 -17
  9. package/dist/shared/components/ListLoadError.js +8 -29
  10. package/dist/shared/components/LoadErrorNote.js +38 -21
  11. package/dist/shared/components/QueryErrorState.js +8 -11
  12. package/dist/shared/components/ReportView.js +1320 -1291
  13. package/dist/shared/components/chat/ChannelArchive.js +60 -60
  14. package/dist/shared/components/chat/ChannelExtras.js +74 -74
  15. package/dist/shared/components/chat/ChatPanel.js +368 -367
  16. package/dist/shared/components/command-center/CommandCenterView.js +313 -69
  17. package/dist/shared/components/command-center/Customize.js +353 -0
  18. package/dist/shared/components/command-center/Header.js +279 -53
  19. package/dist/shared/components/command-center/KioskLinks.js +198 -0
  20. package/dist/shared/components/command-center/PeekPanel.js +144 -3
  21. package/dist/shared/components/command-center/announce.js +13 -0
  22. package/dist/shared/components/command-center/board-prefs.js +99 -0
  23. package/dist/shared/components/command-center/freshness.js +29 -0
  24. package/dist/shared/components/command-center/layout.js +56 -0
  25. package/dist/shared/components/command-center/panels/AttentionPanel.js +132 -3
  26. package/dist/shared/components/command-center/panels/Banner.js +75 -0
  27. package/dist/shared/components/command-center/panels/BoardSettings.js +224 -0
  28. package/dist/shared/components/command-center/panels/FeedPanel.js +145 -29
  29. package/dist/shared/components/command-center/panels/FlowPanel.js +154 -56
  30. package/dist/shared/components/command-center/panels/ForecastPanel.js +244 -3
  31. package/dist/shared/components/command-center/panels/MapLegend.js +266 -0
  32. package/dist/shared/components/command-center/panels/MapPanel.js +216 -66
  33. package/dist/shared/components/command-center/panels/PartnersPanel.js +49 -3
  34. package/dist/shared/components/command-center/panels/PeoplePanel.js +258 -40
  35. package/dist/shared/components/command-center/panels/RegionPicker.js +88 -3
  36. package/dist/shared/components/command-center/panels/SystemPanel.js +158 -38
  37. package/dist/shared/components/command-center/panels/ThroughputPanel.js +307 -3
  38. package/dist/shared/components/command-center/panels/TimeBar.js +227 -6
  39. package/dist/shared/components/command-center/panels/TrafficPanel.js +12 -8
  40. package/dist/shared/components/command-center/panels/WorkloadPanel.js +82 -3
  41. package/dist/shared/components/command-center/panels/attention-actions.js +267 -0
  42. package/dist/shared/components/command-center/panels/map-shared.js +95 -0
  43. package/dist/shared/components/command-center/panels/registry.js +87 -19
  44. package/dist/shared/components/command-center/shell-hooks.js +118 -0
  45. package/dist/shared/components/command-center/shortcuts.js +37 -0
  46. package/dist/shared/components/command-center/theme.js +39 -21
  47. package/dist/shared/components/command-center/time.js +52 -0
  48. package/dist/shared/components/command-center/url-state.js +54 -0
  49. package/dist/shared/components/command-center/work-links.js +32 -0
  50. package/dist/shared/components/help-videos/editor/ClipsPanel.js +49 -48
  51. package/dist/shared/components/help-videos/editor/PublishButton.js +37 -36
  52. package/dist/shared/components/help-videos/editor/StatsTab.js +45 -44
  53. package/dist/shared/components/help-videos/editor/VersionsTab.js +29 -28
  54. package/dist/shared/components/help-videos/library/AuthorRolesButton.js +19 -18
  55. package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +132 -129
  56. package/dist/shared/components/help-videos/library/LearningPathsPanel.js +42 -41
  57. package/dist/shared/components/help-videos/settings/HouseStyleButton.js +21 -20
  58. package/dist/shared/components/help-videos/settings/RenderSettingsButton.js +22 -21
  59. package/dist/shared/components/import/DocumentAutofillButton.js +24 -20
  60. package/dist/shared/components/import/ImportFromFileButton.js +61 -60
  61. package/dist/shared/components/imports/ImportStalenessControl.js +20 -21
  62. package/dist/shared/components/imports/NewImportDialog.js +29 -28
  63. package/dist/shared/components/imports/RunDetailSheet.js +63 -63
  64. package/dist/shared/components/item-edit/FieldRow.js +329 -329
  65. package/dist/shared/components/item-edit/InlineTableField.js +898 -898
  66. package/dist/shared/components/item-edit/PersonalDefaultControl.js +57 -56
  67. package/dist/shared/components/item-edit/PlanGrid.js +220 -221
  68. package/dist/shared/components/item-edit/RecordGrantTools.js +49 -48
  69. package/dist/shared/components/item-edit/placement-behaviour.js +68 -67
  70. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +24 -23
  71. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +17 -16
  72. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +41 -41
  73. package/dist/shared/components/layout-editor/outputs/output-api.js +33 -31
  74. package/dist/shared/components/layout-editor/overview/overview-api.js +84 -83
  75. package/dist/shared/components/layout-editor/useLayoutDraft.js +47 -42
  76. package/dist/shared/components/monitoring/InactiveUserLinksView.js +10 -9
  77. package/dist/shared/components/monitoring/TrafficMiniMap.js +111 -70
  78. package/dist/shared/components/panels/SlaClock.js +35 -36
  79. package/dist/shared/components/pipeline/PipelineEditorView.js +311 -312
  80. package/dist/shared/components/pipeline/TeamSuggestions.js +31 -30
  81. package/dist/shared/components/profile/AgentsPanel.js +73 -72
  82. package/dist/shared/components/profile/MailSuppressedPill.js +22 -21
  83. package/dist/shared/components/support/SupportRequestDialog.js +85 -81
  84. package/dist/shared/components/support/SupportView.js +94 -87
  85. package/dist/shared/lib/autofill-poll.js +21 -18
  86. package/dist/shared/lib/error-actions.js +85 -0
  87. package/dist/shared/lib/error-message.js +223 -82
  88. package/dist/shared/lib/error-toast.js +71 -13
  89. package/dist/shared/lib/safe-error.js +136 -38
  90. package/package.json +1 -1
@@ -1,6 +1,247 @@
1
- function n() {
2
- return null;
1
+ import { jsxs as t, jsx as e, Fragment as L } from "react/jsx-runtime";
2
+ import { AlertTriangle as T } from "lucide-react";
3
+ import { useMemo as H, useState as C } from "react";
4
+ import { useCcQuery as E } from "../api.js";
5
+ import { useCc as F } from "../state.js";
6
+ import { PANEL as U, PANEL_HEAD as W, TITLE as j, MUTED as _, FAINT as y } from "../theme.js";
7
+ const u = 320, g = 120, o = { l: 26, r: 6, t: 8, b: 18 }, b = (r) => r === 0 ? "12a" : r < 12 ? `${r}a` : r === 12 ? "12p" : `${r - 12}p`, z = () => {
8
+ try {
9
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
10
+ } catch {
11
+ return "UTC";
12
+ }
13
+ };
14
+ function q() {
15
+ const r = F(), i = H(z, []), m = E("/forecast", { tz: i }, { refetchInterval: 12e4 }), n = m.data, [N, k] = C(null);
16
+ if (m.isError) return null;
17
+ const d = r.at ? new Date(r.at).getHours() : (/* @__PURE__ */ new Date()).getHours(), p = (n == null ? void 0 : n.by_hour) ?? [], x = Math.max(
18
+ 1,
19
+ ...p.flatMap((a) => [a.arrivals, a.completions, a.expected_arrivals, a.expected_completions])
20
+ ), h = (a) => o.l + a / 23 * (u - o.l - o.r), l = (a) => o.t + (1 - a / x) * (g - o.t - o.b), v = (a) => a.map((c, f) => c == null ? null : `${h(f).toFixed(1)},${l(c).toFixed(1)}`).filter(Boolean).map((c, f) => `${f ? "L" : "M"}${c}`).join(" "), w = (a) => p.map((c) => c.hour <= d ? c[a] : null), A = n != null && (n.history_days ?? 0) === 0, s = N != null ? p[N] : null;
21
+ return /* @__PURE__ */ t("section", { className: U, "data-cc-panel": "forecast", "data-cc-forecast": !0, "aria-busy": m.isLoading, children: [
22
+ /* @__PURE__ */ e("style", { children: `
23
+ [data-cc-mode='light'] [data-cc-forecast] { --fc-a: #2a78d6; --fc-c: #eb6834; }
24
+ [data-cc-mode='dark'] [data-cc-forecast] { --fc-a: #3987e5; --fc-c: #d95926; }
25
+ ` }),
26
+ /* @__PURE__ */ t("div", { className: W, children: [
27
+ /* @__PURE__ */ e("h2", { className: j, children: "Today’s forecast" }),
28
+ /* @__PURE__ */ t("span", { className: `flex items-center gap-2 text-[10.5px] ${_}`, children: [
29
+ /* @__PURE__ */ e($, { color: "var(--fc-a)", label: "Arrivals" }),
30
+ /* @__PURE__ */ e($, { color: "var(--fc-c)", label: "Completions" }),
31
+ /* @__PURE__ */ t("span", { className: "flex items-center gap-1", children: [
32
+ /* @__PURE__ */ e("span", { className: "w-3.5 border-t-2 border-dashed border-[var(--cc-muted)]", "aria-hidden": !0 }),
33
+ "usual"
34
+ ] })
35
+ ] })
36
+ ] }),
37
+ /* @__PURE__ */ t("div", { className: "p-3", children: [
38
+ n && /* @__PURE__ */ t("div", { className: "relative", children: [
39
+ /* @__PURE__ */ t(
40
+ "svg",
41
+ {
42
+ viewBox: `0 0 ${u} ${g}`,
43
+ className: "block h-auto w-full",
44
+ role: "img",
45
+ "aria-label": M(n),
46
+ onMouseLeave: () => k(null),
47
+ onMouseMove: (a) => {
48
+ const c = a.currentTarget.getBoundingClientRect(), f = (a.clientX - c.left) / Math.max(1, c.width) * u, D = Math.round((f - o.l) / (u - o.l - o.r) * 23);
49
+ k(Math.min(23, Math.max(0, D)));
50
+ },
51
+ children: [
52
+ /* @__PURE__ */ e("line", { x1: o.l, x2: u - o.r, y1: l(0), y2: l(0), stroke: "var(--cc-border)" }),
53
+ /* @__PURE__ */ e(
54
+ "line",
55
+ {
56
+ x1: o.l,
57
+ x2: u - o.r,
58
+ y1: l(x),
59
+ y2: l(x),
60
+ stroke: "var(--cc-border)",
61
+ strokeDasharray: "2 3"
62
+ }
63
+ ),
64
+ /* @__PURE__ */ e(
65
+ "text",
66
+ {
67
+ x: o.l - 4,
68
+ y: l(x) + 3,
69
+ textAnchor: "end",
70
+ fontSize: "8",
71
+ fill: "var(--cc-faint)",
72
+ children: Math.round(x)
73
+ }
74
+ ),
75
+ /* @__PURE__ */ e("text", { x: o.l - 4, y: l(0) + 3, textAnchor: "end", fontSize: "8", fill: "var(--cc-faint)", children: "0" }),
76
+ [0, 6, 12, 18, 23].map((a) => /* @__PURE__ */ e(
77
+ "text",
78
+ {
79
+ x: h(a),
80
+ y: g - 4,
81
+ textAnchor: "middle",
82
+ fontSize: "8",
83
+ fill: "var(--cc-faint)",
84
+ children: b(a)
85
+ },
86
+ a
87
+ )),
88
+ /* @__PURE__ */ e(
89
+ "line",
90
+ {
91
+ x1: h(d),
92
+ x2: h(d),
93
+ y1: o.t,
94
+ y2: l(0),
95
+ stroke: "var(--cc-faint)",
96
+ strokeDasharray: "1 2"
97
+ }
98
+ ),
99
+ !A && /* @__PURE__ */ t(L, { children: [
100
+ /* @__PURE__ */ e(
101
+ "path",
102
+ {
103
+ d: v(p.map((a) => a.expected_arrivals)),
104
+ fill: "none",
105
+ stroke: "var(--fc-a)",
106
+ strokeWidth: "1.5",
107
+ strokeDasharray: "4 3",
108
+ opacity: "0.8"
109
+ }
110
+ ),
111
+ /* @__PURE__ */ e(
112
+ "path",
113
+ {
114
+ d: v(p.map((a) => a.expected_completions)),
115
+ fill: "none",
116
+ stroke: "var(--fc-c)",
117
+ strokeWidth: "1.5",
118
+ strokeDasharray: "4 3",
119
+ opacity: "0.8"
120
+ }
121
+ )
122
+ ] }),
123
+ /* @__PURE__ */ e(
124
+ "path",
125
+ {
126
+ d: v(w("arrivals")),
127
+ fill: "none",
128
+ stroke: "var(--fc-a)",
129
+ strokeWidth: "2",
130
+ strokeLinejoin: "round"
131
+ }
132
+ ),
133
+ /* @__PURE__ */ e(
134
+ "path",
135
+ {
136
+ d: v(w("completions")),
137
+ fill: "none",
138
+ stroke: "var(--fc-c)",
139
+ strokeWidth: "2",
140
+ strokeLinejoin: "round"
141
+ }
142
+ ),
143
+ s && /* @__PURE__ */ e(
144
+ "line",
145
+ {
146
+ x1: h(s.hour),
147
+ x2: h(s.hour),
148
+ y1: o.t,
149
+ y2: l(0),
150
+ stroke: "var(--cc-muted)"
151
+ }
152
+ )
153
+ ]
154
+ }
155
+ ),
156
+ s && /* @__PURE__ */ t(
157
+ "div",
158
+ {
159
+ className: "pointer-events-none absolute top-0 rounded-md border border-[var(--cc-border)] bg-[var(--cc-panel)] px-2 py-1 text-[11px] text-[var(--cc-text)] shadow-sm",
160
+ style: {
161
+ left: `${h(s.hour) / u * 100}%`,
162
+ transform: s.hour > 14 ? "translateX(calc(-100% - 6px))" : "translateX(6px)"
163
+ },
164
+ children: [
165
+ /* @__PURE__ */ t("div", { className: "font-medium", children: [
166
+ b(s.hour),
167
+ "–",
168
+ b((s.hour + 1) % 24)
169
+ ] }),
170
+ /* @__PURE__ */ t("div", { className: "tabular-nums", children: [
171
+ "Arrivals ",
172
+ s.hour <= d ? s.arrivals : "–",
173
+ " ",
174
+ /* @__PURE__ */ t("span", { className: y, children: [
175
+ "(usual ",
176
+ s.expected_arrivals,
177
+ ")"
178
+ ] })
179
+ ] }),
180
+ /* @__PURE__ */ t("div", { className: "tabular-nums", children: [
181
+ "Completions ",
182
+ s.hour <= d ? s.completions : "–",
183
+ " ",
184
+ /* @__PURE__ */ t("span", { className: y, children: [
185
+ "(usual ",
186
+ s.expected_completions,
187
+ ")"
188
+ ] })
189
+ ] })
190
+ ]
191
+ }
192
+ )
193
+ ] }),
194
+ n && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1 text-[11.5px]", children: [
195
+ n.behind && /* @__PURE__ */ t(
196
+ "p",
197
+ {
198
+ className: "flex items-center gap-1 font-medium text-[var(--cc-warn-text)]",
199
+ role: "status",
200
+ children: [
201
+ /* @__PURE__ */ e(T, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
202
+ "Falling behind: work is arriving faster than it is being finished, compared with a usual ",
203
+ S(r.at),
204
+ "."
205
+ ]
206
+ }
207
+ ),
208
+ /* @__PURE__ */ e("p", { className: _, children: M(n) }),
209
+ n.region_applies === !1 && /* @__PURE__ */ e("p", { className: y, children: "These records are not placed in regions — showing everywhere." })
210
+ ] }),
211
+ n && /* @__PURE__ */ t("table", { className: "sr-only", children: [
212
+ /* @__PURE__ */ e("caption", { children: "Arrivals and completions by hour today, with the usual" }),
213
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
214
+ /* @__PURE__ */ e("th", { children: "Hour" }),
215
+ /* @__PURE__ */ e("th", { children: "Arrivals" }),
216
+ /* @__PURE__ */ e("th", { children: "Usual arrivals" }),
217
+ /* @__PURE__ */ e("th", { children: "Completions" }),
218
+ /* @__PURE__ */ e("th", { children: "Usual completions" })
219
+ ] }) }),
220
+ /* @__PURE__ */ e("tbody", { children: p.map((a) => /* @__PURE__ */ t("tr", { children: [
221
+ /* @__PURE__ */ e("td", { children: b(a.hour) }),
222
+ /* @__PURE__ */ e("td", { children: a.hour <= d ? a.arrivals : "" }),
223
+ /* @__PURE__ */ e("td", { children: a.expected_arrivals }),
224
+ /* @__PURE__ */ e("td", { children: a.hour <= d ? a.completions : "" }),
225
+ /* @__PURE__ */ e("td", { children: a.expected_completions })
226
+ ] }, a.hour)) })
227
+ ] }),
228
+ !n && m.isLoading && /* @__PURE__ */ e("p", { className: `text-[12px] ${y}`, children: "Working out today…" })
229
+ ] })
230
+ ] });
231
+ }
232
+ function $({ color: r, label: i }) {
233
+ return /* @__PURE__ */ t("span", { className: "flex items-center gap-1", children: [
234
+ /* @__PURE__ */ e("span", { className: "h-[2px] w-3 rounded", style: { background: r }, "aria-hidden": !0 }),
235
+ i
236
+ ] });
237
+ }
238
+ function S(r) {
239
+ return new Date(r ?? Date.now()).toLocaleDateString(void 0, { weekday: "long" });
240
+ }
241
+ function M(r) {
242
+ const i = (r.history_days ?? 0) > 0, m = `${r.arrivals_so_far} arrived so far${i ? ` (usually ${Math.round(r.arrivals_expected)} by now)` : ""}`, n = `${r.completions_so_far} completed${i ? ` (usually ${Math.round(r.completions_expected)})` : ""}`;
243
+ return `${m}; ${n}.${i ? "" : " Not enough history yet for a usual day."}`;
3
244
  }
4
245
  export {
5
- n as ForecastPanel
246
+ q as ForecastPanel
6
247
  };
@@ -0,0 +1,266 @@
1
+ import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
+ import { X as S, ChevronsUpDown as M, Check as $ } from "lucide-react";
3
+ import { useMemo as C, useState as w } from "react";
4
+ import { cn as y } from "../../../lib/utils.js";
5
+ import { Command as A, CommandInput as L, CommandList as O, CommandEmpty as P, CommandItem as F } from "../../ui/command.js";
6
+ import { Popover as E, PopoverTrigger as _, PopoverContent as I } from "../../ui/popover.js";
7
+ import { useCc as T, EMPTY_FILTERS as j } from "../state.js";
8
+ import { FAINT as N, FOCUS as v, MUTED as R } from "../theme.js";
9
+ import { MAP_COLORS as s } from "./map-shared.js";
10
+ function x({ color: c, pulse: l }) {
11
+ return /* @__PURE__ */ o(
12
+ "span",
13
+ {
14
+ className: "relative inline-flex h-3.5 w-3 shrink-0 items-center justify-center",
15
+ "aria-hidden": "true",
16
+ children: [
17
+ l && /* @__PURE__ */ r(
18
+ "span",
19
+ {
20
+ className: "absolute inset-0 rounded-full motion-safe:animate-ping",
21
+ style: { background: `${c}55` }
22
+ }
23
+ ),
24
+ /* @__PURE__ */ r("svg", { width: "12", height: "15", viewBox: "0 0 24 30", className: "relative", "aria-hidden": "true", children: /* @__PURE__ */ r(
25
+ "path",
26
+ {
27
+ d: "M12 0C5.4 0 0 5.4 0 12c0 8.4 12 18 12 18s12-9.6 12-18C24 5.4 18.6 0 12 0z",
28
+ fill: c,
29
+ stroke: "#fff",
30
+ strokeWidth: "2"
31
+ }
32
+ ) })
33
+ ]
34
+ }
35
+ );
36
+ }
37
+ const b = {
38
+ sla_heat: { color: s.breached, text: "SLA heat — larger, stronger dots are breached" },
39
+ activity: { color: s.activity, text: "Changed in the last 15 minutes" },
40
+ out_today: { color: s.out, text: "Out of office today" }
41
+ };
42
+ function J({
43
+ states: c,
44
+ layers: l,
45
+ showPeople: i
46
+ }) {
47
+ return /* @__PURE__ */ o(
48
+ "section",
49
+ {
50
+ className: "w-[240px] space-y-1.5 rounded-lg border border-[var(--cc-border)] bg-[var(--cc-panel)] p-2.5 text-[11.5px] text-[var(--cc-text)] shadow-lg",
51
+ "aria-label": "Map key",
52
+ children: [
53
+ /* @__PURE__ */ r("p", { className: "font-semibold text-[var(--cc-strong)]", children: "Map key" }),
54
+ c.slice(0, 6).map((t) => /* @__PURE__ */ o("p", { className: "flex items-center gap-2", children: [
55
+ /* @__PURE__ */ r(x, { color: t.color ?? s.ok }),
56
+ " ",
57
+ t.label
58
+ ] }, t.key)),
59
+ c.length === 0 && /* @__PURE__ */ o("p", { className: "flex items-center gap-2", children: [
60
+ /* @__PURE__ */ r(x, { color: s.ok }),
61
+ " A record (no pipeline step)"
62
+ ] }),
63
+ /* @__PURE__ */ o("p", { className: "flex items-center gap-2", children: [
64
+ /* @__PURE__ */ r(x, { color: s.warning }),
65
+ " SLA warning — due soon"
66
+ ] }),
67
+ /* @__PURE__ */ o("p", { className: "flex items-center gap-2", children: [
68
+ /* @__PURE__ */ r(x, { color: s.breached, pulse: !0 }),
69
+ " SLA breached — overdue (pulses)"
70
+ ] }),
71
+ /* @__PURE__ */ o("p", { className: "flex items-center gap-2", children: [
72
+ /* @__PURE__ */ r(
73
+ "span",
74
+ {
75
+ className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 border-white text-[8px] font-bold text-white",
76
+ style: { background: s.breached },
77
+ "aria-hidden": "true",
78
+ children: "3"
79
+ }
80
+ ),
81
+ "Group of records — takes the colour of the worst one"
82
+ ] }),
83
+ i && /* @__PURE__ */ o("p", { className: "flex items-center gap-2", children: [
84
+ /* @__PURE__ */ r(
85
+ "span",
86
+ {
87
+ className: "h-4 w-4 shrink-0 rounded-full",
88
+ style: {
89
+ background: `${s.people}45`,
90
+ border: `2px dashed ${s.people}`
91
+ },
92
+ "aria-hidden": "true"
93
+ }
94
+ ),
95
+ "People online at an office or in a region"
96
+ ] }),
97
+ l.map((t) => /* @__PURE__ */ o("p", { className: "flex items-center gap-2", children: [
98
+ /* @__PURE__ */ r(
99
+ "span",
100
+ {
101
+ className: "h-3 w-3 shrink-0 rounded-full",
102
+ style: {
103
+ background: `${b[t].color}88`,
104
+ border: `1.5px solid ${b[t].color}`
105
+ },
106
+ "aria-hidden": "true"
107
+ }
108
+ ),
109
+ b[t].text
110
+ ] }, t))
111
+ ]
112
+ }
113
+ );
114
+ }
115
+ const g = (c) => y(
116
+ "inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px]",
117
+ v,
118
+ c ? "border-nvr-cyan bg-nvr-cyan/15 font-medium text-[var(--cc-strong)]" : "border-[var(--cc-border)] text-[var(--cc-muted)] hover:bg-[var(--cc-chip)]"
119
+ ), U = [
120
+ { key: "breached", label: "Breached", color: s.breached },
121
+ { key: "warning", label: "Warning", color: s.warning },
122
+ { key: "ok", label: "On time", color: s.people }
123
+ ];
124
+ function Q({
125
+ states: c,
126
+ pins: l
127
+ }) {
128
+ const i = T(), t = i.filters, p = (e) => i.setFilters({ ...t, ...e }), u = (e, n) => e.includes(n) ? e.filter((a) => a !== n) : [...e, n], f = t.states.length > 0 || t.sla.length > 0 || !!t.owner, d = C(() => {
129
+ const e = new Map(c.map((n) => [n.key, n]));
130
+ for (const n of t.states) e.has(n) || e.set(n, { key: n, label: n, color: null });
131
+ return [...e.values()];
132
+ }, [c, t.states]);
133
+ return d.length === 0 && l.length === 0 && !f ? null : /* @__PURE__ */ o("fieldset", { className: "relative m-0 flex min-w-0 flex-wrap items-center gap-1.5 border-0 border-b border-[var(--cc-border)] px-3 py-1.5", children: [
134
+ /* @__PURE__ */ r("legend", { className: "sr-only", children: "Map filters" }),
135
+ d.length > 0 && /* @__PURE__ */ r("span", { className: `text-[11px] ${N}`, children: "Step" }),
136
+ d.map((e) => {
137
+ const n = t.states.includes(e.key);
138
+ return /* @__PURE__ */ o(
139
+ "button",
140
+ {
141
+ type: "button",
142
+ "aria-pressed": n,
143
+ onClick: () => p({ states: u(t.states, e.key) }),
144
+ className: g(n),
145
+ children: [
146
+ /* @__PURE__ */ r(
147
+ "span",
148
+ {
149
+ className: "h-2 w-2 rounded-full",
150
+ style: { background: e.color ?? s.ok },
151
+ "aria-hidden": "true"
152
+ }
153
+ ),
154
+ e.label
155
+ ]
156
+ },
157
+ e.key
158
+ );
159
+ }),
160
+ /* @__PURE__ */ r("span", { className: `ml-1 text-[11px] ${N}`, children: "SLA" }),
161
+ U.map((e) => {
162
+ const n = t.sla.includes(e.key);
163
+ return /* @__PURE__ */ o(
164
+ "button",
165
+ {
166
+ type: "button",
167
+ "aria-pressed": n,
168
+ onClick: () => p({ sla: u(t.sla, e.key) }),
169
+ className: g(n),
170
+ children: [
171
+ /* @__PURE__ */ r(
172
+ "span",
173
+ {
174
+ className: "h-2 w-2 rounded-full",
175
+ style: { background: e.color },
176
+ "aria-hidden": "true"
177
+ }
178
+ ),
179
+ e.label
180
+ ]
181
+ },
182
+ e.key
183
+ );
184
+ }),
185
+ /* @__PURE__ */ r(Y, { pins: l, value: t.owner, onChange: (e) => p({ owner: e }) }),
186
+ f && /* @__PURE__ */ r(
187
+ "button",
188
+ {
189
+ type: "button",
190
+ onClick: () => i.setFilters(j),
191
+ className: y("ml-auto text-[11px] underline-offset-2 hover:underline", R, v),
192
+ children: "Clear filters"
193
+ }
194
+ )
195
+ ] });
196
+ }
197
+ function Y({
198
+ pins: c,
199
+ value: l,
200
+ onChange: i
201
+ }) {
202
+ var n;
203
+ const [t, p] = w(!1), [u, f] = w({}), d = C(() => {
204
+ const a = /* @__PURE__ */ new Map();
205
+ for (const m of c)
206
+ for (const h of m.owners ?? []) {
207
+ const k = a.get(h.id) ?? { ...h, n: 0 };
208
+ k.n++, a.set(h.id, k);
209
+ }
210
+ return [...a.values()].sort((m, h) => h.n - m.n || m.name.localeCompare(h.name));
211
+ }, [c]), e = l ? ((n = d.find((a) => a.id === l)) == null ? void 0 : n.name) ?? u[l] ?? "Chosen person" : null;
212
+ return d.length === 0 && !l ? null : /* @__PURE__ */ o(E, { open: t, onOpenChange: p, children: [
213
+ /* @__PURE__ */ r(_, { asChild: !0, children: /* @__PURE__ */ o(
214
+ "button",
215
+ {
216
+ type: "button",
217
+ className: g(!!l),
218
+ "aria-label": e ? `Owner: ${e}` : "Filter by owner",
219
+ children: [
220
+ e ? `Owner: ${e}` : "Any owner",
221
+ l ? /* @__PURE__ */ r(
222
+ S,
223
+ {
224
+ className: "h-3 w-3",
225
+ "aria-hidden": "true",
226
+ onClick: (a) => {
227
+ a.stopPropagation(), i(null);
228
+ }
229
+ }
230
+ ) : /* @__PURE__ */ r(M, { className: "h-3 w-3", "aria-hidden": "true" })
231
+ ]
232
+ }
233
+ ) }),
234
+ /* @__PURE__ */ r(I, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ o(A, { children: [
235
+ /* @__PURE__ */ r(L, { placeholder: "Find an owner…", className: "h-8 text-[12px]" }),
236
+ /* @__PURE__ */ o(O, { children: [
237
+ /* @__PURE__ */ r(P, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "Nobody matches" }),
238
+ d.map((a) => /* @__PURE__ */ o(
239
+ F,
240
+ {
241
+ value: `${a.name} ${a.id}`,
242
+ onSelect: () => {
243
+ f((m) => ({ ...m, [a.id]: a.name })), i(l === a.id ? null : a.id), p(!1);
244
+ },
245
+ className: "text-[12px]",
246
+ children: [
247
+ /* @__PURE__ */ r(
248
+ $,
249
+ {
250
+ className: y("mr-2 h-3 w-3", l === a.id ? "opacity-100" : "opacity-0")
251
+ }
252
+ ),
253
+ /* @__PURE__ */ r("span", { className: "flex-1 truncate", children: a.name }),
254
+ /* @__PURE__ */ r("span", { className: "text-[11px] tabular-nums text-muted-foreground", children: a.n })
255
+ ]
256
+ },
257
+ a.id
258
+ ))
259
+ ] })
260
+ ] }) })
261
+ ] });
262
+ }
263
+ export {
264
+ Q as MapFilters,
265
+ J as MapLegend
266
+ };