@yuku123/z-team-component 0.2.103 → 0.2.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/ChangeLogView-B0ML82u0.js +542 -0
  2. package/dist/ComponentDoc-C_289lsE.js +8035 -0
  3. package/dist/InvitationManagementPage-D2ezz4ZQ.js +495 -0
  4. package/dist/OnboardingPage-BXsJ-kcJ.js +393 -0
  5. package/dist/ScheduledTasks-Cn8BsDkN.js +12127 -0
  6. package/dist/SystemShell-gcfNlt2L.js +688 -0
  7. package/dist/_commonjsHelpers-B52_cu2H.js +26 -0
  8. package/dist/admin-logs-B6K1DwRL.js +198 -0
  9. package/dist/api-BdP8mK8v.js +101 -0
  10. package/dist/api-DxSgE7qw.js +20 -0
  11. package/dist/browser-jb_PFvU3.js +1538 -0
  12. package/dist/createWorkspaceWsHandler-DcNA1pfi.js +13142 -0
  13. package/dist/ctc-sso-DtJHC-2M.js +117 -0
  14. package/dist/echarts-B1OU1xr4.js +16 -0
  15. package/dist/history-BlrA1eaW.js +41 -0
  16. package/dist/index-54iTaRVW.js +316 -0
  17. package/dist/index-BCw3Oxp1.js +42049 -0
  18. package/dist/index-BDq0ofl2.js +348 -0
  19. package/dist/index-BN-o5nZM.js +8 -0
  20. package/dist/index-B_LJRFsK.js +339 -0
  21. package/dist/index-Bf1K9zpk.js +112 -0
  22. package/dist/index-BfMFQ6RD.js +169 -0
  23. package/dist/index-BohoJQPr.js +7631 -0
  24. package/dist/index-C-8n6xxK.js +93 -0
  25. package/dist/index-C815hPWS.js +430 -0
  26. package/dist/index-C8m8s-SU.js +479 -0
  27. package/dist/index-CXJXSmhB.js +2217 -0
  28. package/dist/index-CdugR2_4.js +5892 -0
  29. package/dist/index-CeCsncoT.js +913 -0
  30. package/dist/index-CgCB0-yK.js +1645 -0
  31. package/dist/index-Cjddvrij.js +2699 -0
  32. package/dist/index-D487Inba.js +315 -0
  33. package/dist/index-DK71mfJn.js +999 -0
  34. package/dist/index-DLHcoHS9.js +189 -0
  35. package/dist/index-DUiFk01c.js +178 -0
  36. package/dist/index-DWsfQMp8.js +208 -0
  37. package/dist/index-DgN13A-E.js +10169 -0
  38. package/dist/index-DhDdFRHC.js +279 -0
  39. package/dist/index-DpLamT1r.js +574 -0
  40. package/dist/index-Dpii3P5J.js +1302 -0
  41. package/dist/index-DszzQwsc.js +956 -0
  42. package/dist/index-HJ3Kt-NT.js +358 -0
  43. package/dist/index-Nj-dlFKY.js +242 -0
  44. package/dist/index-ZuYJoo9E.js +118 -0
  45. package/dist/index-etyS3HY2.js +142 -0
  46. package/dist/index-jIh52A4c.js +132 -0
  47. package/dist/index.js +10 -0
  48. package/dist/index.module-CAa-2T7m.js +72 -0
  49. package/dist/index.module-UI0iz8K0.js +42 -0
  50. package/dist/instance-p-ezisoS.js +216 -0
  51. package/dist/menuPermission-u3Gd_c8S.js +60 -0
  52. package/dist/mobile-client-O3yr9h6t.js +24 -0
  53. package/dist/pages.js +21 -0
  54. package/dist/send-default-agent-team-message-BhIV6T6O.js +35 -0
  55. package/dist/spark-md5-Dld54a-T.js +178 -0
  56. package/dist/sso-user-Ib1jhF7t.js +43 -0
  57. package/dist/training-D3Uy5K_M.js +450 -0
  58. package/dist/webide-BGQnArzY.js +5233 -0
  59. package/dist/z-team-component.css +1 -0
  60. package/package.json +1 -1
