yc-component 0.1.10 → 0.1.11

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.
@@ -1,40 +1,40 @@
1
1
  import Ze from "axios";
2
- import { defineComponent as ce, ref as k, computed as D, watch as ne, onBeforeUnmount as At, resolveComponent as V, resolveDirective as et, openBlock as c, createBlock as E, Transition as tt, withCtx as p, withDirectives as _e, createElementVNode as _, normalizeStyle as He, createVNode as f, unref as h, toDisplayString as B, createElementBlock as A, createCommentVNode as P, createTextVNode as q, renderSlot as Ce, Fragment as le, vShow as Ee, reactive as nt, inject as Oe, onMounted as Ue, onUnmounted as Re, renderList as ve, Teleport as Mt, normalizeClass as ue, provide as $e, normalizeProps as Et, mergeProps as ot, withKeys as $t, withModifiers as Pt, nextTick as Je, isRef as Lt } from "vue";
3
- import { ArrowLeft as Dt, ArrowUpBold as Bt, ArrowDownBold as Vt, Switch as Ot, Close as at, Check as lt, Refresh as Xe, ArrowDown as Ut, CircleCheck as Rt, CircleClose as Ft, Remove as Kt, Search as Nt, Upload as zt } from "@element-plus/icons-vue";
4
- import { storeToRefs as Yt, defineStore as Wt } from "pinia";
5
- import { ElMessage as ee } from "element-plus";
6
- const Fe = {
2
+ import { defineComponent as ue, ref as k, computed as D, watch as te, onBeforeUnmount as Mt, resolveComponent as V, resolveDirective as et, openBlock as d, createBlock as E, Transition as tt, withCtx as p, withDirectives as ve, createElementVNode as _, normalizeStyle as He, createVNode as f, unref as h, toDisplayString as B, createElementBlock as A, createCommentVNode as P, createTextVNode as q, renderSlot as Ce, Fragment as ae, vShow as Ee, reactive as nt, inject as Oe, onMounted as Fe, onUnmounted as Ue, renderList as ge, Teleport as Et, normalizeClass as re, provide as $e, normalizeProps as $t, mergeProps as ot, withKeys as Pt, withModifiers as Lt, nextTick as Je, isRef as Dt } from "vue";
3
+ import { ArrowLeft as Bt, ArrowUpBold as Vt, ArrowDownBold as Ot, Switch as Ft, Close as at, Check as lt, Refresh as Xe, ArrowDown as Ut, CircleCheck as Rt, CircleClose as Kt, Remove as Nt, Search as zt, Upload as Yt } from "@element-plus/icons-vue";
4
+ import { storeToRefs as Wt, defineStore as jt } from "pinia";
5
+ import { ElMessage as Z } from "element-plus";
6
+ const Re = {
7
7
  projectId: "default-project",
8
8
  storageKey: "yc-ai-task-queue-v1"
9
9
  };
10
- let he = { ...Fe };
11
- function jt(e) {
12
- he = { ...he, ...e };
10
+ let _e = { ...Re };
11
+ function Gt(e) {
12
+ _e = { ..._e, ...e };
13
13
  }
14
14
  function it() {
15
- return he;
15
+ return _e;
16
16
  }
17
- function Gt() {
18
- return he.projectId ?? Fe.projectId;
17
+ function qt() {
18
+ return _e.projectId ?? Re.projectId;
19
19
  }
20
20
  function st() {
21
- return he.storageKey ?? Fe.storageKey;
21
+ return _e.storageKey ?? Re.storageKey;
22
22
  }
23
- let ie = null;
24
- function qt() {
25
- ie = null;
23
+ let le = null;
24
+ function Ht() {
25
+ le = null;
26
26
  }
27
- function de() {
28
- if (ie) return ie;
27
+ function ce() {
28
+ if (le) return le;
29
29
  const { baseURL: e, getToken: n, onUnauthorized: t } = it();
30
- return ie = Ze.create({
30
+ return le = Ze.create({
31
31
  baseURL: e ?? "",
32
32
  timeout: 6e4,
33
33
  headers: { "Content-Type": "application/json" }
34
- }), ie.interceptors.request.use((o) => {
34
+ }), le.interceptors.request.use((o) => {
35
35
  const l = n == null ? void 0 : n();
36
36
  return l && (o.headers.Authorization = `Bearer ${l}`), o;
37
- }), ie.interceptors.response.use(
37
+ }), le.interceptors.response.use(
38
38
  (o) => {
39
39
  const l = o.data;
40
40
  return (l == null ? void 0 : l.code) != null && l.code !== 200 ? Promise.reject(new Error(l.message || "请求失败")) : (o.data = (l == null ? void 0 : l.data) ?? l, o);
@@ -45,10 +45,10 @@ function de() {
45
45
  const l = (S = (w = o.response) == null ? void 0 : w.data) == null ? void 0 : S.message;
46
46
  return Promise.reject(new Error(l || o.message || "请求失败"));
47
47
  }
48
- ), ie;
48
+ ), le;
49
49
  }
50
- async function Ht(e, n) {
51
- const o = (await de().get(
50
+ async function Jt(e, n) {
51
+ const o = (await ce().get(
52
52
  `/yc-ai/workflows/runs/${e}/artifacts/${n}`,
53
53
  { transformResponse: [(l) => l] }
54
54
  )).data;
@@ -61,16 +61,16 @@ async function Ht(e, n) {
61
61
  return o;
62
62
  }
63
63
  let Pe = {};
64
- function Jt(e) {
64
+ function Xt(e) {
65
65
  Pe = { ...Pe, ...e };
66
66
  }
67
67
  function Ke() {
68
68
  return Pe;
69
69
  }
70
- const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__title" }, Zt = {
70
+ const Qt = { class: "yc-page-window__header" }, Zt = { class: "yc-page-window__title" }, en = {
71
71
  key: 0,
72
72
  class: "yc-page-window__nav"
73
- }, en = { class: "yc-page-window__opera" }, tn = { class: "yc-page-window__content" }, nn = /* @__PURE__ */ ce({
73
+ }, tn = { class: "yc-page-window__opera" }, nn = { class: "yc-page-window__content" }, on = /* @__PURE__ */ ue({
74
74
  __name: "YcPageWindow",
75
75
  props: {
76
76
  visible: { type: Boolean },
@@ -95,26 +95,26 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
95
95
  ), r = D(
96
96
  () => ["detail", "edit"].includes(o.type)
97
97
  ), O = D(() => o.type !== "detail");
98
- function R() {
98
+ function U() {
99
99
  if (!o.row) return -1;
100
- const C = o.rowKey, U = o.row[C];
101
- return o.list.findIndex((Y) => Y[C] === U);
100
+ const C = o.rowKey, F = o.row[C];
101
+ return o.list.findIndex((Y) => Y[C] === F);
102
102
  }
103
103
  function M(C) {
104
- const U = R();
105
- return U < 0 ? !0 : C === "prev" ? U <= 0 : U >= o.list.length - 1;
104
+ const F = U();
105
+ return F < 0 ? !0 : C === "prev" ? F <= 0 : F >= o.list.length - 1;
106
106
  }
107
107
  function L() {
108
- const C = R();
108
+ const C = U();
109
109
  if (C <= 0) return;
110
- const U = o.list[C - 1];
111
- l("checkRow", U), l("prev", U);
110
+ const F = o.list[C - 1];
111
+ l("checkRow", F), l("prev", F);
112
112
  }
113
113
  function N() {
114
- const C = R();
114
+ const C = U();
115
115
  if (C < 0 || C >= o.list.length - 1) return;
116
- const U = o.list[C + 1];
117
- l("checkRow", U), l("next", U);
116
+ const F = o.list[C + 1];
117
+ l("checkRow", F), l("next", F);
118
118
  }
119
119
  function y() {
120
120
  const C = o.type === "detail" ? "edit" : "detail";
@@ -128,37 +128,37 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
128
128
  g.value = !1, C && $();
129
129
  });
130
130
  }
131
- return ne(
131
+ return te(
132
132
  () => o.visible,
133
133
  (C) => {
134
134
  C && l("opened");
135
135
  }
136
- ), At(() => {
136
+ ), Mt(() => {
137
137
  o.visible && $();
138
- }), n({ closeWindow: $ }), (C, U) => {
138
+ }), n({ closeWindow: $ }), (C, F) => {
139
139
  const Y = V("el-icon"), v = V("el-button"), T = V("el-tooltip"), W = V("el-scrollbar"), H = et("loading");
140
- return c(), E(tt, {
140
+ return d(), E(tt, {
141
141
  name: "yc-page-window-fade",
142
142
  mode: "out-in"
143
143
  }, {
144
144
  default: p(() => [
145
- _e(_("div", {
145
+ ve(_("div", {
146
146
  class: "yc-page-window",
147
147
  style: He({ zIndex: e.zIndex })
148
148
  }, [
149
- _("div", Xt, [
150
- _("div", Qt, [
149
+ _("div", Qt, [
150
+ _("div", Zt, [
151
151
  f(Y, {
152
152
  class: "yc-page-window__back",
153
153
  onClick: $
154
154
  }, {
155
155
  default: p(() => [
156
- f(h(Dt))
156
+ f(h(Bt))
157
157
  ]),
158
158
  _: 1
159
159
  }),
160
160
  _("span", null, B(e.title) + B(S.value), 1),
161
- m.value ? (c(), A("div", Zt, [
161
+ m.value ? (d(), A("div", en, [
162
162
  f(T, {
163
163
  content: "上一条",
164
164
  placement: "top"
@@ -173,7 +173,7 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
173
173
  default: p(() => [
174
174
  f(Y, null, {
175
175
  default: p(() => [
176
- f(h(Bt))
176
+ f(h(Vt))
177
177
  ]),
178
178
  _: 1
179
179
  })
@@ -197,7 +197,7 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
197
197
  default: p(() => [
198
198
  f(Y, null, {
199
199
  default: p(() => [
200
- f(h(Vt))
200
+ f(h(Ot))
201
201
  ]),
202
202
  _: 1
203
203
  })
@@ -208,7 +208,7 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
208
208
  _: 1
209
209
  })
210
210
  ])) : P("", !0),
211
- r.value ? (c(), E(v, {
211
+ r.value ? (d(), E(v, {
212
212
  key: 1,
213
213
  text: "",
214
214
  class: "yc-page-window__type-switch",
@@ -218,7 +218,7 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
218
218
  default: p(() => [
219
219
  f(Y, { class: "m-r-4" }, {
220
220
  default: p(() => [
221
- f(h(Ot))
221
+ f(h(Ft))
222
222
  ]),
223
223
  _: 1
224
224
  }),
@@ -227,9 +227,9 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
227
227
  _: 1
228
228
  }, 8, ["type"])) : P("", !0)
229
229
  ]),
230
- _("div", en, [
230
+ _("div", tn, [
231
231
  Ce(C.$slots, "opera", {}, void 0, !0),
232
- e.showButtons && O.value ? (c(), A(le, { key: 0 }, [
232
+ e.showButtons && O.value ? (d(), A(ae, { key: 0 }, [
233
233
  f(v, {
234
234
  text: "",
235
235
  disabled: w.value,
@@ -246,7 +246,7 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
246
246
  ]),
247
247
  _: 1
248
248
  }, 8, ["disabled"]),
249
- e.showConfirm ? (c(), E(v, {
249
+ e.showConfirm ? (d(), E(v, {
250
250
  key: 0,
251
251
  type: "primary",
252
252
  loading: w.value,
@@ -267,10 +267,10 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
267
267
  ], 64)) : P("", !0)
268
268
  ])
269
269
  ]),
270
- _e((c(), A("div", tn, [
270
+ ve((d(), A("div", nn, [
271
271
  f(W, { class: "yc-page-window__scroll" }, {
272
272
  default: p(() => [
273
- e.visible ? (c(), A("div", {
273
+ e.visible ? (d(), A("div", {
274
274
  key: 0,
275
275
  class: "yc-page-window__body",
276
276
  style: He({ minHeight: e.contentMinHeight })
@@ -296,35 +296,35 @@ const Xt = { class: "yc-page-window__header" }, Qt = { class: "yc-page-window__t
296
296
  for (const [o, l] of n)
297
297
  t[o] = l;
298
298
  return t;
299
- }, Qe = /* @__PURE__ */ Se(nn, [["__scopeId", "data-v-b3e784c3"]]);
300
- function on(e) {
301
- e != null && e.aiTask && (jt(e.aiTask), qt()), e != null && e.imageSelector && Jt(e.imageSelector);
299
+ }, Qe = /* @__PURE__ */ Se(on, [["__scopeId", "data-v-b3e784c3"]]);
300
+ function an(e) {
301
+ e != null && e.aiTask && (Gt(e.aiTask), Ht()), e != null && e.imageSelector && Xt(e.imageSelector);
302
302
  }
303
- function an(e, n) {
303
+ function ln(e, n) {
304
304
  (n == null ? void 0 : n.registerPageWindow) !== !1 && (e.component("YcPageWindow", Qe), e.component("SkyPageWindow", Qe));
305
305
  }
306
- const Lo = {
306
+ const Do = {
307
307
  install(e, n) {
308
- on(n), an(e, n);
308
+ an(n), ln(e, n);
309
309
  }
310
310
  }, Ae = "__YC_COMPONENT_AI_DIALOG__", Le = "yc-component:ai-dialog-open";
311
- function ln() {
311
+ function sn() {
312
312
  const e = globalThis;
313
313
  return e[Ae] || (e[Ae] = nt({
314
314
  visible: !1,
315
315
  options: {}
316
316
  })), e[Ae];
317
317
  }
318
- const te = ln();
318
+ const ee = sn();
319
319
  function Ne(e = {}) {
320
- te.options = { ...e }, te.visible = !0, globalThis.dispatchEvent(
320
+ ee.options = { ...e }, ee.visible = !0, globalThis.dispatchEvent(
321
321
  new CustomEvent(Le, { detail: { ...e } })
322
322
  );
323
323
  }
324
324
  function rt() {
325
- te.visible = !1;
325
+ ee.visible = !1;
326
326
  }
327
- function Do(e = {}) {
327
+ function Bo(e = {}) {
328
328
  Ne(e);
329
329
  }
330
330
  function ut(e) {
@@ -337,7 +337,7 @@ function ut(e) {
337
337
  activeCount: w,
338
338
  panelTitle: S,
339
339
  panelSubtitle: m
340
- } = Yt(e);
340
+ } = Wt(e);
341
341
  return {
342
342
  tasks: n,
343
343
  panelVisible: t,
@@ -364,19 +364,19 @@ function ut(e) {
364
364
  onTaskFinish: (r) => e.onTaskFinish(r)
365
365
  };
366
366
  }
367
- const sn = "__YC_AI_TASK_CTX_KEY__", rn = "__YC_AI_TASK_STORE_KEY__";
367
+ const rn = "__YC_AI_TASK_CTX_KEY__", un = "__YC_AI_TASK_STORE_KEY__";
368
368
  function ct(e) {
369
369
  const n = globalThis;
370
370
  return n[e] || (n[e] = Symbol(e)), n[e];
371
371
  }
372
- const dt = ct(sn), ft = ct(rn), un = async (e) => (await de().post(
372
+ const dt = ct(rn), ft = ct(un), cn = async (e) => (await ce().post(
373
373
  "/yc-ai/workflows/runs",
374
374
  e
375
- )).data, pt = async (e) => (await de().get(`/yc-ai/workflows/runs/${e}`)).data, cn = (e) => de().post(`/yc-ai/workflows/runs/${e}/cancel`), dn = (e, n) => de().post(`/yc-ai/workflows/runs/${e}/client-continue`, n);
375
+ )).data, pt = async (e) => (await ce().get(`/yc-ai/workflows/runs/${e}`)).data, dn = (e) => ce().post(`/yc-ai/workflows/runs/${e}/cancel`), fn = (e, n) => ce().post(`/yc-ai/workflows/runs/${e}/client-continue`, n);
376
376
  async function De(e, n) {
377
- return Ht(e, n);
377
+ return Jt(e, n);
378
378
  }
379
- function fn(e, n) {
379
+ function pn(e, n) {
380
380
  const t = e.trim();
381
381
  if (!t)
382
382
  return n;
@@ -399,23 +399,23 @@ function fn(e, n) {
399
399
  throw new Error(`自定义脚本执行失败: ${l instanceof Error ? l.message : String(l)}`);
400
400
  }
401
401
  }
402
- async function pn(e) {
403
- return (await un({
404
- projectId: Gt(),
402
+ async function mn(e) {
403
+ return (await cn({
404
+ projectId: qt(),
405
405
  freeText: e.freeText,
406
406
  promptId: e.promptId,
407
407
  autoMatch: e.autoMatch
408
408
  })).runId;
409
409
  }
410
- async function mn(e, n) {
410
+ async function gn(e, n) {
411
411
  var o, l, g, w;
412
412
  const t = await pt(e);
413
413
  if (t.status === "WAITING_CLIENT" && t.waitingStepKey && t.waitingClientScript) {
414
414
  (o = n == null ? void 0 : n.onProgress) == null || o.call(n, 60, `执行脚本:${t.waitingStepKey}`);
415
415
  let S = {};
416
416
  t.waitingArtifactId && (S = await De(e, t.waitingArtifactId));
417
- const m = fn(t.waitingClientScript, S);
418
- return await dn(e, {
417
+ const m = pn(t.waitingClientScript, S);
418
+ return await fn(e, {
419
419
  stepKey: t.waitingStepKey,
420
420
  output: m ?? {}
421
421
  }), null;
@@ -428,30 +428,30 @@ async function mn(e, n) {
428
428
  }
429
429
  return { phase: "SUCCEEDED", runId: e, result: {} };
430
430
  }
431
- return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((w = n == null ? void 0 : n.onProgress) == null || w.call(n, _n(t), hn(t)), null);
431
+ return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((w = n == null ? void 0 : n.onProgress) == null || w.call(n, hn(t), yn(t)), null);
432
432
  }
433
- async function gn(e) {
433
+ async function vn(e) {
434
434
  const n = await pt(e);
435
435
  return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await De(e, n.finalArtifactId);
436
436
  }
437
- async function vn(e) {
438
- await cn(e);
437
+ async function _n(e) {
438
+ await dn(e);
439
439
  }
440
- function _n(e) {
440
+ function hn(e) {
441
441
  if (e.status === "PENDING") return 8;
442
442
  const n = e.steps ?? [];
443
443
  if (!n.length) return 35;
444
444
  const t = n.filter((o) => o.status === "SUCCEEDED" || o.status === "SKIPPED").length;
445
445
  return Math.min(90, Math.round(20 + t / n.length * 70));
446
446
  }
447
- function hn(e) {
447
+ function yn(e) {
448
448
  var t;
449
449
  if (e.status === "PENDING") return "排队中…";
450
450
  const n = (t = e.steps) == null ? void 0 : t.find((o) => o.status === "RUNNING");
451
451
  return n ? `执行中:${n.stepKey}` : "后端处理中…";
452
452
  }
453
453
  const mt = 80;
454
- function yn() {
454
+ function wn() {
455
455
  try {
456
456
  const e = localStorage.getItem(st());
457
457
  if (!e) return [];
@@ -461,7 +461,7 @@ function yn() {
461
461
  return [];
462
462
  }
463
463
  }
464
- function wn(e) {
464
+ function Tn(e) {
465
465
  const n = e.slice(0, mt).map((t) => ({
466
466
  id: t.id,
467
467
  title: t.title,
@@ -478,66 +478,66 @@ function wn(e) {
478
478
  }));
479
479
  localStorage.setItem(st(), JSON.stringify(n));
480
480
  }
481
- function Tn(e) {
481
+ function In(e) {
482
482
  return {
483
483
  ...e,
484
484
  logs: e.runId ? [`ℹ 已从本地恢复,runId=${e.runId}`] : [],
485
485
  result: void 0
486
486
  };
487
487
  }
488
- function ae(e) {
488
+ function oe(e) {
489
489
  return e === "pending" || e === "running";
490
490
  }
491
- let Be = 0, ge = null;
492
- const In = 5e3;
493
- function Cn() {
491
+ let Be = 0, me = null;
492
+ const Cn = 5e3;
493
+ function Sn() {
494
494
  return Be += 1, `ai_task_${Date.now()}_${Be}`;
495
495
  }
496
- function Sn(e, n = 28) {
496
+ function kn(e, n = 28) {
497
497
  const t = e.trim();
498
498
  return t.length <= n ? t : `${t.slice(0, n)}…`;
499
499
  }
500
- const gt = Wt("ycAiTask", () => {
500
+ const gt = jt("ycAiTask", () => {
501
501
  const e = k([]), n = k(!1), t = k(!1), o = k(!1), l = k({}), g = k(!1), w = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set();
502
- function r(a, d) {
502
+ function r(a, u) {
503
503
  return {
504
504
  taskId: a.id,
505
505
  runId: a.runId,
506
506
  title: a.title,
507
507
  freeText: a.freeText,
508
508
  promptId: a.promptId,
509
- result: d,
509
+ result: u,
510
510
  finishedAt: a.finishedAt ?? Date.now()
511
511
  };
512
512
  }
513
- function O(a, d) {
514
- var re;
515
- const u = e.value.find((pe) => pe.id === a);
516
- if (!(u != null && u.runId)) return;
517
- const K = r(u, d);
518
- (re = S.get(a)) == null || re(K), S.delete(a), m.forEach((pe) => pe(K));
513
+ function O(a, u) {
514
+ var se;
515
+ const c = e.value.find((fe) => fe.id === a);
516
+ if (!(c != null && c.runId)) return;
517
+ const R = r(c, u);
518
+ (se = S.get(a)) == null || se(R), S.delete(a), m.forEach((fe) => fe(R));
519
519
  }
520
- function R(a) {
520
+ function U(a) {
521
521
  return m.add(a), () => m.delete(a);
522
522
  }
523
523
  const M = D(
524
- () => e.value.filter((a) => ae(a.status)).length
524
+ () => e.value.filter((a) => oe(a.status)).length
525
525
  ), L = D(() => e.value.filter((a) => a.status === "running").length), N = D(() => M.value > 0 ? "AI 处理中" : e.value.some((a) => a.status === "failed") ? "部分任务失败" : "AI 任务"), y = D(() => {
526
- const a = e.value.length, d = M.value;
527
- return a === 0 ? "暂无任务" : d > 0 ? `${d}/${a} 项任务进行中` : `${a} 项任务已完成`;
526
+ const a = e.value.length, u = M.value;
527
+ return a === 0 ? "暂无任务" : u > 0 ? `${u}/${a} 项任务进行中` : `${a} 项任务已完成`;
528
528
  });
529
529
  function $() {
530
- wn(e.value);
530
+ Tn(e.value);
531
531
  }
532
- function z(a, d) {
533
- const u = e.value.findIndex((K) => K.id === a);
534
- u >= 0 && (e.value[u] = { ...e.value[u], ...d }, $());
532
+ function z(a, u) {
533
+ const c = e.value.findIndex((R) => R.id === a);
534
+ c >= 0 && (e.value[c] = { ...e.value[c], ...u }, $());
535
535
  }
536
- function C(a, d) {
537
- const u = e.value.find((K) => K.id === a);
538
- u && (u.logs.unshift(d), u.logs.length > 20 && u.logs.pop());
536
+ function C(a, u) {
537
+ const c = e.value.find((R) => R.id === a);
538
+ c && (c.logs.unshift(u), c.logs.length > 20 && c.logs.pop());
539
539
  }
540
- function U() {
540
+ function F() {
541
541
  n.value = !0, t.value = !1;
542
542
  }
543
543
  function Y() {
@@ -553,73 +553,73 @@ const gt = Wt("ycAiTask", () => {
553
553
  o.value = !1, rt();
554
554
  }
555
555
  function H() {
556
- ge || (ge = setInterval(() => {
556
+ me || (me = setInterval(() => {
557
557
  J();
558
- }, In));
558
+ }, Cn));
559
559
  }
560
560
  function x() {
561
- M.value > 0 || ge && (clearInterval(ge), ge = null);
561
+ M.value > 0 || me && (clearInterval(me), me = null);
562
562
  }
563
563
  async function J() {
564
- const a = e.value.filter((d) => d.runId && ae(d.status));
564
+ const a = e.value.filter((u) => u.runId && oe(u.status));
565
565
  if (!a.length) {
566
566
  x();
567
567
  return;
568
568
  }
569
- await Promise.all(a.map((d) => X(d.id)));
569
+ await Promise.all(a.map((u) => X(u.id)));
570
570
  }
571
571
  async function X(a) {
572
572
  if (w.has(a)) return;
573
- const d = e.value.find((u) => u.id === a);
574
- if (!(!(d != null && d.runId) || !ae(d.status))) {
573
+ const u = e.value.find((c) => c.id === a);
574
+ if (!(!(u != null && u.runId) || !oe(u.status))) {
575
575
  w.add(a);
576
576
  try {
577
- const u = await mn(d.runId, {
578
- onProgress: (K, re) => z(a, { progress: K, summary: re, status: "running" })
577
+ const c = await gn(u.runId, {
578
+ onProgress: (R, se) => z(a, { progress: R, summary: se, status: "running" })
579
579
  });
580
- if (!u) return;
581
- if (u.phase === "SUCCEEDED") {
582
- const K = u.result ?? {};
580
+ if (!c) return;
581
+ if (c.phase === "SUCCEEDED") {
582
+ const R = c.result ?? {};
583
583
  z(a, {
584
584
  status: "succeeded",
585
585
  progress: 100,
586
586
  summary: "已完成",
587
- result: K,
588
- runId: u.runId,
587
+ result: R,
588
+ runId: c.runId,
589
589
  finishedAt: Date.now()
590
- }), O(a, K);
590
+ }), O(a, R);
591
591
  } else
592
592
  z(a, {
593
- status: u.errorMessage === "已取消" ? "cancelled" : "failed",
593
+ status: c.errorMessage === "已取消" ? "cancelled" : "failed",
594
594
  progress: 100,
595
- summary: u.errorMessage || "失败",
596
- errorMessage: u.errorMessage,
597
- runId: u.runId,
595
+ summary: c.errorMessage || "失败",
596
+ errorMessage: c.errorMessage,
597
+ runId: c.runId,
598
598
  finishedAt: Date.now()
599
599
  });
600
600
  x();
601
- } catch (u) {
602
- const K = u instanceof Error ? u.message : "同步失败";
603
- C(a, `✗ ${K}`);
601
+ } catch (c) {
602
+ const R = c instanceof Error ? c.message : "同步失败";
603
+ C(a, `✗ ${R}`);
604
604
  } finally {
605
605
  w.delete(a);
606
606
  }
607
607
  }
608
608
  }
609
- async function oe() {
609
+ async function ne() {
610
610
  if (g.value) return;
611
611
  g.value = !0;
612
- const a = yn();
613
- a.length && (e.value = a.map(Tn), Be = a.length);
614
- const d = e.value.filter((u) => u.runId && ae(u.status));
615
- d.length && (await Promise.all(d.map((u) => X(u.id))), H());
616
- for (const u of e.value)
617
- u.status === "pending" && !u.runId && z(u.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
612
+ const a = wn();
613
+ a.length && (e.value = a.map(In), Be = a.length);
614
+ const u = e.value.filter((c) => c.runId && oe(c.status));
615
+ u.length && (await Promise.all(u.map((c) => X(c.id))), H());
616
+ for (const c of e.value)
617
+ c.status === "pending" && !c.runId && z(c.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
618
618
  }
619
- function F(a) {
620
- const d = Cn(), u = {
621
- id: d,
622
- title: a.title ?? Sn(a.freeText),
619
+ function K(a) {
620
+ const u = Sn(), c = {
621
+ id: u,
622
+ title: a.title ?? kn(a.freeText),
623
623
  freeText: a.freeText.trim(),
624
624
  promptId: a.promptId,
625
625
  autoMatch: a.autoMatch,
@@ -629,59 +629,59 @@ const gt = Wt("ycAiTask", () => {
629
629
  createdAt: Date.now(),
630
630
  logs: []
631
631
  };
632
- return e.value.unshift(u), $(), a.onFinish && S.set(d, a.onFinish), a.showPanel !== !1 && U(), se(d), d;
632
+ return e.value.unshift(c), $(), a.onFinish && S.set(u, a.onFinish), a.showPanel !== !1 && F(), ie(u), u;
633
633
  }
634
- async function se(a) {
635
- const d = e.value.find((u) => u.id === a);
636
- if (d)
634
+ async function ie(a) {
635
+ const u = e.value.find((c) => c.id === a);
636
+ if (u)
637
637
  try {
638
- const u = await pn({
639
- freeText: d.freeText,
640
- promptId: d.promptId,
641
- autoMatch: d.autoMatch
638
+ const c = await mn({
639
+ freeText: u.freeText,
640
+ promptId: u.promptId,
641
+ autoMatch: u.autoMatch
642
642
  });
643
643
  z(a, {
644
- runId: u,
644
+ runId: c,
645
645
  status: "running",
646
646
  progress: 10,
647
647
  summary: "后端异步处理中…"
648
- }), C(a, `▶ 已提交 runId=${u}`), H(), X(a);
649
- } catch (u) {
650
- const K = u instanceof Error ? u.message : "提交失败";
648
+ }), C(a, `▶ 已提交 runId=${c}`), H(), X(a);
649
+ } catch (c) {
650
+ const R = c instanceof Error ? c.message : "提交失败";
651
651
  z(a, {
652
652
  status: "failed",
653
653
  progress: 100,
654
- summary: K,
655
- errorMessage: K,
654
+ summary: R,
655
+ errorMessage: R,
656
656
  finishedAt: Date.now()
657
657
  });
658
658
  }
659
659
  }
660
660
  async function j(a) {
661
- const d = e.value.find((K) => K.id === a);
662
- if (!(d != null && d.runId)) return null;
663
- if (d.result) return d.result;
664
- const u = await gn(d.runId);
665
- return u && z(a, { result: u }), u;
661
+ const u = e.value.find((R) => R.id === a);
662
+ if (!(u != null && u.runId)) return null;
663
+ if (u.result) return u.result;
664
+ const c = await vn(u.runId);
665
+ return c && z(a, { result: c }), c;
666
666
  }
667
- async function fe(a) {
668
- const d = e.value.find((u) => u.id === a);
669
- if (d != null && d.runId && ae(d.status))
667
+ async function de(a) {
668
+ const u = e.value.find((c) => c.id === a);
669
+ if (u != null && u.runId && oe(u.status))
670
670
  try {
671
- await vn(d.runId);
671
+ await _n(u.runId);
672
672
  } catch {
673
673
  }
674
- d && ae(d.status) && z(a, { status: "cancelled", summary: "已取消", finishedAt: Date.now() }), S.delete(a), x();
674
+ u && oe(u.status) && z(a, { status: "cancelled", summary: "已取消", finishedAt: Date.now() }), S.delete(a), x();
675
675
  }
676
- function ye() {
676
+ function he() {
677
677
  for (const a of e.value)
678
- ae(a.status) && fe(a.id);
678
+ oe(a.status) && de(a.id);
679
679
  }
680
680
  function ke() {
681
- e.value = e.value.filter((a) => ae(a.status)), $();
681
+ e.value = e.value.filter((a) => oe(a.status)), $();
682
682
  }
683
- function Q(a) {
684
- fe(a), S.delete(a), e.value = e.value.filter((d) => d.id !== a), $();
683
+ function ye(a) {
684
+ de(a), S.delete(a), e.value = e.value.filter((u) => u.id !== a), $();
685
685
  }
686
686
  return {
687
687
  tasks: e,
@@ -694,24 +694,24 @@ const gt = Wt("ycAiTask", () => {
694
694
  activeCount: L,
695
695
  panelTitle: N,
696
696
  panelSubtitle: y,
697
- hydrate: oe,
698
- showPanel: U,
697
+ hydrate: ne,
698
+ showPanel: F,
699
699
  hidePanel: Y,
700
700
  toggleMinimize: v,
701
701
  openDialog: T,
702
702
  closeDialog: W,
703
- enqueue: F,
704
- onTaskFinish: R,
703
+ enqueue: K,
704
+ onTaskFinish: U,
705
705
  refreshActiveTasks: J,
706
706
  loadTaskResult: j,
707
- cancelTask: fe,
708
- cancelAll: ye,
707
+ cancelTask: de,
708
+ cancelAll: he,
709
709
  clearFinished: ke,
710
- removeTask: Q
710
+ removeTask: ye
711
711
  };
712
712
  });
713
- async function kn(e) {
714
- return (await de().get("/yc-ai/ai/prompts", {
713
+ async function xn(e) {
714
+ return (await ce().get("/yc-ai/ai/prompts", {
715
715
  params: e ? { category: e } : {}
716
716
  })).data;
717
717
  }
@@ -719,7 +719,7 @@ function ze() {
719
719
  const e = Oe(ft, null);
720
720
  return e || gt();
721
721
  }
722
- const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__footer-actions" }, An = /* @__PURE__ */ ce({
722
+ const bn = { class: "ai-use-dialog__footer" }, An = { class: "ai-use-dialog__footer-actions" }, Mn = /* @__PURE__ */ ue({
723
723
  __name: "AiUseDialog",
724
724
  props: {
725
725
  title: { default: "AI 生成" },
@@ -743,20 +743,20 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
743
743
  emits: ["update:modelValue", "submitted"],
744
744
  setup(e, { emit: n }) {
745
745
  const t = e, o = n, l = ze(), g = D(() => t.modelValue !== void 0), w = k(!1);
746
- ne(
746
+ te(
747
747
  () => t.modelValue,
748
748
  (v) => {
749
749
  g.value && (w.value = !!v);
750
750
  },
751
751
  { immediate: !0 }
752
- ), ne(w, (v) => {
752
+ ), te(w, (v) => {
753
753
  if (g.value) {
754
754
  o("update:modelValue", v);
755
755
  return;
756
756
  }
757
- te.visible = v, v || rt();
758
- }), ne(
759
- () => te.visible,
757
+ ee.visible = v, v || rt();
758
+ }), te(
759
+ () => ee.visible,
760
760
  (v) => {
761
761
  g.value || (w.value = v);
762
762
  },
@@ -767,45 +767,45 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
767
767
  const T = v.detail ?? {};
768
768
  N(T), w.value = !0;
769
769
  }
770
- Ue(() => {
771
- globalThis.addEventListener(Le, S), g.value || (w.value = te.visible);
772
- }), Re(() => {
770
+ Fe(() => {
771
+ globalThis.addEventListener(Le, S), g.value || (w.value = ee.visible);
772
+ }), Ue(() => {
773
773
  globalThis.removeEventListener(Le, S);
774
774
  });
775
775
  const m = D(
776
- () => (g.value ? void 0 : te.options.title) ?? t.title ?? "AI 生成"
776
+ () => (g.value ? void 0 : ee.options.title) ?? t.title ?? "AI 生成"
777
777
  ), r = k({
778
778
  freeText: t.freeText,
779
779
  promptId: t.promptId,
780
780
  autoMatch: t.autoMatch
781
- }), O = k(t.prompts ? [...t.prompts] : []), R = k(!1), M = k(!1), L = k();
781
+ }), O = k(t.prompts ? [...t.prompts] : []), U = k(!1), M = k(!1), L = k();
782
782
  function N(v) {
783
783
  var T, W;
784
784
  r.value.freeText = v.freeText ?? t.freeText ?? "", r.value.promptId = v.promptId ?? t.promptId, r.value.autoMatch = v.autoMatch ?? t.autoMatch ?? !1, L.value = v.onFinish, (T = v.prompts) != null && T.length ? O.value = [...v.prompts] : (W = t.prompts) != null && W.length && (O.value = [...t.prompts]);
785
785
  }
786
786
  async function y() {
787
787
  if (!(O.value.length > 0)) {
788
- R.value = !0;
788
+ U.value = !0;
789
789
  try {
790
790
  const v = it().listPrompts;
791
- O.value = v ? await v() : await kn();
791
+ O.value = v ? await v() : await xn();
792
792
  } catch {
793
- ee.warning("加载提示词失败");
793
+ Z.warning("加载提示词失败");
794
794
  } finally {
795
- R.value = !1;
795
+ U.value = !1;
796
796
  }
797
797
  }
798
798
  }
799
799
  function $() {
800
- g.value ? N({}) : N(te.options), t.showPromptSelect && y();
800
+ g.value ? N({}) : N(ee.options), t.showPromptSelect && y();
801
801
  }
802
- ne(
802
+ te(
803
803
  () => t.prompts,
804
804
  (v) => {
805
805
  v != null && v.length && (O.value = [...v]);
806
806
  },
807
807
  { deep: !0 }
808
- ), ne(
808
+ ), te(
809
809
  () => [t.freeText, t.promptId, t.autoMatch],
810
810
  ([v, T, W]) => {
811
811
  w.value || (r.value.freeText = v ?? "", r.value.promptId = T, r.value.autoMatch = W ?? !1);
@@ -817,34 +817,34 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
817
817
  function C() {
818
818
  M.value = !1;
819
819
  }
820
- function U() {
820
+ function F() {
821
821
  l.showPanel();
822
822
  }
823
823
  async function Y() {
824
824
  var x, J;
825
825
  if (!r.value.freeText.trim()) {
826
- ee.warning("请填写需求描述");
826
+ Z.warning("请填写需求描述");
827
827
  return;
828
828
  }
829
829
  const v = r.value.autoMatch, T = v ? void 0 : r.value.promptId;
830
830
  if (!v && T == null) {
831
831
  const X = t.showPromptSelect || t.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
832
- ee.warning(X);
832
+ Z.warning(X);
833
833
  return;
834
834
  }
835
835
  M.value = !0;
836
- const W = g.value ? L.value : te.options.onFinish, H = l.enqueue({
836
+ const W = g.value ? L.value : ee.options.onFinish, H = l.enqueue({
837
837
  freeText: r.value.freeText.trim(),
838
838
  promptId: T,
839
839
  autoMatch: v && T == null ? !0 : void 0,
840
840
  showPanel: !0,
841
841
  onFinish: W
842
842
  });
843
- g.value ? o("submitted", H) : (J = (x = te.options).onSubmitted) == null || J.call(x, H), w.value = !1, M.value = !1, ee.success("已加入任务队列,可在任务面板查看进度");
843
+ g.value ? o("submitted", H) : (J = (x = ee.options).onSubmitted) == null || J.call(x, H), w.value = !1, M.value = !1, Z.success("已加入任务队列,可在任务面板查看进度");
844
844
  }
845
845
  return (v, T) => {
846
- const W = V("el-switch"), H = V("el-form-item"), x = V("el-option"), J = V("el-select"), X = V("el-input"), oe = V("el-form"), F = V("el-button"), se = V("el-dialog");
847
- return c(), E(se, {
846
+ const W = V("el-switch"), H = V("el-form-item"), x = V("el-option"), J = V("el-select"), X = V("el-input"), ne = V("el-form"), K = V("el-button"), ie = V("el-dialog");
847
+ return d(), E(ie, {
848
848
  modelValue: w.value,
849
849
  "onUpdate:modelValue": T[4] || (T[4] = (j) => w.value = j),
850
850
  title: m.value,
@@ -855,20 +855,20 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
855
855
  onOpen: $
856
856
  }, {
857
857
  footer: p(() => [
858
- _("div", xn, [
859
- e.showTaskListButton ? (c(), E(F, {
858
+ _("div", bn, [
859
+ e.showTaskListButton ? (d(), E(K, {
860
860
  key: 0,
861
861
  link: "",
862
862
  type: "primary",
863
- onClick: U
863
+ onClick: F
864
864
  }, {
865
865
  default: p(() => [
866
866
  q(B(e.taskListButtonText), 1)
867
867
  ]),
868
868
  _: 1
869
869
  })) : P("", !0),
870
- _("div", bn, [
871
- f(F, {
870
+ _("div", An, [
871
+ f(K, {
872
872
  onClick: T[3] || (T[3] = (j) => w.value = !1)
873
873
  }, {
874
874
  default: p(() => [...T[5] || (T[5] = [
@@ -876,7 +876,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
876
876
  ])]),
877
877
  _: 1
878
878
  }),
879
- f(F, {
879
+ f(K, {
880
880
  type: "primary",
881
881
  loading: M.value,
882
882
  onClick: Y
@@ -890,9 +890,9 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
890
890
  ])
891
891
  ]),
892
892
  default: p(() => [
893
- f(oe, { "label-position": "top" }, {
893
+ f(ne, { "label-position": "top" }, {
894
894
  default: p(() => [
895
- e.showAutoMatch ? (c(), E(H, {
895
+ e.showAutoMatch ? (d(), E(H, {
896
896
  key: 0,
897
897
  label: e.autoMatchLabel
898
898
  }, {
@@ -907,7 +907,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
907
907
  ]),
908
908
  _: 1
909
909
  }, 8, ["label"])) : P("", !0),
910
- e.showPromptSelect ? (c(), E(H, {
910
+ e.showPromptSelect ? (d(), E(H, {
911
911
  key: 1,
912
912
  label: e.promptLabel,
913
913
  required: !r.value.autoMatch
@@ -920,10 +920,10 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
920
920
  clearable: "",
921
921
  placeholder: r.value.autoMatch ? "留空则自动匹配" : "请选择提示词",
922
922
  style: { width: "100%" },
923
- loading: R.value
923
+ loading: U.value
924
924
  }, {
925
925
  default: p(() => [
926
- (c(!0), A(le, null, ve(O.value, (j) => (c(), E(x, {
926
+ (d(!0), A(ae, null, ge(O.value, (j) => (d(), E(x, {
927
927
  key: j.id,
928
928
  label: j.name,
929
929
  value: j.id
@@ -957,16 +957,16 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
957
957
  }, 8, ["modelValue", "title", "width"]);
958
958
  };
959
959
  }
960
- }), Mn = /* @__PURE__ */ Se(An, [["__scopeId", "data-v-9aa82e83"]]), En = { class: "ai-task-panel" }, $n = { class: "ai-task-panel__header" }, Pn = { class: "ai-task-panel__header-left" }, Ln = { class: "ai-task-panel__titles" }, Dn = { class: "ai-task-panel__subtitle" }, Bn = { class: "ai-task-panel__title" }, Vn = { class: "ai-task-panel__header-actions" }, On = { class: "ai-task-panel__body" }, Un = {
960
+ }), En = /* @__PURE__ */ Se(Mn, [["__scopeId", "data-v-9aa82e83"]]), $n = { class: "ai-task-panel" }, Pn = { class: "ai-task-panel__header" }, Ln = { class: "ai-task-panel__header-left" }, Dn = { class: "ai-task-panel__titles" }, Bn = { class: "ai-task-panel__subtitle" }, Vn = { class: "ai-task-panel__title" }, On = { class: "ai-task-panel__header-actions" }, Fn = { class: "ai-task-panel__body" }, Un = {
961
961
  key: 1,
962
962
  class: "ai-task-list"
963
- }, Rn = { class: "ai-task-row__icon" }, Fn = { class: "ai-task-row__main" }, Kn = { class: "ai-task-row__title" }, Nn = { class: "ai-task-row__meta" }, zn = { key: 0 }, Yn = {
963
+ }, Rn = { class: "ai-task-row__icon" }, Kn = { class: "ai-task-row__main" }, Nn = { class: "ai-task-row__title" }, zn = { class: "ai-task-row__meta" }, Yn = { key: 0 }, Wn = {
964
964
  key: 0,
965
965
  class: "ai-task-row__summary"
966
- }, Wn = { class: "ai-task-row__ops" }, jn = {
966
+ }, jn = { class: "ai-task-row__ops" }, Gn = {
967
967
  key: 0,
968
968
  class: "ai-task-panel__footer"
969
- }, Gn = /* @__PURE__ */ ce({
969
+ }, qn = /* @__PURE__ */ ue({
970
970
  __name: "AiTaskPanel",
971
971
  emits: ["use"],
972
972
  setup(e, { emit: n }) {
@@ -999,15 +999,15 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
999
999
  }
1000
1000
  }
1001
1001
  return (m, r) => {
1002
- const O = V("el-icon"), R = V("el-button"), M = V("el-empty"), L = V("el-progress"), N = V("el-badge");
1003
- return c(), E(Mt, { to: "body" }, [
1002
+ const O = V("el-icon"), U = V("el-button"), M = V("el-empty"), L = V("el-progress"), N = V("el-badge");
1003
+ return d(), E(Et, { to: "body" }, [
1004
1004
  f(tt, { name: "ai-panel-slide" }, {
1005
1005
  default: p(() => [
1006
- _e(_("div", En, [
1007
- _("div", $n, [
1008
- _("div", Pn, [
1006
+ ve(_("div", $n, [
1007
+ _("div", Pn, [
1008
+ _("div", Ln, [
1009
1009
  _("div", {
1010
- class: ue(["ai-task-panel__icon", { spinning: h(o).activeCount > 0 }])
1010
+ class: re(["ai-task-panel__icon", { spinning: h(o).activeCount > 0 }])
1011
1011
  }, [
1012
1012
  f(O, null, {
1013
1013
  default: p(() => [
@@ -1016,13 +1016,13 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1016
1016
  _: 1
1017
1017
  })
1018
1018
  ], 2),
1019
- _("div", Ln, [
1020
- _("div", Dn, B(h(o).panelSubtitle), 1),
1021
- _("div", Bn, B(h(o).panelTitle), 1)
1019
+ _("div", Dn, [
1020
+ _("div", Bn, B(h(o).panelSubtitle), 1),
1021
+ _("div", Vn, B(h(o).panelTitle), 1)
1022
1022
  ])
1023
1023
  ]),
1024
- _("div", Vn, [
1025
- h(o).runningCount > 0 ? (c(), E(R, {
1024
+ _("div", On, [
1025
+ h(o).runningCount > 0 ? (d(), E(U, {
1026
1026
  key: 0,
1027
1027
  link: "",
1028
1028
  type: "primary",
@@ -1033,7 +1033,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1033
1033
  ])]),
1034
1034
  _: 1
1035
1035
  })) : P("", !0),
1036
- f(R, {
1036
+ f(U, {
1037
1037
  link: "",
1038
1038
  onClick: r[1] || (r[1] = (y) => h(o).toggleMinimize())
1039
1039
  }, {
@@ -1047,7 +1047,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1047
1047
  ]),
1048
1048
  _: 1
1049
1049
  }),
1050
- f(R, {
1050
+ f(U, {
1051
1051
  link: "",
1052
1052
  onClick: r[2] || (r[2] = (y) => h(o).hidePanel())
1053
1053
  }, {
@@ -1063,14 +1063,14 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1063
1063
  })
1064
1064
  ])
1065
1065
  ]),
1066
- _("div", On, [
1067
- h(o).tasks.length ? (c(), A("div", Un, [
1068
- (c(!0), A(le, null, ve(h(o).tasks, (y) => (c(), A("div", {
1066
+ _("div", Fn, [
1067
+ h(o).tasks.length ? (d(), A("div", Un, [
1068
+ (d(!0), A(ae, null, ge(h(o).tasks, (y) => (d(), A("div", {
1069
1069
  key: y.id,
1070
1070
  class: "ai-task-row"
1071
1071
  }, [
1072
1072
  _("div", Rn, [
1073
- y.status === "succeeded" ? (c(), E(O, {
1073
+ y.status === "succeeded" ? (d(), E(O, {
1074
1074
  key: 0,
1075
1075
  class: "ok"
1076
1076
  }, {
@@ -1078,40 +1078,40 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1078
1078
  f(h(Rt))
1079
1079
  ]),
1080
1080
  _: 1
1081
- })) : y.status === "failed" ? (c(), E(O, {
1081
+ })) : y.status === "failed" ? (d(), E(O, {
1082
1082
  key: 1,
1083
1083
  class: "err"
1084
1084
  }, {
1085
1085
  default: p(() => [
1086
- f(h(Ft))
1086
+ f(h(Kt))
1087
1087
  ]),
1088
1088
  _: 1
1089
- })) : y.status === "running" || y.status === "pending" ? (c(), E(L, {
1089
+ })) : y.status === "running" || y.status === "pending" ? (d(), E(L, {
1090
1090
  key: 2,
1091
1091
  type: "circle",
1092
1092
  percentage: y.progress,
1093
1093
  width: 36,
1094
1094
  "stroke-width": 3
1095
- }, null, 8, ["percentage"])) : (c(), E(O, {
1095
+ }, null, 8, ["percentage"])) : (d(), E(O, {
1096
1096
  key: 3,
1097
1097
  class: "muted"
1098
1098
  }, {
1099
1099
  default: p(() => [
1100
- f(h(Kt))
1100
+ f(h(Nt))
1101
1101
  ]),
1102
1102
  _: 1
1103
1103
  }))
1104
1104
  ]),
1105
- _("div", Fn, [
1106
- _("div", Kn, B(y.title), 1),
1107
- _("div", Nn, [
1105
+ _("div", Kn, [
1106
+ _("div", Nn, B(y.title), 1),
1107
+ _("div", zn, [
1108
1108
  _("span", null, B(w(y.status)), 1),
1109
- y.runId ? (c(), A("span", zn, " · #" + B(y.runId), 1)) : P("", !0)
1109
+ y.runId ? (d(), A("span", Yn, " · #" + B(y.runId), 1)) : P("", !0)
1110
1110
  ]),
1111
- y.summary ? (c(), A("div", Yn, B(y.summary), 1)) : P("", !0)
1111
+ y.summary ? (d(), A("div", Wn, B(y.summary), 1)) : P("", !0)
1112
1112
  ]),
1113
- _("div", Wn, [
1114
- y.status === "running" || y.status === "pending" ? (c(), E(R, {
1113
+ _("div", jn, [
1114
+ y.status === "running" || y.status === "pending" ? (d(), E(U, {
1115
1115
  key: 0,
1116
1116
  link: "",
1117
1117
  type: "danger",
@@ -1123,7 +1123,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1123
1123
  ])]),
1124
1124
  _: 1
1125
1125
  }, 8, ["onClick"])) : P("", !0),
1126
- y.status === "succeeded" && y.runId ? (c(), E(R, {
1126
+ y.status === "succeeded" && y.runId ? (d(), E(U, {
1127
1127
  key: 1,
1128
1128
  link: "",
1129
1129
  type: "primary",
@@ -1136,7 +1136,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1136
1136
  ])]),
1137
1137
  _: 1
1138
1138
  }, 8, ["loading", "onClick"])) : P("", !0),
1139
- y.status !== "running" && y.status !== "pending" ? (c(), E(R, {
1139
+ y.status !== "running" && y.status !== "pending" ? (d(), E(U, {
1140
1140
  key: 2,
1141
1141
  link: "",
1142
1142
  size: "small",
@@ -1149,14 +1149,14 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1149
1149
  }, 8, ["onClick"])) : P("", !0)
1150
1150
  ])
1151
1151
  ]))), 128))
1152
- ])) : (c(), E(M, {
1152
+ ])) : (d(), E(M, {
1153
1153
  key: 0,
1154
1154
  description: "暂无 AI 任务",
1155
1155
  "image-size": 64
1156
1156
  }))
1157
1157
  ]),
1158
- h(o).tasks.some((y) => y.status !== "running" && y.status !== "pending") ? (c(), A("div", jn, [
1159
- f(R, {
1158
+ h(o).tasks.some((y) => y.status !== "running" && y.status !== "pending") ? (d(), A("div", Gn, [
1159
+ f(U, {
1160
1160
  link: "",
1161
1161
  type: "info",
1162
1162
  onClick: r[3] || (r[3] = (y) => h(o).clearFinished())
@@ -1173,11 +1173,11 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1173
1173
  ]),
1174
1174
  _: 1
1175
1175
  }),
1176
- _e(_("div", {
1176
+ ve(_("div", {
1177
1177
  class: "ai-task-panel-mini",
1178
1178
  onClick: r[4] || (r[4] = (y) => h(o).toggleMinimize())
1179
1179
  }, [
1180
- h(o).activeCount > 0 ? (c(), E(O, {
1180
+ h(o).activeCount > 0 ? (d(), E(O, {
1181
1181
  key: 0,
1182
1182
  class: "spinning"
1183
1183
  }, {
@@ -1187,7 +1187,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1187
1187
  _: 1
1188
1188
  })) : P("", !0),
1189
1189
  _("span", null, B(h(o).panelSubtitle), 1),
1190
- h(o).runningCount > 0 ? (c(), E(N, {
1190
+ h(o).runningCount > 0 ? (d(), E(N, {
1191
1191
  key: 1,
1192
1192
  value: h(o).runningCount,
1193
1193
  class: "m-l-8"
@@ -1198,7 +1198,7 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1198
1198
  ]);
1199
1199
  };
1200
1200
  }
1201
- }), qn = /* @__PURE__ */ Se(Gn, [["__scopeId", "data-v-812b3127"]]), Bo = /* @__PURE__ */ ce({
1201
+ }), Hn = /* @__PURE__ */ Se(qn, [["__scopeId", "data-v-812b3127"]]), Vo = /* @__PURE__ */ ue({
1202
1202
  __name: "AiTaskProvider",
1203
1203
  props: {
1204
1204
  title: {},
@@ -1247,66 +1247,66 @@ const xn = { class: "ai-use-dialog__footer" }, bn = { class: "ai-use-dialog__foo
1247
1247
  function S(m) {
1248
1248
  o("use", m);
1249
1249
  }
1250
- return Ue(() => {
1250
+ return Fe(() => {
1251
1251
  l.hydrate(), w = l.onTaskFinish((m) => o("finish", m));
1252
- }), Re(() => {
1252
+ }), Ue(() => {
1253
1253
  w == null || w();
1254
- }), (m, r) => (c(), A(le, null, [
1255
- e.showDialog !== !1 ? (c(), E(Mn, Et(ot({ key: 0 }, g.value)), null, 16)) : P("", !0),
1256
- f(qn, { onUse: S }),
1254
+ }), (m, r) => (d(), A(ae, null, [
1255
+ e.showDialog !== !1 ? (d(), E(En, $t(ot({ key: 0 }, g.value)), null, 16)) : P("", !0),
1256
+ f(Hn, { onUse: S }),
1257
1257
  Ce(m.$slots, "default")
1258
1258
  ], 64));
1259
1259
  }
1260
1260
  });
1261
- function Vo() {
1261
+ function Oo() {
1262
1262
  const e = Oe(dt, null);
1263
1263
  return e || ut(ze());
1264
1264
  }
1265
1265
  const Me = "__YC_COMPONENT_IMAGE_SELECTOR__", Ve = "yc-component:image-selector-open";
1266
- function Hn() {
1266
+ function Jn() {
1267
1267
  const e = globalThis;
1268
1268
  return e[Me] || (e[Me] = nt({
1269
1269
  visible: !1,
1270
1270
  options: {}
1271
1271
  })), e[Me];
1272
1272
  }
1273
- const G = Hn();
1274
- function Jn(e = {}) {
1273
+ const G = Jn();
1274
+ function Xn(e = {}) {
1275
1275
  G.options = { ...e }, G.visible = !0, globalThis.dispatchEvent(
1276
1276
  new CustomEvent(Ve, { detail: { ...e } })
1277
1277
  );
1278
1278
  }
1279
- function Xn() {
1279
+ function Qn() {
1280
1280
  G.visible = !1;
1281
1281
  }
1282
- function Qn(e = {}) {
1283
- Jn(e);
1282
+ function Zn(e = {}) {
1283
+ Xn(e);
1284
1284
  }
1285
- const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__toolbar" }, to = { class: "yc-image-selector__body" }, no = {
1285
+ const eo = { class: "yc-image-selector" }, to = { class: "yc-image-selector__toolbar" }, no = { class: "yc-image-selector__body" }, oo = {
1286
1286
  key: 0,
1287
1287
  class: "yc-image-selector__aside"
1288
- }, oo = ["onClick"], ao = {
1288
+ }, ao = ["onClick"], lo = {
1289
1289
  key: 0,
1290
1290
  class: "yc-image-selector__category-count"
1291
- }, lo = { class: "yc-image-selector__main" }, io = {
1291
+ }, io = { class: "yc-image-selector__main" }, so = {
1292
1292
  key: 1,
1293
1293
  class: "yc-image-selector__grid"
1294
- }, so = ["onClick"], ro = { class: "yc-image-selector__thumb" }, uo = ["src", "alt", "onLoad"], co = {
1294
+ }, ro = ["onClick"], uo = { class: "yc-image-selector__thumb" }, co = ["src", "alt", "onLoad"], fo = {
1295
1295
  key: 0,
1296
1296
  class: "yc-image-selector__order"
1297
- }, fo = ["title"], po = {
1297
+ }, po = ["title"], mo = {
1298
1298
  key: 0,
1299
1299
  class: "yc-image-selector__selected-bar"
1300
- }, mo = { class: "yc-image-selector__selected-bar-label" }, go = { class: "yc-image-selector__selected-bar-list" }, vo = ["onClick"], _o = ["src", "alt"], ho = {
1300
+ }, go = { class: "yc-image-selector__selected-bar-label" }, vo = { class: "yc-image-selector__selected-bar-list" }, _o = ["onClick"], ho = ["src", "alt"], yo = {
1301
1301
  key: 1,
1302
1302
  class: "yc-image-selector__pagination"
1303
- }, yo = {
1303
+ }, wo = {
1304
1304
  key: 0,
1305
1305
  class: "yc-image-selector__footer"
1306
- }, wo = { class: "yc-image-selector__selected-tip" }, To = { class: "yc-image-selector__footer-actions" }, Io = {
1306
+ }, To = { class: "yc-image-selector__selected-tip" }, Io = { class: "yc-image-selector__footer-actions" }, Co = {
1307
1307
  key: 1,
1308
1308
  class: "yc-image-selector__footer yc-image-selector__footer--quick"
1309
- }, Co = { class: "yc-image-selector__selected-tip" }, So = /* @__PURE__ */ ce({
1309
+ }, So = { class: "yc-image-selector__selected-tip" }, ko = /* @__PURE__ */ ue({
1310
1310
  __name: "YcImageSelectorDialog",
1311
1311
  props: {
1312
1312
  modelValue: { type: Boolean },
@@ -1327,27 +1327,28 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
1327
1327
  cancelText: { default: "取消" },
1328
1328
  emptyText: { default: "暂无图片资源" },
1329
1329
  getImages: {},
1330
- upload: {}
1330
+ upload: {},
1331
+ urlField: { default: "url" }
1331
1332
  },
1332
1333
  emits: ["update:modelValue", "confirm", "cancel"],
1333
1334
  setup(e, { emit: n }) {
1334
1335
  const t = e, o = n, l = D(() => t.modelValue !== void 0), g = k(!1);
1335
- ne(
1336
+ te(
1336
1337
  () => t.modelValue,
1337
- (s) => {
1338
- l.value && (g.value = !!s);
1338
+ (i) => {
1339
+ l.value && (g.value = !!i);
1339
1340
  },
1340
1341
  { immediate: !0 }
1341
- ), ne(g, (s) => {
1342
+ ), te(g, (i) => {
1342
1343
  if (l.value) {
1343
- o("update:modelValue", s);
1344
+ o("update:modelValue", i);
1344
1345
  return;
1345
1346
  }
1346
- G.visible = s, s || Xn();
1347
- }), ne(
1347
+ G.visible = i, i || Qn();
1348
+ }), te(
1348
1349
  () => G.visible,
1349
- (s) => {
1350
- l.value || (g.value = s);
1350
+ (i) => {
1351
+ l.value || (g.value = i);
1351
1352
  },
1352
1353
  { immediate: !0 }
1353
1354
  );
@@ -1361,133 +1362,136 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
1361
1362
  () => (l.value ? void 0 : G.options.showModeSwitch) ?? t.showModeSwitch
1362
1363
  ), O = D(
1363
1364
  () => (l.value ? void 0 : G.options.showCategories) ?? t.showCategories
1364
- ), R = D(() => {
1365
- var s, i;
1366
- if ((s = t.categories) != null && s.length) return t.categories;
1367
- if (!l.value && ((i = G.options.categories) != null && i.length))
1365
+ ), U = D(() => {
1366
+ var i, s;
1367
+ if ((i = t.categories) != null && i.length) return t.categories;
1368
+ if (!l.value && ((s = G.options.categories) != null && s.length))
1368
1369
  return G.options.categories;
1369
- }), M = D(() => O.value ? R.value ?? H.value : []), L = D(() => !!t.confirmOnSelect), N = k("single"), y = [
1370
+ }), M = D(() => O.value ? U.value ?? H.value : []), L = D(() => !!t.confirmOnSelect), N = k("single"), y = [
1370
1371
  { label: "单选", value: "single" },
1371
1372
  { label: "多选", value: "multiple" }
1372
1373
  ], $ = D(
1373
1374
  () => r.value ? N.value === "multiple" : S.value
1374
- ), z = k(""), C = k(""), U = k(1), Y = k(0), v = k(!1), T = k(!1), W = k([]), H = k([]), x = k(/* @__PURE__ */ new Map()), J = k(/* @__PURE__ */ new Map()), X = k(), oe = k(), F = D(() => [...x.value.values()]), se = D(() => {
1375
- var i, b;
1376
- const s = F.value.length;
1377
- return L.value ? s ? `已选:${((i = F.value[0]) == null ? void 0 : i.name) || "1 张图片"}` : "单击图片即可完成选择" : s ? $.value ? `已选 ${s} / ${m.value} 张` : `已选:${((b = F.value[0]) == null ? void 0 : b.name) || "1 张图片"}` : $.value ? `多选模式:最多 ${m.value} 张` : "单选模式:请选择一张图片";
1375
+ ), z = k(""), C = k(""), F = k(1), Y = k(0), v = k(!1), T = k(!1), W = k([]), H = k([]), x = k(/* @__PURE__ */ new Map()), J = k(/* @__PURE__ */ new Map()), X = k(), ne = k(), K = D(() => [...x.value.values()]), ie = D(() => {
1376
+ var s, b;
1377
+ const i = K.value.length;
1378
+ return L.value ? i ? `已选:${((s = K.value[0]) == null ? void 0 : s.name) || "1 张图片"}` : "单击图片即可完成选择" : i ? $.value ? `已选 ${i} / ${m.value} 张` : `已选:${((b = K.value[0]) == null ? void 0 : b.name) || "1 张图片"}` : $.value ? `多选模式:最多 ${m.value} 张` : "单选模式:请选择一张图片";
1378
1379
  });
1379
- function j(s) {
1380
- const i = F.value.findIndex((b) => Q(b) === Q(s));
1381
- return i >= 0 ? i + 1 : "";
1380
+ function j(i) {
1381
+ const s = K.value.findIndex((b) => a(b) === a(i));
1382
+ return s >= 0 ? s + 1 : "";
1382
1383
  }
1383
- function fe(s) {
1384
- if (s === "single" && F.value.length > 1) {
1385
- const i = F.value[0];
1386
- x.value = /* @__PURE__ */ new Map([[Q(i), i]]), ee.info("已切换为单选,仅保留第一张");
1384
+ function de(i) {
1385
+ if (i === "single" && K.value.length > 1) {
1386
+ const s = K.value[0];
1387
+ x.value = /* @__PURE__ */ new Map([[a(s), s]]), Z.info("已切换为单选,仅保留第一张");
1387
1388
  }
1388
1389
  }
1389
- function ye() {
1390
+ function he() {
1390
1391
  N.value = S.value ? "multiple" : "single";
1391
1392
  }
1392
1393
  function ke() {
1393
1394
  x.value = /* @__PURE__ */ new Map();
1394
1395
  }
1395
- function Q(s) {
1396
- return s.id ?? s.url;
1396
+ function ye(i) {
1397
+ return i[t.urlField];
1398
+ }
1399
+ function a(i) {
1400
+ return i.id ?? i.url;
1397
1401
  }
1398
- function a(s) {
1399
- return x.value.has(Q(s));
1402
+ function u(i) {
1403
+ return x.value.has(a(i));
1400
1404
  }
1401
- function d(s, i) {
1402
- return s < i ? "portrait" : s > i ? "landscape" : "square";
1405
+ function c(i, s) {
1406
+ return i < s ? "portrait" : i > s ? "landscape" : "square";
1403
1407
  }
1404
- function u(s, i) {
1405
- const b = Q(s);
1406
- J.value.get(b) !== i && (J.value.set(b, i), J.value = new Map(J.value));
1408
+ function R(i, s) {
1409
+ const b = a(i);
1410
+ J.value.get(b) !== s && (J.value.set(b, s), J.value = new Map(J.value));
1407
1411
  }
1408
- function K(s) {
1409
- const i = J.value.get(Q(s));
1410
- return i ? `yc-image-selector__img--${i}` : "";
1412
+ function se(i) {
1413
+ const s = J.value.get(a(i));
1414
+ return s ? `yc-image-selector__img--${s}` : "";
1411
1415
  }
1412
- function re(s, i) {
1413
- const b = s.target;
1414
- !(b != null && b.naturalWidth) || !(b != null && b.naturalHeight) || u(i, d(b.naturalWidth, b.naturalHeight));
1416
+ function fe(i, s) {
1417
+ const b = i.target;
1418
+ !(b != null && b.naturalWidth) || !(b != null && b.naturalHeight) || R(s, c(b.naturalWidth, b.naturalHeight));
1415
1419
  }
1416
- function pe(s) {
1417
- s.width && s.height && u(s, d(s.width, s.height));
1420
+ function yt(i) {
1421
+ i.width && i.height && R(i, c(i.width, i.height));
1418
1422
  }
1419
- function Ye(s) {
1420
- const i = /* @__PURE__ */ new Map();
1421
- if (!(s != null && s.length)) {
1422
- x.value = i;
1423
+ function Ye(i) {
1424
+ const s = /* @__PURE__ */ new Map();
1425
+ if (!(i != null && i.length)) {
1426
+ x.value = s;
1423
1427
  return;
1424
1428
  }
1425
- if (typeof s[0] == "string")
1426
- for (const Z of s)
1427
- i.set(Z, { id: Z, url: Z, name: Z.split("/").pop() });
1429
+ if (typeof i[0] == "string")
1430
+ for (const Q of i)
1431
+ s.set(Q, { id: Q, url: Q, name: Q.split("/").pop() });
1428
1432
  else
1429
- for (const Z of s)
1430
- i.set(Q(Z), Z);
1431
- x.value = i;
1433
+ for (const Q of i)
1434
+ s.set(a(Q), Q);
1435
+ x.value = s;
1432
1436
  }
1433
- function xe(s) {
1434
- X.value = s.onConfirm, oe.value = s.onCancel, Ye(s.selected ?? t.selected);
1437
+ function xe(i) {
1438
+ X.value = i.onConfirm, ne.value = i.onCancel, Ye(i.selected ?? t.selected);
1435
1439
  }
1436
- function We(s) {
1440
+ function We(i) {
1437
1441
  if (l.value) return;
1438
- const i = s.detail ?? {};
1439
- xe(i), g.value = !0;
1442
+ const s = i.detail ?? {};
1443
+ xe(s), g.value = !0;
1440
1444
  }
1441
- Ue(() => {
1445
+ Fe(() => {
1442
1446
  globalThis.addEventListener(Ve, We), l.value || (g.value = G.visible);
1443
- }), Re(() => {
1447
+ }), Ue(() => {
1444
1448
  globalThis.removeEventListener(Ve, We);
1445
1449
  });
1446
1450
  async function be() {
1447
- var s;
1451
+ var i;
1448
1452
  if (!t.getImages) {
1449
- ee.error("请通过 props.getImages 传入图片列表请求方法");
1453
+ Z.error("请通过 props.getImages 传入图片列表请求方法");
1450
1454
  return;
1451
1455
  }
1452
1456
  v.value = !0;
1453
1457
  try {
1454
- const i = await t.getImages({
1458
+ const s = await t.getImages({
1455
1459
  keyword: z.value.trim() || void 0,
1456
1460
  category: C.value || void 0,
1457
- page: U.value,
1461
+ page: F.value,
1458
1462
  pageSize: t.pageSize
1459
1463
  });
1460
- W.value = i.list, Y.value = i.total;
1461
- for (const b of i.list)
1462
- pe(b);
1463
- !R.value && ((s = i.categories) != null && s.length) && (H.value = i.categories);
1464
- } catch (i) {
1465
- ee.error(i instanceof Error ? i.message : "加载图片失败");
1464
+ W.value = s.list, Y.value = s.total;
1465
+ for (const b of s.list)
1466
+ yt(b);
1467
+ !U.value && ((i = s.categories) != null && i.length) && (H.value = s.categories);
1468
+ } catch (s) {
1469
+ Z.error(s instanceof Error ? s.message : "加载图片失败");
1466
1470
  } finally {
1467
1471
  v.value = !1;
1468
1472
  }
1469
1473
  }
1470
1474
  function we() {
1471
- U.value = 1, be();
1475
+ F.value = 1, be();
1472
1476
  }
1473
- function je(s) {
1474
- C.value !== s && (C.value = s, we());
1477
+ function je(i) {
1478
+ C.value !== i && (C.value = i, we());
1475
1479
  }
1476
- function Ge(s) {
1477
- const i = Q(s);
1480
+ function Ge(i) {
1481
+ const s = a(i);
1478
1482
  if ($.value) {
1479
- if (x.value.has(i)) {
1480
- x.value.delete(i), x.value = new Map(x.value);
1483
+ if (x.value.has(s)) {
1484
+ x.value.delete(s), x.value = new Map(x.value);
1481
1485
  return;
1482
1486
  }
1483
- if (F.value.length >= m.value) {
1484
- ee.warning(`最多选择 ${m.value} 张图片`);
1487
+ if (K.value.length >= m.value) {
1488
+ Z.warning(`最多选择 ${m.value} 张图片`);
1485
1489
  return;
1486
1490
  }
1487
- x.value.set(i, s), x.value = new Map(x.value);
1491
+ x.value.set(s, i), x.value = new Map(x.value);
1488
1492
  return;
1489
1493
  }
1490
- if (x.value.has(i)) {
1494
+ if (x.value.has(s)) {
1491
1495
  if (L.value) {
1492
1496
  Je(() => Te());
1493
1497
  return;
@@ -1495,75 +1499,75 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
1495
1499
  x.value = /* @__PURE__ */ new Map();
1496
1500
  return;
1497
1501
  }
1498
- x.value = /* @__PURE__ */ new Map([[i, s]]), L.value && Je(() => Te());
1502
+ x.value = /* @__PURE__ */ new Map([[s, i]]), L.value && Je(() => Te());
1499
1503
  }
1500
- async function yt(s) {
1504
+ async function wt(i) {
1501
1505
  if (!t.upload) {
1502
- ee.error("请通过 props.upload 传入图片上传方法");
1506
+ Z.error("请通过 props.upload 传入图片上传方法");
1503
1507
  return;
1504
1508
  }
1505
1509
  T.value = !0;
1506
1510
  try {
1507
- const { resource: i } = await t.upload(s.file);
1508
- if (ee.success("上传成功"), $.value)
1509
- F.value.length < m.value && (x.value.set(Q(i), i), x.value = new Map(x.value));
1510
- else if (x.value = /* @__PURE__ */ new Map([[Q(i), i]]), L.value) {
1511
+ const { resource: s } = await t.upload(i.file);
1512
+ if (Z.success("上传成功"), $.value)
1513
+ K.value.length < m.value && (x.value.set(a(s), s), x.value = new Map(x.value));
1514
+ else if (x.value = /* @__PURE__ */ new Map([[a(s), s]]), L.value) {
1511
1515
  Te();
1512
1516
  return;
1513
1517
  }
1514
1518
  we();
1515
- } catch (i) {
1516
- ee.error(i instanceof Error ? i.message : "上传失败");
1519
+ } catch (s) {
1520
+ Z.error(s instanceof Error ? s.message : "上传失败");
1517
1521
  } finally {
1518
1522
  T.value = !1;
1519
1523
  }
1520
1524
  }
1521
- function wt() {
1522
- z.value = "", C.value = "", U.value = 1, J.value = /* @__PURE__ */ new Map(), ye(), l.value ? xe({}) : xe(G.options), ye(), be();
1523
- }
1524
1525
  function Tt() {
1526
+ z.value = "", C.value = "", F.value = 1, J.value = /* @__PURE__ */ new Map(), he(), l.value ? xe({}) : xe(G.options), he(), be();
1527
+ }
1528
+ function It() {
1525
1529
  T.value = !1;
1526
1530
  }
1527
1531
  function qe() {
1528
- var s, i, b;
1529
- (s = oe.value) == null || s.call(oe), l.value || (b = (i = G.options).onCancel) == null || b.call(i), o("cancel"), g.value = !1;
1532
+ var i, s, b;
1533
+ (i = ne.value) == null || i.call(ne), l.value || (b = (s = G.options).onCancel) == null || b.call(s), o("cancel"), g.value = !1;
1530
1534
  }
1531
1535
  function Te() {
1532
- var i, b, Z;
1533
- if (!F.value.length) {
1534
- ee.warning("请选择图片");
1536
+ var s, b, Q;
1537
+ if (!K.value.length) {
1538
+ Z.warning("请选择图片");
1535
1539
  return;
1536
1540
  }
1537
- const s = [...F.value];
1541
+ const i = [...K.value];
1538
1542
  if (l.value) {
1539
- o("confirm", s), g.value = !1;
1543
+ o("confirm", i), g.value = !1;
1540
1544
  return;
1541
1545
  }
1542
- (i = X.value) == null || i.call(X, s), (Z = (b = G.options).onConfirm) == null || Z.call(b, s), o("confirm", s), g.value = !1;
1546
+ (s = X.value) == null || s.call(X, i), (Q = (b = G.options).onConfirm) == null || Q.call(b, i), o("confirm", i), g.value = !1;
1543
1547
  }
1544
- return ne(
1548
+ return te(
1545
1549
  () => t.selected,
1546
- (s) => {
1547
- g.value || Ye(s);
1550
+ (i) => {
1551
+ g.value || Ye(i);
1548
1552
  },
1549
1553
  { deep: !0 }
1550
- ), (s, i) => {
1551
- const b = V("el-icon"), Z = V("el-input"), It = V("el-segmented"), me = V("el-button"), Ct = V("el-upload"), St = V("el-empty"), kt = V("el-pagination"), xt = V("el-dialog"), bt = et("loading");
1552
- return c(), E(xt, {
1554
+ ), (i, s) => {
1555
+ const b = V("el-icon"), Q = V("el-input"), Ct = V("el-segmented"), pe = V("el-button"), St = V("el-upload"), kt = V("el-empty"), xt = V("el-pagination"), bt = V("el-dialog"), At = et("loading");
1556
+ return d(), E(bt, {
1553
1557
  modelValue: g.value,
1554
- "onUpdate:modelValue": i[4] || (i[4] = (I) => g.value = I),
1558
+ "onUpdate:modelValue": s[4] || (s[4] = (I) => g.value = I),
1555
1559
  title: w.value,
1556
1560
  width: e.width,
1557
1561
  "append-to-body": "",
1558
1562
  "destroy-on-close": "",
1559
1563
  class: "yc-image-selector-dialog",
1560
- onClosed: Tt,
1561
- onOpen: wt
1564
+ onClosed: It,
1565
+ onOpen: Tt
1562
1566
  }, {
1563
1567
  footer: p(() => [
1564
- L.value ? (c(), A("div", Io, [
1565
- _("span", Co, B(se.value), 1),
1566
- f(me, {
1568
+ L.value ? (d(), A("div", Co, [
1569
+ _("span", So, B(ie.value), 1),
1570
+ f(pe, {
1567
1571
  link: "",
1568
1572
  type: "primary",
1569
1573
  onClick: qe
@@ -1573,18 +1577,18 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
1573
1577
  ]),
1574
1578
  _: 1
1575
1579
  })
1576
- ])) : (c(), A("div", yo, [
1577
- _("span", wo, B(se.value), 1),
1578
- _("div", To, [
1579
- f(me, { onClick: qe }, {
1580
+ ])) : (d(), A("div", wo, [
1581
+ _("span", To, B(ie.value), 1),
1582
+ _("div", Io, [
1583
+ f(pe, { onClick: qe }, {
1580
1584
  default: p(() => [
1581
1585
  q(B(e.cancelText), 1)
1582
1586
  ]),
1583
1587
  _: 1
1584
1588
  }),
1585
- f(me, {
1589
+ f(pe, {
1586
1590
  type: "primary",
1587
- disabled: !F.value.length,
1591
+ disabled: !K.value.length,
1588
1592
  onClick: Te
1589
1593
  }, {
1590
1594
  default: p(() => [
@@ -1596,44 +1600,44 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
1596
1600
  ]))
1597
1601
  ]),
1598
1602
  default: p(() => [
1599
- _("div", Zn, [
1600
- _("div", eo, [
1601
- f(Z, {
1603
+ _("div", eo, [
1604
+ _("div", to, [
1605
+ f(Q, {
1602
1606
  modelValue: z.value,
1603
- "onUpdate:modelValue": i[0] || (i[0] = (I) => z.value = I),
1607
+ "onUpdate:modelValue": s[0] || (s[0] = (I) => z.value = I),
1604
1608
  clearable: "",
1605
1609
  placeholder: "搜索图片名称",
1606
1610
  class: "yc-image-selector__search",
1607
- onKeyup: $t(we, ["enter"]),
1611
+ onKeyup: Pt(we, ["enter"]),
1608
1612
  onClear: we
1609
1613
  }, {
1610
1614
  prefix: p(() => [
1611
1615
  f(b, null, {
1612
1616
  default: p(() => [
1613
- f(h(Nt))
1617
+ f(h(zt))
1614
1618
  ]),
1615
1619
  _: 1
1616
1620
  })
1617
1621
  ]),
1618
1622
  _: 1
1619
1623
  }, 8, ["modelValue"]),
1620
- r.value ? (c(), E(It, {
1624
+ r.value ? (d(), E(Ct, {
1621
1625
  key: 0,
1622
1626
  modelValue: N.value,
1623
- "onUpdate:modelValue": i[1] || (i[1] = (I) => N.value = I),
1627
+ "onUpdate:modelValue": s[1] || (s[1] = (I) => N.value = I),
1624
1628
  options: y,
1625
1629
  class: "yc-image-selector__mode",
1626
- onChange: fe
1630
+ onChange: de
1627
1631
  }, null, 8, ["modelValue"])) : P("", !0),
1628
- e.showUpload && e.upload ? (c(), E(Ct, {
1632
+ e.showUpload && e.upload ? (d(), E(St, {
1629
1633
  key: 1,
1630
1634
  "show-file-list": !1,
1631
1635
  accept: e.accept,
1632
- "http-request": yt,
1636
+ "http-request": wt,
1633
1637
  disabled: T.value
1634
1638
  }, {
1635
1639
  default: p(() => [
1636
- f(me, {
1640
+ f(pe, {
1637
1641
  type: "primary",
1638
1642
  plain: "",
1639
1643
  loading: T.value
@@ -1641,11 +1645,11 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
1641
1645
  default: p(() => [
1642
1646
  f(b, { class: "m-r-4" }, {
1643
1647
  default: p(() => [
1644
- f(h(zt))
1648
+ f(h(Yt))
1645
1649
  ]),
1646
1650
  _: 1
1647
1651
  }),
1648
- i[5] || (i[5] = q(" 上传图片 ", -1))
1652
+ s[5] || (s[5] = q(" 上传图片 ", -1))
1649
1653
  ]),
1650
1654
  _: 1
1651
1655
  }, 8, ["loading"])
@@ -1653,51 +1657,51 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
1653
1657
  _: 1
1654
1658
  }, 8, ["accept", "disabled"])) : P("", !0)
1655
1659
  ]),
1656
- _("div", to, [
1657
- O.value && M.value.length ? (c(), A("aside", no, [
1660
+ _("div", no, [
1661
+ O.value && M.value.length ? (d(), A("aside", oo, [
1658
1662
  _("div", {
1659
- class: ue(["yc-image-selector__category", { "is-active": C.value === "" }]),
1660
- onClick: i[2] || (i[2] = (I) => je(""))
1663
+ class: re(["yc-image-selector__category", { "is-active": C.value === "" }]),
1664
+ onClick: s[2] || (s[2] = (I) => je(""))
1661
1665
  }, B(e.categoryAllLabel), 3),
1662
- (c(!0), A(le, null, ve(M.value, (I) => (c(), A("div", {
1666
+ (d(!0), A(ae, null, ge(M.value, (I) => (d(), A("div", {
1663
1667
  key: I.id,
1664
- class: ue(["yc-image-selector__category", { "is-active": C.value === I.id }]),
1668
+ class: re(["yc-image-selector__category", { "is-active": C.value === I.id }]),
1665
1669
  onClick: (Ie) => je(I.id)
1666
1670
  }, [
1667
1671
  _("span", null, B(I.name), 1),
1668
- I.count != null ? (c(), A("span", ao, B(I.count), 1)) : P("", !0)
1669
- ], 10, oo))), 128))
1672
+ I.count != null ? (d(), A("span", lo, B(I.count), 1)) : P("", !0)
1673
+ ], 10, ao))), 128))
1670
1674
  ])) : P("", !0),
1671
- _e((c(), A("div", lo, [
1672
- !v.value && !W.value.length ? (c(), E(St, {
1675
+ ve((d(), A("div", io, [
1676
+ !v.value && !W.value.length ? (d(), E(kt, {
1673
1677
  key: 0,
1674
1678
  description: e.emptyText
1675
- }, null, 8, ["description"])) : (c(), A("div", io, [
1676
- (c(!0), A(le, null, ve(W.value, (I) => (c(), A("div", {
1679
+ }, null, 8, ["description"])) : (d(), A("div", so, [
1680
+ (d(!0), A(ae, null, ge(W.value, (I) => (d(), A("div", {
1677
1681
  key: String(I.id),
1678
- class: ue(["yc-image-selector__item", {
1679
- "is-selected": a(I),
1682
+ class: re(["yc-image-selector__item", {
1683
+ "is-selected": u(I),
1680
1684
  "is-single-mode": !$.value,
1681
1685
  "is-multi-mode": $.value
1682
1686
  }]),
1683
1687
  onClick: (Ie) => Ge(I)
1684
1688
  }, [
1685
- _("div", ro, [
1689
+ _("div", uo, [
1686
1690
  _("img", {
1687
- src: I.url,
1691
+ src: ye(I),
1688
1692
  alt: I.name || "image",
1689
1693
  loading: "lazy",
1690
- class: ue(K(I)),
1691
- onLoad: (Ie) => re(Ie, I)
1692
- }, null, 42, uo),
1694
+ class: re(se(I)),
1695
+ onLoad: (Ie) => fe(Ie, I)
1696
+ }, null, 42, co),
1693
1697
  _("div", {
1694
- class: ue(["yc-image-selector__indicator", {
1695
- "is-checked": a(I),
1698
+ class: re(["yc-image-selector__indicator", {
1699
+ "is-checked": u(I),
1696
1700
  "is-radio": !$.value,
1697
1701
  "is-checkbox": $.value
1698
1702
  }])
1699
1703
  }, [
1700
- a(I) && $.value ? (c(), A("span", co, B(j(I)), 1)) : a(I) ? (c(), E(b, { key: 1 }, {
1704
+ u(I) && $.value ? (d(), A("span", fo, B(j(I)), 1)) : u(I) ? (d(), E(b, { key: 1 }, {
1701
1705
  default: p(() => [
1702
1706
  f(h(lt))
1703
1707
  ]),
@@ -1708,43 +1712,43 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
1708
1712
  _("div", {
1709
1713
  class: "yc-image-selector__meta",
1710
1714
  title: I.name
1711
- }, B(I.name || "未命名"), 9, fo)
1712
- ], 10, so))), 128))
1715
+ }, B(I.name || "未命名"), 9, po)
1716
+ ], 10, ro))), 128))
1713
1717
  ]))
1714
1718
  ])), [
1715
- [bt, v.value]
1719
+ [At, v.value]
1716
1720
  ])
1717
1721
  ]),
1718
- $.value && F.value.length ? (c(), A("div", po, [
1719
- _("span", mo, "已选 " + B(F.value.length) + " 张", 1),
1720
- _("div", go, [
1721
- (c(!0), A(le, null, ve(F.value, (I) => (c(), A("div", {
1722
+ $.value && K.value.length ? (d(), A("div", mo, [
1723
+ _("span", go, "已选 " + B(K.value.length) + " 张", 1),
1724
+ _("div", vo, [
1725
+ (d(!0), A(ae, null, ge(K.value, (I) => (d(), A("div", {
1722
1726
  key: String(I.id),
1723
1727
  class: "yc-image-selector__selected-chip",
1724
- onClick: Pt((Ie) => Ge(I), ["stop"])
1728
+ onClick: Lt((Ie) => Ge(I), ["stop"])
1725
1729
  }, [
1726
1730
  _("img", {
1727
- src: I.url,
1731
+ src: ye(I),
1728
1732
  alt: I.name
1729
- }, null, 8, _o),
1730
- i[6] || (i[6] = _("span", { class: "yc-image-selector__selected-chip-remove" }, "×", -1))
1731
- ], 8, vo))), 128))
1733
+ }, null, 8, ho),
1734
+ s[6] || (s[6] = _("span", { class: "yc-image-selector__selected-chip-remove" }, "×", -1))
1735
+ ], 8, _o))), 128))
1732
1736
  ]),
1733
- f(me, {
1737
+ f(pe, {
1734
1738
  link: "",
1735
1739
  type: "primary",
1736
1740
  onClick: ke
1737
1741
  }, {
1738
- default: p(() => [...i[7] || (i[7] = [
1742
+ default: p(() => [...s[7] || (s[7] = [
1739
1743
  q("清空", -1)
1740
1744
  ])]),
1741
1745
  _: 1
1742
1746
  })
1743
1747
  ])) : P("", !0),
1744
- Y.value > 0 ? (c(), A("div", ho, [
1745
- f(kt, {
1746
- "current-page": U.value,
1747
- "onUpdate:currentPage": i[3] || (i[3] = (I) => U.value = I),
1748
+ Y.value > 0 ? (d(), A("div", yo, [
1749
+ f(xt, {
1750
+ "current-page": F.value,
1751
+ "onUpdate:currentPage": s[3] || (s[3] = (I) => F.value = I),
1748
1752
  background: "",
1749
1753
  layout: "total, prev, pager, next, jumper",
1750
1754
  "page-size": e.pageSize,
@@ -1758,7 +1762,7 @@ const Zn = { class: "yc-image-selector" }, eo = { class: "yc-image-selector__too
1758
1762
  }, 8, ["modelValue", "title", "width"]);
1759
1763
  };
1760
1764
  }
1761
- }), ko = /* @__PURE__ */ Se(So, [["__scopeId", "data-v-f75b2f69"]]);
1765
+ }), xo = /* @__PURE__ */ Se(ko, [["__scopeId", "data-v-4eb3e555"]]);
1762
1766
  function vt() {
1763
1767
  const e = k(!1), n = k({});
1764
1768
  function t(l = {}) {
@@ -1774,12 +1778,12 @@ function vt() {
1774
1778
  closeImageSelector: o
1775
1779
  };
1776
1780
  }
1777
- const xo = "__YC_IMAGE_SELECTOR_CTX_KEY__";
1778
- function bo(e) {
1781
+ const bo = "__YC_IMAGE_SELECTOR_CTX_KEY__";
1782
+ function Ao(e) {
1779
1783
  const n = globalThis;
1780
1784
  return n[e] || (n[e] = Symbol(e)), n[e];
1781
1785
  }
1782
- const _t = bo(xo), Oo = /* @__PURE__ */ ce({
1786
+ const _t = Ao(bo), Fo = /* @__PURE__ */ ue({
1783
1787
  __name: "YcImageSelectorProvider",
1784
1788
  props: {
1785
1789
  modelValue: { type: Boolean },
@@ -1801,6 +1805,7 @@ const _t = bo(xo), Oo = /* @__PURE__ */ ce({
1801
1805
  emptyText: { default: "暂无图片资源" },
1802
1806
  getImages: {},
1803
1807
  upload: {},
1808
+ urlField: { default: "url" },
1804
1809
  showDialog: { type: Boolean, default: !0 }
1805
1810
  },
1806
1811
  setup(e, { expose: n }) {
@@ -1827,24 +1832,25 @@ const _t = bo(xo), Oo = /* @__PURE__ */ ce({
1827
1832
  cancelText: t.cancelText,
1828
1833
  emptyText: t.emptyText,
1829
1834
  getImages: t.getImages,
1830
- upload: t.upload
1835
+ upload: t.upload,
1836
+ urlField: t.urlField
1831
1837
  }));
1832
1838
  function O(M) {
1833
1839
  var L, N;
1834
1840
  (N = (L = g.value).onConfirm) == null || N.call(L, M), S();
1835
1841
  }
1836
- function R() {
1842
+ function U() {
1837
1843
  var M, L;
1838
1844
  (L = (M = g.value).onCancel) == null || L.call(M), S();
1839
1845
  }
1840
- return n({ openImageSelector: w, closeImageSelector: S }), (M, L) => (c(), A(le, null, [
1841
- e.showDialog !== !1 ? (c(), E(ko, ot({
1846
+ return n({ openImageSelector: w, closeImageSelector: S }), (M, L) => (d(), A(ae, null, [
1847
+ e.showDialog !== !1 ? (d(), E(xo, ot({
1842
1848
  key: 0,
1843
1849
  modelValue: h(l),
1844
- "onUpdate:modelValue": L[0] || (L[0] = (N) => Lt(l) ? l.value = N : null)
1850
+ "onUpdate:modelValue": L[0] || (L[0] = (N) => Dt(l) ? l.value = N : null)
1845
1851
  }, r.value, {
1846
1852
  onConfirm: O,
1847
- onCancel: R
1853
+ onCancel: U
1848
1854
  }), null, 16, ["modelValue"])) : P("", !0),
1849
1855
  Ce(M.$slots, "default")
1850
1856
  ], 64));
@@ -1860,7 +1866,7 @@ function Uo() {
1860
1866
  const n = vt();
1861
1867
  return {
1862
1868
  openImageSelector: (t = {}) => {
1863
- Qn(t), n.openImageSelector(t);
1869
+ Zn(t), n.openImageSelector(t);
1864
1870
  },
1865
1871
  closeImageSelector: () => n.closeImageSelector()
1866
1872
  };
@@ -1880,7 +1886,7 @@ async function Ro(e) {
1880
1886
  throw new Error("加载图片资源失败");
1881
1887
  return o.data;
1882
1888
  }
1883
- async function Fo(e) {
1889
+ async function Ko(e) {
1884
1890
  const n = Ke().uploadImage;
1885
1891
  if (n) return n(e);
1886
1892
  const t = ht(), o = new FormData();
@@ -1895,37 +1901,37 @@ async function Fo(e) {
1895
1901
  return l.data;
1896
1902
  }
1897
1903
  export {
1898
- qn as AiTaskPanel,
1899
- Bo as AiTaskProvider,
1900
- Mn as AiUseDialog,
1904
+ Hn as AiTaskPanel,
1905
+ Vo as AiTaskProvider,
1906
+ En as AiUseDialog,
1901
1907
  _t as IMAGE_SELECTOR_INJECT_KEY,
1902
- ko as ImageSelectorDialog,
1903
- Oo as ImageSelectorProvider,
1908
+ xo as ImageSelectorDialog,
1909
+ Fo as ImageSelectorProvider,
1904
1910
  Qe as SkyPageWindow,
1905
- qn as YcAiTaskPanel,
1906
- Bo as YcAiTaskProvider,
1907
- Mn as YcAiUseDialog,
1908
- Lo as YcComponent,
1909
- ko as YcImageSelectorDialog,
1910
- Oo as YcImageSelectorProvider,
1911
+ Hn as YcAiTaskPanel,
1912
+ Vo as YcAiTaskProvider,
1913
+ En as YcAiUseDialog,
1914
+ Do as YcComponent,
1915
+ xo as YcImageSelectorDialog,
1916
+ Fo as YcImageSelectorProvider,
1911
1917
  Qe as YcPageWindow,
1912
1918
  vt as createImageSelectorApi,
1913
- Lo as default,
1919
+ Do as default,
1914
1920
  Ro as fetchImages,
1915
1921
  it as getAiTaskConfig,
1916
1922
  Ke as getImageSelectorConfig,
1917
1923
  rt as hideAiDialog,
1918
- Xn as hideImageSelectorDialog,
1919
- on as installYcComponent,
1920
- kn as listPrompts,
1921
- Do as openAiUseDialog,
1922
- Qn as openImageSelector,
1923
- jt as setAiTaskConfig,
1924
- Jt as setImageSelectorConfig,
1924
+ Qn as hideImageSelectorDialog,
1925
+ an as installYcComponent,
1926
+ xn as listPrompts,
1927
+ Bo as openAiUseDialog,
1928
+ Zn as openImageSelector,
1929
+ Gt as setAiTaskConfig,
1930
+ Xt as setImageSelectorConfig,
1925
1931
  Ne as showAiDialog,
1926
- Jn as showImageSelectorDialog,
1927
- Fo as uploadImage,
1928
- Vo as useAiTask,
1932
+ Xn as showImageSelectorDialog,
1933
+ Ko as uploadImage,
1934
+ Oo as useAiTask,
1929
1935
  gt as useAiTaskStore,
1930
1936
  Uo as useImageSelector
1931
1937
  };