@epam/ai-dial-projects 1.3.0-dev.249 → 1.3.0-dev.253

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,43 +1,43 @@
1
- import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as t, MarkdownRenderer as n, PROHIBITED_CONVERSATION_NAME_CHARS_RE as r, PanelEmptyState as i, RequestStatus as a, TextRefinementField as o, buildCssVars as ee, getAttachmentTypeFromMime as s, inferMimeTypeFromPath as c, mergeClasses as l, useAvailableHeightCap as u, useTextRefinement as d } from "@epam/ai-dial-chat-shared";
2
- import { Button as te, ButtonAppearance as f, ButtonDropdown as p, ButtonVariant as m, CardShell as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, Dropdown as v, ElementSize as ne, EllipsisTooltip as y, ErrorText as b, FileDropzone as re, FolderPath as x, GhostButton as S, GhostIconButton as C, Highlight as w, Input as T, Label as E, LiveRegion as ie, LiveRegionElement as ae, LiveRegionPoliteness as oe, MenuItemMark as D, NeutralButton as se, ProgressBar as O, ProgressBarRole as ce, Search as le, Spinner as ue, Textarea as de } from "@epam/ai-dial-ui-kit";
3
- import { IconArrowNarrowLeft as fe, IconArrowsSort as k, IconDotsVertical as pe, IconPin as A, IconPinFilled as j } from "@tabler/icons-react";
4
- import { Suspense as M, lazy as N, memo as P, useCallback as F, useEffect as I, useId as L, useMemo as R, useRef as z, useState as B } from "react";
5
- import { Fragment as me, jsx as V, jsxs as H } from "react/jsx-runtime";
6
- import { AttachmentCard as he, FileDndOverlay as ge } from "@epam/ai-dial-attachment-input";
7
- import { BuilderFormContainer as _e } from "@epam/ai-dial-builder-form";
8
- import { LazyMarkdownEditor as ve } from "@epam/ai-dial-ui-kit/editors";
1
+ import { DeleteConfirmationDialog as e, InitialsAvatar as t, MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as n, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as r, MarkdownRenderer as i, PROHIBITED_CONVERSATION_NAME_CHARS_RE as a, PanelEmptyState as o, RequestStatus as s, TextRefinementField as c, buildCssVars as ee, getAttachmentTypeFromMime as l, inferMimeTypeFromPath as u, mergeClasses as d, useAvailableHeightCap as f, useTextRefinement as p } from "@epam/ai-dial-chat-shared";
2
+ import { Button as m, ButtonAppearance as h, ButtonDropdown as g, ButtonVariant as _, CardShell as v, DIAL_ICON_SIZE as y, DIAL_KIT_ICON_STROKE as b, Dropdown as x, ElementSize as S, EllipsisTooltip as C, ErrorText as w, FileDropzone as T, FolderPath as E, GhostButton as D, GhostIconButton as O, Highlight as k, Input as te, Label as A, LiveRegion as j, LiveRegionElement as ne, LiveRegionPoliteness as M, MenuItemMark as N, NeutralButton as re, Popup as P, PopupSize as ie, ProgressBar as F, ProgressBarRole as I, Search as L, Spinner as ae, Textarea as R } from "@epam/ai-dial-ui-kit";
3
+ import { IconArrowNarrowLeft as z, IconArrowsSort as oe, IconDotsVertical as se, IconPin as ce, IconPinFilled as le } from "@tabler/icons-react";
4
+ import { Suspense as ue, lazy as de, memo as B, useCallback as V, useEffect as fe, useId as H, useMemo as U, useRef as W, useState as G } from "react";
5
+ import { Fragment as pe, jsx as K, jsxs as q } from "react/jsx-runtime";
6
+ import { AttachmentCard as me, FileDndOverlay as he } from "@epam/ai-dial-attachment-input";
7
+ import { BuilderFormContainer as ge } from "@epam/ai-dial-builder-form";
8
+ import { LazyMarkdownEditor as _e } from "@epam/ai-dial-ui-kit/editors";
9
9
  //#region src/types/projects-sort-key.ts
