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