@freecallai/pro 0.0.1 → 0.0.2

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 (34) hide show
  1. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-BuMz8Tyy.js +4416 -0
  2. package/dist/KnowledgeArea-BkRVWFrg.js +1224 -0
  3. package/dist/{ToolForm-CWpUIVTl.js → ToolForm-BSJxTJ7U.js} +1 -1
  4. package/dist/index-BVHYCLDv.js +5 -0
  5. package/dist/{index-DOEijEGU.js → index-BnFTr8u9.js} +1 -1
  6. package/dist/{index-5a9mHHzg.js → index-CG2j9Znw.js} +1 -1
  7. package/dist/index-kOPLn4DD.js +5 -0
  8. package/dist/index.js +3 -3
  9. package/dist/{media-migration-CGOFwdYm.js → media-migration-Cj-3xrxd.js} +1 -1
  10. package/dist/{media-upload-Dx45yv6a.js → media-upload-D7DpMJYx.js} +1 -1
  11. package/dist/rich-text/index.js +5 -5
  12. package/dist/rich-text/legacy-converter/index.js +766 -321
  13. package/dist/{guard-BCatAeT4.js → rules-CC6NoltX.js} +252 -190
  14. package/dist/style.css +1 -1
  15. package/dist/types/index.d.ts +1 -1
  16. package/dist/types/rich-text/FkpRichText.vue.d.ts +16 -5
  17. package/dist/types/rich-text/__demo__/reasoning-template-examples.d.ts +12 -0
  18. package/dist/types/rich-text/index.d.ts +1 -1
  19. package/dist/types/rich-text/legacy-converter/business-attribute.d.ts +32 -0
  20. package/dist/types/rich-text/legacy-converter/index.d.ts +1 -0
  21. package/dist/types/rich-text/legacy-converter/tool-contract.d.ts +5 -0
  22. package/dist/types/rich-text/plugins/tool/rules.d.ts +34 -0
  23. package/dist/types/rich-text/public/types.d.ts +10 -0
  24. package/dist/types/rich-text/runtime/file-drop-guard.d.ts +2 -0
  25. package/dist/types/rich-text/runtime/media-policy.d.ts +15 -0
  26. package/dist/types/rich-text/runtime/media-target.d.ts +1 -0
  27. package/dist/types/rich-text/runtime/media-upload-session.d.ts +5 -1
  28. package/dist/types/rich-text/runtime/media-upload-slots.d.ts +4 -0
  29. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +7 -0
  30. package/package.json +1 -1
  31. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js +0 -4115
  32. package/dist/KnowledgeArea-OPR7smbt.js +0 -923
  33. package/dist/index-BsQLwz91.js +0 -5
  34. package/dist/index-xAjlBylT.js +0 -5
