@epam/ai-dial-skill-editor 1.3.0-dev.34 → 1.3.0-dev.343

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 +3 -2
  17. package/index.js +1151 -777
  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:pb-3 desktop:pt-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,222 +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, renderDescription: _, focusRequestKey: v }) => {
368
- let y = V(null), b = V(null), x = V(null), S = V(!1), C = (e) => p.includes(e), w = C(U.Name), E = C(U.Version), D = !!(t.name || t.version || t.description), O = V(v);
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 ? y.current?.focus() : t.version ? b.current?.focus() : t.description && x.current?.focus();
423
+ t.name ? w.current?.focus() : t.version ? T.current?.focus() : t.description && E.current?.focus();
372
424
  };
373
- if (v !== void 0) {
374
- v !== O.current && (O.current = v, e());
375
- return;
376
- }
377
- D && !S.current && e(), S.current = D;
425
+ C === void 0 ? (ee && !D.current && e(), D.current = ee) : C !== te.current && (te.current = C, e());
378
426
  }, [
379
- v,
380
- D,
427
+ C,
428
+ ee,
381
429
  t.name,
382
430
  t.version,
383
431
  t.description
384
432
  ]);
385
- let k = /* @__PURE__ */ F(M, {
386
- id: ke,
387
- ref: x,
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: _ ? 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,
444
+ caption: x,
396
445
  error: t.description || void 0,
397
446
  invalid: !!t.description,
398
- containerClassName: _ ? void 0 : d?.field,
447
+ containerClassName: S ? void 0 : d?.field,
399
448
  className: r,
400
- resize: N.Vertical
449
+ resize: he.Vertical
401
450
  });