10
- var U = /* @__PURE__ */ function(e) {
10
+ var ve = /* @__PURE__ */ function(e) {
11
11
  return e.Newest = "newest", e.Oldest = "oldest", e.NameAsc = "name-asc", e;
12
- }({}), ye = (e, t) => {
12
+ }({}), J = (e, t) => {
13
13
  let n = t.trim().toLocaleLowerCase();
14
14
  return n ? e.filter((e) => e.name.toLocaleLowerCase().includes(n)) : e;
15
- }, be = (e, t, n) => {
15
+ }, ye = (e, t, n) => {
16
16
  let r = new Intl.Collator(n, {
17
17
  sensitivity: "base",
18
18
  numeric: !0
19
19
  }), i = (e, t) => r.compare(e.name, t.name), a = (e, t) => Number(t.isPinned ?? !1) - Number(e.isPinned ?? !1);
20
- if (t === U.NameAsc) return [...e].sort((e, t) => a(e, t) || i(e, t));
21
- let o = t === U.Oldest ? 1 : -1;
20
+ if (t === ve.NameAsc) return [...e].sort((e, t) => a(e, t) || i(e, t));
21
+ let o = t === ve.Oldest ? 1 : -1;
22
22
  return [...e].sort((e, t) => {
23
23
  let n = a(e, t);
24
24
  return n === 0 ? e.updatedAt == null && t.updatedAt == null ? i(e, t) : e.updatedAt == null ? 1 : t.updatedAt == null ? -1 : (e.updatedAt - t.updatedAt) * o || i(e, t) : n;
25
25
  });
26
- }, xe = 60, Se = 3600, W = 24 * Se, G = [
27
- ["year", 365 * W],
28
- ["month", 30 * W],
29
- ["week", 7 * W],
30
- ["day", W],
31
- ["hour", Se],
32
- ["minute", xe]
26
+ }, be = 60, xe = 3600, Y = 24 * xe, Se = [
27
+ ["year", 365 * Y],
28
+ ["month", 30 * Y],
29
+ ["week", 7 * Y],
30
+ ["day", Y],
31
+ ["hour", xe],
32
+ ["minute", be]
33
33
  ], Ce = (e, t, n) => {
34
34
  let r = (t - e) / 1e3;
35
- for (let [e, t] of G) {
35
+ for (let [e, t] of Se) {
36
36
  let i = Math.floor(r / t);
37
37
  if (i >= 1) return new Intl.RelativeTimeFormat(n).format(-i, e);
38
38
  }
39
39
  return new Intl.RelativeTimeFormat(n, { numeric: "auto" }).format(0, "second");
40
- }, K = {
40
+ }, X = {
41
41
  card: "_card_1o77o_1",
42
42
  title: "_title_1o77o_5",
43
43
  updatedAt: "_updatedAt_1o77o_9",
@@ -46,259 +46,259 @@ var U = /* @__PURE__ */ function(e) {
46
46
  link: "_link_1o77o_23",
47
47
  aboveLink: "_aboveLink_1o77o_39",
48
48
  interactive: "_interactive_1o77o_44"
49
- }, we = (e, t) => [e, ...(t ?? "").split("/").filter((e) => e.length > 0)], Te = (e) => e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, Ee = ({ project: e, searchQuery: t, sourceLabel: n, folderPathLabel: r, pinnedLabel: i, href: a, onOpen: o, now: ee, locale: s, updatedAtClassName: c, titleClassName: u, pathLabelClassName: d, pathLeafClassName: te }) => {
50
- let f = /* @__PURE__ */ V(w, {
49
+ }, we = (e, t) => [e, ...(t ?? "").split("/").filter((e) => e.length > 0)], Te = (e) => e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, Ee = ({ project: e, searchQuery: t, sourceLabel: n, folderPathLabel: r, pinnedLabel: i, href: a, onOpen: o, now: s, locale: c, updatedAtClassName: ee, titleClassName: l, pathLabelClassName: u, pathLeafClassName: f }) => {
50
+ let p = /* @__PURE__ */ K(k, {
51
51
  text: e.name,
52
52
  query: t,
53
53
  maxLines: 1,
54
- className: l("min-w-0", u, K.title, a != null && K.aboveLink)
54
+ className: d("min-w-0", l, X.title, a != null && X.aboveLink)
55
55
  });
56
- return /* @__PURE__ */ V("li", {
56
+ return /* @__PURE__ */ K("li", {
57
57
  className: "flex min-w-0",
58
- children: /* @__PURE__ */ H(h, {
58
+ children: /* @__PURE__ */ q(v, {
59
59
  "aria-label": e.name,
60
- className: l("relative flex w-full min-w-0 flex-col gap-2", K.card, a != null && "has-focus-visible:-translate-y-[3px] has-focus-visible:shadow-lg motion-reduce:has-focus-visible:translate-y-0", a != null && K.interactive),
60
+ className: d("relative flex w-full min-w-0 flex-col gap-2", X.card, a != null && "has-focus-visible:-translate-y-[3px] has-focus-visible:shadow-lg motion-reduce:has-focus-visible:translate-y-0", a != null && X.interactive),
61
61
  children: [
62
- e.updatedAt != null && /* @__PURE__ */ V("time", {
62
+ e.updatedAt != null && /* @__PURE__ */ K("time", {
63
63
  dateTime: new Date(e.updatedAt).toISOString(),
64
- className: l(c, K.updatedAt),
65
- children: Ce(e.updatedAt, ee, s)
64
+ className: d(ee, X.updatedAt),
65
+ children: Ce(e.updatedAt, s, c)
66
66
  }),
67
- /* @__PURE__ */ H("div", {
67
+ /* @__PURE__ */ q("div", {
68
68
  className: "flex min-w-0 items-center gap-2",
69
- children: [a == null ? /* @__PURE__ */ V("div", {
69
+ children: [a == null ? /* @__PURE__ */ K("div", {
70
70
  className: "min-w-0 flex-1",
71
- children: f
72
- }) : /* @__PURE__ */ V("a", {
71
+ children: p
72
+ }) : /* @__PURE__ */ K("a", {
73
73
  href: a,
74
74
  onClick: (t) => {
75
75
  o != null && Te(t) && (t.preventDefault(), o(e.id));
76
76
  },
77
- className: l("min-w-0 flex-1", K.link),
78
- children: f
79
- }), e.isPinned && /* @__PURE__ */ H("span", {
80
- className: l("shrink-0", K.pin),
81
- children: [/* @__PURE__ */ V(j, {
82
- size: g.SM,
77
+ className: d("min-w-0 flex-1", X.link),
78
+ children: p
79
+ }), e.isPinned && /* @__PURE__ */ q("span", {
80
+ className: d("shrink-0", X.pin),
81
+ children: [/* @__PURE__ */ K(le, {
82
+ size: y.SM,
83
83
  "aria-hidden": !0
84
- }), /* @__PURE__ */ V("span", {
84
+ }), /* @__PURE__ */ K("span", {
85
85
  className: "sr-only",
86
86
  children: i
87
87
  })]
88
88
  })]
89
89
  }),
90
- /* @__PURE__ */ V(x, {
90
+ /* @__PURE__ */ K(E, {
91
91
  segments: we(n, e.parentPath),
92
92
  ariaLabel: r,
93
- labelClassName: l(d, K.path),
94
- leafClassName: l(te, K.path),
95
- className: l(a != null && K.aboveLink)
93
+ labelClassName: d(u, X.path),
94
+ leafClassName: d(f, X.path),
95
+ className: d(a != null && X.aboveLink)
96
96
  })
97
97
  ]
98
98
  })
99
99
  });
100
- }, q = {
100
+ }, Z = {
101
101
  container: "_container_qfuxj_1",
102
102
  subtitle: "_subtitle_qfuxj_5",
103
103
  sortButton: "_sortButton_qfuxj_9"
104
- }, J = ({ projects: e, isLoading: t = !1, hasError: n = !1, incompleteSources: r = [], onRetry: a, onCreateProject: o, onOpenProject: s, getProjectHref: c, searchQuery: u, onSearchQueryChange: d, sortKey: h, onSortKeyChange: v, labels: y, locale: b, styles: re }) => {
105
- let { colors: x, typography: C } = re ?? {}, w = C?.titleClassName ?? "dial-h2-text", T = C?.subtitleClassName ?? "dial-body-text", E = C?.cardTitleClassName ?? "dial-body-semi-text", oe = C?.pathLabelClassName ?? "dial-tiny-text", se = C?.pathLeafClassName ?? "dial-tiny-semi-text", O = C?.updatedAtClassName ?? "dial-tiny-text", ce = C?.emptyStateDescriptionClassName ?? "dial-small-paragraph-text", de = ee({
106
- "--pr-bg": x?.background,
107
- "--pr-subtitle-text": x?.subtitleText,
108
- "--pr-sort-text": x?.sortButtonText,
109
- "--pr-card-bg": x?.cardBackground,
110
- "--pr-card-title-text": x?.cardTitleText,
111
- "--pr-updated-at-text": x?.updatedAtText,
112
- "--pr-path-text": x?.pathText
113
- }), [fe] = B(() => Date.now()), pe = u.trim(), A = r.length > 0, j = A && e.length === 0, M = R(() => be(ye(e, u), h, b), [
104
+ }, De = ({ projects: e, isLoading: t = !1, hasError: n = !1, incompleteSources: r = [], onRetry: i, onCreateProject: a, onOpenProject: s, getProjectHref: c, searchQuery: l, onSearchQueryChange: u, sortKey: f, onSortKeyChange: p, labels: v, locale: x, styles: C }) => {
105
+ let { colors: w, typography: T } = C ?? {}, E = T?.titleClassName ?? "dial-h2-text", O = T?.subtitleClassName ?? "dial-body-text", k = T?.cardTitleClassName ?? "dial-body-semi-text", te = T?.pathLabelClassName ?? "dial-tiny-text", A = T?.pathLeafClassName ?? "dial-tiny-semi-text", M = T?.updatedAtClassName ?? "dial-tiny-text", re = T?.emptyStateDescriptionClassName ?? "dial-small-paragraph-text", P = ee({
106
+ "--pr-bg": w?.background,
107
+ "--pr-subtitle-text": w?.subtitleText,
108
+ "--pr-sort-text": w?.sortButtonText,
109
+ "--pr-card-bg": w?.cardBackground,
110
+ "--pr-card-title-text": w?.cardTitleText,
111
+ "--pr-updated-at-text": w?.updatedAtText,
112
+ "--pr-path-text": w?.pathText
113
+ }), [ie] = G(() => Date.now()), F = l.trim(), I = r.length > 0, R = I && e.length === 0, z = U(() => ye(J(e, l), f, x), [
114
114
  e,
115
- u,
116
- h,
117
- b
118
- ]), N = y.sortOptions.find((e) => e.value === h)?.label ?? y.sortLabel, P = R(() => y.sortOptions.map((e) => ({
115
+ l,
116
+ f,
117
+ x
118
+ ]), se = v.sortOptions.find((e) => e.value === f)?.label ?? v.sortLabel, ce = U(() => v.sortOptions.map((e) => ({
119
119
  key: e.value,
120
120
  label: e.label,
121
- mark: D.Check,
122
- checked: e.value === h,
123
- onClick: () => v(e.value)
121
+ mark: N.Check,
122
+ checked: e.value === f,
123
+ onClick: () => p(e.value)
124
124
  })), [
125
- y.sortOptions,
126
- h,
127
- v
128
- ]), F = (e) => {
129
- d(e ?? "");
130
- }, I = () => {
131
- if (!t) return n ? y.errorLabel : A ? y.incompleteLabel : e.length === 0 ? y.emptyStateLabel : M.length === 0 ? y.noResultsLabel : y.resultCountLabel(M.length);
132
- }, L = (e, t) => o ? /* @__PURE__ */ V(te, {
133
- label: y.createProjectLabel,
125
+ v.sortOptions,
126
+ f,
127
+ p
128
+ ]), le = (e) => {
129
+ u(e ?? "");
130
+ }, ue = () => {
131
+ if (!t) return n ? v.errorLabel : I ? v.incompleteLabel : e.length === 0 ? v.emptyStateLabel : z.length === 0 ? v.noResultsLabel : v.resultCountLabel(z.length);
132
+ }, de = (e, t) => a ? /* @__PURE__ */ K(m, {
133
+ label: v.createProjectLabel,
134
134
  variant: e,
135
- onClick: o,
136
- className: l("shrink-0", t)
137
- }) : void 0, z = () => t ? /* @__PURE__ */ V(ue, {}) : n || j ? /* @__PURE__ */ H("div", {
135
+ onClick: a,
136
+ className: d("shrink-0", t)
137
+ }) : void 0, B = () => t ? /* @__PURE__ */ K(ae, {}) : n || R ? /* @__PURE__ */ q("div", {
138
138
  className: "flex flex-col items-center gap-3",
139
- children: [/* @__PURE__ */ V("p", {
140
- className: l(T, q.subtitle),
141
- children: n ? y.errorLabel : y.incompleteLabel
142
- }), /* @__PURE__ */ V(S, {
143
- label: y.retryLabel,
144
- onClick: a
139
+ children: [/* @__PURE__ */ K("p", {
140
+ className: d(O, Z.subtitle),
141
+ children: n ? v.errorLabel : v.incompleteLabel
142
+ }), /* @__PURE__ */ K(D, {
143
+ label: v.retryLabel,
144
+ onClick: i
145
145
  })]
146
- }) : e.length === 0 ? /* @__PURE__ */ V(i, {
147
- label: y.emptyStateLabel,
148
- description: y.emptyStateDescription,
149
- action: L(m.Secondary, "mt-2"),
146
+ }) : e.length === 0 ? /* @__PURE__ */ K(o, {
147
+ label: v.emptyStateLabel,
148
+ description: v.emptyStateDescription,
149
+ action: de(_.Secondary, "mt-2"),
150
150
  containerClassName: "p-3",
151
151
  labelClassName: "mt-3",
152
- descriptionClassName: ce
153
- }) : M.length === 0 ? /* @__PURE__ */ V(i, {
154
- label: y.noResultsLabel,
152
+ descriptionClassName: re
153
+ }) : z.length === 0 ? /* @__PURE__ */ K(o, {
154
+ label: v.noResultsLabel,
155
155
  containerClassName: "p-3",
156
156
  labelClassName: "mt-3"
157
- }) : /* @__PURE__ */ V("ul", {
157
+ }) : /* @__PURE__ */ K("ul", {
158
158
  className: "m-0 grid w-full min-w-0 list-none grid-cols-1 gap-5 p-0 desktop:grid-cols-3",
159
- children: M.map((e) => /* @__PURE__ */ V(Ee, {
159
+ children: z.map((e) => /* @__PURE__ */ K(Ee, {
160
160
  project: e,
161
- searchQuery: pe,
162
- sourceLabel: y.sourceLabels[e.source],
163
- folderPathLabel: y.folderPathLabel,
164
- pinnedLabel: y.pinnedLabel ?? "Pinned",
161
+ searchQuery: F,
162
+ sourceLabel: v.sourceLabels[e.source],
163
+ folderPathLabel: v.folderPathLabel,
164
+ pinnedLabel: v.pinnedLabel ?? "Pinned",
165
165
  href: c?.(e.id),
166
166
  onOpen: s,
167
- now: fe,
168
- locale: b,
169
- updatedAtClassName: O,
170
- titleClassName: E,
171
- pathLabelClassName: oe,
172
- pathLeafClassName: se
167
+ now: ie,
168
+ locale: x,
169
+ updatedAtClassName: M,
170
+ titleClassName: k,
171
+ pathLabelClassName: te,
172
+ pathLeafClassName: A
173
173
  }, e.id))
174
- }), me = t || n || j;
175
- return /* @__PURE__ */ H("div", {
176
- style: de,
177
- className: l("flex h-full w-full min-w-0 flex-col overflow-y-auto", q.container),
174
+ }), V = t || n || R;
175
+ return /* @__PURE__ */ q("div", {
176
+ style: P,
177
+ className: d("flex h-full w-full min-w-0 flex-col overflow-y-auto", Z.container),
178
178
  children: [
179
- /* @__PURE__ */ H("div", {
179
+ /* @__PURE__ */ q("div", {
180
180
  className: "flex min-w-0 items-center gap-2 px-4 py-4 desktop:px-8",
181
- children: [/* @__PURE__ */ H("div", {
181
+ children: [/* @__PURE__ */ q("div", {
182
182
  className: "min-w-0 flex-1",
183
- children: [/* @__PURE__ */ V("h1", {
184
- className: l("break-words", w),
185
- children: y.title
186
- }), y.subtitle && /* @__PURE__ */ V("p", {
187
- className: l("mt-0.5", T, q.subtitle),
188
- children: y.subtitle
183
+ children: [/* @__PURE__ */ K("h1", {
184
+ className: d("break-words", E),
185
+ children: v.title
186
+ }), v.subtitle && /* @__PURE__ */ K("p", {
187
+ className: d("mt-0.5", O, Z.subtitle),
188
+ children: v.subtitle
189
189
  })]
190
- }), L(m.Primary)]
190
+ }), de(_.Primary)]
191
191
  }),
192
- /* @__PURE__ */ H("div", {
192
+ /* @__PURE__ */ q("div", {
193
193
  className: "flex flex-col gap-3 px-4 pt-4 pb-5 desktop:flex-row desktop:items-center desktop:px-8",
194
- children: [/* @__PURE__ */ V("div", {
194
+ children: [/* @__PURE__ */ K("div", {
195
195
  role: "search",
196
196
  className: "min-w-0 flex-1",
197
- children: /* @__PURE__ */ V(le, {
198
- value: u,
199
- onChange: F,
200
- placeholder: y.searchPlaceholder,
201
- clearLabel: y.clearSearchLabel,
202
- "aria-label": y.searchAriaLabel,
203
- size: ne.Large
197
+ children: /* @__PURE__ */ K(L, {
198
+ value: l,
199
+ onChange: le,
200
+ placeholder: v.searchPlaceholder,
201
+ clearLabel: v.clearSearchLabel,
202
+ "aria-label": v.searchAriaLabel,
203
+ size: S.Large
204
204
  })
205
- }), y.sortOptions.length > 0 && /* @__PURE__ */ V("div", {
205
+ }), v.sortOptions.length > 0 && /* @__PURE__ */ K("div", {
206
206
  role: "group",
207
- "aria-label": y.sortLabel,
207
+ "aria-label": v.sortLabel,
208
208
  className: "shrink-0",
209
- children: /* @__PURE__ */ V(p, {
210
- items: P,
211
- label: N,
212
- variant: m.Primary,
213
- appearance: f.Ghost,
214
- iconBefore: /* @__PURE__ */ V(k, {
215
- size: g.SM,
209
+ children: /* @__PURE__ */ K(g, {
210
+ items: ce,
211
+ label: se,
212
+ variant: _.Primary,
213
+ appearance: h.Ghost,
214
+ iconBefore: /* @__PURE__ */ K(oe, {
215
+ size: y.SM,
216
216
  "aria-hidden": !0,
217
- stroke: _
217
+ stroke: b
218
218
  }),
219
- className: q.sortButton
219
+ className: Z.sortButton
220
220
  })
221
221
  })]
222
222
  }),
223
- /* @__PURE__ */ V(ie, {
223
+ /* @__PURE__ */ K(j, {
224
224
  visuallyHidden: !0,
225
- as: ae.Span,
226
- children: I()
225
+ as: ne.Span,
226
+ children: ue()
227
227
  }),
228
- /* @__PURE__ */ H("div", {
228
+ /* @__PURE__ */ q("div", {
229
229
  className: "flex w-full min-w-0 flex-1 flex-col items-center gap-5 px-4 pt-6 pb-8 desktop:px-8",
230
- children: [A && !t && !n && !j && /* @__PURE__ */ H("div", {
230
+ children: [I && !t && !n && !R && /* @__PURE__ */ q("div", {
231
231
  className: "flex w-full max-w-[1116px] flex-wrap items-center gap-3",
232
- children: [/* @__PURE__ */ V("p", {
233
- className: l(T, q.subtitle),
234
- children: y.incompleteLabel
235
- }), /* @__PURE__ */ V(S, {
236
- label: y.retryLabel,
237
- onClick: a
232
+ children: [/* @__PURE__ */ K("p", {
233
+ className: d(O, Z.subtitle),
234
+ children: v.incompleteLabel
235
+ }), /* @__PURE__ */ K(D, {
236
+ label: v.retryLabel,
237
+ onClick: i
238
238
  })]
239
- }), /* @__PURE__ */ V("div", {
240
- className: l("flex w-full max-w-[1116px] min-w-0 flex-col items-center", me && "flex-1 justify-center"),
241
- children: z()
239
+ }), /* @__PURE__ */ K("div", {
240
+ className: d("flex w-full max-w-[1116px] min-w-0 flex-col items-center", V && "flex-1 justify-center"),
241
+ children: B()
242
242
  })]
243
243
  })
244
244
  ]
245
245
  });
246
- }, De = /* @__PURE__ */ function(e) {
246
+ }, Oe = /* @__PURE__ */ function(e) {
247
247
  return e.Personal = "personal", e.Shared = "shared", e.Organization = "organization", e;
248
- }({}), Oe = (e) => !!e.dataTransfer?.types.includes("Files"), ke = (e) => {
249
- let [t, n] = B(!1), r = z(0);
248
+ }({}), ke = (e) => !!e.dataTransfer?.types.includes("Files"), Ae = (e) => {
249
+ let [t, n] = G(!1), r = W(0);
250
250
  return {
251
251
  isDragActive: t,
252
252
  handlers: {
253
- onDragEnter: F((e) => {
254
- Oe(e) && (e.preventDefault(), r.current += 1, n(!0));
253
+ onDragEnter: V((e) => {
254
+ ke(e) && (e.preventDefault(), r.current += 1, n(!0));
255
255
  }, []),
256
- onDragLeave: F((e) => {
257
- Oe(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
256
+ onDragLeave: V((e) => {
257
+ ke(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
258
258
  }, []),
259
- onDragOver: F((e) => {
260
- Oe(e) && e.preventDefault();
259
+ onDragOver: V((e) => {
260
+ ke(e) && e.preventDefault();
261
261
  }, []),
262
- onDrop: F((t) => {
263
- if (!Oe(t)) return;
262
+ onDrop: V((t) => {
263
+ if (!ke(t)) return;
264
264
  t.preventDefault(), r.current = 0, n(!1);
265
265
  let i = Array.from(t.dataTransfer?.files ?? []);
266
266
  i.length > 0 && e(i);
267
267
  }, [e])
268
268
  }
269
269
  };
270
- }, Y = /* @__PURE__ */ function(e) {
270
+ }, Q = /* @__PURE__ */ function(e) {
271
271
  return e.UnsupportedType = "unsupported-type", e.TooLarge = "too-large", e.CapacityExceeded = "capacity-exceeded", e.Duplicate = "duplicate", e.InvalidName = "invalid-name", e;
272
- }({}), X = /* @__PURE__ */ function(e) {
272
+ }({}), je = /* @__PURE__ */ function(e) {
273
273
  return e.Required = "required", e.InvalidCharacters = "invalid-characters", e.Reserved = "reserved", e.TooLong = "too-long", e;
274
- }({}), Ae = 255, je = new RegExp(r.source, "u"), Me = /[\p{Cc}‎‏‪-‮⁦-⁩]/u, Ne = /* @__PURE__ */ new Set([
274
+ }({}), Me = 255, Ne = new RegExp(a.source, "u"), Pe = /[\p{Cc}‎‏‪-‮⁦-⁩]/u, Fe = /* @__PURE__ */ new Set([
275
275
  ".",
276
276
  "..",
277
277
  "v",
278
278
  "files",
279
279
  ".dial-resource",
280
280
  ".dial-folder"
281
- ]), Pe = (e) => new TextEncoder().encode(e).length, Fe = (e) => {
281
+ ]), Ie = (e) => new TextEncoder().encode(e).length, Le = (e) => {
282
282
  let t = e.trim();
283
- return t.length === 0 ? X.Required : Pe(t) > 255 ? X.TooLong : je.test(t) || Me.test(t) ? X.InvalidCharacters : Ne.has(t) ? X.Reserved : null;
284
- }, Ie = (e) => {
283
+ return t.length === 0 ? je.Required : Ie(t) > 255 ? je.TooLong : Ne.test(t) || Pe.test(t) ? je.InvalidCharacters : Fe.has(t) ? je.Reserved : null;
284
+ }, Re = (e) => {
285
285
  let t = e.lastIndexOf(".");
286
286
  return t > 0 ? e.slice(t + 1).toLowerCase() : "";
287
- }, Le = (e) => "isStored" in e && e.isStored, Z = (e) => Le(e) ? e.size : e.file.size, Re = (e) => e.reduce((e, t) => e + Z(t), 0), ze = 0, Be = () => (ze += 1, `project-context-${Date.now()}-${ze}`), Ve = (e) => {
288
- let t = e.type || c(e.name) || "application/octet-stream";
287
+ }, ze = (e) => "isStored" in e && e.isStored, Be = (e) => ze(e) ? e.size : e.file.size, Ve = (e) => e.reduce((e, t) => e + Be(t), 0), He = 0, Ue = () => (He += 1, `project-context-${Date.now()}-${He}`), We = (e) => {
288
+ let t = e.type || u(e.name) || "application/octet-stream";
289
289
  return {
290
- id: Be(),
290
+ id: Ue(),
291
291
  name: e.name,
292
292
  contentType: t,
293
- type: s(t),
294
- status: a.Idle,
293
+ type: l(t),
294
+ status: s.Idle,
295
295
  file: e
296
296
  };
297
- }, Q = (e, t, n, r) => Fe(e.name) != null || e.name.trim() !== e.name ? Y.InvalidName : r.allowedExtensions.includes(Ie(e.name)) ? t.has(e.name) ? Y.Duplicate : e.size > r.maxFileBytes ? Y.TooLarge : n + e.size > r.maxTotalBytes ? Y.CapacityExceeded : null : Y.UnsupportedType, He = (e, t, n) => {
298
- let r = new Set(t.map((e) => e.name)), i = Re(t), a = [], o = [];
297
+ }, Ge = (e, t, n, r) => Le(e.name) != null || e.name.trim() !== e.name ? Q.InvalidName : r.allowedExtensions.includes(Re(e.name)) ? t.has(e.name) ? Q.Duplicate : e.size > r.maxFileBytes ? Q.TooLarge : n + e.size > r.maxTotalBytes ? Q.CapacityExceeded : null : Q.UnsupportedType, Ke = (e, t, n) => {
298
+ let r = new Set(t.map((e) => e.name)), i = Ve(t), a = [], o = [];
299
299
  for (let t of e) {
300
- let e = Q(t, r, i, n);
301
- e == null ? (r.add(t.name), i += t.size, a.push(Ve(t))) : o.push({
300
+ let e = Ge(t, r, i, n);
301
+ e == null ? (r.add(t.name), i += t.size, a.push(We(t))) : o.push({
302
302
  name: t.name,
303
303
  reason: e
304
304
  });
@@ -307,283 +307,283 @@ var U = /* @__PURE__ */ function(e) {
307
307
  accepted: a,
308
308
  rejected: o
309
309
  };
310
- }, Ue = (e, t) => e <= 0 ? 0 : t <= 0 ? 100 : Math.min(100, Math.max(1, Math.round(e / t * 100))), We = (e, t) => {
310
+ }, qe = (e, t) => e <= 0 ? 0 : t <= 0 ? 100 : Math.min(100, Math.max(1, Math.round(e / t * 100))), Je = (e, t) => {
311
311
  let n = t.trim().toLowerCase();
312
312
  return n === "" ? e : e.filter((e) => e.name.toLowerCase().includes(n));
313
- }, Ge = {
313
+ }, Ye = {
314
314
  track: "_track_1eyt2_1",
315
315
  text: "_text_1eyt2_11"
316
- }, Ke = ({ usedBytes: e, maxBytes: t, ariaLabel: n, formatLabel: r, textClassName: i = "dial-tiny-text" }) => {
316
+ }, Xe = ({ usedBytes: e, maxBytes: t, ariaLabel: n, formatLabel: r, textClassName: i = "dial-tiny-text" }) => {
317
317
  if (e <= 0) return null;
318
- let a = r(Ue(e, t));
319
- return /* @__PURE__ */ H("div", {
318
+ let a = r(qe(e, t));
319
+ return /* @__PURE__ */ q("div", {
320
320
  className: "flex min-w-0 items-center gap-2",
321
- children: [/* @__PURE__ */ V(O, {
322
- role: ce.Meter,
321
+ children: [/* @__PURE__ */ K(F, {
322
+ role: I.Meter,
323
323
  value: e,
324
324
  max: t,
325
- size: ne.Small,
325
+ size: S.Small,
326
326
  "aria-label": n,
327
327
  "aria-valuetext": a,
328
- className: l("w-[60px] shrink-0", Ge.track)
329
- }), /* @__PURE__ */ V("span", {
328
+ className: d("w-[60px] shrink-0", Ye.track)
329
+ }), /* @__PURE__ */ K("span", {
330
330
  "aria-hidden": !0,
331
- className: l("whitespace-nowrap", i, Ge.text),
331
+ className: d("whitespace-nowrap", i, Ye.text),
332
332
  children: a
333
333
  })]
334
334
  });
335
- }, qe = {
335
+ }, Ze = {
336
336
  formColumn: "_formColumn_1fxsc_1",
337
337
  helper: "_helper_1fxsc_10",
338
338
  label: "_label_1fxsc_14"
339
- }, Je = N(async () => ({ default: (await ve()).MarkdownEditor })), Ye = "device", Xe = "file-manager", Ze = ({ values: n, errors: r, onFieldChange: i, contextFiles: a, onContextFilesChange: s, allowedExtensions: c, maxFileBytes: te, maxTotalBytes: f, onPickFromFileManager: h, onRefineDescription: v, onRefineInstructions: y, onBack: x, onCancel: S, onSubmit: C, isSubmitting: w = !1, labels: D, markdownEditorTheme: se, className: O, styles: ce }) => {
340
- let le = L(), k = L(), pe = L(), A = L(), j = L(), N = z(null), P = z(null), me = u(), [ve, U] = B(!1), [ye, be] = B([]), [xe, Se] = B(""), W = z(void 0), G = F((e) => e ? async (t, n) => {
341
- if (W.current && !W.current.aborted) throw new DOMException("Busy", "AbortError");
342
- W.current = n;
339
+ }, Qe = de(async () => ({ default: (await _e()).MarkdownEditor })), $e = "device", et = "file-manager", tt = ({ values: e, errors: t, onFieldChange: i, contextFiles: a, onContextFilesChange: o, allowedExtensions: s, maxFileBytes: l, maxTotalBytes: u, onPickFromFileManager: m, onRefineDescription: h, onRefineInstructions: v, onBack: x, onCancel: C, onSubmit: E, isSubmitting: D = !1, labels: O, markdownEditorTheme: k, className: N, styles: re }) => {
340
+ let P = H(), ie = H(), F = H(), I = H(), L = H(), oe = W(null), se = W(null), ce = f(), [le, de] = G(!1), [B, pe] = G([]), [_e, ve] = G(""), J = W(void 0), ye = V((e) => e ? async (t, n) => {
341
+ if (J.current && !J.current.aborted) throw new DOMException("Busy", "AbortError");
342
+ J.current = n;
343
343
  try {
344
344
  return await e(t, n);
345
345
  } finally {
346
- W.current === n && (W.current = void 0);
346
+ J.current === n && (J.current = void 0);
347
347
  }
348
- } : void 0, []), Ce = R(() => G(v), [G, v]), K = R(() => G(y), [G, y]), we = d({
349
- value: n.description,
348
+ } : void 0, []), be = U(() => ye(h), [ye, h]), xe = U(() => ye(v), [ye, v]), Y = p({
349
+ value: e.description,
350
350
  onChange: (e) => i("description", e),
351
- onRefine: Ce,
352
- disabled: w
353
- }), Te = d({
354
- value: n.instructions,
351
+ onRefine: be,
352
+ disabled: D
353
+ }), Se = p({
354
+ value: e.instructions,
355
355
  onChange: (e) => i("instructions", e),
356
- onRefine: K,
357
- disabled: w
358
- }), Ee = we.isPending || Te.isPending, q = Fe(n.name), J = r.name ?? (ve && q != null ? D.nameErrors[q] : void 0), De = q != null || w || Ee;
359
- I(() => {
360
- r.name && N.current?.focus();
361
- }, [r.name]);
362
- let Oe = R(() => Re(a), [a]), Y = R(() => c.map((e) => `.${e}`).join(","), [c]), X = (e) => {
356
+ onRefine: xe,
357
+ disabled: D
358
+ }), Ce = Y.isPending || Se.isPending, X = Le(e.name), we = t.name ?? (le && X != null ? O.nameErrors[X] : void 0), Te = X != null || D || Ce;
359
+ fe(() => {
360
+ t.name && oe.current?.focus();
361
+ }, [t.name]);
362
+ let Ee = U(() => Ve(a), [a]), Z = U(() => s.map((e) => `.${e}`).join(","), [s]), De = (e) => {
363
363
  if (e.length === 0) return;
364
- let { accepted: t, rejected: n } = He(e, a, {
365
- allowedExtensions: c,
366
- maxFileBytes: te,
367
- maxTotalBytes: f
364
+ let { accepted: t, rejected: n } = Ke(e, a, {
365
+ allowedExtensions: s,
366
+ maxFileBytes: l,
367
+ maxTotalBytes: u
368
368
  });
369
- be(n), t.length > 0 && s([...a, ...t]), Se([t.length > 0 ? D.filesAddedStatus(t.length) : "", ...n.map(({ name: e, reason: t }) => D.fileRejections[t](e))].filter(Boolean).join(" "));
370
- }, { isDragActive: Ae, handlers: je } = ke(X), Me = (e) => {
369
+ pe(n), t.length > 0 && o([...a, ...t]), ve([t.length > 0 ? O.filesAddedStatus(t.length) : "", ...n.map(({ name: e, reason: t }) => O.fileRejections[t](e))].filter(Boolean).join(" "));
370
+ }, { isDragActive: Oe, handlers: ke } = Ae(De), Q = (e) => {
371
371
  let t = a.find((t) => t.id === e);
372
- s(a.filter((t) => t.id !== e)), be([]), t && Se(D.fileRemovedStatus(t.name));
373
- }, Ne = (e) => {
374
- X(Array.from(e.target.files ?? [])), e.target.value = "";
375
- }, Pe = async () => {
376
- if (h) try {
377
- let e = await h();
378
- e && X(e);
372
+ o(a.filter((t) => t.id !== e)), pe([]), t && ve(O.fileRemovedStatus(t.name));
373
+ }, je = (e) => {
374
+ De(Array.from(e.target.files ?? [])), e.target.value = "";
375
+ }, Me = async () => {
376
+ if (m) try {
377
+ let e = await m();
378
+ e && De(e);
379
379
  } catch {}
380
- }, Ie = [{
381
- key: Ye,
382
- label: D.addFromDeviceLabel,
383
- onClick: () => P.current?.click()
384
- }, ...h ? [{
385
- key: Xe,
386
- label: D.addFromFileManagerLabel,
387
- onClick: () => void Pe()
388
- }] : []], Le = () => {
389
- !De && (!W.current || W.current.aborted) && C();
390
- }, { colors: Z, typography: ze } = ce ?? {}, Be = ze?.titleClassName ?? "dial-h1-text", Ve = l(ze?.labelClassName ?? "dial-tiny-semi-text", qe.label), Q = ze?.helperClassName ?? "dial-tiny-text", Ue = ee({
391
- "--pcf-helper-text": Z?.helperText,
392
- "--pcf-label-text": Z?.labelText,
393
- "--pcf-meter-track": Z?.meterTrack,
394
- "--pcf-meter-fill": Z?.meterFill
395
- }), We = D.refinement, Ge = r.context, Ze = !!Ge;
396
- return /* @__PURE__ */ H("div", {
397
- className: l("relative flex h-full min-h-0 w-full", O),
398
- ...je,
380
+ }, Ne = [{
381
+ key: $e,
382
+ label: O.addFromDeviceLabel,
383
+ onClick: () => se.current?.click()
384
+ }, ...m ? [{
385
+ key: et,
386
+ label: O.addFromFileManagerLabel,
387
+ onClick: () => void Me()
388
+ }] : []], Pe = () => {
389
+ !Te && (!J.current || J.current.aborted) && E();
390
+ }, { colors: Fe, typography: Ie } = re ?? {}, Re = Ie?.titleClassName ?? "dial-h1-text", ze = d(Ie?.labelClassName ?? "dial-tiny-semi-text", Ze.label), Be = Ie?.helperClassName ?? "dial-tiny-text", He = ee({
391
+ "--pcf-helper-text": Fe?.helperText,
392
+ "--pcf-label-text": Fe?.labelText,
393
+ "--pcf-meter-track": Fe?.meterTrack,
394
+ "--pcf-meter-fill": Fe?.meterFill
395
+ }), Ue = O.refinement, We = t.context, Ge = !!We;
396
+ return /* @__PURE__ */ q("div", {
397
+ className: d("relative flex h-full min-h-0 w-full", N),
398
+ ...ke,
399
399
  children: [
400
- /* @__PURE__ */ V(ge, {
401
- isVisible: Ae,
400
+ /* @__PURE__ */ K(he, {
401
+ isVisible: Oe,
402
402
  labels: {
403
- title: D.dropOverlayTitle,
404
- subtitle: D.dropOverlaySubtitle
403
+ title: O.dropOverlayTitle,
404
+ subtitle: O.dropOverlaySubtitle
405
405
  }
406
406
  }),
407
- /* @__PURE__ */ V(_e, {
407
+ /* @__PURE__ */ K(ge, {
408
408
  labels: {
409
- title: D.title,
410
- backButtonLabel: D.backLabel,
411
- cancelButtonLabel: D.cancelLabel,
412
- submitButtonLabel: D.createLabel,
413
- submittingLabel: D.submittingLabel ?? D.createLabel
409
+ title: O.title,
410
+ backButtonLabel: O.backLabel,
411
+ cancelButtonLabel: O.cancelLabel,
412
+ submitButtonLabel: O.createLabel,
413
+ submittingLabel: O.submittingLabel ?? O.createLabel
414
414
  },
415
415
  onBack: x,
416
- onCancel: S,
417
- onSubmit: Le,
418
- isCancelDisabled: w,
419
- isSubmitDisabled: De,
420
- isSubmitting: w,
421
- backIcon: /* @__PURE__ */ V(fe, {
422
- size: g.LG,
423
- stroke: _,
416
+ onCancel: C,
417
+ onSubmit: Pe,
418
+ isCancelDisabled: D,
419
+ isSubmitDisabled: Te,
420
+ isSubmitting: D,
421
+ backIcon: /* @__PURE__ */ K(z, {
422
+ size: y.LG,
423
+ stroke: b,
424
424
  "aria-hidden": !0,
425
425
  className: "rtl:scale-x-[-1]"
426
426
  }),
427
427
  styles: {
428
- colors: { background: Z?.background },
428
+ colors: { background: Fe?.background },
429
429
  header: {
430
- colors: { borderColor: Z?.headerBorder },
431
- typography: { fontClassName: Be }
430
+ colors: { borderColor: Fe?.headerBorder },
431
+ typography: { fontClassName: Re }
432
432
  },
433
- cssVars: Ue
433
+ cssVars: He
434
434
  },
435
- children: /* @__PURE__ */ H("div", {
436
- className: l("mx-auto flex w-full max-w-[1040px] min-w-0 flex-col gap-5 py-6", qe.formColumn),
435
+ children: /* @__PURE__ */ q("div", {
436
+ className: d("mx-auto flex w-full max-w-[1040px] min-w-0 flex-col gap-5 py-6", Ze.formColumn),
437
437
  children: [
438
- /* @__PURE__ */ H("div", {
438
+ /* @__PURE__ */ q("div", {
439
439
  className: "flex flex-col gap-1",
440
440
  children: [
441
- /* @__PURE__ */ V(T, {
442
- id: le,
443
- inputRef: N,
444
- value: n.name,
441
+ /* @__PURE__ */ K(te, {
442
+ id: P,
443
+ inputRef: oe,
444
+ value: e.name,
445
445
  onChange: (e) => i("name", e ?? ""),
446
- onBlur: () => U(!0),
447
- placeholder: D.namePlaceholder,
446
+ onBlur: () => de(!0),
447
+ placeholder: O.namePlaceholder,
448
448
  labelProps: {
449
- label: D.nameLabel,
449
+ label: O.nameLabel,
450
450
  required: !0
451
451
  },
452
452
  required: !0,
453
453
  "aria-required": !0,
454
- invalid: !!J,
455
- "aria-invalid": !!J,
456
- "aria-describedby": J ? k : void 0
454
+ invalid: !!we,
455
+ "aria-invalid": !!we,
456
+ "aria-describedby": we ? ie : void 0
457
457
  }),
458
- /* @__PURE__ */ V(b, {
459
- announce: oe.Assertive,
460
- id: k,
461
- className: Q,
462
- text: r.name ?? ""
458
+ /* @__PURE__ */ K(w, {
459
+ announce: M.Assertive,
460
+ id: ie,
461
+ className: Be,
462
+ text: t.name ?? ""
463
463
  }),
464
- J && !r.name && /* @__PURE__ */ V(b, {
465
- id: k,
466
- className: Q,
467
- text: J
464
+ we && !t.name && /* @__PURE__ */ K(w, {
465
+ id: ie,
466
+ className: Be,
467
+ text: we
468
468
  })
469
469
  ]
470
470
  }),
471
- /* @__PURE__ */ V(o, {
472
- isEnabled: !!v,
473
- fieldId: pe,
474
- label: D.descriptionLabel,
475
- labelClassName: Ve,
476
- labels: We,
477
- refinement: we,
478
- disabled: w || Ee,
479
- children: /* @__PURE__ */ V(de, {
480
- id: pe,
481
- value: n.description,
471
+ /* @__PURE__ */ K(c, {
472
+ isEnabled: !!h,
473
+ fieldId: F,
474
+ label: O.descriptionLabel,
475
+ labelClassName: ze,
476
+ labels: Ue,
477
+ refinement: Y,
478
+ disabled: D || Ce,
479
+ children: /* @__PURE__ */ K(R, {
480
+ id: F,
481
+ value: e.description,
482
482
  onChange: (e) => {
483
- we.reset(), i("description", e);
483
+ Y.reset(), i("description", e);
484
484
  },
485
- placeholder: D.descriptionPlaceholder,
486
- labelProps: v ? void 0 : { label: D.descriptionLabel }
485
+ placeholder: O.descriptionPlaceholder,
486
+ labelProps: h ? void 0 : { label: O.descriptionLabel }
487
487
  })
488
488
  }),
489
- /* @__PURE__ */ V(o, {
490
- isEnabled: !!y,
491
- fieldId: A,
492
- label: D.instructionsLabel,
493
- labelClassName: Ve,
494
- labels: We,
495
- refinement: Te,
496
- disabled: w || Ee,
497
- children: /* @__PURE__ */ H("div", {
489
+ /* @__PURE__ */ K(c, {
490
+ isEnabled: !!v,
491
+ fieldId: I,
492
+ label: O.instructionsLabel,
493
+ labelClassName: ze,
494
+ labels: Ue,
495
+ refinement: Se,
496
+ disabled: D || Ce,
497
+ children: /* @__PURE__ */ q("div", {
498
498
  className: "flex flex-1 flex-col gap-2",
499
- children: [!y && /* @__PURE__ */ V(E, {
500
- htmlFor: A,
501
- className: Ve,
502
- label: D.instructionsLabel
503
- }), /* @__PURE__ */ V("div", {
504
- ref: me,
505
- className: l("w-full", e, t),
506
- children: /* @__PURE__ */ V(M, {
507
- fallback: /* @__PURE__ */ V(ue, {}),
508
- children: /* @__PURE__ */ V(Je, {
509
- id: A,
510
- value: n.instructions,
499
+ children: [!v && /* @__PURE__ */ K(A, {
500
+ htmlFor: I,
501
+ className: ze,
502
+ label: O.instructionsLabel
503
+ }), /* @__PURE__ */ K("div", {
504
+ ref: ce,
505
+ className: d("w-full", n, r),
506
+ children: /* @__PURE__ */ K(ue, {
507
+ fallback: /* @__PURE__ */ K(ae, {}),
508
+ children: /* @__PURE__ */ K(Qe, {
509
+ id: I,
510
+ value: e.instructions,
511
511
  onChange: (e) => {
512
- Te.reset(), i("instructions", e);
512
+ Se.reset(), i("instructions", e);
513
513
  },
514
514
  height: 176,
515
- theme: se,
516
- placeholder: D.instructionsPlaceholder
515
+ theme: k,
516
+ placeholder: O.instructionsPlaceholder
517
517
  })
518
518
  })
519
519
  })]
520
520
  })
521
521
  }),
522
- /* @__PURE__ */ H("section", {
523
- "aria-labelledby": j,
522
+ /* @__PURE__ */ q("section", {
523
+ "aria-labelledby": L,
524
524
  className: "flex flex-col gap-2",
525
525
  children: [
526
- /* @__PURE__ */ H("div", {
526
+ /* @__PURE__ */ q("div", {
527
527
  className: "flex min-w-0 flex-wrap items-center justify-between gap-2",
528
- children: [/* @__PURE__ */ V("h2", {
529
- id: j,
530
- className: Ve,
531
- children: D.contextLabel
532
- }), /* @__PURE__ */ H("div", {
528
+ children: [/* @__PURE__ */ K("h2", {
529
+ id: L,
530
+ className: ze,
531
+ children: O.contextLabel
532
+ }), /* @__PURE__ */ q("div", {
533
533
  className: "flex min-w-0 items-center gap-4",
534
- children: [/* @__PURE__ */ V(Ke, {
535
- usedBytes: Oe,
536
- maxBytes: f,
537
- ariaLabel: D.capacityMeterLabel,
538
- formatLabel: D.capacityLabel,
539
- textClassName: Q
540
- }), /* @__PURE__ */ V(p, {
541
- items: Ie,
542
- label: D.addLabel,
543
- variant: m.Neutral,
544
- size: ne.Small,
545
- disabled: w
534
+ children: [/* @__PURE__ */ K(Xe, {
535
+ usedBytes: Ee,
536
+ maxBytes: u,
537
+ ariaLabel: O.capacityMeterLabel,
538
+ formatLabel: O.capacityLabel,
539
+ textClassName: Be
540
+ }), /* @__PURE__ */ K(g, {
541
+ items: Ne,
542
+ label: O.addLabel,
543
+ variant: _.Neutral,
544
+ size: S.Small,
545
+ disabled: D
546
546
  })]
547
547
  })]
548
548
  }),
549
- /* @__PURE__ */ V("input", {
550
- ref: P,
549
+ /* @__PURE__ */ K("input", {
550
+ ref: se,
551
551
  type: "file",
552
552
  multiple: !0,
553
- accept: Y,
553
+ accept: Z,
554
554
  tabIndex: -1,
555
555
  "aria-hidden": !0,
556
556
  className: "sr-only",
557
- onChange: Ne
557
+ onChange: je
558
558
  }),
559
- /* @__PURE__ */ V(re, {
560
- label: D.dropZoneLabel,
561
- description: D.dropZoneHint,
562
- accept: Y,
559
+ /* @__PURE__ */ K(T, {
560
+ label: O.dropZoneLabel,
561
+ description: O.dropZoneHint,
562
+ accept: Z,
563
563
  multiple: !0,
564
- disabled: w,
565
- onChange: X,
566
- onReject: X
564
+ disabled: D,
565
+ onChange: De,
566
+ onReject: De
567
567
  }),
568
- ye.length > 0 && /* @__PURE__ */ V("ul", {
569
- className: l("flex flex-col gap-1", Q, qe.helper),
570
- children: ye.map(({ name: e, reason: t }) => /* @__PURE__ */ V("li", { children: D.fileRejections[t](e) }, `${t}:${e}`))
568
+ B.length > 0 && /* @__PURE__ */ K("ul", {
569
+ className: d("flex flex-col gap-1", Be, Ze.helper),
570
+ children: B.map(({ name: e, reason: t }) => /* @__PURE__ */ K("li", { children: O.fileRejections[t](e) }, `${t}:${e}`))
571
571
  }),
572
- /* @__PURE__ */ V(ie, {
573
- politeness: oe.Assertive,
574
- children: Ze && /* @__PURE__ */ V("p", {
575
- className: l(Q, qe.helper),
576
- children: Ge
572
+ /* @__PURE__ */ K(j, {
573
+ politeness: M.Assertive,
574
+ children: Ge && /* @__PURE__ */ K("p", {
575
+ className: d(Be, Ze.helper),
576
+ children: We
577
577
  })
578
578
  }),
579
- a.length > 0 && /* @__PURE__ */ V("ul", {
579
+ a.length > 0 && /* @__PURE__ */ K("ul", {
580
580
  className: "flex min-w-0 flex-wrap gap-2 pt-1",
581
- children: a.map((e) => /* @__PURE__ */ V("li", {
581
+ children: a.map((e) => /* @__PURE__ */ K("li", {
582
582
  className: "min-w-0",
583
- children: /* @__PURE__ */ V(he, {
583
+ children: /* @__PURE__ */ K(me, {
584
584
  attachment: e,
585
- onRemove: Me,
586
- labels: { removeLabel: D.removeFileLabel(e.name) }
585
+ onRemove: Q,
586
+ labels: { removeLabel: O.removeFileLabel(e.name) }
587
587
  })
588
588
  }, e.id))
589
589
  })
@@ -592,10 +592,10 @@ var U = /* @__PURE__ */ function(e) {
592
592
  ]
593
593
  })
594
594
  }),
595
- /* @__PURE__ */ V(ie, {
595
+ /* @__PURE__ */ K(j, {
596
596
  visuallyHidden: !0,
597
- as: ae.Span,
598
- children: w ? D.creatingStatus : xe
597
+ as: ne.Span,
598
+ children: D ? O.creatingStatus : _e
599
599
  })
600
600
  ]
601
601
  });
@@ -606,21 +606,21 @@ var U = /* @__PURE__ */ function(e) {
606
606
  body: "_body_16lvl_13",
607
607
  secondary: "_secondary_16lvl_17",
608
608
  panel: "_panel_16lvl_21"
609
- }, Qe = (e) => ({
609
+ }, nt = (e) => ({
610
610
  id: e.name,
611
611
  name: e.name,
612
612
  contentType: e.contentType,
613
- type: s(e.contentType),
614
- status: a.Idle
615
- }), $e = P(({ project: e, isLoading: t = !1, hasError: r = !1, isNotFound: a = !1, isPinned: o, isPinPending: s = !1, contextSearchQuery: c, onContextSearchQueryChange: u, onBack: d, onTogglePin: f, onPublish: p, onEdit: h, onShare: ne, onDelete: b, onDownload: re, onOpenFile: x, onRetry: w, onBrowseProjects: T, labels: E, styles: oe }) => {
616
- let { colors: D, typography: O } = oe ?? {}, ce = O?.titleClassName ?? "dial-h2-text", de = O?.panelTitleClassName ?? "dial-body-semi-text", k = O?.sectionTitleClassName ?? "dial-tiny-text", M = O?.bodyClassName ?? "dial-small-text", N = O?.helperClassName ?? "dial-tiny-text", P = O?.instructionsHeadingClassName ?? "dial-small-semi-text", F = ee({
617
- "--pv-bg": D?.background,
618
- "--pv-border": D?.border,
619
- "--pv-heading-text": D?.headingText,
620
- "--pv-body-text": D?.bodyText,
621
- "--pv-secondary-text": D?.secondaryText
622
- }), I = R(() => e?.contextFiles ?? [], [e]), z = R(() => We(I, c), [I, c]), B = c.trim(), ge = L(), _e = R(() => {
623
- let e = l("mb-1 mt-3 first:mt-0", P);
613
+ type: l(e.contentType),
614
+ status: s.Idle
615
+ }), rt = B(({ project: e, isLoading: t = !1, hasError: n = !1, isNotFound: r = !1, isPinned: a, isPinPending: s = !1, contextSearchQuery: c, onContextSearchQueryChange: l, onBack: u, onTogglePin: f, onPublish: p, onEdit: h, onShare: g, onDelete: v, onDownload: S, onOpenFile: w, onRetry: T, onBrowseProjects: E, mainContent: k, mainContentLabel: te = "Project content", labels: A, styles: M }) => {
616
+ let { colors: N, typography: P } = M ?? {}, ie = P?.titleClassName ?? "dial-h2-text", F = P?.panelTitleClassName ?? "dial-body-semi-text", I = P?.sectionTitleClassName ?? "dial-tiny-text", R = P?.bodyClassName ?? "dial-small-text", oe = P?.helperClassName ?? "dial-tiny-text", ue = P?.instructionsHeadingClassName ?? "dial-small-semi-text", de = ee({
617
+ "--pv-bg": N?.background,
618
+ "--pv-border": N?.border,
619
+ "--pv-heading-text": N?.headingText,
620
+ "--pv-body-text": N?.bodyText,
621
+ "--pv-secondary-text": N?.secondaryText
622
+ }), B = U(() => e?.contextFiles ?? [], [e]), V = U(() => Je(B, c), [B, c]), fe = c.trim(), W = H(), G = U(() => {
623
+ let e = d("mb-1 mt-3 first:mt-0", ue);
624
624
  return {
625
625
  h1: e,
626
626
  h2: e,
@@ -628,199 +628,459 @@ var U = /* @__PURE__ */ function(e) {
628
628
  h4: e,
629
629
  h5: e,
630
630
  h6: e,
631
- p: M,
632
- ul: M,
633
- ol: M
631
+ p: R,
632
+ ul: R,
633
+ ol: R
634
634
  };
635
- }, [M, P]), ve = (e) => {
635
+ }, [R, ue]), he = (e) => {
636
636
  let t = [];
637
637
  return e && p && t.push({
638
638
  key: "publish",
639
- label: E.publishLabel,
639
+ label: A.publishLabel,
640
640
  onClick: p
641
641
  }), e && h && t.push({
642
642
  key: "edit",
643
- label: E.editLabel,
643
+ label: A.editLabel,
644
644
  onClick: h
645
- }), ne && t.push({
645
+ }), g && t.push({
646
646
  key: "share",
647
- label: E.shareLabel,
648
- onClick: ne
647
+ label: A.shareLabel,
648
+ onClick: g
649
649
  }), t.push({
650
650
  key: "download",
651
- label: E.downloadLabel,
652
- onClick: re
653
- }), b && t.push({
651
+ label: A.downloadLabel,
652
+ onClick: S
653
+ }), v && t.push({
654
654
  key: "delete",
655
- label: E.deleteLabel,
655
+ label: A.deleteLabel,
656
656
  danger: !0,
657
- onClick: b
657
+ onClick: v
658
658
  }), t;
659
- }, U = (e, t) => /* @__PURE__ */ V("div", {
659
+ }, ge = (e, t) => /* @__PURE__ */ K("div", {
660
660
  className: t,
661
- children: /* @__PURE__ */ V(v, {
662
- items: ve(e),
661
+ children: /* @__PURE__ */ K(x, {
662
+ items: he(e),
663
663
  matchReferenceWidth: !1,
664
664
  listClassName: "w-[200px]",
665
- children: /* @__PURE__ */ V(C, {
666
- icon: /* @__PURE__ */ V(pe, {
667
- size: g.MD,
665
+ children: /* @__PURE__ */ K(O, {
666
+ icon: /* @__PURE__ */ K(se, {
667
+ size: y.MD,
668
668
  "aria-hidden": !0,
669
- stroke: _
669
+ stroke: b
670
670
  }),
671
- "aria-label": E.moreActionsLabel
671
+ "aria-label": A.moreActionsLabel
672
672
  })
673
673
  })
674
674
  });
675
- return t || r || a || e == null ? /* @__PURE__ */ V("div", {
676
- style: F,
677
- className: l("flex h-full w-full min-w-0 items-center justify-center p-4", $.container),
678
- children: t ? /* @__PURE__ */ V(ue, {}) : r ? /* @__PURE__ */ H("div", {
675
+ return t || n || r || e == null ? /* @__PURE__ */ K("div", {
676
+ style: de,
677
+ className: d("flex h-full w-full min-w-0 items-center justify-center p-4", $.container),
678
+ children: t ? /* @__PURE__ */ K(ae, {}) : n ? /* @__PURE__ */ q("div", {
679
679
  className: "flex flex-col items-center gap-3",
680
- children: [/* @__PURE__ */ V("p", {
680
+ children: [/* @__PURE__ */ K("p", {
681
681
  role: "status",
682
- className: l(M, $.body),
683
- children: E.errorLabel
684
- }), /* @__PURE__ */ V(S, {
685
- label: E.retryLabel,
686
- onClick: w
682
+ className: d(R, $.body),
683
+ children: A.errorLabel
684
+ }), /* @__PURE__ */ K(D, {
685
+ label: A.retryLabel,
686
+ onClick: T
687
687
  })]
688
- }) : /* @__PURE__ */ H("div", {
688
+ }) : /* @__PURE__ */ q("div", {
689
689
  className: "flex flex-col items-center gap-3",
690
- children: [/* @__PURE__ */ V("p", {
691
- className: l(M, $.body),
692
- children: E.notFoundLabel
693
- }), /* @__PURE__ */ V(S, {
694
- label: E.browseProjectsLabel,
695
- onClick: T
690
+ children: [/* @__PURE__ */ K("p", {
691
+ className: d(R, $.body),
692
+ children: A.notFoundLabel
693
+ }), /* @__PURE__ */ K(D, {
694
+ label: A.browseProjectsLabel,
695
+ onClick: E
696
696
  })]
697
697
  })
698
- }) : /* @__PURE__ */ H("div", {
699
- style: F,
700
- className: l("flex h-full w-full min-w-0 flex-col overflow-y-auto", $.container),
701
- children: [/* @__PURE__ */ H("header", {
702
- className: l("flex min-w-0 items-center gap-2 px-4 py-3 desktop:px-8", $.header),
698
+ }) : /* @__PURE__ */ q("div", {
699
+ style: de,
700
+ className: d("flex h-full w-full min-w-0 flex-col overflow-y-auto", $.container),
701
+ children: [/* @__PURE__ */ q("header", {
702
+ className: d("flex min-w-0 items-center gap-2 px-4 py-3 desktop:px-8", $.header),
703
703
  children: [
704
- /* @__PURE__ */ V(C, {
705
- icon: /* @__PURE__ */ V(fe, {
706
- size: g.LG,
704
+ /* @__PURE__ */ K(O, {
705
+ icon: /* @__PURE__ */ K(z, {
706
+ size: y.LG,
707
707
  className: "rtl:scale-x-[-1]",
708
708
  "aria-hidden": !0,
709
- stroke: _
709
+ stroke: b
710
710
  }),
711
- "aria-label": E.backLabel,
712
- onClick: d
711
+ "aria-label": A.backLabel,
712
+ onClick: u
713
713
  }),
714
- /* @__PURE__ */ V("h1", {
715
- className: l("min-w-0 flex-1", ce, $.title),
716
- children: /* @__PURE__ */ V(y, { text: e.name })
714
+ /* @__PURE__ */ K("h1", {
715
+ className: d("min-w-0 flex-1", ie, $.title),
716
+ children: /* @__PURE__ */ K(C, { text: e.name })
717
717
  }),
718
- /* @__PURE__ */ V(C, {
719
- icon: o ? /* @__PURE__ */ V(j, {
720
- size: g.MD,
718
+ /* @__PURE__ */ K(O, {
719
+ icon: a ? /* @__PURE__ */ K(le, {
720
+ size: y.MD,
721
721
  "aria-hidden": !0
722
- }) : /* @__PURE__ */ V(A, {
723
- size: g.MD,
722
+ }) : /* @__PURE__ */ K(ce, {
723
+ size: y.MD,
724
724
  "aria-hidden": !0,
725
- stroke: _
725
+ stroke: b
726
726
  }),
727
- "aria-label": E.pinLabel,
728
- "aria-pressed": o,
727
+ "aria-label": A.pinLabel,
728
+ "aria-pressed": a,
729
729
  "aria-disabled": s || void 0,
730
730
  onClick: () => {
731
731
  s || f();
732
732
  }
733
733
  }),
734
- p && /* @__PURE__ */ V(se, {
735
- label: E.publishLabel,
734
+ p && /* @__PURE__ */ K(re, {
735
+ label: A.publishLabel,
736
736
  onClick: p,
737
737
  className: "hidden shrink-0 desktop:inline-flex"
738
738
  }),
739
- h && /* @__PURE__ */ V(te, {
740
- label: E.editLabel,
741
- variant: m.Primary,
739
+ h && /* @__PURE__ */ K(m, {
740
+ label: A.editLabel,
741
+ variant: _.Primary,
742
742
  onClick: h,
743
743
  className: "hidden shrink-0 desktop:inline-flex"
744
744
  }),
745
- U(!1, "hidden desktop:block"),
746
- U(!0, "desktop:hidden")
745
+ ge(!1, "hidden desktop:block"),
746
+ ge(!0, "desktop:hidden")
747
747
  ]
748
- }), /* @__PURE__ */ V("div", {
749
- className: "flex min-w-0 flex-1 flex-col desktop:flex-row desktop:justify-end",
750
- children: /* @__PURE__ */ H("aside", {
751
- "aria-labelledby": ge,
752
- className: l("flex w-full min-w-0 flex-col gap-5 border-t px-4 py-6 desktop:w-[488px] desktop:shrink-0 desktop:border-s desktop:border-t-0 desktop:px-8", $.panel),
748
+ }), /* @__PURE__ */ q("div", {
749
+ className: d("flex min-w-0 flex-1 flex-col desktop:flex-row", k == null && "desktop:justify-end"),
750
+ children: [k != null && /* @__PURE__ */ K("section", {
751
+ "aria-label": te,
752
+ className: "flex min-w-0 flex-1 flex-col gap-6 px-4 py-6 desktop:px-8",
753
+ children: k
754
+ }), /* @__PURE__ */ q("aside", {
755
+ "aria-labelledby": W,
756
+ className: d("flex w-full min-w-0 flex-col gap-5 border-t px-4 py-6 desktop:w-[488px] desktop:shrink-0 desktop:border-s desktop:border-t-0 desktop:px-8", $.panel),
753
757
  children: [
754
- /* @__PURE__ */ V("h2", {
755
- id: ge,
756
- className: l(de, $.title),
757
- children: E.detailsLabel
758
+ /* @__PURE__ */ K("h2", {
759
+ id: W,
760
+ className: d(F, $.title),
761
+ children: A.detailsLabel
758
762
  }),
759
- e.description !== "" && /* @__PURE__ */ H("section", {
763
+ e.description !== "" && /* @__PURE__ */ q("section", {
760
764
  className: "flex min-w-0 flex-col gap-1",
761
- children: [/* @__PURE__ */ V("h3", {
762
- className: l(k, $.secondary),
763
- children: E.descriptionLabel
764
- }), /* @__PURE__ */ V("p", {
765
- className: l("break-words whitespace-pre-line", M, $.body),
765
+ children: [/* @__PURE__ */ K("h3", {
766
+ className: d(I, $.secondary),
767
+ children: A.descriptionLabel
768
+ }), /* @__PURE__ */ K("p", {
769
+ className: d("break-words whitespace-pre-line", R, $.body),
766
770
  children: e.description
767
771
  })]
768
772
  }),
769
- e.instructions !== "" && /* @__PURE__ */ H("section", {
773
+ e.instructions !== "" && /* @__PURE__ */ q("section", {
770
774
  className: "flex min-w-0 flex-col gap-1",
771
- children: [/* @__PURE__ */ V("h3", {
772
- className: l(k, $.secondary),
773
- children: E.instructionsLabel
774
- }), /* @__PURE__ */ V("div", {
775
- className: l("min-w-0 break-words", M, $.body),
776
- children: /* @__PURE__ */ V(n, {
775
+ children: [/* @__PURE__ */ K("h3", {
776
+ className: d(I, $.secondary),
777
+ children: A.instructionsLabel
778
+ }), /* @__PURE__ */ K("div", {
779
+ className: d("min-w-0 break-words", R, $.body),
780
+ children: /* @__PURE__ */ K(i, {
777
781
  content: e.instructions,
778
- classNames: _e
782
+ classNames: G
779
783
  })
780
784
  })]
781
785
  }),
782
- /* @__PURE__ */ H("section", {
786
+ /* @__PURE__ */ q("section", {
783
787
  className: "flex min-w-0 flex-col gap-2",
784
- children: [/* @__PURE__ */ V("h3", {
785
- className: l(k, $.secondary),
786
- children: E.contextLabel
787
- }), I.length === 0 ? /* @__PURE__ */ V(i, { label: E.emptyContextLabel }) : /* @__PURE__ */ H(me, { children: [
788
- /* @__PURE__ */ V("div", {
788
+ children: [/* @__PURE__ */ K("h3", {
789
+ className: d(I, $.secondary),
790
+ children: A.contextLabel
791
+ }), B.length === 0 ? /* @__PURE__ */ K(o, { label: A.emptyContextLabel }) : /* @__PURE__ */ q(pe, { children: [
792
+ /* @__PURE__ */ K("div", {
789
793
  role: "search",
790
- children: /* @__PURE__ */ V(le, {
794
+ children: /* @__PURE__ */ K(L, {
791
795
  value: c,
792
- onChange: (e) => u(e ?? ""),
793
- placeholder: E.contextSearchPlaceholder,
794
- clearLabel: E.clearSearchLabel,
795
- "aria-label": E.contextSearchAriaLabel
796
+ onChange: (e) => l(e ?? ""),
797
+ placeholder: A.contextSearchPlaceholder,
798
+ clearLabel: A.clearSearchLabel,
799
+ "aria-label": A.contextSearchAriaLabel
796
800
  })
797
801
  }),
798
- z.length === 0 ? /* @__PURE__ */ V("p", {
799
- className: l(N, $.secondary),
800
- children: E.noContextMatchesLabel
801
- }) : /* @__PURE__ */ V("ul", {
802
+ V.length === 0 ? /* @__PURE__ */ K("p", {
803
+ className: d(oe, $.secondary),
804
+ children: A.noContextMatchesLabel
805
+ }) : /* @__PURE__ */ K("ul", {
802
806
  className: "m-0 flex min-w-0 list-none flex-wrap gap-2 p-0 pt-2",
803
- children: z.map((e) => /* @__PURE__ */ V("li", {
807
+ children: V.map((e) => /* @__PURE__ */ K("li", {
804
808
  className: "min-w-0",
805
- children: /* @__PURE__ */ V(he, {
806
- attachment: Qe(e),
807
- searchQuery: B,
808
- onClick: x,
809
- labels: { clickLabel: E.openFileLabel(e.name) }
809
+ children: /* @__PURE__ */ K(me, {
810
+ attachment: nt(e),
811
+ searchQuery: fe,
812
+ onClick: w,
813
+ labels: { clickLabel: A.openFileLabel(e.name) }
810
814
  })
811
815
  }, e.name))
812
816
  }),
813
- /* @__PURE__ */ V(ie, {
817
+ /* @__PURE__ */ K(j, {
814
818
  visuallyHidden: !0,
815
- as: ae.Span,
816
- children: B === "" ? "" : E.contextResultCountLabel(z.length)
819
+ as: ne.Span,
820
+ children: fe === "" ? "" : A.contextResultCountLabel(V.length)
817
821
  })
818
822
  ] })]
819
823
  })
820
824
  ]
825
+ })]
826
+ })]
827
+ });
828
+ }), it = 24, at = ({ item: e, labels: n, rowTitleClassName: r, onOpen: i, onRename: a, onDelete: o }) => {
829
+ let s = U(() => [...a ? [{
830
+ key: "rename",
831
+ label: n.renameLabel,
832
+ onClick: () => a(e.id)
833
+ }] : [], ...o ? [{
834
+ key: "delete",
835
+ label: n.deleteLabel,
836
+ danger: !0,
837
+ onClick: () => o(e.id)
838
+ }] : []], [
839
+ e.id,
840
+ n.deleteLabel,
841
+ n.renameLabel,
842
+ o,
843
+ a
844
+ ]);
845
+ return /* @__PURE__ */ q("li", {
846
+ className: "flex min-w-0 items-center gap-1 rounded focus-within:bg-(--bg-accent-primary-alpha,rgba(92,141,234,0.15)) hover:bg-(--bg-accent-primary-alpha,rgba(92,141,234,0.15))",
847
+ children: [/* @__PURE__ */ q("button", {
848
+ type: "button",
849
+ "aria-label": n.openLabel(e.title, e.authorName),
850
+ className: "flex min-w-0 flex-1 items-center gap-3 rounded px-3 py-2 text-start focus-visible:outline-2 focus-visible:-outline-offset-2",
851
+ onClick: () => i(e.id),
852
+ children: [/* @__PURE__ */ K("span", {
853
+ "aria-hidden": !0,
854
+ className: "shrink-0",
855
+ children: /* @__PURE__ */ K(t, {
856
+ name: e.authorName ?? "",
857
+ size: it
858
+ })
859
+ }), /* @__PURE__ */ K(C, {
860
+ text: e.title,
861
+ className: d("min-w-0 flex-1", r)
862
+ })]
863
+ }), s.length > 0 && /* @__PURE__ */ K(x, {
864
+ items: s,
865
+ placement: "bottom-end",
866
+ children: /* @__PURE__ */ K(O, {
867
+ "aria-label": n.moreActionsLabel(e.title),
868
+ size: S.Small,
869
+ className: "me-2 shrink-0",
870
+ icon: /* @__PURE__ */ K(se, {
871
+ "aria-hidden": !0,
872
+ size: y.SM,
873
+ stroke: b
874
+ })
821
875
  })
822
876
  })]
823
877
  });
824
- });
878
+ }, ot = B(({ items: e, isLoading: t = !1, hasError: n = !1, onRetry: r, hasMore: i = !1, isLoadingMore: a = !1, onLoadMore: s, onOpen: c, onRename: ee, onDelete: l, labels: u, typography: f }) => {
879
+ let p = H(), m = f?.titleClassName ?? "dial-body-semi-text", h = f?.rowTitleClassName ?? "dial-body-text", g = f?.messageClassName ?? "dial-small-text", _ = !t && !n && e.length === 0;
880
+ return /* @__PURE__ */ q("section", {
881
+ "aria-labelledby": _ ? void 0 : p,
882
+ "aria-label": _ ? u.title : void 0,
883
+ className: "flex min-w-0 flex-col gap-2",
884
+ children: [!_ && /* @__PURE__ */ K("h2", {
885
+ id: p,
886
+ className: d("m-0", m),
887
+ children: u.title
888
+ }), t ? /* @__PURE__ */ q("div", {
889
+ role: "status",
890
+ className: "flex justify-center py-6",
891
+ children: [/* @__PURE__ */ K("span", {
892
+ "aria-hidden": !0,
893
+ children: /* @__PURE__ */ K(ae, {})
894
+ }), /* @__PURE__ */ K("span", {
895
+ className: "sr-only",
896
+ children: u.loadingLabel
897
+ })]
898
+ }) : n ? /* @__PURE__ */ q("div", {
899
+ role: "status",
900
+ className: "flex flex-col items-center gap-3 py-6 text-center",
901
+ children: [/* @__PURE__ */ K("p", {
902
+ className: d("m-0", g),
903
+ children: u.errorLabel
904
+ }), /* @__PURE__ */ K(D, {
905
+ label: u.retryLabel,
906
+ onClick: r
907
+ })]
908
+ }) : _ ? /* @__PURE__ */ K("div", {
909
+ role: "status",
910
+ children: /* @__PURE__ */ K(o, {
911
+ label: u.emptyTitle,
912
+ description: u.emptyDescription
913
+ })
914
+ }) : /* @__PURE__ */ q(pe, { children: [/* @__PURE__ */ K("ul", {
915
+ className: "m-0 flex min-w-0 list-none flex-col gap-1 p-0",
916
+ children: e.map((e) => /* @__PURE__ */ K(at, {
917
+ item: e,
918
+ labels: u,
919
+ rowTitleClassName: h,
920
+ onOpen: c,
921
+ onRename: ee,
922
+ onDelete: l
923
+ }, e.id))
924
+ }), i && s && /* @__PURE__ */ K(D, {
925
+ className: "self-center",
926
+ label: u.loadMoreLabel ?? "Show more",
927
+ disabled: a,
928
+ onClick: s
929
+ })] })]
930
+ });
931
+ }), st = B(({ composer: t, items: n, isLoading: r = !1, hasError: i = !1, onRetry: a, hasMore: o, isLoadingMore: s, onLoadMore: c, onOpen: ee, onRename: l, onDelete: u, labels: d, listTypography: f }) => {
932
+ let p = H(), m = W(null), [g, v] = G(null), [y, b] = G(""), [x, S] = G(), [C, w] = G(!1), [T, E] = G(null), [D, O] = G(!1), k = W(null), A = V(() => {
933
+ k.current = document.activeElement;
934
+ }, []), j = V(() => {
935
+ let e = k.current;
936
+ k.current = null, e?.isConnected && window.setTimeout(() => e.focus(), 0);
937
+ }, []), ne = V((e) => {
938
+ k.current = null, window.setTimeout(() => {
939
+ let t = m.current;
940
+ if (!t) return;
941
+ let n = t.querySelectorAll("li > button"), r = n[Math.min(e, n.length - 1)] ?? t.querySelector("h2, section");
942
+ r && !r.matches("button") && (r.tabIndex = -1), r?.focus();
943
+ }, 0);
944
+ }, []), M = V((e) => n.find((t) => t.id === e) ?? null, [n]), N = V((e) => {
945
+ A();
946
+ let t = M(e);
947
+ v(t), b(t?.title ?? ""), S(void 0);
948
+ }, [M, A]), re = V((e) => {
949
+ A(), E(M(e));
950
+ }, [M, A]), F = V(() => {
951
+ C || (v(null), j());
952
+ }, [C, j]), I = V(() => {
953
+ D || (E(null), j());
954
+ }, [D, j]), L = V(async () => {
955
+ if (!g || !l || C) return;
956
+ let e = y.trim();
957
+ if (!e) S(d.renameEmptyError);
958
+ else {
959
+ w(!0);
960
+ try {
961
+ await l(g.id, e), v(null), j();
962
+ } catch {} finally {
963
+ w(!1);
964
+ }
965
+ }
966
+ }, [
967
+ C,
968
+ d.renameEmptyError,
969
+ l,
970
+ g,
971
+ y,
972
+ j
973
+ ]), ae = V((e) => {
974
+ e.key !== "Enter" || e.nativeEvent.isComposing || (e.preventDefault(), L());
975
+ }, [L]), R = V(async () => {
976
+ if (!T || !u) return;
977
+ let e = n.findIndex((e) => e.id === T.id);
978
+ O(!0);
979
+ try {
980
+ await u(T.id), E(null), ne(Math.max(e, 0));
981
+ } catch {} finally {
982
+ O(!1);
983
+ }
984
+ }, [
985
+ T,
986
+ ne,
987
+ n,
988
+ u
989
+ ]), z = U(() => [{
990
+ label: d.renameCancelLabel ?? "Cancel",
991
+ variant: _.Primary,
992
+ appearance: h.Ghost,
993
+ disabled: C,
994
+ onClick: F
995
+ }, {
996
+ label: d.renameSaveLabel,
997
+ variant: _.Primary,
998
+ disabled: C,
999
+ onClick: () => {
1000
+ L();
1001
+ }
1002
+ }], [
1003
+ F,
1004
+ L,
1005
+ C,
1006
+ d.renameCancelLabel,
1007
+ d.renameSaveLabel
1008
+ ]);
1009
+ return /* @__PURE__ */ q(pe, { children: [
1010
+ t,
1011
+ /* @__PURE__ */ K("div", {
1012
+ ref: m,
1013
+ className: "contents",
1014
+ children: /* @__PURE__ */ K(ot, {
1015
+ items: n,
1016
+ isLoading: r,
1017
+ hasError: i,
1018
+ onRetry: a,
1019
+ hasMore: o,
1020
+ isLoadingMore: s,
1021
+ onLoadMore: c,
1022
+ onOpen: ee,
1023
+ onRename: l ? N : void 0,
1024
+ onDelete: u ? re : void 0,
1025
+ labels: d.list,
1026
+ typography: f
1027
+ })
1028
+ }),
1029
+ g && /* @__PURE__ */ K(P, {
1030
+ open: !0,
1031
+ header: d.renameTitle,
1032
+ size: ie.Sm,
1033
+ mainButtons: z,
1034
+ onClose: F,
1035
+ children: /* @__PURE__ */ K("div", {
1036
+ className: "px-6 py-4",
1037
+ children: /* @__PURE__ */ K(te, {
1038
+ id: p,
1039
+ value: y,
1040
+ labelProps: { label: d.renameInputLabel },
1041
+ error: x,
1042
+ disabled: C,
1043
+ onKeyDown: ae,
1044
+ onChange: (e) => {
1045
+ b(e ?? ""), S(void 0);
1046
+ }
1047
+ })
1048
+ })
1049
+ }),
1050
+ T && /* @__PURE__ */ K(e, {
1051
+ open: !0,
1052
+ title: d.deleteTitle(T.title),
1053
+ names: [T.title],
1054
+ message: d.deleteDescription,
1055
+ labels: d.deleteDialog,
1056
+ isLoading: D,
1057
+ onConfirm: () => {
1058
+ R();
1059
+ },
1060
+ onClose: I
1061
+ })
1062
+ ] });
1063
+ }), ct = B(({ projectName: e, projectHref: t, onBack: n, onProjectLinkClick: r, backLabel: i, className: a, nameClassName: o = "dial-body-text" }) => /* @__PURE__ */ q("nav", {
1064
+ "aria-label": i,
1065
+ className: d("flex min-w-0 shrink-0 items-center gap-2 border-b px-4 py-2", a),
1066
+ children: [/* @__PURE__ */ K(O, {
1067
+ "aria-label": i,
1068
+ icon: /* @__PURE__ */ K(z, {
1069
+ "aria-hidden": !0,
1070
+ size: y.MD,
1071
+ stroke: b,
1072
+ className: "rtl:scale-x-[-1]"
1073
+ }),
1074
+ onClick: n
1075
+ }), /* @__PURE__ */ K("a", {
1076
+ href: t,
1077
+ onClick: r,
1078
+ className: "min-w-0 hover:underline focus-visible:underline",
1079
+ children: /* @__PURE__ */ K(C, {
1080
+ text: e,
1081
+ className: d("min-w-0", o)
1082
+ })
1083
+ })]
1084
+ }));
825
1085
  //#endregion
826
- export { Y as ContextFileRejection, Ae as PROJECT_NAME_MAX_BYTES, Ze as ProjectCreateForm, X as ProjectNameError, De as ProjectSource, $e as ProjectView, J as Projects, U as ProjectsSortKey, He as checkContextFiles, We as filterContextFileItems, Re as getContextFilesSize, Le as isStoredContextFile, Fe as validateProjectName };
1086
+ export { Q as ContextFileRejection, Me as PROJECT_NAME_MAX_BYTES, ct as ProjectChatHeader, ot as ProjectConversationList, st as ProjectConversationsPanel, tt as ProjectCreateForm, je as ProjectNameError, Oe as ProjectSource, rt as ProjectView, De as Projects, ve as ProjectsSortKey, Ke as checkContextFiles, Je as filterContextFileItems, Ve as getContextFilesSize, ze as isStoredContextFile, Le as validateProjectName };