@epam/ai-dial-skill-editor 1.3.0-dev.96 → 1.3.0-rc.0

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.
Files changed (36) hide show
  1. package/components/SkillCreateFolderDialog/SkillCreateFolderDialog.d.ts +5 -0
  2. package/components/SkillCreateFolderDialog/SkillCreateFolderDialog.d.ts.map +1 -0
  3. package/components/SkillEditor/SkillEditor.d.ts.map +1 -1
  4. package/components/SkillEditorDialog/SkillEditorDialog.d.ts +5 -0
  5. package/components/SkillEditorDialog/SkillEditorDialog.d.ts.map +1 -0
  6. package/components/SkillFileDropOverlay/SkillFileDropOverlay.d.ts +4 -0
  7. package/components/SkillFileDropOverlay/SkillFileDropOverlay.d.ts.map +1 -1
  8. package/components/SkillFileUploadDialog/SkillFileUploadDialog.d.ts +21 -1
  9. package/components/SkillFileUploadDialog/SkillFileUploadDialog.d.ts.map +1 -1
  10. package/components/SkillFilesSummary/SkillFilesSummary.d.ts +5 -0
  11. package/components/SkillFilesSummary/SkillFilesSummary.d.ts.map +1 -0
  12. package/components/SkillFolderPreview/SkillFolderPreview.d.ts +5 -0
  13. package/components/SkillFolderPreview/SkillFolderPreview.d.ts.map +1 -0
  14. package/hooks/useDraftFolder.d.ts +4 -0
  15. package/hooks/useDraftFolder.d.ts.map +1 -1
  16. package/index.css +2 -2
  17. package/index.js +1151 -779
  18. package/models/skill-create-folder-dialog-props.d.ts +27 -0
  19. package/models/skill-create-folder-dialog-props.d.ts.map +1 -0
  20. package/models/skill-editor-dialog-props.d.ts +36 -0
  21. package/models/skill-editor-dialog-props.d.ts.map +1 -0
  22. package/models/skill-editor-props.d.ts +83 -11
  23. package/models/skill-editor-props.d.ts.map +1 -1
  24. package/models/skill-files-summary-props.d.ts +19 -0
  25. package/models/skill-files-summary-props.d.ts.map +1 -0
  26. package/models/skill-folder-preview-props.d.ts +28 -0
  27. package/models/skill-folder-preview-props.d.ts.map +1 -0
  28. package/package.json +7 -7
  29. package/types/skill-add-source.d.ts +1 -3
  30. package/types/skill-add-source.d.ts.map +1 -1
  31. package/types/skill-file-conflict-resolution.d.ts +8 -0
  32. package/types/skill-file-conflict-resolution.d.ts.map +1 -0
  33. package/utils/file-tree.d.ts +22 -4
  34. package/utils/file-tree.d.ts.map +1 -1
  35. package/utils/icon.d.ts +2 -1
  36. package/utils/icon.d.ts.map +1 -1
