wi-chat 0.3.0 → 0.5.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 (75) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.js +129 -123
  3. package/dist/core/useChat.d.ts +11 -3
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.ts +5 -3
  6. package/dist/index.js +101 -68
  7. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +8 -3
  8. package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +5 -0
  9. package/dist/mobile-ui/index.cjs +1 -1
  10. package/dist/mobile-ui/index.d.ts +2 -2
  11. package/dist/mobile-ui/index.js +79 -71
  12. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
  13. package/dist/mobile-ui/style.css +1 -1
  14. package/dist/page-context/extArgs.d.ts +46 -0
  15. package/dist/page-context/index.cjs +2 -0
  16. package/dist/page-context/index.d.ts +18 -0
  17. package/dist/page-context/index.js +48 -0
  18. package/dist/page-context/state.d.ts +10 -0
  19. package/dist/page-context/types.d.ts +218 -0
  20. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +38 -0
  21. package/dist/parser/answerCom/actionExecute/clarification.d.ts +67 -0
  22. package/dist/parser/answerCom/actionExecute/parseActionExecute.d.ts +28 -0
  23. package/dist/parser/answerCom/actionExecute/types.d.ts +153 -0
  24. package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +43 -0
  25. package/dist/parser/answerCom/outputFile/types.d.ts +17 -0
  26. package/dist/parser/index.cjs +2 -2
  27. package/dist/parser/index.d.ts +12 -0
  28. package/dist/parser/index.js +537 -211
  29. package/dist/parser/registry.d.ts +8 -1
  30. package/dist/parser/title.d.ts +27 -0
  31. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +19 -0
  32. package/dist/renderers/index.cjs +1 -1
  33. package/dist/renderers/index.d.ts +4 -0
  34. package/dist/renderers/index.js +796 -143
  35. package/dist/renderers/outputFile/OutputFile.vue.d.ts +19 -0
  36. package/dist/renderers/outputFile/useOutputFile.d.ts +85 -0
  37. package/dist/renderers/style.css +1 -1
  38. package/dist/right-panel/RightPanel.vue.d.ts +43 -0
  39. package/dist/right-panel/RightPanelIcon.vue.d.ts +38 -0
  40. package/dist/right-panel/RightPanelTabs.vue.d.ts +39 -0
  41. package/dist/right-panel/icons.d.ts +48 -0
  42. package/dist/right-panel/index.cjs +2 -0
  43. package/dist/right-panel/index.d.ts +43 -0
  44. package/dist/right-panel/index.js +1004 -0
  45. package/dist/right-panel/panels/index.d.ts +7 -0
  46. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +27 -0
  47. package/dist/right-panel/panels/newtab/defaults.d.ts +6 -0
  48. package/dist/right-panel/panels/newtab/index.d.ts +4 -0
  49. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +28 -0
  50. package/dist/right-panel/panels/web/index.d.ts +4 -0
  51. package/dist/right-panel/panels/web/useWebview.d.ts +59 -0
  52. package/dist/right-panel/registry.d.ts +24 -0
  53. package/dist/right-panel/runtime.d.ts +45 -0
  54. package/dist/right-panel/scope.d.ts +34 -0
  55. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +23 -0
  56. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +48 -0
  57. package/dist/right-panel/style.css +1 -0
  58. package/dist/right-panel/types.d.ts +363 -0
  59. package/dist/right-panel/useRightPanel.d.ts +39 -0
  60. package/dist/right-panel/useRightPanelTabs.d.ts +14 -0
  61. package/dist/tools/index.cjs +4 -4
  62. package/dist/tools/index.d.ts +1 -1
  63. package/dist/tools/index.js +182 -162
  64. package/dist/tools/markdown/index.d.ts +1 -1
  65. package/dist/tools/markdown/renderMarkdown.d.ts +25 -0
  66. package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
  67. package/dist/web-ui/chat/ChatContainer.vue.d.ts +8 -3
  68. package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +5 -0
  69. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +2 -2
  70. package/dist/web-ui/index.cjs +1 -1
  71. package/dist/web-ui/index.d.ts +2 -2
  72. package/dist/web-ui/index.js +428 -408
  73. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +4 -7
  74. package/dist/web-ui/style.css +1 -1
  75. package/package.json +13 -6
@@ -1,243 +1,896 @@
1
1
  import "wi-chat/style.css";
