@inkeep/cxkit-primitives 0.5.47 → 0.5.49

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.
@@ -1,30 +1,30 @@
1
- import { jsxs as te, jsx as p } from "react/jsx-runtime";
2
- import * as K from "@radix-ui/react-dialog";
1
+ import { jsxs as Z, jsx as p } from "react/jsx-runtime";
2
+ import { Root as Se, Portal as Ee, Overlay as Ce, Content as we } from "../dialog.js";
3
3
  import * as c from "react";
4
- import { useCallback as ue, useMemo as Ee } from "react";
5
- import { commandScore as Ce } from "./command-score.js";
6
- import { Primitive as I } from "@radix-ui/react-primitive";
7
- import { useId as T } from "@radix-ui/react-id";
8
- import { s as we } from "../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
9
- import { ASK_AI_TRIGGER_VALUE as ye } from "../../constants/search.js";
10
- import { composeEventHandlers as Re } from "../../utils/compose-event-handlers.js";
11
- import { useShadow as Ie } from "../shadow/context.js";
12
- const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-heading=""]', fe = '[cmdk-item=""]', de = `${fe}:not([aria-disabled="true"])`, ee = "cmdk-item-select", L = "data-value", xe = (t, n, r) => Ce(t, n, r ?? []), me = c.createContext(void 0), O = () => c.useContext(me), ve = c.createContext(void 0), re = () => c.useContext(ve), he = c.createContext(void 0), ge = c.forwardRef((t, n) => {
13
- const r = M(() => /* @__PURE__ */ new Set()), i = M(() => /* @__PURE__ */ new Map()), u = M(() => /* @__PURE__ */ new Map()), f = M(() => /* @__PURE__ */ new Set()), s = pe(t), {
14
- label: v,
4
+ import { useCallback as le, useMemo as ye } from "react";
5
+ import { commandScore as Ie } from "./command-score.js";
6
+ import { Primitive as R } from "@radix-ui/react-primitive";
7
+ import { useId as F } from "@radix-ui/react-id";
8
+ import { s as Re } from "../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
9
+ import { ASK_AI_TRIGGER_VALUE as ke } from "../../constants/search.js";
10
+ import { composeEventHandlers as xe } from "../../utils/compose-event-handlers.js";
11
+ import { useShadow as Ae } from "../shadow/context.js";
12
+ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-heading=""]', ae = '[cmdk-item=""]', ue = `${ae}:not([aria-disabled="true"])`, Y = "cmdk-item-select", L = "data-value", Le = (t, n, r) => Ie(t, n, r ?? []), de = c.createContext(void 0), D = () => c.useContext(de), fe = c.createContext(void 0), ee = () => c.useContext(fe), me = c.createContext(void 0), he = c.forwardRef((t, n) => {
13
+ const r = M(() => /* @__PURE__ */ new Set()), i = M(() => /* @__PURE__ */ new Map()), a = M(() => /* @__PURE__ */ new Map()), f = M(() => /* @__PURE__ */ new Set()), s = ve(t), {
14
+ label: h,
15
15
  children: d,
16
16
  value: S,
17
17
  onValueChange: C,
18
18
  filter: y,
19
19
  shouldFilter: w,
20
- loop: R,
20
+ loop: I,
21
21
  disablePointerSelection: _ = !1,
22
- vimBindings: N = !0,
23
- defaultSearch: ne,
24
- ...U
25
- } = t, h = M(() => ({
22
+ vimBindings: B = !0,
23
+ defaultSearch: te,
24
+ ...N
25
+ } = t, v = M(() => ({
26
26
  /** Value of the search query. */
27
- search: ne ?? "",
27
+ search: te ?? "",
28
28
  /** Currently selected item value. */
29
29
  value: t.value ?? t.defaultValue ?? "",
30
30
  /** Currently selected item id. */
@@ -37,27 +37,27 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
37
37
  /** Set of groups with at least one visible item. */
38
38
  groups: /* @__PURE__ */ new Set()
39
39
  }
40
- })), $ = T(), j = T(), q = T(), k = c.useRef(null), g = Ge();
40
+ })), U = F(), $ = F(), j = F(), k = c.useRef(null), g = Ne();
41
41
  A(() => {
42
42
  if (S !== void 0) {
43
43
  const e = S.trim();
44
- h.current.value = e, E.emit();
44
+ v.current.value = e, E.emit();
45
45
  }
46
46
  }, [S]), A(() => {
47
- g(6, ce);
47
+ g(6, ne);
48
48
  }, []);
