yc-component 0.1.16 → 0.1.17

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,59 +1,59 @@
1
- var Yt = Object.defineProperty;
2
- var jt = (e, n, t) => n in e ? Yt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
- var tt = (e, n, t) => jt(e, typeof n != "symbol" ? n + "" : n, t);
4
- import ut from "axios";
5
- import { reactive as ct, defineComponent as de, computed as $, ref as b, watch as ne, onMounted as Ke, onUnmounted as Ne, resolveComponent as B, resolveDirective as dt, openBlock as u, createBlock as M, withCtx as g, createElementVNode as T, createElementBlock as A, createVNode as m, withKeys as Gt, unref as w, createCommentVNode as P, createTextVNode as G, normalizeClass as fe, toDisplayString as D, Fragment as re, renderList as he, withDirectives as _e, renderSlot as ye, normalizeProps as ft, mergeProps as ze, withModifiers as Wt, nextTick as nt, render as qt, onBeforeUnmount as Ht, Transition as pt, normalizeStyle as ot, vShow as De, inject as Ye, Teleport as Jt, provide as Be, isRef as Xt } from "vue";
6
- import { ElMessage as Q } from "element-plus";
7
- import { Search as Qt, Upload as Zt, Check as mt, ArrowLeft as en, ArrowUpBold as tn, ArrowDownBold as nn, Switch as on, Close as gt, Refresh as lt, ArrowDown as ln, CircleCheck as an, CircleClose as sn, Remove as rn } from "@element-plus/icons-vue";
8
- import { storeToRefs as un, defineStore as cn } from "pinia";
9
- const je = {
1
+ var Wt = Object.defineProperty;
2
+ var qt = (e, n, t) => n in e ? Wt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
+ var ot = (e, n, t) => qt(e, typeof n != "symbol" ? n + "" : n, t);
4
+ import dt from "axios";
5
+ import { reactive as ft, defineComponent as ue, computed as P, ref as k, watch as ne, onMounted as Ke, onUnmounted as Ye, resolveComponent as V, resolveDirective as pt, openBlock as u, createBlock as E, withCtx as g, createElementVNode as T, createElementBlock as A, createVNode as m, withKeys as Ht, unref as w, createCommentVNode as b, createTextVNode as W, normalizeClass as me, toDisplayString as B, Fragment as ce, renderList as ye, withDirectives as we, renderSlot as Te, normalizeProps as mt, mergeProps as ze, withModifiers as Jt, nextTick as lt, render as Xt, onBeforeUnmount as Qt, Transition as gt, normalizeStyle as at, vShow as Be, inject as je, Teleport as Zt, provide as Ve, isRef as en } from "vue";
6
+ import { ElMessage as ee } from "element-plus";
7
+ import { Search as tn, Upload as nn, Check as vt, ArrowLeft as on, ArrowUpBold as ln, ArrowDownBold as an, Switch as sn, Close as _t, Refresh as it, ArrowDown as rn, CircleCheck as un, CircleClose as cn, Remove as dn } from "@element-plus/icons-vue";
8
+ import { storeToRefs as fn, defineStore as pn } from "pinia";
9
+ const Ge = {
10
10
  projectId: "default-project",
11
11
  storageKey: "yc-ai-task-queue-v1"
12
12
  };
13
- let we = { ...je };
14
- function dn(e) {
15
- we = { ...we, ...e };
13
+ let Ie = { ...Ge };
14
+ function mn(e) {
15
+ Ie = { ...Ie, ...e };
16
16
  }
17
- function vt() {
18
- return we;
17
+ function ht() {
18
+ return Ie;
19
19
  }
20
- function fn() {
21
- return we.projectId ?? je.projectId;
20
+ function gn() {
21
+ return Ie.projectId ?? Ge.projectId;
22
22
  }
23
- function ht() {
24
- return we.storageKey ?? je.storageKey;
23
+ function yt() {
24
+ return Ie.storageKey ?? Ge.storageKey;
25
25
  }
26
- let ce = null;
27
- function pn() {
28
- ce = null;
26
+ let de = null;
27
+ function vn() {
28
+ de = null;
29
29
  }
30
- function pe() {
31
- if (ce) return ce;
32
- const { baseURL: e, getToken: n, onUnauthorized: t } = vt();
33
- return ce = ut.create({
30
+ function ge() {
31
+ if (de) return de;
32
+ const { baseURL: e, getToken: n, onUnauthorized: t } = ht();
33
+ return de = dt.create({
34
34
  baseURL: e ?? "",
35
35
  timeout: 6e4,
36
36
  headers: { "Content-Type": "application/json" }
37
- }), ce.interceptors.request.use((o) => {
38
- const s = n == null ? void 0 : n();
39
- return s && (o.headers.Authorization = `Bearer ${s}`), o;
40
- }), ce.interceptors.response.use(
37
+ }), de.interceptors.request.use((o) => {
38
+ const l = n == null ? void 0 : n();
39
+ return l && (o.headers.Authorization = `Bearer ${l}`), o;
40
+ }), de.interceptors.response.use(
41
41
  (o) => {
42
- const s = o.data;
43
- return (s == null ? void 0 : s.code) != null && s.code !== 200 ? Promise.reject(new Error(s.message || "请求失败")) : (o.data = (s == null ? void 0 : s.data) ?? s, o);
42
+ const l = o.data;
43
+ 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);
44
44
  },
45
45
  (o) => {
46
- var d, v, _;
47
- ((d = o.response) == null ? void 0 : d.status) === 401 && (t == null || t());
48
- const s = (_ = (v = o.response) == null ? void 0 : v.data) == null ? void 0 : _.message;
49
- return Promise.reject(new Error(s || o.message || "请求失败"));
46
+ var y, c, h;
47
+ ((y = o.response) == null ? void 0 : y.status) === 401 && (t == null || t());
48
+ const l = (h = (c = o.response) == null ? void 0 : c.data) == null ? void 0 : h.message;
49
+ return Promise.reject(new Error(l || o.message || "请求失败"));
50
50
  }
51
- ), ce;
51
+ ), de;
52
52
  }
53
- async function mn(e, n) {
54
- const o = (await pe().get(
53
+ async function _n(e, n) {
54
+ const o = (await ge().get(
55
55
  `/yc-ai/workflows/runs/${e}/artifacts/${n}`,
56
- { transformResponse: [(s) => s] }
56
+ { transformResponse: [(l) => l] }
57
57
  )).data;
58
58
  if (typeof o == "string")
59
59
  try {
@@ -63,19 +63,19 @@ async function mn(e, n) {
63
63
  }
64
64
  return o;
65
65
  }
66
- let Ve = {};
67
- function gn(e) {
68
- Ve = { ...Ve, ...e };
66
+ let Oe = {};
67
+ function hn(e) {
68
+ Oe = { ...Oe, ...e };
69
69
  }
70
70
  function Ae() {
71
- return Ve;
71
+ return Oe;
72
72
  }
73
73
  class be extends Error {
74
74
  constructor(n = "Image selector cancelled") {
75
75
  super(n), this.name = "ImageSelectorCancelledError";
76
76
  }
77
77
  }
78
- class at extends Error {
78
+ class st extends Error {
79
79
  constructor(t, o) {
80
80
  super(o || {
81
81
  missing_token: "请先填写并保存云盘 Access Token",
@@ -83,74 +83,74 @@ class at extends Error {
83
83
  valid_site: "请先在云盘配置有效站点",
84
84
  unknown: "云盘鉴权失败"
85
85
  }[t]);
86
- tt(this, "reason");
86
+ ot(this, "reason");
87
87
  this.name = "ImageSelectorAuthError", this.reason = t;
88
88
  }
89
89
  }
90
- let Z = null;
91
- function vn() {
92
- return Z && (Z.reject(new be()), Z = null), new Promise((e, n) => {
93
- Z = { resolve: e, reject: n };
90
+ let te = null;
91
+ function yn() {
92
+ return te && (te.reject(new be()), te = null), new Promise((e, n) => {
93
+ te = { resolve: e, reject: n };
94
94
  });
95
95
  }
96
- function hn(e) {
97
- Z == null || Z.resolve(e), Z = null;
96
+ function wn(e) {
97
+ te == null || te.resolve(e), te = null;
98
98
  }
99
- function it() {
100
- Z == null || Z.reject(new be()), Z = null;
99
+ function rt() {
100
+ te == null || te.reject(new be()), te = null;
101
101
  }
102
- const $e = "__YC_COMPONENT_IMAGE_SELECTOR__", Oe = "yc-component:image-selector-open";
103
- function _n() {
102
+ const Le = "__YC_COMPONENT_IMAGE_SELECTOR__", Fe = "yc-component:image-selector-open";
103
+ function Tn() {
104
104
  const e = globalThis;
105
- return e[$e] || (e[$e] = ct({
105
+ return e[Le] || (e[Le] = ft({
106
106
  visible: !1,
107
107
  options: {}
108
- })), e[$e];
108
+ })), e[Le];
109
109
  }
110
- const q = _n();
111
- function yn(e = {}) {
112
- q.options = { ...e }, q.visible = !0, globalThis.dispatchEvent(
113
- new CustomEvent(Oe, { detail: { ...e } })
110
+ const J = Tn();
111
+ function In(e = {}) {
112
+ J.options = { ...e }, J.visible = !0, globalThis.dispatchEvent(
113
+ new CustomEvent(Fe, { detail: { ...e } })
114
114
  );
115
115
  }
116
- function _t() {
117
- q.visible = !1;
116
+ function wt() {
117
+ J.visible = !1;
118
118
  }
119
- function yt() {
120
- _t();
119
+ function Tt() {
120
+ wt();
121
121
  }
122
- function wt(e = {}) {
123
- const n = vn();
124
- return yn(e), n;
122
+ function It(e = {}) {
123
+ const n = yn();
124
+ return In(e), n;
125
125
  }
126
- const wn = { class: "yc-image-selector" }, Tn = {
126
+ const Cn = { class: "yc-image-selector" }, Sn = {
127
127
  key: 0,
128
128
  class: "yc-image-selector__toolbar"
129
- }, In = { class: "yc-image-selector__body" }, Cn = {
129
+ }, xn = { class: "yc-image-selector__body" }, kn = {
130
130
  key: 0,
131
131
  class: "yc-image-selector__aside"
132
- }, Sn = ["onClick"], kn = {
132
+ }, En = ["onClick"], bn = {
133
133
  key: 0,
134
134
  class: "yc-image-selector__category-count"
135
- }, xn = { class: "yc-image-selector__main" }, bn = {
135
+ }, An = { class: "yc-image-selector__main" }, Mn = {
136
136
  key: 1,
137
137
  class: "yc-image-selector__grid"
138
- }, An = ["onClick"], En = { class: "yc-image-selector__thumb" }, Mn = ["src", "alt", "onLoad"], Pn = {
138
+ }, Pn = ["onClick"], $n = { class: "yc-image-selector__thumb" }, Ln = ["src", "alt", "onLoad"], Dn = {
139
139
  key: 0,
140
140
  class: "yc-image-selector__order"
141
- }, $n = ["title"], Ln = {
141
+ }, Bn = ["title"], Vn = {
142
142
  key: 1,
143
143
  class: "yc-image-selector__selected-bar"
144
- }, Dn = { class: "yc-image-selector__selected-bar-label" }, Bn = { class: "yc-image-selector__selected-bar-list" }, Vn = ["onClick"], On = ["src", "alt"], Un = {
144
+ }, On = { class: "yc-image-selector__selected-bar-label" }, Fn = { class: "yc-image-selector__selected-bar-list" }, Un = ["onClick"], Rn = ["src", "alt"], Nn = {
145
145
  key: 2,
146
146
  class: "yc-image-selector__pagination"
147
- }, Fn = {
147
+ }, Kn = {
148
148
  key: 0,
149
149
  class: "yc-image-selector__footer"
150
- }, Rn = { class: "yc-image-selector__selected-tip" }, Kn = { class: "yc-image-selector__footer-actions" }, Nn = {
150
+ }, Yn = { class: "yc-image-selector__footer-left" }, zn = { class: "yc-image-selector__selected-tip" }, jn = { class: "yc-image-selector__footer-actions" }, Gn = {
151
151
  key: 1,
152
152
  class: "yc-image-selector__footer yc-image-selector__footer--quick"
153
- }, zn = { class: "yc-image-selector__selected-tip" }, Yn = /* @__PURE__ */ de({
153
+ }, Wn = { class: "yc-image-selector__footer-left" }, qn = { class: "yc-image-selector__selected-tip" }, Hn = /* @__PURE__ */ ue({
154
154
  __name: "YcImageSelectorDialog",
155
155
  props: {
156
156
  modelValue: { type: [Boolean, null], default: null },
@@ -171,13 +171,14 @@ const wn = { class: "yc-image-selector" }, Tn = {
171
171
  cancelText: { default: "取消" },
172
172
  emptyText: { default: "暂无图片资源" },
173
173
  renderEmpty: {},
174
+ renderFooterExtra: {},
174
175
  getImages: {},
175
176
  upload: {},
176
177
  urlField: { default: "url" }
177
178
  },
178
179
  emits: ["update:modelValue", "confirm", "cancel"],
179
180
  setup(e, { emit: n }) {
180
- const t = de({
181
+ const t = ue({
181
182
  name: "YcImageSelectorRenderEmpty",
182
183
  props: {
183
184
  render: {
@@ -192,294 +193,333 @@ const wn = { class: "yc-image-selector" }, Tn = {
192
193
  setup(a) {
193
194
  return () => a.render(a.ctx);
194
195
  }
195
- }), o = e, s = n, d = $(() => o.modelValue != null), v = b(!1), _ = b(null);
196
+ }), o = ue({
197
+ name: "YcImageSelectorRenderFooterExtra",
198
+ props: {
199
+ render: {
200
+ type: Function,
201
+ required: !0
202
+ },
203
+ ctx: {
204
+ type: Object,
205
+ required: !0
206
+ }
207
+ },
208
+ setup(a) {
209
+ return () => a.render(a.ctx);
210
+ }
211
+ }), l = e, y = n, c = P(() => l.modelValue != null), h = k(!1), p = k(null);
196
212
  ne(
197
- () => o.modelValue,
213
+ () => l.modelValue,
198
214
  (a) => {
199
- d.value && (v.value = !!a);
215
+ c.value && (h.value = !!a);
200
216
  },
201
217
  { immediate: !0 }
202
- ), ne(v, (a) => {
203
- if (d.value) {
204
- s("update:modelValue", a);
218
+ ), ne(h, (a) => {
219
+ if (c.value) {
220
+ y("update:modelValue", a);
205
221
  return;
206
222
  }
207
- q.visible = a, a || _t();
223
+ J.visible = a, a || wt();
208
224
  }), ne(
209
- () => q.visible,
225
+ () => J.visible,
210
226
  (a) => {
211
- d.value || (v.value = a);
227
+ c.value || (h.value = a);
212
228
  },
213
229
  { immediate: !0 }
214
230
  );
215
- const y = $(
216
- () => (d.value ? void 0 : q.options.title) ?? o.title ?? "选择图片"
217
- ), r = $(
218
- () => (d.value ? void 0 : q.options.multiple) ?? o.multiple
219
- ), C = $(
220
- () => (d.value ? void 0 : q.options.maxCount) ?? o.maxCount
221
- ), V = $(
222
- () => (d.value ? void 0 : q.options.showModeSwitch) ?? o.showModeSwitch
223
- ), F = $(
224
- () => (d.value ? void 0 : q.options.showCategories) ?? o.showCategories
225
- ), X = $(() => {
226
- var a, l;
227
- if ((a = o.categories) != null && a.length) return o.categories;
228
- if (!d.value && ((l = q.options.categories) != null && l.length))
229
- return q.options.categories;
230
- }), O = $(() => F.value ? X.value ?? ee.value : []), f = $(
231
- () => (d.value ? void 0 : q.options.confirmOnSelect) ?? o.confirmOnSelect
232
- ), L = b("single"), H = [
231
+ const r = P(
232
+ () => (c.value ? void 0 : J.options.title) ?? l.title ?? "选择图片"
233
+ ), S = P(
234
+ () => (c.value ? void 0 : J.options.multiple) ?? l.multiple
235
+ ), D = P(
236
+ () => (c.value ? void 0 : J.options.maxCount) ?? l.maxCount
237
+ ), N = P(
238
+ () => (c.value ? void 0 : J.options.showModeSwitch) ?? l.showModeSwitch
239
+ ), q = P(
240
+ () => (c.value ? void 0 : J.options.showCategories) ?? l.showCategories
241
+ ), F = P(() => {
242
+ var a, i;
243
+ if ((a = l.categories) != null && a.length) return l.categories;
244
+ if (!c.value && ((i = J.options.categories) != null && i.length))
245
+ return J.options.categories;
246
+ }), v = P(() => q.value ? F.value ?? Q.value : []), L = P(
247
+ () => (c.value ? void 0 : J.options.confirmOnSelect) ?? l.confirmOnSelect
248
+ ), z = k("single"), $ = [
233
249
  { label: "单选", value: "single" },
234
250
  { label: "多选", value: "multiple" }
235
- ], S = $(
236
- () => V.value ? L.value === "multiple" : r.value
237
- ), U = b(""), N = b(""), h = b(1), k = b(0), Y = b(!1), j = b(!1), W = b([]), ee = b([]), E = b(/* @__PURE__ */ new Map()), oe = b(/* @__PURE__ */ new Map()), le = b(), te = b(), R = b(!1), z = $(() => [...E.value.values()]), Te = $(() => !!_.value || W.value.length === 0), Ie = $(() => ({
238
- authState: _.value,
239
- isEmpty: W.value.length === 0,
240
- reload: me
241
- })), Ce = $(() => {
242
- var l, x;
243
- const a = z.value.length;
244
- return f.value ? a ? `已选:${((l = z.value[0]) == null ? void 0 : l.name) || "1 张图片"}` : "单击图片即可完成选择" : a ? S.value ? `已选 ${a} / ${C.value} 张` : `已选:${((x = z.value[0]) == null ? void 0 : x.name) || "1 张图片"}` : S.value ? `多选模式:最多 ${C.value} 张` : "单选模式:请选择一张图片";
251
+ ], M = P(
252
+ () => N.value ? z.value === "multiple" : S.value
253
+ ), Y = k(""), _ = k(""), C = k(1), K = k(0), j = k(!1), X = k(!1), H = k([]), Q = k([]), O = k(/* @__PURE__ */ new Map()), Z = k(/* @__PURE__ */ new Map()), se = k(), U = k(), oe = k(!1), G = P(() => [...O.value.values()]), Ce = P(() => !!p.value || H.value.length === 0), Se = P(() => ({
254
+ authState: p.value,
255
+ isEmpty: H.value.length === 0,
256
+ reload: ve
257
+ }));
258
+ function s(a) {
259
+ p.value = {
260
+ reason: (a == null ? void 0 : a.reason) ?? "missing_token",
261
+ message: a == null ? void 0 : a.message
262
+ }, H.value = [], K.value = 0, Q.value = [], Y.value = "", _.value = "", C.value = 1;
263
+ }
264
+ const f = P(() => ({
265
+ isAuthenticated: !p.value,
266
+ enterAuthSetup: s
267
+ })), d = P(() => {
268
+ var i, x;
269
+ const a = G.value.length;
270
+ return L.value ? a ? `已选:${((i = G.value[0]) == null ? void 0 : i.name) || "1 张图片"}` : "单击图片即可完成选择" : a ? M.value ? `已选 ${a} / ${D.value} 张` : `已选:${((x = G.value[0]) == null ? void 0 : x.name) || "1 张图片"}` : M.value ? `多选模式:最多 ${D.value} 张` : "单选模式:请选择一张图片";
245
271
  });
246
- function i(a) {
247
- const l = z.value.findIndex((x) => J(x) === J(a));
248
- return l >= 0 ? l + 1 : "";
272
+ function R(a) {
273
+ const i = G.value.findIndex((x) => le(x) === le(a));
274
+ return i >= 0 ? i + 1 : "";
249
275
  }
250
- function p(a) {
251
- if (a === "single" && z.value.length > 1) {
252
- const l = z.value[0];
253
- E.value = /* @__PURE__ */ new Map([[J(l), l]]), Q.info("已切换为单选,仅保留第一张");
276
+ function fe(a) {
277
+ if (a === "single" && G.value.length > 1) {
278
+ const i = G.value[0];
279
+ O.value = /* @__PURE__ */ new Map([[le(i), i]]), ee.info("已切换为单选,仅保留第一张");
254
280
  }
255
281
  }
256
- function c() {
257
- L.value = r.value ? "multiple" : "single";
282
+ function pe() {
283
+ z.value = S.value ? "multiple" : "single";
258
284
  }
259
- function K() {
260
- E.value = /* @__PURE__ */ new Map();
285
+ function Dt() {
286
+ O.value = /* @__PURE__ */ new Map();
261
287
  }
262
- function ue(a) {
263
- return a[o.urlField];
288
+ function He(a) {
289
+ return a[l.urlField];
264
290
  }
265
- function J(a) {
291
+ function le(a) {
266
292
  return a.id ?? a.url;
267
293
  }
268
- function Se(a) {
269
- return E.value.has(J(a));
294
+ function xe(a) {
295
+ return O.value.has(le(a));
270
296
  }
271
- function qe(a, l) {
272
- return a < l ? "portrait" : a > l ? "landscape" : "square";
297
+ function Je(a, i) {
298
+ return a < i ? "portrait" : a > i ? "landscape" : "square";
273
299
  }
274
- function He(a, l) {
275
- const x = J(a);
276
- oe.value.get(x) !== l && (oe.value.set(x, l), oe.value = new Map(oe.value));
300
+ function Xe(a, i) {
301
+ const x = le(a);
302
+ Z.value.get(x) !== i && (Z.value.set(x, i), Z.value = new Map(Z.value));
277
303
  }
278
- function $t(a) {
279
- const l = oe.value.get(J(a));
280
- return l ? `yc-image-selector__img--${l}` : "";
304
+ function Bt(a) {
305
+ const i = Z.value.get(le(a));
306
+ return i ? `yc-image-selector__img--${i}` : "";
281
307
  }
282
- function Lt(a, l) {
308
+ function Vt(a, i) {
283
309
  const x = a.target;
284
- !(x != null && x.naturalWidth) || !(x != null && x.naturalHeight) || He(l, qe(x.naturalWidth, x.naturalHeight));
310
+ !(x != null && x.naturalWidth) || !(x != null && x.naturalHeight) || Xe(i, Je(x.naturalWidth, x.naturalHeight));
285
311
  }
286
- function Dt(a) {
287
- a.width && a.height && He(a, qe(a.width, a.height));
312
+ function Ot(a) {
313
+ a.width && a.height && Xe(a, Je(a.width, a.height));
288
314
  }
289
- function Je(a) {
290
- const l = /* @__PURE__ */ new Map();
315
+ function Qe(a) {
316
+ const i = /* @__PURE__ */ new Map();
291
317
  if (!(a != null && a.length)) {
292
- E.value = l;
318
+ O.value = i;
293
319
  return;
294
320
  }
295
321
  if (typeof a[0] == "string")
296
322
  for (const ie of a)
297
- l.set(ie, { id: ie, url: ie, name: ie.split("/").pop() });
323
+ i.set(ie, { id: ie, url: ie, name: ie.split("/").pop() });
298
324
  else
299
325
  for (const ie of a)
300
- l.set(J(ie), ie);
301
- E.value = l;
326
+ i.set(le(ie), ie);
327
+ O.value = i;
302
328
  }
303
- function Me(a) {
304
- le.value = a.onConfirm, te.value = a.onCancel, Je(a.selected ?? o.selected);
329
+ function Pe(a) {
330
+ se.value = a.onConfirm, U.value = a.onCancel, Qe(a.selected ?? l.selected);
305
331
  }
306
- function Xe(a) {
307
- if (d.value) return;
308
- const l = a.detail ?? {};
309
- Me(l), v.value = !0;
332
+ function Ze(a) {
333
+ if (c.value) return;
334
+ const i = a.detail ?? {};
335
+ Pe(i), h.value = !0;
310
336
  }
311
337
  Ke(() => {
312
- globalThis.addEventListener(Oe, Xe), d.value || (v.value = q.visible);
313
- }), Ne(() => {
314
- globalThis.removeEventListener(Oe, Xe);
338
+ globalThis.addEventListener(Fe, Ze), c.value || (h.value = J.visible);
339
+ }), Ye(() => {
340
+ globalThis.removeEventListener(Fe, Ze);
315
341
  });
316
- async function Pe() {
342
+ async function $e() {
317
343
  var a;
318
- if (!o.getImages) {
319
- Q.error("请通过 props.getImages 传入图片列表请求方法");
344
+ if (!l.getImages) {
345
+ ee.error("请通过 props.getImages 传入图片列表请求方法");
320
346
  return;
321
347
  }
322
- Y.value = !0, _.value = null;
348
+ j.value = !0, p.value = null;
323
349
  try {
324
- const l = await o.getImages({
325
- keyword: U.value.trim() || void 0,
326
- category: F.value && N.value || void 0,
327
- page: h.value,
328
- pageSize: o.pageSize
350
+ const i = await l.getImages({
351
+ keyword: Y.value.trim() || void 0,
352
+ category: q.value && _.value || void 0,
353
+ page: C.value,
354
+ pageSize: l.pageSize
329
355
  });
330
- W.value = l.list, k.value = l.total;
331
- for (const x of l.list)
332
- Dt(x);
333
- F.value && !X.value && ((a = l.categories) != null && a.length) && (ee.value = l.categories);
334
- } catch (l) {
335
- if (W.value = [], k.value = 0, l instanceof at || (l == null ? void 0 : l.name) === "ImageSelectorAuthError") {
336
- const x = l;
337
- _.value = {
356
+ H.value = i.list, K.value = i.total;
357
+ for (const x of i.list)
358
+ Ot(x);
359
+ q.value && !F.value && ((a = i.categories) != null && a.length) && (Q.value = i.categories);
360
+ } catch (i) {
361
+ if (H.value = [], K.value = 0, i instanceof st || (i == null ? void 0 : i.name) === "ImageSelectorAuthError") {
362
+ const x = i;
363
+ p.value = {
338
364
  reason: x.reason || "unknown",
339
365
  message: x.message
340
366
  };
341
367
  return;
342
368
  }
343
- Q.error(l instanceof Error ? l.message : "加载图片失败");
369
+ ee.error(i instanceof Error ? i.message : "加载图片失败");
344
370
  } finally {
345
- Y.value = !1;
371
+ j.value = !1;
346
372
  }
347
373
  }
348
- function me() {
349
- h.value = 1, Pe();
374
+ function ve() {
375
+ C.value = 1, $e();
350
376
  }
351
- function Qe(a) {
352
- N.value !== a && (N.value = a, me());
377
+ function et(a) {
378
+ _.value !== a && (_.value = a, ve());
353
379
  }
354
- function Ze(a) {
355
- const l = J(a);
356
- if (S.value) {
357
- if (E.value.has(l)) {
358
- E.value.delete(l), E.value = new Map(E.value);
380
+ function tt(a) {
381
+ const i = le(a);
382
+ if (M.value) {
383
+ if (O.value.has(i)) {
384
+ O.value.delete(i), O.value = new Map(O.value);
359
385
  return;
360
386
  }
361
- if (z.value.length >= C.value) {
362
- Q.warning(`最多选择 ${C.value} 张图片`);
387
+ if (G.value.length >= D.value) {
388
+ ee.warning(`最多选择 ${D.value} 张图片`);
363
389
  return;
364
390
  }
365
- E.value.set(l, a), E.value = new Map(E.value);
391
+ O.value.set(i, a), O.value = new Map(O.value);
366
392
  return;
367
393
  }
368
- if (E.value.has(l)) {
369
- if (f.value) {
370
- nt(() => ke());
394
+ if (O.value.has(i)) {
395
+ if (L.value) {
396
+ lt(() => ke());
371
397
  return;
372
398
  }
373
- E.value = /* @__PURE__ */ new Map();
399
+ O.value = /* @__PURE__ */ new Map();
374
400
  return;
375
401
  }
376
- E.value = /* @__PURE__ */ new Map([[l, a]]), f.value && nt(() => ke());
402
+ O.value = /* @__PURE__ */ new Map([[i, a]]), L.value && lt(() => ke());
377
403
  }
378
- async function Bt(a) {
379
- if (!o.upload) {
380
- Q.error("请通过 props.upload 传入图片上传方法");
404
+ async function Ft(a) {
405
+ if (!l.upload) {
406
+ ee.error("请通过 props.upload 传入图片上传方法");
381
407
  return;
382
408
  }
383
- j.value = !0;
409
+ X.value = !0;
384
410
  try {
385
- const { resource: l } = await o.upload(a.file);
386
- if (Q.success("上传成功"), _.value = null, S.value)
387
- z.value.length < C.value && (E.value.set(J(l), l), E.value = new Map(E.value));
388
- else if (E.value = /* @__PURE__ */ new Map([[J(l), l]]), f.value) {
411
+ const { resource: i } = await l.upload(a.file);
412
+ if (ee.success("上传成功"), p.value = null, M.value)
413
+ G.value.length < D.value && (O.value.set(le(i), i), O.value = new Map(O.value));
414
+ else if (O.value = /* @__PURE__ */ new Map([[le(i), i]]), L.value) {
389
415
  ke();
390
416
  return;
391
417
  }
392
- me();
393
- } catch (l) {
394
- if (l instanceof at || (l == null ? void 0 : l.name) === "ImageSelectorAuthError") {
395
- const x = l;
396
- _.value = {
418
+ ve();
419
+ } catch (i) {
420
+ if (i instanceof st || (i == null ? void 0 : i.name) === "ImageSelectorAuthError") {
421
+ const x = i;
422
+ p.value = {
397
423
  reason: x.reason || "unknown",
398
424
  message: x.message
399
- }, W.value = [], k.value = 0;
425
+ }, H.value = [], K.value = 0;
400
426
  return;
401
427
  }
402
- Q.error(l instanceof Error ? l.message : "上传失败");
428
+ ee.error(i instanceof Error ? i.message : "上传失败");
403
429
  } finally {
404
- j.value = !1;
430
+ X.value = !1;
405
431
  }
406
432
  }
407
- function Vt() {
408
- R.value = !1, U.value = "", N.value = "", h.value = 1, ee.value = [], oe.value = /* @__PURE__ */ new Map(), _.value = null, c(), d.value ? Me({}) : Me(q.options), c(), Pe();
433
+ function Ut() {
434
+ oe.value = !1, Y.value = "", _.value = "", C.value = 1, Q.value = [], Z.value = /* @__PURE__ */ new Map(), p.value = null, pe(), c.value ? Pe({}) : Pe(J.options), pe(), $e();
409
435
  }
410
- function Ot() {
411
- j.value = !1;
436
+ function Rt() {
437
+ X.value = !1;
412
438
  }
413
- function et() {
439
+ function nt() {
414
440
  var a;
415
- R.value || (R.value = !0, (a = te.value) == null || a.call(te), d.value || it(), s("cancel"), v.value = !1);
441
+ oe.value || (oe.value = !0, (a = U.value) == null || a.call(U), c.value || rt(), y("cancel"), h.value = !1);
416
442
  }
417
443
  function ke() {
418
- var l;
419
- if (!z.value.length) {
420
- Q.warning("请选择图片");
444
+ var i;
445
+ if (!G.value.length) {
446
+ ee.warning("请选择图片");
421
447
  return;
422
448
  }
423
- if (R.value) return;
424
- R.value = !0;
425
- const a = [...z.value];
426
- if (d.value) {
427
- s("confirm", a), v.value = !1;
449
+ if (oe.value) return;
450
+ oe.value = !0;
451
+ const a = [...G.value];
452
+ if (c.value) {
453
+ y("confirm", a), h.value = !1;
428
454
  return;
429
455
  }
430
- (l = le.value) == null || l.call(le, a), d.value || hn(a), s("confirm", a), v.value = !1;
456
+ (i = se.value) == null || i.call(se, a), c.value || wn(a), y("confirm", a), h.value = !1;
431
457
  }
432
- return ne(v, (a, l) => {
458
+ return ne(h, (a, i) => {
433
459
  var x;
434
- l && !a && !R.value && ((x = te.value) == null || x.call(te), d.value || it(), s("cancel"));
460
+ i && !a && !oe.value && ((x = U.value) == null || x.call(U), c.value || rt(), y("cancel"));
435
461
  }), ne(
436
- () => o.selected,
462
+ () => l.selected,
437
463
  (a) => {
438
- v.value || Je(a);
464
+ h.value || Qe(a);
439
465
  },
440
466
  { deep: !0 }
441
- ), (a, l) => {
442
- const x = B("el-icon"), ie = B("el-input"), Ut = B("el-segmented"), ge = B("el-button"), Ft = B("el-upload"), Rt = B("el-empty"), Kt = B("el-pagination"), Nt = B("el-dialog"), zt = dt("loading");
443
- return u(), M(Nt, {
444
- modelValue: v.value,
445
- "onUpdate:modelValue": l[4] || (l[4] = (I) => v.value = I),
446
- title: y.value,
467
+ ), (a, i) => {
468
+ const x = V("el-icon"), ie = V("el-input"), Nt = V("el-segmented"), _e = V("el-button"), Kt = V("el-upload"), Yt = V("el-empty"), zt = V("el-pagination"), jt = V("el-dialog"), Gt = pt("loading");
469
+ return u(), E(jt, {
470
+ modelValue: h.value,
471
+ "onUpdate:modelValue": i[4] || (i[4] = (I) => h.value = I),
472
+ title: r.value,
447
473
  width: e.width,
448
474
  "append-to-body": "",
449
475
  "destroy-on-close": "",
450
476
  class: "yc-image-selector-dialog",
451
- onClosed: Ot,
452
- onOpen: Vt
477
+ onClosed: Rt,
478
+ onOpen: Ut
453
479
  }, {
454
480
  footer: g(() => [
455
- f.value ? (u(), A("div", Nn, [
456
- T("span", zn, D(Ce.value), 1),
457
- m(ge, {
481
+ L.value ? (u(), A("div", Gn, [
482
+ T("div", Wn, [
483
+ T("span", qn, B(d.value), 1),
484
+ l.renderFooterExtra && !p.value ? (u(), E(w(o), {
485
+ key: 0,
486
+ render: l.renderFooterExtra,
487
+ ctx: f.value
488
+ }, null, 8, ["render", "ctx"])) : b("", !0)
489
+ ]),
490
+ m(_e, {
458
491
  link: "",
459
492
  type: "primary",
460
- onClick: et
493
+ onClick: nt
461
494
  }, {
462
495
  default: g(() => [
463
- G(D(e.cancelText), 1)
496
+ W(B(e.cancelText), 1)
464
497
  ]),
465
498
  _: 1
466
499
  })
467
- ])) : (u(), A("div", Fn, [
468
- T("span", Rn, D(Ce.value), 1),
469
- T("div", Kn, [
470
- m(ge, { onClick: et }, {
500
+ ])) : (u(), A("div", Kn, [
501
+ T("div", Yn, [
502
+ T("span", zn, B(d.value), 1),
503
+ l.renderFooterExtra && !p.value ? (u(), E(w(o), {
504
+ key: 0,
505
+ render: l.renderFooterExtra,
506
+ ctx: f.value
507
+ }, null, 8, ["render", "ctx"])) : b("", !0)
508
+ ]),
509
+ T("div", jn, [
510
+ m(_e, { onClick: nt }, {
471
511
  default: g(() => [
472
- G(D(e.cancelText), 1)
512
+ W(B(e.cancelText), 1)
473
513
  ]),
474
514
  _: 1
475
515
  }),
476
- m(ge, {
516
+ m(_e, {
477
517
  type: "primary",
478
- disabled: !z.value.length,
518
+ disabled: !G.value.length,
479
519
  onClick: ke
480
520
  }, {
481
521
  default: g(() => [
482
- G(D(e.confirmText), 1)
522
+ W(B(e.confirmText), 1)
483
523
  ]),
484
524
  _: 1
485
525
  }, 8, ["disabled"])
@@ -487,191 +527,191 @@ const wn = { class: "yc-image-selector" }, Tn = {
487
527
  ]))
488
528
  ]),
489
529
  default: g(() => [
490
- T("div", wn, [
491
- _.value ? P("", !0) : (u(), A("div", Tn, [
530
+ T("div", Cn, [
531
+ p.value ? b("", !0) : (u(), A("div", Sn, [
492
532
  m(ie, {
493
- modelValue: U.value,
494
- "onUpdate:modelValue": l[0] || (l[0] = (I) => U.value = I),
533
+ modelValue: Y.value,
534
+ "onUpdate:modelValue": i[0] || (i[0] = (I) => Y.value = I),
495
535
  clearable: "",
496
536
  placeholder: "搜索图片名称",
497
537
  class: "yc-image-selector__search",
498
- onKeyup: Gt(me, ["enter"]),
499
- onClear: me
538
+ onKeyup: Ht(ve, ["enter"]),
539
+ onClear: ve
500
540
  }, {
501
541
  prefix: g(() => [
502
542
  m(x, null, {
503
543
  default: g(() => [
504
- m(w(Qt))
544
+ m(w(tn))
505
545
  ]),
506
546
  _: 1
507
547
  })
508
548
  ]),
509
549
  _: 1
510
550
  }, 8, ["modelValue"]),
511
- V.value ? (u(), M(Ut, {
551
+ N.value ? (u(), E(Nt, {
512
552
  key: 0,
513
- modelValue: L.value,
514
- "onUpdate:modelValue": l[1] || (l[1] = (I) => L.value = I),
515
- options: H,
553
+ modelValue: z.value,
554
+ "onUpdate:modelValue": i[1] || (i[1] = (I) => z.value = I),
555
+ options: $,
516
556
  class: "yc-image-selector__mode",
517
- onChange: p
518
- }, null, 8, ["modelValue"])) : P("", !0),
519
- e.showUpload && e.upload ? (u(), M(Ft, {
557
+ onChange: fe
558
+ }, null, 8, ["modelValue"])) : b("", !0),
559
+ e.showUpload && e.upload ? (u(), E(Kt, {
520
560
  key: 1,
521
561
  "show-file-list": !1,
522
562
  accept: e.accept,
523
- "http-request": Bt,
524
- disabled: j.value
563
+ "http-request": Ft,
564
+ disabled: X.value
525
565
  }, {
526
566
  default: g(() => [
527
- m(ge, {
567
+ m(_e, {
528
568
  type: "primary",
529
569
  plain: "",
530
- loading: j.value
570
+ loading: X.value
531
571
  }, {
532
572
  default: g(() => [
533
573
  m(x, { class: "m-r-4" }, {
534
574
  default: g(() => [
535
- m(w(Zt))
575
+ m(w(nn))
536
576
  ]),
537
577
  _: 1
538
578
  }),
539
- l[5] || (l[5] = G(" 上传图片 ", -1))
579
+ i[5] || (i[5] = W(" 上传图片 ", -1))
540
580
  ]),
541
581
  _: 1
542
582
  }, 8, ["loading"])
543
583
  ]),
544
584
  _: 1
545
- }, 8, ["accept", "disabled"])) : P("", !0)
585
+ }, 8, ["accept", "disabled"])) : b("", !0)
546
586
  ])),
547
- T("div", In, [
548
- F.value && !_.value ? (u(), A("aside", Cn, [
587
+ T("div", xn, [
588
+ q.value && !p.value ? (u(), A("aside", kn, [
549
589
  T("div", {
550
- class: fe(["yc-image-selector__category", { "is-active": N.value === "" }]),
551
- onClick: l[2] || (l[2] = (I) => Qe(""))
552
- }, D(e.categoryAllLabel), 3),
553
- (u(!0), A(re, null, he(O.value, (I) => (u(), A("div", {
590
+ class: me(["yc-image-selector__category", { "is-active": _.value === "" }]),
591
+ onClick: i[2] || (i[2] = (I) => et(""))
592
+ }, B(e.categoryAllLabel), 3),
593
+ (u(!0), A(ce, null, ye(v.value, (I) => (u(), A("div", {
554
594
  key: I.id,
555
- class: fe(["yc-image-selector__category", { "is-active": N.value === I.id }]),
556
- onClick: (xe) => Qe(I.id)
595
+ class: me(["yc-image-selector__category", { "is-active": _.value === I.id }]),
596
+ onClick: (Ee) => et(I.id)
557
597
  }, [
558
- T("span", null, D(I.name), 1),
559
- I.count != null ? (u(), A("span", kn, D(I.count), 1)) : P("", !0)
560
- ], 10, Sn))), 128))
561
- ])) : P("", !0),
562
- _e((u(), A("div", xn, [
563
- !Y.value && Te.value ? ye(a.$slots, "empty", ft(ze({ key: 0 }, Ie.value)), () => {
598
+ T("span", null, B(I.name), 1),
599
+ I.count != null ? (u(), A("span", bn, B(I.count), 1)) : b("", !0)
600
+ ], 10, En))), 128))
601
+ ])) : b("", !0),
602
+ we((u(), A("div", An, [
603
+ !j.value && Ce.value ? Te(a.$slots, "empty", mt(ze({ key: 0 }, Se.value)), () => {
564
604
  var I;
565
605
  return [
566
- o.renderEmpty ? (u(), M(w(t), {
606
+ l.renderEmpty ? (u(), E(w(t), {
567
607
  key: 0,
568
- render: o.renderEmpty,
569
- ctx: Ie.value
570
- }, null, 8, ["render", "ctx"])) : (u(), M(Rt, {
608
+ render: l.renderEmpty,
609
+ ctx: Se.value
610
+ }, null, 8, ["render", "ctx"])) : (u(), E(Yt, {
571
611
  key: 1,
572
- description: ((I = _.value) == null ? void 0 : I.message) || e.emptyText
612
+ description: ((I = p.value) == null ? void 0 : I.message) || e.emptyText
573
613
  }, null, 8, ["description"]))
574
614
  ];
575
- }, !0) : Te.value ? P("", !0) : (u(), A("div", bn, [
576
- (u(!0), A(re, null, he(W.value, (I) => (u(), A("div", {
615
+ }, !0) : Ce.value ? b("", !0) : (u(), A("div", Mn, [
616
+ (u(!0), A(ce, null, ye(H.value, (I) => (u(), A("div", {
577
617
  key: String(I.id),
578
- class: fe(["yc-image-selector__item", {
579
- "is-selected": Se(I),
580
- "is-single-mode": !S.value,
581
- "is-multi-mode": S.value
618
+ class: me(["yc-image-selector__item", {
619
+ "is-selected": xe(I),
620
+ "is-single-mode": !M.value,
621
+ "is-multi-mode": M.value
582
622
  }]),
583
- onClick: (xe) => Ze(I)
623
+ onClick: (Ee) => tt(I)
584
624
  }, [
585
- T("div", En, [
625
+ T("div", $n, [
586
626
  T("img", {
587
- src: ue(I),
627
+ src: He(I),
588
628
  alt: I.name || "image",
589
629
  loading: "lazy",
590
- class: fe($t(I)),
591
- onLoad: (xe) => Lt(xe, I)
592
- }, null, 42, Mn),
630
+ class: me(Bt(I)),
631
+ onLoad: (Ee) => Vt(Ee, I)
632
+ }, null, 42, Ln),
593
633
  T("div", {
594
- class: fe(["yc-image-selector__indicator", {
595
- "is-checked": Se(I),
596
- "is-radio": !S.value,
597
- "is-checkbox": S.value
634
+ class: me(["yc-image-selector__indicator", {
635
+ "is-checked": xe(I),
636
+ "is-radio": !M.value,
637
+ "is-checkbox": M.value
598
638
  }])
599
639
  }, [
600
- Se(I) && S.value ? (u(), A("span", Pn, D(i(I)), 1)) : Se(I) ? (u(), M(x, { key: 1 }, {
640
+ xe(I) && M.value ? (u(), A("span", Dn, B(R(I)), 1)) : xe(I) ? (u(), E(x, { key: 1 }, {
601
641
  default: g(() => [
602
- m(w(mt))
642
+ m(w(vt))
603
643
  ]),
604
644
  _: 1
605
- })) : P("", !0)
645
+ })) : b("", !0)
606
646
  ], 2)
607
647
  ]),
608
648
  T("div", {
609
649
  class: "yc-image-selector__meta",
610
650
  title: I.name
611
- }, D(I.name || "未命名"), 9, $n)
612
- ], 10, An))), 128))
651
+ }, B(I.name || "未命名"), 9, Bn)
652
+ ], 10, Pn))), 128))
613
653
  ]))
614
654
  ])), [
615
- [zt, Y.value]
655
+ [Gt, j.value]
616
656
  ])
617
657
  ]),
618
- S.value && z.value.length ? (u(), A("div", Ln, [
619
- T("span", Dn, "已选 " + D(z.value.length) + " 张", 1),
620
- T("div", Bn, [
621
- (u(!0), A(re, null, he(z.value, (I) => (u(), A("div", {
658
+ M.value && G.value.length ? (u(), A("div", Vn, [
659
+ T("span", On, "已选 " + B(G.value.length) + " 张", 1),
660
+ T("div", Fn, [
661
+ (u(!0), A(ce, null, ye(G.value, (I) => (u(), A("div", {
622
662
  key: String(I.id),
623
663
  class: "yc-image-selector__selected-chip",
624
- onClick: Wt((xe) => Ze(I), ["stop"])
664
+ onClick: Jt((Ee) => tt(I), ["stop"])
625
665
  }, [
626
666
  T("img", {
627
- src: ue(I),
667
+ src: He(I),
628
668
  alt: I.name
629
- }, null, 8, On),
630
- l[6] || (l[6] = T("span", { class: "yc-image-selector__selected-chip-remove" }, "×", -1))
631
- ], 8, Vn))), 128))
669
+ }, null, 8, Rn),
670
+ i[6] || (i[6] = T("span", { class: "yc-image-selector__selected-chip-remove" }, "×", -1))
671
+ ], 8, Un))), 128))
632
672
  ]),
633
- m(ge, {
673
+ m(_e, {
634
674
  link: "",
635
675
  type: "primary",
636
- onClick: K
676
+ onClick: Dt
637
677
  }, {
638
- default: g(() => [...l[7] || (l[7] = [
639
- G("清空", -1)
678
+ default: g(() => [...i[7] || (i[7] = [
679
+ W("清空", -1)
640
680
  ])]),
641
681
  _: 1
642
682
  })
643
- ])) : P("", !0),
644
- k.value > 0 ? (u(), A("div", Un, [
645
- m(Kt, {
646
- "current-page": h.value,
647
- "onUpdate:currentPage": l[3] || (l[3] = (I) => h.value = I),
683
+ ])) : b("", !0),
684
+ K.value > 0 ? (u(), A("div", Nn, [
685
+ m(zt, {
686
+ "current-page": C.value,
687
+ "onUpdate:currentPage": i[3] || (i[3] = (I) => C.value = I),
648
688
  background: "",
649
689
  layout: "total, prev, pager, next, jumper",
650
690
  "page-size": e.pageSize,
651
- total: k.value,
652
- onCurrentChange: Pe
691
+ total: K.value,
692
+ onCurrentChange: $e
653
693
  }, null, 8, ["current-page", "page-size", "total"])
654
- ])) : P("", !0)
694
+ ])) : b("", !0)
655
695
  ])
656
696
  ]),
657
697
  _: 3
658
698
  }, 8, ["modelValue", "title", "width"]);
659
699
  };
660
700
  }
661
- }), Ee = (e, n) => {
701
+ }), Me = (e, n) => {
662
702
  const t = e.__vccOpts || e;
663
- for (const [o, s] of n)
664
- t[o] = s;
703
+ for (const [o, l] of n)
704
+ t[o] = l;
665
705
  return t;
666
- }, Tt = /* @__PURE__ */ Ee(Yn, [["__scopeId", "data-v-6d4e506a"]]);
667
- function It() {
706
+ }, Ct = /* @__PURE__ */ Me(Hn, [["__scopeId", "data-v-03096613"]]);
707
+ function St() {
668
708
  const { baseURL: e = "" } = Ae();
669
- return ut.create({ baseURL: e, timeout: 3e4 });
709
+ return dt.create({ baseURL: e, timeout: 3e4 });
670
710
  }
671
- async function jn(e) {
711
+ async function Jn(e) {
672
712
  const n = Ae().fetchImages;
673
713
  if (n) return n(e);
674
- const t = It(), { data: o } = await t.get(
714
+ const t = St(), { data: o } = await t.get(
675
715
  "/yc-media/images",
676
716
  { params: e }
677
717
  );
@@ -679,44 +719,44 @@ async function jn(e) {
679
719
  throw new Error("加载图片资源失败");
680
720
  return o.data;
681
721
  }
682
- async function Gn(e) {
722
+ async function Xn(e) {
683
723
  const n = Ae().uploadImage;
684
724
  if (n) return n(e);
685
- const t = It(), o = new FormData();
725
+ const t = St(), o = new FormData();
686
726
  o.append("file", e);
687
- const { data: s } = await t.post(
727
+ const { data: l } = await t.post(
688
728
  "/yc-media/images/upload",
689
729
  o,
690
730
  { headers: { "Content-Type": "multipart/form-data" } }
691
731
  );
692
- if (s.code !== 200)
732
+ if (l.code !== 200)
693
733
  throw new Error("上传图片失败");
694
- return s.data;
734
+ return l.data;
695
735
  }
696
- const st = "__YC_IMAGE_SELECTOR_MOUNT__";
697
- function Wn(e) {
736
+ const ut = "__YC_IMAGE_SELECTOR_MOUNT__";
737
+ function Qn(e) {
698
738
  const n = globalThis;
699
- if (n[st] || typeof document > "u") return;
739
+ if (n[ut] || typeof document > "u") return;
700
740
  const t = document.createElement("div");
701
741
  t.setAttribute("data-yc-image-selector-host", ""), document.body.appendChild(t);
702
- const o = Ae().dialog ?? {}, s = m(Tt, {
703
- getImages: jn,
704
- upload: Gn,
742
+ const o = Ae().dialog ?? {}, l = m(Ct, {
743
+ getImages: Jn,
744
+ upload: Xn,
705
745
  showUpload: o.showUpload ?? !0,
706
746
  ...o
707
747
  });
708
- s.appContext = e._context, qt(s, t), n[st] = !0;
748
+ l.appContext = e._context, Xt(l, t), n[ut] = !0;
709
749
  }
710
- function qn(e) {
711
- e.config.globalProperties.openImageSelector = wt, e.config.globalProperties.closeImageSelector = yt;
750
+ function Zn(e) {
751
+ e.config.globalProperties.openImageSelector = It, e.config.globalProperties.closeImageSelector = Tt;
712
752
  }
713
- function Hn(e) {
714
- Wn(e), qn(e);
753
+ function eo(e) {
754
+ Qn(e), Zn(e);
715
755
  }
716
- const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__title" }, Qn = {
756
+ const to = { class: "yc-page-window__header" }, no = { class: "yc-page-window__title" }, oo = {
717
757
  key: 0,
718
758
  class: "yc-page-window__nav"
719
- }, Zn = { class: "yc-page-window__opera" }, eo = { class: "yc-page-window__content" }, to = /* @__PURE__ */ de({
759
+ }, lo = { class: "yc-page-window__opera" }, ao = { class: "yc-page-window__content" }, io = /* @__PURE__ */ ue({
720
760
  __name: "YcPageWindow",
721
761
  props: {
722
762
  visible: { type: Boolean },
@@ -736,90 +776,90 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
736
776
  },
737
777
  emits: ["update:visible", "update:type", "confirm", "close", "opened", "changeType", "prev", "next", "checkRow"],
738
778
  setup(e, { expose: n, emit: t }) {
739
- const o = e, s = t, d = b(!1), v = $(() => o.loading || d.value), _ = $(() => o.type === "detail" ? "详情" : o.type === "edit" ? "编辑" : o.type === "add" ? "新增" : ""), y = $(
779
+ const o = e, l = t, y = k(!1), c = P(() => o.loading || y.value), h = P(() => o.type === "detail" ? "详情" : o.type === "edit" ? "编辑" : o.type === "add" ? "新增" : ""), p = P(
740
780
  () => o.list.length > 0 && o.row != null
741
- ), r = $(
781
+ ), r = P(
742
782
  () => ["detail", "edit"].includes(o.type)
743
- ), C = $(() => o.type !== "detail");
744
- function V() {
783
+ ), S = P(() => o.type !== "detail");
784
+ function D() {
745
785
  if (!o.row) return -1;
746
- const S = o.rowKey, U = o.row[S];
747
- return o.list.findIndex((N) => N[S] === U);
786
+ const $ = o.rowKey, M = o.row[$];
787
+ return o.list.findIndex((Y) => Y[$] === M);
748
788
  }
749
- function F(S) {
750
- const U = V();
751
- return U < 0 ? !0 : S === "prev" ? U <= 0 : U >= o.list.length - 1;
789
+ function N($) {
790
+ const M = D();
791
+ return M < 0 ? !0 : $ === "prev" ? M <= 0 : M >= o.list.length - 1;
752
792
  }
753
- function X() {
754
- const S = V();
755
- if (S <= 0) return;
756
- const U = o.list[S - 1];
757
- s("checkRow", U), s("prev", U);
793
+ function q() {
794
+ const $ = D();
795
+ if ($ <= 0) return;
796
+ const M = o.list[$ - 1];
797
+ l("checkRow", M), l("prev", M);
758
798
  }
759
- function O() {
760
- const S = V();
761
- if (S < 0 || S >= o.list.length - 1) return;
762
- const U = o.list[S + 1];
763
- s("checkRow", U), s("next", U);
799
+ function F() {
800
+ const $ = D();
801
+ if ($ < 0 || $ >= o.list.length - 1) return;
802
+ const M = o.list[$ + 1];
803
+ l("checkRow", M), l("next", M);
764
804
  }
765
- function f() {
766
- const S = o.type === "detail" ? "edit" : "detail";
767
- s("update:type", S), s("changeType");
805
+ function v() {
806
+ const $ = o.type === "detail" ? "edit" : "detail";
807
+ l("update:type", $), l("changeType");
768
808
  }
769
809
  function L() {
770
- s("update:visible", !1), s("close");
810
+ l("update:visible", !1), l("close");
771
811
  }
772
- function H() {
773
- d.value = !0, s("confirm", (S) => {
774
- d.value = !1, S && L();
812
+ function z() {
813
+ y.value = !0, l("confirm", ($) => {
814
+ y.value = !1, $ && L();
775
815
  });
776
816
  }
777
817
  return ne(
778
818
  () => o.visible,
779
- (S) => {
780
- S && s("opened");
819
+ ($) => {
820
+ $ && l("opened");
781
821
  }
782
- ), Ht(() => {
822
+ ), Qt(() => {
783
823
  o.visible && L();
784
- }), n({ closeWindow: L }), (S, U) => {
785
- const N = B("el-icon"), h = B("el-button"), k = B("el-tooltip"), Y = B("el-scrollbar"), j = dt("loading");
786
- return u(), M(pt, {
824
+ }), n({ closeWindow: L }), ($, M) => {
825
+ const Y = V("el-icon"), _ = V("el-button"), C = V("el-tooltip"), K = V("el-scrollbar"), j = pt("loading");
826
+ return u(), E(gt, {
787
827
  name: "yc-page-window-fade",
788
828
  mode: "out-in"
789
829
  }, {
790
830
  default: g(() => [
791
- _e(T("div", {
831
+ we(T("div", {
792
832
  class: "yc-page-window",
793
- style: ot({ zIndex: e.zIndex })
833
+ style: at({ zIndex: e.zIndex })
794
834
  }, [
795
- T("div", Jn, [
796
- T("div", Xn, [
797
- m(N, {
835
+ T("div", to, [
836
+ T("div", no, [
837
+ m(Y, {
798
838
  class: "yc-page-window__back",
799
839
  onClick: L
800
840
  }, {
801
841
  default: g(() => [
802
- m(w(en))
842
+ m(w(on))
803
843
  ]),
804
844
  _: 1
805
845
  }),
806
- T("span", null, D(e.title) + D(_.value), 1),
807
- y.value ? (u(), A("div", Qn, [
808
- m(k, {
846
+ T("span", null, B(e.title) + B(h.value), 1),
847
+ p.value ? (u(), A("div", oo, [
848
+ m(C, {
809
849
  content: "上一条",
810
850
  placement: "top"
811
851
  }, {
812
852
  default: g(() => [
813
- m(h, {
853
+ m(_, {
814
854
  round: "",
815
855
  text: "",
816
- disabled: F("prev"),
817
- onClick: X
856
+ disabled: N("prev"),
857
+ onClick: q
818
858
  }, {
819
859
  default: g(() => [
820
- m(N, null, {
860
+ m(Y, null, {
821
861
  default: g(() => [
822
- m(w(tn))
862
+ m(w(ln))
823
863
  ]),
824
864
  _: 1
825
865
  })
@@ -829,21 +869,21 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
829
869
  ]),
830
870
  _: 1
831
871
  }),
832
- m(k, {
872
+ m(C, {
833
873
  content: "下一条",
834
874
  placement: "top"
835
875
  }, {
836
876
  default: g(() => [
837
- m(h, {
877
+ m(_, {
838
878
  round: "",
839
879
  text: "",
840
- disabled: F("next"),
841
- onClick: O
880
+ disabled: N("next"),
881
+ onClick: F
842
882
  }, {
843
883
  default: g(() => [
844
- m(N, null, {
884
+ m(Y, null, {
845
885
  default: g(() => [
846
- m(w(nn))
886
+ m(w(an))
847
887
  ]),
848
888
  _: 1
849
889
  })
@@ -853,146 +893,146 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
853
893
  ]),
854
894
  _: 1
855
895
  })
856
- ])) : P("", !0),
857
- r.value ? (u(), M(h, {
896
+ ])) : b("", !0),
897
+ r.value ? (u(), E(_, {
858
898
  key: 1,
859
899
  text: "",
860
900
  class: "yc-page-window__type-switch",
861
901
  type: e.type === "detail" ? "primary" : "success",
862
- onClick: f
902
+ onClick: v
863
903
  }, {
864
904
  default: g(() => [
865
- m(N, { class: "m-r-4" }, {
905
+ m(Y, { class: "m-r-4" }, {
866
906
  default: g(() => [
867
- m(w(on))
907
+ m(w(sn))
868
908
  ]),
869
909
  _: 1
870
910
  }),
871
- G(" " + D(e.type === "detail" ? "切换编辑" : "切换详情"), 1)
911
+ W(" " + B(e.type === "detail" ? "切换编辑" : "切换详情"), 1)
872
912
  ]),
873
913
  _: 1
874
- }, 8, ["type"])) : P("", !0)
914
+ }, 8, ["type"])) : b("", !0)
875
915
  ]),
876
- T("div", Zn, [
877
- ye(S.$slots, "opera", {}, void 0, !0),
878
- e.showButtons && C.value ? (u(), A(re, { key: 0 }, [
879
- m(h, {
916
+ T("div", lo, [
917
+ Te($.$slots, "opera", {}, void 0, !0),
918
+ e.showButtons && S.value ? (u(), A(ce, { key: 0 }, [
919
+ m(_, {
880
920
  text: "",
881
- disabled: v.value,
921
+ disabled: c.value,
882
922
  onClick: L
883
923
  }, {
884
924
  default: g(() => [
885
- m(N, { class: "m-r-4" }, {
925
+ m(Y, { class: "m-r-4" }, {
886
926
  default: g(() => [
887
- m(w(gt))
927
+ m(w(_t))
888
928
  ]),
889
929
  _: 1
890
930
  }),
891
- G(" " + D(e.cancelText), 1)
931
+ W(" " + B(e.cancelText), 1)
892
932
  ]),
893
933
  _: 1
894
934
  }, 8, ["disabled"]),
895
- e.showConfirm ? (u(), M(h, {
935
+ e.showConfirm ? (u(), E(_, {
896
936
  key: 0,
897
937
  type: "primary",
898
- loading: v.value,
938
+ loading: c.value,
899
939
  disabled: e.disabled,
900
- onClick: H
940
+ onClick: z
901
941
  }, {
902
942
  default: g(() => [
903
- m(N, { class: "m-r-4" }, {
943
+ m(Y, { class: "m-r-4" }, {
904
944
  default: g(() => [
905
- m(w(mt))
945
+ m(w(vt))
906
946
  ]),
907
947
  _: 1
908
948
  }),
909
- G(" " + D(e.confirmText), 1)
949
+ W(" " + B(e.confirmText), 1)
910
950
  ]),
911
951
  _: 1
912
- }, 8, ["loading", "disabled"])) : P("", !0)
913
- ], 64)) : P("", !0)
952
+ }, 8, ["loading", "disabled"])) : b("", !0)
953
+ ], 64)) : b("", !0)
914
954
  ])
915
955
  ]),
916
- _e((u(), A("div", eo, [
917
- m(Y, { class: "yc-page-window__scroll" }, {
956
+ we((u(), A("div", ao, [
957
+ m(K, { class: "yc-page-window__scroll" }, {
918
958
  default: g(() => [
919
959
  e.visible ? (u(), A("div", {
920
960
  key: 0,
921
961
  class: "yc-page-window__body",
922
- style: ot({ minHeight: e.contentMinHeight })
962
+ style: at({ minHeight: e.contentMinHeight })
923
963
  }, [
924
- ye(S.$slots, "default", {}, void 0, !0)
925
- ], 4)) : P("", !0)
964
+ Te($.$slots, "default", {}, void 0, !0)
965
+ ], 4)) : b("", !0)
926
966
  ]),
927
967
  _: 3
928
968
  })
929
969
  ])), [
930
- [j, v.value]
970
+ [j, c.value]
931
971
  ])
932
972
  ], 4), [
933
- [De, e.visible]
973
+ [Be, e.visible]
934
974
  ])
935
975
  ]),
936
976
  _: 3
937
977
  });
938
978
  };
939
979
  }
940
- }), rt = /* @__PURE__ */ Ee(to, [["__scopeId", "data-v-b3e784c3"]]);
941
- function no(e) {
942
- e != null && e.aiTask && (dn(e.aiTask), pn()), e != null && e.imageSelector && gn(e.imageSelector);
980
+ }), ct = /* @__PURE__ */ Me(io, [["__scopeId", "data-v-b3e784c3"]]);
981
+ function so(e) {
982
+ e != null && e.aiTask && (mn(e.aiTask), vn()), e != null && e.imageSelector && hn(e.imageSelector);
943
983
  }
944
- function oo(e, n) {
945
- (n == null ? void 0 : n.registerPageWindow) !== !1 && (e.component("YcPageWindow", rt), e.component("SkyPageWindow", rt));
984
+ function ro(e, n) {
985
+ (n == null ? void 0 : n.registerPageWindow) !== !1 && (e.component("YcPageWindow", ct), e.component("SkyPageWindow", ct));
946
986
  }
947
- function lo(e, n) {
948
- (n == null ? void 0 : n.registerImageSelector) !== !1 && Hn(e);
987
+ function uo(e, n) {
988
+ (n == null ? void 0 : n.registerImageSelector) !== !1 && eo(e);
949
989
  }
950
- const ll = {
990
+ const ul = {
951
991
  install(e, n) {
952
- no(n), oo(e, n), lo(e, n);
992
+ so(n), ro(e, n), uo(e, n);
953
993
  }
954
- }, Le = "__YC_COMPONENT_AI_DIALOG__", Ue = "yc-component:ai-dialog-open";
955
- function ao() {
994
+ }, De = "__YC_COMPONENT_AI_DIALOG__", Ue = "yc-component:ai-dialog-open";
995
+ function co() {
956
996
  const e = globalThis;
957
- return e[Le] || (e[Le] = ct({
997
+ return e[De] || (e[De] = ft({
958
998
  visible: !1,
959
999
  options: {}
960
- })), e[Le];
1000
+ })), e[De];
961
1001
  }
962
- const ae = ao();
963
- function Ge(e = {}) {
1002
+ const ae = co();
1003
+ function We(e = {}) {
964
1004
  ae.options = { ...e }, ae.visible = !0, globalThis.dispatchEvent(
965
1005
  new CustomEvent(Ue, { detail: { ...e } })
966
1006
  );
967
1007
  }
968
- function Ct() {
1008
+ function xt() {
969
1009
  ae.visible = !1;
970
1010
  }
971
- function al(e = {}) {
972
- Ge(e);
1011
+ function cl(e = {}) {
1012
+ We(e);
973
1013
  }
974
- function St(e) {
1014
+ function kt(e) {
975
1015
  const {
976
1016
  tasks: n,
977
1017
  panelVisible: t,
978
1018
  panelMinimized: o,
979
- dialogVisible: s,
980
- runningCount: d,
981
- activeCount: v,
982
- panelTitle: _,
983
- panelSubtitle: y
984
- } = un(e);
1019
+ dialogVisible: l,
1020
+ runningCount: y,
1021
+ activeCount: c,
1022
+ panelTitle: h,
1023
+ panelSubtitle: p
1024
+ } = fn(e);
985
1025
  return {
986
1026
  tasks: n,
987
1027
  panelVisible: t,
988
1028
  panelMinimized: o,
989
- dialogVisible: s,
990
- runningCount: d,
991
- activeCount: v,
992
- panelTitle: _,
993
- panelSubtitle: y,
1029
+ dialogVisible: l,
1030
+ runningCount: y,
1031
+ activeCount: c,
1032
+ panelTitle: h,
1033
+ panelSubtitle: p,
994
1034
  openUseDialog: (r) => {
995
- Ge(r ?? {}), e.openDialog(r ?? {});
1035
+ We(r ?? {}), e.openDialog(r ?? {});
996
1036
  },
997
1037
  closeUseDialog: () => e.closeDialog(),
998
1038
  openTaskPanel: () => e.showPanel(),
@@ -1008,19 +1048,19 @@ function St(e) {
1008
1048
  onTaskFinish: (r) => e.onTaskFinish(r)
1009
1049
  };
1010
1050
  }
1011
- const io = "__YC_AI_TASK_CTX_KEY__", so = "__YC_AI_TASK_STORE_KEY__";
1012
- function kt(e) {
1051
+ const fo = "__YC_AI_TASK_CTX_KEY__", po = "__YC_AI_TASK_STORE_KEY__";
1052
+ function Et(e) {
1013
1053
  const n = globalThis;
1014
1054
  return n[e] || (n[e] = Symbol(e)), n[e];
1015
1055
  }
1016
- const xt = kt(io), bt = kt(so), ro = async (e) => (await pe().post(
1056
+ const bt = Et(fo), At = Et(po), mo = async (e) => (await ge().post(
1017
1057
  "/yc-ai/workflows/runs",
1018
1058
  e
1019
- )).data, At = async (e) => (await pe().get(`/yc-ai/workflows/runs/${e}`)).data, uo = (e) => pe().post(`/yc-ai/workflows/runs/${e}/cancel`), co = (e, n) => pe().post(`/yc-ai/workflows/runs/${e}/client-continue`, n);
1020
- async function Fe(e, n) {
1021
- return mn(e, n);
1059
+ )).data, Mt = async (e) => (await ge().get(`/yc-ai/workflows/runs/${e}`)).data, go = (e) => ge().post(`/yc-ai/workflows/runs/${e}/cancel`), vo = (e, n) => ge().post(`/yc-ai/workflows/runs/${e}/client-continue`, n);
1060
+ async function Re(e, n) {
1061
+ return _n(e, n);
1022
1062
  }
1023
- function fo(e, n) {
1063
+ function _o(e, n) {
1024
1064
  const t = e.trim();
1025
1065
  if (!t)
1026
1066
  return n;
@@ -1034,79 +1074,79 @@ function fo(e, n) {
1034
1074
  throw new Error('请定义 function handler(result) { ... }');
1035
1075
  `
1036
1076
  ) : o = new Function("result", `return (${t})(result);`);
1037
- } catch (s) {
1038
- throw new Error(`自定义脚本语法错误: ${s instanceof Error ? s.message : String(s)}`);
1077
+ } catch (l) {
1078
+ throw new Error(`自定义脚本语法错误: ${l instanceof Error ? l.message : String(l)}`);
1039
1079
  }
1040
1080
  try {
1041
1081
  return o(n);
1042
- } catch (s) {
1043
- throw new Error(`自定义脚本执行失败: ${s instanceof Error ? s.message : String(s)}`);
1082
+ } catch (l) {
1083
+ throw new Error(`自定义脚本执行失败: ${l instanceof Error ? l.message : String(l)}`);
1044
1084
  }
1045
1085
  }
1046
- async function po(e) {
1047
- return (await ro({
1048
- projectId: fn(),
1086
+ async function ho(e) {
1087
+ return (await mo({
1088
+ projectId: gn(),
1049
1089
  freeText: e.freeText,
1050
1090
  promptId: e.promptId,
1051
1091
  autoMatch: e.autoMatch
1052
1092
  })).runId;
1053
1093
  }
1054
- async function mo(e, n) {
1055
- var o, s, d, v;
1056
- const t = await At(e);
1094
+ async function yo(e, n) {
1095
+ var o, l, y, c;
1096
+ const t = await Mt(e);
1057
1097
  if (t.status === "WAITING_CLIENT" && t.waitingStepKey && t.waitingClientScript) {
1058
1098
  (o = n == null ? void 0 : n.onProgress) == null || o.call(n, 60, `执行脚本:${t.waitingStepKey}`);
1059
- let _ = {};
1060
- t.waitingArtifactId && (_ = await Fe(e, t.waitingArtifactId));
1061
- const y = fo(t.waitingClientScript, _);
1062
- return await co(e, {
1099
+ let h = {};
1100
+ t.waitingArtifactId && (h = await Re(e, t.waitingArtifactId));
1101
+ const p = _o(t.waitingClientScript, h);
1102
+ return await vo(e, {
1063
1103
  stepKey: t.waitingStepKey,
1064
- output: y ?? {}
1104
+ output: p ?? {}
1065
1105
  }), null;
1066
1106
  }
1067
1107
  if (t.status === "SUCCEEDED") {
1068
1108
  if (t.finalArtifactId) {
1069
- (s = n == null ? void 0 : n.onProgress) == null || s.call(n, 95, "加载结果…");
1070
- const _ = await Fe(e, t.finalArtifactId);
1071
- return (d = n == null ? void 0 : n.onProgress) == null || d.call(n, 100, "已完成"), { phase: "SUCCEEDED", runId: e, result: _ };
1109
+ (l = n == null ? void 0 : n.onProgress) == null || l.call(n, 95, "加载结果…");
1110
+ const h = await Re(e, t.finalArtifactId);
1111
+ return (y = n == null ? void 0 : n.onProgress) == null || y.call(n, 100, "已完成"), { phase: "SUCCEEDED", runId: e, result: h };
1072
1112
  }
1073
1113
  return { phase: "SUCCEEDED", runId: e, result: {} };
1074
1114
  }
1075
- return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((v = n == null ? void 0 : n.onProgress) == null || v.call(n, ho(t), _o(t)), null);
1115
+ return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((c = n == null ? void 0 : n.onProgress) == null || c.call(n, Io(t), Co(t)), null);
1076
1116
  }
1077
- async function go(e) {
1078
- const n = await At(e);
1079
- return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await Fe(e, n.finalArtifactId);
1117
+ async function wo(e) {
1118
+ const n = await Mt(e);
1119
+ return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await Re(e, n.finalArtifactId);
1080
1120
  }
1081
- async function vo(e) {
1082
- await uo(e);
1121
+ async function To(e) {
1122
+ await go(e);
1083
1123
  }
1084
- function ho(e) {
1124
+ function Io(e) {
1085
1125
  if (e.status === "PENDING") return 8;
1086
1126
  const n = e.steps ?? [];
1087
1127
  if (!n.length) return 35;
1088
1128
  const t = n.filter((o) => o.status === "SUCCEEDED" || o.status === "SKIPPED").length;
1089
1129
  return Math.min(90, Math.round(20 + t / n.length * 70));
1090
1130
  }
1091
- function _o(e) {
1131
+ function Co(e) {
1092
1132
  var t;
1093
1133
  if (e.status === "PENDING") return "排队中…";
1094
1134
  const n = (t = e.steps) == null ? void 0 : t.find((o) => o.status === "RUNNING");
1095
1135
  return n ? `执行中:${n.stepKey}` : "后端处理中…";
1096
1136
  }
1097
- const Et = 80;
1098
- function yo() {
1137
+ const Pt = 80;
1138
+ function So() {
1099
1139
  try {
1100
- const e = localStorage.getItem(ht());
1140
+ const e = localStorage.getItem(yt());
1101
1141
  if (!e) return [];
1102
1142
  const n = JSON.parse(e);
1103
- return Array.isArray(n) ? n.filter((t) => t && t.id && t.createdAt).sort((t, o) => o.createdAt - t.createdAt).slice(0, Et) : [];
1143
+ return Array.isArray(n) ? n.filter((t) => t && t.id && t.createdAt).sort((t, o) => o.createdAt - t.createdAt).slice(0, Pt) : [];
1104
1144
  } catch {
1105
1145
  return [];
1106
1146
  }
1107
1147
  }
1108
- function wo(e) {
1109
- const n = e.slice(0, Et).map((t) => ({
1148
+ function xo(e) {
1149
+ const n = e.slice(0, Pt).map((t) => ({
1110
1150
  id: t.id,
1111
1151
  title: t.title,
1112
1152
  freeText: t.freeText,
@@ -1120,250 +1160,250 @@ function wo(e) {
1120
1160
  createdAt: t.createdAt,
1121
1161
  finishedAt: t.finishedAt
1122
1162
  }));
1123
- localStorage.setItem(ht(), JSON.stringify(n));
1163
+ localStorage.setItem(yt(), JSON.stringify(n));
1124
1164
  }
1125
- function To(e) {
1165
+ function ko(e) {
1126
1166
  return {
1127
1167
  ...e,
1128
1168
  logs: e.runId ? [`ℹ 已从本地恢复,runId=${e.runId}`] : [],
1129
1169
  result: void 0
1130
1170
  };
1131
1171
  }
1132
- function se(e) {
1172
+ function re(e) {
1133
1173
  return e === "pending" || e === "running";
1134
1174
  }
1135
- let Re = 0, ve = null;
1136
- const Io = 5e3;
1137
- function Co() {
1138
- return Re += 1, `ai_task_${Date.now()}_${Re}`;
1175
+ let Ne = 0, he = null;
1176
+ const Eo = 5e3;
1177
+ function bo() {
1178
+ return Ne += 1, `ai_task_${Date.now()}_${Ne}`;
1139
1179
  }
1140
- function So(e, n = 28) {
1180
+ function Ao(e, n = 28) {
1141
1181
  const t = e.trim();
1142
1182
  return t.length <= n ? t : `${t.slice(0, n)}…`;
1143
1183
  }
1144
- const Mt = cn("ycAiTask", () => {
1145
- const e = b([]), n = b(!1), t = b(!1), o = b(!1), s = b({}), d = b(!1), v = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set();
1146
- function r(i, p) {
1184
+ const $t = pn("ycAiTask", () => {
1185
+ const e = k([]), n = k(!1), t = k(!1), o = k(!1), l = k({}), y = k(!1), c = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set();
1186
+ function r(s, f) {
1147
1187
  return {
1148
- taskId: i.id,
1149
- runId: i.runId,
1150
- title: i.title,
1151
- freeText: i.freeText,
1152
- promptId: i.promptId,
1153
- result: p,
1154
- finishedAt: i.finishedAt ?? Date.now()
1188
+ taskId: s.id,
1189
+ runId: s.runId,
1190
+ title: s.title,
1191
+ freeText: s.freeText,
1192
+ promptId: s.promptId,
1193
+ result: f,
1194
+ finishedAt: s.finishedAt ?? Date.now()
1155
1195
  };
1156
1196
  }
1157
- function C(i, p) {
1158
- var ue;
1159
- const c = e.value.find((J) => J.id === i);
1160
- if (!(c != null && c.runId)) return;
1161
- const K = r(c, p);
1162
- (ue = _.get(i)) == null || ue(K), _.delete(i), y.forEach((J) => J(K));
1197
+ function S(s, f) {
1198
+ var fe;
1199
+ const d = e.value.find((pe) => pe.id === s);
1200
+ if (!(d != null && d.runId)) return;
1201
+ const R = r(d, f);
1202
+ (fe = h.get(s)) == null || fe(R), h.delete(s), p.forEach((pe) => pe(R));
1163
1203
  }
1164
- function V(i) {
1165
- return y.add(i), () => y.delete(i);
1204
+ function D(s) {
1205
+ return p.add(s), () => p.delete(s);
1166
1206
  }
1167
- const F = $(
1168
- () => e.value.filter((i) => se(i.status)).length
1169
- ), X = $(() => e.value.filter((i) => i.status === "running").length), O = $(() => F.value > 0 ? "AI 处理中" : e.value.some((i) => i.status === "failed") ? "部分任务失败" : "AI 任务"), f = $(() => {
1170
- const i = e.value.length, p = F.value;
1171
- return i === 0 ? "暂无任务" : p > 0 ? `${p}/${i} 项任务进行中` : `${i} 项任务已完成`;
1207
+ const N = P(
1208
+ () => e.value.filter((s) => re(s.status)).length
1209
+ ), q = P(() => e.value.filter((s) => s.status === "running").length), F = P(() => N.value > 0 ? "AI 处理中" : e.value.some((s) => s.status === "failed") ? "部分任务失败" : "AI 任务"), v = P(() => {
1210
+ const s = e.value.length, f = N.value;
1211
+ return s === 0 ? "暂无任务" : f > 0 ? `${f}/${s} 项任务进行中` : `${s} 项任务已完成`;
1172
1212
  });
1173
1213
  function L() {
1174
- wo(e.value);
1214
+ xo(e.value);
1175
1215
  }
1176
- function H(i, p) {
1177
- const c = e.value.findIndex((K) => K.id === i);
1178
- c >= 0 && (e.value[c] = { ...e.value[c], ...p }, L());
1216
+ function z(s, f) {
1217
+ const d = e.value.findIndex((R) => R.id === s);
1218
+ d >= 0 && (e.value[d] = { ...e.value[d], ...f }, L());
1179
1219
  }
1180
- function S(i, p) {
1181
- const c = e.value.find((K) => K.id === i);
1182
- c && (c.logs.unshift(p), c.logs.length > 20 && c.logs.pop());
1220
+ function $(s, f) {
1221
+ const d = e.value.find((R) => R.id === s);
1222
+ d && (d.logs.unshift(f), d.logs.length > 20 && d.logs.pop());
1183
1223
  }
1184
- function U() {
1224
+ function M() {
1185
1225
  n.value = !0, t.value = !1;
1186
1226
  }
1187
- function N() {
1227
+ function Y() {
1188
1228
  n.value = !1;
1189
1229
  }
1190
- function h() {
1230
+ function _() {
1191
1231
  t.value = !t.value;
1192
1232
  }
1193
- function k(i = {}) {
1194
- s.value = { ...i }, o.value = !0, Ge(i);
1233
+ function C(s = {}) {
1234
+ l.value = { ...s }, o.value = !0, We(s);
1195
1235
  }
1196
- function Y() {
1197
- o.value = !1, Ct();
1236
+ function K() {
1237
+ o.value = !1, xt();
1198
1238
  }
1199
1239
  function j() {
1200
- ve || (ve = setInterval(() => {
1201
- ee();
1202
- }, Io));
1240
+ he || (he = setInterval(() => {
1241
+ H();
1242
+ }, Eo));
1203
1243
  }
1204
- function W() {
1205
- F.value > 0 || ve && (clearInterval(ve), ve = null);
1244
+ function X() {
1245
+ N.value > 0 || he && (clearInterval(he), he = null);
1206
1246
  }
1207
- async function ee() {
1208
- const i = e.value.filter((p) => p.runId && se(p.status));
1209
- if (!i.length) {
1210
- W();
1247
+ async function H() {
1248
+ const s = e.value.filter((f) => f.runId && re(f.status));
1249
+ if (!s.length) {
1250
+ X();
1211
1251
  return;
1212
1252
  }
1213
- await Promise.all(i.map((p) => E(p.id)));
1253
+ await Promise.all(s.map((f) => Q(f.id)));
1214
1254
  }
1215
- async function E(i) {
1216
- if (v.has(i)) return;
1217
- const p = e.value.find((c) => c.id === i);
1218
- if (!(!(p != null && p.runId) || !se(p.status))) {
1219
- v.add(i);
1255
+ async function Q(s) {
1256
+ if (c.has(s)) return;
1257
+ const f = e.value.find((d) => d.id === s);
1258
+ if (!(!(f != null && f.runId) || !re(f.status))) {
1259
+ c.add(s);
1220
1260
  try {
1221
- const c = await mo(p.runId, {
1222
- onProgress: (K, ue) => H(i, { progress: K, summary: ue, status: "running" })
1261
+ const d = await yo(f.runId, {
1262
+ onProgress: (R, fe) => z(s, { progress: R, summary: fe, status: "running" })
1223
1263
  });
1224
- if (!c) return;
1225
- if (c.phase === "SUCCEEDED") {
1226
- const K = c.result ?? {};
1227
- H(i, {
1264
+ if (!d) return;
1265
+ if (d.phase === "SUCCEEDED") {
1266
+ const R = d.result ?? {};
1267
+ z(s, {
1228
1268
  status: "succeeded",
1229
1269
  progress: 100,
1230
1270
  summary: "已完成",
1231
- result: K,
1232
- runId: c.runId,
1271
+ result: R,
1272
+ runId: d.runId,
1233
1273
  finishedAt: Date.now()
1234
- }), C(i, K);
1274
+ }), S(s, R);
1235
1275
  } else
1236
- H(i, {
1237
- status: c.errorMessage === "已取消" ? "cancelled" : "failed",
1276
+ z(s, {
1277
+ status: d.errorMessage === "已取消" ? "cancelled" : "failed",
1238
1278
  progress: 100,
1239
- summary: c.errorMessage || "失败",
1240
- errorMessage: c.errorMessage,
1241
- runId: c.runId,
1279
+ summary: d.errorMessage || "失败",
1280
+ errorMessage: d.errorMessage,
1281
+ runId: d.runId,
1242
1282
  finishedAt: Date.now()
1243
1283
  });
1244
- W();
1245
- } catch (c) {
1246
- const K = c instanceof Error ? c.message : "同步失败";
1247
- S(i, `✗ ${K}`);
1284
+ X();
1285
+ } catch (d) {
1286
+ const R = d instanceof Error ? d.message : "同步失败";
1287
+ $(s, `✗ ${R}`);
1248
1288
  } finally {
1249
- v.delete(i);
1289
+ c.delete(s);
1250
1290
  }
1251
1291
  }
1252
1292
  }
1253
- async function oe() {
1254
- if (d.value) return;
1255
- d.value = !0;
1256
- const i = yo();
1257
- i.length && (e.value = i.map(To), Re = i.length);
1258
- const p = e.value.filter((c) => c.runId && se(c.status));
1259
- p.length && (await Promise.all(p.map((c) => E(c.id))), j());
1260
- for (const c of e.value)
1261
- c.status === "pending" && !c.runId && H(c.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
1293
+ async function O() {
1294
+ if (y.value) return;
1295
+ y.value = !0;
1296
+ const s = So();
1297
+ s.length && (e.value = s.map(ko), Ne = s.length);
1298
+ const f = e.value.filter((d) => d.runId && re(d.status));
1299
+ f.length && (await Promise.all(f.map((d) => Q(d.id))), j());
1300
+ for (const d of e.value)
1301
+ d.status === "pending" && !d.runId && z(d.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
1262
1302
  }
1263
- function le(i) {
1264
- const p = Co(), c = {
1265
- id: p,
1266
- title: i.title ?? So(i.freeText),
1267
- freeText: i.freeText.trim(),
1268
- promptId: i.promptId,
1269
- autoMatch: i.autoMatch,
1303
+ function Z(s) {
1304
+ const f = bo(), d = {
1305
+ id: f,
1306
+ title: s.title ?? Ao(s.freeText),
1307
+ freeText: s.freeText.trim(),
1308
+ promptId: s.promptId,
1309
+ autoMatch: s.autoMatch,
1270
1310
  status: "pending",
1271
1311
  progress: 0,
1272
1312
  summary: "正在提交…",
1273
1313
  createdAt: Date.now(),
1274
1314
  logs: []
1275
1315
  };
1276
- return e.value.unshift(c), L(), i.onFinish && _.set(p, i.onFinish), i.showPanel !== !1 && U(), te(p), p;
1316
+ return e.value.unshift(d), L(), s.onFinish && h.set(f, s.onFinish), s.showPanel !== !1 && M(), se(f), f;
1277
1317
  }
1278
- async function te(i) {
1279
- const p = e.value.find((c) => c.id === i);
1280
- if (p)
1318
+ async function se(s) {
1319
+ const f = e.value.find((d) => d.id === s);
1320
+ if (f)
1281
1321
  try {
1282
- const c = await po({
1283
- freeText: p.freeText,
1284
- promptId: p.promptId,
1285
- autoMatch: p.autoMatch
1322
+ const d = await ho({
1323
+ freeText: f.freeText,
1324
+ promptId: f.promptId,
1325
+ autoMatch: f.autoMatch
1286
1326
  });
1287
- H(i, {
1288
- runId: c,
1327
+ z(s, {
1328
+ runId: d,
1289
1329
  status: "running",
1290
1330
  progress: 10,
1291
1331
  summary: "后端异步处理中…"
1292
- }), S(i, `▶ 已提交 runId=${c}`), j(), E(i);
1293
- } catch (c) {
1294
- const K = c instanceof Error ? c.message : "提交失败";
1295
- H(i, {
1332
+ }), $(s, `▶ 已提交 runId=${d}`), j(), Q(s);
1333
+ } catch (d) {
1334
+ const R = d instanceof Error ? d.message : "提交失败";
1335
+ z(s, {
1296
1336
  status: "failed",
1297
1337
  progress: 100,
1298
- summary: K,
1299
- errorMessage: K,
1338
+ summary: R,
1339
+ errorMessage: R,
1300
1340
  finishedAt: Date.now()
1301
1341
  });
1302
1342
  }
1303
1343
  }
1304
- async function R(i) {
1305
- const p = e.value.find((K) => K.id === i);
1306
- if (!(p != null && p.runId)) return null;
1307
- if (p.result) return p.result;
1308
- const c = await go(p.runId);
1309
- return c && H(i, { result: c }), c;
1344
+ async function U(s) {
1345
+ const f = e.value.find((R) => R.id === s);
1346
+ if (!(f != null && f.runId)) return null;
1347
+ if (f.result) return f.result;
1348
+ const d = await wo(f.runId);
1349
+ return d && z(s, { result: d }), d;
1310
1350
  }
1311
- async function z(i) {
1312
- const p = e.value.find((c) => c.id === i);
1313
- if (p != null && p.runId && se(p.status))
1351
+ async function oe(s) {
1352
+ const f = e.value.find((d) => d.id === s);
1353
+ if (f != null && f.runId && re(f.status))
1314
1354
  try {
1315
- await vo(p.runId);
1355
+ await To(f.runId);
1316
1356
  } catch {
1317
1357
  }
1318
- p && se(p.status) && H(i, { status: "cancelled", summary: "已取消", finishedAt: Date.now() }), _.delete(i), W();
1358
+ f && re(f.status) && z(s, { status: "cancelled", summary: "已取消", finishedAt: Date.now() }), h.delete(s), X();
1319
1359
  }
1320
- function Te() {
1321
- for (const i of e.value)
1322
- se(i.status) && z(i.id);
1360
+ function G() {
1361
+ for (const s of e.value)
1362
+ re(s.status) && oe(s.id);
1323
1363
  }
1324
- function Ie() {
1325
- e.value = e.value.filter((i) => se(i.status)), L();
1364
+ function Ce() {
1365
+ e.value = e.value.filter((s) => re(s.status)), L();
1326
1366
  }
1327
- function Ce(i) {
1328
- z(i), _.delete(i), e.value = e.value.filter((p) => p.id !== i), L();
1367
+ function Se(s) {
1368
+ oe(s), h.delete(s), e.value = e.value.filter((f) => f.id !== s), L();
1329
1369
  }
1330
1370
  return {
1331
1371
  tasks: e,
1332
1372
  panelVisible: n,
1333
1373
  panelMinimized: t,
1334
1374
  dialogVisible: o,
1335
- dialogOptions: s,
1336
- hydrated: d,
1337
- runningCount: F,
1338
- activeCount: X,
1339
- panelTitle: O,
1340
- panelSubtitle: f,
1341
- hydrate: oe,
1342
- showPanel: U,
1343
- hidePanel: N,
1344
- toggleMinimize: h,
1345
- openDialog: k,
1346
- closeDialog: Y,
1347
- enqueue: le,
1348
- onTaskFinish: V,
1349
- refreshActiveTasks: ee,
1350
- loadTaskResult: R,
1351
- cancelTask: z,
1352
- cancelAll: Te,
1353
- clearFinished: Ie,
1354
- removeTask: Ce
1375
+ dialogOptions: l,
1376
+ hydrated: y,
1377
+ runningCount: N,
1378
+ activeCount: q,
1379
+ panelTitle: F,
1380
+ panelSubtitle: v,
1381
+ hydrate: O,
1382
+ showPanel: M,
1383
+ hidePanel: Y,
1384
+ toggleMinimize: _,
1385
+ openDialog: C,
1386
+ closeDialog: K,
1387
+ enqueue: Z,
1388
+ onTaskFinish: D,
1389
+ refreshActiveTasks: H,
1390
+ loadTaskResult: U,
1391
+ cancelTask: oe,
1392
+ cancelAll: G,
1393
+ clearFinished: Ce,
1394
+ removeTask: Se
1355
1395
  };
1356
1396
  });
1357
- async function ko(e) {
1358
- return (await pe().get("/yc-ai/ai/prompts", {
1397
+ async function Mo(e) {
1398
+ return (await ge().get("/yc-ai/ai/prompts", {
1359
1399
  params: e ? { category: e } : {}
1360
1400
  })).data;
1361
1401
  }
1362
- function We() {
1363
- const e = Ye(bt, null);
1364
- return e || Mt();
1402
+ function qe() {
1403
+ const e = je(At, null);
1404
+ return e || $t();
1365
1405
  }
1366
- const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__footer-actions" }, Ao = /* @__PURE__ */ de({
1406
+ const Po = { class: "ai-use-dialog__footer" }, $o = { class: "ai-use-dialog__footer-actions" }, Lo = /* @__PURE__ */ ue({
1367
1407
  __name: "AiUseDialog",
1368
1408
  props: {
1369
1409
  title: { default: "AI 生成" },
@@ -1386,147 +1426,147 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1386
1426
  },
1387
1427
  emits: ["update:modelValue", "submitted"],
1388
1428
  setup(e, { emit: n }) {
1389
- const t = e, o = n, s = We(), d = $(() => t.modelValue !== void 0), v = b(!1);
1429
+ const t = e, o = n, l = qe(), y = P(() => t.modelValue !== void 0), c = k(!1);
1390
1430
  ne(
1391
1431
  () => t.modelValue,
1392
- (h) => {
1393
- d.value && (v.value = !!h);
1432
+ (_) => {
1433
+ y.value && (c.value = !!_);
1394
1434
  },
1395
1435
  { immediate: !0 }
1396
- ), ne(v, (h) => {
1397
- if (d.value) {
1398
- o("update:modelValue", h);
1436
+ ), ne(c, (_) => {
1437
+ if (y.value) {
1438
+ o("update:modelValue", _);
1399
1439
  return;
1400
1440
  }
1401
- ae.visible = h, h || Ct();
1441
+ ae.visible = _, _ || xt();
1402
1442
  }), ne(
1403
1443
  () => ae.visible,
1404
- (h) => {
1405
- d.value || (v.value = h);
1444
+ (_) => {
1445
+ y.value || (c.value = _);
1406
1446
  },
1407
1447
  { immediate: !0 }
1408
1448
  );
1409
- function _(h) {
1410
- if (d.value) return;
1411
- const k = h.detail ?? {};
1412
- O(k), v.value = !0;
1449
+ function h(_) {
1450
+ if (y.value) return;
1451
+ const C = _.detail ?? {};
1452
+ F(C), c.value = !0;
1413
1453
  }
1414
1454
  Ke(() => {
1415
- globalThis.addEventListener(Ue, _), d.value || (v.value = ae.visible);
1416
- }), Ne(() => {
1417
- globalThis.removeEventListener(Ue, _);
1455
+ globalThis.addEventListener(Ue, h), y.value || (c.value = ae.visible);
1456
+ }), Ye(() => {
1457
+ globalThis.removeEventListener(Ue, h);
1418
1458
  });
1419
- const y = $(
1420
- () => (d.value ? void 0 : ae.options.title) ?? t.title ?? "AI 生成"
1421
- ), r = b({
1459
+ const p = P(
1460
+ () => (y.value ? void 0 : ae.options.title) ?? t.title ?? "AI 生成"
1461
+ ), r = k({
1422
1462
  freeText: t.freeText,
1423
1463
  promptId: t.promptId,
1424
1464
  autoMatch: t.autoMatch
1425
- }), C = b(t.prompts ? [...t.prompts] : []), V = b(!1), F = b(!1), X = b();
1426
- function O(h) {
1427
- var k, Y;
1428
- r.value.freeText = h.freeText ?? t.freeText ?? "", r.value.promptId = h.promptId ?? t.promptId, r.value.autoMatch = h.autoMatch ?? t.autoMatch ?? !1, X.value = h.onFinish, (k = h.prompts) != null && k.length ? C.value = [...h.prompts] : (Y = t.prompts) != null && Y.length && (C.value = [...t.prompts]);
1465
+ }), S = k(t.prompts ? [...t.prompts] : []), D = k(!1), N = k(!1), q = k();
1466
+ function F(_) {
1467
+ var C, K;
1468
+ r.value.freeText = _.freeText ?? t.freeText ?? "", r.value.promptId = _.promptId ?? t.promptId, r.value.autoMatch = _.autoMatch ?? t.autoMatch ?? !1, q.value = _.onFinish, (C = _.prompts) != null && C.length ? S.value = [..._.prompts] : (K = t.prompts) != null && K.length && (S.value = [...t.prompts]);
1429
1469
  }
1430
- async function f() {
1431
- if (!(C.value.length > 0)) {
1432
- V.value = !0;
1470
+ async function v() {
1471
+ if (!(S.value.length > 0)) {
1472
+ D.value = !0;
1433
1473
  try {
1434
- const h = vt().listPrompts;
1435
- C.value = h ? await h() : await ko();
1474
+ const _ = ht().listPrompts;
1475
+ S.value = _ ? await _() : await Mo();
1436
1476
  } catch {
1437
- Q.warning("加载提示词失败");
1477
+ ee.warning("加载提示词失败");
1438
1478
  } finally {
1439
- V.value = !1;
1479
+ D.value = !1;
1440
1480
  }
1441
1481
  }
1442
1482
  }
1443
1483
  function L() {
1444
- d.value ? O({}) : O(ae.options), t.showPromptSelect && f();
1484
+ y.value ? F({}) : F(ae.options), t.showPromptSelect && v();
1445
1485
  }
1446
1486
  ne(
1447
1487
  () => t.prompts,
1448
- (h) => {
1449
- h != null && h.length && (C.value = [...h]);
1488
+ (_) => {
1489
+ _ != null && _.length && (S.value = [..._]);
1450
1490
  },
1451
1491
  { deep: !0 }
1452
1492
  ), ne(
1453
1493
  () => [t.freeText, t.promptId, t.autoMatch],
1454
- ([h, k, Y]) => {
1455
- v.value || (r.value.freeText = h ?? "", r.value.promptId = k, r.value.autoMatch = Y ?? !1);
1494
+ ([_, C, K]) => {
1495
+ c.value || (r.value.freeText = _ ?? "", r.value.promptId = C, r.value.autoMatch = K ?? !1);
1456
1496
  }
1457
1497
  );
1458
- function H() {
1498
+ function z() {
1459
1499
  r.value.autoMatch && (r.value.promptId = void 0);
1460
1500
  }
1461
- function S() {
1462
- F.value = !1;
1501
+ function $() {
1502
+ N.value = !1;
1463
1503
  }
1464
- function U() {
1465
- s.showPanel();
1504
+ function M() {
1505
+ l.showPanel();
1466
1506
  }
1467
- async function N() {
1468
- var W, ee;
1507
+ async function Y() {
1508
+ var X, H;
1469
1509
  if (!r.value.freeText.trim()) {
1470
- Q.warning("请填写需求描述");
1510
+ ee.warning("请填写需求描述");
1471
1511
  return;
1472
1512
  }
1473
- const h = r.value.autoMatch, k = h ? void 0 : r.value.promptId;
1474
- if (!h && k == null) {
1475
- const E = t.showPromptSelect || t.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
1476
- Q.warning(E);
1513
+ const _ = r.value.autoMatch, C = _ ? void 0 : r.value.promptId;
1514
+ if (!_ && C == null) {
1515
+ const Q = t.showPromptSelect || t.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
1516
+ ee.warning(Q);
1477
1517
  return;
1478
1518
  }
1479
- F.value = !0;
1480
- const Y = d.value ? X.value : ae.options.onFinish, j = s.enqueue({
1519
+ N.value = !0;
1520
+ const K = y.value ? q.value : ae.options.onFinish, j = l.enqueue({
1481
1521
  freeText: r.value.freeText.trim(),
1482
- promptId: k,
1483
- autoMatch: h && k == null ? !0 : void 0,
1522
+ promptId: C,
1523
+ autoMatch: _ && C == null ? !0 : void 0,
1484
1524
  showPanel: !0,
1485
- onFinish: Y
1525
+ onFinish: K
1486
1526
  });
1487
- d.value ? o("submitted", j) : (ee = (W = ae.options).onSubmitted) == null || ee.call(W, j), v.value = !1, F.value = !1, Q.success("已加入任务队列,可在任务面板查看进度");
1527
+ y.value ? o("submitted", j) : (H = (X = ae.options).onSubmitted) == null || H.call(X, j), c.value = !1, N.value = !1, ee.success("已加入任务队列,可在任务面板查看进度");
1488
1528
  }
1489
- return (h, k) => {
1490
- const Y = B("el-switch"), j = B("el-form-item"), W = B("el-option"), ee = B("el-select"), E = B("el-input"), oe = B("el-form"), le = B("el-button"), te = B("el-dialog");
1491
- return u(), M(te, {
1492
- modelValue: v.value,
1493
- "onUpdate:modelValue": k[4] || (k[4] = (R) => v.value = R),
1494
- title: y.value,
1529
+ return (_, C) => {
1530
+ const K = V("el-switch"), j = V("el-form-item"), X = V("el-option"), H = V("el-select"), Q = V("el-input"), O = V("el-form"), Z = V("el-button"), se = V("el-dialog");
1531
+ return u(), E(se, {
1532
+ modelValue: c.value,
1533
+ "onUpdate:modelValue": C[4] || (C[4] = (U) => c.value = U),
1534
+ title: p.value,
1495
1535
  width: e.width,
1496
1536
  "append-to-body": "",
1497
1537
  class: "ai-use-dialog",
1498
- onClosed: S,
1538
+ onClosed: $,
1499
1539
  onOpen: L
1500
1540
  }, {
1501
1541
  footer: g(() => [
1502
- T("div", xo, [
1503
- e.showTaskListButton ? (u(), M(le, {
1542
+ T("div", Po, [
1543
+ e.showTaskListButton ? (u(), E(Z, {
1504
1544
  key: 0,
1505
1545
  link: "",
1506
1546
  type: "primary",
1507
- onClick: U
1547
+ onClick: M
1508
1548
  }, {
1509
1549
  default: g(() => [
1510
- G(D(e.taskListButtonText), 1)
1550
+ W(B(e.taskListButtonText), 1)
1511
1551
  ]),
1512
1552
  _: 1
1513
- })) : P("", !0),
1514
- T("div", bo, [
1515
- m(le, {
1516
- onClick: k[3] || (k[3] = (R) => v.value = !1)
1553
+ })) : b("", !0),
1554
+ T("div", $o, [
1555
+ m(Z, {
1556
+ onClick: C[3] || (C[3] = (U) => c.value = !1)
1517
1557
  }, {
1518
- default: g(() => [...k[5] || (k[5] = [
1519
- G("取消", -1)
1558
+ default: g(() => [...C[5] || (C[5] = [
1559
+ W("取消", -1)
1520
1560
  ])]),
1521
1561
  _: 1
1522
1562
  }),
1523
- m(le, {
1563
+ m(Z, {
1524
1564
  type: "primary",
1525
- loading: F.value,
1526
- onClick: N
1565
+ loading: N.value,
1566
+ onClick: Y
1527
1567
  }, {
1528
1568
  default: g(() => [
1529
- G(D(e.submitText), 1)
1569
+ W(B(e.submitText), 1)
1530
1570
  ]),
1531
1571
  _: 1
1532
1572
  }, 8, ["loading"])
@@ -1534,58 +1574,58 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1534
1574
  ])
1535
1575
  ]),
1536
1576
  default: g(() => [
1537
- m(oe, { "label-position": "top" }, {
1577
+ m(O, { "label-position": "top" }, {
1538
1578
  default: g(() => [
1539
- e.showAutoMatch ? (u(), M(j, {
1579
+ e.showAutoMatch ? (u(), E(j, {
1540
1580
  key: 0,
1541
1581
  label: e.autoMatchLabel
1542
1582
  }, {
1543
1583
  default: g(() => [
1544
- m(Y, {
1584
+ m(K, {
1545
1585
  modelValue: r.value.autoMatch,
1546
- "onUpdate:modelValue": k[0] || (k[0] = (R) => r.value.autoMatch = R),
1586
+ "onUpdate:modelValue": C[0] || (C[0] = (U) => r.value.autoMatch = U),
1547
1587
  "active-text": "按需求自动选",
1548
1588
  "inactive-text": "手动指定",
1549
- onChange: H
1589
+ onChange: z
1550
1590
  }, null, 8, ["modelValue"])
1551
1591
  ]),
1552
1592
  _: 1
1553
- }, 8, ["label"])) : P("", !0),
1554
- e.showPromptSelect ? (u(), M(j, {
1593
+ }, 8, ["label"])) : b("", !0),
1594
+ e.showPromptSelect ? (u(), E(j, {
1555
1595
  key: 1,
1556
1596
  label: e.promptLabel,
1557
1597
  required: !r.value.autoMatch
1558
1598
  }, {
1559
1599
  default: g(() => [
1560
- m(ee, {
1600
+ m(H, {
1561
1601
  modelValue: r.value.promptId,
1562
- "onUpdate:modelValue": k[1] || (k[1] = (R) => r.value.promptId = R),
1602
+ "onUpdate:modelValue": C[1] || (C[1] = (U) => r.value.promptId = U),
1563
1603
  filterable: "",
1564
1604
  clearable: "",
1565
1605
  placeholder: r.value.autoMatch ? "留空则自动匹配" : "请选择提示词",
1566
1606
  style: { width: "100%" },
1567
- loading: V.value
1607
+ loading: D.value
1568
1608
  }, {
1569
1609
  default: g(() => [
1570
- (u(!0), A(re, null, he(C.value, (R) => (u(), M(W, {
1571
- key: R.id,
1572
- label: R.name,
1573
- value: R.id
1610
+ (u(!0), A(ce, null, ye(S.value, (U) => (u(), E(X, {
1611
+ key: U.id,
1612
+ label: U.name,
1613
+ value: U.id
1574
1614
  }, null, 8, ["label", "value"]))), 128))
1575
1615
  ]),
1576
1616
  _: 1
1577
1617
  }, 8, ["modelValue", "placeholder", "loading"])
1578
1618
  ]),
1579
1619
  _: 1
1580
- }, 8, ["label", "required"])) : P("", !0),
1620
+ }, 8, ["label", "required"])) : b("", !0),
1581
1621
  m(j, {
1582
1622
  label: e.freeTextLabel,
1583
1623
  required: ""
1584
1624
  }, {
1585
1625
  default: g(() => [
1586
- m(E, {
1626
+ m(Q, {
1587
1627
  modelValue: r.value.freeText,
1588
- "onUpdate:modelValue": k[2] || (k[2] = (R) => r.value.freeText = R),
1628
+ "onUpdate:modelValue": C[2] || (C[2] = (U) => r.value.freeText = U),
1589
1629
  type: "textarea",
1590
1630
  rows: 4,
1591
1631
  placeholder: e.freeTextPlaceholder
@@ -1601,104 +1641,104 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1601
1641
  }, 8, ["modelValue", "title", "width"]);
1602
1642
  };
1603
1643
  }
1604
- }), Eo = /* @__PURE__ */ Ee(Ao, [["__scopeId", "data-v-9aa82e83"]]), Mo = { class: "ai-task-panel" }, Po = { class: "ai-task-panel__header" }, $o = { class: "ai-task-panel__header-left" }, Lo = { class: "ai-task-panel__titles" }, Do = { class: "ai-task-panel__subtitle" }, Bo = { class: "ai-task-panel__title" }, Vo = { class: "ai-task-panel__header-actions" }, Oo = { class: "ai-task-panel__body" }, Uo = {
1644
+ }), Do = /* @__PURE__ */ Me(Lo, [["__scopeId", "data-v-9aa82e83"]]), Bo = { class: "ai-task-panel" }, Vo = { class: "ai-task-panel__header" }, Oo = { class: "ai-task-panel__header-left" }, Fo = { class: "ai-task-panel__titles" }, Uo = { class: "ai-task-panel__subtitle" }, Ro = { class: "ai-task-panel__title" }, No = { class: "ai-task-panel__header-actions" }, Ko = { class: "ai-task-panel__body" }, Yo = {
1605
1645
  key: 1,
1606
1646
  class: "ai-task-list"
1607
- }, Fo = { class: "ai-task-row__icon" }, Ro = { class: "ai-task-row__main" }, Ko = { class: "ai-task-row__title" }, No = { class: "ai-task-row__meta" }, zo = { key: 0 }, Yo = {
1647
+ }, zo = { class: "ai-task-row__icon" }, jo = { class: "ai-task-row__main" }, Go = { class: "ai-task-row__title" }, Wo = { class: "ai-task-row__meta" }, qo = { key: 0 }, Ho = {
1608
1648
  key: 0,
1609
1649
  class: "ai-task-row__summary"
1610
- }, jo = { class: "ai-task-row__ops" }, Go = {
1650
+ }, Jo = { class: "ai-task-row__ops" }, Xo = {
1611
1651
  key: 0,
1612
1652
  class: "ai-task-panel__footer"
1613
- }, Wo = /* @__PURE__ */ de({
1653
+ }, Qo = /* @__PURE__ */ ue({
1614
1654
  __name: "AiTaskPanel",
1615
1655
  emits: ["use"],
1616
1656
  setup(e, { emit: n }) {
1617
- const t = n, o = We(), s = b(null), d = {
1657
+ const t = n, o = qe(), l = k(null), y = {
1618
1658
  pending: "等待中",
1619
1659
  running: "执行中",
1620
1660
  succeeded: "已完成",
1621
1661
  failed: "失败",
1622
1662
  cancelled: "已取消"
1623
1663
  };
1624
- function v(y) {
1625
- return d[y] ?? y;
1664
+ function c(p) {
1665
+ return y[p] ?? p;
1626
1666
  }
1627
- async function _(y) {
1628
- s.value = y.id;
1667
+ async function h(p) {
1668
+ l.value = p.id;
1629
1669
  try {
1630
- const r = y.result ?? await o.loadTaskResult(y.id);
1670
+ const r = p.result ?? await o.loadTaskResult(p.id);
1631
1671
  if (!r) return;
1632
1672
  t("use", {
1633
- taskId: y.id,
1634
- runId: y.runId,
1635
- title: y.title,
1636
- freeText: y.freeText,
1637
- promptId: y.promptId,
1673
+ taskId: p.id,
1674
+ runId: p.runId,
1675
+ title: p.title,
1676
+ freeText: p.freeText,
1677
+ promptId: p.promptId,
1638
1678
  result: r,
1639
- finishedAt: y.finishedAt ?? Date.now()
1679
+ finishedAt: p.finishedAt ?? Date.now()
1640
1680
  });
1641
1681
  } finally {
1642
- s.value = null;
1682
+ l.value = null;
1643
1683
  }
1644
1684
  }
1645
- return (y, r) => {
1646
- const C = B("el-icon"), V = B("el-button"), F = B("el-empty"), X = B("el-progress"), O = B("el-badge");
1647
- return u(), M(Jt, { to: "body" }, [
1648
- m(pt, { name: "ai-panel-slide" }, {
1685
+ return (p, r) => {
1686
+ const S = V("el-icon"), D = V("el-button"), N = V("el-empty"), q = V("el-progress"), F = V("el-badge");
1687
+ return u(), E(Zt, { to: "body" }, [
1688
+ m(gt, { name: "ai-panel-slide" }, {
1649
1689
  default: g(() => [
1650
- _e(T("div", Mo, [
1651
- T("div", Po, [
1652
- T("div", $o, [
1690
+ we(T("div", Bo, [
1691
+ T("div", Vo, [
1692
+ T("div", Oo, [
1653
1693
  T("div", {
1654
- class: fe(["ai-task-panel__icon", { spinning: w(o).activeCount > 0 }])
1694
+ class: me(["ai-task-panel__icon", { spinning: w(o).activeCount > 0 }])
1655
1695
  }, [
1656
- m(C, null, {
1696
+ m(S, null, {
1657
1697
  default: g(() => [
1658
- m(w(lt))
1698
+ m(w(it))
1659
1699
  ]),
1660
1700
  _: 1
1661
1701
  })
1662
1702
  ], 2),
1663
- T("div", Lo, [
1664
- T("div", Do, D(w(o).panelSubtitle), 1),
1665
- T("div", Bo, D(w(o).panelTitle), 1)
1703
+ T("div", Fo, [
1704
+ T("div", Uo, B(w(o).panelSubtitle), 1),
1705
+ T("div", Ro, B(w(o).panelTitle), 1)
1666
1706
  ])
1667
1707
  ]),
1668
- T("div", Vo, [
1669
- w(o).runningCount > 0 ? (u(), M(V, {
1708
+ T("div", No, [
1709
+ w(o).runningCount > 0 ? (u(), E(D, {
1670
1710
  key: 0,
1671
1711
  link: "",
1672
1712
  type: "primary",
1673
- onClick: r[0] || (r[0] = (f) => w(o).cancelAll())
1713
+ onClick: r[0] || (r[0] = (v) => w(o).cancelAll())
1674
1714
  }, {
1675
1715
  default: g(() => [...r[5] || (r[5] = [
1676
- G(" 取消全部 ", -1)
1716
+ W(" 取消全部 ", -1)
1677
1717
  ])]),
1678
1718
  _: 1
1679
- })) : P("", !0),
1680
- m(V, {
1719
+ })) : b("", !0),
1720
+ m(D, {
1681
1721
  link: "",
1682
- onClick: r[1] || (r[1] = (f) => w(o).toggleMinimize())
1722
+ onClick: r[1] || (r[1] = (v) => w(o).toggleMinimize())
1683
1723
  }, {
1684
1724
  default: g(() => [
1685
- m(C, null, {
1725
+ m(S, null, {
1686
1726
  default: g(() => [
1687
- m(w(ln))
1727
+ m(w(rn))
1688
1728
  ]),
1689
1729
  _: 1
1690
1730
  })
1691
1731
  ]),
1692
1732
  _: 1
1693
1733
  }),
1694
- m(V, {
1734
+ m(D, {
1695
1735
  link: "",
1696
- onClick: r[2] || (r[2] = (f) => w(o).hidePanel())
1736
+ onClick: r[2] || (r[2] = (v) => w(o).hidePanel())
1697
1737
  }, {
1698
1738
  default: g(() => [
1699
- m(C, null, {
1739
+ m(S, null, {
1700
1740
  default: g(() => [
1701
- m(w(gt))
1741
+ m(w(_t))
1702
1742
  ]),
1703
1743
  _: 1
1704
1744
  })
@@ -1707,142 +1747,142 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1707
1747
  })
1708
1748
  ])
1709
1749
  ]),
1710
- T("div", Oo, [
1711
- w(o).tasks.length ? (u(), A("div", Uo, [
1712
- (u(!0), A(re, null, he(w(o).tasks, (f) => (u(), A("div", {
1713
- key: f.id,
1750
+ T("div", Ko, [
1751
+ w(o).tasks.length ? (u(), A("div", Yo, [
1752
+ (u(!0), A(ce, null, ye(w(o).tasks, (v) => (u(), A("div", {
1753
+ key: v.id,
1714
1754
  class: "ai-task-row"
1715
1755
  }, [
1716
- T("div", Fo, [
1717
- f.status === "succeeded" ? (u(), M(C, {
1756
+ T("div", zo, [
1757
+ v.status === "succeeded" ? (u(), E(S, {
1718
1758
  key: 0,
1719
1759
  class: "ok"
1720
1760
  }, {
1721
1761
  default: g(() => [
1722
- m(w(an))
1762
+ m(w(un))
1723
1763
  ]),
1724
1764
  _: 1
1725
- })) : f.status === "failed" ? (u(), M(C, {
1765
+ })) : v.status === "failed" ? (u(), E(S, {
1726
1766
  key: 1,
1727
1767
  class: "err"
1728
1768
  }, {
1729
1769
  default: g(() => [
1730
- m(w(sn))
1770
+ m(w(cn))
1731
1771
  ]),
1732
1772
  _: 1
1733
- })) : f.status === "running" || f.status === "pending" ? (u(), M(X, {
1773
+ })) : v.status === "running" || v.status === "pending" ? (u(), E(q, {
1734
1774
  key: 2,
1735
1775
  type: "circle",
1736
- percentage: f.progress,
1776
+ percentage: v.progress,
1737
1777
  width: 36,
1738
1778
  "stroke-width": 3
1739
- }, null, 8, ["percentage"])) : (u(), M(C, {
1779
+ }, null, 8, ["percentage"])) : (u(), E(S, {
1740
1780
  key: 3,
1741
1781
  class: "muted"
1742
1782
  }, {
1743
1783
  default: g(() => [
1744
- m(w(rn))
1784
+ m(w(dn))
1745
1785
  ]),
1746
1786
  _: 1
1747
1787
  }))
1748
1788
  ]),
1749
- T("div", Ro, [
1750
- T("div", Ko, D(f.title), 1),
1751
- T("div", No, [
1752
- T("span", null, D(v(f.status)), 1),
1753
- f.runId ? (u(), A("span", zo, " · #" + D(f.runId), 1)) : P("", !0)
1789
+ T("div", jo, [
1790
+ T("div", Go, B(v.title), 1),
1791
+ T("div", Wo, [
1792
+ T("span", null, B(c(v.status)), 1),
1793
+ v.runId ? (u(), A("span", qo, " · #" + B(v.runId), 1)) : b("", !0)
1754
1794
  ]),
1755
- f.summary ? (u(), A("div", Yo, D(f.summary), 1)) : P("", !0)
1795
+ v.summary ? (u(), A("div", Ho, B(v.summary), 1)) : b("", !0)
1756
1796
  ]),
1757
- T("div", jo, [
1758
- f.status === "running" || f.status === "pending" ? (u(), M(V, {
1797
+ T("div", Jo, [
1798
+ v.status === "running" || v.status === "pending" ? (u(), E(D, {
1759
1799
  key: 0,
1760
1800
  link: "",
1761
1801
  type: "danger",
1762
1802
  size: "small",
1763
- onClick: (L) => w(o).cancelTask(f.id)
1803
+ onClick: (L) => w(o).cancelTask(v.id)
1764
1804
  }, {
1765
1805
  default: g(() => [...r[6] || (r[6] = [
1766
- G(" 取消 ", -1)
1806
+ W(" 取消 ", -1)
1767
1807
  ])]),
1768
1808
  _: 1
1769
- }, 8, ["onClick"])) : P("", !0),
1770
- f.status === "succeeded" && f.runId ? (u(), M(V, {
1809
+ }, 8, ["onClick"])) : b("", !0),
1810
+ v.status === "succeeded" && v.runId ? (u(), E(D, {
1771
1811
  key: 1,
1772
1812
  link: "",
1773
1813
  type: "primary",
1774
1814
  size: "small",
1775
- loading: s.value === f.id,
1776
- onClick: (L) => _(f)
1815
+ loading: l.value === v.id,
1816
+ onClick: (L) => h(v)
1777
1817
  }, {
1778
1818
  default: g(() => [...r[7] || (r[7] = [
1779
- G(" 使用 ", -1)
1819
+ W(" 使用 ", -1)
1780
1820
  ])]),
1781
1821
  _: 1
1782
- }, 8, ["loading", "onClick"])) : P("", !0),
1783
- f.status !== "running" && f.status !== "pending" ? (u(), M(V, {
1822
+ }, 8, ["loading", "onClick"])) : b("", !0),
1823
+ v.status !== "running" && v.status !== "pending" ? (u(), E(D, {
1784
1824
  key: 2,
1785
1825
  link: "",
1786
1826
  size: "small",
1787
- onClick: (L) => w(o).removeTask(f.id)
1827
+ onClick: (L) => w(o).removeTask(v.id)
1788
1828
  }, {
1789
1829
  default: g(() => [...r[8] || (r[8] = [
1790
- G(" 移除 ", -1)
1830
+ W(" 移除 ", -1)
1791
1831
  ])]),
1792
1832
  _: 1
1793
- }, 8, ["onClick"])) : P("", !0)
1833
+ }, 8, ["onClick"])) : b("", !0)
1794
1834
  ])
1795
1835
  ]))), 128))
1796
- ])) : (u(), M(F, {
1836
+ ])) : (u(), E(N, {
1797
1837
  key: 0,
1798
1838
  description: "暂无 AI 任务",
1799
1839
  "image-size": 64
1800
1840
  }))
1801
1841
  ]),
1802
- w(o).tasks.some((f) => f.status !== "running" && f.status !== "pending") ? (u(), A("div", Go, [
1803
- m(V, {
1842
+ w(o).tasks.some((v) => v.status !== "running" && v.status !== "pending") ? (u(), A("div", Xo, [
1843
+ m(D, {
1804
1844
  link: "",
1805
1845
  type: "info",
1806
- onClick: r[3] || (r[3] = (f) => w(o).clearFinished())
1846
+ onClick: r[3] || (r[3] = (v) => w(o).clearFinished())
1807
1847
  }, {
1808
1848
  default: g(() => [...r[9] || (r[9] = [
1809
- G("清除已完成", -1)
1849
+ W("清除已完成", -1)
1810
1850
  ])]),
1811
1851
  _: 1
1812
1852
  })
1813
- ])) : P("", !0)
1853
+ ])) : b("", !0)
1814
1854
  ], 512), [
1815
- [De, w(o).panelVisible && !w(o).panelMinimized]
1855
+ [Be, w(o).panelVisible && !w(o).panelMinimized]
1816
1856
  ])
1817
1857
  ]),
1818
1858
  _: 1
1819
1859
  }),
1820
- _e(T("div", {
1860
+ we(T("div", {
1821
1861
  class: "ai-task-panel-mini",
1822
- onClick: r[4] || (r[4] = (f) => w(o).toggleMinimize())
1862
+ onClick: r[4] || (r[4] = (v) => w(o).toggleMinimize())
1823
1863
  }, [
1824
- w(o).activeCount > 0 ? (u(), M(C, {
1864
+ w(o).activeCount > 0 ? (u(), E(S, {
1825
1865
  key: 0,
1826
1866
  class: "spinning"
1827
1867
  }, {
1828
1868
  default: g(() => [
1829
- m(w(lt))
1869
+ m(w(it))
1830
1870
  ]),
1831
1871
  _: 1
1832
- })) : P("", !0),
1833
- T("span", null, D(w(o).panelSubtitle), 1),
1834
- w(o).runningCount > 0 ? (u(), M(O, {
1872
+ })) : b("", !0),
1873
+ T("span", null, B(w(o).panelSubtitle), 1),
1874
+ w(o).runningCount > 0 ? (u(), E(F, {
1835
1875
  key: 1,
1836
1876
  value: w(o).runningCount,
1837
1877
  class: "m-l-8"
1838
- }, null, 8, ["value"])) : P("", !0)
1878
+ }, null, 8, ["value"])) : b("", !0)
1839
1879
  ], 512), [
1840
- [De, w(o).panelVisible && w(o).panelMinimized]
1880
+ [Be, w(o).panelVisible && w(o).panelMinimized]
1841
1881
  ])
1842
1882
  ]);
1843
1883
  };
1844
1884
  }
1845
- }), qo = /* @__PURE__ */ Ee(Wo, [["__scopeId", "data-v-812b3127"]]), il = /* @__PURE__ */ de({
1885
+ }), Zo = /* @__PURE__ */ Me(Qo, [["__scopeId", "data-v-812b3127"]]), dl = /* @__PURE__ */ ue({
1846
1886
  __name: "AiTaskProvider",
1847
1887
  props: {
1848
1888
  title: {},
@@ -1865,10 +1905,10 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1865
1905
  },
1866
1906
  emits: ["finish", "use"],
1867
1907
  setup(e, { emit: n }) {
1868
- const t = e, o = n, s = Mt();
1869
- Be(bt, s), Be(xt, St(s));
1870
- const d = $(() => {
1871
- const y = {
1908
+ const t = e, o = n, l = $t();
1909
+ Ve(At, l), Ve(bt, kt(l));
1910
+ const y = P(() => {
1911
+ const p = {
1872
1912
  title: t.title,
1873
1913
  freeText: t.freeText,
1874
1914
  promptId: t.promptId,
@@ -1885,61 +1925,61 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1885
1925
  taskListButtonText: t.taskListButtonText,
1886
1926
  width: t.width
1887
1927
  };
1888
- return t.modelValue !== void 0 && (y.modelValue = t.modelValue), y;
1928
+ return t.modelValue !== void 0 && (p.modelValue = t.modelValue), p;
1889
1929
  });
1890
- let v;
1891
- function _(y) {
1892
- o("use", y);
1930
+ let c;
1931
+ function h(p) {
1932
+ o("use", p);
1893
1933
  }
1894
1934
  return Ke(() => {
1895
- s.hydrate(), v = s.onTaskFinish((y) => o("finish", y));
1896
- }), Ne(() => {
1897
- v == null || v();
1898
- }), (y, r) => (u(), A(re, null, [
1899
- e.showDialog !== !1 ? (u(), M(Eo, ft(ze({ key: 0 }, d.value)), null, 16)) : P("", !0),
1900
- m(qo, { onUse: _ }),
1901
- ye(y.$slots, "default")
1935
+ l.hydrate(), c = l.onTaskFinish((p) => o("finish", p));
1936
+ }), Ye(() => {
1937
+ c == null || c();
1938
+ }), (p, r) => (u(), A(ce, null, [
1939
+ e.showDialog !== !1 ? (u(), E(Do, mt(ze({ key: 0 }, y.value)), null, 16)) : b("", !0),
1940
+ m(Zo, { onUse: h }),
1941
+ Te(p.$slots, "default")
1902
1942
  ], 64));
1903
1943
  }
1904
1944
  });
1905
- function sl() {
1906
- const e = Ye(xt, null);
1907
- return e || St(We());
1945
+ function fl() {
1946
+ const e = je(bt, null);
1947
+ return e || kt(qe());
1908
1948
  }
1909
- function Ho() {
1910
- const e = b(!1), n = b({});
1949
+ function el() {
1950
+ const e = k(!1), n = k({});
1911
1951
  let t = null;
1912
- function o(_) {
1913
- t == null || t.resolve(_), t = null;
1952
+ function o(h) {
1953
+ t == null || t.resolve(h), t = null;
1914
1954
  }
1915
- function s() {
1955
+ function l() {
1916
1956
  t == null || t.reject(new be()), t = null;
1917
1957
  }
1918
- function d(_ = {}) {
1958
+ function y(h = {}) {
1919
1959
  t && (t.reject(new be()), t = null);
1920
- const y = new Promise((r, C) => {
1921
- t = { resolve: r, reject: C };
1960
+ const p = new Promise((r, S) => {
1961
+ t = { resolve: r, reject: S };
1922
1962
  });
1923
- return n.value = { ..._ }, e.value = !0, y;
1963
+ return n.value = { ...h }, e.value = !0, p;
1924
1964
  }
1925
- function v() {
1965
+ function c() {
1926
1966
  e.value = !1;
1927
1967
  }
1928
1968
  return {
1929
1969
  dialogVisible: e,
1930
1970
  dialogOptions: n,
1931
- openImageSelector: d,
1932
- closeImageSelector: v,
1971
+ openImageSelector: y,
1972
+ closeImageSelector: c,
1933
1973
  settlePendingConfirm: o,
1934
- settlePendingCancel: s
1974
+ settlePendingCancel: l
1935
1975
  };
1936
1976
  }
1937
- const Jo = "__YC_IMAGE_SELECTOR_CTX_KEY__";
1938
- function Xo(e) {
1977
+ const tl = "__YC_IMAGE_SELECTOR_CTX_KEY__";
1978
+ function nl(e) {
1939
1979
  const n = globalThis;
1940
1980
  return n[e] || (n[e] = Symbol(e)), n[e];
1941
1981
  }
1942
- const Pt = Xo(Jo), rl = /* @__PURE__ */ de({
1982
+ const Lt = nl(tl), pl = /* @__PURE__ */ ue({
1943
1983
  __name: "YcImageSelectorProvider",
1944
1984
  props: {
1945
1985
  modelValue: { type: [Boolean, null] },
@@ -1960,113 +2000,115 @@ const Pt = Xo(Jo), rl = /* @__PURE__ */ de({
1960
2000
  cancelText: { default: "取消" },
1961
2001
  emptyText: { default: "暂无图片资源" },
1962
2002
  renderEmpty: {},
2003
+ renderFooterExtra: {},
1963
2004
  getImages: {},
1964
2005
  upload: {},
1965
2006
  urlField: { default: "url" },
1966
2007
  showDialog: { type: Boolean, default: !0 }
1967
2008
  },
1968
2009
  setup(e, { expose: n }) {
1969
- const t = e, o = Ho(), {
1970
- dialogVisible: s,
1971
- dialogOptions: d,
1972
- openImageSelector: v,
1973
- closeImageSelector: _,
1974
- settlePendingConfirm: y,
2010
+ const t = e, o = el(), {
2011
+ dialogVisible: l,
2012
+ dialogOptions: y,
2013
+ openImageSelector: c,
2014
+ closeImageSelector: h,
2015
+ settlePendingConfirm: p,
1975
2016
  settlePendingCancel: r
1976
2017
  } = o;
1977
- Be(Pt, o);
1978
- function C(O, f) {
1979
- return O in d.value ? d.value[O] : f;
2018
+ Ve(Lt, o);
2019
+ function S(F, v) {
2020
+ return F in y.value ? y.value[F] : v;
1980
2021
  }
1981
- const V = $(() => ({
1982
- title: C("title", t.title),
1983
- multiple: C("multiple", t.multiple),
1984
- maxCount: C("maxCount", t.maxCount),
1985
- selected: C("selected", t.selected),
2022
+ const D = P(() => ({
2023
+ title: S("title", t.title),
2024
+ multiple: S("multiple", t.multiple),
2025
+ maxCount: S("maxCount", t.maxCount),
2026
+ selected: S("selected", t.selected),
1986
2027
  width: t.width,
1987
2028
  pageSize: t.pageSize,
1988
2029
  showUpload: t.showUpload,
1989
2030
  accept: t.accept,
1990
- showCategories: C("showCategories", t.showCategories),
1991
- categories: C("categories", t.categories),
1992
- categoryAllLabel: C("categoryAllLabel", t.categoryAllLabel),
1993
- showModeSwitch: C("showModeSwitch", t.showModeSwitch),
1994
- confirmOnSelect: C("confirmOnSelect", t.confirmOnSelect),
2031
+ showCategories: S("showCategories", t.showCategories),
2032
+ categories: S("categories", t.categories),
2033
+ categoryAllLabel: S("categoryAllLabel", t.categoryAllLabel),
2034
+ showModeSwitch: S("showModeSwitch", t.showModeSwitch),
2035
+ confirmOnSelect: S("confirmOnSelect", t.confirmOnSelect),
1995
2036
  confirmText: t.confirmText,
1996
2037
  cancelText: t.cancelText,
1997
2038
  emptyText: t.emptyText,
1998
2039
  renderEmpty: t.renderEmpty,
2040
+ renderFooterExtra: t.renderFooterExtra,
1999
2041
  getImages: t.getImages,
2000
2042
  upload: t.upload,
2001
2043
  urlField: t.urlField
2002
2044
  }));
2003
- function F(O) {
2004
- var f, L;
2005
- (L = (f = d.value).onConfirm) == null || L.call(f, O), y(O), _();
2045
+ function N(F) {
2046
+ var v, L;
2047
+ (L = (v = y.value).onConfirm) == null || L.call(v, F), p(F), h();
2006
2048
  }
2007
- function X() {
2008
- var O, f;
2009
- (f = (O = d.value).onCancel) == null || f.call(O), r(), _();
2049
+ function q() {
2050
+ var F, v;
2051
+ (v = (F = y.value).onCancel) == null || v.call(F), r(), h();
2010
2052
  }
2011
- return n({ openImageSelector: v, closeImageSelector: _ }), (O, f) => (u(), A(re, null, [
2012
- e.showDialog !== !1 ? (u(), M(Tt, ze({
2053
+ return n({ openImageSelector: c, closeImageSelector: h }), (F, v) => (u(), A(ce, null, [
2054
+ e.showDialog !== !1 ? (u(), E(Ct, ze({
2013
2055
  key: 0,
2014
- modelValue: w(s),
2015
- "onUpdate:modelValue": f[0] || (f[0] = (L) => Xt(s) ? s.value = L : null)
2016
- }, V.value, {
2017
- onConfirm: F,
2018
- onCancel: X
2019
- }), null, 16, ["modelValue"])) : P("", !0),
2020
- ye(O.$slots, "default")
2056
+ modelValue: w(l),
2057
+ "onUpdate:modelValue": v[0] || (v[0] = (L) => en(l) ? l.value = L : null)
2058
+ }, D.value, {
2059
+ onConfirm: N,
2060
+ onCancel: q
2061
+ }), null, 16, ["modelValue"])) : b("", !0),
2062
+ Te(F.$slots, "default")
2021
2063
  ], 64));
2022
2064
  }
2023
2065
  });
2024
- function ul() {
2025
- const e = Ye(Pt, null);
2066
+ function ml() {
2067
+ const e = je(Lt, null);
2026
2068
  return e ? {
2027
2069
  openImageSelector: (n = {}) => e.openImageSelector(n),
2028
2070
  closeImageSelector: () => e.closeImageSelector()
2029
2071
  } : {
2030
- openImageSelector: wt,
2031
- closeImageSelector: yt
2072
+ openImageSelector: It,
2073
+ closeImageSelector: Tt
2032
2074
  };
2033
2075
  }
2034
2076
  export {
2035
- qo as AiTaskPanel,
2036
- il as AiTaskProvider,
2037
- Eo as AiUseDialog,
2038
- Pt as IMAGE_SELECTOR_INJECT_KEY,
2039
- at as ImageSelectorAuthError,
2077
+ Zo as AiTaskPanel,
2078
+ dl as AiTaskProvider,
2079
+ Do as AiUseDialog,
2080
+ Lt as IMAGE_SELECTOR_INJECT_KEY,
2081
+ st as ImageSelectorAuthError,
2040
2082
  be as ImageSelectorCancelledError,
2041
- Tt as ImageSelectorDialog,
2042
- rl as ImageSelectorProvider,
2043
- rt as SkyPageWindow,
2044
- qo as YcAiTaskPanel,
2045
- il as YcAiTaskProvider,
2046
- Eo as YcAiUseDialog,
2047
- ll as YcComponent,
2048
- Tt as YcImageSelectorDialog,
2049
- rl as YcImageSelectorProvider,
2050
- rt as YcPageWindow,
2051
- yt as closeImageSelector,
2052
- Ho as createImageSelectorApi,
2053
- ll as default,
2054
- jn as fetchImages,
2055
- vt as getAiTaskConfig,
2083
+ Ct as ImageSelectorDialog,
2084
+ pl as ImageSelectorProvider,
2085
+ ct as SkyPageWindow,
2086
+ Zo as YcAiTaskPanel,
2087
+ dl as YcAiTaskProvider,
2088
+ Do as YcAiUseDialog,
2089
+ ul as YcComponent,
2090
+ Ct as YcImageSelectorDialog,
2091
+ pl as YcImageSelectorProvider,
2092
+ ct as YcPageWindow,
2093
+ Tt as closeImageSelector,
2094
+ el as createImageSelectorApi,
2095
+ ul as default,
2096
+ Jn as fetchImages,
2097
+ ht as getAiTaskConfig,
2056
2098
  Ae as getImageSelectorConfig,
2057
- Ct as hideAiDialog,
2058
- _t as hideImageSelectorDialog,
2059
- Hn as installImageSelector,
2060
- no as installYcComponent,
2061
- ko as listPrompts,
2062
- al as openAiUseDialog,
2063
- wt as openImageSelector,
2064
- dn as setAiTaskConfig,
2065
- gn as setImageSelectorConfig,
2066
- Ge as showAiDialog,
2067
- yn as showImageSelectorDialog,
2068
- Gn as uploadImage,
2069
- sl as useAiTask,
2070
- Mt as useAiTaskStore,
2071
- ul as useImageSelector
2099
+ xt as hideAiDialog,
2100
+ wt as hideImageSelectorDialog,
2101
+ eo as installImageSelector,
2102
+ so as installYcComponent,
2103
+ Mo as listPrompts,
2104
+ cl as openAiUseDialog,
2105
+ It as openImageSelector,
2106
+ mn as setAiTaskConfig,
2107
+ hn as setImageSelectorConfig,
2108
+ We as showAiDialog,
2109
+ In as showImageSelectorDialog,
2110
+ Xn as uploadImage,
2111
+ fl as useAiTask,
2112
+ $t as useAiTaskStore,
2113
+ ml as useImageSelector
2072
2114
  };