@epam/ai-dial-skill-editor 1.2.0-dev.21 → 1.2.0-dev.217

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,129 +1,647 @@
1
- import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as t, buildCssVars as n, formatFileSize as r, mergeClasses as i, useAvailableHeightCap as a } from "@epam/ai-dial-chat-shared";
2
- import { Accordion as o, CaptionText as s, DIAL_ICON_SIZE as c, DIAL_KIT_ICON_STROKE as l, EditorThemes as u, ErrorText as d, FileDropzone as f, GhostButton as ee, GhostIconButton as te, Input as p, NeutralButton as m, Popup as ne, PopupSize as re, PrimaryButton as ie, Spinner as h, Textarea as g } from "@epam/ai-dial-ui-kit";
3
- import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
4
- import { IconArrowNarrowLeft as b, IconFileText as ae, IconPlus as oe, IconTrashX as se, IconUpload as x } from "@tabler/icons-react";
5
- import { Suspense as S, lazy as C, useCallback as w, useEffect as T, useId as E, useMemo as D, useRef as O, useState as k } from "react";
6
- import { DialFileNodeType as A, DialFoldersTree as ce } from "@epam/ai-dial-react-file-manager";
7
- import { LazyMarkdownEditor as j } from "@epam/ai-dial-ui-kit/editors";
8
- var M = {
1
+ import { MARKDOWN_EDITOR_FILL_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as t, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as n, RESIZABLE_TEXTAREA_CLASS_NAME as r, TAG_INPUT_TAG_CLASS_NAME as i, TextRefinementField as a, buildCssVars as o, formatFileSize as s, mergeClasses as c, useAvailableHeightCap as l, useTextRefinement as u } from "@epam/ai-dial-chat-shared";
2
+ import { Accordion as d, ButtonAppearance as f, ButtonDropdown as p, ButtonVariant as m, CaptionText as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, DangerIconButton as v, EditorThemes as y, ElementSize as b, ErrorText as x, FileDropzone as S, GhostButton as C, GhostIconButton as w, Input as T, Label as E, LinkButton as D, NeutralButton as O, Popup as k, PopupSize as ee, PrimaryButton as A, Select as te, Spinner as ne, TagInput as j, Textarea as M, TextareaResize as N } from "@epam/ai-dial-ui-kit";
3
+ import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
4
+ import { IconArrowNarrowLeft as L, IconDatabase as re, IconFileText as ie, IconFileZip as ae, IconFolderPlus as oe, IconPhoto as se, IconPlus as ce, IconTrashX as le, IconUpload as ue } from "@tabler/icons-react";
5
+ import { Suspense as de, lazy as R, memo as fe, useCallback as z, useEffect as pe, useId as me, useMemo as B, useRef as V, useState as H } from "react";
6
+ import { DialFileNodeType as he, DialFoldersTree as ge } from "@epam/ai-dial-react-file-manager";
7
+ import { LazyMarkdownEditor as _e } from "@epam/ai-dial-ui-kit/editors";
8
+ c("flex flex-col", {
9
+ body: "_body_m2y60_2",
10
+ sideColumn: "_sideColumn_m2y60_6",
11
+ reservedColumn: "_reservedColumn_m2y60_10"
12
+ }.sideColumn);
13
+ //#endregion
14
+ //#region ../builder-form/src/constants/public-class-names.ts
15
+ var ve = {
16
+ layout: "dial-builder-form-layout",
17
+ section: "dial-builder-form-section",
18
+ metadataSection: "dial-builder-form-metadata-section",
19
+ setupSection: "dial-builder-form-setup-section"
20
+ }, ye = {
21
+ section: "_section_l1mnx_1",
22
+ title: "_title_l1mnx_5"
23
+ }, be = ({ title: e, children: t, styles: n, className: r }) => {
24
+ let i = o({
25
+ "--es-border-color": n?.colors?.borderColor,
26
+ "--es-title-color": n?.colors?.titleColor
27
+ });
28
+ return /* @__PURE__ */ I("section", {
29
+ className: c("flex h-full flex-col gap-4 rounded border p-6", ye.section, r, ve.section),
30
+ style: i,
31
+ children: [e != null && /* @__PURE__ */ F("h2", {
32
+ className: c("dial-h3-text", ye.title),
33
+ children: e
34
+ }), t]
35
+ });
36
+ }, xe = {
9
37
  headerBorder: "_headerBorder_1kidu_1",
10
38
  footerBorder: "_footerBorder_1kidu_5",
11
39
  sidebarBorder: "_sidebarBorder_1kidu_9"
12
- }, N = ({ title: e, onBack: t, backAriaLabel: r = "Back", actions: a, leftContent: o, rightContent: s, isSaving: u = !1, labels: d, styles: f, dir: ee }) => {
13
- let p = E(), m = u ? d?.savingStatusLabel ?? "Saving" : "";
14
- return /* @__PURE__ */ y("div", {
15
- dir: ee,
16
- className: "flex min-h-0 flex-1 flex-col",
17
- style: n({
18
- "--el-header-border-color": f?.colors?.headerBorderColor,
19
- "--el-sidebar-border-color": f?.colors?.sidebarBorderColor
20
- }),
40
+ }, Se = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: r, leftContent: i, rightContent: a, isSaving: s = !1, labels: l, styles: u, dir: d }) => {
41
+ let f = me(), p = s ? l?.savingStatusLabel ?? "Saving" : "", m = o({
42
+ "--el-header-border-color": u?.colors?.headerBorderColor,
43
+ "--el-sidebar-border-color": u?.colors?.sidebarBorderColor
44
+ });
45
+ return /* @__PURE__ */ I("div", {
46
+ dir: d,
47
+ className: c("flex min-h-0 flex-1 flex-col", ve.layout),
48
+ style: m,
21
49
  children: [
22
- /* @__PURE__ */ v("span", {
50
+ /* @__PURE__ */ F("span", {
23
51
  role: "status",
24
52
  "aria-live": "polite",
25
53
  className: "sr-only",
26
- id: p,
27
- children: m
54
+ id: f,
55
+ children: p
28
56
  }),
29
- /* @__PURE__ */ y("div", {
30
- className: i("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", M.headerBorder),
31
- children: [/* @__PURE__ */ y("div", {
57
+ /* @__PURE__ */ I("div", {
58
+ className: c("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", xe.headerBorder),
59
+ children: [/* @__PURE__ */ I("div", {
32
60
  className: "flex min-w-0 flex-1 items-center gap-2",
33
- children: [/* @__PURE__ */ v(te, {
34
- icon: /* @__PURE__ */ v(b, {
35
- size: c.LG,
36
- stroke: l,
61
+ children: [/* @__PURE__ */ F(w, {
62
+ icon: /* @__PURE__ */ F(L, {
63
+ size: g.LG,
64
+ stroke: _,
37
65
  "aria-hidden": !0,
38
66
  className: "rtl:scale-x-[-1]"
39
67
  }),
40
- "aria-label": r,
68
+ "aria-label": n,
41
69
  onClick: t
42
- }), /* @__PURE__ */ v("h1", {
70
+ }), /* @__PURE__ */ F("h1", {
43
71
  className: "dial-h2-text min-w-0 truncate",
44
72
  children: e
45
73
  })]
46
- }), a != null && /* @__PURE__ */ v("div", {
74
+ }), r != null && /* @__PURE__ */ F("div", {
47
75
  className: "hidden shrink-0 items-center gap-2 desktop:flex",
48
- children: a
76
+ children: r
49
77
  })]
50
78
  }),
51
- /* @__PURE__ */ y("div", {
79
+ /* @__PURE__ */ I("div", {
52
80
  className: "flex flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden",
53
- children: [/* @__PURE__ */ v("div", {
54
- className: i(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 : M.sidebarBorder),
55
- children: o
56
- }), s != null && /* @__PURE__ */ v("div", {
57
- className: "desktop:flex-1 desktop:overflow-y-auto",
58
- children: s
81
+ children: [/* @__PURE__ */ F("div", {
82
+ className: c(a == null ? "desktop:flex-1" : "desktop:w-[400px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", a == null ? void 0 : xe.sidebarBorder),
83
+ children: i
84
+ }), a != null && /* @__PURE__ */ F("div", {
85
+ className: "desktop:flex desktop:min-h-0 desktop:flex-1 desktop:flex-col desktop:overflow-y-auto",
86
+ children: a
59
87
  })]
60
88
  }),
61
- a != null && /* @__PURE__ */ v("div", {
62
- className: i("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", M.footerBorder),
63
- children: a
89
+ r != null && /* @__PURE__ */ F("div", {
90
+ className: c("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", xe.footerBorder),
91
+ children: r
64
92
  })
65
93
  ]
66
94
  });
67
- }, P = (e) => !!e.dataTransfer?.types.includes("Files"), le = (e) => {
68
- let [t, n] = k(!1), r = O(0);
69
- return {
70
- isDragActive: t,
71
- dropZoneHandlers: {
72
- onDragEnter: w((e) => {
73
- P(e) && (e.preventDefault(), r.current += 1, n(!0));
74
- }, []),
75
- onDragLeave: w((e) => {
76
- P(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
77
- }, []),
78
- onDragOver: w((e) => {
79
- P(e) && e.preventDefault();
80
- }, []),
81
- onDrop: w((t) => {
82
- if (!P(t)) return;
83
- t.preventDefault(), r.current = 0, n(!1);
84
- let i = Array.from(t.dataTransfer?.files ?? []);
85
- i.length > 0 && e(i);
86
- }, [e])
95
+ }, Ce = {
96
+ box: "_box_c9as8_1",
97
+ icon: "_icon_c9as8_6",
98
+ caption: "_caption_c9as8_10"
99
+ }, we = ({ label: e, avatarUrl: t, avatarAlt: n = "", addAvatarLabel: r = "Add avatar", captionText: i = "PNG, JPG or SVG (max 1 MB)", onAddAvatarClick: a, styles: s, className: l }) => {
100
+ let u = o({
101
+ "--aa-box-bg": s?.colors?.boxBackgroundColor,
102
+ "--aa-box-border": s?.colors?.boxBorderColor,
103
+ "--aa-icon": s?.colors?.placeholderIconColor,
104
+ "--aa-caption": s?.colors?.captionColor
105
+ });
106
+ return /* @__PURE__ */ I("div", {
107
+ className: c("flex flex-col gap-2", l),
108
+ style: u,
109
+ children: [/* @__PURE__ */ F(E, { label: e }), /* @__PURE__ */ I("div", {
110
+ className: "flex items-start gap-3",
111
+ children: [/* @__PURE__ */ F("div", {
112
+ className: c("flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border", Ce.box),
113
+ children: t ? /* @__PURE__ */ F("img", {
114
+ src: t,
115
+ alt: n,
116
+ className: "h-16 w-16 object-cover"
117
+ }) : /* @__PURE__ */ F(se, {
118
+ size: g.LG,
119
+ stroke: _,
120
+ "aria-hidden": !0,
121
+ className: Ce.icon
122
+ })
123
+ }), /* @__PURE__ */ I("div", {
124
+ className: "flex flex-col gap-3",
125
+ children: [/* @__PURE__ */ F(D, {
126
+ size: b.Small,
127
+ iconBefore: /* @__PURE__ */ F(ce, {
128
+ size: g.SM,
129
+ stroke: _,
130
+ "aria-hidden": !0
131
+ }),
132
+ className: "w-fit",
133
+ label: r,
134
+ onClick: a
135
+ }), /* @__PURE__ */ F("span", {
136
+ className: c("dial-tiny-text", Ce.caption),
137
+ children: i
138
+ })]
139
+ })]
140
+ })]
141
+ });
142
+ }, Te = ({ isOpen: e, onClose: t, onAttach: n, bucket: r, FileManagerModal: i, allowedMimeTypes: a, maxFileSizeBytes: o, labels: s }) => {
143
+ let c = z((e) => e.length === 1 ? s.deleteConfirmTitleSingle : s.deleteConfirmTitleMultiple, [s.deleteConfirmTitleSingle, s.deleteConfirmTitleMultiple]), l = z((e) => /* @__PURE__ */ F("div", {
144
+ className: "dial-small-text px-6 py-3",
145
+ children: /* @__PURE__ */ F("p", {
146
+ className: "mb-3 text-secondary",
147
+ children: e.length === 1 ? /* @__PURE__ */ I(P, { children: [
148
+ s.deleteConfirmSingleText,
149
+ " ",
150
+ /* @__PURE__ */ I("span", {
151
+ className: "break-words text-primary",
152
+ children: [
153
+ "\"",
154
+ e[0].split("/").pop(),
155
+ "\"?"
156
+ ]
157
+ })
158
+ ] }) : /* @__PURE__ */ I(P, { children: [
159
+ s.deleteConfirmMultipleText,
160
+ " ",
161
+ /* @__PURE__ */ I("span", {
162
+ className: "text-primary",
163
+ children: [
164
+ e.length,
165
+ " ",
166
+ s.deleteConfirmItemsLabel
167
+ ]
168
+ })
169
+ ] })
170
+ })
171
+ }), [
172
+ s.deleteConfirmSingleText,
173
+ s.deleteConfirmMultipleText,
174
+ s.deleteConfirmItemsLabel
175
+ ]);
176
+ return /* @__PURE__ */ F(de, {
177
+ fallback: null,
178
+ children: e && /* @__PURE__ */ F(i, {
179
+ isOpen: e,
180
+ onClose: t,
181
+ onAttach: n,
182
+ bucket: r,
183
+ allowedTypes: a,
184
+ maxSelectableFileSize: o,
185
+ maximumAttachmentsAmount: 1,
186
+ canAttachFolders: !1,
187
+ title: s.title,
188
+ attachLabel: s.attachLabel,
189
+ emptyTitle: s.emptyTitle,
190
+ emptyDescription: s.emptyDescription,
191
+ errorMessage: s.errorMessage,
192
+ retryLabel: s.retryLabel,
193
+ hiddenFilesLabel: s.hiddenFilesLabel,
194
+ showHiddenFilesLabel: s.showHiddenFilesLabel,
195
+ hideHiddenFilesLabel: s.hideHiddenFilesLabel,
196
+ getSelectionLabel: s.getSelectionLabel,
197
+ uploadFilesLabel: s.uploadFilesLabel,
198
+ newFolderLabel: s.newFolderLabel,
199
+ downloadLabel: s.downloadLabel,
200
+ downloadingLabel: s.downloadingLabel,
201
+ deleteLabel: s.deleteLabel,
202
+ deletingLabel: s.deletingLabel,
203
+ deleteConfirmTitle: c,
204
+ deleteConfirmBody: l,
205
+ deleteConfirmLabel: s.deleteConfirmLabel,
206
+ deleteCancelLabel: s.deleteCancelLabel
207
+ })
208
+ });
209
+ }, U = /* @__PURE__ */ function(e) {
210
+ return e.Avatar = "avatar", e.Name = "name", e.Version = "version", e.Description = "description", e.Locales = "locales", e.Tags = "tags", e;
211
+ }({}), Ee = [
212
+ "avatar",
213
+ "name",
214
+ "version",
215
+ "description",
216
+ "locales",
217
+ "tags"
218
+ ], W = (e, t, n) => ({
219
+ id: e,
220
+ language: n.find((e) => !t.has(e.code))?.code ?? "",
221
+ name: "",
222
+ description: ""
223
+ }), De = ({ value: e, onChange: t, availableLocaleOptions: n = [], labels: i, className: a, summaryClassName: o = "dial-body-text text-secondary", rowLabelClassName: s = "dial-tiny-lead-text text-secondary" }) => {
224
+ let { summaryLabel: l, addLabel: u, editLabel: d, popupTitle: p, addLocaleLabel: h, localeRowLabel: y = "Locale", languageLabel: x, nameLabel: S, namePlaceholder: C, descriptionLabel: w, descriptionPlaceholder: E, deleteAriaLabel: O, cancelLabel: ee = "Cancel", saveLabel: A = "Save" } = i, [ne, j] = H(!1), [P, L] = H([]), re = V(0);
225
+ pe(() => {
226
+ ne && L(e.length > 0 ? e : [W(`locale-row-${++re.current}`, /* @__PURE__ */ new Set(), n)]);
227
+ }, [
228
+ ne,
229
+ e,
230
+ n
231
+ ]);
232
+ let ie = () => j(!0), ae = () => j(!1), oe = () => {
233
+ t(P.filter((e) => e.language && e.name)), j(!1);
234
+ }, se = () => {
235
+ let e = new Set(P.map((e) => e.language).filter(Boolean));
236
+ L((t) => [...t, W(`locale-row-${++re.current}`, e, n)]);
237
+ }, ue = (e, t) => {
238
+ L((n) => n.map((n) => n.id === e ? {
239
+ ...n,
240
+ ...t
241
+ } : n));
242
+ }, de = (e) => {
243
+ L((t) => t.filter((t) => t.id !== e));
244
+ }, R = (e) => n.find((t) => t.code === e)?.label ?? e.toUpperCase(), fe = P.some((e) => !e.language || !e.name);
245
+ return n.length === 0 ? null : /* @__PURE__ */ I("div", {
246
+ className: c("flex items-center gap-2", a),
247
+ children: [
248
+ e.length > 0 && /* @__PURE__ */ F("span", {
249
+ className: o,
250
+ children: `${l}: ${e.map((e) => `[${R(e.language)}]`).join(", ")}`
251
+ }),
252
+ /* @__PURE__ */ F(D, {
253
+ label: e.length > 0 ? d : u,
254
+ iconBefore: /* @__PURE__ */ F(ce, {
255
+ size: g.SM,
256
+ "aria-hidden": !0,
257
+ stroke: _
258
+ }),
259
+ className: "!px-0",
260
+ onClick: ie
261
+ }),
262
+ /* @__PURE__ */ F(k, {
263
+ open: ne,
264
+ header: p,
265
+ onClose: ae,
266
+ mainButtons: [{
267
+ label: ee,
268
+ onClick: ae
269
+ }, {
270
+ label: A,
271
+ variant: m.Primary,
272
+ disabled: fe,
273
+ onClick: oe
274
+ }],
275
+ children: /* @__PURE__ */ I("div", {
276
+ className: "flex flex-col gap-8 px-6 py-3",
277
+ children: [P.map((e, t) => {
278
+ let i = new Set(P.filter((t) => t.id !== e.id).map((e) => e.language).filter(Boolean));
279
+ return /* @__PURE__ */ I("div", {
280
+ className: "flex flex-col gap-2",
281
+ children: [/* @__PURE__ */ I("div", {
282
+ className: "flex items-center justify-between",
283
+ children: [/* @__PURE__ */ I("span", {
284
+ className: s,
285
+ children: [
286
+ y,
287
+ " ",
288
+ t + 1
289
+ ]
290
+ }), /* @__PURE__ */ F(v, {
291
+ appearance: f.Ghost,
292
+ size: b.Small,
293
+ icon: /* @__PURE__ */ F(le, {
294
+ size: g.SM,
295
+ "aria-hidden": !0,
296
+ stroke: _
297
+ }),
298
+ "aria-label": `${O} ${t + 1}`,
299
+ onClick: () => de(e.id)
300
+ })]
301
+ }), /* @__PURE__ */ I("div", {
302
+ role: "group",
303
+ "aria-label": `${y} ${t + 1}`,
304
+ className: "flex flex-col gap-5",
305
+ children: [/* @__PURE__ */ I("div", {
306
+ className: "flex flex-col gap-5 desktop:flex-row desktop:items-start",
307
+ children: [/* @__PURE__ */ F(te, {
308
+ id: `${e.id}-language`,
309
+ labelProps: {
310
+ label: x,
311
+ required: !0
312
+ },
313
+ className: "desktop:shrink-0 desktop:basis-40",
314
+ options: n.map((e) => ({
315
+ value: e.code,
316
+ label: e.label,
317
+ disabled: i.has(e.code)
318
+ })),
319
+ value: e.language,
320
+ onChange: (t) => ue(e.id, { language: t })
321
+ }), /* @__PURE__ */ F(T, {
322
+ id: `${e.id}-name`,
323
+ containerClassName: "min-w-0 flex-1",
324
+ required: !0,
325
+ value: e.name,
326
+ onChange: (t) => ue(e.id, { name: t ?? "" }),
327
+ labelProps: {
328
+ label: S,
329
+ required: !0
330
+ },
331
+ placeholder: C
332
+ })]
333
+ }), /* @__PURE__ */ F(M, {
334
+ id: `${e.id}-description`,
335
+ className: r,
336
+ resize: N.Vertical,
337
+ value: e.description,
338
+ onChange: (t) => ue(e.id, { description: t }),
339
+ labelProps: { label: w },
340
+ placeholder: E
341
+ })]
342
+ })]
343
+ }, e.id);
344
+ }), /* @__PURE__ */ F(D, {
345
+ label: h,
346
+ iconBefore: /* @__PURE__ */ F(ce, {
347
+ size: g.SM,
348
+ "aria-hidden": !0,
349
+ stroke: _
350
+ }),
351
+ className: "self-start",
352
+ onClick: se,
353
+ disabled: P.length >= n.length
354
+ })]
355
+ })
356
+ })
357
+ ]
358
+ });
359
+ }, Oe = "Add tags, comma separated", G = "deployment-creation-form-description", ke = ({ values: e, errors: t, onChange: n, onNameBlur: a, onVersionBlur: o, iconPreviewUrl: s, onAddAvatarClick: l, labels: u, styles: d, availableLocaleOptions: f = [], fields: p = Ee, isNameReadOnly: m = !1, nameCaption: h, isDescriptionRequired: g = !1, renderDescription: _, focusRequestKey: v }) => {
360
+ let y = V(null), b = V(null), x = V(null), S = V(!1), C = (e) => p.includes(e), w = C(U.Name), E = C(U.Version), D = !!(t.name || t.version || t.description), O = V(v);
361
+ pe(() => {
362
+ let e = () => {
363
+ t.name ? y.current?.focus() : t.version ? b.current?.focus() : t.description && x.current?.focus();
364
+ };
365
+ if (v !== void 0) {
366
+ v !== O.current && (O.current = v, e());
367
+ return;
87
368
  }
88
- };
89
- }, F = "SKILL.md", I = /* @__PURE__ */ function(e) {
369
+ D && !S.current && e(), S.current = D;
370
+ }, [
371
+ v,
372
+ D,
373
+ t.name,
374
+ t.version,
375
+ t.description
376
+ ]);
377
+ let k = /* @__PURE__ */ F(M, {
378
+ id: G,
379
+ ref: x,
380
+ value: e.description,
381
+ onChange: (e) => n({ description: e }),
382
+ "aria-required": g || void 0,
383
+ labelProps: _ ? void 0 : {
384
+ label: u.description.label,
385
+ required: g
386
+ },
387
+ placeholder: u.description.placeholder,
388
+ error: t.description || void 0,
389
+ invalid: !!t.description,
390
+ containerClassName: _ ? void 0 : d?.field,
391
+ className: r,
392
+ resize: N.Vertical
393
+ });
394
+ return /* @__PURE__ */ I("div", {
395
+ role: u.ariaLabel ? "group" : void 0,
396
+ "aria-label": u.ariaLabel,
397
+ className: c("flex flex-col gap-4", d?.root),
398
+ children: [
399
+ C(U.Avatar) && /* @__PURE__ */ F(we, {
400
+ label: u.iconUrl.label,
401
+ avatarUrl: s,
402
+ addAvatarLabel: u.iconUrl.addAvatarLabel,
403
+ captionText: u.iconUrl.captionText,
404
+ onAddAvatarClick: l,
405
+ className: d?.field
406
+ }),
407
+ (w || E) && /* @__PURE__ */ I("div", {
408
+ className: c("flex items-start gap-4", d?.field),
409
+ children: [w && /* @__PURE__ */ F(T, {
410
+ id: "deployment-creation-form-name",
411
+ inputRef: y,
412
+ value: e.name,
413
+ onChange: (e) => n({ name: e ?? "" }),
414
+ onBlur: a,
415
+ readOnly: m,
416
+ labelProps: {
417
+ label: u.name.label,
418
+ required: !0
419
+ },
420
+ placeholder: u.name.placeholder,
421
+ caption: h,
422
+ error: t.name || void 0,
423
+ invalid: !!t.name,
424
+ containerClassName: E ? "min-w-0 basis-0 grow-[2]" : "min-w-0 flex-1"
425
+ }), E && /* @__PURE__ */ F(T, {
426
+ id: "deployment-creation-form-version",
427
+ inputRef: b,
428
+ value: e.version,
429
+ onChange: (e) => n({ version: e ?? "" }),
430
+ onBlur: o,
431
+ labelProps: { label: u.version.label },
432
+ placeholder: u.version.placeholder,
433
+ error: t.version || void 0,
434
+ invalid: !!t.version,
435
+ containerClassName: w ? "min-w-0 basis-0 grow-[1]" : "min-w-0 flex-1"
436
+ })]
437
+ }),
438
+ C(U.Description) && (_ ? /* @__PURE__ */ F("div", {
439
+ className: d?.field,
440
+ children: _(k, G)
441
+ }) : k),
442
+ C(U.Locales) && /* @__PURE__ */ F(De, {
443
+ value: e.otherLocales,
444
+ onChange: (e) => n({ otherLocales: e }),
445
+ availableLocaleOptions: f,
446
+ labels: u.otherLocales,
447
+ className: d?.field
448
+ }),
449
+ C(U.Tags) && /* @__PURE__ */ F("div", {
450
+ className: d?.field,
451
+ children: /* @__PURE__ */ F(j, {
452
+ id: "deployment-creation-form-topics",
453
+ labelProps: { label: u.topics.label },
454
+ placeholder: u.topics.placeholder ?? Oe,
455
+ value: e.topics,
456
+ onChange: (e) => n({ topics: e }),
457
+ tagClassName: i
458
+ })
459
+ })
460
+ ]
461
+ });
462
+ }, Ae = "border-0 p-4 desktop:p-6", je = "desktop:flex-1", Me = "px-4 pt-4 desktop:px-6 desktop:pt-6", Ne = fe(({ title: e, onBack: t, onCancel: n, onSubmit: r, submitLabel: i, isSubmitting: a = !1, isSubmitDisabled: o = !1, extraActions: s, hideStandardActions: l = !1, metadata: u, metadataTitle: d, metadataFooter: f, setup: p, setupTitle: m, alert: h, metadataSectionClassName: g, setupSectionClassName: _, labels: v, styles: y, dir: b }) => {
463
+ let x = h == null ? null : /* @__PURE__ */ F("div", {
464
+ role: "alert",
465
+ className: Me,
466
+ children: h
467
+ }), S = p != null;
468
+ return /* @__PURE__ */ F(Se, {
469
+ title: e,
470
+ onBack: t,
471
+ backAriaLabel: v?.backAriaLabel ?? "Back",
472
+ isSaving: a,
473
+ labels: { savingStatusLabel: v?.savingStatusLabel ?? "Saving" },
474
+ styles: y?.layout,
475
+ dir: b,
476
+ actions: /* @__PURE__ */ I(P, { children: [s, !l && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(O, {
477
+ label: v?.cancelLabel ?? "Cancel",
478
+ disabled: a,
479
+ onClick: n
480
+ }), /* @__PURE__ */ F(A, {
481
+ label: i,
482
+ disabled: a || o,
483
+ onClick: r
484
+ })] })] }),
485
+ leftContent: /* @__PURE__ */ I(P, { children: [
486
+ !S && x,
487
+ /* @__PURE__ */ F(be, {
488
+ title: d === null ? void 0 : d ?? v?.metadataTitle ?? "Metadata",
489
+ styles: y?.section,
490
+ className: c(Ae, g, ve.metadataSection),
491
+ children: u
492
+ }),
493
+ f
494
+ ] }),
495
+ rightContent: S ? /* @__PURE__ */ I(P, { children: [x, /* @__PURE__ */ F(be, {
496
+ title: m ?? v?.setupTitle ?? "Setup",
497
+ styles: y?.section,
498
+ className: c(Ae, je, _, ve.setupSection),
499
+ children: p
500
+ })] }) : void 0
501
+ });
502
+ }), Pe = {
503
+ name: {
504
+ label: "Name",
505
+ placeholder: "Enter name"
506
+ },
507
+ description: {
508
+ label: "Description",
509
+ placeholder: "Enter description"
510
+ },
511
+ iconUrl: {
512
+ label: "Avatar",
513
+ addAvatarLabel: "Add avatar",
514
+ captionText: "PNG, JPG or SVG (max 1 MB)"
515
+ },
516
+ version: {
517
+ label: "Version",
518
+ placeholder: "e.g. 1.0.0"
519
+ },
520
+ topics: {
521
+ label: "Tags",
522
+ placeholder: "Add tags, comma separated"
523
+ },
524
+ otherLocales: {
525
+ summaryLabel: "Locales",
526
+ addLabel: "Add locales",
527
+ editLabel: "Edit locales",
528
+ popupTitle: "Add locale",
529
+ addLocaleLabel: "Add locale",
530
+ localeRowLabel: "Locale",
531
+ languageLabel: "Language",
532
+ nameLabel: "Name",
533
+ namePlaceholder: "Enter name",
534
+ descriptionLabel: "About",
535
+ descriptionPlaceholder: "Enter brief description",
536
+ deleteAriaLabel: "Delete locale",
537
+ cancelLabel: "Cancel",
538
+ saveLabel: "Save"
539
+ },
540
+ ariaLabel: "Metadata"
541
+ }, Fe = {
542
+ title: "Add avatar",
543
+ attachLabel: "Attach",
544
+ emptyTitle: "This folder is empty",
545
+ emptyDescription: "",
546
+ errorMessage: "Failed to load files",
547
+ retryLabel: "Retry",
548
+ hiddenFilesLabel: "Hidden files",
549
+ showHiddenFilesLabel: "Show hidden files",
550
+ hideHiddenFilesLabel: "Hide hidden files",
551
+ getSelectionLabel: (e) => e === 1 ? "item selected" : "items selected",
552
+ uploadFilesLabel: "Files",
553
+ newFolderLabel: "Folder",
554
+ downloadLabel: "Download",
555
+ downloadingLabel: "Preparing download…",
556
+ deleteLabel: "Delete",
557
+ deletingLabel: "Deleting…",
558
+ deleteConfirmTitleSingle: "Confirm deleting",
559
+ deleteConfirmTitleMultiple: "Confirm deleting items",
560
+ deleteConfirmSingleText: "Are you sure you want to delete",
561
+ deleteConfirmMultipleText: "Do you want to delete following",
562
+ deleteConfirmItemsLabel: "items?",
563
+ deleteConfirmLabel: "Delete",
564
+ deleteCancelLabel: "Cancel"
565
+ }, Ie = fe(({ values: e, errors: t, onChange: n, onNameBlur: r, onVersionBlur: i, avatarPicker: a, availableLocaleOptions: o, fields: s = Ee, isNameReadOnly: c, nameCaption: l, isDescriptionRequired: u, renderDescription: d, focusRequestKey: f, labels: p }) => {
566
+ let [m, h] = H(!1), g = B(() => a ? s : s.filter((e) => e !== U.Avatar), [a, s]), _ = e.iconUrl, v = a?.resolveIconUrl, y = B(() => v ? v(_) : void 0, [_, v]), b = z(() => h(!0), []), x = z(() => h(!1), []), S = a?.resolveAttachedIconUrl, C = z((e) => {
567
+ let t = S?.(e);
568
+ t && n({ iconUrl: t }), h(!1);
569
+ }, [n, S]);
570
+ return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(ke, {
571
+ values: e,
572
+ errors: t,
573
+ onChange: n,
574
+ onNameBlur: r,
575
+ onVersionBlur: i,
576
+ iconPreviewUrl: y,
577
+ onAddAvatarClick: b,
578
+ labels: p?.form ?? Pe,
579
+ availableLocaleOptions: o,
580
+ fields: g,
581
+ isNameReadOnly: c,
582
+ nameCaption: l,
583
+ isDescriptionRequired: u,
584
+ renderDescription: d,
585
+ focusRequestKey: f
586
+ }), a && /* @__PURE__ */ F(Te, {
587
+ isOpen: m,
588
+ onClose: x,
589
+ onAttach: C,
590
+ bucket: a.bucket,
591
+ FileManagerModal: a.FileManagerModal,
592
+ allowedMimeTypes: a.allowedMimeTypes,
593
+ maxFileSizeBytes: a.maxFileSizeBytes,
594
+ labels: p?.avatarPicker ?? Fe
595
+ })] });
596
+ }), Le = /* @__PURE__ */ function(e) {
597
+ return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e.ControlCharacters = "control-characters", e;
598
+ }({});
599
+ new Set([Le.TooLong, Le.ControlCharacters]);
600
+ //#endregion
601
+ //#region src/constants/public-class-names.ts
602
+ var Re = {
603
+ root: "dial-skill-editor-root",
604
+ refineFeedback: "dial-skill-editor-refine-feedback"
605
+ }, K = "SKILL.md", q = /* @__PURE__ */ function(e) {
90
606
  return e.File = "file", e.Folder = "folder", e;
91
- }({}), L = (e) => {
607
+ }({}), ze = /* @__PURE__ */ function(e) {
608
+ return e.Header = "header", e.Child = "child", e.Sibling = "sibling", e;
609
+ }({}), J = (e) => {
92
610
  let t = e.lastIndexOf("/");
93
611
  return t === -1 ? null : e.slice(0, t);
94
- }, R = (e) => {
612
+ }, Be = (e) => {
95
613
  let t = e.lastIndexOf("/");
96
614
  return t === -1 ? e : e.slice(t + 1);
97
- }, ue = (e) => {
615
+ }, Ve = (e) => {
98
616
  let t = /* @__PURE__ */ new Map(), n = (e) => {
99
617
  let n = t.get(e);
100
618
  if (n) return n;
101
619
  let r = {
102
620
  path: e,
103
- name: R(e),
104
- nodeType: A.FOLDER,
105
- parentPath: L(e),
621
+ name: Be(e),
622
+ nodeType: he.FOLDER,
623
+ parentPath: J(e),
106
624
  folderId: e,
107
625
  items: []
108
626
  };
109
627
  return t.set(e, r), r;
110
628
  };
111
629
  for (let r of e) {
112
- if (r.kind === I.Folder) {
113
- n(r.path);
630
+ if (r.kind === q.Folder) {
631
+ n(r.path).name = r.name;
114
632
  continue;
115
633
  }
116
634
  t.set(r.path, {
117
635
  path: r.path,
118
636
  name: r.name,
119
- nodeType: A.ITEM,
120
- parentPath: L(r.path),
121
- folderId: L(r.path) ?? ""
637
+ nodeType: he.ITEM,
638
+ parentPath: J(r.path),
639
+ folderId: J(r.path) ?? ""
122
640
  });
123
641
  }
124
642
  for (let t of [...e]) {
125
- let e = L(t.path);
126
- for (; e != null;) n(e), e = L(e);
643
+ let e = J(t.path);
644
+ for (; e != null;) n(e), e = J(e);
127
645
  }
128
646
  let r = [];
129
647
  for (let e of t.values()) {
@@ -135,462 +653,785 @@ var M = {
135
653
  n ? n.items = [...n.items ?? [], e] : r.push(e);
136
654
  }
137
655
  return r;
138
- }, de = ({ isVisible: e, labels: t }) => {
656
+ }, He = (e, t) => e ? `${e}/${t}` : t, Ue = (e) => J(e) ?? "", We = (e, t) => {
657
+ if (!t) return "";
658
+ switch (e) {
659
+ case ze.Child: return t.path;
660
+ case ze.Sibling: return Ue(t.path);
661
+ case ze.Header: return t.kind === q.Folder ? t.path : "";
662
+ }
663
+ }, Ge = (e, t) => {
664
+ let n = t ? `${t}/` : "", r = /* @__PURE__ */ new Set();
665
+ for (let { path: i } of e) {
666
+ if (!i.startsWith(n) || i === t) continue;
667
+ let e = i.slice(n.length);
668
+ r.add(e.split("/")[0]);
669
+ }
670
+ return r;
671
+ }, Ke = (e, t, n) => {
672
+ let r = e.trim();
673
+ if (!r) return n.required;
674
+ if (/[/\\]/.test(r) || r === "." || r === "..") return n.invalid;
675
+ if (t.has(r)) return n.duplicate;
676
+ }, qe = "\\new-folder", Je = ({ files: e, fileActions: t, defaultName: n, messages: r, onRevealFolder: i, onCreated: a }) => {
677
+ let [o, s] = H(null), c = o?.parentPath ?? null, l = V([]), u = c == null ? void 0 : He(c, qe), d = B(() => u == null ? void 0 : {
678
+ path: u,
679
+ name: n,
680
+ kind: q.Folder
681
+ }, [u, n]), f = z((n, i) => {
682
+ let a = Ge(e, i);
683
+ return i === "" && a.add(K), Ke(n, a, r) ?? t.validateFolderPath?.(He(i, n.trim()));
684
+ }, [
685
+ e,
686
+ r,
687
+ t
688
+ ]), p = z((e, t) => {
689
+ l.current = [], s({
690
+ parentPath: e,
691
+ pane: t
692
+ }), e !== "" && i(e);
693
+ }, [i]), m = z((e, t) => {
694
+ if (c == null || t.path !== u) return null;
695
+ let n = f(e, c);
696
+ return l.current = [...l.current.slice(-1), {
697
+ value: e,
698
+ isValid: n == null
699
+ }], n ?? null;
700
+ }, [
701
+ c,
702
+ u,
703
+ f
704
+ ]), h = z(() => {
705
+ l.current = [], s(null);
706
+ }, []), g = z((e) => {
707
+ if (c == null) return;
708
+ let [n] = l.current;
709
+ if (l.current.length === 2 && n != null && !n.isValid && n.value !== e || f(e, c) != null) {
710
+ h();
711
+ return;
712
+ }
713
+ let r = He(c, e.trim());
714
+ h(), t.onCreateFolder?.(r), a(r);
715
+ }, [
716
+ c,
717
+ f,
718
+ h,
719
+ t,
720
+ a
721
+ ]);
722
+ return {
723
+ draftNode: d,
724
+ draftPath: u,
725
+ draftPane: o?.pane,
726
+ startDraft: p,
727
+ handleValidate: m,
728
+ handleSave: g,
729
+ handleCancel: h
730
+ };
731
+ }, Ye = (e) => !!e.dataTransfer?.types.includes("Files"), Xe = (e) => {
732
+ let [t, n] = H(!1), r = V(0);
733
+ return {
734
+ isDragActive: t,
735
+ dropZoneHandlers: {
736
+ onDragEnter: z((e) => {
737
+ Ye(e) && (e.preventDefault(), r.current += 1, n(!0));
738
+ }, []),
739
+ onDragLeave: z((e) => {
740
+ Ye(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
741
+ }, []),
742
+ onDragOver: z((e) => {
743
+ Ye(e) && e.preventDefault();
744
+ }, []),
745
+ onDrop: z((t) => {
746
+ if (!Ye(t)) return;
747
+ t.preventDefault(), r.current = 0, n(!1);
748
+ let i = Array.from(t.dataTransfer?.files ?? []);
749
+ i.length > 0 && e(i);
750
+ }, [e])
751
+ }
752
+ };
753
+ }, Ze = /* @__PURE__ */ function(e) {
754
+ return e.Files = "files", e.Archive = "archive", e;
755
+ }({}), Y = /* @__PURE__ */ function(e) {
756
+ return e.Mobile = "mobile", e.Desktop = "desktop", e;
757
+ }({}), Qe = ({ isVisible: e, labels: t }) => {
139
758
  if (!e) return null;
140
759
  let n = t ?? {};
141
- return /* @__PURE__ */ v("div", {
760
+ return /* @__PURE__ */ F("div", {
142
761
  role: "status",
143
762
  "aria-live": "polite",
144
- className: i("pointer-events-none absolute inset-0 z-[100] flex items-center justify-center backdrop-blur-sm"),
145
- children: /* @__PURE__ */ y("div", {
763
+ className: c("pointer-events-none absolute inset-0 z-[100] flex items-center justify-center backdrop-blur-sm"),
764
+ children: /* @__PURE__ */ I("div", {
146
765
  className: "flex flex-col items-center text-center",
147
766
  children: [
148
- /* @__PURE__ */ v(x, {
767
+ /* @__PURE__ */ F(ue, {
149
768
  size: 100,
150
769
  className: "text-accent-primary",
151
770
  "aria-hidden": !0,
152
- stroke: l
771
+ stroke: _
153
772
  }),
154
- /* @__PURE__ */ v("span", {
773
+ /* @__PURE__ */ F("span", {
155
774
  className: "dial-h3-text mt-5",
156
775
  children: n.dropOverlayTitle ?? "Upload files"
157
776
  }),
158
- /* @__PURE__ */ v("span", {
777
+ /* @__PURE__ */ F("span", {
159
778
  className: "dial-small-text mt-4",
160
779
  children: n.dropOverlaySubtitle ?? "Drop files here to add them to this skill"
161
780
  })
162
781
  ]
163
782
  })
164
783
  });
165
- }, fe = /* @__PURE__ */ function(e) {
784
+ }, $e = /* @__PURE__ */ function(e) {
166
785
  return e.SupportingFile = "supporting-file", e.Manifest = "manifest", e;
167
- }({}), z = /* @__PURE__ */ function(e) {
786
+ }({}), et = /* @__PURE__ */ function(e) {
168
787
  return e.Valid = "valid", e.Invalid = "invalid", e;
169
- }({}), B = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), V = 0, H = () => `skill-file-candidate-${++V}`, pe = ({ isOpen: e, onClose: t, fileActions: n, initialFiles: i, labels: a }) => {
170
- let o = a ?? {}, [s, c] = k([]), [u, p] = k(/* @__PURE__ */ new Map()), [m, g] = k([]), [b, oe] = k(!1), [x, S] = k(), [C, w] = k(!1), D = E(), O = (e) => {
171
- let t = e.map((e) => ({
172
- id: H(),
173
- file: e,
174
- path: B(e)
175
- }));
176
- S(void 0), c((e) => [...e, ...t]);
177
- }, A = (e) => {
178
- c((t) => t.filter((t) => t.id !== e));
788
+ }({}), tt = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), nt = ".zip,application/zip", X = 0, rt = () => `skill-file-candidate-${++X}`, it = (e, t, n) => ({
789
+ id: rt(),
790
+ file: e,
791
+ path: He(n, t.replace(/\\/g, "/"))
792
+ }), at = ({ isOpen: e, onClose: t, fileActions: n, mode: r = Ze.Files, targetFolderPath: i = "", initialFiles: a, initialEntries: o, labels: c }) => {
793
+ let l = c ?? {}, [u, d] = H([]), [p, h] = H(/* @__PURE__ */ new Map()), [g, v] = H([]), [y, b] = H(!1), [C, T] = H(), [E, D] = H(!1), [O, A] = H(), [te, j] = H(0), M = V(0), N = r === Ze.Archive, L = l.uploadArchiveErrorMessage ?? "Couldn't read this archive", re = me(), ae = (e) => {
794
+ T(void 0), d((t) => [...t, ...e]);
795
+ }, oe = async (e) => {
796
+ let { extractArchive: t } = n;
797
+ if (!t) return;
798
+ let r = M.current;
799
+ A(void 0), j((e) => e + 1);
800
+ try {
801
+ let n = await Promise.all(e.map((e) => t(e)));
802
+ if (r !== M.current) return;
803
+ let a = n.flat();
804
+ if (a.length === 0) {
805
+ A(l.uploadArchiveEmptyMessage ?? "This archive has no files");
806
+ return;
807
+ }
808
+ ae(a.map((e) => it(e.file, e.path, i)));
809
+ } catch {
810
+ if (r !== M.current) return;
811
+ A(L);
812
+ } finally {
813
+ r === M.current && j((e) => e - 1);
814
+ }
815
+ }, se = (e) => {
816
+ if (N) {
817
+ oe(e);
818
+ return;
819
+ }
820
+ ae(e.map((e) => it(e, tt(e), i)));
821
+ }, ce = (e) => {
822
+ d((t) => t.filter((t) => t.id !== e));
179
823
  };
180
- T(() => {
181
- e && (c((i ?? []).map((e) => ({
182
- id: H(),
183
- file: e,
184
- path: B(e)
185
- }))), p(/* @__PURE__ */ new Map()), g([]), S(void 0));
186
- }, [e]), T(() => {
824
+ pe(() => {
825
+ e && (M.current += 1, d([...(a ?? []).map((e) => it(e, tt(e), i)), ...(o ?? []).map((e) => it(e.file, e.path, i))]), h(/* @__PURE__ */ new Map()), v([]), T(void 0), A(void 0), j(0));
826
+ }, [e]), pe(() => {
187
827
  if (!e) return;
188
828
  let t = !1;
189
- if (s.length === 0) {
190
- p(/* @__PURE__ */ new Map()), g([]);
829
+ if (u.length === 0) {
830
+ h(/* @__PURE__ */ new Map()), v([]);
191
831
  return;
192
832
  }
193
- return oe(!0), n.validateBatch(s).then(({ results: e, batchErrors: n }) => {
194
- t || (p(new Map(e.map((e) => [e.candidateId, e]))), g(n.map((e) => e.message)));
833
+ return b(!0), n.validateBatch(u).then(({ results: e, batchErrors: n }) => {
834
+ t || (h(new Map(e.map((e) => [e.candidateId, e]))), v(n.map((e) => e.message)));
195
835
  }).finally(() => {
196
- t || oe(!1);
836
+ t || b(!1);
197
837
  }), () => {
198
838
  t = !0;
199
839
  };
200
- }, [s, e]);
201
- let ce = s.some((e) => u.get(e.id)?.status === z.Invalid), j = s.length > 0 && s.every((e) => u.get(e.id)?.status === z.Invalid), M = s.length > 0 && !ce && m.length === 0 && !b && !C, N = async () => {
202
- w(!0), S(void 0);
840
+ }, [u, e]);
841
+ let ue = u.some((e) => p.get(e.id)?.status === et.Invalid), de = u.length > 0 && u.every((e) => p.get(e.id)?.status === et.Invalid), R = u.length > 0 && !ue && g.length === 0 && !y && !E && te === 0, fe = async () => {
842
+ D(!0), T(void 0);
203
843
  try {
204
- let { results: e, batchErrors: r } = await n.validateBatch(s), i = new Map(e.map((e) => [e.candidateId, e]));
205
- if (p(i), g(r.map((e) => e.message)), s.some((e) => i.get(e.id)?.status === z.Invalid) || r.length > 0) return;
206
- let a = await n.commitBatch(s);
844
+ let { results: e, batchErrors: r } = await n.validateBatch(u), i = new Map(e.map((e) => [e.candidateId, e]));
845
+ if (h(i), v(r.map((e) => e.message)), u.some((e) => i.get(e.id)?.status === et.Invalid) || r.length > 0) return;
846
+ let a = await n.commitBatch(u);
207
847
  if (a.error) {
208
- S(a.error);
848
+ T(a.error);
209
849
  return;
210
850
  }
211
851
  t();
212
852
  } finally {
213
- w(!1);
853
+ D(!1);
214
854
  }
215
855
  };
216
- return /* @__PURE__ */ v(ne, {
856
+ return /* @__PURE__ */ F(k, {
217
857
  open: e,
218
- header: o.uploadDialogTitle ?? "Upload files from device",
219
- size: re.Sm,
220
- closeAriaLabel: o.uploadDialogCloseAriaLabel ?? "Close",
858
+ header: N ? l.uploadArchiveDialogTitle ?? "Upload archive from device" : l.uploadDialogTitle ?? "Upload files from device",
859
+ size: ee.Sm,
860
+ closeAriaLabel: l.uploadDialogCloseAriaLabel ?? "Close",
221
861
  onClose: t,
222
- footer: /* @__PURE__ */ y("div", {
223
- className: "flex min-h-[44px] items-center justify-end gap-2 px-6 py-4",
224
- children: [/* @__PURE__ */ v(ee, {
225
- label: o.uploadCancelLabel ?? "Cancel",
226
- onClick: t
227
- }), /* @__PURE__ */ v(ie, {
228
- label: o.uploadConfirmLabel ?? "Add",
229
- iconBefore: C ? /* @__PURE__ */ v(h, {
230
- size: 16,
231
- ariaLabel: ""
232
- }) : void 0,
233
- onClick: () => void N(),
234
- disabled: !M
235
- })]
236
- }),
237
- children: /* @__PURE__ */ y("div", {
862
+ mainButtons: [{
863
+ label: l.uploadCancelLabel ?? "Cancel",
864
+ variant: m.Primary,
865
+ appearance: f.Ghost,
866
+ onClick: t
867
+ }, {
868
+ label: l.uploadConfirmLabel ?? "Add",
869
+ variant: m.Primary,
870
+ iconBefore: E ? /* @__PURE__ */ F(ne, {
871
+ size: 16,
872
+ ariaLabel: ""
873
+ }) : void 0,
874
+ onClick: () => void fe(),
875
+ disabled: !R
876
+ }],
877
+ children: /* @__PURE__ */ I("div", {
238
878
  className: "flex flex-col gap-4 px-6 py-4",
239
879
  children: [
240
- /* @__PURE__ */ v(f, {
241
- label: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("span", {
880
+ /* @__PURE__ */ F(S, {
881
+ label: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("span", {
242
882
  className: "desktop:hidden",
243
- children: o.uploadDropZoneMobileLabel ?? "Click here to upload"
244
- }), /* @__PURE__ */ v("span", {
883
+ children: N ? l.uploadArchiveDropZoneMobileLabel ?? "Click here to upload a .zip archive" : l.uploadDropZoneMobileLabel ?? "Click here to upload"
884
+ }), /* @__PURE__ */ F("span", {
245
885
  className: "hidden desktop:inline",
246
- children: o.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
886
+ children: N ? l.uploadArchiveDropZoneLabel ?? "Drag and drop a .zip archive or click here to upload" : l.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
247
887
  })] }),
248
- ariaLabel: o.uploadDropZoneAriaLabel ?? "Upload files",
888
+ ariaLabel: l.uploadDropZoneAriaLabel ?? "Upload files",
249
889
  multiple: !0,
250
- className: j ? "border-error hover:border-error" : void 0,
251
- onChange: O
890
+ accept: N ? nt : void 0,
891
+ className: de ? "border-error hover:border-error" : void 0,
892
+ onChange: se,
893
+ onReject: N ? () => A(L) : void 0
252
894
  }),
253
- /* @__PURE__ */ v("span", {
895
+ te > 0 && /* @__PURE__ */ F(ne, { ariaLabel: l.uploadArchiveExtractingAriaLabel ?? "Reading archive" }),
896
+ /* @__PURE__ */ F("div", {
897
+ role: "alert",
898
+ children: O && /* @__PURE__ */ F(x, { text: O })
899
+ }),
900
+ /* @__PURE__ */ F("span", {
254
901
  role: "status",
255
902
  "aria-live": "polite",
256
903
  className: "sr-only",
257
- id: D,
258
- children: m.map((e) => `${o.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
904
+ id: re,
905
+ children: g.map((e) => `${l.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
259
906
  }),
260
- m.map((e) => /* @__PURE__ */ v(d, { text: e }, e)),
261
- s.length > 0 && /* @__PURE__ */ v("ul", {
907
+ g.map((e) => /* @__PURE__ */ F(x, { text: e }, e)),
908
+ u.length > 0 && /* @__PURE__ */ F("ul", {
262
909
  className: "flex flex-col gap-2",
263
- children: s.map((e) => {
264
- let t = u.get(e.id), n = t?.kind === fe.Manifest, i = t?.status === z.Invalid;
265
- return /* @__PURE__ */ y("li", {
910
+ children: u.map((e) => {
911
+ let t = p.get(e.id), n = t?.kind === $e.Manifest, r = t?.status === et.Invalid;
912
+ return /* @__PURE__ */ I("li", {
266
913
  className: "flex items-center gap-2 rounded-lg border border-tertiary p-2",
267
914
  children: [
268
- /* @__PURE__ */ v(ae, {
915
+ /* @__PURE__ */ F(ie, {
269
916
  size: 20,
270
917
  "aria-hidden": !0,
271
- stroke: l
918
+ stroke: _
272
919
  }),
273
- /* @__PURE__ */ y("div", {
920
+ /* @__PURE__ */ I("div", {
274
921
  className: "flex min-w-0 flex-1 flex-col",
275
922
  children: [
276
- /* @__PURE__ */ v("span", {
923
+ /* @__PURE__ */ F("span", {
277
924
  className: "dial-small-text truncate",
278
925
  children: e.path
279
926
  }),
280
- /* @__PURE__ */ v("span", {
927
+ /* @__PURE__ */ F("span", {
281
928
  className: "dial-tiny-text text-secondary",
282
- children: r(e.file.size)
929
+ children: s(e.file.size)
283
930
  }),
284
- i && t?.error && /* @__PURE__ */ v(d, { text: t.error }),
285
- n && !i && /* @__PURE__ */ v("span", {
931
+ r && t?.error && /* @__PURE__ */ F(x, { text: t.error }),
932
+ n && !r && /* @__PURE__ */ F("span", {
286
933
  className: "dial-tiny-text text-secondary",
287
- children: o.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
934
+ children: l.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
288
935
  })
289
936
  ]
290
937
  }),
291
- /* @__PURE__ */ v(te, {
292
- icon: /* @__PURE__ */ v(se, {
938
+ /* @__PURE__ */ F(w, {
939
+ icon: /* @__PURE__ */ F(le, {
293
940
  size: 16,
294
941
  "aria-hidden": !0,
295
- stroke: l
942
+ stroke: _
296
943
  }),
297
- "aria-label": o.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
298
- onClick: () => A(e.id)
944
+ "aria-label": l.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
945
+ onClick: () => ce(e.id)
299
946
  })
300
947
  ]
301
948
  }, e.id);
302
949
  })
303
950
  }),
304
- x && /* @__PURE__ */ v(d, { text: x })
951
+ C && /* @__PURE__ */ F(x, { text: C })
305
952
  ]
306
953
  })
307
954
  });
308
- }, U = {
309
- title: "_title_65glc_1",
310
- helperText: "_helperText_65glc_5"
311
- }, me = C(async () => {
312
- let { MarkdownEditor: e } = await j();
955
+ }, ot = {
956
+ title: "_title_1cnn4_1",
957
+ helperText: "_helperText_1cnn4_5",
958
+ refineFeedback: "_refineFeedback_1cnn4_9",
959
+ refineError: "_refineError_1cnn4_13"
960
+ }, st = {
961
+ mode: Ze.Files,
962
+ targetFolderPath: ""
963
+ }, ct = [U.Name, U.Description], lt = 24, ut = 300, dt = "desktop:px-8 desktop:py-6", ft = "gap-4 px-4 py-6 desktop:gap-5 desktop:px-8 desktop:py-6", pt = R(async () => {
964
+ let { MarkdownEditor: e } = await _e();
313
965
  return { default: e };
314
- }), W = ({ initialValues: r, files: f, selectedPath: te, onSelectedPathChange: ne, expandedPaths: re, onExpandedPathsChange: b, isLoading: ae = !1, hasLoadError: x = !1, isSubmitting: C = !1, errors: E, submitError: A, conflict: j, onReloadLatest: M, isNameReadOnly: P = !1, onDirtyChange: L, fileActions: R, supportingFileContent: fe, onSubmit: z, onCancel: B, onBack: V, backAriaLabel: H, title: W, onRetry: he, labels: ge, styles: _e, dir: ve, instructionsEditorTheme: ye = u.light }) => {
315
- let [G, K] = k({
966
+ }), mt = ({ initialValues: r, files: i, selectedPath: s, onSelectedPathChange: v, expandedPaths: S, onExpandedPathsChange: w, isLoading: T = !1, hasLoadError: D = !1, isSubmitting: O = !1, errors: k, submitError: ee, conflict: te, onReloadLatest: j, isNameReadOnly: M = !1, onDirtyChange: N, onValuesChange: L, onRefineDescription: ie, onRefineInstructions: se, fileActions: R, supportingFileContent: fe, onSubmit: _e, onCancel: ve, onBack: ye, backAriaLabel: be, title: xe, onRetry: Se, onRetrySubmit: Ce, labels: we, styles: Te, dir: U, instructionsEditorTheme: Ee = y.light }) => {
967
+ let [W, De] = H({
316
968
  name: r?.name ?? "",
317
969
  description: r?.description ?? "",
318
970
  instructions: r?.instructions ?? ""
319
- }), be = a(), xe = O(r), Se = xe.current !== r, Ce = O(f);
320
- T(() => {
321
- xe.current = r, K({
971
+ }), Oe = me(), G = V(void 0), ke = l({
972
+ bottomGap: lt,
973
+ minHeight: ut
974
+ }), Ae = V(W), je = (e) => {
975
+ let t = {
976
+ ...Ae.current,
977
+ ...e
978
+ };
979
+ Ae.current = t, De(t), L?.(t);
980
+ }, Me = (e) => e ? async (t, n) => {
981
+ if (G.current && !G.current.aborted) throw new DOMException("Busy", "AbortError");
982
+ G.current = n;
983
+ try {
984
+ return await e(t, n);
985
+ } finally {
986
+ G.current === n && (G.current = void 0);
987
+ }
988
+ } : void 0, Fe = u({
989
+ value: W.description,
990
+ onChange: (e) => je({ description: e }),
991
+ onRefine: Me(ie),
992
+ disabled: O || T || D,
993
+ resetKey: r
994
+ }), Le = u({
995
+ value: W.instructions,
996
+ onChange: (e) => je({ instructions: e }),
997
+ onRefine: Me(se),
998
+ disabled: O || T || D,
999
+ resetKey: r
1000
+ }), J = Fe.isPending || Le.isPending, Be = () => {
1001
+ Fe.reset(), Le.reset();
1002
+ }, He = () => {
1003
+ Be(), ve();
1004
+ }, Ue = () => {
1005
+ Be(), ye();
1006
+ }, Ge = () => {
1007
+ O || T || D || G.current && !G.current.aborted || _e(W);
1008
+ }, Ke = V(r), qe = Ke.current !== r, Ye = V(i);
1009
+ pe(() => {
1010
+ Ke.current = r;
1011
+ let e = {
322
1012
  name: r?.name ?? "",
323
1013
  description: r?.description ?? "",
324
1014
  instructions: r?.instructions ?? ""
325
- }), Ce.current = f;
1015
+ };
1016
+ Ae.current = e, De(e), Ye.current = i;
326
1017
  }, [r]);
327
- let we = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), Te = O(!1);
328
- T(() => {
329
- if (Se) return;
1018
+ let $e = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), et = V(!1);
1019
+ pe(() => {
1020
+ if (qe) return;
330
1021
  let e = {
331
1022
  name: r?.name ?? "",
332
1023
  description: r?.description ?? "",
333
1024
  instructions: r?.instructions ?? ""
334
- }, t = JSON.stringify(G) !== JSON.stringify(e) || we(f) !== we(Ce.current);
335
- t !== Te.current && (Te.current = t, L?.(t));
1025
+ }, t = JSON.stringify(W) !== JSON.stringify(e) || $e(i) !== $e(Ye.current);
1026
+ t !== et.current && (et.current = t, N?.(t));
336
1027
  }, [
337
- G,
338
- f,
1028
+ W,
1029
+ i,
339
1030
  r,
340
- Se,
341
- L
1031
+ qe,
1032
+ N
342
1033
  ]);
343
- let [Ee, De] = k(F), q = te ?? Ee, J = w((e) => {
344
- De(e), ne?.(e);
345
- }, [ne]), [Oe, ke] = k([]), Ae = re ?? Oe, je = D(() => new Set(Ae), [Ae]), Me = w((e) => {
1034
+ let [tt, nt] = H(K), X = s ?? tt, rt = z((e) => {
1035
+ nt(e), v?.(e);
1036
+ }, [v]), [it, mt] = H([]), ht = S ?? it, gt = B(() => new Set(ht), [ht]), _t = z((e) => {
346
1037
  let t = [...e];
347
- ke(t), b?.(t);
348
- }, [b]), [Y, Ne] = k(!1), [Pe, Fe] = k(), [Ie, Le] = k(!1), { isDragActive: Re, dropZoneHandlers: ze } = le(w((e) => {
349
- Y || (Fe(e), Ne(!0));
350
- }, [Y])), X = ge ?? {}, Z = _e?.colors, Q = _e?.typography ?? {}, Be = Q.titleClassName ?? "dial-body-semi-text", Ve = Q.helperTextClassName ?? "dial-tiny-semi-text", He = Q.removeIconClassName ?? "text-secondary", Ue = n({
351
- "--se-title-color": Z?.title,
352
- "--se-helper-text-color": Z?.helperText
353
- }), We = Z?.border ? { colors: {
354
- headerBorderColor: Z.border,
355
- sidebarBorderColor: Z.border
356
- } } : void 0, Ge = D(() => ue([{
357
- path: F,
358
- name: F,
359
- kind: I.File
360
- }, ...f]), [f]), $ = D(() => f.find((e) => e.path === q), [f, q]), Ke = w((e) => {
361
- J(e.path);
362
- }, [J]), qe = w((e) => {
363
- R.onRemoveNode(e), q === e && J(F);
1038
+ mt(t), w?.(t);
1039
+ }, [w]), [vt, yt] = H(!1), [bt, xt] = H(st), Z = z((e) => {
1040
+ xt(e), yt(!0);
1041
+ }, []), [St, Ct] = H(!1), { isDragActive: wt, dropZoneHandlers: Tt } = Xe(z((e) => {
1042
+ vt || Z({
1043
+ ...st,
1044
+ initialFiles: e
1045
+ });
1046
+ }, [vt, Z])), Q = we ?? {}, $ = Te?.colors, Et = Te?.typography ?? {}, Dt = Et.titleClassName ?? "dial-body-semi-text", Ot = Et.helperTextClassName ?? "dial-tiny-semi-text", kt = Et.removeIconClassName ?? "text-secondary", At = Et.menuIconClassName ?? "text-secondary", jt = o({
1047
+ "--se-title-color": $?.title,
1048
+ "--se-helper-text-color": $?.helperText,
1049
+ "--se-refine-action-text": $?.refineActionText,
1050
+ "--se-refine-error-text": $?.refineErrorText
1051
+ }), Mt = {
1052
+ feedbackClassName: c(ot.refineFeedback, Et.refineFeedbackClassName ?? "dial-small-text", Re.refineFeedback),
1053
+ errorClassName: ot.refineError
1054
+ }, Nt = {
1055
+ layout: $?.border ? { colors: {
1056
+ headerBorderColor: $.border,
1057
+ sidebarBorderColor: $.border
1058
+ } } : void 0,
1059
+ section: $?.title ? { colors: { titleColor: $.title } } : void 0
1060
+ }, Pt = B(() => ({
1061
+ required: Q.folderNameRequiredError ?? "Enter a folder name",
1062
+ invalid: Q.folderNameInvalidError ?? "Folder name can't contain / or \\, or be . or ..",
1063
+ duplicate: Q.folderNameDuplicateError ?? "An item with this name already exists here"
1064
+ }), [
1065
+ Q.folderNameRequiredError,
1066
+ Q.folderNameInvalidError,
1067
+ Q.folderNameDuplicateError
1068
+ ]), Ft = z((e) => {
1069
+ gt.has(e) || _t(new Set([...gt, e]));
1070
+ }, [gt, _t]), It = Je({
1071
+ files: i,
1072
+ fileActions: R,
1073
+ defaultName: Q.newFolderDefaultName ?? "New folder",
1074
+ messages: Pt,
1075
+ onRevealFolder: Ft,
1076
+ onCreated: rt
1077
+ }), { draftNode: Lt, draftPath: Rt, draftPane: zt } = It, Bt = B(() => Ve([{
1078
+ path: K,
1079
+ name: K,
1080
+ kind: q.File
1081
+ }, ...i]), [i]), Vt = B(() => Lt ? Ve([
1082
+ {
1083
+ path: K,
1084
+ name: K,
1085
+ kind: q.File
1086
+ },
1087
+ ...i,
1088
+ Lt
1089
+ ]) : Bt, [
1090
+ i,
1091
+ Lt,
1092
+ Bt
1093
+ ]), Ht = B(() => i.find((e) => e.path === X), [i, X]), Ut = z((e) => {
1094
+ e.path !== Rt && rt(e.path);
1095
+ }, [rt, Rt]), Wt = z((e) => {
1096
+ R.onRemoveNode(e), X === e && rt(K);
364
1097
  }, [
365
1098
  R,
366
- q,
367
- J
368
- ]), Je = w((e) => e.path === "SKILL.md" ? [] : [{
369
- key: "remove",
370
- label: X.removeLabel ?? "Remove",
371
- icon: /* @__PURE__ */ v(se, {
372
- size: c.SM,
373
- className: He,
1099
+ X,
1100
+ rt
1101
+ ]), { startDraft: Gt } = It, { onCreateFolder: Kt, extractArchive: qt, pickFromFileSystem: Jt } = R, Yt = z(async (e) => {
1102
+ if (!Jt) return;
1103
+ let t = await Jt();
1104
+ t?.length && Z({
1105
+ mode: Ze.Files,
1106
+ targetFolderPath: e,
1107
+ initialEntries: t
1108
+ });
1109
+ }, [Jt, Z]), Xt = z((e, t) => {
1110
+ let n = (e) => /* @__PURE__ */ F(e, {
1111
+ size: g.SM,
1112
+ className: At,
374
1113
  "aria-hidden": !0,
375
- stroke: l
376
- }),
377
- onClick: () => qe(e.path)
378
- }], [
379
- X.removeLabel,
380
- He,
381
- qe
382
- ]), Ye = /* @__PURE__ */ y("div", {
1114
+ stroke: _
1115
+ }), r = [];
1116
+ return Kt && r.push({
1117
+ key: "create-folder",
1118
+ label: Q.createFolderLabel ?? "Create folder",
1119
+ icon: n(oe),
1120
+ onClick: () => Gt(e, t)
1121
+ }), r.push({
1122
+ key: "upload-files",
1123
+ label: Q.uploadFilesLabel ?? Q.addUploadLabel ?? "Upload files from device",
1124
+ icon: n(ue),
1125
+ onClick: () => Z({
1126
+ mode: Ze.Files,
1127
+ targetFolderPath: e
1128
+ })
1129
+ }), qt && r.push({
1130
+ key: "upload-archive",
1131
+ label: Q.uploadArchiveLabel ?? "Upload archive from device",
1132
+ icon: n(ae),
1133
+ onClick: () => Z({
1134
+ mode: Ze.Archive,
1135
+ targetFolderPath: e
1136
+ })
1137
+ }), Jt && r.push({
1138
+ key: "open-file-system",
1139
+ label: Q.openFileSystemLabel ?? "Open DIAL file system",
1140
+ icon: n(re),
1141
+ onClick: () => void Yt(e)
1142
+ }), r;
1143
+ }, [
1144
+ At,
1145
+ Kt,
1146
+ qt,
1147
+ Jt,
1148
+ Q.createFolderLabel,
1149
+ Q.uploadFilesLabel,
1150
+ Q.addUploadLabel,
1151
+ Q.uploadArchiveLabel,
1152
+ Q.openFileSystemLabel,
1153
+ Gt,
1154
+ Z,
1155
+ Yt
1156
+ ]), Zt = B(() => {
1157
+ let e = We(ze.Header, i.find((e) => e.path === X));
1158
+ return {
1159
+ [Y.Mobile]: Xt(e, Y.Mobile),
1160
+ [Y.Desktop]: Xt(e, Y.Desktop)
1161
+ };
1162
+ }, [
1163
+ Xt,
1164
+ i,
1165
+ X
1166
+ ]), Qt = z((e, t) => {
1167
+ if (e.path === "SKILL.md" || e.path === Rt) return [];
1168
+ let n = {
1169
+ path: e.path,
1170
+ name: e.name,
1171
+ kind: e.nodeType === he.FOLDER ? q.Folder : q.File
1172
+ }, r = [];
1173
+ return n.kind === q.Folder && r.push({
1174
+ key: "add-child",
1175
+ label: Q.addChildLabel ?? "Add child",
1176
+ children: Xt(We(ze.Child, n), t)
1177
+ }), r.push({
1178
+ key: "add-sibling",
1179
+ label: Q.addSiblingLabel ?? "Add sibling",
1180
+ children: Xt(We(ze.Sibling, n), t)
1181
+ }, {
1182
+ key: "delete",
1183
+ label: Q.deleteLabel ?? Q.removeLabel ?? "Delete",
1184
+ icon: /* @__PURE__ */ F(le, {
1185
+ size: g.SM,
1186
+ className: kt,
1187
+ "aria-hidden": !0,
1188
+ stroke: _
1189
+ }),
1190
+ onClick: () => Wt(e.path)
1191
+ }), r;
1192
+ }, [
1193
+ Rt,
1194
+ Q.addChildLabel,
1195
+ Q.addSiblingLabel,
1196
+ Q.deleteLabel,
1197
+ Q.removeLabel,
1198
+ kt,
1199
+ Xt,
1200
+ Wt
1201
+ ]), $t = B(() => ({
1202
+ [Y.Mobile]: (e) => Qt(e, Y.Mobile),
1203
+ [Y.Desktop]: (e) => Qt(e, Y.Desktop)
1204
+ }), [Qt]), en = (e) => /* @__PURE__ */ I("div", {
383
1205
  className: "flex flex-col gap-2 desktop:gap-5",
384
- children: [/* @__PURE__ */ y("div", {
1206
+ children: [/* @__PURE__ */ I("div", {
385
1207
  className: "flex items-center justify-between",
386
- children: [/* @__PURE__ */ v("span", {
387
- className: i(U.title, Be),
388
- children: X.filesHeading ?? "Files"
389
- }), /* @__PURE__ */ v(m, {
390
- label: X.addUploadLabel ?? "Upload from device",
391
- iconBefore: /* @__PURE__ */ v(oe, {
392
- size: 16,
1208
+ children: [/* @__PURE__ */ F("span", {
1209
+ className: c(ot.title, Dt),
1210
+ children: Q.filesHeading ?? "Files"
1211
+ }), /* @__PURE__ */ F(p, {
1212
+ label: Q.addLabel ?? "Add",
1213
+ variant: m.Neutral,
1214
+ appearance: f.Solid,
1215
+ size: b.Small,
1216
+ iconBefore: /* @__PURE__ */ F(ce, {
1217
+ size: g.SM,
393
1218
  "aria-hidden": !0,
394
- stroke: l
1219
+ stroke: _
395
1220
  }),
396
- onClick: () => {
397
- Fe(void 0), Ne(!0);
398
- }
1221
+ items: Zt[e]
399
1222
  })]
400
- }), /* @__PURE__ */ v("div", {
1223
+ }), /* @__PURE__ */ F("div", {
401
1224
  role: "tree",
402
- "aria-label": X.filesTreeAriaLabel ?? "Skill files",
403
- children: /* @__PURE__ */ v(ce, {
404
- items: Ge,
1225
+ "aria-label": Q.filesTreeAriaLabel ?? "Skill files",
1226
+ children: /* @__PURE__ */ F(ge, {
1227
+ items: zt === e ? Vt : Bt,
405
1228
  showFiles: !0,
406
- selectedPath: q,
407
- expandedPaths: je,
408
- onExpandedPathsChange: Me,
409
- onItemClick: Ke,
410
- getContextMenuItems: Je,
1229
+ selectedPath: X,
1230
+ expandedPaths: gt,
1231
+ onExpandedPathsChange: _t,
1232
+ onItemClick: Ut,
1233
+ getContextMenuItems: $t[e],
1234
+ renamedPath: zt === e ? Rt : void 0,
1235
+ onRenameSave: It.handleSave,
1236
+ onRenameCancel: It.handleCancel,
1237
+ onRenameValidate: It.handleValidate,
411
1238
  rootItemPath: ""
412
1239
  })
413
1240
  })]
414
- }), Xe = /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(m, {
415
- label: X.cancelLabel ?? "Cancel",
416
- onClick: B,
417
- disabled: C
418
- }), /* @__PURE__ */ v(ie, {
419
- label: X.createLabel ?? "Create",
420
- iconBefore: C ? /* @__PURE__ */ v(h, {
421
- size: 16,
422
- ariaLabel: ""
423
- }) : void 0,
424
- onClick: () => z(G),
425
- disabled: C
426
- })] });
427
- return ae ? /* @__PURE__ */ v("div", {
428
- dir: ve,
1241
+ }), tn = B(() => ({
1242
+ name: W.name,
1243
+ description: W.description,
1244
+ iconUrl: "",
1245
+ version: "",
1246
+ topics: [],
1247
+ otherLocales: []
1248
+ }), [W.name, W.description]), nn = B(() => ({
1249
+ name: k?.name,
1250
+ description: k?.description
1251
+ }), [k?.name, k?.description]), rn = B(() => ({ form: {
1252
+ ...Pe,
1253
+ name: {
1254
+ label: Q.nameLabel ?? "Name",
1255
+ placeholder: Q.namePlaceholder ?? "good-morning-breakfast"
1256
+ },
1257
+ description: {
1258
+ label: Q.descriptionLabel ?? "Description",
1259
+ placeholder: Q.descriptionPlaceholder ?? "What this skill does and when to use it"
1260
+ },
1261
+ ariaLabel: void 0
1262
+ } }), [
1263
+ Q.nameLabel,
1264
+ Q.namePlaceholder,
1265
+ Q.descriptionLabel,
1266
+ Q.descriptionPlaceholder
1267
+ ]), an = (e) => {
1268
+ e.name !== void 0 && je({ name: e.name }), e.description !== void 0 && (Fe.reset(), je({ description: e.description }));
1269
+ }, on = ie ? (e, t) => /* @__PURE__ */ F(a, {
1270
+ isEnabled: !0,
1271
+ fieldId: t,
1272
+ required: !0,
1273
+ label: Q.descriptionLabel ?? "Description",
1274
+ labels: Q,
1275
+ refinement: Fe,
1276
+ disabled: J || O,
1277
+ ...Mt,
1278
+ children: e
1279
+ }) : void 0, sn = {
1280
+ title: xe,
1281
+ onBack: Ue,
1282
+ onCancel: He,
1283
+ onSubmit: Ge,
1284
+ submitLabel: Q.createLabel ?? "Create",
1285
+ isSubmitDisabled: J || T || D,
1286
+ labels: {
1287
+ cancelLabel: Q.cancelLabel ?? "Cancel",
1288
+ backAriaLabel: be ?? "Back",
1289
+ savingStatusLabel: Q.savingStatusLabel ?? "Saving"
1290
+ },
1291
+ styles: Nt,
1292
+ metadataTitle: null
1293
+ };
1294
+ if (T) return /* @__PURE__ */ F("div", {
1295
+ dir: U,
429
1296
  className: "relative flex min-h-0 flex-1 flex-col",
430
- children: /* @__PURE__ */ v(N, {
431
- title: W,
432
- onBack: V,
433
- backAriaLabel: H,
434
- actions: Xe,
435
- isSaving: !1,
436
- labels: { savingStatusLabel: X.savingStatusLabel },
437
- styles: We,
438
- leftContent: /* @__PURE__ */ v("div", {
1297
+ children: /* @__PURE__ */ F(Ne, {
1298
+ ...sn,
1299
+ metadata: /* @__PURE__ */ F("div", {
439
1300
  role: "status",
440
- "aria-label": X.loadingAriaLabel ?? "Loading skill",
1301
+ "aria-label": Q.loadingAriaLabel ?? "Loading skill",
441
1302
  className: "flex flex-1 items-center justify-center p-8",
442
- children: /* @__PURE__ */ v(h, {})
1303
+ children: /* @__PURE__ */ F(ne, {})
443
1304
  })
444
1305
  })
445
- }) : x ? /* @__PURE__ */ v("div", {
446
- dir: ve,
1306
+ });
1307
+ if (D) return /* @__PURE__ */ F("div", {
1308
+ dir: U,
447
1309
  className: "relative flex min-h-0 flex-1 flex-col",
448
- children: /* @__PURE__ */ v(N, {
449
- title: W,
450
- onBack: V,
451
- backAriaLabel: H,
452
- actions: Xe,
453
- isSaving: !1,
454
- labels: { savingStatusLabel: X.savingStatusLabel },
455
- styles: We,
456
- leftContent: /* @__PURE__ */ y("div", {
1310
+ children: /* @__PURE__ */ F(Ne, {
1311
+ ...sn,
1312
+ metadata: /* @__PURE__ */ I("div", {
457
1313
  role: "alert",
458
1314
  className: "flex flex-col items-center gap-4 p-8",
459
- children: [/* @__PURE__ */ v(d, { text: X.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ v(ie, {
460
- label: X.retryLabel ?? "Retry",
461
- onClick: he
1315
+ children: [/* @__PURE__ */ F(x, { text: Q.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ F(A, {
1316
+ label: Q.retryLabel ?? "Retry",
1317
+ onClick: Se
462
1318
  })]
463
1319
  })
464
1320
  })
465
- }) : /* @__PURE__ */ y("div", {
466
- dir: ve,
467
- className: "relative flex min-h-0 flex-1 flex-col",
468
- style: Ue,
469
- ...ze,
1321
+ });
1322
+ let cn = X === K, ln = cn ? K : Q.selectedFileHeading?.(Ht?.name ?? X) ?? Ht?.name ?? X, un = ee != null || te != null ? /* @__PURE__ */ I("div", {
1323
+ className: "flex flex-col gap-2",
1324
+ children: [ee != null && /* @__PURE__ */ I("div", {
1325
+ className: "flex items-center gap-2",
1326
+ children: [/* @__PURE__ */ F(x, { text: ee }), Ce != null && /* @__PURE__ */ F(C, {
1327
+ label: Q.retryLabel ?? "Retry",
1328
+ onClick: Ce
1329
+ })]
1330
+ }), te != null && /* @__PURE__ */ I("div", {
1331
+ className: "flex items-center gap-2",
1332
+ children: [/* @__PURE__ */ F(x, { text: te.message }), /* @__PURE__ */ F(C, {
1333
+ label: Q.reloadLatestLabel ?? "Reload latest",
1334
+ onClick: j
1335
+ })]
1336
+ })]
1337
+ }) : void 0, dn = /* @__PURE__ */ F(a, {
1338
+ isEnabled: !!se,
1339
+ fieldId: Oe,
1340
+ required: !0,
1341
+ labelClassName: c(ot.helperText, Ot),
1342
+ label: Q.instructionsLabel ?? "Instructions",
1343
+ labels: Q,
1344
+ refinement: Le,
1345
+ disabled: J || O,
1346
+ ...Mt,
1347
+ children: /* @__PURE__ */ I("div", {
1348
+ className: "flex flex-1 flex-col gap-2",
1349
+ children: [
1350
+ !se && /* @__PURE__ */ F(E, {
1351
+ htmlFor: Oe,
1352
+ className: c(ot.helperText, Ot),
1353
+ label: Q.instructionsLabel ?? "Instructions",
1354
+ required: !0
1355
+ }),
1356
+ /* @__PURE__ */ F("div", {
1357
+ ref: ke,
1358
+ className: c(t, e, n),
1359
+ children: /* @__PURE__ */ F(de, {
1360
+ fallback: /* @__PURE__ */ F(ne, { ariaLabel: Q.instructionsLoadingAriaLabel ?? "Loading" }),
1361
+ children: /* @__PURE__ */ F(pt, {
1362
+ id: Oe,
1363
+ ariaLabel: Q.instructionsLabel ?? "Instructions",
1364
+ value: W.instructions,
1365
+ onChange: (e) => {
1366
+ Le.reset(), je({ instructions: e });
1367
+ },
1368
+ theme: Ee,
1369
+ placeholder: Q.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
1370
+ })
1371
+ })
1372
+ }),
1373
+ k?.instructions != null && /* @__PURE__ */ F(x, { text: k.instructions })
1374
+ ]
1375
+ })
1376
+ });
1377
+ return /* @__PURE__ */ I("div", {
1378
+ dir: U,
1379
+ className: c("relative flex min-h-0 flex-1 flex-col", Re.root),
1380
+ style: jt,
1381
+ ...Tt,
470
1382
  children: [
471
- /* @__PURE__ */ v(de, {
472
- isVisible: Re && !Y,
473
- labels: ge
1383
+ /* @__PURE__ */ F(Qe, {
1384
+ isVisible: wt && !vt,
1385
+ labels: we
474
1386
  }),
475
- /* @__PURE__ */ v(N, {
476
- title: W,
477
- onBack: V,
478
- backAriaLabel: H,
479
- actions: Xe,
480
- isSaving: C,
481
- labels: { savingStatusLabel: X.savingStatusLabel },
482
- styles: We,
483
- leftContent: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", {
484
- className: "px-4 py-4 desktop:hidden",
485
- children: /* @__PURE__ */ v(o, {
486
- title: X.editingFileLabel ?? "Editing file",
487
- description: $?.name ?? "SKILL.md",
488
- expanded: Ie,
489
- onToggle: Le,
490
- ariaLabel: X.editingFileLabel ?? "Editing file",
491
- children: Ye
1387
+ /* @__PURE__ */ F(Ne, {
1388
+ ...sn,
1389
+ isSubmitting: O,
1390
+ metadataSectionClassName: dt,
1391
+ metadata: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
1392
+ className: "desktop:hidden",
1393
+ children: /* @__PURE__ */ F(d, {
1394
+ title: Q.editingFileLabel ?? "Editing file",
1395
+ description: Ht?.name ?? "SKILL.md",
1396
+ expanded: St,
1397
+ onToggle: Ct,
1398
+ ariaLabel: Q.editingFileLabel ?? "Editing file",
1399
+ children: en(Y.Mobile)
492
1400
  })
493
- }), /* @__PURE__ */ v("div", {
494
- className: "hidden px-8 py-6 desktop:block",
495
- children: Ye
1401
+ }), /* @__PURE__ */ F("div", {
1402
+ className: "hidden desktop:block",
1403
+ children: en(Y.Desktop)
496
1404
  })] }),
497
- rightContent: /* @__PURE__ */ y("div", {
498
- className: "flex flex-1 flex-col gap-4 px-4 py-6 desktop:gap-5 desktop:px-8",
499
- children: [
500
- A != null && /* @__PURE__ */ v("div", {
501
- role: "alert",
502
- children: /* @__PURE__ */ v(d, { text: A })
503
- }),
504
- j != null && /* @__PURE__ */ y("div", {
505
- role: "alert",
506
- className: "flex items-center gap-2",
507
- children: [/* @__PURE__ */ v(d, { text: j.message }), /* @__PURE__ */ v(ee, {
508
- label: X.reloadLatestLabel ?? "Reload latest",
509
- onClick: M
510
- })]
511
- }),
512
- /* @__PURE__ */ v("h2", {
513
- className: i(U.title, Be),
514
- children: q === "SKILL.md" ? F : X.selectedFileHeading?.($?.name ?? q) ?? $?.name ?? q
515
- }),
516
- q === "SKILL.md" ? /* @__PURE__ */ y(_, { children: [
517
- /* @__PURE__ */ v(p, {
518
- labelProps: {
519
- label: X.nameLabel ?? "Name",
520
- required: !0
521
- },
522
- value: G.name,
523
- onChange: (e) => K((t) => ({
524
- ...t,
525
- name: e ?? ""
526
- })),
527
- placeholder: X.namePlaceholder ?? "good-morning-breakfast",
528
- caption: E?.name ? void 0 : X.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
529
- error: E?.name,
530
- invalid: !!E?.name,
531
- disabled: P
532
- }),
533
- /* @__PURE__ */ v(g, {
534
- labelProps: {
535
- label: X.descriptionLabel ?? "Description",
536
- required: !0
537
- },
538
- value: G.description,
539
- placeholder: X.descriptionPlaceholder ?? "What this skill does and when to use it",
540
- onChange: (e) => K((t) => ({
541
- ...t,
542
- description: e
543
- })),
544
- error: E?.description,
545
- invalid: !!E?.description
546
- }),
547
- /* @__PURE__ */ y("div", {
548
- className: "flex flex-1 flex-col gap-2",
549
- children: [
550
- /* @__PURE__ */ y("span", {
551
- className: "flex items-center gap-0.5",
552
- children: [/* @__PURE__ */ v("span", {
553
- className: i(U.helperText, Ve),
554
- children: X.instructionsLabel ?? "Instructions"
555
- }), /* @__PURE__ */ v("span", {
556
- className: "dial-tiny-text text-error",
557
- children: "*"
558
- })]
559
- }),
560
- /* @__PURE__ */ v("div", {
561
- ref: be,
562
- className: i(e, t),
563
- children: /* @__PURE__ */ v(S, {
564
- fallback: /* @__PURE__ */ v(h, { ariaLabel: X.instructionsLoadingAriaLabel ?? "Loading" }),
565
- children: /* @__PURE__ */ v(me, {
566
- value: G.instructions,
567
- onChange: (e) => K((t) => ({
568
- ...t,
569
- instructions: e
570
- })),
571
- theme: ye,
572
- placeholder: X.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
573
- })
574
- })
575
- }),
576
- E?.instructions != null && /* @__PURE__ */ v(d, { text: E.instructions })
577
- ]
578
- })
579
- ] }) : $?.kind === I.File && (fe ?? /* @__PURE__ */ v(s, { text: X.supportingFileNote ?? "This supporting file is included in the skill package as-is. Remove it from the Files panel to replace its content." }))
580
- ]
581
- })
1405
+ alert: un,
1406
+ setupTitle: ln,
1407
+ setupSectionClassName: ft,
1408
+ setup: cn ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(Ie, {
1409
+ values: tn,
1410
+ errors: nn,
1411
+ onChange: an,
1412
+ fields: ct,
1413
+ isDescriptionRequired: !0,
1414
+ isNameReadOnly: M,
1415
+ nameCaption: k?.name ? void 0 : Q.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
1416
+ renderDescription: on,
1417
+ labels: rn
1418
+ }), dn] }) : /* @__PURE__ */ F(P, { children: Ht?.kind === q.File && /* @__PURE__ */ F("div", {
1419
+ className: "flex min-h-0 flex-1 flex-col",
1420
+ children: fe ?? /* @__PURE__ */ F(h, { text: Q.supportingFileNote ?? "This supporting file is included in the skill package as-is. Remove it from the Files panel to replace its content." })
1421
+ }) })
582
1422
  }),
583
- /* @__PURE__ */ v(pe, {
584
- isOpen: Y,
585
- onClose: () => {
586
- Ne(!1), Fe(void 0);
587
- },
1423
+ /* @__PURE__ */ F(at, {
1424
+ isOpen: vt,
1425
+ onClose: () => yt(!1),
588
1426
  fileActions: R,
589
- initialFiles: Pe,
590
- labels: ge
1427
+ mode: bt.mode,
1428
+ targetFolderPath: bt.targetFolderPath,
1429
+ initialFiles: bt.initialFiles,
1430
+ initialEntries: bt.initialEntries,
1431
+ labels: we
591
1432
  })
592
1433
  ]
593
1434
  });
594
1435
  };
595
1436
  //#endregion
596
- export { W as SkillEditor, fe as SkillFileCandidateKind, I as SkillFileNodeKind, z as SkillFileValidationStatus };
1437
+ export { Re as SKILL_EDITOR_CLASS, mt as SkillEditor, $e as SkillFileCandidateKind, q as SkillFileNodeKind, Ze as SkillFileUploadMode, et as SkillFileValidationStatus };