@epam/ai-dial-skill-editor 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,10 +1,10 @@
1
1
  import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as t, TextRefinementField as n, buildCssVars as r, formatFileSize as i, mergeClasses as a, useAvailableHeightCap as o, useTextRefinement as s } from "@epam/ai-dial-chat-shared";
2
- import { Accordion as c, ButtonAppearance as l, ButtonVariant as u, CaptionText as d, DIAL_ICON_SIZE as f, DIAL_KIT_ICON_STROKE as p, EditorThemes as m, ErrorText as h, FileDropzone as g, GhostButton as _, GhostIconButton as ee, Input as te, Label as ne, NeutralButton as v, Popup as re, PopupSize as y, PrimaryButton as b, Spinner as x, Textarea as ie } from "@epam/ai-dial-ui-kit";
3
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
4
- import { IconArrowNarrowLeft as T, IconFileText as E, IconPlus as ae, IconTrashX as oe, IconUpload as D } from "@tabler/icons-react";
5
- import { Suspense as se, lazy as O, useCallback as k, useEffect as A, useId as j, useMemo as M, useRef as N, useState as P } from "react";
6
- import { DialFileNodeType as F, DialFoldersTree as ce } from "@epam/ai-dial-react-file-manager";
7
- import { LazyMarkdownEditor as le } from "@epam/ai-dial-ui-kit/editors";
2
+ import { Accordion as c, ButtonAppearance as l, ButtonDropdown as u, ButtonVariant as d, CaptionText as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, EditorThemes as h, ElementSize as g, ErrorText as _, FileDropzone as v, GhostButton as y, GhostIconButton as ee, Input as te, Label as ne, NeutralButton as re, Popup as ie, PopupSize as ae, PrimaryButton as oe, Spinner as b, Textarea as x } from "@epam/ai-dial-ui-kit";
3
+ import { Fragment as se, jsx as S, jsxs as C } from "react/jsx-runtime";
4
+ import { IconArrowNarrowLeft as w, IconDatabase as ce, IconFileText as T, IconFileZip as le, IconFolderPlus as E, IconPlus as ue, IconTrashX as de, IconUpload as fe } from "@tabler/icons-react";
5
+ import { Suspense as D, lazy as O, useCallback as k, useEffect as pe, useId as me, useMemo as A, useRef as j, useState as M } from "react";
6
+ import { DialFileNodeType as he, DialFoldersTree as ge } from "@epam/ai-dial-react-file-manager";
7
+ import { LazyMarkdownEditor as N } from "@epam/ai-dial-ui-kit/editors";
8
8
  a("flex flex-col", {
9
9
  body: "_body_m2y60_2",
10
10
  sideColumn: "_sideColumn_m2y60_6",
@@ -12,131 +12,111 @@ a("flex flex-col", {
12
12
  }.sideColumn);
13
13
  //#endregion
14
14
  //#region ../builder-form/src/constants/public-class-names.ts
15
- var ue = {
15
+ var P = {
16
16
  layout: "dial-builder-form-layout",
17
17
  section: "dial-builder-form-section"
18
- }, I = {
18
+ }, F = {
19
19
  headerBorder: "_headerBorder_1kidu_1",
20
20
  footerBorder: "_footerBorder_1kidu_5",
21
21
  sidebarBorder: "_sidebarBorder_1kidu_9"
22
- }, de = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: i, leftContent: o, rightContent: s, isSaving: c = !1, labels: l, styles: u, dir: d }) => {
23
- let m = j(), h = c ? l?.savingStatusLabel ?? "Saving" : "", g = r({
22
+ }, _e = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: i, leftContent: o, rightContent: s, isSaving: c = !1, labels: l, styles: u, dir: d }) => {
23
+ let f = me(), h = c ? l?.savingStatusLabel ?? "Saving" : "", g = r({
24
24
  "--el-header-border-color": u?.colors?.headerBorderColor,
25
25
  "--el-sidebar-border-color": u?.colors?.sidebarBorderColor
26
26
  });
27
- return /* @__PURE__ */ w("div", {
27
+ return /* @__PURE__ */ C("div", {
28
28
  dir: d,
29
- className: a("flex min-h-0 flex-1 flex-col", ue.layout),
29
+ className: a("flex min-h-0 flex-1 flex-col", P.layout),
30
30
  style: g,
31
31
  children: [
32
- /* @__PURE__ */ C("span", {
32
+ /* @__PURE__ */ S("span", {
33
33
  role: "status",
34
34
  "aria-live": "polite",
35
35
  className: "sr-only",
36
- id: m,
36
+ id: f,
37
37
  children: h
38
38
  }),
39
- /* @__PURE__ */ w("div", {
40
- className: a("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", I.headerBorder),
41
- children: [/* @__PURE__ */ w("div", {
39
+ /* @__PURE__ */ C("div", {
40
+ className: a("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", F.headerBorder),
41
+ children: [/* @__PURE__ */ C("div", {
42
42
  className: "flex min-w-0 flex-1 items-center gap-2",
43
- children: [/* @__PURE__ */ C(ee, {
44
- icon: /* @__PURE__ */ C(T, {
45
- size: f.LG,
46
- stroke: p,
43
+ children: [/* @__PURE__ */ S(ee, {
44
+ icon: /* @__PURE__ */ S(w, {
45
+ size: p.LG,
46
+ stroke: m,
47
47
  "aria-hidden": !0,
48
48
  className: "rtl:scale-x-[-1]"
49
49
  }),
50
50
  "aria-label": n,
51
51
  onClick: t
52
- }), /* @__PURE__ */ C("h1", {
52
+ }), /* @__PURE__ */ S("h1", {
53
53
  className: "dial-h2-text min-w-0 truncate",
54
54
  children: e
55
55
  })]
56
- }), i != null && /* @__PURE__ */ C("div", {
56
+ }), i != null && /* @__PURE__ */ S("div", {
57
57
  className: "hidden shrink-0 items-center gap-2 desktop:flex",
58
58
  children: i
59
59
  })]
60
60
  }),
61
- /* @__PURE__ */ w("div", {
61
+ /* @__PURE__ */ C("div", {
62
62
  className: "flex flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden",
63
- children: [/* @__PURE__ */ C("div", {
64
- className: a(s == null ? "desktop:flex-1" : "desktop:w-[360px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", s == null ? void 0 : I.sidebarBorder),
63
+ children: [/* @__PURE__ */ S("div", {
64
+ className: a(s == null ? "desktop:flex-1" : "desktop:w-[400px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", s == null ? void 0 : F.sidebarBorder),
65
65
  children: o
66
- }), s != null && /* @__PURE__ */ C("div", {
66
+ }), s != null && /* @__PURE__ */ S("div", {
67
67
  className: "desktop:flex-1 desktop:overflow-y-auto",
68
68
  children: s
69
69
  })]
70
70
  }),
71
- i != null && /* @__PURE__ */ C("div", {
72
- className: a("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", I.footerBorder),
71
+ i != null && /* @__PURE__ */ S("div", {
72
+ className: a("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", F.footerBorder),
73
73
  children: i
74
74
  })
75
75
  ]
76
76
  });
77
- }, fe = {
77
+ }, ve = {
78
78
  root: "dial-skill-editor-root",
79
79
  refineFeedback: "dial-skill-editor-refine-feedback"
80
- }, L = (e) => !!e.dataTransfer?.types.includes("Files"), pe = (e) => {
81
- let [t, n] = P(!1), r = N(0);
82
- return {
83
- isDragActive: t,
84
- dropZoneHandlers: {
85
- onDragEnter: k((e) => {
86
- L(e) && (e.preventDefault(), r.current += 1, n(!0));
87
- }, []),
88
- onDragLeave: k((e) => {
89
- L(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
90
- }, []),
91
- onDragOver: k((e) => {
92
- L(e) && e.preventDefault();
93
- }, []),
94
- onDrop: k((t) => {
95
- if (!L(t)) return;
96
- t.preventDefault(), r.current = 0, n(!1);
97
- let i = Array.from(t.dataTransfer?.files ?? []);
98
- i.length > 0 && e(i);
99
- }, [e])
100
- }
101
- };
102
- }, R = "SKILL.md", z = /* @__PURE__ */ function(e) {
80
+ }, I = "SKILL.md", L = /* @__PURE__ */ function(e) {
103
81
  return e.File = "file", e.Folder = "folder", e;
104
- }({}), B = (e) => {
82
+ }({}), R = /* @__PURE__ */ function(e) {
83
+ return e.Header = "header", e.Child = "child", e.Sibling = "sibling", e;
84
+ }({}), z = (e) => {
105
85
  let t = e.lastIndexOf("/");
106
86
  return t === -1 ? null : e.slice(0, t);
107
- }, V = (e) => {
87
+ }, ye = (e) => {
108
88
  let t = e.lastIndexOf("/");
109
89
  return t === -1 ? e : e.slice(t + 1);
110
- }, me = (e) => {
90
+ }, be = (e) => {
111
91
  let t = /* @__PURE__ */ new Map(), n = (e) => {
112
92
  let n = t.get(e);
113
93
  if (n) return n;
114
94
  let r = {
115
95
  path: e,
116
- name: V(e),
117
- nodeType: F.FOLDER,
118
- parentPath: B(e),
96
+ name: ye(e),
97
+ nodeType: he.FOLDER,
98
+ parentPath: z(e),
119
99
  folderId: e,
120
100
  items: []
121
101
  };
122
102
  return t.set(e, r), r;
123
103
  };
124
104
  for (let r of e) {
125
- if (r.kind === z.Folder) {
126
- n(r.path);
105
+ if (r.kind === L.Folder) {
106
+ n(r.path).name = r.name;
127
107
  continue;
128
108
  }
129
109
  t.set(r.path, {
130
110
  path: r.path,
131
111
  name: r.name,
132
- nodeType: F.ITEM,
133
- parentPath: B(r.path),
134
- folderId: B(r.path) ?? ""
112
+ nodeType: he.ITEM,
113
+ parentPath: z(r.path),
114
+ folderId: z(r.path) ?? ""
135
115
  });
136
116
  }
137
117
  for (let t of [...e]) {
138
- let e = B(t.path);
139
- for (; e != null;) n(e), e = B(e);
118
+ let e = z(t.path);
119
+ for (; e != null;) n(e), e = z(e);
140
120
  }
141
121
  let r = [];
142
122
  for (let e of t.values()) {
@@ -148,196 +128,328 @@ var ue = {
148
128
  n ? n.items = [...n.items ?? [], e] : r.push(e);
149
129
  }
150
130
  return r;
151
- }, he = ({ isVisible: e, labels: t }) => {
131
+ }, B = (e, t) => e ? `${e}/${t}` : t, xe = (e) => z(e) ?? "", Se = (e, t) => {
132
+ if (!t) return "";
133
+ switch (e) {
134
+ case R.Child: return t.path;
135
+ case R.Sibling: return xe(t.path);
136
+ case R.Header: return t.kind === L.Folder ? t.path : "";
137
+ }
138
+ }, Ce = (e, t) => {
139
+ let n = t ? `${t}/` : "", r = /* @__PURE__ */ new Set();
140
+ for (let { path: i } of e) {
141
+ if (!i.startsWith(n) || i === t) continue;
142
+ let e = i.slice(n.length);
143
+ r.add(e.split("/")[0]);
144
+ }
145
+ return r;
146
+ }, we = (e, t, n) => {
147
+ let r = e.trim();
148
+ if (!r) return n.required;
149
+ if (/[/\\]/.test(r) || r === "." || r === "..") return n.invalid;
150
+ if (t.has(r)) return n.duplicate;
151
+ }, Te = "\\new-folder", Ee = ({ files: e, fileActions: t, defaultName: n, messages: r, onRevealFolder: i, onCreated: a }) => {
152
+ let [o, s] = M(null), c = o?.parentPath ?? null, l = j([]), u = c == null ? void 0 : B(c, Te), d = A(() => u == null ? void 0 : {
153
+ path: u,
154
+ name: n,
155
+ kind: L.Folder
156
+ }, [u, n]), f = k((n, i) => {
157
+ let a = Ce(e, i);
158
+ return i === "" && a.add(I), we(n, a, r) ?? t.validateFolderPath?.(B(i, n.trim()));
159
+ }, [
160
+ e,
161
+ r,
162
+ t
163
+ ]), p = k((e, t) => {
164
+ l.current = [], s({
165
+ parentPath: e,
166
+ pane: t
167
+ }), e !== "" && i(e);
168
+ }, [i]), m = k((e, t) => {
169
+ if (c == null || t.path !== u) return null;
170
+ let n = f(e, c);
171
+ return l.current = [...l.current.slice(-1), {
172
+ value: e,
173
+ isValid: n == null
174
+ }], n ?? null;
175
+ }, [
176
+ c,
177
+ u,
178
+ f
179
+ ]), h = k(() => {
180
+ l.current = [], s(null);
181
+ }, []), g = k((e) => {
182
+ if (c == null) return;
183
+ let [n] = l.current;
184
+ if (l.current.length === 2 && n != null && !n.isValid && n.value !== e || f(e, c) != null) {
185
+ h();
186
+ return;
187
+ }
188
+ let r = B(c, e.trim());
189
+ h(), t.onCreateFolder?.(r), a(r);
190
+ }, [
191
+ c,
192
+ f,
193
+ h,
194
+ t,
195
+ a
196
+ ]);
197
+ return {
198
+ draftNode: d,
199
+ draftPath: u,
200
+ draftPane: o?.pane,
201
+ startDraft: p,
202
+ handleValidate: m,
203
+ handleSave: g,
204
+ handleCancel: h
205
+ };
206
+ }, V = (e) => !!e.dataTransfer?.types.includes("Files"), De = (e) => {
207
+ let [t, n] = M(!1), r = j(0);
208
+ return {
209
+ isDragActive: t,
210
+ dropZoneHandlers: {
211
+ onDragEnter: k((e) => {
212
+ V(e) && (e.preventDefault(), r.current += 1, n(!0));
213
+ }, []),
214
+ onDragLeave: k((e) => {
215
+ V(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
216
+ }, []),
217
+ onDragOver: k((e) => {
218
+ V(e) && e.preventDefault();
219
+ }, []),
220
+ onDrop: k((t) => {
221
+ if (!V(t)) return;
222
+ t.preventDefault(), r.current = 0, n(!1);
223
+ let i = Array.from(t.dataTransfer?.files ?? []);
224
+ i.length > 0 && e(i);
225
+ }, [e])
226
+ }
227
+ };
228
+ }, H = /* @__PURE__ */ function(e) {
229
+ return e.Files = "files", e.Archive = "archive", e;
230
+ }({}), U = /* @__PURE__ */ function(e) {
231
+ return e.Mobile = "mobile", e.Desktop = "desktop", e;
232
+ }({}), Oe = ({ isVisible: e, labels: t }) => {
152
233
  if (!e) return null;
153
234
  let n = t ?? {};
154
- return /* @__PURE__ */ C("div", {
235
+ return /* @__PURE__ */ S("div", {
155
236
  role: "status",
156
237
  "aria-live": "polite",
157
238
  className: a("pointer-events-none absolute inset-0 z-[100] flex items-center justify-center backdrop-blur-sm"),
158
- children: /* @__PURE__ */ w("div", {
239
+ children: /* @__PURE__ */ C("div", {
159
240
  className: "flex flex-col items-center text-center",
160
241
  children: [
161
- /* @__PURE__ */ C(D, {
242
+ /* @__PURE__ */ S(fe, {
162
243
  size: 100,
163
244
  className: "text-accent-primary",
164
245
  "aria-hidden": !0,
165
- stroke: p
246
+ stroke: m
166
247
  }),
167
- /* @__PURE__ */ C("span", {
248
+ /* @__PURE__ */ S("span", {
168
249
  className: "dial-h3-text mt-5",
169
250
  children: n.dropOverlayTitle ?? "Upload files"
170
251
  }),
171
- /* @__PURE__ */ C("span", {
252
+ /* @__PURE__ */ S("span", {
172
253
  className: "dial-small-text mt-4",
173
254
  children: n.dropOverlaySubtitle ?? "Drop files here to add them to this skill"
174
255
  })
175
256
  ]
176
257
  })
177
258
  });
178
- }, H = /* @__PURE__ */ function(e) {
259
+ }, ke = /* @__PURE__ */ function(e) {
179
260
  return e.SupportingFile = "supporting-file", e.Manifest = "manifest", e;
180
- }({}), U = /* @__PURE__ */ function(e) {
261
+ }({}), W = /* @__PURE__ */ function(e) {
181
262
  return e.Valid = "valid", e.Invalid = "invalid", e;
182
- }({}), ge = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), _e = 0, ve = () => `skill-file-candidate-${++_e}`, ye = ({ isOpen: e, onClose: t, fileActions: n, initialFiles: r, labels: a }) => {
183
- let o = a ?? {}, [s, c] = P([]), [d, f] = P(/* @__PURE__ */ new Map()), [m, _] = P([]), [te, ne] = P(!1), [v, b] = P(), [ie, T] = P(!1), ae = j(), D = (e) => {
184
- let t = e.map((e) => ({
185
- id: ve(),
186
- file: e,
187
- path: ge(e)
188
- }));
189
- b(void 0), c((e) => [...e, ...t]);
190
- }, se = (e) => {
191
- c((t) => t.filter((t) => t.id !== e));
263
+ }({}), Ae = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), je = ".zip,application/zip", Me = 0, Ne = () => `skill-file-candidate-${++Me}`, Pe = (e, t, n) => ({
264
+ id: Ne(),
265
+ file: e,
266
+ path: B(n, t.replace(/\\/g, "/"))
267
+ }), Fe = ({ isOpen: e, onClose: t, fileActions: n, mode: r = H.Files, targetFolderPath: a = "", initialFiles: o, initialEntries: s, labels: c }) => {
268
+ let u = c ?? {}, [f, p] = M([]), [h, g] = M(/* @__PURE__ */ new Map()), [y, te] = M([]), [ne, re] = M(!1), [oe, x] = M(), [w, ce] = M(!1), [le, E] = M(), [ue, fe] = M(0), D = j(0), O = r === H.Archive, k = u.uploadArchiveErrorMessage ?? "Couldn't read this archive", A = me(), he = (e) => {
269
+ x(void 0), p((t) => [...t, ...e]);
270
+ }, ge = async (e) => {
271
+ let { extractArchive: t } = n;
272
+ if (!t) return;
273
+ let r = D.current;
274
+ E(void 0), fe((e) => e + 1);
275
+ try {
276
+ let n = await Promise.all(e.map((e) => t(e)));
277
+ if (r !== D.current) return;
278
+ let i = n.flat();
279
+ if (i.length === 0) {
280
+ E(u.uploadArchiveEmptyMessage ?? "This archive has no files");
281
+ return;
282
+ }
283
+ he(i.map((e) => Pe(e.file, e.path, a)));
284
+ } catch {
285
+ if (r !== D.current) return;
286
+ E(k);
287
+ } finally {
288
+ r === D.current && fe((e) => e - 1);
289
+ }
290
+ }, N = (e) => {
291
+ if (O) {
292
+ ge(e);
293
+ return;
294
+ }
295
+ he(e.map((e) => Pe(e, Ae(e), a)));
296
+ }, P = (e) => {
297
+ p((t) => t.filter((t) => t.id !== e));
192
298
  };
193
- A(() => {
194
- e && (c((r ?? []).map((e) => ({
195
- id: ve(),
196
- file: e,
197
- path: ge(e)
198
- }))), f(/* @__PURE__ */ new Map()), _([]), b(void 0));
199
- }, [e]), A(() => {
299
+ pe(() => {
300
+ e && (D.current += 1, p([...(o ?? []).map((e) => Pe(e, Ae(e), a)), ...(s ?? []).map((e) => Pe(e.file, e.path, a))]), g(/* @__PURE__ */ new Map()), te([]), x(void 0), E(void 0), fe(0));
301
+ }, [e]), pe(() => {
200
302
  if (!e) return;
201
303
  let t = !1;
202
- if (s.length === 0) {
203
- f(/* @__PURE__ */ new Map()), _([]);
304
+ if (f.length === 0) {
305
+ g(/* @__PURE__ */ new Map()), te([]);
204
306
  return;
205
307
  }
206
- return ne(!0), n.validateBatch(s).then(({ results: e, batchErrors: n }) => {
207
- t || (f(new Map(e.map((e) => [e.candidateId, e]))), _(n.map((e) => e.message)));
308
+ return re(!0), n.validateBatch(f).then(({ results: e, batchErrors: n }) => {
309
+ t || (g(new Map(e.map((e) => [e.candidateId, e]))), te(n.map((e) => e.message)));
208
310
  }).finally(() => {
209
- t || ne(!1);
311
+ t || re(!1);
210
312
  }), () => {
211
313
  t = !0;
212
314
  };
213
- }, [s, e]);
214
- let O = s.some((e) => d.get(e.id)?.status === U.Invalid), k = s.length > 0 && s.every((e) => d.get(e.id)?.status === U.Invalid), M = s.length > 0 && !O && m.length === 0 && !te && !ie, N = async () => {
215
- T(!0), b(void 0);
315
+ }, [f, e]);
316
+ let F = f.some((e) => h.get(e.id)?.status === W.Invalid), _e = f.length > 0 && f.every((e) => h.get(e.id)?.status === W.Invalid), ve = f.length > 0 && !F && y.length === 0 && !ne && !w && ue === 0, I = async () => {
317
+ ce(!0), x(void 0);
216
318
  try {
217
- let { results: e, batchErrors: r } = await n.validateBatch(s), i = new Map(e.map((e) => [e.candidateId, e]));
218
- if (f(i), _(r.map((e) => e.message)), s.some((e) => i.get(e.id)?.status === U.Invalid) || r.length > 0) return;
219
- let a = await n.commitBatch(s);
319
+ let { results: e, batchErrors: r } = await n.validateBatch(f), i = new Map(e.map((e) => [e.candidateId, e]));
320
+ if (g(i), te(r.map((e) => e.message)), f.some((e) => i.get(e.id)?.status === W.Invalid) || r.length > 0) return;
321
+ let a = await n.commitBatch(f);
220
322
  if (a.error) {
221
- b(a.error);
323
+ x(a.error);
222
324
  return;
223
325
  }
224
326
  t();
225
327
  } finally {
226
- T(!1);
328
+ ce(!1);
227
329
  }
228
330
  };
229
- return /* @__PURE__ */ C(re, {
331
+ return /* @__PURE__ */ S(ie, {
230
332
  open: e,
231
- header: o.uploadDialogTitle ?? "Upload files from device",
232
- size: y.Sm,
233
- closeAriaLabel: o.uploadDialogCloseAriaLabel ?? "Close",
333
+ header: O ? u.uploadArchiveDialogTitle ?? "Upload archive from device" : u.uploadDialogTitle ?? "Upload files from device",
334
+ size: ae.Sm,
335
+ closeAriaLabel: u.uploadDialogCloseAriaLabel ?? "Close",
234
336
  onClose: t,
235
337
  mainButtons: [{
236
- label: o.uploadCancelLabel ?? "Cancel",
237
- variant: u.Primary,
338
+ label: u.uploadCancelLabel ?? "Cancel",
339
+ variant: d.Primary,
238
340
  appearance: l.Ghost,
239
341
  onClick: t
240
342
  }, {
241
- label: o.uploadConfirmLabel ?? "Add",
242
- variant: u.Primary,
243
- iconBefore: ie ? /* @__PURE__ */ C(x, {
343
+ label: u.uploadConfirmLabel ?? "Add",
344
+ variant: d.Primary,
345
+ iconBefore: w ? /* @__PURE__ */ S(b, {
244
346
  size: 16,
245
347
  ariaLabel: ""
246
348
  }) : void 0,
247
- onClick: () => void N(),
248
- disabled: !M
349
+ onClick: () => void I(),
350
+ disabled: !ve
249
351
  }],
250
- children: /* @__PURE__ */ w("div", {
352
+ children: /* @__PURE__ */ C("div", {
251
353
  className: "flex flex-col gap-4 px-6 py-4",
252
354
  children: [
253
- /* @__PURE__ */ C(g, {
254
- label: /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("span", {
355
+ /* @__PURE__ */ S(v, {
356
+ label: /* @__PURE__ */ C(se, { children: [/* @__PURE__ */ S("span", {
255
357
  className: "desktop:hidden",
256
- children: o.uploadDropZoneMobileLabel ?? "Click here to upload"
257
- }), /* @__PURE__ */ C("span", {
358
+ children: O ? u.uploadArchiveDropZoneMobileLabel ?? "Click here to upload a .zip archive" : u.uploadDropZoneMobileLabel ?? "Click here to upload"
359
+ }), /* @__PURE__ */ S("span", {
258
360
  className: "hidden desktop:inline",
259
- children: o.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
361
+ children: O ? u.uploadArchiveDropZoneLabel ?? "Drag and drop a .zip archive or click here to upload" : u.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
260
362
  })] }),
261
- ariaLabel: o.uploadDropZoneAriaLabel ?? "Upload files",
363
+ ariaLabel: u.uploadDropZoneAriaLabel ?? "Upload files",
262
364
  multiple: !0,
263
- className: k ? "border-error hover:border-error" : void 0,
264
- onChange: D
365
+ accept: O ? je : void 0,
366
+ className: _e ? "border-error hover:border-error" : void 0,
367
+ onChange: N,
368
+ onReject: O ? () => E(k) : void 0
369
+ }),
370
+ ue > 0 && /* @__PURE__ */ S(b, { ariaLabel: u.uploadArchiveExtractingAriaLabel ?? "Reading archive" }),
371
+ /* @__PURE__ */ S("div", {
372
+ role: "alert",
373
+ children: le && /* @__PURE__ */ S(_, { text: le })
265
374
  }),
266
- /* @__PURE__ */ C("span", {
375
+ /* @__PURE__ */ S("span", {
267
376
  role: "status",
268
377
  "aria-live": "polite",
269
378
  className: "sr-only",
270
- id: ae,
271
- children: m.map((e) => `${o.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
379
+ id: A,
380
+ children: y.map((e) => `${u.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
272
381
  }),
273
- m.map((e) => /* @__PURE__ */ C(h, { text: e }, e)),
274
- s.length > 0 && /* @__PURE__ */ C("ul", {
382
+ y.map((e) => /* @__PURE__ */ S(_, { text: e }, e)),
383
+ f.length > 0 && /* @__PURE__ */ S("ul", {
275
384
  className: "flex flex-col gap-2",
276
- children: s.map((e) => {
277
- let t = d.get(e.id), n = t?.kind === H.Manifest, r = t?.status === U.Invalid;
278
- return /* @__PURE__ */ w("li", {
385
+ children: f.map((e) => {
386
+ let t = h.get(e.id), n = t?.kind === ke.Manifest, r = t?.status === W.Invalid;
387
+ return /* @__PURE__ */ C("li", {
279
388
  className: "flex items-center gap-2 rounded-lg border border-tertiary p-2",
280
389
  children: [
281
- /* @__PURE__ */ C(E, {
390
+ /* @__PURE__ */ S(T, {
282
391
  size: 20,
283
392
  "aria-hidden": !0,
284
- stroke: p
393
+ stroke: m
285
394
  }),
286
- /* @__PURE__ */ w("div", {
395
+ /* @__PURE__ */ C("div", {
287
396
  className: "flex min-w-0 flex-1 flex-col",
288
397
  children: [
289
- /* @__PURE__ */ C("span", {
398
+ /* @__PURE__ */ S("span", {
290
399
  className: "dial-small-text truncate",
291
400
  children: e.path
292
401
  }),
293
- /* @__PURE__ */ C("span", {
402
+ /* @__PURE__ */ S("span", {
294
403
  className: "dial-tiny-text text-secondary",
295
404
  children: i(e.file.size)
296
405
  }),
297
- r && t?.error && /* @__PURE__ */ C(h, { text: t.error }),
298
- n && !r && /* @__PURE__ */ C("span", {
406
+ r && t?.error && /* @__PURE__ */ S(_, { text: t.error }),
407
+ n && !r && /* @__PURE__ */ S("span", {
299
408
  className: "dial-tiny-text text-secondary",
300
- children: o.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
409
+ children: u.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
301
410
  })
302
411
  ]
303
412
  }),
304
- /* @__PURE__ */ C(ee, {
305
- icon: /* @__PURE__ */ C(oe, {
413
+ /* @__PURE__ */ S(ee, {
414
+ icon: /* @__PURE__ */ S(de, {
306
415
  size: 16,
307
416
  "aria-hidden": !0,
308
- stroke: p
417
+ stroke: m
309
418
  }),
310
- "aria-label": o.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
311
- onClick: () => se(e.id)
419
+ "aria-label": u.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
420
+ onClick: () => P(e.id)
312
421
  })
313
422
  ]
314
423
  }, e.id);
315
424
  })
316
425
  }),
317
- v && /* @__PURE__ */ C(h, { text: v })
426
+ oe && /* @__PURE__ */ S(_, { text: oe })
318
427
  ]
319
428
  })
320
429
  });
321
- }, W = {
430
+ }, G = {
322
431
  title: "_title_1cnn4_1",
323
432
  helperText: "_helperText_1cnn4_5",
324
433
  refineFeedback: "_refineFeedback_1cnn4_9",
325
434
  refineError: "_refineError_1cnn4_13"
326
- }, be = O(async () => {
327
- let { MarkdownEditor: e } = await le();
435
+ }, Ie = {
436
+ mode: H.Files,
437
+ targetFolderPath: ""
438
+ }, Le = O(async () => {
439
+ let { MarkdownEditor: e } = await N();
328
440
  return { default: e };
329
- }), G = ({ initialValues: i, files: l, selectedPath: u, onSelectedPathChange: g, expandedPaths: ee, onExpandedPathsChange: re, isLoading: y = !1, hasLoadError: T = !1, isSubmitting: E = !1, errors: D, submitError: O, conflict: F, onReloadLatest: le, isNameReadOnly: ue = !1, onDirtyChange: I, onValuesChange: L, onRefineDescription: B, onRefineInstructions: V, fileActions: H, supportingFileContent: U, onSubmit: ge, onCancel: _e, onBack: ve, backAriaLabel: G, title: xe, onRetry: Se, onRetrySubmit: Ce, labels: we, styles: Te, dir: Ee, instructionsEditorTheme: De = m.light }) => {
330
- let [K, Oe] = P({
441
+ }), Re = ({ initialValues: i, files: v, selectedPath: ee, onSelectedPathChange: ie, expandedPaths: ae, onExpandedPathsChange: w, isLoading: T = !1, hasLoadError: O = !1, isSubmitting: N = !1, errors: P, submitError: F, conflict: z, onReloadLatest: ye, isNameReadOnly: B = !1, onDirtyChange: xe, onValuesChange: Ce, onRefineDescription: we, onRefineInstructions: Te, fileActions: V, supportingFileContent: ke, onSubmit: W, onCancel: Ae, onBack: je, backAriaLabel: Me, title: Ne, onRetry: Pe, onRetrySubmit: Re, labels: ze, styles: Be, dir: Ve, instructionsEditorTheme: He = h.light }) => {
442
+ let [K, Ue] = M({
331
443
  name: i?.name ?? "",
332
444
  description: i?.description ?? "",
333
445
  instructions: i?.instructions ?? ""
334
- }), ke = j(), Ae = j(), q = N(void 0), je = o(), Me = N(K), J = (e) => {
446
+ }), We = me(), Ge = me(), q = j(void 0), Ke = o(), qe = j(K), Je = (e) => {
335
447
  let t = {
336
- ...Me.current,
448
+ ...qe.current,
337
449
  ...e
338
450
  };
339
- Me.current = t, Oe(t), L?.(t);
340
- }, Ne = (e) => e ? async (t, n) => {
451
+ qe.current = t, Ue(t), Ce?.(t);
452
+ }, Ye = (e) => e ? async (t, n) => {
341
453
  if (q.current && !q.current.aborted) throw new DOMException("Busy", "AbortError");
342
454
  q.current = n;
343
455
  try {
@@ -345,328 +457,457 @@ var ue = {
345
457
  } finally {
346
458
  q.current === n && (q.current = void 0);
347
459
  }
348
- } : void 0, Y = s({
460
+ } : void 0, Xe = s({
349
461
  value: K.description,
350
- onChange: (e) => J({ description: e }),
351
- onRefine: Ne(B),
352
- disabled: E || y || T,
462
+ onChange: (e) => Je({ description: e }),
463
+ onRefine: Ye(we),
464
+ disabled: N || T || O,
353
465
  resetKey: i
354
- }), Pe = s({
466
+ }), Ze = s({
355
467
  value: K.instructions,
356
- onChange: (e) => J({ instructions: e }),
357
- onRefine: Ne(V),
358
- disabled: E || y || T,
468
+ onChange: (e) => Je({ instructions: e }),
469
+ onRefine: Ye(Te),
470
+ disabled: N || T || O,
359
471
  resetKey: i
360
- }), Fe = Y.isPending || Pe.isPending, Ie = () => {
361
- Y.reset(), Pe.reset();
362
- }, Le = () => {
363
- Ie(), _e();
364
- }, Re = () => {
365
- Ie(), ve();
366
- }, ze = () => {
367
- E || y || T || q.current && !q.current.aborted || ge(K);
368
- }, Be = N(i), Ve = Be.current !== i, He = N(l);
369
- A(() => {
370
- Be.current = i;
472
+ }), Qe = Xe.isPending || Ze.isPending, $e = () => {
473
+ Xe.reset(), Ze.reset();
474
+ }, et = () => {
475
+ $e(), Ae();
476
+ }, tt = () => {
477
+ $e(), je();
478
+ }, nt = () => {
479
+ N || T || O || q.current && !q.current.aborted || W(K);
480
+ }, rt = j(i), it = rt.current !== i, at = j(v);
481
+ pe(() => {
482
+ rt.current = i;
371
483
  let e = {
372
484
  name: i?.name ?? "",
373
485
  description: i?.description ?? "",
374
486
  instructions: i?.instructions ?? ""
375
487
  };
376
- Me.current = e, Oe(e), He.current = l;
488
+ qe.current = e, Ue(e), at.current = v;
377
489
  }, [i]);
378
- let Ue = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), We = N(!1);
379
- A(() => {
380
- if (Ve) return;
490
+ let ot = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), st = j(!1);
491
+ pe(() => {
492
+ if (it) return;
381
493
  let e = {
382
494
  name: i?.name ?? "",
383
495
  description: i?.description ?? "",
384
496
  instructions: i?.instructions ?? ""
385
- }, t = JSON.stringify(K) !== JSON.stringify(e) || Ue(l) !== Ue(He.current);
386
- t !== We.current && (We.current = t, I?.(t));
497
+ }, t = JSON.stringify(K) !== JSON.stringify(e) || ot(v) !== ot(at.current);
498
+ t !== st.current && (st.current = t, xe?.(t));
387
499
  }, [
388
500
  K,
389
- l,
501
+ v,
390
502
  i,
391
- Ve,
392
- I
503
+ it,
504
+ xe
393
505
  ]);
394
- let [Ge, Ke] = P(R), X = u ?? Ge, qe = k((e) => {
395
- Ke(e), g?.(e);
396
- }, [g]), [Je, Ye] = P([]), Xe = ee ?? Je, Ze = M(() => new Set(Xe), [Xe]), Qe = k((e) => {
506
+ let [ct, lt] = M(I), J = ee ?? ct, ut = k((e) => {
507
+ lt(e), ie?.(e);
508
+ }, [ie]), [dt, ft] = M([]), pt = ae ?? dt, mt = A(() => new Set(pt), [pt]), ht = k((e) => {
397
509
  let t = [...e];
398
- Ye(t), re?.(t);
399
- }, [re]), [$e, et] = P(!1), [tt, nt] = P(), [rt, it] = P(!1), { isDragActive: at, dropZoneHandlers: ot } = pe(k((e) => {
400
- $e || (nt(e), et(!0));
401
- }, [$e])), Z = we ?? {}, Q = Te?.colors, st = Te?.typography ?? {}, ct = st.titleClassName ?? "dial-body-semi-text", lt = st.helperTextClassName ?? "dial-tiny-semi-text", ut = st.removeIconClassName ?? "text-secondary", dt = r({
402
- "--se-title-color": Q?.title,
403
- "--se-helper-text-color": Q?.helperText,
404
- "--se-refine-action-text": Q?.refineActionText,
405
- "--se-refine-error-text": Q?.refineErrorText
406
- }), ft = {
407
- feedbackClassName: a(W.refineFeedback, st.refineFeedbackClassName ?? "dial-small-text", fe.refineFeedback),
408
- errorClassName: W.refineError
409
- }, pt = Q?.border ? { colors: {
410
- headerBorderColor: Q.border,
411
- sidebarBorderColor: Q.border
412
- } } : void 0, mt = M(() => me([{
413
- path: R,
414
- name: R,
415
- kind: z.File
416
- }, ...l]), [l]), $ = M(() => l.find((e) => e.path === X), [l, X]), ht = k((e) => {
417
- qe(e.path);
418
- }, [qe]), gt = k((e) => {
419
- H.onRemoveNode(e), X === e && qe(R);
510
+ ft(t), w?.(t);
511
+ }, [w]), [gt, _t] = M(!1), [vt, yt] = M(Ie), Y = k((e) => {
512
+ yt(e), _t(!0);
513
+ }, []), [bt, xt] = M(!1), { isDragActive: St, dropZoneHandlers: Ct } = De(k((e) => {
514
+ gt || Y({
515
+ ...Ie,
516
+ initialFiles: e
517
+ });
518
+ }, [gt, Y])), X = ze ?? {}, Z = Be?.colors, wt = Be?.typography ?? {}, Tt = wt.titleClassName ?? "dial-body-semi-text", Et = wt.helperTextClassName ?? "dial-tiny-semi-text", Dt = wt.removeIconClassName ?? "text-secondary", Ot = wt.menuIconClassName ?? "text-secondary", kt = r({
519
+ "--se-title-color": Z?.title,
520
+ "--se-helper-text-color": Z?.helperText,
521
+ "--se-refine-action-text": Z?.refineActionText,
522
+ "--se-refine-error-text": Z?.refineErrorText
523
+ }), At = {
524
+ feedbackClassName: a(G.refineFeedback, wt.refineFeedbackClassName ?? "dial-small-text", ve.refineFeedback),
525
+ errorClassName: G.refineError
526
+ }, jt = Z?.border ? { colors: {
527
+ headerBorderColor: Z.border,
528
+ sidebarBorderColor: Z.border
529
+ } } : void 0, Mt = A(() => ({
530
+ required: X.folderNameRequiredError ?? "Enter a folder name",
531
+ invalid: X.folderNameInvalidError ?? "Folder name can't contain / or \\, or be . or ..",
532
+ duplicate: X.folderNameDuplicateError ?? "An item with this name already exists here"
533
+ }), [
534
+ X.folderNameRequiredError,
535
+ X.folderNameInvalidError,
536
+ X.folderNameDuplicateError
537
+ ]), Nt = k((e) => {
538
+ mt.has(e) || ht(new Set([...mt, e]));
539
+ }, [mt, ht]), Q = Ee({
540
+ files: v,
541
+ fileActions: V,
542
+ defaultName: X.newFolderDefaultName ?? "New folder",
543
+ messages: Mt,
544
+ onRevealFolder: Nt,
545
+ onCreated: ut
546
+ }), { draftNode: Pt, draftPath: Ft, draftPane: It } = Q, Lt = A(() => be([{
547
+ path: I,
548
+ name: I,
549
+ kind: L.File
550
+ }, ...v]), [v]), Rt = A(() => Pt ? be([
551
+ {
552
+ path: I,
553
+ name: I,
554
+ kind: L.File
555
+ },
556
+ ...v,
557
+ Pt
558
+ ]) : Lt, [
559
+ v,
560
+ Pt,
561
+ Lt
562
+ ]), zt = A(() => v.find((e) => e.path === J), [v, J]), Bt = k((e) => {
563
+ e.path !== Ft && ut(e.path);
564
+ }, [ut, Ft]), Vt = k((e) => {
565
+ V.onRemoveNode(e), J === e && ut(I);
420
566
  }, [
421
- H,
422
- X,
423
- qe
424
- ]), _t = k((e) => e.path === "SKILL.md" ? [] : [{
425
- key: "remove",
426
- label: Z.removeLabel ?? "Remove",
427
- icon: /* @__PURE__ */ C(oe, {
428
- size: f.SM,
429
- className: ut,
567
+ V,
568
+ J,
569
+ ut
570
+ ]), { startDraft: Ht } = Q, { onCreateFolder: Ut, extractArchive: Wt, pickFromFileSystem: Gt } = V, Kt = k(async (e) => {
571
+ if (!Gt) return;
572
+ let t = await Gt();
573
+ t?.length && Y({
574
+ mode: H.Files,
575
+ targetFolderPath: e,
576
+ initialEntries: t
577
+ });
578
+ }, [Gt, Y]), $ = k((e, t) => {
579
+ let n = (e) => /* @__PURE__ */ S(e, {
580
+ size: p.SM,
581
+ className: Ot,
430
582
  "aria-hidden": !0,
431
- stroke: p
432
- }),
433
- onClick: () => gt(e.path)
434
- }], [
435
- Z.removeLabel,
436
- ut,
437
- gt
438
- ]), vt = /* @__PURE__ */ w("div", {
583
+ stroke: m
584
+ }), r = [];
585
+ return Ut && r.push({
586
+ key: "create-folder",
587
+ label: X.createFolderLabel ?? "Create folder",
588
+ icon: n(E),
589
+ onClick: () => Ht(e, t)
590
+ }), r.push({
591
+ key: "upload-files",
592
+ label: X.uploadFilesLabel ?? X.addUploadLabel ?? "Upload files from device",
593
+ icon: n(fe),
594
+ onClick: () => Y({
595
+ mode: H.Files,
596
+ targetFolderPath: e
597
+ })
598
+ }), Wt && r.push({
599
+ key: "upload-archive",
600
+ label: X.uploadArchiveLabel ?? "Upload archive from device",
601
+ icon: n(le),
602
+ onClick: () => Y({
603
+ mode: H.Archive,
604
+ targetFolderPath: e
605
+ })
606
+ }), Gt && r.push({
607
+ key: "open-file-system",
608
+ label: X.openFileSystemLabel ?? "Open DIAL file system",
609
+ icon: n(ce),
610
+ onClick: () => void Kt(e)
611
+ }), r;
612
+ }, [
613
+ Ot,
614
+ Ut,
615
+ Wt,
616
+ Gt,
617
+ X.createFolderLabel,
618
+ X.uploadFilesLabel,
619
+ X.addUploadLabel,
620
+ X.uploadArchiveLabel,
621
+ X.openFileSystemLabel,
622
+ Ht,
623
+ Y,
624
+ Kt
625
+ ]), qt = A(() => {
626
+ let e = Se(R.Header, v.find((e) => e.path === J));
627
+ return {
628
+ [U.Mobile]: $(e, U.Mobile),
629
+ [U.Desktop]: $(e, U.Desktop)
630
+ };
631
+ }, [
632
+ $,
633
+ v,
634
+ J
635
+ ]), Jt = k((e, t) => {
636
+ if (e.path === "SKILL.md" || e.path === Ft) return [];
637
+ let n = {
638
+ path: e.path,
639
+ name: e.name,
640
+ kind: e.nodeType === he.FOLDER ? L.Folder : L.File
641
+ }, r = [];
642
+ return n.kind === L.Folder && r.push({
643
+ key: "add-child",
644
+ label: X.addChildLabel ?? "Add child",
645
+ children: $(Se(R.Child, n), t)
646
+ }), r.push({
647
+ key: "add-sibling",
648
+ label: X.addSiblingLabel ?? "Add sibling",
649
+ children: $(Se(R.Sibling, n), t)
650
+ }, {
651
+ key: "delete",
652
+ label: X.deleteLabel ?? X.removeLabel ?? "Delete",
653
+ icon: /* @__PURE__ */ S(de, {
654
+ size: p.SM,
655
+ className: Dt,
656
+ "aria-hidden": !0,
657
+ stroke: m
658
+ }),
659
+ onClick: () => Vt(e.path)
660
+ }), r;
661
+ }, [
662
+ Ft,
663
+ X.addChildLabel,
664
+ X.addSiblingLabel,
665
+ X.deleteLabel,
666
+ X.removeLabel,
667
+ Dt,
668
+ $,
669
+ Vt
670
+ ]), Yt = A(() => ({
671
+ [U.Mobile]: (e) => Jt(e, U.Mobile),
672
+ [U.Desktop]: (e) => Jt(e, U.Desktop)
673
+ }), [Jt]), Xt = (e) => /* @__PURE__ */ C("div", {
439
674
  className: "flex flex-col gap-2 desktop:gap-5",
440
- children: [/* @__PURE__ */ w("div", {
675
+ children: [/* @__PURE__ */ C("div", {
441
676
  className: "flex items-center justify-between",
442
- children: [/* @__PURE__ */ C("span", {
443
- className: a(W.title, ct),
444
- children: Z.filesHeading ?? "Files"
445
- }), /* @__PURE__ */ C(v, {
446
- label: Z.addUploadLabel ?? "Upload from device",
447
- iconBefore: /* @__PURE__ */ C(ae, {
448
- size: 16,
677
+ children: [/* @__PURE__ */ S("span", {
678
+ className: a(G.title, Tt),
679
+ children: X.filesHeading ?? "Files"
680
+ }), /* @__PURE__ */ S(u, {
681
+ label: X.addLabel ?? "Add",
682
+ variant: d.Neutral,
683
+ appearance: l.Solid,
684
+ size: g.Small,
685
+ iconBefore: /* @__PURE__ */ S(ue, {
686
+ size: p.SM,
449
687
  "aria-hidden": !0,
450
- stroke: p
688
+ stroke: m
451
689
  }),
452
- onClick: () => {
453
- nt(void 0), et(!0);
454
- }
690
+ items: qt[e]
455
691
  })]
456
- }), /* @__PURE__ */ C("div", {
692
+ }), /* @__PURE__ */ S("div", {
457
693
  role: "tree",
458
- "aria-label": Z.filesTreeAriaLabel ?? "Skill files",
459
- children: /* @__PURE__ */ C(ce, {
460
- items: mt,
694
+ "aria-label": X.filesTreeAriaLabel ?? "Skill files",
695
+ children: /* @__PURE__ */ S(ge, {
696
+ items: It === e ? Rt : Lt,
461
697
  showFiles: !0,
462
- selectedPath: X,
463
- expandedPaths: Ze,
464
- onExpandedPathsChange: Qe,
465
- onItemClick: ht,
466
- getContextMenuItems: _t,
698
+ selectedPath: J,
699
+ expandedPaths: mt,
700
+ onExpandedPathsChange: ht,
701
+ onItemClick: Bt,
702
+ getContextMenuItems: Yt[e],
703
+ renamedPath: It === e ? Ft : void 0,
704
+ onRenameSave: Q.handleSave,
705
+ onRenameCancel: Q.handleCancel,
706
+ onRenameValidate: Q.handleValidate,
467
707
  rootItemPath: ""
468
708
  })
469
709
  })]
470
- }), yt = /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(v, {
471
- label: Z.cancelLabel ?? "Cancel",
472
- onClick: Le,
473
- disabled: E
474
- }), /* @__PURE__ */ C(b, {
475
- label: Z.createLabel ?? "Create",
476
- iconBefore: E ? /* @__PURE__ */ C(x, {
710
+ }), Zt = /* @__PURE__ */ C(se, { children: [/* @__PURE__ */ S(re, {
711
+ label: X.cancelLabel ?? "Cancel",
712
+ onClick: et,
713
+ disabled: N
714
+ }), /* @__PURE__ */ S(oe, {
715
+ label: X.createLabel ?? "Create",
716
+ iconBefore: N ? /* @__PURE__ */ S(b, {
477
717
  size: 16,
478
718
  ariaLabel: ""
479
719
  }) : void 0,
480
- onClick: ze,
481
- disabled: E || Fe || y || T
720
+ onClick: nt,
721
+ disabled: N || Qe || T || O
482
722
  })] });
483
- return y ? /* @__PURE__ */ C("div", {
484
- dir: Ee,
723
+ return T ? /* @__PURE__ */ S("div", {
724
+ dir: Ve,
485
725
  className: "relative flex min-h-0 flex-1 flex-col",
486
- children: /* @__PURE__ */ C(de, {
487
- title: xe,
488
- onBack: Re,
489
- backAriaLabel: G,
490
- actions: yt,
726
+ children: /* @__PURE__ */ S(_e, {
727
+ title: Ne,
728
+ onBack: tt,
729
+ backAriaLabel: Me,
730
+ actions: Zt,
491
731
  isSaving: !1,
492
- labels: { savingStatusLabel: Z.savingStatusLabel },
493
- styles: pt,
494
- leftContent: /* @__PURE__ */ C("div", {
732
+ labels: { savingStatusLabel: X.savingStatusLabel },
733
+ styles: jt,
734
+ leftContent: /* @__PURE__ */ S("div", {
495
735
  role: "status",
496
- "aria-label": Z.loadingAriaLabel ?? "Loading skill",
736
+ "aria-label": X.loadingAriaLabel ?? "Loading skill",
497
737
  className: "flex flex-1 items-center justify-center p-8",
498
- children: /* @__PURE__ */ C(x, {})
738
+ children: /* @__PURE__ */ S(b, {})
499
739
  })
500
740
  })
501
- }) : T ? /* @__PURE__ */ C("div", {
502
- dir: Ee,
741
+ }) : O ? /* @__PURE__ */ S("div", {
742
+ dir: Ve,
503
743
  className: "relative flex min-h-0 flex-1 flex-col",
504
- children: /* @__PURE__ */ C(de, {
505
- title: xe,
506
- onBack: Re,
507
- backAriaLabel: G,
508
- actions: yt,
744
+ children: /* @__PURE__ */ S(_e, {
745
+ title: Ne,
746
+ onBack: tt,
747
+ backAriaLabel: Me,
748
+ actions: Zt,
509
749
  isSaving: !1,
510
- labels: { savingStatusLabel: Z.savingStatusLabel },
511
- styles: pt,
512
- leftContent: /* @__PURE__ */ w("div", {
750
+ labels: { savingStatusLabel: X.savingStatusLabel },
751
+ styles: jt,
752
+ leftContent: /* @__PURE__ */ C("div", {
513
753
  role: "alert",
514
754
  className: "flex flex-col items-center gap-4 p-8",
515
- children: [/* @__PURE__ */ C(h, { text: Z.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ C(b, {
516
- label: Z.retryLabel ?? "Retry",
517
- onClick: Se
755
+ children: [/* @__PURE__ */ S(_, { text: X.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ S(oe, {
756
+ label: X.retryLabel ?? "Retry",
757
+ onClick: Pe
518
758
  })]
519
759
  })
520
760
  })
521
- }) : /* @__PURE__ */ w("div", {
522
- dir: Ee,
523
- className: a("relative flex min-h-0 flex-1 flex-col", fe.root),
524
- style: dt,
525
- ...ot,
761
+ }) : /* @__PURE__ */ C("div", {
762
+ dir: Ve,
763
+ className: a("relative flex min-h-0 flex-1 flex-col", ve.root),
764
+ style: kt,
765
+ ...Ct,
526
766
  children: [
527
- /* @__PURE__ */ C(he, {
528
- isVisible: at && !$e,
529
- labels: we
767
+ /* @__PURE__ */ S(Oe, {
768
+ isVisible: St && !gt,
769
+ labels: ze
530
770
  }),
531
- /* @__PURE__ */ C(de, {
532
- title: xe,
533
- onBack: Re,
534
- backAriaLabel: G,
535
- actions: yt,
536
- isSaving: E,
537
- labels: { savingStatusLabel: Z.savingStatusLabel },
538
- styles: pt,
539
- leftContent: /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
771
+ /* @__PURE__ */ S(_e, {
772
+ title: Ne,
773
+ onBack: tt,
774
+ backAriaLabel: Me,
775
+ actions: Zt,
776
+ isSaving: N,
777
+ labels: { savingStatusLabel: X.savingStatusLabel },
778
+ styles: jt,
779
+ leftContent: /* @__PURE__ */ C(se, { children: [/* @__PURE__ */ S("div", {
540
780
  className: "px-4 py-4 desktop:hidden",
541
- children: /* @__PURE__ */ C(c, {
542
- title: Z.editingFileLabel ?? "Editing file",
543
- description: $?.name ?? "SKILL.md",
544
- expanded: rt,
545
- onToggle: it,
546
- ariaLabel: Z.editingFileLabel ?? "Editing file",
547
- children: vt
781
+ children: /* @__PURE__ */ S(c, {
782
+ title: X.editingFileLabel ?? "Editing file",
783
+ description: zt?.name ?? "SKILL.md",
784
+ expanded: bt,
785
+ onToggle: xt,
786
+ ariaLabel: X.editingFileLabel ?? "Editing file",
787
+ children: Xt(U.Mobile)
548
788
  })
549
- }), /* @__PURE__ */ C("div", {
789
+ }), /* @__PURE__ */ S("div", {
550
790
  className: "hidden px-8 py-6 desktop:block",
551
- children: vt
791
+ children: Xt(U.Desktop)
552
792
  })] }),
553
- rightContent: /* @__PURE__ */ w("div", {
793
+ rightContent: /* @__PURE__ */ C("div", {
554
794
  className: "flex flex-1 flex-col gap-4 px-4 py-6 desktop:gap-5 desktop:px-8",
555
795
  children: [
556
- O != null && /* @__PURE__ */ w("div", {
796
+ F != null && /* @__PURE__ */ C("div", {
557
797
  role: "alert",
558
798
  className: "flex items-center gap-2",
559
- children: [/* @__PURE__ */ C(h, { text: O }), Ce != null && /* @__PURE__ */ C(_, {
560
- label: Z.retryLabel ?? "Retry",
561
- onClick: Ce
799
+ children: [/* @__PURE__ */ S(_, { text: F }), Re != null && /* @__PURE__ */ S(y, {
800
+ label: X.retryLabel ?? "Retry",
801
+ onClick: Re
562
802
  })]
563
803
  }),
564
- F != null && /* @__PURE__ */ w("div", {
804
+ z != null && /* @__PURE__ */ C("div", {
565
805
  role: "alert",
566
806
  className: "flex items-center gap-2",
567
- children: [/* @__PURE__ */ C(h, { text: F.message }), /* @__PURE__ */ C(_, {
568
- label: Z.reloadLatestLabel ?? "Reload latest",
569
- onClick: le
807
+ children: [/* @__PURE__ */ S(_, { text: z.message }), /* @__PURE__ */ S(y, {
808
+ label: X.reloadLatestLabel ?? "Reload latest",
809
+ onClick: ye
570
810
  })]
571
811
  }),
572
- /* @__PURE__ */ C("h2", {
573
- className: a(W.title, ct),
574
- children: X === "SKILL.md" ? R : Z.selectedFileHeading?.($?.name ?? X) ?? $?.name ?? X
812
+ /* @__PURE__ */ S("h2", {
813
+ className: a(G.title, Tt),
814
+ children: J === "SKILL.md" ? I : X.selectedFileHeading?.(zt?.name ?? J) ?? zt?.name ?? J
575
815
  }),
576
- X === "SKILL.md" ? /* @__PURE__ */ w(S, { children: [
577
- /* @__PURE__ */ C(te, {
816
+ J === "SKILL.md" ? /* @__PURE__ */ C(se, { children: [
817
+ /* @__PURE__ */ S(te, {
578
818
  labelProps: {
579
- label: Z.nameLabel ?? "Name",
819
+ label: X.nameLabel ?? "Name",
580
820
  required: !0
581
821
  },
582
822
  value: K.name,
583
- onChange: (e) => J({ name: e ?? "" }),
584
- placeholder: Z.namePlaceholder ?? "good-morning-breakfast",
585
- caption: D?.name ? void 0 : Z.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
586
- error: D?.name,
587
- invalid: !!D?.name,
588
- disabled: ue
823
+ onChange: (e) => Je({ name: e ?? "" }),
824
+ placeholder: X.namePlaceholder ?? "good-morning-breakfast",
825
+ caption: P?.name ? void 0 : X.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
826
+ error: P?.name,
827
+ invalid: !!P?.name,
828
+ disabled: B
589
829
  }),
590
- /* @__PURE__ */ C(n, {
591
- isEnabled: !!B,
592
- fieldId: ke,
830
+ /* @__PURE__ */ S(n, {
831
+ isEnabled: !!we,
832
+ fieldId: We,
593
833
  required: !0,
594
- label: Z.descriptionLabel ?? "Description",
595
- labels: Z,
596
- refinement: Y,
597
- disabled: Fe || E,
598
- ...ft,
599
- children: /* @__PURE__ */ C(ie, {
600
- id: ke,
834
+ label: X.descriptionLabel ?? "Description",
835
+ labels: X,
836
+ refinement: Xe,
837
+ disabled: Qe || N,
838
+ ...At,
839
+ children: /* @__PURE__ */ S(x, {
840
+ id: We,
601
841
  "aria-required": !0,
602
- labelProps: B ? void 0 : {
603
- label: Z.descriptionLabel ?? "Description",
842
+ labelProps: we ? void 0 : {
843
+ label: X.descriptionLabel ?? "Description",
604
844
  required: !0
605
845
  },
606
846
  value: K.description,
607
- placeholder: Z.descriptionPlaceholder ?? "What this skill does and when to use it",
847
+ placeholder: X.descriptionPlaceholder ?? "What this skill does and when to use it",
608
848
  onChange: (e) => {
609
- Y.reset(), J({ description: e });
849
+ Xe.reset(), Je({ description: e });
610
850
  },
611
- error: D?.description,
612
- invalid: !!D?.description
851
+ error: P?.description,
852
+ invalid: !!P?.description
613
853
  })
614
854
  }),
615
- /* @__PURE__ */ C(n, {
616
- isEnabled: !!V,
617
- fieldId: Ae,
855
+ /* @__PURE__ */ S(n, {
856
+ isEnabled: !!Te,
857
+ fieldId: Ge,
618
858
  required: !0,
619
- labelClassName: a(W.helperText, lt),
620
- label: Z.instructionsLabel ?? "Instructions",
621
- labels: Z,
622
- refinement: Pe,
623
- disabled: Fe || E,
624
- ...ft,
625
- children: /* @__PURE__ */ w("div", {
859
+ labelClassName: a(G.helperText, Et),
860
+ label: X.instructionsLabel ?? "Instructions",
861
+ labels: X,
862
+ refinement: Ze,
863
+ disabled: Qe || N,
864
+ ...At,
865
+ children: /* @__PURE__ */ C("div", {
626
866
  className: "flex flex-1 flex-col gap-2",
627
867
  children: [
628
- !V && /* @__PURE__ */ C(ne, {
629
- htmlFor: Ae,
630
- className: a(W.helperText, lt),
631
- label: Z.instructionsLabel ?? "Instructions",
868
+ !Te && /* @__PURE__ */ S(ne, {
869
+ htmlFor: Ge,
870
+ className: a(G.helperText, Et),
871
+ label: X.instructionsLabel ?? "Instructions",
632
872
  required: !0
633
873
  }),
634
- /* @__PURE__ */ C("div", {
635
- ref: je,
874
+ /* @__PURE__ */ S("div", {
875
+ ref: Ke,
636
876
  className: a(e, t),
637
- children: /* @__PURE__ */ C(se, {
638
- fallback: /* @__PURE__ */ C(x, { ariaLabel: Z.instructionsLoadingAriaLabel ?? "Loading" }),
639
- children: /* @__PURE__ */ C(be, {
640
- id: Ae,
641
- ariaLabel: Z.instructionsLabel ?? "Instructions",
877
+ children: /* @__PURE__ */ S(D, {
878
+ fallback: /* @__PURE__ */ S(b, { ariaLabel: X.instructionsLoadingAriaLabel ?? "Loading" }),
879
+ children: /* @__PURE__ */ S(Le, {
880
+ id: Ge,
881
+ ariaLabel: X.instructionsLabel ?? "Instructions",
642
882
  value: K.instructions,
643
883
  onChange: (e) => {
644
- Pe.reset(), J({ instructions: e });
884
+ Ze.reset(), Je({ instructions: e });
645
885
  },
646
- theme: De,
647
- placeholder: Z.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
886
+ theme: He,
887
+ placeholder: X.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
648
888
  })
649
889
  })
650
890
  }),
651
- D?.instructions != null && /* @__PURE__ */ C(h, { text: D.instructions })
891
+ P?.instructions != null && /* @__PURE__ */ S(_, { text: P.instructions })
652
892
  ]
653
893
  })
654
894
  })
655
- ] }) : $?.kind === z.File && (U ?? /* @__PURE__ */ C(d, { text: Z.supportingFileNote ?? "This supporting file is included in the skill package as-is. Remove it from the Files panel to replace its content." }))
895
+ ] }) : zt?.kind === L.File && (ke ?? /* @__PURE__ */ S(f, { text: X.supportingFileNote ?? "This supporting file is included in the skill package as-is. Remove it from the Files panel to replace its content." }))
656
896
  ]
657
897
  })
658
898
  }),
659
- /* @__PURE__ */ C(ye, {
660
- isOpen: $e,
661
- onClose: () => {
662
- et(!1), nt(void 0);
663
- },
664
- fileActions: H,
665
- initialFiles: tt,
666
- labels: we
899
+ /* @__PURE__ */ S(Fe, {
900
+ isOpen: gt,
901
+ onClose: () => _t(!1),
902
+ fileActions: V,
903
+ mode: vt.mode,
904
+ targetFolderPath: vt.targetFolderPath,
905
+ initialFiles: vt.initialFiles,
906
+ initialEntries: vt.initialEntries,
907
+ labels: ze
667
908
  })
668
909
  ]
669
910
  });
670
911
  };
671
912
  //#endregion
672
- export { fe as SKILL_EDITOR_CLASS, G as SkillEditor, H as SkillFileCandidateKind, z as SkillFileNodeKind, U as SkillFileValidationStatus };
913
+ export { ve as SKILL_EDITOR_CLASS, Re as SkillEditor, ke as SkillFileCandidateKind, L as SkillFileNodeKind, H as SkillFileUploadMode, W as SkillFileValidationStatus };