@@ -1,4 +1,4 @@
1
- const it = [
1
+ const ot = [
2
2
  {
3
3
  id: "todo",
4
4
  apiVersion: 1,
@@ -30,7 +30,7 @@ const it = [
30
30
  optionSource: "flatTags",
31
31
  optionTrigger: "hover"
32
32
  }
33
- ], ot = [
33
+ ], st = [
34
34
  {
35
35
  id: "ticket",
36
36
  apiVersion: 1,
@@ -46,7 +46,7 @@ const it = [
46
46
  optionSource: "flatTags",
47
47
  optionTrigger: "hover"
48
48
  }
49
- ], st = [
49
+ ], at = [
50
50
  {
51
51
  id: "originalReply",
52
52
  apiVersion: 1,
@@ -71,7 +71,7 @@ const it = [
71
71
  types: ["reasoning"],
72
72
  icon: "original"
73
73
  }
74
- ], at = [
74
+ ], lt = [
75
75
  {
76
76
  id: "memory",
77
77
  apiVersion: 1,
@@ -84,7 +84,7 @@ const it = [
84
84
  types: ["normal", "reasoning", "agent"],
85
85
  icon: "memory"
86
86
  }
87
- ], lt = [
87
+ ], ct = [
88
88
  {
89
89
  id: "tagged",
90
90
  apiVersion: 1,
@@ -101,7 +101,7 @@ const it = [
101
101
  optionTrigger: "hover",
102
102
  questionTag: { kind: "default" }
103
103
  }
104
- ], ct = [
104
+ ], pt = [
105
105
  {
106
106
  id: "attribute",
107
107
  apiVersion: 1,
@@ -118,7 +118,7 @@ const it = [
118
118
  optionTrigger: "hover",
119
119
  optionHierarchy: "tree"
120
120
  }
121
- ], pt = [
121
+ ], dt = [
122
122
  {
123
123
  id: "tool",
124
124
  apiVersion: 1,
@@ -136,7 +136,7 @@ const it = [
136
136
  optionHierarchy: "tree",
137
137
  uiPorts: ["getToolForm"]
138
138
  }
139
- ], dt = [
139
+ ], ut = [
140
140
  {
141
141
  id: "variable",
142
142
  apiVersion: 1,
@@ -152,7 +152,7 @@ const it = [
152
152
  optionSource: "variables"
153
153
  }
154
154
  ];
155
- const Ot = {
155
+ const Kt = {
156
156
  agents: "searchAgents",
157
157
  variables: "listVariables",
158
158
  flatTags: "listCapabilityOptions",
@@ -173,7 +173,7 @@ const w = {
173
173
  id: "reasoningTemplate.load",
174
174
  requiredPorts: ["getReasoningTemplate"]
175
175
  }
176
- }, ut = [
176
+ }, gt = [
177
177
  {
178
178
  id: "image",
179
179
  apiVersion: 1,
@@ -188,7 +188,7 @@ const w = {
188
188
  icon: "image",
189
189
  optionKind: "media"
190
190
  }
191
- ], gt = [
191
+ ], ft = [
192
192
  {
193
193
  id: "video",
194
194
  apiVersion: 1,
@@ -203,7 +203,7 @@ const w = {
203
203
  icon: "video",
204
204
  optionKind: "media"
205
205
  }
206
- ], ft = [
206
+ ], yt = [
207
207
  {
208
208
  id: "separator",
209
209
  apiVersion: 1,
@@ -216,7 +216,7 @@ const w = {
216
216
  types: ["normal", "reasoning"],
217
217
  icon: "separator"
218
218
  }
219
- ], yt = [
219
+ ], mt = [
220
220
  {
221
221
  id: "reasoningPolish",
222
222
  apiVersion: 1,
@@ -246,7 +246,7 @@ const w = {
246
246
  optionKind: "selection",
247
247
  optionSource: "capabilities"
248
248
  }
249
- ], mt = [
249
+ ], bt = [
250
250
  {
251
251
  id: "agentSelect",
252
252
  apiVersion: 1,
@@ -263,8 +263,7 @@ const w = {
263
263
  optionSource: "agents",
264
264
  optionTrigger: "hover"
265
265
  }
266
- ], Y = [
267
- ...it,
266
+ ], Z = [
268
267
  ...ot,
269
268
  ...st,
270
269
  ...at,
@@ -276,10 +275,11 @@ const w = {
276
275
  ...gt,
277
276
  ...ft,
278
277
  ...yt,
278
+ ...mt,
279
279
  ...kt,
280
- ...mt
280
+ ...bt
281
281
  ];
282
- function Z(n, r = "") {
282
+ function tt(r, n = "") {
283
283
  const e = /* @__PURE__ */ new Set(), s = (o, t, i) => {
284
284
  if (o === null || typeof o == "string" || typeof o == "boolean")
285
285
  return null;
@@ -288,122 +288,122 @@ function Z(n, r = "") {
288
288
  if (typeof o != "object" || i > 64 || e.has(o))
289
289
  return t;
290
290
  if (!Array.isArray(o)) {
291
- const l = Object.getPrototypeOf(o);
292
- if (l !== Object.prototype && l !== null) return t;
291
+ const c = Object.getPrototypeOf(o);
292
+ if (c !== Object.prototype && c !== null) return t;
293
293
  }
294
294
  const u = Reflect.ownKeys(o);
295
- if (u.some((l) => typeof l == "symbol")) return t;
295
+ if (u.some((c) => typeof c == "symbol")) return t;
296
296
  if (Array.isArray(o)) {
297
297
  if (u.length !== o.length + 1) return t;
298
- for (let l = 0; l < o.length; l++)
299
- if (!Object.prototype.hasOwnProperty.call(o, l))
300
- return `${t}[${l}]`;
298
+ for (let c = 0; c < o.length; c++)
299
+ if (!Object.prototype.hasOwnProperty.call(o, c))
300
+ return `${t}[${c}]`;
301
301
  }
302
302
  e.add(o);
303
- for (const l of u) {
304
- if (Array.isArray(o) && l === "length") continue;
305
- const a = Object.getOwnPropertyDescriptor(o, l), p = Array.isArray(o) ? `${t}[${String(l)}]` : t ? `${t}.${String(l)}` : String(l);
303
+ for (const c of u) {
304
+ if (Array.isArray(o) && c === "length") continue;
305
+ const a = Object.getOwnPropertyDescriptor(o, c), l = Array.isArray(o) ? `${t}[${String(c)}]` : t ? `${t}.${String(c)}` : String(c);
306
306
  if (!a || !("value" in a) || !Array.isArray(o) && !a.enumerable)
307
- return p;
308
- const d = s(a.value, p, i + 1);
307
+ return l;
308
+ const d = s(a.value, l, i + 1);
309
309
  if (d !== null) return d;
310
310
  }
311
311
  return e.delete(o), null;
312
312
  };
313
313
  try {
314
- return s(n, r, 0);
314
+ return s(r, n, 0);
315
315
  } catch {
316
- return r;
316
+ return n;
317
317
  }
318
318
  }
319
- function $(n) {
320
- if (typeof n != "string" || !/^https?:\/\/[^\s]+$/i.test(n))
319
+ function $(r) {
320
+ if (typeof r != "string" || !/^https?:\/\/[^\s]+$/i.test(r))
321
321
  return !1;
322
322
  try {
323
- const r = new URL(n);
324
- return (r.protocol === "http:" || r.protocol === "https:") && !!r.hostname && !r.username && !r.password;
323
+ const n = new URL(r);
324
+ return (n.protocol === "http:" || n.protocol === "https:") && !!n.hostname && !n.username && !n.password;
325
325
  } catch {
326
326
  return !1;
327
327
  }
328
328
  }
329
- const bt = [
329
+ const wt = [
330
330
  "todo",
331
331
  "ticket",
332
332
  "variable",
333
333
  "attribute",
334
334
  "tool",
335
335
  "separator"
336
- ], wt = ["todo", "ticket", "attribute"], St = ["image", "video"], At = new Set(bt), $t = new Set(wt), qt = new Set(St), tt = (n) => typeof n == "string" && At.has(n), Rt = (n) => typeof n == "string" && $t.has(n), et = (n) => typeof n == "string" && qt.has(n), Vt = /* @__PURE__ */ new Set([
336
+ ], St = ["todo", "ticket", "attribute"], At = ["image", "video"], $t = new Set(wt), It = new Set(St), ht = new Set(At), et = (r) => typeof r == "string" && $t.has(r), Nt = (r) => typeof r == "string" && It.has(r), rt = (r) => typeof r == "string" && ht.has(r), Tt = /* @__PURE__ */ new Set([
337
337
  "businessToken",
338
338
  "originalReply",
339
339
  "messageSeparator",
340
340
  "mediaBlock"
341
- ]), q = (n) => Vt.has(n);
342
- function Dt(n, r) {
343
- return n === "businessToken" ? tt(r == null ? void 0 : r.kind) ? r.kind : null : n === "mediaBlock" ? et(r == null ? void 0 : r.kind) ? r.kind : null : n === "originalReply" ? "originalReply" : n === "messageSeparator" ? "separator" : null;
341
+ ]), I = (r) => Tt.has(r);
342
+ function _t(r, n) {
343
+ return r === "businessToken" ? et(n == null ? void 0 : n.kind) ? n.kind : null : r === "mediaBlock" ? rt(n == null ? void 0 : n.kind) ? n.kind : null : r === "originalReply" ? "originalReply" : r === "messageSeparator" ? "separator" : null;
344
344
  }
345
- function ht(n) {
346
- var r;
347
- return !!((r = n.content) != null && r.some(
348
- (e) => typeof e.type == "string" && q(e.type) || ht(e)
345
+ function Vt(r) {
346
+ var n;
347
+ return !!((n = r.content) != null && n.some(
348
+ (e) => typeof e.type == "string" && I(e.type) || Vt(e)
349
349
  ));
350
350
  }
351
- const Bt = "fkpTrustedNodeIds";
352
- function Kt(n) {
353
- const r = [], e = (s) => {
351
+ const Lt = "fkpTrustedNodeIds";
352
+ function Mt(r) {
353
+ const n = [], e = (s) => {
354
354
  var o, t;
355
- s.type && q(s.type) && typeof ((o = s.attrs) == null ? void 0 : o.id) == "string" && s.attrs.id && r.push(s.attrs.id), (t = s.content) == null || t.forEach(e);
355
+ s.type && I(s.type) && typeof ((o = s.attrs) == null ? void 0 : o.id) == "string" && s.attrs.id && n.push(s.attrs.id), (t = s.content) == null || t.forEach(e);
356
356
  };
357
- return Array.isArray(n) ? n.forEach(e) : e(n), r;
357
+ return Array.isArray(r) ? r.forEach(e) : e(r), n;
358
358
  }
359
- function Nt(n, r) {
359
+ function Ct(r, n) {
360
360
  for (let t = 0; t < 8; t++) {
361
- const i = r();
362
- if (i && !n.has(i)) return i;
361
+ const i = n();
362
+ if (i && !r.has(i)) return i;
363
363
  }
364
- const e = r() || "node";
364
+ const e = n() || "node";
365
365
  let s = e, o = 1;
366
- for (; n.has(s); ) s = `${e}-${o++}`;
366
+ for (; r.has(s); ) s = `${e}-${o++}`;
367
367
  return s;
368
368
  }
369
- const W = {
369
+ const Q = {
370
370
  todo: "待办",
371
371
  tagged: "顾客标签"
372
372
  };
373
- function xt(n) {
374
- return n.includes("[") || n.includes("]") || /[【】\r\n]/u.test(n);
373
+ function Pt(r) {
374
+ return r.includes("[") || r.includes("]") || /[【】\r\n]/u.test(r);
375
375
  }
376
- function nt(n) {
377
- return /[{}\r\n]/u.test(n);
376
+ function nt(r) {
377
+ return /[{}\r\n]/u.test(r);
378
378
  }
379
- function It(n, r) {
379
+ function qt(r, n) {
380
380
  var i;
381
- const e = (i = n.extensionState[r]) == null ? void 0 : i.data;
381
+ const e = (i = r.extensionState[n]) == null ? void 0 : i.data;
382
382
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
383
383
  const { tag: s } = e;
384
384
  if (!s || typeof s != "object" || Array.isArray(s)) return null;
385
385
  const { id: o, label: t } = s;
386
386
  return typeof o != "string" || !o.trim() || typeof t != "string" || !t.trim() ? null : { id: o, label: t };
387
387
  }
388
- function Tt(n) {
389
- return ["todo", "tagged"].flatMap((r) => {
388
+ function xt(r) {
389
+ return ["todo", "tagged"].flatMap((n) => {
390
390
  var t;
391
- if (r === "todo" && n.type !== "normal") return [];
392
- const e = (t = n.extensionState[r]) == null ? void 0 : t.data, s = e && typeof e == "object" && !Array.isArray(e) ? e.enabled === !0 : !1, o = s ? It(n, r) : null;
391
+ if (n === "todo" && r.type !== "normal") return [];
392
+ const e = (t = r.extensionState[n]) == null ? void 0 : t.data, s = e && typeof e == "object" && !Array.isArray(e) ? e.enabled === !0 : !1, o = s ? qt(r, n) : null;
393
393
  if (s && !o)
394
- throw new Error(`${W[r]}已开启但未选择方案`);
394
+ throw new Error(`${Q[n]}已开启但未选择方案`);
395
395
  if (o && nt(o.label))
396
396
  throw new Error("方案名称包含协议保留字符");
397
- return o ? [`{${W[r]}@${o.label}}`] : [];
397
+ return o ? [`{${Q[n]}@${o.label}}`] : [];
398
398
  }).join("");
399
399
  }
400
- function Lt(n) {
401
- var r;
402
- if (typeof ((r = n.question) == null ? void 0 : r.text) != "string" || xt(n.question.text))
400
+ function Ft(r) {
401
+ var n;
402
+ if (typeof ((n = r.question) == null ? void 0 : n.text) != "string" || Pt(r.question.text))
403
403
  throw new Error("意图文字中不可填写方括号或换行,请修改");
404
- return `[${n.question.text}]${Tt(n)}`;
404
+ return `[${r.question.text}]${xt(r)}`;
405
405
  }
406
- const rt = /* @__PURE__ */ new Set([
406
+ const it = /* @__PURE__ */ new Set([
407
407
  "doc",
408
408
  "paragraph",
409
409
  "text",
@@ -418,7 +418,7 @@ const rt = /* @__PURE__ */ new Set([
418
418
  "originalReply",
419
419
  "messageSeparator",
420
420
  "mediaBlock"
421
- ]), Ct = (n) => rt.has(n), vt = /* @__PURE__ */ new Set([
421
+ ]), Ut = (r) => it.has(r), Ot = /* @__PURE__ */ new Set([
422
422
  "bold",
423
423
  "italic",
424
424
  "strike",
@@ -444,7 +444,7 @@ const rt = /* @__PURE__ */ new Set([
444
444
  blockquote: A,
445
445
  codeBlock: /* @__PURE__ */ new Set(["text"]),
446
446
  originalReply: /* @__PURE__ */ new Set(["paragraph", "mediaBlock", "messageSeparator"])
447
- }, Pt = {
447
+ }, vt = {
448
448
  orderedList: /* @__PURE__ */ new Set(["start", "type"]),
449
449
  codeBlock: /* @__PURE__ */ new Set(["language"]),
450
450
  businessToken: /* @__PURE__ */ new Set([
@@ -470,13 +470,13 @@ const rt = /* @__PURE__ */ new Set([
470
470
  "error"
471
471
  ])
472
472
  };
473
- function jt(n) {
474
- if (!n || typeof n != "object" || Array.isArray(n)) return !1;
475
- const r = n;
476
- if (typeof r.type != "string" || !vt.has(r.type) || Object.keys(r).some((o) => !["type", "attrs"].includes(o)) || r.attrs !== void 0 && (!r.attrs || typeof r.attrs != "object" || Array.isArray(r.attrs)))
473
+ function jt(r) {
474
+ if (!r || typeof r != "object" || Array.isArray(r)) return !1;
475
+ const n = r;
476
+ if (typeof n.type != "string" || !Ot.has(n.type) || Object.keys(n).some((o) => !["type", "attrs"].includes(o)) || n.attrs !== void 0 && (!n.attrs || typeof n.attrs != "object" || Array.isArray(n.attrs)))
477
477
  return !1;
478
- const e = r.attrs || {};
479
- if (r.type !== "link") return Object.keys(e).length === 0;
478
+ const e = n.attrs || {};
479
+ if (n.type !== "link") return Object.keys(e).length === 0;
480
480
  if (Object.keys(e).some(
481
481
  (o) => !["href", "target", "rel", "class", "title"].includes(o)
482
482
  ) || !$(e.href))
@@ -484,30 +484,30 @@ function jt(n) {
484
484
  const s = (o) => o == null || typeof o == "string";
485
485
  return !s(e.rel) || !s(e.class) || !s(e.title) || e.target !== void 0 && e.target !== null && !["_blank", "_self"].includes(String(e.target)) ? !1 : e.target !== "_blank" || typeof e.rel == "string" && e.rel.split(/\s+/).includes("noopener");
486
486
  }
487
- function m(n, r, e = "") {
488
- const s = Object.keys(n).find(
489
- (o) => !r.includes(o)
487
+ function k(r, n, e = "") {
488
+ const s = Object.keys(r).find(
489
+ (o) => !n.includes(o)
490
490
  );
491
491
  return s ? e ? `${e}.${s}` : s : null;
492
492
  }
493
- function G(n, r = "knowledge.doc") {
494
- if (n === null) return null;
493
+ function Y(r, n = "knowledge.doc") {
494
+ if (r === null) return null;
495
495
  const e = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new WeakSet();
496
- function o(t, i, u, l = !1) {
497
- var p, d, y, g, k, f, b, V, h, x, I, T, v, P, j, O, R, D, B, K, N, L, C, U, F, M, E, _, z, H;
498
- if (!t || typeof t != "object" || !t.type || !rt.has(t.type) || s.has(t) || (s.add(t), u ? !((p = J[u]) != null && p.has(t.type)) : t.type !== "doc") || l && t.type === "businessToken" && ((d = t.attrs) == null ? void 0 : d.kind) === "attribute")
496
+ function o(t, i, u, c = !1) {
497
+ var l, d, f, g, m, y, b, h, T, V, P, q, x, O, v, j, R, D, B, K, N, _, L, M, C, F, U, E, z, H;
498
+ if (!t || typeof t != "object" || !t.type || !it.has(t.type) || s.has(t) || (s.add(t), u ? !((l = J[u]) != null && l.has(t.type)) : t.type !== "doc") || c && t.type === "businessToken" && ((d = t.attrs) == null ? void 0 : d.kind) === "attribute")
499
499
  return i;
500
- for (const c of Object.keys(t))
501
- if (!["type", "attrs", "content", "marks", "text"].includes(c))
502
- return `${i}.${c}`;
500
+ for (const p of Object.keys(t))
501
+ if (!["type", "attrs", "content", "marks", "text"].includes(p))
502
+ return `${i}.${p}`;
503
503
  if (t.content !== void 0 && !Array.isArray(t.content))
504
504
  return `${i}.content`;
505
505
  if (["bulletList", "orderedList", "blockquote", "originalReply"].includes(
506
506
  t.type
507
- ) && !((y = t.content) != null && y.length))
507
+ ) && !((f = t.content) != null && f.length))
508
508
  return `${i}.content`;
509
- if (t.type === "listItem" && ((k = (g = t.content) == null ? void 0 : g[0]) == null ? void 0 : k.type) !== "paragraph")
510
- return (f = t.content) != null && f.length ? `${i}.content[0]` : `${i}.content`;
509
+ if (t.type === "listItem" && ((m = (g = t.content) == null ? void 0 : g[0]) == null ? void 0 : m.type) !== "paragraph")
510
+ return (y = t.content) != null && y.length ? `${i}.content[0]` : `${i}.content`;
511
511
  if (t.text !== void 0 && t.type !== "text") return `${i}.text`;
512
512
  if (t.type === "text" && (typeof t.text != "string" || t.text.length === 0))
513
513
  return `${i}.text`;
@@ -517,104 +517,104 @@ function G(n, r = "knowledge.doc") {
517
517
  return `${i}.content`;
518
518
  if (t.attrs !== void 0 && (!t.attrs || typeof t.attrs != "object" || Array.isArray(t.attrs)))
519
519
  return `${i}.attrs`;
520
- const a = Pt[t.type] || /* @__PURE__ */ new Set();
521
- for (const c of Object.keys(t.attrs || {}))
522
- if (!a.has(c)) return `${i}.attrs.${c}`;
523
- if (t.type === "businessToken" && !tt((V = t.attrs) == null ? void 0 : V.kind))
520
+ const a = vt[t.type] || /* @__PURE__ */ new Set();
521
+ for (const p of Object.keys(t.attrs || {}))
522
+ if (!a.has(p)) return `${i}.attrs.${p}`;
523
+ if (t.type === "businessToken" && !et((h = t.attrs) == null ? void 0 : h.kind))
524
524
  return `${i}.attrs.kind`;
525
- if (t.type === "businessToken" && (typeof ((h = t.attrs) == null ? void 0 : h.key) != "string" || !t.attrs.key))
525
+ if (t.type === "businessToken" && (typeof ((T = t.attrs) == null ? void 0 : T.key) != "string" || !t.attrs.key))
526
526
  return `${i}.attrs.key`;
527
- if (t.type === "businessToken" && ((x = t.attrs) == null ? void 0 : x.label) !== void 0 && typeof t.attrs.label != "string")
527
+ if (t.type === "businessToken" && ((V = t.attrs) == null ? void 0 : V.label) !== void 0 && typeof t.attrs.label != "string")
528
528
  return `${i}.attrs.label`;
529
- if (t.type === "businessToken" && ((I = t.attrs) == null ? void 0 : I.token) !== void 0 && t.attrs.token !== null && typeof t.attrs.token != "string")
529
+ if (t.type === "businessToken" && ((P = t.attrs) == null ? void 0 : P.token) !== void 0 && t.attrs.token !== null && typeof t.attrs.token != "string")
530
530
  return `${i}.attrs.token`;
531
- if (t.type === "businessToken" && ((T = t.attrs) == null ? void 0 : T.params) != null && (t.attrs.kind !== "tool" || typeof t.attrs.params != "object" || Array.isArray(t.attrs.params) || Z(t.attrs.params) !== null || JSON.stringify(t.attrs.params).length > 8192))
531
+ if (t.type === "businessToken" && ((q = t.attrs) == null ? void 0 : q.params) != null && (t.attrs.kind !== "tool" || typeof t.attrs.params != "object" || Array.isArray(t.attrs.params) || tt(t.attrs.params) !== null || JSON.stringify(t.attrs.params).length > 8192))
532
532
  return `${i}.attrs.params`;
533
- if (t.type === "mediaBlock" && !et((v = t.attrs) == null ? void 0 : v.kind))
533
+ if (t.type === "mediaBlock" && !rt((x = t.attrs) == null ? void 0 : x.kind))
534
534
  return `${i}.attrs.kind`;
535
535
  if (t.type === "mediaBlock") {
536
- if (((P = t.attrs) == null ? void 0 : P.assetId) !== void 0 && t.attrs.assetId !== null && typeof t.attrs.assetId != "string")
536
+ if (((O = t.attrs) == null ? void 0 : O.assetId) !== void 0 && t.attrs.assetId !== null && typeof t.attrs.assetId != "string")
537
537
  return `${i}.attrs.assetId`;
538
- if (((j = t.attrs) == null ? void 0 : j.name) !== void 0 && typeof t.attrs.name != "string")
538
+ if (((v = t.attrs) == null ? void 0 : v.name) !== void 0 && typeof t.attrs.name != "string")
539
539
  return `${i}.attrs.name`;
540
- if (((O = t.attrs) == null ? void 0 : O.error) !== void 0 && typeof t.attrs.error != "string")
540
+ if (((j = t.attrs) == null ? void 0 : j.error) !== void 0 && typeof t.attrs.error != "string")
541
541
  return `${i}.attrs.error`;
542
542
  if (((R = t.attrs) == null ? void 0 : R.status) !== void 0 && !["ready", "uploading", "error"].includes(String(t.attrs.status)))
543
543
  return `${i}.attrs.status`;
544
- const c = (((D = t.attrs) == null ? void 0 : D.status) === "uploading" || ((B = t.attrs) == null ? void 0 : B.status) === "error") && typeof ((K = t.attrs) == null ? void 0 : K.src) == "string" && t.attrs.src.startsWith("blob:");
545
- if (!$((N = t.attrs) == null ? void 0 : N.src) && !c)
544
+ const p = (((D = t.attrs) == null ? void 0 : D.status) === "uploading" || ((B = t.attrs) == null ? void 0 : B.status) === "error") && typeof ((K = t.attrs) == null ? void 0 : K.src) == "string" && t.attrs.src.startsWith("blob:");
545
+ if (!$((N = t.attrs) == null ? void 0 : N.src) && !p)
546
546
  return `${i}.attrs.src`;
547
- if (((L = t.attrs) == null ? void 0 : L.poster) !== void 0 && t.attrs.poster !== null && !$(t.attrs.poster))
547
+ if (((_ = t.attrs) == null ? void 0 : _.poster) !== void 0 && t.attrs.poster !== null && !$(t.attrs.poster))
548
548
  return `${i}.attrs.poster`;
549
549
  }
550
- if (q(t.type)) {
551
- const c = (C = t.attrs) == null ? void 0 : C.id;
552
- if ((t.type === "mediaBlock" || c !== void 0) && (typeof c != "string" || !c.trim() || e.has(c)))
550
+ if (I(t.type)) {
551
+ const p = (L = t.attrs) == null ? void 0 : L.id;
552
+ if ((t.type === "mediaBlock" || p !== void 0) && (typeof p != "string" || !p.trim() || e.has(p)))
553
553
  return `${i}.attrs.id`;
554
- if (typeof c == "string" && e.add(c), ((U = t.attrs) == null ? void 0 : U.nodeVersion) !== void 0 && (!Number.isSafeInteger(t.attrs.nodeVersion) || t.attrs.nodeVersion < 0))
554
+ if (typeof p == "string" && e.add(p), ((M = t.attrs) == null ? void 0 : M.nodeVersion) !== void 0 && (!Number.isSafeInteger(t.attrs.nodeVersion) || t.attrs.nodeVersion < 0))
555
555
  return `${i}.attrs.nodeVersion`;
556
556
  }
557
- if (t.type === "orderedList" && ((F = t.attrs) == null ? void 0 : F.start) !== void 0 && (!Number.isSafeInteger(t.attrs.start) || t.attrs.start < 1))
557
+ if (t.type === "orderedList" && ((C = t.attrs) == null ? void 0 : C.start) !== void 0 && (!Number.isSafeInteger(t.attrs.start) || t.attrs.start < 1))
558
558
  return `${i}.attrs.start`;
559
- if (t.type === "orderedList" && ((M = t.attrs) == null ? void 0 : M.type) !== void 0 && t.attrs.type !== null && !["1", "a", "A", "i", "I"].includes(t.attrs.type))
559
+ if (t.type === "orderedList" && ((F = t.attrs) == null ? void 0 : F.type) !== void 0 && t.attrs.type !== null && !["1", "a", "A", "i", "I"].includes(t.attrs.type))
560
560
  return `${i}.attrs.type`;
561
- if (t.type === "codeBlock" && ((E = t.attrs) == null ? void 0 : E.language) !== void 0 && t.attrs.language !== null && typeof t.attrs.language != "string")
561
+ if (t.type === "codeBlock" && ((U = t.attrs) == null ? void 0 : U.language) !== void 0 && t.attrs.language !== null && typeof t.attrs.language != "string")
562
562
  return `${i}.attrs.language`;
563
563
  if (t.marks !== void 0 && !Array.isArray(t.marks))
564
564
  return `${i}.marks`;
565
- if (u === "codeBlock" && ((_ = t.marks) != null && _.length)) return `${i}.marks`;
566
- if ((z = t.marks) != null && z.some((c) => !jt(c)))
565
+ if (u === "codeBlock" && ((E = t.marks) != null && E.length)) return `${i}.marks`;
566
+ if ((z = t.marks) != null && z.some((p) => !jt(p)))
567
567
  return `${i}.marks`;
568
568
  if ((H = t.marks) != null && H.length) {
569
- const c = t.marks.map((S) => S.type);
570
- if (new Set(c).size !== c.length || c.includes("code") && c.length > 1)
569
+ const p = t.marks.map((S) => S.type);
570
+ if (new Set(p).size !== p.length || p.includes("code") && p.length > 1)
571
571
  return `${i}.marks`;
572
572
  }
573
- for (const [c, S] of (t.content || []).entries()) {
574
- const Q = o(
573
+ for (const [p, S] of (t.content || []).entries()) {
574
+ const W = o(
575
575
  S,
576
- `${i}.content[${c}]`,
576
+ `${i}.content[${p}]`,
577
577
  t.type,
578
- l || t.type === "originalReply"
578
+ c || t.type === "originalReply"
579
579
  );
580
- if (Q) return Q;
580
+ if (W) return W;
581
581
  }
582
582
  return null;
583
583
  }
584
- return o(n, r);
584
+ return o(r, n);
585
585
  }
586
- function X(n, r, e = "knowledge.doc") {
587
- if (!n) return null;
586
+ function G(r, n, e = "knowledge.doc") {
587
+ if (!r) return null;
588
588
  const s = /* @__PURE__ */ new WeakSet(), o = (t, i) => {
589
- var a, p;
589
+ var a, l;
590
590
  if (s.has(t)) return i;
591
591
  s.add(t);
592
- const u = t.type === "businessToken" ? String((a = t.attrs) == null ? void 0 : a.kind) : t.type === "mediaBlock" ? String((p = t.attrs) == null ? void 0 : p.kind) : t.type === "originalReply" ? "originalReply" : t.type === "messageSeparator" ? "separator" : null, l = t.type === "businessToken" ? "knowledgeInline" : u ? "knowledgeBlock" : null;
593
- if (t.type === "messageSeparator" && r === "agent" || u && t.type !== "messageSeparator" && !Y.some(
594
- (d) => d.id === u && d.slot === l && d.types.includes(r)
592
+ const u = t.type === "businessToken" ? String((a = t.attrs) == null ? void 0 : a.kind) : t.type === "mediaBlock" ? String((l = t.attrs) == null ? void 0 : l.kind) : t.type === "originalReply" ? "originalReply" : t.type === "messageSeparator" ? "separator" : null, c = t.type === "businessToken" ? "knowledgeInline" : u ? "knowledgeBlock" : null;
593
+ if (t.type === "messageSeparator" && n === "agent" || u && t.type !== "messageSeparator" && !Z.some(
594
+ (d) => d.id === u && d.slot === c && d.types.includes(n)
595
595
  ))
596
596
  return i;
597
- for (const [d, y] of (t.content || []).entries()) {
598
- const g = o(y, `${i}.content[${d}]`);
597
+ for (const [d, f] of (t.content || []).entries()) {
598
+ const g = o(f, `${i}.content[${d}]`);
599
599
  if (g) return g;
600
600
  }
601
601
  return null;
602
602
  };
603
- return o(n, e);
603
+ return o(r, e);
604
604
  }
605
- function Ut(n) {
606
- if (!n || typeof n != "object" || Array.isArray(n)) return !1;
607
- const r = n, e = r.question, s = r.knowledge;
608
- return ["normal", "reasoning", "agent"].includes(String(r.type)) && !!e && typeof e == "object" && !Array.isArray(e) && typeof e.text == "string" && !!s && typeof s == "object" && !Array.isArray(s) && Object.prototype.hasOwnProperty.call(s, "doc") && !!r.extensionState && typeof r.extensionState == "object" && !Array.isArray(r.extensionState);
605
+ function Et(r) {
606
+ if (!r || typeof r != "object" || Array.isArray(r)) return !1;
607
+ const n = r, e = n.question, s = n.knowledge;
608
+ return ["normal", "reasoning", "agent"].includes(String(n.type)) && !!e && typeof e == "object" && !Array.isArray(e) && typeof e.text == "string" && !!s && typeof s == "object" && !Array.isArray(s) && Object.prototype.hasOwnProperty.call(s, "doc") && !!n.extensionState && typeof n.extensionState == "object" && !Array.isArray(n.extensionState);
609
609
  }
610
- function Ft(n) {
611
- if (!n || typeof n != "object" || Array.isArray(n))
610
+ function zt(r) {
611
+ if (!r || typeof r != "object" || Array.isArray(r))
612
612
  return "modelValue";
613
- const r = Z(n);
614
- if (r !== null) return r || "modelValue";
615
- const e = n;
613
+ const n = tt(r);
614
+ if (n !== null) return n || "modelValue";
615
+ const e = r;
616
616
  if (e.schemaVersion !== 1) return "schemaVersion";
617
- const s = m(e, [
617
+ const s = k(e, [
618
618
  "schemaVersion",
619
619
  "id",
620
620
  "type",
@@ -627,7 +627,7 @@ function Ft(n) {
627
627
  if (!["normal", "reasoning", "agent"].includes(e.type)) return "type";
628
628
  if (!e.question || typeof e.question != "object" || Array.isArray(e.question) || typeof e.question.text != "string")
629
629
  return "question.text";
630
- const o = m(
630
+ const o = k(
631
631
  e.question,
632
632
  ["text"],
633
633
  "question"
@@ -635,7 +635,7 @@ function Ft(n) {
635
635
  if (o) return o;
636
636
  if (!e.knowledge || typeof e.knowledge != "object" || Array.isArray(e.knowledge))
637
637
  return "knowledge";
638
- const t = m(
638
+ const t = k(
639
639
  e.knowledge,
640
640
  ["doc", "retainedDoc", "agentRef"],
641
641
  "knowledge"
@@ -652,27 +652,27 @@ function Ft(n) {
652
652
  const { agentRef: a } = e.knowledge;
653
653
  if (typeof a != "object" || Array.isArray(a) || typeof a.id != "string" || !a.id || typeof a.name != "string")
654
654
  return "knowledge.agentRef";
655
- const p = m(
655
+ const l = k(
656
656
  a,
657
657
  ["id", "name"],
658
658
  "knowledge.agentRef"
659
659
  );
660
- if (p) return p;
660
+ if (l) return l;
661
661
  }
662
- const i = G(e.knowledge.doc);
662
+ const i = Y(e.knowledge.doc);
663
663
  if (i) return i;
664
- const u = X(
664
+ const u = G(
665
665
  e.knowledge.doc,
666
666
  e.type
667
667
  );
668
668
  if (u) return u;
669
- const l = G(
669
+ const c = Y(
670
670
  e.knowledge.retainedDoc ?? null,
671
671
  "knowledge.retainedDoc"
672
672
  );
673
- if (l) return l;
673
+ if (c) return c;
674
674
  if (e.type === "agent") {
675
- const a = X(
675
+ const a = G(
676
676
  e.knowledge.retainedDoc ?? null,
677
677
  "normal",
678
678
  "knowledge.retainedDoc"
@@ -681,38 +681,38 @@ function Ft(n) {
681
681
  }
682
682
  if (!e.extensionState || typeof e.extensionState != "object" || Array.isArray(e.extensionState))
683
683
  return "extensionState";
684
- for (const [a, p] of Object.entries(e.extensionState)) {
685
- const d = Y.find(
684
+ for (const [a, l] of Object.entries(e.extensionState)) {
685
+ const d = Z.find(
686
686
  (g) => g.id === a && g.types.includes(e.type) && g.implementation === "plugin"
687
687
  );
688
688
  if (!d) return `extensionState.${a}`;
689
- if (!p || typeof p != "object" || p.version !== d.dataVersion)
689
+ if (!l || typeof l != "object" || l.version !== d.dataVersion)
690
690
  return `extensionState.${a}.version`;
691
- const y = m(
692
- p,
691
+ const f = k(
692
+ l,
693
693
  ["version", "data"],
694
694
  `extensionState.${a}`
695
695
  );
696
- if (y) return y;
697
- if (!p.data || typeof p.data != "object" || Array.isArray(p.data))
696
+ if (f) return f;
697
+ if (!l.data || typeof l.data != "object" || Array.isArray(l.data))
698
698
  return `extensionState.${a}.data`;
699
- if (d.slot === "questionAction" && typeof p.data.enabled != "boolean")
699
+ if (d.slot === "questionAction" && typeof l.data.enabled != "boolean")
700
700
  return `extensionState.${a}.data.enabled`;
701
701
  if (d.slot === "questionAction" && (a === "todo" || a === "tagged")) {
702
- const g = p.data;
702
+ const g = l.data;
703
703
  if (g.enabled === !0 && g.tag === void 0)
704
704
  return `extensionState.${a}.data.tag`;
705
705
  if (g.tag !== void 0) {
706
- const { tag: k } = g;
707
- if (!k || typeof k != "object" || Array.isArray(k))
706
+ const { tag: m } = g;
707
+ if (!m || typeof m != "object" || Array.isArray(m))
708
708
  return `extensionState.${a}.data.tag`;
709
- const f = k;
710
- if (typeof f.id != "string" || !f.id.trim())
709
+ const y = m;
710
+ if (typeof y.id != "string" || !y.id.trim())
711
711
  return `extensionState.${a}.data.tag.id`;
712
- if (typeof f.label != "string" || !f.label.trim() || nt(f.label))
712
+ if (typeof y.label != "string" || !y.label.trim() || nt(y.label))
713
713
  return `extensionState.${a}.data.tag.label`;
714
- const b = m(
715
- f,
714
+ const b = k(
715
+ y,
716
716
  ["id", "label"],
717
717
  `extensionState.${a}.data.tag`
718
718
  );
@@ -722,28 +722,90 @@ function Ft(n) {
722
722
  }
723
723
  return null;
724
724
  }
725
+ const Rt = (r) => typeof r == "string" && /^(?:[1-9]|[1-9]\d)$/.test(r), Dt = {
726
+ none: "不标记",
727
+ red: "红色",
728
+ yellow: "黄色",
729
+ green: "绿色",
730
+ blue: "蓝色",
731
+ purple: "紫色"
732
+ }, Ht = {
733
+ none: "",
734
+ red: "#f53f3f",
735
+ yellow: "#ff7d00",
736
+ green: "#00b42a",
737
+ blue: "#165dff",
738
+ purple: "#722ed1"
739
+ };
740
+ function Bt(r) {
741
+ if (!r || typeof r != "object" || Array.isArray(r)) return !1;
742
+ const n = r;
743
+ return typeof n.id == "string" && /^rmk_[a-z0-9]{8}$/.test(n.id) && (n.contentMode === "fixed" || n.contentMode === "smart") && typeof n.content == "string" && !!n.content.trim() && [...n.content.trim()].length <= 500 && !/\^\^|\$\$|¥¥/.test(n.content) && !n.content.endsWith("^") && Object.hasOwn(Dt, String(n.flag)) && typeof n.preserveFlag == "boolean" && (n.position === "first" || n.position === "last");
744
+ }
745
+ function X() {
746
+ return `rmk_${crypto.randomUUID().replace(/-/g, "").slice(0, 8)}`;
747
+ }
748
+ function Wt(r, n, e, s, o) {
749
+ if (r !== "small_payment" && r !== "order_note")
750
+ return { ok: !0, params: n };
751
+ let t = 0;
752
+ const i = /* @__PURE__ */ new Set(), u = (l) => {
753
+ var d, f, g;
754
+ l.type === "businessToken" && ((d = l.attrs) == null ? void 0 : d.kind) === "tool" && (!o || l.attrs.id !== o) && (l.attrs.key === "small_payment" && t++, l.attrs.key === "order_note" && i.add(String(((f = l.attrs.params) == null ? void 0 : f.id) || ""))), (g = l.content) == null || g.forEach(u);
755
+ };
756
+ if (s && u(s), r === "small_payment")
757
+ return Rt(n.amount) ? t ? {
758
+ ok: !1,
759
+ code: "TOOL_LIMIT_REACHED",
760
+ message: "最多配置一个小额打款工具"
761
+ } : { ok: !0, params: n } : {
762
+ ok: !1,
763
+ code: "TOOL_PARAMS_INVALID",
764
+ message: "打款金额必须是1-99的整数元"
765
+ };
766
+ let c = typeof e.id == "string" && /^rmk_[a-z0-9]{8}$/.test(e.id) ? e.id : X();
767
+ if (!o)
768
+ for (; i.has(c); ) c = X();
769
+ if (i.has(c))
770
+ return {
771
+ ok: !1,
772
+ code: "TOOL_PARAMS_INVALID",
773
+ message: "订单备注编号重复"
774
+ };
775
+ const a = { ...n, id: c };
776
+ return Bt(a) ? { ok: !0, params: { ...a } } : {
777
+ ok: !1,
778
+ code: "TOOL_PARAMS_INVALID",
779
+ message: "订单备注内容或配置不合法"
780
+ };
781
+ }
725
782
  export {
726
- bt as B,
727
- wt as C,
728
- St as M,
729
- Tt as a,
730
- Ft as b,
731
- Y as c,
732
- Ut as d,
733
- q as e,
734
- Z as f,
735
- G as g,
736
- xt as h,
737
- Ct as i,
783
+ wt as B,
784
+ St as C,
785
+ At as M,
786
+ xt as a,
787
+ zt as b,
788
+ Z as c,
789
+ Et as d,
790
+ I as e,
791
+ tt as f,
792
+ Y as g,
793
+ Pt as h,
794
+ Ut as i,
738
795
  $ as j,
739
796
  nt as k,
740
- Dt as l,
741
- ht as m,
742
- It as n,
743
- Ot as o,
744
- Nt as p,
797
+ _t as l,
798
+ Vt as m,
799
+ qt as n,
800
+ Kt as o,
801
+ Wt as p,
745
802
  Rt as q,
746
- Kt as r,
747
- Lt as s,
748
- Bt as t
803
+ Bt as r,
804
+ Ft as s,
805
+ Dt as t,
806
+ Lt as u,
807
+ Ct as v,
808
+ Nt as w,
809
+ Mt as x,
810
+ Ht as y
749
811
  };