@@ -0,0 +1,913 @@
1
+ import { jsxs as i, jsx as e, Fragment as le } from "react/jsx-runtime";
2
+ import { useState as u, useEffect as re, useCallback as O } from "react";
3
+ import { a as U, f as $, B, b as D, u as F } from "./ComponentDoc-C_289lsE.js";
4
+ import { SearchOutlined as Ce, ReloadOutlined as Se, PlusOutlined as Te, FileZipOutlined as Z, CloudDownloadOutlined as Y, EditOutlined as he, UserSwitchOutlined as be, ArrowLeftOutlined as fe, UserOutlined as Ue, CloudUploadOutlined as $e, PictureOutlined as de, EyeOutlined as Be } from "@ant-design/icons";
5
+ import { message as b, Input as H, Tooltip as se, Button as g, Spin as ce, Empty as De, Popconfirm as pe, Tag as ie, Modal as Re, Select as Pe, Upload as me, Tabs as Le } from "antd";
6
+ import ve from "react-markdown";
7
+ import _e from "rehype-highlight";
8
+ import ge from "remark-gfm";
9
+ import { M as na } from "./index-Cjddvrij.js";
10
+ function j(a) {
11
+ return a ? `?token=${encodeURIComponent(a)}` : "";
12
+ }
13
+ function P(a) {
14
+ return a && a.startsWith("http://") && a.includes(".aliyuncs.com/") ? "https://" + a.slice(7) : a;
15
+ }
16
+ function X(a) {
17
+ return {
18
+ ...a,
19
+ coverUrl: P(a.coverUrl),
20
+ fileUrl: P(a.fileUrl)
21
+ };
22
+ }
23
+ async function Ie(a = {}, n = "") {
24
+ const l = new URLSearchParams();
25
+ n && l.set("token", n), a.category && l.set("category", a.category), a.keyword && l.set("keyword", a.keyword), a.mine && l.set("mine", "true");
26
+ const r = l.toString(), c = await U(
27
+ `${B}/market/resources${r ? `?${r}` : ""}`,
28
+ $
29
+ );
30
+ return (await D(
31
+ c,
32
+ "获取资源列表失败"
33
+ )).map(X);
34
+ }
35
+ async function ye(a, n = "") {
36
+ const l = await U(
37
+ `${B}/market/resources/${a}${j(n)}`,
38
+ $
39
+ ), r = await D(
40
+ l,
41
+ "获取资源详情失败"
42
+ );
43
+ return X(r);
44
+ }
45
+ async function Me(a, n, l = "") {
46
+ const r = new URLSearchParams();
47
+ r.set("publish", n ? "true" : "false"), l && r.set("token", l);
48
+ const c = await U(`${B}/market/resources?${r.toString()}`, {
49
+ ...$,
50
+ method: "POST",
51
+ headers: { "Content-Type": "application/json" },
52
+ body: JSON.stringify({
53
+ ...a,
54
+ coverUrl: P(a.coverUrl ?? null),
55
+ fileUrl: P(a.fileUrl ?? null)
56
+ })
57
+ }), h = await D(c, "新建资源失败");
58
+ return X(h);
59
+ }
60
+ async function we(a, n, l, r = "") {
61
+ const c = new URLSearchParams();
62
+ l !== null && c.set("publish", l ? "true" : "false"), r && c.set("token", r);
63
+ const h = c.toString(), d = await U(
64
+ `${B}/market/resources/${a}${h ? `?${h}` : ""}`,
65
+ {
66
+ ...$,
67
+ method: "PUT",
68
+ headers: { "Content-Type": "application/json" },
69
+ body: JSON.stringify({
70
+ ...n,
71
+ coverUrl: P(n.coverUrl ?? null),
72
+ fileUrl: P(n.fileUrl ?? null)
73
+ })
74
+ }
75
+ ), v = await D(d, "保存资源失败");
76
+ return X(v);
77
+ }
78
+ async function Ne(a, n = "") {
79
+ const l = await U(
80
+ `${B}/market/resources/${a}${j(n)}`,
81
+ { ...$, method: "DELETE" }
82
+ );
83
+ return D(l, "删除资源失败");
84
+ }
85
+ async function ke(a, n = "", l) {
86
+ const r = new URLSearchParams();
87
+ n && r.set("token", n);
88
+ const c = await U(
89
+ `${B}/market/resources/${a}/download?${r.toString()}`,
90
+ { ...$, method: "POST" }
91
+ ), h = await D(c, "下载失败");
92
+ return {
93
+ ...h,
94
+ fileUrl: P(h.fileUrl) ?? h.fileUrl
95
+ };
96
+ }
97
+ async function Oe(a, n = "") {
98
+ const l = new FormData();
99
+ l.append("file", a);
100
+ const r = await U(
101
+ `${B}/market/upload-package${j(n)}`,
102
+ { ...$, method: "POST", body: l }
103
+ ), c = await D(r, "上传资源包失败");
104
+ return { ...c, url: P(c.url) ?? c.url };
105
+ }
106
+ async function xe(a, n = "") {
107
+ const l = new FormData();
108
+ l.append("file", a);
109
+ const r = await U(`${B}/market/upload-cover${j(n)}`, {
110
+ ...$,
111
+ method: "POST",
112
+ body: l
113
+ }), c = await D(r, "上传封面失败");
114
+ return { ...c, url: P(c.url) ?? c.url };
115
+ }
116
+ async function ue(a, n = "") {
117
+ const l = new URLSearchParams();
118
+ a && l.set("keyword", a), n && l.set("token", n);
119
+ const r = l.toString(), c = await U(
120
+ `${B}/market/users${r ? `?${r}` : ""}`,
121
+ $
122
+ );
123
+ return D(c, "搜索用户失败");
124
+ }
125
+ async function Ee(a, n, l = "") {
126
+ const r = await U(
127
+ `${B}/market/resources/${a}/transfer-owner${j(l)}`,
128
+ {
129
+ ...$,
130
+ method: "POST",
131
+ headers: { "Content-Type": "application/json" },
132
+ body: JSON.stringify({ targetStaffId: n })
133
+ }
134
+ );
135
+ return D(r, "转交失败");
136
+ }
137
+ const Fe = "_tabBody_1ouee_3", Ae = "_comingSoon_1ouee_3", ze = "_comingSoonIcon_1ouee_22", We = "_comingSoonTitle_1ouee_26", He = "_comingSoonDesc_1ouee_32", je = "_listWrap_1ouee_37", Ge = "_toolbar_1ouee_41", Ke = "_toolbarCount_1ouee_48", Ve = "_toolbarRight_1ouee_53", qe = "_emptyWrap_1ouee_59", Je = "_cardGrid_1ouee_64", Ze = "_card_1ouee_64", Ye = "_cardCover_1ouee_87", Qe = "_cardCoverFallback_1ouee_101", Xe = "_cardDraftBadge_1ouee_111", et = "_cardBody_1ouee_122", tt = "_cardTitle_1ouee_130", at = "_cardSummary_1ouee_139", nt = "_cardMeta_1ouee_150", ot = "_cardCreator_1ouee_158", it = "_cardDownloads_1ouee_165", lt = "_cardFileName_1ouee_171", rt = "_cardActions_1ouee_175", ct = "_cardDraftTag_1ouee_184", dt = "_editorWrap_1ouee_191", st = "_detailWrap_1ouee_192", mt = "_editorTopBar_1ouee_199", ut = "_backBtn_1ouee_209", ht = "_editorTitle_1ouee_226", ft = "_editorTopActions_1ouee_235", pt = "_editorBody_1ouee_241", vt = "_detailBody_1ouee_242", _t = "_section_1ouee_252", gt = "_sectionTitle_1ouee_259", yt = "_uploaderInner_1ouee_269", wt = "_uploaderIcon_1ouee_273", Nt = "_uploaderText_1ouee_279", kt = "_uploaderFile_1ouee_284", Ct = "_coverRow_1ouee_290", St = "_coverPreview_1ouee_296", Tt = "_coverRemove_1ouee_312", bt = "_formRow_1ouee_318", Ut = "_formLabel_1ouee_329", $t = "_docEditor_1ouee_337", Bt = "_docPreview_1ouee_343", Dt = "_docPreviewEmpty_1ouee_398", Rt = "_detailHeader_1ouee_405", Pt = "_detailCover_1ouee_414", Lt = "_detailInfo_1ouee_430", It = "_detailNameRow_1ouee_438", Mt = "_detailName_1ouee_438", Ot = "_detailSummary_1ouee_452", xt = "_detailMeta_1ouee_458", Et = "_detailActions_1ouee_467", Ft = "_detailDocSection_1ouee_473", t = {
138
+ tabBody: Fe,
139
+ comingSoon: Ae,
140
+ comingSoonIcon: ze,
141
+ comingSoonTitle: We,
142
+ comingSoonDesc: He,
143
+ listWrap: je,
144
+ toolbar: Ge,
145
+ toolbarCount: Ke,
146
+ toolbarRight: Ve,
147
+ emptyWrap: qe,
148
+ cardGrid: Je,
149
+ card: Ze,
150
+ cardCover: Ye,
151
+ cardCoverFallback: Qe,
152
+ cardDraftBadge: Xe,
153
+ cardBody: et,
154
+ cardTitle: tt,
155
+ cardSummary: at,
156
+ cardMeta: nt,
157
+ cardCreator: ot,
158
+ cardDownloads: it,
159
+ cardFileName: lt,
160
+ cardActions: rt,
161
+ cardDraftTag: ct,
162
+ editorWrap: dt,
163
+ detailWrap: st,
164
+ editorTopBar: mt,
165
+ backBtn: ut,
166
+ editorTitle: ht,
167
+ editorTopActions: ft,
168
+ editorBody: pt,
169
+ detailBody: vt,
170
+ section: _t,
171
+ sectionTitle: gt,
172
+ uploaderInner: yt,
173
+ uploaderIcon: wt,
174
+ uploaderText: Nt,
175
+ uploaderFile: kt,
176
+ coverRow: Ct,
177
+ coverPreview: St,
178
+ coverRemove: Tt,
179
+ formRow: bt,
180
+ formLabel: Ut,
181
+ docEditor: $t,
182
+ docPreview: Bt,
183
+ docPreviewEmpty: Dt,
184
+ detailHeader: Rt,
185
+ detailCover: Pt,
186
+ detailInfo: Lt,
187
+ detailNameRow: It,
188
+ detailName: Mt,
189
+ detailSummary: Ot,
190
+ detailMeta: xt,
191
+ detailActions: Et,
192
+ detailDocSection: Ft
193
+ }, At = {
194
+ "browser-plugin": "浏览器插件",
195
+ "ztools-plugin": "zTools 插件",
196
+ software: "软件资源"
197
+ };
198
+ function Q(a) {
199
+ return !a || a <= 0 ? "-" : a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(1)} KB` : a < 1024 * 1024 * 1024 ? `${(a / 1024 / 1024).toFixed(1)} MB` : `${(a / 1024 / 1024 / 1024).toFixed(2)} GB`;
200
+ }
201
+ function zt({
202
+ resources: a,
203
+ loading: n,
204
+ category: l,
205
+ onReload: r,
206
+ onCreate: c,
207
+ onOpenDetail: h,
208
+ onEdit: d
209
+ }) {
210
+ const v = F((o) => o.token), k = F((o) => o.currentUser), w = k != null && k.id ? String(k.id) : "", [C, m] = u(""), [S, M] = u(null), [p, T] = u(null), [L, I] = u([]), [x, R] = u(!1), [f, y] = u(null), [G, A] = u(!1), [z, K] = u(a);
211
+ re(() => {
212
+ K(a);
213
+ }, [a]);
214
+ const E = C.trim() ? z.filter(
215
+ (o) => o.name.toLowerCase().includes(C.trim().toLowerCase()) || (o.summary ?? "").toLowerCase().includes(C.trim().toLowerCase())
216
+ ) : z, V = O(
217
+ async (o) => {
218
+ if (o.fileUrl) {
219
+ M(o.id);
220
+ try {
221
+ const N = await ke(o.id, v);
222
+ if (N.fileUrl) {
223
+ const _ = document.createElement("a");
224
+ _.href = N.fileUrl, _.download = N.fileName || o.name, _.target = "_blank", _.rel = "noopener", document.body.appendChild(_), _.click(), _.remove(), r();
225
+ }
226
+ } catch {
227
+ } finally {
228
+ M(null);
229
+ }
230
+ }
231
+ },
232
+ [v, r]
233
+ ), q = O(
234
+ async (o) => {
235
+ try {
236
+ await Ne(o, v), b.success("已删除"), r();
237
+ } catch {
238
+ }
239
+ },
240
+ [v, r]
241
+ ), ee = O(
242
+ (o) => {
243
+ T(o), y(null), I([]), R(!0), ue("", v).then(
244
+ (N) => I(
245
+ N.filter((_) => String(_.id) !== o.creatorId)
246
+ )
247
+ ).catch(() => {
248
+ }).finally(() => R(!1));
249
+ },
250
+ [v]
251
+ ), te = O(
252
+ (o) => {
253
+ R(!0), ue(o, v).then(
254
+ (N) => I(
255
+ p ? N.filter((_) => String(_.id) !== p.creatorId) : N
256
+ )
257
+ ).catch(() => {
258
+ }).finally(() => R(!1));
259
+ },
260
+ [v, p]
261
+ ), ae = O(async () => {
262
+ if (!(!p || f === null)) {
263
+ A(!0);
264
+ try {
265
+ await Ee(p.id, f, v), b.success("已转交"), T(null), r();
266
+ } catch {
267
+ } finally {
268
+ A(!1);
269
+ }
270
+ }
271
+ }, [p, f, v, r]);
272
+ return /* @__PURE__ */ i("div", { className: t.listWrap, children: [
273
+ /* @__PURE__ */ i("div", { className: t.toolbar, children: [
274
+ /* @__PURE__ */ e(
275
+ H,
276
+ {
277
+ allowClear: !0,
278
+ prefix: /* @__PURE__ */ e(Ce, { style: { color: "#999" } }),
279
+ placeholder: "搜索资源名称/简介",
280
+ value: C,
281
+ onChange: (o) => m(o.target.value),
282
+ style: { width: 260 }
283
+ }
284
+ ),
285
+ /* @__PURE__ */ i("span", { className: t.toolbarCount, children: [
286
+ "共 ",
287
+ E.length,
288
+ " 个",
289
+ At[l] ?? "资源"
290
+ ] }),
291
+ /* @__PURE__ */ i("div", { className: t.toolbarRight, children: [
292
+ /* @__PURE__ */ e(se, { title: "刷新", children: /* @__PURE__ */ e(g, { icon: /* @__PURE__ */ e(Se, {}), onClick: r }) }),
293
+ /* @__PURE__ */ e(g, { type: "primary", icon: /* @__PURE__ */ e(Te, {}), onClick: c, children: "新增资源" })
294
+ ] })
295
+ ] }),
296
+ /* @__PURE__ */ e(ce, { spinning: n, children: E.length === 0 && !n ? /* @__PURE__ */ e("div", { className: t.emptyWrap, children: /* @__PURE__ */ e(De, { description: "暂无资源,点击右上角「新增资源」上传第一个" }) }) : /* @__PURE__ */ e("div", { className: t.cardGrid, children: E.map((o) => {
297
+ const N = o.creatorId === w, _ = o.status === 0;
298
+ return /* @__PURE__ */ i(
299
+ "div",
300
+ {
301
+ className: t.card,
302
+ onClick: () => h(o),
303
+ children: [
304
+ /* @__PURE__ */ i("div", { className: t.cardCover, children: [
305
+ o.coverUrl ? /* @__PURE__ */ e("img", { src: o.coverUrl, alt: o.name }) : /* @__PURE__ */ e("div", { className: t.cardCoverFallback, children: /* @__PURE__ */ e(Z, {}) }),
306
+ _ && /* @__PURE__ */ e("span", { className: t.cardDraftBadge, children: "草稿" })
307
+ ] }),
308
+ /* @__PURE__ */ i("div", { className: t.cardBody, children: [
309
+ /* @__PURE__ */ e("div", { className: t.cardTitle, title: o.name, children: o.name }),
310
+ /* @__PURE__ */ e("div", { className: t.cardSummary, children: o.summary || "暂无简介" }),
311
+ /* @__PURE__ */ i("div", { className: t.cardMeta, children: [
312
+ /* @__PURE__ */ e("span", { className: t.cardCreator, children: o.creatorName }),
313
+ /* @__PURE__ */ i(
314
+ "span",
315
+ {
316
+ className: t.cardDownloads,
317
+ title: `累计下载 ${o.downloadCount} 次`,
318
+ children: [
319
+ /* @__PURE__ */ e(Y, {}),
320
+ " ",
321
+ o.downloadCount,
322
+ " ",
323
+ "次下载"
324
+ ]
325
+ }
326
+ ),
327
+ o.version && /* @__PURE__ */ i(
328
+ "span",
329
+ {
330
+ className: t.cardFileName,
331
+ title: `版本 ${o.version}`,
332
+ children: [
333
+ "v",
334
+ o.version
335
+ ]
336
+ }
337
+ ),
338
+ o.fileName && /* @__PURE__ */ e(
339
+ "span",
340
+ {
341
+ className: t.cardFileName,
342
+ title: `${o.fileName}(${Q(
343
+ o.fileSize
344
+ )})`,
345
+ children: Q(o.fileSize)
346
+ }
347
+ )
348
+ ] }),
349
+ /* @__PURE__ */ i(
350
+ "div",
351
+ {
352
+ className: t.cardActions,
353
+ onClick: (s) => s.stopPropagation(),
354
+ children: [
355
+ /* @__PURE__ */ e(
356
+ g,
357
+ {
358
+ size: "small",
359
+ type: "primary",
360
+ icon: /* @__PURE__ */ e(Y, {}),
361
+ disabled: !o.fileUrl,
362
+ loading: S === o.id,
363
+ onClick: () => void V(o),
364
+ children: "下载"
365
+ }
366
+ ),
367
+ N && /* @__PURE__ */ i(le, { children: [
368
+ /* @__PURE__ */ e(
369
+ g,
370
+ {
371
+ size: "small",
372
+ icon: /* @__PURE__ */ e(he, {}),
373
+ onClick: () => d(o),
374
+ children: "编辑"
375
+ }
376
+ ),
377
+ /* @__PURE__ */ e(
378
+ pe,
379
+ {
380
+ title: "确定删除该资源?",
381
+ onConfirm: () => void q(o.id),
382
+ children: /* @__PURE__ */ e(g, { size: "small", danger: !0, children: "删除" })
383
+ }
384
+ )
385
+ ] }),
386
+ N && /* @__PURE__ */ e(se, { title: "转交给其他用户接手维护", children: /* @__PURE__ */ e(
387
+ g,
388
+ {
389
+ size: "small",
390
+ icon: /* @__PURE__ */ e(be, {}),
391
+ onClick: () => ee(o)
392
+ }
393
+ ) }),
394
+ _ && /* @__PURE__ */ e(ie, { color: "orange", className: t.cardDraftTag, children: "仅自己可见" })
395
+ ]
396
+ }
397
+ )
398
+ ] })
399
+ ]
400
+ },
401
+ o.id
402
+ );
403
+ }) }) }),
404
+ /* @__PURE__ */ i(
405
+ Re,
406
+ {
407
+ open: p !== null,
408
+ title: `转交「${(p == null ? void 0 : p.name) ?? ""}」所有权`,
409
+ okText: "转交",
410
+ okButtonProps: {
411
+ disabled: f === null,
412
+ loading: G
413
+ },
414
+ onCancel: () => T(null),
415
+ onOk: () => void ae(),
416
+ destroyOnHidden: !0,
417
+ children: [
418
+ /* @__PURE__ */ i("p", { style: { color: "#666", marginBottom: 12 }, children: [
419
+ "转交后「",
420
+ p == null ? void 0 : p.creatorName,
421
+ "」将失去该资源的编辑/删除权,由新所有者接手维护。"
422
+ ] }),
423
+ /* @__PURE__ */ e(
424
+ Pe,
425
+ {
426
+ showSearch: !0,
427
+ filterOption: !1,
428
+ placeholder: "输入姓名/账号/工号搜索",
429
+ style: { width: "100%" },
430
+ loading: x,
431
+ value: f,
432
+ onSearch: te,
433
+ onChange: (o) => y(o),
434
+ options: L.map((o) => ({
435
+ value: o.id,
436
+ label: `${o.name}(${o.accountNo ?? o.jobNumber ?? o.id})`
437
+ }))
438
+ }
439
+ )
440
+ ]
441
+ }
442
+ )
443
+ ] });
444
+ }
445
+ function Wt({
446
+ resource: a,
447
+ currentUserId: n,
448
+ onBack: l,
449
+ onEdit: r,
450
+ onDeleted: c
451
+ }) {
452
+ var R;
453
+ const h = F((f) => f.token), [d, v] = u(a), [k, w] = u(!a.docContent), [C, m] = u(!1), [S, M] = u(!1);
454
+ re(() => {
455
+ let f = !0;
456
+ if (!(a.docContent !== null && a.docContent !== void 0))
457
+ return w(!0), ye(a.id, h).then((y) => {
458
+ f && v(y);
459
+ }).catch(() => {
460
+ }).finally(() => {
461
+ f && w(!1);
462
+ }), () => {
463
+ f = !1;
464
+ };
465
+ }, [a, h]);
466
+ const p = d.creatorId === n, T = d.status === 0, L = async () => {
467
+ if (d.fileUrl) {
468
+ m(!0);
469
+ try {
470
+ const f = await ke(d.id, h);
471
+ if (f.fileUrl) {
472
+ const y = document.createElement("a");
473
+ y.href = f.fileUrl, y.download = f.fileName || d.name, y.target = "_blank", y.rel = "noopener", document.body.appendChild(y), y.click(), y.remove();
474
+ }
475
+ } catch {
476
+ } finally {
477
+ m(!1);
478
+ }
479
+ }
480
+ }, I = async (f) => {
481
+ M(!0);
482
+ try {
483
+ await we(d.id, {}, f, h), b.success(f ? "已发布" : "已下架为草稿"), l();
484
+ } catch {
485
+ } finally {
486
+ M(!1);
487
+ }
488
+ }, x = async () => {
489
+ try {
490
+ await Ne(d.id, h), b.success("已删除"), c();
491
+ } catch {
492
+ }
493
+ };
494
+ return /* @__PURE__ */ i("div", { className: t.detailWrap, children: [
495
+ /* @__PURE__ */ i("div", { className: t.editorTopBar, children: [
496
+ /* @__PURE__ */ i("button", { type: "button", className: t.backBtn, onClick: l, children: [
497
+ /* @__PURE__ */ e(fe, {}),
498
+ " 返回列表"
499
+ ] }),
500
+ /* @__PURE__ */ e("span", { className: t.editorTitle, children: d.name }),
501
+ /* @__PURE__ */ e("div", { className: t.editorTopActions, children: p && /* @__PURE__ */ i(le, { children: [
502
+ !T && /* @__PURE__ */ e(
503
+ g,
504
+ {
505
+ loading: S,
506
+ onClick: () => void I(!1),
507
+ children: "下架为草稿"
508
+ }
509
+ ),
510
+ T && /* @__PURE__ */ e(
511
+ g,
512
+ {
513
+ type: "primary",
514
+ ghost: !0,
515
+ loading: S,
516
+ onClick: () => void I(!0),
517
+ children: "发布"
518
+ }
519
+ ),
520
+ /* @__PURE__ */ e(g, { icon: /* @__PURE__ */ e(he, {}), onClick: () => r(d), children: "编辑" }),
521
+ /* @__PURE__ */ e(
522
+ pe,
523
+ {
524
+ title: "确定删除该资源?",
525
+ onConfirm: () => void x(),
526
+ children: /* @__PURE__ */ e(g, { danger: !0, children: "删除" })
527
+ }
528
+ )
529
+ ] }) })
530
+ ] }),
531
+ /* @__PURE__ */ i("div", { className: t.detailBody, children: [
532
+ /* @__PURE__ */ i("div", { className: t.detailHeader, children: [
533
+ /* @__PURE__ */ e("div", { className: t.detailCover, children: d.coverUrl ? /* @__PURE__ */ e("img", { src: d.coverUrl, alt: d.name }) : /* @__PURE__ */ e("div", { className: t.cardCoverFallback, children: /* @__PURE__ */ e(Z, {}) }) }),
534
+ /* @__PURE__ */ i("div", { className: t.detailInfo, children: [
535
+ /* @__PURE__ */ i("div", { className: t.detailNameRow, children: [
536
+ /* @__PURE__ */ e("h1", { className: t.detailName, children: d.name }),
537
+ T ? /* @__PURE__ */ e(ie, { color: "orange", children: "草稿(仅自己可见)" }) : /* @__PURE__ */ e(ie, { color: "green", children: "已发布" })
538
+ ] }),
539
+ /* @__PURE__ */ e("div", { className: t.detailSummary, children: d.summary || "暂无简介" }),
540
+ /* @__PURE__ */ i("div", { className: t.detailMeta, children: [
541
+ /* @__PURE__ */ i("span", { children: [
542
+ /* @__PURE__ */ e(Ue, {}),
543
+ " ",
544
+ d.creatorName
545
+ ] }),
546
+ /* @__PURE__ */ i("span", { children: [
547
+ /* @__PURE__ */ e(Y, {}),
548
+ " ",
549
+ d.downloadCount,
550
+ " 次下载"
551
+ ] }),
552
+ d.version && /* @__PURE__ */ i("span", { title: `版本 ${d.version}`, children: [
553
+ "v",
554
+ d.version
555
+ ] }),
556
+ d.fileName && /* @__PURE__ */ i("span", { title: d.fileName, children: [
557
+ /* @__PURE__ */ e(Z, {}),
558
+ " ",
559
+ d.fileName,
560
+ "(",
561
+ Q(d.fileSize),
562
+ ")"
563
+ ] }),
564
+ /* @__PURE__ */ i("span", { children: [
565
+ "更新于 ",
566
+ ((R = d.updateTime) == null ? void 0 : R.slice(0, 10)) ?? "-"
567
+ ] })
568
+ ] }),
569
+ /* @__PURE__ */ e("div", { className: t.detailActions, children: /* @__PURE__ */ e(
570
+ g,
571
+ {
572
+ type: "primary",
573
+ size: "large",
574
+ icon: /* @__PURE__ */ e(Y, {}),
575
+ disabled: !d.fileUrl,
576
+ loading: C,
577
+ onClick: () => void L(),
578
+ children: "下载资源包"
579
+ }
580
+ ) })
581
+ ] })
582
+ ] }),
583
+ /* @__PURE__ */ i("div", { className: t.detailDocSection, children: [
584
+ /* @__PURE__ */ e("div", { className: t.sectionTitle, children: "使用说明" }),
585
+ /* @__PURE__ */ e(ce, { spinning: k, children: /* @__PURE__ */ e("div", { className: t.docPreview, children: d.docContent ? /* @__PURE__ */ e(
586
+ ve,
587
+ {
588
+ remarkPlugins: [ge],
589
+ rehypePlugins: [_e],
590
+ children: d.docContent
591
+ }
592
+ ) : /* @__PURE__ */ e("div", { className: t.docPreviewEmpty, children: "创建者暂未补充使用说明" }) }) })
593
+ ] })
594
+ ] })
595
+ ] });
596
+ }
597
+ function Ht(a) {
598
+ const n = (a ?? "").trim();
599
+ if (!n) return "1.0.1";
600
+ const l = n.match(/^(.*)\.(\d+)$/);
601
+ return l ? `${l[1]}.${Number(l[2]) + 1}` : /^\d+$/.test(n) ? String(Number(n) + 1) : n;
602
+ }
603
+ function jt({
604
+ category: a,
605
+ resource: n,
606
+ onSaved: l,
607
+ onCancel: r
608
+ }) {
609
+ const c = F((s) => s.token), h = a === "ztools-plugin", [d, v] = u((n == null ? void 0 : n.name) ?? ""), [k, w] = u((n == null ? void 0 : n.summary) ?? ""), [C, m] = u((n == null ? void 0 : n.version) ?? ""), [S, M] = u((n == null ? void 0 : n.docContent) ?? ""), [p, T] = u((n == null ? void 0 : n.coverUrl) ?? ""), [L, I] = u((n == null ? void 0 : n.fileUrl) ?? ""), [x, R] = u((n == null ? void 0 : n.fileName) ?? ""), [f, y] = u((n == null ? void 0 : n.fileSize) ?? 0), [G, A] = u(!1), [z, K] = u(!1), [E, V] = u(null), [q, ee] = u("edit"), te = async (s) => {
610
+ const W = L;
611
+ A(!0);
612
+ try {
613
+ const J = await Oe(s, c);
614
+ I(J.url), R(J.fileName ?? s.name), y(J.size);
615
+ const ne = C.trim();
616
+ if (W && ne) {
617
+ const oe = Ht(ne);
618
+ if (oe !== ne)
619
+ return m(oe), b.success(
620
+ `资源包已替换,版本号自动升级至 v${oe}(可手动修改)`
621
+ ), !1;
622
+ }
623
+ b.success(`资源包已上传:${J.fileName ?? s.name}`);
624
+ } catch {
625
+ } finally {
626
+ A(!1);
627
+ }
628
+ return !1;
629
+ }, ae = async (s) => {
630
+ K(!0);
631
+ try {
632
+ const W = await xe(s, c);
633
+ T(W.url), b.success("封面已上传");
634
+ } catch {
635
+ } finally {
636
+ K(!1);
637
+ }
638
+ return !1;
639
+ }, o = () => ({
640
+ name: d.trim(),
641
+ summary: k.trim() || void 0,
642
+ docContent: S || void 0,
643
+ coverUrl: p || void 0,
644
+ fileUrl: L || void 0,
645
+ fileName: x || void 0,
646
+ fileSize: f || void 0,
647
+ version: C.trim() || void 0
648
+ }), N = (s) => d.trim() ? s && !L ? (b.warning("发布前请先上传资源包"), !1) : !0 : (b.warning("请填写资源名称"), !1), _ = async (s) => {
649
+ if (N(s)) {
650
+ V(s ? "publish" : "draft");
651
+ try {
652
+ const W = n ? await we(n.id, o(), s, c) : await Me(
653
+ { ...o(), category: a },
654
+ s,
655
+ c
656
+ );
657
+ b.success(s ? "已发布" : "已保存草稿"), l(W);
658
+ } catch {
659
+ } finally {
660
+ V(null);
661
+ }
662
+ }
663
+ };
664
+ return /* @__PURE__ */ i("div", { className: t.editorWrap, children: [
665
+ /* @__PURE__ */ i("div", { className: t.editorTopBar, children: [
666
+ /* @__PURE__ */ i("button", { type: "button", className: t.backBtn, onClick: r, children: [
667
+ /* @__PURE__ */ e(fe, {}),
668
+ " 返回列表"
669
+ ] }),
670
+ /* @__PURE__ */ e("span", { className: t.editorTitle, children: n ? "编辑资源" : "新增资源" }),
671
+ /* @__PURE__ */ i("div", { className: t.editorTopActions, children: [
672
+ /* @__PURE__ */ e(
673
+ g,
674
+ {
675
+ onClick: () => void _(!1),
676
+ loading: E === "draft",
677
+ children: "保存草稿"
678
+ }
679
+ ),
680
+ /* @__PURE__ */ e(
681
+ g,
682
+ {
683
+ type: "primary",
684
+ onClick: () => void _(!0),
685
+ loading: E === "publish",
686
+ children: (n == null ? void 0 : n.status) === 1 ? "保存并保持发布" : "直接发布"
687
+ }
688
+ )
689
+ ] })
690
+ ] }),
691
+ /* @__PURE__ */ i("div", { className: t.editorBody, children: [
692
+ /* @__PURE__ */ i("div", { className: t.section, children: [
693
+ /* @__PURE__ */ i("div", { className: t.sectionTitle, children: [
694
+ /* @__PURE__ */ e(Z, {}),
695
+ " 资源包(唯一,重新上传将替换)"
696
+ ] }),
697
+ /* @__PURE__ */ e(
698
+ me.Dragger,
699
+ {
700
+ accept: h ? ".html,.htm,.zip" : ".zip,.crx,.xpi,.tar,.gz,.rar,.7z,.exe,.dmg,.apk",
701
+ showUploadList: !1,
702
+ maxCount: 1,
703
+ beforeUpload: (s) => (te(s), !1),
704
+ disabled: G,
705
+ children: /* @__PURE__ */ e("div", { className: t.uploaderInner, children: G ? /* @__PURE__ */ e(ce, {}) : /* @__PURE__ */ i(le, { children: [
706
+ /* @__PURE__ */ e("p", { className: t.uploaderIcon, children: /* @__PURE__ */ e($e, {}) }),
707
+ /* @__PURE__ */ e("p", { className: t.uploaderText, children: h ? "点击或拖拽插件 HTML 文件到此处上传(z-biz-tool-box 插件入口,最大 200MB)" : "点击或拖拽资源包到此处上传(zip / crx 等,最大 200MB)" }),
708
+ L && /* @__PURE__ */ i("p", { className: t.uploaderFile, children: [
709
+ "当前:",
710
+ x,
711
+ "(",
712
+ Q(f),
713
+ ")"
714
+ ] })
715
+ ] }) })
716
+ }
717
+ )
718
+ ] }),
719
+ /* @__PURE__ */ i("div", { className: t.section, children: [
720
+ /* @__PURE__ */ i("div", { className: t.sectionTitle, children: [
721
+ /* @__PURE__ */ e(de, {}),
722
+ " 封面图(可选)"
723
+ ] }),
724
+ /* @__PURE__ */ e("div", { className: t.coverRow, children: p ? /* @__PURE__ */ i("div", { className: t.coverPreview, children: [
725
+ /* @__PURE__ */ e("img", { src: p, alt: "封面" }),
726
+ /* @__PURE__ */ e(
727
+ g,
728
+ {
729
+ size: "small",
730
+ danger: !0,
731
+ className: t.coverRemove,
732
+ onClick: () => T(""),
733
+ children: "移除"
734
+ }
735
+ )
736
+ ] }) : /* @__PURE__ */ e(
737
+ me,
738
+ {
739
+ accept: "image/png,image/jpeg,image/gif,image/bmp,image/webp",
740
+ showUploadList: !1,
741
+ beforeUpload: (s) => (ae(s), !1),
742
+ disabled: z,
743
+ children: /* @__PURE__ */ e(g, { icon: /* @__PURE__ */ e(de, {}), loading: z, children: "上传封面图" })
744
+ }
745
+ ) })
746
+ ] }),
747
+ /* @__PURE__ */ i("div", { className: t.section, children: [
748
+ /* @__PURE__ */ e("div", { className: t.sectionTitle, children: "基本信息" }),
749
+ /* @__PURE__ */ i("div", { className: t.formRow, children: [
750
+ /* @__PURE__ */ e("div", { className: t.formLabel, children: "资源名称" }),
751
+ /* @__PURE__ */ e(
752
+ H,
753
+ {
754
+ placeholder: "如:Header Forge 请求头锻造器",
755
+ value: d,
756
+ maxLength: 200,
757
+ onChange: (s) => v(s.target.value)
758
+ }
759
+ )
760
+ ] }),
761
+ /* @__PURE__ */ i("div", { className: t.formRow, children: [
762
+ /* @__PURE__ */ e("div", { className: t.formLabel, children: "简介" }),
763
+ /* @__PURE__ */ e(
764
+ H.TextArea,
765
+ {
766
+ placeholder: "一句话介绍该资源解决什么问题",
767
+ value: k,
768
+ maxLength: 500,
769
+ rows: 2,
770
+ onChange: (s) => w(s.target.value)
771
+ }
772
+ )
773
+ ] }),
774
+ /* @__PURE__ */ i("div", { className: t.formRow, children: [
775
+ /* @__PURE__ */ i("div", { className: t.formLabel, children: [
776
+ "版本号(替换资源包自动升级;",
777
+ h ? "zTools 插件缺省 1.0.0" : "可选",
778
+ ")"
779
+ ] }),
780
+ /* @__PURE__ */ e(
781
+ H,
782
+ {
783
+ placeholder: "如:1.2.0",
784
+ value: C,
785
+ maxLength: 50,
786
+ style: { width: 220 },
787
+ onChange: (s) => m(s.target.value)
788
+ }
789
+ )
790
+ ] })
791
+ ] }),
792
+ /* @__PURE__ */ i("div", { className: t.section, children: [
793
+ /* @__PURE__ */ e("div", { className: t.sectionTitle, children: "使用说明文档(Markdown)" }),
794
+ /* @__PURE__ */ e(
795
+ Le,
796
+ {
797
+ activeKey: q,
798
+ onChange: (s) => ee(s),
799
+ items: [
800
+ { key: "edit", label: "编辑" },
801
+ { key: "preview", label: "预览" }
802
+ ]
803
+ }
804
+ ),
805
+ q === "edit" ? /* @__PURE__ */ e(
806
+ H.TextArea,
807
+ {
808
+ className: t.docEditor,
809
+ value: S,
810
+ onChange: (s) => M(s.target.value),
811
+ placeholder: `# 使用说明
812
+
813
+ ## 安装步骤
814
+ 1. 下载资源包
815
+ 2. 浏览器打开 chrome://extensions
816
+ 3. ...`,
817
+ autoSize: { minRows: 12, maxRows: 24 }
818
+ }
819
+ ) : /* @__PURE__ */ e("div", { className: t.docPreview, children: S ? /* @__PURE__ */ e(
820
+ ve,
821
+ {
822
+ remarkPlugins: [ge],
823
+ rehypePlugins: [_e],
824
+ children: S
825
+ }
826
+ ) : /* @__PURE__ */ i("div", { className: t.docPreviewEmpty, children: [
827
+ /* @__PURE__ */ e(Be, {}),
828
+ " 暂无内容"
829
+ ] }) })
830
+ ] })
831
+ ] })
832
+ ] });
833
+ }
834
+ function Gt({ category: a }) {
835
+ const n = F((m) => m.token), l = F((m) => m.currentUser), [r, c] = u({ kind: "list" }), [h, d] = u([]), [v, k] = u(!1), w = O(async () => {
836
+ k(!0);
837
+ try {
838
+ const m = await Ie({ category: a }, n);
839
+ d(Array.isArray(m) ? m : []);
840
+ } catch {
841
+ } finally {
842
+ k(!1);
843
+ }
844
+ }, [a, n]);
845
+ re(() => {
846
+ w();
847
+ }, [w]);
848
+ const C = O(
849
+ async (m) => {
850
+ if (!m) {
851
+ c({ kind: "editor", resource: null });
852
+ return;
853
+ }
854
+ if (m.docContent !== null && m.docContent !== void 0) {
855
+ c({ kind: "editor", resource: m });
856
+ return;
857
+ }
858
+ try {
859
+ const S = await ye(m.id, n);
860
+ c({ kind: "editor", resource: S });
861
+ } catch {
862
+ c({ kind: "list" });
863
+ }
864
+ },
865
+ [n]
866
+ );
867
+ return r.kind === "editor" ? /* @__PURE__ */ e(
868
+ jt,
869
+ {
870
+ category: a,
871
+ resource: r.resource,
872
+ onSaved: (m) => {
873
+ c({ kind: "detail", resource: m }), w();
874
+ },
875
+ onCancel: () => c({ kind: "list" })
876
+ }
877
+ ) : r.kind === "detail" ? /* @__PURE__ */ e(
878
+ Wt,
879
+ {
880
+ resource: r.resource,
881
+ currentUserId: l != null && l.id ? String(l.id) : "",
882
+ onBack: () => {
883
+ c({ kind: "list" }), w();
884
+ },
885
+ onEdit: (m) => c({ kind: "editor", resource: m }),
886
+ onDeleted: () => {
887
+ c({ kind: "list" }), w();
888
+ }
889
+ }
890
+ ) : /* @__PURE__ */ e("div", { className: t.tabBody, children: /* @__PURE__ */ e(
891
+ zt,
892
+ {
893
+ resources: h,
894
+ loading: v,
895
+ category: a,
896
+ onReload: w,
897
+ onCreate: () => c({ kind: "editor", resource: null }),
898
+ onOpenDetail: (m) => c({ kind: "detail", resource: m }),
899
+ onEdit: (m) => void C(m)
900
+ }
901
+ ) });
902
+ }
903
+ function ea({ tab: a }) {
904
+ return a === "coming" ? /* @__PURE__ */ i("div", { className: t.comingSoon, children: [
905
+ /* @__PURE__ */ e("div", { className: t.comingSoonIcon, children: "🧩" }),
906
+ /* @__PURE__ */ e("div", { className: t.comingSoonTitle, children: "更多分类敬请期待" }),
907
+ /* @__PURE__ */ e("div", { className: t.comingSoonDesc, children: "市场将陆续开放脚本工具等更多资源分类" })
908
+ ] }) : /* @__PURE__ */ e(Gt, { category: a });
909
+ }
910
+ export {
911
+ na as MARKET_TABS,
912
+ ea as MarketContent
913
+ };