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