@epam/ai-dial-conversation-panel 1.2.0-dev.164 → 1.2.0-dev.173

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.
package/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { ConversationTransferJobStatus as e, DeploymentIcon as t, FilterTab as n, buildCssVars as r, getUtf8ByteLength as i, mergeClasses as a, sanitizeConversationName as o, stripTrailingDots as s } from "@epam/ai-dial-chat-shared";
2
- import { PanelEmpty as c, PanelNoResults as l, SidebarOrientation as u, SidebarPanel as d } from "@epam/ai-dial-sidebar";
3
- import { Button as f, ButtonVariant as p, ConfirmationPopup as m, ConfirmationPopupVariant as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, Dropdown as v, ElementSize as y, EllipsisTooltip as b, FilterChips as x, GhostIconButton as S, Highlight as C, Input as w, Popup as T, PopupSize as E, ProgressBar as D, Search as O, Skeleton as ee, SkeletonVariant as k, Spinner as A, Tooltip as j, mergeClasses as M } from "@epam/ai-dial-ui-kit";
4
- import { createElement as te, memo as N, useCallback as P, useEffect as F, useId as ne, useImperativeHandle as re, useLayoutEffect as ie, useMemo as I, useRef as L, useState as R } from "react";
5
- import { jsx as z, jsxs as B } from "react/jsx-runtime";
6
- import { IconAlertCircleFilled as ae, IconAlertTriangleFilled as oe, IconCaretDownFilled as V, IconCaretRightFilled as se, IconCheck as ce, IconChevronDown as H, IconChevronUp as le, IconDotsVertical as ue, IconFile as de, IconFileZip as U, IconJson as fe, IconPlus as pe, IconSparkles as me, IconX as W } from "@tabler/icons-react";
1
+ import { DeploymentIcon as e, FilterTab as t, buildCssVars as n, getUtf8ByteLength as r, mergeClasses as i, sanitizeConversationName as a, stripTrailingDots as o } from "@epam/ai-dial-chat-shared";
2
+ import { PanelEmpty as s, PanelNoResults as c, SidebarOrientation as l, SidebarPanel as u } from "@epam/ai-dial-sidebar";
3
+ import { Button as d, ButtonVariant as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, Dropdown as h, ElementSize as g, EllipsisTooltip as _, FilterChips as v, GhostIconButton as y, Highlight as b, Input as x, Popup as S, PopupSize as C, Search as w, Skeleton as T, SkeletonVariant as ee, Spinner as E, mergeClasses as D } from "@epam/ai-dial-ui-kit";
4
+ import { createElement as O, memo as k, useCallback as A, useEffect as j, useId as M, useImperativeHandle as N, useLayoutEffect as te, useMemo as P, useRef as F, useState as I } from "react";
5
+ import { jsx as L, jsxs as R } from "react/jsx-runtime";
6
+ import { IconCaretDownFilled as z, IconCaretRightFilled as ne, IconDotsVertical as re, IconPlus as ie, IconSparkles as ae } from "@tabler/icons-react";
7
7
  //#region src/constants/public-class-names.ts
