wi-chat 0.6.1 → 0.7.0

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 (107) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.d.ts +12 -0
  3. package/dist/core/index.js +737 -322
  4. package/dist/core/useAnswerActions.d.ts +61 -0
  5. package/dist/core/useChat.d.ts +90 -15
  6. package/dist/core/useChatAuth.d.ts +96 -0
  7. package/dist/core/useChatRooms.d.ts +66 -0
  8. package/dist/core/useKeepAlive.d.ts +41 -0
  9. package/dist/core/useLlm.d.ts +73 -0
  10. package/dist/core/useRunningGroups.d.ts +58 -0
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.ts +4 -2
  13. package/dist/index.js +119 -108
  14. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +8 -8
  15. package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +6 -6
  16. package/dist/mobile-ui/index.cjs +1 -1
  17. package/dist/mobile-ui/index.js +104 -104
  18. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +6 -6
  19. package/dist/page-context/index.js +2 -4
  20. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +1 -7
  21. package/dist/parser/answerCom/actionExecute/clarification.d.ts +15 -3
  22. package/dist/parser/answerCom/actionExecute/constants.d.ts +10 -0
  23. package/dist/parser/answerCom/actionExecute/parseCollectClarifications.d.ts +3 -2
  24. package/dist/parser/answerCom/actionExecute/parseHostAction.d.ts +3 -2
  25. package/dist/parser/answerCom/actionExecute/types.d.ts +3 -3
  26. package/dist/parser/answerCom/generic/parseGeneric.d.ts +52 -0
  27. package/dist/parser/answerCom/generic/types.d.ts +75 -0
  28. package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +7 -6
  29. package/dist/parser/answerCom/outputFile/types.d.ts +15 -5
  30. package/dist/parser/answerCom/presentFiles/parsePresentFiles.d.ts +58 -0
  31. package/dist/parser/answerCom/presentFiles/types.d.ts +27 -0
  32. package/dist/parser/answerMeta.d.ts +71 -0
  33. package/dist/parser/deepThinking/parseDeepThinking.d.ts +8 -0
  34. package/dist/parser/history/history.d.ts +9 -0
  35. package/dist/parser/history/index.d.ts +1 -1
  36. package/dist/parser/index.cjs +6 -2
  37. package/dist/parser/index.d.ts +13 -4
  38. package/dist/parser/index.js +640 -457
  39. package/dist/parser/message.d.ts +9 -0
  40. package/dist/parser/registry.d.ts +1 -1
  41. package/dist/parser/runTime.d.ts +29 -0
  42. package/dist/renderers/TextAnswer-BgKGvG_o.cjs +2 -0
  43. package/dist/renderers/TextAnswer-PQwV3K7v.js +5 -0
  44. package/dist/renderers/aiAnswer/AiAnswerBubble.vue.d.ts +4 -4
  45. package/dist/renderers/answerCard/AnswerCard.vue.d.ts +65 -0
  46. package/dist/renderers/answerCard/AnswerToolbar.vue.d.ts +42 -0
  47. package/dist/renderers/answerConfig.d.ts +33 -0
  48. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +3 -3
  49. package/dist/renderers/deepThinking/DeepThinkingSteps.vue.d.ts +4 -4
  50. package/dist/renderers/deviceLastValue/DeviceLastValue.vue.d.ts +37 -0
  51. package/dist/renderers/hostAction/HostActionStatus.vue.d.ts +3 -3
  52. package/dist/renderers/iframePage/IframePage.vue.d.ts +3 -3
  53. package/dist/renderers/index.cjs +6 -1
  54. package/dist/renderers/index.d.ts +14 -0
  55. package/dist/renderers/index.js +1504 -607
  56. package/dist/renderers/knowledgeStream/KnowledgeStreamResult.vue.d.ts +3 -3
  57. package/dist/renderers/media/MediaAnswer.vue.d.ts +19 -0
  58. package/dist/renderers/outputFile/OutputFile.vue.d.ts +3 -3
  59. package/dist/renderers/outputFile/OutputFileLink.vue.d.ts +19 -0
  60. package/dist/renderers/outputFile/localFile.d.ts +46 -0
  61. package/dist/renderers/outputFile/useOutputFile.d.ts +32 -3
  62. package/dist/renderers/presentFiles/PresentFiles.vue.d.ts +19 -0
  63. package/dist/renderers/recordset/RecordsetView.vue.d.ts +19 -0
  64. package/dist/renderers/sqlQuery/SqlQuery.vue.d.ts +19 -0
  65. package/dist/renderers/style.css +1 -1
  66. package/dist/renderers/text/TextAnswer.vue.d.ts +19 -0
  67. package/dist/request/api.d.ts +121 -1
  68. package/dist/request/client.d.ts +6 -0
  69. package/dist/request/index.cjs +4 -2
  70. package/dist/request/index.d.ts +4 -2
  71. package/dist/request/index.js +754 -181
  72. package/dist/request/ws.d.ts +11 -86
  73. package/dist/request/wsCore.d.ts +104 -0
  74. package/dist/request/wsSession.d.ts +353 -0
  75. package/dist/right-panel/RightPanel.vue.d.ts +6 -6
  76. package/dist/right-panel/RightPanelIcon.vue.d.ts +4 -4
  77. package/dist/right-panel/RightPanelTabs.vue.d.ts +9 -5
  78. package/dist/right-panel/index.cjs +1 -1
  79. package/dist/right-panel/index.d.ts +1 -1
  80. package/dist/right-panel/index.js +617 -537
  81. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +4 -4
  82. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +3 -3
  83. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +3 -3
  84. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +5 -5
  85. package/dist/right-panel/style.css +1 -1
  86. package/dist/right-panel/types.d.ts +10 -0
  87. package/dist/theme/index.js +2 -4
  88. package/dist/tools/index.cjs +5 -5
  89. package/dist/tools/index.d.ts +2 -2
  90. package/dist/tools/index.js +323 -217
  91. package/dist/tools/markdown/MarkdownContent.vue.d.ts +5 -5
  92. package/dist/tools/markdown/index.d.ts +2 -0
  93. package/dist/tools/markdown/interactions.d.ts +39 -0
  94. package/dist/tools/markdown/sanitize.d.ts +6 -0
  95. package/dist/tools/style.css +1 -1
  96. package/dist/tools/useAutoScroll.d.ts +3 -3
  97. package/dist/web-ui/attach/AttachmentCard.vue.d.ts +6 -6
  98. package/dist/web-ui/attach/AttachmentList.vue.d.ts +6 -6
  99. package/dist/web-ui/chat/ChatContainer.vue.d.ts +10 -10
  100. package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +6 -6
  101. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +6 -6
  102. package/dist/web-ui/index.cjs +1 -1
  103. package/dist/web-ui/index.js +630 -635
  104. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +11 -11
  105. package/dist/web-ui/recordset/RecordsetTable.vue.d.ts +4 -4
  106. package/dist/web-ui/style.css +1 -1
  107. package/package.json +2 -1
@@ -1,151 +1,266 @@
1
1
  import "wi-chat/style.css";
