@mechane-ai/elements 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +48 -18
  2. package/bin/mechane-elements-catalog.mjs +42 -4
  3. package/dist/ai.js +268 -202
  4. package/dist/catalog.json +91 -31
  5. package/dist/categorical-values-BXi-rJuv.js +74 -0
  6. package/dist/chart-cursor-1mFd48Jc.js +23 -0
  7. package/dist/chart-data-CIJVWCYt.js +21 -0
  8. package/dist/{chart-frame-Ztktqs1b.js → chart-frame-BaxKn_MB.js} +22 -41
  9. package/dist/{chart-input-BO3BqlFO.js → chart-input-Bm82_9Rd.js} +2 -2
  10. package/dist/chart-theme-4zprJ3rW.js +404 -0
  11. package/dist/charts/cartesian.js +1598 -1432
  12. package/dist/charts/distribution.js +476 -404
  13. package/dist/charts/graph.js +363 -349
  14. package/dist/charts/hierarchy.js +103 -94
  15. package/dist/charts/matrix.js +340 -333
  16. package/dist/charts/timeline.js +167 -134
  17. package/dist/charts.js +3 -3
  18. package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
  19. package/dist/collections.js +1648 -1188
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +67 -66
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +2 -2
  25. package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/csp.js +6 -11
  28. package/dist/feedback.js +1 -1
  29. package/dist/forms/dates.js +274 -214
  30. package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
  31. package/dist/forms.js +3 -3
  32. package/dist/index.js +1 -1
  33. package/dist/layout.js +207 -207
  34. package/dist/navigation.js +4 -3
  35. package/dist/packages/ai/src/conversation.d.ts +2 -0
  36. package/dist/packages/ai/src/prompt-input.d.ts +7 -2
  37. package/dist/packages/charts/src/cartesian/composition-bars.d.ts +2 -2
  38. package/dist/packages/charts/src/cartesian/index.d.ts +3 -2
  39. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +8 -2
  40. package/dist/packages/charts/src/cartesian/time-series.d.ts +11 -1
  41. package/dist/packages/charts/src/categorical-values.d.ts +14 -9
  42. package/dist/packages/charts/src/chart-frame.d.ts +7 -9
  43. package/dist/packages/charts/src/chart-inspection.d.ts +1 -2
  44. package/dist/packages/charts/src/chart-range.d.ts +33 -0
  45. package/dist/packages/charts/src/chart-rows.d.ts +20 -0
  46. package/dist/packages/charts/src/chart-theme.d.ts +17 -0
  47. package/dist/packages/charts/src/chart.d.ts +81 -0
  48. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -4
  49. package/dist/packages/charts/src/index.d.ts +1 -0
  50. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +3 -3
  51. package/dist/packages/charts/src/plot-width.d.ts +0 -1
  52. package/dist/packages/charts/src/timeline/index.d.ts +1 -1
  53. package/dist/packages/charts/src/timeline/waterfall.d.ts +6 -2
  54. package/dist/packages/collections/src/collection-controls.d.ts +5 -1
  55. package/dist/packages/collections/src/collection-filters.d.ts +4 -1
  56. package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
  57. package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
  58. package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
  59. package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
  60. package/dist/packages/collections/src/data-table-text.d.ts +13 -0
  61. package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
  62. package/dist/packages/collections/src/data-table.d.ts +3 -85
  63. package/dist/packages/collections/src/index.d.ts +11 -6
  64. package/dist/packages/collections/src/query-controls.d.ts +6 -2
  65. package/dist/packages/collections/src/table-results.d.ts +47 -13
  66. package/dist/packages/collections/src/timeline.d.ts +1 -0
  67. package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
  68. package/dist/packages/collections/src/use-table-window.d.ts +25 -0
  69. package/dist/packages/content/src/viewer.d.ts +8 -0
  70. package/dist/packages/core/src/disclosure.d.ts +9 -1
  71. package/dist/packages/core/src/index.d.ts +1 -0
  72. package/dist/packages/core/src/route-link.d.ts +11 -0
  73. package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
  74. package/dist/packages/forms/src/file-picker.d.ts +15 -0
  75. package/dist/packages/forms/src/form-controls.d.ts +1 -6
  76. package/dist/packages/forms/src/forms.d.ts +4 -1
  77. package/dist/packages/forms/src/index.d.ts +4 -2
  78. package/dist/packages/forms/src/selection.d.ts +14 -0
  79. package/dist/packages/foundations/src/csp/index.d.ts +1 -1
  80. package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
  81. package/dist/packages/navigation/src/index.d.ts +1 -1
  82. package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
  83. package/dist/plot-width-v2c_rA20.js +63 -0
  84. package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
  85. package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
  86. package/dist/src-CGc_hjxJ.js +409 -0
  87. package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
  88. package/dist/{src-Dcs3SZ9V.js → src-DVHlknB6.js} +1 -1
  89. package/dist/styles2.css +136 -114
  90. package/package.json +1 -4
  91. package/skills/extend-elements/SKILL.md +74 -0
  92. package/skills/review-elements/SKILL.md +76 -0
  93. package/skills/upgrade-elements/SKILL.md +34 -0
  94. package/skills/upgrade-elements/references/releases.md +58 -0
  95. package/skills/use-elements/SKILL.md +64 -13
  96. package/skills/use-elements/references/agent.md +57 -0
  97. package/skills/use-elements/references/charts.md +63 -0
  98. package/skills/use-elements/references/collections.md +89 -0
  99. package/skills/use-elements/references/conversations.md +47 -0
  100. package/skills/use-elements/references/forms.md +81 -0
  101. package/skills/use-elements/references/styling.md +70 -0
  102. package/skills/use-elements/references/workspace.md +3 -3
  103. package/dist/categorical-values-DZLGQVW1.js +0 -63
  104. package/dist/chart-navigation-BAbb5PV9.js +0 -154
  105. package/dist/header-styles-COxCYFZx.js +0 -90
  106. package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
  107. package/dist/packages/charts/src/chart-surface.d.ts +0 -27
  108. package/dist/packages/navigation/src/route-link.d.ts +0 -2
  109. package/dist/plot-width-CIqBiHcd.js +0 -105
  110. package/dist/src-Bk7M67zy.js +0 -396
@@ -1,24 +1,35 @@
1
- import { E as e, _ as t, c as n, i as r, p as i, w as a } from "./src-DcW_gMX8.js";
2
- import { r as o } from "./src-gqEebHEa.js";
3
- import { t as s } from "./header-styles-COxCYFZx.js";
1
+ import { D as e, T as t, c as n, i as r, m as i, u as a, v as o } from "./src-CpdJlDhO.js";
2
+ import { r as s } from "./src-1EHkSFS-.js";
4
3
  import { i as c, r as l, t as u } from "./src-na2DdkKI.js";
5
- import { p as d } from "./src-Dcs3SZ9V.js";
6
- import { t as f } from "./accessibility-P89UG9-r.js";
7
- import { l as ee, t as p } from "./constants.stylex-CqhVl0uU.js";
8
- import { t as te } from "./use-scroll-tab-index-Dxpdh4W7.js";
9
- import { n as m } from "./forms-DeU0Tiv3.js";
10
- import * as h from "@stylexjs/stylex";
11
- import { Button as g } from "@ui-sdk/react/button";
12
- import { createParts as _, mergeProps as v } from "@ui-sdk/react/primitive";
13
- import { Children as y, Fragment as ne, createContext as b, useContext as x, useEffect as S, useId as re, useLayoutEffect as C, useMemo as ie, useRef as w, useState as T, useSyncExternalStore as E } from "react";
14
- import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
15
- import { ArrowDown as ae, ArrowUp as oe, ArrowUpDown as se, ChevronLeft as A, ChevronRight as j, CircleDashed as ce, ListFilter as le, Search as M, Settings2 as ue, X as de } from "lucide-react";
16
- import { definePrimitive as N } from "@ui-sdk/core";
17
- import { useShortcut as P } from "@ui-sdk/react/shortcuts";
18
- import { createColumnHelper as fe, tableFeatures as F, useTable as pe } from "@tanstack/react-table";
19
- import { defaultRangeExtractor as me, useVirtualizer as he } from "@tanstack/react-virtual";
4
+ import { p as d } from "./src-DVHlknB6.js";
5
+ import { l as f, t as ee } from "./constants.stylex-CqhVl0uU.js";
6
+ import { t as te } from "./accessibility-P89UG9-r.js";
7
+ import { t as ne } from "./use-scroll-tab-index-Dxpdh4W7.js";
8
+ import { n as p } from "./forms-CEbwzlRR.js";
9
+ import * as m from "@stylexjs/stylex";
10
+ import { Button as h } from "@ui-sdk/react/button";
11
+ import { createParts as g, mergeProps as _, usePart as v, usePrimitive as y } from "@ui-sdk/react/primitive";
12
+ import { Children as b, Fragment as re, createContext as x, useContext as S, useEffect as C, useId as w, useLayoutEffect as T, useMemo as E, useRef as D, useState as O, useSyncExternalStore as ie } from "react";
13
+ import { byCell as k, createChange as A, createGridFocus as ae, createSelection as j, createVirtualizer as oe, definePrimitive as se, dispatch as M, selects as ce } from "@ui-sdk/core";
14
+ import { Fragment as le, jsx as N, jsxs as P } from "react/jsx-runtime";
15
+ import { ArrowDown as ue, ArrowUp as de, ArrowUpDown as fe, ChevronLeft as pe, ChevronRight as F, CircleDashed as me, ListFilter as I, Search as he, Settings2 as ge, X as L } from "lucide-react";
16
+ import { useShortcut as R } from "@ui-sdk/react/shortcuts";
17
+ import { Toolbar as _e, ToolbarButton as z, ToolbarGroup as ve, ToolbarInput as B } from "@ui-sdk/react/toolbar";
18
+ import { createColumnHelper as ye, tableFeatures as be, useTable as xe } from "@tanstack/react-table";
19
+ import { Timeline as Se, TimelineDescription as Ce, TimelineItem as we, TimelineMarker as Te, TimelineTime as V, TimelineTitle as Ee } from "@ui-sdk/react/timeline";
20
+ // packages/collections/src/control-toolbar.tsx
21
+ var H = x(!1);
22
+ function U(e) {
23
+ return S(H) ? /* @__PURE__ */ N(ve, { ...e }) : /* @__PURE__ */ N(H, {
24
+ value: !0,
25
+ children: /* @__PURE__ */ N(_e, { ...e })
26
+ });
27
+ }
28
+ function De(e) {
29
+ return S(H) ? /* @__PURE__ */ N(z, { render: e }) : e;
30
+ }
20
31
  // packages/collections/src/collection-controls.tsx