402
451
  return /* @__PURE__ */ I("div", {
403
452
  role: u.ariaLabel ? "group" : void 0,
404
453
  "aria-label": u.ariaLabel,
405
454
  className: c("flex flex-col gap-4", d?.root),
406
455
  children: [
407
- C(U.Avatar) && /* @__PURE__ */ F(we, {
456
+ O(W.Avatar) && /* @__PURE__ */ F(Ie, {
408
457
  label: u.iconUrl.label,
409
458
  avatarUrl: s,
410
459
  addAvatarLabel: u.iconUrl.addAvatarLabel,
@@ -412,54 +461,61 @@ var ve = {
412
461
  onAddAvatarClick: l,
413
462
  className: d?.field
414
463
  }),
415
- (w || E) && /* @__PURE__ */ I("div", {
464
+ (k || A) && /* @__PURE__ */ I("div", {
416
465
  className: c("flex items-start gap-4", d?.field),
417
- children: [w && /* @__PURE__ */ F(T, {
466
+ children: [k && /* @__PURE__ */ F(j, {
418
467
  id: "deployment-creation-form-name",
419
- inputRef: y,
468
+ inputRef: w,
420
469
  value: e.name,
421
470
  onChange: (e) => n({ name: e ?? "" }),
422
471
  onBlur: a,
423
- readOnly: m,
472
+ disabled: h,
473
+ tooltipText: h ? g : void 0,
424
474
  labelProps: {
425
475
  label: u.name.label,
426
476
  required: !0
427
477
  },
428
478
  placeholder: u.name.placeholder,
429
- caption: h,
479
+ caption: y,
430
480
  error: t.name || void 0,
431
481
  invalid: !!t.name,
432
- containerClassName: E ? "min-w-0 basis-0 grow-[2]" : "min-w-0 flex-1"
433
- }), E && /* @__PURE__ */ F(T, {
482
+ containerClassName: A ? "min-w-0 basis-0 grow-[2]" : "min-w-0 flex-1"
483
+ }), A && /* @__PURE__ */ F(j, {
434
484
  id: "deployment-creation-form-version",
435
- inputRef: b,
485
+ inputRef: T,
436
486
  value: e.version,
437
- onChange: (e) => n({ version: e ?? "" }),
438
- onBlur: o,
487
+ onChange: (e) => {
488
+ _ || n({ version: e ?? "" });
489
+ },
490
+ onBlur: _ ? void 0 : o,
491
+ readOnly: _,
492
+ tooltipText: _ ? v : void 0,
439
493
  labelProps: { label: u.version.label },
440
494
  placeholder: u.version.placeholder,
441
495
  error: t.version || void 0,
442
496
  invalid: !!t.version,
443
- containerClassName: w ? "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"
444
498
  })]
445
499
  }),
446
- C(U.Description) && (_ ? /* @__PURE__ */ F("div", {
500
+ O(W.Description) && (S ? /* @__PURE__ */ F("div", {
447
501
  className: d?.field,
448
- children: _(k, ke)
449
- }) : k),
450
- C(U.Locales) && /* @__PURE__ */ F(W, {
502
+ children: S(ne, Ke)
503
+ }) : ne),
504
+ O(W.Locales) && /* @__PURE__ */ F(Ue, {
451
505
  value: e.otherLocales,
452
506
  onChange: (e) => n({ otherLocales: e }),
453
507
  availableLocaleOptions: f,
508
+ formatLocaleLabel: p,
454
509
  labels: u.otherLocales,
455
- className: d?.field
510
+ className: d?.field,
511
+ colors: d?.localesColors
456
512
  }),
457
- C(U.Tags) && /* @__PURE__ */ F("div", {
513
+ O(W.Tags) && /* @__PURE__ */ F("div", {
458
514
  className: d?.field,
459
- children: /* @__PURE__ */ F(j, {
515
+ children: /* @__PURE__ */ F(pe, {
460
516
  id: "deployment-creation-form-topics",
461
517
  labelProps: { label: u.topics.label },
462
- placeholder: u.topics.placeholder ?? Oe,
518
+ placeholder: u.topics.placeholder ?? We,
463
519
  value: e.topics,
464
520
  onChange: (e) => n({ topics: e }),
465
521
  tagClassName: i
@@ -467,53 +523,58 @@ var ve = {
467
523
  })
468
524
  ]
469
525
  });
470
- }, 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 }) => {
471
- let w = v == null ? null : /* @__PURE__ */ F("div", {
472
- role: "alert",
473
- 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,
474
530
  children: v
475
- }), T = p != null;
476
- return /* @__PURE__ */ F(Se, {
531
+ }), D = p != null;
532
+ return /* @__PURE__ */ F(Pe, {
477
533
  title: e,
478
534
  onBack: t,
479
- backAriaLabel: x?.backAriaLabel ?? "Back",
535
+ backAriaLabel: C?.backAriaLabel ?? "Back",
480
536
  isSaving: a,
481
- labels: { savingStatusLabel: x?.savingStatusLabel ?? "Saving" },
482
- 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, {
483
544
  title: g,
484
- styles: S?.section,
485
- className: c(Ae, _, ve.asideSection),
545
+ styles: w?.section,
546
+ className: c(Je, _, H.asideSection),
486
547
  children: h
487
548
  }),
488
- styles: S?.layout,
489
- dir: C,
490
- actions: /* @__PURE__ */ I(P, { children: [s, !l && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(O, {
491
- 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",
492
553
  disabled: a,
493
554
  onClick: n
494
- }), /* @__PURE__ */ F(A, {
555
+ }), /* @__PURE__ */ F(ce, {
495
556
  label: i,
496
557
  disabled: a || o,
497
558
  onClick: r
498
559
  })] })] }),
499
560
  leftContent: /* @__PURE__ */ I(P, { children: [
500
- !T && w,
501
- /* @__PURE__ */ F(be, {
502
- title: d === null ? void 0 : d ?? x?.metadataTitle ?? "Metadata",
503
- styles: S?.section,
504
- 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),
505
566
  children: u
506
567
  }),
507
568
  f
508
569
  ] }),
509
- centerContent: T ? /* @__PURE__ */ I(P, { children: [w, /* @__PURE__ */ F(be, {
510
- title: m === null ? void 0 : m ?? x?.setupTitle ?? "Setup",
511
- styles: S?.section,
512
- 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),
513
574
  children: p
514
575
  })] }) : void 0
515
576
  });
516
- }), Pe = {
577
+ }), $e = {
517
578
  name: {
518
579
  label: "Name",
519
580
  placeholder: "Enter name"
@@ -552,7 +613,7 @@ var ve = {
552
613
  saveLabel: "Save"
553
614
  },
554
615
  ariaLabel: "Metadata"
555
- }, Fe = {
616
+ }, et = {
556
617
  title: "Add avatar",
557
618
  attachLabel: "Attach",
558
619
  emptyTitle: "This folder is empty",
@@ -576,83 +637,82 @@ var ve = {
576
637
  deleteConfirmItemsLabel: "items?",
577
638
  deleteConfirmLabel: "Delete",
578
639
  deleteCancelLabel: "Cancel"
579
- }, Ie = fe(({ values: e, errors: t, onChange: n, onNameBlur: r, onVersionBlur: i, avatarPicker: a, availableLocaleOptions: o, fields: s = Ee, isNameReadOnly: c, nameCaption: l, isDescriptionRequired: u, renderDescription: d, focusRequestKey: f, labels: p }) => {
580
- let [m, h] = H(!1), g = B(() => a ? s : s.filter((e) => e !== U.Avatar), [a, s]), _ = e.iconUrl, v = a?.resolveIconUrl, y = B(() => v ? v(_) : void 0, [_, v]), b = z(() => h(!0), []), x = z(() => h(!1), []), S = a?.resolveAttachedIconUrl, C = z((e) => {
581
- let t = S?.(e);
582
- t && n({ iconUrl: t }), h(!1);
583
- }, [n, S]);
584
- 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, {
585
646
  values: e,
586
647
  errors: t,
587
648
  onChange: n,
588
649
  onNameBlur: r,
589
650
  onVersionBlur: i,
590
- iconPreviewUrl: y,
591
- onAddAvatarClick: b,
592
- labels: p?.form ?? Pe,
651
+ iconPreviewUrl: w,
652
+ onAddAvatarClick: T,
653
+ labels: v?.form ?? $e,
593
654
  availableLocaleOptions: o,
594
- fields: g,
595
- isNameReadOnly: c,
596
- nameCaption: l,
597
- isDescriptionRequired: u,
598
- renderDescription: d,
599
- focusRequestKey: f
600
- }), a && /* @__PURE__ */ F(Te, {
601
- isOpen: m,
602
- onClose: x,
603
- onAttach: C,
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,
604
670
  bucket: a.bucket,
605
671
  FileManagerModal: a.FileManagerModal,
606
672
  allowedMimeTypes: a.allowedMimeTypes,
607
673
  maxFileSizeBytes: a.maxFileSizeBytes,
608
- labels: p?.avatarPicker ?? Fe
674
+ labels: v?.avatarPicker ?? et
609
675
  })] });
610
- }), Le = /* @__PURE__ */ function(e) {
676
+ }), G = /* @__PURE__ */ function(e) {
611
677
  return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e.ControlCharacters = "control-characters", e;
612
678
  }({});
613
- new Set([Le.TooLong, Le.ControlCharacters]);
679
+ G.TooLong, G.ControlCharacters;
614
680
  //#endregion
615
681
  //#region src/constants/public-class-names.ts
616
- var Re = {
682
+ var nt = {
617
683
  root: "dial-skill-editor-root",
618
684
  refineFeedback: "dial-skill-editor-refine-feedback"
619
685
  }, K = "SKILL.md", q = /* @__PURE__ */ function(e) {
620
686
  return e.File = "file", e.Folder = "folder", e;
621
- }({}), ze = /* @__PURE__ */ function(e) {
622
- 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;
623
689
  }({}), J = (e) => {
624
690
  let t = e.lastIndexOf("/");
625
691
  return t === -1 ? null : e.slice(0, t);
626
- }, Be = (e) => {
692
+ }, it = (e) => {
627
693
  let t = e.lastIndexOf("/");
628
694
  return t === -1 ? e : e.slice(t + 1);
629
- }, Ve = (e) => {
695
+ }, at = (e) => {
630
696
  let t = /* @__PURE__ */ new Map(), n = (e) => {
631
697
  let n = t.get(e);
632
698
  if (n) return n;
633
699
  let r = {
634
700
  path: e,
635
- name: Be(e),
636
- nodeType: he.FOLDER,
701
+ name: it(e),
702
+ nodeType: Oe.FOLDER,
637
703
  parentPath: J(e),
638
704
  folderId: e,
639
705
  items: []
640
706
  };
641
707
  return t.set(e, r), r;
642
708
  };
643
- for (let r of e) {
644
- if (r.kind === q.Folder) {
645
- n(r.path).name = r.name;
646
- continue;
647
- }
648
- t.set(r.path, {
649
- path: r.path,
650
- name: r.name,
651
- nodeType: he.ITEM,
652
- parentPath: J(r.path),
653
- folderId: J(r.path) ?? ""
654
- });
655
- }
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
+ });
656
716
  for (let t of [...e]) {
657
717
  let e = J(t.path);
658
718
  for (; e != null;) n(e), e = J(e);
@@ -667,44 +727,61 @@ var Re = {
667
727
  n ? n.items = [...n.items ?? [], e] : r.push(e);
668
728
  }
669
729
  return r;
670
- }, 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) => {
671
735
  if (!t) return "";
672
736
  switch (e) {
673
- case ze.Child: return t.path;
674
- case ze.Sibling: return Ue(t.path);
675
- case ze.Header: return t.kind === q.Folder ? t.path : "";
676
- }
677
- }, Ge = (e, t) => {
678
- let n = t ? `${t}/` : "", r = /* @__PURE__ */ new Set();
679
- for (let { path: i } of e) {
680
- if (!i.startsWith(n) || i === t) continue;
681
- let e = i.slice(n.length);
682
- r.add(e.split("/")[0]);
737
+ case rt.Child: return t.path;
738
+ case rt.Header: return t.kind === q.Folder ? t.path : "";
683
739
  }
684
- return r;
685
- }, Ke = (e, t, n) => {
740
+ }, lt = (e, t) => new Set(dt(e, t).map((e) => e.name)), ut = (e, t, n) => {
686
741
  let r = e.trim();
687
742
  if (!r) return n.required;
688
743
  if (/[/\\]/.test(r) || r === "." || r === "..") return n.invalid;
689
744
  if (t.has(r)) return n.duplicate;
690
- }, qe = "\\new-folder", Je = ({ files: e, fileActions: t, defaultName: n, messages: r, onRevealFolder: i, onCreated: a }) => {
691
- 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 : {
692
769
  path: u,
693
770
  name: n,
694
771
  kind: q.Folder
695
- }, [u, n]), f = z((n, i) => {
696
- let a = Ge(e, i);
697
- 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()));
698
775
  }, [
699
776
  e,
700
777
  r,
701
778
  t
702
- ]), p = z((e, t) => {
779
+ ]), p = R((e, t) => {
703
780
  l.current = [], s({
704
781
  parentPath: e,
705
782
  pane: t
706
783
  }), e !== "" && i(e);
707
- }, [i]), m = z((e, t) => {
784
+ }, [i]), m = R((e, t) => {
708
785
  if (c == null || t.path !== u) return null;
709
786
  let n = f(e, c);
710
787
  return l.current = [...l.current.slice(-1), {
@@ -715,23 +792,24 @@ var Re = {
715
792
  c,
716
793
  u,
717
794
  f
718
- ]), h = z(() => {
795
+ ]), h = R(() => {
719
796
  l.current = [], s(null);
720
- }, []), 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) => {
721
805
  if (c == null) return;
722
- let [n] = l.current;
723
- if (l.current.length === 2 && n != null && !n.isValid && n.value !== e || f(e, c) != null) {
724
- h();
725
- return;
726
- }
727
- let r = He(c, e.trim());
728
- 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));
729
808
  }, [
730
809
  c,
731
810
  f,
732
811
  h,
733
- t,
734
- a
812
+ g
735
813
  ]);