2
- import { defineAsyncComponent as P, defineComponent as v, computed as m, openBlock as l, createElementBlock as i, createElementVNode as u, Fragment as g, renderList as C, createBlock as I, resolveDynamicComponent as x, createCommentVNode as w, createTextVNode as A, pushScopeId as E, popScopeId as T, toDisplayString as S, withDirectives as U, vShow as L, getCurrentInstance as O, inject as B, toValue as b, provide as N, unref as h } from "vue";
3
- import { knowledgeStreamParser as V, iframePageParser as j, IFRAME_RESIZER_CHILD_SCRIPT as F } from "wi-chat/parser";
4
- import { renderMarkdown as R, downloadTableAsExcel as H } from "wi-chat/tools";
5
- import M from "@iframe-resizer/vue/iframe-resizer.vue";
6
- const z = [
7
- { ...V, component: P(() => Promise.resolve().then(() => me)) },
8
- { ...j, component: P(() => Promise.resolve().then(() => Ie)) }
9
- ], G = (n) => {
10
- const t = (o) => {
2
+ import { defineAsyncComponent as J, defineComponent as D, computed as T, openBlock as i, createElementBlock as u, createElementVNode as s, Fragment as M, renderList as F, createBlock as Z, resolveDynamicComponent as ge, createCommentVNode as V, createTextVNode as ke, pushScopeId as Q, popScopeId as ee, unref as l, toDisplayString as m, withDirectives as Se, vShow as $e, getCurrentInstance as ue, inject as ce, toValue as A, ref as L, watch as de, onBeforeUnmount as xe, provide as _e, withKeys as re, withModifiers as te, normalizeClass as q, Teleport as Ie, createVNode as Ce, Transition as Ee, withCtx as Oe, reactive as Te, normalizeStyle as Ve } from "vue";
3
+ import { knowledgeStreamParser as Ue, iframePageParser as Le, outputFileParser as Me, actionExecuteParser as Pe, formatFileSize as je, IFRAME_RESIZER_CHILD_SCRIPT as Re, submitClarification as Ne, cancelClarification as Fe } from "wi-chat/parser";
4
+ import { createStyleScope as pe, renderMarkdown as fe, downloadTableAsExcel as Ae } from "wi-chat/tools";
5
+ import le from "@iframe-resizer/vue/iframe-resizer.vue";
6
+ const De = [
7
+ { ...Ue, component: J(() => Promise.resolve().then(() => _t)) },
8
+ { ...Le, component: J(() => Promise.resolve().then(() => _s)) },
9
+ { ...Me, component: J(() => Promise.resolve().then(() => ss)) },
10
+ // 确认卡片(action_execute → collect_clarifications):解析由内置 actionExecuteParser 完成,
11
+ // 提交/取消经 wi-chat/parser 的 submitClarification / cancelClarification 回传 wait_reply
12
+ { ...Pe, component: J(() => Promise.resolve().then(() => Qs)) }
13
+ ], Be = (n) => {
14
+ const a = (c) => {
11
15
  const r = {};
12
- for (const e of o)
13
- !e.answerType || !e.component || (r[e.answerType] = e.component);
16
+ for (const t of c)
17
+ !t.answerType || !t.component || (r[t.answerType] = t.component);
14
18
  return r;
15
19
  };
16
- return { ...t(z), ...t(n ?? []) };
17
- }, K = (n) => (E("data-v-efad55c8"), n = n(), T(), n), W = { class: "flex justify-start" }, q = { class: "ai-answer-bubble" }, J = {
20
+ return { ...a(De), ...a(n ?? []) };
21
+ }, ze = (n) => (Q("data-v-efad55c8"), n = n(), ee(), n), qe = { class: "flex justify-start" }, Ke = { class: "ai-answer-bubble" }, He = {
18
22
  key: 0,
19
23
  class: "ai-answer-bubble__error"
20
- }, Y = { class: "ai-answer-bubble__body" }, X = {
24
+ }, Xe = { class: "ai-answer-bubble__body" }, Ge = {
21
25
  key: 0,
22
26
  class: "ai-answer-bubble__status"
23
- }, Z = {
27
+ }, We = {
24
28
  key: 2,
25
29
  class: "ai-answer-bubble__status"
26
- }, Q = {
30
+ }, Ye = {
27
31
  key: 3,
28
32
  class: "ai-answer-bubble__loading"
29
- }, ee = /* @__PURE__ */ K(() => /* @__PURE__ */ u("span", { class: "ai-answer-bubble__pulse" }, null, -1)), te = /* @__PURE__ */ v({
33
+ }, Je = /* @__PURE__ */ ze(() => /* @__PURE__ */ s("span", { class: "ai-answer-bubble__pulse" }, null, -1)), Ze = /* @__PURE__ */ D({
30
34
  __name: "AiAnswerBubble",
31
35
  props: {
32
36
  answer: {},
33
37
  error: { type: Boolean, default: !1 },
34
38
  stopped: { type: Boolean, default: !1 },
35
- contentMap: { default: () => G() }
39
+ contentMap: { default: () => Be() }
36
40
  },
37
41
  setup(n) {
38
- const t = n, o = m(() => {
39
- var e, s;
40
- return ((s = (e = t.answer) == null ? void 0 : e.answer) == null ? void 0 : s.reports) ?? [];
41
- }), r = m(() => o.value.filter((e) => t.contentMap[e.answer_type]));
42
- return (e, s) => (l(), i("div", W, [
43
- u("div", q, [
44
- e.error ? (l(), i("div", J, "回答加载失败")) : r.value.length ? (l(), i(g, { key: 1 }, [
45
- u("div", Y, [
46
- (l(!0), i(g, null, C(r.value, (p, a) => (l(), I(x(e.contentMap[p.answer_type]), {
47
- key: a,
48
- report: p
42
+ const a = n, c = T(() => {
43
+ var t, _;
44
+ return ((_ = (t = a.answer) == null ? void 0 : t.answer) == null ? void 0 : _.reports) ?? [];
45
+ }), r = T(() => c.value.filter((t) => a.contentMap[t.answer_type]));
46
+ return (t, _) => (i(), u("div", qe, [
47
+ s("div", Ke, [
48
+ t.error ? (i(), u("div", He, "回答加载失败")) : r.value.length ? (i(), u(M, { key: 1 }, [
49
+ s("div", Xe, [
50
+ (i(!0), u(M, null, F(r.value, (w, x) => (i(), Z(ge(t.contentMap[w.answer_type]), {
51
+ key: x,
52
+ report: w
49
53
  }, null, 8, ["report"]))), 128))
50
54
  ]),
51
- e.stopped ? (l(), i("div", X, "回答已停止")) : w("", !0)
52
- ], 64)) : e.stopped ? (l(), i("div", Z, "回答已停止")) : o.value.length ? w("", !0) : (l(), i("div", Q, [
53
- ee,
54
- A("正在思考...")
55
+ t.stopped ? (i(), u("div", Ge, "回答已停止")) : V("", !0)
56
+ ], 64)) : t.stopped ? (i(), u("div", We, "回答已停止")) : c.value.length ? V("", !0) : (i(), u("div", Ye, [
57
+ Je,
58
+ ke("正在思考...")
55
59
  ]))
56
60
  ])
57
61
  ]));
58
62
  }
59
- }), k = (n, t) => {
60
- const o = n.__vccOpts || n;
61
- for (const [r, e] of t)
62
- o[r] = e;
63
- return o;
64
- }, Te = /* @__PURE__ */ k(te, [["__scopeId", "data-v-efad55c8"]]), ne = (n) => (E("data-v-c6f5cb64"), n = n(), T(), n), re = {
65
- key: 0,
66
- class: "deep-thinking"
67
- }, oe = ["aria-expanded"], se = /* @__PURE__ */ ne(() => /* @__PURE__ */ u("span", { class: "deep-thinking__title" }, "深度思考", -1)), ae = { class: "deep-thinking__count" }, le = { class: "deep-thinking__list" }, ce = { class: "deep-thinking__index" }, ie = ["innerHTML"], de = /* @__PURE__ */ v({
63
+ }), B = (n, a) => {
64
+ const c = n.__vccOpts || n;
65
+ for (const [r, t] of a)
66
+ c[r] = t;
67
+ return c;
68
+ }, an = /* @__PURE__ */ B(Ze, [["__scopeId", "data-v-efad55c8"]]), Qe = (n) => (Q("data-v-de333356"), n = n(), ee(), n), et = ["data-wi-md-scope"], tt = ["aria-expanded"], st = /* @__PURE__ */ Qe(() => /* @__PURE__ */ s("span", { class: "deep-thinking__title" }, "深度思考", -1)), nt = { class: "deep-thinking__count" }, ot = { class: "deep-thinking__list" }, at = { class: "deep-thinking__index" }, rt = ["innerHTML"], lt = /* @__PURE__ */ D({
68
69
  __name: "DeepThinkingSteps",
69
70
  props: {
70
71
  steps: {},
71
72
  expanded: { type: Boolean }
72
73
  },
73
74
  emits: ["update:expanded"],
74
- setup(n, { emit: t }) {
75
- const o = n, r = t, e = { imageDownload: !1, tableDownload: !1 }, s = /* @__PURE__ */ new Map(), p = (c) => {
76
- let d = s.get(c);
77
- return d === void 0 && (s.size > 500 && s.clear(), d = R(c, e), s.set(c, d)), d;
78
- }, a = m(() => o.steps.map(p));
79
- return (c, d) => a.value.length ? (l(), i("div", re, [
80
- u("button", {
75
+ setup(n, { emit: a }) {
76
+ const c = n, r = a, t = { imageDownload: !1, tableDownload: !1 }, _ = pe(), w = { ...t, styleScope: _.selector }, x = /* @__PURE__ */ new Map(), b = (p) => {
77
+ let y = x.get(p);
78
+ return y === void 0 && (x.size > 500 && x.clear(), y = fe(p, w), x.set(p, y)), y;
79
+ }, g = T(() => c.steps.map(b));
80
+ return (p, y) => g.value.length ? (i(), u("div", {
81
+ key: 0,
82
+ class: "deep-thinking",
83
+ "data-wi-md-scope": l(_).id
84
+ }, [
85
+ s("button", {
81
86
  type: "button",
82
87
  class: "deep-thinking__header",
83
- "aria-expanded": c.expanded,
84
- onClick: d[0] || (d[0] = (_) => r("update:expanded", !c.expanded))
88
+ "aria-expanded": p.expanded,
89
+ onClick: y[0] || (y[0] = (k) => r("update:expanded", !p.expanded))
85
90
  }, [
86
- se,
87
- u("span", ae, S(a.value.length), 1),
88
- u("span", null, S(c.expanded ? "收起" : "展开"), 1)
89
- ], 8, oe),
90
- U(u("div", le, [
91
- (l(!0), i(g, null, C(a.value, (_, f) => (l(), i("div", {
92
- key: f,
91
+ st,
92
+ s("span", nt, m(g.value.length), 1),
93
+ s("span", null, m(p.expanded ? "收起" : "展开"), 1)
94
+ ], 8, tt),
95
+ Se(s("div", ot, [
96
+ (i(!0), u(M, null, F(g.value, (k, E) => (i(), u("div", {
97
+ key: E,
93
98
  class: "deep-thinking__item"
94
99
  }, [
95
- u("span", ce, S(f + 1), 1),
96
- u("div", {
100
+ s("span", at, m(E + 1), 1),
101
+ s("div", {
97
102
  class: "markdown-it",
98
- innerHTML: _
99
- }, null, 8, ie)
103
+ innerHTML: k
104
+ }, null, 8, rt)
100
105
  ]))), 128))
101
106
  ], 512), [
102
- [L, c.expanded]
107
+ [$e, p.expanded]
103
108
  ])
104
- ])) : w("", !0);
109
+ ], 8, et)) : V("", !0);
105
110
  }
106
- }), Re = /* @__PURE__ */ k(de, [["__scopeId", "data-v-c6f5cb64"]]), pe = ["innerHTML"], ue = /* @__PURE__ */ v({
111
+ }), rn = /* @__PURE__ */ B(lt, [["__scopeId", "data-v-de333356"]]), it = ["data-wi-md-scope"], ut = ["innerHTML"], ct = /* @__PURE__ */ D({
107
112
  __name: "KnowledgeStreamResult",
108
113
  props: {
109
114
  report: {}
110
115
  },
111
116
  setup(n) {
112
- const t = n, o = { imageDownload: !1, tableDownload: !0 }, r = (a) => {
113
- var f;
114
- const d = a.target.closest(".wi-md-table-download");
115
- if (!d)
117
+ const a = n, c = { imageDownload: !1, tableDownload: !0 }, r = pe(), t = { ...c, styleScope: r.selector }, _ = (g) => {
118
+ var E;
119
+ const y = g.target.closest(".wi-md-table-download");
120
+ if (!y)
116
121
  return;
117
- a.preventDefault(), a.stopPropagation();
118
- const _ = (f = d.closest(".wi-md-table-wrap")) == null ? void 0 : f.querySelector("table");
119
- _ && H(_);
120
- }, e = /* @__PURE__ */ new Map(), s = (a) => {
121
- let c = e.get(a);
122
- return c === void 0 && (e.size > 300 && e.clear(), c = R(a, o), e.set(a, c)), c;
123
- }, p = m(() => (t.report.values || []).map((a) => s(a.answer || "")));
124
- return (a, c) => (l(), i("div", {
122
+ g.preventDefault(), g.stopPropagation();
123
+ const k = (E = y.closest(".wi-md-table-wrap")) == null ? void 0 : E.querySelector("table");
124
+ k && Ae(k);
125
+ }, w = /* @__PURE__ */ new Map(), x = (g) => {
126
+ let p = w.get(g);
127
+ return p === void 0 && (w.size > 300 && w.clear(), p = fe(g, t), w.set(g, p)), p;
128
+ }, b = T(() => (a.report.values || []).map((g) => x(g.answer || "")));
129
+ return (g, p) => (i(), u("div", {
125
130
  class: "knowledge-result",
126
- onClick: r
131
+ "data-wi-md-scope": l(r).id,
132
+ onClick: _
127
133
  }, [
128
- (l(!0), i(g, null, C(p.value, (d, _) => (l(), i("div", {
129
- key: _,
134
+ (i(!0), u(M, null, F(b.value, (y, k) => (i(), u("div", {
135
+ key: k,
130
136
  class: "markdown-it",
131
- innerHTML: d
132
- }, null, 8, pe))), 128))
137
+ innerHTML: y
138
+ }, null, 8, ut))), 128))
139
+ ], 8, it));
140
+ }
141
+ }), dt = /* @__PURE__ */ B(ct, [["__scopeId", "data-v-857bc0d2"]]), _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
142
+ __proto__: null,
143
+ default: dt
144
+ }, Symbol.toStringTag, { value: "Module" })), ve = Symbol("wi-chat-output-file-config"), ln = (n) => {
145
+ _e(ve, n);
146
+ }, pt = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "ico"]), ft = /* @__PURE__ */ new Set(["mp3", "wav", "ogg", "m4a", "aac", "flac"]), vt = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi", "mkv"]), wt = /* @__PURE__ */ new Set(["doc", "docx", "xls", "xlsx", "ppt", "pptx"]), yt = /* @__PURE__ */ new Set(["html", "htm"]), ht = /* @__PURE__ */ new Set([
147
+ "js",
148
+ "mjs",
149
+ "cjs",
150
+ "ts",
151
+ "tsx",
152
+ "jsx",
153
+ "vue",
154
+ "py",
155
+ "java",
156
+ "c",
157
+ "h",
158
+ "cpp",
159
+ "hpp",
160
+ "cs",
161
+ "go",
162
+ "rs",
163
+ "php",
164
+ "rb",
165
+ "sh",
166
+ "bash",
167
+ "bat",
168
+ "ps1",
169
+ "css",
170
+ "scss",
171
+ "less"
172
+ ]), mt = /* @__PURE__ */ new Set([
173
+ "txt",
174
+ "text",
175
+ "md",
176
+ "markdown",
177
+ "json",
178
+ "csv",
179
+ "log",
180
+ "xml",
181
+ "yaml",
182
+ "yml",
183
+ "ini",
184
+ "conf",
185
+ "env",
186
+ "toml",
187
+ "sql"
188
+ ]), bt = 20, N = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Map(), gt = (n, a) => {
189
+ if (!N.has(n) && N.size >= bt) {
190
+ const c = N.keys().next().value;
191
+ c !== void 0 && N.delete(c);
192
+ }
193
+ N.set(n, a);
194
+ }, kt = (n) => {
195
+ const a = n.lastIndexOf(".");
196
+ return a >= 0 ? n.slice(a + 1).toLowerCase() : "";
197
+ }, St = (n) => pt.has(n) ? "image" : n === "pdf" ? "pdf" : yt.has(n) ? "html" : ft.has(n) ? "audio" : vt.has(n) ? "video" : wt.has(n) ? "office" : ht.has(n) ? "code" : mt.has(n) ? "text" : "unknown", $t = (n) => {
198
+ const a = ue() ? ce(ve, {}) : {}, c = T(() => {
199
+ var I;
200
+ const d = A(n);
201
+ return ((I = d == null ? void 0 : d.values) == null ? void 0 : I.file_id) ?? (d == null ? void 0 : d.file_id) ?? "";
202
+ }), r = T(() => {
203
+ var I;
204
+ const d = A(n);
205
+ return ((I = d == null ? void 0 : d.values) == null ? void 0 : I.file_name) ?? (d == null ? void 0 : d.file_name) ?? "未命名文件";
206
+ }), t = T(() => kt(r.value)), _ = T(() => St(t.value)), w = L(!1), x = L(!1), b = L(""), g = L(!1), p = L(""), y = L(""), k = L(null), E = T(() => k.value ? je(k.value.size) : ""), O = () => {
207
+ y.value && typeof URL < "u" && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(y.value), y.value = "";
208
+ }, j = async () => {
209
+ const d = c.value, I = r.value;
210
+ if (!d)
211
+ throw new Error("缺少文件 id,无法加载文件");
212
+ const C = d || I, X = N.get(C);
213
+ if (X)
214
+ return X;
215
+ let R = se.get(C);
216
+ return R || (R = (async () => {
217
+ var G, W;
218
+ if (a.loadFile)
219
+ return a.loadFile(d);
220
+ const P = (G = a.getFileUrl) == null ? void 0 : G.call(a, d);
221
+ if (!P)
222
+ throw new Error("未配置文件加载方式(请提供 loadFile 或 getFileUrl)");
223
+ const v = await fetch(P, { headers: (W = a.getHeaders) == null ? void 0 : W.call(a) });
224
+ if (!v.ok)
225
+ throw new Error(`文件加载失败(HTTP ${v.status})`);
226
+ return v.blob();
227
+ })().then((P) => (gt(C, P), P)).finally(() => se.delete(C)), se.set(C, R)), R;
228
+ }, S = async () => {
229
+ x.value = !0, b.value = "", g.value = !1, p.value = "", O();
230
+ try {
231
+ const d = await j();
232
+ k.value = d;
233
+ const I = _.value;
234
+ if (I === "office") {
235
+ g.value = !0;
236
+ return;
237
+ }
238
+ if (I === "image" || I === "pdf" || I === "audio" || I === "video") {
239
+ typeof URL < "u" && typeof URL.createObjectURL == "function" && (y.value = URL.createObjectURL(d));
240
+ return;
241
+ }
242
+ const C = await d.text();
243
+ if (C.includes("\0")) {
244
+ g.value = !0;
245
+ return;
246
+ }
247
+ p.value = C;
248
+ } catch (d) {
249
+ b.value = d instanceof Error ? d.message : String(d);
250
+ } finally {
251
+ x.value = !1;
252
+ }
253
+ }, $ = async () => {
254
+ if (a.openPreview) {
255
+ a.openPreview({
256
+ fileId: c.value,
257
+ fileName: r.value,
258
+ loadFile: j,
259
+ download: H
260
+ });
261
+ return;
262
+ }
263
+ w.value = !0, await S();
264
+ }, K = () => {
265
+ w.value = !1, x.value = !1, b.value = "", g.value = !1, p.value = "", O();
266
+ }, H = async () => {
267
+ try {
268
+ const d = k.value ?? await j();
269
+ if (k.value = d, a.downloadFile) {
270
+ a.downloadFile({ fileId: c.value, fileName: r.value, blob: d });
271
+ return;
272
+ }
273
+ if (typeof document > "u" || typeof URL > "u")
274
+ return;
275
+ const I = URL.createObjectURL(d), C = document.createElement("a");
276
+ C.href = I, C.download = r.value, document.body.appendChild(C), C.click(), C.remove(), URL.revokeObjectURL(I);
277
+ } catch (d) {
278
+ b.value = d instanceof Error ? d.message : String(d), !w.value && !a.openPreview && (w.value = !0);
279
+ }
280
+ }, z = (d) => {
281
+ d.key === "Escape" && w.value && K();
282
+ };
283
+ return de(w, (d) => {
284
+ typeof window > "u" || (d ? window.addEventListener("keydown", z) : window.removeEventListener("keydown", z));
285
+ }), xe(() => {
286
+ typeof window < "u" && window.removeEventListener("keydown", z), O();
287
+ }), {
288
+ fileId: c,
289
+ fileName: r,
290
+ extension: t,
291
+ previewKind: _,
292
+ fileSize: E,
293
+ visible: w,
294
+ loading: x,
295
+ error: b,
296
+ unsupported: g,
297
+ textContent: p,
298
+ objectUrl: y,
299
+ open: $,
300
+ close: K,
301
+ download: H
302
+ };
303
+ }, oe = (n) => (Q("data-v-f61a91b5"), n = n(), ee(), n), xt = { class: "wi-output-file" }, It = ["aria-label"], Ct = /* @__PURE__ */ oe(() => /* @__PURE__ */ s("svg", {
304
+ viewBox: "0 0 24 24",
305
+ fill: "none",
306
+ stroke: "currentColor",
307
+ "stroke-width": "1.7",
308
+ "stroke-linecap": "round",
309
+ "stroke-linejoin": "round"
310
+ }, [
311
+ /* @__PURE__ */ s("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
312
+ /* @__PURE__ */ s("path", { d: "M14 2.5v4h4" })
313
+ ], -1)), Et = [
314
+ Ct
315
+ ], Ot = { class: "wi-output-file__info" }, Tt = ["title"], Vt = { class: "wi-output-file__meta" }, Ut = { class: "wi-output-file__ext" }, Lt = {
316
+ key: 0,
317
+ class: "wi-output-file__size"
318
+ }, Mt = /* @__PURE__ */ oe(() => /* @__PURE__ */ s("svg", {
319
+ viewBox: "0 0 24 24",
320
+ fill: "none",
321
+ stroke: "currentColor",
322
+ "stroke-width": "1.8",
323
+ "stroke-linecap": "round",
324
+ "stroke-linejoin": "round"
325
+ }, [
326
+ /* @__PURE__ */ s("path", { d: "M12 3v12" }),
327
+ /* @__PURE__ */ s("path", { d: "m7 10 5 5 5-5" }),
328
+ /* @__PURE__ */ s("path", { d: "M5 21h14" })
329
+ ], -1)), Pt = [
330
+ Mt
331
+ ], jt = ["aria-label"], Rt = { class: "wi-output-file-drawer__head" }, Nt = { class: "wi-output-file-drawer__title" }, Ft = { class: "wi-output-file-drawer__ext" }, At = ["title"], Dt = {
332
+ key: 0,
333
+ class: "wi-output-file-drawer__size"
334
+ }, Bt = { class: "wi-output-file-drawer__actions" }, zt = { class: "wi-output-file-drawer__body" }, qt = {
335
+ key: 0,
336
+ class: "wi-output-file-drawer__state"
337
+ }, Kt = {
338
+ key: 1,
339
+ class: "wi-output-file-drawer__state is-error"
340
+ }, Ht = {
341
+ key: 2,
342
+ class: "wi-output-file-drawer__state"
343
+ }, Xt = /* @__PURE__ */ oe(() => /* @__PURE__ */ s("p", null, "该文件类型暂不支持在线预览,请下载后查看。", -1)), Gt = ["src", "alt"], Wt = ["src", "title"], Yt = ["srcdoc", "title"], Jt = ["src"], Zt = ["src"], Qt = {
344
+ key: 8,
345
+ class: "wi-output-file-drawer__text"
346
+ }, es = /* @__PURE__ */ D({
347
+ __name: "OutputFile",
348
+ props: {
349
+ report: {}
350
+ },
351
+ setup(n) {
352
+ const a = n, {
353
+ fileName: c,
354
+ extension: r,
355
+ previewKind: t,
356
+ fileSize: _,
357
+ visible: w,
358
+ loading: x,
359
+ error: b,
360
+ unsupported: g,
361
+ textContent: p,
362
+ objectUrl: y,
363
+ open: k,
364
+ close: E,
365
+ download: O
366
+ } = $t(() => a.report);
367
+ return (j, S) => (i(), u("div", xt, [
368
+ s("div", {
369
+ class: "wi-output-file__card",
370
+ role: "button",
371
+ tabindex: "0",
372
+ "aria-label": `预览文件 ${l(c)}`,
373
+ onClick: S[1] || (S[1] = //@ts-ignore
374
+ (...$) => l(k) && l(k)(...$)),
375
+ onKeydown: [
376
+ S[2] || (S[2] = re(
377
+ //@ts-ignore
378
+ (...$) => l(k) && l(k)(...$),
379
+ ["enter"]
380
+ )),
381
+ S[3] || (S[3] = re(te(
382
+ //@ts-ignore
383
+ (...$) => l(k) && l(k)(...$),
384
+ ["prevent"]
385
+ ), ["space"]))
386
+ ]
387
+ }, [
388
+ s("span", {
389
+ class: q(["wi-output-file__icon", `is-${l(t)}`])
390
+ }, Et, 2),
391
+ s("div", Ot, [
392
+ s("div", {
393
+ class: "wi-output-file__name",
394
+ title: l(c)
395
+ }, m(l(c)), 9, Tt),
396
+ s("div", Vt, [
397
+ s("span", Ut, m(l(r).toUpperCase() || "FILE"), 1),
398
+ l(_) ? (i(), u("span", Lt, m(l(_)), 1)) : V("", !0)
399
+ ])
400
+ ]),
401
+ s("button", {
402
+ type: "button",
403
+ class: "wi-output-file__download",
404
+ title: "下载文件",
405
+ "aria-label": "下载文件",
406
+ onClick: S[0] || (S[0] = te(
407
+ //@ts-ignore
408
+ (...$) => l(O) && l(O)(...$),
409
+ ["stop"]
410
+ ))
411
+ }, Pt)
412
+ ], 40, It),
413
+ (i(), Z(Ie, { to: "body" }, [
414
+ Ce(Ee, { name: "wi-output-file-fade" }, {
415
+ default: Oe(() => [
416
+ l(w) ? (i(), u("div", {
417
+ key: 0,
418
+ class: "wi-output-file-mask",
419
+ onClick: S[8] || (S[8] = te(
420
+ //@ts-ignore
421
+ (...$) => l(E) && l(E)(...$),
422
+ ["self"]
423
+ ))
424
+ }, [
425
+ s("aside", {
426
+ class: "wi-output-file-drawer",
427
+ role: "dialog",
428
+ "aria-modal": "true",
429
+ "aria-label": `预览文件 ${l(c)}`
430
+ }, [
431
+ s("header", Rt, [
432
+ s("div", Nt, [
433
+ s("span", Ft, m(l(r).toUpperCase() || "FILE"), 1),
434
+ s("div", {
435
+ class: "wi-output-file-drawer__name",
436
+ title: l(c)
437
+ }, m(l(c)), 9, At),
438
+ l(_) ? (i(), u("div", Dt, m(l(_)), 1)) : V("", !0)
439
+ ]),
440
+ s("div", Bt, [
441
+ s("button", {
442
+ type: "button",
443
+ class: "wi-output-file-drawer__btn",
444
+ onClick: S[4] || (S[4] = //@ts-ignore
445
+ (...$) => l(O) && l(O)(...$))
446
+ }, "下载"),
447
+ s("button", {
448
+ type: "button",
449
+ class: "wi-output-file-drawer__btn wi-output-file-drawer__btn--close",
450
+ title: "关闭",
451
+ "aria-label": "关闭预览",
452
+ onClick: S[5] || (S[5] = //@ts-ignore
453
+ (...$) => l(E) && l(E)(...$))
454
+ }, " × ")
455
+ ])
456
+ ]),
457
+ s("div", zt, [
458
+ l(x) ? (i(), u("div", qt, "文件加载中…")) : l(b) ? (i(), u("div", Kt, [
459
+ s("p", null, m(l(b)), 1),
460
+ s("button", {
461
+ type: "button",
462
+ class: "wi-output-file-drawer__btn",
463
+ onClick: S[6] || (S[6] = //@ts-ignore
464
+ (...$) => l(O) && l(O)(...$))
465
+ }, "下载文件")
466
+ ])) : l(g) ? (i(), u("div", Ht, [
467
+ Xt,
468
+ s("button", {
469
+ type: "button",
470
+ class: "wi-output-file-drawer__btn",
471
+ onClick: S[7] || (S[7] = //@ts-ignore
472
+ (...$) => l(O) && l(O)(...$))
473
+ }, "下载文件")
474
+ ])) : l(t) === "image" && l(y) ? (i(), u("img", {
475
+ key: 3,
476
+ class: "wi-output-file-drawer__image",
477
+ src: l(y),
478
+ alt: l(c)
479
+ }, null, 8, Gt)) : l(t) === "pdf" && l(y) ? (i(), u("iframe", {
480
+ key: 4,
481
+ class: "wi-output-file-drawer__frame",
482
+ src: l(y),
483
+ title: l(c)
484
+ }, null, 8, Wt)) : l(t) === "html" ? (i(), u("iframe", {
485
+ key: 5,
486
+ class: "wi-output-file-drawer__frame",
487
+ srcdoc: l(p),
488
+ sandbox: "allow-scripts allow-forms allow-modals",
489
+ title: l(c)
490
+ }, null, 8, Yt)) : l(t) === "audio" && l(y) ? (i(), u("audio", {
491
+ key: 6,
492
+ class: "wi-output-file-drawer__media",
493
+ src: l(y),
494
+ controls: ""
495
+ }, null, 8, Jt)) : l(t) === "video" && l(y) ? (i(), u("video", {
496
+ key: 7,
497
+ class: "wi-output-file-drawer__media",
498
+ src: l(y),
499
+ controls: ""
500
+ }, null, 8, Zt)) : (i(), u("pre", Qt, m(l(p)), 1))
501
+ ])
502
+ ], 8, jt)
503
+ ])) : V("", !0)
504
+ ]),
505
+ _: 1
506
+ })
507
+ ]))
133
508
  ]));
134
509
  }
135
- }), _e = /* @__PURE__ */ k(ue, [["__scopeId", "data-v-1827e802"]]), me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
510
+ }), ts = /* @__PURE__ */ B(es, [["__scopeId", "data-v-f61a91b5"]]), ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
136
511
  __proto__: null,
137
- default: _e
138
- }, Symbol.toStringTag, { value: "Module" })), fe = () => {
139
- var t, o;
140
- const n = (o = (t = window == null ? void 0 : window.globalConfig) == null ? void 0 : t.WebApiUrl) == null ? void 0 : o.MainUrl;
512
+ default: ts
513
+ }, Symbol.toStringTag, { value: "Module" })), ns = () => {
514
+ var a, c;
515
+ const n = (c = (a = window == null ? void 0 : window.globalConfig) == null ? void 0 : a.WebApiUrl) == null ? void 0 : c.MainUrl;
141
516
  return typeof n == "string" ? n : "";
142
- }, he = () => window.location.origin + window.location.pathname, y = "access-session", ge = () => {
143
- const n = window.location.pathname.split("/").filter((t) => !!t).join("-");
517
+ }, os = () => window.location.origin + window.location.pathname, ne = "access-session", as = () => {
518
+ const n = window.location.pathname.split("/").filter((a) => !!a).join("-");
144
519
  return n ? `${n}-` : "";
145
- }, we = () => {
146
- const n = `${ge()}${y}`, t = [];
520
+ }, rs = () => {
521
+ const n = `${as()}${ne}`, a = [];
147
522
  for (let r = 0; r < localStorage.length; r++) {
148
- const e = localStorage.key(r);
149
- !e || !e.endsWith(y) || e.slice(0, e.lastIndexOf(":")) !== "wi admin" && (e.endsWith(`x-${y}`) || t.push(e));
523
+ const t = localStorage.key(r);
524
+ !t || !t.endsWith(ne) || t.slice(0, t.lastIndexOf(":")) !== "wi admin" && (t.endsWith(`x-${ne}`) || a.push(t));
150
525
  }
151
- const o = t.find((r) => r.endsWith(n)) ?? t[0];
152
- if (!o)
526
+ const c = a.find((r) => r.endsWith(n)) ?? a[0];
527
+ if (!c)
153
528
  return "";
154
529
  try {
155
- const r = localStorage.getItem(o);
530
+ const r = localStorage.getItem(c);
156
531
  if (!r || r === "undefined")
157
532
  return "";
158
- const e = JSON.parse(r);
159
- return e == null ? "" : String(e);
533
+ const t = JSON.parse(r);
534
+ return t == null ? "" : String(t);
160
535
  } catch {
161
536
  return "";
162
537
  }
163
- }, D = Symbol("wi-chat-iframe-page-config"), De = (n) => {
164
- N(D, n);
165
- }, be = (n, t) => {
166
- const o = (t == null ? void 0 : t.mainUrl) !== void 0 ? String(b(t.mainUrl)) : fe(), r = (t == null ? void 0 : t.token) !== void 0 ? String(b(t.token)) : we();
167
- return n.replace(/\{\{\s*MAIN_URL\s*\}\}/g, o).replace(/\{\{\s*SERVE_URL\s*\}\}/g, he()).replace(/\{\{\s*token\s*\}\}/g, r);
168
- }, ve = (n) => {
169
- const t = O() ? B(D, {}) : {}, o = m(() => {
170
- var p;
171
- const e = b(n), s = ((p = e == null ? void 0 : e.values) == null ? void 0 : p.url) ?? (e == null ? void 0 : e.url) ?? "";
172
- return s ? t.resolveUrl ? t.resolveUrl(s) : be(s, t) : "";
173
- }), r = m(() => {
174
- var s;
175
- const e = b(n);
176
- return ((s = e == null ? void 0 : e.values) == null ? void 0 : s.srcdoc) ?? (e == null ? void 0 : e.srcdoc) ?? "";
538
+ }, we = Symbol("wi-chat-iframe-page-config"), un = (n) => {
539
+ _e(we, n);
540
+ }, ls = (n, a) => {
541
+ const c = (a == null ? void 0 : a.mainUrl) !== void 0 ? String(A(a.mainUrl)) : ns(), r = (a == null ? void 0 : a.token) !== void 0 ? String(A(a.token)) : rs();
542
+ return n.replace(/\{\{\s*MAIN_URL\s*\}\}/g, c).replace(/\{\{\s*SERVE_URL\s*\}\}/g, os()).replace(/\{\{\s*token\s*\}\}/g, r);
543
+ }, is = (n) => {
544
+ const a = ue() ? ce(we, {}) : {}, c = T(() => {
545
+ var w;
546
+ const t = A(n), _ = ((w = t == null ? void 0 : t.values) == null ? void 0 : w.url) ?? (t == null ? void 0 : t.url) ?? "";
547
+ return _ ? a.resolveUrl ? a.resolveUrl(_) : ls(_, a) : "";
548
+ }), r = T(() => {
549
+ var _;
550
+ const t = A(n);
551
+ return ((_ = t == null ? void 0 : t.values) == null ? void 0 : _.srcdoc) ?? (t == null ? void 0 : t.srcdoc) ?? "";
177
552
  });
178
- return { url: o, srcdoc: r };
179
- }, $ = "data-wi-iframe-resizer-child", ke = (n) => {
553
+ return { url: c, srcdoc: r };
554
+ }, ie = "data-wi-iframe-resizer-child", us = (n) => {
180
555
  if (!n)
181
556
  return !1;
182
- let t = null;
557
+ let a = null;
183
558
  try {
184
- t = n.contentDocument;
559
+ a = n.contentDocument;
185
560
  } catch {
186
561
  return !1;
187
562
  }
188
- if (!t)
563
+ if (!a)
189
564
  return !1;
190
- const o = t.head || t.documentElement;
191
- if (!o)
565
+ const c = a.head || a.documentElement;
566
+ if (!c)
192
567
  return !1;
193
- const r = t.defaultView;
194
- if (r != null && r.parentIframe || r != null && r.parentIFrame || t.querySelector(`script[${$}]`))
568
+ const r = a.defaultView;
569
+ if (r != null && r.parentIframe || r != null && r.parentIFrame || a.querySelector(`script[${ie}]`))
195
570
  return !1;
196
- const e = t.createElement("script");
197
- return e.textContent = F, e.setAttribute($, ""), o.appendChild(e), !0;
198
- }, Se = /* @__PURE__ */ v({
571
+ const t = a.createElement("script");
572
+ return t.textContent = Re, t.setAttribute(ie, ""), c.appendChild(t), !0;
573
+ }, cs = /* @__PURE__ */ D({
199
574
  __name: "IframePage",
200
575
  props: {
201
576
  report: {}
202
577
  },
203
578
  setup(n) {
204
- const t = n, { url: o, srcdoc: r } = ve(() => t.report), e = (s) => {
205
- ke(s.target);
579
+ const a = n, { url: c, srcdoc: r } = is(() => a.report), t = (_) => {
580
+ us(_.target);
206
581
  };
207
- return (s, p) => h(o) ? (l(), I(M, {
582
+ return (_, w) => l(c) ? (i(), Z(le, {
208
583
  key: 0,
209
584
  class: "iframe-page__frame iframe-page__frame--url",
210
585
  license: "GPLv3",
211
- src: h(o),
586
+ src: l(c),
212
587
  width: "100%",
213
588
  "warning-timeout": 0,
214
- onLoad: e
215
- }, null, 8, ["src"])) : h(r) ? (l(), I(M, {
589
+ onLoad: t
590
+ }, null, 8, ["src"])) : l(r) ? (i(), Z(le, {
216
591
  key: 1,
217
592
  class: "iframe-page iframe-page--srcdoc",
218
593
  license: "GPLv3",
219
- srcdoc: h(r),
594
+ srcdoc: l(r),
220
595
  width: "100%",
221
596
  frameborder: "no",
222
597
  border: "0",
223
598
  marginwidth: "0",
224
599
  marginheight: "0",
225
600
  scrolling: "no"
226
- }, null, 8, ["srcdoc"])) : w("", !0);
601
+ }, null, 8, ["srcdoc"])) : V("", !0);
602
+ }
603
+ }), ds = /* @__PURE__ */ B(cs, [["__scopeId", "data-v-f4c94a4e"]]), _s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
604
+ __proto__: null,
605
+ default: ds
606
+ }, Symbol.toStringTag, { value: "Module" })), ae = (n) => (Q("data-v-74053305"), n = n(), ee(), n), ps = { class: "wi-clarify__header" }, fs = { class: "wi-clarify__heading" }, vs = /* @__PURE__ */ ae(() => /* @__PURE__ */ s("div", { class: "wi-clarify__eyebrow" }, "需要补充信息", -1)), ws = { class: "wi-clarify__title" }, ys = {
607
+ key: 0,
608
+ class: "wi-clarify__desc"
609
+ }, hs = { class: "wi-clarify__status" }, ms = { class: "wi-clarify__progress" }, bs = { class: "wi-clarify__progress-track" }, gs = {
610
+ key: 0,
611
+ class: "wi-clarify__panel"
612
+ }, ks = { class: "wi-clarify__question" }, Ss = {
613
+ key: 0,
614
+ class: "wi-clarify__question-desc"
615
+ }, $s = {
616
+ key: 1,
617
+ class: "wi-clarify__binding"
618
+ }, xs = {
619
+ key: 2,
620
+ class: "wi-clarify__options"
621
+ }, Is = ["onClick"], Cs = { class: "wi-clarify__option-indicator" }, Es = {
622
+ key: 3,
623
+ class: "wi-clarify__date"
624
+ }, Os = ["for"], Ts = ["id", "value"], Vs = { class: "wi-clarify__text" }, Us = {
625
+ key: 0,
626
+ class: "wi-clarify__or"
627
+ }, Ls = /* @__PURE__ */ ae(() => /* @__PURE__ */ s("span", null, "或者,用自己的话说明", -1)), Ms = [
628
+ Ls
629
+ ], Ps = ["for"], js = ["id", "value", "placeholder"], Rs = {
630
+ class: "wi-clarify__dots",
631
+ "aria-label": "确认问题导航"
632
+ }, Ns = ["aria-label", "onClick"], Fs = { class: "wi-clarify__footer" }, As = /* @__PURE__ */ ae(() => /* @__PURE__ */ s("span", { class: "wi-clarify__confirm-text" }, "取消后本次操作将停止等待这些回答", -1)), Ds = { class: "wi-clarify__actions" }, Bs = { class: "wi-clarify__actions" }, zs = ["disabled"], qs = {
633
+ key: 1,
634
+ class: "wi-clarify__result"
635
+ }, Ks = { class: "wi-clarify__result-icon" }, Hs = { class: "wi-clarify__result-body" }, Xs = {
636
+ key: 0,
637
+ class: "wi-clarify__summary"
638
+ }, Gs = { key: 1 }, Ws = { key: 2 }, Ys = {
639
+ key: 2,
640
+ class: "wi-clarify__feedback"
641
+ }, Js = /* @__PURE__ */ D({
642
+ __name: "ClarificationCard",
643
+ props: {
644
+ report: {}
645
+ },
646
+ setup(n) {
647
+ const a = n, c = {
648
+ requestId: "",
649
+ title: "需要补充信息",
650
+ description: "",
651
+ items: [],
652
+ status: "expired",
653
+ resultMessage: "本次补充信息已失效(回答已结束)"
654
+ }, r = T(() => a.report.values ?? c), t = T(() => r.value.items ?? []), _ = L(0), w = Te({}), x = L(!1), b = L("");
655
+ de(() => {
656
+ var e;
657
+ return (e = r.value) == null ? void 0 : e.requestId;
658
+ }, () => {
659
+ Object.keys(w).forEach((e) => delete w[e]), t.value.forEach((e) => {
660
+ const o = { structuredValue: void 0, structuredValues: [], textValue: "" };
661
+ e.default !== void 0 && (e.input.type === "multi_select" ? o.structuredValues = Array.isArray(e.default) ? [...e.default] : [] : e.input.type === "text" ? o.textValue = String(e.default) : o.structuredValue = e.default), w[e.id] = o;
662
+ }), _.value = 0;
663
+ }, { immediate: !0 });
664
+ const p = (e) => (w[e] || (w[e] = { structuredValue: void 0, structuredValues: [], textValue: "" }), w[e]), y = T(() => {
665
+ var e, o, f;
666
+ return ((e = r.value) == null ? void 0 : e.status) === "submitted" ? "已提交" : ((o = r.value) == null ? void 0 : o.status) === "cancelled" ? "已取消" : ((f = r.value) == null ? void 0 : f.status) === "expired" ? "已失效" : "等待回答";
667
+ }), k = (e) => {
668
+ try {
669
+ const o = JSON.stringify(e);
670
+ return o === void 0 ? String(e) : o;
671
+ } catch {
672
+ return String(e);
673
+ }
674
+ }, E = (e, o) => k(e) === k(o), O = (e, o) => {
675
+ const f = p(e.id);
676
+ return e.input.type === "multi_select" ? f.structuredValues.some((h) => E(h, o)) : E(f.structuredValue, o);
677
+ }, j = (e, o) => {
678
+ const f = p(e.id);
679
+ if (f.textValue = "", e.input.type === "multi_select") {
680
+ const h = f.structuredValues.findIndex((U) => E(U, o));
681
+ h >= 0 ? f.structuredValues.splice(h, 1) : f.structuredValues.push(o);
682
+ return;
683
+ }
684
+ f.structuredValue = o;
685
+ }, S = (e) => {
686
+ var o;
687
+ return ((o = e.target) == null ? void 0 : o.value) ?? "";
688
+ }, $ = (e, o) => {
689
+ const f = p(e.id);
690
+ f.textValue = S(o), e.input.type !== "text" && (f.structuredValue = void 0, f.structuredValues.splice(0));
691
+ }, K = (e, o) => {
692
+ const f = p(e.id);
693
+ f.structuredValue = S(o), f.textValue = "";
694
+ }, H = (e) => {
695
+ const o = p(e.id).structuredValue;
696
+ return o == null ? "" : String(o);
697
+ }, z = (e) => {
698
+ var o;
699
+ return ((o = e.input.textInput) == null ? void 0 : o.placeholder) ?? e.input.placeholder ?? (e.input.type === "text" ? "请输入需要补充的信息" : "例如:使用阀门,或者说明你的具体要求");
700
+ }, d = (e) => {
701
+ const o = e.binding;
702
+ if (!o)
703
+ return "";
704
+ const f = o.actionName ? `动作:${o.actionName}` : "", h = o.parameterPath ? `参数:${o.parameterPath}` : "";
705
+ return [f, h].filter(Boolean).join(" · ");
706
+ }, I = (e) => {
707
+ const o = p(e.id);
708
+ return e.input.type === "multi_select" ? o.structuredValues.length > 0 : e.input.type === "single_select" ? o.structuredValue !== void 0 : e.input.type === "date" ? !!o.structuredValue : !1;
709
+ }, C = (e) => !!p(e.id).textValue.trim() || I(e), X = (e) => !e.required || C(e) ? !0 : (b.value = `请回答“${e.question}”`, !1), R = () => {
710
+ b.value = "", _.value = Math.max(0, _.value - 1);
711
+ }, P = () => {
712
+ !v.value || !X(v.value) || (b.value = "", _.value = Math.min(t.value.length - 1, _.value + 1));
713
+ }, v = T(() => t.value[_.value]), G = (e, o) => e.input.type === "date" ? String(o ?? "") : (Array.isArray(o) ? o : [o]).map((h) => {
714
+ var Y;
715
+ const U = (Y = e.input.options) == null ? void 0 : Y.find((be) => E(be.value, h));
716
+ return (U == null ? void 0 : U.label) ?? String(h ?? "");
717
+ }).filter(Boolean).join("、"), W = (e) => {
718
+ const o = p(e.id), f = o.textValue.trim();
719
+ if (e.input.type === "text" || f || !I(e))
720
+ return { id: e.id, mode: "text", value: f, displayText: f };
721
+ const h = e.input.type === "multi_select" ? [...o.structuredValues] : o.structuredValue;
722
+ return {
723
+ id: e.id,
724
+ mode: "structured",
725
+ value: h,
726
+ displayText: G(e, h)
727
+ };
728
+ }, ye = () => {
729
+ const e = t.value.findIndex((f) => f.required && !C(f));
730
+ if (e >= 0) {
731
+ _.value = e, b.value = `请回答“${t.value[e].question}”`;
732
+ return;
733
+ }
734
+ b.value = "";
735
+ const o = t.value.map(W);
736
+ Ne(r.value.requestId, o) || (b.value = "本次补充信息已经处理");
737
+ }, he = () => {
738
+ x.value = !1, b.value = "", Fe(r.value.requestId) || (b.value = "本次补充信息已经处理");
739
+ }, me = (e) => {
740
+ var o;
741
+ return ((o = t.value.find((f) => f.id === e)) == null ? void 0 : o.question) ?? e;
742
+ };
743
+ return (e, o) => {
744
+ var f;
745
+ return i(), u("section", {
746
+ class: q(["wi-clarify", `is-${r.value.status}`])
747
+ }, [
748
+ s("header", ps, [
749
+ s("div", fs, [
750
+ vs,
751
+ s("h3", ws, m(r.value.title), 1),
752
+ r.value.description ? (i(), u("p", ys, m(r.value.description), 1)) : V("", !0)
753
+ ]),
754
+ s("span", hs, m(y.value), 1)
755
+ ]),
756
+ r.value.status === "pending" ? (i(), u(M, { key: 0 }, [
757
+ s("div", ms, [
758
+ s("span", null, "问题 " + m(_.value + 1) + " / " + m(t.value.length), 1),
759
+ s("div", bs, [
760
+ s("span", {
761
+ style: Ve({ width: `${(_.value + 1) / t.value.length * 100}%` })
762
+ }, null, 4)
763
+ ])
764
+ ]),
765
+ v.value ? (i(), u("div", gs, [
766
+ s("div", ks, [
767
+ s("span", {
768
+ class: q(v.value.required ? "wi-clarify__required" : "wi-clarify__optional")
769
+ }, m(v.value.required ? "必填" : "选填"), 3),
770
+ s("h4", null, m(v.value.question), 1)
771
+ ]),
772
+ v.value.description ? (i(), u("p", Ss, m(v.value.description), 1)) : V("", !0),
773
+ d(v.value) ? (i(), u("div", $s, m(d(v.value)), 1)) : V("", !0),
774
+ v.value.input.type === "single_select" || v.value.input.type === "multi_select" ? (i(), u("div", xs, [
775
+ (i(!0), u(M, null, F(v.value.input.options, (h, U) => (i(), u("button", {
776
+ key: U,
777
+ type: "button",
778
+ class: q(["wi-clarify__option", { "is-selected": O(v.value, h.value) }]),
779
+ onClick: (Y) => j(v.value, h.value)
780
+ }, [
781
+ s("span", Cs, m(O(v.value, h.value) ? "✓" : ""), 1),
782
+ s("span", null, m(h.label), 1)
783
+ ], 10, Is))), 128))
784
+ ])) : v.value.input.type === "date" ? (i(), u("div", Es, [
785
+ s("label", {
786
+ for: `wi-clarify-date-${v.value.id}`
787
+ }, "选择日期", 8, Os),
788
+ s("input", {
789
+ id: `wi-clarify-date-${v.value.id}`,
790
+ type: "date",
791
+ value: H(v.value),
792
+ onInput: o[0] || (o[0] = (h) => K(v.value, h))
793
+ }, null, 40, Ts)
794
+ ])) : V("", !0),
795
+ s("div", Vs, [
796
+ v.value.input.type !== "text" ? (i(), u("div", Us, Ms)) : V("", !0),
797
+ s("label", {
798
+ for: `wi-clarify-text-${v.value.id}`
799
+ }, m(v.value.input.type === "text" ? "你的回答" : "自然语言回答"), 9, Ps),
800
+ s("textarea", {
801
+ id: `wi-clarify-text-${v.value.id}`,
802
+ value: p(v.value.id).textValue,
803
+ placeholder: z(v.value),
804
+ rows: "3",
805
+ onInput: o[1] || (o[1] = (h) => $(v.value, h))
806
+ }, null, 40, js)
807
+ ])
808
+ ])) : V("", !0),
809
+ s("div", Rs, [
810
+ (i(!0), u(M, null, F(t.value, (h, U) => (i(), u("button", {
811
+ key: h.id,
812
+ type: "button",
813
+ "aria-label": `查看第 ${U + 1} 个问题`,
814
+ class: q({ "is-active": U === _.value, "is-answered": C(h) }),
815
+ onClick: (Y) => _.value = U
816
+ }, null, 10, Ns))), 128))
817
+ ]),
818
+ s("footer", Fs, [
819
+ x.value ? (i(), u(M, { key: 0 }, [
820
+ As,
821
+ s("div", Ds, [
822
+ s("button", {
823
+ type: "button",
824
+ class: "wi-clarify__btn wi-clarify__btn--secondary",
825
+ onClick: o[2] || (o[2] = (h) => x.value = !1)
826
+ }, " 继续填写 "),
827
+ s("button", {
828
+ type: "button",
829
+ class: "wi-clarify__btn wi-clarify__btn--danger",
830
+ onClick: he
831
+ }, "确认取消")
832
+ ])
833
+ ], 64)) : (i(), u(M, { key: 1 }, [
834
+ s("button", {
835
+ type: "button",
836
+ class: "wi-clarify__cancel",
837
+ onClick: o[3] || (o[3] = (h) => x.value = !0)
838
+ }, "取消"),
839
+ s("div", Bs, [
840
+ s("button", {
841
+ type: "button",
842
+ class: "wi-clarify__btn wi-clarify__btn--secondary",
843
+ disabled: _.value === 0,
844
+ onClick: R
845
+ }, " 上一项 ", 8, zs),
846
+ _.value < t.value.length - 1 ? (i(), u("button", {
847
+ key: 0,
848
+ type: "button",
849
+ class: "wi-clarify__btn wi-clarify__btn--primary",
850
+ onClick: P
851
+ }, " 下一项 ")) : (i(), u("button", {
852
+ key: 1,
853
+ type: "button",
854
+ class: "wi-clarify__btn wi-clarify__btn--primary",
855
+ onClick: ye
856
+ }, "提交全部"))
857
+ ])
858
+ ], 64))
859
+ ])
860
+ ], 64)) : (i(), u("div", qs, [
861
+ s("div", Ks, m(r.value.status === "submitted" ? "✓" : r.value.status === "cancelled" ? "—" : "!"), 1),
862
+ s("div", Hs, [
863
+ s("h4", null, m(r.value.resultMessage || y.value), 1),
864
+ r.value.status === "submitted" && ((f = r.value.answers) != null && f.length) ? (i(), u("div", Xs, [
865
+ (i(!0), u(M, null, F(r.value.answers, (h) => (i(), u("div", {
866
+ key: h.id
867
+ }, [
868
+ s("span", null, m(me(h.id)), 1),
869
+ s("strong", null, m(h.displayText || "未填写"), 1)
870
+ ]))), 128))
871
+ ])) : r.value.status === "cancelled" ? (i(), u("p", Gs, "本次确认未提交,工作流将收到取消结果。")) : (i(), u("p", Ws, "该确认项已失效,无法再提交。"))
872
+ ])
873
+ ])),
874
+ b.value ? (i(), u("div", Ys, m(b.value), 1)) : V("", !0)
875
+ ], 2);
876
+ };
227
877
  }
228
- }), ye = /* @__PURE__ */ k(Se, [["__scopeId", "data-v-f4c94a4e"]]), Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
878
+ }), Zs = /* @__PURE__ */ B(Js, [["__scopeId", "data-v-74053305"]]), Qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
229
879
  __proto__: null,
230
- default: ye
880
+ default: Zs
231
881
  }, Symbol.toStringTag, { value: "Module" }));
232
882
  export {
233
- Te as AiAnswerBubble,
234
- Re as DeepThinkingSteps,
235
- ye as IframePage,
236
- _e as KnowledgeStreamResult,
237
- G as createAnswerContentMap,
238
- ke as injectIframeResizerChild,
239
- De as provideIframePageConfig,
240
- be as resolveIframePlaceholders,
241
- ve as useIframePage
883
+ an as AiAnswerBubble,
884
+ Zs as ClarificationCard,
885
+ rn as DeepThinkingSteps,
886
+ ds as IframePage,
887
+ dt as KnowledgeStreamResult,
888
+ ts as OutputFile,
889
+ Be as createAnswerContentMap,
890
+ us as injectIframeResizerChild,
891
+ un as provideIframePageConfig,
892
+ ln as provideOutputFileConfig,
893
+ ls as resolveIframePlaceholders,
894
+ is as useIframePage
242
895
  };
243
896
  //# sourceMappingURL=index.js.map