@freecallai/pro 0.0.1 → 0.0.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 (119) hide show
  1. package/README.md +23 -17
  2. package/dist/FkpKnowledgeTypePicker.vue_vue_type_script_setup_true_lang-xR8ZhhdJ.js +187 -0
  3. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-CaHRIHab.js +4864 -0
  4. package/dist/KnowledgeArea-_rsydhnt.js +1438 -0
  5. package/dist/{ToolForm-CWpUIVTl.js → ToolForm-Czg67cDT.js} +1 -1
  6. package/dist/{choice-DDg5gNtS.js → choice-Bt2xhoN_.js} +1 -1
  7. package/dist/edition-info/index.js +4 -0
  8. package/dist/filters/index.js +7 -0
  9. package/dist/guard-B7U3S4F1.js +1163 -0
  10. package/dist/{index-D8bcFtWR.js → index-9NM1SHoR.js} +1 -1
  11. package/dist/index-B4-2_sJI.js +10 -0
  12. package/dist/{index-DOEijEGU.js → index-BBv72oZe.js} +10 -10
  13. package/dist/index-BF6MRSMb.js +6 -0
  14. package/dist/index-BQrYBmwR.js +5 -0
  15. package/dist/index-CS2xQQ8W.js +168 -0
  16. package/dist/index-D0bJAQSN.js +327 -0
  17. package/dist/index-D9yqpH_4.js +57 -0
  18. package/dist/index-DCmHHi07.js +71 -0
  19. package/dist/index-DYeJRJY1.js +6 -0
  20. package/dist/{index-CJlAseSN.js → index-DnaEbb6l.js} +1 -1
  21. package/dist/{index-DSgEWJGP.js → index-Dy2Gy3bL.js} +1 -1
  22. package/dist/index-lNhA3N9x.js +379 -0
  23. package/dist/{index-5a9mHHzg.js → index-sjDmbR5o.js} +1 -1
  24. package/dist/index-trxE5T0w.js +6 -0
  25. package/dist/index-uCVrA6xK.js +5 -0
  26. package/dist/index.js +36 -11
  27. package/dist/inline-KPGqYMIR.js +19 -0
  28. package/dist/knowledge-CupkY2rK.js +6 -0
  29. package/dist/{knowledge-DnYGicjn.js → knowledge-DzwXQR-q.js} +1 -1
  30. package/dist/knowledge-type-picker/index.js +5 -0
  31. package/dist/media-extensions-DhRlLKYM.js +321 -0
  32. package/dist/{media-migration-CGOFwdYm.js → media-migration-CbMT2wS0.js} +1 -1
  33. package/dist/{media-upload-Dx45yv6a.js → media-upload-P9WeUHHr.js} +1 -1
  34. package/dist/navigation/index.js +4 -0
  35. package/dist/operations-D8pn-_iW.js +20 -0
  36. package/dist/{question-DGC6JHy5.js → question-C7akkjHn.js} +1 -1
  37. package/dist/{question-D1--acV8.js → question-DXZ8R-34.js} +1 -1
  38. package/dist/rich-text/index.js +57 -53
  39. package/dist/rich-text/legacy-converter/index.js +1271 -340
  40. package/dist/style.css +1 -1
  41. package/dist/switcher/index.js +4 -0
  42. package/dist/types/edition-info/FkpEditionInfo.vue.d.ts +5 -0
  43. package/dist/types/edition-info/index.d.ts +2 -0
  44. package/dist/types/edition-info/types.d.ts +5 -0
  45. package/dist/types/filters/FkpFilter.vue.d.ts +20 -0
  46. package/dist/types/filters/FkpFilterDateRange.vue.d.ts +13 -0
  47. package/dist/types/filters/FkpFilterPeriod.vue.d.ts +17 -0
  48. package/dist/types/filters/FkpSearchableMultiSelect.vue.d.ts +44 -0
  49. package/dist/types/filters/index.d.ts +5 -0
  50. package/dist/types/filters/selection.d.ts +5 -0
  51. package/dist/types/filters/types.d.ts +30 -0
  52. package/dist/types/index.d.ts +7 -1
  53. package/dist/types/knowledge-type-picker/index.d.ts +3 -0
  54. package/dist/types/navigation/FkpNavigation.vue.d.ts +51 -0
  55. package/dist/types/navigation/index.d.ts +2 -0
  56. package/dist/types/navigation/types.d.ts +15 -0
  57. package/dist/types/rich-text/FkpRichText.vue.d.ts +31 -7
  58. package/dist/types/rich-text/__demo__/conversion-fixtures.d.ts +2 -2
  59. package/dist/types/rich-text/__demo__/reasoning-template-examples.d.ts +11 -0
  60. package/dist/types/rich-text/config/descriptor.d.ts +25 -2
  61. package/dist/types/rich-text/config/resolve.d.ts +2 -0
  62. package/dist/types/rich-text/index.d.ts +3 -1
  63. package/dist/types/rich-text/legacy-converter/agent-prompt-preview.d.ts +2 -0
  64. package/dist/types/rich-text/legacy-converter/business-attribute.d.ts +12 -0
  65. package/dist/types/rich-text/legacy-converter/index.d.ts +8 -0
  66. package/dist/types/rich-text/legacy-converter/tool-contract.d.ts +1 -0
  67. package/dist/types/rich-text/model/guard.d.ts +2 -1
  68. package/dist/types/rich-text/model/node-contract.d.ts +3 -5
  69. package/dist/types/rich-text/model/node-identity.d.ts +7 -1
  70. package/dist/types/rich-text/model/question-text.d.ts +2 -4
  71. package/dist/types/rich-text/plugins/attribute/token.d.ts +9 -0
  72. package/dist/types/rich-text/plugins/operations.d.ts +9 -0
  73. package/dist/types/rich-text/plugins/reasoningTemplate/defaults.d.ts +14 -0
  74. package/dist/types/rich-text/plugins/reasoningTemplate/examples.d.ts +9 -0
  75. package/dist/types/rich-text/plugins/separator/token.d.ts +2 -0
  76. package/dist/types/rich-text/plugins/tableKnowledge/descriptor.d.ts +2 -0
  77. package/dist/types/rich-text/plugins/tableKnowledge/index.d.ts +2 -0
  78. package/dist/types/rich-text/plugins/tableKnowledge/token.d.ts +9 -0
  79. package/dist/types/rich-text/plugins/ticket/protocol.d.ts +8 -0
  80. package/dist/types/rich-text/plugins/ticket/token.d.ts +9 -0
  81. package/dist/types/rich-text/plugins/todo/token.d.ts +3 -0
  82. package/dist/types/rich-text/plugins/token-catalog.d.ts +46 -0
  83. package/dist/types/rich-text/plugins/token-definition.d.ts +24 -0
  84. package/dist/types/rich-text/plugins/tool/presentation.d.ts +2 -1
  85. package/dist/types/rich-text/plugins/tool/protocol.d.ts +5 -0
  86. package/dist/types/rich-text/plugins/tool/rules.d.ts +35 -0
  87. package/dist/types/rich-text/plugins/tool/token.d.ts +2 -0
  88. package/dist/types/rich-text/plugins/variable/token.d.ts +2 -0
  89. package/dist/types/rich-text/public/types.d.ts +73 -6
  90. package/dist/types/rich-text/runtime/action-ports.d.ts +6 -1
  91. package/dist/types/rich-text/runtime/file-drop-guard.d.ts +2 -0
  92. package/dist/types/rich-text/runtime/knowledge-clipboard.d.ts +16 -0
  93. package/dist/types/rich-text/runtime/media-policy.d.ts +15 -0
  94. package/dist/types/rich-text/runtime/media-target.d.ts +3 -0
  95. package/dist/types/rich-text/runtime/media-upload-session.d.ts +5 -1
  96. package/dist/types/rich-text/runtime/media-upload-slots.d.ts +4 -0
  97. package/dist/types/rich-text/runtime/schema-plan.d.ts +1 -0
  98. package/dist/types/rich-text/types.d.ts +3 -40
  99. package/dist/types/rich-text/ui/FkpKnowledgeTypePicker.vue.d.ts +38 -0
  100. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +12 -1
  101. package/dist/types/rich-text/ui/knowledge-type-picker-types.d.ts +14 -0
  102. package/dist/types/rich-text/ui/token-renderer.d.ts +5 -0
  103. package/dist/types/switcher/FkpSwitcher.vue.d.ts +52 -0
  104. package/dist/types/switcher/index.d.ts +2 -0
  105. package/dist/types/switcher/types.d.ts +7 -0
  106. package/package.json +26 -6
  107. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js +0 -4115
  108. package/dist/KnowledgeArea-OPR7smbt.js +0 -923
  109. package/dist/guard-BCatAeT4.js +0 -749
  110. package/dist/index-BsQLwz91.js +0 -5
  111. package/dist/index-CzpY61Qj.js +0 -6
  112. package/dist/index-DxxX09iY.js +0 -6
  113. package/dist/index-nnvfy5q0.js +0 -31
  114. package/dist/index-urNonkMH.js +0 -6
  115. package/dist/index-xAjlBylT.js +0 -5
  116. package/dist/inline-TT_dl8Y3.js +0 -17
  117. package/dist/knowledge-BZCmalF_.js +0 -6
  118. package/dist/media-extensions-ZoxmhIhH.js +0 -276
  119. package/dist/operations-JgnjGx3H.js +0 -19