736
814
  return {
737
815
  draftNode: d,
@@ -739,711 +817,1007 @@ var Re = {
739
817
  draftPane: o?.pane,
740
818
  startDraft: p,
741
819
  handleValidate: m,
742
- handleSave: g,
743
- handleCancel: h
820
+ handleSave: _,
821
+ handleCancel: h,
822
+ validateNewFolder: f,
823
+ createFolder: g
744
824
  };
745
- }, Ye = (e) => !!e.dataTransfer?.types.includes("Files"), Xe = (e) => {
746
- 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);
747
827
  return {
748
828
  isDragActive: t,
749
829
  dropZoneHandlers: {
750
- onDragEnter: z((e) => {
751
- Ye(e) && (e.preventDefault(), r.current += 1, n(!0));
830
+ onDragEnter: R((e) => {
831
+ ht(e) && (e.preventDefault(), r.current += 1, n(!0));
752
832
  }, []),
753
- onDragLeave: z((e) => {
754
- 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)));
755
835
  }, []),
756
- onDragOver: z((e) => {
757
- Ye(e) && e.preventDefault();
836
+ onDragOver: R((e) => {
837
+ ht(e) && e.preventDefault();
758
838
  }, []),
759
- onDrop: z((t) => {
760
- if (!Ye(t)) return;
839
+ onDrop: R((t) => {
840
+ if (!ht(t)) return;
761
841
  t.preventDefault(), r.current = 0, n(!1);
762
842
  let i = Array.from(t.dataTransfer?.files ?? []);
763
843
  i.length > 0 && e(i);
764
844
  }, [e])
765
845
  }
766
846
  };
767
- }, Ze = /* @__PURE__ */ function(e) {
847
+ }, _t = /* @__PURE__ */ function(e) {
768
848
  return e.Files = "files", e.Archive = "archive", e;
769
849
  }({}), Y = /* @__PURE__ */ function(e) {
770
850
  return e.Mobile = "mobile", e.Desktop = "desktop", e;
771
- }({}), Qe = (e, t, n = g.MD) => /* @__PURE__ */ F(e, {
851
+ }({}), vt = (e, t, n = b.MD, r) => /* @__PURE__ */ F(e, {
772
852
  size: n,
773
853
  className: t,
854
+ style: r,
774
855
  "aria-hidden": !0,
775
- stroke: _
776
- }), $e = ({ isVisible: e, labels: t }) => {
777
- if (!e) return null;
778
- let n = t ?? {};
779
- return /* @__PURE__ */ F("div", {
780
- role: "status",
781
- "aria-live": "polite",
782
- 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"),
783
955
  children: /* @__PURE__ */ I("div", {
956
+ "aria-hidden": !0,
784
957
  className: "flex flex-col items-center text-center",
785
958
  children: [
786
- /* @__PURE__ */ F(ue, {
959
+ /* @__PURE__ */ F(Se, {
787
960
  size: 100,
788
- className: "text-accent-primary",
961
+ className: St.icon,
789
962
  "aria-hidden": !0,
790
- stroke: _
963
+ stroke: x
791
964
  }),
792
965
  /* @__PURE__ */ F("span", {
793
- className: "dial-h3-text mt-5",
794
- children: n.dropOverlayTitle ?? "Upload files"
966
+ className: c("mt-5", n),
967
+ children: a
795
968
  }),
796
969
  /* @__PURE__ */ F("span", {
797
- className: "dial-small-text mt-4",
798
- children: n.dropOverlaySubtitle ?? "Drop files here to add them to this skill"
970
+ className: c("mt-4", r),
971
+ children: o
799
972
  })
800
973
  ]
801
974
  })
802
- });
803
- }, 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) {
804
997
  return e.SupportingFile = "supporting-file", e.Manifest = "manifest", e;
805
- }({}), tt = /* @__PURE__ */ function(e) {
998
+ }({}), Dt = /* @__PURE__ */ function(e) {
806
999
  return e.Valid = "valid", e.Invalid = "invalid", e;
807
- }({}), nt = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), rt = ".zip,application/zip", it = 0, X = () => `skill-file-candidate-${++it}`, Z = (e, t, n) => ({
808
- 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(),
809
1007
  file: e,
810
- path: He(n, t.replace(/\\/g, "/"))
811
- }), at = ({ isOpen: e, onClose: t, fileActions: n, mode: r = Ze.Files, targetFolderPath: i = "", initialFiles: a, initialEntries: o, labels: c }) => {
812
- 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) => {
813
- T(void 0), d((t) => [...t, ...e]);
814
- }, 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) => {
815
1038
  let { extractArchive: t } = n;
816
1039
  if (!t) return;
817
- let r = M.current;
818
- A(void 0), j((e) => e + 1);
1040
+ let r = ge.current;
1041
+ pe(void 0), he((e) => e + 1);
819
1042
  try {
820
1043
  let n = await Promise.all(e.map((e) => t(e)));
821
- if (r !== M.current) return;
1044
+ if (r !== ge.current) return;
822
1045
  let a = n.flat();
823
1046
  if (a.length === 0) {
824
- A(l.uploadArchiveEmptyMessage ?? "This archive has no files");
1047
+ pe(_.uploadArchiveEmptyMessage ?? "This archive has no files");
825
1048
  return;
826
1049
  }
827
- ae(a.map((e) => Z(e.file, e.path, i)));
1050
+ R(a.map((e) => jt(e.file, e.path, i)));
828
1051
  } catch {
829
- if (r !== M.current) return;
830
- A(L);
1052
+ if (r !== ge.current) return;
1053
+ pe(_e);
831
1054
  } finally {
832
- r === M.current && j((e) => e - 1);
833
- }
834
- }, se = (e) => {
835
- if (N) {
836
- oe(e);
837
- return;
1055
+ r === ge.current && he((e) => e - 1);
838
1056
  }
839
- ae(e.map((e) => Z(e, nt(e), i)));
840
- }, ce = (e) => {
841
- 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));
842
1061
  };