package/index.js CHANGED
@@ -1,10 +1,10 @@
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";
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, useControlErrorAssociation as u, useIsMobile as d, useTextRefinement as f } from "@epam/ai-dial-chat-shared";
2
+ import { Accordion as p, BottomSheet as m, Breadcrumbs as h, ButtonAppearance as g, ButtonDropdown as _, ButtonVariant as v, CaptionText as y, DIAL_ICON_SIZE as b, DIAL_KIT_ICON_STROKE as x, DangerIconButton as S, DialItemType as C, EditorThemes as w, ElementSize as T, ErrorMessageNotification as E, ErrorText as D, FileDropzone as O, FileName as k, GhostButton as A, GhostIconButton as ee, Input as j, Label as te, LinkButton as ne, LiveRegion as re, LiveRegionElement as ie, LiveRegionPoliteness as M, NeutralButton as ae, NoDataContent as oe, Popup as N, PopupSize as se, PrimaryButton as ce, RadioGroup as le, ResizeHandle as ue, Select as de, Spinner as fe, TagInput as pe, Textarea as me, TextareaResize as he } from "@epam/ai-dial-ui-kit";
3
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";
4
+ import { IconArrowNarrowLeft as ge, IconDatabase as L, IconFileZip as _e, IconFolderPlus as ve, IconPhoto as ye, IconPlus as be, IconTrashX as xe, IconUpload as Se } from "@tabler/icons-react";
5
+ import { Suspense as Ce, lazy as we, memo as Te, useCallback as R, useEffect as Ee, useId as De, useMemo as z, useRef as B, useState as V } from "react";
6
+ import { DialFileNodeType as Oe, DialFoldersTree as ke } from "@epam/ai-dial-react-file-manager";
7
+ import { LazyMarkdownEditor as Ae } from "@epam/ai-dial-ui-kit/editors";
8
8
  c("flex flex-col desktop:min-h-0 desktop:overflow-y-auto", {
9
9
  body: "_body_1xd7h_2",
10
10
  sideColumn: "_sideColumn_1xd7h_6",
@@ -12,64 +12,77 @@ c("flex flex-col desktop:min-h-0 desktop:overflow-y-auto", {
12
12
  }.sideColumn);
13
13
  //#endregion
14
14
  //#region ../builder-form/src/constants/public-class-names.ts
15
- var ve = {
15
+ var H = {
16
16
  layout: "dial-builder-form-layout",
17
17
  section: "dial-builder-form-section",
18
18
  metadataSection: "dial-builder-form-metadata-section",
19
19
  setupSection: "dial-builder-form-setup-section",
20
20
  asideSection: "dial-builder-form-aside-section"
21
- }, ye = {
21
+ }, je = {
22
22
  section: "_section_l1mnx_1",
23
23
  title: "_title_l1mnx_5"
24
- }, be = ({ title: e, children: t, styles: n, className: r }) => {
24
+ }, Me = ({ title: e, children: t, styles: n, className: r }) => {
25
25
  let i = o({
26
26
  "--es-border-color": n?.colors?.borderColor,
27
27
  "--es-title-color": n?.colors?.titleColor
28
28
  });
29
29
  return /* @__PURE__ */ I("section", {
30
- className: c("flex h-full flex-col gap-4 rounded border p-6", ye.section, r, ve.section),
30
+ className: c("flex h-full flex-col gap-4 rounded border", je.section, r, H.section),
31
31
  style: i,
32
32
  children: [e != null && /* @__PURE__ */ F("h2", {
33
- className: c("dial-h3-text", ye.title),
33
+ className: c(n?.typography?.titleClassName ?? "dial-h3-text", je.title),
34
34
  children: e
35
35
  }), t]
36
36
  });
37
- }, xe = {
37
+ }, Ne = (e, { min: t = 280, max: n = 640, containerWidth: r } = {}) => {
38
+ let i = r != null && r > 0 ? r - 360 : n;
39
+ return Math.round(Math.min(Math.max(t, Math.min(n, i)), Math.max(t, Number.isFinite(e) ? e : t)));
40
+ }, U = {
38
41
  headerBorder: "_headerBorder_1adw2_1",
39
42
  footerBorder: "_footerBorder_1adw2_5",
40
43
  columnBorder: "_columnBorder_1adw2_10"
41
- }, Se = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: r, leftContent: i, centerContent: a, rightContent: s, isSaving: l = !1, labels: u, styles: d, dir: f }) => {
42
- let p = me(), m = l ? u?.savingStatusLabel ?? "Saving" : "", h = o({
43
- "--el-header-border-color": d?.colors?.headerBorderColor,
44
- "--el-sidebar-border-color": d?.colors?.sidebarBorderColor
44
+ }, Pe = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: r, leftContent: i, centerContent: a, rightContent: s, resizableLeftColumn: l, isSaving: u = !1, labels: d, styles: f, dir: p }) => {
45
+ let m = De(), h = u ? d?.savingStatusLabel ?? "Saving" : "", g = B(null), [_, v] = V(), y = l != null && a != null, S = l?.minWidth, C = l?.maxWidth, w = {
46
+ min: S,
47
+ max: C,
48
+ containerWidth: _
49
+ }, T = y ? Ne(l.width, w) : void 0, E = Ne(C ?? 640, w);
50
+ Ee(() => {
51
+ let e = g.current;
52
+ if (!y || e == null || typeof ResizeObserver > "u") return;
53
+ let t = new ResizeObserver(() => v(e.clientWidth));
54
+ return t.observe(e), () => t.disconnect();
55
+ }, [y]);
56
+ let D = o({
57
+ "--el-header-border-color": f?.colors?.headerBorderColor,
58
+ "--el-sidebar-border-color": f?.colors?.sidebarBorderColor
45
59
  });
46
60
  return /* @__PURE__ */ I("div", {
47
- dir: f,
48
- className: c("flex min-h-0 flex-1 flex-col", ve.layout),
49
- style: h,
61
+ dir: p,
62
+ className: c("flex min-h-0 flex-1 flex-col", H.layout),
63
+ style: D,
50
64
  children: [
51
- /* @__PURE__ */ F("span", {
52
- role: "status",
53
- "aria-live": "polite",
54
- className: "sr-only",
55
- id: p,
56
- children: m
65
+ /* @__PURE__ */ F(re, {
66
+ visuallyHidden: !0,
67
+ as: ie.Span,
68
+ id: m,
69
+ children: h
57
70
  }),
58
71
  /* @__PURE__ */ I("div", {
59
- className: c("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pt-3 desktop:pb-3", xe.headerBorder),
72
+ className: c("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pt-3 desktop:pb-3", U.headerBorder),
60
73
  children: [/* @__PURE__ */ I("div", {
61
74
  className: "flex min-w-0 flex-1 items-center gap-2",
62
- children: [/* @__PURE__ */ F(w, {
63
- icon: /* @__PURE__ */ F(L, {
64
- size: g.LG,
65
- stroke: _,
75
+ children: [/* @__PURE__ */ F(ee, {
76
+ icon: /* @__PURE__ */ F(ge, {
77
+ size: b.LG,
78
+ stroke: x,
66
79
  "aria-hidden": !0,
67
80
  className: "rtl:scale-x-[-1]"
68
81
  }),
69
82
  "aria-label": n,
70
83
  onClick: t
71
84
  }), /* @__PURE__ */ F("h1", {
72
- className: "dial-h2-text min-w-0 truncate",
85
+ className: c(f?.typography?.titleClassName ?? "dial-h2-text", "min-w-0 truncate"),
73
86
  children: e
74
87
  })]
75
88
  }), r != null && /* @__PURE__ */ F("div", {
@@ -78,85 +91,106 @@ var ve = {
78
91
  })]
79
92
  }),
80
93
  /* @__PURE__ */ I("div", {
94
+ ref: g,
81
95
  className: "flex flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden",
82
96
  children: [
83
97
  /* @__PURE__ */ F("div", {
84
- 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.columnBorder),
98
+ className: c(a == null ? "desktop:flex-1" : "desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", a != null && !y && "desktop:w-[400px]", y && "desktop:relative desktop:w-(--el-left-width)", "desktop:overflow-y-auto", a == null ? void 0 : U.columnBorder),
99
+ style: T == null ? void 0 : { "--el-left-width": `${T}px` },
85
100
  children: i
86
101
  }),
102
+ y && T != null && /* @__PURE__ */ F("div", {
103
+ className: "relative hidden w-0 shrink-0 desktop:block",
104
+ children: /* @__PURE__ */ F(ue, {
105
+ width: T,
106
+ minWidth: S ?? 280,
107
+ maxWidth: E,
108
+ defaultWidth: l.defaultWidth ?? 400,
109
+ onWidthChange: l.onWidthChange,
110
+ label: d?.resizeHandleLabel ?? "Resize columns",
111
+ tooltip: d?.resizeHandleTooltip ?? "Drag to resize"
112
+ })
113
+ }),
87
114
  a != null && /* @__PURE__ */ F("div", {
88
115
  className: "desktop:flex desktop:min-h-0 desktop:flex-1 desktop:flex-col desktop:overflow-y-auto",
89
116
  children: a
90
117
  }),
91
118
  s != null && /* @__PURE__ */ F("div", {
92
- className: c("desktop:w-[400px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-s", xe.columnBorder),
119
+ className: c("desktop:w-[400px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-s", U.columnBorder),
93
120
  children: s
94
121
  })
95
122
  ]
96
123
  }),
97
124
  r != null && /* @__PURE__ */ F("div", {
98
- className: c("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", xe.footerBorder),
125
+ className: c("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 *:flex-1 desktop:hidden", U.footerBorder),
99
126
  children: r
100
127
  })
101
128
  ]
102
129
  });
103
- }, Ce = {
130
+ }, Fe = {
104
131
  box: "_box_c9as8_1",
105
132
  icon: "_icon_c9as8_6",
106
133
  caption: "_caption_c9as8_10"
107
- }, 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 }) => {
108
- let u = o({
109
- "--aa-box-bg": s?.colors?.boxBackgroundColor,
110
- "--aa-box-border": s?.colors?.boxBorderColor,
111
- "--aa-icon": s?.colors?.placeholderIconColor,
112
- "--aa-caption": s?.colors?.captionColor
134
+ }, Ie = ({ label: e, avatarUrl: t, avatarAlt: n = "", addAvatarLabel: r = "Add avatar", captionText: i = "PNG, JPG or SVG (max 1 MB)", onAddAvatarClick: a, captionClassName: s = "dial-tiny-text", styles: l, className: u }) => {
135
+ let d = o({
136
+ "--aa-box-bg": l?.colors?.boxBackgroundColor,
137
+ "--aa-box-border": l?.colors?.boxBorderColor,
138
+ "--aa-icon": l?.colors?.placeholderIconColor,
139
+ "--aa-caption": l?.colors?.captionColor
113
140
  });
114
141
  return /* @__PURE__ */ I("div", {
115
- className: c("flex flex-col gap-2", l),
116
- style: u,
117
- children: [/* @__PURE__ */ F(E, { label: e }), /* @__PURE__ */ I("div", {
142
+ className: c("flex flex-col gap-2", u),
143
+ style: d,
144
+ children: [/* @__PURE__ */ F(te, { label: e }), /* @__PURE__ */ I("div", {
118
145
  className: "flex items-start gap-3",
119
146
  children: [/* @__PURE__ */ F("div", {
120
- className: c("flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border", Ce.box),
147
+ className: c("flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border", Fe.box),
121
148
  children: t ? /* @__PURE__ */ F("img", {
122
149
  src: t,
123
150
  alt: n,
124
151
  className: "h-16 w-16 object-cover"
125
- }) : /* @__PURE__ */ F(se, {
126
- size: g.LG,
127
- stroke: _,
152
+ }) : /* @__PURE__ */ F(ye, {
153
+ size: b.LG,
154
+ stroke: x,
128
155
  "aria-hidden": !0,
129
- className: Ce.icon
156
+ className: Fe.icon
130
157
  })
131
158
  }), /* @__PURE__ */ I("div", {
132
159
  className: "flex flex-col gap-3",
133
- children: [/* @__PURE__ */ F(C, {
134
- size: b.Small,
135
- iconBefore: /* @__PURE__ */ F(ce, {
136
- size: g.SM,
137
- stroke: _,
160
+ children: [/* @__PURE__ */ F(A, {
161
+ size: T.Small,
162
+ iconBefore: /* @__PURE__ */ F(be, {
163
+ size: b.SM,
164
+ stroke: x,
138
165
  "aria-hidden": !0
139
166
  }),
140
167
  className: "w-fit",
141
168
  label: r,
142
169
  onClick: a
143
170
  }), /* @__PURE__ */ F("span", {
144
- className: c("dial-tiny-text", Ce.caption),
171
+ className: c(s, Fe.caption),
145
172
  children: i
146
173
  })]
147
174
  })]
148
175
  })]
149
176
  });
150
- }, Te = ({ isOpen: e, onClose: t, onAttach: n, bucket: r, FileManagerModal: i, allowedMimeTypes: a, maxFileSizeBytes: o, labels: s }) => {
151
- let c = z((e) => e.length === 1 ? s.deleteConfirmTitleSingle : s.deleteConfirmTitleMultiple, [s.deleteConfirmTitleSingle, s.deleteConfirmTitleMultiple]), l = z((e) => /* @__PURE__ */ F("div", {
152
- className: "dial-small-text px-6 py-3",
177
+ }, Le = {
178
+ confirmText: "_confirmText_19ec1_1",
179
+ confirmItem: "_confirmItem_19ec1_5"
180
+ }, Re = ({ isOpen: e, onClose: t, onAttach: n, bucket: r, FileManagerModal: i, allowedMimeTypes: a, maxFileSizeBytes: s, labels: l, confirmBodyClassName: u = "dial-small-text", styles: d }) => {
181
+ let f = d?.colors?.confirmText, p = d?.colors?.confirmItemText, m = R((e) => e.length === 1 ? l.deleteConfirmTitleSingle : l.deleteConfirmTitleMultiple, [l.deleteConfirmTitleSingle, l.deleteConfirmTitleMultiple]), h = R((e) => /* @__PURE__ */ F("div", {
182
+ className: c(u, "px-6 py-3"),
183
+ style: o({
184
+ "--apm-confirm-text": f,
185
+ "--apm-confirm-item-text": p
186
+ }),
153
187
  children: /* @__PURE__ */ F("p", {
154
- className: "mb-3 text-secondary",
188
+ className: c("mb-3", Le.confirmText),
155
189
  children: e.length === 1 ? /* @__PURE__ */ I(P, { children: [
156
- s.deleteConfirmSingleText,
190
+ l.deleteConfirmSingleText,
157
191
  " ",
158
192
  /* @__PURE__ */ I("span", {
159
- className: "break-words text-primary",
193
+ className: c("wrap-break-word", Le.confirmItem),
160
194
  children: [
161
195
  "\"",
162
196
  e[0].split("/").pop(),
@@ -164,24 +198,27 @@ var ve = {
164
198
  ]
165
199
  })
166
200
  ] }) : /* @__PURE__ */ I(P, { children: [
167
- s.deleteConfirmMultipleText,
201
+ l.deleteConfirmMultipleText,
168
202
  " ",
169
203
  /* @__PURE__ */ I("span", {
170
- className: "text-primary",
204
+ className: Le.confirmItem,
171
205
  children: [
172
206
  e.length,
173
207
  " ",
174
- s.deleteConfirmItemsLabel
208
+ l.deleteConfirmItemsLabel
175
209
  ]
176
210
  })
177
211
  ] })
178
212
  })
179
213
  }), [
180
- s.deleteConfirmSingleText,
181
- s.deleteConfirmMultipleText,
182
- s.deleteConfirmItemsLabel
214
+ l.deleteConfirmSingleText,
215
+ l.deleteConfirmMultipleText,
216
+ l.deleteConfirmItemsLabel,
217
+ f,
218
+ p,
219
+ u
183
220
  ]);
184
- return /* @__PURE__ */ F(de, {
221
+ return /* @__PURE__ */ F(Ce, {
185
222
  fallback: null,
186
223
  children: e && /* @__PURE__ */ F(i, {
187
224
  isOpen: e,
@@ -189,223 +226,234 @@ var ve = {
189
226
  onAttach: n,
190
227
  bucket: r,
191
228
  allowedTypes: a,
192
- maxSelectableFileSize: o,
229
+ maxSelectableFileSize: s,
193
230
  maximumAttachmentsAmount: 1,
194
231
  canAttachFolders: !1,
195
- title: s.title,
196
- attachLabel: s.attachLabel,
197
- emptyTitle: s.emptyTitle,
198
- emptyDescription: s.emptyDescription,
199
- errorMessage: s.errorMessage,
200
- retryLabel: s.retryLabel,
201
- hiddenFilesLabel: s.hiddenFilesLabel,
202
- showHiddenFilesLabel: s.showHiddenFilesLabel,
203
- hideHiddenFilesLabel: s.hideHiddenFilesLabel,
204
- getSelectionLabel: s.getSelectionLabel,
205
- uploadFilesLabel: s.uploadFilesLabel,
206
- newFolderLabel: s.newFolderLabel,
207
- downloadLabel: s.downloadLabel,
208
- downloadingLabel: s.downloadingLabel,
209
- deleteLabel: s.deleteLabel,
210
- deletingLabel: s.deletingLabel,
211
- deleteConfirmTitle: c,
212
- deleteConfirmBody: l,
213
- deleteConfirmLabel: s.deleteConfirmLabel,
214
- deleteCancelLabel: s.deleteCancelLabel
232
+ title: l.title,
233
+ attachLabel: l.attachLabel,
234
+ emptyTitle: l.emptyTitle,
235
+ emptyDescription: l.emptyDescription,
236
+ errorMessage: l.errorMessage,
237
+ retryLabel: l.retryLabel,
238
+ hiddenFilesLabel: l.hiddenFilesLabel,
239
+ showHiddenFilesLabel: l.showHiddenFilesLabel,
240
+ hideHiddenFilesLabel: l.hideHiddenFilesLabel,
241
+ getSelectionLabel: l.getSelectionLabel,
242
+ uploadFilesLabel: l.uploadFilesLabel,
243
+ newFolderLabel: l.newFolderLabel,
244
+ downloadLabel: l.downloadLabel,
245
+ downloadingLabel: l.downloadingLabel,
246
+ deleteLabel: l.deleteLabel,
247
+ deletingLabel: l.deletingLabel,
248
+ deleteConfirmTitle: m,
249
+ deleteConfirmBody: h,
250
+ deleteConfirmLabel: l.deleteConfirmLabel,
251
+ deleteCancelLabel: l.deleteCancelLabel
215
252
  })
216
253
  });
217
- }, U = /* @__PURE__ */ function(e) {
254
+ }, W = /* @__PURE__ */ function(e) {
218
255
  return e.Avatar = "avatar", e.Name = "name", e.Version = "version", e.Description = "description", e.Locales = "locales", e.Tags = "tags", e;
219
- }({}), Ee = [
256
+ }({}), ze = [
220
257
  "avatar",
221
258
  "name",
222
259
  "version",
223
260
  "description",
224
261
  "locales",
225
262
  "tags"
226
- ], De = (e, t, n) => ({
263
+ ], Be = {
264
+ summary: "_summary_1hlc9_1",
265
+ rowLabel: "_rowLabel_1hlc9_5"
266
+ }, Ve = (e, t, n) => ({
227
267
  id: e,
228
268
  language: n.find((e) => !t.has(e.code))?.code ?? "",
229
269
  name: "",
230
270
  description: ""
231
- }), W = ({ 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" }) => {
232
- 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);
233
- pe(() => {
234
- ne && L(e.length > 0 ? e : [De(`locale-row-${++re.current}`, /* @__PURE__ */ new Set(), n)]);
271
+ }), He = (e) => e.toUpperCase(), Ue = ({ value: e, onChange: t, availableLocaleOptions: n = [], formatLocaleLabel: i = He, labels: a, className: s, summaryClassName: l = "dial-body-text", rowLabelClassName: u = "dial-tiny-lead-text", colors: d }) => {
272
+ let f = o({
273
+ "--dlf-summary-text": d?.summaryText,
274
+ "--dlf-row-label-text": d?.rowLabelText
275
+ }), { summaryLabel: p, addLabel: m, editLabel: h, popupTitle: _, addLocaleLabel: y, localeRowLabel: C = "Locale", languageLabel: w, nameLabel: E, namePlaceholder: D, descriptionLabel: O, descriptionPlaceholder: k, deleteAriaLabel: A, cancelLabel: ee = "Cancel", saveLabel: te = "Save" } = a, [re, ie] = V(!1), [M, ae] = V([]), oe = B(0);
276
+ Ee(() => {
277
+ re && ae(e.length > 0 ? e : [Ve(`locale-row-${++oe.current}`, /* @__PURE__ */ new Set(), n)]);
235
278
  }, [
236
- ne,
279
+ re,
237
280
  e,
238
281
  n
239
282
  ]);
240
- let ie = () => j(!0), ae = () => j(!1), oe = () => {
241
- t(P.filter((e) => e.language && e.name)), j(!1);
242
- }, se = () => {
243
- let e = new Set(P.map((e) => e.language).filter(Boolean));
244
- L((t) => [...t, De(`locale-row-${++re.current}`, e, n)]);
245
- }, ue = (e, t) => {
246
- L((n) => n.map((n) => n.id === e ? {
283
+ let se = () => ie(!0), ce = () => ie(!1), le = () => {
284
+ t(M.filter((e) => e.language && e.name)), ie(!1);
285
+ }, ue = () => {
286
+ let e = new Set(M.map((e) => e.language).filter(Boolean));
287
+ ae((t) => [...t, Ve(`locale-row-${++oe.current}`, e, n)]);
288
+ }, fe = (e, t) => {
289
+ ae((n) => n.map((n) => n.id === e ? {
247
290
  ...n,
248
291
  ...t
249
292
  } : n));
250
- }, de = (e) => {
251
- L((t) => t.filter((t) => t.id !== e));
252
- }, R = (e) => n.find((t) => t.code === e)?.label ?? e.toUpperCase(), fe = P.some((e) => !e.language || !e.name);
253
- return n.length === 0 ? null : /* @__PURE__ */ I("div", {
254
- className: c("flex items-center gap-2", a),
293
+ }, pe = (e) => {
294
+ ae((t) => t.filter((t) => t.id !== e));
295
+ }, P = new Set(n.map((e) => e.code)), ge = (e) => e !== "" && !P.has(e), L = e.some((e) => ge(e.language)), _e = new Set(M.map((e) => e.language).filter((e) => P.has(e))).size, ve = (t, r) => {
296
+ let a = e.find((e) => e.id === t.id)?.language, o = [...new Set([a ?? "", t.language].filter(ge))];
297
+ return [...n.map((e) => ({
298
+ value: e.code,
299
+ label: e.label,
300
+ disabled: r.has(e.code)
301
+ })), ...o.map((e) => ({
302
+ value: e,
303
+ label: i(e),
304
+ disabled: r.has(e)
305
+ }))];
306
+ }, ye = M.some((e) => !e.language || !e.name);
307
+ return n.length === 0 && !L ? null : /* @__PURE__ */ I("div", {
308
+ className: c("flex items-center gap-2", s),
309
+ style: f,
255
310
  children: [
256
311
  e.length > 0 && /* @__PURE__ */ F("span", {
257
- className: o,
258
- children: `${l}: ${e.map((e) => `[${R(e.language)}]`).join(", ")}`
312
+ className: c(Be.summary, l),
313
+ children: `${p}: ${e.map((e) => `[${e.language.toUpperCase()}]`).join(", ")}`
259
314
  }),
260
- /* @__PURE__ */ F(D, {
261
- label: e.length > 0 ? d : u,
262
- iconBefore: /* @__PURE__ */ F(ce, {
263
- size: g.SM,
315
+ /* @__PURE__ */ F(ne, {
316
+ label: e.length > 0 ? h : m,
317
+ iconBefore: /* @__PURE__ */ F(be, {
318
+ size: b.SM,
264
319
  "aria-hidden": !0,
265
- stroke: _
320
+ stroke: x
266
321
  }),
267
- className: "!px-0",
268
- onClick: ie
322
+ className: "px-0!",
323
+ onClick: se
269
324
  }),
270
- /* @__PURE__ */ F(k, {
271
- open: ne,
272
- header: p,
273
- onClose: ae,
325
+ /* @__PURE__ */ F(N, {
326
+ open: re,
327
+ header: _,
328
+ onClose: ce,
274
329
  mainButtons: [{
275
330
  label: ee,
276
- onClick: ae
331
+ onClick: ce
277
332
  }, {
278
- label: A,
279
- variant: m.Primary,
280
- disabled: fe,
281
- onClick: oe
333
+ label: te,
334
+ variant: v.Primary,
335
+ disabled: ye,
336
+ onClick: le
282
337
  }],
283
338
  children: /* @__PURE__ */ I("div", {
284
339
  className: "flex flex-col gap-8 px-6 py-3",
285
- children: [P.map((e, t) => {
286
- let i = new Set(P.filter((t) => t.id !== e.id).map((e) => e.language).filter(Boolean));
340
+ style: f,
341
+ children: [M.map((e, t) => {
342
+ let n = new Set(M.filter((t) => t.id !== e.id).map((e) => e.language).filter(Boolean));
287
343
  return /* @__PURE__ */ I("div", {
288
344
  className: "flex flex-col gap-2",
289
345
  children: [/* @__PURE__ */ I("div", {
290
346
  className: "flex items-center justify-between",
291
347
  children: [/* @__PURE__ */ I("span", {
292
- className: s,
348
+ className: c(Be.rowLabel, u),
293
349
  children: [
294
- y,
350
+ C,
295
351
  " ",
296
352
  t + 1
297
353
  ]
298
- }), /* @__PURE__ */ F(v, {
299
- appearance: f.Ghost,
300
- size: b.Small,
301
- icon: /* @__PURE__ */ F(le, {
302
- size: g.SM,
354
+ }), /* @__PURE__ */ F(S, {
355
+ appearance: g.Ghost,
356
+ size: T.Small,
357
+ icon: /* @__PURE__ */ F(xe, {
358
+ size: b.SM,
303
359
  "aria-hidden": !0,
304
- stroke: _
360
+ stroke: x
305
361
  }),
306
- "aria-label": `${O} ${t + 1}`,
307
- onClick: () => de(e.id)
362
+ "aria-label": `${A} ${t + 1}`,
363
+ onClick: () => pe(e.id)
308
364
  })]
309
365
  }), /* @__PURE__ */ I("div", {
310
366
  role: "group",
311
- "aria-label": `${y} ${t + 1}`,
367
+ "aria-label": `${C} ${t + 1}`,
312
368
  className: "flex flex-col gap-5",
313
369
  children: [/* @__PURE__ */ I("div", {
314
370
  className: "flex flex-col gap-5 desktop:flex-row desktop:items-start",
315
- children: [/* @__PURE__ */ F(te, {
371
+ children: [/* @__PURE__ */ F(de, {
316
372
  id: `${e.id}-language`,
317
373
  labelProps: {
318
- label: x,
374
+ label: w,
319
375
  required: !0
320
376
  },
321
377
  className: "desktop:shrink-0 desktop:basis-40",
322
- options: n.map((e) => ({
323
- value: e.code,
324
- label: e.label,
325
- disabled: i.has(e.code)
326
- })),
378
+ options: ve(e, n),
327
379
  value: e.language,
328
- onChange: (t) => ue(e.id, { language: t })
329
- }), /* @__PURE__ */ F(T, {
380
+ onChange: (t) => fe(e.id, { language: t })
381
+ }), /* @__PURE__ */ F(j, {
330
382
  id: `${e.id}-name`,
331
383
  containerClassName: "min-w-0 flex-1",
332
384
  required: !0,
333
385
  value: e.name,
334
- onChange: (t) => ue(e.id, { name: t ?? "" }),
386
+ onChange: (t) => fe(e.id, { name: t ?? "" }),
335
387
  labelProps: {
336
- label: S,
388
+ label: E,
337
389
  required: !0
338
390
  },
339
- placeholder: C
391
+ placeholder: D
340
392
  })]
341
- }), /* @__PURE__ */ F(M, {
393
+ }), /* @__PURE__ */ F(me, {
342
394
  id: `${e.id}-description`,
343
395
  className: r,
344
- resize: N.Vertical,
396
+ resize: he.Vertical,
345
397
  value: e.description,
346
- onChange: (t) => ue(e.id, { description: t }),
347
- labelProps: { label: w },
348
- placeholder: E
398
+ onChange: (t) => fe(e.id, { description: t }),
399
+ labelProps: { label: O },
400
+ placeholder: k
349
401
  })]
350
402
  })]
351
403
  }, e.id);
352
- }), /* @__PURE__ */ F(D, {
353
- label: h,
354
- iconBefore: /* @__PURE__ */ F(ce, {
355
- size: g.SM,
404
+ }), /* @__PURE__ */ F(ne, {
405
+ label: y,
406
+ iconBefore: /* @__PURE__ */ F(be, {
407
+ size: b.SM,
356
408
  "aria-hidden": !0,
357
- stroke: _
409
+ stroke: x
358
410
  }),
359
411
  className: "self-start",
360
- onClick: se,
361
- disabled: P.length >= n.length
412
+ onClick: ue,
413
+ disabled: _e >= n.length
362
414
  })]
363
415
  })
364
416
  })
365
417
  ]
366
418
  });
367
- }, Oe = "Add tags, comma separated", ke = "deployment-creation-form-description", G = ({ 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, descriptionCaption: _, renderDescription: v, focusRequestKey: y }) => {
368
- let b = V(null), x = V(null), S = V(null), C = V(!1), w = (e) => p.includes(e), E = w(U.Name), D = w(U.Version), O = !!(t.name || t.version || t.description), k = V(y);
369
- pe(() => {
419
+ }, We = "Add tags, comma separated", Ge = "The version is changed with \"Save as new version\"", Ke = "deployment-creation-form-description", qe = ({ values: e, errors: t, onChange: n, onNameBlur: a, onVersionBlur: o, iconPreviewUrl: s, onAddAvatarClick: l, labels: u, styles: d, availableLocaleOptions: f = [], formatLocaleLabel: p, fields: m = ze, isNameReadOnly: h = !1, nameReadOnlyTooltip: g, isVersionReadOnly: _ = !1, versionReadOnlyTooltip: v = Ge, nameCaption: y, isDescriptionRequired: b = !1, descriptionCaption: x, renderDescription: S, focusRequestKey: C }) => {
420
+ let w = B(null), T = B(null), E = B(null), D = B(!1), O = (e) => m.includes(e), k = O(W.Name), A = O(W.Version), ee = !!(t.name || t.version || t.description), te = B(C);
421
+ Ee(() => {
370
422
  let e = () => {
371
- t.name ? b.current?.focus() : t.version ? x.current?.focus() : t.description && S.current?.focus();
423
+ t.name ? w.current?.focus() : t.version ? T.current?.focus() : t.description && E.current?.focus();
372
424
  };
373
- if (y !== void 0) {
374
- y !== k.current && (k.current = y, e());
375
- return;
376
- }
377
- O && !C.current && e(), C.current = O;
425
+ C === void 0 ? (ee && !D.current && e(), D.current = ee) : C !== te.current && (te.current = C, e());
378
426
  }, [
379
- y,
380
- O,
427
+ C,
428
+ ee,
381
429
  t.name,
382
430
  t.version,
383
431
  t.description
384
432
  ]);
385
- let ee = /* @__PURE__ */ F(M, {
386
- id: ke,
387
- ref: S,
433
+ let ne = /* @__PURE__ */ F(me, {
434
+ id: Ke,
435
+ ref: E,
388
436
  value: e.description,
389
437
  onChange: (e) => n({ description: e }),
390
- "aria-required": g || void 0,
391
- labelProps: v ? void 0 : {
438
+ "aria-required": b || void 0,
439
+ labelProps: S ? void 0 : {
392
440
  label: u.description.label,
393
- required: g
441
+ required: b
394
442
  },
395
443
  placeholder: u.description.placeholder,
396
- caption: _,
444
+ caption: x,
397
445
  error: t.description || void 0,
398
446
  invalid: !!t.description,
399
- containerClassName: v ? void 0 : d?.field,
447
+ containerClassName: S ? void 0 : d?.field,
400
448
  className: r,
401
- resize: N.Vertical
449
+ resize: he.Vertical
402
450
  });
403
451
  return /* @__PURE__ */ I("div", {
404
452
  role: u.ariaLabel ? "group" : void 0,
405
453
  "aria-label": u.ariaLabel,
406
454
  className: c("flex flex-col gap-4", d?.root),
407
455
  children: [
408
- w(U.Avatar) && /* @__PURE__ */ F(we, {
456
+ O(W.Avatar) && /* @__PURE__ */ F(Ie, {
409
457
  label: u.iconUrl.label,
410
458
  avatarUrl: s,
411
459
  addAvatarLabel: u.iconUrl.addAvatarLabel,
@@ -413,54 +461,61 @@ var ve = {
413
461
  onAddAvatarClick: l,
414
462
  className: d?.field
415
463
  }),
416
- (E || D) && /* @__PURE__ */ I("div", {
464
+ (k || A) && /* @__PURE__ */ I("div", {
417
465
  className: c("flex items-start gap-4", d?.field),
418
- children: [E && /* @__PURE__ */ F(T, {
466
+ children: [k && /* @__PURE__ */ F(j, {
419
467
  id: "deployment-creation-form-name",
420
- inputRef: b,
468
+ inputRef: w,
421
469
  value: e.name,
422
470
  onChange: (e) => n({ name: e ?? "" }),
423
471
  onBlur: a,
424
- readOnly: m,
472
+ disabled: h,
473
+ tooltipText: h ? g : void 0,
425
474
  labelProps: {
426
475
  label: u.name.label,
427
476
  required: !0
428
477
  },
429
478
  placeholder: u.name.placeholder,
430
- caption: h,
479
+ caption: y,
431
480
  error: t.name || void 0,
432
481
  invalid: !!t.name,
433
- containerClassName: D ? "min-w-0 basis-0 grow-[2]" : "min-w-0 flex-1"
434
- }), D && /* @__PURE__ */ F(T, {
482
+ containerClassName: A ? "min-w-0 basis-0 grow-[2]" : "min-w-0 flex-1"
483
+ }), A && /* @__PURE__ */ F(j, {
435
484
  id: "deployment-creation-form-version",
436
- inputRef: x,
485
+ inputRef: T,
437
486
  value: e.version,
438
- onChange: (e) => n({ version: e ?? "" }),
439
- onBlur: o,
487
+ onChange: (e) => {
488
+ _ || n({ version: e ?? "" });
489
+ },
490
+ onBlur: _ ? void 0 : o,
491
+ readOnly: _,
492
+ tooltipText: _ ? v : void 0,
440
493
  labelProps: { label: u.version.label },
441
494
  placeholder: u.version.placeholder,
442
495
  error: t.version || void 0,
443
496
  invalid: !!t.version,
444
- containerClassName: E ? "min-w-0 basis-0 grow-[1]" : "min-w-0 flex-1"
497
+ containerClassName: k ? "min-w-0 basis-0 grow-[1]" : "min-w-0 flex-1"
445
498
  })]
446
499
  }),
447
- w(U.Description) && (v ? /* @__PURE__ */ F("div", {
500
+ O(W.Description) && (S ? /* @__PURE__ */ F("div", {
448
501
  className: d?.field,
449
- children: v(ee, ke)
450
- }) : ee),
451
- w(U.Locales) && /* @__PURE__ */ F(W, {
502
+ children: S(ne, Ke)
503
+ }) : ne),
504
+ O(W.Locales) && /* @__PURE__ */ F(Ue, {
452
505
  value: e.otherLocales,
453
506
  onChange: (e) => n({ otherLocales: e }),
454
507
  availableLocaleOptions: f,
508
+ formatLocaleLabel: p,
455
509
  labels: u.otherLocales,
456
- className: d?.field
510
+ className: d?.field,
511
+ colors: d?.localesColors
457
512
  }),
458
- w(U.Tags) && /* @__PURE__ */ F("div", {
513
+ O(W.Tags) && /* @__PURE__ */ F("div", {
459
514
  className: d?.field,
460
- children: /* @__PURE__ */ F(j, {
515
+ children: /* @__PURE__ */ F(pe, {
461
516
  id: "deployment-creation-form-topics",
462
517
  labelProps: { label: u.topics.label },
463
- placeholder: u.topics.placeholder ?? Oe,
518
+ placeholder: u.topics.placeholder ?? We,
464
519
  value: e.topics,
465
520
  onChange: (e) => n({ topics: e }),
466
521
  tagClassName: i
@@ -468,53 +523,58 @@ var ve = {
468
523
  })
469
524
  ]
470
525
  });
471
- }, Ae = "border-0 p-4 desktop:p-8", 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, asideData: h, asideTitle: g, asideSectionClassName: _, alert: v, metadataSectionClassName: y, setupSectionClassName: b, labels: x, styles: S, dir: C }) => {
472
- let w = v == null ? null : /* @__PURE__ */ F("div", {
473
- role: "alert",
474
- className: Me,
526
+ }, Je = "border-0 p-4 desktop:p-8", Ye = "border-0", Xe = "desktop:flex-1", Ze = "px-4 pt-4 desktop:px-6 desktop:pt-6", Qe = Te(({ 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, asideData: h, asideTitle: g, asideSectionClassName: _, alert: v, resizableLeftColumn: y, metadataSectionClassName: b, setupSectionClassName: x, hasSetupSectionPadding: S = !0, labels: C, styles: w, dir: T }) => {
527
+ let E = /* @__PURE__ */ F(re, {
528
+ politeness: M.Assertive,
529
+ className: v == null ? void 0 : Ze,
475
530
  children: v
476
- }), T = p != null;
477
- return /* @__PURE__ */ F(Se, {
531
+ }), D = p != null;
532
+ return /* @__PURE__ */ F(Pe, {
478
533
  title: e,
479
534
  onBack: t,
480
- backAriaLabel: x?.backAriaLabel ?? "Back",
535
+ backAriaLabel: C?.backAriaLabel ?? "Back",
481
536
  isSaving: a,
482
- labels: { savingStatusLabel: x?.savingStatusLabel ?? "Saving" },
483
- rightContent: h == null ? void 0 : /* @__PURE__ */ F(be, {
537
+ resizableLeftColumn: y,
538
+ labels: {
539
+ savingStatusLabel: C?.savingStatusLabel ?? "Saving",
540
+ resizeHandleLabel: C?.resizeHandleLabel,
541
+ resizeHandleTooltip: C?.resizeHandleTooltip
542
+ },
543
+ rightContent: h == null ? void 0 : /* @__PURE__ */ F(Me, {
484
544
  title: g,
485
- styles: S?.section,
486
- className: c(Ae, _, ve.asideSection),
545
+ styles: w?.section,
546
+ className: c(Je, _, H.asideSection),
487
547
  children: h
488
548
  }),
489
- styles: S?.layout,
490
- dir: C,
491
- actions: /* @__PURE__ */ I(P, { children: [s, !l && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(O, {
492
- label: x?.cancelLabel ?? "Cancel",
549
+ styles: w?.layout,
550
+ dir: T,
551
+ actions: /* @__PURE__ */ I(P, { children: [s, !l && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(ae, {
552
+ label: C?.cancelLabel ?? "Cancel",
493
553
  disabled: a,
494
554
  onClick: n
495
- }), /* @__PURE__ */ F(A, {
555
+ }), /* @__PURE__ */ F(ce, {
496
556
  label: i,
497
557
  disabled: a || o,
498
558
  onClick: r
499
559
  })] })] }),
500
560
  leftContent: /* @__PURE__ */ I(P, { children: [
501
- !T && w,
502
- /* @__PURE__ */ F(be, {
503
- title: d === null ? void 0 : d ?? x?.metadataTitle ?? "Metadata",
504
- styles: S?.section,
505
- className: c(Ae, y, ve.metadataSection),
561
+ !D && E,
562
+ /* @__PURE__ */ F(Me, {
563
+ title: d === null ? void 0 : d ?? C?.metadataTitle ?? "Metadata",
564
+ styles: w?.section,
565
+ className: c(Je, b, H.metadataSection),
506
566
  children: u
507
567
  }),
508
568
  f
509
569
  ] }),
510
- centerContent: T ? /* @__PURE__ */ I(P, { children: [w, /* @__PURE__ */ F(be, {
511
- title: m === null ? void 0 : m ?? x?.setupTitle ?? "Setup",
512
- styles: S?.section,
513
- className: c(Ae, je, b, ve.setupSection),
570
+ centerContent: D ? /* @__PURE__ */ I(P, { children: [E, /* @__PURE__ */ F(Me, {
571
+ title: m === null ? void 0 : m ?? C?.setupTitle ?? "Setup",
572
+ styles: w?.section,
573
+ className: c(S ? Je : Ye, Xe, x, H.setupSection),
514
574
  children: p
515
575
  })] }) : void 0
516
576
  });
517
- }), Pe = {
577
+ }), $e = {
518
578
  name: {
519
579
  label: "Name",
520
580
  placeholder: "Enter name"
@@ -553,7 +613,7 @@ var ve = {
553
613
  saveLabel: "Save"
554
614
  },
555
615
  ariaLabel: "Metadata"
556
- }, Fe = {
616
+ }, et = {
557
617
  title: "Add avatar",
558
618
  attachLabel: "Attach",
559
619
  emptyTitle: "This folder is empty",
@@ -577,84 +637,82 @@ var ve = {
577
637
  deleteConfirmItemsLabel: "items?",
578
638
  deleteConfirmLabel: "Delete",
579
639
  deleteCancelLabel: "Cancel"
580
- }, 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, descriptionCaption: d, renderDescription: f, focusRequestKey: p, labels: m }) => {
581
- let [h, g] = H(!1), _ = B(() => a ? s : s.filter((e) => e !== U.Avatar), [a, s]), v = e.iconUrl, y = a?.resolveIconUrl, b = B(() => y ? y(v) : void 0, [v, y]), x = z(() => g(!0), []), S = z(() => g(!1), []), C = a?.resolveAttachedIconUrl, w = z((e) => {
582
- let t = C?.(e);
583
- t && n({ iconUrl: t }), g(!1);
584
- }, [n, C]);
585
- return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(G, {
640
+ }, tt = Te(({ values: e, errors: t, onChange: n, onNameBlur: r, onVersionBlur: i, avatarPicker: a, availableLocaleOptions: o, formatLocaleLabel: s, fields: c = ze, isNameReadOnly: l, nameReadOnlyTooltip: u, isVersionReadOnly: d, versionReadOnlyTooltip: f, nameCaption: p, isDescriptionRequired: m, descriptionCaption: h, renderDescription: g, focusRequestKey: _, labels: v }) => {
641
+ let [y, b] = V(!1), x = z(() => a ? c : c.filter((e) => e !== W.Avatar), [a, c]), S = e.iconUrl, C = a?.resolveIconUrl, w = z(() => C ? C(S) : void 0, [S, C]), T = R(() => b(!0), []), E = R(() => b(!1), []), D = a?.resolveAttachedIconUrl, O = R((e) => {
642
+ let t = D?.(e);
643
+ t && n({ iconUrl: t }), b(!1);
644
+ }, [n, D]);
645
+ return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(qe, {
586
646
  values: e,
587
647
  errors: t,
588
648
  onChange: n,
589
649
  onNameBlur: r,
590
650
  onVersionBlur: i,
591
- iconPreviewUrl: b,
592
- onAddAvatarClick: x,
593
- labels: m?.form ?? Pe,
651
+ iconPreviewUrl: w,
652
+ onAddAvatarClick: T,
653
+ labels: v?.form ?? $e,
594
654
  availableLocaleOptions: o,
595
- fields: _,
596
- isNameReadOnly: c,
597
- nameCaption: l,
598
- isDescriptionRequired: u,
599
- descriptionCaption: d,
600
- renderDescription: f,
601
- focusRequestKey: p
602
- }), a && /* @__PURE__ */ F(Te, {
603
- isOpen: h,
604
- onClose: S,
605
- onAttach: w,
655
+ formatLocaleLabel: s,
656
+ fields: x,
657
+ isNameReadOnly: l,
658
+ nameReadOnlyTooltip: u,
659
+ isVersionReadOnly: d,
660
+ versionReadOnlyTooltip: f,
661
+ nameCaption: p,
662
+ isDescriptionRequired: m,
663
+ descriptionCaption: h,
664
+ renderDescription: g,
665
+ focusRequestKey: _
666
+ }), a && /* @__PURE__ */ F(Re, {
667
+ isOpen: y,
668
+ onClose: E,
669
+ onAttach: O,
606
670
  bucket: a.bucket,
607
671
  FileManagerModal: a.FileManagerModal,
608
672
  allowedMimeTypes: a.allowedMimeTypes,
609
673
  maxFileSizeBytes: a.maxFileSizeBytes,
610
- labels: m?.avatarPicker ?? Fe
674
+ labels: v?.avatarPicker ?? et
611
675
  })] });
612
- }), Le = /* @__PURE__ */ function(e) {
676
+ }), G = /* @__PURE__ */ function(e) {
613
677
  return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e.ControlCharacters = "control-characters", e;
614
678
  }({});
615
- new Set([Le.TooLong, Le.ControlCharacters]);
679
+ G.TooLong, G.ControlCharacters;
616
680
  //#endregion
617
681
  //#region src/constants/public-class-names.ts
618
- var Re = {
682
+ var nt = {
619
683
  root: "dial-skill-editor-root",
620
684
  refineFeedback: "dial-skill-editor-refine-feedback"
621
685
  }, K = "SKILL.md", q = /* @__PURE__ */ function(e) {
622
686
  return e.File = "file", e.Folder = "folder", e;
623
- }({}), ze = /* @__PURE__ */ function(e) {
624
- return e.Header = "header", e.Child = "child", e.Sibling = "sibling", e;
687
+ }({}), rt = /* @__PURE__ */ function(e) {
688
+ return e.Header = "header", e.Child = "child", e;
625
689
  }({}), J = (e) => {
626
690
  let t = e.lastIndexOf("/");
627
691
  return t === -1 ? null : e.slice(0, t);
628
- }, Be = (e) => {
692
+ }, it = (e) => {
629
693
  let t = e.lastIndexOf("/");
630
694
  return t === -1 ? e : e.slice(t + 1);
631
- }, Ve = (e) => {
695
+ }, at = (e) => {
632
696
  let t = /* @__PURE__ */ new Map(), n = (e) => {
633
697
  let n = t.get(e);
634
698
  if (n) return n;
635
699
  let r = {
636
700
  path: e,
637
- name: Be(e),
638
- nodeType: he.FOLDER,
701
+ name: it(e),
702
+ nodeType: Oe.FOLDER,
639
703
  parentPath: J(e),
640
704
  folderId: e,
641
705
  items: []
642
706
  };
643
707
  return t.set(e, r), r;
644
708
  };
645
- for (let r of e) {
646
- if (r.kind === q.Folder) {
647
- n(r.path).name = r.name;
648
- continue;
649
- }
650
- t.set(r.path, {
651
- path: r.path,
652
- name: r.name,
653
- nodeType: he.ITEM,
654
- parentPath: J(r.path),
655
- folderId: J(r.path) ?? ""
656
- });
657
- }
709
+ for (let r of e) r.kind === q.Folder ? n(r.path).name = r.name : t.set(r.path, {
710
+ path: r.path,
711
+ name: r.name,
712
+ nodeType: Oe.ITEM,
713
+ parentPath: J(r.path),
714
+ folderId: J(r.path) ?? ""
715
+ });
658
716
  for (let t of [...e]) {
659
717
  let e = J(t.path);
660
718
  for (; e != null;) n(e), e = J(e);
@@ -669,44 +727,61 @@ var Re = {
669
727
  n ? n.items = [...n.items ?? [], e] : r.push(e);
670
728
  }
671
729
  return r;
672
- }, He = (e, t) => e ? `${e}/${t}` : t, Ue = (e) => J(e) ?? "", We = (e, t) => {
730
+ }, ot = (e, t) => e ? `${e}/${t}` : t, st = (e, t) => {
731
+ let n = e.lastIndexOf("/"), r = n === -1 ? "" : e.slice(0, n), i = e.slice(n + 1), a = i.lastIndexOf("."), o = a > 0, s = o ? i.slice(0, a) : i, c = o ? i.slice(a) : "", l = 1, u = ot(r, `${s} (${l})${c}`);
732
+ for (; t.has(u);) l += 1, u = ot(r, `${s} (${l})${c}`);
733
+ return u;
734
+ }, ct = (e, t) => {
673
735
  if (!t) return "";
674
736
  switch (e) {
675
- case ze.Child: return t.path;
676
- case ze.Sibling: return Ue(t.path);
677
- case ze.Header: return t.kind === q.Folder ? t.path : "";
678
- }
679
- }, Ge = (e, t) => {
680
- let n = t ? `${t}/` : "", r = /* @__PURE__ */ new Set();
681
- for (let { path: i } of e) {
682
- if (!i.startsWith(n) || i === t) continue;
683
- let e = i.slice(n.length);
684
- r.add(e.split("/")[0]);
737
+ case rt.Child: return t.path;
738
+ case rt.Header: return t.kind === q.Folder ? t.path : "";
685
739
  }
686
- return r;
687
- }, Ke = (e, t, n) => {
740
+ }, lt = (e, t) => new Set(dt(e, t).map((e) => e.name)), ut = (e, t, n) => {
688
741
  let r = e.trim();
689
742
  if (!r) return n.required;
690
743
  if (/[/\\]/.test(r) || r === "." || r === "..") return n.invalid;
691
744
  if (t.has(r)) return n.duplicate;
692
- }, qe = "\\new-folder", Je = ({ files: e, fileActions: t, defaultName: n, messages: r, onRevealFolder: i, onCreated: a }) => {
693
- 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 : {
745
+ }, dt = (e, t) => {
746
+ let n = t ? `${t}/` : "", r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
747
+ for (let a of e) {
748
+ if (!a.path.startsWith(n) || a.path === t) continue;
749
+ let e = a.path.slice(n.length), o = e.indexOf("/"), s = o === -1, c = s ? e : e.slice(0, o), l = `${n}${c}`, u = s && a.kind === q.File ? q.File : q.Folder;
750
+ if (r.has(l) || r.set(l, {
751
+ path: l,
752
+ name: c,
753
+ kind: u,
754
+ childCount: 0
755
+ }), !s) {
756
+ let t = o + 1, n = e.indexOf("/", t), r = e.slice(t, n === -1 ? void 0 : n);
757
+ i.set(l, (i.get(l) ?? /* @__PURE__ */ new Set()).add(r));
758
+ }
759
+ }
760
+ return [...r.values()].map((e) => ({
761
+ ...e,
762
+ childCount: i.get(e.path)?.size ?? 0
763
+ })).sort((e, t) => e.kind === t.kind ? e.name.localeCompare(t.name) : e.kind === q.Folder ? -1 : 1);
764
+ }, ft = (e) => {
765
+ let t = e.split("/").slice(0, -1);
766
+ return t.map((e, n) => t.slice(0, n + 1).join("/"));
767
+ }, pt = "\\new-folder", mt = ({ files: e, fileActions: t, defaultName: n, messages: r, onRevealFolder: i, onCreated: a }) => {
768
+ let [o, s] = V(null), c = o?.parentPath ?? null, l = B([]), u = c == null ? void 0 : ot(c, pt), d = z(() => u == null ? void 0 : {
694
769
  path: u,
695
770
  name: n,
696
771
  kind: q.Folder
697
- }, [u, n]), f = z((n, i) => {
698
- let a = Ge(e, i);
699
- return i === "" && a.add(K), Ke(n, a, r) ?? t.validateFolderPath?.(He(i, n.trim()));
772
+ }, [u, n]), f = R((n, i) => {
773
+ let a = lt(e, i);
774
+ return i === "" && a.add(K), ut(n, a, r) ?? t.validateFolderPath?.(ot(i, n.trim()));
700
775
  }, [
701
776
  e,
702
777
  r,
703
778
  t
704
- ]), p = z((e, t) => {
779
+ ]), p = R((e, t) => {
705
780
  l.current = [], s({
706
781
  parentPath: e,
707
782
  pane: t
708
783
  }), e !== "" && i(e);
709
- }, [i]), m = z((e, t) => {
784
+ }, [i]), m = R((e, t) => {
710
785
  if (c == null || t.path !== u) return null;
711
786
  let n = f(e, c);
712
787
  return l.current = [...l.current.slice(-1), {
@@ -717,23 +792,24 @@ var Re = {
717
792
  c,
718
793
  u,
719
794
  f
720
- ]), h = z(() => {
795
+ ]), h = R(() => {
721
796
  l.current = [], s(null);
722
- }, []), g = z((e) => {
797
+ }, []), g = R((e, n) => {
798
+ let r = ot(n, e.trim());
799
+ t.onCreateFolder?.(r), n !== "" && i(n), a(r);
800
+ }, [
801
+ t,
802
+ i,
803
+ a
804
+ ]), _ = R((e) => {
723
805
  if (c == null) return;
724
- let [n] = l.current;
725
- if (l.current.length === 2 && n != null && !n.isValid && n.value !== e || f(e, c) != null) {
726
- h();
727
- return;
728
- }
729
- let r = He(c, e.trim());
730
- h(), t.onCreateFolder?.(r), a(r);
806
+ let [t] = l.current;
807
+ l.current.length === 2 && t != null && !t.isValid && t.value !== e || f(e, c) != null ? h() : (h(), g(e, c));
731
808
  }, [
732
809
  c,
733
810
  f,
734
811
  h,
735
- t,
736
- a
812
+ g
737
813
  ]);
738
814
  return {
739
815
  draftNode: d,
@@ -741,711 +817,1007 @@ var Re = {
741
817
  draftPane: o?.pane,
742
818
  startDraft: p,
743
819
  handleValidate: m,
744
- handleSave: g,
745
- handleCancel: h
820
+ handleSave: _,
821
+ handleCancel: h,
822
+ validateNewFolder: f,
823
+ createFolder: g
746
824
  };
747
- }, Ye = (e) => !!e.dataTransfer?.types.includes("Files"), Xe = (e) => {
748
- let [t, n] = H(!1), r = V(0);
825
+ }, ht = (e) => !!e.dataTransfer?.types.includes("Files"), gt = (e) => {
826
+ let [t, n] = V(!1), r = B(0);
749
827
  return {
750
828
  isDragActive: t,
751
829
  dropZoneHandlers: {
752
- onDragEnter: z((e) => {
753
- Ye(e) && (e.preventDefault(), r.current += 1, n(!0));
830
+ onDragEnter: R((e) => {
831
+ ht(e) && (e.preventDefault(), r.current += 1, n(!0));
754
832
  }, []),
755
- onDragLeave: z((e) => {
756
- Ye(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
833
+ onDragLeave: R((e) => {
834
+ ht(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
757
835
  }, []),
758
- onDragOver: z((e) => {
759
- Ye(e) && e.preventDefault();
836
+ onDragOver: R((e) => {
837
+ ht(e) && e.preventDefault();
760
838
  }, []),
761
- onDrop: z((t) => {
762
- if (!Ye(t)) return;
839
+ onDrop: R((t) => {
840
+ if (!ht(t)) return;
763
841
  t.preventDefault(), r.current = 0, n(!1);
764
842
  let i = Array.from(t.dataTransfer?.files ?? []);
765
843
  i.length > 0 && e(i);
766
844
  }, [e])
767
845
  }
768
846
  };
769
- }, Ze = /* @__PURE__ */ function(e) {
847
+ }, _t = /* @__PURE__ */ function(e) {
770
848
  return e.Files = "files", e.Archive = "archive", e;
771
849
  }({}), Y = /* @__PURE__ */ function(e) {
772
850
  return e.Mobile = "mobile", e.Desktop = "desktop", e;
773
- }({}), Qe = (e, t, n = g.MD) => /* @__PURE__ */ F(e, {
851
+ }({}), vt = (e, t, n = b.MD, r) => /* @__PURE__ */ F(e, {
774
852
  size: n,
775
853
  className: t,
854
+ style: r,
776
855
  "aria-hidden": !0,
777
- stroke: _
778
- }), $e = ({ isVisible: e, labels: t }) => {
779
- if (!e) return null;
780
- let n = t ?? {};
781
- return /* @__PURE__ */ F("div", {
782
- role: "status",
783
- "aria-live": "polite",
784
- className: c("pointer-events-none absolute inset-0 z-[100] flex items-center justify-center backdrop-blur-sm"),
856
+ stroke: x
857
+ }), yt = { footer: "_footer_hn1ri_7" }, bt = ({ isOpen: e, title: t, closeAriaLabel: n, onClose: r, confirmLabel: i, onConfirm: a, cancelLabel: s, onCancel: l, isConfirmDisabled: u = !1, isConfirming: f = !1, children: p, colors: h }) => {
858
+ let _ = d(), y = f ? /* @__PURE__ */ F(fe, {
859
+ size: 16,
860
+ ariaLabel: ""
861
+ }) : void 0;
862
+ if (_) {
863
+ let d = o({
864
+ "--se-dialog-footer-bg": h?.footerBackground,
865
+ "--se-dialog-footer-border": h?.footerBorder
866
+ });
867
+ return /* @__PURE__ */ I(m, {
868
+ open: e,
869
+ title: t,
870
+ closeAriaLabel: n,
871
+ onClose: r,
872
+ children: [p, /* @__PURE__ */ I("div", {
873
+ className: c("sticky bottom-0 flex gap-3 border-t p-4", yt.footer),
874
+ style: d,
875
+ children: [/* @__PURE__ */ F(ce, {
876
+ className: "flex-1",
877
+ label: i,
878
+ iconBefore: y,
879
+ disabled: u,
880
+ onClick: a
881
+ }), /* @__PURE__ */ F(ae, {
882
+ className: "flex-1",
883
+ label: s,
884
+ onClick: l
885
+ })]
886
+ })]
887
+ });
888
+ }
889
+ return /* @__PURE__ */ F(N, {
890
+ open: e,
891
+ header: t,
892
+ size: se.Sm,
893
+ closeAriaLabel: n,
894
+ onClose: r,
895
+ mainButtons: [{
896
+ label: s,
897
+ variant: v.Primary,
898
+ appearance: g.Ghost,
899
+ onClick: l
900
+ }, {
901
+ label: i,
902
+ variant: v.Primary,
903
+ iconBefore: y,
904
+ onClick: a,
905
+ disabled: u
906
+ }],
907
+ children: p
908
+ });
909
+ }, xt = ({ isOpen: e, onClose: t, validateName: n, onCreate: r, title: i, nameLabel: a, namePlaceholder: o, createLabel: s, cancelLabel: c, closeAriaLabel: l, dialogColors: u }) => {
910
+ let d = De(), [f, p] = V(""), [m, h] = V(!1);
911
+ Ee(() => {
912
+ e && (p(""), h(!1));
913
+ }, [e]);
914
+ let g = m ? n(f) : void 0, _ = () => {
915
+ h(!0), n(f) ?? (r(f), t());
916
+ };
917
+ return /* @__PURE__ */ F(bt, {
918
+ isOpen: e,
919
+ title: i,
920
+ closeAriaLabel: l,
921
+ onClose: t,
922
+ confirmLabel: s,
923
+ onConfirm: _,
924
+ cancelLabel: c,
925
+ onCancel: t,
926
+ colors: u,
927
+ children: /* @__PURE__ */ F("form", {
928
+ className: "px-4 py-4 desktop:px-6",
929
+ onSubmit: (e) => {
930
+ e.preventDefault(), _();
931
+ },
932
+ children: /* @__PURE__ */ F(j, {
933
+ id: d,
934
+ labelProps: {
935
+ label: a,
936
+ htmlFor: d,
937
+ required: !0
938
+ },
939
+ value: f,
940
+ placeholder: o,
941
+ error: g,
942
+ invalid: g != null,
943
+ onChange: (e) => p(e ?? "")
944
+ })
945
+ })
946
+ });
947
+ }, St = { icon: "_icon_1p1f5_1" }, Ct = ({ isVisible: e, labels: t, titleClassName: n = "dial-h3-text", subtitleClassName: r = "dial-small-text" }) => {
948
+ let i = t ?? {}, a = i.dropOverlayTitle ?? "Upload files", o = i.dropOverlaySubtitle ?? "Drop files here to add them to this skill", s = /* @__PURE__ */ F(re, {
949
+ visuallyHidden: !0,
950
+ as: ie.Span,
951
+ children: e ? `${a}. ${o}` : ""
952
+ });
953
+ return e ? /* @__PURE__ */ I(P, { children: [s, /* @__PURE__ */ F("div", {
954
+ className: c("pointer-events-none absolute inset-0 z-100 flex items-center justify-center backdrop-blur-sm"),
785
955
  children: /* @__PURE__ */ I("div", {
956
+ "aria-hidden": !0,
786
957
  className: "flex flex-col items-center text-center",
787
958
  children: [
788
- /* @__PURE__ */ F(ue, {
959
+ /* @__PURE__ */ F(Se, {
789
960
  size: 100,
790
- className: "text-accent-primary",
961
+ className: St.icon,
791
962
  "aria-hidden": !0,
792
- stroke: _
963
+ stroke: x
793
964
  }),
794
965
  /* @__PURE__ */ F("span", {
795
- className: "dial-h3-text mt-5",
796
- children: n.dropOverlayTitle ?? "Upload files"
966
+ className: c("mt-5", n),
967
+ children: a
797
968
  }),
798
969
  /* @__PURE__ */ F("span", {
799
- className: "dial-small-text mt-4",
800
- children: n.dropOverlaySubtitle ?? "Drop files here to add them to this skill"
970
+ className: c("mt-4", r),
971
+ children: o
801
972
  })
802
973
  ]
803
974
  })
804
- });
805
- }, et = /* @__PURE__ */ function(e) {
975
+ })] }) : s;
976
+ }, wt = {
977
+ card: "_card_1tr87_2",
978
+ label: "_label_1tr87_7",
979
+ fileName: "_fileName_1tr87_11",
980
+ header: "_header_1tr87_16"
981
+ }, Tt = ({ label: e, fileName: t, isExpanded: n, onToggle: r, children: i, labelClassName: a = "dial-tiny-lead-text", fileNameClassName: o = "dial-small-text" }) => /* @__PURE__ */ F(p, {
982
+ expanded: n,
983
+ onToggle: r,
984
+ title: /* @__PURE__ */ F("span", {
985
+ className: c("block", wt.label, a),
986
+ children: e
987
+ }),
988
+ description: /* @__PURE__ */ F(k, {
989
+ name: t,
990
+ nameClassName: c(wt.fileName, o)
991
+ }),
992
+ className: c("rounded-lg border py-0 shadow-xs", wt.card),
993
+ headerClassName: c("gap-4 rounded-lg py-2 ps-3 pe-2 text-start [&>span]:flex-1 [&>span]:gap-1 [&>svg]:size-6", n ? "[&>svg]:-rotate-90" : "[&>svg]:rotate-90", wt.header),
994
+ contentClassName: "max-h-[416px] overflow-y-auto pt-4 pb-2 ps-3 pe-2",
995
+ children: i
996
+ }), Et = /* @__PURE__ */ function(e) {
806
997
  return e.SupportingFile = "supporting-file", e.Manifest = "manifest", e;
807
- }({}), tt = /* @__PURE__ */ function(e) {
998
+ }({}), Dt = /* @__PURE__ */ function(e) {
808
999
  return e.Valid = "valid", e.Invalid = "invalid", e;
809
- }({}), nt = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), rt = ".zip,application/zip", it = 0, X = () => `skill-file-candidate-${++it}`, Z = (e, t, n) => ({
810
- id: X(),
1000
+ }({}), X = /* @__PURE__ */ function(e) {
1001
+ return e.Replace = "replace", e.Duplicate = "duplicate", e;
1002
+ }({}), Z = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), Q = {
1003
+ invalidDropZone: "_invalidDropZone_j9j9q_1",
1004
+ row: "_row_j9j9q_5"
1005
+ }, $ = ".zip,application/zip", Ot = [], kt = 0, At = () => `skill-file-candidate-${++kt}`, jt = (e, t, n) => ({
1006
+ id: At(),
811
1007
  file: e,
812
- path: He(n, t.replace(/\\/g, "/"))
813
- }), at = ({ isOpen: e, onClose: t, fileActions: n, mode: r = Ze.Files, targetFolderPath: i = "", initialFiles: a, initialEntries: o, labels: c }) => {
814
- 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) => {
815
- T(void 0), d((t) => [...t, ...e]);
816
- }, oe = async (e) => {
1008
+ path: ot(n, t.replace(/\\/g, "/"))
1009
+ }), Mt = ({ isOpen: e, onClose: t, fileActions: n, mode: r = _t.Files, targetFolderPath: i = "", initialFiles: a, initialEntries: l, existingFilePaths: u = Ot, onCommitted: d, messageClassName: f = "dial-small-text", rowCaptionClassName: p, labels: m, dialogColors: h, colors: g }) => {
1010
+ let _ = m ?? {}, [v, b] = V([]), [S, C] = V([]), [w, T] = V(X.Replace), E = z(() => new Set(u), [u]), [A, j] = V(/* @__PURE__ */ new Map()), [te, ne] = V([]), [ae, oe] = V(!1), [N, se] = V(), [ce, ue] = V(!1), [de, pe] = V(), [me, he] = V(0), ge = B(0), L = r === _t.Archive, _e = _.uploadArchiveErrorMessage ?? "Couldn't read this archive", ve = De(), ye = De(), be = De(), Se = B(null), Ce = B(!1), we = S[0]?.id;
1011
+ Ee(() => {
1012
+ e && (we == null ? Ce.current && (Ce.current = !1, document.getElementById(ye)?.focus()) : (Ce.current = !0, Se.current?.focus()));
1013
+ }, [
1014
+ we,
1015
+ e,
1016
+ ye
1017
+ ]);
1018
+ let Te = (e) => e.path !== "SKILL.md" && E.has(e.path), R = (e) => {
1019
+ se(void 0), b((t) => [...t, ...e.filter((e) => !Te(e))]), C((t) => [...t, ...e.filter(Te)]);
1020
+ }, Oe = (e) => {
1021
+ let [t, ...n] = S;
1022
+ t && (C(n), T(X.Replace), e != null && (se(void 0), b((r) => {
1023
+ if (e === X.Replace) return [...r, {
1024
+ ...t,
1025
+ replacesExisting: !0
1026
+ }];
1027
+ let i = /* @__PURE__ */ new Set([
1028
+ ...u,
1029
+ ...r.map((e) => e.path),
1030
+ ...n.map((e) => e.path)
1031
+ ]);
1032
+ return [...r, {
1033
+ ...t,
1034
+ path: st(t.path, i)
1035
+ }];
1036
+ })));
1037
+ }, ke = async (e) => {
817
1038
  let { extractArchive: t } = n;
818
1039
  if (!t) return;
819
- let r = M.current;
820
- A(void 0), j((e) => e + 1);
1040
+ let r = ge.current;
1041
+ pe(void 0), he((e) => e + 1);
821
1042
  try {
822
1043
  let n = await Promise.all(e.map((e) => t(e)));
823
- if (r !== M.current) return;
1044
+ if (r !== ge.current) return;
824
1045
  let a = n.flat();
825
1046
  if (a.length === 0) {
826
- A(l.uploadArchiveEmptyMessage ?? "This archive has no files");
1047
+ pe(_.uploadArchiveEmptyMessage ?? "This archive has no files");
827
1048
  return;
828
1049
  }
829
- ae(a.map((e) => Z(e.file, e.path, i)));
1050
+ R(a.map((e) => jt(e.file, e.path, i)));
830
1051
  } catch {
831
- if (r !== M.current) return;
832
- A(L);
1052
+ if (r !== ge.current) return;
1053
+ pe(_e);
833
1054
  } finally {
834
- r === M.current && j((e) => e - 1);
835
- }
836
- }, se = (e) => {
837
- if (N) {
838
- oe(e);
839
- return;
1055
+ r === ge.current && he((e) => e - 1);
840
1056
  }
841
- ae(e.map((e) => Z(e, nt(e), i)));
842
- }, ce = (e) => {
843
- d((t) => t.filter((t) => t.id !== e));
1057
+ }, Ae = (e) => {
1058
+ L ? ke(e) : R(e.map((e) => jt(e, Z(e), i)));
1059
+ }, H = (e) => {
1060
+ b((t) => t.filter((t) => t.id !== e));
844
1061
  };
845
- pe(() => {
846
- e && (M.current += 1, d([...(a ?? []).map((e) => Z(e, nt(e), i)), ...(o ?? []).map((e) => Z(e.file, e.path, i))]), h(/* @__PURE__ */ new Map()), v([]), T(void 0), A(void 0), j(0));
847
- }, [e]), pe(() => {
1062
+ Ee(() => {
1063
+ if (!e) return;
1064
+ ge.current += 1;
1065
+ let t = [...(a ?? []).map((e) => jt(e, Z(e), i)), ...(l ?? []).map((e) => jt(e.file, e.path, i))];
1066
+ b(t.filter((e) => !Te(e))), C(t.filter(Te)), T(X.Replace), j(/* @__PURE__ */ new Map()), ne([]), se(void 0), pe(void 0), he(0);
1067
+ }, [e]), Ee(() => {
848
1068
  if (!e) return;
849
1069
  let t = !1;
850
- if (u.length === 0) {
851
- h(/* @__PURE__ */ new Map()), v([]);
852
- return;
853
- }
854
- return b(!0), n.validateBatch(u).then(({ results: e, batchErrors: n }) => {
855
- t || (h(new Map(e.map((e) => [e.candidateId, e]))), v(n.map((e) => e.message)));
1070
+ if (v.length === 0) j(/* @__PURE__ */ new Map()), ne([]);
1071
+ else return oe(!0), n.validateBatch(v).then(({ results: e, batchErrors: n }) => {
1072
+ t || (j(new Map(e.map((e) => [e.candidateId, e]))), ne(n.map((e) => e.message)));
856
1073
  }).finally(() => {
857
- t || b(!1);
1074
+ t || oe(!1);
858
1075
  }), () => {
859
1076
  t = !0;
860
1077
  };
861
- }, [u, e]);
862
- let ue = u.some((e) => p.get(e.id)?.status === tt.Invalid), de = u.length > 0 && u.every((e) => p.get(e.id)?.status === tt.Invalid), R = u.length > 0 && !ue && g.length === 0 && !y && !E && te === 0, fe = async () => {
863
- D(!0), T(void 0);
1078
+ }, [v, e]);
1079
+ let je = v.some((e) => A.get(e.id)?.status === Dt.Invalid), Me = v.length > 0 && v.every((e) => A.get(e.id)?.status === Dt.Invalid), Ne = [...te, ...v.flatMap((e) => {
1080
+ let t = A.get(e.id);
1081
+ return t?.status === Dt.Invalid && t.error ? [`${e.path}: ${t.error}`] : [];
1082
+ })], U = v.length > 0 && !je && te.length === 0 && !ae && !ce && me === 0, Pe = async () => {
1083
+ ue(!0), se(void 0);
864
1084
  try {
865
- let { results: e, batchErrors: r } = await n.validateBatch(u), i = new Map(e.map((e) => [e.candidateId, e]));
866
- if (h(i), v(r.map((e) => e.message)), u.some((e) => i.get(e.id)?.status === tt.Invalid) || r.length > 0) return;
867
- let a = await n.commitBatch(u);
1085
+ let { results: e, batchErrors: r } = await n.validateBatch(v), i = new Map(e.map((e) => [e.candidateId, e]));
1086
+ if (j(i), ne(r.map((e) => e.message)), v.some((e) => i.get(e.id)?.status === Dt.Invalid) || r.length > 0) return;
1087
+ let a = await n.commitBatch(v);
868
1088
  if (a.error) {
869
- T(a.error);
1089
+ se(a.error);
870
1090
  return;
871
1091
  }
872
- t();
1092
+ d?.(v), t();
873
1093
  } finally {
874
- D(!1);
1094
+ ue(!1);
875
1095
  }
876
- };
877
- return /* @__PURE__ */ F(k, {
878
- open: e,
879
- header: N ? l.uploadArchiveDialogTitle ?? "Upload archive from device" : l.uploadDialogTitle ?? "Upload files from device",
880
- size: ee.Sm,
881
- closeAriaLabel: l.uploadDialogCloseAriaLabel ?? "Close",
1096
+ }, Fe = _.uploadDialogCloseAriaLabel ?? "Close", Ie = _.uploadCancelLabel ?? "Cancel", [Le] = S;
1097
+ if (Le) {
1098
+ let t = _.uploadConflictTitle ?? "Replace or duplicate it?";
1099
+ return /* @__PURE__ */ F(bt, {
1100
+ isOpen: e,
1101
+ title: t,
1102
+ closeAriaLabel: Fe,
1103
+ onClose: () => Oe(null),
1104
+ confirmLabel: _.uploadConflictConfirmLabel ?? "Confirm",
1105
+ onConfirm: () => Oe(w),
1106
+ cancelLabel: Ie,
1107
+ onCancel: () => Oe(null),
1108
+ colors: h,
1109
+ children: /* @__PURE__ */ I("div", {
1110
+ className: "flex flex-col gap-4 px-4 py-4 desktop:px-6",
1111
+ children: [/* @__PURE__ */ F("p", {
1112
+ ref: Se,
1113
+ tabIndex: -1,
1114
+ className: c("outline-hidden", f),
1115
+ children: _.uploadConflictMessage?.(Le.path) ?? `Item with the same name "${Le.path}" already exists.`
1116
+ }), /* @__PURE__ */ F(le, {
1117
+ ariaLabel: t,
1118
+ value: w,
1119
+ onChange: (e) => T(e === X.Duplicate ? X.Duplicate : X.Replace),
1120
+ items: [{
1121
+ value: X.Replace,
1122
+ label: _.uploadConflictReplaceLabel ?? "Replace"
1123
+ }, {
1124
+ value: X.Duplicate,
1125
+ label: _.uploadConflictDuplicateLabel ?? "Duplicate"
1126
+ }]
1127
+ })]
1128
+ })
1129
+ });
1130
+ }
1131
+ return /* @__PURE__ */ F(bt, {
1132
+ isOpen: e,
1133
+ title: L ? _.uploadArchiveDialogTitle ?? "Upload archive from device" : _.uploadDialogTitle ?? "Upload files from device",
1134
+ closeAriaLabel: Fe,
882
1135
  onClose: t,
883
- mainButtons: [{
884
- label: l.uploadCancelLabel ?? "Cancel",
885
- variant: m.Primary,
886
- appearance: f.Ghost,
887
- onClick: t
888
- }, {
889
- label: l.uploadConfirmLabel ?? "Add",
890
- variant: m.Primary,
891
- iconBefore: E ? /* @__PURE__ */ F(ne, {
892
- size: 16,
893
- ariaLabel: ""
894
- }) : void 0,
895
- onClick: () => void fe(),
896
- disabled: !R
897
- }],
1136
+ confirmLabel: _.uploadConfirmLabel ?? "Add",
1137
+ onConfirm: () => void Pe(),
1138
+ isConfirmDisabled: !U,
1139
+ isConfirming: ce,
1140
+ cancelLabel: Ie,
1141
+ onCancel: t,
1142
+ colors: h,
898
1143
  children: /* @__PURE__ */ I("div", {
899
- className: "flex flex-col gap-4 px-6 py-4",
1144
+ className: "flex flex-col gap-4 px-4 py-4 desktop:px-6",
1145
+ style: o({
1146
+ "--se-upload-invalid-dropzone-border": g?.invalidDropZoneBorder,
1147
+ "--se-upload-row-border": g?.rowBorder
1148
+ }),
900
1149
  children: [
901
- /* @__PURE__ */ F(S, {
1150
+ /* @__PURE__ */ F(O, {
902
1151
  label: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("span", {
903
1152
  className: "desktop:hidden",
904
- children: N ? l.uploadArchiveDropZoneMobileLabel ?? "Click here to upload a .zip archive" : l.uploadDropZoneMobileLabel ?? "Click here to upload"
1153
+ children: L ? _.uploadArchiveDropZoneMobileLabel ?? "Click here to upload a .zip archive" : _.uploadDropZoneMobileLabel ?? "Click here to upload"
905
1154
  }), /* @__PURE__ */ F("span", {
906
1155
  className: "hidden desktop:inline",
907
- 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"
1156
+ children: L ? _.uploadArchiveDropZoneLabel ?? "Drag and drop a .zip archive or click here to upload" : _.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
908
1157
  })] }),
909
- ariaLabel: l.uploadDropZoneAriaLabel ?? "Upload files",
1158
+ description: L ? _.uploadArchiveDropZoneDescription : _.uploadDropZoneDescription,
1159
+ id: ye,
1160
+ ariaLabel: _.uploadDropZoneAriaLabel ?? "Upload files",
910
1161
  multiple: !0,
911
- accept: N ? rt : void 0,
912
- className: de ? "border-error hover:border-error" : void 0,
913
- onChange: se,
914
- onReject: N ? () => A(L) : void 0
1162
+ accept: L ? $ : void 0,
1163
+ className: Me ? Q.invalidDropZone : void 0,
1164
+ onChange: Ae,
1165
+ onReject: L ? () => pe(_e) : void 0
915
1166
  }),
916
- te > 0 && /* @__PURE__ */ F(ne, { ariaLabel: l.uploadArchiveExtractingAriaLabel ?? "Reading archive" }),
917
- /* @__PURE__ */ F("div", {
918
- role: "alert",
919
- children: O && /* @__PURE__ */ F(x, { text: O })
1167
+ me > 0 && /* @__PURE__ */ F(fe, { ariaLabel: _.uploadArchiveExtractingAriaLabel ?? "Reading archive" }),
1168
+ /* @__PURE__ */ F(D, {
1169
+ text: de,
1170
+ announce: M.Assertive
920
1171
  }),
921
- /* @__PURE__ */ F("span", {
922
- role: "status",
923
- "aria-live": "polite",
924
- className: "sr-only",
925
- id: re,
926
- children: g.map((e) => `${l.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
1172
+ /* @__PURE__ */ F(re, {
1173
+ visuallyHidden: !0,
1174
+ as: ie.Span,
1175
+ id: ve,
1176
+ children: Ne.map((e) => `${_.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
927
1177
  }),
928
- g.map((e) => /* @__PURE__ */ F(x, { text: e }, e)),
929
- u.length > 0 && /* @__PURE__ */ F("ul", {
1178
+ te.map((e) => /* @__PURE__ */ F(D, { text: e }, e)),
1179
+ v.length > 0 && /* @__PURE__ */ F("ul", {
930
1180
  className: "flex flex-col gap-2",
931
- children: u.map((e) => {
932
- let t = p.get(e.id), n = t?.kind === et.Manifest, r = t?.status === tt.Invalid;
1181
+ children: v.map((e) => {
1182
+ let t = A.get(e.id), n = t?.kind === Et.Manifest, r = t?.status === Dt.Invalid, i = r ? t?.error : void 0, a = `${be}${e.id}`;
933
1183
  return /* @__PURE__ */ I("li", {
934
- className: "flex items-center gap-2 rounded-lg border border-tertiary p-2",
935
- children: [
936
- /* @__PURE__ */ F(ie, {
937
- size: 20,
1184
+ className: c("flex items-center gap-2 rounded-lg border p-2", Q.row),
1185
+ children: [/* @__PURE__ */ F(k, {
1186
+ name: e.path,
1187
+ className: "min-w-0 flex-1",
1188
+ details: /* @__PURE__ */ I(P, { children: [
1189
+ /* @__PURE__ */ F(y, {
1190
+ className: p,
1191
+ text: s(e.file.size)
1192
+ }),
1193
+ /* @__PURE__ */ F(D, {
1194
+ id: a,
1195
+ text: i
1196
+ }),
1197
+ n && !r && /* @__PURE__ */ F(y, {
1198
+ className: p,
1199
+ text: _.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
1200
+ }),
1201
+ e.replacesExisting && !r && /* @__PURE__ */ F(y, {
1202
+ className: p,
1203
+ text: _.uploadReplaceRowNote ?? "Will replace the existing file"
1204
+ })
1205
+ ] })
1206
+ }), /* @__PURE__ */ F(ee, {
1207
+ icon: /* @__PURE__ */ F(xe, {
1208
+ size: 16,
938
1209
  "aria-hidden": !0,
939
- stroke: _
940
- }),
941
- /* @__PURE__ */ I("div", {
942
- className: "flex min-w-0 flex-1 flex-col",
943
- children: [
944
- /* @__PURE__ */ F("span", {
945
- className: "dial-small-text truncate",
946
- children: e.path
947
- }),
948
- /* @__PURE__ */ F("span", {
949
- className: "dial-tiny-text text-secondary",
950
- children: s(e.file.size)
951
- }),
952
- r && t?.error && /* @__PURE__ */ F(x, { text: t.error }),
953
- n && !r && /* @__PURE__ */ F("span", {
954
- className: "dial-tiny-text text-secondary",
955
- children: l.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
956
- })
957
- ]
1210
+ stroke: x
958
1211
  }),
959
- /* @__PURE__ */ F(w, {
960
- icon: /* @__PURE__ */ F(le, {
961
- size: 16,
962
- "aria-hidden": !0,
963
- stroke: _
964
- }),
965
- "aria-label": l.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
966
- onClick: () => ce(e.id)
967
- })
968
- ]
1212
+ "aria-label": _.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
1213
+ "aria-describedby": i ? a : void 0,
1214
+ onClick: () => H(e.id)
1215
+ })]
969
1216
  }, e.id);
970
1217
  })
971
1218
  }),
972
- C && /* @__PURE__ */ F(x, { text: C })
1219
+ /* @__PURE__ */ F(D, {
1220
+ text: N,
1221
+ announce: M.Assertive
1222
+ })
973
1223
  ]
974
1224
  })
975
1225
  });
976
- }, ot = {
977
- title: "_title_5md1a_1",
978
- helperText: "_helperText_5md1a_5",
979
- refineFeedback: "_refineFeedback_5md1a_9",
980
- refineError: "_refineError_5md1a_13"
981
- }, st = {
982
- mode: Ze.Files,
1226
+ }, Nt = {
1227
+ list: "_list_1hpyi_1",
1228
+ row: "_row_1hpyi_5",
1229
+ count: "_count_1hpyi_14"
1230
+ }, Pt = (e) => e === 1 ? "1 item" : `${e} items`, Ft = ({ folderPath: e, entries: t, onOpen: n, rootLabel: r = "Skill", breadcrumbAriaLabel: i = "Folder path", overflowAriaLabel: a = "Show hidden path segments", listAriaLabel: o = "Folder content", emptyTitle: s = "This folder is empty", emptyDescription: l = "Use Add to upload files or create a subfolder.", itemCountLabel: u = Pt, itemCountClassName: d = "dial-tiny-text" }) => {
1231
+ let f = e.split("/"), p = [{
1232
+ label: r,
1233
+ onClick: () => n("", q.Folder)
1234
+ }, ...f.map((e, t) => {
1235
+ let r = f.slice(0, t + 1).join("/");
1236
+ return t === f.length - 1 ? { label: e } : {
1237
+ label: e,
1238
+ onClick: () => n(r, q.Folder)
1239
+ };
1240
+ })];
1241
+ return /* @__PURE__ */ I("div", {
1242
+ className: "flex min-h-0 flex-1 flex-col gap-4",
1243
+ children: [/* @__PURE__ */ F(h, {
1244
+ items: p,
1245
+ ariaLabel: i,
1246
+ overflowAriaLabel: a
1247
+ }), t.length === 0 ? /* @__PURE__ */ F(oe, {
1248
+ title: s,
1249
+ description: l,
1250
+ live: !0
1251
+ }) : /* @__PURE__ */ F("ul", {
1252
+ "aria-label": o,
1253
+ className: c("m-0 flex list-none flex-col overflow-hidden rounded-lg border p-0", Nt.list),
1254
+ children: t.map((e) => {
1255
+ let t = e.kind === q.Folder;
1256
+ return /* @__PURE__ */ F("li", {
1257
+ className: "m-0 p-0",
1258
+ children: /* @__PURE__ */ I("button", {
1259
+ type: "button",
1260
+ onClick: () => n(e.path, e.kind),
1261
+ className: c("flex w-full cursor-pointer items-center justify-between gap-4 border-b bg-transparent px-3 py-2 text-start last:border-b-0", Nt.row),
1262
+ children: [/* @__PURE__ */ F(k, {
1263
+ name: e.name,
1264
+ type: t ? C.Folder : C.File,
1265
+ className: "min-w-0 flex-1"
1266
+ }), t && /* @__PURE__ */ F("span", {
1267
+ className: c("shrink-0", Nt.count, d),
1268
+ children: u(e.childCount)
1269
+ })]
1270
+ })
1271
+ }, e.path);
1272
+ })
1273
+ })]
1274
+ });
1275
+ }, It = {
1276
+ title: "_title_lgmx6_1",
1277
+ helperText: "_helperText_lgmx6_5",
1278
+ refineFeedback: "_refineFeedback_lgmx6_9",
1279
+ refineError: "_refineError_lgmx6_13",
1280
+ menuIcon: "_menuIcon_lgmx6_17"
1281
+ }, Lt = {
1282
+ mode: _t.Files,
983
1283
  targetFolderPath: ""
984
- }, ct = [U.Name, U.Description], lt = 24, ut = 300, dt = "desktop:px-8 desktop:py-6", ft = "desktop:px-8 desktop:py-6", pt = "gap-4 px-4 py-6 desktop:gap-5 desktop:px-8 desktop:py-6", mt = R(async () => {
985
- let { MarkdownEditor: e } = await _e();
1284
+ }, Rt = [W.Name, W.Description], zt = 24, Bt = 300, Vt = "pb-0 desktop:px-8 desktop:py-6", Ht = "desktop:px-8 desktop:py-6", Ut = "gap-4 px-4 pt-5 pb-6 desktop:gap-5 desktop:px-8 desktop:py-6", Wt = we(async () => {
1285
+ let { MarkdownEditor: e } = await Ae();
986
1286
  return { default: e };
987
- }), ht = ({ initialValues: r, files: i, selectedPath: s, onSelectedPathChange: _, expandedPaths: v, onExpandedPathsChange: S, 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, asideData: _e, onSubmit: ve, onCancel: ye, onBack: be, backAriaLabel: xe, title: Se, onRetry: Ce, onRetrySubmit: we, labels: Te, styles: U, dir: Ee, instructionsEditorTheme: De = y.light }) => {
988
- let [W, Oe] = H({
1287
+ }), Gt = ({ initialValues: r, files: i, selectedPath: s, onSelectedPathChange: d, expandedPaths: p, onExpandedPathsChange: m, isLoading: h = !1, hasLoadError: S = !1, isSubmitting: C = !1, errors: O, submitError: k, conflict: j, onReloadLatest: ne, isNameReadOnly: re = !1, onDirtyChange: ie, onValuesChange: M, onRefineDescription: ae, onRefineInstructions: oe, fileActions: N, supportingFileContent: se, asideData: le, onSubmit: ue, onCancel: de, onBack: pe, backAriaLabel: me, title: he, onRetry: ge, onRetrySubmit: ye, labels: be, styles: we, dir: Te, instructionsEditorTheme: Ae = w.light }) => {
1288
+ let [H, je] = V({
989
1289
  name: r?.name ?? "",
990
1290
  description: r?.description ?? "",
991
1291
  instructions: r?.instructions ?? ""
992
- }), ke = me(), G = V(void 0), Ae = l({
993
- bottomGap: lt,
994
- minHeight: ut
995
- }), je = V(W), Me = (e) => {
1292
+ }), Me = De(), Ne = De();
1293
+ u(() => document.getElementById(Me), Ne, !!O?.instructions);
1294
+ let U = B(void 0), Pe = l({
1295
+ bottomGap: zt,
1296
+ minHeight: Bt
1297
+ }), Fe = B(H), Ie = (e) => {
996
1298
  let t = {
997
- ...je.current,
1299
+ ...Fe.current,
998
1300
  ...e
999
1301
  };
1000
- je.current = t, Oe(t), L?.(t);
1001
- }, Fe = (e) => e ? async (t, n) => {
1002
- if (G.current && !G.current.aborted) throw new DOMException("Busy", "AbortError");
1003
- G.current = n;
1302
+ Fe.current = t, je(t), M?.(t);
1303
+ }, Le = (e) => e ? async (t, n) => {
1304
+ if (U.current && !U.current.aborted) throw new DOMException("Busy", "AbortError");
1305
+ U.current = n;
1004
1306
  try {
1005
1307
  return await e(t, n);
1006
1308
  } finally {
1007
- G.current === n && (G.current = void 0);
1309
+ U.current === n && (U.current = void 0);
1008
1310
  }
1009
- } : void 0, Le = u({
1010
- value: W.description,
1011
- onChange: (e) => Me({ description: e }),
1012
- onRefine: Fe(ie),
1013
- disabled: O || T || D,
1311
+ } : void 0, Re = f({
1312
+ value: H.description,
1313
+ onChange: (e) => Ie({ description: e }),
1314
+ onRefine: Le(ae),
1315
+ disabled: C || h || S,
1014
1316
  resetKey: r
1015
- }), J = u({
1016
- value: W.instructions,
1017
- onChange: (e) => Me({ instructions: e }),
1018
- onRefine: Fe(se),
1019
- disabled: O || T || D,
1317
+ }), W = f({
1318
+ value: H.instructions,
1319
+ onChange: (e) => Ie({ instructions: e }),
1320
+ onRefine: Le(oe),
1321
+ disabled: C || h || S,
1020
1322
  resetKey: r
1021
- }), Be = Le.isPending || J.isPending, He = () => {
1022
- Le.reset(), J.reset();
1323
+ }), ze = Re.isPending || W.isPending, Be = () => {
1324
+ Re.reset(), W.reset();
1325
+ }, Ve = () => {
1326
+ Be(), de();
1327
+ }, He = () => {
1328
+ Be(), pe();
1023
1329
  }, Ue = () => {
1024
- He(), ye();
1025
- }, Ge = () => {
1026
- He(), be();
1027
- }, Ke = () => {
1028
- O || T || D || G.current && !G.current.aborted || ve(W);
1029
- }, qe = V(r), Ye = qe.current !== r, et = V(i);
1030
- pe(() => {
1031
- qe.current = r;
1330
+ C || h || S || U.current && !U.current.aborted || ue(H);
1331
+ }, We = B(r), Ge = We.current !== r, Ke = B(i), [qe, Je] = V(!1);
1332
+ Ee(() => {
1333
+ We.current = r;
1032
1334
  let e = {
1033
1335
  name: r?.name ?? "",
1034
1336
  description: r?.description ?? "",
1035
1337
  instructions: r?.instructions ?? ""
1036
1338
  };
1037
- je.current = e, Oe(e), et.current = i;
1339
+ Fe.current = e, je(e), Ke.current = i, Je(!1);
1038
1340
  }, [r]);
1039
- let tt = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), nt = V(!1);
1040
- pe(() => {
1041
- if (Ye) return;
1341
+ let Ye = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), Xe = B(!1);
1342
+ Ee(() => {
1343
+ if (Ge) return;
1042
1344
  let e = {
1043
1345
  name: r?.name ?? "",
1044
1346
  description: r?.description ?? "",
1045
1347
  instructions: r?.instructions ?? ""
1046
- }, t = JSON.stringify(W) !== JSON.stringify(e) || tt(i) !== tt(et.current);
1047
- t !== nt.current && (nt.current = t, N?.(t));
1348
+ }, t = JSON.stringify(H) !== JSON.stringify(e) || Ye(i) !== Ye(Ke.current) || qe;
1349
+ t !== Xe.current && (Xe.current = t, ie?.(t));
1048
1350
  }, [
1049
- W,
1351
+ H,
1050
1352
  i,
1051
1353
  r,
1052
- Ye,
1053
- N
1354
+ Ge,
1355
+ qe,
1356
+ ie
1054
1357
  ]);
1055
- let [rt, it] = H(K), X = s ?? rt, Z = z((e) => {
1056
- it(e), _?.(e);
1057
- }, [_]), [ht, gt] = H([]), _t = v ?? ht, vt = B(() => new Set(_t), [_t]), yt = z((e) => {
1358
+ let [Ze, et] = V(K), G = s ?? Ze, J = R((e) => {
1359
+ et(e), d?.(e);
1360
+ }, [d]), [it, ot] = V([]), st = p ?? it, lt = z(() => new Set(st), [st]), ut = R((e) => {
1058
1361
  let t = [...e];
1059
- gt(t), S?.(t);
1060
- }, [S]), [bt, xt] = H(!1), [St, Ct] = H(st), wt = z((e) => {
1061
- Ct(e), xt(!0);
1062
- }, []), [Tt, Et] = H(!1), { isDragActive: Dt, dropZoneHandlers: Ot } = Xe(z((e) => {
1063
- bt || wt({
1064
- ...st,
1362
+ ot(t), m?.(t);
1363
+ }, [m]), [pt, ht] = V(!1), [yt, bt] = V(Lt), St = R((e) => {
1364
+ bt(e), ht(!0);
1365
+ }, []), [wt, Et] = V(!1), { isDragActive: Dt, dropZoneHandlers: X } = gt(R((e) => {
1366
+ pt || St({
1367
+ ...Lt,
1065
1368
  initialFiles: e
1066
1369
  });
1067
- }, [bt, wt])), Q = Te ?? {}, $ = U?.colors, kt = U?.typography ?? {}, At = kt.titleClassName ?? "dial-body-semi-text", jt = kt.helperTextClassName ?? "dial-tiny-semi-text", Mt = kt.removeIconClassName, Nt = kt.menuIconClassName ?? "text-secondary", Pt = o({
1068
- "--se-title-color": $?.title,
1069
- "--se-helper-text-color": $?.helperText,
1070
- "--se-refine-action-text": $?.refineActionText,
1071
- "--se-refine-error-text": $?.refineErrorText
1072
- }), Ft = {
1073
- feedbackClassName: c($?.refineActionText && ot.refineFeedback, kt.refineFeedbackClassName, Re.refineFeedback),
1074
- errorClassName: ot.refineError
1075
- }, It = {
1076
- layout: $?.border ? { colors: {
1077
- headerBorderColor: $.border,
1078
- sidebarBorderColor: $.border
1370
+ }, [pt, St])), Z = be ?? {}, Q = we?.colors, $ = we?.typography ?? {}, Ot = $.titleClassName ?? "dial-body-semi-text", kt = $.helperTextClassName ?? "dial-tiny-semi-text", At = $.removeIconClassName, jt = z(() => o({ "--se-menu-icon": Q?.menuIcon }), [Q?.menuIcon]), Nt = o({
1371
+ "--se-title-color": Q?.title,
1372
+ "--se-helper-text-color": Q?.helperText,
1373
+ "--se-refine-action-text": Q?.refineActionText,
1374
+ "--se-refine-error-text": Q?.refineErrorText,
1375
+ "--se-files-card-bg": Q?.filesCardBackground,
1376
+ "--se-files-card-border": Q?.filesCardBorder,
1377
+ "--se-folder-row-border": Q?.folderRowBorder,
1378
+ "--se-folder-row-hover-bg": Q?.folderRowHoverBackground,
1379
+ "--se-drop-overlay-icon": Q?.dropOverlayIcon
1380
+ }), Pt = {
1381
+ footerBackground: Q?.dialogFooterBackground,
1382
+ footerBorder: Q?.dialogFooterBorder
1383
+ }, Gt = {
1384
+ feedbackClassName: c(Q?.refineActionText && It.refineFeedback, $.refineFeedbackClassName, nt.refineFeedback),
1385
+ errorClassName: It.refineError
1386
+ }, Kt = {
1387
+ layout: Q?.border ? { colors: {
1388
+ headerBorderColor: Q.border,
1389
+ sidebarBorderColor: Q.border
1079
1390
  } } : void 0,
1080
- section: $?.title ? { colors: { titleColor: $.title } } : void 0
1081
- }, Lt = B(() => ({
1082
- required: Q.folderNameRequiredError ?? "Enter a folder name",
1083
- invalid: Q.folderNameInvalidError ?? "Folder name can't contain / or \\, or be . or ..",
1084
- duplicate: Q.folderNameDuplicateError ?? "An item with this name already exists here"
1391
+ section: Q?.title ? { colors: { titleColor: Q.title } } : void 0
1392
+ }, qt = z(() => ({
1393
+ required: Z.folderNameRequiredError ?? "Enter a folder name",
1394
+ invalid: Z.folderNameInvalidError ?? "Folder name can't contain / or \\, or be . or ..",
1395
+ duplicate: Z.folderNameDuplicateError ?? "An item with this name already exists here"
1396
+ }), [
1397
+ Z.folderNameRequiredError,
1398
+ Z.folderNameInvalidError,
1399
+ Z.folderNameDuplicateError
1400
+ ]), Jt = R((e) => {
1401
+ lt.has(e) || ut(/* @__PURE__ */ new Set([...lt, e]));
1402
+ }, [lt, ut]), Yt = yt.targetFolderPath, Xt = z(() => ({
1403
+ ...N,
1404
+ commitBatch: async (e) => {
1405
+ let t = await N.commitBatch(e);
1406
+ return !t.error && Yt !== "" && Jt(Yt), t;
1407
+ }
1085
1408
  }), [
1086
- Q.folderNameRequiredError,
1087
- Q.folderNameInvalidError,
1088
- Q.folderNameDuplicateError
1089
- ]), Rt = z((e) => {
1090
- vt.has(e) || yt(new Set([...vt, e]));
1091
- }, [vt, yt]), zt = Je({
1409
+ N,
1410
+ Yt,
1411
+ Jt
1412
+ ]), Zt = mt({
1092
1413
  files: i,
1093
- fileActions: R,
1094
- defaultName: Q.newFolderDefaultName ?? "New folder",
1095
- messages: Lt,
1096
- onRevealFolder: Rt,
1097
- onCreated: Z
1098
- }), { draftNode: Bt, draftPath: Vt, draftPane: Ht } = zt, Ut = B(() => Ve([{
1414
+ fileActions: N,
1415
+ defaultName: Z.newFolderDefaultName ?? "New folder",
1416
+ messages: qt,
1417
+ onRevealFolder: Jt,
1418
+ onCreated: J
1419
+ }), { draftNode: Qt, draftPath: $t, draftPane: en } = Zt, tn = z(() => at([{
1099
1420
  path: K,
1100
1421
  name: K,
1101
1422
  kind: q.File
1102
- }, ...i]), [i]), Wt = B(() => Bt ? Ve([
1423
+ }, ...i]), [i]), nn = z(() => Qt ? at([
1103
1424
  {
1104
1425
  path: K,
1105
1426
  name: K,
1106
1427
  kind: q.File
1107
1428
  },
1108
1429
  ...i,
1109
- Bt
1110
- ]) : Ut, [
1430
+ Qt
1431
+ ]) : tn, [
1111
1432
  i,
1112
- Bt,
1113
- Ut
1114
- ]), Gt = B(() => i.find((e) => e.path === X), [i, X]), Kt = z((e) => {
1115
- e.path !== Vt && Z(e.path);
1116
- }, [Z, Vt]), qt = z((e) => {
1117
- R.onRemoveNode(e), X === e && Z(K);
1433
+ Qt,
1434
+ tn
1435
+ ]), rn = z(() => i.find((e) => e.path === G), [i, G]), an = z(() => dt(i, G), [i, G]), on = rn?.kind === q.Folder || an.length > 0, sn = R((e) => {
1436
+ e.path !== $t && J(e.path);
1437
+ }, [J, $t]), cn = R((e, t) => {
1438
+ if (e === "") {
1439
+ J(K);
1440
+ return;
1441
+ }
1442
+ let n = [...ft(e), ...t === q.Folder ? [e] : []].filter((e) => !lt.has(e));
1443
+ n.length > 0 && ut(/* @__PURE__ */ new Set([...lt, ...n])), J(e);
1118
1444
  }, [
1119
- R,
1120
- X,
1121
- Z
1122
- ]), { startDraft: Jt } = zt, { onCreateFolder: Yt, extractArchive: Xt, pickFromFileSystem: Zt } = R, Qt = z(async (e) => {
1123
- if (!Zt) return;
1124
- let t = await Zt();
1125
- t?.length && wt({
1126
- mode: Ze.Files,
1445
+ lt,
1446
+ ut,
1447
+ J
1448
+ ]), ln = R((e) => {
1449
+ N.onRemoveNode(e), (G === e || G.startsWith(`${e}/`)) && J(K);
1450
+ }, [
1451
+ N,
1452
+ G,
1453
+ J
1454
+ ]), { startDraft: un } = Zt, { onCreateFolder: dn, extractArchive: fn, pickFromFileSystem: pn } = N, [mn, hn] = V(null), gn = R((e, t) => {
1455
+ t === Y.Mobile ? hn(e) : un(e, t);
1456
+ }, [un]), _n = z(() => i.filter((e) => e.kind === q.File).map((e) => e.path), [i]), vn = R(async (e) => {
1457
+ if (!pn) return;
1458
+ let t = await pn();
1459
+ t?.length && St({
1460
+ mode: _t.Files,
1127
1461
  targetFolderPath: e,
1128
1462
  initialEntries: t
1129
1463
  });
1130
- }, [Zt, wt]), $t = z((e, t) => {
1131
- let n = (e) => Qe(e, Nt), r = [];
1132
- return Yt && r.push({
1464
+ }, [pn, St]), yn = R((e, t) => {
1465
+ let n = (e) => vt(e, It.menuIcon, void 0, jt), r = [];
1466
+ return dn && r.push({
1133
1467
  key: "create-folder",
1134
- label: Q.createFolderLabel ?? "Create folder",
1135
- icon: n(oe),
1136
- onClick: () => Jt(e, t)
1468
+ label: Z.createFolderLabel ?? "Create folder",
1469
+ icon: n(ve),
1470
+ onClick: () => gn(e, t)
1137
1471
  }), r.push({
1138
1472
  key: "upload-files",
1139
- label: Q.uploadFilesLabel ?? "Upload files from device",
1140
- icon: n(ue),
1141
- onClick: () => wt({
1142
- mode: Ze.Files,
1473
+ label: Z.uploadFilesLabel ?? "Upload files from device",
1474
+ icon: n(Se),
1475
+ onClick: () => St({
1476
+ mode: _t.Files,
1143
1477
  targetFolderPath: e
1144
1478
  })
1145
- }), Xt && r.push({
1479
+ }), fn && r.push({
1146
1480
  key: "upload-archive",
1147
- label: Q.uploadArchiveLabel ?? "Upload archive from device",
1148
- icon: n(ae),
1149
- onClick: () => wt({
1150
- mode: Ze.Archive,
1481
+ label: Z.uploadArchiveLabel ?? "Upload archive from device",
1482
+ icon: n(_e),
1483
+ onClick: () => St({
1484
+ mode: _t.Archive,
1151
1485
  targetFolderPath: e
1152
1486
  })
1153
- }), Zt && r.push({
1487
+ }), pn && r.push({
1154
1488
  key: "open-file-system",
1155
- label: Q.openFileSystemLabel ?? "Open DIAL file system",
1156
- icon: n(re),
1157
- onClick: () => void Qt(e)
1489
+ label: Z.openFileSystemLabel ?? "Open DIAL file system",
1490
+ icon: n(L),
1491
+ onClick: () => void vn(e)
1158
1492
  }), r;
1159
1493
  }, [
1160
- Nt,
1161
- Yt,
1162
- Xt,
1163
- Zt,
1164
- Q.createFolderLabel,
1165
- Q.uploadFilesLabel,
1166
- Q.uploadArchiveLabel,
1167
- Q.openFileSystemLabel,
1168
- Jt,
1169
- wt,
1170
- Qt
1171
- ]), en = B(() => {
1172
- let e = We(ze.Header, i.find((e) => e.path === X));
1494
+ jt,
1495
+ dn,
1496
+ fn,
1497
+ pn,
1498
+ Z.createFolderLabel,
1499
+ Z.uploadFilesLabel,
1500
+ Z.uploadArchiveLabel,
1501
+ Z.openFileSystemLabel,
1502
+ gn,
1503
+ St,
1504
+ vn
1505
+ ]), bn = z(() => {
1506
+ let e = ct(rt.Header, i.find((e) => e.path === G));
1173
1507
  return {
1174
- [Y.Mobile]: $t(e, Y.Mobile),
1175
- [Y.Desktop]: $t(e, Y.Desktop)
1508
+ [Y.Mobile]: yn(e, Y.Mobile),
1509
+ [Y.Desktop]: yn(e, Y.Desktop)
1176
1510
  };
1177
1511
  }, [
1178
- $t,
1512
+ yn,
1179
1513
  i,
1180
- X
1181
- ]), tn = z((e, t) => {
1182
- if (e.path === Vt || e.nodeType !== he.FOLDER) return [];
1514
+ G
1515
+ ]), xn = R((e, t) => {
1516
+ if (e.path === $t || e.nodeType !== Oe.FOLDER) return [];
1183
1517
  let n = {
1184
1518
  path: e.path,
1185
1519
  name: e.name,
1186
1520
  kind: q.Folder
1187
- }, r = $t(We(ze.Child, n), t);
1521
+ }, r = yn(ct(rt.Child, n), t);
1188
1522
  return r.push({
1189
- key: "add-sibling",
1190
- icon: Qe(ce),
1191
- label: Q.addSiblingLabel ?? "Add sibling",
1192
- children: $t(We(ze.Sibling, n), t)
1193
- }, {
1194
1523
  key: "delete",
1195
- label: Q.deleteLabel ?? "Delete",
1524
+ label: Z.deleteLabel ?? "Delete",
1196
1525
  danger: !0,
1197
- icon: Qe(le, Mt),
1198
- onClick: () => qt(e.path)
1526
+ icon: vt(xe, At),
1527
+ onClick: () => ln(e.path)
1199
1528
  }), r;
1200
1529
  }, [
1201
- Vt,
1202
- Q.addSiblingLabel,
1203
- Q.deleteLabel,
1204
- Mt,
1205
1530
  $t,
1206
- qt
1207
- ]), nn = B(() => ({
1208
- [Y.Mobile]: (e) => tn(e, Y.Mobile),
1209
- [Y.Desktop]: (e) => tn(e, Y.Desktop)
1210
- }), [tn]), rn = z((e) => e.nodeType === he.FOLDER || e.path === "SKILL.md" ? null : /* @__PURE__ */ F(w, {
1211
- size: b.Small,
1212
- icon: Qe(le, Mt, g.SM),
1213
- "aria-label": Q.deleteLabel ?? "Delete",
1214
- onClick: () => qt(e.path)
1531
+ Z.deleteLabel,
1532
+ At,
1533
+ yn,
1534
+ ln
1535
+ ]), Sn = z(() => ({
1536
+ [Y.Mobile]: (e) => xn(e, Y.Mobile),
1537
+ [Y.Desktop]: (e) => xn(e, Y.Desktop)
1538
+ }), [xn]), Cn = R((e) => e.nodeType === Oe.FOLDER || e.path === "SKILL.md" ? null : /* @__PURE__ */ F(ee, {
1539
+ size: T.Small,
1540
+ icon: vt(xe, At, b.SM),
1541
+ "aria-label": Z.deleteLabel ?? "Delete",
1542
+ onClick: () => ln(e.path)
1215
1543
  }), [
1216
- Q.deleteLabel,
1217
- Mt,
1218
- qt
1219
- ]), an = (e) => /* @__PURE__ */ I("div", {
1544
+ Z.deleteLabel,
1545
+ At,
1546
+ ln
1547
+ ]), wn = (e) => /* @__PURE__ */ I("div", {
1220
1548
  className: "flex flex-col gap-2 desktop:gap-5",
1221
1549
  children: [/* @__PURE__ */ I("div", {
1222
1550
  className: "flex items-center justify-between",
1223
1551
  children: [/* @__PURE__ */ F("span", {
1224
- className: c(ot.title, At),
1225
- children: Q.filesHeading ?? "Files"
1226
- }), /* @__PURE__ */ F(p, {
1227
- label: Q.addLabel ?? "Add",
1228
- variant: m.Neutral,
1229
- appearance: f.Solid,
1230
- size: b.Small,
1231
- items: en[e]
1552
+ className: c(It.title, Ot),
1553
+ children: Z.filesHeading ?? "Files"
1554
+ }), /* @__PURE__ */ F(_, {
1555
+ label: Z.addLabel ?? "Add",
1556
+ variant: v.Neutral,
1557
+ appearance: g.Solid,
1558
+ size: T.Small,
1559
+ items: bn[e]
1232
1560
  })]
1233
1561
  }), /* @__PURE__ */ F("div", {
1234
1562
  role: "tree",
1235
- "aria-label": Q.filesTreeAriaLabel ?? "Skill files",
1236
- children: /* @__PURE__ */ F(ge, {
1237
- items: Ht === e ? Wt : Ut,
1563
+ "aria-label": Z.filesTreeAriaLabel ?? "Skill files",
1564
+ children: /* @__PURE__ */ F(ke, {
1565
+ items: en === e ? nn : tn,
1238
1566
  showFiles: !0,
1239
- selectedPath: X,
1240
- expandedPaths: vt,
1241
- onExpandedPathsChange: yt,
1242
- onItemClick: Kt,
1243
- getContextMenuItems: nn[e],
1244
- renderItemActions: rn,
1245
- renamedPath: Ht === e ? Vt : void 0,
1246
- onRenameSave: zt.handleSave,
1247
- onRenameCancel: zt.handleCancel,
1248
- onRenameValidate: zt.handleValidate,
1567
+ selectedPath: G,
1568
+ expandedPaths: lt,
1569
+ onExpandedPathsChange: ut,
1570
+ onItemClick: sn,
1571
+ getContextMenuItems: Sn[e],
1572
+ renderItemActions: Cn,
1573
+ renamedPath: en === e ? $t : void 0,
1574
+ onRenameSave: Zt.handleSave,
1575
+ onRenameCancel: Zt.handleCancel,
1576
+ onRenameValidate: Zt.handleValidate,
1249
1577
  rootItemPath: ""
1250
1578
  })
1251
1579
  })]
1252
- }), on = B(() => ({
1253
- name: W.name,
1254
- description: W.description,
1580
+ }), Tn = z(() => ({
1581
+ name: H.name,
1582
+ description: H.description,
1255
1583
  iconUrl: "",
1256
1584
  version: "",
1257
1585
  topics: [],
1258
1586
  otherLocales: []
1259
- }), [W.name, W.description]), sn = B(() => ({
1260
- name: k?.name,
1261
- description: k?.description
1262
- }), [k?.name, k?.description]), cn = B(() => ({ form: {
1263
- ...Pe,
1587
+ }), [H.name, H.description]), En = z(() => ({
1588
+ name: O?.name,
1589
+ description: O?.description
1590
+ }), [O?.name, O?.description]), Dn = z(() => ({ form: {
1591
+ ...$e,
1264
1592
  name: {
1265
- label: Q.nameLabel ?? "Name",
1266
- placeholder: Q.namePlaceholder ?? "good-morning-breakfast"
1593
+ label: Z.nameLabel ?? "Name",
1594
+ placeholder: Z.namePlaceholder ?? "good-morning-breakfast"
1267
1595
  },
1268
1596
  description: {
1269
- label: Q.descriptionLabel ?? "Description",
1270
- placeholder: Q.descriptionPlaceholder ?? "What this skill does and when to use it"
1597
+ label: Z.descriptionLabel ?? "Description",
1598
+ placeholder: Z.descriptionPlaceholder ?? "What this skill does and when to use it"
1271
1599
  },
1272
1600
  ariaLabel: void 0
1273
1601
  } }), [
1274
- Q.nameLabel,
1275
- Q.namePlaceholder,
1276
- Q.descriptionLabel,
1277
- Q.descriptionPlaceholder
1278
- ]), ln = (e) => {
1279
- e.name !== void 0 && Me({ name: e.name }), e.description !== void 0 && (Le.reset(), Me({ description: e.description }));
1280
- }, un = ie ? (e, t) => /* @__PURE__ */ F(a, {
1602
+ Z.nameLabel,
1603
+ Z.namePlaceholder,
1604
+ Z.descriptionLabel,
1605
+ Z.descriptionPlaceholder
1606
+ ]), On = (e) => {
1607
+ e.name !== void 0 && Ie({ name: e.name }), e.description !== void 0 && (Re.reset(), Ie({ description: e.description }));
1608
+ }, kn = ae ? (e, t) => /* @__PURE__ */ F(a, {
1281
1609
  isEnabled: !0,
1282
1610
  fieldId: t,
1283
1611
  required: !0,
1284
- label: Q.descriptionLabel ?? "Description",
1285
- labels: Q,
1286
- refinement: Le,
1287
- disabled: Be || O,
1288
- ...Ft,
1612
+ label: Z.descriptionLabel ?? "Description",
1613
+ labels: Z,
1614
+ refinement: Re,
1615
+ disabled: ze || C,
1616
+ ...Gt,
1289
1617
  children: e
1290
- }) : void 0, dn = {
1291
- title: Se,
1292
- onBack: Ge,
1293
- onCancel: Ue,
1294
- onSubmit: Ke,
1295
- submitLabel: Q.createLabel ?? "Create",
1296
- isSubmitDisabled: Be || T || D,
1618
+ }) : void 0, An = {
1619
+ title: he,
1620
+ onBack: He,
1621
+ onCancel: Ve,
1622
+ onSubmit: Ue,
1623
+ submitLabel: Z.createLabel ?? "Create",
1624
+ isSubmitDisabled: ze || h || S,
1297
1625
  labels: {
1298
- cancelLabel: Q.cancelLabel ?? "Cancel",
1299
- backAriaLabel: xe ?? "Back",
1300
- savingStatusLabel: Q.savingStatusLabel ?? "Saving"
1626
+ cancelLabel: Z.cancelLabel ?? "Cancel",
1627
+ backAriaLabel: me ?? "Back",
1628
+ savingStatusLabel: Z.savingStatusLabel ?? "Saving"
1301
1629
  },
1302
- styles: It,
1630
+ styles: Kt,
1303
1631
  metadataTitle: null
1304
1632
  };
1305
- if (T) return /* @__PURE__ */ F("div", {
1306
- dir: Ee,
1633
+ if (h) return /* @__PURE__ */ F("div", {
1634
+ dir: Te,
1307
1635
  className: "relative flex min-h-0 flex-1 flex-col",
1308
- children: /* @__PURE__ */ F(Ne, {
1309
- ...dn,
1636
+ children: /* @__PURE__ */ F(Qe, {
1637
+ ...An,
1310
1638
  metadata: /* @__PURE__ */ F("div", {
1311
- role: "status",
1312
- "aria-label": Q.loadingAriaLabel ?? "Loading skill",
1313
1639
  className: "flex flex-1 items-center justify-center p-8",
1314
- children: /* @__PURE__ */ F(ne, {})
1640
+ children: /* @__PURE__ */ F(fe, { ariaLabel: Z.loadingAriaLabel ?? "Loading skill" })
1315
1641
  })
1316
1642
  })
1317
1643
  });
1318
- if (D) return /* @__PURE__ */ F("div", {
1319
- dir: Ee,
1644
+ if (S) return /* @__PURE__ */ F("div", {
1645
+ dir: Te,
1320
1646
  className: "relative flex min-h-0 flex-1 flex-col",
1321
- children: /* @__PURE__ */ F(Ne, {
1322
- ...dn,
1323
- metadata: /* @__PURE__ */ I("div", {
1324
- role: "alert",
1325
- className: "flex flex-col items-center gap-4 p-8",
1326
- children: [/* @__PURE__ */ F(x, { text: Q.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ F(A, {
1327
- label: Q.retryLabel ?? "Retry",
1328
- onClick: Ce
1329
- })]
1647
+ children: /* @__PURE__ */ F(Qe, {
1648
+ ...An,
1649
+ metadata: /* @__PURE__ */ F("div", {
1650
+ className: "p-8",
1651
+ children: /* @__PURE__ */ F(E, {
1652
+ message: Z.loadErrorMessage ?? "Couldn't load this skill. Please try again.",
1653
+ iconStroke: x,
1654
+ action: /* @__PURE__ */ F(ce, {
1655
+ label: Z.retryLabel ?? "Retry",
1656
+ onClick: ge
1657
+ })
1658
+ })
1330
1659
  })
1331
1660
  })
1332
1661
  });
1333
- let fn = X === K, pn = fn ? K : Q.selectedFileHeading?.(Gt?.name ?? X) ?? Gt?.name ?? X, mn = ee != null || te != null ? /* @__PURE__ */ I("div", {
1662
+ let jn = G === K, Mn = rn?.name ?? G.slice(G.lastIndexOf("/") + 1), Nn = jn ? K : Z.selectedFileHeading?.(Mn) ?? Mn, Pn = k != null || j != null ? /* @__PURE__ */ I("div", {
1334
1663
  className: "flex flex-col gap-2",
1335
- children: [ee != null && /* @__PURE__ */ I("div", {
1664
+ children: [k != null && /* @__PURE__ */ I("div", {
1336
1665
  className: "flex items-center gap-2",
1337
- children: [/* @__PURE__ */ F(x, { text: ee }), we != null && /* @__PURE__ */ F(C, {
1338
- label: Q.retryLabel ?? "Retry",
1339
- onClick: we
1666
+ children: [/* @__PURE__ */ F(D, { text: k }), ye != null && /* @__PURE__ */ F(A, {
1667
+ label: Z.retryLabel ?? "Retry",
1668
+ onClick: ye
1340
1669
  })]
1341
- }), te != null && /* @__PURE__ */ I("div", {
1670
+ }), j != null && /* @__PURE__ */ I("div", {
1342
1671
  className: "flex items-center gap-2",
1343
- children: [/* @__PURE__ */ F(x, { text: te.message }), /* @__PURE__ */ F(C, {
1344
- label: Q.reloadLatestLabel ?? "Reload latest",
1345
- onClick: j
1672
+ children: [/* @__PURE__ */ F(D, { text: j.message }), /* @__PURE__ */ F(A, {
1673
+ label: Z.reloadLatestLabel ?? "Reload latest",
1674
+ onClick: ne
1346
1675
  })]
1347
1676
  })]
1348
- }) : void 0, hn = /* @__PURE__ */ F(a, {
1349
- isEnabled: !!se,
1350
- fieldId: ke,
1677
+ }) : void 0, Fn = /* @__PURE__ */ F(a, {
1678
+ isEnabled: !!oe,
1679
+ fieldId: Me,
1351
1680
  required: !0,
1352
- labelClassName: c(ot.helperText, jt),
1353
- label: Q.instructionsLabel ?? "Instructions",
1354
- labels: Q,
1355
- refinement: J,
1356
- disabled: Be || O,
1357
- ...Ft,
1681
+ labelClassName: c(It.helperText, kt),
1682
+ label: Z.instructionsLabel ?? "Instructions",
1683
+ labels: Z,
1684
+ refinement: W,
1685
+ disabled: ze || C,
1686
+ ...Gt,
1358
1687
  children: /* @__PURE__ */ I("div", {
1359
1688
  className: "flex flex-1 flex-col gap-2",
1360
1689
  children: [
1361
- !se && /* @__PURE__ */ F(E, {
1362
- htmlFor: ke,
1363
- className: c(ot.helperText, jt),
1364
- label: Q.instructionsLabel ?? "Instructions",
1690
+ !oe && /* @__PURE__ */ F(te, {
1691
+ htmlFor: Me,
1692
+ className: c(It.helperText, kt),
1693
+ label: Z.instructionsLabel ?? "Instructions",
1365
1694
  required: !0
1366
1695
  }),
1367
1696
  /* @__PURE__ */ F("div", {
1368
- ref: Ae,
1697
+ ref: Pe,
1369
1698
  className: c(t, e, n),
1370
- children: /* @__PURE__ */ F(de, {
1371
- fallback: /* @__PURE__ */ F(ne, { ariaLabel: Q.instructionsLoadingAriaLabel ?? "Loading" }),
1372
- children: /* @__PURE__ */ F(mt, {
1373
- id: ke,
1374
- ariaLabel: Q.instructionsLabel ?? "Instructions",
1375
- value: W.instructions,
1699
+ children: /* @__PURE__ */ F(Ce, {
1700
+ fallback: /* @__PURE__ */ F(fe, { ariaLabel: Z.instructionsLoadingAriaLabel ?? "Loading" }),
1701
+ children: /* @__PURE__ */ F(Wt, {
1702
+ id: Me,
1703
+ ariaLabel: Z.instructionsLabel ?? "Instructions",
1704
+ value: H.instructions,
1376
1705
  onChange: (e) => {
1377
- J.reset(), Me({ instructions: e });
1706
+ W.reset(), Ie({ instructions: e });
1378
1707
  },
1379
- theme: De,
1708
+ theme: Ae,
1380
1709
  showDragbar: !1,
1381
- placeholder: Q.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
1710
+ placeholder: Z.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
1382
1711
  })
1383
1712
  })
1384
1713
  }),
1385
- k?.instructions != null && /* @__PURE__ */ F(x, { text: k.instructions })
1714
+ O?.instructions != null && /* @__PURE__ */ F(D, {
1715
+ id: Ne,
1716
+ text: O.instructions
1717
+ })
1386
1718
  ]
1387
1719
  })
1388
1720
  });
1389
1721
  return /* @__PURE__ */ I("div", {
1390
- dir: Ee,
1391
- className: c("relative flex min-h-0 flex-1 flex-col", Re.root),
1392
- style: Pt,
1393
- ...Ot,
1722
+ dir: Te,
1723
+ className: c("relative flex min-h-0 min-w-0 flex-1 flex-col", nt.root),
1724
+ style: Nt,
1725
+ ...X,
1394
1726
  children: [
1395
- /* @__PURE__ */ F($e, {
1396
- isVisible: Dt && !bt,
1397
- labels: Te
1727
+ /* @__PURE__ */ F(Ct, {
1728
+ isVisible: Dt && !pt,
1729
+ labels: be,
1730
+ titleClassName: $.dropOverlayTitleClassName,
1731
+ subtitleClassName: $.dropOverlaySubtitleClassName
1398
1732
  }),
1399
- /* @__PURE__ */ F(Ne, {
1400
- ...dn,
1401
- asideData: _e,
1402
- asideSectionClassName: ft,
1403
- isSubmitting: O,
1404
- metadataSectionClassName: dt,
1733
+ /* @__PURE__ */ F(Qe, {
1734
+ ...An,
1735
+ asideData: le,
1736
+ asideSectionClassName: Ht,
1737
+ isSubmitting: C,
1738
+ metadataSectionClassName: Vt,
1405
1739
  metadata: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
1406
1740
  className: "desktop:hidden",
1407
- children: /* @__PURE__ */ F(d, {
1408
- title: Q.editingFileLabel ?? "Editing file",
1409
- description: Gt?.name ?? "SKILL.md",
1410
- expanded: Tt,
1741
+ children: /* @__PURE__ */ F(Tt, {
1742
+ label: Z.editingFileLabel ?? "Editing file",
1743
+ fileName: jn ? K : Mn,
1744
+ isExpanded: wt,
1411
1745
  onToggle: Et,
1412
- ariaLabel: Q.editingFileLabel ?? "Editing file",
1413
- children: an(Y.Mobile)
1746
+ labelClassName: $.editingFileLabelClassName,
1747
+ fileNameClassName: $.editingFileNameClassName,
1748
+ children: wn(Y.Mobile)
1414
1749
  })
1415
1750
  }), /* @__PURE__ */ F("div", {
1416
1751
  className: "hidden desktop:block",
1417
- children: an(Y.Desktop)
1752
+ children: wn(Y.Desktop)
1418
1753
  })] }),
1419
- alert: mn,
1420
- setupTitle: pn,
1421
- setupSectionClassName: pt,
1422
- setup: fn ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(Ie, {
1423
- values: on,
1424
- errors: sn,
1425
- onChange: ln,
1426
- fields: ct,
1754
+ alert: Pn,
1755
+ setupTitle: Nn,
1756
+ setupSectionClassName: Ut,
1757
+ setup: jn ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(tt, {
1758
+ values: Tn,
1759
+ errors: En,
1760
+ onChange: On,
1761
+ fields: Rt,
1427
1762
  isDescriptionRequired: !0,
1428
- isNameReadOnly: M,
1429
- nameCaption: k?.name ? void 0 : Q.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
1430
- renderDescription: un,
1431
- labels: cn
1432
- }), hn] }) : /* @__PURE__ */ F(P, { children: Gt?.kind === q.File && /* @__PURE__ */ F("div", {
1433
- className: "flex min-h-0 flex-1 flex-col",
1434
- 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." })
1435
- }) })
1763
+ isNameReadOnly: re,
1764
+ nameReadOnlyTooltip: Z.nameReadOnlyTooltip ?? "The skill name can't be changed after creation",
1765
+ nameCaption: O?.name ? void 0 : Z.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
1766
+ renderDescription: kn,
1767
+ labels: Dn
1768
+ }), Fn] }) : /* @__PURE__ */ I(P, { children: [on && G !== $t && /* @__PURE__ */ F(Ft, {
1769
+ folderPath: G,
1770
+ entries: an,
1771
+ onOpen: cn,
1772
+ rootLabel: Z.folderPreviewRootLabel,
1773
+ breadcrumbAriaLabel: Z.folderPreviewBreadcrumbAriaLabel,
1774
+ overflowAriaLabel: Z.folderPreviewOverflowAriaLabel,
1775
+ listAriaLabel: Z.folderPreviewListAriaLabel,
1776
+ emptyTitle: Z.folderEmptyTitle,
1777
+ emptyDescription: Z.folderEmptyDescription,
1778
+ itemCountLabel: Z.folderItemCountLabel,
1779
+ itemCountClassName: $.folderItemCountClassName
1780
+ }), rn?.kind === q.File && /* @__PURE__ */ F("div", {
1781
+ className: "flex h-[max(320px,60dvh)] min-h-0 min-w-0 flex-none flex-col desktop:h-auto desktop:flex-1",
1782
+ children: se ?? /* @__PURE__ */ F(y, { text: Z.supportingFileNote ?? "This supporting file is included in the skill package as-is. Remove it from the Files panel to replace its content." })
1783
+ })] })
1784
+ }),
1785
+ /* @__PURE__ */ F(Mt, {
1786
+ isOpen: pt,
1787
+ onClose: () => ht(!1),
1788
+ fileActions: Xt,
1789
+ mode: yt.mode,
1790
+ targetFolderPath: yt.targetFolderPath,
1791
+ initialFiles: yt.initialFiles,
1792
+ initialEntries: yt.initialEntries,
1793
+ existingFilePaths: _n,
1794
+ onCommitted: (e) => {
1795
+ e.some((e) => e.replacesExisting) && Je(!0);
1796
+ },
1797
+ messageClassName: $.uploadMessageClassName,
1798
+ rowCaptionClassName: $.uploadRowCaptionClassName,
1799
+ labels: be,
1800
+ dialogColors: Pt,
1801
+ colors: {
1802
+ invalidDropZoneBorder: Q?.uploadInvalidDropZoneBorder,
1803
+ rowBorder: Q?.uploadRowBorder
1804
+ }
1436
1805
  }),
1437
- /* @__PURE__ */ F(at, {
1438
- isOpen: bt,
1439
- onClose: () => xt(!1),
1440
- fileActions: R,
1441
- mode: St.mode,
1442
- targetFolderPath: St.targetFolderPath,
1443
- initialFiles: St.initialFiles,
1444
- initialEntries: St.initialEntries,
1445
- labels: Te
1806
+ /* @__PURE__ */ F(xt, {
1807
+ isOpen: mn != null,
1808
+ onClose: () => hn(null),
1809
+ validateName: (e) => Zt.validateNewFolder(e, mn ?? ""),
1810
+ onCreate: (e) => Zt.createFolder(e, mn ?? ""),
1811
+ title: Z.createFolderLabel ?? "Create folder",
1812
+ nameLabel: Z.createFolderNameLabel ?? "Name",
1813
+ namePlaceholder: Z.createFolderNamePlaceholder ?? "Enter folder name",
1814
+ createLabel: Z.createFolderConfirmLabel ?? "Create",
1815
+ cancelLabel: Z.cancelLabel ?? "Cancel",
1816
+ closeAriaLabel: Z.createFolderCloseAriaLabel ?? "Close",
1817
+ dialogColors: Pt
1446
1818
  })
1447
1819
  ]
1448
1820
  });
1449
1821
  };
1450
1822
  //#endregion
1451
- export { Re as SKILL_EDITOR_CLASS, ht as SkillEditor, et as SkillFileCandidateKind, q as SkillFileNodeKind, Ze as SkillFileUploadMode, tt as SkillFileValidationStatus };
1823
+ export { nt as SKILL_EDITOR_CLASS, Gt as SkillEditor, Et as SkillFileCandidateKind, q as SkillFileNodeKind, _t as SkillFileUploadMode, Dt as SkillFileValidationStatus };