49
- const G = Ie(), E = c.useMemo(() => ({
49
+ const G = Ae(), E = c.useMemo(() => ({
50
50
  subscribe: (e) => (f.current.add(e), () => f.current.delete(e)),
51
- snapshot: () => h.current,
51
+ snapshot: () => v.current,
52
52
  setState: (e, l, o) => {
53
- if (!Object.is(h.current[e], l)) {
54
- if (h.current[e] = l, e === "search")
55
- J(), z(), g(1, W);
53
+ if (!Object.is(v.current[e], l)) {
54
+ if (v.current[e] = l, e === "search")
55
+ W(), z(), g(1, H);
56
56
  else if (e === "value" && (G?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input") || g(1, () => {
57
57
  x()?.focus();
58
58
  }), g(7, () => {
59
- h.current.selectedItemId = x()?.id, E.emit();
60
- }), o || g(5, ce), s.current?.value !== void 0)) {
59
+ v.current.selectedItemId = x()?.id, E.emit();
60
+ }), o || g(5, ne), s.current?.value !== void 0)) {
61
61
  const b = l ?? "";
62
62
  s.current.onValueChange?.(b);
63
63
  return;
@@ -68,167 +68,159 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
68
68
  emit: () => {
69
69
  f.current.forEach((e) => e());
70
70
  }
71
- }), []), H = c.useMemo(
71
+ }), []), q = c.useMemo(
72
72
  () => ({
73
73
  // Keep id → {value, keywords} mapping up-to-date
74
74
  value: (e, l, o) => {
75
- l !== u.current.get(e)?.value && (u.current.set(e, { value: l, keywords: o }), h.current.filtered.items.set(e, oe(l, o)), g(2, () => {
75
+ l !== a.current.get(e)?.value && (a.current.set(e, { value: l, keywords: o }), v.current.filtered.items.set(e, re(l, o)), g(2, () => {
76
76
  z(), E.emit();
77
77
  }));
78
78
  },
79
79
  // Track item lifecycle (mount, unmount)
80
80
  item: (e, l) => (r.current.add(e), l && (i.current.has(l) ? i.current?.get(l)?.add(e) : i.current.set(l, /* @__PURE__ */ new Set([e]))), g(3, () => {
81
- J(), z(), h.current.value || W(), E.emit();
81
+ W(), z(), v.current.value || H(), E.emit();
82
82
  }), () => {
83
- u.current.delete(e), r.current.delete(e), h.current.filtered.items.delete(e);
83
+ a.current.delete(e), r.current.delete(e), v.current.filtered.items.delete(e);
84
84
  const o = x();
85
85
  g(4, () => {
86
- J(), o?.getAttribute("id") === e && W(), E.emit();
86
+ W(), o?.getAttribute("id") === e && H(), E.emit();
87
87
  });
88
88
  }),
89
89
  // Track group lifecycle (mount, unmount)
90
90
  group: (e) => (i.current.has(e) || i.current.set(e, /* @__PURE__ */ new Set()), () => {
91
- u.current.delete(e), i.current.delete(e);
91
+ a.current.delete(e), i.current.delete(e);
92
92
  }),
93
93
  filter: () => !!s.current.shouldFilter,
94
- label: v || t["aria-label"] || "",
94
+ label: h || t["aria-label"] || "",
95
95
  getDisablePointerSelection: () => !!s.current.disablePointerSelection,
96
- listId: $,
97
- inputId: q,
98
- labelId: j,
96
+ listId: U,
97
+ inputId: j,
98
+ labelId: $,
99
99
  listInnerRef: k
100
100
  }),
101
101
  []
102
102
  );
103
- function oe(e, l) {
104
- const o = s.current?.filter ?? xe;
105
- return e ? o?.(e, h.current.search, l) : 0;
103
+ function re(e, l) {
104
+ const o = s.current?.filter ?? Le;
105
+ return e ? o?.(e, v.current.search, l) : 0;
106
106
  }
107
107
  function z() {
108
- if (!h.current.search || // Explicitly false, because true | undefined is the default
108
+ if (!v.current.search || // Explicitly false, because true | undefined is the default
109
109
  s.current.shouldFilter === !1)
110
110
  return;
111
- const e = h.current.filtered.items, l = [];
112
- h.current.filtered.groups.forEach((a) => {
113
- const m = i.current.get(a);
111
+ const e = v.current.filtered.items, l = [];
112
+ v.current.filtered.groups.forEach((u) => {
113
+ const m = i.current.get(u);
114
114
  let b = 0;
115
- m.forEach((Y) => {
116
- const Se = e.get(Y);
117
- b = Math.max(Se, b);
118
- }), l.push([a, b]);
115
+ m.forEach((Q) => {
116
+ const be = e.get(Q);
117
+ b = Math.max(be, b);
118
+ }), l.push([u, b]);
119
119
  });
120
120
  const o = k.current;
121
- V().sort((a, m) => {
122
- const b = a.getAttribute("id"), Y = m.getAttribute("id");
123
- return (e.get(Y) ?? 0) - (e.get(b) ?? 0);
124
- }).forEach((a) => {
125
- const m = a.closest(Z);
121
+ V().sort((u, m) => {
122
+ const b = u.getAttribute("id"), Q = m.getAttribute("id");
123
+ return (e.get(Q) ?? 0) - (e.get(b) ?? 0);
124
+ }).forEach((u) => {
125
+ const m = u.closest(X);
126
126
  if (m) {
127
- const b = a.parentElement === m ? a : a.closest(`${Z} > *`);
127
+ const b = u.parentElement === m ? u : u.closest(`${X} > *`);
128
128
  b && m.appendChild(b);
129
129
  } else {
130
- const b = a.parentElement === o ? a : a.closest(`${Z} > *`);
130
+ const b = u.parentElement === o ? u : u.closest(`${X} > *`);
131
131
  b && o?.appendChild(b);
132
132
  }
133
- }), l.sort((a, m) => m[1] - a[1]).forEach((a) => {
133
+ }), l.sort((u, m) => m[1] - u[1]).forEach((u) => {
134
134
  const m = k.current?.querySelector(
135
- `${D}[${L}="${encodeURIComponent(a[0])}"]`
135
+ `${T}[${L}="${encodeURIComponent(u[0])}"]`
136
136
  );
137
137
  m?.parentElement?.appendChild(m);
138
138
  });
139
139
  }
140
- function W() {
140
+ function H() {
141
141
  const l = V().find(
142
- (o) => o.getAttribute("aria-disabled") !== "true" && o.getAttribute("data-value") !== ye
142
+ (o) => o.getAttribute("aria-disabled") !== "true" && o.getAttribute("data-value") !== ke
143
143
  )?.getAttribute(L);
144
144
  E.setState("value", l || void 0);
145
145
  }
146
- function J() {
147
- if (!h.current.search || // Explicitly false, because true | undefined is the default
146
+ function W() {
147
+ if (!v.current.search || // Explicitly false, because true | undefined is the default
148
148
  s.current.shouldFilter === !1) {
149
- h.current.filtered.count = r.current.size;
149
+ v.current.filtered.count = r.current.size;
150
150
  return;
151
151
  }
152
- h.current.filtered.groups = /* @__PURE__ */ new Set();
152
+ v.current.filtered.groups = /* @__PURE__ */ new Set();
153
153
  let e = 0;
154
154
  for (const l of r.current) {
155
- const o = u.current.get(l)?.value ?? "", a = u.current.get(l)?.keywords ?? [], m = oe(o, a);
156
- h.current.filtered.items.set(l, m), m > 0 && e++;
155
+ const o = a.current.get(l)?.value ?? "", u = a.current.get(l)?.keywords ?? [], m = re(o, u);
156
+ v.current.filtered.items.set(l, m), m > 0 && e++;
157
157
  }
158
158
  for (const [l, o] of i.current)
159
- for (const a of o) {
160
- const m = h.current.filtered.items.get(a);
159
+ for (const u of o) {
160
+ const m = v.current.filtered.items.get(u);
161
161
  if (m && m > 0) {
162
- h.current.filtered.groups.add(l);
162
+ v.current.filtered.groups.add(l);
163
163
  break;
164
164
  }
165
165
  }
166
- h.current.filtered.count = e;
166
+ v.current.filtered.count = e;
167
167
  }
168
- function ce() {
168
+ function ne() {
169
169
  const e = x();
170
- e && (e.parentElement?.firstChild === e && e.closest(D)?.querySelector(ke)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
170
+ e && (e.parentElement?.firstChild === e && e.closest(T)?.querySelector(_e)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
171
171
  }
172
172
  function x() {
173
- return k.current?.querySelector(`${fe}[aria-selected="true"]`);
173
+ return k.current?.querySelector(`${ae}[aria-selected="true"]`);
174
174
  }
175
175
  function V() {
176
- return Array.from(k.current?.querySelectorAll(de) || []);
176
+ return Array.from(k.current?.querySelectorAll(ue) || []);
177
177
  }
178
- function Q(e) {
178
+ function oe(e) {
179
179
  const o = V()[e];
180
180
  o && E.setState("value", o.getAttribute(L));
181
181
  }
182
- function X(e) {
183
- const l = x(), o = V(), a = o.findIndex((b) => b === l);
184
- let m = o[a + e];
185
- s.current?.loop && (m = a + e < 0 ? o[o.length - 1] : a + e === o.length ? o[0] : o[a + e]), m && E.setState("value", m.getAttribute(L));
182
+ function J(e) {
183
+ const l = x(), o = V(), u = o.findIndex((b) => b === l);
184
+ let m = o[u + e];
185
+ s.current?.loop && (m = u + e < 0 ? o[o.length - 1] : u + e === o.length ? o[0] : o[u + e]), m && E.setState("value", m.getAttribute(L));
186
186
  }
187
- function se(e) {
188
- let o = x()?.closest(D), a;
189
- for (; o && !a; )
190
- o = e > 0 ? Fe(o, D) : Oe(o, D), a = o?.querySelector(de);
191
- a ? E.setState("value", a.getAttribute(L)) : X(e);
187
+ function ce(e) {
188
+ let o = x()?.closest(T), u;
189
+ for (; o && !u; )
190
+ o = e > 0 ? Ke(o, T) : Be(o, T), u = o?.querySelector(ue);
191
+ u ? E.setState("value", u.getAttribute(L)) : J(e);
192
192
  }
193
- const ie = () => Q(V().length - 1), le = (e) => {
194
- e.preventDefault(), e.metaKey ? ie() : e.altKey ? se(1) : X(1);
195
- }, ae = (e) => {
196
- e.preventDefault(), e.metaKey ? Q(0) : e.altKey ? se(-1) : X(-1);
193
+ const pe = () => oe(V().length - 1), se = (e) => {
194
+ e.preventDefault(), e.metaKey ? pe() : e.altKey ? ce(1) : J(1);
195
+ }, ie = (e) => {
196
+ e.preventDefault(), e.metaKey ? oe(0) : e.altKey ? ce(-1) : J(-1);
197
197
  };
198
- return /* @__PURE__ */ te(
199
- I.div,
198
+ return /* @__PURE__ */ Z(
199
+ R.div,
200
200
  {
201
201
  ref: n,
202
202
  tabIndex: -1,
203
- ...U,
203
+ ...N,
204
204
  "cmdk-root": "",
205
205
  onKeyDown: (e) => {
206
- if (U.onKeyDown?.(e), !e.defaultPrevented)
206
+ if (N.onKeyDown?.(e), !e.defaultPrevented)
207
207
  switch (e.key) {
208
208
  case "n":
209
209
  case "j": {
210
- N && e.ctrlKey && le(e);
210
+ B && e.ctrlKey && se(e);
211
211
  break;
212
212
  }
213
213
  case "ArrowDown": {
214
- le(e);
214
+ se(e);
215
215
  break;
216
216
  }
217
217
  case "p":
218
218
  case "k": {
219
- N && e.ctrlKey && ae(e);
219
+ B && e.ctrlKey && ie(e);
220
220
  break;
221
221
  }
222
222
  case "ArrowUp": {
223
- ae(e);
224
- break;
225
- }
226
- case "Home": {
227
- e.preventDefault(), Q(0);
228
- break;
229
- }
230
- case "End": {
231
- e.preventDefault(), ie();
223
+ ie(e);
232
224
  break;
233
225
  }
234
226
  case "Enter":
@@ -236,7 +228,7 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
236
228
  e.preventDefault();
237
229
  const l = x();
238
230
  if (l) {
239
- const o = new Event(ee);
231
+ const o = new Event(Y);
240
232
  l.dispatchEvent(o);
241
233
  }
242
234
  }
@@ -250,34 +242,34 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
250
242
  "label",
251
243
  {
252
244
  "cmdk-label": "",
253
- htmlFor: H.inputId,
254
- id: H.labelId,
255
- style: Be,
256
- children: v
245
+ htmlFor: q.inputId,
246
+ id: q.labelId,
247
+ style: $e,
248
+ children: h
257
249
  }
258
250
  ),
259
- B(t, (e) => /* @__PURE__ */ p(ve.Provider, { value: E, children: /* @__PURE__ */ p(me.Provider, { value: H, children: e }) }))
251
+ K(t, (e) => /* @__PURE__ */ p(fe.Provider, { value: E, children: /* @__PURE__ */ p(de.Provider, { value: q, children: e }) }))
260
252
  ]
261
253
  }
262
254
  );
263
- }), Ae = c.forwardRef((t, n) => {
264
- const { id: r } = t, i = c.useRef(null), u = c.useContext(he), f = O(), s = pe(t), v = s.current?.forceMount ?? u?.forceMount;
255
+ }), Me = c.forwardRef((t, n) => {
256
+ const { id: r } = t, i = c.useRef(null), a = c.useContext(me), f = D(), s = ve(t), h = s.current?.forceMount ?? a?.forceMount;
265
257
  A(() => {
266
- if (!v)
267
- return f.item(r, u?.id);
268
- }, [v]);
269
- const d = be(r, i, [t.value, t.children, i], t.keywords), S = re(), C = P((g) => g.value && g.value === d.current), y = P(
270
- (g) => v || f.filter() === !1 ? !0 : g.search ? g.filtered.items.get(r) > 0 : !0
258
+ if (!h)
259
+ return f.item(r, a?.id);
260
+ }, [h]);
261
+ const d = ge(r, i, [t.value, t.children, i], t.keywords), S = ee(), C = P((g) => g.value && g.value === d.current), y = P(
262
+ (g) => h || f.filter() === !1 ? !0 : g.search ? g.filtered.items.get(r) > 0 : !0
271
263
  );
272
264
  c.useEffect(() => {
273
265
  const g = i.current;
274
266
  if (!g || t.disabled) return;
275
- const G = () => R("keyboard");
276
- return g.addEventListener(ee, G), () => g.removeEventListener(ee, G);
267
+ const G = () => I("keyboard");
268
+ return g.addEventListener(Y, G), () => g.removeEventListener(Y, G);
277
269
  }, [y, t.onSelect, t.disabled]);
278
- const w = ue(() => {
270
+ const w = le(() => {
279
271
  S.setState("value", d.current, !0);
280
- }, [S, d]), R = ue(
272
+ }, [S, d]), I = le(
281
273
  (g = "click") => {
282
274
  w(), s.current.onSelect?.({ value: d.current, trigger: g });
283
275
  },
@@ -286,18 +278,18 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
286
278
  if (!y) return null;
287
279
  const {
288
280
  disabled: _,
289
- value: N,
290
- onSelect: ne,
291
- forceMount: U,
292
- keywords: h,
293
- onClick: $,
294
- ...j
295
- } = t, q = Ee(() => F([i, n]), [i, n]), k = Re($, R);
281
+ value: B,
282
+ onSelect: te,
283
+ forceMount: N,
284
+ keywords: v,
285
+ onClick: U,
286
+ ...$
287
+ } = t, j = ye(() => O([i, n]), [i, n]), k = xe(U, I);
296
288
  return /* @__PURE__ */ p(
297
- I.div,
289
+ R.div,
298
290
  {
299
- ref: q,
300
- ...j,
291
+ ref: j,
292
+ ...$,
301
293
  id: r,
302
294
  "cmdk-item": "",
303
295
  role: "option",
@@ -311,46 +303,46 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
311
303
  children: t.children
312
304
  }
313
305
  );
314
- }), _e = c.forwardRef((t, n) => {
315
- const { heading: r, children: i, forceMount: u, ...f } = t, s = T(), v = c.useRef(null), d = c.useRef(null), S = T(), C = O(), y = P(
316
- (R) => u || C.filter() === !1 ? !0 : R.search ? R.filtered.groups.has(s) : !0
306
+ }), Pe = c.forwardRef((t, n) => {
307
+ const { heading: r, children: i, forceMount: a, ...f } = t, s = F(), h = c.useRef(null), d = c.useRef(null), S = F(), C = D(), y = P(
308
+ (I) => a || C.filter() === !1 ? !0 : I.search ? I.filtered.groups.has(s) : !0
317
309
  );
318
- A(() => C.group(s), []), be(s, v, [t.value, t.heading, d]);
319
- const w = c.useMemo(() => ({ id: s, forceMount: u }), [u]);
320
- return /* @__PURE__ */ te(
321
- I.div,
310
+ A(() => C.group(s), []), ge(s, h, [t.value, t.heading, d]);
311
+ const w = c.useMemo(() => ({ id: s, forceMount: a }), [a]);
312
+ return /* @__PURE__ */ Z(
313
+ R.div,
322
314
  {
323
- ref: F([v, n]),
315
+ ref: O([h, n]),
324
316
  ...f,
325
317
  "cmdk-group": "",
326
318
  role: "presentation",
327
319
  hidden: y ? void 0 : !0,
328
320
  children: [
329
321
  r && /* @__PURE__ */ p("div", { ref: d, "cmdk-group-heading": "", "aria-hidden": !0, id: S, children: r }),
330
- B(t, (R) => (
322
+ K(t, (I) => (
331
323
  // biome-ignore lint/a11y/useSemanticElements: <explanation>
332
- /* @__PURE__ */ p("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? S : void 0, children: /* @__PURE__ */ p(he.Provider, { value: w, children: R }) })
324
+ /* @__PURE__ */ p("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? S : void 0, children: /* @__PURE__ */ p(me.Provider, { value: w, children: I }) })
333
325
  ))
334
326
  ]
335
327
  }
336
328
  );
337
- }), Le = c.forwardRef((t, n) => {
338
- const { alwaysRender: r, ...i } = t, u = c.useRef(null), f = P((s) => !s.search);
329
+ }), Ve = c.forwardRef((t, n) => {
330
+ const { alwaysRender: r, ...i } = t, a = c.useRef(null), f = P((s) => !s.search);
339
331
  return !r && !f ? null : /* @__PURE__ */ p(
340
- I.div,
332
+ R.div,
341
333
  {
342
- ref: F([u, n]),
334
+ ref: O([a, n]),
343
335
  ...i,
344
336
  "cmdk-separator": "",
345
337
  role: "separator"
346
338
  }
347
339
  );
348
- }), Me = c.forwardRef((t, n) => {
349
- const { onValueChange: r, ...i } = t, u = t.value != null, f = re(), s = P((d) => d.search), v = O();
340
+ }), Te = c.forwardRef((t, n) => {
341
+ const { onValueChange: r, ...i } = t, a = t.value != null, f = ee(), s = P((d) => d.search), h = D();
350
342
  return c.useEffect(() => {
351
343
  t.value != null && f.setState("search", t.value);
352
344
  }, [t.value]), /* @__PURE__ */ p(
353
- I.input,
345
+ R.input,
354
346
  {
355
347
  ref: n,
356
348
  ...i,
@@ -361,18 +353,18 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
361
353
  "aria-autocomplete": "list",
362
354
  role: "combobox",
363
355
  "aria-expanded": !0,
364
- "aria-controls": v.listId,
365
- "aria-labelledby": v.labelId,
366
- id: v.inputId,
356
+ "aria-controls": h.listId,
357
+ "aria-labelledby": h.labelId,
358
+ id: h.inputId,
367
359
  type: "text",
368
- value: u ? t.value : s,
360
+ value: a ? t.value : s,
369
361
  onChange: (d) => {
370
- u || f.setState("search", d.target.value), r?.(d.target.value);
362
+ a || f.setState("search", d.target.value), r?.(d.target.value);
371
363
  }
372
364
  }
373
365
  );
374
- }), Pe = c.forwardRef((t, n) => {
375
- const { children: r, label: i = "Suggestions", ...u } = t, f = c.useRef(null), s = c.useRef(null), v = O();
366
+ }), Fe = c.forwardRef((t, n) => {
367
+ const { children: r, label: i = "Suggestions", ...a } = t, f = c.useRef(null), s = c.useRef(null), h = D();
376
368
  return c.useEffect(() => {
377
369
  if (s.current && f.current) {
378
370
  const d = s.current, S = f.current;
@@ -388,27 +380,27 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
388
380
  };
389
381
  }
390
382
  }, []), /* @__PURE__ */ p(
391
- I.div,
383
+ R.div,
392
384
  {
393
- ref: F([f, n]),
394
- ...u,
385
+ ref: O([f, n]),
386
+ ...a,
395
387
  "cmdk-list": "",
396
388
  tabIndex: -1,
397
389
  "aria-label": i,
398
- id: v.listId,
399
- children: B(t, (d) => /* @__PURE__ */ p("div", { ref: F([s, v.listInnerRef]), "cmdk-list-sizer": "", children: d }))
390
+ id: h.listId,
391
+ children: K(t, (d) => /* @__PURE__ */ p("div", { ref: O([s, h.listInnerRef]), "cmdk-list-sizer": "", children: d }))
400
392
  }
401
393
  );
402
- }), Ve = c.forwardRef((t, n) => {
403
- const { open: r, onOpenChange: i, overlayClassName: u, contentClassName: f, container: s, ...v } = t;
404
- return /* @__PURE__ */ p(K.Root, { open: r, onOpenChange: i, children: /* @__PURE__ */ te(K.Portal, { container: s, children: [
405
- /* @__PURE__ */ p(K.Overlay, { "cmdk-overlay": "", className: u }),
406
- /* @__PURE__ */ p(K.Content, { "aria-label": t.label, "cmdk-dialog": "", className: f, children: /* @__PURE__ */ p(ge, { ref: n, ...v }) })
394
+ }), Oe = c.forwardRef((t, n) => {
395
+ const { open: r, onOpenChange: i, overlayClassName: a, contentClassName: f, container: s, ...h } = t;
396
+ return /* @__PURE__ */ p(Se, { open: r, onOpenChange: i, children: /* @__PURE__ */ Z(Ee, { container: s, children: [
397
+ /* @__PURE__ */ p(Ce, { "cmdk-overlay": "", className: a }),
398
+ /* @__PURE__ */ p(we, { "aria-label": t.label, "cmdk-dialog": "", className: f, children: /* @__PURE__ */ p(he, { ref: n, ...h }) })
407
399
  ] }) });
408
- }), De = c.forwardRef((t, n) => P((i) => i.filtered.count === 0) ? /* @__PURE__ */ p(I.div, { ref: n, ...t, "cmdk-empty": "", role: "presentation" }) : null), Te = c.forwardRef((t, n) => {
409
- const { progress: r, children: i, label: u = "Loading...", ...f } = t;
400
+ }), De = c.forwardRef((t, n) => P((i) => i.filtered.count === 0) ? /* @__PURE__ */ p(R.div, { ref: n, ...t, "cmdk-empty": "", role: "presentation" }) : null), Ge = c.forwardRef((t, n) => {
401
+ const { progress: r, children: i, label: a = "Loading...", ...f } = t;
410
402
  return /* @__PURE__ */ p(
411
- I.div,
403
+ R.div,
412
404
  {
413
405
  ref: n,
414
406
  ...f,
@@ -417,35 +409,35 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
417
409
  "aria-valuenow": r,
418
410
  "aria-valuemin": 0,
419
411
  "aria-valuemax": 100,
420
- "aria-label": u,
421
- children: B(t, (s) => /* @__PURE__ */ p("div", { "aria-hidden": !0, children: s }))
412
+ "aria-label": a,
413
+ children: K(t, (s) => /* @__PURE__ */ p("div", { "aria-hidden": !0, children: s }))
422
414
  }
423
415
  );
424
- }), Qe = Object.assign(ge, {
425
- List: Pe,
426
- Item: Ae,
427
- Input: Me,
428
- Group: _e,
429
- Separator: Le,
430
- Dialog: Ve,
416
+ }), et = Object.assign(he, {
417
+ List: Fe,
418
+ Item: Me,
419
+ Input: Te,
420
+ Group: Pe,
421
+ Separator: Ve,
422
+ Dialog: Oe,
431
423
  Empty: De,
432
- Loading: Te
424
+ Loading: Ge
433
425
  });
434
- function Fe(t, n) {
426
+ function Ke(t, n) {
435
427
  let r = t.nextElementSibling;
436
428
  for (; r; ) {
437
429
  if (r.matches(n)) return r;
438
430
  r = r.nextElementSibling;
439
431
  }
440
432
  }
441
- function Oe(t, n) {
433
+ function Be(t, n) {
442
434
  let r = t.previousElementSibling;
443
435
  for (; r; ) {
444
436
  if (r.matches(n)) return r;
445
437
  r = r.previousElementSibling;
446
438
  }
447
439
  }
448
- function pe(t) {
440
+ function ve(t) {
449
441
  const n = c.useRef(t);
450
442
  return A(() => {
451
443
  n.current = t;
@@ -456,7 +448,7 @@ function M(t) {
456
448
  const n = c.useRef(void 0);
457
449
  return n.current === void 0 && (n.current = t()), n;
458
450
  }
459
- function F(t) {
451
+ function O(t) {
460
452
  return (n) => {
461
453
  t.forEach((r) => {
462
454
  typeof r == "function" ? r(n) : r != null && (r.current = n);
@@ -464,44 +456,44 @@ function F(t) {
464
456
  };
465
457
  }
466
458
  function P(t) {
467
- const n = re(), r = () => t(n.snapshot());
468
- return we.useSyncExternalStore(n.subscribe, r, r);
459
+ const n = ee(), r = () => t(n.snapshot());
460
+ return Re.useSyncExternalStore(n.subscribe, r, r);
469
461
  }
470
- function be(t, n, r, i = []) {
471
- const u = c.useRef(void 0), f = O();
462
+ function ge(t, n, r, i = []) {
463
+ const a = c.useRef(void 0), f = D();
472
464
  return A(() => {
473
465
  const s = (() => {
474
466
  for (const d of r) {
475
467
  if (typeof d == "string")
476
468
  return d.trim();
477
469
  if (typeof d == "object" && "current" in d)
478
- return d.current ? d.current.textContent?.trim() : u.current;
470
+ return d.current ? d.current.textContent?.trim() : a.current;
479
471
  }
480
- })(), v = i.map((d) => d.trim());
481
- f.value(t, s, v), n.current?.setAttribute(L, s), u.current = s;
482
- }), u;
472
+ })(), h = i.map((d) => d.trim());
473
+ f.value(t, s, h), n.current?.setAttribute(L, s), a.current = s;
474
+ }), a;
483
475
  }
484
- const Ge = () => {
476
+ const Ne = () => {
485
477
  const [t, n] = c.useState(), r = M(() => /* @__PURE__ */ new Map());
486
478
  return A(() => {
487
479
  r.current.forEach((i) => i()), r.current = /* @__PURE__ */ new Map();
488
- }, [t]), (i, u) => {
489
- r.current.set(i, u), n({});
480
+ }, [t]), (i, a) => {
481
+ r.current.set(i, a), n({});
490
482
  };
491
483
  };
492
- function Ke(t) {
484
+ function Ue(t) {
493
485
  const n = t.type;
494
486
  return typeof n == "function" ? n(t.props) : "render" in n ? n.render(t.props) : t;
495
487
  }
496
- function B({ asChild: t, children: n }, r) {
488
+ function K({ asChild: t, children: n }, r) {
497
489
  return t && c.isValidElement(n) ? c.cloneElement(
498
- Ke(n),
490
+ Ue(n),
499
491
  { ref: n.ref },
500
492
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
501
493
  r(n.props.children)
502
494
  ) : r(n);
503
495
  }
504
- const Be = {
496
+ const $e = {
505
497
  position: "absolute",
506
498
  width: "1px",
507
499
  height: "1px",
@@ -513,16 +505,16 @@ const Be = {
513
505
  borderWidth: "0"
514
506
  };
515
507
  export {
516
- Qe as Command,
517
- Ve as CommandDialog,
508
+ et as Command,
509
+ Oe as CommandDialog,
518
510
  De as CommandEmpty,
519
- Me as CommandInput,
520
- Ae as CommandItem,
521
- Pe as CommandList,
522
- Te as CommandLoading,
523
- ge as CommandRoot,
524
- Le as CommandSeparator,
525
- xe as defaultFilter,
511
+ Te as CommandInput,
512
+ Me as CommandItem,
513
+ Fe as CommandList,
514
+ Ge as CommandLoading,
515
+ he as CommandRoot,
516
+ Ve as CommandSeparator,
517
+ Le as defaultFilter,
526
518
  P as useCommandState,
527
- re as useCommandStore
519
+ ee as useCommandStore
528
520
  };