@skopon-cool/form-sdk 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +94 -9
  2. package/dist/adapter/a2uiAdapter.d.ts +1 -0
  3. package/dist/adapter/a2uiAdapter.d.ts.map +1 -1
  4. package/dist/adapter/formSchema.d.ts +2 -1
  5. package/dist/adapter/formSchema.d.ts.map +1 -1
  6. package/dist/catalog/a2uiCustomCatalog.d.ts.map +1 -1
  7. package/dist/client/apiEnvelope.d.ts +7 -0
  8. package/dist/client/apiEnvelope.d.ts.map +1 -0
  9. package/dist/client/authStorage.d.ts +24 -0
  10. package/dist/client/authStorage.d.ts.map +1 -0
  11. package/dist/client/caseSearchClient.d.ts +11 -0
  12. package/dist/client/caseSearchClient.d.ts.map +1 -0
  13. package/dist/client/formClient.d.ts +2 -2
  14. package/dist/client/formClient.d.ts.map +1 -1
  15. package/dist/client/resumeSearchClient.d.ts +9 -0
  16. package/dist/client/resumeSearchClient.d.ts.map +1 -0
  17. package/dist/client/skoponSdkClients.d.ts +22 -0
  18. package/dist/client/skoponSdkClients.d.ts.map +1 -0
  19. package/dist/components/AskUserFormCard.d.ts +3 -1
  20. package/dist/components/AskUserFormCard.d.ts.map +1 -1
  21. package/dist/components/CurlSubmitBlock.d.ts +3 -1
  22. package/dist/components/CurlSubmitBlock.d.ts.map +1 -1
  23. package/dist/index.d.ts +6 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1191 -820
  26. package/dist/submit/buildAnswerAgentBody.d.ts +19 -0
  27. package/dist/submit/buildAnswerAgentBody.d.ts.map +1 -0
  28. package/dist/submit/submitAnswerAgent.d.ts +9 -0
  29. package/dist/submit/submitAnswerAgent.d.ts.map +1 -0
  30. package/dist/submit/validateFormSubmit.d.ts +10 -0
  31. package/dist/submit/validateFormSubmit.d.ts.map +1 -0
  32. package/package.json +1 -1
  33. package/src/adapter/a2uiAdapter.ts +1 -1
  34. package/src/adapter/formSchema.test.ts +24 -0
  35. package/src/adapter/formSchema.ts +9 -2
  36. package/src/adapter/resolveSurface.ts +3 -3
  37. package/src/catalog/a2uiCustomCatalog.tsx +35 -3
  38. package/src/catalog/textFieldPreview.test.tsx +31 -0
  39. package/src/client/apiEnvelope.ts +21 -0
  40. package/src/client/authStorage.test.ts +87 -0
  41. package/src/client/authStorage.ts +102 -0
  42. package/src/client/caseSearchClient.ts +107 -0
  43. package/src/client/formClient.test.ts +25 -0
  44. package/src/client/formClient.ts +7 -25
  45. package/src/client/resumeSearchClient.test.ts +87 -0
  46. package/src/client/resumeSearchClient.ts +108 -0
  47. package/src/client/skoponSdkClients.ts +51 -0
  48. package/src/components/AskUserFormCard.tsx +45 -11
  49. package/src/components/CurlSubmitBlock.tsx +73 -25
  50. package/src/index.ts +32 -0
  51. package/src/submit/buildAnswerAgentBody.ts +61 -0
  52. package/src/submit/submit.test.ts +115 -0
  53. package/src/submit/submitAnswerAgent.ts +39 -0
  54. package/src/submit/validateFormSubmit.ts +111 -0
  55. package/dist/catalog/skoponSelectLoading.test.d.ts +0 -2
  56. package/dist/catalog/skoponSelectLoading.test.d.ts.map +0 -1
  57. package/dist/catalog/textFieldPreview.test.d.ts +0 -2
  58. package/dist/catalog/textFieldPreview.test.d.ts.map +0 -1
  59. package/dist/components/SkoponA2uiStreamRenderer.test.d.ts +0 -2
  60. package/dist/components/SkoponA2uiStreamRenderer.test.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,31 +1,31 @@
1
1
  import './form-sdk.css';
2
- import { jsx as l, jsxs as C } from "react/jsx-runtime";
3
- import { createContext as we, useContext as Le, useCallback as te, useSyncExternalStore as It, useMemo as V, useState as P, useRef as L, useEffect as B, forwardRef as Ft, useImperativeHandle as Pt } from "react";
4
- import { Spin as je, Button as ge, Typography as H, Avatar as zt, Tag as re, Select as Ue, Checkbox as Ut, Radio as _t, Switch as Et, TimePicker as Rt, DatePicker as Bt, Upload as ke, Input as Ae, InputNumber as Ot, ConfigProvider as Vt, Tooltip as ne } from "antd";
5
- import { ReloadOutlined as Ze, FileTextOutlined as et, UserOutlined as qt, FileImageOutlined as wt, FileExcelOutlined as Lt, FileOutlined as tt, PictureOutlined as jt, SoundOutlined as $t, VideoCameraOutlined as Dt } from "@ant-design/icons";
6
- import { createBinderlessComponentImplementation as q, basicCatalog as de, A2uiSurface as nt } from "@a2ui/react/v0_9";
2
+ import { jsx as l, jsxs as I } from "react/jsx-runtime";
3
+ import { createContext as De, useContext as He, useCallback as te, useSyncExternalStore as Gt, useMemo as B, useState as F, useRef as j, useEffect as R, forwardRef as Jt, useImperativeHandle as Yt } from "react";
4
+ import { Spin as Ke, Button as be, Typography as L, Avatar as Wt, Tag as re, Select as we, Checkbox as Xt, Radio as Qt, Switch as Zt, TimePicker as en, DatePicker as tn, Upload as _e, Input as Me, InputNumber as nn, ConfigProvider as rn, Tooltip as ne } from "antd";
5
+ import { ReloadOutlined as pt, FileTextOutlined as ft, UserOutlined as on, FileImageOutlined as an, FileExcelOutlined as sn, FileOutlined as ht, PictureOutlined as ln, SoundOutlined as cn, VideoCameraOutlined as un } from "@ant-design/icons";
6
+ import { createBinderlessComponentImplementation as O, basicCatalog as fe, A2uiSurface as gt } from "@a2ui/react/v0_9";
7
7
  import { z as f } from "zod";