2
- import { defineAsyncComponent as H, defineComponent as j, computed as I, openBlock as l, createElementBlock as c, createElementVNode as e, Fragment as M, renderList as B, createBlock as ee, resolveDynamicComponent as ke, createCommentVNode as V, createTextVNode as Se, pushScopeId as K, popScopeId as X, unref as i, toDisplayString as v, withDirectives as $e, vShow as xe, getCurrentInstance as ce, inject as ue, toValue as z, ref as U, watch as de, onBeforeUnmount as Ie, provide as _e, withKeys as re, withModifiers as te, normalizeClass as D, Teleport as Ce, createVNode as Ee, Transition as Oe, withCtx as Te, reactive as Ve, normalizeStyle as Pe } from "vue";
3
- import { knowledgeStreamParser as Ue, iframePageParser as Me, outputFileParser as Le, collectClarificationsParser as je, hostActionParser as Ne, formatFileSize as Re, IFRAME_RESIZER_CHILD_SCRIPT as Ae, submitClarification as Fe, cancelClarification as De } from "wi-chat/parser";
4
- import { createStyleScope as pe, renderMarkdown as fe, downloadTableAsExcel as Be } from "wi-chat/tools";
5
- import ie from "@iframe-resizer/vue/iframe-resizer.vue";
6
- const ze = [
7
- { ...Ue, component: H(() => Promise.resolve().then(() => ft)) },
8
- { ...Me, component: H(() => Promise.resolve().then(() => fs)) },
9
- { ...Le, component: H(() => Promise.resolve().then(() => os)) },
2
+ import { defineAsyncComponent as Y, defineComponent as D, computed as b, openBlock as n, createElementBlock as l, createElementVNode as t, Fragment as T, renderList as j, createBlock as J, resolveDynamicComponent as Me, createCommentVNode as I, createTextVNode as Ee, ref as q, watch as ae, onBeforeUnmount as le, unref as y, toDisplayString as k, withDirectives as ve, vShow as qe, onMounted as Re, getCurrentInstance as Ie, inject as fe, toValue as ee, provide as ye, withKeys as ie, withModifiers as Q, normalizeClass as X, Teleport as Be, createVNode as ze, Transition as De, withCtx as He, reactive as Ke, normalizeStyle as Ae, vModelText as Oe, renderSlot as We, createStaticVNode as Xe } from "vue";
3
+ import { knowledgeStreamParser as Ge, iframePageParser as Ye, outputFileParser as Ze, presentFilesParser as Je, collectClarificationsParser as Qe, hostActionParser as et, textParser as tt, recordsetParser as st, sqlQueryParser as nt, deviceLastValueParser as at, videoParser as lt, wavParser as ot, cameraParser as rt, scriptParser as it, formatFileSize as ut, OUTPUT_FILE_ANSWER_TYPE as ct, IFRAME_RESIZER_CHILD_SCRIPT as dt, submitClarification as _t, cancelClarification as pt, readAnswerMeta as vt, isValidDuration as ft, formatDuration as yt } from "wi-chat/parser";
4
+ import { bindMarkdownInteractions as me, createStyleScope as we, renderMarkdown as he, MarkdownContent as Te } from "wi-chat/tools";
5
+ import ge from "@iframe-resizer/vue/iframe-resizer.vue";
6
+ const oe = Y(() => Promise.resolve().then(() => Da)), mt = [
7
+ { ...Ge, component: Y(() => Promise.resolve().then(() => Ut)) },
8
+ { ...Ye, component: Y(() => Promise.resolve().then(() => Ks)) },
9
+ { ...Ze, component: Y(() => Promise.resolve().then(() => Ts)) },
10
+ // present_files:一组文件,每个文件复用一张 OutputFile 卡片(共用 provideOutputFileConfig)
11
+ { ...Je, component: Y(() => Promise.resolve().then(() => Vs)) },
10
12
  // 确认卡片(front_reply + action_execute + executor=agent + collect_clarifications):
11
13
  // 解析由内置 collectClarificationsParser 完成,提交/取消经 wi-chat/parser 回传 wait_reply
12
- { ...je, component: H(() => Promise.resolve().then(() => tn)) },
14
+ { ...Qe, component: Y(() => Promise.resolve().then(() => An)) },
13
15
  // 宿主执行过程(front_reply + action_execute + executor=host):宿主执行、进度卡片
14
- { ...Ne, component: H(() => Promise.resolve().then(() => fn)) }
15
- ], qe = (n) => {
16
- const a = (u) => {
17
- const t = {};
18
- for (const o of u)
19
- !o.answerType || !o.component || (t[o.answerType] = o.component);
20
- return t;
16
+ { ...et, component: Y(() => Promise.resolve().then(() => qn)) },
17
+ // 新版 reports 中直接下发的通用类型(原生实现,不依赖 Element Plus / ECharts)
18
+ { ...tt, component: Y(() => import("./TextAnswer-PQwV3K7v.js")) },
19
+ { ...st, component: Y(() => Promise.resolve().then(() => oa)) },
20
+ { ...nt, component: Y(() => Promise.resolve().then(() => wa)) },
21
+ { ...at, component: Y(() => Promise.resolve().then(() => Oa)) },
22
+ { ...lt, component: oe },
23
+ { ...ot, component: oe },
24
+ { ...rt, component: oe },
25
+ { ...it, component: oe }
26
+ ], Pe = (o) => {
27
+ const s = (r) => {
28
+ const e = {};
29
+ for (const a of r)
30
+ !a.answerType || !a.component || (e[a.answerType] = a.component);
31
+ return e;
21
32
  };
22
- return { ...a(ze), ...a(n ?? []) };
23
- }, He = (n) => (K("data-v-efad55c8"), n = n(), X(), n), Ke = { class: "flex justify-start" }, Xe = { class: "ai-answer-bubble" }, Ge = {
33
+ return { ...s(mt), ...s(o ?? []) };
34
+ }, wt = { class: "flex justify-start" }, ht = { class: "ai-answer-bubble" }, gt = {
24
35
  key: 0,
25
36
  class: "ai-answer-bubble__error"
26
- }, We = { class: "ai-answer-bubble__body" }, Ye = {
37
+ }, bt = { class: "ai-answer-bubble__body" }, kt = {
27
38
  key: 0,
28
39
  class: "ai-answer-bubble__status"
29
- }, Je = {
40
+ }, $t = {
30
41
  key: 2,
31
42
  class: "ai-answer-bubble__status"
32
- }, Ze = {
43
+ }, xt = {
33
44
  key: 3,
34
45
  class: "ai-answer-bubble__loading"
35
- }, Qe = /* @__PURE__ */ He(() => /* @__PURE__ */ e("span", { class: "ai-answer-bubble__pulse" }, null, -1)), et = /* @__PURE__ */ j({
46
+ }, St = /* @__PURE__ */ D({
36
47
  __name: "AiAnswerBubble",
37
48
  props: {
38
49
  answer: {},
39
50
  error: { type: Boolean, default: !1 },
40
51
  stopped: { type: Boolean, default: !1 },
41
- contentMap: { default: () => qe() }
52
+ contentMap: { default: () => Pe() }
42
53
  },
43
- setup(n) {
44
- const a = n, u = I(() => {
45
- var o, d;
46
- return ((d = (o = a.answer) == null ? void 0 : o.answer) == null ? void 0 : d.reports) ?? [];
47
- }), t = I(() => u.value.filter((o) => a.contentMap[o.answer_type]));
48
- return (o, d) => (l(), c("div", Ke, [
49
- e("div", Xe, [
50
- o.error ? (l(), c("div", Ge, "回答加载失败")) : t.value.length ? (l(), c(M, { key: 1 }, [
51
- e("div", We, [
52
- (l(!0), c(M, null, B(t.value, (w, $) => (l(), ee(ke(o.contentMap[w.answer_type]), {
53
- key: $,
54
- report: w
54
+ setup(o) {
55
+ const s = o, r = b(() => {
56
+ var a, c;
57
+ return ((c = (a = s.answer) == null ? void 0 : a.answer) == null ? void 0 : c.reports) ?? [];
58
+ }), e = b(() => r.value.filter((a) => s.contentMap[a.answer_type]));
59
+ return (a, c) => (n(), l("div", wt, [
60
+ t("div", ht, [
61
+ o.error ? (n(), l("div", gt, "回答加载失败")) : e.value.length ? (n(), l(T, { key: 1 }, [
62
+ t("div", bt, [
63
+ (n(!0), l(T, null, j(e.value, (p, f) => (n(), J(Me(o.contentMap[p.answer_type]), {
64
+ key: f,
65
+ report: p
55
66
  }, null, 8, ["report"]))), 128))
56
67
  ]),
57
- o.stopped ? (l(), c("div", Ye, "回答已停止")) : V("", !0)
58
- ], 64)) : o.stopped ? (l(), c("div", Je, "回答已停止")) : u.value.length ? V("", !0) : (l(), c("div", Ze, [
59
- Qe,
60
- Se("正在思考...")
61
- ]))
68
+ o.stopped ? (n(), l("div", kt, "回答已停止")) : I("", !0)
69
+ ], 64)) : o.stopped ? (n(), l("div", $t, "回答已停止")) : r.value.length ? I("", !0) : (n(), l("div", xt, [...c[0] || (c[0] = [
70
+ t("span", { class: "ai-answer-bubble__pulse" }, null, -1),
71
+ Ee("正在思考...", -1)
72
+ ])]))
62
73
  ])
63
74
  ]));
64
75
  }
65
- }), N = (n, a) => {
66
- const u = n.__vccOpts || n;
67
- for (const [t, o] of a)
68
- u[t] = o;
69
- return u;
70
- }, bn = /* @__PURE__ */ N(et, [["__scopeId", "data-v-efad55c8"]]), tt = (n) => (K("data-v-de333356"), n = n(), X(), n), st = ["data-wi-md-scope"], nt = ["aria-expanded"], ot = /* @__PURE__ */ tt(() => /* @__PURE__ */ e("span", { class: "deep-thinking__title" }, "深度思考", -1)), at = { class: "deep-thinking__count" }, rt = { class: "deep-thinking__list" }, it = { class: "deep-thinking__index" }, lt = ["innerHTML"], ct = /* @__PURE__ */ j({
76
+ }), H = (o, s) => {
77
+ const r = o.__vccOpts || o;
78
+ for (const [e, a] of s)
79
+ r[e] = a;
80
+ return r;
81
+ }, hl = /* @__PURE__ */ H(St, [["__scopeId", "data-v-efad55c8"]]), Ct = ["data-wi-md-scope"], Mt = ["aria-expanded"], Et = { class: "deep-thinking__count" }, It = { class: "deep-thinking__list" }, At = { class: "deep-thinking__index" }, Ot = ["innerHTML"], Tt = /* @__PURE__ */ D({
71
82
  __name: "DeepThinkingSteps",
72
83
  props: {
73
84
  steps: {},
74
85
  expanded: { type: Boolean }
75
86
  },
76
87
  emits: ["update:expanded"],
77
- setup(n, { emit: a }) {
78
- const u = n, t = a, o = { imageDownload: !1, tableDownload: !1 }, d = pe(), w = { ...o, styleScope: d.selector }, $ = /* @__PURE__ */ new Map(), b = (p) => {
79
- let y = $.get(p);
80
- return y === void 0 && ($.size > 500 && $.clear(), y = fe(p, w), $.set(p, y)), y;
81
- }, g = I(() => u.steps.map(b));
82
- return (p, y) => g.value.length ? (l(), c("div", {
88
+ setup(o, { emit: s }) {
89
+ const r = o, e = s, a = { imageDownload: !1, tableDownload: !1 }, c = q();
90
+ let p;
91
+ ae(c, (v) => {
92
+ p == null || p(), p = me(v);
93
+ }), le(() => p == null ? void 0 : p());
94
+ const f = we(), x = { ...a, styleScope: f.selector }, _ = /* @__PURE__ */ new Map(), w = (v) => {
95
+ let d = _.get(v);
96
+ return d === void 0 && (_.size > 500 && _.clear(), d = he(v, x), _.set(v, d)), d;
97
+ }, m = b(() => r.steps.map(w));
98
+ return (v, d) => m.value.length ? (n(), l("div", {
83
99
  key: 0,
100
+ ref_key: "rootEl",
101
+ ref: c,
84
102
  class: "deep-thinking",
85
- "data-wi-md-scope": i(d).id
103
+ "data-wi-md-scope": y(f).id
86
104
  }, [
87
- e("button", {
105
+ t("button", {
88
106
  type: "button",
89
107
  class: "deep-thinking__header",
90
- "aria-expanded": p.expanded,
91
- onClick: y[0] || (y[0] = (k) => t("update:expanded", !p.expanded))
108
+ "aria-expanded": o.expanded,
109
+ onClick: d[0] || (d[0] = ($) => e("update:expanded", !o.expanded))
92
110
  }, [
93
- ot,
94
- e("span", at, v(g.value.length), 1),
95
- e("span", null, v(p.expanded ? "收起" : "展开"), 1)
96
- ], 8, nt),
97
- $e(e("div", rt, [
98
- (l(!0), c(M, null, B(g.value, (k, O) => (l(), c("div", {
99
- key: O,
111
+ d[1] || (d[1] = t("span", { class: "deep-thinking__title" }, "深度思考", -1)),
112
+ t("span", Et, k(m.value.length), 1),
113
+ t("span", null, k(o.expanded ? "收起" : "展开"), 1)
114
+ ], 8, Mt),
115
+ ve(t("div", It, [
116
+ (n(!0), l(T, null, j(m.value, ($, U) => (n(), l("div", {
117
+ key: U,
100
118
  class: "deep-thinking__item"
101
119
  }, [
102
- e("span", it, v(O + 1), 1),
103
- e("div", {
104
- class: "markdown-it",
105
- innerHTML: k
106
- }, null, 8, lt)
120
+ t("span", At, k(U + 1), 1),
121
+ t("div", {
122
+ class: "markdown-it wi-markdown wi-markdown--muted",
123
+ innerHTML: $
124
+ }, null, 8, Ot)
107
125
  ]))), 128))
108
126
  ], 512), [
109
- [xe, p.expanded]
127
+ [qe, o.expanded]
110
128
  ])
111
- ], 8, st)) : V("", !0);
129
+ ], 8, Ct)) : I("", !0);
112
130
  }
113
- }), gn = /* @__PURE__ */ N(ct, [["__scopeId", "data-v-de333356"]]), ut = ["data-wi-md-scope"], dt = ["innerHTML"], _t = /* @__PURE__ */ j({
131
+ }), gl = /* @__PURE__ */ H(Tt, [["__scopeId", "data-v-6ce85bcf"]]), Pt = ["data-wi-md-scope"], Lt = ["innerHTML"], jt = /* @__PURE__ */ D({
114
132
  __name: "KnowledgeStreamResult",
115
133
  props: {
116
134
  report: {}
117
135
  },
118
- setup(n) {
119
- const a = n, u = { imageDownload: !1, tableDownload: !0 }, t = pe(), o = { ...u, styleScope: t.selector }, d = (g) => {
120
- var O;
121
- const y = g.target.closest(".wi-md-table-download");
122
- if (!y)
123
- return;
124
- g.preventDefault(), g.stopPropagation();
125
- const k = (O = y.closest(".wi-md-table-wrap")) == null ? void 0 : O.querySelector("table");
126
- k && Be(k);
127
- }, w = /* @__PURE__ */ new Map(), $ = (g) => {
128
- let p = w.get(g);
129
- return p === void 0 && (w.size > 300 && w.clear(), p = fe(g, o), w.set(g, p)), p;
130
- }, b = I(() => (a.report.values || []).map((g) => $(g.answer || "")));
131
- return (g, p) => (l(), c("div", {
136
+ setup(o) {
137
+ const s = o, r = {}, e = we(), a = { ...r, styleScope: e.selector }, c = q();
138
+ let p;
139
+ Re(() => {
140
+ p = me(c.value);
141
+ }), le(() => p == null ? void 0 : p());
142
+ const f = /* @__PURE__ */ new Map(), x = (w) => {
143
+ let m = f.get(w);
144
+ return m === void 0 && (f.size > 300 && f.clear(), m = he(w, a), f.set(w, m)), m;
145
+ }, _ = b(() => (s.report.values || []).map((w) => x(w.answer || "")));
146
+ return (w, m) => (n(), l("div", {
147
+ ref_key: "rootEl",
148
+ ref: c,
132
149
  class: "knowledge-result",
133
- "data-wi-md-scope": i(t).id,
134
- onClick: d
150
+ "data-wi-md-scope": y(e).id
135
151
  }, [
136
- (l(!0), c(M, null, B(b.value, (y, k) => (l(), c("div", {
137
- key: k,
138
- class: "markdown-it",
139
- innerHTML: y
140
- }, null, 8, dt))), 128))
141
- ], 8, ut));
152
+ (n(!0), l(T, null, j(_.value, (v, d) => (n(), l("div", {
153
+ key: d,
154
+ class: "markdown-it wi-markdown",
155
+ innerHTML: v
156
+ }, null, 8, Lt))), 128))
157
+ ], 8, Pt));
142
158
  }
143
- }), pt = /* @__PURE__ */ N(_t, [["__scopeId", "data-v-857bc0d2"]]), ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
159
+ }), Vt = /* @__PURE__ */ H(jt, [["__scopeId", "data-v-8d14c026"]]), Ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
144
160
  __proto__: null,
145
- default: pt
146
- }, Symbol.toStringTag, { value: "Module" })), ve = Symbol("wi-chat-output-file-config"), kn = (n) => {
147
- _e(ve, n);
148
- }, vt = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "ico"]), wt = /* @__PURE__ */ new Set(["mp3", "wav", "ogg", "m4a", "aac", "flac"]), ht = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi", "mkv"]), yt = /* @__PURE__ */ new Set(["doc", "docx", "xls", "xlsx", "ppt", "pptx"]), mt = /* @__PURE__ */ new Set(["html", "htm"]), bt = /* @__PURE__ */ new Set([
161
+ default: Vt
162
+ }, Symbol.toStringTag, { value: "Module" })), Ft = /^(?:[a-z][a-z\d+.-]*:|\/\/|#|data:|blob:|about:)/i, be = (o) => {
163
+ const s = o.trim();
164
+ return s ? /^[a-zA-Z]:[\\/]/.test(s) ? !0 : !Ft.test(s) : !1;
165
+ }, Nt = (o) => {
166
+ var r;
167
+ const s = ((r = o == null ? void 0 : o.values) == null ? void 0 : r.file_path) ?? (o == null ? void 0 : o.file_path);
168
+ return typeof s == "string" ? s : "";
169
+ }, ke = (o, s) => {
170
+ const r = o.split(/[?#]/)[0], e = r.replace(/\\/g, "/");
171
+ if (/^[a-zA-Z]:[\\/]/.test(r) || /^~\//.test(e)) return r;
172
+ if (/^\/\/[^/]/.test(e) || /^\/[^/]/.test(e) || e === "/") return e;
173
+ const a = s.replace(/[\\/]+/g, "/"), c = a.lastIndexOf("/"), p = c > 0 ? a.slice(0, c) : c === 0 ? "/" : "", f = (p ? `${p}/${e}` : e).replace(/[\\/]+/g, "/"), x = f.match(/^([a-zA-Z]:\/|\/\/[^/]+\/?|\/)/), _ = x ? x[0] : "", w = f.slice(_.length), m = [];
174
+ for (const v of w.split("/"))
175
+ !v || v === "." || (v === ".." ? m.length && m.pop() : m.push(v));
176
+ return _ + m.join("/");
177
+ }, re = (o, s) => {
178
+ const r = o.match(new RegExp(`\\b${s}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i"));
179
+ return r ? r[1] ?? r[2] ?? r[3] ?? "" : void 0;
180
+ }, qt = (o) => {
181
+ const s = [];
182
+ for (const r of o.matchAll(/<script\b[^>]*>/gi)) {
183
+ const e = r[0], a = re(e, "src");
184
+ a && s.push({ match: e, url: a, kind: "script" });
185
+ }
186
+ for (const r of o.matchAll(/<link\b[^>]*>/gi)) {
187
+ const e = r[0], a = (re(e, "rel") ?? "").toLowerCase(), c = re(e, "href");
188
+ c && (a === "stylesheet" || !a ? s.push({ match: e, url: c, kind: "style" }) : a.includes("icon") && s.push({ match: e, url: c, kind: "image" }));
189
+ }
190
+ for (const r of o.matchAll(/<img\b[^>]*>/gi)) {
191
+ const e = r[0], a = re(e, "src");
192
+ a && s.push({ match: e, url: a, kind: "image" });
193
+ }
194
+ return s;
195
+ }, Rt = (o, s) => s === "script" ? o.replace(/<\/script/gi, "<\\/script") : o.replace(/<\/style/gi, "<\\/style"), $e = async (o, s) => {
196
+ const r = await o.arrayBuffer(), e = new Uint8Array(r);
197
+ let a = "";
198
+ const c = 32768;
199
+ for (let f = 0; f < e.length; f += c)
200
+ a += String.fromCharCode(...e.subarray(f, f + c));
201
+ return `data:${s};base64,${(typeof btoa == "function" ? btoa : (f) => Buffer.from(f, "binary").toString("base64"))(a)}`;
202
+ }, xe = (o) => {
203
+ var e;
204
+ const s = ((e = o.split(/[?#]/)[0].split(".").pop()) == null ? void 0 : e.toLowerCase()) ?? "";
205
+ return {
206
+ png: "image/png",
207
+ jpg: "image/jpeg",
208
+ jpeg: "image/jpeg",
209
+ gif: "image/gif",
210
+ webp: "image/webp",
211
+ bmp: "image/bmp",
212
+ svg: "image/svg+xml",
213
+ ico: "image/x-icon",
214
+ avif: "image/avif",
215
+ css: "text/css",
216
+ js: "text/javascript",
217
+ mjs: "text/javascript",
218
+ woff: "font/woff",
219
+ woff2: "font/woff2",
220
+ ttf: "font/ttf"
221
+ }[s] ?? "application/octet-stream";
222
+ }, Bt = async (o, s, r) => {
223
+ const e = await s(o);
224
+ if (!r) return e;
225
+ let a = await e.blob.text();
226
+ const c = qt(a).filter((_) => be(_.url)), p = /* @__PURE__ */ new Map(), f = (_) => {
227
+ let w = p.get(_);
228
+ return w || (w = s(_, o).catch(() => null), p.set(_, w)), w;
229
+ }, x = async (_, w) => {
230
+ let m = _;
231
+ const v = [..._.matchAll(/url\(\s*(?:"([^"]*)"|'([^']*)'|([^)]*?))\s*\)/gi)];
232
+ for (const d of v) {
233
+ const $ = d[1] ?? d[2] ?? d[3] ?? "";
234
+ if (!$.trim() || !be($)) continue;
235
+ const U = ke($.trim(), w), M = await f(U);
236
+ if (!M) continue;
237
+ const A = M.mimeType || xe(U), B = await $e(M.blob, A);
238
+ m = m.split(d[0]).join(`url("${B}")`);
239
+ }
240
+ return m;
241
+ };
242
+ for (const _ of c) {
243
+ const w = ke(_.url.trim(), o), m = await f(w);
244
+ if (!m) continue;
245
+ const v = m.mimeType || xe(w);
246
+ if (_.kind === "script" || _.kind === "style") {
247
+ let d = await m.blob.text();
248
+ _.kind === "style" && (d = await x(d, w));
249
+ const $ = Rt(d, _.kind), U = _.kind === "script" ? `<script>
250
+ ${$}
251
+ <\/script>` : `<style>
252
+ ${$}
253
+ </style>`;
254
+ a = a.split(_.match).join(U);
255
+ } else {
256
+ const d = await $e(m.blob, v);
257
+ a = a.split(_.match).join(_.match.replace(_.url, d));
258
+ }
259
+ }
260
+ return { blob: new Blob([a], { type: "text/html;charset=utf-8" }), mimeType: "text/html" };
261
+ }, Le = Symbol("wi-chat-output-file-config"), bl = (o) => {
262
+ ye(Le, o);
263
+ }, zt = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "ico"]), Dt = /* @__PURE__ */ new Set(["mp3", "wav", "ogg", "m4a", "aac", "flac"]), Ht = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi", "mkv"]), Kt = /* @__PURE__ */ new Set(["doc", "docx", "xls", "xlsx", "ppt", "pptx"]), Wt = /* @__PURE__ */ new Set(["html", "htm"]), Xt = /* @__PURE__ */ new Set([
149
264
  "js",
150
265
  "mjs",
151
266
  "cjs",
@@ -171,7 +286,7 @@ const ze = [
171
286
  "css",
172
287
  "scss",
173
288
  "less"
174
- ]), gt = /* @__PURE__ */ new Set([
289
+ ]), Gt = /* @__PURE__ */ new Set([
175
290
  "txt",
176
291
  "text",
177
292
  "md",
@@ -187,756 +302,1538 @@ const ze = [
187
302
  "env",
188
303
  "toml",
189
304
  "sql"
190
- ]), kt = 20, F = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Map(), St = (n, a) => {
191
- if (!F.has(n) && F.size >= kt) {
192
- const u = F.keys().next().value;
193
- u !== void 0 && F.delete(u);
305
+ ]), Yt = 20, ne = /* @__PURE__ */ new Map(), ue = /* @__PURE__ */ new Map(), Zt = (o, s) => {
306
+ if (!ne.has(o) && ne.size >= Yt) {
307
+ const r = ne.keys().next().value;
308
+ r !== void 0 && ne.delete(r);
194
309
  }
195
- F.set(n, a);
196
- }, $t = (n) => {
197
- const a = n.lastIndexOf(".");
198
- return a >= 0 ? n.slice(a + 1).toLowerCase() : "";
199
- }, xt = (n) => vt.has(n) ? "image" : n === "pdf" ? "pdf" : mt.has(n) ? "html" : wt.has(n) ? "audio" : ht.has(n) ? "video" : yt.has(n) ? "office" : bt.has(n) ? "code" : gt.has(n) ? "text" : "unknown", It = (n) => {
200
- const a = ce() ? ue(ve, {}) : {}, u = I(() => {
201
- var C;
202
- const _ = z(n);
203
- return ((C = _ == null ? void 0 : _.values) == null ? void 0 : C.file_id) ?? (_ == null ? void 0 : _.file_id) ?? "";
204
- }), t = I(() => {
205
- var C;
206
- const _ = z(n);
207
- return ((C = _ == null ? void 0 : _.values) == null ? void 0 : C.file_name) ?? (_ == null ? void 0 : _.file_name) ?? "未命名文件";
208
- }), o = I(() => $t(t.value)), d = I(() => xt(o.value)), w = U(!1), $ = U(!1), b = U(""), g = U(!1), p = U(""), y = U(""), k = U(null), O = I(() => k.value ? Re(k.value.size) : ""), T = () => {
209
- y.value && typeof URL < "u" && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(y.value), y.value = "";
210
- }, R = async () => {
211
- const _ = u.value, C = t.value;
212
- if (!_)
213
- throw new Error("缺少文件 id,无法加载文件");
214
- const E = _ || C, Y = F.get(E);
215
- if (Y)
216
- return Y;
217
- let A = se.get(E);
218
- return A || (A = (async () => {
219
- var J, Z;
220
- if (a.loadFile)
221
- return a.loadFile(_);
222
- const L = (J = a.getFileUrl) == null ? void 0 : J.call(a, _);
223
- if (!L)
224
- throw new Error("未配置文件加载方式(请提供 loadFile 或 getFileUrl)");
225
- const h = await fetch(L, { headers: (Z = a.getHeaders) == null ? void 0 : Z.call(a) });
226
- if (!h.ok)
227
- throw new Error(`文件加载失败(HTTP ${h.status})`);
228
- return h.blob();
229
- })().then((L) => (St(E, L), L)).finally(() => se.delete(E)), se.set(E, A)), A;
230
- }, S = async () => {
231
- $.value = !0, b.value = "", g.value = !1, p.value = "", T();
310
+ ne.set(o, s);
311
+ }, Jt = (o) => {
312
+ const s = o.lastIndexOf(".");
313
+ return s >= 0 ? o.slice(s + 1).toLowerCase() : "";
314
+ }, Qt = (o) => zt.has(o) ? "image" : o === "pdf" ? "pdf" : Wt.has(o) ? "html" : Dt.has(o) ? "audio" : Ht.has(o) ? "video" : Kt.has(o) ? "office" : Xt.has(o) ? "code" : Gt.has(o) ? "text" : "unknown", je = (o) => {
315
+ const s = Ie() ? fe(Le, {}) : {}, r = b(() => {
316
+ var F;
317
+ const S = ee(o);
318
+ return ((F = S == null ? void 0 : S.values) == null ? void 0 : F.file_id) ?? (S == null ? void 0 : S.file_id) ?? "";
319
+ }), e = b(() => {
320
+ var F;
321
+ const S = ee(o);
322
+ return ((F = S == null ? void 0 : S.values) == null ? void 0 : F.file_name) ?? (S == null ? void 0 : S.file_name) ?? "未命名文件";
323
+ }), a = b(() => Nt(ee(o))), c = b(() => s.readLocalFile ? typeof s.isLocalSupported == "function" ? !!s.isLocalSupported() : !0 : !1), p = b(
324
+ () => c.value && a.value ? "local" : "remote"
325
+ ), f = b(() => Jt(e.value)), x = b(() => Qt(f.value)), _ = q(!1), w = q(!1), m = q(""), v = q(!1), d = q(""), $ = q(""), U = q(null), M = b(() => U.value ? ut(U.value.size) : ""), A = () => {
326
+ $.value && typeof URL < "u" && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL($.value), $.value = "";
327
+ }, B = async () => {
328
+ const S = r.value, F = e.value, W = a.value, O = p.value === "local", Z = O ? `local_${W}` : S ? `remote_${S}` : `file_${F}`, g = ne.get(Z);
329
+ if (g) return g;
330
+ let V = ue.get(Z);
331
+ return V || (V = (async () => {
332
+ var i, u;
333
+ if (O)
334
+ return (await Bt(
335
+ W,
336
+ s.readLocalFile,
337
+ x.value === "html"
338
+ )).blob;
339
+ if (s.loadFile) {
340
+ if (!S) throw new Error("缺少文件 id,无法加载文件");
341
+ return s.loadFile(S);
342
+ }
343
+ const L = S ? (i = s.getFileUrl) == null ? void 0 : i.call(s, S) : void 0;
344
+ if (!L) throw new Error("未配置文件加载方式(请提供 loadFile / getFileUrl,桌面端本地文件需提供 readLocalFile)");
345
+ const C = await fetch(L, { headers: (u = s.getHeaders) == null ? void 0 : u.call(s) });
346
+ if (!C.ok) throw new Error(`文件加载失败(HTTP ${C.status})`);
347
+ return C.blob();
348
+ })().then((L) => (Zt(Z, L), L)).finally(() => ue.delete(Z)), ue.set(Z, V)), V;
349
+ }, G = async () => {
350
+ w.value = !0, m.value = "", v.value = !1, d.value = "", A();
232
351
  try {
233
- const _ = await R();
234
- k.value = _;
235
- const C = d.value;
236
- if (C === "office") {
237
- g.value = !0;
352
+ const S = await B();
353
+ U.value = S;
354
+ const F = x.value;
355
+ if (F === "office") {
356
+ v.value = !0;
238
357
  return;
239
358
  }
240
- if (C === "image" || C === "pdf" || C === "audio" || C === "video") {
241
- typeof URL < "u" && typeof URL.createObjectURL == "function" && (y.value = URL.createObjectURL(_));
359
+ if (F === "image" || F === "pdf" || F === "audio" || F === "video") {
360
+ typeof URL < "u" && typeof URL.createObjectURL == "function" && ($.value = URL.createObjectURL(S));
242
361
  return;
243
362
  }
244
- const E = await _.text();
245
- if (E.includes("\0")) {
246
- g.value = !0;
363
+ const W = await S.text();
364
+ if (W.includes("\0")) {
365
+ v.value = !0;
247
366
  return;
248
367
  }
249
- p.value = E;
250
- } catch (_) {
251
- b.value = _ instanceof Error ? _.message : String(_);
368
+ d.value = W;
369
+ } catch (S) {
370
+ m.value = S instanceof Error ? S.message : String(S);
252
371
  } finally {
253
- $.value = !1;
372
+ w.value = !1;
254
373
  }
255
- }, x = async () => {
256
- if (a.openPreview) {
257
- a.openPreview({
258
- fileId: u.value,
259
- fileName: t.value,
260
- loadFile: R,
261
- download: W
262
- });
263
- return;
264
- }
265
- w.value = !0, await S();
266
- }, G = () => {
267
- w.value = !1, $.value = !1, b.value = "", g.value = !1, p.value = "", T();
268
- }, W = async () => {
269
- try {
270
- const _ = k.value ?? await R();
271
- if (k.value = _, a.downloadFile) {
272
- a.downloadFile({ fileId: u.value, fileName: t.value, blob: _ });
374
+ }, P = async () => {
375
+ var S;
376
+ if (!((S = s.isAccessBlocked) != null && S.call(s))) {
377
+ if (s.openPreview) {
378
+ s.openPreview({
379
+ fileId: r.value,
380
+ fileName: e.value,
381
+ filePath: a.value,
382
+ source: p.value,
383
+ loadFile: B,
384
+ download: K
385
+ });
273
386
  return;
274
387
  }
275
- if (typeof document > "u" || typeof URL > "u")
276
- return;
277
- const C = URL.createObjectURL(_), E = document.createElement("a");
278
- E.href = C, E.download = t.value, document.body.appendChild(E), E.click(), E.remove(), URL.revokeObjectURL(C);
279
- } catch (_) {
280
- b.value = _ instanceof Error ? _.message : String(_), !w.value && !a.openPreview && (w.value = !0);
388
+ _.value = !0, await G();
281
389
  }
282
- }, q = (_) => {
283
- _.key === "Escape" && w.value && G();
390
+ }, R = () => {
391
+ _.value = !1, w.value = !1, m.value = "", v.value = !1, d.value = "", A();
392
+ }, K = async () => {
393
+ var S;
394
+ if (!((S = s.isAccessBlocked) != null && S.call(s)))
395
+ try {
396
+ const F = U.value ?? await B();
397
+ if (U.value = F, s.downloadFile) {
398
+ s.downloadFile({ fileId: r.value, fileName: e.value, blob: F });
399
+ return;
400
+ }
401
+ if (typeof document > "u" || typeof URL > "u") return;
402
+ const W = URL.createObjectURL(F), O = document.createElement("a");
403
+ O.href = W, O.download = e.value, document.body.appendChild(O), O.click(), O.remove(), URL.revokeObjectURL(W);
404
+ } catch (F) {
405
+ m.value = F instanceof Error ? F.message : String(F), !_.value && !s.openPreview && (_.value = !0);
406
+ }
407
+ }, N = (S) => {
408
+ S.key === "Escape" && _.value && R();
284
409
  };
285
- return de(w, (_) => {
286
- typeof window > "u" || (_ ? window.addEventListener("keydown", q) : window.removeEventListener("keydown", q));
287
- }), Ie(() => {
288
- typeof window < "u" && window.removeEventListener("keydown", q), T();
410
+ return ae(_, (S) => {
411
+ typeof window > "u" || (S ? window.addEventListener("keydown", N) : window.removeEventListener("keydown", N));
412
+ }), le(() => {
413
+ typeof window < "u" && window.removeEventListener("keydown", N), A();
289
414
  }), {
290
- fileId: u,
291
- fileName: t,
292
- extension: o,
293
- previewKind: d,
294
- fileSize: O,
295
- visible: w,
296
- loading: $,
297
- error: b,
298
- unsupported: g,
299
- textContent: p,
300
- objectUrl: y,
301
- open: x,
302
- close: G,
303
- download: W
415
+ fileId: r,
416
+ fileName: e,
417
+ filePath: a,
418
+ source: p,
419
+ extension: f,
420
+ previewKind: x,
421
+ fileSize: M,
422
+ visible: _,
423
+ loading: w,
424
+ error: m,
425
+ unsupported: v,
426
+ textContent: d,
427
+ objectUrl: $,
428
+ open: P,
429
+ close: R,
430
+ download: K
304
431
  };
305
- }, oe = (n) => (K("data-v-f61a91b5"), n = n(), X(), n), Ct = { class: "wi-output-file" }, Et = ["aria-label"], Ot = /* @__PURE__ */ oe(() => /* @__PURE__ */ e("svg", {
306
- viewBox: "0 0 24 24",
307
- fill: "none",
308
- stroke: "currentColor",
309
- "stroke-width": "1.7",
310
- "stroke-linecap": "round",
311
- "stroke-linejoin": "round"
312
- }, [
313
- /* @__PURE__ */ e("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
314
- /* @__PURE__ */ e("path", { d: "M14 2.5v4h4" })
315
- ], -1)), Tt = [
316
- Ot
317
- ], Vt = { class: "wi-output-file__info" }, Pt = ["title"], Ut = { class: "wi-output-file__meta" }, Mt = { class: "wi-output-file__ext" }, Lt = {
432
+ }, es = { class: "wi-output-file" }, ts = ["aria-label"], ss = { class: "wi-output-file__info" }, ns = ["title"], as = { class: "wi-output-file__meta" }, ls = { class: "wi-output-file__ext" }, os = {
318
433
  key: 0,
319
434
  class: "wi-output-file__size"
320
- }, jt = /* @__PURE__ */ oe(() => /* @__PURE__ */ e("svg", {
321
- viewBox: "0 0 24 24",
322
- fill: "none",
323
- stroke: "currentColor",
324
- "stroke-width": "1.8",
325
- "stroke-linecap": "round",
326
- "stroke-linejoin": "round"
327
- }, [
328
- /* @__PURE__ */ e("path", { d: "M12 3v12" }),
329
- /* @__PURE__ */ e("path", { d: "m7 10 5 5 5-5" }),
330
- /* @__PURE__ */ e("path", { d: "M5 21h14" })
331
- ], -1)), Nt = [
332
- jt
333
- ], Rt = ["aria-label"], At = { class: "wi-output-file-drawer__head" }, Ft = { class: "wi-output-file-drawer__title" }, Dt = { class: "wi-output-file-drawer__ext" }, Bt = ["title"], zt = {
435
+ }, rs = ["aria-label"], is = { class: "wi-output-file-drawer__head" }, us = { class: "wi-output-file-drawer__title" }, cs = { class: "wi-output-file-drawer__ext" }, ds = ["title"], _s = {
334
436
  key: 0,
335
437
  class: "wi-output-file-drawer__size"
336
- }, qt = { class: "wi-output-file-drawer__actions" }, Ht = { class: "wi-output-file-drawer__body" }, Kt = {
438
+ }, ps = { class: "wi-output-file-drawer__actions" }, vs = { class: "wi-output-file-drawer__body" }, fs = {
337
439
  key: 0,
338
440
  class: "wi-output-file-drawer__state"
339
- }, Xt = {
441
+ }, ys = {
340
442
  key: 1,
341
443
  class: "wi-output-file-drawer__state is-error"
342
- }, Gt = {
444
+ }, ms = {
343
445
  key: 2,
344
446
  class: "wi-output-file-drawer__state"
345
- }, Wt = /* @__PURE__ */ oe(() => /* @__PURE__ */ e("p", null, "该文件类型暂不支持在线预览,请下载后查看。", -1)), Yt = ["src", "alt"], Jt = ["src", "title"], Zt = ["srcdoc", "title"], Qt = ["src"], es = ["src"], ts = {
447
+ }, ws = ["src", "alt"], hs = ["src", "title"], gs = ["srcdoc", "title"], bs = ["src"], ks = ["src"], $s = {
346
448
  key: 8,
347
449
  class: "wi-output-file-drawer__text"
348
- }, ss = /* @__PURE__ */ j({
450
+ }, xs = /* @__PURE__ */ D({
349
451
  __name: "OutputFile",
350
452
  props: {
351
453
  report: {}
352
454
  },
353
- setup(n) {
354
- const a = n, {
355
- fileName: u,
356
- extension: t,
357
- previewKind: o,
358
- fileSize: d,
359
- visible: w,
360
- loading: $,
361
- error: b,
362
- unsupported: g,
363
- textContent: p,
364
- objectUrl: y,
365
- open: k,
366
- close: O,
367
- download: T
368
- } = It(() => a.report);
369
- return (R, S) => (l(), c("div", Ct, [
370
- e("div", {
455
+ setup(o) {
456
+ const s = o, {
457
+ fileName: r,
458
+ extension: e,
459
+ previewKind: a,
460
+ fileSize: c,
461
+ visible: p,
462
+ loading: f,
463
+ error: x,
464
+ unsupported: _,
465
+ textContent: w,
466
+ objectUrl: m,
467
+ open: v,
468
+ close: d,
469
+ download: $
470
+ } = je(() => s.report);
471
+ return (U, M) => (n(), l("div", es, [
472
+ t("div", {
371
473
  class: "wi-output-file__card",
372
474
  role: "button",
373
475
  tabindex: "0",
374
- "aria-label": `预览文件 ${i(u)}`,
375
- onClick: S[1] || (S[1] = //@ts-ignore
376
- (...x) => i(k) && i(k)(...x)),
476
+ "aria-label": `预览文件 ${y(r)}`,
477
+ onClick: M[1] || (M[1] = //@ts-ignore
478
+ (...A) => y(v) && y(v)(...A)),
377
479
  onKeydown: [
378
- S[2] || (S[2] = re(
480
+ M[2] || (M[2] = ie(
379
481
  //@ts-ignore
380
- (...x) => i(k) && i(k)(...x),
482
+ (...A) => y(v) && y(v)(...A),
381
483
  ["enter"]
382
484
  )),
383
- S[3] || (S[3] = re(te(
485
+ M[3] || (M[3] = ie(Q(
384
486
  //@ts-ignore
385
- (...x) => i(k) && i(k)(...x),
487
+ (...A) => y(v) && y(v)(...A),
386
488
  ["prevent"]
387
489
  ), ["space"]))
388
490
  ]
389
491
  }, [
390
- e("span", {
391
- class: D(["wi-output-file__icon", `is-${i(o)}`])
392
- }, Tt, 2),
393
- e("div", Vt, [
394
- e("div", {
492
+ t("span", {
493
+ class: X(["wi-output-file__icon", `is-${y(a)}`])
494
+ }, [...M[9] || (M[9] = [
495
+ t("svg", {
496
+ viewBox: "0 0 24 24",
497
+ fill: "none",
498
+ stroke: "currentColor",
499
+ "stroke-width": "1.7",
500
+ "stroke-linecap": "round",
501
+ "stroke-linejoin": "round"
502
+ }, [
503
+ t("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
504
+ t("path", { d: "M14 2.5v4h4" })
505
+ ], -1)
506
+ ])], 2),
507
+ t("div", ss, [
508
+ t("div", {
395
509
  class: "wi-output-file__name",
396
- title: i(u)
397
- }, v(i(u)), 9, Pt),
398
- e("div", Ut, [
399
- e("span", Mt, v(i(t).toUpperCase() || "FILE"), 1),
400
- i(d) ? (l(), c("span", Lt, v(i(d)), 1)) : V("", !0)
510
+ title: y(r)
511
+ }, k(y(r)), 9, ns),
512
+ t("div", as, [
513
+ t("span", ls, k(y(e).toUpperCase() || "FILE"), 1),
514
+ y(c) ? (n(), l("span", os, k(y(c)), 1)) : I("", !0)
401
515
  ])
402
516
  ]),
403
- e("button", {
517
+ t("button", {
404
518
  type: "button",
405
519
  class: "wi-output-file__download",
406
520
  title: "下载文件",
407
521
  "aria-label": "下载文件",
408
- onClick: S[0] || (S[0] = te(
522
+ onClick: M[0] || (M[0] = Q(
409
523
  //@ts-ignore
410
- (...x) => i(T) && i(T)(...x),
524
+ (...A) => y($) && y($)(...A),
411
525
  ["stop"]
412
526
  ))
413
- }, Nt)
414
- ], 40, Et),
415
- (l(), ee(Ce, { to: "body" }, [
416
- Ee(Oe, { name: "wi-output-file-fade" }, {
417
- default: Te(() => [
418
- i(w) ? (l(), c("div", {
527
+ }, [...M[10] || (M[10] = [
528
+ t("svg", {
529
+ viewBox: "0 0 24 24",
530
+ fill: "none",
531
+ stroke: "currentColor",
532
+ "stroke-width": "1.8",
533
+ "stroke-linecap": "round",
534
+ "stroke-linejoin": "round"
535
+ }, [
536
+ t("path", { d: "M12 3v12" }),
537
+ t("path", { d: "m7 10 5 5 5-5" }),
538
+ t("path", { d: "M5 21h14" })
539
+ ], -1)
540
+ ])])
541
+ ], 40, ts),
542
+ (n(), J(Be, { to: "body" }, [
543
+ ze(De, { name: "wi-output-file-fade" }, {
544
+ default: He(() => [
545
+ y(p) ? (n(), l("div", {
419
546
  key: 0,
420
547
  class: "wi-output-file-mask",
421
- onClick: S[8] || (S[8] = te(
548
+ onClick: M[8] || (M[8] = Q(
422
549
  //@ts-ignore
423
- (...x) => i(O) && i(O)(...x),
550
+ (...A) => y(d) && y(d)(...A),
424
551
  ["self"]
425
552
  ))
426
553
  }, [
427
- e("aside", {
554
+ t("aside", {
428
555
  class: "wi-output-file-drawer",
429
556
  role: "dialog",
430
557
  "aria-modal": "true",
431
- "aria-label": `预览文件 ${i(u)}`
558
+ "aria-label": `预览文件 ${y(r)}`
432
559
  }, [
433
- e("header", At, [
434
- e("div", Ft, [
435
- e("span", Dt, v(i(t).toUpperCase() || "FILE"), 1),
436
- e("div", {
560
+ t("header", is, [
561
+ t("div", us, [
562
+ t("span", cs, k(y(e).toUpperCase() || "FILE"), 1),
563
+ t("div", {
437
564
  class: "wi-output-file-drawer__name",
438
- title: i(u)
439
- }, v(i(u)), 9, Bt),
440
- i(d) ? (l(), c("div", zt, v(i(d)), 1)) : V("", !0)
565
+ title: y(r)
566
+ }, k(y(r)), 9, ds),
567
+ y(c) ? (n(), l("div", _s, k(y(c)), 1)) : I("", !0)
441
568
  ]),
442
- e("div", qt, [
443
- e("button", {
569
+ t("div", ps, [
570
+ t("button", {
444
571
  type: "button",
445
572
  class: "wi-output-file-drawer__btn",
446
- onClick: S[4] || (S[4] = //@ts-ignore
447
- (...x) => i(T) && i(T)(...x))
573
+ onClick: M[4] || (M[4] = //@ts-ignore
574
+ (...A) => y($) && y($)(...A))
448
575
  }, "下载"),
449
- e("button", {
576
+ t("button", {
450
577
  type: "button",
451
578
  class: "wi-output-file-drawer__btn wi-output-file-drawer__btn--close",
452
579
  title: "关闭",
453
580
  "aria-label": "关闭预览",
454
- onClick: S[5] || (S[5] = //@ts-ignore
455
- (...x) => i(O) && i(O)(...x))
581
+ onClick: M[5] || (M[5] = //@ts-ignore
582
+ (...A) => y(d) && y(d)(...A))
456
583
  }, " × ")
457
584
  ])
458
585
  ]),
459
- e("div", Ht, [
460
- i($) ? (l(), c("div", Kt, "文件加载中…")) : i(b) ? (l(), c("div", Xt, [
461
- e("p", null, v(i(b)), 1),
462
- e("button", {
586
+ t("div", vs, [
587
+ y(f) ? (n(), l("div", fs, "文件加载中…")) : y(x) ? (n(), l("div", ys, [
588
+ t("p", null, k(y(x)), 1),
589
+ t("button", {
463
590
  type: "button",
464
591
  class: "wi-output-file-drawer__btn",
465
- onClick: S[6] || (S[6] = //@ts-ignore
466
- (...x) => i(T) && i(T)(...x))
592
+ onClick: M[6] || (M[6] = //@ts-ignore
593
+ (...A) => y($) && y($)(...A))
467
594
  }, "下载文件")
468
- ])) : i(g) ? (l(), c("div", Gt, [
469
- Wt,
470
- e("button", {
595
+ ])) : y(_) ? (n(), l("div", ms, [
596
+ M[11] || (M[11] = t("p", null, "该文件类型暂不支持在线预览,请下载后查看。", -1)),
597
+ t("button", {
471
598
  type: "button",
472
599
  class: "wi-output-file-drawer__btn",
473
- onClick: S[7] || (S[7] = //@ts-ignore
474
- (...x) => i(T) && i(T)(...x))
600
+ onClick: M[7] || (M[7] = //@ts-ignore
601
+ (...A) => y($) && y($)(...A))
475
602
  }, "下载文件")
476
- ])) : i(o) === "image" && i(y) ? (l(), c("img", {
603
+ ])) : y(a) === "image" && y(m) ? (n(), l("img", {
477
604
  key: 3,
478
605
  class: "wi-output-file-drawer__image",
479
- src: i(y),
480
- alt: i(u)
481
- }, null, 8, Yt)) : i(o) === "pdf" && i(y) ? (l(), c("iframe", {
606
+ src: y(m),
607
+ alt: y(r)
608
+ }, null, 8, ws)) : y(a) === "pdf" && y(m) ? (n(), l("iframe", {
482
609
  key: 4,
483
610
  class: "wi-output-file-drawer__frame",
484
- src: i(y),
485
- title: i(u)
486
- }, null, 8, Jt)) : i(o) === "html" ? (l(), c("iframe", {
611
+ src: y(m),
612
+ title: y(r)
613
+ }, null, 8, hs)) : y(a) === "html" ? (n(), l("iframe", {
487
614
  key: 5,
488
615
  class: "wi-output-file-drawer__frame",
489
- srcdoc: i(p),
616
+ srcdoc: y(w),
490
617
  sandbox: "allow-scripts allow-forms allow-modals",
491
- title: i(u)
492
- }, null, 8, Zt)) : i(o) === "audio" && i(y) ? (l(), c("audio", {
618
+ title: y(r)
619
+ }, null, 8, gs)) : y(a) === "audio" && y(m) ? (n(), l("audio", {
493
620
  key: 6,
494
621
  class: "wi-output-file-drawer__media",
495
- src: i(y),
622
+ src: y(m),
496
623
  controls: ""
497
- }, null, 8, Qt)) : i(o) === "video" && i(y) ? (l(), c("video", {
624
+ }, null, 8, bs)) : y(a) === "video" && y(m) ? (n(), l("video", {
498
625
  key: 7,
499
626
  class: "wi-output-file-drawer__media",
500
- src: i(y),
627
+ src: y(m),
501
628
  controls: ""
502
- }, null, 8, es)) : (l(), c("pre", ts, v(i(p)), 1))
629
+ }, null, 8, ks)) : (n(), l("pre", $s, k(y(w)), 1))
503
630
  ])
504
- ], 8, Rt)
505
- ])) : V("", !0)
631
+ ], 8, rs)
632
+ ])) : I("", !0)
506
633
  ]),
507
634
  _: 1
508
635
  })
509
636
  ]))
510
637
  ]));
511
638
  }
512
- }), ns = /* @__PURE__ */ N(ss, [["__scopeId", "data-v-f61a91b5"]]), os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
639
+ }), Ss = /* @__PURE__ */ H(xs, [["__scopeId", "data-v-f96eaa7a"]]), Cs = { class: "wi-output-file-link" }, Ms = ["title", "aria-label"], Es = { class: "wi-output-file-link__name" }, Is = ["aria-label"], As = /* @__PURE__ */ D({
640
+ __name: "OutputFileLink",
641
+ props: {
642
+ report: {}
643
+ },
644
+ setup(o) {
645
+ const s = o, { fileName: r, open: e, download: a } = je(() => s.report);
646
+ return (c, p) => (n(), l("span", Cs, [
647
+ t("a", {
648
+ class: "wi-output-file-link__anchor",
649
+ role: "link",
650
+ tabindex: "0",
651
+ title: `预览文件 ${y(r)}`,
652
+ "aria-label": `预览文件 ${y(r)}`,
653
+ onClick: p[0] || (p[0] = Q((f) => y(e)(), ["prevent"])),
654
+ onKeydown: [
655
+ p[1] || (p[1] = ie(Q((f) => y(e)(), ["prevent"]), ["enter"])),
656
+ p[2] || (p[2] = ie(Q((f) => y(e)(), ["prevent"]), ["space"]))
657
+ ]
658
+ }, [
659
+ p[4] || (p[4] = t("svg", {
660
+ class: "wi-output-file-link__icon",
661
+ viewBox: "0 0 24 24",
662
+ fill: "none",
663
+ stroke: "currentColor",
664
+ "stroke-width": "1.8",
665
+ "stroke-linecap": "round",
666
+ "stroke-linejoin": "round",
667
+ "aria-hidden": "true"
668
+ }, [
669
+ t("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
670
+ t("path", { d: "M14 2.5v4h4" })
671
+ ], -1)),
672
+ t("span", Es, k(y(r)), 1)
673
+ ], 40, Ms),
674
+ t("button", {
675
+ type: "button",
676
+ class: "wi-output-file-link__download",
677
+ title: "下载文件",
678
+ "aria-label": `下载文件 ${y(r)}`,
679
+ onClick: p[3] || (p[3] = Q((f) => y(a)(), ["stop"]))
680
+ }, [...p[5] || (p[5] = [
681
+ t("svg", {
682
+ viewBox: "0 0 24 24",
683
+ fill: "none",
684
+ stroke: "currentColor",
685
+ "stroke-width": "1.8",
686
+ "stroke-linecap": "round",
687
+ "stroke-linejoin": "round",
688
+ "aria-hidden": "true"
689
+ }, [
690
+ t("path", { d: "M12 3v12" }),
691
+ t("path", { d: "M7 11l5 5 5-5" }),
692
+ t("path", { d: "M4 20h16" })
693
+ ], -1)
694
+ ])], 8, Is)
695
+ ]));
696
+ }
697
+ }), Os = /* @__PURE__ */ H(As, [["__scopeId", "data-v-d9a5a149"]]), Ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
513
698
  __proto__: null,
514
- default: ns
515
- }, Symbol.toStringTag, { value: "Module" })), as = () => {
516
- var a, u;
517
- const n = (u = (a = window == null ? void 0 : window.globalConfig) == null ? void 0 : a.WebApiUrl) == null ? void 0 : u.MainUrl;
518
- return typeof n == "string" ? n : "";
519
- }, rs = () => window.location.origin + window.location.pathname, ne = "access-session", is = () => {
520
- const n = window.location.pathname.split("/").filter((a) => !!a).join("-");
521
- return n ? `${n}-` : "";
522
- }, ls = () => {
523
- const n = `${is()}${ne}`, a = [];
524
- for (let t = 0; t < localStorage.length; t++) {
525
- const o = localStorage.key(t);
526
- !o || !o.endsWith(ne) || o.slice(0, o.lastIndexOf(":")) !== "wi admin" && (o.endsWith(`x-${ne}`) || a.push(o));
699
+ default: Os
700
+ }, Symbol.toStringTag, { value: "Module" })), Ps = { class: "wi-present-files" }, Ls = /* @__PURE__ */ D({
701
+ __name: "PresentFiles",
702
+ props: {
703
+ report: {}
704
+ },
705
+ setup(o) {
706
+ const s = o, r = b(() => {
707
+ var c;
708
+ const a = (c = s.report) == null ? void 0 : c.values;
709
+ return Array.isArray(a == null ? void 0 : a.files) ? a.files : [];
710
+ }), e = (a) => ({
711
+ answer_type: ct,
712
+ values: a
713
+ });
714
+ return (a, c) => (n(), l("div", Ps, [
715
+ (n(!0), l(T, null, j(r.value, (p, f) => (n(), J(Ss, {
716
+ key: `${p.file_id || ""}-${p.file_path || ""}-${f}`,
717
+ report: e(p)
718
+ }, null, 8, ["report"]))), 128))
719
+ ]));
527
720
  }
528
- const u = a.find((t) => t.endsWith(n)) ?? a[0];
529
- if (!u)
530
- return "";
721
+ }), js = /* @__PURE__ */ H(Ls, [["__scopeId", "data-v-9e9518be"]]), Vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
722
+ __proto__: null,
723
+ default: js
724
+ }, Symbol.toStringTag, { value: "Module" })), Us = () => {
725
+ var s, r;
726
+ const o = (r = (s = window == null ? void 0 : window.globalConfig) == null ? void 0 : s.WebApiUrl) == null ? void 0 : r.MainUrl;
727
+ return typeof o == "string" ? o : "";
728
+ }, Fs = () => window.location.origin + window.location.pathname, ce = "access-session", Ns = () => {
729
+ const o = window.location.pathname.split("/").filter((s) => !!s).join("-");
730
+ return o ? `${o}-` : "";
731
+ }, qs = () => {
732
+ const o = `${Ns()}${ce}`, s = [];
733
+ for (let e = 0; e < localStorage.length; e++) {
734
+ const a = localStorage.key(e);
735
+ !a || !a.endsWith(ce) || a.slice(0, a.lastIndexOf(":")) !== "wi admin" && (a.endsWith(`x-${ce}`) || s.push(a));
736
+ }
737
+ const r = s.find((e) => e.endsWith(o)) ?? s[0];
738
+ if (!r) return "";
531
739
  try {
532
- const t = localStorage.getItem(u);
533
- if (!t || t === "undefined")
534
- return "";
535
- const o = JSON.parse(t);
536
- return o == null ? "" : String(o);
740
+ const e = localStorage.getItem(r);
741
+ if (!e || e === "undefined") return "";
742
+ const a = JSON.parse(e);
743
+ return a == null ? "" : String(a);
537
744
  } catch {
538
745
  return "";
539
746
  }
540
- }, we = Symbol("wi-chat-iframe-page-config"), Sn = (n) => {
541
- _e(we, n);
542
- }, cs = (n, a) => {
543
- const u = (a == null ? void 0 : a.mainUrl) !== void 0 ? String(z(a.mainUrl)) : as(), t = (a == null ? void 0 : a.token) !== void 0 ? String(z(a.token)) : ls();
544
- return n.replace(/\{\{\s*MAIN_URL\s*\}\}/g, u).replace(/\{\{\s*SERVE_URL\s*\}\}/g, rs()).replace(/\{\{\s*token\s*\}\}/g, t);
545
- }, us = (n) => {
546
- const a = ce() ? ue(we, {}) : {}, u = I(() => {
547
- var w;
548
- const o = z(n), d = ((w = o == null ? void 0 : o.values) == null ? void 0 : w.url) ?? (o == null ? void 0 : o.url) ?? "";
549
- return d ? a.resolveUrl ? a.resolveUrl(d) : cs(d, a) : "";
550
- }), t = I(() => {
551
- var d;
552
- const o = z(n);
553
- return ((d = o == null ? void 0 : o.values) == null ? void 0 : d.srcdoc) ?? (o == null ? void 0 : o.srcdoc) ?? "";
747
+ }, Ve = Symbol("wi-chat-iframe-page-config"), kl = (o) => {
748
+ ye(Ve, o);
749
+ }, Rs = (o, s) => {
750
+ const r = (s == null ? void 0 : s.mainUrl) !== void 0 ? String(ee(s.mainUrl)) : Us(), e = (s == null ? void 0 : s.token) !== void 0 ? String(ee(s.token)) : qs();
751
+ return o.replace(/\{\{\s*MAIN_URL\s*\}\}/g, r).replace(/\{\{\s*SERVE_URL\s*\}\}/g, Fs()).replace(/\{\{\s*token\s*\}\}/g, e);
752
+ }, Bs = (o) => {
753
+ const s = Ie() ? fe(Ve, {}) : {}, r = b(() => {
754
+ var p;
755
+ const a = ee(o), c = ((p = a == null ? void 0 : a.values) == null ? void 0 : p.url) ?? (a == null ? void 0 : a.url) ?? "";
756
+ return c ? s.resolveUrl ? s.resolveUrl(c) : Rs(c, s) : "";
757
+ }), e = b(() => {
758
+ var c;
759
+ const a = ee(o);
760
+ return ((c = a == null ? void 0 : a.values) == null ? void 0 : c.srcdoc) ?? (a == null ? void 0 : a.srcdoc) ?? "";
554
761
  });
555
- return { url: u, srcdoc: t };
556
- }, le = "data-wi-iframe-resizer-child", ds = (n) => {
557
- if (!n)
558
- return !1;
559
- let a = null;
762
+ return { url: r, srcdoc: e };
763
+ }, Se = "data-wi-iframe-resizer-child", zs = (o) => {
764
+ if (!o) return !1;
765
+ let s = null;
560
766
  try {
561
- a = n.contentDocument;
767
+ s = o.contentDocument;
562
768
  } catch {
563
769
  return !1;
564
770
  }
565
- if (!a)
566
- return !1;
567
- const u = a.head || a.documentElement;
568
- if (!u)
569
- return !1;
570
- const t = a.defaultView;
571
- if (t != null && t.parentIframe || t != null && t.parentIFrame || a.querySelector(`script[${le}]`))
572
- return !1;
573
- const o = a.createElement("script");
574
- return o.textContent = Ae, o.setAttribute(le, ""), u.appendChild(o), !0;
575
- }, _s = /* @__PURE__ */ j({
771
+ if (!s) return !1;
772
+ const r = s.head || s.documentElement;
773
+ if (!r) return !1;
774
+ const e = s.defaultView;
775
+ if (e != null && e.parentIframe || e != null && e.parentIFrame || s.querySelector(`script[${Se}]`)) return !1;
776
+ const a = s.createElement("script");
777
+ return a.textContent = dt, a.setAttribute(Se, ""), r.appendChild(a), !0;
778
+ }, Ds = /* @__PURE__ */ D({
576
779
  __name: "IframePage",
577
780
  props: {
578
781
  report: {}
579
782
  },
580
- setup(n) {
581
- const a = n, { url: u, srcdoc: t } = us(() => a.report), o = (d) => {
582
- ds(d.target);
783
+ setup(o) {
784
+ const s = o, { url: r, srcdoc: e } = Bs(() => s.report), a = (c) => {
785
+ zs(c.target);
583
786
  };
584
- return (d, w) => i(u) ? (l(), ee(ie, {
787
+ return (c, p) => y(r) ? (n(), J(ge, {
585
788
  key: 0,
586
789
  class: "iframe-page__frame iframe-page__frame--url",
587
790
  license: "GPLv3",
588
- src: i(u),
791
+ src: y(r),
589
792
  width: "100%",
590
793
  "warning-timeout": 0,
591
- onLoad: o
592
- }, null, 8, ["src"])) : i(t) ? (l(), ee(ie, {
794
+ onLoad: a
795
+ }, null, 8, ["src"])) : y(e) ? (n(), J(ge, {
593
796
  key: 1,
594
797
  class: "iframe-page iframe-page--srcdoc",
595
798
  license: "GPLv3",
596
- srcdoc: i(t),
799
+ srcdoc: y(e),
597
800
  width: "100%",
598
801
  frameborder: "no",
599
802
  border: "0",
600
803
  marginwidth: "0",
601
804
  marginheight: "0",
602
805
  scrolling: "no"
603
- }, null, 8, ["srcdoc"])) : V("", !0);
806
+ }, null, 8, ["srcdoc"])) : I("", !0);
604
807
  }
605
- }), ps = /* @__PURE__ */ N(_s, [["__scopeId", "data-v-f4c94a4e"]]), fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
808
+ }), Hs = /* @__PURE__ */ H(Ds, [["__scopeId", "data-v-f4c94a4e"]]), Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
606
809
  __proto__: null,
607
- default: ps
608
- }, Symbol.toStringTag, { value: "Module" })), ae = (n) => (K("data-v-74053305"), n = n(), X(), n), vs = { class: "wi-clarify__header" }, ws = { class: "wi-clarify__heading" }, hs = /* @__PURE__ */ ae(() => /* @__PURE__ */ e("div", { class: "wi-clarify__eyebrow" }, "需要补充信息", -1)), ys = { class: "wi-clarify__title" }, ms = {
810
+ default: Hs
811
+ }, Symbol.toStringTag, { value: "Module" })), Ws = { class: "wi-clarify__header" }, Xs = { class: "wi-clarify__heading" }, Gs = { class: "wi-clarify__title" }, Ys = {
609
812
  key: 0,
610
813
  class: "wi-clarify__desc"
611
- }, bs = { class: "wi-clarify__status" }, gs = { class: "wi-clarify__progress" }, ks = { class: "wi-clarify__progress-track" }, Ss = {
814
+ }, Zs = { class: "wi-clarify__status" }, Js = { class: "wi-clarify__progress" }, Qs = { class: "wi-clarify__progress-track" }, en = {
612
815
  key: 0,
613
816
  class: "wi-clarify__panel"
614
- }, $s = { class: "wi-clarify__question" }, xs = {
817
+ }, tn = { class: "wi-clarify__question" }, sn = {
615
818
  key: 0,
616
819
  class: "wi-clarify__question-desc"
617
- }, Is = {
820
+ }, nn = {
618
821
  key: 1,
619
822
  class: "wi-clarify__binding"
620
- }, Cs = {
823
+ }, an = {
621
824
  key: 2,
622
825
  class: "wi-clarify__options"
623
- }, Es = ["onClick"], Os = { class: "wi-clarify__option-indicator" }, Ts = {
826
+ }, ln = ["onClick"], on = { class: "wi-clarify__option-indicator" }, rn = {
624
827
  key: 3,
625
828
  class: "wi-clarify__date"
626
- }, Vs = ["for"], Ps = ["id", "value"], Us = { class: "wi-clarify__text" }, Ms = {
829
+ }, un = ["for"], cn = ["id", "value"], dn = { class: "wi-clarify__text" }, _n = {
627
830
  key: 0,
628
831
  class: "wi-clarify__or"
629
- }, Ls = /* @__PURE__ */ ae(() => /* @__PURE__ */ e("span", null, "或者,用自己的话说明", -1)), js = [
630
- Ls
631
- ], Ns = ["for"], Rs = ["id", "value", "placeholder"], As = {
832
+ }, pn = ["for"], vn = ["id", "value", "placeholder"], fn = {
632
833
  class: "wi-clarify__dots",
633
834
  "aria-label": "确认问题导航"
634
- }, Fs = ["aria-label", "onClick"], Ds = { class: "wi-clarify__footer" }, Bs = /* @__PURE__ */ ae(() => /* @__PURE__ */ e("span", { class: "wi-clarify__confirm-text" }, "取消后本次操作将停止等待这些回答", -1)), zs = { class: "wi-clarify__actions" }, qs = { class: "wi-clarify__actions" }, Hs = ["disabled"], Ks = {
835
+ }, yn = ["aria-label", "onClick"], mn = { class: "wi-clarify__footer" }, wn = { class: "wi-clarify__actions" }, hn = { class: "wi-clarify__actions" }, gn = ["disabled"], bn = {
635
836
  key: 1,
636
837
  class: "wi-clarify__result"
637
- }, Xs = { class: "wi-clarify__result-icon" }, Gs = { class: "wi-clarify__result-body" }, Ws = {
838
+ }, kn = { class: "wi-clarify__result-icon" }, $n = { class: "wi-clarify__result-body" }, xn = {
638
839
  key: 0,
639
840
  class: "wi-clarify__summary"
640
- }, Ys = { key: 1 }, Js = { key: 2 }, Zs = {
841
+ }, Sn = { key: 1 }, Cn = { key: 2 }, Mn = {
641
842
  key: 2,
642
843
  class: "wi-clarify__feedback"
643
- }, Qs = /* @__PURE__ */ j({
844
+ }, En = /* @__PURE__ */ D({
644
845
  __name: "ClarificationCard",
645
846
  props: {
646
847
  report: {}
647
848
  },
648
- setup(n) {
649
- const a = n, u = {
849
+ setup(o) {
850
+ const s = o, r = {
650
851
  requestId: "",
651
852
  title: "需要补充信息",
652
853
  description: "",
653
854
  items: [],
654
855
  status: "expired",
655
856
  resultMessage: "本次补充信息已失效(回答已结束)"
656
- }, t = I(() => a.report.values ?? u), o = I(() => t.value.items ?? []), d = U(0), w = Ve({}), $ = U(!1), b = U("");
657
- de(() => {
658
- var s;
659
- return (s = t.value) == null ? void 0 : s.requestId;
857
+ }, e = b(() => s.report.values ?? r), a = b(() => e.value.items ?? []), c = q(0), p = Ke({}), f = q(!1), x = q("");
858
+ ae(() => {
859
+ var i;
860
+ return (i = e.value) == null ? void 0 : i.requestId;
660
861
  }, () => {
661
- Object.keys(w).forEach((s) => delete w[s]), o.value.forEach((s) => {
662
- const r = { structuredValue: void 0, structuredValues: [], textValue: "" };
663
- s.default !== void 0 && (s.input.type === "multi_select" ? r.structuredValues = Array.isArray(s.default) ? [...s.default] : [] : s.input.type === "text" ? r.textValue = String(s.default) : r.structuredValue = s.default), w[s.id] = r;
664
- }), d.value = 0;
862
+ Object.keys(p).forEach((i) => delete p[i]), a.value.forEach((i) => {
863
+ const u = { structuredValue: void 0, structuredValues: [], textValue: "" };
864
+ i.default !== void 0 && (i.input.type === "multi_select" ? u.structuredValues = Array.isArray(i.default) ? [...i.default] : [] : i.input.type === "text" ? u.textValue = String(i.default) : u.structuredValue = i.default), p[i.id] = u;
865
+ }), c.value = 0;
665
866
  }, { immediate: !0 });
666
- const p = (s) => (w[s] || (w[s] = { structuredValue: void 0, structuredValues: [], textValue: "" }), w[s]), y = I(() => {
667
- var s, r, f;
668
- return ((s = t.value) == null ? void 0 : s.status) === "submitted" ? "已提交" : ((r = t.value) == null ? void 0 : r.status) === "cancelled" ? "已取消" : ((f = t.value) == null ? void 0 : f.status) === "expired" ? "已失效" : "等待回答";
669
- }), k = (s) => {
867
+ const w = (i) => (p[i] || (p[i] = { structuredValue: void 0, structuredValues: [], textValue: "" }), p[i]), m = b(() => {
868
+ var i, u, h;
869
+ return ((i = e.value) == null ? void 0 : i.status) === "submitted" ? "已提交" : ((u = e.value) == null ? void 0 : u.status) === "cancelled" ? "已取消" : ((h = e.value) == null ? void 0 : h.status) === "expired" ? "已失效" : "等待回答";
870
+ }), v = (i) => {
670
871
  try {
671
- const r = JSON.stringify(s);
672
- return r === void 0 ? String(s) : r;
872
+ const u = JSON.stringify(i);
873
+ return u === void 0 ? String(i) : u;
673
874
  } catch {
674
- return String(s);
875
+ return String(i);
675
876
  }
676
- }, O = (s, r) => k(s) === k(r), T = (s, r) => {
677
- const f = p(s.id);
678
- return s.input.type === "multi_select" ? f.structuredValues.some((m) => O(m, r)) : O(f.structuredValue, r);
679
- }, R = (s, r) => {
680
- const f = p(s.id);
681
- if (f.textValue = "", s.input.type === "multi_select") {
682
- const m = f.structuredValues.findIndex((P) => O(P, r));
683
- m >= 0 ? f.structuredValues.splice(m, 1) : f.structuredValues.push(r);
877
+ }, d = (i, u) => v(i) === v(u), $ = (i, u) => {
878
+ const h = w(i.id);
879
+ return i.input.type === "multi_select" ? h.structuredValues.some((E) => d(E, u)) : d(h.structuredValue, u);
880
+ }, U = (i, u) => {
881
+ const h = w(i.id);
882
+ if (h.textValue = "", i.input.type === "multi_select") {
883
+ const E = h.structuredValues.findIndex((z) => d(z, u));
884
+ E >= 0 ? h.structuredValues.splice(E, 1) : h.structuredValues.push(u);
684
885
  return;
685
886
  }
686
- f.structuredValue = r;
687
- }, S = (s) => {
688
- var r;
689
- return ((r = s.target) == null ? void 0 : r.value) ?? "";
690
- }, x = (s, r) => {
691
- const f = p(s.id);
692
- f.textValue = S(r), s.input.type !== "text" && (f.structuredValue = void 0, f.structuredValues.splice(0));
693
- }, G = (s, r) => {
694
- const f = p(s.id);
695
- f.structuredValue = S(r), f.textValue = "";
696
- }, W = (s) => {
697
- const r = p(s.id).structuredValue;
698
- return r == null ? "" : String(r);
699
- }, q = (s) => {
700
- var r;
701
- return ((r = s.input.textInput) == null ? void 0 : r.placeholder) ?? s.input.placeholder ?? (s.input.type === "text" ? "请输入需要补充的信息" : "例如:使用阀门,或者说明你的具体要求");
702
- }, _ = (s) => {
703
- const r = s.binding;
704
- if (!r)
705
- return "";
706
- const f = r.actionName ? `动作:${r.actionName}` : "", m = r.parameterPath ? `参数:${r.parameterPath}` : "";
707
- return [f, m].filter(Boolean).join(" · ");
708
- }, C = (s) => {
709
- const r = p(s.id);
710
- return s.input.type === "multi_select" ? r.structuredValues.length > 0 : s.input.type === "single_select" ? r.structuredValue !== void 0 : s.input.type === "date" ? !!r.structuredValue : !1;
711
- }, E = (s) => !!p(s.id).textValue.trim() || C(s), Y = (s) => !s.required || E(s) ? !0 : (b.value = `请回答“${s.question}”`, !1), A = () => {
712
- b.value = "", d.value = Math.max(0, d.value - 1);
713
- }, L = () => {
714
- !h.value || !Y(h.value) || (b.value = "", d.value = Math.min(o.value.length - 1, d.value + 1));
715
- }, h = I(() => o.value[d.value]), J = (s, r) => s.input.type === "date" ? String(r ?? "") : (Array.isArray(r) ? r : [r]).map((m) => {
716
- var Q;
717
- const P = (Q = s.input.options) == null ? void 0 : Q.find((ge) => O(ge.value, m));
718
- return (P == null ? void 0 : P.label) ?? String(m ?? "");
719
- }).filter(Boolean).join("、"), Z = (s) => {
720
- const r = p(s.id), f = r.textValue.trim();
721
- if (s.input.type === "text" || f || !C(s))
722
- return { id: s.id, mode: "text", value: f, displayText: f };
723
- const m = s.input.type === "multi_select" ? [...r.structuredValues] : r.structuredValue;
887
+ h.structuredValue = u;
888
+ }, M = (i) => {
889
+ var u;
890
+ return ((u = i.target) == null ? void 0 : u.value) ?? "";
891
+ }, A = (i, u) => {
892
+ const h = w(i.id);
893
+ h.textValue = M(u), i.input.type !== "text" && (h.structuredValue = void 0, h.structuredValues.splice(0));
894
+ }, B = (i, u) => {
895
+ const h = w(i.id);
896
+ h.structuredValue = M(u), h.textValue = "";
897
+ }, G = (i) => {
898
+ const u = w(i.id).structuredValue;
899
+ return u == null ? "" : String(u);
900
+ }, P = (i) => {
901
+ var u;
902
+ return ((u = i.input.textInput) == null ? void 0 : u.placeholder) ?? i.input.placeholder ?? (i.input.type === "text" ? "请输入需要补充的信息" : "例如:使用阀门,或者说明你的具体要求");
903
+ }, R = (i) => {
904
+ const u = i.binding;
905
+ if (!u) return "";
906
+ const h = u.actionName ? `动作:${u.actionName}` : "", E = u.parameterPath ? `参数:${u.parameterPath}` : "";
907
+ return [h, E].filter(Boolean).join(" · ");
908
+ }, K = (i) => {
909
+ const u = w(i.id);
910
+ return i.input.type === "multi_select" ? u.structuredValues.length > 0 : i.input.type === "single_select" ? u.structuredValue !== void 0 : i.input.type === "date" ? !!u.structuredValue : !1;
911
+ }, N = (i) => !!w(i.id).textValue.trim() || K(i), S = (i) => !i.required || N(i) ? !0 : (x.value = `请回答“${i.question}”`, !1), F = () => {
912
+ x.value = "", c.value = Math.max(0, c.value - 1);
913
+ }, W = () => {
914
+ !O.value || !S(O.value) || (x.value = "", c.value = Math.min(a.value.length - 1, c.value + 1));
915
+ }, O = b(() => a.value[c.value]), Z = (i, u) => i.input.type === "date" ? String(u ?? "") : (Array.isArray(u) ? u : [u]).map((E) => {
916
+ var te;
917
+ const z = (te = i.input.options) == null ? void 0 : te.find((Ne) => d(Ne.value, E));
918
+ return (z == null ? void 0 : z.label) ?? String(E ?? "");
919
+ }).filter(Boolean).join("、"), g = (i) => {
920
+ const u = w(i.id), h = u.textValue.trim();
921
+ if (i.input.type === "text" || h || !K(i))
922
+ return { id: i.id, mode: "text", value: h, displayText: h };
923
+ const E = i.input.type === "multi_select" ? [...u.structuredValues] : u.structuredValue;
724
924
  return {
725
- id: s.id,
925
+ id: i.id,
726
926
  mode: "structured",
727
- value: m,
728
- displayText: J(s, m)
927
+ value: E,
928
+ displayText: Z(i, E)
729
929
  };
730
- }, ye = () => {
731
- const s = o.value.findIndex((f) => f.required && !E(f));
732
- if (s >= 0) {
733
- d.value = s, b.value = `请回答“${o.value[s].question}”`;
930
+ }, V = () => {
931
+ const i = a.value.findIndex((h) => h.required && !N(h));
932
+ if (i >= 0) {
933
+ c.value = i, x.value = `请回答“${a.value[i].question}”`;
734
934
  return;
735
935
  }
736
- b.value = "";
737
- const r = o.value.map(Z);
738
- Fe(t.value.requestId, r) || (b.value = "本次补充信息已经处理");
739
- }, me = () => {
740
- $.value = !1, b.value = "", De(t.value.requestId) || (b.value = "本次补充信息已经处理");
741
- }, be = (s) => {
742
- var r;
743
- return ((r = o.value.find((f) => f.id === s)) == null ? void 0 : r.question) ?? s;
936
+ x.value = "";
937
+ const u = a.value.filter((h) => h.required || N(h)).map(g);
938
+ _t(e.value.requestId, u) || (x.value = "本次补充信息已经处理");
939
+ }, L = () => {
940
+ f.value = !1, x.value = "", pt(e.value.requestId) || (x.value = "本次补充信息已经处理");
941
+ }, C = (i) => {
942
+ var u;
943
+ return ((u = a.value.find((h) => h.id === i)) == null ? void 0 : u.question) ?? i;
744
944
  };
745
- return (s, r) => {
746
- var f;
747
- return l(), c("section", {
748
- class: D(["wi-clarify", `is-${t.value.status}`])
945
+ return (i, u) => {
946
+ var h;
947
+ return n(), l("section", {
948
+ class: X(["wi-clarify", `is-${e.value.status}`])
749
949
  }, [
750
- e("header", vs, [
751
- e("div", ws, [
752
- hs,
753
- e("h3", ys, v(t.value.title), 1),
754
- t.value.description ? (l(), c("p", ms, v(t.value.description), 1)) : V("", !0)
950
+ t("header", Ws, [
951
+ t("div", Xs, [
952
+ u[4] || (u[4] = t("div", { class: "wi-clarify__eyebrow" }, "需要补充信息", -1)),
953
+ t("h3", Gs, k(e.value.title), 1),
954
+ e.value.description ? (n(), l("p", Ys, k(e.value.description), 1)) : I("", !0)
755
955
  ]),
756
- e("span", bs, v(y.value), 1)
956
+ t("span", Zs, k(m.value), 1)
757
957
  ]),
758
- t.value.status === "pending" ? (l(), c(M, { key: 0 }, [
759
- e("div", gs, [
760
- e("span", null, "问题 " + v(d.value + 1) + " / " + v(o.value.length), 1),
761
- e("div", ks, [
762
- e("span", {
763
- style: Pe({ width: `${(d.value + 1) / o.value.length * 100}%` })
958
+ e.value.status === "pending" ? (n(), l(T, { key: 0 }, [
959
+ t("div", Js, [
960
+ t("span", null, "问题 " + k(c.value + 1) + " / " + k(a.value.length), 1),
961
+ t("div", Qs, [
962
+ t("span", {
963
+ style: Ae({ width: `${(c.value + 1) / a.value.length * 100}%` })
764
964
  }, null, 4)
765
965
  ])
766
966
  ]),
767
- h.value ? (l(), c("div", Ss, [
768
- e("div", $s, [
769
- e("span", {
770
- class: D(h.value.required ? "wi-clarify__required" : "wi-clarify__optional")
771
- }, v(h.value.required ? "必填" : "选填"), 3),
772
- e("h4", null, v(h.value.question), 1)
967
+ O.value ? (n(), l("div", en, [
968
+ t("div", tn, [
969
+ t("span", {
970
+ class: X(O.value.required ? "wi-clarify__required" : "wi-clarify__optional")
971
+ }, k(O.value.required ? "必填" : "选填"), 3),
972
+ t("h4", null, k(O.value.question), 1)
773
973
  ]),
774
- h.value.description ? (l(), c("p", xs, v(h.value.description), 1)) : V("", !0),
775
- _(h.value) ? (l(), c("div", Is, v(_(h.value)), 1)) : V("", !0),
776
- h.value.input.type === "single_select" || h.value.input.type === "multi_select" ? (l(), c("div", Cs, [
777
- (l(!0), c(M, null, B(h.value.input.options, (m, P) => (l(), c("button", {
778
- key: P,
974
+ O.value.description ? (n(), l("p", sn, k(O.value.description), 1)) : I("", !0),
975
+ R(O.value) ? (n(), l("div", nn, k(R(O.value)), 1)) : I("", !0),
976
+ O.value.input.type === "single_select" || O.value.input.type === "multi_select" ? (n(), l("div", an, [
977
+ (n(!0), l(T, null, j(O.value.input.options, (E, z) => (n(), l("button", {
978
+ key: z,
779
979
  type: "button",
780
- class: D(["wi-clarify__option", { "is-selected": T(h.value, m.value) }]),
781
- onClick: (Q) => R(h.value, m.value)
980
+ class: X(["wi-clarify__option", { "is-selected": $(O.value, E.value) }]),
981
+ onClick: (te) => U(O.value, E.value)
782
982
  }, [
783
- e("span", Os, v(T(h.value, m.value) ? "✓" : ""), 1),
784
- e("span", null, v(m.label), 1)
785
- ], 10, Es))), 128))
786
- ])) : h.value.input.type === "date" ? (l(), c("div", Ts, [
787
- e("label", {
788
- for: `wi-clarify-date-${h.value.id}`
789
- }, "选择日期", 8, Vs),
790
- e("input", {
791
- id: `wi-clarify-date-${h.value.id}`,
983
+ t("span", on, k($(O.value, E.value) ? "✓" : ""), 1),
984
+ t("span", null, k(E.label), 1)
985
+ ], 10, ln))), 128))
986
+ ])) : O.value.input.type === "date" ? (n(), l("div", rn, [
987
+ t("label", {
988
+ for: `wi-clarify-date-${O.value.id}`
989
+ }, "选择日期", 8, un),
990
+ t("input", {
991
+ id: `wi-clarify-date-${O.value.id}`,
792
992
  type: "date",
793
- value: W(h.value),
794
- onInput: r[0] || (r[0] = (m) => G(h.value, m))
795
- }, null, 40, Ps)
796
- ])) : V("", !0),
797
- e("div", Us, [
798
- h.value.input.type !== "text" ? (l(), c("div", Ms, js)) : V("", !0),
799
- e("label", {
800
- for: `wi-clarify-text-${h.value.id}`
801
- }, v(h.value.input.type === "text" ? "你的回答" : "自然语言回答"), 9, Ns),
802
- e("textarea", {
803
- id: `wi-clarify-text-${h.value.id}`,
804
- value: p(h.value.id).textValue,
805
- placeholder: q(h.value),
993
+ value: G(O.value),
994
+ onInput: u[0] || (u[0] = (E) => B(O.value, E))
995
+ }, null, 40, cn)
996
+ ])) : I("", !0),
997
+ t("div", dn, [
998
+ O.value.input.type !== "text" ? (n(), l("div", _n, [...u[5] || (u[5] = [
999
+ t("span", null, "或者,用自己的话说明", -1)
1000
+ ])])) : I("", !0),
1001
+ t("label", {
1002
+ for: `wi-clarify-text-${O.value.id}`
1003
+ }, k(O.value.input.type === "text" ? "你的回答" : "自然语言回答"), 9, pn),
1004
+ t("textarea", {
1005
+ id: `wi-clarify-text-${O.value.id}`,
1006
+ value: w(O.value.id).textValue,
1007
+ placeholder: P(O.value),
806
1008
  rows: "3",
807
- onInput: r[1] || (r[1] = (m) => x(h.value, m))
808
- }, null, 40, Rs)
1009
+ onInput: u[1] || (u[1] = (E) => A(O.value, E))
1010
+ }, null, 40, vn)
809
1011
  ])
810
- ])) : V("", !0),
811
- e("div", As, [
812
- (l(!0), c(M, null, B(o.value, (m, P) => (l(), c("button", {
813
- key: m.id,
1012
+ ])) : I("", !0),
1013
+ t("div", fn, [
1014
+ (n(!0), l(T, null, j(a.value, (E, z) => (n(), l("button", {
1015
+ key: E.id,
814
1016
  type: "button",
815
- "aria-label": `查看第 ${P + 1} 个问题`,
816
- class: D({ "is-active": P === d.value, "is-answered": E(m) }),
817
- onClick: (Q) => d.value = P
818
- }, null, 10, Fs))), 128))
1017
+ "aria-label": `查看第 ${z + 1} 个问题`,
1018
+ class: X({ "is-active": z === c.value, "is-answered": N(E) }),
1019
+ onClick: (te) => c.value = z
1020
+ }, null, 10, yn))), 128))
819
1021
  ]),
820
- e("footer", Ds, [
821
- $.value ? (l(), c(M, { key: 0 }, [
822
- Bs,
823
- e("div", zs, [
824
- e("button", {
1022
+ t("footer", mn, [
1023
+ f.value ? (n(), l(T, { key: 0 }, [
1024
+ u[6] || (u[6] = t("span", { class: "wi-clarify__confirm-text" }, "取消后本次操作将停止等待这些回答", -1)),
1025
+ t("div", wn, [
1026
+ t("button", {
825
1027
  type: "button",
826
1028
  class: "wi-clarify__btn wi-clarify__btn--secondary",
827
- onClick: r[2] || (r[2] = (m) => $.value = !1)
1029
+ onClick: u[2] || (u[2] = (E) => f.value = !1)
828
1030
  }, " 继续填写 "),
829
- e("button", {
1031
+ t("button", {
830
1032
  type: "button",
831
1033
  class: "wi-clarify__btn wi-clarify__btn--danger",
832
- onClick: me
1034
+ onClick: L
833
1035
  }, "确认取消")
834
1036
  ])
835
- ], 64)) : (l(), c(M, { key: 1 }, [
836
- e("button", {
1037
+ ], 64)) : (n(), l(T, { key: 1 }, [
1038
+ t("button", {
837
1039
  type: "button",
838
1040
  class: "wi-clarify__cancel",
839
- onClick: r[3] || (r[3] = (m) => $.value = !0)
1041
+ onClick: u[3] || (u[3] = (E) => f.value = !0)
840
1042
  }, "取消"),
841
- e("div", qs, [
842
- e("button", {
1043
+ t("div", hn, [
1044
+ t("button", {
843
1045
  type: "button",
844
1046
  class: "wi-clarify__btn wi-clarify__btn--secondary",
845
- disabled: d.value === 0,
846
- onClick: A
847
- }, " 上一项 ", 8, Hs),
848
- d.value < o.value.length - 1 ? (l(), c("button", {
1047
+ disabled: c.value === 0,
1048
+ onClick: F
1049
+ }, " 上一项 ", 8, gn),
1050
+ c.value < a.value.length - 1 ? (n(), l("button", {
849
1051
  key: 0,
850
1052
  type: "button",
851
1053
  class: "wi-clarify__btn wi-clarify__btn--primary",
852
- onClick: L
853
- }, " 下一项 ")) : (l(), c("button", {
1054
+ onClick: W
1055
+ }, " 下一项 ")) : (n(), l("button", {
854
1056
  key: 1,
855
1057
  type: "button",
856
1058
  class: "wi-clarify__btn wi-clarify__btn--primary",
857
- onClick: ye
1059
+ onClick: V
858
1060
  }, "提交全部"))
859
1061
  ])
860
1062
  ], 64))
861
1063
  ])
862
- ], 64)) : (l(), c("div", Ks, [
863
- e("div", Xs, v(t.value.status === "submitted" ? "✓" : t.value.status === "cancelled" ? "—" : "!"), 1),
864
- e("div", Gs, [
865
- e("h4", null, v(t.value.resultMessage || y.value), 1),
866
- t.value.status === "submitted" && ((f = t.value.answers) != null && f.length) ? (l(), c("div", Ws, [
867
- (l(!0), c(M, null, B(t.value.answers, (m) => (l(), c("div", {
868
- key: m.id
1064
+ ], 64)) : (n(), l("div", bn, [
1065
+ t("div", kn, k(e.value.status === "submitted" ? "✓" : e.value.status === "cancelled" ? "—" : "!"), 1),
1066
+ t("div", $n, [
1067
+ t("h4", null, k(e.value.resultMessage || m.value), 1),
1068
+ e.value.status === "submitted" && ((h = e.value.answers) != null && h.length) ? (n(), l("div", xn, [
1069
+ (n(!0), l(T, null, j(e.value.answers, (E) => (n(), l("div", {
1070
+ key: E.id
869
1071
  }, [
870
- e("span", null, v(be(m.id)), 1),
871
- e("strong", null, v(m.displayText || "未填写"), 1)
1072
+ t("span", null, k(C(E.id)), 1),
1073
+ t("strong", null, k(E.displayText || "未填写"), 1)
872
1074
  ]))), 128))
873
- ])) : t.value.status === "cancelled" ? (l(), c("p", Ys, "本次确认未提交,工作流将收到取消结果。")) : (l(), c("p", Js, "该确认项已失效,无法再提交。"))
1075
+ ])) : e.value.status === "cancelled" ? (n(), l("p", Sn, "本次确认未提交,工作流将收到取消结果。")) : (n(), l("p", Cn, "该确认项已失效,无法再提交。"))
874
1076
  ])
875
1077
  ])),
876
- b.value ? (l(), c("div", Zs, v(b.value), 1)) : V("", !0)
1078
+ x.value ? (n(), l("div", Mn, k(x.value), 1)) : I("", !0)
877
1079
  ], 2);
878
1080
  };
879
1081
  }
880
- }), en = /* @__PURE__ */ N(Qs, [["__scopeId", "data-v-74053305"]]), tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1082
+ }), In = /* @__PURE__ */ H(En, [["__scopeId", "data-v-c684f993"]]), An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
881
1083
  __proto__: null,
882
- default: en
883
- }, Symbol.toStringTag, { value: "Module" })), he = (n) => (K("data-v-bb5c9850"), n = n(), X(), n), sn = { class: "wi-host-action__head" }, nn = {
1084
+ default: In
1085
+ }, Symbol.toStringTag, { value: "Module" })), On = { class: "wi-host-action__head" }, Tn = {
884
1086
  class: "wi-host-action__icon",
885
1087
  "aria-hidden": "true"
886
- }, on = { class: "wi-host-action__title" }, an = /* @__PURE__ */ he(() => /* @__PURE__ */ e("span", { class: "wi-host-action__label" }, "执行操作", -1)), rn = { class: "wi-host-action__name" }, ln = { class: "wi-host-action__chip" }, cn = { class: "wi-host-action__message" }, un = {
1088
+ }, Pn = { class: "wi-host-action__title" }, Ln = { class: "wi-host-action__name" }, jn = { class: "wi-host-action__chip" }, Vn = { class: "wi-host-action__message" }, Un = {
887
1089
  key: 0,
888
1090
  class: "wi-host-action__args"
889
- }, dn = /* @__PURE__ */ he(() => /* @__PURE__ */ e("summary", null, "查看参数", -1)), _n = /* @__PURE__ */ j({
1091
+ }, Fn = /* @__PURE__ */ D({
890
1092
  __name: "HostActionStatus",
891
1093
  props: {
892
1094
  report: {}
893
1095
  },
894
- setup(n) {
895
- const a = n, u = {
1096
+ setup(o) {
1097
+ const s = o, r = {
896
1098
  id: "",
897
1099
  name: "",
898
1100
  arguments: {},
899
1101
  status: "unknown",
900
1102
  message: "执行状态未知(回答已结束)"
901
- }, t = I(() => a.report.values ?? u), o = I(() => t.value.status === "running" ? "●" : t.value.status === "success" ? "✓" : t.value.status === "error" ? "!" : "?"), d = I(() => t.value.status === "running" ? "执行中" : t.value.status === "success" ? "已完成" : t.value.status === "error" ? "执行失败" : "状态未知"), w = I(() => {
902
- const b = t.value.arguments;
903
- return !!b && typeof b == "object" && Object.keys(b).length > 0;
904
- }), $ = I(() => JSON.stringify(t.value.arguments ?? {}, null, 2));
905
- return (b, g) => (l(), c("section", {
906
- class: D(["wi-host-action", `is-${t.value.status}`])
1103
+ }, e = b(() => s.report.values ?? r), a = b(() => e.value.status === "running" ? "●" : e.value.status === "success" ? "✓" : e.value.status === "error" ? "!" : "?"), c = b(() => e.value.status === "running" ? "执行中" : e.value.status === "success" ? "已完成" : e.value.status === "error" ? "执行失败" : "状态未知"), p = b(() => {
1104
+ const x = e.value.arguments;
1105
+ return !!x && typeof x == "object" && Object.keys(x).length > 0;
1106
+ }), f = b(() => JSON.stringify(e.value.arguments ?? {}, null, 2));
1107
+ return (x, _) => (n(), l("section", {
1108
+ class: X(["wi-host-action", `is-${e.value.status}`])
907
1109
  }, [
908
- e("header", sn, [
909
- e("span", nn, v(o.value), 1),
910
- e("div", on, [
911
- an,
912
- e("code", rn, v(t.value.name || "未知操作"), 1)
1110
+ t("header", On, [
1111
+ t("span", Tn, k(a.value), 1),
1112
+ t("div", Pn, [
1113
+ _[0] || (_[0] = t("span", { class: "wi-host-action__label" }, "执行操作", -1)),
1114
+ t("code", Ln, k(e.value.name || "未知操作"), 1)
913
1115
  ]),
914
- e("span", ln, v(d.value), 1)
1116
+ t("span", jn, k(c.value), 1)
915
1117
  ]),
916
- e("p", cn, v(t.value.message || d.value), 1),
917
- w.value ? (l(), c("details", un, [
918
- dn,
919
- e("pre", null, v($.value), 1)
920
- ])) : V("", !0)
1118
+ t("p", Vn, k(e.value.message || c.value), 1),
1119
+ p.value ? (n(), l("details", Un, [
1120
+ _[1] || (_[1] = t("summary", null, "查看参数", -1)),
1121
+ t("pre", null, k(f.value), 1)
1122
+ ])) : I("", !0)
921
1123
  ], 2));
922
1124
  }
923
- }), pn = /* @__PURE__ */ N(_n, [["__scopeId", "data-v-bb5c9850"]]), fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1125
+ }), Nn = /* @__PURE__ */ H(Fn, [["__scopeId", "data-v-4acb4d02"]]), qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1126
+ __proto__: null,
1127
+ default: Nn
1128
+ }, Symbol.toStringTag, { value: "Module" })), $l = /* @__PURE__ */ D({
1129
+ __name: "TextAnswer",
1130
+ props: {
1131
+ report: {}
1132
+ },
1133
+ setup(o) {
1134
+ const s = o, r = b(() => {
1135
+ var e;
1136
+ return typeof ((e = s.report) == null ? void 0 : e.values) == "string" ? s.report.values : "";
1137
+ });
1138
+ return (e, a) => r.value ? (n(), J(y(Te), {
1139
+ key: 0,
1140
+ class: "wi-text-answer",
1141
+ source: r.value
1142
+ }, null, 8, ["source"])) : I("", !0);
1143
+ }
1144
+ }), Rn = { class: "wi-recordset" }, Bn = { class: "wi-recordset__head" }, zn = {
1145
+ key: 0,
1146
+ class: "wi-recordset__title"
1147
+ }, Dn = {
1148
+ key: 1,
1149
+ class: "wi-recordset__switch"
1150
+ }, Hn = ["viewBox"], Kn = ["x2", "y1", "y2"], Wn = ["x", "y"], Xn = ["points", "stroke"], Gn = ["cx", "cy", "fill"], Yn = ["x", "y", "width", "height", "fill"], Zn = ["x", "y"], Jn = {
1151
+ key: 1,
1152
+ class: "wi-recordset__legend"
1153
+ }, Qn = {
1154
+ key: 2,
1155
+ class: "wi-recordset__table-wrap"
1156
+ }, ea = { class: "wi-recordset__table" }, ta = { key: 0 }, sa = ["colspan"], de = 640, _e = 240, se = 48, Ce = 12, pe = 12, na = 26, aa = /* @__PURE__ */ D({
1157
+ __name: "RecordsetView",
1158
+ props: {
1159
+ report: {}
1160
+ },
1161
+ setup(o) {
1162
+ const s = o, r = ["#6455e7", "#36cfc9", "#ffa940", "#f759ab", "#73d13d", "#40a9ff"], e = b(() => {
1163
+ var g;
1164
+ return (g = s.report) == null ? void 0 : g.values;
1165
+ }), a = b(() => {
1166
+ var g;
1167
+ return (((g = e.value) == null ? void 0 : g.cols) ?? []).map((V, L) => ({ ...V, index: L }));
1168
+ }), c = b(() => {
1169
+ var g;
1170
+ return Array.isArray((g = e.value) == null ? void 0 : g.values) ? e.value.values : [];
1171
+ }), p = b(() => {
1172
+ var g;
1173
+ return Number((g = e.value) == null ? void 0 : g.max_cols) || a.value.length;
1174
+ }), f = b(() => a.value.slice(0, p.value)), x = b(() => a.value.find((g) => g.type === "time")), _ = b(() => a.value.filter((g) => g.type === "value")), w = b(() => a.value.find((g) => g.type === "name")), m = b(() => {
1175
+ var g;
1176
+ return ((g = e.value) == null ? void 0 : g.chart) !== "table" && !!x.value && _.value.length > 0 && c.value.length > 0;
1177
+ }), v = q("chart"), d = b(() => {
1178
+ var g;
1179
+ return String(((g = e.value) == null ? void 0 : g.chart_type) ?? "").includes("bar");
1180
+ }), $ = b(() => {
1181
+ var V;
1182
+ const g = ((V = x.value) == null ? void 0 : V.index) ?? 0;
1183
+ return [...new Set(c.value.map((L) => String((L == null ? void 0 : L[g]) ?? "")))];
1184
+ }), U = b(() => {
1185
+ var C;
1186
+ const g = ((C = x.value) == null ? void 0 : C.index) ?? 0, V = new Map($.value.map((i, u) => [i, u])), L = [];
1187
+ if (w.value && _.value.length) {
1188
+ const i = _.value[0].index, u = /* @__PURE__ */ new Map();
1189
+ c.value.forEach((h) => {
1190
+ const E = String((h == null ? void 0 : h[w.value.index]) ?? "");
1191
+ u.has(E) || u.set(E, new Array($.value.length).fill(null));
1192
+ const z = Number(h == null ? void 0 : h[i]);
1193
+ u.get(E)[V.get(String((h == null ? void 0 : h[g]) ?? ""))] = Number.isFinite(z) ? z : null;
1194
+ }), u.forEach((h, E) => L.push({ name: E, data: h }));
1195
+ } else
1196
+ _.value.forEach((i) => {
1197
+ const u = new Array($.value.length).fill(null);
1198
+ c.value.forEach((h) => {
1199
+ const E = Number(h == null ? void 0 : h[i.index]);
1200
+ u[V.get(String((h == null ? void 0 : h[g]) ?? ""))] = Number.isFinite(E) ? E : null;
1201
+ }), L.push({ name: i.title || i.name || "", data: u });
1202
+ });
1203
+ return L;
1204
+ }), M = b(() => U.value.flatMap((g) => g.data.filter((V) => V !== null))), A = b(() => M.value.length ? Math.min(0, ...M.value) : 0), B = b(() => {
1205
+ const g = M.value.length ? Math.max(...M.value) : 1;
1206
+ return g === A.value ? A.value + 1 : g;
1207
+ }), G = de - se - Ce, P = _e - pe - na, R = (g) => pe + P * g / 4, K = (g) => se + ($.value.length <= 1 ? G / 2 : G * g / ($.value.length - 1)), N = (g) => pe + P - (g - A.value) / (B.value - A.value) * P, S = b(() => {
1208
+ const g = $.value.length || 1, V = G / g, L = Math.max(2, V * 0.7 / Math.max(1, U.value.length));
1209
+ return U.value.map((C, i) => ({
1210
+ name: C.name,
1211
+ points: C.data.map((u, h) => u === null ? null : `${K(h).toFixed(1)},${N(u).toFixed(1)}`).filter(Boolean).join(" "),
1212
+ // 只有一个数据点时折线画不出来,改画圆点
1213
+ dots: C.data.length > 1 ? [] : C.data.filter((u) => u !== null).map((u) => ({ x: K(0), y: N(u) })),
1214
+ bars: C.data.map((u, h) => {
1215
+ const E = u ?? 0, z = N(Math.max(E, 0)), te = Math.abs(N(E) - N(0));
1216
+ return { x: se + V * h + V * 0.15 + L * i, y: z, w: L, h: te };
1217
+ })
1218
+ }));
1219
+ }), F = /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/, W = b(() => {
1220
+ const g = $.value.length, V = Math.max(1, Math.ceil(g / 6));
1221
+ return $.value.map((L, C) => ({ text: F.test(L) ? L.slice(5, 16) : L, x: d.value ? se + G / g * (C + 0.5) : K(C), i: C })).filter((L) => L.i % V === 0);
1222
+ }), O = (g) => Math.abs(g) >= 1e3 ? g.toFixed(0) : Number(g.toFixed(2)).toString(), Z = (g) => g == null ? "" : typeof g == "object" ? JSON.stringify(g) : String(g);
1223
+ return (g, V) => {
1224
+ var L;
1225
+ return n(), l("div", Rn, [
1226
+ t("div", Bn, [
1227
+ (L = e.value) != null && L.title ? (n(), l("span", zn, k(e.value.title), 1)) : I("", !0),
1228
+ m.value ? (n(), l("div", Dn, [
1229
+ t("button", {
1230
+ type: "button",
1231
+ class: X({ "is-active": v.value === "chart" }),
1232
+ onClick: V[0] || (V[0] = (C) => v.value = "chart")
1233
+ }, "图表", 2),
1234
+ t("button", {
1235
+ type: "button",
1236
+ class: X({ "is-active": v.value === "table" }),
1237
+ onClick: V[1] || (V[1] = (C) => v.value = "table")
1238
+ }, "表格", 2)
1239
+ ])) : I("", !0)
1240
+ ]),
1241
+ v.value === "chart" && m.value ? (n(), l("svg", {
1242
+ key: 0,
1243
+ class: "wi-recordset__chart",
1244
+ viewBox: `0 0 ${de} ${_e}`
1245
+ }, [
1246
+ (n(), l(T, null, j(4, (C) => t("line", {
1247
+ key: `g${C}`,
1248
+ x1: se,
1249
+ x2: de - Ce,
1250
+ y1: R(C),
1251
+ y2: R(C),
1252
+ class: "wi-recordset__grid"
1253
+ }, null, 8, Kn)), 64)),
1254
+ (n(), l(T, null, j(5, (C) => t("text", {
1255
+ key: `y${C}`,
1256
+ x: se - 6,
1257
+ y: R(C - 1) + 4,
1258
+ class: "wi-recordset__axis",
1259
+ "text-anchor": "end"
1260
+ }, k(O(B.value - (B.value - A.value) * (C - 1) / 4)), 9, Wn)), 64)),
1261
+ (n(!0), l(T, null, j(S.value, (C, i) => (n(), l(T, { key: i }, [
1262
+ !d.value && !C.dots.length ? (n(), l("polyline", {
1263
+ key: 0,
1264
+ points: C.points,
1265
+ fill: "none",
1266
+ stroke: r[i % r.length],
1267
+ "stroke-width": "2"
1268
+ }, null, 8, Xn)) : !d.value && C.dots.length ? (n(!0), l(T, { key: 1 }, j(C.dots, (u, h) => (n(), l("circle", {
1269
+ key: h,
1270
+ cx: u.x,
1271
+ cy: u.y,
1272
+ r: "3",
1273
+ fill: r[i % r.length]
1274
+ }, null, 8, Gn))), 128)) : (n(!0), l(T, { key: 2 }, j(C.bars, (u, h) => (n(), l("rect", {
1275
+ key: h,
1276
+ x: u.x,
1277
+ y: u.y,
1278
+ width: u.w,
1279
+ height: u.h,
1280
+ fill: r[i % r.length]
1281
+ }, null, 8, Yn))), 128))
1282
+ ], 64))), 128)),
1283
+ (n(!0), l(T, null, j(W.value, (C, i) => (n(), l("text", {
1284
+ key: `x${i}`,
1285
+ x: C.x,
1286
+ y: _e - 6,
1287
+ class: "wi-recordset__axis",
1288
+ "text-anchor": "middle"
1289
+ }, k(C.text), 9, Zn))), 128))
1290
+ ], 8, Hn)) : I("", !0),
1291
+ v.value === "chart" && m.value && S.value.length > 1 ? (n(), l("div", Jn, [
1292
+ (n(!0), l(T, null, j(S.value, (C, i) => (n(), l("span", { key: i }, [
1293
+ t("i", {
1294
+ style: Ae({ background: r[i % r.length] })
1295
+ }, null, 4),
1296
+ Ee(k(C.name), 1)
1297
+ ]))), 128))
1298
+ ])) : I("", !0),
1299
+ v.value === "table" || !m.value ? (n(), l("div", Qn, [
1300
+ t("table", ea, [
1301
+ t("thead", null, [
1302
+ t("tr", null, [
1303
+ (n(!0), l(T, null, j(f.value, (C, i) => (n(), l("th", { key: i }, k(C.title || C.name), 1))), 128))
1304
+ ])
1305
+ ]),
1306
+ t("tbody", null, [
1307
+ (n(!0), l(T, null, j(c.value, (C, i) => (n(), l("tr", { key: i }, [
1308
+ (n(!0), l(T, null, j(f.value, (u, h) => (n(), l("td", { key: h }, k(Z(C == null ? void 0 : C[u.index])), 1))), 128))
1309
+ ]))), 128)),
1310
+ c.value.length ? I("", !0) : (n(), l("tr", ta, [
1311
+ t("td", {
1312
+ colspan: f.value.length || 1,
1313
+ class: "wi-recordset__empty"
1314
+ }, "无数据", 8, sa)
1315
+ ]))
1316
+ ])
1317
+ ])
1318
+ ])) : I("", !0)
1319
+ ]);
1320
+ };
1321
+ }
1322
+ }), la = /* @__PURE__ */ H(aa, [["__scopeId", "data-v-a284a756"]]), oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
924
1323
  __proto__: null,
925
- default: pn
926
- }, Symbol.toStringTag, { value: "Module" }));
1324
+ default: la
1325
+ }, Symbol.toStringTag, { value: "Module" })), Ue = Symbol("wi-chat-answer-render-config"), xl = (o) => {
1326
+ ye(Ue, o);
1327
+ }, Fe = () => fe(Ue, {}), ra = (o, s) => {
1328
+ var r;
1329
+ return s ? o.getFileUrl ? o.getFileUrl(s) : (r = o.api) != null && r.getFileUrl ? o.api.getFileUrl(s) : /^(https?:|blob:|data:|\/)/.test(s) ? s : "" : "";
1330
+ }, ia = { class: "wi-sql-query" }, ua = { class: "wi-sql-query__head" }, ca = ["disabled"], da = {
1331
+ key: 0,
1332
+ class: "wi-sql-query__error"
1333
+ }, _a = {
1334
+ key: 1,
1335
+ class: "wi-sql-query__table-wrap"
1336
+ }, pa = { class: "wi-sql-query__table" }, va = { key: 0 }, fa = ["colspan"], ya = /* @__PURE__ */ D({
1337
+ __name: "SqlQuery",
1338
+ props: {
1339
+ report: {}
1340
+ },
1341
+ setup(o) {
1342
+ var _, w;
1343
+ const s = o, r = Fe(), e = q(((w = (_ = s.report) == null ? void 0 : _.values) == null ? void 0 : w.sql) ?? ""), a = q(!1), c = q(""), p = q(null), f = b(() => {
1344
+ var m;
1345
+ return !!e.value.trim() && !!((m = r.api) != null && m.queryChatSql);
1346
+ }), x = async () => {
1347
+ var m, v, d;
1348
+ if ((m = r.api) != null && m.queryChatSql) {
1349
+ a.value = !0, c.value = "";
1350
+ try {
1351
+ p.value = await r.api.queryChatSql({ ds_id: (d = (v = s.report) == null ? void 0 : v.values) == null ? void 0 : d.ds_id, sql: e.value });
1352
+ } catch ($) {
1353
+ p.value = null, c.value = $ instanceof Error ? $.message : String($);
1354
+ } finally {
1355
+ a.value = !1;
1356
+ }
1357
+ }
1358
+ };
1359
+ return (m, v) => (n(), l("div", ia, [
1360
+ t("div", ua, [
1361
+ v[1] || (v[1] = t("span", { class: "wi-sql-query__label" }, "SQL", -1)),
1362
+ t("button", {
1363
+ type: "button",
1364
+ class: "wi-sql-query__run",
1365
+ disabled: a.value || !f.value,
1366
+ onClick: x
1367
+ }, k(a.value ? "执行中…" : "执行查询"), 9, ca)
1368
+ ]),
1369
+ ve(t("textarea", {
1370
+ "onUpdate:modelValue": v[0] || (v[0] = (d) => e.value = d),
1371
+ class: "wi-sql-query__editor",
1372
+ spellcheck: "false",
1373
+ rows: "6"
1374
+ }, null, 512), [
1375
+ [Oe, e.value]
1376
+ ]),
1377
+ c.value ? (n(), l("div", da, k(c.value), 1)) : p.value ? (n(), l("div", _a, [
1378
+ t("table", pa, [
1379
+ t("thead", null, [
1380
+ t("tr", null, [
1381
+ (n(!0), l(T, null, j(p.value.columns, (d, $) => (n(), l("th", { key: $ }, k(d), 1))), 128))
1382
+ ])
1383
+ ]),
1384
+ t("tbody", null, [
1385
+ (n(!0), l(T, null, j(p.value.values, (d, $) => (n(), l("tr", { key: $ }, [
1386
+ (n(!0), l(T, null, j(p.value.columns, (U, M) => (n(), l("td", { key: M }, k((d == null ? void 0 : d[M]) ?? ""), 1))), 128))
1387
+ ]))), 128)),
1388
+ p.value.values.length ? I("", !0) : (n(), l("tr", va, [
1389
+ t("td", {
1390
+ colspan: p.value.columns.length || 1,
1391
+ class: "wi-sql-query__empty"
1392
+ }, "无数据", 8, fa)
1393
+ ]))
1394
+ ])
1395
+ ])
1396
+ ])) : I("", !0)
1397
+ ]));
1398
+ }
1399
+ }), ma = /* @__PURE__ */ H(ya, [["__scopeId", "data-v-06a8d258"]]), wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1400
+ __proto__: null,
1401
+ default: ma
1402
+ }, Symbol.toStringTag, { value: "Module" })), ha = { class: "wi-dlv" }, ga = {
1403
+ key: 0,
1404
+ class: "wi-dlv__title"
1405
+ }, ba = { class: "wi-dlv__wrap" }, ka = { class: "wi-dlv__table" }, $a = ["title"], xa = { class: "wi-dlv__row-head" }, Sa = ["title"], Ca = {
1406
+ key: 1,
1407
+ class: "wi-dlv__pager"
1408
+ }, Ma = ["disabled"], Ea = ["disabled"], Ia = /* @__PURE__ */ D({
1409
+ __name: "DeviceLastValue",
1410
+ props: {
1411
+ report: {},
1412
+ pageSize: { default: 6 }
1413
+ },
1414
+ setup(o) {
1415
+ const s = o, r = b(() => {
1416
+ var _;
1417
+ return (_ = s.report) == null ? void 0 : _.values;
1418
+ }), e = q(1), a = b(() => {
1419
+ var _, w;
1420
+ return ((w = (_ = r.value) == null ? void 0 : _.values) == null ? void 0 : w.length) ?? 0;
1421
+ }), c = b(() => Math.max(1, Math.ceil(a.value / s.pageSize)));
1422
+ ae([a, () => s.pageSize], () => {
1423
+ e.value > c.value && (e.value = c.value);
1424
+ });
1425
+ const p = b(() => {
1426
+ var _;
1427
+ return (((_ = r.value) == null ? void 0 : _.values) ?? []).slice((e.value - 1) * s.pageSize, e.value * s.pageSize);
1428
+ }), f = (_, w) => {
1429
+ const m = _ == null ? void 0 : _[w.id], v = m && typeof m == "object" ? m.OVALUE : m;
1430
+ return v == null || v === "" ? "-" : w.unit ? `${v} ${w.unit}` : String(v);
1431
+ }, x = (_) => [_.OTYPE && `类型:${_.OTYPE}`, _.ONAME && `编号:${_.ONAME}`, _.OTIME && `时间:${_.OTIME}`].filter(Boolean).join(`
1432
+ `);
1433
+ return (_, w) => {
1434
+ var m, v;
1435
+ return n(), l("div", ha, [
1436
+ (m = r.value) != null && m.title ? (n(), l("div", ga, k(r.value.title), 1)) : I("", !0),
1437
+ t("div", ba, [
1438
+ t("table", ka, [
1439
+ t("thead", null, [
1440
+ t("tr", null, [
1441
+ w[2] || (w[2] = t("th", { class: "wi-dlv__corner" }, null, -1)),
1442
+ (n(!0), l(T, null, j(p.value, (d, $) => (n(), l("th", {
1443
+ key: $,
1444
+ title: x(d)
1445
+ }, k(d.OTITLE || d.ONAME || "-"), 9, $a))), 128))
1446
+ ])
1447
+ ]),
1448
+ t("tbody", null, [
1449
+ (n(!0), l(T, null, j(((v = r.value) == null ? void 0 : v.rows) ?? [], (d) => (n(), l("tr", {
1450
+ key: d.id
1451
+ }, [
1452
+ t("th", xa, k(d.title), 1),
1453
+ (n(!0), l(T, null, j(p.value, ($, U) => (n(), l("td", {
1454
+ key: U,
1455
+ title: x($)
1456
+ }, k(f($, d)), 9, Sa))), 128))
1457
+ ]))), 128))
1458
+ ])
1459
+ ])
1460
+ ]),
1461
+ c.value > 1 ? (n(), l("div", Ca, [
1462
+ t("button", {
1463
+ type: "button",
1464
+ disabled: e.value <= 1,
1465
+ onClick: w[0] || (w[0] = (d) => e.value -= 1)
1466
+ }, "‹", 8, Ma),
1467
+ t("span", null, k(e.value) + " / " + k(c.value) + "(共 " + k(a.value) + " 项)", 1),
1468
+ t("button", {
1469
+ type: "button",
1470
+ disabled: e.value >= c.value,
1471
+ onClick: w[1] || (w[1] = (d) => e.value += 1)
1472
+ }, "›", 8, Ea)
1473
+ ])) : I("", !0)
1474
+ ]);
1475
+ };
1476
+ }
1477
+ }), Aa = /* @__PURE__ */ H(Ia, [["__scopeId", "data-v-37504400"]]), Oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1478
+ __proto__: null,
1479
+ default: Aa
1480
+ }, Symbol.toStringTag, { value: "Module" })), Ta = { class: "wi-media" }, Pa = ["src"], La = {
1481
+ key: 1,
1482
+ class: "wi-media__tip"
1483
+ }, ja = ["src"], Va = { class: "wi-media__tip" }, Ua = {
1484
+ key: 2,
1485
+ class: "wi-media__grid"
1486
+ }, Fa = ["src", "alt"], Na = {
1487
+ key: 1,
1488
+ class: "wi-media__cam-empty"
1489
+ }, qa = { class: "wi-media__cam-name" }, Ra = {
1490
+ key: 3,
1491
+ class: "wi-media__tip"
1492
+ }, Ba = /* @__PURE__ */ D({
1493
+ __name: "MediaAnswer",
1494
+ props: {
1495
+ report: {}
1496
+ },
1497
+ setup(o) {
1498
+ const s = o, r = Fe(), e = (f) => ra(r, f), a = b(() => {
1499
+ var f, x;
1500
+ return e((x = (f = s.report) == null ? void 0 : f.values) == null ? void 0 : x.file_id);
1501
+ }), c = b(() => {
1502
+ var f, x;
1503
+ return e((x = (f = s.report) == null ? void 0 : f.values) == null ? void 0 : x.file_id);
1504
+ }), p = b(() => {
1505
+ var x;
1506
+ const f = (x = s.report) == null ? void 0 : x.values;
1507
+ return Array.isArray(f == null ? void 0 : f.cameras) && f.cameras.length ? f.cameras : String((f == null ? void 0 : f.res_id) ?? "").split(",").filter(Boolean).map((_) => ({ res_id: _ }));
1508
+ });
1509
+ return (f, x) => {
1510
+ var _, w, m;
1511
+ return n(), l("div", Ta, [
1512
+ o.report.answer_type === "video" ? (n(), l(T, { key: 0 }, [
1513
+ a.value ? (n(), l("video", {
1514
+ key: 0,
1515
+ class: "wi-media__video",
1516
+ src: a.value,
1517
+ controls: "",
1518
+ preload: "metadata"
1519
+ }, null, 8, Pa)) : (n(), l("div", La, "视频资源:" + k(((_ = o.report.values) == null ? void 0 : _.model_id) || ((w = o.report.values) == null ? void 0 : w.file_id) || "-"), 1))
1520
+ ], 64)) : o.report.answer_type === "wav" ? (n(), l(T, { key: 1 }, [
1521
+ c.value ? (n(), l("audio", {
1522
+ key: 0,
1523
+ class: "wi-media__audio",
1524
+ src: c.value,
1525
+ controls: "",
1526
+ preload: "metadata"
1527
+ }, null, 8, ja)) : I("", !0),
1528
+ t("div", Va, "声音分析记录:" + k(((m = o.report.values) == null ? void 0 : m.noise_id) || "-"), 1)
1529
+ ], 64)) : o.report.answer_type === "camera" ? (n(), l("div", Ua, [
1530
+ (n(!0), l(T, null, j(p.value, (v, d) => (n(), l("div", {
1531
+ key: d,
1532
+ class: "wi-media__cam"
1533
+ }, [
1534
+ e(v.file_id) ? (n(), l("img", {
1535
+ key: 0,
1536
+ src: e(v.file_id),
1537
+ alt: v.name || v.res_id
1538
+ }, null, 8, Fa)) : (n(), l("div", Na, "无画面")),
1539
+ t("div", qa, k(v.name || v.res_id || `摄像头 ${d + 1}`), 1)
1540
+ ]))), 128))
1541
+ ])) : (n(), l("div", Ra, "暂不支持此操作,请使用插件"))
1542
+ ]);
1543
+ };
1544
+ }
1545
+ }), za = /* @__PURE__ */ H(Ba, [["__scopeId", "data-v-f6c03f9d"]]), Da = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1546
+ __proto__: null,
1547
+ default: za
1548
+ }, Symbol.toStringTag, { value: "Module" })), Ha = { class: "wi-answer-card" }, Ka = ["aria-expanded"], Wa = {
1549
+ key: 1,
1550
+ class: "wi-answer-card__run"
1551
+ }, Xa = {
1552
+ key: 0,
1553
+ class: "wi-answer-card__dot is-running"
1554
+ }, Ga = { key: 1 }, Ya = ["data-wi-md-scope"], Za = { class: "wi-answer-card__step-index" }, Ja = ["innerHTML"], Qa = {
1555
+ key: 3,
1556
+ class: "wi-answer-card__err"
1557
+ }, el = {
1558
+ key: 4,
1559
+ class: "wi-answer-card__err"
1560
+ }, tl = {
1561
+ key: 5,
1562
+ class: "wi-answer-card__body"
1563
+ }, sl = {
1564
+ key: 6,
1565
+ class: "wi-answer-card__typing"
1566
+ }, nl = {
1567
+ key: 7,
1568
+ class: "wi-answer-card__conclusion"
1569
+ }, al = {
1570
+ key: 8,
1571
+ class: "wi-answer-card__stopped"
1572
+ }, ll = {
1573
+ key: 9,
1574
+ class: "wi-answer-card__ask-more"
1575
+ }, ol = ["onClick"], rl = /* @__PURE__ */ D({
1576
+ __name: "AnswerCard",
1577
+ props: {
1578
+ message: {},
1579
+ running: { type: Boolean, default: !1 },
1580
+ contentMap: { default: () => Pe() },
1581
+ showAskMore: { type: Boolean, default: !0 }
1582
+ },
1583
+ emits: ["ask"],
1584
+ setup(o, { emit: s }) {
1585
+ const r = o, e = s, a = b(() => vt(r.message.answer)), c = b(() => r.running && !r.message.stopped && !r.message.error), p = b(() => {
1586
+ var P, R;
1587
+ return ((R = (P = r.message.answer) == null ? void 0 : P.answer) == null ? void 0 : R.reports) ?? [];
1588
+ }), f = b(() => p.value.filter((P) => !!P.answer_type && !!r.contentMap[P.answer_type])), x = q(Date.now());
1589
+ let _ = null;
1590
+ ae(
1591
+ c,
1592
+ (P) => {
1593
+ P && !_ && (x.value = Date.now(), _ = setInterval(() => x.value = Date.now(), 1e3)), !P && _ && (clearInterval(_), _ = null);
1594
+ },
1595
+ { immediate: !0 }
1596
+ ), le(() => _ && clearInterval(_));
1597
+ const w = b(() => {
1598
+ const P = c.value && r.message.runStartAt != null ? x.value - r.message.runStartAt : r.message.runMs;
1599
+ return ft(P) ? P : null;
1600
+ }), m = b(() => r.message.thinking.steps.length > 0), v = b(() => c.value || w.value != null || m.value), d = b(() => {
1601
+ const P = c.value ? "进行中" : r.message.stopped ? "已停止" : "已完成";
1602
+ return w.value == null ? P : `${P},用时 ${yt(w.value)}`;
1603
+ }), $ = () => {
1604
+ r.message.thinking.expanded = !r.message.thinking.expanded;
1605
+ }, U = we(), M = q();
1606
+ let A;
1607
+ ae(M, (P) => {
1608
+ A == null || A(), A = me(P);
1609
+ }), le(() => A == null ? void 0 : A());
1610
+ const B = /* @__PURE__ */ new Map(), G = b(
1611
+ () => r.message.thinking.steps.map((P) => {
1612
+ let R = B.get(P);
1613
+ return R === void 0 && (B.size > 500 && B.clear(), R = he(P, { imageDownload: !1, tableDownload: !1, styleScope: U.selector }), B.set(P, R)), R;
1614
+ })
1615
+ );
1616
+ return (P, R) => {
1617
+ var K;
1618
+ return n(), l("div", Ha, [
1619
+ v.value && m.value ? (n(), l("button", {
1620
+ key: 0,
1621
+ type: "button",
1622
+ class: "wi-answer-card__pill",
1623
+ "aria-expanded": o.message.thinking.expanded,
1624
+ onClick: $
1625
+ }, [
1626
+ t("span", {
1627
+ class: X(["wi-answer-card__dot", { "is-running": c.value }])
1628
+ }, null, 2),
1629
+ t("span", null, k(d.value), 1),
1630
+ t("span", {
1631
+ class: X(["wi-answer-card__caret", { "is-open": o.message.thinking.expanded }])
1632
+ }, "▾", 2)
1633
+ ], 8, Ka)) : v.value ? (n(), l("div", Wa, [
1634
+ c.value ? (n(), l("span", Xa)) : (n(), l("span", Ga, "✓")),
1635
+ t("span", null, k(d.value), 1)
1636
+ ])) : I("", !0),
1637
+ o.message.thinking.expanded && G.value.length ? (n(), l("div", {
1638
+ key: 2,
1639
+ ref_key: "thinkingEl",
1640
+ ref: M,
1641
+ class: "wi-answer-card__thinking",
1642
+ "data-wi-md-scope": y(U).id
1643
+ }, [
1644
+ (n(!0), l(T, null, j(G.value, (N, S) => (n(), l("div", {
1645
+ key: S,
1646
+ class: "wi-answer-card__step"
1647
+ }, [
1648
+ t("span", Za, k(S + 1), 1),
1649
+ t("div", {
1650
+ class: "markdown-it wi-markdown wi-markdown--muted",
1651
+ innerHTML: N
1652
+ }, null, 8, Ja)
1653
+ ]))), 128))
1654
+ ], 8, Ya)) : I("", !0),
1655
+ (K = a.value.err) != null && K.msg ? (n(), l("div", Qa, k(a.value.err.msg), 1)) : I("", !0),
1656
+ o.message.error ? (n(), l("div", el, "回答出错,请重试")) : I("", !0),
1657
+ f.value.length ? (n(), l("div", tl, [
1658
+ (n(!0), l(T, null, j(f.value, (N, S) => (n(), J(Me(o.contentMap[N.answer_type]), {
1659
+ key: S,
1660
+ report: N
1661
+ }, null, 8, ["report"]))), 128))
1662
+ ])) : c.value && !m.value ? (n(), l("div", sl, [...R[0] || (R[0] = [
1663
+ t("span", null, null, -1),
1664
+ t("span", null, null, -1),
1665
+ t("span", null, null, -1)
1666
+ ])])) : I("", !0),
1667
+ a.value.conclusion.length ? (n(), l("div", nl, [
1668
+ (n(!0), l(T, null, j(a.value.conclusion, (N, S) => (n(), J(y(Te), {
1669
+ key: S,
1670
+ source: N.report || ""
1671
+ }, null, 8, ["source"]))), 128))
1672
+ ])) : I("", !0),
1673
+ o.message.stopped ? (n(), l("div", al, "已停止生成")) : I("", !0),
1674
+ o.showAskMore && a.value.contextHistory.length && !c.value ? (n(), l("div", ll, [
1675
+ R[1] || (R[1] = t("div", { class: "wi-answer-card__ask-title" }, "你可以继续问我:", -1)),
1676
+ (n(!0), l(T, null, j(a.value.contextHistory, (N, S) => (n(), l("button", {
1677
+ key: `${N.history_id ?? ""}-${S}`,
1678
+ type: "button",
1679
+ onClick: (F) => e("ask", N.question || "")
1680
+ }, k(N.question), 9, ol))), 128))
1681
+ ])) : I("", !0),
1682
+ We(P.$slots, "footer", { running: c.value }, void 0, !0)
1683
+ ]);
1684
+ };
1685
+ }
1686
+ }), Sl = /* @__PURE__ */ H(rl, [["__scopeId", "data-v-5e57acb8"]]), il = { class: "wi-answer-toolbar" }, ul = {
1687
+ key: 2,
1688
+ class: "wi-answer-toolbar__toast"
1689
+ }, cl = {
1690
+ key: 3,
1691
+ class: "wi-answer-toolbar__feedback"
1692
+ }, dl = { class: "wi-answer-toolbar__feedback-ops" }, _l = ["disabled"], pl = /* @__PURE__ */ D({
1693
+ __name: "AnswerToolbar",
1694
+ props: {
1695
+ message: {},
1696
+ actions: {},
1697
+ shareable: { type: Boolean, default: !0 }
1698
+ },
1699
+ setup(o) {
1700
+ const s = o, r = b(() => s.actions.stateOf(s.message)), e = q(""), a = q(!1), c = q("");
1701
+ let p = null;
1702
+ const f = (v) => {
1703
+ e.value = v, p && clearTimeout(p), p = setTimeout(() => e.value = "", 2e3);
1704
+ }, x = async () => f(await s.actions.copy(s.message) ? "已复制" : "复制失败"), _ = async (v) => {
1705
+ try {
1706
+ await s.actions.toggleState(s.message, v);
1707
+ } catch (d) {
1708
+ f(d instanceof Error ? d.message : "操作失败");
1709
+ }
1710
+ }, w = async () => {
1711
+ try {
1712
+ await s.actions.feedback(s.message, c.value), c.value = "", a.value = !1, f("感谢您的反馈");
1713
+ } catch (v) {
1714
+ f(v instanceof Error ? v.message : "提交失败");
1715
+ }
1716
+ }, m = async () => {
1717
+ try {
1718
+ await s.actions.share(s.message), f("已复制分享链接");
1719
+ } catch (v) {
1720
+ f(v instanceof Error ? v.message : "分享失败");
1721
+ }
1722
+ };
1723
+ return (v, d) => (n(), l("div", il, [
1724
+ o.actions.canCopy(o.message) ? (n(), l("button", {
1725
+ key: 0,
1726
+ type: "button",
1727
+ title: "复制",
1728
+ onClick: x
1729
+ }, [...d[5] || (d[5] = [
1730
+ t("svg", { viewBox: "0 0 24 24" }, [
1731
+ t("rect", {
1732
+ x: "9",
1733
+ y: "9",
1734
+ width: "11",
1735
+ height: "11",
1736
+ rx: "2"
1737
+ }),
1738
+ t("path", { d: "M5 15V5a2 2 0 0 1 2-2h10" })
1739
+ ], -1)
1740
+ ])])) : I("", !0),
1741
+ o.message.historyId ? (n(), l(T, { key: 1 }, [
1742
+ t("button", {
1743
+ type: "button",
1744
+ title: "点赞",
1745
+ class: X({ "is-active": r.value === "1" }),
1746
+ onClick: d[0] || (d[0] = ($) => _("1"))
1747
+ }, [...d[6] || (d[6] = [
1748
+ t("svg", { viewBox: "0 0 24 24" }, [
1749
+ t("path", { d: "M7 10v11H4V10h3Zm0 0 4-7a2 2 0 0 1 3 2l-1 5h6a2 2 0 0 1 2 2.3l-1.4 7A2 2 0 0 1 17.6 21H7" })
1750
+ ], -1)
1751
+ ])], 2),
1752
+ t("button", {
1753
+ type: "button",
1754
+ title: "点踩",
1755
+ class: X({ "is-active": r.value === "0" }),
1756
+ onClick: d[1] || (d[1] = ($) => _("0"))
1757
+ }, [...d[7] || (d[7] = [
1758
+ t("svg", { viewBox: "0 0 24 24" }, [
1759
+ t("path", { d: "M17 14V3h3v11h-3Zm0 0-4 7a2 2 0 0 1-3-2l1-5H5a2 2 0 0 1-2-2.3l1.4-7A2 2 0 0 1 6.4 3H17" })
1760
+ ], -1)
1761
+ ])], 2),
1762
+ t("button", {
1763
+ type: "button",
1764
+ title: "问题反馈",
1765
+ onClick: d[2] || (d[2] = ($) => a.value = !a.value)
1766
+ }, [...d[8] || (d[8] = [
1767
+ t("svg", { viewBox: "0 0 24 24" }, [
1768
+ t("path", { d: "M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10Z" }),
1769
+ t("path", { d: "M12 7v4M12 14h.01" })
1770
+ ], -1)
1771
+ ])]),
1772
+ o.shareable ? (n(), l("button", {
1773
+ key: 0,
1774
+ type: "button",
1775
+ title: "分享",
1776
+ onClick: m
1777
+ }, [...d[9] || (d[9] = [
1778
+ Xe('<svg viewBox="0 0 24 24" data-v-6ffad29a><circle cx="18" cy="5" r="3" data-v-6ffad29a></circle><circle cx="6" cy="12" r="3" data-v-6ffad29a></circle><circle cx="18" cy="19" r="3" data-v-6ffad29a></circle><path d="m8.6 13.5 6.8 4M15.4 6.5l-6.8 4" data-v-6ffad29a></path></svg>', 1)
1779
+ ])])) : I("", !0)
1780
+ ], 64)) : I("", !0),
1781
+ e.value ? (n(), l("span", ul, k(e.value), 1)) : I("", !0),
1782
+ a.value ? (n(), l("div", cl, [
1783
+ d[10] || (d[10] = t("div", { class: "wi-answer-toolbar__feedback-title" }, "你的反馈将帮助我们优化进步", -1)),
1784
+ ve(t("textarea", {
1785
+ "onUpdate:modelValue": d[3] || (d[3] = ($) => c.value = $),
1786
+ rows: "3",
1787
+ placeholder: "请描述回答存在的问题"
1788
+ }, null, 512), [
1789
+ [Oe, c.value]
1790
+ ]),
1791
+ t("div", dl, [
1792
+ t("button", {
1793
+ type: "button",
1794
+ onClick: d[4] || (d[4] = ($) => a.value = !1)
1795
+ }, "取消"),
1796
+ t("button", {
1797
+ type: "button",
1798
+ class: "is-primary",
1799
+ disabled: !c.value.trim(),
1800
+ onClick: w
1801
+ }, "提交", 8, _l)
1802
+ ])
1803
+ ])) : I("", !0)
1804
+ ]));
1805
+ }
1806
+ }), Cl = /* @__PURE__ */ H(pl, [["__scopeId", "data-v-6ffad29a"]]);
927
1807
  export {
928
- bn as AiAnswerBubble,
929
- en as ClarificationCard,
930
- gn as DeepThinkingSteps,
931
- pn as HostActionStatus,
932
- ps as IframePage,
933
- pt as KnowledgeStreamResult,
934
- ns as OutputFile,
935
- qe as createAnswerContentMap,
936
- ds as injectIframeResizerChild,
937
- Sn as provideIframePageConfig,
938
- kn as provideOutputFileConfig,
939
- cs as resolveIframePlaceholders,
940
- us as useIframePage
1808
+ Ue as ANSWER_RENDER_CONFIG,
1809
+ hl as AiAnswerBubble,
1810
+ Sl as AnswerCard,
1811
+ Cl as AnswerToolbar,
1812
+ In as ClarificationCard,
1813
+ gl as DeepThinkingSteps,
1814
+ Aa as DeviceLastValue,
1815
+ Nn as HostActionStatus,
1816
+ Hs as IframePage,
1817
+ Vt as KnowledgeStreamResult,
1818
+ za as MediaAnswer,
1819
+ Ss as OutputFile,
1820
+ Os as OutputFileLink,
1821
+ js as PresentFiles,
1822
+ la as RecordsetView,
1823
+ ma as SqlQuery,
1824
+ $l as TextAnswer,
1825
+ Pe as createAnswerContentMap,
1826
+ xe as guessMimeType,
1827
+ zs as injectIframeResizerChild,
1828
+ ke as joinLocalAssetPath,
1829
+ xl as provideAnswerRenderConfig,
1830
+ kl as provideIframePageConfig,
1831
+ bl as provideOutputFileConfig,
1832
+ Bt as readLocalFileForPreview,
1833
+ Nt as readLocalFilePath,
1834
+ ra as resolveFileUrl,
1835
+ Rs as resolveIframePlaceholders,
1836
+ Fe as useAnswerRenderConfig,
1837
+ Bs as useIframePage
941
1838
  };
942
1839
  //# sourceMappingURL=index.js.map