21
- var ge = {
32
+ var W = {
22
33
  toolbar: {
23
34
  kOIVth: "x1hnptsi",
24
35
  kMwMTN: "xbixft",
@@ -33,35 +44,40 @@ var ge = {
33
44
  $$css: !0
34
45
  }
35
46
  };
36
- function I({ label: e, children: t, actions: n }) {
37
- let r = y.toArray(t).length > 0, i = y.toArray(n).length > 0;
38
- return !r && !i ? null : /* @__PURE__ */ k("div", {
39
- role: "group",
47
+ function G({ label: e, children: t, actions: n }) {
48
+ let r = b.toArray(t).length > 0, i = b.toArray(n).length > 0;
49
+ return !r && !i ? null : /* @__PURE__ */ P(U, {
40
50
  "aria-label": e,
41
- ...h.props(s.row, s.blockEnd, ge.toolbar),
42
- children: [t, i && /* @__PURE__ */ O("div", {
51
+ ...m.props(a.row, a.blockEnd, W.toolbar),
52
+ children: [t, i && /* @__PURE__ */ N("div", {
43
53
  className: "x78zum5 x6s0dn4 x1a02dak x1hnptsi xeuugli xvc5jky",
44
54
  children: n
45
55
  })]
46
56
  });
47
57
  }
48
- function L({ filters: t, onRemove: n, label: r = "Applied filters" }) {
49
- return t.length === 0 ? null : /* @__PURE__ */ O("div", {
50
- role: "group",
58
+ function K({ filters: t, onRemove: n, label: r = "Applied filters" }) {
59
+ return t.length === 0 ? null : /* @__PURE__ */ N(U, {
51
60
  "aria-label": r,
52
61
  className: "x78zum5 x6s0dn4 x1a02dak x1hnptsi xeuugli",
53
- children: t.map((t) => /* @__PURE__ */ k("span", {
62
+ children: t.map((t) => /* @__PURE__ */ P("span", {
54
63
  className: "x1n2onr6 x9f619 x3nfvp2 x6s0dn4 xunmzkg x1f9pz31 x992rv9 xyibt8p x1ok0vyi xeuugli x193iq5w xpvm0e4 xbixft x1hz01jw xtqrqnz x1778rvt x1s928wv x1j6awrg xarstr8 x5hscyn x86avzo x10z0kkz x1k48kgn x2q1x1w",
55
- children: [/* @__PURE__ */ O("span", {
64
+ children: [/* @__PURE__ */ N("span", {
56
65
  title: t.label,
57
66
  className: "xeuugli xb3r6kr xlyipyv xuxw1ft",
58
67
  children: t.label
59
- }), /* @__PURE__ */ O(e, {
60
- "aria-label": `Remove ${t.label}`,
61
- variant: "ghost",
62
- onClick: () => n(t.id),
63
- xstyle: ge.remove,
64
- children: /* @__PURE__ */ O(de, {
68
+ }), /* @__PURE__ */ N(z, {
69
+ render: /* @__PURE__ */ N(e, {
70
+ "aria-label": `Remove ${t.label}`,
71
+ variant: "ghost",
72
+ xstyle: W.remove
73
+ }),
74
+ onClick: (e) => {
75
+ M({ options: () => ({ onRemove: n }) }, "onRemove", t.id, {
76
+ reason: "remove-press",
77
+ event: e.nativeEvent
78
+ });
79
+ },
80
+ children: /* @__PURE__ */ N(L, {
65
81
  size: 14,
66
82
  "aria-hidden": "true"
67
83
  })
@@ -69,58 +85,59 @@ function L({ filters: t, onRemove: n, label: r = "Applied filters" }) {
69
85
  }, t.id))
70
86
  });
71
87
  }
72
- function R({ options: t, onChange: n, onReset: r, label: i = "Display options" }) {
73
- return /* @__PURE__ */ k(l.Root, { children: [/* @__PURE__ */ O(l.Trigger, {
74
- render: /* @__PURE__ */ O(e, {
75
- "aria-label": i,
76
- title: i
77
- }),
78
- children: /* @__PURE__ */ O(ue, {
88
+ function Oe({ options: n, onChange: r, onReset: i, label: a = "Display options" }) {
89
+ let o = De(/* @__PURE__ */ N(e, {
90
+ "aria-label": a,
91
+ title: a
92
+ }));
93
+ return /* @__PURE__ */ P(l.Root, { children: [/* @__PURE__ */ N(l.Trigger, {
94
+ render: o,
95
+ children: /* @__PURE__ */ N(ge, {
79
96
  size: 14,
80
97
  "aria-hidden": "true"
81
98
  })
82
- }), /* @__PURE__ */ k(l.Popup, {
99
+ }), /* @__PURE__ */ P(l.Popup, {
83
100
  align: "end",
84
- children: [/* @__PURE__ */ O(l.Title, { children: "Display" }), /* @__PURE__ */ k("div", {
101
+ children: [/* @__PURE__ */ N(l.Title, { children: "Display" }), /* @__PURE__ */ P("div", {
85
102
  className: "xrvj5dj x1n8ia3y xfb3i0g",
86
- children: [t.map((e) => /* @__PURE__ */ k("label", {
103
+ children: [n.map((e) => /* @__PURE__ */ P("label", {
87
104
  className: "x78zum5 x6s0dn4 x1hnptsi xbixft xtqrqnz x1hz01jw x1778rvt xeuugli xj0a0fe",
88
- children: [/* @__PURE__ */ O(o.Root, {
105
+ children: [/* @__PURE__ */ N(s.Root, {
89
106
  checked: e.isChecked,
90
- onCheckedChange: (t) => n(e.id, t),
107
+ onCheckedChange: (t) => r(e.id, t),
91
108
  disabled: e.isRequired === !0,
92
- children: /* @__PURE__ */ O(o.Indicator, {})
109
+ children: /* @__PURE__ */ N(s.Indicator, {})
93
110
  }), e.label]
94
- }, e.id)), r !== void 0 && /* @__PURE__ */ O(a, {
111
+ }, e.id)), i !== void 0 && /* @__PURE__ */ N(t, {
95
112
  type: "button",
96
113
  variant: "ghost",
97
- onClick: r,
114
+ onClick: i,
98
115
  children: "Reset defaults"
99
116
  })]
100
117
  })]
101
118
  })] });
102
119
  }
103
- function _e({ label: e, description: t, previous: r, next: i }) {
104
- return /* @__PURE__ */ k("nav", {
120
+ function ke({ label: e, description: r, previous: i, next: a }) {
121
+ return /* @__PURE__ */ P("nav", {
105
122
  "aria-label": e === void 0 ? "Pagination" : `${e} pagination`,
106
123
  className: "x78zum5 x6s0dn4 x1qughib x1a02dak xaml1ju xeuugli",
107
- children: [/* @__PURE__ */ O(n, { children: t }), /* @__PURE__ */ k("div", {
124
+ children: [/* @__PURE__ */ N(n, { children: r }), /* @__PURE__ */ P("div", {
108
125
  className: "x78zum5 x6s0dn4 x1a02dak x1hnptsi xeuugli xvc5jky",
109
- children: [/* @__PURE__ */ k(a, {
126
+ children: [/* @__PURE__ */ P(t, {
110
127
  variant: "outline",
111
128
  "aria-label": e === void 0 ? void 0 : `Previous page of ${e}`,
112
- disabled: r.disabled,
113
- onClick: r.onClick,
114
- children: [/* @__PURE__ */ O(A, {
129
+ disabled: i.disabled,
130
+ onClick: i.onClick,
131
+ children: [/* @__PURE__ */ N(pe, {
115
132
  size: 16,
116
133
  "aria-hidden": "true"
117
134
  }), "Previous"]
118
- }), /* @__PURE__ */ k(a, {
135
+ }), /* @__PURE__ */ P(t, {
119
136
  variant: "outline",
120
137
  "aria-label": e === void 0 ? void 0 : `Next page of ${e}`,
121
- disabled: i.disabled,
122
- onClick: i.onClick,
123
- children: ["Next", /* @__PURE__ */ O(j, {
138
+ disabled: a.disabled,
139
+ onClick: a.onClick,
140
+ children: ["Next", /* @__PURE__ */ N(F, {
124
141
  size: 16,
125
142
  "aria-hidden": "true"
126
143
  })]
@@ -128,154 +145,1226 @@ function _e({ label: e, description: t, previous: r, next: i }) {
128
145
  })]
129
146
  });
130
147
  }
131
- // packages/collections/src/table-query.tsx
132
- var z = b(void 0);
133
- function B(e) {
134
- if (e.reason.trim().length === 0) throw Error("A table query exception requires a reason.");
135
- }
136
- function V({ search: e, filters: t, children: n, isFiltered: r = !1 }) {
137
- return e === void 0 ? /* @__PURE__ */ O(z, {
138
- value: void 0,
139
- children: n
140
- }) : (e !== !0 && B(e), t !== !0 && B(t), /* @__PURE__ */ O(z, {
141
- value: r,
142
- children: n
143
- }));
144
- }
145
- function H(e) {
146
- if ("reason" in e) B(e);
147
- else {
148
- if (e.length === 0) throw Error("Supply filter dimensions or explain why the table has none.");
149
- if (new Set(e.map((e) => e.id)).size !== e.length) throw Error("Each table filter must have a unique ID.");
150
- }
151
- }
152
- var U = [];
153
- function W(e, t) {
154
- let [n, r] = T(""), [i, a] = T(/* @__PURE__ */ new Map()), o = typeof t.search == "function" ? t.search : void 0;
155
- typeof t.search != "function" && B(t.search), H(t.filters);
156
- let s = "reason" in t.filters ? U : t.filters, c = o === void 0 ? void 0 : {
157
- value: n,
158
- onChange: r
159
- }, l = n.trim().toLowerCase(), u = ie(() => s.map((t) => {
160
- let n = new Set(e.map(t.value)), r = i.get(t.id);
161
- r !== void 0 && n.add(r);
162
- let o = Array.from(n, (e) => ({
163
- value: `value:${e}`,
164
- label: t.formatLabel?.(e) ?? (e === "" ? "Unspecified" : e)
165
- }));
166
- return {
167
- id: t.id,
168
- label: t.label,
169
- options: [{
170
- value: "",
171
- label: "All"
172
- }, ...o],
173
- defaultValue: "",
174
- value: r === void 0 ? "" : `value:${r}`,
175
- onChange(e) {
176
- a((n) => {
177
- let r = new Map(n);
178
- return e === "" ? r.delete(t.id) : r.set(t.id, e.slice(6)), r;
179
- });
180
- }
181
- };
182
- }), [
183
- s,
184
- i,
185
- e
186
- ]), d = l !== "" && o !== void 0, f = u.some((e) => e.value !== e.defaultValue);
187
- return {
188
- rows: d || f ? e.filter((e) => d && !o(e).toLowerCase().includes(l) ? !1 : s.every((t) => !i.has(t.id) || t.value(e) === i.get(t.id))) : e,
189
- search: c,
190
- filters: u,
191
- isFiltered: d || f
192
- };
193
- }
194
- function G() {
195
- let e = x(z);
196
- if (e === void 0) throw Error("A frame-owned table requires its enclosing collection to supply TableQueryFrame.");
197
- return e;
198
- }
199
- function ve(e) {
200
- "reason" in e.search && B(e.search), H(e.filters);
201
- let t = "reason" in e.search ? void 0 : e.search, n = "reason" in e.filters ? [] : e.filters;
202
- return {
203
- search: t,
204
- filters: n,
205
- isFiltered: !!t?.value.trim() || n.some((e) => e.value !== e.defaultValue)
206
- };
207
- }
208
- // packages/collections/src/table-results.tsx
209
- function K({ status: e, sort: t, pagination: n, isPlaceholder: r }) {
210
- return {
211
- status: e,
212
- pending: e === "pending",
213
- sort: t ?? null,
214
- page: n?.description ?? null,
215
- hasPreviousPage: n !== void 0 && !n.previous.disabled,
216
- hasNextPage: n !== void 0 && !n.next.disabled,
217
- isPlaceholder: r
218
- };
219
- }
220
- var q = "[hidden], [inert], [aria-hidden=\"true\"], [data-agent-hidden], [data-agent-secret]";
221
- function ye(e) {
222
- let t = e?.closest("table")?.tBodies[0];
223
- return t === void 0 || t.closest(q) !== null ? [] : Array.from(t.rows).flatMap((e) => {
224
- let t = e.dataset.rowId, n = Array.from(e.cells).find((e) => e.dataset.recordLabel !== void 0);
225
- if (t === void 0 || n === void 0 || n.closest(q) !== null || !n.checkVisibility({ visibilityProperty: !0 }) || n.querySelector("[data-agent-secret], [data-agent-hidden]") !== null) return [];
226
- let r = n.querySelector("[data-row-action][aria-label]") ?? n.querySelector("[data-record-text]");
227
- if (r !== null && (r.closest(q) !== null || !r.checkVisibility({ visibilityProperty: !0 }))) return [];
228
- let i = r?.getAttribute("aria-label") ?? r?.textContent.trim();
229
- return [{
230
- value: t,
231
- label: i === void 0 || i.length === 0 ? t : i
232
- }];
233
- });
234
- }
235
- var be = N({
236
- name: "collection-results",
237
- options: {
238
- status: "string",
239
- sort: "value",
240
- pagination: "value",
241
- captionElement: "value",
242
- isPlaceholder: "boolean"
148
+ // packages/collections/src/data-table-styles.ts
149
+ var Ae = {
150
+ kmVPX3: "x1717udv",
151
+ kMzoRj: "xc342km",
152
+ $$css: !0
153
+ }, je = {
154
+ kVAEAm: "x10l6tqk",
155
+ k87sOh: "x13vifvy",
156
+ kLqNvP: "x1o0tod",
157
+ kzqmXN: "x1i1rx1s",
158
+ k33iCy: "xlshs6z",
159
+ kfzvcC: "x47corl",
160
+ $$css: !0
161
+ }, q = {
162
+ frame: {
163
+ k7Eaqz: "xeuugli",
164
+ kMv6JI: "x1hz01jw",
165
+ kGuDYH: "xtqrqnz",
166
+ kLWn49: "x1778rvt",
167
+ k63SB2: "xj57cvi",
168
+ kMwMTN: "xbixft",
169
+ khiITx: "xvmahel",
170
+ $$css: !0
243
171
  },
244
- state: K,
245
- sync: K,
246
- controlled: [
247
- "status",
248
- "sort",
249
- "page",
250
- "hasPreviousPage",
251
- "hasNextPage"
252
- ],
253
- api: ({ options: e }) => ({ records: () => ye(e().captionElement.current) }),
254
- agent: {
255
- actions: [],
256
- items: (e) => e.records(),
257
- shown: (e) => !e.isPlaceholder
172
+ content: { $$css: !0 },
173
+ placeholder: {
174
+ kfzvcC: "x47corl",
175
+ $$css: !0
258
176
  },
259
- slots: (e) => ({ root: e({}) })
260
- }), xe = _(be, { root: "caption" }).Root;
261
- function Se({ recordId: e, collection: t }) {
177
+ fillFrame: {
178
+ k1xSpc: "x78zum5",
179
+ kXwgrk: "xdt5ytf",
180
+ kUk6DE: "x98rzlu",
181
+ kAzted: "x2lwn1j",
182
+ $$css: !0
183
+ },
184
+ viewport: {
185
+ kVAEAm: "x1n2onr6",
186
+ k7Eaqz: "xeuugli",
187
+ k9g6sI: "x12h1iku",
188
+ kVQacm: "xysyzu8",
189
+ kacamN: "xy5w88m",
190
+ k3XXqK: "x1t137rt",
191
+ kPJHz1: "x13qnu6",
192
+ k7shQP: "x9v5kkp",
193
+ kZs9gx: "x19rmrnh",
194
+ kiEn40: "x1bqaal",
195
+ $$css: !0
196
+ },
197
+ fillViewport: {
198
+ kUk6DE: "x98rzlu",
199
+ kAzted: "x2lwn1j",
200
+ $$css: !0
201
+ },
202
+ virtual: (e) => [{
203
+ kskxy: e == null ? e : "x1jols5v",
204
+ $$css: !0
205
+ }, { "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }],
206
+ table: {
207
+ kzqmXN: "xh8yej3",
208
+ kLvRdT: "x1mwwwfo",
209
+ kcqcaj: "xss6m8b",
210
+ k9WMMc: "xdpxx8g",
211
+ kMwMTN: "xbixft",
212
+ kWkggS: "xpvm0e4",
213
+ $$css: !0
214
+ },
215
+ fixed: {
216
+ kPzzVL: "x140o2bo",
217
+ $$css: !0
218
+ },
219
+ minimumWidth: (e, t) => [{
220
+ k7Eaqz: (e == null ? e : "x7w7ha4 ") + (t == null ? t : "x18ie477"),
221
+ $$css: !0
222
+ }, {
223
+ "--x-1utbgw4": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
224
+ "--x-1wqfzdf": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
225
+ }],
226
+ caption: {
227
+ k9WMMc: "xdpxx8g",
228
+ kmVPX3: "xg7ukam",
229
+ kMwMTN: "x153jb6y",
230
+ kGuDYH: "xy8obcc",
231
+ kLWn49: "xas2l8k",
232
+ $$css: !0
233
+ },
234
+ header: {
235
+ kB7OPa: "x9f619",
236
+ kVAEAm: "x7wzq59",
237
+ k87sOh: "x13vifvy",
238
+ kY2c9j: "x11ru5tl",
239
+ kZKoxP: "x1krvmzm",
240
+ k8WAf4: "xt970qd",
241
+ kg3NbH: "x1dc62k6",
242
+ kt9PQ7: "xso031l",
243
+ kfdmCh: "x1q0q8m5",
244
+ kL6WhQ: "x1qndepd",
245
+ kMwMTN: "x153jb6y",
246
+ kWkggS: "xpvm0e4",
247
+ k63SB2: "xj57cvi",
248
+ kGuDYH: "xy8obcc",
249
+ kLWn49: "xas2l8k",
250
+ khDVqt: "xuxw1ft",
251
+ $$css: !0
252
+ },
253
+ headerLabel: {
254
+ k1xSpc: "x1lliihq",
255
+ k7Eaqz: "xeuugli",
256
+ kVQacm: "xb3r6kr",
257
+ kg5iWk: "xlyipyv",
258
+ khDVqt: "xuxw1ft",
259
+ $$css: !0
260
+ },
261
+ sort: {
262
+ k1xSpc: "x3nfvp2",
263
+ kGNEyG: "x6s0dn4",
264
+ kOIVth: "x1hnptsi",
265
+ ks0D6T: "x193iq5w",
266
+ k7Eaqz: "xeuugli",
267
+ kAzted: "x2zujid x17oiadl",
268
+ kmVPX3: "x1717udv",
269
+ kMzoRj: "xc342km",
270
+ kMwMTN: "x1heor9g",
271
+ kWkggS: "xjbqb8w",
272
+ kMv6JI: "xjb2p0i",
273
+ kGuDYH: "x1qlqyl8",
274
+ k63SB2: "x1pd3egz",
275
+ kLWn49: "x15bjb6t",
276
+ kkrTdU: "x1ypdohk",
277
+ kDPRdz: "xp9636p",
278
+ kSReZ0: "x1s9zmfe",
279
+ kPJHz1: "x13qnu6",
280
+ k7shQP: "x9v5kkp",
281
+ kZs9gx: "x19rmrnh",
282
+ kiEn40: "x7s97pk",
283
+ $$css: !0
284
+ },
285
+ sortIcon: {
286
+ kmuXW: "x2lah0s",
287
+ $$css: !0
288
+ },
289
+ row: {
290
+ kVAEAm: "x1n2onr6",
291
+ kHBbk8: "xc8icb0",
292
+ kZKoxP: "x1wtzb06",
293
+ kt9PQ7: "xso031l",
294
+ kfdmCh: "x1q0q8m5",
295
+ kL6WhQ: "x1qndepd",
296
+ ko0ZBZ: "x19k386i",
297
+ kx8K5S: "x1t1lzn6",
298
+ $$css: !0
299
+ },
300
+ selected: {
301
+ kWkggS: "x1r8u7ye",
302
+ $$css: !0
303
+ },
304
+ actionable: {
305
+ kkrTdU: "x1ypdohk",
306
+ kSReZ0: "x1ecmtor",
307
+ $$css: !0
308
+ },
309
+ trigger: {
310
+ kO7zv1: "x1rh3ycu",
311
+ kfSwDN: "x1hx0egp",
312
+ k1xSpc: "x78zum5",
313
+ kGNEyG: "x6s0dn4",
314
+ kzqmXN: "xh8yej3",
315
+ k7Eaqz: "xeuugli",
316
+ kAzted: "x17tes2r x17oiadl",
317
+ kmVPX3: "x1717udv",
318
+ kMzoRj: "xc342km",
319
+ kaIpWk: "x1ok0vyi",
320
+ kMwMTN: "x1heor9g",
321
+ kWkggS: "xjbqb8w",
322
+ kMv6JI: "xjb2p0i",
323
+ kGuDYH: "x1qlqyl8",
324
+ k63SB2: "x1pd3egz",
325
+ kLWn49: "x15bjb6t",
326
+ k9WMMc: "x16tdsg8",
327
+ kybGjl: "x1hl2dhg",
328
+ kkrTdU: "x1ypdohk",
329
+ k3XXqK: "x1t137rt",
330
+ k5JduY: "x1s928wv",
331
+ kwXMNM: "x1j6awrg",
332
+ kv0HGH: "xarstr8",
333
+ kIHVmn: "x11q50lq",
334
+ kEbOEz: "xa2q2qx",
335
+ kQSxdi: "x1x5eltu",
336
+ kUivIt: "x1jdy9wv",
337
+ kYPGJ8: "xtgyt42",
338
+ kWC4TW: "x19mxcj1",
339
+ $$css: !0
340
+ },
341
+ cell: {
342
+ kB7OPa: "x9f619",
343
+ k8WAf4: "xt970qd",
344
+ kg3NbH: "x1dc62k6",
345
+ kXLuUW: "xxymvpz",
346
+ kHjlTd: "xj0a0fe",
347
+ $$css: !0
348
+ },
349
+ start: {
350
+ k9WMMc: "x1yc453h",
351
+ $$css: !0
352
+ },
353
+ end: {
354
+ k9WMMc: "xp4054r",
355
+ $$css: !0
356
+ },
357
+ width: (e) => [{
358
+ kzqmXN: e == null ? e : "x5lhr3w",
359
+ k7Eaqz: e == null ? e : "xkj4a21",
360
+ $$css: !0
361
+ }, {
362
+ "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
363
+ "--x-minWidth": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e)
364
+ }],
365
+ secondary: {
366
+ k1xSpc: "xqxxu6g",
367
+ $$css: !0
368
+ },
369
+ truncated: {
370
+ kVQacm: "xb3r6kr",
371
+ khDVqt: "xuxw1ft",
372
+ kg5iWk: "xlyipyv",
373
+ $$css: !0
374
+ },
375
+ cellContent: {
376
+ k1xSpc: "x1lliihq",
377
+ k7Eaqz: "xeuugli",
378
+ kzqmXN: "xh8yej3",
379
+ ks0D6T: "x193iq5w",
380
+ k8hWNX: "xkfz77",
381
+ kDUsi3: "x1ljc890",
382
+ $$css: !0
383
+ },
384
+ rowControl: {
385
+ kVAEAm: "x1n2onr6",
386
+ kY2c9j: "x1vjfegm",
387
+ $$css: !0
388
+ },
389
+ text: {
390
+ k1xSpc: "x1lliihq",
391
+ k7Eaqz: "xeuugli",
392
+ kzqmXN: "xh8yej3",
393
+ $$css: !0
394
+ },
395
+ textColumn: {
396
+ kUk6DE: "x98rzlu",
397
+ k7Eaqz: "xeuugli",
398
+ $$css: !0
399
+ },
400
+ textRow: {
401
+ k1xSpc: "x78zum5",
402
+ kGNEyG: "x6s0dn4",
403
+ kOIVth: "x1n8ia3y",
404
+ k7Eaqz: "xeuugli",
405
+ kzqmXN: "xh8yej3",
406
+ kMv6JI: "x1hz01jw",
407
+ kGuDYH: "xtqrqnz",
408
+ kLWn49: "x1778rvt",
409
+ k63SB2: "xj57cvi",
410
+ $$css: !0
411
+ },
412
+ primaryRow: {
413
+ k1xSpc: "x78zum5",
414
+ kGNEyG: "x6s0dn4",
415
+ kOIVth: "x1hnptsi",
416
+ k7Eaqz: "xeuugli",
417
+ $$css: !0
418
+ },
419
+ primaryText: {
420
+ kzqmXN: "x14atkfc",
421
+ kmuXW: "xs83m0k",
422
+ $$css: !0
423
+ },
424
+ adornment: {
425
+ k1xSpc: "x3nfvp2",
426
+ kGNEyG: "x6s0dn4",
427
+ kmuXW: "x2lah0s",
428
+ $$css: !0
429
+ },
430
+ secondaryText: {
431
+ kMwMTN: "x153jb6y",
432
+ kGuDYH: "xy8obcc",
433
+ kLWn49: "xas2l8k",
434
+ $$css: !0
435
+ },
436
+ cellViewport: {
437
+ k1xSpc: "x78zum5",
438
+ kGNEyG: "x6s0dn4",
439
+ k7Eaqz: "xeuugli",
440
+ kzqmXN: "xh8yej3",
441
+ kZKoxP: "xw3im37",
442
+ $$css: !0
443
+ },
444
+ fixedContent: {
445
+ kskxy: "x1l6neo7",
446
+ $$css: !0
447
+ },
448
+ readable: {
449
+ khDVqt: "xuxw1ft",
450
+ $$css: !0
451
+ },
452
+ contentCell: {
453
+ k8WAf4: "xn9t2bk",
454
+ $$css: !0
455
+ },
456
+ contentViewport: {
457
+ kZKoxP: "xt7dq6l",
458
+ $$css: !0
459
+ },
460
+ selection: {
461
+ kzqmXN: "x1d7z9mz",
462
+ k7Eaqz: "xeuugli",
463
+ kg3NbH: "x1dc62k6",
464
+ $$css: !0
465
+ },
466
+ spacer: (e) => [
467
+ Ae,
468
+ {
469
+ kZKoxP: e == null ? e : "x16ye13r",
470
+ $$css: !0
471
+ },
472
+ { "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
473
+ ],
474
+ sizer: (e) => [
475
+ je,
476
+ {
477
+ kZKoxP: e == null ? e : "x16ye13r",
478
+ $$css: !0
479
+ },
480
+ { "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
481
+ ],
482
+ emptyCell: {
483
+ kmVPX3: "x1717udv",
484
+ $$css: !0
485
+ },
486
+ empty: {
487
+ kB7OPa: "x9f619",
488
+ kVAEAm: "x7wzq59",
489
+ kLqNvP: "x1o0tod",
490
+ kzqmXN: "xzfn7dr",
491
+ ks0D6T: "x193iq5w",
492
+ kmVPX3: "x1ttojsm",
493
+ k9WMMc: "x2b8uid",
494
+ khDVqt: "xeaf4i8",
495
+ kHjlTd: "xj0a0fe",
496
+ kMwMTN: "x153jb6y",
497
+ $$css: !0
498
+ },
499
+ footer: {
500
+ kmVPX3: "xg7ukam",
501
+ kEafiO: "x178xt8z",
502
+ kPef9Z: "x13fuv20",
503
+ kLZC3w: "xhjagg4",
504
+ $$css: !0
505
+ },
506
+ endContent: {
507
+ kAzted: "xid9utz",
508
+ kmVPX3: "xg7ukam",
509
+ kMwMTN: "x153jb6y",
510
+ kGuDYH: "xy8obcc",
511
+ kLWn49: "xas2l8k",
512
+ kefpsp: "x15x95ik",
513
+ kyjxKa: "x1az1eml",
514
+ $$css: !0
515
+ }
516
+ };
517
+ // packages/collections/src/data-table-text.tsx
518
+ function Me({ children: e, leading: t, isDecorative: n = !1 }) {
519
+ let r = b.toArray(t).length > 0;
520
+ return /* @__PURE__ */ P("span", {
521
+ "aria-hidden": n || void 0,
522
+ inert: n || void 0,
523
+ ...m.props(q.textRow),
524
+ children: [r && /* @__PURE__ */ N("span", {
525
+ "aria-hidden": !0,
526
+ ...m.props(q.adornment),
527
+ children: t
528
+ }), /* @__PURE__ */ N("span", {
529
+ ...m.props(q.textColumn),
530
+ children: e
531
+ })]
532
+ });
533
+ }
534
+ function Ne({ children: e, secondary: t, leading: n, trailing: r }) {
535
+ let i = b.toArray(r).length > 0;
536
+ return /* @__PURE__ */ P(Me, {
537
+ leading: n,
538
+ children: [/* @__PURE__ */ P("span", {
539
+ ...m.props(q.primaryRow),
540
+ children: [/* @__PURE__ */ N("span", {
541
+ "data-record-text": !0,
542
+ title: e,
543
+ ...m.props(q.text, q.primaryText, q.truncated),
544
+ children: e
545
+ }), i && /* @__PURE__ */ N("span", {
546
+ ...m.props(q.adornment),
547
+ children: r
548
+ })]
549
+ }), t !== void 0 && /* @__PURE__ */ N("span", {
550
+ title: t,
551
+ ...m.props(q.text, q.truncated, q.secondaryText),
552
+ children: t
553
+ })]
554
+ });
555
+ }
556
+ function Pe({ leading: e, isSecondary: t = !1 }) {
557
+ return /* @__PURE__ */ P(Me, {
558
+ leading: e,
559
+ isDecorative: !0,
560
+ children: [/* @__PURE__ */ N("span", {
561
+ ...m.props(q.text),
562
+ children: /* @__PURE__ */ N(d, { width: "70%" })
563
+ }), t && /* @__PURE__ */ N("span", {
564
+ ...m.props(q.text, q.secondaryText),
565
+ children: /* @__PURE__ */ N(d, { width: "45%" })
566
+ })]
567
+ });
568
+ }
569
+ // packages/collections/src/data-table-layout.tsx
570
+ var Fe = ee.compactTable.slice(7), Ie = /* @__PURE__ */ new Set(["string", "number"]), J = {
571
+ primary: {
572
+ minimumWidth: 240,
573
+ isFlexible: !0,
574
+ shouldTruncate: !0
575
+ },
576
+ text: {
577
+ minimumWidth: 160,
578
+ isFlexible: !1,
579
+ shouldTruncate: !0
580
+ },
581
+ status: {
582
+ minimumWidth: 160,
583
+ isFlexible: !1,
584
+ shouldTruncate: !1
585
+ },
586
+ number: {
587
+ minimumWidth: 112,
588
+ isFlexible: !1,
589
+ shouldTruncate: !1
590
+ },
591
+ timestamp: {
592
+ minimumWidth: 160,
593
+ isFlexible: !1,
594
+ shouldTruncate: !1
595
+ },
596
+ actions: {
597
+ minimumWidth: 112,
598
+ isFlexible: !1,
599
+ shouldTruncate: !1
600
+ }
601
+ }, Le = {
602
+ fixed: q.content,
603
+ content: q.contentCell
604
+ }, Re = {
605
+ primary: q.start,
606
+ text: q.start,
607
+ status: q.start,
608
+ number: q.end,
609
+ timestamp: q.end,
610
+ actions: q.end
611
+ }, ze = {
612
+ content: q.content,
613
+ fill: q.fillFrame
614
+ }, Be = {
615
+ content: q.content,
616
+ fill: q.fillViewport
617
+ };
618
+ function Ve(e) {
619
+ return e.map((e) => {
620
+ let t = J[e.role], n = e.width ?? (t.isFlexible ? void 0 : t.minimumWidth);
621
+ return {
622
+ ...e,
623
+ ...n === void 0 ? {} : { width: n }
624
+ };
625
+ });
626
+ }
627
+ function He(e, t = 0) {
628
+ return {
629
+ minimumWidth: e.reduce((e, t) => e + (t.width ?? J[t.role].minimumWidth), t),
630
+ compactWidth: e.filter((e) => e.isSecondary !== !0).reduce((e, t) => e + (t.width ?? J[t.role].minimumWidth), t)
631
+ };
632
+ }
633
+ function Ue(e) {
634
+ let t = globalThis.matchMedia(Fe);
635
+ return t.addEventListener("change", e), () => t.removeEventListener("change", e);
636
+ }
637
+ function We() {
638
+ return globalThis.matchMedia(Fe).matches;
639
+ }
640
+ function Ge({ columns: e, canSelect: t = !1 }) {
641
+ return /* @__PURE__ */ P("colgroup", { children: [t && /* @__PURE__ */ N("col", { ...m.props(q.selection) }), e.map((e) => /* @__PURE__ */ N("col", { ...m.props(e.width !== void 0 && q.width(e.width), e.isSecondary === !0 && q.secondary) }, e.id))] });
642
+ }
643
+ function Ke({ role: e, isFixed: t, shouldTruncate: n, children: r }) {
644
+ let i = J[e], a = t && i.shouldTruncate, o = typeof r == "string" && (n ?? a);
645
+ return /* @__PURE__ */ N("span", {
646
+ ...m.props(q.cellViewport, !t && q.contentViewport),
647
+ children: /* @__PURE__ */ N("span", {
648
+ "data-record-text": Ie.has(typeof r) || void 0,
649
+ title: typeof r == "string" ? r : void 0,
650
+ ...m.props(q.cellContent, t && q.fixedContent, t && !i.shouldTruncate && q.readable, o && q.truncated),
651
+ children: r
652
+ })
653
+ });
654
+ }
655
+ // packages/collections/src/table-results.tsx
656
+ function qe({ status: e, sort: t, selected: n, pagination: r, isPlaceholder: i }) {
657
+ return {
658
+ status: e,
659
+ pending: e === "pending",
660
+ sort: t,
661
+ selected: n === null ? [] : [...n],
662
+ page: r?.description ?? null,
663
+ hasPreviousPage: r !== void 0 && !r.previous.disabled,
664
+ hasNextPage: r !== void 0 && !r.next.disabled,
665
+ isPlaceholder: i
666
+ };
667
+ }
668
+ var Y = "[hidden], [inert], [aria-hidden=\"true\"], [data-agent-hidden], [data-agent-secret]";
669
+ function Je(e) {
670
+ let t = e instanceof HTMLTableElement ? e.tBodies[0] : void 0;
671
+ if (t !== void 0 && t.closest(Y) === null) return new Map(Array.from(t.rows).flatMap((e) => {
672
+ let t = e.dataset.rowId, n = Array.from(e.cells).find((e) => e.dataset.recordLabel !== void 0);
673
+ if (t === void 0 || n === void 0) return [];
674
+ if (n.closest(Y) !== null || n.querySelector("[data-agent-secret], [data-agent-hidden]") !== null || !n.checkVisibility({ visibilityProperty: !0 })) return [[t, null]];
675
+ let r = n.querySelector("[data-row-action][aria-label]") ?? n.querySelector("[data-record-text]");
676
+ if (r !== null && r.closest(Y) !== null || r?.checkVisibility({ visibilityProperty: !0 }) === !1) return [[t, null]];
677
+ let i = r?.getAttribute("aria-label") ?? r?.textContent.trim();
678
+ return [[t, i === void 0 || i.length === 0 ? t : i]];
679
+ }));
680
+ }
681
+ var Ye = {
682
+ none: "ascending",
683
+ ascending: "descending",
684
+ descending: "none"
685
+ }, Xe = /* @__PURE__ */ new Set(["ascending", "descending"]), Ze = /* @__PURE__ */ new Set(["Home", "End"]), Qe = se({
686
+ name: "collection-results",
687
+ options: {
688
+ status: "string",
689
+ sort: "value",
690
+ onSortChange: "callback",
691
+ sortable: "list",
692
+ selected: "value",
693
+ onSelectedChange: "callback",
694
+ pagination: "value",
695
+ rowIds: "list",
696
+ rowLabel: "callback",
697
+ isActionable: "boolean",
698
+ reveal: "callback",
699
+ onOpen: "callback",
700
+ isPlaceholder: "boolean"
701
+ },
702
+ state: (e) => ({
703
+ ...qe(e),
704
+ active: null
705
+ }),
706
+ sync: qe,
707
+ controlled: [
708
+ "status",
709
+ "sort",
710
+ "selected",
711
+ "page",
712
+ "hasPreviousPage",
713
+ "hasNextPage"
714
+ ],
715
+ api: (e) => {
716
+ let t = A(e), n = ae(e, {
717
+ key: "active",
718
+ rows: () => e.options().rowIds.length,
719
+ cols: () => 1,
720
+ disabled: () => !e.options().isActionable,
721
+ reveal: (t) => e.options().reveal(t.row)
722
+ }), r = { rowIds: e.options().rowIds };
723
+ e.onOptions((t) => {
724
+ let i = n.active(), a = i === null ? void 0 : r.rowIds[i.row];
725
+ if (r.rowIds = t.rowIds, i === null || t.rowIds[i.row] === a) return;
726
+ let o = a === void 0 ? -1 : t.rowIds.indexOf(a);
727
+ e.store.set({ active: o === -1 ? null : {
728
+ row: o,
729
+ col: 0
730
+ } });
731
+ });
732
+ let i = j(e, {
733
+ key: "selected",
734
+ set: (e, n) => t("selected", e, n),
735
+ order: () => e.options().rowIds,
736
+ multiple: () => !0
737
+ });
738
+ function a() {
739
+ if (e.options().selected === null) throw Error("This table has no row selection.");
740
+ }
741
+ function o(t) {
742
+ let { sortable: n } = e.options(), r = n.find((e) => e.id === t || e.label === t);
743
+ if (r === void 0) {
744
+ let e = n.map((e) => e.label).join(", ");
745
+ throw Error(e.length === 0 ? "This table has no sortable column." : `Sort by one of: ${e}.`);
746
+ }
747
+ return r.id;
748
+ }
749
+ function s(t) {
750
+ let n = e.options().pagination?.[t];
751
+ if (n === void 0 || n.disabled) throw Error(`There is no ${t} page.`);
752
+ return n.onClick(), !0;
753
+ }
754
+ return {
755
+ grid: n,
756
+ rowKeydown(t) {
757
+ t.shiftKey || (t.metaKey || t.ctrlKey || !Ze.has(t.key) ? n.keydown(t) : (t.preventDefault(), n.focus({
758
+ row: t.key === "Home" ? 0 : e.options().rowIds.length - 1,
759
+ col: 0
760
+ }, {
761
+ reason: "list-navigation",
762
+ event: t
763
+ })));
764
+ },
765
+ focusRow: (e) => n.focus({
766
+ row: e,
767
+ col: 0
768
+ }),
769
+ toggleSort(n, r) {
770
+ let { sort: i } = e.options(), a = Ye[i?.columnId === n ? i.direction : "none"];
771
+ return t("sort", a === "none" ? null : {
772
+ columnId: n,
773
+ direction: a
774
+ }, {
775
+ reason: "trigger-press",
776
+ event: r
777
+ });
778
+ },
779
+ toggleRow(e, t) {
780
+ let n = t === void 0 ? { reason: "item-press" } : {
781
+ reason: "item-press",
782
+ event: t
783
+ };
784
+ t instanceof MouseEvent && t.shiftKey ? i.extend(e, n) : i.toggle(e, n);
785
+ },
786
+ toggleAll(e) {
787
+ i.toggleAll(e === void 0 ? { reason: "item-press" } : {
788
+ reason: "item-press",
789
+ event: e
790
+ });
791
+ },
792
+ sort(e, n = "ascending") {
793
+ if (n === "none") return t("sort", null, { reason: "imperative" });
794
+ if (!Xe.has(n)) throw Error("The direction is ascending, descending or none.");
795
+ return t("sort", {
796
+ columnId: o(e),
797
+ direction: n === "descending" ? "descending" : "ascending"
798
+ }, { reason: "imperative" });
799
+ },
800
+ select(n) {
801
+ a();
802
+ let { rowIds: r } = e.options(), i = (Array.isArray(n) ? n : [n]).map(String), o = i.find((e) => !r.includes(e));
803
+ if (o !== void 0) throw Error(`No row "${o}" is in this table.`);
804
+ return t("selected", i, { reason: "imperative" });
805
+ },
806
+ open(t) {
807
+ let n = e.options().rowIds.indexOf(String(t));
808
+ if (n === -1 || !e.options().isActionable) throw Error(n === -1 ? `No row "${String(t)}" is in this table.` : "The rows have no action now.");
809
+ return e.options().onOpen(n), !0;
810
+ },
811
+ previousPage: () => s("previous"),
812
+ nextPage: () => s("next"),
813
+ records() {
814
+ let t = Je(e.element("root")), { rowIds: n, rowLabel: r } = e.options();
815
+ if (t === void 0) return [];
816
+ let i = Array.from(t.values()).includes(null);
817
+ return n.flatMap((e, n) => {
818
+ let a = t.has(e) ? t.get(e) : r(n);
819
+ return !t.has(e) && i || a == null ? [] : [{
820
+ value: e,
821
+ label: a
822
+ }];
823
+ });
824
+ }
825
+ };
826
+ },
827
+ slots: (e) => ({
828
+ root: e({}),
829
+ trigger: e({
830
+ props: {
831
+ value: "string",
832
+ row: "number",
833
+ col: "number"
834
+ },
835
+ selects: ce({ active: k }),
836
+ attrs: (e, { props: t, api: n }) => ({ tabindex: n.grid.tabIndex(e, t) }),
837
+ on: {
838
+ keydown: (e, { api: t }) => t.rowKeydown(e),
839
+ focus: (e, { api: t, props: n }) => {
840
+ t.grid.focus(n, {
841
+ reason: "item-press",
842
+ event: e
843
+ });
844
+ }
845
+ },
846
+ bind: (e, { api: t, props: n }) => t.grid.bind(e, n)
847
+ })
848
+ }),
849
+ agent: {
850
+ actions: [
851
+ "sort",
852
+ "select",
853
+ "open",
854
+ "previousPage",
855
+ "nextPage"
856
+ ],
857
+ items: (e) => e.records(),
858
+ shown: (e) => !e.isPlaceholder
859
+ }
860
+ });
861
+ function $e(e, t) {
862
+ let n = y(Qe, e), r = v(n, "root", {}, t(n.api), "table");
863
+ return {
864
+ api: n.api,
865
+ element: r
866
+ };
867
+ }
868
+ var et = g(Qe, {
869
+ root: "table",
870
+ trigger: "a"
871
+ }).Trigger, tt = g(Qe, {
872
+ root: "table",
873
+ trigger: "button"
874
+ }).Trigger;
875
+ // packages/collections/src/data-table-trigger.tsx
876
+ function nt(e) {
877
+ if (e.defaultPrevented || e.button !== 0) return !1;
878
+ let t = e.metaKey || e.ctrlKey, n = e.altKey || e.shiftKey;
879
+ return t || n ? !1 : e.detail === 0 || e.currentTarget.ownerDocument.getSelection()?.isCollapsed !== !1;
880
+ }
881
+ function rt({ index: e, recordId: t, row: n, action: r, isActive: i, children: a }) {
882
+ let o = r.label?.(n), s = r.href === void 0 ? /* @__PURE__ */ N(tt, {
883
+ value: t,
884
+ row: e,
885
+ col: 0,
886
+ type: "button",
887
+ disabled: r.disabled === !0,
888
+ "aria-label": o,
889
+ "aria-pressed": i,
890
+ "data-row-action": !0,
891
+ onClick: (e) => {
892
+ nt(e) && r.onActivate(n);
893
+ },
894
+ ...m.props(q.trigger),
895
+ children: a
896
+ }) : /* @__PURE__ */ N(et, {
897
+ value: t,
898
+ row: e,
899
+ col: 0,
900
+ "aria-label": o,
901
+ href: r.href(n),
902
+ "data-row-action": !0,
903
+ onClick: (e) => {
904
+ r.onActivate !== void 0 && nt(e) && (e.preventDefault(), r.onActivate(n));
905
+ },
906
+ ...m.props(q.trigger),
907
+ children: a
908
+ });
909
+ return o === void 0 ? s : /* @__PURE__ */ P(u.Root, { children: [/* @__PURE__ */ N(u.Trigger, { render: s }), /* @__PURE__ */ N(u.Popup, {
910
+ side: "top",
911
+ align: "start",
912
+ children: o
913
+ })] });
914
+ }
915
+ // packages/collections/src/use-end-reached.ts
916
+ function it({ end: e, viewport: t, onEndReached: n, content: r }) {
917
+ C(() => {
918
+ if (n === void 0 || e.current === null) return;
919
+ let r = new IntersectionObserver((e) => {
920
+ e.some((e) => e.isIntersecting) && n();
921
+ }, { root: t?.current ?? null });
922
+ return r.observe(e.current), () => r.disconnect();
923
+ }, [
924
+ e,
925
+ t,
926
+ n,
927
+ r
928
+ ]);
929
+ }
930
+ // packages/collections/src/use-table-window.ts
931
+ var at = [];
932
+ function ot(e) {
933
+ let t = D(e), [{ rows: n, subscribe: r, readItems: i, scrollToIndex: a }] = O(() => {
934
+ let e = oe({
935
+ count: () => t.current.count,
936
+ estimate: () => t.current.estimate,
937
+ key: (e) => t.current.keyOf(e),
938
+ overscan: 6,
939
+ keep: () => t.current.keep(),
940
+ onEnd: () => t.current.onEnd?.(),
941
+ endThreshold: 0,
942
+ get scrollMargin() {
943
+ return t.current.margin;
944
+ }
945
+ });
946
+ return {
947
+ rows: e,
948
+ subscribe: (t) => e.subscribe(t),
949
+ readItems: () => e.items(),
950
+ scrollToIndex: (t) => e.scrollToIndex(t)
951
+ };
952
+ }), [o] = O(() => /* @__PURE__ */ new Map()), { isEnabled: s, viewport: c } = e;
953
+ return T(() => {
954
+ t.current = e, n.refresh();
955
+ }), T(() => {
956
+ let e = c.current;
957
+ if (s && e !== null) return n.connect(e);
958
+ }, [
959
+ s,
960
+ n,
961
+ c
962
+ ]), {
963
+ items: ie(r, i, () => at),
964
+ size: n.size(),
965
+ scrollToIndex: a,
966
+ measure(e) {
967
+ let t = o.get(e);
968
+ if (t !== void 0) return t;
969
+ let r = (t) => n.measure(e, t);
970
+ return o.set(e, r), r;
971
+ }
972
+ };
973
+ }
974
+ // packages/collections/src/data-table-rows.tsx
975
+ var st = be({}), ct = {
976
+ ascending: de,
977
+ descending: ue,
978
+ none: fe
979
+ };
980
+ function lt(e, t) {
981
+ let n = D(void 0);
982
+ C(() => {
983
+ if (t === void 0) {
984
+ n.current = void 0;
985
+ return;
986
+ }
987
+ if (n.current !== void 0 && n.current.id === e) return;
988
+ let r = { isCurrent: !0 };
989
+ return queueMicrotask(() => {
990
+ r.isCurrent && (n.current = { id: e }, t(e));
991
+ }), () => {
992
+ r.isCurrent = !1;
993
+ };
994
+ }, [e, t]);
995
+ }
996
+ function X({ rows: e, columns: t, getRowId: n, caption: r, empty: i, sort: a, onSortChange: o, selectedIds: c, onSelectionChange: l, selectionLabel: u, rowAction: d, activeRowId: ee, focusRowId: p, onRowHighlightChange: g, hideCaption: _ = !1, hideHeaders: v = !1, rowSizing: y = "fixed", window: b, endContent: x, onEndReached: S, footer: w, pagination: k, resultStatus: A = "ready", isPlaceholder: ae = !1 }) {
997
+ let j = E(() => Ve(t), [t]), oe = ie(Ue, We, () => !1), se = E(() => {
998
+ let e = ye();
999
+ return e.columns(j.map((t) => e.display({
1000
+ id: t.id,
1001
+ header: t.label
1002
+ })));
1003
+ }, [j]), M = xe({
1004
+ features: st,
1005
+ columns: se,
1006
+ data: e,
1007
+ getRowId: n
1008
+ }), ce = ne(), ue = ce.viewport, de = D(null), fe = D(null), pe = D(null), [F, me] = O(0), [I, he] = O(), [ge, L] = O(), R = D(void 0), _e = D(void 0), z = E(() => e.map(n), [e, n]), ve = I === void 0 ? -1 : z.indexOf(I.id), B = I?.isWithin === !0 ? ve : -1, be = B === -1 ? void 0 : I?.id, Se = j.findIndex((e) => e.role === "primary" && e.isSecondary !== !0), Ce = Se === -1 ? j.findIndex((e) => e.isSecondary !== !0) : Se, we = typeof b?.height == "string" ? b.height : "content", Te = d !== void 0 && d.disabled !== !0;
1009
+ it({
1010
+ end: de,
1011
+ onEndReached: b === void 0 ? S : void 0,
1012
+ content: e.length
1013
+ }), C(() => {
1014
+ let e = fe.current, t = pe.current;
1015
+ if (b === void 0 || e === null || t === null) return;
1016
+ let n = new ResizeObserver(() => me(e.offsetHeight + t.offsetHeight));
1017
+ return n.observe(e), n.observe(t), () => n.disconnect();
1018
+ }, [
1019
+ b,
1020
+ _,
1021
+ v
1022
+ ]);
1023
+ let V = ot({
1024
+ isEnabled: b !== void 0,
1025
+ viewport: ue,
1026
+ count: e.length,
1027
+ keyOf: (e) => z[e] ?? String(e),
1028
+ estimate: y === "fixed" ? f.rowHeight : b?.estimatedRowHeight ?? f.rowHeight,
1029
+ margin: F,
1030
+ keep: () => [
1031
+ Math.max(0, ve),
1032
+ B - 1,
1033
+ B,
1034
+ B + 1
1035
+ ],
1036
+ onEnd: S
1037
+ });
1038
+ C(() => {
1039
+ b !== void 0 && e.length === 0 && S?.();
1040
+ }, [
1041
+ b,
1042
+ e.length,
1043
+ S
1044
+ ]);
1045
+ function Ee(e) {
1046
+ return ue.current?.querySelector(`[data-row-id="${CSS.escape(e)}"] [data-row-action]`) ?? null;
1047
+ }
1048
+ let H = E(() => o === void 0 ? [] : j.filter((e) => e.canSort === !0).map(({ id: e, label: t }) => ({
1049
+ id: e,
1050
+ label: t
1051
+ })), [j, o]), U = E(() => c === void 0 ? null : Array.from(c), [c]), De = {
1052
+ status: A,
1053
+ sort: a ?? null,
1054
+ onSortChange: o === void 0 ? void 0 : (e, t) => o(e ?? void 0, t),
1055
+ sortable: H,
1056
+ selected: U,
1057
+ onSelectedChange: l === void 0 ? void 0 : (e, t) => l(new Set(e), t),
1058
+ pagination: k,
1059
+ rowIds: z,
1060
+ rowLabel: (t) => {
1061
+ let n = e[t];
1062
+ return n === void 0 ? void 0 : d?.label?.(n) ?? u?.(n);
1063
+ },
1064
+ isActionable: Te,
1065
+ reveal: (e) => {
1066
+ b !== void 0 && V.scrollToIndex(e);
1067
+ },
1068
+ onOpen: (e) => {
1069
+ let t = z[e], n = t === void 0 ? null : Ee(t);
1070
+ n === null ? (_e.current = t, V.scrollToIndex(e)) : n.click();
1071
+ },
1072
+ isPlaceholder: ae
1073
+ };
1074
+ T(() => {
1075
+ let e = _e.current;
1076
+ e !== void 0 && (_e.current = void 0, Ee(e)?.click());
1077
+ });
1078
+ let W = b === void 0 ? M.getRowModel().rows.map((e, t) => ({
1079
+ row: e,
1080
+ index: t,
1081
+ spacerHeight: 0
1082
+ })) : V.items.flatMap((e, t, n) => {
1083
+ let r = M.getRowModel().rows[e.index], i = n[t - 1];
1084
+ if (r === void 0) return [];
1085
+ let a = i === void 0 ? 0 : i.start + i.size;
1086
+ return [{
1087
+ row: r,
1088
+ index: e.index,
1089
+ spacerHeight: e.start - a
1090
+ }];
1091
+ }), G = W.some(({ row: e }) => e.id === ge) ? ge : void 0;
1092
+ ge !== void 0 && G === void 0 && L(void 0), lt(G ?? be, g);
1093
+ let K = j.filter((e) => !oe || e.isSecondary !== !0).length + (c === void 0 ? 0 : 1), Oe = c === void 0 ? 0 : 76, Ae = w != null && typeof w != "boolean" || k !== void 0, { minimumWidth: je, compactWidth: Me } = He(j, Oe), Ne = V.items.at(-1), Pe = V.size - (Ne === void 0 ? 0 : Ne.start + Ne.size), Fe = c === void 0 ? 0 : z.filter((e) => c.has(e)).length, Ie = z.length > 0 && Fe === z.length, J = Fe > 0 && !Ie;
1094
+ function qe(t) {
1095
+ return /* @__PURE__ */ P(le, { children: [
1096
+ /* @__PURE__ */ N("caption", {
1097
+ ref: fe,
1098
+ "aria-label": r,
1099
+ ...m.props(q.caption, _ && te.hidden),
1100
+ children: r
1101
+ }),
1102
+ /* @__PURE__ */ N(Ge, {
1103
+ columns: j,
1104
+ canSelect: c !== void 0
1105
+ }),
1106
+ /* @__PURE__ */ N("thead", {
1107
+ ref: pe,
1108
+ ...m.props(v && te.hidden),
1109
+ children: /* @__PURE__ */ P("tr", { children: [c !== void 0 && /* @__PURE__ */ N("th", {
1110
+ scope: "col",
1111
+ "aria-label": "Select",
1112
+ ...m.props(q.header, q.selection, q.rowControl),
1113
+ children: /* @__PURE__ */ N(s.Root, {
1114
+ "aria-label": `Select every row of ${r}`,
1115
+ checked: Ie,
1116
+ indeterminate: J,
1117
+ disabled: z.length === 0,
1118
+ onCheckedChange: (e, n) => t.toggleAll(n.event),
1119
+ children: /* @__PURE__ */ N(s.Indicator, {})
1120
+ })
1121
+ }), j.map((e) => {
1122
+ let n = a?.columnId === e.id ? a.direction : void 0, i = ct[n ?? "none"];
1123
+ return /* @__PURE__ */ N("th", {
1124
+ scope: "col",
1125
+ title: e.label,
1126
+ "aria-sort": n,
1127
+ ...m.props(q.header, Re[e.role], e.width !== void 0 && q.width(e.width), e.isSecondary === !0 && q.secondary),
1128
+ children: e.canSort === !0 && o !== void 0 ? /* @__PURE__ */ P(h, {
1129
+ type: "button",
1130
+ "aria-label": `Sort ${r} by ${e.label}`,
1131
+ ...m.props(q.sort),
1132
+ onClick: (n) => t.toggleSort(e.id, n.nativeEvent),
1133
+ children: [/* @__PURE__ */ N("span", {
1134
+ ...m.props(q.headerLabel),
1135
+ children: e.label
1136
+ }), /* @__PURE__ */ N(i, {
1137
+ size: 14,
1138
+ "aria-hidden": "true",
1139
+ ...m.props(q.sortIcon)
1140
+ })]
1141
+ }) : /* @__PURE__ */ N("span", {
1142
+ ...m.props(q.headerLabel),
1143
+ children: e.label
1144
+ })
1145
+ }, e.id);
1146
+ })] })
1147
+ }),
1148
+ /* @__PURE__ */ P("tbody", {
1149
+ onPointerLeave: () => L(void 0),
1150
+ onKeyDownCapture: () => L(void 0),
1151
+ onBlur: (e) => {
1152
+ e.currentTarget.contains(e.relatedTarget) || he((e) => e === void 0 ? void 0 : {
1153
+ id: e.id,
1154
+ isWithin: !1
1155
+ });
1156
+ },
1157
+ children: [
1158
+ W.map(({ row: e, index: n, spacerHeight: r }) => /* @__PURE__ */ P(re, { children: [r > 0 && /* @__PURE__ */ N("tr", {
1159
+ "aria-hidden": "true",
1160
+ children: /* @__PURE__ */ N("td", {
1161
+ colSpan: K,
1162
+ ...m.props(q.spacer(r))
1163
+ })
1164
+ }), /* @__PURE__ */ P("tr", {
1165
+ "data-index": n,
1166
+ "data-row-id": e.id,
1167
+ "aria-rowindex": b === void 0 ? void 0 : n + 2,
1168
+ ref: b === void 0 || y === "fixed" ? void 0 : V.measure(n),
1169
+ onPointerMove: (t) => {
1170
+ t.pointerType === "mouse" && L(e.id);
1171
+ },
1172
+ onPointerEnter: (t) => {
1173
+ t.pointerType === "mouse" && L(e.id);
1174
+ },
1175
+ onPointerLeave: () => {
1176
+ L((t) => t === e.id ? void 0 : t);
1177
+ },
1178
+ onPointerDown: (e) => {
1179
+ e.pointerType !== "mouse" && L(void 0);
1180
+ },
1181
+ onFocus: () => {
1182
+ L(void 0), he({
1183
+ id: e.id,
1184
+ isWithin: !0
1185
+ });
1186
+ },
1187
+ ...m.props(q.row, Te && q.actionable, (c?.has(e.id) === !0 || ee === e.id) && q.selected),
1188
+ children: [c !== void 0 && /* @__PURE__ */ N("td", {
1189
+ ...m.props(q.cell, q.selection, q.rowControl),
1190
+ children: /* @__PURE__ */ N(s.Root, {
1191
+ "aria-label": u(e.original),
1192
+ checked: c.has(e.id),
1193
+ onCheckedChange: (n, r) => t.toggleRow(e.id, r.event),
1194
+ children: /* @__PURE__ */ N(s.Indicator, {})
1195
+ })
1196
+ }), j.map((t, r) => {
1197
+ let i = /* @__PURE__ */ N(Ke, {
1198
+ role: t.role,
1199
+ isFixed: y === "fixed",
1200
+ shouldTruncate: t.shouldTruncate,
1201
+ children: t.cell(e.original)
1202
+ });
1203
+ return /* @__PURE__ */ N("td", {
1204
+ "data-record-label": r === Ce || void 0,
1205
+ ...m.props(q.cell, Le[y], Re[t.role], t.width !== void 0 && q.width(t.width), t.isSecondary === !0 && q.secondary),
1206
+ children: d !== void 0 && r === Ce ? /* @__PURE__ */ N(rt, {
1207
+ index: n,
1208
+ recordId: e.id,
1209
+ row: e.original,
1210
+ action: d,
1211
+ isActive: ee === e.id,
1212
+ children: i
1213
+ }) : i
1214
+ }, t.id);
1215
+ })]
1216
+ })] }, e.id)),
1217
+ b !== void 0 && Pe > 0 && /* @__PURE__ */ N("tr", {
1218
+ "aria-hidden": "true",
1219
+ children: /* @__PURE__ */ N("td", {
1220
+ colSpan: K,
1221
+ ...m.props(q.spacer(Pe))
1222
+ })
1223
+ }),
1224
+ e.length === 0 && /* @__PURE__ */ N("tr", { children: /* @__PURE__ */ N("td", {
1225
+ colSpan: K,
1226
+ ...m.props(q.emptyCell),
1227
+ children: /* @__PURE__ */ N("div", {
1228
+ ...m.props(q.empty),
1229
+ children: i
1230
+ })
1231
+ }) })
1232
+ ]
1233
+ })
1234
+ ] });
1235
+ }
1236
+ let { api: Y, element: Je } = $e(De, (t) => ({
1237
+ "aria-label": r,
1238
+ "aria-busy": A === "pending" || void 0,
1239
+ "aria-rowcount": b === void 0 ? void 0 : Math.max(1, e.length) + 1,
1240
+ ...m.props(q.table, q.fixed, q.minimumWidth(je, Me)),
1241
+ children: qe(t)
1242
+ }));
1243
+ return T(() => {
1244
+ if (p === void 0) {
1245
+ R.current = void 0;
1246
+ return;
1247
+ }
1248
+ let e = z.indexOf(p);
1249
+ if (R.current === p || e === -1) return;
1250
+ let t = requestAnimationFrame(() => {
1251
+ Y.focusRow(e) && (R.current = p);
1252
+ });
1253
+ return () => cancelAnimationFrame(t);
1254
+ }, [
1255
+ z,
1256
+ p,
1257
+ Te,
1258
+ Y
1259
+ ]), /* @__PURE__ */ P("div", {
1260
+ ...m.props(q.frame, ze[we]),
1261
+ children: [/* @__PURE__ */ P("div", {
1262
+ ref: ce.ref,
1263
+ "data-table-viewport": !0,
1264
+ role: "region",
1265
+ "aria-label": r,
1266
+ tabIndex: ce.tabIndex,
1267
+ ...m.props(q.viewport, Be[we], typeof b?.height == "number" && q.virtual(b.height)),
1268
+ children: [
1269
+ Je,
1270
+ b !== void 0 && /* @__PURE__ */ N("div", {
1271
+ "aria-hidden": !0,
1272
+ ...m.props(q.sizer(F + V.size))
1273
+ }),
1274
+ /* @__PURE__ */ N("div", {
1275
+ ref: de,
1276
+ ...m.props(x !== void 0 && q.endContent),
1277
+ children: x
1278
+ })
1279
+ ]
1280
+ }), Ae && /* @__PURE__ */ P("div", {
1281
+ ...m.props(q.footer),
1282
+ children: [w, k !== void 0 && /* @__PURE__ */ N(ke, {
1283
+ ...k,
1284
+ label: r
1285
+ })]
1286
+ })]
1287
+ });
1288
+ }
1289
+ // packages/collections/src/table-query.tsx
1290
+ var ut = x(void 0);
1291
+ function Z(e) {
1292
+ if (e.reason.trim().length === 0) throw Error("A table query exception requires a reason.");
1293
+ }
1294
+ function dt({ search: e, filters: t, children: n, isFiltered: r = !1 }) {
1295
+ return e === void 0 ? /* @__PURE__ */ N(ut, {
1296
+ value: void 0,
1297
+ children: n
1298
+ }) : (e !== !0 && Z(e), t !== !0 && Z(t), /* @__PURE__ */ N(ut, {
1299
+ value: r,
1300
+ children: n
1301
+ }));
1302
+ }
1303
+ function ft(e) {
1304
+ if ("reason" in e) Z(e);
1305
+ else {
1306
+ if (e.length === 0) throw Error("Supply filter dimensions or explain why the table has none.");
1307
+ if (new Set(e.map((e) => e.id)).size !== e.length) throw Error("Each table filter must have a unique ID.");
1308
+ }
1309
+ }
1310
+ var pt = [];
1311
+ function mt(e, t) {
1312
+ let [n, r] = O(""), [i, a] = O(/* @__PURE__ */ new Map()), o = typeof t.search == "function" ? t.search : void 0;
1313
+ typeof t.search != "function" && Z(t.search), ft(t.filters);
1314
+ let s = "reason" in t.filters ? pt : t.filters, c = o === void 0 ? void 0 : {
1315
+ value: n,
1316
+ onChange: r
1317
+ }, l = n.trim().toLowerCase(), u = E(() => s.map((t) => {
1318
+ let n = new Set(e.map(t.value)), r = i.get(t.id);
1319
+ r !== void 0 && n.add(r);
1320
+ let o = Array.from(n, (e) => ({
1321
+ value: `value:${e}`,
1322
+ label: t.formatLabel?.(e) ?? (e === "" ? "Unspecified" : e)
1323
+ }));
1324
+ return {
1325
+ id: t.id,
1326
+ label: t.label,
1327
+ options: [{
1328
+ value: "",
1329
+ label: "All"
1330
+ }, ...o],
1331
+ defaultValue: "",
1332
+ value: r === void 0 ? "" : `value:${r}`,
1333
+ onChange(e) {
1334
+ a((n) => {
1335
+ let r = new Map(n);
1336
+ return e === "" ? r.delete(t.id) : r.set(t.id, e.slice(6)), r;
1337
+ });
1338
+ }
1339
+ };
1340
+ }), [
1341
+ s,
1342
+ i,
1343
+ e
1344
+ ]), d = l !== "" && o !== void 0, f = u.some((e) => e.value !== e.defaultValue);
1345
+ return {
1346
+ rows: d || f ? e.filter((e) => d && !o(e).toLowerCase().includes(l) ? !1 : s.every((t) => !i.has(t.id) || t.value(e) === i.get(t.id))) : e,
1347
+ search: c,
1348
+ filters: u,
1349
+ isFiltered: d || f
1350
+ };
1351
+ }
1352
+ function ht() {
1353
+ let e = S(ut);
1354
+ if (e === void 0) throw Error("A frame-owned table requires its enclosing collection to supply TableQueryFrame.");
1355
+ return e;
1356
+ }
1357
+ function gt(e) {
1358
+ "reason" in e.search && Z(e.search), ft(e.filters);
1359
+ let t = "reason" in e.search ? void 0 : e.search, n = "reason" in e.filters ? [] : e.filters;
262
1360
  return {
263
- recordId: e,
264
- collection: t
1361
+ search: t,
1362
+ filters: n,
1363
+ isFiltered: !!t?.value.trim() || n.some((e) => e.value !== e.defaultValue)
265
1364
  };
266
1365
  }
267
- var Ce = N({
268
- name: "collection-record",
269
- options: {
270
- recordId: "string",
271
- collection: "string"
272
- },
273
- state: Se,
274
- sync: Se,
275
- controlled: ["recordId", "collection"],
276
- api: () => ({}),
277
- slots: (e) => ({ root: e({}) })
278
- }), J = _(Ce, { root: "a" }).Root, we = _(Ce, { root: "button" }).Root, Y = {
1366
+ // packages/collections/src/collection-filters.tsx
1367
+ var Q = {
279
1368
  search: {
280
1369
  kzqmXN: "xh8yej3",
281
1370
  k1K539: "x1kk91vl",
@@ -298,12 +1387,12 @@ var Ce = N({
298
1387
  kMwMTN: "xr5kp14",
299
1388
  $$css: !0
300
1389
  }
301
- }, X = {
302
- positive: Y.positive,
303
- negative: Y.negative,
304
- warning: Y.warning,
1390
+ }, _t = {
1391
+ positive: Q.positive,
1392
+ negative: Q.negative,
1393
+ warning: Q.warning,
305
1394
  neutral: void 0
306
- }, Te = /* @__PURE__ */ new Set([
1395
+ }, vt = /* @__PURE__ */ new Set([
307
1396
  "Home",
308
1397
  "End",
309
1398
  "ArrowLeft",
@@ -311,49 +1400,49 @@ var Ce = N({
311
1400
  "Backspace",
312
1401
  "Delete"
313
1402
  ]);
314
- function Ee({ option: e }) {
315
- return /* @__PURE__ */ O("span", {
316
- ...h.props(Y.icon, X[e.tone ?? "neutral"]),
317
- children: e.icon ?? /* @__PURE__ */ O(ce, {
1403
+ function yt({ option: e }) {
1404
+ return /* @__PURE__ */ N("span", {
1405
+ ...m.props(Q.icon, _t[e.tone ?? "neutral"]),
1406
+ children: e.icon ?? /* @__PURE__ */ N(me, {
318
1407
  size: 14,
319
1408
  "aria-hidden": !0
320
1409
  })
321
1410
  });
322
1411
  }
323
- function De({ groups: t }) {
324
- let [n, i] = T(""), a = t.filter((e) => e.label.toLowerCase().includes(n.toLowerCase())), o = t.length === 1 && t[0] !== void 0 ? `Filter by ${t[0].label.toLowerCase()}` : "Filters";
325
- return /* @__PURE__ */ k(c.Root, {
1412
+ function bt({ groups: t }) {
1413
+ let [n, i] = O(""), a = t.filter((e) => e.label.toLowerCase().includes(n.toLowerCase())), o = t.length === 1 && t[0] !== void 0 ? `Filter by ${t[0].label.toLowerCase()}` : "Filters", s = De(/* @__PURE__ */ N(e, {
1414
+ "aria-label": o,
1415
+ title: "Filters"
1416
+ }));
1417
+ return /* @__PURE__ */ P(c.Root, {
326
1418
  onOpenChange: (e) => {
327
1419
  e || i("");
328
1420
  },
329
- children: [/* @__PURE__ */ O(c.Trigger, {
330
- render: /* @__PURE__ */ O(e, {
331
- "aria-label": o,
332
- title: "Filters"
333
- }),
334
- children: /* @__PURE__ */ O(le, {
1421
+ children: [/* @__PURE__ */ N(c.Trigger, {
1422
+ render: s,
1423
+ children: /* @__PURE__ */ N(I, {
335
1424
  size: 14,
336
1425
  "aria-hidden": !0
337
1426
  })
338
- }), /* @__PURE__ */ k(c.Popup, {
1427
+ }), /* @__PURE__ */ P(c.Popup, {
339
1428
  align: "end",
340
1429
  children: [
341
- /* @__PURE__ */ O(Z, {
1430
+ /* @__PURE__ */ N(xt, {
342
1431
  label: "Find a filter",
343
1432
  value: n,
344
1433
  onChange: i
345
1434
  }),
346
- a.map((e) => /* @__PURE__ */ O(Oe, { group: e }, e.id)),
347
- a.length === 0 && /* @__PURE__ */ O("div", {
1435
+ a.map((e) => /* @__PURE__ */ N(St, { group: e }, e.id)),
1436
+ a.length === 0 && /* @__PURE__ */ N("div", {
348
1437
  className: "x1hmw7ec x5g2kb4",
349
- children: /* @__PURE__ */ O(r, { children: "No filters found" })
1438
+ children: /* @__PURE__ */ N(r, { children: "No filters found" })
350
1439
  })
351
1440
  ]
352
1441
  })]
353
1442
  });
354
1443
  }
355
- function Z({ label: e, value: t, onChange: n }) {
356
- return /* @__PURE__ */ O(m, {
1444
+ function xt({ label: e, value: t, onChange: n }) {
1445
+ return /* @__PURE__ */ N(p, {
357
1446
  type: "search",
358
1447
  "aria-label": e,
359
1448
  placeholder: "Filter…",
@@ -361,65 +1450,65 @@ function Z({ label: e, value: t, onChange: n }) {
361
1450
  value: t,
362
1451
  onValueChange: n,
363
1452
  onKeyDown: (e) => {
364
- (e.key.length === 1 || Te.has(e.key)) && e.stopPropagation();
1453
+ (e.key.length === 1 || vt.has(e.key)) && e.stopPropagation();
365
1454
  },
366
- xstyle: Y.search
1455
+ xstyle: Q.search
367
1456
  });
368
1457
  }
369
- function Oe({ group: e }) {
370
- let [t, n] = T(""), i = e.options.filter((e) => e.label.toLowerCase().includes(t.toLowerCase()));
371
- return /* @__PURE__ */ k(c.SubmenuRoot, {
1458
+ function St({ group: e }) {
1459
+ let [t, n] = O(""), i = e.options.filter((e) => e.label.toLowerCase().includes(t.toLowerCase()));
1460
+ return /* @__PURE__ */ P(c.SubmenuRoot, {
372
1461
  onOpenChange: (e) => {
373
1462
  e || n("");
374
1463
  },
375
- children: [/* @__PURE__ */ k(c.SubmenuTrigger, { children: [
376
- e.icon ?? /* @__PURE__ */ O(le, {
1464
+ children: [/* @__PURE__ */ P(c.SubmenuTrigger, { children: [
1465
+ e.icon ?? /* @__PURE__ */ N(I, {
377
1466
  size: 14,
378
1467
  "aria-hidden": !0
379
1468
  }),
380
- /* @__PURE__ */ O("span", {
1469
+ /* @__PURE__ */ N("span", {
381
1470
  className: "x98rzlu xeuugli xj0a0fe",
382
1471
  children: e.label
383
1472
  }),
384
- /* @__PURE__ */ O("span", {
1473
+ /* @__PURE__ */ N("span", {
385
1474
  className: "xazcve0 xb3r6kr xuxw1ft xlyipyv x153jb6y xy8obcc xas2l8k",
386
1475
  children: e.options.find((t) => t.value === e.value)?.label
387
1476
  }),
388
- /* @__PURE__ */ O(j, {
1477
+ /* @__PURE__ */ N(F, {
389
1478
  size: 14,
390
1479
  "aria-hidden": !0
391
1480
  })
392
- ] }), /* @__PURE__ */ k(c.Popup, {
1481
+ ] }), /* @__PURE__ */ P(c.Popup, {
393
1482
  align: "start",
394
1483
  "aria-label": e.label,
395
1484
  children: [
396
- /* @__PURE__ */ O(Z, {
1485
+ /* @__PURE__ */ N(xt, {
397
1486
  label: `Find ${e.label.toLowerCase()}`,
398
1487
  value: t,
399
1488
  onChange: n
400
1489
  }),
401
- /* @__PURE__ */ O(c.RadioGroup, {
1490
+ /* @__PURE__ */ N(c.RadioGroup, {
402
1491
  value: e.value,
403
1492
  onValueChange: e.onChange,
404
- children: i.map((e) => /* @__PURE__ */ k(c.RadioItem, {
1493
+ children: i.map((e) => /* @__PURE__ */ P(c.RadioItem, {
405
1494
  value: e.value,
406
1495
  closeOnSelect: !0,
407
- children: [/* @__PURE__ */ O(Ee, { option: e }), /* @__PURE__ */ O("span", {
1496
+ children: [/* @__PURE__ */ N(yt, { option: e }), /* @__PURE__ */ N("span", {
408
1497
  className: "x98rzlu xeuugli xj0a0fe",
409
1498
  children: e.label
410
1499
  })]
411
1500
  }, e.value))
412
1501
  }),
413
- i.length === 0 && /* @__PURE__ */ O("div", {
1502
+ i.length === 0 && /* @__PURE__ */ N("div", {
414
1503
  className: "x1hmw7ec x5g2kb4",
415
- children: /* @__PURE__ */ O(r, { children: "No options found" })
1504
+ children: /* @__PURE__ */ N(r, { children: "No options found" })
416
1505
  })
417
1506
  ]
418
1507
  })]
419
1508
  });
420
1509
  }
421
1510
  // packages/collections/src/query-controls.tsx
422
- function ke(e) {
1511
+ function Ct(e) {
423
1512
  return {
424
1513
  value: e.search?.value ?? "",
425
1514
  filters: e.selections,
@@ -427,7 +1516,7 @@ function ke(e) {
427
1516
  available: e.search !== void 0 || e.groups.length > 0
428
1517
  };
429
1518
  }
430
- function Ae(e) {
1519
+ function wt(e) {
431
1520
  let t = JSON.parse(e);
432
1521
  if (Array.isArray(t) && t.length === 2) {
433
1522
  let e = t[0], n = t[1];
@@ -435,415 +1524,208 @@ function Ae(e) {
435
1524
  }
436
1525
  throw Error("Select a listed filter option, or provide a filter ID and value.");
437
1526
  }
438
- var je = N({
439
- name: "collection-query",
440
- options: {
441
- search: "value",
442
- groups: "list",
443
- selections: "value",
444
- isDisabled: "boolean"
445
- },
446
- state: ke,
447
- sync: ke,
448
- controlled: ["value", "filters"],
449
- api: ({ options: e }) => ({
450
- get setQuery() {
451
- let { search: t, isDisabled: n } = e();
452
- return n || t === void 0 ? null : (e) => {
453
- if (typeof e != "string") throw TypeError("The search term must be a string.");
454
- t.onChange(e);
455
- };
456
- },
457
- get submitSearch() {
458
- let { search: t, isDisabled: n } = e();
459
- return n ? void 0 : t?.onSubmit;
460
- },
461
- get setFilter() {
462
- let { groups: t, isDisabled: n } = e();
463
- return n || t.length === 0 ? null : (e, n) => {
464
- let [r, i] = n === void 0 ? Ae(e) : [e, n], a = t.find((e) => e.id === r);
465
- if (a === void 0 || !a.options.some((e) => e.value === i)) throw Error("Unknown filter or option. Choose one of the listed filter options.");
466
- a.onChange(i);
467
- };
468
- },
469
- items() {
470
- return e().groups.flatMap((e) => e.options.map((t) => ({
471
- value: JSON.stringify([e.id, t.value]),
472
- label: `${e.label} · ${t.label}`
473
- })));
474
- }
475
- }),
476
- agent: {
477
- actions: [
478
- "setQuery",
479
- "submitSearch",
480
- "setFilter"
481
- ],
482
- items: (e) => e.items(),
483
- shown: (e) => e.available && !e.disabled
484
- },
485
- slots: (e) => ({ root: e({ attrs: () => ({ role: "group" }) }) })
486
- }), Me = _(je, { root: "div" }).Root, Ne = { input: {
487
- k7Eaqz: "xeuugli",
488
- kUk6DE: "x98rzlu",
489
- $$css: !0
490
- } };
491
- function Pe({ label: t = "Collection controls", search: n, filters: r = [], filterContent: i, chips: a = [], viewActions: o, display: s, isPlaceholder: c = !1, isReady: u }) {
492
- let [d, f] = T(!1), [ee, p] = T(!1), te = w(null), h = w(null), g = w(null), _ = ie(() => Object.fromEntries(r.map((e) => [e.id, e.value])), [r]), v = c || !u, ne = n !== void 0 && (d || n.value.length > 0);
493
- C(() => {
494
- d && !c && u && (g.current?.focus(), g.current?.select());
495
- }, [
496
- d,
497
- c,
498
- u
499
- ]);
500
- function b() {
501
- (te.current ?? h.current?.querySelector("button"))?.focus();
502
- }
503
- function x() {
504
- n !== void 0 && !c && u && (g.current?.focus(), g.current?.select(), f(!0));
505
- }
506
- function S() {
507
- n?.onChange(""), f(!1), b();
508
- }
509
- function re(e) {
510
- ne && !e.defaultPrevented && e.key === "Escape" && e.target instanceof Element && e.target.closest("[role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"], [role=\"listbox\"], [data-native-find], input:not([data-view-find]), textarea, select") === null && (e.preventDefault(), e.stopPropagation(), S());
511
- }
512
- let E = r.filter((e) => e.value !== e.defaultValue).map((e) => ({
513
- id: `filter:${e.id}`,
514
- label: e.options.find((t) => t.value === e.value)?.label ?? e.value,
515
- onRemove: () => e.onChange(e.defaultValue)
516
- }));
517
- for (let e of a) E.push({
518
- ...e,
519
- id: `chip:${e.id}`
520
- });
521
- let D = i !== void 0 || r.length > 0, ae = y.toArray([o, s]).length > 0, oe = n !== void 0 || D || ae, se = n?.label ?? "Search this view", A = n?.placeholder ?? "Find in view…";
522
- return {
523
- openSearch: x,
524
- onKeyDown: re,
525
- actions: oe ? /* @__PURE__ */ k(Me, {
526
- search: n,
527
- groups: r,
528
- selections: _,
529
- isDisabled: v,
530
- ref: h,
531
- "aria-label": t,
532
- "aria-hidden": v,
533
- inert: v,
534
- className: "x78zum5 x6s0dn4 x1a02dak x13a6bvl x1hnptsi xeuugli x193iq5w",
535
- children: [
536
- n !== void 0 && /* @__PURE__ */ O(e, {
537
- ref: te,
538
- type: "button",
539
- disabled: c,
540
- "aria-label": "Find in view",
541
- title: "Find in view",
542
- "data-view-find-trigger": !0,
543
- "aria-expanded": ne,
544
- onClick: x,
545
- children: /* @__PURE__ */ O(M, {
546
- size: 14,
547
- "aria-hidden": !0
548
- })
549
- }),
550
- ne && /* @__PURE__ */ k("div", {
551
- className: "x78zum5 x6s0dn4 xunmzkg xdl07me x193iq5w",
552
- children: [/* @__PURE__ */ O(m, {
553
- ref: g,
554
- type: "search",
555
- disabled: c,
556
- "data-view-find": !0,
557
- "aria-label": se,
558
- placeholder: A,
559
- value: n.value,
560
- onValueChange: n.onChange,
561
- onKeyDown: (e) => {
562
- e.key === "Enter" && n.onSubmit !== void 0 && (e.preventDefault(), n.onSubmit()), e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), S());
563
- },
564
- xstyle: Ne.input
565
- }), /* @__PURE__ */ O(e, {
566
- type: "button",
567
- variant: "ghost",
568
- "data-view-find-close": !0,
569
- "aria-label": "Close search",
570
- title: "Close search (Esc)",
571
- onClick: S,
572
- children: /* @__PURE__ */ O(de, {
573
- size: 14,
574
- "aria-hidden": !0
575
- })
576
- })]
577
- }),
578
- i === void 0 ? r.length > 0 ? /* @__PURE__ */ O(De, { groups: r }) : null : /* @__PURE__ */ k(l.Root, {
579
- open: ee,
580
- onOpenChange: p,
581
- children: [/* @__PURE__ */ O(l.Trigger, {
582
- render: /* @__PURE__ */ O(e, {
583
- "aria-label": "Filters",
584
- title: "Filters"
585
- }),
586
- children: /* @__PURE__ */ O(le, {
587
- size: 14,
588
- "aria-hidden": !0
589
- })
590
- }), /* @__PURE__ */ k(l.Popup, {
591
- align: "end",
592
- className: "x1m258z3 xw7nakj",
593
- children: [/* @__PURE__ */ O(l.Title, { children: "Filters" }), i(() => p(!1))]
594
- })]
595
- }),
596
- o,
597
- s
598
- ]
599
- }) : void 0,
600
- chips: E.length > 0 && /* @__PURE__ */ O("div", {
601
- "aria-hidden": v,
602
- inert: v,
603
- className: "xjp7ctv",
604
- children: /* @__PURE__ */ O(L, {
605
- filters: E,
606
- onRemove: (e) => {
607
- b(), E.find((t) => t.id === e)?.onRemove();
608
- }
609
- })
610
- })
611
- };
612
- }
613
- // packages/collections/src/use-end-reached.ts
614
- function Fe({ end: e, viewport: t, onEndReached: n, content: r }) {
615
- S(() => {
616
- if (n === void 0 || e.current === null) return;
617
- let r = new IntersectionObserver((e) => {
618
- e.some((e) => e.isIntersecting) && n();
619
- }, { root: t?.current ?? null });
620
- return r.observe(e.current), () => r.disconnect();
621
- }, [
622
- e,
623
- t,
624
- n,
625
- r
626
- ]);
627
- }
628
- // packages/collections/src/data-table.tsx
629
- var Ie = F({}), Le = /* @__PURE__ */ new Set(["string", "number"]), Re = 76, ze = p.compactTable.slice(7), Be = /* @__PURE__ */ new Map([["ArrowUp", -1], ["ArrowDown", 1]]), Ve = {
630
- kmVPX3: "x1717udv",
631
- kMzoRj: "xc342km",
632
- $$css: !0
633
- }, Q = {
634
- frame: {
635
- k7Eaqz: "xeuugli",
636
- kMv6JI: "x1hz01jw",
637
- kGuDYH: "xtqrqnz",
638
- kLWn49: "x1778rvt",
639
- k63SB2: "xj57cvi",
640
- kMwMTN: "xbixft",
641
- khiITx: "xvmahel",
642
- $$css: !0
643
- },
644
- content: { $$css: !0 },
645
- placeholder: {
646
- kfzvcC: "x47corl",
647
- $$css: !0
648
- },
649
- fillFrame: {
650
- k1xSpc: "x78zum5",
651
- kXwgrk: "xdt5ytf",
652
- kUk6DE: "x98rzlu",
653
- kAzted: "x2lwn1j",
654
- $$css: !0
655
- },
656
- viewport: {
657
- k7Eaqz: "xeuugli",
658
- k9g6sI: "x12h1iku",
659
- kVQacm: "xysyzu8",
660
- kacamN: "xy5w88m",
661
- k3XXqK: "x1t137rt",
662
- kPJHz1: "x13qnu6",
663
- k7shQP: "x9v5kkp",
664
- kZs9gx: "x19rmrnh",
665
- kiEn40: "x1bqaal",
666
- $$css: !0
667
- },
668
- fillViewport: {
669
- kUk6DE: "x98rzlu",
670
- kAzted: "x2lwn1j",
671
- $$css: !0
672
- },
673
- virtual: (e) => [{
674
- kskxy: e == null ? e : "x1jols5v",
675
- $$css: !0
676
- }, { "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }],
677
- table: {
678
- kzqmXN: "xh8yej3",
679
- kLvRdT: "x1mwwwfo",
680
- kcqcaj: "xss6m8b",
681
- k9WMMc: "xdpxx8g",
682
- kMwMTN: "xbixft",
683
- kWkggS: "xpvm0e4",
684
- $$css: !0
685
- },
686
- fixed: {
687
- kPzzVL: "x140o2bo",
688
- $$css: !0
689
- },
690
- minimumWidth: (e, t) => [{
691
- k7Eaqz: (e == null ? e : "x7w7ha4 ") + (t == null ? t : "x18ie477"),
692
- $$css: !0
693
- }, {
694
- "--x-1utbgw4": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
695
- "--x-1wqfzdf": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
696
- }],
697
- caption: {
698
- k9WMMc: "xdpxx8g",
699
- kmVPX3: "xg7ukam",
700
- kMwMTN: "x153jb6y",
701
- kGuDYH: "xy8obcc",
702
- kLWn49: "xas2l8k",
703
- $$css: !0
704
- },
705
- header: {
706
- kB7OPa: "x9f619",
707
- kVAEAm: "x7wzq59",
708
- k87sOh: "x13vifvy",
709
- kY2c9j: "x11ru5tl",
710
- kZKoxP: "x1krvmzm",
711
- k8WAf4: "xt970qd",
712
- kg3NbH: "x1dc62k6",
713
- kt9PQ7: "xso031l",
714
- kfdmCh: "x1q0q8m5",
715
- kL6WhQ: "x1qndepd",
716
- kMwMTN: "x153jb6y",
717
- kWkggS: "xpvm0e4",
718
- k63SB2: "xj57cvi",
719
- kGuDYH: "xy8obcc",
720
- kLWn49: "xas2l8k",
721
- khDVqt: "xuxw1ft",
722
- $$css: !0
723
- },
724
- cell: {
725
- kB7OPa: "x9f619",
726
- k8WAf4: "xt970qd",
727
- kg3NbH: "x1dc62k6",
728
- kXLuUW: "xxymvpz",
729
- kHjlTd: "xj0a0fe",
730
- $$css: !0
731
- },
732
- start: {
733
- k9WMMc: "x1yc453h",
734
- $$css: !0
735
- },
736
- end: {
737
- k9WMMc: "xp4054r",
738
- $$css: !0
739
- },
740
- width: (e) => [{
741
- kzqmXN: e == null ? e : "x5lhr3w",
742
- k7Eaqz: e == null ? e : "xkj4a21",
743
- $$css: !0
744
- }, {
745
- "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
746
- "--x-minWidth": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e)
747
- }],
748
- secondary: {
749
- k1xSpc: "xqxxu6g",
750
- $$css: !0
751
- },
752
- contentCell: {
753
- k8WAf4: "xn9t2bk",
754
- $$css: !0
1527
+ var Tt = se({
1528
+ name: "collection-query",
1529
+ options: {
1530
+ search: "value",
1531
+ groups: "list",
1532
+ selections: "value",
1533
+ isDisabled: "boolean"
755
1534
  },
756
- spacer: (e) => [
757
- Ve,
758
- {
759
- kZKoxP: e == null ? e : "x16ye13r",
760
- $$css: !0
1535
+ state: Ct,
1536
+ sync: Ct,
1537
+ controlled: ["value", "filters"],
1538
+ api: ({ options: e }) => ({
1539
+ get setQuery() {
1540
+ let { search: t, isDisabled: n } = e();
1541
+ return n || t === void 0 ? null : (e) => {
1542
+ if (typeof e != "string") throw TypeError("The search term must be a string.");
1543
+ M({ options: () => t }, "onChange", e, { reason: "imperative" });
1544
+ };
761
1545
  },
762
- { "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
763
- ]
764
- }, He = {
765
- primary: {
766
- minimumWidth: 240,
767
- isFlexible: !0,
768
- shouldTruncate: !0
769
- },
770
- text: {
771
- minimumWidth: 160,
772
- isFlexible: !1,
773
- shouldTruncate: !0
774
- },
775
- status: {
776
- minimumWidth: 160,
777
- isFlexible: !1,
778
- shouldTruncate: !1
779
- },
780
- number: {
781
- minimumWidth: 112,
782
- isFlexible: !1,
783
- shouldTruncate: !1
784
- },
785
- timestamp: {
786
- minimumWidth: 160,
787
- isFlexible: !1,
788
- shouldTruncate: !1
1546
+ get submitSearch() {
1547
+ let { search: t, isDisabled: n } = e();
1548
+ return n || t?.onSubmit === void 0 ? null : () => {
1549
+ M({ options: () => t }, "onSubmit", t.value, { reason: "imperative" });
1550
+ };
1551
+ },
1552
+ get setFilter() {
1553
+ let { groups: t, isDisabled: n } = e();
1554
+ return n || t.length === 0 ? null : (e, n) => {
1555
+ let [r, i] = n === void 0 ? wt(e) : [e, n], a = t.find((e) => e.id === r);
1556
+ if (a === void 0 || !a.options.some((e) => e.value === i)) throw Error("Unknown filter or option. Choose one of the listed filter options.");
1557
+ M({ options: () => a }, "onChange", i, { reason: "imperative" });
1558
+ };
1559
+ },
1560
+ items() {
1561
+ return e().groups.flatMap((e) => e.options.map((t) => ({
1562
+ value: JSON.stringify([e.id, t.value]),
1563
+ label: `${e.label} · ${t.label}`
1564
+ })));
1565
+ }
1566
+ }),
1567
+ agent: {
1568
+ actions: [
1569
+ "setQuery",
1570
+ "submitSearch",
1571
+ "setFilter"
1572
+ ],
1573
+ items: (e) => e.items(),
1574
+ shown: (e) => e.available && !e.disabled
789
1575
  },
790
- actions: {
791
- minimumWidth: 112,
792
- isFlexible: !1,
793
- shouldTruncate: !1
1576
+ slots: (e) => ({ root: e({}) })
1577
+ }), Et = g(Tt, { root: "div" }).Root, Dt = { input: {
1578
+ k7Eaqz: "xeuugli",
1579
+ kUk6DE: "x98rzlu",
1580
+ $$css: !0
1581
+ } };
1582
+ function Ot({ label: t = "Collection controls", search: n, filters: r = [], filterContent: i, chips: a = [], viewActions: o, display: s, isPlaceholder: c = !1, isReady: u }) {
1583
+ let [d, f] = O(!1), [ee, te] = O(!1), ne = D(null), m = D(null), h = D(null), g = E(() => Object.fromEntries(r.map((e) => [e.id, e.value])), [r]), _ = c || !u, v = n !== void 0 && (d || n.value.length > 0);
1584
+ T(() => {
1585
+ d && !c && u && (h.current?.focus(), h.current?.select());
1586
+ }, [
1587
+ d,
1588
+ c,
1589
+ u
1590
+ ]);
1591
+ function y() {
1592
+ (ne.current ?? m.current?.querySelector("button"))?.focus();
794
1593
  }
795
- }, Ue = {
796
- fixed: Q.content,
797
- content: Q.contentCell
798
- }, We = {
799
- primary: Q.start,
800
- text: Q.start,
801
- status: Q.start,
802
- number: Q.end,
803
- timestamp: Q.end,
804
- actions: Q.end
805
- }, Ge = {
806
- content: Q.content,
807
- fill: Q.fillFrame
808
- }, Ke = {
809
- content: Q.content,
810
- fill: Q.fillViewport
811
- };
812
- function qe(e) {
813
- return e.map((e) => {
814
- let t = He[e.role], n = e.width ?? (t.isFlexible ? void 0 : t.minimumWidth);
815
- return {
816
- ...e,
817
- ...n === void 0 ? {} : { width: n }
818
- };
1594
+ function re() {
1595
+ n !== void 0 && !c && u && (h.current?.focus(), h.current?.select(), f(!0));
1596
+ }
1597
+ function x(e, t) {
1598
+ n !== void 0 && M({ options: () => n }, "onChange", "", {
1599
+ reason: e,
1600
+ event: t
1601
+ }), f(!1), y();
1602
+ }
1603
+ function S(e) {
1604
+ v && !e.defaultPrevented && e.key === "Escape" && e.target instanceof Element && e.target.closest("[role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"], [role=\"listbox\"], [data-native-find], input:not([data-view-find]), textarea, select") === null && (e.preventDefault(), e.stopPropagation(), x("escape-key", e.nativeEvent));
1605
+ }
1606
+ let C = r.filter((e) => e.value !== e.defaultValue).map((e) => ({
1607
+ id: `filter:${e.id}`,
1608
+ label: e.options.find((t) => t.value === e.value)?.label ?? e.value,
1609
+ onRemove: (t) => e.onChange(e.defaultValue, t)
1610
+ }));
1611
+ for (let e of a) C.push({
1612
+ ...e,
1613
+ id: `chip:${e.id}`
819
1614
  });
820
- }
821
- function Je(e, t = 0) {
1615
+ let w = i !== void 0 || r.length > 0, ie = b.toArray([o, s]).length > 0, k = n !== void 0 || w || ie, A = n?.label ?? "Search this view", ae = n?.placeholder ?? "Find in view…";
822
1616
  return {
823
- minimumWidth: e.reduce((e, t) => e + (t.width ?? He[t.role].minimumWidth), t),
824
- compactWidth: e.filter((e) => e.isSecondary !== !0).reduce((e, t) => e + (t.width ?? He[t.role].minimumWidth), t)
1617
+ openSearch: re,
1618
+ onKeyDown: S,
1619
+ actions: k ? /* @__PURE__ */ P(U, {
1620
+ "aria-label": t,
1621
+ render: /* @__PURE__ */ N(Et, {
1622
+ search: n,
1623
+ groups: r,
1624
+ selections: g,
1625
+ isDisabled: _,
1626
+ ref: m,
1627
+ "aria-hidden": _,
1628
+ inert: _,
1629
+ className: "x78zum5 x6s0dn4 x1a02dak x13a6bvl x1hnptsi xeuugli x193iq5w"
1630
+ }),
1631
+ children: [
1632
+ n !== void 0 && /* @__PURE__ */ N(z, {
1633
+ disabled: c,
1634
+ render: /* @__PURE__ */ N(e, {
1635
+ ref: ne,
1636
+ type: "button",
1637
+ "aria-label": "Find in view",
1638
+ title: "Find in view",
1639
+ "data-view-find-trigger": !0,
1640
+ "aria-expanded": v,
1641
+ onClick: re
1642
+ }),
1643
+ children: /* @__PURE__ */ N(he, {
1644
+ size: 14,
1645
+ "aria-hidden": !0
1646
+ })
1647
+ }),
1648
+ v && /* @__PURE__ */ P("div", {
1649
+ className: "x78zum5 x6s0dn4 xunmzkg xdl07me x193iq5w",
1650
+ children: [/* @__PURE__ */ N(B, {
1651
+ disabled: c,
1652
+ render: /* @__PURE__ */ N(p, {
1653
+ ref: h,
1654
+ type: "search",
1655
+ "data-view-find": !0,
1656
+ "aria-label": A,
1657
+ placeholder: ae,
1658
+ value: n.value,
1659
+ onValueChange: n.onChange,
1660
+ onKeyDown: (e) => {
1661
+ e.key === "Enter" && n.onSubmit !== void 0 && (e.preventDefault(), M({ options: () => n }, "onSubmit", n.value, {
1662
+ reason: "enter-key",
1663
+ event: e.nativeEvent
1664
+ })), e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), x("escape-key", e.nativeEvent));
1665
+ },
1666
+ xstyle: Dt.input
1667
+ })
1668
+ }), /* @__PURE__ */ N(z, {
1669
+ render: /* @__PURE__ */ N(e, {
1670
+ type: "button",
1671
+ variant: "ghost",
1672
+ "data-view-find-close": !0,
1673
+ "aria-label": "Close search",
1674
+ title: "Close search (Esc)",
1675
+ onClick: (e) => x("clear-press", e.nativeEvent)
1676
+ }),
1677
+ children: /* @__PURE__ */ N(L, {
1678
+ size: 14,
1679
+ "aria-hidden": !0
1680
+ })
1681
+ })]
1682
+ }),
1683
+ i === void 0 ? r.length > 0 ? /* @__PURE__ */ N(bt, { groups: r }) : null : /* @__PURE__ */ P(l.Root, {
1684
+ open: ee,
1685
+ onOpenChange: te,
1686
+ children: [/* @__PURE__ */ N(l.Trigger, {
1687
+ render: /* @__PURE__ */ N(z, { render: /* @__PURE__ */ N(e, {
1688
+ "aria-label": "Filters",
1689
+ title: "Filters"
1690
+ }) }),
1691
+ children: /* @__PURE__ */ N(I, {
1692
+ size: 14,
1693
+ "aria-hidden": !0
1694
+ })
1695
+ }), /* @__PURE__ */ P(l.Popup, {
1696
+ align: "end",
1697
+ className: "x1m258z3 xw7nakj",
1698
+ children: [/* @__PURE__ */ N(l.Title, { children: "Filters" }), i(() => te(!1))]
1699
+ })]
1700
+ }),
1701
+ o,
1702
+ s
1703
+ ]
1704
+ }) : void 0,
1705
+ chips: C.length > 0 && /* @__PURE__ */ N("div", {
1706
+ "aria-hidden": _,
1707
+ inert: _,
1708
+ className: "xjp7ctv",
1709
+ children: /* @__PURE__ */ N(K, {
1710
+ filters: C,
1711
+ onRemove: (e, t) => {
1712
+ y(), C.find((t) => t.id === e)?.onRemove(t);
1713
+ }
1714
+ })
1715
+ })
825
1716
  };
826
1717
  }
827
- function Ye(e) {
828
- let t = globalThis.matchMedia(ze);
829
- return t.addEventListener("change", e), () => t.removeEventListener("change", e);
830
- }
831
- function Xe() {
832
- return globalThis.matchMedia(ze).matches;
833
- }
834
- function Ze({ columns: e, canSelect: t = !1 }) {
835
- return /* @__PURE__ */ k("colgroup", { children: [t && /* @__PURE__ */ O("col", { className: "x1d7z9mz xeuugli x1dc62k6" }), e.map((e) => /* @__PURE__ */ O("col", { ...h.props(e.width !== void 0 && Q.width(e.width), e.isSecondary === !0 && Q.secondary) }, e.id))] });
836
- }
837
- function Qe({ columns: e, rows: t = 3, hideCaption: n = !0, ...r }) {
1718
+ // packages/collections/src/data-table.tsx
1719
+ function kt({ columns: e, rows: t = 3, hideCaption: n = !0, ...r }) {
838
1720
  let i = typeof r.window?.height == "string" ? r.window.height : "content", a = Array.from({ length: t }, (e, t) => ({ id: String(t) })), o = e.map(({ placeholder: e, ...t }) => ({
839
1721
  ...t,
840
- cell: () => e ?? /* @__PURE__ */ O(d, { width: "60%" })
1722
+ cell: () => e ?? /* @__PURE__ */ N(d, { width: "60%" })
841
1723
  }));
842
- return /* @__PURE__ */ O("div", {
1724
+ return /* @__PURE__ */ N("div", {
843
1725
  "aria-hidden": !0,
844
1726
  inert: !0,
845
- ...h.props(Ge[i], Q.placeholder),
846
- children: /* @__PURE__ */ O(ot, {
1727
+ ...m.props(ze[i], q.placeholder),
1728
+ children: /* @__PURE__ */ N(X, {
847
1729
  ...r,
848
1730
  hideCaption: n,
849
1731
  isPlaceholder: !0,
@@ -854,86 +1736,35 @@ function Qe({ columns: e, rows: t = 3, hideCaption: n = !0, ...r }) {
854
1736
  })
855
1737
  });
856
1738
  }
857
- function $e({ children: e, leading: t, isDecorative: n = !1 }) {
858
- let r = y.toArray(t).length > 0;
859
- return /* @__PURE__ */ k("span", {
860
- "aria-hidden": n || void 0,
861
- inert: n || void 0,
862
- className: "x78zum5 x6s0dn4 x1n8ia3y xeuugli xh8yej3 x1hz01jw xtqrqnz x1778rvt xj57cvi",
863
- children: [r && /* @__PURE__ */ O("span", {
864
- "aria-hidden": !0,
865
- className: "x3nfvp2 x6s0dn4 x2lah0s",
866
- children: t
867
- }), /* @__PURE__ */ O("span", {
868
- className: "x98rzlu xeuugli",
869
- children: e
870
- })]
871
- });
872
- }
873
- function et({ children: e, secondary: t, leading: n, trailing: r }) {
874
- let i = y.toArray(r).length > 0;
875
- return /* @__PURE__ */ k($e, {
876
- leading: n,
877
- children: [/* @__PURE__ */ k("span", {
878
- className: "x78zum5 x6s0dn4 x1hnptsi xeuugli",
879
- children: [/* @__PURE__ */ O("span", {
880
- "data-record-text": !0,
881
- title: e,
882
- className: "x1lliihq xeuugli x14atkfc xs83m0k xb3r6kr xuxw1ft xlyipyv",
883
- children: e
884
- }), i && /* @__PURE__ */ O("span", {
885
- className: "x3nfvp2 x6s0dn4 x2lah0s",
886
- children: r
887
- })]
888
- }), t !== void 0 && /* @__PURE__ */ O("span", {
889
- title: t,
890
- className: "x1lliihq xeuugli xh8yej3 xb3r6kr xuxw1ft xlyipyv x153jb6y xy8obcc xas2l8k",
891
- children: t
892
- })]
893
- });
894
- }
895
- function tt({ leading: e, isSecondary: t = !1 }) {
896
- return /* @__PURE__ */ k($e, {
897
- leading: e,
898
- isDecorative: !0,
899
- children: [/* @__PURE__ */ O("span", {
900
- className: "x1lliihq xeuugli xh8yej3",
901
- children: /* @__PURE__ */ O(d, { width: "70%" })
902
- }), t && /* @__PURE__ */ O("span", {
903
- className: "x1lliihq xeuugli xh8yej3 x153jb6y xy8obcc xas2l8k",
904
- children: /* @__PURE__ */ O(d, { width: "45%" })
905
- })]
906
- });
907
- }
908
- function nt({ query: e, ...t }) {
1739
+ function At({ query: e, ...t }) {
909
1740
  switch (e.mode) {
910
1741
  case "local":
911
1742
  if (t.onEndReached !== void 0 || t.pagination !== void 0) throw Error("Local table queries require all rows. Use a controlled or frame query for a paged source.");
912
- return /* @__PURE__ */ O(it, {
1743
+ return /* @__PURE__ */ N(Mt, {
913
1744
  query: e,
914
1745
  table: t
915
1746
  });
916
- case "controlled": return /* @__PURE__ */ O(at, {
1747
+ case "controlled": return /* @__PURE__ */ N(Nt, {
917
1748
  table: {
918
1749
  ...t,
919
1750
  filteredEmpty: t.filteredEmpty ?? t.empty
920
1751
  },
921
- ...ve(e)
1752
+ ...gt(e)
922
1753
  });
923
- case "frame": return /* @__PURE__ */ O(rt, { table: t });
924
- case "static": return B(e), /* @__PURE__ */ O(V, { children: /* @__PURE__ */ O(ot, { ...t }) });
1754
+ case "frame": return /* @__PURE__ */ N(jt, { table: t });
1755
+ case "static": return Z(e), /* @__PURE__ */ N(dt, { children: /* @__PURE__ */ N(X, { ...t }) });
925
1756
  }
926
1757
  }
927
- function rt({ table: e }) {
928
- let t = G();
929
- return /* @__PURE__ */ O(V, { children: /* @__PURE__ */ O(ot, {
1758
+ function jt({ table: e }) {
1759
+ let t = ht();
1760
+ return /* @__PURE__ */ N(dt, { children: /* @__PURE__ */ N(X, {
930
1761
  ...e,
931
1762
  empty: t ? e.filteredEmpty ?? "No matching records." : e.empty
932
1763
  }) });
933
1764
  }
934
- function it({ query: e, table: t }) {
935
- let { rows: n, search: r, filters: i, isFiltered: a } = W(t.rows, e);
936
- return /* @__PURE__ */ O(at, {
1765
+ function Mt({ query: e, table: t }) {
1766
+ let { rows: n, search: r, filters: i, isFiltered: a } = mt(t.rows, e);
1767
+ return /* @__PURE__ */ N(Nt, {
937
1768
  table: {
938
1769
  ...t,
939
1770
  rows: n
@@ -943,13 +1774,13 @@ function it({ query: e, table: t }) {
943
1774
  isFiltered: a
944
1775
  });
945
1776
  }
946
- function at({ table: e, search: t, filters: n, isFiltered: r }) {
947
- let i = Pe({
1777
+ function Nt({ table: e, search: t, filters: n, isFiltered: r }) {
1778
+ let i = Ot({
948
1779
  ...t !== void 0 && { search: t },
949
1780
  filters: n,
950
1781
  isReady: !0,
951
1782
  label: e.caption
952
- }), a = w(null), o = {
1783
+ }), a = D(null), o = {
953
1784
  description: `Find in ${e.caption}`,
954
1785
  layer: a,
955
1786
  when: () => {
@@ -959,436 +1790,61 @@ function at({ table: e, search: t, filters: n, isFiltered: r }) {
959
1790
  return t === null || t.closest("[data-native-find], textarea, select, input:not([data-view-find]), [contenteditable=\"true\"], [role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"], [role=\"listbox\"]") !== null ? !1 : t.closest("[data-table-query]") === e || t === e.ownerDocument.body && e.ownerDocument.querySelectorAll("[data-view-find-trigger]").length === 1;
960
1791
  }
961
1792
  };
962
- return P(t === void 0 ? null : "/", i.openSearch, o), P(t === void 0 ? null : "mod+f", i.openSearch, o), /* @__PURE__ */ O(V, { children: /* @__PURE__ */ k("div", {
1793
+ return R(t === void 0 ? null : "/", i.openSearch, o), R(t === void 0 ? null : "mod+f", i.openSearch, o), /* @__PURE__ */ N(dt, { children: /* @__PURE__ */ P("div", {
963
1794
  ref: a,
964
1795
  "data-table-query": !0,
965
1796
  onKeyDown: i.onKeyDown,
966
- ...h.props(Ge[typeof e.window?.height == "string" ? e.window.height : "content"]),
967
- children: [(t !== void 0 || n.length > 0) && /* @__PURE__ */ O(I, {
1797
+ ...m.props(ze[typeof e.window?.height == "string" ? e.window.height : "content"]),
1798
+ children: [(t !== void 0 || n.length > 0) && /* @__PURE__ */ N(G, {
968
1799
  label: `${e.caption} controls`,
969
1800
  actions: i.actions,
970
1801
  children: i.chips
971
- }), /* @__PURE__ */ O(ot, {
1802
+ }), /* @__PURE__ */ N(X, {
972
1803
  ...e,
973
1804
  empty: r ? e.filteredEmpty ?? "No matching records." : e.empty
974
1805
  })]
975
1806
  }) });
976
1807
  }
977
- function ot({ rows: e, columns: t, getRowId: n, caption: r, empty: i, sort: a, onSortChange: s, selectedIds: c, onSelectionChange: l, selectionLabel: u, rowAction: d, activeRowId: p, focusRowId: m, onRowHighlightChange: _, hideCaption: v = !1, hideHeaders: y = !1, rowSizing: b = "fixed", window: x, endContent: re, onEndReached: D, footer: A, pagination: j, resultStatus: ce = "ready", isPlaceholder: le = !1 }) {
978
- let M = ie(() => qe(t), [t]), ue = E(Ye, Xe, () => !1), de = ie(() => {
979
- let e = fe();
980
- return e.columns(M.map((t) => e.display({
981
- id: t.id,
982
- header: t.label
983
- })));
984
- }, [M]), N = pe({
985
- features: Ie,
986
- columns: de,
987
- data: e,
988
- getRowId: n
989
- }), P = te(), F = P.viewport, ge = w(null), I = w(null), L = w(null), [R, z] = T(0), [B, V] = T(), [H, U] = T(), W = w(void 0), G = w(void 0), ve = w(void 0), K = e.findIndex((e) => n(e) === B), q = M.findIndex((e) => e.role === "primary" && e.isSecondary !== !0), ye = q === -1 ? M.findIndex((e) => e.isSecondary !== !0) : q, be = typeof x?.height == "string" ? x.height : "content", Se = new Set(e.map(n)), Ce = B !== void 0 && Se.has(B) ? B : void 0;
990
- B !== void 0 && Ce === void 0 && V(void 0), Fe({
991
- end: ge,
992
- onEndReached: x === void 0 ? D : void 0,
993
- content: e.length
994
- }), S(() => {
995
- let e = I.current, t = L.current;
996
- if (x === void 0 || e === null || t === null) return;
997
- let n = new ResizeObserver(() => z(e.offsetHeight + t.offsetHeight));
998
- return n.observe(e), n.observe(t), () => n.disconnect();
999
- }, [
1000
- x,
1001
- v,
1002
- y
1003
- ]);
1004
- let J = he({
1005
- count: e.length,
1006
- enabled: x !== void 0,
1007
- getScrollElement: () => F.current,
1008
- getItemKey: (t) => {
1009
- let r = e[t];
1010
- if (r === void 0) throw RangeError("The virtual row is outside the supplied table page.");
1011
- return n(r);
1012
- },
1013
- estimateSize: () => b === "fixed" ? ee.rowHeight : x?.estimatedRowHeight ?? ee.rowHeight,
1014
- scrollMargin: R,
1015
- scrollPaddingStart: R,
1016
- overscan: 6,
1017
- rangeExtractor: (t) => {
1018
- let n = me(t);
1019
- if (K === -1) return n;
1020
- let r = [
1021
- K - 1,
1022
- K,
1023
- K + 1
1024
- ].filter((t) => t >= 0 && t < e.length), i = n[0] ?? 0, a = n.at(-1) ?? -1;
1025
- return [
1026
- ...r.filter((e) => e < i),
1027
- ...n,
1028
- ...r.filter((e) => e > a)
1029
- ];
1030
- }
1031
- }), we = x === void 0 ? N.getRowModel().rows.map((e, t) => ({
1032
- row: e,
1033
- index: t,
1034
- spacerHeight: 0
1035
- })) : J.getVirtualItems().flatMap((e, t, n) => {
1036
- let r = N.getRowModel().rows[e.index];
1037
- return r === void 0 ? [] : [{
1038
- row: r,
1039
- index: e.index,
1040
- spacerHeight: e.start - (n[t - 1]?.end ?? R)
1041
- }];
1042
- }), Y = we.some(({ row: e }) => e.id === H) ? H : void 0, X = Y ?? Ce;
1043
- H !== void 0 && Y === void 0 && U(void 0), S(() => {
1044
- if (_ === void 0) {
1045
- W.current = void 0;
1046
- return;
1047
- }
1048
- if (W.current !== void 0 && W.current.id === X) return;
1049
- let e = { isCurrent: !0 };
1050
- return queueMicrotask(() => {
1051
- e.isCurrent && (W.current = { id: X }, _(X));
1052
- }), () => {
1053
- e.isCurrent = !1;
1054
- };
1055
- }, [X, _]);
1056
- let Te = we.some(({ row: e }) => e.id === m);
1057
- C(() => {
1058
- if (m === void 0) {
1059
- ve.current = void 0;
1060
- return;
1061
- }
1062
- if (ve.current === m) return;
1063
- if (!Te && x !== void 0) {
1064
- let t = e.findIndex((e) => n(e) === m);
1065
- t !== -1 && J.scrollToIndex(t, { align: "auto" });
1066
- return;
1067
- }
1068
- let t = F.current?.querySelector(`[data-row-id="${CSS.escape(m)}"] [data-row-action]`);
1069
- if (t == null || t.matches(":disabled")) return;
1070
- let r = requestAnimationFrame(() => {
1071
- t.focus({ preventScroll: !0 }), document.activeElement === t && (ve.current = m);
1072
- });
1073
- return () => cancelAnimationFrame(r);
1074
- }, [
1075
- e,
1076
- m,
1077
- d?.disabled,
1078
- Te,
1079
- x,
1080
- n,
1081
- F,
1082
- J
1083
- ]);
1084
- let Ee = x !== void 0 && (e.length === 0 || J.range?.endIndex === e.length - 1);
1085
- S(() => {
1086
- Ee && D?.();
1087
- }, [
1088
- Ee,
1089
- D,
1090
- e.length
1091
- ]), C(() => {
1092
- if (G.current === void 0) return;
1093
- let e = Array.from(F.current?.querySelectorAll("[data-row-id]") ?? []).find((e) => e.dataset.rowId === G.current)?.querySelector("[data-row-action]");
1094
- e != null && (e.focus({ preventScroll: x !== void 0 }), G.current = void 0);
1095
- });
1096
- function De(t, r) {
1097
- let i = t.metaKey || t.ctrlKey, a = t.altKey || t.shiftKey;
1098
- if (i || a) return;
1099
- let o = Be.get(t.key);
1100
- if (o === void 0) return;
1101
- t.preventDefault();
1102
- let s = r + o, c = e[s];
1103
- c !== void 0 && (G.current = n(c), V(G.current), x !== void 0 && J.scrollToIndex(s, { align: "auto" }));
1104
- }
1105
- let Z = M.filter((e) => !ue || e.isSecondary !== !0).length + (c === void 0 ? 0 : 1), Oe = c === void 0 ? 0 : Re, ke = A != null && typeof A != "boolean" || j !== void 0, { minimumWidth: Ae, compactWidth: je } = Je(M, Oe), Me = J.getTotalSize() - (J.getVirtualItems().at(-1)?.end ?? R) + R;
1106
- return /* @__PURE__ */ k("div", {
1107
- ...h.props(Q.frame, Ge[be]),
1108
- children: [/* @__PURE__ */ k("div", {
1109
- ref: P.ref,
1110
- "data-table-viewport": !0,
1111
- role: "region",
1112
- "aria-label": r,
1113
- tabIndex: P.tabIndex,
1114
- ...h.props(Q.viewport, Ke[be], typeof x?.height == "number" && Q.virtual(x.height)),
1115
- children: [/* @__PURE__ */ k("table", {
1116
- "aria-busy": ce === "pending" || void 0,
1117
- "aria-rowcount": x === void 0 ? void 0 : Math.max(1, e.length) + 1,
1118
- ...h.props(Q.table, Q.fixed, Q.minimumWidth(Ae, je)),
1119
- children: [
1120
- /* @__PURE__ */ O(xe, {
1121
- ref: I,
1122
- captionElement: I,
1123
- "aria-label": r,
1124
- status: ce,
1125
- sort: a,
1126
- pagination: j,
1127
- isPlaceholder: le,
1128
- ...h.props(Q.caption, v && f.hidden),
1129
- children: r
1130
- }),
1131
- /* @__PURE__ */ O(Ze, {
1132
- columns: M,
1133
- canSelect: c !== void 0
1134
- }),
1135
- /* @__PURE__ */ O("thead", {
1136
- ref: L,
1137
- ...h.props(y && f.hidden),
1138
- children: /* @__PURE__ */ k("tr", { children: [c !== void 0 && /* @__PURE__ */ O("th", {
1139
- scope: "col",
1140
- className: "x9f619 x7wzq59 x13vifvy x11ru5tl x1krvmzm xt970qd xso031l x1q0q8m5 x1qndepd x153jb6y xpvm0e4 xj57cvi xy8obcc xas2l8k xuxw1ft x1d7z9mz xeuugli x1dc62k6",
1141
- children: /* @__PURE__ */ O("span", {
1142
- ...h.props(f.hidden),
1143
- children: "Select"
1144
- })
1145
- }), M.map((e) => {
1146
- let t = a?.columnId === e.id ? a.direction : void 0;
1147
- return /* @__PURE__ */ O("th", {
1148
- scope: "col",
1149
- title: e.label,
1150
- "aria-sort": t,
1151
- ...h.props(Q.header, We[e.role], e.width !== void 0 && Q.width(e.width), e.isSecondary === !0 && Q.secondary),
1152
- children: e.canSort === !0 && s !== void 0 ? /* @__PURE__ */ k(g, {
1153
- type: "button",
1154
- "aria-label": `Sort ${r} by ${e.label}`,
1155
- className: "x3nfvp2 x6s0dn4 x1hnptsi x193iq5w xeuugli x2zujid x17oiadl x1717udv xc342km x1heor9g xjbqb8w xjb2p0i x1qlqyl8 x1pd3egz x15bjb6t x1ypdohk xp9636p x1s9zmfe x13qnu6 x9v5kkp x19rmrnh x7s97pk",
1156
- onClick: () => {
1157
- s(t === "ascending" ? {
1158
- columnId: e.id,
1159
- direction: "descending"
1160
- } : t === "descending" ? void 0 : {
1161
- columnId: e.id,
1162
- direction: "ascending"
1163
- });
1164
- },
1165
- children: [/* @__PURE__ */ O("span", {
1166
- className: "x1lliihq xeuugli xb3r6kr xlyipyv xuxw1ft",
1167
- children: e.label
1168
- }), O(t === "ascending" ? oe : t === "descending" ? ae : se, {
1169
- size: 14,
1170
- "aria-hidden": "true",
1171
- className: "x2lah0s"
1172
- })]
1173
- }) : /* @__PURE__ */ O("span", {
1174
- className: "x1lliihq xeuugli xb3r6kr xlyipyv xuxw1ft",
1175
- children: e.label
1176
- })
1177
- }, e.id);
1178
- })] })
1179
- }),
1180
- /* @__PURE__ */ k("tbody", {
1181
- onPointerLeave: () => U(void 0),
1182
- onKeyDownCapture: () => U(void 0),
1183
- onBlur: (e) => {
1184
- e.currentTarget.contains(e.relatedTarget) || V(void 0);
1185
- },
1186
- children: [
1187
- we.map(({ row: e, index: t, spacerHeight: n }) => /* @__PURE__ */ k(ne, { children: [n > 0 && /* @__PURE__ */ O("tr", {
1188
- "aria-hidden": "true",
1189
- children: /* @__PURE__ */ O("td", {
1190
- colSpan: Z,
1191
- ...h.props(Q.spacer(n))
1192
- })
1193
- }), /* @__PURE__ */ k("tr", {
1194
- "data-index": t,
1195
- "data-row-id": e.id,
1196
- "aria-rowindex": x === void 0 ? void 0 : t + 2,
1197
- ref: x === void 0 || b === "fixed" ? void 0 : J.measureElement,
1198
- onPointerMove: (t) => {
1199
- t.pointerType === "mouse" && U(e.id);
1200
- },
1201
- onPointerEnter: (t) => {
1202
- t.pointerType === "mouse" && U(e.id);
1203
- },
1204
- onPointerLeave: () => {
1205
- U((t) => t === e.id ? void 0 : t);
1206
- },
1207
- onPointerDown: (e) => {
1208
- e.pointerType !== "mouse" && U(void 0);
1209
- },
1210
- onFocus: () => {
1211
- U(void 0), V(e.id);
1212
- },
1213
- ...{
1214
- 0: { className: "x1n2onr6 xc8icb0 x1wtzb06 xso031l x1q0q8m5 x1qndepd x19k386i x1t1lzn6" },
1215
- 2: { className: "x1n2onr6 xc8icb0 x1wtzb06 xso031l x1q0q8m5 x1qndepd x19k386i x1t1lzn6 x1ypdohk x1ecmtor" },
1216
- 1: { className: "x1n2onr6 xc8icb0 x1wtzb06 xso031l x1q0q8m5 x1qndepd x19k386i x1t1lzn6 x1r8u7ye" },
1217
- 3: { className: "x1n2onr6 xc8icb0 x1wtzb06 xso031l x1q0q8m5 x1qndepd x19k386i x1t1lzn6 x1ypdohk x1ecmtor x1r8u7ye" }
1218
- }[(d !== void 0 && d.disabled !== !0) << 1 | (c?.has(e.id) === !0 || p === e.id)],
1219
- children: [c !== void 0 && /* @__PURE__ */ O("td", {
1220
- className: "x9f619 xt970qd xxymvpz xj0a0fe x1d7z9mz xeuugli x1dc62k6 x1n2onr6 x1vjfegm",
1221
- children: /* @__PURE__ */ O(o.Root, {
1222
- "aria-label": u(e.original),
1223
- checked: c.has(e.id),
1224
- onCheckedChange: (t) => {
1225
- let n = new Set(c);
1226
- t ? n.add(e.id) : n.delete(e.id), l(n);
1227
- },
1228
- children: /* @__PURE__ */ O(o.Indicator, {})
1229
- })
1230
- }), M.map((n, i) => /* @__PURE__ */ O("td", {
1231
- "data-record-label": i === ye || void 0,
1232
- ...h.props(Q.cell, Ue[b], We[n.role], n.width !== void 0 && Q.width(n.width), n.isSecondary === !0 && Q.secondary),
1233
- children: d !== void 0 && i === ye ? /* @__PURE__ */ O(lt, {
1234
- recordId: e.id,
1235
- collection: r,
1236
- row: e.original,
1237
- action: d,
1238
- isActive: p === e.id,
1239
- onKeyDown: (e) => De(e, t),
1240
- children: /* @__PURE__ */ O(st, {
1241
- role: n.role,
1242
- isFixed: b === "fixed",
1243
- shouldTruncate: n.shouldTruncate,
1244
- children: n.cell(e.original)
1245
- })
1246
- }) : /* @__PURE__ */ O(st, {
1247
- role: n.role,
1248
- isFixed: b === "fixed",
1249
- shouldTruncate: n.shouldTruncate,
1250
- children: n.cell(e.original)
1251
- })
1252
- }, n.id))]
1253
- })] }, e.id)),
1254
- x !== void 0 && Me > 0 && /* @__PURE__ */ O("tr", {
1255
- "aria-hidden": "true",
1256
- children: /* @__PURE__ */ O("td", {
1257
- colSpan: Z,
1258
- ...h.props(Q.spacer(Me))
1259
- })
1260
- }),
1261
- e.length === 0 && /* @__PURE__ */ O("tr", { children: /* @__PURE__ */ O("td", {
1262
- colSpan: Z,
1263
- className: "x1717udv",
1264
- children: /* @__PURE__ */ O("div", {
1265
- className: "x9f619 x7wzq59 x1o0tod xzfn7dr x193iq5w x1ttojsm x2b8uid xeaf4i8 xj0a0fe x153jb6y",
1266
- children: i
1267
- })
1268
- }) })
1269
- ]
1270
- })
1271
- ]
1272
- }), /* @__PURE__ */ O("div", {
1273
- ref: ge,
1274
- ...{
1275
- 0: {},
1276
- 1: { className: "xid9utz xg7ukam x153jb6y xy8obcc xas2l8k x15x95ik x1az1eml" }
1277
- }[re !== void 0 | 0],
1278
- children: re
1279
- })]
1280
- }), ke && /* @__PURE__ */ k("div", {
1281
- className: "xg7ukam x178xt8z x13fuv20 xhjagg4",
1282
- children: [A, j !== void 0 && /* @__PURE__ */ O(_e, {
1283
- ...j,
1284
- label: r
1285
- })]
1286
- })]
1287
- });
1288
- }
1289
- function st({ role: e, isFixed: t, shouldTruncate: n, children: r }) {
1290
- let i = He[e], a = t && i.shouldTruncate, o = typeof r == "string" && (n ?? a);
1291
- return /* @__PURE__ */ O("span", {
1292
- ...{
1293
- 0: { className: "x78zum5 x6s0dn4 xeuugli xh8yej3 xw3im37" },
1294
- 1: { className: "x78zum5 x6s0dn4 xeuugli xh8yej3 xt7dq6l" }
1295
- }[!t | 0],
1296
- children: /* @__PURE__ */ O("span", {
1297
- "data-record-text": Le.has(typeof r) || void 0,
1298
- title: typeof r == "string" ? r : void 0,
1299
- ...{
1300
- 0: { className: "x1lliihq xeuugli xh8yej3 x193iq5w xkfz77 x1ljc890" },
1301
- 4: { className: "x1lliihq xeuugli xh8yej3 x193iq5w xkfz77 x1ljc890 x1l6neo7" },
1302
- 2: { className: "x1lliihq xeuugli xh8yej3 x193iq5w xkfz77 x1ljc890 xuxw1ft" },
1303
- 6: { className: "x1lliihq xeuugli xh8yej3 x193iq5w xkfz77 x1ljc890 x1l6neo7 xuxw1ft" },
1304
- 1: { className: "x1lliihq xeuugli xh8yej3 x193iq5w xkfz77 x1ljc890 xb3r6kr xuxw1ft xlyipyv" },
1305
- 5: { className: "x1lliihq xeuugli xh8yej3 x193iq5w xkfz77 x1ljc890 x1l6neo7 xb3r6kr xuxw1ft xlyipyv" },
1306
- 3: { className: "x1lliihq xeuugli xh8yej3 x193iq5w xkfz77 x1ljc890 xb3r6kr xuxw1ft xlyipyv" },
1307
- 7: { className: "x1lliihq xeuugli xh8yej3 x193iq5w xkfz77 x1ljc890 x1l6neo7 xb3r6kr xuxw1ft xlyipyv" }
1308
- }[!!t << 2 | !(!t || i.shouldTruncate) << 1 | !!o],
1309
- children: r
1310
- })
1311
- });
1312
- }
1313
- function ct(e) {
1314
- if (e.defaultPrevented || e.button !== 0) return !1;
1315
- let t = e.metaKey || e.ctrlKey, n = e.altKey || e.shiftKey;
1316
- return t || n ? !1 : e.detail === 0 || e.currentTarget.ownerDocument.getSelection()?.isCollapsed !== !1;
1317
- }
1318
- function lt({ collection: e, recordId: t, row: n, action: r, isActive: i, children: a, onKeyDown: o }) {
1319
- let s = r.label?.(n), c = r.href === void 0 ? /* @__PURE__ */ O(we, {
1320
- collection: e,
1321
- recordId: t,
1322
- type: "button",
1323
- disabled: r.disabled === !0,
1324
- "aria-label": s,
1325
- "aria-pressed": i,
1326
- "data-row-action": !0,
1327
- onKeyDown: o,
1328
- onClick: (e) => {
1329
- ct(e) && r.onActivate(n);
1330
- },
1331
- className: "x1rh3ycu x1hx0egp x78zum5 x6s0dn4 xh8yej3 xeuugli x17tes2r x17oiadl x1717udv xc342km x1ok0vyi x1heor9g xjbqb8w xjb2p0i x1qlqyl8 x1pd3egz x15bjb6t x16tdsg8 x1hl2dhg x1ypdohk x1t137rt x1s928wv x1j6awrg xarstr8 x11q50lq xa2q2qx x1x5eltu x1jdy9wv xtgyt42 x19mxcj1",
1332
- children: a
1333
- }) : /* @__PURE__ */ O(J, {
1334
- collection: e,
1335
- recordId: t,
1336
- href: r.href(n),
1337
- "aria-label": s,
1338
- "data-row-action": !0,
1339
- onKeyDown: o,
1340
- onClick: (e) => {
1341
- r.onActivate !== void 0 && ct(e) && (e.preventDefault(), r.onActivate(n));
1342
- },
1343
- className: "x1rh3ycu x1hx0egp x78zum5 x6s0dn4 xh8yej3 xeuugli x17tes2r x17oiadl x1717udv xc342km x1ok0vyi x1heor9g xjbqb8w xjb2p0i x1qlqyl8 x1pd3egz x15bjb6t x16tdsg8 x1hl2dhg x1ypdohk x1t137rt x1s928wv x1j6awrg xarstr8 x11q50lq xa2q2qx x1x5eltu x1jdy9wv xtgyt42 x19mxcj1",
1344
- children: a
1345
- });
1346
- return s === void 0 ? c : /* @__PURE__ */ k(u.Root, { children: [/* @__PURE__ */ O(u.Trigger, { render: c }), /* @__PURE__ */ O(u.Popup, {
1347
- side: "top",
1348
- align: "start",
1349
- children: s
1350
- })] });
1351
- }
1352
1808
  // packages/collections/src/collection-scroll.tsx
1353
- function ut(e) {
1809
+ function Pt(e) {
1354
1810
  switch (e.status) {
1355
- case "loading": return /* @__PURE__ */ O(n, {
1811
+ case "loading": return /* @__PURE__ */ N(n, {
1356
1812
  role: "status",
1357
1813
  variant: "caption",
1358
1814
  tone: "muted",
1359
1815
  children: e.message ?? "Loading…"
1360
1816
  });
1361
- case "complete": return e.message === void 0 ? null : /* @__PURE__ */ O(n, {
1817
+ case "complete": return e.message === void 0 ? null : /* @__PURE__ */ N(n, {
1362
1818
  variant: "caption",
1363
1819
  tone: "muted",
1364
1820
  children: e.message
1365
1821
  });
1366
- case "ready": return /* @__PURE__ */ O(a, {
1822
+ case "ready": return /* @__PURE__ */ N(t, {
1367
1823
  onClick: e.onLoadMore,
1368
1824
  children: e.message ?? "Load more"
1369
1825
  });
1370
- case "error": return /* @__PURE__ */ k(i, {
1826
+ case "error": return /* @__PURE__ */ P(i, {
1371
1827
  role: "status",
1372
- children: [/* @__PURE__ */ O(n, {
1828
+ children: [/* @__PURE__ */ N(n, {
1373
1829
  variant: "caption",
1374
1830
  tone: "muted",
1375
1831
  children: e.message ?? "More records could not be loaded."
1376
- }), /* @__PURE__ */ O(a, {
1832
+ }), /* @__PURE__ */ N(t, {
1377
1833
  onClick: e.onLoadMore,
1378
1834
  children: "Retry"
1379
1835
  })]
1380
1836
  });
1381
1837
  }
1382
1838
  }
1383
- function dt({ children: e, endContent: t, onEndReached: n, shouldFill: r = !1, endPosition: i = "end", label: a = "Collection" }) {
1384
- let o = te(), s = o.viewport, c = w(null);
1385
- Fe({
1839
+ function Ft({ children: e, endContent: t, onEndReached: n, shouldFill: r = !1, endPosition: i = "end", label: a = "Collection" }) {
1840
+ let o = ne(), s = o.viewport, c = D(null);
1841
+ it({
1386
1842
  end: c,
1387
1843
  viewport: r ? s : void 0,
1388
1844
  onEndReached: n,
1389
1845
  content: e
1390
1846
  });
1391
- let l = /* @__PURE__ */ O("div", {
1847
+ let l = /* @__PURE__ */ N("div", {
1392
1848
  ref: c,
1393
1849
  ...{
1394
1850
  0: {},
@@ -1396,7 +1852,7 @@ function dt({ children: e, endContent: t, onEndReached: n, shouldFill: r = !1, e
1396
1852
  }[t !== void 0 | 0],
1397
1853
  children: t
1398
1854
  });
1399
- return /* @__PURE__ */ k("div", {
1855
+ return /* @__PURE__ */ P("div", {
1400
1856
  ref: o.ref,
1401
1857
  role: r ? "region" : void 0,
1402
1858
  "aria-label": r ? a : void 0,
@@ -1413,26 +1869,27 @@ function dt({ children: e, endContent: t, onEndReached: n, shouldFill: r = !1, e
1413
1869
  });
1414
1870
  }
1415
1871
  // packages/collections/src/inspector.tsx
1416
- var ft = 860, pt = b(void 0);
1417
- function mt({ reading: e }) {
1872
+ var It = 860, Lt = x(void 0);
1873
+ function Rt({ reading: e }) {
1418
1874
  return { value: e };
1419
1875
  }
1420
- var ht = N({
1876
+ var zt = se({
1421
1877
  name: "detail-field",
1422
1878
  options: { reading: "string" },
1423
- state: mt,
1424
- sync: mt,
1879
+ state: Rt,
1880
+ sync: Rt,
1425
1881
  api: () => ({}),
1882
+ agent: { actions: [] },
1426
1883
  slots: (e) => ({ root: e({}) })
1427
- }), gt = _(ht, { root: "dd" }).Root;
1428
- function _t({ master: e, detail: t, label: n, masterLabel: r, revealKey: i, returnFocusRef: o, ...s }) {
1429
- let c = re(), l = w(null), u = w(null), d = w(null);
1430
- C(() => {
1431
- i !== void 0 && l.current !== null && d.current !== null && l.current.clientWidth <= ft && (d.current.focus({ preventScroll: !0 }), d.current.scrollIntoView({
1884
+ }), Bt = g(zt, { root: "dd" }).Root;
1885
+ function Vt({ master: e, detail: n, label: r, masterLabel: i, revealKey: a, returnFocusRef: o, ...s }) {
1886
+ let c = w(), l = D(null), u = D(null), d = D(null);
1887
+ T(() => {
1888
+ a !== void 0 && l.current !== null && d.current !== null && l.current.clientWidth <= It && (d.current.focus({ preventScroll: !0 }), d.current.scrollIntoView({
1432
1889
  block: "start",
1433
1890
  behavior: "instant"
1434
1891
  }));
1435
- }, [i]);
1892
+ }, [a]);
1436
1893
  function f() {
1437
1894
  let e = o?.current ?? u.current;
1438
1895
  e?.focus({ preventScroll: !0 }), e?.scrollIntoView({
@@ -1440,62 +1897,62 @@ function _t({ master: e, detail: t, label: n, masterLabel: r, revealKey: i, retu
1440
1897
  behavior: "instant"
1441
1898
  });
1442
1899
  }
1443
- return /* @__PURE__ */ O("div", {
1444
- ...v({ className: "x9vvk8s x12h1iku xeuugli xbixft x1hz01jw xtqrqnz x1778rvt" }, s),
1445
- children: /* @__PURE__ */ k("div", {
1900
+ return /* @__PURE__ */ N("div", {
1901
+ ..._({ className: "x9vvk8s x12h1iku xeuugli xbixft x1hz01jw xtqrqnz x1778rvt" }, s),
1902
+ children: /* @__PURE__ */ P("div", {
1446
1903
  ref: l,
1447
1904
  className: "xrvj5dj x4ruv2j x1y7acmc x7a106z x1j825kq xeuugli",
1448
- children: [/* @__PURE__ */ O("div", {
1905
+ children: [/* @__PURE__ */ N("div", {
1449
1906
  ref: u,
1450
1907
  role: "group",
1451
- "aria-label": r,
1908
+ "aria-label": i,
1452
1909
  "aria-details": c,
1453
1910
  tabIndex: -1,
1454
1911
  className: "xeuugli",
1455
1912
  children: e
1456
- }), /* @__PURE__ */ k("aside", {
1913
+ }), /* @__PURE__ */ P("aside", {
1457
1914
  ref: d,
1458
1915
  id: c,
1459
- "aria-label": n,
1916
+ "aria-label": r,
1460
1917
  tabIndex: -1,
1461
1918
  className: "x7wzq59 x7cfggw xqfmuo8 xeuugli x1sbza1b xhuqrux xexx8yu xdz7uhd xpilrb4 xdctr63 x1t7ytsu x97x49r x972fbf x1mg79u0 x13fuv20 xhjagg4 x14ijc3v x13qnu6 x9v5kkp x19rmrnh x12ijfkc",
1462
- children: [/* @__PURE__ */ O("div", {
1919
+ children: [/* @__PURE__ */ N("div", {
1463
1920
  className: "x1s85apg x1yamub6 x1xxlxpq",
1464
- children: /* @__PURE__ */ k(a, {
1921
+ children: /* @__PURE__ */ P(t, {
1465
1922
  variant: "ghost",
1466
1923
  onClick: f,
1467
- children: ["Back to ", r.toLowerCase()]
1924
+ children: ["Back to ", i.toLowerCase()]
1468
1925
  })
1469
- }), /* @__PURE__ */ O(pt.Provider, {
1470
- value: n,
1471
- children: t
1926
+ }), /* @__PURE__ */ N(Lt.Provider, {
1927
+ value: r,
1928
+ children: n
1472
1929
  })]
1473
1930
  })]
1474
1931
  })
1475
1932
  });
1476
1933
  }
1477
- function vt({ value: e, label: t }) {
1934
+ function Ht({ value: e, label: t }) {
1478
1935
  let n = typeof e == "number" ? String(e) : e;
1479
- return typeof n == "string" ? /* @__PURE__ */ O(gt, {
1936
+ return typeof n == "string" ? /* @__PURE__ */ N(Bt, {
1480
1937
  "aria-label": t,
1481
1938
  reading: n,
1482
1939
  className: "xeuugli x1ghz6dp xbixft xj0a0fe xss6m8b",
1483
1940
  children: n
1484
- }) : /* @__PURE__ */ O("dd", {
1941
+ }) : /* @__PURE__ */ N("dd", {
1485
1942
  className: "xeuugli x1ghz6dp xbixft xj0a0fe xss6m8b",
1486
1943
  children: e
1487
1944
  });
1488
1945
  }
1489
- function yt({ items: e, ...t }) {
1490
- let n = x(pt), r = t["aria-label"] ?? n;
1491
- return /* @__PURE__ */ O("dl", {
1492
- ...v({ className: "x1ghz6dp xrvj5dj xezdspq x1i3977y xuytk5h x1hz01jw xvmahel xtqrqnz x1778rvt" }, t),
1493
- children: e.map(({ label: e, value: t }) => /* @__PURE__ */ k("div", {
1946
+ function Ut({ items: e, ...t }) {
1947
+ let n = S(Lt), r = t["aria-label"] ?? n;
1948
+ return /* @__PURE__ */ N("dl", {
1949
+ ..._({ className: "x1ghz6dp xrvj5dj xezdspq x1i3977y xuytk5h x1hz01jw xvmahel xtqrqnz x1778rvt" }, t),
1950
+ children: e.map(({ label: e, value: t }) => /* @__PURE__ */ P("div", {
1494
1951
  className: "xjp7ctv",
1495
- children: [/* @__PURE__ */ O("dt", {
1952
+ children: [/* @__PURE__ */ N("dt", {
1496
1953
  className: "xeuugli x153jb6y xj0a0fe",
1497
1954
  children: e
1498
- }), /* @__PURE__ */ O(vt, {
1955
+ }), /* @__PURE__ */ N(Ht, {
1499
1956
  value: t,
1500
1957
  label: r === void 0 ? e : `${r} · ${e}`
1501
1958
  })]
@@ -1503,13 +1960,13 @@ function yt({ items: e, ...t }) {
1503
1960
  });
1504
1961
  }
1505
1962
  // packages/collections/src/list-footer.tsx
1506
- function bt({ children: e, actions: t, ...n }) {
1507
- return /* @__PURE__ */ k("div", {
1508
- ...v({ className: "x78zum5 x6s0dn4 x1qughib x1a02dak xeuugli x1n8ia3y x1qokhjc x1m92p3w x178xt8z x13fuv20 xhjagg4 x153jb6y x1hz01jw xvmahel xtqrqnz x1778rvt" }, n),
1509
- children: [/* @__PURE__ */ O("div", {
1963
+ function Wt({ children: e, actions: t, ...n }) {
1964
+ return /* @__PURE__ */ P("div", {
1965
+ ..._({ className: "x78zum5 x6s0dn4 x1qughib x1a02dak xeuugli x1n8ia3y x1qokhjc x1m92p3w x178xt8z x13fuv20 xhjagg4 x153jb6y x1hz01jw xvmahel xtqrqnz x1778rvt" }, n),
1966
+ children: [/* @__PURE__ */ N("div", {
1510
1967
  className: "xeuugli xj0a0fe",
1511
1968
  children: e
1512
- }), t != null && /* @__PURE__ */ O("div", {
1969
+ }), t != null && /* @__PURE__ */ N("div", {
1513
1970
  className: "x78zum5 x6s0dn4 x1a02dak x1hnptsi xeuugli",
1514
1971
  children: t
1515
1972
  })]
@@ -1609,7 +2066,7 @@ var $ = {
1609
2066
  kCS8Yb: "x1l7klhg",
1610
2067
  $$css: !0
1611
2068
  }
1612
- }, xt = {
2069
+ }, Gt = {
1613
2070
  inline: {
1614
2071
  metric: void 0,
1615
2072
  label: void 0,
@@ -1631,31 +2088,31 @@ var $ = {
1631
2088
  detail: void 0,
1632
2089
  valueWidth: "9ch"
1633
2090
  }
1634
- }, St = {
2091
+ }, Kt = {
1635
2092
  inline: $.grid,
1636
2093
  columns: $.columns
1637
2094
  };
1638
- function Ct({ layout: e = "inline", ...t }) {
1639
- return /* @__PURE__ */ O("dl", { ...v(h.props(St[e]), t) });
2095
+ function qt({ layout: e = "inline", ...t }) {
2096
+ return /* @__PURE__ */ N("dl", { ..._(m.props(Kt[e]), t) });
1640
2097
  }
1641
- function wt({ label: e, value: t, detail: n, isLoading: r = !1, hasDetail: i = !1, variant: a = "inline", trend: o, ...s }) {
1642
- let c = xt[a];
1643
- return /* @__PURE__ */ k("div", {
1644
- ...v(h.props($.metric, c.metric), s),
2098
+ function Jt({ label: e, value: t, detail: n, isLoading: r = !1, hasDetail: i = !1, variant: a = "inline", trend: o, ...s }) {
2099
+ let c = Gt[a];
2100
+ return /* @__PURE__ */ P("div", {
2101
+ ..._(m.props($.metric, c.metric), s),
1645
2102
  children: [
1646
- /* @__PURE__ */ O("dt", {
1647
- ...h.props($.label, c.label),
2103
+ /* @__PURE__ */ N("dt", {
2104
+ ...m.props($.label, c.label),
1648
2105
  children: e
1649
2106
  }),
1650
- /* @__PURE__ */ O("dd", {
1651
- ...h.props($.value, c.value),
1652
- children: r ? /* @__PURE__ */ O(d, { width: c.valueWidth }) : t
2107
+ /* @__PURE__ */ N("dd", {
2108
+ ...m.props($.value, c.value),
2109
+ children: r ? /* @__PURE__ */ N(d, { width: c.valueWidth }) : t
1653
2110
  }),
1654
- (r ? i : n !== void 0) && /* @__PURE__ */ O("dd", {
1655
- ...h.props($.detail, c.detail),
1656
- children: r ? /* @__PURE__ */ O(d, { width: "24ch" }) : n
2111
+ (r ? i : n !== void 0) && /* @__PURE__ */ N("dd", {
2112
+ ...m.props($.detail, c.detail),
2113
+ children: r ? /* @__PURE__ */ N(d, { width: "24ch" }) : n
1657
2114
  }),
1658
- o !== void 0 && /* @__PURE__ */ O("dd", {
2115
+ o !== void 0 && /* @__PURE__ */ N("dd", {
1659
2116
  className: "x1ghz6dp xeuugli xh8yej3 xkh2ocl",
1660
2117
  children: o
1661
2118
  })
@@ -1663,64 +2120,67 @@ function wt({ label: e, value: t, detail: n, isLoading: r = !1, hasDetail: i = !
1663
2120
  });
1664
2121
  }
1665
2122
  // packages/collections/src/timestamp.tsx
1666
- function Tt({ dateTime: e, label: t, title: n }) {
1667
- return n === void 0 ? /* @__PURE__ */ O("time", {
2123
+ function Yt({ dateTime: e, label: t, title: n }) {
2124
+ return n === void 0 ? /* @__PURE__ */ N("time", {
1668
2125
  dateTime: e,
1669
2126
  className: "x1hz01jw xy8obcc xas2l8k x153jb6y xss6m8b xj0a0fe x13qnu6 x9v5kkp x19rmrnh x7s97pk",
1670
2127
  children: t
1671
- }) : /* @__PURE__ */ k(u.Root, { children: [/* @__PURE__ */ O(u.Trigger, {
1672
- render: /* @__PURE__ */ O("time", {
2128
+ }) : /* @__PURE__ */ P(u.Root, { children: [/* @__PURE__ */ N(u.Trigger, {
2129
+ render: /* @__PURE__ */ N("time", {
1673
2130
  dateTime: e,
1674
2131
  tabIndex: 0,
1675
2132
  "aria-label": n,
1676
2133
  className: "x1hz01jw xy8obcc xas2l8k x153jb6y xss6m8b xj0a0fe x13qnu6 x9v5kkp x19rmrnh x7s97pk"
1677
2134
  }),
1678
2135
  children: t
1679
- }), /* @__PURE__ */ O(u.Popup, { children: n })] });
2136
+ }), /* @__PURE__ */ N(u.Popup, { children: n })] });
1680
2137
  }
1681
2138
  // packages/collections/src/timeline.tsx
1682
- function Et({ label: e, children: t }) {
1683
- return /* @__PURE__ */ O("ol", {
2139
+ function Xt({ label: e, children: t }) {
2140
+ return /* @__PURE__ */ N(Se, {
1684
2141
  "aria-label": e,
2142
+ render: /* @__PURE__ */ N("ol", {}),
1685
2143
  className: "xe8uvvx x1ghz6dp x1717udv xeuugli",
1686
2144
  children: t
1687
2145
  });
1688
2146
  }
1689
- function Dt({ icon: e, title: n, time: r, metadata: i, children: a, details: o, defaultOpen: s = !1 }) {
1690
- let [c, l] = T(s), u = /* @__PURE__ */ k("div", {
2147
+ function Zt({ icon: e, title: t, time: n, metadata: r, children: i, details: a, defaultOpen: s = !1 }) {
2148
+ let [c, l] = O(s), u = /* @__PURE__ */ P("div", {
1691
2149
  className: "x78zum5 x1pha0wt x1hnptsi x1a02dak xeuugli",
1692
- children: [/* @__PURE__ */ O("div", {
2150
+ children: [/* @__PURE__ */ N(Ee, {
1693
2151
  className: "xeuugli xk4h15q xj0a0fe",
1694
- children: o === void 0 ? n : /* @__PURE__ */ O(t.Trigger, {
2152
+ children: a === void 0 ? t : /* @__PURE__ */ N(o.Trigger, {
1695
2153
  className: "x14atkfc x16exltd x17oiadl xt970qd xlqzeqv",
1696
- children: n
2154
+ children: t
1697
2155
  })
1698
- }), r != null && /* @__PURE__ */ O("div", {
2156
+ }), n != null && /* @__PURE__ */ N(V, {
2157
+ render: /* @__PURE__ */ N("div", {}),
1699
2158
  className: "xeuugli x153jb6y xy8obcc xas2l8k xss6m8b xj0a0fe",
1700
- children: r
2159
+ children: n
1701
2160
  })]
1702
- }), d = /* @__PURE__ */ k(D, { children: [
2161
+ }), d = /* @__PURE__ */ P(le, { children: [
1703
2162
  u,
1704
- a != null && (!c || o === void 0) && /* @__PURE__ */ O("div", {
2163
+ i != null && (!c || a === void 0) && /* @__PURE__ */ N(Ce, {
1705
2164
  className: "xeuugli x1ewvobj xj0a0fe",
1706
- children: a
2165
+ children: i
1707
2166
  }),
1708
- i != null && /* @__PURE__ */ O("div", {
2167
+ r != null && /* @__PURE__ */ N("div", {
1709
2168
  className: "xeuugli x153jb6y xy8obcc xas2l8k xj0a0fe",
1710
- children: i
2169
+ children: r
1711
2170
  }),
1712
- o !== void 0 && /* @__PURE__ */ O(t.Panel, { children: o })
2171
+ a !== void 0 && /* @__PURE__ */ N(o.Panel, { children: a })
1713
2172
  ] });
1714
- return /* @__PURE__ */ k("li", {
1715
- className: "x1n2onr6 xrvj5dj x1eqwfih x1y1mm1b xhlx3wy xeuugli x1hz01jw xvmahel xtqrqnz x1778rvt xbixft x1cpjm7i x1hmns74 x1lk18uv x1gi6gvw x1jw5pjq x1vgi0k x1mi36wk x1wse844 xup0pd7",
1716
- children: [/* @__PURE__ */ O("span", {
1717
- "aria-hidden": !0,
2173
+ return /* @__PURE__ */ P(we, {
2174
+ render: /* @__PURE__ */ N("li", {}),
2175
+ className: "x1n2onr6 xrvj5dj x1eqwfih x1y1mm1b xhlx3wy xeuugli x1hz01jw xvmahel xtqrqnz x1778rvt xbixft x1cpjm7i x1hmns74 x1lk18uv x1gi6gvw x1jw5pjq x1vgi0k x1mi36wk x1wse844 xup0pd7 x1t137rt x13qnu6 x9v5kkp x19rmrnh x7s97pk",
2176
+ children: [/* @__PURE__ */ N(Te, {
2177
+ render: /* @__PURE__ */ N("span", {}),
1718
2178
  className: "x78zum5 x6s0dn4 xl56j7k x1b1e0sl x153jb6y",
1719
2179
  children: e
1720
- }), o === void 0 ? /* @__PURE__ */ O("div", {
2180
+ }), a === void 0 ? /* @__PURE__ */ N("div", {
1721
2181
  className: "xrvj5dj x1hnptsi xeuugli",
1722
2182
  children: d
1723
- }) : /* @__PURE__ */ O(t.Root, {
2183
+ }) : /* @__PURE__ */ N(o.Root, {
1724
2184
  open: c,
1725
2185
  onOpenChange: l,
1726
2186
  className: "xrvj5dj x1hnptsi xeuugli xh8yej3",
@@ -1728,8 +2188,8 @@ function Dt({ icon: e, title: n, time: r, metadata: i, children: a, details: o,
1728
2188
  })]
1729
2189
  });
1730
2190
  }
1731
- var Ot = {
1732
- Root: Et,
1733
- Item: Dt
2191
+ var Qt = {
2192
+ Root: Xt,
2193
+ Item: Zt
1734
2194
  };
1735
- export { ut as CollectionEnd, De as CollectionFilters, _e as CollectionPagination, dt as CollectionScroll, I as CollectionToolbar, nt as DataTable, Qe as DataTablePlaceholder, et as DataTableText, tt as DataTableTextPlaceholder, yt as Details, R as DisplayOptions, L as FilterChips, _t as Inspector, bt as ListFooter, wt as Metric, Ct as MetricGrid, V as TableQueryFrame, Ot as Timeline, Tt as Timestamp, Pe as useCollectionControls, W as useLocalTableQuery };
2195
+ export { Pt as CollectionEnd, bt as CollectionFilters, ke as CollectionPagination, Ft as CollectionScroll, G as CollectionToolbar, At as DataTable, kt as DataTablePlaceholder, Ne as DataTableText, Pe as DataTableTextPlaceholder, Ut as Details, Oe as DisplayOptions, K as FilterChips, Vt as Inspector, Wt as ListFooter, Jt as Metric, qt as MetricGrid, dt as TableQueryFrame, Qt as Timeline, Yt as Timestamp, Ot as useCollectionControls, mt as useLocalTableQuery };