8
- import { Catalog as Ht, MessageProcessor as rt } from "@a2ui/web_core/v0_9";
9
- import { injectBasicCatalogStyles as ot } from "@a2ui/web_core/v0_9/basic_catalog";
10
- import { injectStyles as it } from "@a2ui/react/styles";
11
- import Ge from "dayjs";
12
- const so = "v0.9", Kt = [
8
+ import { Catalog as mn, MessageProcessor as yt } from "@a2ui/web_core/v0_9";
9
+ import { injectBasicCatalogStyles as vt } from "@a2ui/web_core/v0_9/basic_catalog";
10
+ import { injectStyles as bt } from "@a2ui/react/styles";
11
+ import at from "dayjs";
12
+ const Lo = "v0.9", dn = [
13
13
  "huge",
14
14
  "large",
15
15
  "medium",
16
16
  "small",
17
17
  "icon"
18
18
  ];
19
- function _e(e) {
19
+ function he(e) {
20
20
  return e === "image" || e === "video" || e === "audio";
21
21
  }
22
- function $e(e) {
22
+ function Se(e) {
23
23
  return e === "heading" || e === "paragraph";
24
24
  }
25
- function W(e) {
26
- return !$e(e) && !_e(e);
25
+ function Y(e) {
26
+ return !Se(e) && !he(e);
27
27
  }
28
- function Gt() {
28
+ function pn() {
29
29
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
30
30
  return crypto.randomUUID();
31
31
  if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") {
@@ -40,10 +40,10 @@ function Gt() {
40
40
  });
41
41
  }
42
42
  function ie(e) {
43
- const t = Gt().replace(/-/g, "").slice(0, 8);
43
+ const t = pn().replace(/-/g, "").slice(0, 8);
44
44
  return `${e}${t}`;
45
45
  }
46
- const at = [
46
+ const St = [
47
47
  { value: "image/*", label: "图片" },
48
48
  { value: "video/*", label: "视频" },
49
49
  { value: "audio/*", label: "音频" },
@@ -54,7 +54,7 @@ const at = [
54
54
  { value: "text/plain", label: "纯文本" },
55
55
  { value: "application/zip", label: "ZIP 压缩包" },
56
56
  { value: "application/x-rar-compressed", label: "RAR 压缩包" }
57
- ], Jt = {
57
+ ], fn = {
58
58
  "image/*": ["image/*"],
59
59
  "video/*": ["video/*"],
60
60
  "audio/*": ["audio/*"],
@@ -74,7 +74,7 @@ const at = [
74
74
  "text/plain": ["text/plain"],
75
75
  "application/zip": ["application/zip"],
76
76
  "application/x-rar-compressed": ["application/x-rar-compressed"]
77
- }, Yt = {
77
+ }, hn = {
78
78
  "image/*": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg"],
79
79
  "video/*": [".mp4", ".mov", ".avi", ".webm"],
80
80
  "audio/*": [".mp3", ".wav", ".ogg", ".m4a"],
@@ -85,14 +85,14 @@ const at = [
85
85
  "text/plain": [".txt"],
86
86
  "application/zip": [".zip", ".7z"],
87
87
  "application/x-rar-compressed": [".rar"]
88
- }, Xt = {
88
+ }, gn = {
89
89
  "application/msword": "office/word",
90
90
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "office/word",
91
91
  "application/vnd.ms-excel": "office/excel",
92
92
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "office/excel",
93
93
  "application/vnd.ms-powerpoint": "office/ppt",
94
94
  "application/vnd.openxmlformats-officedocument.presentationml.presentation": "office/ppt"
95
- }, De = [
95
+ }, Ge = [
96
96
  { value: ".jpg", label: ".jpg" },
97
97
  { value: ".jpeg", label: ".jpeg" },
98
98
  { value: ".png", label: ".png" },
@@ -118,18 +118,18 @@ const at = [
118
118
  { value: ".zip", label: ".zip" },
119
119
  { value: ".rar", label: ".rar" },
120
120
  { value: ".7z", label: ".7z" }
121
- ], Wt = Object.fromEntries(
122
- at.map((e) => [e.value, e.label])
123
- ), Qt = Object.fromEntries(
124
- De.map((e) => [e.value, e.label])
125
- ), Zt = new Set(at.map((e) => e.value)), en = new Set(
126
- De.map((e) => e.value)
121
+ ], yn = Object.fromEntries(
122
+ St.map((e) => [e.value, e.label])
123
+ ), vn = Object.fromEntries(
124
+ Ge.map((e) => [e.value, e.label])
125
+ ), bn = new Set(St.map((e) => e.value)), Sn = new Set(
126
+ Ge.map((e) => e.value)
127
127
  );
128
- function tn(e) {
128
+ function kn(e) {
129
129
  const t = e.trim();
130
- return t ? Zt.has(t) ? t : Xt[t] ?? null : null;
130
+ return t ? bn.has(t) ? t : gn[t] ?? null : null;
131
131
  }
132
- function nn(e) {
132
+ function Cn(e) {
133
133
  return Array.isArray(e) ? e.map((t) => {
134
134
  const n = t.trim().toLowerCase();
135
135
  return n ? n.startsWith(".") ? n : `.${n}` : "";
@@ -139,100 +139,103 @@ function ae(e) {
139
139
  if (!Array.isArray(e)) return [];
140
140
  const t = [], n = /* @__PURE__ */ new Set();
141
141
  for (const r of e) {
142
- const o = tn(r);
142
+ const o = kn(r);
143
143
  o && !n.has(o) && (n.add(o), t.push(o));
144
144
  }
145
145
  return t;
146
146
  }
147
- function rn(e) {
147
+ function xn(e) {
148
148
  const t = ae(e), n = [];
149
149
  for (const r of t)
150
- n.push(...Jt[r] ?? [r]);
150
+ n.push(...fn[r] ?? [r]);
151
151
  return n;
152
152
  }
153
- function on(e) {
153
+ function An(e) {
154
154
  const t = ae(e);
155
155
  if (t.length === 0) return [];
156
156
  const n = /* @__PURE__ */ new Set();
157
157
  for (const r of t)
158
- for (const o of Yt[r] ?? [])
158
+ for (const o of hn[r] ?? [])
159
159
  n.add(o);
160
- return De.filter((r) => n.has(r.value));
160
+ return Ge.filter((r) => n.has(r.value));
161
161
  }
162
- function He(e, t) {
163
- const n = nn(t), r = ae(e);
162
+ function Je(e, t) {
163
+ const n = Cn(t), r = ae(e);
164
164
  if (r.length === 0)
165
- return n.filter((i) => en.has(i));
165
+ return n.filter((i) => Sn.has(i));
166
166
  const o = new Set(
167
- on(r).map((i) => i.value)
167
+ An(r).map((i) => i.value)
168
168
  );
169
169
  return n.filter((i) => o.has(i));
170
170
  }
171
- function an(e, t) {
172
- const n = rn(e), r = He(e, t), o = [...n, ...r];
171
+ function Tn(e, t) {
172
+ const n = xn(e), r = Je(e, t), o = [...n, ...r];
173
173
  return o.length > 0 ? o.join(",") : void 0;
174
174
  }
175
- function ln(e, t) {
176
- const n = ae(e), r = He(
175
+ function In(e, t) {
176
+ const n = ae(e), r = Je(
177
177
  n,
178
178
  t
179
179
  ), o = [
180
- ...n.map((i) => Wt[i] ?? i),
181
- ...r.map((i) => Qt[i] ?? i)
180
+ ...n.map((i) => yn[i] ?? i),
181
+ ...r.map((i) => vn[i] ?? i)
182
182
  ];
183
183
  return o.length === 0 ? null : o.join("、");
184
184
  }
185
- const sn = [
185
+ const _n = [
186
186
  "video",
187
187
  "audio",
188
188
  "image",
189
189
  "file",
190
190
  "spreadsheet",
191
191
  "document"
192
- ], cn = new Set(sn);
193
- function un(e) {
194
- return e && cn.has(e) ? e : "file";
192
+ ], Mn = new Set(_n);
193
+ function Nn(e) {
194
+ return e && Mn.has(e) ? e : "file";
195
195
  }
196
- function le(e) {
197
- return typeof e == "string" && Kt.includes(e) ? e : "medium";
196
+ function se(e) {
197
+ return typeof e == "string" && dn.includes(e) ? e : "medium";
198
198
  }
199
- function pn(e, t) {
199
+ function Fn(e, t) {
200
200
  var o;
201
201
  const n = Math.max(1, t);
202
202
  let r = [];
203
203
  return Array.isArray(e.mediaUrls) ? r = e.mediaUrls.map((i) => String(i).trim()) : (o = e.mediaUrl) != null && o.trim() && (r = [e.mediaUrl.trim()]), r.length === 0 ? [""] : r.slice(0, n);
204
204
  }
205
- function dn(e) {
205
+ function Un(e) {
206
206
  var t;
207
207
  return Array.isArray(e.mediaUrls) ? e.mediaUrls.map((n) => n.trim()).filter(Boolean) : (t = e.mediaUrl) != null && t.trim() ? [e.mediaUrl.trim()] : [];
208
208
  }
209
- function mn(e) {
210
- return `form-media-size-${le(e)}`;
209
+ function Pn(e) {
210
+ return `form-media-size-${se(e)}`;
211
211
  }
212
- function fn(e) {
213
- return `form-media-preview form-media-list ${mn(e)}`;
212
+ function En(e) {
213
+ return `form-media-preview form-media-list ${Pn(e)}`;
214
214
  }
215
- const hn = 10;
216
- function ye(e) {
215
+ const zn = 10;
216
+ function Ye(e) {
217
+ return e && typeof e == "object" && !Array.isArray(e) ? e : {};
218
+ }
219
+ function le(e) {
217
220
  return e === !0 || e === "true" || e === 1 || e === "1";
218
221
  }
219
- function Je(e, t = 1) {
222
+ function st(e, t = 1) {
220
223
  const n = typeof e == "number" ? e : Number(e);
221
224
  return Number.isFinite(n) ? Math.max(0, Math.floor(n)) : t;
222
225
  }
223
- function ce(e, t = 1) {
226
+ function me(e, t = 1) {
224
227
  const n = typeof e == "number" ? e : Number(e);
225
228
  return Number.isFinite(n) ? Math.max(1, Math.floor(n)) : t;
226
229
  }
227
- function gn(e, t) {
230
+ function Rn(e, t) {
228
231
  if (t !== void 0)
229
- return e === "toggle" ? ye(t) : e === "multiselect" || e === "checkbox" || e === "resume_multiselect" || e === "case_multiselect" ? Array.isArray(t) ? t.map(String) : typeof t == "string" && t ? [t] : [] : typeof t == "boolean" ? t ? "true" : "false" : Array.isArray(t) ? t.map(String) : String(t);
232
+ return e === "toggle" ? le(t) : e === "multiselect" || e === "checkbox" || e === "resume_multiselect" || e === "case_multiselect" ? Array.isArray(t) ? t.map(String) : typeof t == "string" && t ? [t] : [] : typeof t == "boolean" ? t ? "true" : "false" : Array.isArray(t) ? t.map(String) : String(t);
230
233
  }
231
- function yn(e) {
234
+ function Bn(e) {
232
235
  const t = typeof (e == null ? void 0 : e.pageSize) == "number" ? e.pageSize : Number(e == null ? void 0 : e.pageSize), n = Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20, r = typeof (e == null ? void 0 : e.agentKind) == "string" && e.agentKind.trim() ? e.agentKind.trim() : void 0, o = typeof (e == null ? void 0 : e.agentUniqueId) == "string" && e.agentUniqueId.trim() ? e.agentUniqueId.trim() : void 0, i = typeof (e == null ? void 0 : e.flowType) == "string" && e.flowType.trim() ? e.flowType.trim() : void 0, a = typeof (e == null ? void 0 : e.category) == "string" && e.category.trim() ? e.category.trim() : void 0, s = Array.isArray(e == null ? void 0 : e.flowUniqueIds) ? e.flowUniqueIds.map(String).filter(Boolean) : [];
233
236
  return { agentKind: r, agentUniqueId: o, flowType: i, category: a, flowUniqueIds: s, pageSize: n };
234
237
  }
235
- function vn(e) {
238
+ function wn(e) {
236
239
  const t = typeof (e == null ? void 0 : e.pageSize) == "number" ? e.pageSize : Number(e == null ? void 0 : e.pageSize), n = Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20;
237
240
  return {
238
241
  names: Array.isArray(e == null ? void 0 : e.names) ? e.names.map(String).filter(Boolean) : [],
@@ -241,14 +244,14 @@ function vn(e) {
241
244
  pageSize: n
242
245
  };
243
246
  }
244
- function bn(e) {
247
+ function qn(e) {
245
248
  if (e.type !== "case_singleselect") return e;
246
249
  const t = typeof e.defaultValue == "string" && e.defaultValue.trim() ? [e.defaultValue.trim()] : Array.isArray(e.defaultValue) ? e.defaultValue.map(String).filter(Boolean) : [];
247
250
  return { ...e, type: "case_multiselect", defaultValue: t };
248
251
  }
249
- function Sn(e) {
252
+ function On(e) {
250
253
  var o, i;
251
- const t = bn(e), n = ae(t.fileAcceptTypes), r = t.type;
254
+ const t = qn(e), n = ae(t.fileAcceptTypes), r = t.type;
252
255
  return {
253
256
  id: ((o = t.id) == null ? void 0 : o.trim()) || ie("block-"),
254
257
  type: r,
@@ -257,17 +260,17 @@ function Sn(e) {
257
260
  placeholder: t.placeholder ?? "",
258
261
  help: t.help ?? "",
259
262
  required: t.required === !0,
260
- mediaUrls: _e(r) ? pn(t, hn) : void 0,
261
- mediaSize: _e(r) ? le(t.mediaSize) : void 0,
263
+ mediaUrls: he(r) ? Fn(t, zn) : void 0,
264
+ mediaSize: he(r) ? se(t.mediaSize) : void 0,
262
265
  fileAcceptTypes: n,
263
- fileAcceptExtensions: He(
266
+ fileAcceptExtensions: Je(
264
267
  n,
265
268
  t.fileAcceptExtensions
266
269
  ),
267
- filePlaceholderIcon: un(t.filePlaceholderIcon),
268
- fileMinCount: r === "file" ? Je(t.fileMinCount, 1) : void 0,
269
- fileMaxCount: r === "file" ? Je(t.fileMaxCount, 1) : void 0,
270
- defaultValue: gn(r, t.defaultValue),
270
+ filePlaceholderIcon: Nn(t.filePlaceholderIcon),
271
+ fileMinCount: r === "file" ? st(t.fileMinCount, 1) : void 0,
272
+ fileMaxCount: r === "file" ? st(t.fileMaxCount, 1) : void 0,
273
+ defaultValue: Rn(r, t.defaultValue),
271
274
  options: Array.isArray(t.options) ? t.options.map((a, s) => {
272
275
  var c, u;
273
276
  return {
@@ -276,16 +279,16 @@ function Sn(e) {
276
279
  };
277
280
  }) : void 0,
278
281
  resumeEnableRefresh: r === "resume_multiselect" ? t.resumeEnableRefresh !== !1 : void 0,
279
- resumeMinCount: r === "resume_multiselect" && t.resumeMinCount != null ? ce(t.resumeMinCount, 1) : void 0,
280
- resumeMaxCount: r === "resume_multiselect" && t.resumeMaxCount != null ? ce(t.resumeMaxCount, 1) : void 0,
281
- resumeFilter: r === "resume_multiselect" ? vn(t.resumeFilter) : void 0,
282
+ resumeMinCount: r === "resume_multiselect" && t.resumeMinCount != null ? me(t.resumeMinCount, 1) : void 0,
283
+ resumeMaxCount: r === "resume_multiselect" && t.resumeMaxCount != null ? me(t.resumeMaxCount, 1) : void 0,
284
+ resumeFilter: r === "resume_multiselect" ? wn(t.resumeFilter) : void 0,
282
285
  caseEnableRefresh: r === "case_multiselect" ? t.caseEnableRefresh !== !1 : void 0,
283
- caseMinCount: r === "case_multiselect" && t.caseMinCount != null ? ce(t.caseMinCount, 1) : void 0,
284
- caseMaxCount: r === "case_multiselect" && t.caseMaxCount != null ? ce(t.caseMaxCount, 1) : void 0,
285
- caseFilter: r === "case_multiselect" ? yn(t.caseFilter) : void 0
286
+ caseMinCount: r === "case_multiselect" && t.caseMinCount != null ? me(t.caseMinCount, 1) : void 0,
287
+ caseMaxCount: r === "case_multiselect" && t.caseMaxCount != null ? me(t.caseMaxCount, 1) : void 0,
288
+ caseFilter: r === "case_multiselect" ? Bn(t.caseFilter) : void 0
286
289
  };
287
290
  }
288
- function me(e) {
291
+ function ge(e) {
289
292
  return {
290
293
  title: e.title ?? "",
291
294
  description: e.description ?? "",
@@ -293,18 +296,18 @@ function me(e) {
293
296
  jsonSchema: e.jsonSchema ?? {}
294
297
  };
295
298
  }
296
- function Z(e) {
299
+ function W(e) {
297
300
  if (!e || !Array.isArray(e.blocks))
298
- return me({ title: "", description: "", blocks: [], jsonSchema: {} });
299
- const t = e.blocks.map(Sn);
300
- return me({
301
+ return ge({ title: "", description: "", blocks: [], jsonSchema: {} });
302
+ const t = e.blocks.map(On);
303
+ return ge({
301
304
  title: typeof e.title == "string" ? e.title : "",
302
305
  description: typeof e.description == "string" ? e.description : "",
303
306
  blocks: t,
304
- jsonSchema: {}
307
+ jsonSchema: Ye(e.jsonSchema)
305
308
  });
306
309
  }
307
- function xn(e) {
310
+ function jn(e) {
308
311
  const t = typeof e.pageSize == "number" ? e.pageSize : Number(e.pageSize), n = typeof e.agentKind == "string" && e.agentKind.trim() ? e.agentKind.trim() : void 0, r = typeof e.agentUniqueId == "string" && e.agentUniqueId.trim() ? e.agentUniqueId.trim() : void 0, o = typeof e.flowType == "string" && e.flowType.trim() ? e.flowType.trim() : void 0, i = typeof e.category == "string" && e.category.trim() ? e.category.trim() : void 0, a = Array.isArray(e.flowUniqueIds) ? e.flowUniqueIds.map(String).filter(Boolean) : [];
309
312
  return {
310
313
  agentKind: n,
@@ -315,14 +318,14 @@ function xn(e) {
315
318
  pageSize: Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20
316
319
  };
317
320
  }
318
- function Ye(e) {
321
+ function lt(e) {
319
322
  if (e == null) return;
320
323
  const t = typeof e == "number" ? e : Number(e);
321
324
  if (!(!Number.isFinite(t) || t < 1))
322
325
  return Math.floor(t);
323
326
  }
324
- function Cn(e, t) {
325
- var a, s, c, u, d, p;
327
+ function Vn(e, t) {
328
+ var a, s, c, u, d, m;
326
329
  const { id: n, label: r, path: o, withData: i } = t;
327
330
  return i({
328
331
  id: n,
@@ -337,14 +340,14 @@ function Cn(e, t) {
337
340
  flowType: (c = e.caseFilter) == null ? void 0 : c.flowType,
338
341
  category: (u = e.caseFilter) == null ? void 0 : u.category,
339
342
  flowUniqueIds: ((d = e.caseFilter) == null ? void 0 : d.flowUniqueIds) ?? [],
340
- pageSize: ((p = e.caseFilter) == null ? void 0 : p.pageSize) ?? 20
343
+ pageSize: ((m = e.caseFilter) == null ? void 0 : m.pageSize) ?? 20
341
344
  },
342
345
  ...e.caseMinCount !== void 0 ? { minCount: e.caseMinCount } : {},
343
346
  ...e.caseMaxCount !== void 0 ? { maxCount: e.caseMaxCount } : {},
344
347
  value: { path: o }
345
348
  });
346
349
  }
347
- function kn(e, t, n) {
350
+ function Ln(e, t, n) {
348
351
  const r = n.nameFromValue(e.value), o = {
349
352
  ...t("case_multiselect"),
350
353
  name: r,
@@ -352,32 +355,32 @@ function kn(e, t, n) {
352
355
  }, i = n.asLiteral(e.placeholder);
353
356
  i && (o.placeholder = i);
354
357
  const a = n.asLiteral(e.help);
355
- a && (o.help = a), e.caseFilter && typeof e.caseFilter == "object" && (o.caseFilter = xn(e.caseFilter));
356
- const s = Ye(e.minCount);
358
+ a && (o.help = a), e.caseFilter && typeof e.caseFilter == "object" && (o.caseFilter = jn(e.caseFilter));
359
+ const s = lt(e.minCount);
357
360
  s !== void 0 && (o.caseMinCount = s);
358
- const c = Ye(e.maxCount);
361
+ const c = lt(e.maxCount);
359
362
  return c !== void 0 && (o.caseMaxCount = c), o;
360
363
  }
361
- const lt = we({ interactive: !0 });
362
- function Ee({
364
+ const kt = De({ interactive: !0 });
365
+ function qe({
363
366
  interactive: e,
364
367
  children: t
365
368
  }) {
366
- return /* @__PURE__ */ l(lt.Provider, { value: { interactive: e }, children: t });
369
+ return /* @__PURE__ */ l(kt.Provider, { value: { interactive: e }, children: t });
367
370
  }
368
- function K() {
369
- return Le(lt);
371
+ function H() {
372
+ return He(kt);
370
373
  }
371
- function st(e) {
374
+ function Ct(e) {
372
375
  return e && typeof e == "object" && "path" in e && String(e.path ?? "").trim() || null;
373
376
  }
374
- function Xe(e, t = "value") {
377
+ function ct(e, t = "value") {
375
378
  const r = e.componentModel.properties[t];
376
- if (!(!st(r) || r === void 0))
379
+ if (!(!Ct(r) || r === void 0))
377
380
  return e.dataContext.resolveDynamicValue(r);
378
381
  }
379
- function G(e, t = "value") {
380
- const r = e.componentModel.properties[t], o = st(r), i = te(
382
+ function K(e, t = "value") {
383
+ const r = e.componentModel.properties[t], o = Ct(r), i = te(
381
384
  (u) => {
382
385
  if (!o || r === void 0) return () => {
383
386
  };
@@ -388,7 +391,7 @@ function G(e, t = "value") {
388
391
  ), a = te(() => {
389
392
  if (!(!o || r === void 0))
390
393
  return e.dataContext.resolveDynamicValue(r);
391
- }, [e, r, o]), s = It(i, a, a), c = te(
394
+ }, [e, r, o]), s = Gt(i, a, a), c = te(
392
395
  (u) => {
393
396
  !o || !r || typeof r != "object" || !("path" in r) || e.dataContext.set(String(r.path), u);
394
397
  },
@@ -400,61 +403,61 @@ function oe(e) {
400
403
  if (typeof e == "string") return e || void 0;
401
404
  if (typeof e == "number") return String(e);
402
405
  }
403
- function $(e) {
406
+ function q(e) {
404
407
  return Array.isArray(e) ? e.map(String) : typeof e == "string" && e ? [e] : [];
405
408
  }
406
- function ct(e, t) {
407
- return t ? Array.isArray(e) ? null : $(e) : Array.isArray(e) ? e.length > 0 ? String(e[0]) : "" : e == null || typeof e == "string" || typeof e == "number" ? null : "";
409
+ function xt(e, t) {
410
+ return t ? Array.isArray(e) ? null : q(e) : Array.isArray(e) ? e.length > 0 ? String(e[0]) : "" : e == null || typeof e == "string" || typeof e == "number" ? null : "";
408
411
  }
409
- function fe(e) {
412
+ function ye(e) {
410
413
  if (e == null) return;
411
414
  const t = typeof e == "number" ? e : Number(e);
412
415
  if (!(!Number.isFinite(t) || t < 1))
413
416
  return Math.floor(t);
414
417
  }
415
- function ut(e, t, n, r) {
418
+ function At(e, t, n, r) {
416
419
  if (e.includes(t)) {
417
420
  const i = e.filter((a) => a !== t);
418
421
  return n !== void 0 && i.length < n ? null : i;
419
422
  }
420
423
  return r !== void 0 && e.length >= r ? null : [...e, t];
421
424
  }
422
- function pt(e, t, n, r, o) {
425
+ function Tt(e, t, n, r, o) {
423
426
  if (!n) return !0;
424
427
  const i = e.includes(t);
425
428
  return !!(!i && o !== void 0 && e.length >= o || i && r !== void 0 && e.length <= r);
426
429
  }
427
- function dt(e, t) {
430
+ function It(e, t) {
428
431
  return t === void 0 || e.length <= t ? null : e.slice(0, t);
429
432
  }
430
- const mt = we(null);
431
- function Re({
433
+ const _t = De(null);
434
+ function Oe({
432
435
  caseSearch: e,
433
436
  children: t
434
437
  }) {
435
- return /* @__PURE__ */ l(mt.Provider, { value: e ?? null, children: t });
438
+ return /* @__PURE__ */ l(_t.Provider, { value: e ?? null, children: t });
436
439
  }
437
- function An() {
438
- return Le(mt);
440
+ function $n() {
441
+ return He(_t);
439
442
  }
440
- function Te(e) {
443
+ function Ne(e) {
441
444
  return typeof e == "string" ? e : "";
442
445
  }
443
- function Me(e) {
446
+ function Fe(e) {
444
447
  if (!e || typeof e != "object")
445
448
  return { flowUniqueIds: [], pageSize: 20 };
446
449
  const t = e, n = typeof t.pageSize == "number" ? t.pageSize : Number(t.pageSize), r = Number.isFinite(n) && n >= 1 && n <= 100 ? Math.floor(n) : 20, o = typeof t.agentKind == "string" && t.agentKind.trim() ? t.agentKind.trim() : void 0, i = typeof t.agentUniqueId == "string" && t.agentUniqueId.trim() ? t.agentUniqueId.trim() : void 0, a = typeof t.flowType == "string" && t.flowType.trim() ? t.flowType.trim() : void 0, s = typeof t.category == "string" && t.category.trim() ? t.category.trim() : void 0, c = Array.isArray(t.flowUniqueIds) ? t.flowUniqueIds.map(String).filter(Boolean) : [];
447
450
  return { agentKind: o, agentUniqueId: i, flowType: a, category: s, flowUniqueIds: c, pageSize: r };
448
451
  }
449
- function Ne(e) {
452
+ function Ue(e) {
450
453
  var r;
451
454
  const t = !!((r = e.flowUniqueIds) != null && r.length), n = !!(e.agentUniqueId && e.flowType && e.category);
452
455
  return t || n;
453
456
  }
454
- function Tn(e) {
457
+ function Dn(e) {
455
458
  return JSON.stringify(e);
456
459
  }
457
- const Mn = {
460
+ const Hn = {
458
461
  name: "SkoponCaseSelect",
459
462
  schema: f.object({
460
463
  label: f.any().optional(),
@@ -467,13 +470,13 @@ const Mn = {
467
470
  value: f.any().optional()
468
471
  }).passthrough()
469
472
  };
470
- function Nn({
473
+ function Kn({
471
474
  item: e,
472
475
  selected: t,
473
476
  disabled: n,
474
477
  onToggle: r
475
478
  }) {
476
- return /* @__PURE__ */ C(
479
+ return /* @__PURE__ */ I(
477
480
  "button",
478
481
  {
479
482
  type: "button",
@@ -481,11 +484,11 @@ function Nn({
481
484
  disabled: n,
482
485
  onClick: r,
483
486
  children: [
484
- /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-avatar", children: /* @__PURE__ */ l(et, { style: { fontSize: 24, color: "var(--color-primary, #208368)" } }) }),
485
- /* @__PURE__ */ C("div", { className: "skopon-resume-select-card-body", children: [
487
+ /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-avatar", children: /* @__PURE__ */ l(ft, { style: { fontSize: 24, color: "var(--color-primary, #208368)" } }) }),
488
+ /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-body", children: [
486
489
  /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-name", children: e.name }),
487
490
  e.description ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-desc", children: e.description }) : null,
488
- /* @__PURE__ */ C("div", { className: "skopon-resume-select-card-meta", children: [
491
+ /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-meta", children: [
489
492
  e.caseUniqueId,
490
493
  e.platform ? ` · ${e.platform}` : "",
491
494
  e.link ? ` · ${e.link}` : ""
@@ -495,104 +498,104 @@ function Nn({
495
498
  }
496
499
  );
497
500
  }
498
- function In({ context: e }) {
499
- const { interactive: t } = K(), n = An(), { value: r, setValue: o } = G(e), i = e.componentModel.properties, a = Te(i.label), s = Te(i.placeholder), c = Te(i.help), u = i.enableRefresh !== !1, d = fe(i.minCount), p = fe(i.maxCount), v = V(() => Me(i.caseFilter), [i.caseFilter]), g = Tn(v), [A, E] = P(1), [T, m] = P(!1), [h, x] = P(""), [y, S] = P([]), [N, _] = P(0), [j, Q] = P(v.pageSize ?? 20), w = L(0), O = $(r);
500
- B(() => {
501
- const b = dt(O, p);
502
- b !== null && o(b);
503
- }, [p, O, o]);
504
- const J = V(() => n ? Ne(v) ? h || s || "暂无匹配的案例" : "未配置案例列表筛选条件" : "未配置案例搜索服务", [n, v, h, s]), Y = te(
505
- async (b) => {
506
- const I = Me(JSON.parse(g)), R = ++w.current;
507
- if (!n || !Ne(I)) {
508
- S([]), _(0), x(""), m(!1);
501
+ function Gn({ context: e }) {
502
+ const { interactive: t } = H(), n = $n(), { value: r, setValue: o } = K(e), i = e.componentModel.properties, a = Ne(i.label), s = Ne(i.placeholder), c = Ne(i.help), u = i.enableRefresh !== !1, d = ye(i.minCount), m = ye(i.maxCount), v = B(() => Fe(i.caseFilter), [i.caseFilter]), h = Dn(v), [x, N] = F(1), [k, p] = F(!1), [b, g] = F(""), [C, U] = F([]), [S, A] = F(0), [X, V] = F(v.pageSize ?? 20), P = j(0), w = q(r);
503
+ R(() => {
504
+ const y = It(w, m);
505
+ y !== null && o(y);
506
+ }, [m, w, o]);
507
+ const $ = B(() => n ? Ue(v) ? b || s || "暂无匹配的案例" : "未配置案例列表筛选条件" : "未配置案例搜索服务", [n, v, b, s]), G = te(
508
+ async (y) => {
509
+ const T = Fe(JSON.parse(h)), E = ++P.current;
510
+ if (!n || !Ue(T)) {
511
+ U([]), A(0), g(""), p(!1);
509
512
  return;
510
513
  }
511
- m(!0), x("");
514
+ p(!0), g("");
512
515
  try {
513
- const M = await n({ filter: I, page: b });
514
- if (R !== w.current) return;
515
- S(M.list), _(M.total), E(M.page), Q(M.pageSize);
516
+ const M = await n({ filter: T, page: y });
517
+ if (E !== P.current) return;
518
+ U(M.list), A(M.total), N(M.page), V(M.pageSize);
516
519
  } catch (M) {
517
- if (R !== w.current) return;
518
- S([]), _(0), x(M instanceof Error ? M.message : "加载案例列表失败");
520
+ if (E !== P.current) return;
521
+ U([]), A(0), g(M instanceof Error ? M.message : "加载案例列表失败");
519
522
  } finally {
520
- R === w.current && m(!1);
523
+ E === P.current && p(!1);
521
524
  }
522
525
  },
523
- [n, g]
526
+ [n, h]
524
527
  );
525
- B(() => {
526
- E(1), Y(1);
527
- }, [g, Y]);
528
- const F = (b) => {
528
+ R(() => {
529
+ N(1), G(1);
530
+ }, [h, G]);
531
+ const Q = (y) => {
529
532
  if (!t) return;
530
- const I = ut(
531
- O,
532
- b,
533
+ const T = At(
534
+ w,
535
+ y,
533
536
  d,
534
- p
537
+ m
535
538
  );
536
- I !== null && o(I);
537
- }, z = () => {
538
- const b = Me(JSON.parse(g)), I = j || b.pageSize || 20, R = Math.max(1, Math.ceil(N / I)), M = A >= R ? 1 : A + 1;
539
- Y(M);
539
+ T !== null && o(T);
540
+ }, Z = () => {
541
+ const y = Fe(JSON.parse(h)), T = X || y.pageSize || 20, E = Math.max(1, Math.ceil(S / T)), M = x >= E ? 1 : x + 1;
542
+ G(M);
540
543
  };
541
- return /* @__PURE__ */ C("div", { className: "form-block-preview skopon-resume-select", children: [
544
+ return /* @__PURE__ */ I("div", { className: "form-block-preview skopon-resume-select", children: [
542
545
  a ? /* @__PURE__ */ l("div", { className: "form-block-preview-label", children: a }) : null,
543
- T && y.length === 0 ? /* @__PURE__ */ C("div", { className: "skopon-resume-select-status", children: [
544
- /* @__PURE__ */ l(je, { size: "small" }),
546
+ k && C.length === 0 ? /* @__PURE__ */ I("div", { className: "skopon-resume-select-status", children: [
547
+ /* @__PURE__ */ l(Ke, { size: "small" }),
545
548
  " 加载案例…"
546
549
  ] }) : null,
547
- !T && y.length === 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-empty", children: J }) : null,
548
- y.length > 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-list", children: y.map((b) => /* @__PURE__ */ l(
549
- Nn,
550
+ !k && C.length === 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-empty", children: $ }) : null,
551
+ C.length > 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-list", children: C.map((y) => /* @__PURE__ */ l(
552
+ Kn,
550
553
  {
551
- item: b,
552
- selected: O.includes(b.caseUniqueId),
553
- disabled: pt(
554
- O,
555
- b.caseUniqueId,
554
+ item: y,
555
+ selected: w.includes(y.caseUniqueId),
556
+ disabled: Tt(
557
+ w,
558
+ y.caseUniqueId,
556
559
  t,
557
560
  d,
558
- p
561
+ m
559
562
  ),
560
- onToggle: () => F(b.caseUniqueId)
563
+ onToggle: () => Q(y.caseUniqueId)
561
564
  },
562
- b.caseUniqueId
565
+ y.caseUniqueId
563
566
  )) }) : null,
564
- u && n && Ne(v) ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ l(
565
- ge,
567
+ u && n && Ue(v) ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ l(
568
+ be,
566
569
  {
567
570
  type: "default",
568
571
  size: "small",
569
- icon: /* @__PURE__ */ l(Ze, {}),
570
- loading: T,
572
+ icon: /* @__PURE__ */ l(pt, {}),
573
+ loading: k,
571
574
  disabled: !t,
572
- onClick: z,
575
+ onClick: Z,
573
576
  children: "换一批"
574
577
  }
575
578
  ) }) : null,
576
- c ? /* @__PURE__ */ l(H.Text, { type: "secondary", className: "form-block-preview-help", children: c }) : null
579
+ c ? /* @__PURE__ */ l(L.Text, { type: "secondary", className: "form-block-preview-help", children: c }) : null
577
580
  ] });
578
581
  }
579
- const Fn = q(
580
- Mn,
581
- In
582
- ), Pn = {
582
+ const Jn = O(
583
+ Hn,
584
+ Gn
585
+ ), Yn = {
583
586
  type: "case_multiselect",
584
587
  componentName: "SkoponCaseSelect",
585
- toComponent: Cn,
586
- fromComponent: kn,
587
- catalogComponents: [Fn]
588
+ toComponent: Vn,
589
+ fromComponent: Ln,
590
+ catalogComponents: [Jn]
588
591
  };
589
- function We(e) {
592
+ function ut(e) {
590
593
  if (e == null) return;
591
594
  const t = typeof e == "number" ? e : Number(e);
592
595
  if (!(!Number.isFinite(t) || t < 1))
593
596
  return Math.floor(t);
594
597
  }
595
- function zn(e, t) {
598
+ function Wn(e, t) {
596
599
  var a, s, c, u;
597
600
  const { id: n, label: r, path: o, withData: i } = t;
598
601
  return i({
@@ -613,7 +616,7 @@ function zn(e, t) {
613
616
  value: { path: o }
614
617
  });
615
618
  }
616
- function Un(e, t, n) {
619
+ function Xn(e, t, n) {
617
620
  const r = n.nameFromValue(e.value), o = {
618
621
  ...t("resume_multiselect"),
619
622
  name: r,
@@ -630,34 +633,34 @@ function Un(e, t, n) {
630
633
  pageSize: typeof u.pageSize == "number" ? u.pageSize : 20
631
634
  };
632
635
  }
633
- const s = We(e.minCount);
636
+ const s = ut(e.minCount);
634
637
  s !== void 0 && (o.resumeMinCount = s);
635
- const c = We(e.maxCount);
638
+ const c = ut(e.maxCount);
636
639
  return c !== void 0 && (o.resumeMaxCount = c), o;
637
640
  }
638
- const ft = we(null);
639
- function Be({
641
+ const Mt = De(null);
642
+ function je({
640
643
  resumeSearch: e,
641
644
  children: t
642
645
  }) {
643
- return /* @__PURE__ */ l(ft.Provider, { value: e ?? null, children: t });
646
+ return /* @__PURE__ */ l(Mt.Provider, { value: e ?? null, children: t });
644
647
  }
645
- function _n() {
646
- return Le(ft);
648
+ function Qn() {
649
+ return He(Mt);
647
650
  }
648
- function Ie(e) {
651
+ function Pe(e) {
649
652
  return typeof e == "string" ? e : "";
650
653
  }
651
- function Fe(e) {
654
+ function Ee(e) {
652
655
  if (!e || typeof e != "object")
653
656
  return { names: [], agentUniqueIds: [], resumeUniqueIds: [], pageSize: 20 };
654
657
  const t = e, n = Array.isArray(t.names) ? t.names.map(String).filter(Boolean) : [], r = Array.isArray(t.agentUniqueIds) ? t.agentUniqueIds.map(String).filter(Boolean) : [], o = Array.isArray(t.resumeUniqueIds) ? t.resumeUniqueIds.map(String).filter(Boolean) : [], i = typeof t.pageSize == "number" ? t.pageSize : Number(t.pageSize), a = Number.isFinite(i) && i >= 1 && i <= 100 ? Math.floor(i) : 20;
655
658
  return { names: n, agentUniqueIds: r, resumeUniqueIds: o, pageSize: a };
656
659
  }
657
- function En(e) {
660
+ function Zn(e) {
658
661
  return JSON.stringify(e);
659
662
  }
660
- const Rn = {
663
+ const er = {
661
664
  name: "SkoponResumeSelect",
662
665
  schema: f.object({
663
666
  label: f.any().optional(),
@@ -669,40 +672,40 @@ const Rn = {
669
672
  maxCount: f.any().optional(),
670
673
  value: f.any().optional()
671
674
  }).passthrough()
672
- }, Bn = 3, On = 2;
673
- function Pe(e, t) {
674
- const n = (t ?? []).filter(Boolean), r = n.slice(0, Bn), o = n.length - r.length;
675
- return /* @__PURE__ */ C("div", { className: "skopon-resume-select-card-tags", children: [
675
+ }, tr = 3, nr = 2;
676
+ function ze(e, t) {
677
+ const n = (t ?? []).filter(Boolean), r = n.slice(0, tr), o = n.length - r.length;
678
+ return /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-tags", children: [
676
679
  /* @__PURE__ */ l("span", { className: "skopon-resume-select-card-tags-label", children: e }),
677
- n.length > 0 ? /* @__PURE__ */ C("div", { className: "skopon-resume-select-card-tags-list", children: [
680
+ n.length > 0 ? /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-tags-list", children: [
678
681
  r.map((i) => /* @__PURE__ */ l(re, { className: "skopon-resume-select-card-tag", children: i }, i)),
679
- o > 0 ? /* @__PURE__ */ C(re, { className: "skopon-resume-select-card-tag", children: [
682
+ o > 0 ? /* @__PURE__ */ I(re, { className: "skopon-resume-select-card-tag", children: [
680
683
  "+",
681
684
  o
682
685
  ] }) : null
683
686
  ] }) : /* @__PURE__ */ l("span", { className: "skopon-resume-select-card-tags-empty", children: "暂无" })
684
687
  ] });
685
688
  }
686
- function Vn(e) {
687
- return /* @__PURE__ */ C("div", { className: "skopon-resume-select-card-field", children: [
689
+ function rr(e) {
690
+ return /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-field", children: [
688
691
  /* @__PURE__ */ l("span", { className: "skopon-resume-select-card-tags-label", children: "满意度" }),
689
692
  /* @__PURE__ */ l("span", { className: "skopon-resume-select-card-field-value", children: typeof e == "number" ? `${e}%` : "暂无" })
690
693
  ] });
691
694
  }
692
- function qn({ work: e }) {
693
- return /* @__PURE__ */ C("div", { className: "skopon-resume-select-card-work", children: [
694
- /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-work-cover", children: e.coverUrl ? /* @__PURE__ */ l("img", { src: e.coverUrl, alt: "", className: "skopon-resume-select-card-work-img" }) : /* @__PURE__ */ l(wt, { className: "skopon-resume-select-card-work-placeholder" }) }),
695
+ function or({ work: e }) {
696
+ return /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-work", children: [
697
+ /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-work-cover", children: e.coverUrl ? /* @__PURE__ */ l("img", { src: e.coverUrl, alt: "", className: "skopon-resume-select-card-work-img" }) : /* @__PURE__ */ l(an, { className: "skopon-resume-select-card-work-placeholder" }) }),
695
698
  /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-work-title", children: e.title || "未命名作品" })
696
699
  ] });
697
700
  }
698
- function wn({
701
+ function ir({
699
702
  item: e,
700
703
  selected: t,
701
704
  disabled: n,
702
705
  onToggle: r
703
706
  }) {
704
- const o = (e.works ?? []).slice(0, On);
705
- return /* @__PURE__ */ C(
707
+ const o = (e.works ?? []).slice(0, nr);
708
+ return /* @__PURE__ */ I(
706
709
  "button",
707
710
  {
708
711
  type: "button",
@@ -711,168 +714,168 @@ function wn({
711
714
  onClick: r,
712
715
  children: [
713
716
  /* @__PURE__ */ l(
714
- zt,
717
+ Wt,
715
718
  {
716
719
  size: 48,
717
720
  src: e.avatarUrl || void 0,
718
- icon: e.avatarUrl ? void 0 : /* @__PURE__ */ l(qt, {}),
721
+ icon: e.avatarUrl ? void 0 : /* @__PURE__ */ l(on, {}),
719
722
  className: "skopon-resume-select-card-avatar"
720
723
  }
721
724
  ),
722
725
  /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-name", children: e.name || "未命名简历" }),
723
- /* @__PURE__ */ C("div", { className: "skopon-resume-select-card-body", children: [
724
- Vn(e.satisfaction),
725
- Pe("性格", e.personality),
726
- Pe("专长", e.specialties),
727
- Pe("擅长领域", e.traits),
728
- /* @__PURE__ */ C("div", { className: "skopon-resume-select-card-works", children: [
726
+ /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-body", children: [
727
+ rr(e.satisfaction),
728
+ ze("性格", e.personality),
729
+ ze("专长", e.specialties),
730
+ ze("擅长领域", e.traits),
731
+ /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-works", children: [
729
732
  /* @__PURE__ */ l("span", { className: "skopon-resume-select-card-works-label", children: "过往作品" }),
730
- o.length > 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-works-list", children: o.map((i, a) => /* @__PURE__ */ l(qn, { work: i }, `${i.title}-${a}`)) }) : /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-works-empty", children: "暂无作品" })
733
+ o.length > 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-works-list", children: o.map((i, a) => /* @__PURE__ */ l(or, { work: i }, `${i.title}-${a}`)) }) : /* @__PURE__ */ l("div", { className: "skopon-resume-select-card-works-empty", children: "暂无作品" })
731
734
  ] })
732
735
  ] })
733
736
  ]
734
737
  }
735
738
  );
736
739
  }
737
- function Ln({ context: e }) {
738
- const { interactive: t } = K(), n = _n(), { value: r, setValue: o } = G(e), i = e.componentModel.properties, a = Ie(i.label), s = Ie(i.placeholder), c = Ie(i.help), u = i.enableRefresh !== !1, d = fe(i.minCount), p = fe(i.maxCount), v = V(() => Fe(i.resumeFilter), [i.resumeFilter]), g = En(v), [A, E] = P(1), [T, m] = P(!1), [h, x] = P(""), [y, S] = P([]), [N, _] = P(0), [j, Q] = P(v.pageSize ?? 20), w = L(0), O = $(r);
739
- B(() => {
740
- const b = dt(O, p);
741
- b !== null && o(b);
742
- }, [p, O, o]);
743
- const J = te(
744
- async (b) => {
745
- const I = Fe(JSON.parse(g)), R = ++w.current;
740
+ function ar({ context: e }) {
741
+ const { interactive: t } = H(), n = Qn(), { value: r, setValue: o } = K(e), i = e.componentModel.properties, a = Pe(i.label), s = Pe(i.placeholder), c = Pe(i.help), u = i.enableRefresh !== !1, d = ye(i.minCount), m = ye(i.maxCount), v = B(() => Ee(i.resumeFilter), [i.resumeFilter]), h = Zn(v), [x, N] = F(1), [k, p] = F(!1), [b, g] = F(""), [C, U] = F([]), [S, A] = F(0), [X, V] = F(v.pageSize ?? 20), P = j(0), w = q(r);
742
+ R(() => {
743
+ const y = It(w, m);
744
+ y !== null && o(y);
745
+ }, [m, w, o]);
746
+ const $ = te(
747
+ async (y) => {
748
+ const T = Ee(JSON.parse(h)), E = ++P.current;
746
749
  if (!n) {
747
- S([]), _(0), x("未配置简历搜索服务"), m(!1);
750
+ U([]), A(0), g("未配置简历搜索服务"), p(!1);
748
751
  return;
749
752
  }
750
- m(!0), x("");
753
+ p(!0), g("");
751
754
  try {
752
- const M = await n({ filter: I, page: b });
753
- if (R !== w.current) return;
754
- S(M.list), _(M.total), E(M.page), Q(M.pageSize);
755
+ const M = await n({ filter: T, page: y });
756
+ if (E !== P.current) return;
757
+ U(M.list), A(M.total), N(M.page), V(M.pageSize);
755
758
  } catch (M) {
756
- if (R !== w.current) return;
757
- S([]), _(0), x(M instanceof Error ? M.message : "加载简历列表失败");
759
+ if (E !== P.current) return;
760
+ U([]), A(0), g(M instanceof Error ? M.message : "加载简历列表失败");
758
761
  } finally {
759
- R === w.current && m(!1);
762
+ E === P.current && p(!1);
760
763
  }
761
764
  },
762
- [n, g]
765
+ [n, h]
763
766
  );
764
- B(() => {
765
- E(1), J(1);
766
- }, [g, J]);
767
- const Y = (b) => {
767
+ R(() => {
768
+ N(1), $(1);
769
+ }, [h, $]);
770
+ const G = (y) => {
768
771
  if (!t) return;
769
- const I = ut(
770
- O,
771
- b,
772
+ const T = At(
773
+ w,
774
+ y,
772
775
  d,
773
- p
776
+ m
774
777
  );
775
- I !== null && o(I);
776
- }, F = () => {
777
- const b = Fe(JSON.parse(g)), I = j || b.pageSize || 20, R = Math.max(1, Math.ceil(N / I)), M = A >= R ? 1 : A + 1;
778
- J(M);
779
- }, z = s || "暂无匹配的简历";
780
- return /* @__PURE__ */ C("div", { className: "form-block-preview skopon-resume-select", children: [
778
+ T !== null && o(T);
779
+ }, Q = () => {
780
+ const y = Ee(JSON.parse(h)), T = X || y.pageSize || 20, E = Math.max(1, Math.ceil(S / T)), M = x >= E ? 1 : x + 1;
781
+ $(M);
782
+ }, Z = s || "暂无匹配的简历";
783
+ return /* @__PURE__ */ I("div", { className: "form-block-preview skopon-resume-select", children: [
781
784
  a ? /* @__PURE__ */ l("div", { className: "form-block-preview-label", children: a }) : null,
782
- T && y.length === 0 ? /* @__PURE__ */ C("div", { className: "skopon-resume-select-status", children: [
783
- /* @__PURE__ */ l(je, { size: "small" }),
785
+ k && C.length === 0 ? /* @__PURE__ */ I("div", { className: "skopon-resume-select-status", children: [
786
+ /* @__PURE__ */ l(Ke, { size: "small" }),
784
787
  " 加载简历…"
785
788
  ] }) : null,
786
- !T && h ? /* @__PURE__ */ l(H.Text, { type: "danger", className: "skopon-resume-select-status", children: h }) : null,
787
- !T && !h && y.length === 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-empty", children: z }) : null,
788
- y.length > 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-list", children: y.map((b) => /* @__PURE__ */ l(
789
- wn,
789
+ !k && b ? /* @__PURE__ */ l(L.Text, { type: "danger", className: "skopon-resume-select-status", children: b }) : null,
790
+ !k && !b && C.length === 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-empty", children: Z }) : null,
791
+ C.length > 0 ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-list", children: C.map((y) => /* @__PURE__ */ l(
792
+ ir,
790
793
  {
791
- item: b,
792
- selected: O.includes(b.resumeUniqueId),
793
- disabled: pt(
794
- O,
795
- b.resumeUniqueId,
794
+ item: y,
795
+ selected: w.includes(y.resumeUniqueId),
796
+ disabled: Tt(
797
+ w,
798
+ y.resumeUniqueId,
796
799
  t,
797
800
  d,
798
- p
801
+ m
799
802
  ),
800
- onToggle: () => Y(b.resumeUniqueId)
803
+ onToggle: () => G(y.resumeUniqueId)
801
804
  },
802
- b.resumeUniqueId
805
+ y.resumeUniqueId
803
806
  )) }) : null,
804
807
  u && n ? /* @__PURE__ */ l("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ l(
805
- ge,
808
+ be,
806
809
  {
807
810
  type: "default",
808
811
  size: "small",
809
- icon: /* @__PURE__ */ l(Ze, {}),
810
- loading: T,
812
+ icon: /* @__PURE__ */ l(pt, {}),
813
+ loading: k,
811
814
  disabled: !t,
812
- onClick: F,
815
+ onClick: Q,
813
816
  children: "换一批"
814
817
  }
815
818
  ) }) : null,
816
- c ? /* @__PURE__ */ l(H.Text, { type: "secondary", className: "form-block-preview-help", children: c }) : null
819
+ c ? /* @__PURE__ */ l(L.Text, { type: "secondary", className: "form-block-preview-help", children: c }) : null
817
820
  ] });
818
821
  }
819
- const jn = q(
820
- Rn,
821
- Ln
822
- ), $n = {
822
+ const sr = O(
823
+ er,
824
+ ar
825
+ ), lr = {
823
826
  type: "resume_multiselect",
824
827
  componentName: "SkoponResumeSelect",
825
- toComponent: zn,
826
- fromComponent: Un,
827
- catalogComponents: [jn]
828
- }, ve = [$n, Pn], Dn = new Map(
829
- ve.map((e) => [e.type, e])
830
- ), Hn = new Map(
831
- ve.map((e) => [e.componentName, e])
828
+ toComponent: Wn,
829
+ fromComponent: Xn,
830
+ catalogComponents: [sr]
831
+ }, ke = [lr, Yn], cr = new Map(
832
+ ke.map((e) => [e.type, e])
833
+ ), ur = new Map(
834
+ ke.map((e) => [e.componentName, e])
832
835
  );
833
- function Kn(e) {
834
- return Dn.get(e);
836
+ function mr(e) {
837
+ return cr.get(e);
835
838
  }
836
- function Gn(e) {
837
- return Hn.get(e);
839
+ function dr(e) {
840
+ return ur.get(e);
838
841
  }
839
- function Jn() {
840
- return ve.flatMap((e) => e.catalogComponents);
842
+ function pr() {
843
+ return ke.flatMap((e) => e.catalogComponents);
841
844
  }
842
- function Yn() {
843
- return ve.map((e) => e.componentName);
845
+ function fr() {
846
+ return ke.map((e) => e.componentName);
844
847
  }
845
- const he = "root", Oe = "__title__", Ve = "__desc__", ht = "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";
846
- function Xn(e) {
848
+ const ve = "root", Ve = "__title__", Le = "__desc__", We = "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";
849
+ function hr(e) {
847
850
  return `/${e}`;
848
851
  }
849
- function Qe(e) {
852
+ function mt(e) {
850
853
  return e && typeof e == "object" && "path" in e ? String(e.path ?? "").replace(/^\//, "") : "";
851
854
  }
852
- function U(e) {
855
+ function z(e) {
853
856
  if (typeof e == "string") return e;
854
857
  }
855
- function Wn(e) {
858
+ function gr(e) {
856
859
  const t = e.id || ie("a2-"), n = e.type === "video" ? "video" : e.type === "audio" ? "audio" : "image";
857
860
  return {
858
861
  id: t,
859
862
  component: "SkoponMedia",
860
863
  mediaType: n,
861
- urls: dn(e),
862
- mediaSize: le(e.mediaSize),
864
+ urls: Un(e),
865
+ mediaSize: se(e.mediaSize),
863
866
  label: e.label ?? "",
864
867
  help: e.help ?? "",
865
868
  placeholder: e.placeholder ?? ""
866
869
  };
867
870
  }
868
- function Qn(e) {
871
+ function yr(e) {
869
872
  if (Array.isArray(e.urls))
870
873
  return e.urls.map((n) => String(n).trim()).filter(Boolean);
871
- const t = U(e.url);
874
+ const t = z(e.url);
872
875
  return t != null && t.trim() ? [t.trim()] : [];
873
876
  }
874
- function ue(e, t, n) {
875
- const r = typeof e.id == "string" ? e.id : ie("block-"), o = Qn(e), i = U(e.label) ?? U(e.description) ?? n, a = U(e.help), s = U(e.placeholder), c = le(e.mediaSize);
877
+ function de(e, t, n) {
878
+ const r = typeof e.id == "string" ? e.id : ie("block-"), o = yr(e), i = z(e.label) ?? z(e.description) ?? n, a = z(e.help), s = z(e.placeholder), c = se(e.mediaSize);
876
879
  return {
877
880
  id: r,
878
881
  type: t,
@@ -883,10 +886,10 @@ function ue(e, t, n) {
883
886
  mediaUrls: o.length > 0 ? o : [""]
884
887
  };
885
888
  }
886
- function Zn(e) {
889
+ function vr(e) {
887
890
  switch (e.type) {
888
891
  case "toggle":
889
- return ye(e.defaultValue);
892
+ return le(e.defaultValue);
890
893
  case "multiselect":
891
894
  case "checkbox":
892
895
  case "resume_multiselect":
@@ -900,9 +903,9 @@ function Zn(e) {
900
903
  return typeof e.defaultValue == "string" ? e.defaultValue : "";
901
904
  }
902
905
  }
903
- function er(e) {
906
+ function br(e) {
904
907
  var u;
905
- const t = e.id || ie("a2-"), n = e.label ?? "", r = ((u = e.name) == null ? void 0 : u.trim()) || "", o = r ? Xn(r) : void 0, i = (e.options ?? []).map((d) => ({ label: d.label, value: d.value })), a = (d) => r ? { node: d, dataKey: r, dataValue: Zn(e) } : { node: d }, s = { id: t, label: n, name: r, path: o, withData: a }, c = Kn(e.type);
908
+ const t = e.id || ie("a2-"), n = e.label ?? "", r = ((u = e.name) == null ? void 0 : u.trim()) || "", o = r ? hr(r) : void 0, i = (e.options ?? []).map((d) => ({ label: d.label, value: d.value })), a = (d) => r ? { node: d, dataKey: r, dataValue: vr(e) } : { node: d }, s = { id: t, label: n, name: r, path: o, withData: a }, c = mr(e.type);
906
909
  if (c)
907
910
  return c.toComponent(e, s);
908
911
  switch (e.type) {
@@ -927,7 +930,7 @@ function er(e) {
927
930
  component: "TextField",
928
931
  label: n,
929
932
  variant: "shortText",
930
- validationRegexp: ht,
933
+ validationRegexp: We,
931
934
  ...e.placeholder ? { placeholder: e.placeholder } : {},
932
935
  value: { path: o }
933
936
  });
@@ -1013,7 +1016,7 @@ function er(e) {
1013
1016
  case "image":
1014
1017
  case "video":
1015
1018
  case "audio":
1016
- return { node: Wn(e) };
1019
+ return { node: gr(e) };
1017
1020
  case "file":
1018
1021
  return a({
1019
1022
  id: t,
@@ -1030,31 +1033,31 @@ function er(e) {
1030
1033
  return { node: null };
1031
1034
  }
1032
1035
  }
1033
- function qe(e) {
1036
+ function $e(e) {
1034
1037
  if (!e || !Array.isArray(e.components) || e.components.length === 0) return !0;
1035
- const t = e.components.find((r) => r.id === he);
1038
+ const t = e.components.find((r) => r.id === ve);
1036
1039
  if (!t) return e.components.length === 0;
1037
1040
  const n = t.children;
1038
1041
  return !Array.isArray(n) || n.length === 0;
1039
1042
  }
1040
- function gt(e, t) {
1043
+ function Nt(e, t) {
1041
1044
  const n = [], r = [], o = {}, i = (t == null ? void 0 : t.includeHeader) !== !1, a = (e.title ?? "").trim(), s = (e.description ?? "").trim();
1042
- i && a && (n.push({ id: Oe, component: "Text", text: a, variant: "h2" }), r.push(Oe)), i && s && (n.push({ id: Ve, component: "Text", text: s, variant: "body" }), r.push(Ve));
1045
+ i && a && (n.push({ id: Ve, component: "Text", text: a, variant: "h2" }), r.push(Ve)), i && s && (n.push({ id: Le, component: "Text", text: s, variant: "body" }), r.push(Le));
1043
1046
  for (const d of e.blocks ?? []) {
1044
- const { node: p, dataKey: v, dataValue: g } = er(d);
1045
- p && (n.push(p), r.push(p.id), v && (o[v] = g));
1047
+ const { node: m, dataKey: v, dataValue: h } = br(d);
1048
+ m && (n.push(m), r.push(m.id), v && (o[v] = h));
1046
1049
  }
1047
- n.unshift({ id: he, component: "Column", children: r });
1048
- const c = { root: he, components: n, dataModel: o }, u = t == null ? void 0 : t.styleId;
1050
+ n.unshift({ id: ve, component: "Column", children: r });
1051
+ const c = { root: ve, components: n, dataModel: o }, u = t == null ? void 0 : t.styleId;
1049
1052
  return u !== void 0 && (c.surfaceProperties = { styleId: u ?? null }), c;
1050
1053
  }
1051
- function tr(e) {
1054
+ function Sr(e) {
1052
1055
  const t = /* @__PURE__ */ new Map();
1053
1056
  for (const n of e.components ?? [])
1054
1057
  n && typeof n.id == "string" && t.set(n.id, n);
1055
1058
  return t;
1056
1059
  }
1057
- function ze(e) {
1060
+ function Re(e) {
1058
1061
  const t = e.options;
1059
1062
  return Array.isArray(t) ? t.map((n) => {
1060
1063
  if (!n || typeof n != "object") return null;
@@ -1065,10 +1068,10 @@ function ze(e) {
1065
1068
  };
1066
1069
  }).filter((n) => !!n) : [];
1067
1070
  }
1068
- function nr(e) {
1069
- const t = typeof e.id == "string" ? e.id : ie("block-"), n = String(e.component ?? ""), r = U(e.label) ?? U(e.text) ?? "", o = Qe(e.value), i = (s) => ({ id: t, type: s, label: r }), a = Gn(n);
1071
+ function kr(e) {
1072
+ const t = typeof e.id == "string" ? e.id : ie("block-"), n = String(e.component ?? ""), r = z(e.label) ?? z(e.text) ?? "", o = mt(e.value), i = (s) => ({ id: t, type: s, label: r }), a = dr(n);
1070
1073
  if (a)
1071
- return a.fromComponent(e, i, { asLiteral: U, nameFromValue: Qe });
1074
+ return a.fromComponent(e, i, { asLiteral: z, nameFromValue: mt });
1072
1075
  switch (n) {
1073
1076
  case "Text": {
1074
1077
  const s = String(e.variant ?? "body"), c = /^h[1-6]$/i.test(s) || s === "title" || s === "subtitle";
@@ -1077,8 +1080,8 @@ function nr(e) {
1077
1080
  case "TextField": {
1078
1081
  const s = String(e.variant ?? "shortText");
1079
1082
  let c = "text";
1080
- s === "longText" ? c = "textarea" : s === "number" ? c = "number" : U(e.validationRegexp) === ht && (c = "email");
1081
- const u = { ...i(c), name: o }, d = U(e.placeholder);
1083
+ s === "longText" ? c = "textarea" : s === "number" ? c = "number" : z(e.validationRegexp) === We && (c = "email");
1084
+ const u = { ...i(c), name: o }, d = z(e.placeholder);
1082
1085
  return d && (u.placeholder = d), u;
1083
1086
  }
1084
1087
  case "CheckBox":
@@ -1087,46 +1090,46 @@ function nr(e) {
1087
1090
  const c = String(e.mode ?? "single") === "multiple" ? "multiselect" : "select", u = {
1088
1091
  ...i(c),
1089
1092
  name: o,
1090
- options: ze(e)
1091
- }, d = U(e.placeholder);
1093
+ options: Re(e)
1094
+ }, d = z(e.placeholder);
1092
1095
  return d && (u.placeholder = d), u;
1093
1096
  }
1094
1097
  case "ChoicePicker": {
1095
- const s = U(e.skoponPickerType);
1098
+ const s = z(e.skoponPickerType);
1096
1099
  if (s === "select" || s === "multiselect" || s === "radio" || s === "checkbox") {
1097
1100
  const d = {
1098
1101
  ...i(s),
1099
1102
  name: o,
1100
- options: ze(e)
1101
- }, p = U(e.placeholder);
1102
- return p && (d.placeholder = p), d;
1103
+ options: Re(e)
1104
+ }, m = z(e.placeholder);
1105
+ return m && (d.placeholder = m), d;
1103
1106
  }
1104
1107
  const u = String(e.variant ?? "mutuallyExclusive") === "multipleSelection" ? "checkbox" : "radio";
1105
- return { ...i(u), name: o, options: ze(e) };
1108
+ return { ...i(u), name: o, options: Re(e) };
1106
1109
  }
1107
1110
  case "DateTimeInput": {
1108
- const s = e.enableDate === !0, c = e.enableTime === !0, d = { ...i(!s && c ? "time" : "datetime"), name: o }, p = U(e.placeholder);
1109
- return p && (d.placeholder = p), d;
1111
+ const s = e.enableDate === !0, c = e.enableTime === !0, d = { ...i(!s && c ? "time" : "datetime"), name: o }, m = z(e.placeholder);
1112
+ return m && (d.placeholder = m), d;
1110
1113
  }
1111
1114
  case "SkoponMedia": {
1112
1115
  const s = String(e.mediaType ?? "image");
1113
- return ue(e, s === "video" ? "video" : s === "audio" ? "audio" : "image", r);
1116
+ return de(e, s === "video" ? "video" : s === "audio" ? "audio" : "image", r);
1114
1117
  }
1115
1118
  case "Image":
1116
- return ue(e, "image", r);
1119
+ return de(e, "image", r);
1117
1120
  case "Video":
1118
- return ue(e, "video", r);
1121
+ return de(e, "video", r);
1119
1122
  case "AudioPlayer":
1120
- return ue(e, "audio", r);
1123
+ return de(e, "audio", r);
1121
1124
  case "FileUpload": {
1122
- const s = U(e.accept) ?? "", c = { ...i("file"), name: o };
1125
+ const s = z(e.accept) ?? "", c = { ...i("file"), name: o };
1123
1126
  return s && (c.fileAcceptExtensions = s.split(",").map((u) => u.trim()).filter(Boolean)), Array.isArray(e.fileAcceptTypes) && (c.fileAcceptTypes = e.fileAcceptTypes.map(String)), typeof e.filePlaceholderIcon == "string" && (c.filePlaceholderIcon = e.filePlaceholderIcon), typeof e.minCount == "number" && (c.fileMinCount = e.minCount), typeof e.maxCount == "number" && (c.fileMaxCount = e.maxCount), c;
1124
1127
  }
1125
1128
  default:
1126
1129
  return null;
1127
1130
  }
1128
1131
  }
1129
- function yt(e, t, n, r) {
1132
+ function Ft(e, t, n, r) {
1130
1133
  if (n.has(e)) return;
1131
1134
  n.add(e);
1132
1135
  const o = t.get(e);
@@ -1134,47 +1137,47 @@ function yt(e, t, n, r) {
1134
1137
  const i = String(o.component ?? "");
1135
1138
  if ((i === "Column" || i === "Row") && Array.isArray(o.children)) {
1136
1139
  for (const a of o.children)
1137
- typeof a == "string" && yt(a, t, n, r);
1140
+ typeof a == "string" && Ft(a, t, n, r);
1138
1141
  return;
1139
1142
  }
1140
1143
  r.push(o);
1141
1144
  }
1142
- function rr(e, t) {
1145
+ function Cr(e, t) {
1143
1146
  return t ? e.map((n) => {
1144
1147
  var i;
1145
1148
  const r = (i = n.name) == null ? void 0 : i.trim();
1146
1149
  if (!r || !(r in t)) return n;
1147
1150
  const o = t[r];
1148
- return o === void 0 ? n : n.type === "toggle" ? { ...n, defaultValue: ye(o) } : { ...n, defaultValue: o };
1151
+ return o === void 0 ? n : n.type === "toggle" ? { ...n, defaultValue: le(o) } : { ...n, defaultValue: o };
1149
1152
  }) : e;
1150
1153
  }
1151
- function or(e) {
1154
+ function xr(e) {
1152
1155
  if (!e || !Array.isArray(e.components))
1153
- return me({ title: "", description: "", blocks: [], jsonSchema: {} });
1154
- const t = tr(e), n = [];
1155
- yt(e.root ?? he, t, /* @__PURE__ */ new Set(), n);
1156
+ return ge({ title: "", description: "", blocks: [], jsonSchema: {} });
1157
+ const t = Sr(e), n = [];
1158
+ Ft(e.root ?? ve, t, /* @__PURE__ */ new Set(), n);
1156
1159
  let r = "", o = "";
1157
1160
  const i = [];
1158
1161
  for (const a of n) {
1159
- if (a.id === Oe) {
1160
- r = U(a.text) ?? r;
1162
+ if (a.id === Ve) {
1163
+ r = z(a.text) ?? r;
1161
1164
  continue;
1162
1165
  }
1163
- if (a.id === Ve) {
1164
- o = U(a.text) ?? o;
1166
+ if (a.id === Le) {
1167
+ o = z(a.text) ?? o;
1165
1168
  continue;
1166
1169
  }
1167
- const s = nr(a);
1170
+ const s = kr(a);
1168
1171
  s && i.push(s);
1169
1172
  }
1170
- return me({
1173
+ return ge({
1171
1174
  title: r,
1172
1175
  description: o,
1173
- blocks: rr(i, e.dataModel),
1176
+ blocks: Cr(i, e.dataModel),
1174
1177
  jsonSchema: {}
1175
1178
  });
1176
1179
  }
1177
- function ir(e, t) {
1180
+ function Ar(e, t) {
1178
1181
  const { surfaceId: n, catalogId: r } = t, o = [
1179
1182
  { version: "v0.9", createSurface: { surfaceId: n, catalogId: r } },
1180
1183
  {
@@ -1187,24 +1190,25 @@ function ir(e, t) {
1187
1190
  updateDataModel: { surfaceId: n, path: "/", value: e.dataModel }
1188
1191
  }), o;
1189
1192
  }
1190
- function vt(e) {
1193
+ function Ut(e) {
1191
1194
  return !!e && typeof e == "object" && !Array.isArray(e) && Array.isArray(e.components);
1192
1195
  }
1193
- function ar(e, t) {
1196
+ function Tr(e, t) {
1194
1197
  if (!e || typeof e != "object") return null;
1195
- const n = e, r = vt(n.a2ui) ? n.a2ui : void 0;
1196
- if (r && !qe(r)) return r;
1198
+ const n = e, r = Ut(n.a2ui) ? n.a2ui : void 0;
1199
+ if (r && !$e(r)) return r;
1197
1200
  const o = Array.isArray(n.blocks) ? n.blocks : [];
1198
1201
  if (o.length === 0) return null;
1199
- const i = Z({
1202
+ const i = W({
1200
1203
  title: typeof n.title == "string" ? n.title : "",
1201
1204
  description: typeof n.description == "string" ? n.description : "",
1202
- blocks: o
1203
- }), a = gt(i, t);
1204
- return qe(a) ? null : a;
1205
+ blocks: o,
1206
+ jsonSchema: Ye(n.jsonSchema ?? n.json_schema)
1207
+ }), a = Nt(i, t);
1208
+ return $e(a) ? null : a;
1205
1209
  }
1206
- function lr(e, t, n) {
1207
- return gt(
1210
+ function Ir(e, t, n) {
1211
+ return Nt(
1208
1212
  {
1209
1213
  title: e.title,
1210
1214
  description: e.description,
@@ -1213,17 +1217,18 @@ function lr(e, t, n) {
1213
1217
  n
1214
1218
  );
1215
1219
  }
1216
- function sr(e) {
1220
+ function _r(e) {
1217
1221
  if (!e || typeof e != "object" || Array.isArray(e))
1218
1222
  return;
1219
1223
  const t = e;
1220
- return !(Array.isArray(t.blocks) && t.blocks.length > 0) && vt(t.a2ui) ? or(t.a2ui) : Z({
1224
+ return !(Array.isArray(t.blocks) && t.blocks.length > 0) && Ut(t.a2ui) ? xr(t.a2ui) : W({
1221
1225
  title: typeof t.title == "string" ? t.title : "",
1222
1226
  description: typeof t.description == "string" ? t.description : "",
1223
- blocks: Array.isArray(t.blocks) ? t.blocks : []
1227
+ blocks: Array.isArray(t.blocks) ? t.blocks : [],
1228
+ jsonSchema: Ye(t.jsonSchema ?? t.json_schema)
1224
1229
  });
1225
1230
  }
1226
- function cr(e, t, n) {
1231
+ function Mr(e, t, n) {
1227
1232
  const r = e.model.surfacesMap.get(t);
1228
1233
  if (!r) return {};
1229
1234
  const o = {};
@@ -1233,14 +1238,15 @@ function cr(e, t, n) {
1233
1238
  }
1234
1239
  return o;
1235
1240
  }
1236
- function ur(e) {
1237
- return Z({
1241
+ function Nr(e) {
1242
+ return W({
1238
1243
  title: "",
1239
1244
  description: "",
1240
- blocks: [e]
1245
+ blocks: [e],
1246
+ jsonSchema: {}
1241
1247
  }).blocks[0];
1242
1248
  }
1243
- function pr(e, t) {
1249
+ function Fr(e, t) {
1244
1250
  var o, i;
1245
1251
  const n = /* @__PURE__ */ new Map();
1246
1252
  for (const a of t) {
@@ -1249,11 +1255,11 @@ function pr(e, t) {
1249
1255
  }
1250
1256
  const r = [];
1251
1257
  for (const a of e.blocks) {
1252
- if ($e(a.type)) {
1253
- r.push(ur(a));
1258
+ if (Se(a.type)) {
1259
+ r.push(Nr(a));
1254
1260
  continue;
1255
1261
  }
1256
- if (!W(a.type)) continue;
1262
+ if (!Y(a.type)) continue;
1257
1263
  const s = (i = a.name) == null ? void 0 : i.trim();
1258
1264
  if (!s) continue;
1259
1265
  const c = n.get(s);
@@ -1261,123 +1267,126 @@ function pr(e, t) {
1261
1267
  }
1262
1268
  return r;
1263
1269
  }
1264
- function dr(e, t) {
1270
+ function Ur(e, t) {
1265
1271
  var r;
1266
1272
  const n = {
1267
1273
  ...e,
1268
1274
  name: ((r = e.name) == null ? void 0 : r.trim()) || t.name
1269
1275
  };
1270
- return t.defaultValue !== void 0 && (n.defaultValue = t.defaultValue), Z({
1276
+ return t.defaultValue !== void 0 && (n.defaultValue = t.defaultValue), W({
1271
1277
  title: "",
1272
1278
  description: "",
1273
- blocks: [n]
1279
+ blocks: [n],
1280
+ jsonSchema: {}
1274
1281
  }).blocks[0];
1275
1282
  }
1276
- function bt(e) {
1283
+ function Ce(e) {
1277
1284
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1278
1285
  const t = e;
1279
- return Array.isArray(t.blocks) ? Z({
1286
+ return Array.isArray(t.blocks) ? W({
1280
1287
  title: typeof t.title == "string" ? t.title : "",
1281
1288
  description: typeof t.description == "string" ? t.description : "",
1282
- blocks: t.blocks
1289
+ blocks: t.blocks,
1290
+ jsonSchema: {}
1283
1291
  }) : null;
1284
1292
  }
1285
- function mr(e, t) {
1293
+ function Pr(e, t) {
1286
1294
  var i, a, s, c, u, d;
1287
1295
  const n = /* @__PURE__ */ new Map();
1288
- for (const p of (t == null ? void 0 : t.blocks) ?? [])
1289
- W(p.type) && ((i = p.name) != null && i.trim()) && n.set(p.name.trim(), p);
1296
+ for (const m of (t == null ? void 0 : t.blocks) ?? [])
1297
+ Y(m.type) && ((i = m.name) != null && i.trim()) && n.set(m.name.trim(), m);
1290
1298
  const r = [], o = [];
1291
- for (const p of e.blocks) {
1292
- if (!W(p.type)) continue;
1293
- const v = (a = p.name) == null ? void 0 : a.trim();
1299
+ for (const m of e.blocks) {
1300
+ if (!Y(m.type)) continue;
1301
+ const v = (a = m.name) == null ? void 0 : a.trim();
1294
1302
  if (!v) continue;
1295
- const g = n.get(v);
1296
- g ? r.push(dr(g, p)) : o.push(
1297
- Z({
1303
+ const h = n.get(v);
1304
+ h ? r.push(Ur(h, m)) : o.push(
1305
+ W({
1298
1306
  title: "",
1299
1307
  description: "",
1300
- blocks: [p]
1308
+ blocks: [m],
1309
+ jsonSchema: {}
1301
1310
  }).blocks[0]
1302
1311
  );
1303
1312
  }
1304
1313
  return {
1305
1314
  matchedBlocks: r,
1306
1315
  extraBlocks: o,
1307
- renderBlocks: pr(e, r),
1316
+ renderBlocks: Fr(e, r),
1308
1317
  title: ((s = e.title) == null ? void 0 : s.trim()) || ((c = t == null ? void 0 : t.title) == null ? void 0 : c.trim()) || "",
1309
1318
  description: ((u = e.description) == null ? void 0 : u.trim()) || ((d = t == null ? void 0 : t.description) == null ? void 0 : d.trim()) || ""
1310
1319
  };
1311
1320
  }
1312
- function fr(e) {
1321
+ function Er(e) {
1313
1322
  const { type: t, defaultValue: n } = e;
1314
1323
  return n !== void 0 ? t === "toggle" ? n === !0 || n === "true" : t === "multiselect" || t === "checkbox" || t === "resume_multiselect" || t === "case_multiselect" ? Array.isArray(n) ? n.map(String) : typeof n == "string" && n ? [n] : [] : n : t === "toggle" ? !1 : t === "multiselect" || t === "checkbox" || t === "resume_multiselect" || t === "case_multiselect" ? [] : t === "number" ? null : "";
1315
1324
  }
1316
- function St(e) {
1325
+ function Xe(e) {
1317
1326
  var n;
1318
1327
  const t = {};
1319
1328
  for (const r of e) {
1320
- if (!W(r.type)) continue;
1329
+ if (!Y(r.type)) continue;
1321
1330
  const o = (n = r.name) == null ? void 0 : n.trim();
1322
- o && (t[o] = fr(r));
1331
+ o && (t[o] = Er(r));
1323
1332
  }
1324
1333
  return t;
1325
1334
  }
1326
- function hr(e) {
1335
+ function zr(e) {
1327
1336
  return e.blocks.some(
1328
1337
  (t) => {
1329
1338
  var n;
1330
- return W(t.type) && !!((n = t.name) != null && n.trim());
1339
+ return Y(t.type) && !!((n = t.name) != null && n.trim());
1331
1340
  }
1332
1341
  );
1333
1342
  }
1334
- function gr(e) {
1343
+ function Rr(e) {
1335
1344
  return e.blocks.filter((t) => {
1336
1345
  var n;
1337
- return $e(t.type) ? !0 : W(t.type) && !!((n = t.name) != null && n.trim());
1346
+ return Se(t.type) ? !0 : Y(t.type) && !!((n = t.name) != null && n.trim());
1338
1347
  });
1339
1348
  }
1340
- function yr(e) {
1349
+ function Br(e) {
1341
1350
  return e.blocks.filter((t) => {
1342
1351
  var n;
1343
- return W(t.type) && ((n = t.name) == null ? void 0 : n.trim());
1352
+ return Y(t.type) && ((n = t.name) == null ? void 0 : n.trim());
1344
1353
  }).map((t) => t.name.trim());
1345
1354
  }
1346
- function xt(e) {
1355
+ function Pt(e) {
1347
1356
  return e.replace(/'/g, "'\\''");
1348
1357
  }
1349
- function Ct(e, t) {
1358
+ function Et(e, t) {
1350
1359
  const n = (t ?? "").trim() || "<callback_url>", r = JSON.stringify(e ?? {}, null, 2);
1351
1360
  return [
1352
1361
  `curl -X POST '${n}' \\`,
1353
1362
  " -H 'Content-Type: application/json' \\",
1354
- ` -d '${xt(r)}'`
1363
+ ` -d '${Pt(r)}'`
1355
1364
  ].join(`
1356
1365
  `);
1357
1366
  }
1358
- function vr(e, t) {
1367
+ function wr(e, t) {
1359
1368
  return JSON.stringify({ ...e, ...t }, null, 2);
1360
1369
  }
1361
- function kt({
1370
+ function qr({
1362
1371
  cardValues: e,
1363
1372
  extraValues: t = {},
1364
1373
  callbackUrl: n
1365
1374
  }) {
1366
- const r = (n ?? "").trim() || "<callback_url>", o = vr(e, t);
1375
+ const r = (n ?? "").trim() || "<callback_url>", o = wr(e, t);
1367
1376
  return [
1368
1377
  `curl -X POST '${r}' \\`,
1369
1378
  " -H 'Content-Type: application/json' \\",
1370
- ` -d '${xt(o)}'`
1379
+ ` -d '${Pt(o)}'`
1371
1380
  ].join(`
1372
1381
  `);
1373
1382
  }
1374
- function br(e, t) {
1375
- const n = bt(e);
1376
- if (!n) return Ct(e, t);
1377
- const r = St(n.blocks);
1378
- return kt({ cardValues: r, callbackUrl: t });
1383
+ function $o(e, t) {
1384
+ const n = Ce(e);
1385
+ if (!n) return Et(e, t);
1386
+ const r = Xe(n.blocks);
1387
+ return qr({ cardValues: r, callbackUrl: t });
1379
1388
  }
1380
- async function Sr(e, t, n) {
1389
+ async function zt(e, t, n) {
1381
1390
  const r = e.trim();
1382
1391
  if (!r)
1383
1392
  throw new Error("callback_url 为空");
@@ -1404,7 +1413,7 @@ async function Sr(e, t, n) {
1404
1413
  }
1405
1414
  return { ok: i.ok, status: i.status, body: a };
1406
1415
  }
1407
- async function At(e) {
1416
+ async function Do(e) {
1408
1417
  var n;
1409
1418
  if (typeof navigator < "u" && ((n = navigator.clipboard) != null && n.writeText)) {
1410
1419
  await navigator.clipboard.writeText(e);
@@ -1420,7 +1429,7 @@ async function At(e) {
1420
1429
  document.body.removeChild(t);
1421
1430
  }
1422
1431
  }
1423
- async function xr(e) {
1432
+ async function Qe(e) {
1424
1433
  let t;
1425
1434
  try {
1426
1435
  t = await e.json();
@@ -1433,10 +1442,53 @@ async function xr(e) {
1433
1442
  throw new Error(t.message || `响应缺少 data (${e.status})`);
1434
1443
  return t.data;
1435
1444
  }
1436
- function co(e = {}) {
1445
+ const Rt = "auth_user", Or = "token", jr = "answer_agent_callback_url";
1446
+ function Bt(e) {
1447
+ if (typeof window > "u") return null;
1448
+ try {
1449
+ return e === "localStorage" ? window.localStorage : window.sessionStorage;
1450
+ } catch {
1451
+ return null;
1452
+ }
1453
+ }
1454
+ function wt(e) {
1455
+ try {
1456
+ const t = JSON.parse(e);
1457
+ return !t || typeof t != "object" || Array.isArray(t) ? null : t;
1458
+ } catch {
1459
+ return null;
1460
+ }
1461
+ }
1462
+ function Vr(e, t) {
1463
+ const n = wt(e);
1464
+ if (!n) return "";
1465
+ const r = n[t];
1466
+ return typeof r == "string" ? r.trim().replace(/^bearer\s+/i, "").trim() : "";
1467
+ }
1468
+ function Lr(e = {}) {
1469
+ const t = e.storage ?? "sessionStorage", n = e.storageKey ?? Rt, r = e.answerAgentCallbackUrlField ?? jr, o = Bt(t);
1470
+ if (!o) return "";
1471
+ const i = o.getItem(n);
1472
+ if (!i) return "";
1473
+ const a = wt(i);
1474
+ if (!a) return "";
1475
+ const s = a[r];
1476
+ return typeof s == "string" ? s.trim() : "";
1477
+ }
1478
+ function qt(e = {}) {
1479
+ const t = e.storage ?? "sessionStorage", n = e.storageKey ?? Rt, r = e.tokenField ?? Or, o = Bt(t);
1480
+ if (!o) return {};
1481
+ const i = o.getItem(n);
1482
+ if (!i) return {};
1483
+ const a = Vr(i, r);
1484
+ return a ? { Authorization: `Bearer ${a}` } : {};
1485
+ }
1486
+ async function Ze(e = {}) {
1487
+ return e.getHeaders ? await e.getHeaders() ?? {} : qt(e.authStorage);
1488
+ }
1489
+ function $r(e = {}) {
1437
1490
  const t = (e.baseUrl ?? "/api/v1").replace(/\/$/, ""), n = e.detailPath ?? "/dev/form/detail", r = e.fetch ?? fetch;
1438
1491
  async function o(i) {
1439
- var p;
1440
1492
  const a = new URLSearchParams();
1441
1493
  if (i.formId !== void 0)
1442
1494
  a.set("form_id", String(i.formId));
@@ -1444,34 +1496,261 @@ function co(e = {}) {
1444
1496
  a.set("form_unique_id", i.formUniqueId);
1445
1497
  else
1446
1498
  throw new Error("form_id 或 form_unique_id 至少传一个");
1447
- const s = await ((p = e.getHeaders) == null ? void 0 : p.call(e)) ?? {}, c = await r(`${t}${n}?${a.toString()}`, {
1499
+ const s = await Ze(e), c = await r(`${t}${n}?${a.toString()}`, {
1448
1500
  method: "GET",
1449
1501
  headers: s
1450
- }), u = await xr(c), d = sr(u.form_definition);
1502
+ }), u = await Qe(c), d = _r(u.form_definition);
1451
1503
  return {
1452
1504
  formUniqueId: u.form_unique_id,
1453
1505
  formId: u.form_id,
1454
1506
  disabled: u.disabled === 1,
1455
1507
  formDefinition: d,
1456
- a2ui: ar(u.form_definition) ?? void 0
1508
+ a2ui: Tr(u.form_definition) ?? void 0
1457
1509
  };
1458
1510
  }
1459
1511
  return { fetchDetail: o };
1460
1512
  }
1461
- const Cr = {
1462
- video: Dt,
1463
- audio: $t,
1464
- image: jt,
1465
- file: tt,
1466
- spreadsheet: Lt,
1467
- document: et
1513
+ function Dr(e) {
1514
+ if (!e || typeof e != "object" || Array.isArray(e))
1515
+ return e ?? null;
1516
+ const t = e;
1517
+ return Array.isArray(t.blocks) ? {
1518
+ title: typeof t.title == "string" ? t.title : "",
1519
+ description: typeof t.description == "string" ? t.description : "",
1520
+ blocks: t.blocks
1521
+ } : e;
1522
+ }
1523
+ function Ot({
1524
+ context: e,
1525
+ payload: t,
1526
+ form: n,
1527
+ answer: r
1528
+ }) {
1529
+ const o = Ce(t) ?? t, i = n ? Dr(n) : o;
1530
+ return {
1531
+ mission_id: e.missionId ?? null,
1532
+ tenant_id: e.tenantId ?? null,
1533
+ tenant_user_id: e.tenantUserId ?? null,
1534
+ request_id: e.requestId ?? null,
1535
+ ask_user_query_description: e.askUserQueryDescription ?? null,
1536
+ callback_url: (e.callbackUrl ?? "").trim() || null,
1537
+ form: i,
1538
+ question: o,
1539
+ answer: r
1540
+ };
1541
+ }
1542
+ async function jt(e, t) {
1543
+ const n = ((t == null ? void 0 : t.answerAgentCallbackUrl) ?? Lr(t == null ? void 0 : t.authStorage)).trim();
1544
+ if (!n)
1545
+ throw new Error("answer_agent_callback_url 未配置,无法提交");
1546
+ const r = qt(t == null ? void 0 : t.authStorage);
1547
+ return zt(n, e, {
1548
+ ...t,
1549
+ headers: {
1550
+ ...r,
1551
+ ...(t == null ? void 0 : t.headers) ?? {}
1552
+ }
1553
+ });
1554
+ }
1555
+ function Hr(e) {
1556
+ return {
1557
+ resumeUniqueId: e.resume_unique_id,
1558
+ resumeId: e.resume_id,
1559
+ agentId: e.agent_id,
1560
+ name: e.name,
1561
+ avatarUrl: e.avatar_url ?? null,
1562
+ description: e.description ?? void 0,
1563
+ satisfaction: e.satisfaction,
1564
+ published: e.published,
1565
+ worksCount: e.works_count,
1566
+ personality: e.personality_json ?? [],
1567
+ specialties: e.specialties_json ?? [],
1568
+ traits: e.traits_json ?? [],
1569
+ works: (e.works_json ?? []).map((t) => ({
1570
+ title: t.title ?? "",
1571
+ coverUrl: t.cover_url ?? null,
1572
+ link: t.link
1573
+ }))
1574
+ };
1575
+ }
1576
+ function Kr(e, t) {
1577
+ const n = new URLSearchParams();
1578
+ n.set("page", String(t)), n.set("page_size", String(e.pageSize ?? 20));
1579
+ for (const r of e.names ?? [])
1580
+ r && n.append("name", r);
1581
+ for (const r of e.agentUniqueIds ?? [])
1582
+ r && n.append("agent_unique_id", r);
1583
+ for (const r of e.resumeUniqueIds ?? [])
1584
+ r && n.append("resume_unique_id", r);
1585
+ return n;
1586
+ }
1587
+ function Gr(e = {}) {
1588
+ const t = (e.baseUrl ?? "/api/v1").replace(/\/$/, ""), n = e.searchPath ?? "/univ/resume/search", r = e.fetch ?? fetch;
1589
+ return async ({ filter: o, page: i }) => {
1590
+ const a = await Ze(e), s = Kr(o, i), c = await r(`${t}${n}?${s.toString()}`, {
1591
+ method: "GET",
1592
+ headers: a
1593
+ }), u = await Qe(c);
1594
+ return {
1595
+ list: (u.list ?? []).map(Hr),
1596
+ total: u.total ?? 0,
1597
+ page: u.page ?? i,
1598
+ pageSize: u.page_size ?? o.pageSize ?? 20
1599
+ };
1600
+ };
1601
+ }
1602
+ function Jr(e) {
1603
+ var r, o, i, a;
1604
+ const t = !!((r = e.flowUniqueIds) != null && r.length), n = !!((o = e.agentUniqueId) != null && o.trim() && ((i = e.flowType) != null && i.trim()) && ((a = e.category) != null && a.trim()));
1605
+ return t || n;
1606
+ }
1607
+ function Yr(e) {
1608
+ return {
1609
+ caseUniqueId: e.case_unique_id,
1610
+ caseId: e.case_id,
1611
+ flowId: e.flow_id,
1612
+ name: e.name,
1613
+ link: e.link,
1614
+ platform: e.platform ?? null,
1615
+ description: e.description ?? void 0
1616
+ };
1617
+ }
1618
+ function Wr(e, t, n) {
1619
+ var o, i, a;
1620
+ const r = new URLSearchParams();
1621
+ r.set("page", String(t)), r.set("page_size", String(e.pageSize ?? 20)), r.set("published", String(n)), (o = e.agentUniqueId) != null && o.trim() && r.set("agent_unique_id", e.agentUniqueId.trim()), (i = e.flowType) != null && i.trim() && r.set("flow_type", e.flowType.trim()), (a = e.category) != null && a.trim() && r.set("category_unique_id", e.category.trim());
1622
+ for (const s of e.flowUniqueIds ?? [])
1623
+ s && r.append("flow_unique_ids", s);
1624
+ return r;
1625
+ }
1626
+ function Xr(e = {}) {
1627
+ const t = (e.baseUrl ?? "/api/v1").replace(/\/$/, ""), n = e.listPath ?? "/univ/case/list", r = e.fetch ?? fetch, o = e.published ?? 1;
1628
+ return async ({ filter: i, page: a }) => {
1629
+ if (!Jr(i))
1630
+ return { list: [], total: 0, page: 1, pageSize: i.pageSize ?? 20 };
1631
+ const s = await Ze(e), c = Wr(i, a, o), u = await r(`${t}${n}?${c.toString()}`, {
1632
+ method: "GET",
1633
+ headers: s
1634
+ }), d = await Qe(u);
1635
+ return {
1636
+ list: (d.list ?? []).map(Yr),
1637
+ total: d.total ?? 0,
1638
+ page: d.page ?? a,
1639
+ pageSize: d.page_size ?? i.pageSize ?? 20
1640
+ };
1641
+ };
1642
+ }
1643
+ function Ho(e = {}) {
1644
+ var r, o, i, a;
1645
+ const t = {
1646
+ baseUrl: e.baseUrl,
1647
+ fetch: e.fetch,
1648
+ getHeaders: e.getHeaders,
1649
+ authStorage: e.authStorage
1650
+ };
1651
+ return {
1652
+ fetchDetail: $r({
1653
+ ...t,
1654
+ detailPath: (r = e.form) == null ? void 0 : r.detailPath
1655
+ }).fetchDetail,
1656
+ resumeSearch: Gr({
1657
+ ...t,
1658
+ searchPath: (o = e.resume) == null ? void 0 : o.searchPath
1659
+ }),
1660
+ caseSearch: Xr({
1661
+ ...t,
1662
+ listPath: (i = e.case) == null ? void 0 : i.listPath,
1663
+ published: (a = e.case) == null ? void 0 : a.published
1664
+ })
1665
+ };
1666
+ }
1667
+ function Vt(e, t) {
1668
+ if (!t.trim()) return !0;
1669
+ try {
1670
+ return new RegExp(t).test(e);
1671
+ } catch {
1672
+ return !0;
1673
+ }
1674
+ }
1675
+ function Lt(e) {
1676
+ return e == null ? !0 : typeof e == "string" ? !e.trim() : !1;
1677
+ }
1678
+ function Qr(e, t) {
1679
+ switch (e.type) {
1680
+ case "multiselect":
1681
+ case "checkbox":
1682
+ case "file":
1683
+ case "resume_multiselect":
1684
+ case "case_multiselect":
1685
+ return q(t).length === 0;
1686
+ case "toggle":
1687
+ return !le(t);
1688
+ case "number":
1689
+ return t == null || t === "";
1690
+ default:
1691
+ return Lt(t);
1692
+ }
1693
+ }
1694
+ function Be(e, t) {
1695
+ return e.required === !0 || t > 0;
1696
+ }
1697
+ function Zr(e, t) {
1698
+ var n, r;
1699
+ for (const o of e) {
1700
+ const i = (n = o.name) == null ? void 0 : n.trim();
1701
+ if (!i || Se(o.type) || he(o.type)) continue;
1702
+ const a = t[i], s = ((r = o.label) == null ? void 0 : r.trim()) || i;
1703
+ if (o.required && Qr(o, a))
1704
+ return { fieldName: i, label: s, message: `请填写「${s}」` };
1705
+ if (o.type === "email" && !Lt(a)) {
1706
+ const c = String(a).trim();
1707
+ if (!Vt(c, We))
1708
+ return { fieldName: i, label: s, message: `「${s}」格式不正确` };
1709
+ }
1710
+ if (o.type === "file") {
1711
+ const c = o.fileMinCount ?? 0, u = q(a).length;
1712
+ if (c > 0 && u < c && Be(o, u))
1713
+ return {
1714
+ fieldName: i,
1715
+ label: s,
1716
+ message: `「${s}」至少需要 ${c} 个文件`
1717
+ };
1718
+ }
1719
+ if (o.type === "resume_multiselect") {
1720
+ const c = o.resumeMinCount, u = q(a).length;
1721
+ if (c !== void 0 && u < c && Be(o, u))
1722
+ return {
1723
+ fieldName: i,
1724
+ label: s,
1725
+ message: `「${s}」至少选择 ${c} 项`
1726
+ };
1727
+ }
1728
+ if (o.type === "case_multiselect") {
1729
+ const c = o.caseMinCount, u = q(a).length;
1730
+ if (c !== void 0 && u < c && Be(o, u))
1731
+ return {
1732
+ fieldName: i,
1733
+ label: s,
1734
+ message: `「${s}」至少选择 ${c} 项`
1735
+ };
1736
+ }
1737
+ }
1738
+ return null;
1739
+ }
1740
+ const eo = {
1741
+ video: un,
1742
+ audio: cn,
1743
+ image: ln,
1744
+ file: ht,
1745
+ spreadsheet: sn,
1746
+ document: ft
1468
1747
  };
1469
- function kr({
1748
+ function to({
1470
1749
  type: e,
1471
1750
  size: t = 40,
1472
1751
  className: n
1473
1752
  }) {
1474
- const r = Cr[e] ?? tt;
1753
+ const r = eo[e] ?? ht;
1475
1754
  return /* @__PURE__ */ l(
1476
1755
  r,
1477
1756
  {
@@ -1481,7 +1760,7 @@ function kr({
1481
1760
  }
1482
1761
  );
1483
1762
  }
1484
- const Tt = "skopon-form-v0_9", Ar = /* @__PURE__ */ new Set([
1763
+ const $t = "skopon-form-v0_9", no = /* @__PURE__ */ new Set([
1485
1764
  "SkoponMedia",
1486
1765
  "SkoponSelect",
1487
1766
  "Image",
@@ -1493,24 +1772,24 @@ const Tt = "skopon-form-v0_9", Ar = /* @__PURE__ */ new Set([
1493
1772
  "FileUpload",
1494
1773
  "TextField",
1495
1774
  "Text",
1496
- ...Yn()
1497
- ]), Tr = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "caption"]);
1498
- function se(e) {
1499
- const t = [...de.components.values()].find((n) => n.name === e);
1775
+ ...fr()
1776
+ ]), ro = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "caption"]);
1777
+ function ce(e) {
1778
+ const t = [...fe.components.values()].find((n) => n.name === e);
1500
1779
  if (!t) throw new Error(`Missing basic catalog component: ${e}`);
1501
1780
  return t.schema;
1502
1781
  }
1503
- function k(e) {
1782
+ function _(e) {
1504
1783
  return typeof e == "string" ? e : "";
1505
1784
  }
1506
- function Mt(e) {
1785
+ function Dt(e) {
1507
1786
  return Array.isArray(e) ? e.map((t) => {
1508
1787
  if (!t || typeof t != "object") return null;
1509
1788
  const n = t, r = String(n.value ?? n.label ?? ""), o = String(n.label ?? n.value ?? "");
1510
1789
  return { value: r, label: o };
1511
1790
  }).filter((t) => !!t) : [];
1512
1791
  }
1513
- function be({
1792
+ function xe({
1514
1793
  mediaType: e,
1515
1794
  urls: t,
1516
1795
  mediaSize: n,
@@ -1518,17 +1797,17 @@ function be({
1518
1797
  help: o,
1519
1798
  placeholder: i
1520
1799
  }) {
1521
- const a = r == null ? void 0 : r.trim(), s = o == null ? void 0 : o.trim(), c = fn(n), u = (i == null ? void 0 : i.trim()) || (e === "image" ? "未设置图片 URL" : e === "video" ? "未设置视频 URL" : "未设置音频 URL");
1522
- return /* @__PURE__ */ C("div", { className: "form-block-preview", children: [
1800
+ const a = r == null ? void 0 : r.trim(), s = o == null ? void 0 : o.trim(), c = En(n), u = (i == null ? void 0 : i.trim()) || (e === "image" ? "未设置图片 URL" : e === "video" ? "未设置视频 URL" : "未设置音频 URL");
1801
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", children: [
1523
1802
  a ? /* @__PURE__ */ l("div", { className: "form-block-preview-label", children: a }) : null,
1524
- t.length === 0 ? /* @__PURE__ */ l("div", { className: "form-media-preview form-media-preview--empty", children: u }) : /* @__PURE__ */ l("div", { className: c, children: t.map((d, p) => e === "image" ? /* @__PURE__ */ l(
1803
+ t.length === 0 ? /* @__PURE__ */ l("div", { className: "form-media-preview form-media-preview--empty", children: u }) : /* @__PURE__ */ l("div", { className: c, children: t.map((d, m) => e === "image" ? /* @__PURE__ */ l(
1525
1804
  "img",
1526
1805
  {
1527
1806
  src: d,
1528
1807
  alt: a || "图片",
1529
1808
  className: "form-media-item"
1530
1809
  },
1531
- `media-${p}`
1810
+ `media-${m}`
1532
1811
  ) : e === "video" ? /* @__PURE__ */ l(
1533
1812
  "video",
1534
1813
  {
@@ -1536,7 +1815,7 @@ function be({
1536
1815
  controls: !0,
1537
1816
  className: "form-media-item"
1538
1817
  },
1539
- `media-${p}`
1818
+ `media-${m}`
1540
1819
  ) : /* @__PURE__ */ l(
1541
1820
  "audio",
1542
1821
  {
@@ -1544,23 +1823,23 @@ function be({
1544
1823
  controls: !0,
1545
1824
  className: "form-media-item form-media-item--audio"
1546
1825
  },
1547
- `media-${p}`
1826
+ `media-${m}`
1548
1827
  )) }),
1549
- s ? /* @__PURE__ */ l(H.Text, { type: "secondary", className: "form-block-preview-help", children: s }) : null
1828
+ s ? /* @__PURE__ */ l(L.Text, { type: "secondary", className: "form-block-preview-help", children: s }) : null
1550
1829
  ] });
1551
1830
  }
1552
- function Se(e, t) {
1553
- const n = Array.isArray(e.urls) ? e.urls.map((r) => String(r).trim()).filter(Boolean) : k(e.url).trim() ? [k(e.url).trim()] : [];
1831
+ function Ae(e, t) {
1832
+ const n = Array.isArray(e.urls) ? e.urls.map((r) => String(r).trim()).filter(Boolean) : _(e.url).trim() ? [_(e.url).trim()] : [];
1554
1833
  return {
1555
1834
  mediaType: t,
1556
1835
  urls: n,
1557
- mediaSize: le(e.mediaSize),
1558
- label: k(e.label) || k(e.description),
1559
- help: k(e.help),
1560
- placeholder: k(e.placeholder)
1836
+ mediaSize: se(e.mediaSize),
1837
+ label: _(e.label) || _(e.description),
1838
+ help: _(e.help),
1839
+ placeholder: _(e.placeholder)
1561
1840
  };
1562
1841
  }
1563
- const Mr = {
1842
+ const oo = {
1564
1843
  name: "SkoponMedia",
1565
1844
  schema: f.object({
1566
1845
  mediaType: f.any().optional(),
@@ -1570,19 +1849,19 @@ const Mr = {
1570
1849
  help: f.any().optional(),
1571
1850
  placeholder: f.any().optional()
1572
1851
  }).passthrough()
1573
- }, Nr = q(Mr, ({ context: e }) => {
1574
- const t = e.componentModel.properties, n = k(t.mediaType);
1575
- return /* @__PURE__ */ l(be, { ...Se(t, n === "video" ? "video" : n === "audio" ? "audio" : "image") });
1576
- }), Ir = q(
1577
- { name: "Image", schema: se("Image") },
1578
- ({ context: e }) => /* @__PURE__ */ l(be, { ...Se(e.componentModel.properties, "image") })
1579
- ), Fr = q(
1580
- { name: "Video", schema: se("Video") },
1581
- ({ context: e }) => /* @__PURE__ */ l(be, { ...Se(e.componentModel.properties, "video") })
1582
- ), Pr = q(
1583
- { name: "AudioPlayer", schema: se("AudioPlayer") },
1584
- ({ context: e }) => /* @__PURE__ */ l(be, { ...Se(e.componentModel.properties, "audio") })
1585
- ), zr = {
1852
+ }, io = O(oo, ({ context: e }) => {
1853
+ const t = e.componentModel.properties, n = _(t.mediaType);
1854
+ return /* @__PURE__ */ l(xe, { ...Ae(t, n === "video" ? "video" : n === "audio" ? "audio" : "image") });
1855
+ }), ao = O(
1856
+ { name: "Image", schema: ce("Image") },
1857
+ ({ context: e }) => /* @__PURE__ */ l(xe, { ...Ae(e.componentModel.properties, "image") })
1858
+ ), so = O(
1859
+ { name: "Video", schema: ce("Video") },
1860
+ ({ context: e }) => /* @__PURE__ */ l(xe, { ...Ae(e.componentModel.properties, "video") })
1861
+ ), lo = O(
1862
+ { name: "AudioPlayer", schema: ce("AudioPlayer") },
1863
+ ({ context: e }) => /* @__PURE__ */ l(xe, { ...Ae(e.componentModel.properties, "audio") })
1864
+ ), co = {
1586
1865
  name: "SkoponSelect",
1587
1866
  schema: f.object({
1588
1867
  label: f.any().optional(),
@@ -1592,15 +1871,15 @@ const Mr = {
1592
1871
  value: f.any().optional()
1593
1872
  }).passthrough()
1594
1873
  };
1595
- function Ur({ context: e }) {
1596
- const { interactive: t } = K(), { value: n, setValue: r } = G(e), o = e.componentModel.properties, i = k(o.label), a = k(o.placeholder), s = Mt(o.options), c = k(o.mode) === "multiple";
1597
- return B(() => {
1598
- const u = ct(n, c);
1874
+ function uo({ context: e }) {
1875
+ const { interactive: t } = H(), { value: n, setValue: r } = K(e), o = e.componentModel.properties, i = _(o.label), a = _(o.placeholder), s = Dt(o.options), c = _(o.mode) === "multiple";
1876
+ return R(() => {
1877
+ const u = xt(n, c);
1599
1878
  u !== null && r(u);
1600
- }, [c, n, r]), /* @__PURE__ */ C("div", { className: "form-block-preview", children: [
1879
+ }, [c, n, r]), /* @__PURE__ */ I("div", { className: "form-block-preview", children: [
1601
1880
  i ? /* @__PURE__ */ l("div", { className: "form-block-preview-label", children: i }) : null,
1602
1881
  /* @__PURE__ */ l(
1603
- Ue,
1882
+ we,
1604
1883
  {
1605
1884
  mode: c ? "multiple" : void 0,
1606
1885
  disabled: !t,
@@ -1609,25 +1888,25 @@ function Ur({ context: e }) {
1609
1888
  style: { width: "100%" },
1610
1889
  placeholder: a || (c ? "请选择多项" : "请选择"),
1611
1890
  options: s,
1612
- value: c ? $(n) : oe(n),
1891
+ value: c ? q(n) : oe(n),
1613
1892
  onChange: (u) => r(c ? u ?? [] : u ?? "")
1614
1893
  }
1615
1894
  )
1616
1895
  ] });
1617
1896
  }
1618
- const _r = q(
1619
- zr,
1620
- Ur
1897
+ const mo = O(
1898
+ co,
1899
+ uo
1621
1900
  );
1622
- function Er({ context: e }) {
1623
- const { interactive: t } = K(), { value: n, setValue: r } = G(e), o = e.componentModel.properties, i = k(o.label), a = k(o.variant) || "mutuallyExclusive", s = k(o.skoponPickerType), c = k(o.placeholder), u = Mt(o.options), p = s === "select" || s === "multiselect" || s === "radio" || s === "checkbox" ? s : a === "multipleSelection" ? "checkbox" : "radio", v = p === "multiselect" || p === "checkbox";
1624
- return B(() => {
1625
- const g = ct(n, v);
1626
- g !== null && r(g);
1627
- }, [v, n, r]), /* @__PURE__ */ C("div", { className: "form-block-preview", children: [
1901
+ function po({ context: e }) {
1902
+ const { interactive: t } = H(), { value: n, setValue: r } = K(e), o = e.componentModel.properties, i = _(o.label), a = _(o.variant) || "mutuallyExclusive", s = _(o.skoponPickerType), c = _(o.placeholder), u = Dt(o.options), m = s === "select" || s === "multiselect" || s === "radio" || s === "checkbox" ? s : a === "multipleSelection" ? "checkbox" : "radio", v = m === "multiselect" || m === "checkbox";
1903
+ return R(() => {
1904
+ const h = xt(n, v);
1905
+ h !== null && r(h);
1906
+ }, [v, n, r]), /* @__PURE__ */ I("div", { className: "form-block-preview", children: [
1628
1907
  i ? /* @__PURE__ */ l("div", { className: "form-block-preview-label", children: i }) : null,
1629
- p === "select" ? /* @__PURE__ */ l(
1630
- Ue,
1908
+ m === "select" ? /* @__PURE__ */ l(
1909
+ we,
1631
1910
  {
1632
1911
  disabled: !t,
1633
1912
  allowClear: !0,
@@ -1636,10 +1915,10 @@ function Er({ context: e }) {
1636
1915
  placeholder: c || "请选择",
1637
1916
  options: u,
1638
1917
  value: oe(n),
1639
- onChange: (g) => r(g ?? "")
1918
+ onChange: (h) => r(h ?? "")
1640
1919
  }
1641
- ) : p === "multiselect" ? /* @__PURE__ */ l(
1642
- Ue,
1920
+ ) : m === "multiselect" ? /* @__PURE__ */ l(
1921
+ we,
1643
1922
  {
1644
1923
  mode: "multiple",
1645
1924
  disabled: !t,
@@ -1648,31 +1927,31 @@ function Er({ context: e }) {
1648
1927
  style: { width: "100%" },
1649
1928
  placeholder: c || "请选择多项",
1650
1929
  options: u,
1651
- value: $(n),
1652
- onChange: (g) => r(g ?? [])
1930
+ value: q(n),
1931
+ onChange: (h) => r(h ?? [])
1653
1932
  }
1654
- ) : p === "checkbox" ? /* @__PURE__ */ l(
1655
- Ut.Group,
1933
+ ) : m === "checkbox" ? /* @__PURE__ */ l(
1934
+ Xt.Group,
1656
1935
  {
1657
1936
  disabled: !t,
1658
1937
  className: "form-block-preview-control",
1659
1938
  options: u,
1660
- value: $(n),
1661
- onChange: (g) => r(g)
1939
+ value: q(n),
1940
+ onChange: (h) => r(h)
1662
1941
  }
1663
1942
  ) : /* @__PURE__ */ l(
1664
- _t.Group,
1943
+ Qt.Group,
1665
1944
  {
1666
1945
  disabled: !t,
1667
1946
  className: "form-block-preview-control",
1668
1947
  options: u,
1669
1948
  value: oe(n),
1670
- onChange: (g) => r(g.target.value)
1949
+ onChange: (h) => r(h.target.value)
1671
1950
  }
1672
1951
  )
1673
1952
  ] });
1674
1953
  }
1675
- const Rr = q(
1954
+ const fo = O(
1676
1955
  {
1677
1956
  name: "ChoicePicker",
1678
1957
  schema: f.object({
@@ -1684,57 +1963,57 @@ const Rr = q(
1684
1963
  placeholder: f.any().optional()
1685
1964
  }).passthrough()
1686
1965
  },
1687
- Er
1966
+ po
1688
1967
  );
1689
- function Br({ context: e }) {
1690
- const { interactive: t } = K(), { value: n, setValue: r } = G(e), o = e.componentModel.properties, i = k(o.label);
1691
- return /* @__PURE__ */ C("div", { className: "form-block-preview", children: [
1968
+ function ho({ context: e }) {
1969
+ const { interactive: t } = H(), { value: n, setValue: r } = K(e), o = e.componentModel.properties, i = _(o.label);
1970
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", children: [
1692
1971
  i ? /* @__PURE__ */ l("div", { className: "form-block-preview-label", children: i }) : null,
1693
1972
  /* @__PURE__ */ l(
1694
- Et,
1973
+ Zt,
1695
1974
  {
1696
1975
  disabled: !t,
1697
1976
  className: "form-block-preview-control",
1698
- checked: ye(n),
1977
+ checked: le(n),
1699
1978
  onChange: (a) => r(a)
1700
1979
  }
1701
1980
  )
1702
1981
  ] });
1703
1982
  }
1704
- const Or = q(
1705
- { name: "CheckBox", schema: se("CheckBox") },
1706
- Br
1983
+ const go = O(
1984
+ { name: "CheckBox", schema: ce("CheckBox") },
1985
+ ho
1707
1986
  );
1708
- function Vr(e, t, n) {
1987
+ function yo(e, t, n) {
1709
1988
  const r = oe(e);
1710
1989
  if (!r) return;
1711
1990
  if (!t && n) {
1712
- const i = Ge(r, "HH:mm", !0);
1991
+ const i = at(r, "HH:mm", !0);
1713
1992
  return i.isValid() ? i : void 0;
1714
1993
  }
1715
- const o = Ge(r);
1994
+ const o = at(r);
1716
1995
  return o.isValid() ? o : void 0;
1717
1996
  }
1718
- function qr({ context: e }) {
1719
- const { interactive: t } = K(), { value: n, setValue: r } = G(e), o = e.componentModel.properties, i = k(o.label), a = k(o.placeholder), s = o.enableDate === !0, c = o.enableTime === !0, u = Vr(n, s, c), d = (p) => {
1720
- if (!p) {
1997
+ function vo({ context: e }) {
1998
+ const { interactive: t } = H(), { value: n, setValue: r } = K(e), o = e.componentModel.properties, i = _(o.label), a = _(o.placeholder), s = o.enableDate === !0, c = o.enableTime === !0, u = yo(n, s, c), d = (m) => {
1999
+ if (!m) {
1721
2000
  r("");
1722
2001
  return;
1723
2002
  }
1724
2003
  if (!s && c) {
1725
- r(p.format("HH:mm"));
2004
+ r(m.format("HH:mm"));
1726
2005
  return;
1727
2006
  }
1728
2007
  if (s && c) {
1729
- r(p.format("YYYY-MM-DDTHH:mm"));
2008
+ r(m.format("YYYY-MM-DDTHH:mm"));
1730
2009
  return;
1731
2010
  }
1732
- r(p.format("YYYY-MM-DD"));
2011
+ r(m.format("YYYY-MM-DD"));
1733
2012
  };
1734
- return /* @__PURE__ */ C("div", { className: "form-block-preview", children: [
2013
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", children: [
1735
2014
  i ? /* @__PURE__ */ l("div", { className: "form-block-preview-label", children: i }) : null,
1736
2015
  !s && c ? /* @__PURE__ */ l(
1737
- Rt,
2016
+ en,
1738
2017
  {
1739
2018
  disabled: !t,
1740
2019
  className: "form-block-preview-control",
@@ -1744,7 +2023,7 @@ function qr({ context: e }) {
1744
2023
  onChange: d
1745
2024
  }
1746
2025
  ) : /* @__PURE__ */ l(
1747
- Bt,
2026
+ tn,
1748
2027
  {
1749
2028
  showTime: s && c,
1750
2029
  disabled: !t,
@@ -1757,7 +2036,7 @@ function qr({ context: e }) {
1757
2036
  )
1758
2037
  ] });
1759
2038
  }
1760
- const wr = q(
2039
+ const bo = O(
1761
2040
  {
1762
2041
  name: "DateTimeInput",
1763
2042
  schema: f.object({
@@ -1770,8 +2049,8 @@ const wr = q(
1770
2049
  max: f.any().optional()
1771
2050
  }).passthrough()
1772
2051
  },
1773
- qr
1774
- ), Lr = {
2052
+ vo
2053
+ ), So = {
1775
2054
  name: "FileUpload",
1776
2055
  schema: f.object({
1777
2056
  label: f.any().optional(),
@@ -1783,109 +2062,130 @@ const wr = q(
1783
2062
  value: f.any().optional()
1784
2063
  }).passthrough()
1785
2064
  };
1786
- function jr({ context: e }) {
1787
- const { interactive: t } = K(), { value: n, setValue: r } = G(e), o = e.componentModel.properties, i = k(o.label), a = k(o.accept), s = Array.isArray(o.fileAcceptTypes) ? o.fileAcceptTypes.map(String) : void 0, c = a ? a.split(",").map((m) => m.trim()).filter(Boolean) : void 0, u = ln(s, c), d = typeof o.filePlaceholderIcon == "string" && ["video", "audio", "image", "file", "spreadsheet", "document"].includes(
2065
+ function ko({ context: e }) {
2066
+ const { interactive: t } = H(), { value: n, setValue: r } = K(e), o = e.componentModel.properties, i = _(o.label), a = _(o.accept), s = Array.isArray(o.fileAcceptTypes) ? o.fileAcceptTypes.map(String) : void 0, c = a ? a.split(",").map((p) => p.trim()).filter(Boolean) : void 0, u = In(s, c), d = typeof o.filePlaceholderIcon == "string" && ["video", "audio", "image", "file", "spreadsheet", "document"].includes(
1788
2067
  o.filePlaceholderIcon
1789
- ) ? o.filePlaceholderIcon : "document", p = typeof o.minCount == "number" ? Math.max(0, o.minCount) : 0, v = typeof o.maxCount == "number" ? o.maxCount : 1, g = v > 0, A = $(n), E = g && A.length >= v, T = A.length < p;
1790
- return /* @__PURE__ */ C("div", { className: "form-block-preview", children: [
2068
+ ) ? o.filePlaceholderIcon : "document", m = typeof o.minCount == "number" ? Math.max(0, o.minCount) : 0, v = typeof o.maxCount == "number" ? o.maxCount : 1, h = v > 0, x = q(n), N = h && x.length >= v, k = x.length < m;
2069
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", children: [
1791
2070
  i ? /* @__PURE__ */ l("div", { className: "form-block-preview-label", children: i }) : null,
1792
- /* @__PURE__ */ C(
1793
- ke.Dragger,
2071
+ /* @__PURE__ */ I(
2072
+ _e.Dragger,
1794
2073
  {
1795
- disabled: !t || E,
1796
- accept: an(s, c),
2074
+ disabled: !t || N,
2075
+ accept: Tn(s, c),
1797
2076
  className: "form-file-upload-preview",
1798
- showUploadList: t && A.length > 0,
1799
- fileList: t ? A.map((m, h) => ({
1800
- uid: `${h}-${m}`,
1801
- name: m,
2077
+ showUploadList: t && x.length > 0,
2078
+ fileList: t ? x.map((p, b) => ({
2079
+ uid: `${b}-${p}`,
2080
+ name: p,
1802
2081
  status: "done"
1803
2082
  })) : [],
1804
- beforeUpload: (m) => {
1805
- if (!t) return ke.LIST_IGNORE;
1806
- const h = $(Xe(e));
1807
- if (g && h.length >= v) return ke.LIST_IGNORE;
1808
- const x = g ? [...h, m.name].slice(0, v) : [...h, m.name];
1809
- return r(x), !1;
2083
+ beforeUpload: (p) => {
2084
+ if (!t) return _e.LIST_IGNORE;
2085
+ const b = q(ct(e));
2086
+ if (h && b.length >= v) return _e.LIST_IGNORE;
2087
+ const g = h ? [...b, p.name].slice(0, v) : [...b, p.name];
2088
+ return r(g), !1;
1810
2089
  },
1811
- onRemove: (m) => {
1812
- const h = $(Xe(e)), x = /^(\d+)-/.exec(m.uid ?? ""), y = x ? Number(x[1]) : -1, S = y >= 0 && y < h.length ? h.filter((N, _) => _ !== y) : h.filter((N) => N !== m.name);
1813
- if (S.length < p) return !1;
1814
- r(S);
2090
+ onRemove: (p) => {
2091
+ const b = q(ct(e)), g = /^(\d+)-/.exec(p.uid ?? ""), C = g ? Number(g[1]) : -1, U = C >= 0 && C < b.length ? b.filter((S, A) => A !== C) : b.filter((S) => S !== p.name);
2092
+ if (U.length < m) return !1;
2093
+ r(U);
1815
2094
  },
1816
2095
  children: [
1817
- /* @__PURE__ */ l("p", { className: "form-file-upload-preview-icon", children: /* @__PURE__ */ l(kr, { type: d, size: 40 }) }),
2096
+ /* @__PURE__ */ l("p", { className: "form-file-upload-preview-icon", children: /* @__PURE__ */ l(to, { type: d, size: 40 }) }),
1818
2097
  /* @__PURE__ */ l("p", { className: "form-file-upload-preview-text", children: "点击或拖拽文件到此处上传" })
1819
2098
  ]
1820
2099
  }
1821
2100
  ),
1822
- /* @__PURE__ */ C(H.Text, { type: "secondary", className: "form-block-preview-help", children: [
2101
+ /* @__PURE__ */ I(L.Text, { type: "secondary", className: "form-block-preview-help", children: [
1823
2102
  "允许:",
1824
2103
  u ?? "全部类型",
1825
- p > 0 ? `;至少 ${p} 个文件` : "",
1826
- g ? `;最多 ${v} 个文件` : "",
2104
+ m > 0 ? `;至少 ${m} 个文件` : "",
2105
+ h ? `;最多 ${v} 个文件` : "",
1827
2106
  ";当前仅收集文件名(不含文件内容,需宿主另行上传)",
1828
- T && t ? `(当前 ${A.length} 个,未达下限)` : ""
2107
+ k && t ? `(当前 ${x.length} 个,未达下限)` : ""
1829
2108
  ] })
1830
2109
  ] });
1831
2110
  }
1832
- const $r = q(
1833
- Lr,
1834
- jr
2111
+ const Co = O(
2112
+ So,
2113
+ ko
1835
2114
  );
1836
- function Dr({ context: e }) {
1837
- const { interactive: t } = K(), { value: n, setValue: r } = G(e), o = e.componentModel.properties, i = k(o.label), a = k(o.placeholder), s = k(o.variant) || "shortText", c = oe(n) ?? "", u = !t, d = "form-block-preview-control";
1838
- let p;
2115
+ function xo({ context: e }) {
2116
+ const { interactive: t } = H(), { value: n, setValue: r } = K(e), o = e.componentModel.properties, i = _(o.label), a = _(o.placeholder), s = _(o.variant) || "shortText", c = _(o.validationRegexp), u = oe(n) ?? "", d = !t, [m, v] = F(""), h = (k) => {
2117
+ if (!c || !k.trim()) {
2118
+ v("");
2119
+ return;
2120
+ }
2121
+ v(Vt(k, c) ? "" : "格式不正确");
2122
+ };
2123
+ R(() => {
2124
+ h(u);
2125
+ }, [c, u]);
2126
+ const x = "form-block-preview-control";
2127
+ let N;
1839
2128
  if (s === "longText")
1840
- p = /* @__PURE__ */ l(
1841
- Ae.TextArea,
2129
+ N = /* @__PURE__ */ l(
2130
+ Me.TextArea,
1842
2131
  {
1843
- disabled: u,
1844
- className: d,
2132
+ disabled: d,
2133
+ className: x,
1845
2134
  placeholder: a || "长文本回答...",
1846
2135
  autoSize: { minRows: 2, maxRows: 6 },
1847
- value: c,
1848
- onChange: (v) => r(v.target.value)
2136
+ value: u,
2137
+ status: m ? "error" : void 0,
2138
+ onChange: (k) => {
2139
+ const p = k.target.value;
2140
+ r(p), h(p);
2141
+ },
2142
+ onBlur: (k) => h(k.target.value)
1849
2143
  }
1850
2144
  );
1851
2145
  else if (s === "number") {
1852
- const v = c && Number.isFinite(Number(c)) ? Number(c) : void 0;
1853
- p = /* @__PURE__ */ l(
1854
- Ot,
2146
+ const k = u && Number.isFinite(Number(u)) ? Number(u) : void 0;
2147
+ N = /* @__PURE__ */ l(
2148
+ nn,
1855
2149
  {
1856
- disabled: u,
1857
- className: d,
2150
+ disabled: d,
2151
+ className: x,
1858
2152
  style: { width: "100%" },
1859
2153
  placeholder: a || "数字",
1860
- value: v,
1861
- onChange: (g) => r(g == null ? "" : String(g))
2154
+ value: k,
2155
+ onChange: (p) => r(p == null ? "" : String(p))
1862
2156
  }
1863
2157
  );
1864
- } else s === "obscured" ? p = /* @__PURE__ */ l(
1865
- Ae.Password,
2158
+ } else s === "obscured" ? N = /* @__PURE__ */ l(
2159
+ Me.Password,
1866
2160
  {
1867
- disabled: u,
1868
- className: d,
2161
+ disabled: d,
2162
+ className: x,
1869
2163
  placeholder: a,
1870
- value: c,
1871
- onChange: (v) => r(v.target.value)
2164
+ value: u,
2165
+ onChange: (k) => r(k.target.value)
1872
2166
  }
1873
- ) : p = /* @__PURE__ */ l(
1874
- Ae,
2167
+ ) : N = /* @__PURE__ */ l(
2168
+ Me,
1875
2169
  {
1876
- disabled: u,
1877
- className: d,
2170
+ disabled: d,
2171
+ className: x,
1878
2172
  placeholder: a,
1879
- value: c,
1880
- onChange: (v) => r(v.target.value)
2173
+ value: u,
2174
+ status: m ? "error" : void 0,
2175
+ onChange: (k) => {
2176
+ const p = k.target.value;
2177
+ r(p), h(p);
2178
+ },
2179
+ onBlur: (k) => h(k.target.value)
1881
2180
  }
1882
2181
  );
1883
- return /* @__PURE__ */ C("div", { className: "form-block-preview", children: [
2182
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", children: [
1884
2183
  i ? /* @__PURE__ */ l("div", { className: "form-block-preview-label", children: i }) : null,
1885
- p
2184
+ N,
2185
+ m ? /* @__PURE__ */ l(L.Text, { type: "danger", className: "form-block-preview-help", children: m }) : null
1886
2186
  ] });
1887
2187
  }
1888
- const Hr = q(
2188
+ const Ao = O(
1889
2189
  {
1890
2190
  name: "TextField",
1891
2191
  schema: f.object({
@@ -1896,35 +2196,35 @@ const Hr = q(
1896
2196
  value: f.any().optional()
1897
2197
  }).passthrough()
1898
2198
  },
1899
- Dr
2199
+ xo
1900
2200
  );
1901
- function Kr({ context: e }) {
1902
- const t = e.componentModel.properties, n = k(t.text), r = k(t.variant) || "body";
1903
- return Tr.has(r) ? r === "caption" ? /* @__PURE__ */ l(H.Text, { type: "secondary", className: "form-block-preview-paragraph", children: /* @__PURE__ */ l("em", { children: n }) }) : /* @__PURE__ */ l(r, { className: "form-block-preview-heading", children: n }) : /* @__PURE__ */ l(H.Paragraph, { className: "form-block-preview-paragraph", children: n });
2201
+ function To({ context: e }) {
2202
+ const t = e.componentModel.properties, n = _(t.text), r = _(t.variant) || "body";
2203
+ return ro.has(r) ? r === "caption" ? /* @__PURE__ */ l(L.Text, { type: "secondary", className: "form-block-preview-paragraph", children: /* @__PURE__ */ l("em", { children: n }) }) : /* @__PURE__ */ l(r, { className: "form-block-preview-heading", children: n }) : /* @__PURE__ */ l(L.Paragraph, { className: "form-block-preview-paragraph", children: n });
1904
2204
  }
1905
- const Gr = q(
1906
- { name: "Text", schema: se("Text") },
1907
- Kr
2205
+ const Io = O(
2206
+ { name: "Text", schema: ce("Text") },
2207
+ To
1908
2208
  );
1909
- function Nt() {
2209
+ function Ht() {
1910
2210
  const t = [
1911
- ...[...de.components.values()].filter(
1912
- (r) => !Ar.has(r.name)
2211
+ ...[...fe.components.values()].filter(
2212
+ (r) => !no.has(r.name)
1913
2213
  ),
1914
- Nr,
1915
- _r,
1916
- Ir,
1917
- Fr,
1918
- Pr,
1919
- Rr,
1920
- Or,
1921
- wr,
1922
- $r,
1923
- Hr,
1924
- Gr,
1925
- ...Jn()
1926
- ], n = [...de.functions.values()];
1927
- return new Ht(Tt, t, n, de.themeSchema);
2214
+ io,
2215
+ mo,
2216
+ ao,
2217
+ so,
2218
+ lo,
2219
+ fo,
2220
+ go,
2221
+ bo,
2222
+ Co,
2223
+ Ao,
2224
+ Io,
2225
+ ...pr()
2226
+ ], n = [...fe.functions.values()];
2227
+ return new mn($t, t, n, fe.themeSchema);
1928
2228
  }
1929
2229
  const D = {
1930
2230
  jade9: "#29a383",
@@ -1938,7 +2238,7 @@ const D = {
1938
2238
  primaryHover: "#26997b",
1939
2239
  primaryActive: "#1d3b31",
1940
2240
  onPrimary: "#ffffff"
1941
- }, Jr = {
2241
+ }, _o = {
1942
2242
  cssVar: { key: "vidtempl" },
1943
2243
  token: {
1944
2244
  colorPrimary: D.primarySolid,
@@ -2023,14 +2323,14 @@ const D = {
2023
2323
  }
2024
2324
  }
2025
2325
  };
2026
- function X({
2326
+ function J({
2027
2327
  children: e,
2028
2328
  locale: t,
2029
2329
  theme: n
2030
2330
  }) {
2031
- return /* @__PURE__ */ l(Vt, { theme: n ?? Jr, locale: t, children: e });
2331
+ return /* @__PURE__ */ l(rn, { theme: n ?? _o, locale: t, children: e });
2032
2332
  }
2033
- const Yr = Ft(
2333
+ const Mo = Jt(
2034
2334
  function({
2035
2335
  doc: t,
2036
2336
  surfaceId: n = "skopon-form",
@@ -2041,57 +2341,57 @@ const Yr = Ft(
2041
2341
  caseSearch: s = null,
2042
2342
  wrapProvider: c = !0
2043
2343
  }, u) {
2044
- B(() => {
2045
- it(), ot();
2344
+ R(() => {
2345
+ bt(), vt();
2046
2346
  }, []);
2047
- const d = L(null), p = L(i);
2048
- p.current = i;
2049
- const v = V(() => {
2050
- if (qe(t)) return "";
2347
+ const d = j(null), m = j(i);
2348
+ m.current = i;
2349
+ const v = B(() => {
2350
+ if ($e(t)) return "";
2051
2351
  try {
2052
2352
  return JSON.stringify(t);
2053
2353
  } catch {
2054
2354
  return String(t);
2055
2355
  }
2056
- }, [t]), g = V(() => {
2356
+ }, [t]), h = B(() => {
2057
2357
  if (!v)
2058
2358
  return { surfaces: [], processor: null };
2059
2359
  try {
2060
- const m = JSON.parse(v), h = new rt([Nt()]), x = ir(m, {
2360
+ const p = JSON.parse(v), b = new yt([Ht()]), g = Ar(p, {
2061
2361
  surfaceId: n,
2062
- catalogId: Tt
2362
+ catalogId: $t
2063
2363
  });
2064
- return h.processMessages(x), {
2065
- surfaces: Array.from(h.model.surfacesMap.values()),
2066
- processor: h
2364
+ return b.processMessages(g), {
2365
+ surfaces: Array.from(b.model.surfacesMap.values()),
2366
+ processor: b
2067
2367
  };
2068
- } catch (m) {
2069
- return console.error("[SkoponFormRenderer] 渲染 A2UI surface 失败", m), { surfaces: [], processor: null };
2368
+ } catch (p) {
2369
+ return console.error("[SkoponFormRenderer] 渲染 A2UI surface 失败", p), { surfaces: [], processor: null };
2070
2370
  }
2071
- }, [v, n]), { surfaces: A, processor: E } = g;
2072
- if (d.current = E, Pt(
2371
+ }, [v, n]), { surfaces: x, processor: N } = h;
2372
+ if (d.current = N, Yt(
2073
2373
  u,
2074
2374
  () => ({
2075
- getValues(m) {
2076
- const h = d.current;
2077
- if (!h) return {};
2078
- const x = (m ?? p.current).map((y) => y.trim()).filter(Boolean);
2079
- return cr(h, n, x);
2375
+ getValues(p) {
2376
+ const b = d.current;
2377
+ if (!b) return {};
2378
+ const g = (p ?? m.current).map((C) => C.trim()).filter(Boolean);
2379
+ return Mr(b, n, g);
2080
2380
  }
2081
2381
  }),
2082
2382
  [n]
2083
- ), A.length === 0) {
2084
- const m = /* @__PURE__ */ l(Be, { resumeSearch: a, children: /* @__PURE__ */ l(Re, { caseSearch: s, children: /* @__PURE__ */ l(Ee, { interactive: o, children: r }) }) });
2085
- return c ? /* @__PURE__ */ l(X, { children: m }) : m;
2383
+ ), x.length === 0) {
2384
+ const p = /* @__PURE__ */ l(je, { resumeSearch: a, children: /* @__PURE__ */ l(Oe, { caseSearch: s, children: /* @__PURE__ */ l(qe, { interactive: o, children: r }) }) });
2385
+ return c ? /* @__PURE__ */ l(J, { children: p }) : p;
2086
2386
  }
2087
- const T = /* @__PURE__ */ l(Be, { resumeSearch: a, children: /* @__PURE__ */ l(Re, { caseSearch: s, children: /* @__PURE__ */ l(Ee, { interactive: o, children: /* @__PURE__ */ l("div", { className: "a2ui-surface a2ui-container", children: A.map((m) => /* @__PURE__ */ l(nt, { surface: m }, m.id)) }) }) }) });
2088
- return c ? /* @__PURE__ */ l(X, { children: T }) : T;
2387
+ const k = /* @__PURE__ */ l(je, { resumeSearch: a, children: /* @__PURE__ */ l(Oe, { caseSearch: s, children: /* @__PURE__ */ l(qe, { interactive: o, children: /* @__PURE__ */ l("div", { className: "a2ui-surface a2ui-container", children: x.map((p) => /* @__PURE__ */ l(gt, { surface: p }, p.id)) }) }) }) });
2388
+ return c ? /* @__PURE__ */ l(J, { children: k }) : k;
2089
2389
  }
2090
2390
  );
2091
2391
  function pe() {
2092
- return new rt([Nt()]);
2392
+ return new yt([Ht()]);
2093
2393
  }
2094
- function uo({
2394
+ function Ko({
2095
2395
  messages: e,
2096
2396
  surfaceId: t = "skopon-form-stream",
2097
2397
  emptyHint: n = null,
@@ -2099,111 +2399,149 @@ function uo({
2099
2399
  resumeSearch: o = null,
2100
2400
  caseSearch: i = null
2101
2401
  }) {
2102
- B(() => {
2103
- it(), ot();
2402
+ R(() => {
2403
+ bt(), vt();
2104
2404
  }, []);
2105
- const a = L(null);
2405
+ const a = j(null);
2106
2406
  a.current === null && (a.current = pe());
2107
- const s = L(0), c = L(""), u = L(!0), d = L(t);
2108
- function p(m, h) {
2109
- a.current = m, s.current = h.length, c.current = JSON.stringify(h), u.current && (A(m), T(Array.from(m.model.surfacesMap.values())));
2407
+ const s = j(0), c = j(""), u = j(!0), d = j(t);
2408
+ function m(p, b) {
2409
+ a.current = p, s.current = b.length, c.current = JSON.stringify(b), u.current && (x(p), k(Array.from(p.model.surfacesMap.values())));
2110
2410
  }
2111
- function v(m, h) {
2112
- if (h <= 0) return !1;
2113
- const x = JSON.stringify(m.slice(0, h)), y = c.current;
2114
- if (!y) return !0;
2411
+ function v(p, b) {
2412
+ if (b <= 0) return !1;
2413
+ const g = JSON.stringify(p.slice(0, b)), C = c.current;
2414
+ if (!C) return !0;
2115
2415
  try {
2116
- const S = JSON.parse(y);
2117
- return JSON.stringify(S.slice(0, h)) !== x;
2416
+ const U = JSON.parse(C);
2417
+ return JSON.stringify(U.slice(0, b)) !== g;
2118
2418
  } catch {
2119
2419
  return !0;
2120
2420
  }
2121
2421
  }
2122
- const [g, A] = P(
2422
+ const [h, x] = F(
2123
2423
  () => a.current
2124
- ), [E, T] = P(
2424
+ ), [N, k] = F(
2125
2425
  () => Array.from(
2126
2426
  a.current.model.surfacesMap.values()
2127
2427
  )
2128
2428
  );
2129
- return B(() => (u.current = !0, () => {
2429
+ return R(() => (u.current = !0, () => {
2130
2430
  u.current = !1;
2131
- }), []), B(() => {
2132
- a.current = g;
2133
- }, [g]), B(() => {
2134
- const m = () => {
2135
- u.current && T(Array.from(g.model.surfacesMap.values()));
2136
- }, h = g.onSurfaceCreated(m), x = g.onSurfaceDeleted(m);
2431
+ }), []), R(() => {
2432
+ a.current = h;
2433
+ }, [h]), R(() => {
2434
+ const p = () => {
2435
+ u.current && k(Array.from(h.model.surfacesMap.values()));
2436
+ }, b = h.onSurfaceCreated(p), g = h.onSurfaceDeleted(p);
2137
2437
  return () => {
2138
- h.unsubscribe(), x.unsubscribe();
2438
+ b.unsubscribe(), g.unsubscribe();
2139
2439
  };
2140
- }, [g]), B(() => {
2141
- let m = !1;
2142
- const h = d.current !== t;
2143
- if (d.current = t, h) {
2144
- const N = pe();
2145
- return Array.isArray(e) && e.length > 0 ? (N.processMessages(e), m || p(N, e)) : (a.current = N, s.current = 0, c.current = "", m || (A(N), T([]))), () => {
2146
- m = !0;
2440
+ }, [h]), R(() => {
2441
+ let p = !1;
2442
+ const b = d.current !== t;
2443
+ if (d.current = t, b) {
2444
+ const S = pe();
2445
+ return Array.isArray(e) && e.length > 0 ? (S.processMessages(e), p || m(S, e)) : (a.current = S, s.current = 0, c.current = "", p || (x(S), k([]))), () => {
2446
+ p = !0;
2147
2447
  };
2148
2448
  }
2149
2449
  if (!Array.isArray(e) || e.length === 0) {
2150
2450
  if (s.current > 0) {
2151
- const N = pe();
2152
- a.current = N, s.current = 0, c.current = "", m || (A(N), T([]));
2451
+ const S = pe();
2452
+ a.current = S, s.current = 0, c.current = "", p || (x(S), k([]));
2153
2453
  }
2154
2454
  return () => {
2155
- m = !0;
2455
+ p = !0;
2156
2456
  };
2157
2457
  }
2158
- const x = a.current, y = s.current;
2159
- if (e.length < y || v(e, y)) {
2160
- const N = pe();
2161
- return N.processMessages(e), m || p(N, e), () => {
2162
- m = !0;
2458
+ const g = a.current, C = s.current;
2459
+ if (e.length < C || v(e, C)) {
2460
+ const S = pe();
2461
+ return S.processMessages(e), p || m(S, e), () => {
2462
+ p = !0;
2163
2463
  };
2164
2464
  }
2165
- const S = e.slice(y);
2166
- return S.length === 0 ? () => {
2167
- m = !0;
2168
- } : (x.processMessages(S), s.current = e.length, c.current = JSON.stringify(e), m || T(Array.from(x.model.surfacesMap.values())), () => {
2169
- m = !0;
2465
+ const U = e.slice(C);
2466
+ return U.length === 0 ? () => {
2467
+ p = !0;
2468
+ } : (g.processMessages(U), s.current = e.length, c.current = JSON.stringify(e), p || k(Array.from(g.model.surfacesMap.values())), () => {
2469
+ p = !0;
2170
2470
  });
2171
- }, [e, t]), E.length === 0 ? /* @__PURE__ */ l(X, { children: n }) : /* @__PURE__ */ l(X, { children: /* @__PURE__ */ l(Be, { resumeSearch: o, children: /* @__PURE__ */ l(Re, { caseSearch: i, children: /* @__PURE__ */ l(Ee, { interactive: r, children: /* @__PURE__ */ l("div", { className: "a2ui-surface a2ui-container", children: E.map((m) => /* @__PURE__ */ l(nt, { surface: m }, m.id)) }) }) }) }) });
2471
+ }, [e, t]), N.length === 0 ? /* @__PURE__ */ l(J, { children: n }) : /* @__PURE__ */ l(J, { children: /* @__PURE__ */ l(je, { resumeSearch: o, children: /* @__PURE__ */ l(Oe, { caseSearch: i, children: /* @__PURE__ */ l(qe, { interactive: r, children: /* @__PURE__ */ l("div", { className: "a2ui-surface a2ui-container", children: N.map((p) => /* @__PURE__ */ l(gt, { surface: p }, p.id)) }) }) }) }) });
2472
+ }
2473
+ function No(e, t) {
2474
+ if (t && typeof t == "object" && t !== null && "message" in t) {
2475
+ const n = t.message;
2476
+ if (typeof n == "string" && n.trim())
2477
+ return `提交失败 (${e}): ${n.trim()}`;
2478
+ }
2479
+ return typeof t == "string" && t.trim() ? `提交失败 (${e}): ${t.trim()}` : `提交失败 (${e})`;
2480
+ }
2481
+ function Fo(e) {
2482
+ const t = Ce(e);
2483
+ return t ? Xe(t.blocks) : e && typeof e == "object" && !Array.isArray(e) ? e : {};
2172
2484
  }
2173
- function Xr({
2485
+ function Uo({
2174
2486
  payload: e,
2175
2487
  callbackUrl: t,
2176
2488
  title: n,
2177
2489
  unpublishedFormId: r,
2178
2490
  incompleteFormId: o,
2179
- copyMode: i = "display",
2491
+ answerAgentContext: i,
2180
2492
  onNotify: a
2181
2493
  }) {
2182
- const s = V(
2183
- () => Ct(e, t),
2494
+ const [s, c] = F(!1), u = B(
2495
+ () => Et(e, t),
2184
2496
  [e, t]
2185
- ), c = V(() => i === "submitFields" ? br(e, t) : s, [i, e, t, s]);
2186
- async function u() {
2187
- try {
2188
- await At(c), a == null || a("success", "已复制到剪贴板");
2189
- } catch {
2190
- a == null || a("error", "复制失败");
2497
+ ), d = B(
2498
+ () => ({
2499
+ ...i,
2500
+ callbackUrl: (i == null ? void 0 : i.callbackUrl) ?? t ?? null
2501
+ }),
2502
+ [i, t]
2503
+ );
2504
+ async function m() {
2505
+ if (!s) {
2506
+ c(!0);
2507
+ try {
2508
+ const v = Fo(e), h = Ot({
2509
+ context: d,
2510
+ payload: e,
2511
+ answer: v
2512
+ }), x = await jt(h);
2513
+ x.ok ? a == null || a("success", "提交成功") : a == null || a("error", No(x.status, x.body));
2514
+ } catch (v) {
2515
+ const h = v instanceof Error ? v.message : "提交失败";
2516
+ a == null || a("error", h);
2517
+ } finally {
2518
+ c(!1);
2519
+ }
2191
2520
  }
2192
2521
  }
2193
- const d = i === "submitFields" ? "复制提交字段 curl(向 callback 回传)" : "复制 curl";
2194
- return /* @__PURE__ */ C("div", { className: "ask-user-curl-card", children: [
2195
- /* @__PURE__ */ C("div", { className: "ask-user-curl-card-header", children: [
2196
- /* @__PURE__ */ C("div", { className: "ask-user-curl-card-header-title", children: [
2197
- /* @__PURE__ */ l(H.Text, { type: "secondary", children: n ?? "curl 命令" }),
2522
+ return /* @__PURE__ */ I("div", { className: "ask-user-curl-card", children: [
2523
+ /* @__PURE__ */ I("div", { className: "ask-user-curl-card-header", children: [
2524
+ /* @__PURE__ */ I("div", { className: "ask-user-curl-card-header-title", children: [
2525
+ /* @__PURE__ */ l(L.Text, { type: "secondary", children: n ?? "curl 命令" }),
2198
2526
  r ? /* @__PURE__ */ l(ne, { title: r, children: /* @__PURE__ */ l(re, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) : null,
2199
2527
  o ? /* @__PURE__ */ l(ne, { title: o, children: /* @__PURE__ */ l(re, { className: "ask-user-curl-incomplete-tag", children: "卡片 ID 待补足" }) }) : null
2200
2528
  ] }),
2201
- /* @__PURE__ */ l(ne, { title: d, children: /* @__PURE__ */ l(ge, { size: "small", type: "text", onClick: () => void u(), children: "复制" }) })
2529
+ /* @__PURE__ */ l(ne, { title: "提交到 answer_agent_callback_url", children: /* @__PURE__ */ l(
2530
+ be,
2531
+ {
2532
+ size: "small",
2533
+ type: "text",
2534
+ loading: s,
2535
+ disabled: s,
2536
+ onClick: () => void m(),
2537
+ children: "提交"
2538
+ }
2539
+ ) })
2202
2540
  ] }),
2203
- /* @__PURE__ */ l("pre", { className: "skopon-form-curl-json", children: s })
2541
+ /* @__PURE__ */ l("pre", { className: "skopon-form-curl-json", children: u })
2204
2542
  ] });
2205
2543
  }
2206
- function Wr(e, t) {
2544
+ function dt(e, t) {
2207
2545
  if (t && typeof t == "object" && t !== null && "message" in t) {
2208
2546
  const n = t.message;
2209
2547
  if (typeof n == "string" && n.trim())
@@ -2211,160 +2549,193 @@ function Wr(e, t) {
2211
2549
  }
2212
2550
  return typeof t == "string" && t.trim() ? `提交失败 (${e}): ${t.trim()}` : `提交失败 (${e})`;
2213
2551
  }
2214
- function po({
2552
+ function Go({
2215
2553
  payload: e,
2216
2554
  formUniqueId: t,
2217
2555
  callbackUrl: n,
2218
2556
  submitMode: r = "curl",
2219
- fetchFormDetail: o,
2220
- onNotify: i,
2221
- resumeSearch: a = null,
2222
- caseSearch: s = null
2557
+ answerAgentContext: o,
2558
+ fetchFormDetail: i,
2559
+ onNotify: a,
2560
+ resumeSearch: s = null,
2561
+ caseSearch: c = null
2223
2562
  }) {
2224
- const [c, u] = P(null), [d, p] = P(!1), [v, g] = P(!0), [A, E] = P(!1), T = L(null), m = L(!0), h = L(i);
2225
- h.current = i;
2226
- const x = (t == null ? void 0 : t.trim()) ?? "";
2227
- B(() => (m.current = !0, () => {
2228
- m.current = !1;
2229
- }), []), B(() => {
2230
- let F = !1;
2231
- return x ? (g(!0), p(!1), o({ formUniqueId: x }).then((z) => {
2232
- F || (p(!!z.disabled), u(z.formDefinition ?? null));
2233
- }).catch((z) => {
2234
- var b;
2235
- if (!F) {
2236
- p(!1), u(null);
2237
- const I = z instanceof Error ? z.message : "获取表单定义失败";
2238
- (b = h.current) == null || b.call(h, "error", I);
2563
+ const [u, d] = F(null), [m, v] = F(!1), [h, x] = F(!0), [N, k] = F(!1), p = j(null), b = j(!0), g = j(a);
2564
+ g.current = a;
2565
+ const C = (t == null ? void 0 : t.trim()) ?? "", U = B(
2566
+ () => ({
2567
+ ...o,
2568
+ callbackUrl: (o == null ? void 0 : o.callbackUrl) ?? n ?? null
2569
+ }),
2570
+ [o, n]
2571
+ );
2572
+ R(() => (b.current = !0, () => {
2573
+ b.current = !1;
2574
+ }), []), R(() => {
2575
+ let y = !1;
2576
+ return C ? (x(!0), v(!1), i({ formUniqueId: C }).then((T) => {
2577
+ y || (v(!!T.disabled), d(T.formDefinition ?? null));
2578
+ }).catch((T) => {
2579
+ var E;
2580
+ if (!y) {
2581
+ v(!1), d(null);
2582
+ const M = T instanceof Error ? T.message : "获取表单定义失败";
2583
+ (E = g.current) == null || E.call(g, "error", M);
2239
2584
  }
2240
2585
  }).finally(() => {
2241
- F || g(!1);
2586
+ y || x(!1);
2242
2587
  }), () => {
2243
- F = !0;
2244
- }) : (g(!1), p(!1), u(null), () => {
2245
- F = !0;
2588
+ y = !0;
2589
+ }) : (x(!1), v(!1), d(null), () => {
2590
+ y = !0;
2246
2591
  });
2247
- }, [x, o]);
2248
- const y = V(() => bt(e), [e]), S = V(() => y ? mr(y, c ?? void 0) : null, [y, c]), N = (S == null ? void 0 : S.matchedBlocks) ?? [], _ = !!(y && hr(y) && N.length === 0), j = V(() => _ && y ? gr(y) : S && S.renderBlocks.length > 0 ? S.renderBlocks : [], [S, _, y]), Q = V(
2249
- () => _ ? {} : St((S == null ? void 0 : S.extraBlocks) ?? []),
2250
- [_, S]
2251
- ), w = V(() => _ && y ? yr(y) : j.filter((F) => {
2252
- var z;
2253
- return (z = F.name) == null ? void 0 : z.trim();
2254
- }).map((F) => F.name.trim()), [_, y, j]), O = V(() => {
2255
- if (j.length === 0) return null;
2256
- const F = (S == null ? void 0 : S.title) ?? (y == null ? void 0 : y.title) ?? "", z = (S == null ? void 0 : S.description) ?? (y == null ? void 0 : y.description) ?? "";
2257
- return lr({ title: F, description: z }, j);
2258
- }, [S, y, j]), J = x ? `ask-user-${x}` : "ask-user-payload";
2259
- if (v)
2260
- return /* @__PURE__ */ l(X, { children: /* @__PURE__ */ l("div", { className: "ask-user-form-card", children: /* @__PURE__ */ l(je, { size: "small" }) }) });
2261
- if (!y || j.length === 0)
2262
- return /* @__PURE__ */ l(X, { children: /* @__PURE__ */ l(
2263
- Xr,
2592
+ }, [C, i]);
2593
+ const S = B(() => Ce(e), [e]), A = B(() => S ? Pr(S, u ?? void 0) : null, [S, u]), X = (A == null ? void 0 : A.matchedBlocks) ?? [], V = !!(S && zr(S) && X.length === 0), P = B(() => V && S ? Rr(S) : A && A.renderBlocks.length > 0 ? A.renderBlocks : [], [A, V, S]), w = B(
2594
+ () => V ? {} : Xe((A == null ? void 0 : A.extraBlocks) ?? []),
2595
+ [V, A]
2596
+ ), $ = B(() => V && S ? Br(S) : P.filter((y) => {
2597
+ var T;
2598
+ return (T = y.name) == null ? void 0 : T.trim();
2599
+ }).map((y) => y.name.trim()), [V, S, P]), G = B(() => {
2600
+ if (P.length === 0) return null;
2601
+ const y = (A == null ? void 0 : A.title) ?? (S == null ? void 0 : S.title) ?? "", T = (A == null ? void 0 : A.description) ?? (S == null ? void 0 : S.description) ?? "";
2602
+ return Ir({ title: y, description: T }, P);
2603
+ }, [A, S, P]), Q = C ? `ask-user-${C}` : "ask-user-payload";
2604
+ if (h)
2605
+ return /* @__PURE__ */ l(J, { children: /* @__PURE__ */ l("div", { className: "ask-user-form-card", children: /* @__PURE__ */ l(Ke, { size: "small" }) }) });
2606
+ if (!S || P.length === 0)
2607
+ return /* @__PURE__ */ l(J, { children: /* @__PURE__ */ l(
2608
+ Uo,
2264
2609
  {
2265
2610
  payload: e,
2266
2611
  callbackUrl: n,
2267
- copyMode: "submitFields",
2268
- unpublishedFormId: d && x ? x : void 0,
2269
- onNotify: i
2612
+ answerAgentContext: U,
2613
+ unpublishedFormId: m && C ? C : void 0,
2614
+ onNotify: a
2270
2615
  }
2271
2616
  ) });
2272
- async function Y() {
2273
- var F, z, b, I, R, M;
2274
- if (!A) {
2275
- E(!0);
2617
+ async function Z() {
2618
+ var y, T, E, M, et, tt, nt, rt;
2619
+ if (!N) {
2620
+ k(!0);
2276
2621
  try {
2277
- const ee = ((F = T.current) == null ? void 0 : F.getValues(w)) ?? {}, xe = { ...ee, ...Q };
2622
+ const ee = ((y = p.current) == null ? void 0 : y.getValues($)) ?? {}, ue = Zr(P, ee);
2623
+ if (ue) {
2624
+ (T = g.current) == null || T.call(g, "error", ue.message);
2625
+ return;
2626
+ }
2627
+ const ot = { ...ee, ...w };
2278
2628
  if (r === "post") {
2279
- const Ke = (n ?? "").trim();
2280
- if (!Ke) {
2281
- (z = h.current) == null || z.call(h, "error", "callback_url 为空,无法提交");
2629
+ const it = (n ?? "").trim();
2630
+ if (!it) {
2631
+ (E = g.current) == null || E.call(g, "error", "callback_url 为空,无法提交");
2282
2632
  return;
2283
2633
  }
2284
- const Ce = await Sr(Ke, xe);
2285
- if (!m.current) return;
2286
- Ce.ok ? (b = h.current) == null || b.call(h, "success", "提交成功") : (I = h.current) == null || I.call(h, "error", Wr(Ce.status, Ce.body));
2634
+ const Ie = await zt(it, ot);
2635
+ if (!b.current) return;
2636
+ Ie.ok ? (M = g.current) == null || M.call(g, "success", "提交成功") : (et = g.current) == null || et.call(g, "error", dt(Ie.status, Ie.body));
2287
2637
  return;
2288
2638
  }
2289
- if (await At(
2290
- kt({ cardValues: ee, extraValues: Q, callbackUrl: n })
2291
- ), !m.current) return;
2292
- (R = h.current) == null || R.call(h, "success", "已复制 curl 到剪贴板");
2639
+ const Kt = Ot({
2640
+ context: U,
2641
+ payload: e,
2642
+ form: u ?? S,
2643
+ answer: ot
2644
+ }), Te = await jt(Kt);
2645
+ if (!b.current) return;
2646
+ Te.ok ? (tt = g.current) == null || tt.call(g, "success", "提交成功") : (nt = g.current) == null || nt.call(g, "error", dt(Te.status, Te.body));
2293
2647
  } catch (ee) {
2294
- if (!m.current) return;
2295
- const xe = ee instanceof Error ? ee.message : "复制失败";
2296
- (M = h.current) == null || M.call(h, "error", xe);
2648
+ if (!b.current) return;
2649
+ const ue = ee instanceof Error ? ee.message : "提交失败";
2650
+ (rt = g.current) == null || rt.call(g, "error", ue);
2297
2651
  } finally {
2298
- m.current && E(!1);
2652
+ b.current && k(!1);
2299
2653
  }
2300
2654
  }
2301
2655
  }
2302
- return /* @__PURE__ */ l(X, { children: /* @__PURE__ */ C("div", { className: "ask-user-form-card", children: [
2303
- d && x ? /* @__PURE__ */ l("div", { className: "ask-user-form-card-status", children: /* @__PURE__ */ l(ne, { title: x, children: /* @__PURE__ */ l(re, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) }) : null,
2656
+ return /* @__PURE__ */ l(J, { children: /* @__PURE__ */ I("div", { className: "ask-user-form-card", children: [
2657
+ m && C ? /* @__PURE__ */ l("div", { className: "ask-user-form-card-status", children: /* @__PURE__ */ l(ne, { title: C, children: /* @__PURE__ */ l(re, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) }) : null,
2304
2658
  /* @__PURE__ */ l(
2305
- Yr,
2659
+ Mo,
2306
2660
  {
2307
- ref: T,
2308
- doc: O,
2309
- surfaceId: J,
2310
- fieldNames: w,
2661
+ ref: p,
2662
+ doc: G,
2663
+ surfaceId: Q,
2664
+ fieldNames: $,
2311
2665
  interactive: !0,
2312
2666
  wrapProvider: !1,
2313
- resumeSearch: a,
2314
- caseSearch: s
2667
+ resumeSearch: s,
2668
+ caseSearch: c
2315
2669
  }
2316
2670
  ),
2317
- /* @__PURE__ */ l("div", { className: "ask-user-form-actions", children: /* @__PURE__ */ l(ne, { title: r === "curl" ? "点击复制 curl" : "提交 JSON 到 callback_url", children: /* @__PURE__ */ l(
2318
- ge,
2671
+ /* @__PURE__ */ l("div", { className: "ask-user-form-actions", children: /* @__PURE__ */ l(
2672
+ ne,
2319
2673
  {
2320
- type: "primary",
2321
- size: "small",
2322
- loading: A,
2323
- disabled: A,
2324
- onClick: () => void Y(),
2325
- children: "提交"
2674
+ title: r === "post" ? "提交 JSON 到 callback_url" : "提交到 answer_agent_callback_url",
2675
+ children: /* @__PURE__ */ l(
2676
+ be,
2677
+ {
2678
+ type: "primary",
2679
+ size: "small",
2680
+ loading: N,
2681
+ disabled: N,
2682
+ onClick: () => void Z(),
2683
+ children: "提交"
2684
+ }
2685
+ )
2326
2686
  }
2327
- ) }) })
2687
+ ) })
2328
2688
  ] }) });
2329
2689
  }
2330
2690
  export {
2331
- so as A2UI_PROTOCOL_VERSION,
2332
- po as AskUserFormCard,
2333
- Re as CaseSearchProvider,
2334
- Xr as CurlSubmitBlock,
2335
- Kt as FORM_MEDIA_SIZES,
2336
- Be as ResumeSearchProvider,
2337
- uo as SkoponA2uiStreamRenderer,
2338
- X as SkoponFormProvider,
2339
- Yr as SkoponFormRenderer,
2340
- or as a2uiToBlocks,
2341
- gt as blocksToA2ui,
2342
- vr as buildAskUserCurlBodyJson,
2343
- kt as buildAskUserCurlStatement,
2344
- br as buildAskUserSubmitCurlFromPayload,
2345
- lr as buildAskUserSurface,
2346
- Ct as buildCurlStatement,
2347
- At as copyTextToClipboard,
2348
- co as createFormClient,
2349
- St as extractExtraBlockValues,
2350
- cr as extractSurfaceValues,
2351
- yr as getPayloadInputFieldNames,
2352
- gr as getPayloadRenderableBlocks,
2353
- mr as intersectPayloadBlocksWithForm,
2354
- qe as isA2uiSurfaceEmpty,
2355
- W as isInputBlockType,
2356
- $e as isLayoutBlockType,
2357
- _e as isMediaBlockType,
2358
- sr as mapFormDefinitionFromDto,
2359
- Z as normalizeFormDefinition,
2360
- bt as parsePayloadBlocksJson,
2361
- hr as payloadHasInputBlocks,
2362
- ar as resolveSurfaceFromFormDefinition,
2363
- Jr as skoponAntdTheme,
2691
+ Lo as A2UI_PROTOCOL_VERSION,
2692
+ Go as AskUserFormCard,
2693
+ Oe as CaseSearchProvider,
2694
+ Uo as CurlSubmitBlock,
2695
+ jr as DEFAULT_AUTH_ANSWER_AGENT_CALLBACK_URL_FIELD,
2696
+ Rt as DEFAULT_AUTH_STORAGE_KEY,
2697
+ Or as DEFAULT_AUTH_TOKEN_FIELD,
2698
+ dn as FORM_MEDIA_SIZES,
2699
+ je as ResumeSearchProvider,
2700
+ Ko as SkoponA2uiStreamRenderer,
2701
+ J as SkoponFormProvider,
2702
+ Mo as SkoponFormRenderer,
2703
+ xr as a2uiToBlocks,
2704
+ Nt as blocksToA2ui,
2705
+ Ot as buildAnswerAgentBody,
2706
+ wr as buildAskUserCurlBodyJson,
2707
+ qr as buildAskUserCurlStatement,
2708
+ $o as buildAskUserSubmitCurlFromPayload,
2709
+ Ir as buildAskUserSurface,
2710
+ Et as buildCurlStatement,
2711
+ Do as copyTextToClipboard,
2712
+ Xr as createCaseSearchClient,
2713
+ $r as createFormClient,
2714
+ Gr as createResumeSearchClient,
2715
+ Ho as createSkoponSdkClients,
2716
+ Xe as extractExtraBlockValues,
2717
+ Mr as extractSurfaceValues,
2718
+ Br as getPayloadInputFieldNames,
2719
+ Rr as getPayloadRenderableBlocks,
2720
+ Pr as intersectPayloadBlocksWithForm,
2721
+ $e as isA2uiSurfaceEmpty,
2722
+ Y as isInputBlockType,
2723
+ Se as isLayoutBlockType,
2724
+ he as isMediaBlockType,
2725
+ _r as mapFormDefinitionFromDto,
2726
+ W as normalizeFormDefinition,
2727
+ Ce as parsePayloadBlocksJson,
2728
+ zr as payloadHasInputBlocks,
2729
+ Lr as resolveAnswerAgentCallbackUrl,
2730
+ Ze as resolveClientHeaders,
2731
+ qt as resolveSkoponAuthHeaders,
2732
+ Tr as resolveSurfaceFromFormDefinition,
2733
+ _o as skoponAntdTheme,
2364
2734
  D as skoponBrandColors,
2365
- Sr as submitFormJson,
2366
- ir as surfaceDocToMessages,
2367
- me as syncFormDefinition,
2368
- An as useCaseSearch,
2369
- _n as useResumeSearch
2735
+ jt as submitAnswerAgent,
2736
+ zt as submitFormJson,
2737
+ Ar as surfaceDocToMessages,
2738
+ ge as syncFormDefinition,
2739
+ $n as useCaseSearch,
2740
+ Qn as useResumeSearch
2370
2741
  };