843
- pe(() => {
844
- 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));
845
- }, [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(() => {
846
1068
  if (!e) return;
847
1069
  let t = !1;
848
- if (u.length === 0) {
849
- h(/* @__PURE__ */ new Map()), v([]);
850
- return;
851
- }
852
- return b(!0), n.validateBatch(u).then(({ results: e, batchErrors: n }) => {
853
- 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)));
854
1073
  }).finally(() => {
855
- t || b(!1);
1074
+ t || oe(!1);
856
1075
  }), () => {
857
1076
  t = !0;
858
1077
  };
859
- }, [u, e]);
860
- 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 () => {
861
- 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);
862
1084
  try {
863
- let { results: e, batchErrors: r } = await n.validateBatch(u), i = new Map(e.map((e) => [e.candidateId, e]));
864
- if (h(i), v(r.map((e) => e.message)), u.some((e) => i.get(e.id)?.status === tt.Invalid) || r.length > 0) return;
865
- 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);
866
1088
  if (a.error) {
867
- T(a.error);
1089
+ se(a.error);
868
1090
  return;
869
1091
  }
870
- t();
1092
+ d?.(v), t();
871
1093
  } finally {
872
- D(!1);
1094
+ ue(!1);
873
1095
  }
874
- };
875
- return /* @__PURE__ */ F(k, {
876
- open: e,
877
- header: N ? l.uploadArchiveDialogTitle ?? "Upload archive from device" : l.uploadDialogTitle ?? "Upload files from device",
878
- size: ee.Sm,
879
- 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,
880
1135
  onClose: t,
881
- mainButtons: [{
882
- label: l.uploadCancelLabel ?? "Cancel",
883
- variant: m.Primary,
884
- appearance: f.Ghost,
885
- onClick: t
886
- }, {
887
- label: l.uploadConfirmLabel ?? "Add",
888
- variant: m.Primary,
889
- iconBefore: E ? /* @__PURE__ */ F(ne, {
890
- size: 16,
891
- ariaLabel: ""
892
- }) : void 0,
893
- onClick: () => void fe(),
894
- disabled: !R
895
- }],
1136
+ confirmLabel: _.uploadConfirmLabel ?? "Add",
1137
+ onConfirm: () => void Pe(),
1138
+ isConfirmDisabled: !U,
1139
+ isConfirming: ce,
1140
+ cancelLabel: Ie,
1141
+ onCancel: t,
1142
+ colors: h,
896
1143
  children: /* @__PURE__ */ I("div", {
897
- 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
+ }),
898
1149
  children: [
899
- /* @__PURE__ */ F(S, {
1150
+ /* @__PURE__ */ F(O, {
900
1151
  label: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("span", {
901
1152
  className: "desktop:hidden",
902
- 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"
903
1154
  }), /* @__PURE__ */ F("span", {
904
1155
  className: "hidden desktop:inline",
905
- 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"
906
1157
  })] }),
907
- ariaLabel: l.uploadDropZoneAriaLabel ?? "Upload files",
1158
+ description: L ? _.uploadArchiveDropZoneDescription : _.uploadDropZoneDescription,
1159
+ id: ye,
1160
+ ariaLabel: _.uploadDropZoneAriaLabel ?? "Upload files",
908
1161
  multiple: !0,
909
- accept: N ? rt : void 0,
910
- className: de ? "border-error hover:border-error" : void 0,
911
- onChange: se,
912
- 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
913
1166
  }),
914
- te > 0 && /* @__PURE__ */ F(ne, { ariaLabel: l.uploadArchiveExtractingAriaLabel ?? "Reading archive" }),
915
- /* @__PURE__ */ F("div", {
916
- role: "alert",
917
- 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
918
1171
  }),
919
- /* @__PURE__ */ F("span", {
920
- role: "status",
921
- "aria-live": "polite",
922
- className: "sr-only",
923
- id: re,
924
- 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(" ")
925
1177
  }),
926
- g.map((e) => /* @__PURE__ */ F(x, { text: e }, e)),
927
- u.length > 0 && /* @__PURE__ */ F("ul", {
1178
+ te.map((e) => /* @__PURE__ */ F(D, { text: e }, e)),
1179
+ v.length > 0 && /* @__PURE__ */ F("ul", {
928
1180
  className: "flex flex-col gap-2",
929
- children: u.map((e) => {
930
- 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}`;
931
1183
  return /* @__PURE__ */ I("li", {
932
- className: "flex items-center gap-2 rounded-lg border border-tertiary p-2",
933
- children: [
934
- /* @__PURE__ */ F(ie, {
935
- 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,
936
1209
  "aria-hidden": !0,
937
- stroke: _
938
- }),
939
- /* @__PURE__ */ I("div", {
940
- className: "flex min-w-0 flex-1 flex-col",
941
- children: [
942
- /* @__PURE__ */ F("span", {
943
- className: "dial-small-text truncate",
944
- children: e.path
945
- }),
946
- /* @__PURE__ */ F("span", {
947
- className: "dial-tiny-text text-secondary",
948
- children: s(e.file.size)
949
- }),
950
- r && t?.error && /* @__PURE__ */ F(x, { text: t.error }),
951
- n && !r && /* @__PURE__ */ F("span", {
952
- className: "dial-tiny-text text-secondary",
953
- children: l.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
954
- })
955
- ]
1210
+ stroke: x
956
1211
  }),
957
- /* @__PURE__ */ F(w, {
958
- icon: /* @__PURE__ */ F(le, {
959
- size: 16,
960
- "aria-hidden": !0,
961
- stroke: _
962
- }),
963
- "aria-label": l.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
964
- onClick: () => ce(e.id)
965
- })
966
- ]
1212
+ "aria-label": _.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
1213
+ "aria-describedby": i ? a : void 0,
1214
+ onClick: () => H(e.id)
1215
+ })]
967
1216
  }, e.id);
968
1217
  })
969
1218
  }),
970
- C && /* @__PURE__ */ F(x, { text: C })
1219
+ /* @__PURE__ */ F(D, {
1220
+ text: N,
1221
+ announce: M.Assertive
1222
+ })
971
1223
  ]
972
1224
  })
973
1225
  });
974
- }, ot = {
975
- title: "_title_5md1a_1",
976
- helperText: "_helperText_5md1a_5",
977
- refineFeedback: "_refineFeedback_5md1a_9",
978
- refineError: "_refineError_5md1a_13"
979
- }, st = {
980
- 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,
981
1283
  targetFolderPath: ""
982
- }, 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 () => {
983
- 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();
984
1286
  return { default: e };
985
- }), 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 }) => {
986
- 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({
987
1289
  name: r?.name ?? "",
988
1290
  description: r?.description ?? "",
989
1291
  instructions: r?.instructions ?? ""
990
- }), ke = me(), G = V(void 0), Ae = l({
991
- bottomGap: lt,
992
- minHeight: ut
993
- }), 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) => {
994
1298
  let t = {
995
- ...je.current,
1299
+ ...Fe.current,
996
1300
  ...e
997
1301
  };
998
- je.current = t, Oe(t), L?.(t);
999
- }, Fe = (e) => e ? async (t, n) => {
1000
- if (G.current && !G.current.aborted) throw new DOMException("Busy", "AbortError");
1001
- 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;
1002
1306
  try {
1003
1307
  return await e(t, n);
1004
1308
  } finally {
1005
- G.current === n && (G.current = void 0);
1309
+ U.current === n && (U.current = void 0);
1006
1310
  }
1007
- } : void 0, Le = u({
1008
- value: W.description,
1009
- onChange: (e) => Me({ description: e }),
1010
- onRefine: Fe(ie),
1011
- 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,
1012
1316
  resetKey: r
1013
- }), J = u({
1014
- value: W.instructions,
1015
- onChange: (e) => Me({ instructions: e }),
1016
- onRefine: Fe(se),
1017
- 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,
1018
1322
  resetKey: r
1019
- }), Be = Le.isPending || J.isPending, He = () => {
1020
- 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();
1021
1329
  }, Ue = () => {
1022
- He(), ye();
1023
- }, Ge = () => {
1024
- He(), be();
1025
- }, Ke = () => {
1026
- O || T || D || G.current && !G.current.aborted || ve(W);
1027
- }, qe = V(r), Ye = qe.current !== r, et = V(i);
1028
- pe(() => {
1029
- 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;
1030
1334
  let e = {
1031
1335
  name: r?.name ?? "",
1032
1336
  description: r?.description ?? "",
1033
1337
  instructions: r?.instructions ?? ""
1034
1338
  };
1035
- je.current = e, Oe(e), et.current = i;
1339
+ Fe.current = e, je(e), Ke.current = i, Je(!1);
1036
1340
  }, [r]);
1037
- let tt = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), nt = V(!1);
1038
- pe(() => {
1039
- 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;
1040
1344
  let e = {
1041
1345
  name: r?.name ?? "",
1042
1346
  description: r?.description ?? "",
1043
1347
  instructions: r?.instructions ?? ""
1044
- }, t = JSON.stringify(W) !== JSON.stringify(e) || tt(i) !== tt(et.current);
1045
- 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));
1046
1350
  }, [
1047
- W,
1351
+ H,
1048
1352
  i,
1049
1353
  r,
1050
- Ye,
1051
- N
1354
+ Ge,
1355
+ qe,
1356
+ ie
1052
1357
  ]);
1053
- let [rt, it] = H(K), X = s ?? rt, Z = z((e) => {
1054
- it(e), _?.(e);
1055
- }, [_]), [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) => {
1056
1361
  let t = [...e];
1057
- gt(t), S?.(t);
1058
- }, [S]), [bt, xt] = H(!1), [St, Ct] = H(st), wt = z((e) => {
1059
- Ct(e), xt(!0);
1060
- }, []), [Tt, Et] = H(!1), { isDragActive: Dt, dropZoneHandlers: Ot } = Xe(z((e) => {
1061
- bt || wt({
1062
- ...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,
1063
1368
  initialFiles: e
1064
1369
  });
1065
- }, [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({
1066
- "--se-title-color": $?.title,
1067
- "--se-helper-text-color": $?.helperText,
1068
- "--se-refine-action-text": $?.refineActionText,
1069
- "--se-refine-error-text": $?.refineErrorText
1070
- }), Ft = {
1071
- feedbackClassName: c($?.refineActionText && ot.refineFeedback, kt.refineFeedbackClassName, Re.refineFeedback),
1072
- errorClassName: ot.refineError
1073
- }, It = {
1074
- layout: $?.border ? { colors: {
1075
- headerBorderColor: $.border,
1076
- 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
1077
1390
  } } : void 0,
1078
- section: $?.title ? { colors: { titleColor: $.title } } : void 0
1079
- }, Lt = B(() => ({
1080
- required: Q.folderNameRequiredError ?? "Enter a folder name",
1081
- invalid: Q.folderNameInvalidError ?? "Folder name can't contain / or \\, or be . or ..",
1082
- 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
+ }
1083
1408
  }), [
1084
- Q.folderNameRequiredError,
1085
- Q.folderNameInvalidError,
1086
- Q.folderNameDuplicateError
1087
- ]), Rt = z((e) => {
1088
- vt.has(e) || yt(new Set([...vt, e]));
1089
- }, [vt, yt]), zt = Je({
1409
+ N,
1410
+ Yt,
1411
+ Jt
1412
+ ]), Zt = mt({
1090
1413
  files: i,
1091
- fileActions: R,
1092
- defaultName: Q.newFolderDefaultName ?? "New folder",
1093
- messages: Lt,
1094
- onRevealFolder: Rt,
1095
- onCreated: Z
1096
- }), { 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([{
1097
1420
  path: K,
1098
1421
  name: K,
1099
1422
  kind: q.File
1100
- }, ...i]), [i]), Wt = B(() => Bt ? Ve([
1423
+ }, ...i]), [i]), nn = z(() => Qt ? at([
1101
1424
  {
1102
1425
  path: K,
1103
1426
  name: K,
1104
1427
  kind: q.File
1105
1428
  },
1106
1429
  ...i,
1107
- Bt
1108
- ]) : Ut, [
1430
+ Qt
1431
+ ]) : tn, [
1109
1432
  i,
1110
- Bt,
1111
- Ut
1112
- ]), Gt = B(() => i.find((e) => e.path === X), [i, X]), Kt = z((e) => {
1113
- e.path !== Vt && Z(e.path);
1114
- }, [Z, Vt]), qt = z((e) => {
1115
- 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);
1116
1444
  }, [
1117
- R,
1118
- X,
1119
- Z
1120
- ]), { startDraft: Jt } = zt, { onCreateFolder: Yt, extractArchive: Xt, pickFromFileSystem: Zt } = R, Qt = z(async (e) => {
1121
- if (!Zt) return;
1122
- let t = await Zt();
1123
- t?.length && wt({
1124
- 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,
1125
1461
  targetFolderPath: e,
1126
1462
  initialEntries: t
1127
1463
  });
1128
- }, [Zt, wt]), $t = z((e, t) => {
1129
- let n = (e) => Qe(e, Nt), r = [];
1130
- 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({
1131
1467
  key: "create-folder",
1132
- label: Q.createFolderLabel ?? "Create folder",
1133
- icon: n(oe),
1134
- onClick: () => Jt(e, t)
1468
+ label: Z.createFolderLabel ?? "Create folder",
1469
+ icon: n(ve),
1470
+ onClick: () => gn(e, t)
1135
1471
  }), r.push({
1136
1472
  key: "upload-files",
1137
- label: Q.uploadFilesLabel ?? "Upload files from device",
1138
- icon: n(ue),
1139
- onClick: () => wt({
1140
- mode: Ze.Files,
1473
+ label: Z.uploadFilesLabel ?? "Upload files from device",
1474
+ icon: n(Se),
1475
+ onClick: () => St({
1476
+ mode: _t.Files,
1141
1477
  targetFolderPath: e
1142
1478
  })
1143
- }), Xt && r.push({
1479
+ }), fn && r.push({
1144
1480
  key: "upload-archive",
1145
- label: Q.uploadArchiveLabel ?? "Upload archive from device",
1146
- icon: n(ae),
1147
- onClick: () => wt({
1148
- mode: Ze.Archive,
1481
+ label: Z.uploadArchiveLabel ?? "Upload archive from device",
1482
+ icon: n(_e),
1483
+ onClick: () => St({
1484
+ mode: _t.Archive,
1149
1485
  targetFolderPath: e
1150
1486
  })
1151
- }), Zt && r.push({
1487
+ }), pn && r.push({
1152
1488
  key: "open-file-system",
1153
- label: Q.openFileSystemLabel ?? "Open DIAL file system",
1154
- icon: n(re),
1155
- onClick: () => void Qt(e)
1489
+ label: Z.openFileSystemLabel ?? "Open DIAL file system",
1490
+ icon: n(L),
1491
+ onClick: () => void vn(e)
1156
1492
  }), r;
1157
1493
  }, [
1158
- Nt,
1159
- Yt,
1160
- Xt,
1161
- Zt,
1162
- Q.createFolderLabel,
1163
- Q.uploadFilesLabel,
1164
- Q.uploadArchiveLabel,
1165
- Q.openFileSystemLabel,
1166
- Jt,
1167
- wt,
1168
- Qt
1169
- ]), en = B(() => {
1170
- 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));
1171
1507
  return {
1172
- [Y.Mobile]: $t(e, Y.Mobile),
1173
- [Y.Desktop]: $t(e, Y.Desktop)
1508
+ [Y.Mobile]: yn(e, Y.Mobile),
1509
+ [Y.Desktop]: yn(e, Y.Desktop)
1174
1510
  };
1175
1511
  }, [
1176
- $t,
1512
+ yn,
1177
1513
  i,
1178
- X
1179
- ]), tn = z((e, t) => {
1180
- 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 [];
1181
1517
  let n = {
1182
1518
  path: e.path,
1183
1519
  name: e.name,
1184
1520
  kind: q.Folder
1185
- }, r = $t(We(ze.Child, n), t);
1521
+ }, r = yn(ct(rt.Child, n), t);
1186
1522
  return r.push({
1187
- key: "add-sibling",
1188
- icon: Qe(ce),
1189
- label: Q.addSiblingLabel ?? "Add sibling",
1190
- children: $t(We(ze.Sibling, n), t)
1191
- }, {
1192
1523
  key: "delete",
1193
- label: Q.deleteLabel ?? "Delete",
1524
+ label: Z.deleteLabel ?? "Delete",
1194
1525
  danger: !0,
1195
- icon: Qe(le, Mt),
1196
- onClick: () => qt(e.path)
1526
+ icon: vt(xe, At),
1527
+ onClick: () => ln(e.path)
1197
1528
  }), r;
1198
1529
  }, [
1199
- Vt,
1200
- Q.addSiblingLabel,
1201
- Q.deleteLabel,
1202
- Mt,
1203
1530
  $t,
1204
- qt
1205
- ]), nn = B(() => ({
1206
- [Y.Mobile]: (e) => tn(e, Y.Mobile),
1207
- [Y.Desktop]: (e) => tn(e, Y.Desktop)
1208
- }), [tn]), rn = z((e) => e.nodeType === he.FOLDER || e.path === "SKILL.md" ? null : /* @__PURE__ */ F(w, {
1209
- size: b.Small,
1210
- icon: Qe(le, Mt, g.SM),
1211
- "aria-label": Q.deleteLabel ?? "Delete",
1212
- 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)
1213
1543
  }), [
1214
- Q.deleteLabel,
1215
- Mt,
1216
- qt
1217
- ]), an = (e) => /* @__PURE__ */ I("div", {
1544
+ Z.deleteLabel,
1545
+ At,
1546
+ ln
1547
+ ]), wn = (e) => /* @__PURE__ */ I("div", {
1218
1548
  className: "flex flex-col gap-2 desktop:gap-5",
1219
1549
  children: [/* @__PURE__ */ I("div", {
1220
1550
  className: "flex items-center justify-between",
1221
1551
  children: [/* @__PURE__ */ F("span", {
1222
- className: c(ot.title, At),
1223
- children: Q.filesHeading ?? "Files"
1224
- }), /* @__PURE__ */ F(p, {
1225
- label: Q.addLabel ?? "Add",
1226
- variant: m.Neutral,
1227
- appearance: f.Solid,
1228
- size: b.Small,
1229
- 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]
1230
1560
  })]
1231
1561
  }), /* @__PURE__ */ F("div", {
1232
1562
  role: "tree",
1233
- "aria-label": Q.filesTreeAriaLabel ?? "Skill files",
1234
- children: /* @__PURE__ */ F(ge, {
1235
- items: Ht === e ? Wt : Ut,
1563
+ "aria-label": Z.filesTreeAriaLabel ?? "Skill files",
1564
+ children: /* @__PURE__ */ F(ke, {
1565
+ items: en === e ? nn : tn,
1236
1566
  showFiles: !0,
1237
- selectedPath: X,
1238
- expandedPaths: vt,
1239
- onExpandedPathsChange: yt,
1240
- onItemClick: Kt,
1241
- getContextMenuItems: nn[e],
1242
- renderItemActions: rn,
1243
- renamedPath: Ht === e ? Vt : void 0,
1244
- onRenameSave: zt.handleSave,
1245
- onRenameCancel: zt.handleCancel,
1246
- 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,
1247
1577
  rootItemPath: ""
1248
1578
  })
1249
1579
  })]
1250
- }), on = B(() => ({
1251
- name: W.name,
1252
- description: W.description,
1580
+ }), Tn = z(() => ({
1581
+ name: H.name,
1582
+ description: H.description,
1253
1583
  iconUrl: "",
1254
1584
  version: "",
1255
1585
  topics: [],
1256
1586
  otherLocales: []
1257
- }), [W.name, W.description]), sn = B(() => ({
1258
- name: k?.name,
1259
- description: k?.description
1260
- }), [k?.name, k?.description]), cn = B(() => ({ form: {
1261
- ...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,
1262
1592
  name: {
1263
- label: Q.nameLabel ?? "Name",
1264
- placeholder: Q.namePlaceholder ?? "good-morning-breakfast"
1593
+ label: Z.nameLabel ?? "Name",
1594
+ placeholder: Z.namePlaceholder ?? "good-morning-breakfast"
1265
1595
  },
1266
1596
  description: {
1267
- label: Q.descriptionLabel ?? "Description",
1268
- 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"
1269
1599
  },
1270
1600
  ariaLabel: void 0
1271
1601
  } }), [
1272
- Q.nameLabel,
1273
- Q.namePlaceholder,
1274
- Q.descriptionLabel,
1275
- Q.descriptionPlaceholder
1276
- ]), ln = (e) => {
1277
- e.name !== void 0 && Me({ name: e.name }), e.description !== void 0 && (Le.reset(), Me({ description: e.description }));
1278
- }, 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, {
1279
1609
  isEnabled: !0,
1280
1610
  fieldId: t,
1281
1611
  required: !0,
1282
- label: Q.descriptionLabel ?? "Description",
1283
- labels: Q,
1284
- refinement: Le,
1285
- disabled: Be || O,
1286
- ...Ft,
1612
+ label: Z.descriptionLabel ?? "Description",
1613
+ labels: Z,
1614
+ refinement: Re,
1615
+ disabled: ze || C,
1616
+ ...Gt,
1287
1617
  children: e
1288
- }) : void 0, dn = {
1289
- title: Se,
1290
- onBack: Ge,
1291
- onCancel: Ue,
1292
- onSubmit: Ke,
1293
- submitLabel: Q.createLabel ?? "Create",
1294
- 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,
1295
1625
  labels: {
1296
- cancelLabel: Q.cancelLabel ?? "Cancel",
1297
- backAriaLabel: xe ?? "Back",
1298
- savingStatusLabel: Q.savingStatusLabel ?? "Saving"
1626
+ cancelLabel: Z.cancelLabel ?? "Cancel",
1627
+ backAriaLabel: me ?? "Back",
1628
+ savingStatusLabel: Z.savingStatusLabel ?? "Saving"
1299
1629
  },
1300
- styles: It,
1630
+ styles: Kt,
1301
1631
  metadataTitle: null
1302
1632
  };
1303
- if (T) return /* @__PURE__ */ F("div", {
1304
- dir: Ee,
1633
+ if (h) return /* @__PURE__ */ F("div", {
1634
+ dir: Te,
1305
1635
  className: "relative flex min-h-0 flex-1 flex-col",
1306
- children: /* @__PURE__ */ F(Ne, {
1307
- ...dn,
1636
+ children: /* @__PURE__ */ F(Qe, {
1637
+ ...An,
1308
1638
  metadata: /* @__PURE__ */ F("div", {
1309
- role: "status",
1310
- "aria-label": Q.loadingAriaLabel ?? "Loading skill",
1311
1639
  className: "flex flex-1 items-center justify-center p-8",
1312
- children: /* @__PURE__ */ F(ne, {})
1640
+ children: /* @__PURE__ */ F(fe, { ariaLabel: Z.loadingAriaLabel ?? "Loading skill" })
1313
1641
  })
1314
1642
  })
1315
1643
  });
1316
- if (D) return /* @__PURE__ */ F("div", {
1317
- dir: Ee,
1644
+ if (S) return /* @__PURE__ */ F("div", {
1645
+ dir: Te,
1318
1646
  className: "relative flex min-h-0 flex-1 flex-col",
1319
- children: /* @__PURE__ */ F(Ne, {
1320
- ...dn,
1321
- metadata: /* @__PURE__ */ I("div", {
1322
- role: "alert",
1323
- className: "flex flex-col items-center gap-4 p-8",
1324
- children: [/* @__PURE__ */ F(x, { text: Q.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ F(A, {
1325
- label: Q.retryLabel ?? "Retry",
1326
- onClick: Ce
1327
- })]
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
+ })
1328
1659
  })
1329
1660
  })
1330
1661
  });
1331
- 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", {
1332
1663
  className: "flex flex-col gap-2",
1333
- children: [ee != null && /* @__PURE__ */ I("div", {
1664
+ children: [k != null && /* @__PURE__ */ I("div", {
1334
1665
  className: "flex items-center gap-2",
1335
- children: [/* @__PURE__ */ F(x, { text: ee }), we != null && /* @__PURE__ */ F(C, {
1336
- label: Q.retryLabel ?? "Retry",
1337
- onClick: we
1666
+ children: [/* @__PURE__ */ F(D, { text: k }), ye != null && /* @__PURE__ */ F(A, {
1667
+ label: Z.retryLabel ?? "Retry",
1668
+ onClick: ye
1338
1669
  })]
1339
- }), te != null && /* @__PURE__ */ I("div", {
1670
+ }), j != null && /* @__PURE__ */ I("div", {
1340
1671
  className: "flex items-center gap-2",
1341
- children: [/* @__PURE__ */ F(x, { text: te.message }), /* @__PURE__ */ F(C, {
1342
- label: Q.reloadLatestLabel ?? "Reload latest",
1343
- onClick: j
1672
+ children: [/* @__PURE__ */ F(D, { text: j.message }), /* @__PURE__ */ F(A, {
1673
+ label: Z.reloadLatestLabel ?? "Reload latest",
1674
+ onClick: ne
1344
1675
  })]
1345
1676
  })]
1346
- }) : void 0, hn = /* @__PURE__ */ F(a, {
1347
- isEnabled: !!se,
1348
- fieldId: ke,
1677
+ }) : void 0, Fn = /* @__PURE__ */ F(a, {
1678
+ isEnabled: !!oe,
1679
+ fieldId: Me,
1349
1680
  required: !0,
1350
- labelClassName: c(ot.helperText, jt),
1351
- label: Q.instructionsLabel ?? "Instructions",
1352
- labels: Q,
1353
- refinement: J,
1354
- disabled: Be || O,
1355
- ...Ft,
1681
+ labelClassName: c(It.helperText, kt),
1682
+ label: Z.instructionsLabel ?? "Instructions",
1683
+ labels: Z,
1684
+ refinement: W,
1685
+ disabled: ze || C,
1686
+ ...Gt,
1356
1687
  children: /* @__PURE__ */ I("div", {
1357
1688
  className: "flex flex-1 flex-col gap-2",
1358
1689
  children: [
1359
- !se && /* @__PURE__ */ F(E, {
1360
- htmlFor: ke,
1361
- className: c(ot.helperText, jt),
1362
- label: Q.instructionsLabel ?? "Instructions",
1690
+ !oe && /* @__PURE__ */ F(te, {
1691
+ htmlFor: Me,
1692
+ className: c(It.helperText, kt),
1693
+ label: Z.instructionsLabel ?? "Instructions",
1363
1694
  required: !0
1364
1695
  }),
1365
1696
  /* @__PURE__ */ F("div", {
1366
- ref: Ae,
1697
+ ref: Pe,
1367
1698
  className: c(t, e, n),
1368
- children: /* @__PURE__ */ F(de, {
1369
- fallback: /* @__PURE__ */ F(ne, { ariaLabel: Q.instructionsLoadingAriaLabel ?? "Loading" }),
1370
- children: /* @__PURE__ */ F(mt, {
1371
- id: ke,
1372
- ariaLabel: Q.instructionsLabel ?? "Instructions",
1373
- 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,
1374
1705
  onChange: (e) => {
1375
- J.reset(), Me({ instructions: e });
1706
+ W.reset(), Ie({ instructions: e });
1376
1707
  },
1377
- theme: De,
1708
+ theme: Ae,
1378
1709
  showDragbar: !1,
1379
- placeholder: Q.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
1710
+ placeholder: Z.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
1380
1711
  })
1381
1712
  })
1382
1713
  }),
1383
- k?.instructions != null && /* @__PURE__ */ F(x, { text: k.instructions })
1714
+ O?.instructions != null && /* @__PURE__ */ F(D, {
1715
+ id: Ne,
1716
+ text: O.instructions
1717
+ })
1384
1718
  ]
1385
1719
  })
1386
1720
  });
1387
1721
  return /* @__PURE__ */ I("div", {
1388
- dir: Ee,
1389
- className: c("relative flex min-h-0 flex-1 flex-col", Re.root),
1390
- style: Pt,
1391
- ...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,
1392
1726
  children: [
1393
- /* @__PURE__ */ F($e, {
1394
- isVisible: Dt && !bt,
1395
- labels: Te
1727
+ /* @__PURE__ */ F(Ct, {
1728
+ isVisible: Dt && !pt,
1729
+ labels: be,
1730
+ titleClassName: $.dropOverlayTitleClassName,
1731
+ subtitleClassName: $.dropOverlaySubtitleClassName
1396
1732
  }),
1397
- /* @__PURE__ */ F(Ne, {
1398
- ...dn,
1399
- asideData: _e,
1400
- asideSectionClassName: ft,
1401
- isSubmitting: O,
1402
- metadataSectionClassName: dt,
1733
+ /* @__PURE__ */ F(Qe, {
1734
+ ...An,
1735
+ asideData: le,
1736
+ asideSectionClassName: Ht,
1737
+ isSubmitting: C,
1738
+ metadataSectionClassName: Vt,
1403
1739
  metadata: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
1404
1740
  className: "desktop:hidden",
1405
- children: /* @__PURE__ */ F(d, {
1406
- title: Q.editingFileLabel ?? "Editing file",
1407
- description: Gt?.name ?? "SKILL.md",
1408
- expanded: Tt,
1741
+ children: /* @__PURE__ */ F(Tt, {
1742
+ label: Z.editingFileLabel ?? "Editing file",
1743
+ fileName: jn ? K : Mn,
1744
+ isExpanded: wt,
1409
1745
  onToggle: Et,
1410
- ariaLabel: Q.editingFileLabel ?? "Editing file",
1411
- children: an(Y.Mobile)
1746
+ labelClassName: $.editingFileLabelClassName,
1747
+ fileNameClassName: $.editingFileNameClassName,
1748
+ children: wn(Y.Mobile)
1412
1749
  })
1413
1750
  }), /* @__PURE__ */ F("div", {
1414
1751
  className: "hidden desktop:block",
1415
- children: an(Y.Desktop)
1752
+ children: wn(Y.Desktop)
1416
1753
  })] }),
1417
- alert: mn,
1418
- setupTitle: pn,
1419
- setupSectionClassName: pt,
1420
- setup: fn ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(Ie, {
1421
- values: on,
1422
- errors: sn,
1423
- onChange: ln,
1424
- 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,
1425
1762
  isDescriptionRequired: !0,
1426
- isNameReadOnly: M,
1427
- nameCaption: k?.name ? void 0 : Q.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
1428
- renderDescription: un,
1429
- labels: cn
1430
- }), hn] }) : /* @__PURE__ */ F(P, { children: Gt?.kind === q.File && /* @__PURE__ */ F("div", {
1431
- className: "flex min-h-0 flex-1 flex-col",
1432
- 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." })
1433
- }) })
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
+ }
1434
1805
  }),
1435
- /* @__PURE__ */ F(at, {
1436
- isOpen: bt,
1437
- onClose: () => xt(!1),
1438
- fileActions: R,
1439
- mode: St.mode,
1440
- targetFolderPath: St.targetFolderPath,
1441
- initialFiles: St.initialFiles,
1442
- initialEntries: St.initialEntries,
1443
- 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
1444
1818
  })
1445
1819
  ]
1446
1820
  });
1447
1821
  };
1448
1822
  //#endregion
1449
- 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 };