8
- var he = {
8
+ var B = {
9
9
  newChatButton: "dial-cp-new-chat-button",
10
10
  search: "dial-cp-search"
11
- }, G = typeof window < "u" ? ie : F;
12
- function ge(e) {
11
+ }, V = typeof window < "u" ? te : j;
12
+ function oe(e) {
13
13
  if (e !== void 0) switch (typeof e) {
14
14
  case "number": return e;
15
15
  case "string":
@@ -17,15 +17,15 @@ function ge(e) {
17
17
  break;
18
18
  }
19
19
  }
20
- function _e({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
21
- let { styleHeight: s, styleWidth: c } = I(() => ({
22
- styleHeight: ge(o?.height),
23
- styleWidth: ge(o?.width)
24
- }), [o?.height, o?.width]), [l, u] = R({
20
+ function se({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
21
+ let { styleHeight: s, styleWidth: c } = P(() => ({
22
+ styleHeight: oe(o?.height),
23
+ styleWidth: oe(o?.width)
24
+ }), [o?.height, o?.width]), [l, u] = I({
25
25
  height: t,
26
26
  width: n
27
27
  }), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
28
- return G(() => {
28
+ return V(() => {
29
29
  if (i === null || d) return;
30
30
  let t = new ResizeObserver((e) => {
31
31
  for (let t of e) {
@@ -45,7 +45,7 @@ function _e({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
45
45
  i,
46
46
  s,
47
47
  c
48
- ]), I(() => ({
48
+ ]), P(() => ({
49
49
  height: s ?? l.height,
50
50
  width: c ?? l.width
51
51
  }), [
@@ -54,26 +54,26 @@ function _e({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
54
54
  c
55
55
  ]);
56
56
  }
57
- function ve(e) {
58
- let t = L(() => {
57
+ function ce(e) {
58
+ let t = F(() => {
59
59
  throw Error("Cannot call during render.");
60
60
  });
61
- return G(() => {
61
+ return V(() => {
62
62
  t.current = e;
63
- }, [e]), P((e) => t.current?.(e), [t]);
63
+ }, [e]), A((e) => t.current?.(e), [t]);
64
64
  }
65
- var K = null;
66
- function ye(e = !1) {
67
- if (K === null || e) {
65
+ var H = null;
66
+ function U(e = !1) {
67
+ if (H === null || e) {
68
68
  let e = document.createElement("div"), t = e.style;
69
69
  t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
70
70
  let n = document.createElement("div"), r = n.style;
71
- return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? K = "positive-descending" : (e.scrollLeft = 1, K = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), K;
71
+ return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? H = "positive-descending" : (e.scrollLeft = 1, H = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), H;
72
72
  }
73
- return K;
73
+ return H;
74
74
  }
75
- function be({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
76
- if (t === "horizontal" && n) switch (ye()) {
75
+ function le({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
76
+ if (t === "horizontal" && n) switch (U()) {
77
77
  case "negative": return -r;
78
78
  case "positive-descending":
79
79
  if (e) {
@@ -84,26 +84,26 @@ function be({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
84
84
  }
85
85
  return r;
86
86
  }
87
- function q(e, t = "Assertion error") {
87
+ function W(e, t = "Assertion error") {
88
88
  if (!e) throw console.error(t), Error(t);
89
89
  }
90
- function J(e, t) {
90
+ function G(e, t) {
91
91
  if (e === t) return !0;
92
- if (!!e != !!t || (q(e !== void 0), q(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
92
+ if (!!e != !!t || (W(e !== void 0), W(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
93
93
  for (let n in e) if (!Object.is(t[n], e[n])) return !1;
94
94
  return !0;
95
95
  }
96
- function xe({ cachedBounds: e, itemCount: t, itemSize: n }) {
96
+ function K({ cachedBounds: e, itemCount: t, itemSize: n }) {
97
97
  if (t === 0) return 0;
98
98
  if (typeof n == "number") return t * n;
99
99
  {
100
100
  let n = e.get(e.size === 0 ? 0 : e.size - 1);
101
- return q(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
101
+ return W(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
102
102
  }
103
103
  }
104
- function Se({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
104
+ function ue({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
105
105
  if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
106
- let s = xe({
106
+ let s = K({
107
107
  cachedBounds: t,
108
108
  itemCount: r,
109
109
  itemSize: i
@@ -115,7 +115,7 @@ function Se({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
115
115
  default: return a >= u && a <= l ? a : a < u ? u : l;
116
116
  }
117
117
  }
118
- function Ce({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
118
+ function q({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
119
119
  let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
120
120
  for (; u < a;) {
121
121
  let n = e.get(u);
@@ -134,11 +134,11 @@ function Ce({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
134
134
  stopIndexOverscan: l
135
135
  };
136
136
  }
137
- function we({ itemCount: e, itemProps: t, itemSize: n }) {
137
+ function de({ itemCount: e, itemProps: t, itemSize: n }) {
138
138
  let r = /* @__PURE__ */ new Map();
139
139
  return {
140
140
  get(i) {
141
- for (q(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
141
+ for (W(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
142
142
  let e = r.size, a;
143
143
  switch (typeof n) {
144
144
  case "function":
@@ -154,14 +154,14 @@ function we({ itemCount: e, itemProps: t, itemSize: n }) {
154
154
  });
155
155
  else {
156
156
  let t = r.get(e - 1);
157
- q(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
157
+ W(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
158
158
  scrollOffset: t.scrollOffset + t.size,
159
159
  size: a
160
160
  });
161
161
  }
162
162
  }
163
163
  let a = r.get(i);
164
- return q(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
164
+ return W(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
165
165
  },
166
166
  set(e, t) {
167
167
  r.set(e, t);
@@ -171,8 +171,8 @@ function we({ itemCount: e, itemProps: t, itemSize: n }) {
171
171
  }
172
172
  };
173
173
  }
174
- function Te({ itemCount: e, itemProps: t, itemSize: n }) {
175
- return I(() => we({
174
+ function J({ itemCount: e, itemProps: t, itemSize: n }) {
175
+ return P(() => de({
176
176
  itemCount: e,
177
177
  itemProps: t,
178
178
  itemSize: n
@@ -182,11 +182,11 @@ function Te({ itemCount: e, itemProps: t, itemSize: n }) {
182
182
  n
183
183
  ]);
184
184
  }
185
- function Ee({ containerSize: e, itemSize: t }) {
185
+ function Y({ containerSize: e, itemSize: t }) {
186
186
  let n;
187
187
  switch (typeof t) {
188
188
  case "string":
189
- q(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), q(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
189
+ W(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), W(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
190
190
  break;
191
191
  default:
192
192
  n = t;
@@ -194,21 +194,21 @@ function Ee({ containerSize: e, itemSize: t }) {
194
194
  }
195
195
  return n;
196
196
  }
197
- function De({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
198
- let { height: u = n, width: d = n } = _e({
197
+ function fe({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
198
+ let { height: u = n, width: d = n } = se({
199
199
  defaultHeight: r === "vertical" ? n : void 0,
200
200
  defaultWidth: r === "horizontal" ? n : void 0,
201
201
  element: e,
202
202
  mode: r === "vertical" ? "only-height" : "only-width",
203
203
  style: t
204
- }), f = L({
204
+ }), f = F({
205
205
  height: 0,
206
206
  width: 0
207
- }), p = r === "vertical" ? u : d, m = Ee({
207
+ }), p = r === "vertical" ? u : d, m = Y({
208
208
  containerSize: p,
209
209
  itemSize: s
210
210
  });
211
- ie(() => {
211
+ te(() => {
212
212
  if (typeof c == "function") {
213
213
  let e = f.current;
214
214
  (e.height !== u || e.width !== d) && (c({
@@ -221,11 +221,11 @@ function De({ containerElement: e, containerStyle: t, defaultContainerSize: n =
221
221
  c,
222
222
  d
223
223
  ]);
224
- let h = Te({
224
+ let h = J({
225
225
  itemCount: a,
226
226
  itemProps: o,
227
227
  itemSize: m
228
- }), g = P((e) => h.get(e), [h]), [_, v] = R(() => Ce({
228
+ }), g = A((e) => h.get(e), [h]), [_, v] = I(() => q({
229
229
  cachedBounds: h,
230
230
  containerScrollOffset: 0,
231
231
  containerSize: p,
@@ -236,7 +236,7 @@ function De({ containerElement: e, containerStyle: t, defaultContainerSize: n =
236
236
  startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
237
237
  stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
238
238
  stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
239
- }, C = P(() => xe({
239
+ }, C = A(() => K({
240
240
  cachedBounds: h,
241
241
  itemCount: a,
242
242
  itemSize: m
@@ -244,9 +244,9 @@ function De({ containerElement: e, containerStyle: t, defaultContainerSize: n =
244
244
  h,
245
245
  a,
246
246
  m
247
- ]), w = P((t) => Ce({
247
+ ]), w = A((t) => q({
248
248
  cachedBounds: h,
249
- containerScrollOffset: be({
249
+ containerScrollOffset: le({
250
250
  containerElement: e,
251
251
  direction: r,
252
252
  isRtl: i,
@@ -264,19 +264,19 @@ function De({ containerElement: e, containerStyle: t, defaultContainerSize: n =
264
264
  a,
265
265
  l
266
266
  ]);
267
- return G(() => {
267
+ return V(() => {
268
268
  v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
269
269
  }, [
270
270
  e,
271
271
  r,
272
272
  w
273
- ]), G(() => {
273
+ ]), V(() => {
274
274
  if (!e) return;
275
275
  let t = () => {
276
276
  v((t) => {
277
- let { scrollLeft: n, scrollTop: o } = e, s = Ce({
277
+ let { scrollLeft: n, scrollTop: o } = e, s = q({
278
278
  cachedBounds: h,
279
- containerScrollOffset: be({
279
+ containerScrollOffset: le({
280
280
  containerElement: e,
281
281
  direction: r,
282
282
  isRtl: i,
@@ -286,7 +286,7 @@ function De({ containerElement: e, containerStyle: t, defaultContainerSize: n =
286
286
  itemCount: a,
287
287
  overscanCount: l
288
288
  });
289
- return J(s, t) ? t : s;
289
+ return G(s, t) ? t : s;
290
290
  });
291
291
  };
292
292
  return e.addEventListener("scroll", t), () => {
@@ -302,8 +302,8 @@ function De({ containerElement: e, containerStyle: t, defaultContainerSize: n =
302
302
  ]), {
303
303
  getCellBounds: g,
304
304
  getEstimatedSize: C,
305
- scrollToIndex: ve(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
306
- let s = Se({
305
+ scrollToIndex: ce(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
306
+ let s = ue({
307
307
  align: t,
308
308
  cachedBounds: h,
309
309
  containerScrollOffset: n,
@@ -313,14 +313,14 @@ function De({ containerElement: e, containerStyle: t, defaultContainerSize: n =
313
313
  itemSize: m
314
314
  });
315
315
  if (e) {
316
- if (s = be({
316
+ if (s = le({
317
317
  containerElement: e,
318
318
  direction: r,
319
319
  isRtl: i,
320
320
  scrollOffset: s
321
321
  }), typeof e.scrollTo != "function") {
322
322
  let e = w(s);
323
- J(_, e) || v(e);
323
+ G(_, e) || v(e);
324
324
  }
325
325
  return s;
326
326
  }
@@ -331,30 +331,30 @@ function De({ containerElement: e, containerStyle: t, defaultContainerSize: n =
331
331
  stopIndexVisible: x
332
332
  };
333
333
  }
334
- function Oe(e) {
335
- return I(() => e, Object.values(e));
334
+ function pe(e) {
335
+ return P(() => e, Object.values(e));
336
336
  }
337
- function ke(e, t) {
337
+ function me(e, t) {
338
338
  let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
339
- return J(n, a) && J(r, o) && J(i, s);
339
+ return G(n, a) && G(r, o) && G(i, s);
340
340
  }
341
- function Ae(e) {
341
+ function he(e) {
342
342
  return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
343
343
  }
344
- var je = "data-react-window-index";
345
- function Me({ children: e, className: t, defaultHeight: n = 0, listRef: r, onResize: i, onRowsRendered: a, overscanCount: o = 3, rowComponent: s, rowCount: c, rowHeight: l, rowProps: u, tagName: d = "div", style: f, ...p }) {
346
- let m = Oe(u), h = I(() => N(s, ke), [s]), [g, _] = R(null), v = Ae(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = De({
344
+ var ge = "data-react-window-index";
345
+ function _e({ children: e, className: t, defaultHeight: n = 0, listRef: r, onResize: i, onRowsRendered: a, overscanCount: o = 3, rowComponent: s, rowCount: c, rowHeight: l, rowProps: u, tagName: d = "div", style: f, ...p }) {
346
+ let m = pe(u), h = P(() => k(s, me), [s]), [g, _] = I(null), v = he(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = fe({
347
347
  containerElement: g,
348
348
  containerStyle: f,
349
349
  defaultContainerSize: n,
350
350
  direction: "vertical",
351
351
  itemCount: c,
352
352
  itemProps: m,
353
- itemSize: I(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
353
+ itemSize: P(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
354
354
  onResize: i,
355
355
  overscanCount: o
356
356
  });
357
- re(r, () => ({
357
+ N(r, () => ({
358
358
  get element() {
359
359
  return g;
360
360
  },
@@ -369,12 +369,12 @@ function Me({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
369
369
  top: r
370
370
  });
371
371
  }
372
- }), [g, x]), G(() => {
372
+ }), [g, x]), V(() => {
373
373
  if (!g) return;
374
374
  let e = Array.from(g.children).filter((e, t) => {
375
375
  if (e.hasAttribute("aria-hidden")) return !1;
376
376
  let n = `${S + t}`;
377
- return e.setAttribute(je, n), !0;
377
+ return e.setAttribute(ge, n), !0;
378
378
  });
379
379
  if (v) return l.observeRowElements(e);
380
380
  }, [
@@ -383,7 +383,7 @@ function Me({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
383
383
  l,
384
384
  S,
385
385
  w
386
- ]), F(() => {
386
+ ]), j(() => {
387
387
  S >= 0 && w >= 0 && a && a({
388
388
  startIndex: C,
389
389
  stopIndex: T
@@ -398,11 +398,11 @@ function Me({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
398
398
  w,
399
399
  T
400
400
  ]);
401
- let E = I(() => {
401
+ let ee = P(() => {
402
402
  let e = [];
403
403
  if (c > 0) for (let t = S; t <= w; t++) {
404
404
  let n = y(t);
405
- e.push(/* @__PURE__ */ te(h, {
405
+ e.push(/* @__PURE__ */ O(h, {
406
406
  ...m,
407
407
  ariaAttributes: {
408
408
  "aria-posinset": t + 1,
@@ -429,7 +429,7 @@ function Me({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
429
429
  m,
430
430
  S,
431
431
  w
432
- ]), D = /* @__PURE__ */ z("div", {
432
+ ]), E = /* @__PURE__ */ L("div", {
433
433
  "aria-hidden": !0,
434
434
  style: {
435
435
  height: b(),
@@ -437,7 +437,7 @@ function Me({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
437
437
  zIndex: -1
438
438
  }
439
439
  });
440
- return te(d, {
440
+ return O(d, {
441
441
  role: "list",
442
442
  ...p,
443
443
  className: t,
@@ -449,59 +449,59 @@ function Me({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
449
449
  overflowY: "auto",
450
450
  ...f
451
451
  }
452
- }, E, e, D);
452
+ }, ee, e, E);
453
453
  }
454
454
  //#endregion
455
455
  //#region src/types/virtual-row.ts
456
- var Y = /* @__PURE__ */ function(e) {
456
+ var X = /* @__PURE__ */ function(e) {
457
457
  return e.Header = "header", e.Item = "item", e;
458
- }({}), Ne = (e) => `${60 + e * 23 % 35}%`, Pe = (e, t) => e ? t ? "pe-9" : "pe-2 group-focus-within/conversation:pe-9 group-hover/conversation:pe-9" : "pe-3", Fe = (e, t) => t.rows[e].kind === Y.Item ? 36 : e === 0 ? 24 : 56, Ie = (e) => {
458
+ }({}), ve = (e) => `${60 + e * 23 % 35}%`, ye = (e, t) => e ? t ? "pe-9" : "pe-2 group-focus-within/conversation:pe-9 group-hover/conversation:pe-9" : "pe-3", be = (e, t) => t.rows[e].kind === X.Item ? 36 : e === 0 ? 24 : 56, xe = (e) => {
459
459
  switch (e) {
460
- case n.Shared: return n.Shared;
461
- case n.Organization: return n.Organization;
462
- default: return n.MyChats;
460
+ case t.Shared: return t.Shared;
461
+ case t.Organization: return t.Organization;
462
+ default: return t.MyChats;
463
463
  }
464
- }, Le = (e, t) => {
464
+ }, Se = (e, t) => {
465
465
  let n = null;
466
- for (let r of e) if (r.kind === Y.Header) n = r.groupKey;
466
+ for (let r of e) if (r.kind === X.Header) n = r.groupKey;
467
467
  else if (r.item.id === t) return n;
468
468
  return null;
469
- }, Re = (e, t, r) => {
469
+ }, Ce = (e, n, r) => {
470
470
  let i = /* @__PURE__ */ new Set();
471
- if (t != null && i.add(t), t === n.Pinned) {
471
+ if (n != null && i.add(n), n === t.Pinned) {
472
472
  let t = r.find((t) => t.id === e);
473
- t && i.add(Ie(t.source));
474
- } else i.add(n.Pinned);
473
+ t && i.add(xe(t.source));
474
+ } else i.add(t.Pinned);
475
475
  return i;
476
- }, ze = (e, t, n, r) => {
476
+ }, we = (e, t, n, r) => {
477
477
  let i = e.currentTarget.getBoundingClientRect();
478
478
  if (e.clientY >= i.top + i.height / 2) return t;
479
479
  let a = null, o = !1;
480
- for (let e of n) if (e.kind === Y.Header) o = e.groupKey === r;
480
+ for (let e of n) if (e.kind === X.Header) o = e.groupKey === r;
481
481
  else if (o) {
482
482
  if (e.item.id === t) return a;
483
483
  a = e.item.id;
484
484
  }
485
485
  return null;
486
- }, Be = [
486
+ }, Te = [
487
487
  {
488
- value: n.All,
488
+ value: t.All,
489
489
  labelKey: "all"
490
490
  },
491
491
  {
492
- value: n.MyChats,
492
+ value: t.MyChats,
493
493
  labelKey: "myChats"
494
494
  },
495
495
  {
496
- value: n.Shared,
496
+ value: t.Shared,
497
497
  labelKey: "shared"
498
498
  },
499
499
  {
500
- value: n.Organization,
500
+ value: t.Organization,
501
501
  labelKey: "organization"
502
502
  }
503
- ], Ve = N(({ activeTab: e, labels: t, onChange: n, tabClassName: r = "dial-tiny-semi-text", hiddenSources: i }) => /* @__PURE__ */ z(x, {
504
- items: I(() => Be.filter(({ value: e }) => !i?.includes(e)).map(({ value: e, labelKey: n }) => ({
503
+ ], Ee = k(({ activeTab: e, labels: t, onChange: n, tabClassName: r = "dial-tiny-semi-text", hiddenSources: i }) => /* @__PURE__ */ L(v, {
504
+ items: P(() => Te.filter(({ value: e }) => !i?.includes(e)).map(({ value: e, labelKey: n }) => ({
505
505
  value: e,
506
506
  label: t[n]
507
507
  })), [t, i]),
@@ -510,27 +510,27 @@ var Y = /* @__PURE__ */ function(e) {
510
510
  stretch: !0,
511
511
  "aria-label": t.groupAriaLabel ?? "Filter chats",
512
512
  className: "px-3 py-2",
513
- chipClassName: M("!px-2", r)
514
- })), He = { button: "_button_1pnt8_1" }, Ue = N(({ label: e, onClick: t, labelClassName: n = "dial-small-semi-text", colors: i, className: o }) => /* @__PURE__ */ z("div", {
513
+ chipClassName: D("!px-2", r)
514
+ })), De = { button: "_button_1pnt8_1" }, Oe = k(({ label: e, onClick: t, labelClassName: r = "dial-small-semi-text", colors: a, className: o }) => /* @__PURE__ */ L("div", {
515
515
  className: "px-3 py-2",
516
- style: r({
517
- "--cp-new-chat-bg": i?.background,
518
- "--cp-new-chat-text": i?.text,
519
- "--cp-new-chat-focus-outline": i?.focusOutline
516
+ style: n({
517
+ "--cp-new-chat-bg": a?.background,
518
+ "--cp-new-chat-text": a?.text,
519
+ "--cp-new-chat-focus-outline": a?.focusOutline
520
520
  }),
521
- children: /* @__PURE__ */ z(f, {
521
+ children: /* @__PURE__ */ L(d, {
522
522
  label: e,
523
- textClassName: n,
524
- iconBefore: /* @__PURE__ */ z(pe, {
523
+ textClassName: r,
524
+ iconBefore: /* @__PURE__ */ L(ie, {
525
525
  size: 18,
526
- stroke: _,
526
+ stroke: m,
527
527
  className: "shrink-0",
528
528
  "aria-hidden": !0
529
529
  }),
530
530
  onClick: t,
531
- className: a("h-[36px] w-full gap-2 px-3 py-1 shadow-chat-button hover:shadow-xs focus-visible:shadow-xs active:shadow-xs", He.button, o, he.newChatButton)
531
+ className: i("h-[36px] w-full gap-2 px-3 py-1 shadow-chat-button hover:shadow-xs focus-visible:shadow-xs active:shadow-xs", De.button, o, B.newChatButton)
532
532
  })
533
- })), X = {
533
+ })), Z = {
534
534
  skeletonColor: "var(--cp-skeleton-color, var(--bg-control-disable-primary, #dce0e8))",
535
535
  item: "_item_j0zft_2",
536
536
  itemActive: "_itemActive_j0zft_15",
@@ -540,9 +540,9 @@ var Y = /* @__PURE__ */ function(e) {
540
540
  triggerIcon: "_triggerIcon_j0zft_32",
541
541
  unreadDot: "_unreadDot_j0zft_40",
542
542
  search: "_search_j0zft_48"
543
- }, Z = ({ label: e, isExpanded: t, onToggle: n, listId: r, className: i = "dial-tiny-lead-text", dropZoneGroupKey: o, isDragOver: s, onDragOver: c, onDragLeave: l, onDrop: u }) => {
543
+ }, ke = ({ label: e, isExpanded: t, onToggle: n, listId: r, className: a = "dial-tiny-lead-text", dropZoneGroupKey: o, isDragOver: s, onDragOver: c, onDragLeave: l, onDrop: u }) => {
544
544
  let d = o != null;
545
- return /* @__PURE__ */ B("button", {
545
+ return /* @__PURE__ */ R("button", {
546
546
  type: "button",
547
547
  "aria-expanded": t,
548
548
  "aria-controls": r,
@@ -556,137 +556,137 @@ var Y = /* @__PURE__ */ function(e) {
556
556
  onDrop: d ? (e) => {
557
557
  d && (e.preventDefault(), u?.(o, o, null));
558
558
  } : void 0,
559
- className: a("group flex h-6 w-full items-center gap-1 rounded py-1 pe-3 text-start", i, X.groupHeader, s && X.dropZoneActive),
560
- children: [t ? /* @__PURE__ */ z(V, {
559
+ className: i("group flex h-6 w-full items-center gap-1 rounded py-1 pe-3 text-start", a, Z.groupHeader, s && Z.dropZoneActive),
560
+ children: [t ? /* @__PURE__ */ L(z, {
561
561
  size: 12,
562
562
  className: "shrink-0 opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100",
563
563
  "aria-hidden": !0
564
- }) : /* @__PURE__ */ z(se, {
564
+ }) : /* @__PURE__ */ L(ne, {
565
565
  size: 12,
566
566
  className: "shrink-0 opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100 rtl:scale-x-[-1]",
567
567
  "aria-hidden": !0
568
- }), /* @__PURE__ */ z(b, { text: e })]
568
+ }), /* @__PURE__ */ L(_, { text: e })]
569
569
  });
570
- }, We = ({ item: e, isActive: n, onSelectConversation: r, searchQuery: i = "", getActions: o, onActionMenuOpen: s, actionsLabel: c = "More actions", itemTitleClassName: l = "dial-small-text", itemIconBadgeClassName: u, unreadIndicatorLabel: d = "Unread", rowGroupKey: p, rows: m, draggingId: h, dragOverId: b, allowedDropGroups: x, onDragStart: w, onDragEnd: T, onDragOver: E, onDragLeave: D, onDrop: O }) => {
571
- let [A, j] = R(!1), M = L(null), te = P((t) => {
572
- j(t), t && M.current && s?.(e, M.current);
573
- }, [e, s]), N = o?.(e) ?? [], F = N.length > 0, ne = e.leadingIcon ? /* @__PURE__ */ z("span", {
570
+ }, Ae = ({ item: t, isActive: n, onSelectConversation: r, searchQuery: a = "", getActions: o, onActionMenuOpen: s, actionsLabel: c = "More actions", itemTitleClassName: l = "dial-small-text", itemIconBadgeClassName: u, unreadIndicatorLabel: f = "Unread", rowGroupKey: _, rows: v, draggingId: x, dragOverId: S, allowedDropGroups: C, onDragStart: w, onDragEnd: E, onDragOver: D, onDragLeave: O, onDrop: k }) => {
571
+ let [j, M] = I(!1), N = F(null), te = A((e) => {
572
+ M(e), e && N.current && s?.(t, N.current);
573
+ }, [t, s]), P = o?.(t) ?? [], z = P.length > 0, ne = t.leadingIcon ? /* @__PURE__ */ L("span", {
574
574
  className: "flex size-6 shrink-0 items-center justify-center",
575
- children: e.leadingIcon
576
- }) : e.isIconLoading ? /* @__PURE__ */ z(ee, {
577
- variant: k.Circular,
578
- width: g.LG,
579
- height: g.LG,
580
- color: X.skeletonColor,
575
+ children: t.leadingIcon
576
+ }) : t.isIconLoading ? /* @__PURE__ */ L(T, {
577
+ variant: ee.Circular,
578
+ width: p.LG,
579
+ height: p.LG,
580
+ color: Z.skeletonColor,
581
581
  "aria-hidden": !0
582
- }) : /* @__PURE__ */ z(t, {
583
- src: e.iconUrl,
584
- size: g.LG,
585
- initialsName: e.iconTooltip ?? "",
586
- labels: { tooltip: e.iconTooltip },
582
+ }) : /* @__PURE__ */ L(e, {
583
+ src: t.iconUrl,
584
+ size: p.LG,
585
+ initialsName: t.iconTooltip ?? "",
586
+ labels: { tooltip: t.iconTooltip },
587
587
  styles: { badgeClassName: u }
588
- }), re = Pe(F, A), ie = e.isUnread ? /* @__PURE__ */ B("span", {
588
+ }), ie = ye(z, j), ae = t.isUnread ? /* @__PURE__ */ R("span", {
589
589
  className: "flex size-6 shrink-0 items-center justify-center",
590
- children: [/* @__PURE__ */ z("span", {
591
- className: a("size-[7.11px] rounded-full", X.unreadDot, F && (A ? "opacity-0" : "group-focus-within/conversation:opacity-0 group-hover/conversation:opacity-0")),
590
+ children: [/* @__PURE__ */ L("span", {
591
+ className: i("size-[7.11px] rounded-full", Z.unreadDot, z && (j ? "opacity-0" : "group-focus-within/conversation:opacity-0 group-hover/conversation:opacity-0")),
592
592
  "aria-hidden": !0
593
- }), /* @__PURE__ */ z("span", {
593
+ }), /* @__PURE__ */ L("span", {
594
594
  className: "sr-only",
595
- children: d
595
+ children: f
596
596
  })]
597
- }) : void 0, I = p != null, ae = P((e) => {
598
- e.currentTarget.contains(e.relatedTarget) || D?.();
599
- }, [D]), oe = P((t) => {
600
- if (!p || !m || !O) return;
601
- t.preventDefault();
602
- let n = ze(t, e.id, m, p);
603
- O(e.id, p, n);
597
+ }) : void 0, B = _ != null, V = A((e) => {
598
+ e.currentTarget.contains(e.relatedTarget) || O?.();
599
+ }, [O]), oe = A((e) => {
600
+ if (!_ || !v || !k) return;
601
+ e.preventDefault();
602
+ let n = we(e, t.id, v, _);
603
+ k(t.id, _, n);
604
604
  }, [
605
- e.id,
606
- m,
607
- p,
608
- O
609
- ]), V = e.id === h, se = e.id === b, ce = p != null && (x?.has(p) ?? !1), H = h != null;
610
- return /* @__PURE__ */ B("li", {
611
- className: a("group/conversation relative", V && "cursor-grabbing opacity-50", se && ce && "rounded", se && ce && X.dropZoneActive, H && !V && !ce && "cursor-not-allowed"),
612
- draggable: I || void 0,
613
- onDragStart: I ? () => w?.(e.id) : void 0,
614
- onDragEnd: I ? T : void 0,
615
- onDragOver: I ? (t) => {
616
- t.preventDefault(), E?.(e.id);
605
+ t.id,
606
+ v,
607
+ _,
608
+ k
609
+ ]), se = t.id === x, ce = t.id === S, H = _ != null && (C?.has(_) ?? !1), U = x != null;
610
+ return /* @__PURE__ */ R("li", {
611
+ className: i("group/conversation relative", se && "cursor-grabbing opacity-50", ce && H && "rounded", ce && H && Z.dropZoneActive, U && !se && !H && "cursor-not-allowed"),
612
+ draggable: B || void 0,
613
+ onDragStart: B ? () => w?.(t.id) : void 0,
614
+ onDragEnd: B ? E : void 0,
615
+ onDragOver: B ? (e) => {
616
+ e.preventDefault(), D?.(t.id);
617
617
  } : void 0,
618
- onDragLeave: I ? ae : void 0,
619
- onDrop: I ? oe : void 0,
620
- children: [/* @__PURE__ */ z("a", {
621
- href: e.href,
618
+ onDragLeave: B ? V : void 0,
619
+ onDrop: B ? oe : void 0,
620
+ children: [/* @__PURE__ */ L("a", {
621
+ href: t.href,
622
622
  className: "contents",
623
- onClick: (t) => {
624
- e.href && (t.preventDefault(), r(e.id));
623
+ onClick: (e) => {
624
+ t.href && (e.preventDefault(), r(t.id));
625
625
  },
626
- children: /* @__PURE__ */ z(f, {
626
+ children: /* @__PURE__ */ L(d, {
627
627
  iconBefore: ne,
628
- label: /* @__PURE__ */ z(C, {
629
- text: e.title,
630
- query: i,
631
- className: e.isUnread ? "dial-small-semi-text" : l,
628
+ label: /* @__PURE__ */ L(b, {
629
+ text: t.title,
630
+ query: a,
631
+ className: t.isUnread ? "dial-small-semi-text" : l,
632
632
  maxLines: 1
633
633
  }),
634
- iconAfter: ie,
634
+ iconAfter: ae,
635
635
  textClassName: "min-w-0 flex-1",
636
636
  "aria-current": n ? "page" : void 0,
637
- onClick: e.href ? void 0 : () => r(e.id),
638
- tabIndex: e.href ? -1 : void 0,
639
- className: a("h-8 w-full justify-start gap-2 py-2 ps-3 after:pointer-events-none", re, X.item, n && X.itemActive, A && X.itemActive)
637
+ onClick: t.href ? void 0 : () => r(t.id),
638
+ tabIndex: t.href ? -1 : void 0,
639
+ className: i("h-8 w-full justify-start gap-2 py-2 ps-3 after:pointer-events-none", ie, Z.item, n && Z.itemActive, j && Z.itemActive)
640
640
  })
641
- }), F && /* @__PURE__ */ z("div", {
642
- className: a("absolute inset-y-0 end-1 flex items-center", A ? "opacity-100" : "opacity-0 group-focus-within/conversation:opacity-100 group-hover/conversation:opacity-100"),
643
- children: /* @__PURE__ */ z(v, {
644
- items: N,
641
+ }), z && /* @__PURE__ */ L("div", {
642
+ className: i("absolute inset-y-0 end-1 flex items-center", j ? "opacity-100" : "opacity-0 group-focus-within/conversation:opacity-100 group-hover/conversation:opacity-100"),
643
+ children: /* @__PURE__ */ L(h, {
644
+ items: P,
645
645
  onOpenChange: te,
646
646
  matchReferenceWidth: !1,
647
647
  listClassName: "w-[200px]",
648
- children: /* @__PURE__ */ z(S, {
649
- ref: M,
650
- icon: /* @__PURE__ */ z(ue, {
651
- size: g.SM,
652
- className: X.triggerIcon,
648
+ children: /* @__PURE__ */ L(y, {
649
+ ref: N,
650
+ icon: /* @__PURE__ */ L(re, {
651
+ size: p.SM,
652
+ className: Z.triggerIcon,
653
653
  "aria-hidden": !0,
654
- stroke: _
654
+ stroke: m
655
655
  }),
656
- size: y.Small,
656
+ size: g.Small,
657
657
  "aria-label": c,
658
- className: a(A && X.triggerActive)
658
+ className: i(j && Z.triggerActive)
659
659
  })
660
660
  })
661
661
  })]
662
662
  });
663
- }, Ge = ({ index: e, style: t, rows: r, expandedGroups: i, onToggleGroup: a, listId: o, activeConversationId: s, searchQuery: c, onSelectConversation: l, getActions: u, onActionMenuOpen: d, actionsLabel: f, unreadIndicatorLabel: p, styles: m, draggingId: h, dragOverId: g, allowedDropGroups: _, onDragStart: v, onDragEnd: y, onDragOver: b, onDragLeave: x, onDrop: S }) => {
663
+ }, je = ({ index: e, style: n, rows: r, expandedGroups: i, onToggleGroup: a, listId: o, activeConversationId: s, searchQuery: c, onSelectConversation: l, getActions: u, onActionMenuOpen: d, actionsLabel: f, unreadIndicatorLabel: p, styles: m, draggingId: h, dragOverId: g, allowedDropGroups: _, onDragStart: v, onDragEnd: y, onDragOver: b, onDragLeave: x, onDrop: S }) => {
664
664
  let C = r[e];
665
- if (C.kind === Y.Header) {
666
- let r = C.groupKey === n.Pinned;
667
- return /* @__PURE__ */ z("div", {
665
+ if (C.kind === X.Header) {
666
+ let r = C.groupKey === t.Pinned;
667
+ return /* @__PURE__ */ L("div", {
668
668
  role: "presentation",
669
- style: t,
669
+ style: n,
670
670
  className: e === 0 ? "pt-0" : "pt-8",
671
- children: /* @__PURE__ */ z(Z, {
671
+ children: /* @__PURE__ */ L(ke, {
672
672
  label: C.label,
673
673
  isExpanded: i.has(C.groupKey),
674
674
  onToggle: () => a(C.groupKey),
675
675
  listId: o,
676
676
  className: m?.groupHeaderClassName,
677
- dropZoneGroupKey: r ? n.Pinned : void 0,
678
- isDragOver: r && g === n.Pinned,
677
+ dropZoneGroupKey: r ? t.Pinned : void 0,
678
+ isDragOver: r && g === t.Pinned,
679
679
  onDragOver: r ? b : void 0,
680
680
  onDragLeave: r ? x : void 0,
681
681
  onDrop: r ? S : void 0
682
682
  })
683
683
  });
684
684
  }
685
- return /* @__PURE__ */ z("div", {
685
+ return /* @__PURE__ */ L("div", {
686
686
  role: "presentation",
687
- style: t,
687
+ style: n,
688
688
  className: "pt-1",
689
- children: /* @__PURE__ */ z(We, {
689
+ children: /* @__PURE__ */ L(Ae, {
690
690
  item: C.item,
691
691
  isActive: C.item.id === s,
692
692
  searchQuery: c,
@@ -709,552 +709,337 @@ var Y = /* @__PURE__ */ function(e) {
709
709
  onDrop: S
710
710
  })
711
711
  });
712
- }, Ke = (e, t) => t === n.All ? !0 : e.source === t, qe = (e, t) => t ? e.title.toLowerCase().includes(t.toLowerCase()) : !0, Je = new Set([
713
- n.Pinned,
714
- n.MyChats,
715
- n.Shared,
716
- n.Organization
717
- ]), Ye = N(({ conversations: e, isLoading: t, isOpen: i, onSelectConversation: o, activeConversationId: s, labels: f, onNewChat: p, styles: m, className: h, isOverlay: g = !1, getActions: _, onActionMenuOpen: v, onToggle: y, headerActions: b, onMoveConversation: x, activeFilter: S, onActiveFilterChange: C, isFilterTabsHidden: w = !1, hiddenSources: T }) => {
718
- let { colors: E, typography: D, newChatButton: k, searchWrapperClassName: A, headerClassName: j, headerActionsClassName: M, newChatButtonClassName: te } = m ?? {}, { title: N, emptyLabel: re, noResultsLabel: ie, loadingLabel: ae = "Loading conversations", newChatLabel: oe, searchPlaceholder: V, searchClearLabel: se, filterLabels: ce, groupLabels: H, actionsLabel: le, unreadIndicatorLabel: ue, closeAriaLabel: de } = f, [U, fe] = R(""), [pe, me] = R(n.All);
719
- F(() => {
720
- S != null && me(S);
712
+ }, Me = (e, n) => n === t.All ? !0 : e.source === n, Ne = (e, t) => t ? e.title.toLowerCase().includes(t.toLowerCase()) : !0, Pe = new Set([
713
+ t.Pinned,
714
+ t.MyChats,
715
+ t.Shared,
716
+ t.Organization
717
+ ]), Fe = k(({ conversations: e, isLoading: r, isOpen: a, onSelectConversation: o, activeConversationId: d, labels: f, onNewChat: p, styles: m, className: h, isOverlay: g = !1, getActions: _, onActionMenuOpen: v, onToggle: y, headerActions: b, onMoveConversation: x, activeFilter: S, onActiveFilterChange: C, isFilterTabsHidden: ee = !1, hiddenSources: E }) => {
718
+ let { colors: D, typography: O, newChatButton: k, searchWrapperClassName: N, headerClassName: te, headerActionsClassName: z, newChatButtonClassName: ne } = m ?? {}, { title: re, emptyLabel: ie, noResultsLabel: ae, loadingLabel: V = "Loading conversations", newChatLabel: oe, searchPlaceholder: se, searchClearLabel: ce, filterLabels: H, groupLabels: U, actionsLabel: le, unreadIndicatorLabel: W, closeAriaLabel: G } = f, [K, ue] = I(""), [q, de] = I(t.All);
719
+ j(() => {
720
+ S != null && de(S);
721
721
  }, [S]);
722
- let W = I(() => T?.length ? e.filter((e) => e.source == null || !T.includes(e.source)) : e, [e, T]), [G, ge] = R(() => Je), [_e, ve] = R(5), K = ne(), ye = L(null), be = L(null), [q, J] = R(null), [xe, Se] = R(null), [Ce, we] = R(null), Te = L(null), Ee = L(null), De = P(({ height: e }) => {
723
- ve(Math.ceil(e / 36 * 2));
724
- }, []), Oe = P((e) => {
725
- fe(e ?? "");
726
- }, []), ke = P((e) => {
727
- ge((t) => {
722
+ let J = P(() => E?.length ? e.filter((e) => e.source == null || !E.includes(e.source)) : e, [e, E]), [Y, fe] = I(() => Pe), [pe, me] = I(5), he = M(), ge = F(null), ye = F(null), [xe, we] = I(null), [Te, De] = I(null), [ke, Ae] = I(null), Fe = F(null), Ie = F(null), Le = A(({ height: e }) => {
723
+ me(Math.ceil(e / 36 * 2));
724
+ }, []), Re = A((e) => {
725
+ ue(e ?? "");
726
+ }, []), ze = A((e) => {
727
+ fe((t) => {
728
728
  let n = new Set(t);
729
729
  return n.has(e) ? n.delete(e) : n.add(e), n;
730
730
  });
731
- }, []), Ae = P(() => {
732
- Te.current = null, Ee.current = null, J(null), Se(null), we(null);
733
- }, []), je = P((e, t) => {
734
- let n = Re(e, Le(t, e), W);
735
- Te.current = e, Ee.current = n, J(e), we(n);
736
- }, [W]), Pe = P(() => {
737
- Ae();
738
- }, [Ae]), Ie = P((e) => {
739
- Se(e);
740
- }, []), ze = P(() => {
741
- Se(null);
742
- }, []), Be = P((e, t, n) => {
743
- let r = Te.current, i = Ee.current;
744
- Ae(), r != null && r !== e && i?.has(t) && x?.({
731
+ }, []), Be = A(() => {
732
+ Fe.current = null, Ie.current = null, we(null), De(null), Ae(null);
733
+ }, []), Ve = A((e, t) => {
734
+ let n = Ce(e, Se(t, e), J);
735
+ Fe.current = e, Ie.current = n, we(e), Ae(n);
736
+ }, [J]), He = A(() => {
737
+ Be();
738
+ }, [Be]), Ue = A((e) => {
739
+ De(e);
740
+ }, []), We = A(() => {
741
+ De(null);
742
+ }, []), Ge = A((e, t, n) => {
743
+ let r = Fe.current, i = Ie.current;
744
+ Be(), r != null && r !== e && i?.has(t) && x?.({
745
745
  draggedId: r,
746
746
  targetGroupKey: t,
747
747
  afterId: n
748
748
  });
749
- }, [Ae, x]), He = r({
750
- "--cp-item-hover": E?.itemHover,
751
- "--cp-item-active": E?.itemActive,
752
- "--cp-text": E?.text,
753
- "--cp-text-secondary": E?.textSecondary,
749
+ }, [Be, x]), Ke = n({
750
+ "--cp-item-hover": D?.itemHover,
751
+ "--cp-item-active": D?.itemActive,
752
+ "--cp-text": D?.text,
753
+ "--cp-text-secondary": D?.textSecondary,
754
754
  "--cp-new-chat-bg": k?.background,
755
755
  "--cp-new-chat-text": k?.text,
756
756
  "--cp-new-chat-focus-outline": k?.focusOutline,
757
- "--cp-drop-zone-ring": E?.dropZoneRing,
758
- "--cp-trigger-bg": E?.triggerBackground,
759
- "--cp-trigger-icon": E?.triggerIcon,
760
- "--cp-trigger-icon-idle": E?.triggerIconIdle,
761
- "--cp-skeleton-color": E?.skeletonColor,
762
- "--cp-unread-dot": E?.unreadDot
763
- }), Z = I(() => W.filter((e) => Ke(e, pe) && qe(e, U)), [
764
- W,
765
- pe,
766
- U
767
- ]), We = I(() => Z.filter((e) => e.isPinned), [Z]), Ye = I(() => Z.filter((e) => !e.isPinned && e.source !== n.Shared && e.source !== n.Organization), [Z]), Xe = I(() => Z.filter((e) => !e.isPinned && e.source === n.Shared), [Z]), Ze = I(() => Z.filter((e) => !e.isPinned && e.source === n.Organization), [Z]), Q = I(() => [
757
+ "--cp-drop-zone-ring": D?.dropZoneRing,
758
+ "--cp-trigger-bg": D?.triggerBackground,
759
+ "--cp-trigger-icon": D?.triggerIcon,
760
+ "--cp-trigger-icon-idle": D?.triggerIconIdle,
761
+ "--cp-skeleton-color": D?.skeletonColor,
762
+ "--cp-unread-dot": D?.unreadDot
763
+ }), Q = P(() => J.filter((e) => Me(e, q) && Ne(e, K)), [
764
+ J,
765
+ q,
766
+ K
767
+ ]), qe = P(() => Q.filter((e) => e.isPinned), [Q]), Je = P(() => Q.filter((e) => !e.isPinned && e.source !== t.Shared && e.source !== t.Organization), [Q]), Ye = P(() => Q.filter((e) => !e.isPinned && e.source === t.Shared), [Q]), Xe = P(() => Q.filter((e) => !e.isPinned && e.source === t.Organization), [Q]), Ze = P(() => [
768
768
  {
769
- key: n.Pinned,
770
- label: H?.pinned ?? "Pinned",
771
- items: We
769
+ key: t.Pinned,
770
+ label: U?.pinned ?? "Pinned",
771
+ items: qe
772
772
  },
773
773
  {
774
- key: n.MyChats,
775
- label: H?.myChats ?? "My chats",
776
- items: Ye
774
+ key: t.MyChats,
775
+ label: U?.myChats ?? "My chats",
776
+ items: Je
777
777
  },
778
778
  {
779
- key: n.Shared,
780
- label: H?.shared ?? "Shared",
781
- items: Xe
779
+ key: t.Shared,
780
+ label: U?.shared ?? "Shared",
781
+ items: Ye
782
782
  },
783
783
  {
784
- key: n.Organization,
785
- label: H?.organization ?? "Organization",
786
- items: Ze
784
+ key: t.Organization,
785
+ label: U?.organization ?? "Organization",
786
+ items: Xe
787
787
  }
788
788
  ], [
789
- H,
790
- We,
789
+ U,
790
+ qe,
791
+ Je,
791
792
  Ye,
792
- Xe,
793
- Ze
794
- ]), $ = I(() => {
793
+ Xe
794
+ ]), $ = P(() => {
795
795
  let e = [];
796
- for (let t of Q) if (t.items.length !== 0 && (e.push({
797
- kind: Y.Header,
796
+ for (let t of Ze) if (t.items.length !== 0 && (e.push({
797
+ kind: X.Header,
798
798
  groupKey: t.key,
799
799
  label: t.label
800
- }), G.has(t.key))) for (let n of t.items) e.push({
801
- kind: Y.Item,
800
+ }), Y.has(t.key))) for (let n of t.items) e.push({
801
+ kind: X.Item,
802
802
  item: n,
803
803
  groupKey: t.key
804
804
  });
805
805
  return e;
806
- }, [Q, G]);
807
- F(() => {
808
- if (!s || be.current === s) return;
809
- let e = $.findIndex((e) => e.kind === Y.Item && e.item.id === s);
810
- e >= 0 && (ye.current?.scrollToRow({
806
+ }, [Ze, Y]);
807
+ j(() => {
808
+ if (!d || ye.current === d) return;
809
+ let e = $.findIndex((e) => e.kind === X.Item && e.item.id === d);
810
+ e >= 0 && (ge.current?.scrollToRow({
811
811
  index: e,
812
812
  align: "smart",
813
813
  behavior: "smooth"
814
- }), be.current = s);
814
+ }), ye.current = d);
815
815
  }, [
816
- s,
817
- Q,
818
- G,
816
+ d,
817
+ Ze,
818
+ Y,
819
819
  $
820
820
  ]);
821
- let Qe = I(() => ({
821
+ let Qe = P(() => ({
822
822
  rows: $,
823
- expandedGroups: G,
824
- onToggleGroup: ke,
825
- listId: K,
826
- activeConversationId: s,
827
- searchQuery: U,
823
+ expandedGroups: Y,
824
+ onToggleGroup: ze,
825
+ listId: he,
826
+ activeConversationId: d,
827
+ searchQuery: K,
828
828
  onSelectConversation: o,
829
829
  getActions: _,
830
830
  onActionMenuOpen: v,
831
831
  actionsLabel: le,
832
- unreadIndicatorLabel: ue,
832
+ unreadIndicatorLabel: W,
833
833
  styles: {
834
- groupHeaderClassName: D?.groupHeaderClassName,
835
- itemTitleClassName: D?.itemTitleClassName,
834
+ groupHeaderClassName: O?.groupHeaderClassName,
835
+ itemTitleClassName: O?.itemTitleClassName,
836
836
  itemIconBadgeClassName: m?.itemIconBadgeClassName
837
837
  },
838
- draggingId: q,
839
- dragOverId: xe,
840
- allowedDropGroups: Ce,
841
- onDragStart: (e) => je(e, $),
842
- onDragEnd: Pe,
843
- onDragOver: Ie,
844
- onDragLeave: ze,
845
- onDrop: Be
838
+ draggingId: xe,
839
+ dragOverId: Te,
840
+ allowedDropGroups: ke,
841
+ onDragStart: (e) => Ve(e, $),
842
+ onDragEnd: He,
843
+ onDragOver: Ue,
844
+ onDragLeave: We,
845
+ onDrop: Ge
846
846
  }), [
847
847
  $,
848
- G,
849
- ke,
848
+ Y,
849
+ ze,
850
+ he,
851
+ d,
850
852
  K,
851
- s,
852
- U,
853
853
  o,
854
854
  _,
855
855
  v,
856
856
  le,
857
- ue,
858
- D?.groupHeaderClassName,
859
- D?.itemTitleClassName,
857
+ W,
858
+ O?.groupHeaderClassName,
859
+ O?.itemTitleClassName,
860
860
  m?.itemIconBadgeClassName,
861
- q,
862
861
  xe,
863
- Ce,
864
- je,
865
- Pe,
866
- Ie,
867
- ze,
868
- Be
869
- ]), $e = W.length === 0, et = W.length > 0 && Z.length === 0;
870
- return /* @__PURE__ */ B(d, {
871
- isOpen: i,
862
+ Te,
863
+ ke,
864
+ Ve,
865
+ He,
866
+ Ue,
867
+ We,
868
+ Ge
869
+ ]), $e = J.length === 0, et = J.length > 0 && Q.length === 0;
870
+ return /* @__PURE__ */ R(u, {
871
+ isOpen: a,
872
872
  isOverlay: g,
873
- orientation: u.Left,
874
- title: N,
873
+ orientation: l.Left,
874
+ title: re,
875
875
  labels: {
876
- ariaLabel: N,
877
- closeLabel: de
876
+ ariaLabel: re,
877
+ closeLabel: G
878
878
  },
879
879
  onClose: y,
880
880
  styles: {
881
881
  colors: {
882
- background: E?.background,
883
- border: E?.border
882
+ background: D?.background,
883
+ border: D?.border
884
884
  },
885
- typography: { fontClassName: D?.fontClassName },
885
+ typography: { fontClassName: O?.fontClassName },
886
886
  bodyClassName: "flex flex-col overflow-hidden p-0 gap-3",
887
- cssVars: He,
888
- titleClassName: D?.fontClassName,
889
- headerClassName: a("h-[64px]", j),
890
- headerActionsClassName: M,
891
- className: a(i ? "w-[324px] mobile:w-full" : "w-0", h)
887
+ cssVars: Ke,
888
+ titleClassName: O?.fontClassName,
889
+ headerClassName: i("h-[64px]", te),
890
+ headerActionsClassName: z,
891
+ className: i(a ? "w-[324px] mobile:w-full" : "w-0", h)
892
892
  },
893
893
  rightActions: b,
894
894
  children: [
895
- /* @__PURE__ */ z(Ue, {
895
+ /* @__PURE__ */ L(Oe, {
896
896
  label: oe,
897
897
  onClick: p,
898
- labelClassName: D?.newChatLabelClassName,
898
+ labelClassName: O?.newChatLabelClassName,
899
899
  colors: k,
900
- className: te
900
+ className: ne
901
901
  }),
902
- /* @__PURE__ */ z("div", {
902
+ /* @__PURE__ */ L("div", {
903
903
  role: "search",
904
- className: a("px-3 py-2", he.search),
905
- children: /* @__PURE__ */ z(O, {
906
- wrapperClassName: a(X.search, A),
907
- value: U,
908
- onChange: Oe,
909
- placeholder: V,
910
- clearLabel: se,
911
- "aria-label": V
904
+ className: i("px-3 py-2", B.search),
905
+ children: /* @__PURE__ */ L(w, {
906
+ wrapperClassName: i(Z.search, N),
907
+ value: K,
908
+ onChange: Re,
909
+ placeholder: se,
910
+ clearLabel: ce,
911
+ "aria-label": se
912
912
  })
913
913
  }),
914
- !w && /* @__PURE__ */ z(Ve, {
915
- activeTab: pe,
916
- labels: ce,
914
+ !ee && /* @__PURE__ */ L(Ee, {
915
+ activeTab: q,
916
+ labels: H,
917
917
  onChange: (e) => {
918
- me(e), C?.(e);
918
+ de(e), C?.(e);
919
919
  },
920
- tabClassName: D?.tabClassName,
921
- hiddenSources: T
920
+ tabClassName: O?.tabClassName,
921
+ hiddenSources: E
922
922
  }),
923
- /* @__PURE__ */ z("span", {
923
+ /* @__PURE__ */ L("span", {
924
924
  role: "status",
925
925
  "aria-live": "polite",
926
926
  className: "sr-only",
927
- children: t ? ae : $e ? re : et ? ie : ""
927
+ children: r ? V : $e ? ie : et ? ae : ""
928
928
  }),
929
- /* @__PURE__ */ z("div", {
929
+ /* @__PURE__ */ L("div", {
930
930
  className: "flex-1 overflow-hidden px-3 py-1",
931
- children: t ? /* @__PURE__ */ z("div", {
931
+ children: r ? /* @__PURE__ */ L("div", {
932
932
  className: "flex flex-col gap-3 px-2 py-3",
933
- children: Array.from({ length: 15 }, (e, t) => /* @__PURE__ */ z(ee, {
933
+ children: Array.from({ length: 15 }, (e, t) => /* @__PURE__ */ L(T, {
934
934
  avatar: { size: 24 },
935
- showTitle: { width: Ne(t) },
935
+ showTitle: { width: ve(t) },
936
936
  paragraph: !1,
937
937
  active: !0,
938
- color: X.skeletonColor
938
+ color: Z.skeletonColor
939
939
  }, t))
940
- }) : $e ? /* @__PURE__ */ z(c, { label: re }) : et ? /* @__PURE__ */ z(l, { label: ie }) : /* @__PURE__ */ z(Me, {
941
- listRef: ye,
942
- id: K,
940
+ }) : $e ? /* @__PURE__ */ L(s, { label: ie }) : et ? /* @__PURE__ */ L(c, { label: ae }) : /* @__PURE__ */ L(_e, {
941
+ listRef: ge,
942
+ id: he,
943
943
  role: "list",
944
944
  style: { height: "100%" },
945
- rowComponent: Ge,
945
+ rowComponent: je,
946
946
  rowCount: $.length,
947
- rowHeight: Fe,
948
- overscanCount: _e,
949
- onResize: De,
947
+ rowHeight: be,
948
+ overscanCount: pe,
949
+ onResize: Le,
950
950
  rowProps: Qe
951
951
  })
952
952
  })
953
953
  ]
954
954
  });
955
- }), Xe = 8e3, Ze = "flex size-7 shrink-0 items-center justify-center", Q = {
956
- root: "_root_11lia_1",
957
- text: "_text_11lia_5",
958
- textSecondary: "_textSecondary_11lia_9",
959
- divider: "_divider_11lia_13",
960
- successIcon: "_successIcon_11lia_17",
961
- errorIcon: "_errorIcon_11lia_21",
962
- failureCount: "_failureCount_11lia_25",
963
- warningIcon: "_warningIcon_11lia_35"
964
- }, $ = ({ title: e, failedCount: t, isCollapsed: n, jobsId: r, labels: i, styles: o, onToggleCollapse: s, onClose: c }) => {
965
- let l = o?.typography;
966
- return /* @__PURE__ */ B("div", {
967
- className: a(Q.divider, "mx-4 flex items-center justify-between py-3"),
968
- children: [/* @__PURE__ */ B("div", {
969
- className: "flex min-w-0 items-center gap-2",
970
- children: [/* @__PURE__ */ z("span", {
971
- className: a(Q.text, "truncate", l?.titleClassName || "dial-small-paragraph-semi-text"),
972
- children: e
973
- }), t > 0 && /* @__PURE__ */ z("span", {
974
- className: a(Q.failureCount, "inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full px-1", l?.failureCountClassName || "dial-small-paragraph-semi-text"),
975
- children: t
976
- })]
977
- }), /* @__PURE__ */ B("div", {
978
- className: "flex shrink-0 items-center gap-1",
979
- children: [/* @__PURE__ */ z(S, {
980
- "aria-label": n ? i.expandQueueAriaLabel : i.collapseQueueAriaLabel,
981
- size: y.Small,
982
- "aria-expanded": !n,
983
- "aria-controls": r,
984
- icon: z(n ? le : H, {
985
- size: g.SM,
986
- className: Q.textSecondary,
987
- stroke: _,
988
- "aria-hidden": !0
989
- }),
990
- onClick: s,
991
- className: Ze
992
- }), /* @__PURE__ */ z(S, {
993
- "aria-label": i.closeQueueAriaLabel,
994
- size: y.Small,
995
- icon: /* @__PURE__ */ z(W, {
996
- size: g.SM,
997
- className: Q.textSecondary,
998
- stroke: _,
999
- "aria-hidden": !0
1000
- }),
1001
- onClick: c,
1002
- className: Ze
1003
- })]
1004
- })]
1005
- });
1006
- }, Qe = [".dial", ".zip"], $e = (e) => {
1007
- let t = e.toLowerCase();
1008
- return Qe.some((e) => t.endsWith(e)) ? U : t.endsWith(".json") ? fe : de;
1009
- }, et = ({ job: t, labels: n, onCancel: r, styles: i }) => {
1010
- let o = i?.typography, s = $e(t.fileName), c = t.status === e.Canceled;
1011
- return /* @__PURE__ */ B("div", {
1012
- className: "group flex items-center gap-2 px-4 py-2",
1013
- children: [
1014
- /* @__PURE__ */ z(s, {
1015
- size: g.SM,
1016
- stroke: _,
1017
- className: Q.textSecondary,
1018
- "aria-hidden": !0
1019
- }),
1020
- /* @__PURE__ */ z(b, {
1021
- text: t.fileName,
1022
- className: a(c ? Q.textSecondary : Q.text, o?.jobLabelClassName || "dial-small-text"),
1023
- contentClassName: "!z-[80]"
1024
- }),
1025
- t.status === e.InProgress && /* @__PURE__ */ B("div", {
1026
- className: a("flex size-7 shrink-0 items-center justify-center", "grid"),
1027
- children: [/* @__PURE__ */ z(A, {
1028
- size: g.SM,
1029
- ariaLabel: n.jobProgressAriaLabel(t.fileName),
1030
- className: "pointer-events-none col-start-1 row-start-1 opacity-100 transition-opacity group-focus-within:opacity-0 group-hover:opacity-0"
1031
- }), /* @__PURE__ */ z(S, {
1032
- "aria-label": n.cancelJobAriaLabel(t.fileName),
1033
- size: y.Small,
1034
- icon: /* @__PURE__ */ z(W, {
1035
- size: g.SM,
1036
- className: Q.textSecondary,
1037
- stroke: _,
1038
- "aria-hidden": !0
1039
- }),
1040
- onClick: () => r(t.id),
1041
- className: "col-start-1 row-start-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100"
1042
- })]
1043
- }),
1044
- t.status === e.Success && /* @__PURE__ */ z("span", {
1045
- className: "flex size-7 shrink-0 items-center justify-center",
1046
- children: /* @__PURE__ */ z(ce, {
1047
- size: g.SM,
1048
- stroke: _,
1049
- className: Q.successIcon,
1050
- "aria-hidden": !0
1051
- })
1052
- }),
1053
- t.status === e.Warning && /* @__PURE__ */ z(j, {
1054
- tooltip: n.jobWarningMessage(t.warningCode, t.warningNames),
1055
- contentClassName: "!z-[80]",
1056
- asChild: !0,
1057
- children: /* @__PURE__ */ z("span", {
1058
- className: "flex size-7 shrink-0 items-center justify-center",
1059
- role: "img",
1060
- "aria-label": n.jobWarningMessage(t.warningCode, t.warningNames),
1061
- tabIndex: 0,
1062
- children: /* @__PURE__ */ z(oe, {
1063
- size: g.SM,
1064
- className: Q.warningIcon,
1065
- "aria-hidden": !0
1066
- })
1067
- })
1068
- }),
1069
- t.status === e.Failed && /* @__PURE__ */ z(j, {
1070
- tooltip: n.jobErrorMessage(t.errorCode),
1071
- contentClassName: "!z-[80]",
1072
- asChild: !0,
1073
- children: /* @__PURE__ */ z("span", {
1074
- className: "flex size-7 shrink-0 items-center justify-center",
1075
- role: "img",
1076
- "aria-label": n.jobErrorMessage(t.errorCode),
1077
- tabIndex: 0,
1078
- children: /* @__PURE__ */ z(ae, {
1079
- size: g.SM,
1080
- className: Q.errorIcon,
1081
- "aria-hidden": !0
1082
- })
1083
- })
1084
- }),
1085
- c && /* @__PURE__ */ z("span", {
1086
- className: a(Q.textSecondary, "shrink-0", o?.canceledLabelClassName || "dial-small-text"),
1087
- children: n.canceledLabel
1088
- })
1089
- ]
1090
- });
1091
- }, tt = (e) => Math.round(e.reduce((e, t) => e + t.progress.percent, 0) / e.length), nt = (t) => t.filter((t) => t.status !== e.InProgress).length, rt = (e, t, n) => e && t ? n.closeQueueConfirmDescriptionMixed : t ? n.closeQueueConfirmDescriptionFailed : n.closeQueueConfirmDescriptionInProgress, it = N(({ title: t, jobs: n, onClose: i, onCancel: o, labels: s, styles: c }) => {
1092
- let [l, u] = R(!1), d = ne(), [f, p] = R(!1), g = c?.colors, _ = {
1093
- ...r({
1094
- "--cp-transfer-queue-bg": g?.background,
1095
- "--cp-transfer-queue-text": g?.text,
1096
- "--cp-transfer-queue-text-secondary": g?.textSecondary,
1097
- "--cp-transfer-queue-success-icon": g?.successIcon,
1098
- "--cp-transfer-queue-error-icon": g?.errorIcon,
1099
- "--cp-transfer-queue-warning-icon": g?.warningIcon,
1100
- "--cp-transfer-queue-divider": g?.divider,
1101
- "--cp-transfer-queue-failure-count-bg": g?.failureCountBackground,
1102
- "--cp-transfer-queue-failure-count-text": g?.failureCountText
1103
- }),
1104
- ...c?.cssVars
1105
- }, v = n.some((t) => t.status === e.InProgress), b = n.some((t) => t.status === e.Failed), x = n.length > 0 && n.every((t) => t.status === e.Success), S = P(() => {
1106
- v || b ? p(!0) : i();
1107
- }, [
1108
- v,
1109
- b,
1110
- i
1111
- ]), C = P(() => {
1112
- p(!1), i();
1113
- }, [i]), w = P(() => {
1114
- u((e) => !e);
1115
- }, []);
1116
- if (F(() => {
1117
- if (!x) return;
1118
- let e = setTimeout(i, Xe);
1119
- return () => clearTimeout(e);
1120
- }, [x, i]), n.length === 0) return null;
1121
- let T = n.filter((t) => t.status === e.Failed).length;
1122
- return /* @__PURE__ */ B("div", {
1123
- role: "status",
1124
- "aria-live": "polite",
1125
- style: _,
1126
- className: a(Q.root, "w-[370px] max-w-[calc(100vw-2rem)] rounded-xl shadow-md", c?.rootClassName),
1127
- children: [
1128
- /* @__PURE__ */ z($, {
1129
- title: t,
1130
- failedCount: T,
1131
- isCollapsed: l,
1132
- jobsId: d,
1133
- labels: s,
1134
- styles: c,
1135
- onToggleCollapse: w,
1136
- onClose: S
1137
- }),
1138
- l && v && /* @__PURE__ */ z(D, {
1139
- value: tt(n),
1140
- size: y.Small,
1141
- "aria-label": s.queueProgressAriaLabel,
1142
- "aria-valuetext": s.queueProgressValueText(nt(n), n.length)
1143
- }),
1144
- !l && /* @__PURE__ */ z("div", {
1145
- id: d,
1146
- className: a("flex max-h-[40vh] flex-col overflow-y-auto py-1", c?.bodyClassName),
1147
- children: n.map((e) => /* @__PURE__ */ z(et, {
1148
- job: e,
1149
- labels: s,
1150
- onCancel: o,
1151
- styles: c
1152
- }, e.id))
1153
- }),
1154
- /* @__PURE__ */ z(m, {
1155
- open: f,
1156
- header: s.closeQueueConfirmHeader,
1157
- description: rt(v, b, s),
1158
- confirmLabel: s.closeLabel,
1159
- cancelLabel: s.cancelLabel,
1160
- variant: h.Danger,
1161
- onConfirm: C,
1162
- onClose: () => p(!1)
1163
- })
1164
- ]
1165
- });
1166
- });
1167
- it.displayName = "ImportExportQueue";
1168
- //#endregion
1169
- //#region src/components/RenameConversationPopup/RenameConversationPopup.tsx
1170
- var at = N(({ isOpen: e, currentTitle: t, isSaving: n, error: r, onSave: a, onCancel: c, onGenerateWithAi: l, labels: u, styles: d }) => {
1171
- let [f, m] = R(t), [h, v] = R(!1), [y, b] = R(null), x = L(null), C = L(!1), D = L(0);
1172
- F(() => {
1173
- let n = e && !C.current;
1174
- if (C.current = e, !e) {
955
+ }), Ie = k(({ isOpen: e, currentTitle: t, isSaving: n, error: i, onSave: s, onCancel: c, onGenerateWithAi: l, labels: u, styles: d }) => {
956
+ let [h, g] = I(t), [_, v] = I(!1), [b, w] = I(null), T = F(null), ee = F(!1), D = F(0);
957
+ j(() => {
958
+ let n = e && !ee.current;
959
+ if (ee.current = e, !e) {
1175
960
  D.current += 1, v(!1);
1176
961
  return;
1177
962
  }
1178
963
  if (!n) return;
1179
- D.current += 1, m(t), b(null), v(!1);
1180
- let r = setTimeout(() => x.current?.focus(), 0);
964
+ D.current += 1, g(t), w(null), v(!1);
965
+ let r = setTimeout(() => T.current?.focus(), 0);
1181
966
  return () => clearTimeout(r);
1182
- }, [e, t]), F(() => () => {
967
+ }, [e, t]), j(() => () => {
1183
968
  D.current += 1;
1184
969
  }, []);
1185
- let O = s(f.trim()), ee = i(O) > 255, k = n || O === "" || O === t.trim() || ee, j = P(() => {
1186
- k || a(O);
970
+ let O = o(h.trim()), k = r(O) > 255, M = n || O === "" || O === t.trim() || k, N = A(() => {
971
+ M || s(O);
1187
972
  }, [
1188
- k,
1189
- a,
973
+ M,
974
+ s,
1190
975
  O
1191
- ]), M = P((e) => {
1192
- e.key === "Enter" && j();
1193
- }, [j]), te = P(async () => {
1194
- if (h) return;
976
+ ]), te = A((e) => {
977
+ e.key === "Enter" && N();
978
+ }, [N]), P = A(async () => {
979
+ if (_) return;
1195
980
  let e = ++D.current;
1196
- v(!0), b(null);
981
+ v(!0), w(null);
1197
982
  try {
1198
983
  let t = await l();
1199
984
  if (e !== D.current) return;
1200
- m(o(t));
985
+ g(a(t));
1201
986
  } catch {
1202
987
  if (e !== D.current) return;
1203
- b(u.renameWithAiError);
988
+ w(u.renameWithAiError);
1204
989
  } finally {
1205
990
  e === D.current && v(!1);
1206
991
  }
1207
992
  }, [
1208
- h,
993
+ _,
1209
994
  l,
1210
995
  u.renameWithAiError
1211
- ]), N;
1212
- return N = ee ? u.nameTooLongError : y ?? r ?? void 0, /* @__PURE__ */ z(T, {
996
+ ]), z;
997
+ return z = k ? u.nameTooLongError : b ?? i ?? void 0, /* @__PURE__ */ L(S, {
1213
998
  open: e,
1214
999
  header: u.popupTitle,
1215
- size: E.Sm,
1000
+ size: C.Sm,
1216
1001
  onClose: c,
1217
1002
  mainButtons: n ? void 0 : [{
1218
1003
  label: u.cancelLabel,
1219
1004
  onClick: c
1220
1005
  }, {
1221
1006
  label: u.saveLabel,
1222
- variant: p.Primary,
1223
- disabled: k,
1224
- onClick: j
1007
+ variant: f.Primary,
1008
+ disabled: M,
1009
+ onClick: N
1225
1010
  }],
1226
- children: /* @__PURE__ */ z("div", {
1011
+ children: /* @__PURE__ */ L("div", {
1227
1012
  className: d?.bodyClassName,
1228
1013
  style: d?.cssVars,
1229
- children: n ? /* @__PURE__ */ z("div", {
1014
+ children: n ? /* @__PURE__ */ L("div", {
1230
1015
  className: "h-[120px] px-6 py-4",
1231
- children: /* @__PURE__ */ z(A, { size: 50 })
1232
- }) : /* @__PURE__ */ B("div", {
1016
+ children: /* @__PURE__ */ L(E, { size: 50 })
1017
+ }) : /* @__PURE__ */ R("div", {
1233
1018
  className: "flex items-start gap-2 px-6 py-3",
1234
- children: [/* @__PURE__ */ z("div", {
1019
+ children: [/* @__PURE__ */ L("div", {
1235
1020
  className: "min-w-0 flex-1",
1236
- children: /* @__PURE__ */ z(w, {
1237
- inputRef: x,
1238
- value: f,
1021
+ children: /* @__PURE__ */ L(x, {
1022
+ inputRef: T,
1023
+ value: h,
1239
1024
  placeholder: u.inputPlaceholder,
1240
- error: N,
1241
- onChange: (e) => m(o(e ?? "")),
1242
- onKeyDown: M
1025
+ error: z,
1026
+ onChange: (e) => g(a(e ?? "")),
1027
+ onKeyDown: te
1243
1028
  })
1244
- }), /* @__PURE__ */ z(S, {
1029
+ }), /* @__PURE__ */ L(y, {
1245
1030
  "aria-label": u.renameWithAiLabel,
1246
1031
  tooltipProps: { tooltip: u.renameWithAiLabel },
1247
- disabled: h || n,
1248
- onClick: te,
1249
- icon: h ? /* @__PURE__ */ z(A, { size: g.MD }) : /* @__PURE__ */ z(me, {
1250
- size: g.MD,
1251
- stroke: _
1032
+ disabled: _ || n,
1033
+ onClick: P,
1034
+ icon: _ ? /* @__PURE__ */ L(E, { size: p.MD }) : /* @__PURE__ */ L(ae, {
1035
+ size: p.MD,
1036
+ stroke: m
1252
1037
  })
1253
1038
  })]
1254
1039
  })
1255
1040
  })
1256
1041
  });
1257
1042
  });
1258
- at.displayName = "RenameConversationPopup";
1043
+ Ie.displayName = "RenameConversationPopup";
1259
1044
  //#endregion
1260
- export { he as CONVERSATION_PANEL_CLASS, Ye as ConversationPanel, it as ImportExportQueue, at as RenameConversationPopup, $e as getTransferFileIcon };
1045
+ export { B as CONVERSATION_PANEL_CLASS, Fe as ConversationPanel, Ie as RenameConversationPopup };