@@ -0,0 +1,1163 @@
1
+ const be = [
2
+ {
3
+ id: "todo",
4
+ apiVersion: 1,
5
+ dataVersion: 1,
6
+ implementation: "plugin",
7
+ label: "待办",
8
+ slot: "questionAction",
9
+ actions: [{ id: "todo.questionAction.apply", requiredPorts: [] }],
10
+ order: 10,
11
+ types: ["normal"],
12
+ icon: "Followup",
13
+ menu: {
14
+ title: "待办标签",
15
+ searchLabel: "搜索标签名称",
16
+ classes: ["is-todo-menu"],
17
+ width: 296,
18
+ helpClass: "fkp-todo-help",
19
+ guidanceClass: "fkp-todo-guidance",
20
+ guidance: [
21
+ "常规知识可直接开启待办标签;",
22
+ "推理知识需在回复话术末尾双引号前添加该标签;",
23
+ "触发后,「人机协同」「仅提示/夜间值守」会进入待办,「智能转接」会按所选方案转接"
24
+ ]
25
+ },
26
+ optionKind: "selection",
27
+ optionSource: "flatTags",
28
+ optionTrigger: "hover",
29
+ questionTag: { kind: "todo", protocolLabel: "待办" }
30
+ },
31
+ {
32
+ id: "todo",
33
+ apiVersion: 1,
34
+ dataVersion: 1,
35
+ implementation: "plugin",
36
+ label: "待办",
37
+ slot: "knowledgeInline",
38
+ actions: [{ id: "todo.knowledgeInline.apply", requiredPorts: [] }],
39
+ order: 10,
40
+ types: ["reasoning"],
41
+ icon: "Followup",
42
+ menu: {
43
+ title: "待办标签",
44
+ searchLabel: "搜索标签名称",
45
+ classes: ["is-todo-menu"],
46
+ width: 296,
47
+ helpClass: "fkp-todo-help",
48
+ guidanceClass: "fkp-todo-guidance",
49
+ guidance: [
50
+ "常规知识可直接开启待办标签;",
51
+ "推理知识需在回复话术末尾双引号前添加该标签;",
52
+ "触发后,「人机协同」「仅提示/夜间值守」会进入待办,「智能转接」会按所选方案转接"
53
+ ]
54
+ },
55
+ optionKind: "selection",
56
+ optionSource: "flatTags",
57
+ optionTrigger: "hover"
58
+ }
59
+ ], we = [
60
+ {
61
+ id: "tableKnowledge",
62
+ apiVersion: 1,
63
+ dataVersion: 1,
64
+ implementation: "plugin",
65
+ label: "表格知识",
66
+ slot: "knowledgeInline",
67
+ actions: [
68
+ { id: "tableKnowledge.knowledgeInline.apply", requiredPorts: [] }
69
+ ],
70
+ order: 55,
71
+ types: ["normal", "reasoning"],
72
+ icon: "table-knowledge",
73
+ menu: {
74
+ title: "表格知识",
75
+ searchLabel: "搜索表格知识名称",
76
+ classes: ["is-table-menu"],
77
+ width: 320,
78
+ helpClass: "fkp-reference-help"
79
+ },
80
+ optionKind: "selection",
81
+ optionSource: "flatTags",
82
+ optionTrigger: "hover"
83
+ }
84
+ ], he = [
85
+ {
86
+ id: "ticket",
87
+ apiVersion: 1,
88
+ dataVersion: 1,
89
+ implementation: "plugin",
90
+ label: "工单",
91
+ slot: "knowledgeInline",
92
+ actions: [{ id: "ticket.knowledgeInline.apply", requiredPorts: [] }],
93
+ order: 25,
94
+ types: ["reasoning"],
95
+ icon: "AI-ticket",
96
+ menu: {
97
+ title: "工单",
98
+ searchLabel: "搜索工单名称",
99
+ classes: ["is-ticket-menu"],
100
+ width: 320,
101
+ helpClass: "fkp-ticket-help",
102
+ guidanceClass: "fkp-ticket-guidance",
103
+ guidance: [
104
+ "可将工单场景添加至目标客服回复话术的引号“”内,命中后将自动创建工单"
105
+ ],
106
+ headingClass: "fkp-ticket-heading",
107
+ badge: {
108
+ text: "限免",
109
+ className: "fkp-ticket-badge",
110
+ dotClass: "fkp-ticket-dot"
111
+ }
112
+ },
113
+ optionKind: "selection",
114
+ optionSource: "flatTags",
115
+ optionTrigger: "hover"
116
+ }
117
+ ], $e = [
118
+ {
119
+ id: "originalReply",
120
+ apiVersion: 1,
121
+ dataVersion: 1,
122
+ implementation: "plugin",
123
+ label: "原话",
124
+ removalLabel: "原话复述",
125
+ slot: "questionAction",
126
+ actions: [{ id: "originalReply.questionAction.apply", requiredPorts: [] }],
127
+ order: 20,
128
+ types: ["normal"],
129
+ icon: "quote"
130
+ },
131
+ {
132
+ id: "originalReply",
133
+ apiVersion: 1,
134
+ dataVersion: 1,
135
+ implementation: "plugin",
136
+ label: "原话",
137
+ removalLabel: "原话复述",
138
+ slot: "knowledgeBlock",
139
+ actions: [{ id: "originalReply.knowledgeBlock.apply", requiredPorts: [] }],
140
+ order: 20,
141
+ types: ["reasoning"],
142
+ icon: "quote"
143
+ }
144
+ ], Se = [
145
+ {
146
+ id: "memory",
147
+ apiVersion: 1,
148
+ dataVersion: 1,
149
+ implementation: "plugin",
150
+ label: "记忆",
151
+ slot: "questionAction",
152
+ actions: [{ id: "memory.questionAction.apply", requiredPorts: [] }],
153
+ order: 30,
154
+ types: ["normal", "reasoning", "agent"],
155
+ icon: "memory"
156
+ }
157
+ ], Ae = [
158
+ {
159
+ id: "tagged",
160
+ apiVersion: 1,
161
+ dataVersion: 1,
162
+ implementation: "plugin",
163
+ label: "打标",
164
+ slot: "questionAction",
165
+ actions: [{ id: "tagged.questionAction.apply", requiredPorts: [] }],
166
+ order: 40,
167
+ types: ["normal", "reasoning", "agent"],
168
+ icon: "tag",
169
+ menu: {
170
+ title: "顾客标签",
171
+ searchLabel: "搜索标签名称",
172
+ classes: ["is-todo-menu", "is-tagged-menu"],
173
+ width: 336,
174
+ helpClass: "fkp-todo-help",
175
+ guidanceClass: "fkp-tagged-guidance",
176
+ guidance: ["顾客消息命中此场景后,将对其打上所选顾客标签"]
177
+ },
178
+ optionKind: "selection",
179
+ optionSource: "flatTags",
180
+ optionTrigger: "hover",
181
+ questionTag: { kind: "default", protocolLabel: "顾客标签" }
182
+ }
183
+ ], Te = [
184
+ {
185
+ id: "attribute",
186
+ apiVersion: 1,
187
+ dataVersion: 1,
188
+ implementation: "plugin",
189
+ label: "属性",
190
+ slot: "knowledgeInline",
191
+ actions: [{ id: "attribute.knowledgeInline.apply", requiredPorts: [] }],
192
+ order: 30,
193
+ types: ["reasoning"],
194
+ icon: "data",
195
+ menu: {
196
+ title: "属性",
197
+ searchLabel: "搜索属性名称",
198
+ classes: ["is-attribute-menu"],
199
+ width: 320,
200
+ helpClass: "fkp-reference-help",
201
+ guidanceClass: "fkp-reference-guidance",
202
+ guidance: [
203
+ "命中此场景后,AI将读取引用的业务属性数据,用于判断条件并生成回复"
204
+ ]
205
+ },
206
+ optionKind: "selection",
207
+ optionSource: "capabilities",
208
+ optionTrigger: "hover",
209
+ optionHierarchy: "tree"
210
+ }
211
+ ], Ie = [
212
+ {
213
+ id: "tool",
214
+ apiVersion: 1,
215
+ dataVersion: 1,
216
+ implementation: "plugin",
217
+ label: "工具",
218
+ slot: "knowledgeInline",
219
+ actions: [{ id: "tool.knowledgeInline.apply", requiredPorts: [] }],
220
+ order: 40,
221
+ types: ["reasoning"],
222
+ icon: "tool",
223
+ menu: {
224
+ title: "工具",
225
+ searchLabel: "搜索工具名称",
226
+ classes: ["is-tool-menu"],
227
+ width: 320,
228
+ helpClass: "fkp-reference-help",
229
+ guidanceClass: "fkp-reference-guidance",
230
+ guidance: [
231
+ "命中此场景后,AI将在判断条件后,按照引用工具中设定的内容,自动执行对应操作"
232
+ ]
233
+ },
234
+ optionKind: "selection",
235
+ optionSource: "capabilities",
236
+ optionTrigger: "hover",
237
+ optionHierarchy: "tree",
238
+ uiPorts: ["getToolForm"]
239
+ }
240
+ ], ve = [
241
+ {
242
+ id: "variable",
243
+ apiVersion: 1,
244
+ dataVersion: 1,
245
+ implementation: "plugin",
246
+ label: "变量",
247
+ slot: "knowledgeInline",
248
+ actions: [{ id: "variable.knowledgeInline.apply", requiredPorts: [] }],
249
+ order: 50,
250
+ types: ["normal", "reasoning"],
251
+ icon: "variate",
252
+ menu: {
253
+ title: "变量",
254
+ searchLabel: "搜索变量名称",
255
+ classes: ["is-variable-menu"],
256
+ width: 426,
257
+ helpClass: "fkp-variable-help",
258
+ guidanceClass: "fkp-variable-guidance",
259
+ guidance: ["可插入客服昵称,或您在变量管理中配置的变量"]
260
+ },
261
+ optionKind: "selection",
262
+ optionSource: "variables",
263
+ optionTrigger: "hover"
264
+ }
265
+ ];
266
+ const it = {
267
+ agents: "searchAgents",
268
+ variables: "listVariables",
269
+ flatTags: "listCapabilityOptions",
270
+ capabilities: "listCapabilityOptions",
271
+ reasoningTemplates: "listCapabilityOptions"
272
+ };
273
+ const w = {
274
+ agentOpenConfig: {
275
+ id: "agentSelect.openConfig",
276
+ requiredPorts: ["openAgentConfig"]
277
+ },
278
+ imageUpload: { id: "image.upload", requiredPorts: ["uploadMedia"] },
279
+ videoUpload: { id: "video.upload", requiredPorts: ["uploadMedia"] },
280
+ reasoningPolishPropose: {
281
+ id: "reasoningPolish.propose",
282
+ requiredPorts: ["proposeReasoning"]
283
+ },
284
+ reasoningTemplateLoad: {
285
+ id: "reasoningTemplate.load",
286
+ requiredPorts: [],
287
+ optionalPorts: ["getReasoningTemplate", "listCapabilityOptions"]
288
+ }
289
+ }, xe = [
290
+ {
291
+ id: "image",
292
+ apiVersion: 1,
293
+ dataVersion: 1,
294
+ implementation: "plugin",
295
+ label: "图片",
296
+ slot: "knowledgeBlock",
297
+ actions: [w.imageUpload],
298
+ primaryActionId: "image.upload",
299
+ order: 60,
300
+ types: ["normal", "reasoning"],
301
+ icon: "pic",
302
+ optionKind: "media"
303
+ }
304
+ ], Pe = [
305
+ {
306
+ id: "video",
307
+ apiVersion: 1,
308
+ dataVersion: 1,
309
+ implementation: "plugin",
310
+ label: "视频",
311
+ slot: "knowledgeBlock",
312
+ actions: [w.videoUpload],
313
+ primaryActionId: "video.upload",
314
+ order: 70,
315
+ types: ["normal", "reasoning"],
316
+ icon: "video2",
317
+ optionKind: "media"
318
+ }
319
+ ], Oe = [
320
+ {
321
+ id: "separator",
322
+ apiVersion: 1,
323
+ dataVersion: 1,
324
+ implementation: "plugin",
325
+ label: "分隔符",
326
+ slot: "knowledgeInline",
327
+ actions: [{ id: "separator.knowledgeInline.apply", requiredPorts: [] }],
328
+ order: 80,
329
+ types: ["normal", "reasoning"],
330
+ icon: "sep"
331
+ }
332
+ ], qe = [
333
+ {
334
+ id: "reasoningPolish",
335
+ apiVersion: 1,
336
+ dataVersion: 1,
337
+ implementation: "plugin",
338
+ label: "润色",
339
+ slot: "sceneAction",
340
+ actions: [w.reasoningPolishPropose],
341
+ primaryActionId: "reasoningPolish.propose",
342
+ order: 90,
343
+ types: ["reasoning"],
344
+ icon: "AI"
345
+ }
346
+ ], Ve = [
347
+ {
348
+ id: "reasoningTemplate",
349
+ apiVersion: 1,
350
+ dataVersion: 1,
351
+ implementation: "plugin",
352
+ label: "模板",
353
+ slot: "sceneAction",
354
+ actions: [w.reasoningTemplateLoad],
355
+ primaryActionId: "reasoningTemplate.load",
356
+ order: 100,
357
+ types: ["reasoning"],
358
+ icon: "tabs",
359
+ menu: {
360
+ title: "模板",
361
+ searchLabel: "搜索模板名称",
362
+ classes: [],
363
+ width: 320,
364
+ helpClass: "fkp-reference-help"
365
+ },
366
+ optionKind: "selection",
367
+ optionSource: "reasoningTemplates"
368
+ }
369
+ ], je = [
370
+ {
371
+ id: "agentSelect",
372
+ apiVersion: 1,
373
+ dataVersion: 1,
374
+ implementation: "host",
375
+ label: "选择 Agent",
376
+ slot: "sceneAction",
377
+ actions: [w.agentOpenConfig],
378
+ readPorts: ["getAgentPrompt"],
379
+ order: 10,
380
+ types: ["agent"],
381
+ icon: "Agent",
382
+ menu: {
383
+ title: "自定义Agent",
384
+ searchLabel: "搜索标签名称",
385
+ classes: ["is-agent-menu", "fkp-agent-menu"],
386
+ width: 320,
387
+ helpClass: "fkp-agent-help",
388
+ guidanceClass: "fkp-agent-guidance",
389
+ guidance: [
390
+ "顾客消息命中此场景,AI 将按所选 Agent 的配置流程进行多轮追问判断,并最终根据实际情况自动回复;"
391
+ ]
392
+ },
393
+ optionKind: "selection",
394
+ optionSource: "agents",
395
+ optionTrigger: "hover"
396
+ }
397
+ ], q = [
398
+ ...be,
399
+ ...he,
400
+ ...we,
401
+ ...$e,
402
+ ...Se,
403
+ ...Ae,
404
+ ...Te,
405
+ ...Ie,
406
+ ...ve,
407
+ ...xe,
408
+ ...Pe,
409
+ ...Oe,
410
+ ...qe,
411
+ ...Ve,
412
+ ...je
413
+ ];
414
+ function ce(e, t = "") {
415
+ const r = /* @__PURE__ */ new Set(), i = (o, a, n) => {
416
+ if (o === null || typeof o == "string" || typeof o == "boolean")
417
+ return null;
418
+ if (typeof o == "number")
419
+ return Number.isFinite(o) ? null : a;
420
+ if (typeof o != "object" || n > 64 || r.has(o))
421
+ return a;
422
+ if (!Array.isArray(o)) {
423
+ const c = Object.getPrototypeOf(o);
424
+ if (c !== Object.prototype && c !== null) return a;
425
+ }
426
+ const s = Reflect.ownKeys(o);
427
+ if (s.some((c) => typeof c == "symbol")) return a;
428
+ if (Array.isArray(o)) {
429
+ if (s.length !== o.length + 1) return a;
430
+ for (let c = 0; c < o.length; c++)
431
+ if (!Object.prototype.hasOwnProperty.call(o, c))
432
+ return `${a}[${c}]`;
433
+ }
434
+ r.add(o);
435
+ for (const c of s) {
436
+ if (Array.isArray(o) && c === "length") continue;
437
+ const l = Object.getOwnPropertyDescriptor(o, c), u = Array.isArray(o) ? `${a}[${String(c)}]` : a ? `${a}.${String(c)}` : String(c);
438
+ if (!l || !("value" in l) || !Array.isArray(o) && !l.enumerable)
439
+ return u;
440
+ const d = i(l.value, u, n + 1);
441
+ if (d !== null) return d;
442
+ }
443
+ return r.delete(o), null;
444
+ };
445
+ try {
446
+ return i(e, t, 0);
447
+ } catch {
448
+ return t;
449
+ }
450
+ }
451
+ function S(e, t, r) {
452
+ return {
453
+ choice: !0,
454
+ present: (i) => ({
455
+ layout: "choice",
456
+ icon: t,
457
+ label: String(i.label || ""),
458
+ ariaLabel: `${e}:${i.label || ""}`
459
+ }),
460
+ serialize: r
461
+ };
462
+ }
463
+ const Le = S(
464
+ "待办",
465
+ "Followup",
466
+ (e) => e.label === "默认" && e.token === "{待办}" ? "{待办}" : `{待办@${e.label || e.key}}`
467
+ );
468
+ function st(e) {
469
+ const t = e.match(/^\{智能工单@name=([^{};\r\n]+);id=([^\s{};]+)\}$/u);
470
+ if (t && t[1].trim())
471
+ return { key: t[2], label: t[1], params: { protocol: "legacy" } };
472
+ const r = e.match(/^\{智能建单@([^\s{}:]+):([^{}\r\n]+)\}$/u);
473
+ return r && r[2].trim() ? { key: r[1], label: r[2] } : null;
474
+ }
475
+ function _e(e, t, r) {
476
+ return (r == null ? void 0 : r.protocol) === "legacy" ? `{智能工单@name=${t};id=${e}}` : `{智能建单@${e}:${t}}`;
477
+ }
478
+ const Re = {
479
+ ...S(
480
+ "工单",
481
+ "AI-ticket",
482
+ (e) => _e(
483
+ String(e.key || ""),
484
+ String(e.label || ""),
485
+ e.params
486
+ )
487
+ ),
488
+ allowsParams: !0,
489
+ validate(e) {
490
+ return e.params != null && (typeof e.params != "object" || Array.isArray(e.params) || Object.keys(e.params).length !== 1 || e.params.protocol !== "legacy") ? "params" : typeof e.key != "string" || !/^[^\s{}:]+$/u.test(e.key) ? "key" : typeof e.label != "string" || !e.label.trim() || /[{}\r\n]/u.test(e.label) || e.params != null && /[;]/u.test(e.label) ? "label" : e.params != null && /[;]/u.test(e.key) ? "key" : null;
491
+ }
492
+ }, Ce = {
493
+ ...S(
494
+ "表格知识",
495
+ "table-knowledge",
496
+ (e) => `##${e.label}##`
497
+ ),
498
+ validate: (e) => typeof e.label != "string" || !e.label.trim() || /[#\r\n]/u.test(e.label) ? "label" : null
499
+ }, De = {
500
+ ...S("属性", "data", (e) => `{属性@${e.key}}`),
501
+ allowInOriginalReply: !1
502
+ }, Be = {
503
+ requiresInsertToken: !0,
504
+ present(e) {
505
+ const t = String(e.label || e.key || "");
506
+ return {
507
+ layout: "inline",
508
+ icon: "variate",
509
+ label: t.startsWith("#") && t.endsWith("#") ? t : `#${t}#`,
510
+ ariaLabel: String(e.label || "")
511
+ };
512
+ },
513
+ serialize: (e) => String(e.token || `#${e.key}#`)
514
+ }, Ne = {
515
+ present: (e) => ({
516
+ layout: "inline",
517
+ icon: "sep",
518
+ label: String(e.label || ""),
519
+ ariaLabel: String(e.label || "")
520
+ }),
521
+ serialize: () => "{分隔符}"
522
+ };
523
+ function Ke(e, t) {
524
+ if (e !== "order_note" && e !== "small_payment") return null;
525
+ const r = t && typeof t == "object" && !Array.isArray(t) ? t : {};
526
+ if (e === "small_payment") {
527
+ const o = typeof r.amount == "string" ? r.amount : "", a = /^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/.test(o), [n = "", s = ""] = o.split(".");
528
+ return {
529
+ label: "小额打款",
530
+ icon: "tool",
531
+ summary: a ? `¥${n}.${s.padEnd(2, "0")}` : ""
532
+ };
533
+ }
534
+ return { label: "备注", icon: "msg-tag", summary: r.contentMode === "smart" ? "智能提取" : typeof r.content == "string" ? r.content.replace(/\s+/g, " ").trim() : "" };
535
+ }
536
+ const ue = (e) => typeof e == "string" && /^(?:[1-9]|[1-9]\d)$/.test(e), pe = (e) => typeof e == "string" && /^(?:rmk_[a-z0-9]{8}|[1-9]\d*)$/.test(e), $ = {
537
+ none: "不标记",
538
+ red: "红色",
539
+ yellow: "黄色",
540
+ green: "绿色",
541
+ blue: "蓝色",
542
+ purple: "紫色"
543
+ }, at = {
544
+ none: "",
545
+ red: "#f53f3f",
546
+ yellow: "#ff7d00",
547
+ green: "#00b42a",
548
+ blue: "#165dff",
549
+ purple: "#722ed1"
550
+ };
551
+ function A(e) {
552
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
553
+ const t = e;
554
+ return pe(t.id) && (t.contentMode === "fixed" || t.contentMode === "smart") && typeof t.content == "string" && !!t.content.trim() && [...t.content.trim()].length <= 500 && !/\^\^|\$\$|¥¥/.test(t.content) && !t.content.endsWith("^") && Object.hasOwn($, String(t.flag)) && typeof t.preserveFlag == "boolean" && (t.position === "first" || t.position === "last");
555
+ }
556
+ function ae() {
557
+ return `rmk_${crypto.randomUUID().replace(/-/g, "").slice(0, 8)}`;
558
+ }
559
+ function lt(e, t, r, i, o) {
560
+ if (e !== "small_payment" && e !== "order_note")
561
+ return { ok: !0, params: t };
562
+ let a = 0;
563
+ const n = /* @__PURE__ */ new Set(), s = (u) => {
564
+ var d, y, g;
565
+ u.type === "businessToken" && ((d = u.attrs) == null ? void 0 : d.kind) === "tool" && (!o || u.attrs.id !== o) && (u.attrs.key === "small_payment" && a++, u.attrs.key === "order_note" && n.add(String(((y = u.attrs.params) == null ? void 0 : y.id) || ""))), (g = u.content) == null || g.forEach(s);
566
+ };
567
+ if (i && s(i), e === "small_payment")
568
+ return ue(t.amount) ? a ? {
569
+ ok: !1,
570
+ code: "TOOL_LIMIT_REACHED",
571
+ message: "最多配置一个小额打款工具"
572
+ } : { ok: !0, params: t } : {
573
+ ok: !1,
574
+ code: "TOOL_PARAMS_INVALID",
575
+ message: "打款金额必须是1-99的整数元"
576
+ };
577
+ let c = pe(r.id) ? r.id : ae();
578
+ if (!o)
579
+ for (; n.has(c); ) c = ae();
580
+ if (n.has(c))
581
+ return {
582
+ ok: !1,
583
+ code: "TOOL_PARAMS_INVALID",
584
+ message: "订单备注编号重复"
585
+ };
586
+ const l = { ...t, id: c };
587
+ return A(l) ? { ok: !0, params: { ...l } } : {
588
+ ok: !1,
589
+ code: "TOOL_PARAMS_INVALID",
590
+ message: "订单备注内容或配置不合法"
591
+ };
592
+ }
593
+ function ct(e) {
594
+ const t = /^\{外部方法@([^\s{}:]+):([^{}\r\n]+)\}$/u.exec(e);
595
+ if (t && t[2].trim())
596
+ return {
597
+ type: "businessToken",
598
+ attrs: {
599
+ kind: "tool",
600
+ key: "external_method",
601
+ label: t[2],
602
+ params: { sceneId: t[1], sceneName: t[2] }
603
+ }
604
+ };
605
+ const r = /^\$\$小额打款@([1-9]\d*)\$\$$/u.exec(e);
606
+ if (r) {
607
+ const n = Number(r[1]);
608
+ return n < 100 || n > 9900 || n % 100 !== 0 ? null : {
609
+ type: "businessToken",
610
+ attrs: {
611
+ kind: "tool",
612
+ key: "small_payment",
613
+ label: "小额打款",
614
+ params: { amount: String(n / 100) }
615
+ }
616
+ };
617
+ }
618
+ const i = /^\^\^订单备注-(固定话术|智能提取)@编号=(rmk_[a-z0-9]{8}|[1-9]\d*);插旗=([^;]+);保留已有旗帜=(是|否);位置=(最前|最后);内容=([\s\S]+)\^\^$/u.exec(
619
+ e
620
+ );
621
+ if (!i) return null;
622
+ const o = Object.keys($).find(
623
+ (n) => $[n] === i[3]
624
+ );
625
+ if (!o) return null;
626
+ const a = {
627
+ id: i[2],
628
+ contentMode: i[1] === "固定话术" ? "fixed" : "smart",
629
+ content: i[6],
630
+ flag: o,
631
+ preserveFlag: i[4] === "是",
632
+ position: i[5] === "最前" ? "first" : "last"
633
+ };
634
+ return A(a) ? {
635
+ type: "businessToken",
636
+ attrs: { kind: "tool", key: "order_note", label: "订单备注", params: a }
637
+ } : null;
638
+ }
639
+ function Fe(e) {
640
+ var r;
641
+ if (e.type !== "businessToken" || ((r = e.attrs) == null ? void 0 : r.kind) !== "tool") return null;
642
+ const { params: t } = e.attrs;
643
+ if (e.attrs.key === "external_method") {
644
+ const { sceneId: i, sceneName: o } = t || {};
645
+ return typeof i == "string" && /^[^\s{}:]+$/u.test(i) && typeof o == "string" && o.trim() && !/[{}\r\n]/u.test(o) ? `{外部方法@${i}:${o}}` : null;
646
+ }
647
+ return e.attrs.key === "small_payment" ? ue(t == null ? void 0 : t.amount) ? `$$小额打款@${Number(t.amount) * 100}$$` : null : e.attrs.key !== "order_note" || !A(t) ? null : `^^订单备注-${t.contentMode === "fixed" ? "固定话术" : "智能提取"}@编号=${t.id};插旗=${$[t.flag]};保留已有旗帜=${t.preserveFlag ? "是" : "否"};位置=${t.position === "first" ? "最前" : "最后"};内容=${t.content}^^`;
648
+ }
649
+ function ut(e) {
650
+ try {
651
+ const t = JSON.parse(decodeURIComponent(e)), r = {
652
+ id: String(t.id || ""),
653
+ contentMode: t.content_type === "extract" ? "smart" : "fixed",
654
+ content: String(t.content || ""),
655
+ flag: t.flag,
656
+ preserveFlag: t.keep_flag_if_exists,
657
+ position: t.remark_position === "after" ? "last" : "first"
658
+ };
659
+ return !["fixed", "extract"].includes(String(t.content_type)) || !["before", "after"].includes(String(t.remark_position)) || !A(r) ? null : {
660
+ type: "businessToken",
661
+ attrs: { kind: "tool", key: "order_note", label: "订单备注", params: r }
662
+ };
663
+ } catch {
664
+ return null;
665
+ }
666
+ }
667
+ const Me = {
668
+ allowsParams: !0,
669
+ present(e) {
670
+ const t = Ke(e.key, e.params);
671
+ return t ? {
672
+ layout: "toolNote",
673
+ icon: t.icon,
674
+ label: t.label,
675
+ ariaLabel: t.summary ? `${t.label}:${t.summary}` : t.label,
676
+ className: `fkp-tool-note fkp-tool-note--${e.key === "order_note" ? "order-note" : "small-payment"}`,
677
+ summary: t.summary
678
+ } : {
679
+ layout: "tool",
680
+ icon: "tool",
681
+ label: String(e.label || ""),
682
+ ariaLabel: `工具:${e.label || ""}`
683
+ };
684
+ },
685
+ serialize(e) {
686
+ if (["small_payment", "order_note", "external_method"].includes(
687
+ String(e.key)
688
+ )) {
689
+ const t = Fe({
690
+ type: "businessToken",
691
+ attrs: { ...e }
692
+ });
693
+ if (!t) throw new Error("工具参数无法序列化为算法协议");
694
+ return t;
695
+ }
696
+ return `{工具@${e.key}}`;
697
+ }
698
+ }, de = {
699
+ todo: Le,
700
+ ticket: Re,
701
+ tableKnowledge: Ce,
702
+ variable: Be,
703
+ attribute: De,
704
+ tool: Me,
705
+ separator: Ne
706
+ }, P = de;
707
+ function I(e) {
708
+ return typeof e == "string" && Object.prototype.hasOwnProperty.call(P, e) ? P[e] : void 0;
709
+ }
710
+ const ge = Object.keys(
711
+ de
712
+ ), Ee = ge.filter(
713
+ (e) => P[e].choice
714
+ ), Ue = ["image", "video"], ze = new Set(ge), We = new Set(Ee), He = new Set(Ue), fe = (e) => typeof e == "string" && ze.has(e), pt = (e) => typeof e == "string" && We.has(e), ye = (e) => typeof e == "string" && He.has(e), Je = /* @__PURE__ */ new Set([
715
+ "businessToken",
716
+ "originalReply",
717
+ "messageSeparator",
718
+ "mediaBlock"
719
+ ]), V = (e) => Je.has(e);
720
+ function Qe(e, t) {
721
+ return e === "businessToken" ? fe(t == null ? void 0 : t.kind) ? t.kind : null : e === "mediaBlock" ? ye(t == null ? void 0 : t.kind) ? t.kind : null : e === "originalReply" ? "originalReply" : e === "messageSeparator" ? "separator" : null;
722
+ }
723
+ function Ge(e) {
724
+ const t = Qe(e.type || "", e.attrs);
725
+ return t ? {
726
+ id: t,
727
+ slot: e.type === "businessToken" || e.type === "messageSeparator" ? "knowledgeInline" : "knowledgeBlock"
728
+ } : null;
729
+ }
730
+ function Ye(e) {
731
+ var t;
732
+ return !!((t = e.content) != null && t.some(
733
+ (r) => typeof r.type == "string" && V(r.type) || Ye(r)
734
+ ));
735
+ }
736
+ const dt = "fkpTrustedNodeIds";
737
+ function gt(e) {
738
+ const t = [], r = (i) => {
739
+ var o, a;
740
+ i.type && V(i.type) && typeof ((o = i.attrs) == null ? void 0 : o.id) == "string" && i.attrs.id && t.push(i.attrs.id), (a = i.content) == null || a.forEach(r);
741
+ };
742
+ return Array.isArray(e) ? e.forEach(r) : r(e), t;
743
+ }
744
+ function ft(e, t) {
745
+ for (let a = 0; a < 8; a++) {
746
+ const n = t();
747
+ if (n && !e.has(n)) return n;
748
+ }
749
+ const r = t() || "node";
750
+ let i = r, o = 1;
751
+ for (; e.has(i); ) i = `${r}-${o++}`;
752
+ return i;
753
+ }
754
+ function O(e) {
755
+ if (typeof e != "string" || !/^https?:\/\/[^\s]+$/i.test(e))
756
+ return !1;
757
+ try {
758
+ const t = new URL(e);
759
+ return (t.protocol === "http:" || t.protocol === "https:") && !!t.hostname && !t.username && !t.password;
760
+ } catch {
761
+ return !1;
762
+ }
763
+ }
764
+ function Xe(e) {
765
+ return e.includes("[") || e.includes("]") || /[【】\r\n]/u.test(e);
766
+ }
767
+ function me(e) {
768
+ return /[{}\r\n]/u.test(e);
769
+ }
770
+ function Ze(e, t) {
771
+ var n;
772
+ const r = (n = e.extensionState[t]) == null ? void 0 : n.data;
773
+ if (!r || typeof r != "object" || Array.isArray(r)) return null;
774
+ const { tag: i } = r;
775
+ if (!i || typeof i != "object" || Array.isArray(i)) return null;
776
+ const { id: o, label: a } = i;
777
+ return typeof o != "string" || !o.trim() || typeof a != "string" || !a.trim() ? null : { id: o, label: a };
778
+ }
779
+ function et(e) {
780
+ return q.filter(
781
+ (t) => t.slot === "questionAction" && t.questionTag && t.types.includes(e.type)
782
+ ).sort((t, r) => t.order - r.order).flatMap(({ id: t, questionTag: r }) => {
783
+ var s;
784
+ const i = r.protocolLabel, o = (s = e.extensionState[t]) == null ? void 0 : s.data, a = o && typeof o == "object" && !Array.isArray(o) ? o.enabled === !0 : !1, n = a ? Ze(e, t) : null;
785
+ if (a && !n) throw new Error(`${i}已开启但未选择方案`);
786
+ if (n && me(n.label))
787
+ throw new Error("方案名称包含协议保留字符");
788
+ return n ? [`{${i}@${n.label}}`] : [];
789
+ }).join("");
790
+ }
791
+ function yt(e) {
792
+ var t;
793
+ if (typeof ((t = e.question) == null ? void 0 : t.text) != "string" || Xe(e.question.text))
794
+ throw new Error("意图文字中不可填写方括号或换行,请修改");
795
+ return `[${e.question.text}]${et(e)}`;
796
+ }
797
+ const ke = /* @__PURE__ */ new Set([
798
+ "doc",
799
+ "paragraph",
800
+ "text",
801
+ "bulletList",
802
+ "orderedList",
803
+ "listItem",
804
+ "blockquote",
805
+ "codeBlock",
806
+ "hardBreak",
807
+ "horizontalRule",
808
+ "businessToken",
809
+ "originalReply",
810
+ "messageSeparator",
811
+ "mediaBlock"
812
+ ]), mt = (e) => ke.has(e), tt = /* @__PURE__ */ new Set([
813
+ "bold",
814
+ "italic",
815
+ "strike",
816
+ "code",
817
+ "link",
818
+ "underline"
819
+ ]), v = /* @__PURE__ */ new Set([
820
+ "paragraph",
821
+ "bulletList",
822
+ "orderedList",
823
+ "blockquote",
824
+ "codeBlock",
825
+ "horizontalRule",
826
+ "originalReply",
827
+ "messageSeparator",
828
+ "mediaBlock"
829
+ ]), le = {
830
+ doc: v,
831
+ paragraph: /* @__PURE__ */ new Set(["text", "hardBreak", "businessToken"]),
832
+ bulletList: /* @__PURE__ */ new Set(["listItem"]),
833
+ orderedList: /* @__PURE__ */ new Set(["listItem"]),
834
+ listItem: /* @__PURE__ */ new Set(["paragraph", ...v]),
835
+ blockquote: v,
836
+ codeBlock: /* @__PURE__ */ new Set(["text"]),
837
+ originalReply: /* @__PURE__ */ new Set(["paragraph", "mediaBlock", "messageSeparator"])
838
+ }, nt = {
839
+ orderedList: /* @__PURE__ */ new Set(["start", "type"]),
840
+ codeBlock: /* @__PURE__ */ new Set(["language"]),
841
+ businessToken: /* @__PURE__ */ new Set([
842
+ "id",
843
+ "nodeVersion",
844
+ "kind",
845
+ "key",
846
+ "label",
847
+ "token",
848
+ "params"
849
+ ]),
850
+ originalReply: /* @__PURE__ */ new Set(["id", "nodeVersion"]),
851
+ messageSeparator: /* @__PURE__ */ new Set(["id", "nodeVersion"]),
852
+ mediaBlock: /* @__PURE__ */ new Set([
853
+ "id",
854
+ "nodeVersion",
855
+ "assetId",
856
+ "src",
857
+ "kind",
858
+ "name",
859
+ "poster",
860
+ "status",
861
+ "error"
862
+ ])
863
+ };
864
+ function rt(e) {
865
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
866
+ const t = e;
867
+ if (typeof t.type != "string" || !tt.has(t.type) || Object.keys(t).some((o) => !["type", "attrs"].includes(o)) || t.attrs !== void 0 && (!t.attrs || typeof t.attrs != "object" || Array.isArray(t.attrs)))
868
+ return !1;
869
+ const r = t.attrs || {};
870
+ if (t.type !== "link") return Object.keys(r).length === 0;
871
+ if (Object.keys(r).some(
872
+ (o) => !["href", "target", "rel", "class", "title"].includes(o)
873
+ ) || !O(r.href))
874
+ return !1;
875
+ const i = (o) => o == null || typeof o == "string";
876
+ return !i(r.rel) || !i(r.class) || !i(r.title) || r.target !== void 0 && r.target !== null && !["_blank", "_self"].includes(String(r.target)) ? !1 : r.target !== "_blank" || typeof r.rel == "string" && r.rel.split(/\s+/).includes("noopener");
877
+ }
878
+ function k(e, t, r = "") {
879
+ const i = Object.keys(e).find(
880
+ (o) => !t.includes(o)
881
+ );
882
+ return i ? r ? `${r}.${i}` : i : null;
883
+ }
884
+ function x(e, t = "knowledge.doc", r = !1) {
885
+ if (e === null) return null;
886
+ const i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new WeakSet();
887
+ function a(n, s, c, l = !1) {
888
+ var d, y, g, m, f, b, j, L, _, R, h, C, D, B, N, K, F, M, E, U, z, W, H, J, Q, G, Y, X, Z, ee, te, ne, re, oe, ie;
889
+ if (!n || typeof n != "object" || !n.type || !ke.has(n.type) || o.has(n) || (o.add(n), c ? !((d = le[c]) != null && d.has(n.type)) : n.type !== "doc") || !r && l && n.type === "businessToken" && ((g = I((y = n.attrs) == null ? void 0 : y.kind)) == null ? void 0 : g.allowInOriginalReply) === !1)
890
+ return s;
891
+ for (const p of Object.keys(n))
892
+ if (!["type", "attrs", "content", "marks", "text"].includes(p))
893
+ return `${s}.${p}`;
894
+ if (n.content !== void 0 && !Array.isArray(n.content))
895
+ return `${s}.content`;
896
+ if (["bulletList", "orderedList", "blockquote", "originalReply"].includes(
897
+ n.type
898
+ ) && !((m = n.content) != null && m.length))
899
+ return `${s}.content`;
900
+ if (n.type === "listItem" && ((b = (f = n.content) == null ? void 0 : f[0]) == null ? void 0 : b.type) !== "paragraph")
901
+ return (j = n.content) != null && j.length ? `${s}.content[0]` : `${s}.content`;
902
+ if (n.text !== void 0 && n.type !== "text") return `${s}.text`;
903
+ if (n.type === "text" && (typeof n.text != "string" || n.text.length === 0))
904
+ return `${s}.text`;
905
+ if (n.type === "text" && n.content !== void 0)
906
+ return `${s}.content`;
907
+ if ((L = n.content) != null && L.length && !le[n.type])
908
+ return `${s}.content`;
909
+ if (n.attrs !== void 0 && (!n.attrs || typeof n.attrs != "object" || Array.isArray(n.attrs)))
910
+ return `${s}.attrs`;
911
+ const u = nt[n.type] || /* @__PURE__ */ new Set();
912
+ for (const p of Object.keys(n.attrs || {}))
913
+ if (!u.has(p)) return `${s}.attrs.${p}`;
914
+ if (n.type === "businessToken" && !fe((_ = n.attrs) == null ? void 0 : _.kind))
915
+ return `${s}.attrs.kind`;
916
+ if (n.type === "businessToken") {
917
+ const p = (C = (h = I(
918
+ (R = n.attrs) == null ? void 0 : R.kind
919
+ )) == null ? void 0 : h.validate) == null ? void 0 : C.call(h, n.attrs || {});
920
+ if (p) return `${s}.attrs.${p}`;
921
+ }
922
+ if (n.type === "businessToken" && (typeof ((D = n.attrs) == null ? void 0 : D.key) != "string" || !n.attrs.key))
923
+ return `${s}.attrs.key`;
924
+ if (n.type === "businessToken" && ((B = n.attrs) == null ? void 0 : B.label) !== void 0 && typeof n.attrs.label != "string")
925
+ return `${s}.attrs.label`;
926
+ if (n.type === "businessToken" && ((N = n.attrs) == null ? void 0 : N.token) !== void 0 && n.attrs.token !== null && typeof n.attrs.token != "string")
927
+ return `${s}.attrs.token`;
928
+ if (n.type === "businessToken" && ((K = n.attrs) == null ? void 0 : K.params) != null && (!((F = I(n.attrs.kind)) != null && F.allowsParams) || typeof n.attrs.params != "object" || Array.isArray(n.attrs.params) || ce(n.attrs.params) !== null || JSON.stringify(n.attrs.params).length > 8192))
929
+ return `${s}.attrs.params`;
930
+ if (n.type === "mediaBlock" && !ye((M = n.attrs) == null ? void 0 : M.kind))
931
+ return `${s}.attrs.kind`;
932
+ if (n.type === "mediaBlock") {
933
+ if (((E = n.attrs) == null ? void 0 : E.assetId) !== void 0 && n.attrs.assetId !== null && typeof n.attrs.assetId != "string")
934
+ return `${s}.attrs.assetId`;
935
+ if (((U = n.attrs) == null ? void 0 : U.name) !== void 0 && typeof n.attrs.name != "string")
936
+ return `${s}.attrs.name`;
937
+ if (((z = n.attrs) == null ? void 0 : z.error) !== void 0 && typeof n.attrs.error != "string")
938
+ return `${s}.attrs.error`;
939
+ if (((W = n.attrs) == null ? void 0 : W.status) !== void 0 && !["ready", "uploading", "error"].includes(String(n.attrs.status)))
940
+ return `${s}.attrs.status`;
941
+ const p = (((H = n.attrs) == null ? void 0 : H.status) === "uploading" || ((J = n.attrs) == null ? void 0 : J.status) === "error") && typeof ((Q = n.attrs) == null ? void 0 : Q.src) == "string" && n.attrs.src.startsWith("blob:");
942
+ if (!O((G = n.attrs) == null ? void 0 : G.src) && !p)
943
+ return `${s}.attrs.src`;
944
+ if (((Y = n.attrs) == null ? void 0 : Y.poster) !== void 0 && n.attrs.poster !== null && !O(n.attrs.poster))
945
+ return `${s}.attrs.poster`;
946
+ }
947
+ if (V(n.type)) {
948
+ const p = (X = n.attrs) == null ? void 0 : X.id;
949
+ if ((n.type === "mediaBlock" || p !== void 0) && (typeof p != "string" || !p.trim() || i.has(p)))
950
+ return `${s}.attrs.id`;
951
+ if (typeof p == "string" && i.add(p), ((Z = n.attrs) == null ? void 0 : Z.nodeVersion) !== void 0 && (!Number.isSafeInteger(n.attrs.nodeVersion) || n.attrs.nodeVersion < 0))
952
+ return `${s}.attrs.nodeVersion`;
953
+ }
954
+ if (n.type === "orderedList" && ((ee = n.attrs) == null ? void 0 : ee.start) !== void 0 && (!Number.isSafeInteger(n.attrs.start) || n.attrs.start < 1))
955
+ return `${s}.attrs.start`;
956
+ if (n.type === "orderedList" && ((te = n.attrs) == null ? void 0 : te.type) !== void 0 && n.attrs.type !== null && !["1", "a", "A", "i", "I"].includes(n.attrs.type))
957
+ return `${s}.attrs.type`;
958
+ if (n.type === "codeBlock" && ((ne = n.attrs) == null ? void 0 : ne.language) !== void 0 && n.attrs.language !== null && typeof n.attrs.language != "string")
959
+ return `${s}.attrs.language`;
960
+ if (n.marks !== void 0 && !Array.isArray(n.marks))
961
+ return `${s}.marks`;
962
+ if (c === "codeBlock" && ((re = n.marks) != null && re.length)) return `${s}.marks`;
963
+ if ((oe = n.marks) != null && oe.some((p) => !rt(p)))
964
+ return `${s}.marks`;
965
+ if ((ie = n.marks) != null && ie.length) {
966
+ const p = n.marks.map((T) => T.type);
967
+ if (new Set(p).size !== p.length || p.includes("code") && p.length > 1)
968
+ return `${s}.marks`;
969
+ }
970
+ for (const [p, T] of (n.content || []).entries()) {
971
+ const se = a(
972
+ T,
973
+ `${s}.content[${p}]`,
974
+ n.type,
975
+ l || n.type === "originalReply"
976
+ );
977
+ if (se) return se;
978
+ }
979
+ return null;
980
+ }
981
+ return a(e, t);
982
+ }
983
+ function ot(e, t, r = "knowledge.doc") {
984
+ if (!e) return null;
985
+ const i = /* @__PURE__ */ new WeakSet(), o = (a, n) => {
986
+ if (i.has(a)) return n;
987
+ i.add(a);
988
+ const s = Ge(a);
989
+ if (s && !q.some(
990
+ (c) => c.id === s.id && c.slot === s.slot && c.types.includes(t)
991
+ ))
992
+ return n;
993
+ for (const [c, l] of (a.content || []).entries()) {
994
+ const u = o(l, `${n}.content[${c}]`);
995
+ if (u) return u;
996
+ }
997
+ return null;
998
+ };
999
+ return o(e, r);
1000
+ }
1001
+ function kt(e) {
1002
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
1003
+ const t = e, r = t.question, i = t.knowledge;
1004
+ return ["normal", "reasoning", "agent"].includes(String(t.type)) && !!r && typeof r == "object" && !Array.isArray(r) && typeof r.text == "string" && !!i && typeof i == "object" && !Array.isArray(i) && Object.prototype.hasOwnProperty.call(i, "doc") && !!t.extensionState && typeof t.extensionState == "object" && !Array.isArray(t.extensionState);
1005
+ }
1006
+ function bt(e) {
1007
+ if (!e || typeof e != "object" || Array.isArray(e))
1008
+ return "modelValue";
1009
+ const t = ce(e);
1010
+ if (t !== null) return t || "modelValue";
1011
+ const r = e;
1012
+ if (r.schemaVersion !== 1) return "schemaVersion";
1013
+ const i = k(r, [
1014
+ "schemaVersion",
1015
+ "id",
1016
+ "type",
1017
+ "question",
1018
+ "knowledge",
1019
+ "extensionState"
1020
+ ]);
1021
+ if (i) return i;
1022
+ if (r.id !== void 0 && typeof r.id != "string") return "id";
1023
+ if (!["normal", "reasoning", "agent"].includes(r.type)) return "type";
1024
+ if (!r.question || typeof r.question != "object" || Array.isArray(r.question) || typeof r.question.text != "string")
1025
+ return "question.text";
1026
+ const o = k(
1027
+ r.question,
1028
+ ["text"],
1029
+ "question"
1030
+ );
1031
+ if (o) return o;
1032
+ if (!r.knowledge || typeof r.knowledge != "object" || Array.isArray(r.knowledge))
1033
+ return "knowledge";
1034
+ const a = k(
1035
+ r.knowledge,
1036
+ ["doc", "retainedDoc", "agentRef", "agentBody"],
1037
+ "knowledge"
1038
+ );
1039
+ if (a) return a;
1040
+ if (!Object.prototype.hasOwnProperty.call(r.knowledge, "doc") || r.type === "agent" && r.knowledge.doc !== null)
1041
+ return "knowledge.doc";
1042
+ if (r.type !== "agent") {
1043
+ if (r.knowledge.agentRef != null) return "knowledge.agentRef";
1044
+ if (Object.prototype.hasOwnProperty.call(r.knowledge, "retainedDoc"))
1045
+ return "knowledge.retainedDoc";
1046
+ if (Object.prototype.hasOwnProperty.call(r.knowledge, "agentBody"))
1047
+ return "knowledge.agentBody";
1048
+ }
1049
+ if (r.knowledge.agentRef !== void 0 && r.knowledge.agentRef !== null) {
1050
+ const { agentRef: l } = r.knowledge;
1051
+ if (typeof l != "object" || Array.isArray(l) || typeof l.id != "string" || typeof l.name != "string" || !l.name.trim() || l.invalid !== void 0 && typeof l.invalid != "boolean")
1052
+ return "knowledge.agentRef";
1053
+ const u = k(
1054
+ l,
1055
+ ["id", "name", "invalid"],
1056
+ "knowledge.agentRef"
1057
+ );
1058
+ if (u) return u;
1059
+ }
1060
+ const n = x(r.knowledge.doc);
1061
+ if (n) return n;
1062
+ const s = ot(
1063
+ r.knowledge.doc,
1064
+ r.type
1065
+ );
1066
+ if (s) return s;
1067
+ const c = x(
1068
+ r.knowledge.retainedDoc ?? null,
1069
+ "knowledge.retainedDoc",
1070
+ r.type === "agent"
1071
+ );
1072
+ if (c) return c;
1073
+ if (r.type === "agent") {
1074
+ if (r.knowledge.agentBody && r.knowledge.retainedDoc)
1075
+ return "knowledge.agentBody";
1076
+ const l = x(
1077
+ r.knowledge.agentBody ?? null,
1078
+ "knowledge.agentBody",
1079
+ !0
1080
+ );
1081
+ if (l) return l;
1082
+ }
1083
+ if (!r.extensionState || typeof r.extensionState != "object" || Array.isArray(r.extensionState))
1084
+ return "extensionState";
1085
+ for (const [l, u] of Object.entries(r.extensionState)) {
1086
+ const d = q.find(
1087
+ (g) => g.id === l && g.types.includes(r.type) && g.implementation === "plugin"
1088
+ );
1089
+ if (!d) return `extensionState.${l}`;
1090
+ if (!u || typeof u != "object" || u.version !== d.dataVersion)
1091
+ return `extensionState.${l}.version`;
1092
+ const y = k(
1093
+ u,
1094
+ ["version", "data"],
1095
+ `extensionState.${l}`
1096
+ );
1097
+ if (y) return y;
1098
+ if (!u.data || typeof u.data != "object" || Array.isArray(u.data))
1099
+ return `extensionState.${l}.data`;
1100
+ if (d.slot === "questionAction" && typeof u.data.enabled != "boolean")
1101
+ return `extensionState.${l}.data.enabled`;
1102
+ if (d.slot === "questionAction" && d.questionTag) {
1103
+ const g = u.data;
1104
+ if (g.enabled === !0 && g.tag === void 0)
1105
+ return `extensionState.${l}.data.tag`;
1106
+ if (g.tag !== void 0) {
1107
+ const { tag: m } = g;
1108
+ if (!m || typeof m != "object" || Array.isArray(m))
1109
+ return `extensionState.${l}.data.tag`;
1110
+ const f = m;
1111
+ if (typeof f.id != "string" || !f.id.trim())
1112
+ return `extensionState.${l}.data.tag.id`;
1113
+ if (typeof f.label != "string" || !f.label.trim() || me(f.label))
1114
+ return `extensionState.${l}.data.tag.label`;
1115
+ const b = k(
1116
+ f,
1117
+ ["id", "label"],
1118
+ `extensionState.${l}.data.tag`
1119
+ );
1120
+ if (b) return b;
1121
+ }
1122
+ }
1123
+ }
1124
+ return null;
1125
+ }
1126
+ export {
1127
+ q as A,
1128
+ it as B,
1129
+ Ee as C,
1130
+ Ge as D,
1131
+ mt as E,
1132
+ kt as F,
1133
+ me as G,
1134
+ ge as H,
1135
+ Ze as I,
1136
+ Ue as M,
1137
+ et as a,
1138
+ O as b,
1139
+ bt as c,
1140
+ _e as d,
1141
+ st as e,
1142
+ ce as f,
1143
+ I as g,
1144
+ Xe as h,
1145
+ V as i,
1146
+ Fe as j,
1147
+ ct as k,
1148
+ ut as l,
1149
+ ft as m,
1150
+ fe as n,
1151
+ ue as o,
1152
+ lt as p,
1153
+ A as q,
1154
+ x as r,
1155
+ yt as s,
1156
+ dt as t,
1157
+ gt as u,
1158
+ at as v,
1159
+ $ as w,
1160
+ pt as x,
1161
+ Qe as y,
1162
+ Ye as z
1163
+ };