@somecat/ai-assist-sdk 1.1.0 → 1.1.1

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.
@@ -1,29 +1,32 @@
1
- import { defineComponent as U, reactive as x, openBlock as g, createElementBlock as p, normalizeClass as z, Fragment as Y, createStaticVNode as St, createCommentVNode as X, renderList as st, createElementVNode as n, createVNode as ct, unref as R, toDisplayString as B, Transition as _t, withCtx as bt, withKeys as Tt, ref as T, nextTick as rt, computed as Z, watch as wt, onMounted as Q, onUnmounted as gt, createBlock as et, withModifiers as ht, Teleport as At, withDirectives as dt, vShow as pt, vModelText as Et, normalizeStyle as Mt, createApp as Rt } from "vue";
2
- import { r as yt, p as kt, s as Dt, u as Nt, c as Ht, g as Pt, a as Lt, b as Ot, d as Bt, e as Wt, f as ut, h as Xt, i as Gt, j as Vt, k as Ft, l as Ct } from "../chunks/index-BGsRRqdb.mjs";
3
- import { r as mt, s as Kt, a as qt, b as Qt, f as zt, c as ot, d as Yt, e as jt, g as Jt, h as Zt, i as xt, j as Ut } from "../chunks/index-C_RXhcQu.mjs";
4
- import { SearchOutlined as It, PlusOutlined as te } from "@ant-design/icons-vue";
5
- const ee = {
1
+ import { defineComponent as q, reactive as J, openBlock as b, createElementBlock as O, normalizeClass as X, Fragment as U, createStaticVNode as he, createCommentVNode as j, renderList as rt, createElementVNode as h, createVNode as G, unref as N, toDisplayString as B, Transition as ge, withCtx as pe, createBlock as z, ref as M, shallowRef as ve, onMounted as W, watch as Pt, onUnmounted as mt, h as $t, nextTick as lt, withKeys as me, computed as et, withModifiers as Ft, Teleport as ye, withDirectives as At, vShow as jt, vModelText as we, normalizeStyle as ke, createApp as be } from "vue";
2
+ import { r as Bt, p as It, u as Ce, c as Ae, g as Se, s as Ee, a as Te, b as xe, d as Re, e as wt, f as Oe, h as Me, i as Pe, j as De, k as te } from "../chunks/index-DctVgLU4.mjs";
3
+ import { SearchOutlined as Le, CheckOutlined as He, CopyOutlined as Ne, RedoOutlined as $e, PlusOutlined as Fe } from "@ant-design/icons-vue";
4
+ import { f as je, s as ct, a as Be, b as Ie, c as Qe, d as _e, e as Ye, g as Ve } from "../chunks/index-Co5SARS3.mjs";
5
+ const We = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACQNJREFUeF7lmwuMlFcVx3/nY1lYYAEX6FJ22fIIUMvDUEAaqA9aSWqCL6oRaQlPoVbUKthqNdZGY6rtsoYaKwSBhhYbU5tYSWykVvDRWgq2AUp4WGCXXSiwPMpz2d2Z65z57rc7+83sPHbv0pq5yWSSmfude+7/3Hven9DFwxgzCPg4MBYYA4wGBgLF9qMcXLSfeuAgcAB4G/i7iJzuShalK4gbYybFNjIXmAmMAzq6jgH2AltjwG0WkV2u+e0oY0l8GGNUokuBRcAtrhm19PYB64G1IqKnptOj0wAYY/oDDwDfBD7UaY6yI3AOWA38UkTOZ/dI6lkdBsAYo88uAH4O6D1/P4bqh4eAjSKi1yXn0SEAjDEVeidjd3N6zit2zQP/Up0jIjW5ks8ZAGOMbvoF4IZcF+vi+aeA2SKiYGQ9cgLAGKMK7imgMOsVru/ERuBrIqKKMquRFQDGmG7A48C3s6L6/k+qAr4rIpFMrGQEwG5ej/xnMxH7gP3/or0SaUHIBoBV/0eSD8ugSkS+k04waQGwd/63HzDJ5srO4nQ6oV0ArLZ/xbXCOwv81xiOG7hkfeTeMdduiMAoka7wpFQx3tGedUgJgLXzb7g0dc3Aq82Gg0YwRn0W/ejy1n8xIJ4wWmBagVCQq5zTz1cTOSWVn5AEgPXw/uHSyWkAtjQYTkdNy36T+A2wEBjkCZ/pKfRwC4L6Bx8Le4ypAFhoAw5ny//xKtQ0RREJpJ+ZdEWB8LleGXV0ZkJtZywSkQ2JP7VZwQY2Go878+33NMLLl6MIgsHEv3XoNWgDiIj+CPptL8edvYXxbl0ujR1GJwZQYQB+HOPtkVxhbW++3u41Zw0XI/7GEwFouf6WgzAgOr+4GywtCSBzxRWPxoDXfbYAHUhE4/lqlyFtbRM8c8ZXckkSDyEQOgAtOvLeAUJ5d2ebV0IaSt8U5BNaToAxZgXwhMul/nkRtr2XGoDg+Ot3qhHYiE/2E25X0bgdK0WkMrhqgYQ0B+c0k7PlLOy82E6YnmQFW69JnDGrMKf09ZhV4nb3wD4R0Rylr5FsDm+n62WeOwl7L2WXp0iwgr5ALHNj+whzSl1zFqc3WXOMAQB6HNL6zB1hYfMJ2H0hOwCS6FtEJvQV5t7YkdUzPrMqpgdWBADsBsZnfCTHCZtqFQD/oWSzlyDmRJEHeFkAPtJPmFee48LZTd8jIhPE5u1PdiJ13e5yG2vgrfOpT0BYCSaZQasDJvYX5msCzv1QxkoVgLtjufvn3dOH9UfhzXMhkbbnCIUZsCfg1hJh0bCu4C5O84sKwI9i0n/UxRLbTumGYe4wKO0B6w7DTusHhJVcayCU3t2dVAJLRsKFZthSB+P6w4R+LriN03hEAXjWVnE6TfUbb0BDM9xVBndXwJqDsFPj3xQ6IOMVsJ7jlAHCstHwYi386Rj06Q5VkzvNakBgswKgYa8Tkgs13jJwx40wbyT8ej/sqPevQJIrnOUepgyE+2+GTYfhleO+ptrgLhm/UwE4EissOLll87b7AHyqDOaPgl/tg9dtabM9O9+iIkOOUeAJTL0Blt8CTx+Cl+v8YGnTJ7JEL/O0owqAVmQHZJ6becZX/urf7JnlsHAMrN4Lr6l96cS4rRS+NQ42HIC/1Pr0N9/ZCYJtHz2jAFxzlfaa87fWE7BkDPxmP2w7EegAP9KNJ4MSckGBCkw6AJbRGUPgvpth3QHYWgeewO9mOAOg0SkAX30V3ms0TB0krBgLzx2BF6pTm8GklFg4PrZ7nH0TzBkOlW/716lvIayb5hYAZ1dg5S6ovgwji+Gxib4FeGyPVYJt8x1JZ6A9R+j74wU1hQ/9Bw5fgoreUKndB25G/Ao4U4JPHoRtJw3dRFh3G/TwYPHrcDVic4EJOdAk/lNoyaICYf1UaIjAkh0QiRpmDBaWj3Kz+1h1O64EnZnB187AL/b7El82UrhrMDxbDc/XpsgChxMiKUKDLw0V5lbAS+/Cmnd8uivHCNO1wcbNiJtBZ45QQxQW74LLzYaSQuGpiaDCX7EbTjSEY4K2ai9IBwZKckiRR+UEKBC4700422joUyCsmwQ9PTe7j7fduHSFla3f18Ezx6JxDmcNFpYOE45egR/sM1xsbgUhXUaoOFYX+OmHYVgvWHvUsOVdtf9wT7nHl8ucbV4JxV1hp8GQnoL79xpOq8QFllV4zCqFugb42SFDzdX0+YGKIuHhUUJZT9hyEtZU+2CW9hCeHC8UuZO+ko0HQ5oCdxoOH7oMDx4wNEb8WsDswcKCct/i//mUYWu94dCVeIDQkgYf1QtmDvL4tE3Ib6w1/OFENP5/gSc8PkYYrTU0d8MPh5WeMcZ5QmT7OUPlEUOTvdQjioT5ZR4ftZHcpQjUa9VOmwYLoY92IAA7LsDTdYYj9qQUiPDgcOF2bcVyO/yEiAWgS1Jib12CnxyOcjmhLjCo0GNqXxheBCXd/VNxtkk3DP++YKhvbL0iqgu+N8xjkvussC7bJiWmroXzpKiuUt8Ea48btp2Ptjp/KVzhsHCn9xOWl3uUOK6SJqzTmhS1p8B5WjxxUwevwkvnDNvPR7nQ3FoWC+oC6gn26+4xrRg+P9BjRE+35z1ErW1a3ALgvDCSaguq0483Qs01Q1Wd4VxzlJFFwg+HdmOo2zpgOgRTFkacl8YyyXDBO9E4ELf2EZ6ocGvf0qydujRmT4HT4mgmAOYdjnDsWpRJvT0qK6wZyPRQ5/9PXRy1AKixcVoeT8fvvUciHGs0cQBWlV+XE5C+PG5BcN4g0R4I91RHqGmMMrmXR1XZdTkB6RskLABqnJ21yKg/U3U6Qq02CQXxj0XkwDXDtag6QcIILYEnhMuFnjC/vzCxyFmXSHYtMhYErcU4aZLafsXw8MnmFq83iPbCpyLcH6Dz9GSsHuzkZGTfJBUw5qpN7nQEvn6imWNNagATRJyiJSbxgHRHeGCAxxeKO60bcm+TSwBBm6Pzs1EyAYT8bZW1+kAvYf42SyeAkJ/t8onaOm9fmAiBkL+vzCQoxvx9aSoBBDXq+fnaXOhK5OeLk2FXNm9fnU0V6eXly9Pthbwf9Nfn/wcCtr9y4amOcAAAAABJRU5ErkJggg==", Xe = {
6
6
  key: 0,
7
7
  class: "message-content ba-markdown"
8
- }, ne = { class: "agent-thought__spinner" }, se = { class: "agent-thought__text" }, oe = ["onClick"], ae = { class: "thinking-block__title" }, ie = {
8
+ }, Ge = { class: "agent-thought__spinner" }, Ue = { class: "agent-thought__text" }, ze = ["onClick"], Je = { class: "thinking-block__title" }, qe = {
9
9
  key: 0,
10
10
  class: "thinking-block__content"
11
- }, le = { key: 2 }, ce = ["innerHTML"], re = {
11
+ }, Ke = { key: 2 }, Ze = ["innerHTML"], tn = {
12
12
  key: 0,
13
13
  class: "streaming-cursor"
14
- }, ue = ["innerHTML"], ve = {
14
+ }, en = ["innerHTML"], nn = {
15
15
  key: 0,
16
16
  class: "streaming-cursor"
17
- }, de = {
17
+ }, sn = {
18
18
  key: 3,
19
19
  class: "message-error"
20
- }, ge = {
20
+ }, on = {
21
21
  key: 4,
22
- class: "message-cost"
23
- }, me = { class: "status-indicator" }, fe = {
22
+ class: "message-toolbar"
23
+ }, an = ["data-tooltip"], rn = {
24
+ class: "tooltip-enhanced",
25
+ "data-tooltip": "重新回答"
26
+ }, ln = {
24
27
  key: 1,
25
28
  class: "message-content"
26
- }, he = /* @__PURE__ */ U({
29
+ }, cn = /* @__PURE__ */ q({
27
30
  __name: "MessageItem",
28
31
  props: {
29
32
  msg: {},
@@ -33,62 +36,63 @@ const ee = {
33
36
  getSegmentDisplayContent: { type: Function },
34
37
  setMessageRef: { type: Function }
35
38
  },
36
- setup(t) {
37
- const a = x(/* @__PURE__ */ new Map());
38
- function o(s) {
39
- a.set(s, a.get(s) !== !0);
40
- }
41
- function l(s) {
42
- const m = [];
43
- s.inputTokens > 0 && m.push(`输入 ${s.inputTokens} tokens`), s.outputTokens > 0 && m.push(`输出 ${s.outputTokens} tokens`);
44
- const c = s.latency >= 1 ? `${s.latency.toFixed(1)}s` : `${Math.round(s.latency * 1e3)}ms`;
45
- return m.push(`耗时 ${c}`), m.join(" · ");
39
+ emits: ["regenerate"],
40
+ setup(t, { emit: s }) {
41
+ const e = J(/* @__PURE__ */ new Map());
42
+ function o(a) {
43
+ e.set(a, e.get(a) !== !0);
46
44
  }
47
- function i(s) {
45
+ const n = J(/* @__PURE__ */ new Map());
46
+ function i(a, c) {
47
+ var f;
48
48
  try {
49
- const { copy: m } = Nt();
50
- m(s.content);
49
+ let r = a.content;
50
+ if (!r && ((f = a.segments) != null && f.length) && (r = a.segments.filter((u) => u.type !== "thinking" && u.type !== "agent_thought").map((u) => u.content).join(`
51
+ `)), r) {
52
+ const { copy: u } = Ce();
53
+ u(r), n.set(c, !0), setTimeout(() => n.set(c, !1), 2e3);
54
+ }
51
55
  } catch {
52
56
  }
53
57
  }
54
- return (s, m) => {
55
- var c;
56
- return g(), p("div", {
57
- class: z(["message", `${t.msg.type}-message`])
58
+ return (a, c) => {
59
+ var f;
60
+ return b(), O("div", {
61
+ class: X(["message", `${t.msg.type}-message`])
58
62
  }, [
59
- t.msg.type === "ai" ? (g(), p(Y, { key: 0 }, [
60
- (t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (g(), p("div", ee, [...m[1] || (m[1] = [
61
- St('<div class="scale-animation-container"><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span></div>', 1)
62
- ])])) : X("", !0),
63
- t.msg.segments && t.msg.segments.length ? (g(), p("div", {
63
+ t.msg.type === "ai" ? (b(), O(U, { key: 0 }, [
64
+ (t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (b(), O("div", Xe, [...c[2] || (c[2] = [
65
+ he('<div class="scale-animation-container"><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span></div>', 1)
66
+ ])])) : j("", !0),
67
+ t.msg.segments && t.msg.segments.length ? (b(), O("div", {
64
68
  key: 1,
65
69
  class: "message-content ba-markdown",
66
- ref: (d) => t.setMessageRef(d, t.index)
70
+ ref: (r) => t.setMessageRef(r, t.index)
67
71
  }, [
68
- (g(!0), p(Y, null, st(t.msg.segments, (d, f) => (g(), p(Y, { key: f }, [
69
- d.type === "agent_thought" ? (g(), p("div", {
72
+ (b(!0), O(U, null, rt(t.msg.segments, (r, u) => (b(), O(U, { key: u }, [
73
+ r.type === "agent_thought" ? (b(), O("div", {
70
74
  key: 0,
71
- class: z(["agent-thought", { "agent-thought--done": d.duration != null }])
75
+ class: X(["agent-thought", { "agent-thought--done": r.duration != null }])
72
76
  }, [
73
- n("span", ne, [
74
- ct(R(It))
77
+ h("span", Ge, [
78
+ G(N(Le))
75
79
  ]),
76
- n("span", se, B(d.duration != null ? "工具调用" : "工具调用中..."), 1)
77
- ], 2)) : d.type === "thinking" ? (g(), p("div", {
80
+ h("span", Ue, B(r.duration != null ? "工具调用" : "工具调用中..."), 1)
81
+ ], 2)) : r.type === "thinking" ? (b(), O("div", {
78
82
  key: 1,
79
- class: z(["thinking-block", {
80
- "thinking-block--expanded": a.get(f) === !0,
81
- "thinking-block--active": d.duration == null
83
+ class: X(["thinking-block", {
84
+ "thinking-block--expanded": e.get(u) === !0,
85
+ "thinking-block--active": r.duration == null
82
86
  }])
83
87
  }, [
84
- n("div", {
88
+ h("div", {
85
89
  class: "thinking-block__header",
86
- onClick: (v) => o(f)
90
+ onClick: (d) => o(u)
87
91
  }, [
88
- m[3] || (m[3] = n("span", { class: "thinking-block__indicator" }, null, -1)),
89
- n("span", ae, B(d.duration != null ? "深度思考" : "深度思考中"), 1),
90
- (g(), p("svg", {
91
- class: z(["thinking-block__arrow", { "thinking-block__arrow--down": a.get(f) === !0 }]),
92
+ c[4] || (c[4] = h("span", { class: "thinking-block__indicator" }, null, -1)),
93
+ h("span", Je, B(r.duration != null ? "深度思考" : "深度思考中"), 1),
94
+ (b(), O("svg", {
95
+ class: X(["thinking-block__arrow", { "thinking-block__arrow--down": e.get(u) === !0 }]),
92
96
  viewBox: "0 0 24 24",
93
97
  width: "14",
94
98
  height: "14",
@@ -97,64 +101,1125 @@ const ee = {
97
101
  "stroke-width": "2.5",
98
102
  "stroke-linecap": "round",
99
103
  "stroke-linejoin": "round"
100
- }, [...m[2] || (m[2] = [
101
- n("polyline", { points: "6 9 12 15 18 9" }, null, -1)
104
+ }, [...c[3] || (c[3] = [
105
+ h("polyline", { points: "6 9 12 15 18 9" }, null, -1)
102
106
  ])], 2))
103
- ], 8, oe),
104
- ct(_t, { name: "thinking-expand" }, {
105
- default: bt(() => [
106
- a.get(f) === !0 ? (g(), p("div", ie, B(d.content), 1)) : X("", !0)
107
+ ], 8, ze),
108
+ G(ge, { name: "thinking-expand" }, {
109
+ default: pe(() => [
110
+ e.get(u) === !0 ? (b(), O("div", qe, B(r.content), 1)) : j("", !0)
107
111
  ]),
108
112
  _: 2
109
113
  }, 1024)
110
- ], 2)) : (g(), p("div", le, [
111
- n("div", {
112
- innerHTML: R(yt)(R(kt)(t.getSegmentDisplayContent(t.index, f, d, t.msg)))
113
- }, null, 8, ce)
114
+ ], 2)) : (b(), O("div", Ke, [
115
+ h("div", {
116
+ innerHTML: N(Bt)(N(It)(t.getSegmentDisplayContent(t.index, u, r, t.msg)))
117
+ }, null, 8, Ze)
114
118
  ]))
115
119
  ], 64))), 128)),
116
- t.msg.status === t.STATUS.ANSWERING ? (g(), p("span", re)) : X("", !0)
117
- ], 512)) : X("", !0),
118
- !((c = t.msg.segments) != null && c.length) && t.msg.content ? (g(), p("div", {
120
+ t.msg.status === t.STATUS.ANSWERING ? (b(), O("span", tn)) : j("", !0)
121
+ ], 512)) : j("", !0),
122
+ !((f = t.msg.segments) != null && f.length) && t.msg.content ? (b(), O("div", {
119
123
  key: 2,
120
124
  class: "message-content ba-markdown",
121
- ref: (d) => t.setMessageRef(d, t.index)
125
+ ref: (r) => t.setMessageRef(r, t.index)
122
126
  }, [
123
- n("div", {
124
- innerHTML: R(yt)(R(kt)(t.displayedContent.get(t.index) ?? t.msg.content))
125
- }, null, 8, ue),
126
- t.msg.status === t.STATUS.ANSWERING ? (g(), p("span", ve)) : X("", !0)
127
- ], 512)) : X("", !0),
128
- t.msg.errorMessage ? (g(), p("div", de, [
129
- m[4] || (m[4] = n("span", { class: "message-error__icon" }, "⚠️", -1)),
130
- n("span", null, B(t.msg.errorMessage), 1)
131
- ])) : X("", !0),
132
- t.msg.cost && t.msg.status !== t.STATUS.ANSWERING && t.msg.status !== t.STATUS.THINKING ? (g(), p("div", ge, B(l(t.msg.cost)), 1)) : X("", !0),
133
- n("div", me, [
134
- n("span", {
135
- onClick: m[0] || (m[0] = (d) => i(t.msg))
136
- }, B(R(Dt)(t.msg.status)), 1)
137
- ])
138
- ], 64)) : (g(), p("div", fe, B(t.msg.content), 1))
127
+ h("div", {
128
+ innerHTML: N(Bt)(N(It)(t.displayedContent.get(t.index) ?? t.msg.content))
129
+ }, null, 8, en),
130
+ t.msg.status === t.STATUS.ANSWERING ? (b(), O("span", nn)) : j("", !0)
131
+ ], 512)) : j("", !0),
132
+ t.msg.errorMessage ? (b(), O("div", sn, [
133
+ c[5] || (c[5] = h("span", { class: "message-error__icon" }, "⚠️", -1)),
134
+ h("span", null, B(t.msg.errorMessage), 1)
135
+ ])) : j("", !0),
136
+ t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (b(), O("div", on, [
137
+ h("div", {
138
+ class: "tooltip-enhanced",
139
+ "data-tooltip": n.get(t.index) ? "已复制" : "复制回答"
140
+ }, [
141
+ n.get(t.index) ? (b(), z(N(He), {
142
+ key: 0,
143
+ class: "message-toolbar__check"
144
+ })) : (b(), z(N(Ne), {
145
+ key: 1,
146
+ onClick: c[0] || (c[0] = (r) => i(t.msg, t.index))
147
+ }))
148
+ ], 8, an),
149
+ h("div", rn, [
150
+ G(N($e), {
151
+ onClick: c[1] || (c[1] = (r) => a.$emit("regenerate"))
152
+ })
153
+ ])
154
+ ])) : j("", !0)
155
+ ], 64)) : (b(), O("div", ln, B(t.msg.content), 1))
139
156
  ], 2);
140
157
  };
141
158
  }
142
- }), pe = { class: "input-container" }, ye = {
159
+ }), ee = /^[a-z0-9]+(-[a-z0-9]+)*$/, kt = (t, s, e, o = "") => {
160
+ const n = t.split(":");
161
+ if (t.slice(0, 1) === "@") {
162
+ if (n.length < 2 || n.length > 3) return null;
163
+ o = n.shift().slice(1);
164
+ }
165
+ if (n.length > 3 || !n.length) return null;
166
+ if (n.length > 1) {
167
+ const c = n.pop(), f = n.pop(), r = {
168
+ provider: n.length > 0 ? n[0] : o,
169
+ prefix: f,
170
+ name: c
171
+ };
172
+ return s && !gt(r) ? null : r;
173
+ }
174
+ const i = n[0], a = i.split("-");
175
+ if (a.length > 1) {
176
+ const c = {
177
+ provider: o,
178
+ prefix: a.shift(),
179
+ name: a.join("-")
180
+ };
181
+ return s && !gt(c) ? null : c;
182
+ }
183
+ if (e && o === "") {
184
+ const c = {
185
+ provider: o,
186
+ prefix: "",
187
+ name: i
188
+ };
189
+ return s && !gt(c, e) ? null : c;
190
+ }
191
+ return null;
192
+ }, gt = (t, s) => t ? !!((s && t.prefix === "" || t.prefix) && t.name) : !1;
193
+ function un(t, s) {
194
+ const e = t.icons, o = t.aliases || /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ Object.create(null);
195
+ function i(a) {
196
+ if (e[a]) return n[a] = [];
197
+ if (!(a in n)) {
198
+ n[a] = null;
199
+ const c = o[a] && o[a].parent, f = c && i(c);
200
+ f && (n[a] = [c].concat(f));
201
+ }
202
+ return n[a];
203
+ }
204
+ return Object.keys(e).concat(Object.keys(o)).forEach(i), n;
205
+ }
206
+ const ne = Object.freeze({
207
+ left: 0,
208
+ top: 0,
209
+ width: 16,
210
+ height: 16
211
+ }), yt = Object.freeze({
212
+ rotate: 0,
213
+ vFlip: !1,
214
+ hFlip: !1
215
+ }), bt = Object.freeze({
216
+ ...ne,
217
+ ...yt
218
+ }), xt = Object.freeze({
219
+ ...bt,
220
+ body: "",
221
+ hidden: !1
222
+ });
223
+ function fn(t, s) {
224
+ const e = {};
225
+ !t.hFlip != !s.hFlip && (e.hFlip = !0), !t.vFlip != !s.vFlip && (e.vFlip = !0);
226
+ const o = ((t.rotate || 0) + (s.rotate || 0)) % 4;
227
+ return o && (e.rotate = o), e;
228
+ }
229
+ function Qt(t, s) {
230
+ const e = fn(t, s);
231
+ for (const o in xt) o in yt ? o in t && !(o in e) && (e[o] = yt[o]) : o in s ? e[o] = s[o] : o in t && (e[o] = t[o]);
232
+ return e;
233
+ }
234
+ function dn(t, s, e) {
235
+ const o = t.icons, n = t.aliases || /* @__PURE__ */ Object.create(null);
236
+ let i = {};
237
+ function a(c) {
238
+ i = Qt(o[c] || n[c], i);
239
+ }
240
+ return a(s), e.forEach(a), Qt(t, i);
241
+ }
242
+ function se(t, s) {
243
+ const e = [];
244
+ if (typeof t != "object" || typeof t.icons != "object") return e;
245
+ t.not_found instanceof Array && t.not_found.forEach((n) => {
246
+ s(n, null), e.push(n);
247
+ });
248
+ const o = un(t);
249
+ for (const n in o) {
250
+ const i = o[n];
251
+ i && (s(n, dn(t, n, i)), e.push(n));
252
+ }
253
+ return e;
254
+ }
255
+ const hn = {
256
+ provider: "",
257
+ aliases: {},
258
+ not_found: {},
259
+ ...ne
260
+ };
261
+ function St(t, s) {
262
+ for (const e in s) if (e in t && typeof t[e] != typeof s[e]) return !1;
263
+ return !0;
264
+ }
265
+ function oe(t) {
266
+ if (typeof t != "object" || t === null) return null;
267
+ const s = t;
268
+ if (typeof s.prefix != "string" || !t.icons || typeof t.icons != "object" || !St(t, hn)) return null;
269
+ const e = s.icons;
270
+ for (const n in e) {
271
+ const i = e[n];
272
+ if (!n || typeof i.body != "string" || !St(i, xt)) return null;
273
+ }
274
+ const o = s.aliases || /* @__PURE__ */ Object.create(null);
275
+ for (const n in o) {
276
+ const i = o[n], a = i.parent;
277
+ if (!n || typeof a != "string" || !e[a] && !o[a] || !St(i, xt)) return null;
278
+ }
279
+ return s;
280
+ }
281
+ const _t = /* @__PURE__ */ Object.create(null);
282
+ function gn(t, s) {
283
+ return {
284
+ provider: t,
285
+ prefix: s,
286
+ icons: /* @__PURE__ */ Object.create(null),
287
+ missing: /* @__PURE__ */ new Set()
288
+ };
289
+ }
290
+ function nt(t, s) {
291
+ const e = _t[t] || (_t[t] = /* @__PURE__ */ Object.create(null));
292
+ return e[s] || (e[s] = gn(t, s));
293
+ }
294
+ function ie(t, s) {
295
+ return oe(s) ? se(s, (e, o) => {
296
+ o ? t.icons[e] = o : t.missing.add(e);
297
+ }) : [];
298
+ }
299
+ function pn(t, s, e) {
300
+ try {
301
+ if (typeof e.body == "string")
302
+ return t.icons[s] = { ...e }, !0;
303
+ } catch {
304
+ }
305
+ return !1;
306
+ }
307
+ let ut = !1;
308
+ function ae(t) {
309
+ return typeof t == "boolean" && (ut = t), ut;
310
+ }
311
+ function vn(t) {
312
+ const s = typeof t == "string" ? kt(t, !0, ut) : t;
313
+ if (s) {
314
+ const e = nt(s.provider, s.prefix), o = s.name;
315
+ return e.icons[o] || (e.missing.has(o) ? null : void 0);
316
+ }
317
+ }
318
+ function mn(t, s) {
319
+ const e = kt(t, !0, ut);
320
+ if (!e) return !1;
321
+ const o = nt(e.provider, e.prefix);
322
+ return s ? pn(o, e.name, s) : (o.missing.add(e.name), !0);
323
+ }
324
+ function yn(t, s) {
325
+ if (typeof t != "object") return !1;
326
+ if (typeof s != "string" && (s = t.provider || ""), ut && !s && !t.prefix) {
327
+ let o = !1;
328
+ return oe(t) && (t.prefix = "", se(t, (n, i) => {
329
+ mn(n, i) && (o = !0);
330
+ })), o;
331
+ }
332
+ const e = t.prefix;
333
+ return gt({
334
+ prefix: e,
335
+ name: "a"
336
+ }) ? !!ie(nt(s, e), t) : !1;
337
+ }
338
+ const re = Object.freeze({
339
+ width: null,
340
+ height: null
341
+ }), le = Object.freeze({
342
+ ...re,
343
+ ...yt
344
+ }), wn = /(-?[0-9.]*[0-9]+[0-9.]*)/g, kn = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
345
+ function Yt(t, s, e) {
346
+ if (s === 1) return t;
347
+ if (e = e || 100, typeof t == "number") return Math.ceil(t * s * e) / e;
348
+ if (typeof t != "string") return t;
349
+ const o = t.split(wn);
350
+ if (o === null || !o.length) return t;
351
+ const n = [];
352
+ let i = o.shift(), a = kn.test(i);
353
+ for (; ; ) {
354
+ if (a) {
355
+ const c = parseFloat(i);
356
+ isNaN(c) ? n.push(i) : n.push(Math.ceil(c * s * e) / e);
357
+ } else n.push(i);
358
+ if (i = o.shift(), i === void 0) return n.join("");
359
+ a = !a;
360
+ }
361
+ }
362
+ function bn(t, s = "defs") {
363
+ let e = "";
364
+ const o = t.indexOf("<" + s);
365
+ for (; o >= 0; ) {
366
+ const n = t.indexOf(">", o), i = t.indexOf("</" + s);
367
+ if (n === -1 || i === -1) break;
368
+ const a = t.indexOf(">", i);
369
+ if (a === -1) break;
370
+ e += t.slice(n + 1, i).trim(), t = t.slice(0, o).trim() + t.slice(a + 1);
371
+ }
372
+ return {
373
+ defs: e,
374
+ content: t
375
+ };
376
+ }
377
+ function Cn(t, s) {
378
+ return t ? "<defs>" + t + "</defs>" + s : s;
379
+ }
380
+ function An(t, s, e) {
381
+ const o = bn(t);
382
+ return Cn(o.defs, s + o.content + e);
383
+ }
384
+ const Sn = (t) => t === "unset" || t === "undefined" || t === "none";
385
+ function En(t, s) {
386
+ const e = {
387
+ ...bt,
388
+ ...t
389
+ }, o = {
390
+ ...le,
391
+ ...s
392
+ }, n = {
393
+ left: e.left,
394
+ top: e.top,
395
+ width: e.width,
396
+ height: e.height
397
+ };
398
+ let i = e.body;
399
+ [e, o].forEach((y) => {
400
+ const v = [], l = y.hFlip, g = y.vFlip;
401
+ let A = y.rotate;
402
+ l ? g ? A += 2 : (v.push("translate(" + (n.width + n.left).toString() + " " + (0 - n.top).toString() + ")"), v.push("scale(-1 1)"), n.top = n.left = 0) : g && (v.push("translate(" + (0 - n.left).toString() + " " + (n.height + n.top).toString() + ")"), v.push("scale(1 -1)"), n.top = n.left = 0);
403
+ let w;
404
+ switch (A < 0 && (A -= Math.floor(A / 4) * 4), A = A % 4, A) {
405
+ case 1:
406
+ w = n.height / 2 + n.top, v.unshift("rotate(90 " + w.toString() + " " + w.toString() + ")");
407
+ break;
408
+ case 2:
409
+ v.unshift("rotate(180 " + (n.width / 2 + n.left).toString() + " " + (n.height / 2 + n.top).toString() + ")");
410
+ break;
411
+ case 3:
412
+ w = n.width / 2 + n.left, v.unshift("rotate(-90 " + w.toString() + " " + w.toString() + ")");
413
+ break;
414
+ }
415
+ A % 2 === 1 && (n.left !== n.top && (w = n.left, n.left = n.top, n.top = w), n.width !== n.height && (w = n.width, n.width = n.height, n.height = w)), v.length && (i = An(i, '<g transform="' + v.join(" ") + '">', "</g>"));
416
+ });
417
+ const a = o.width, c = o.height, f = n.width, r = n.height;
418
+ let u, d;
419
+ a === null ? (d = c === null ? "1em" : c === "auto" ? r : c, u = Yt(d, f / r)) : (u = a === "auto" ? f : a, d = c === null ? Yt(u, r / f) : c === "auto" ? r : c);
420
+ const p = {}, E = (y, v) => {
421
+ Sn(v) || (p[y] = v.toString());
422
+ };
423
+ E("width", u), E("height", d);
424
+ const D = [
425
+ n.left,
426
+ n.top,
427
+ f,
428
+ r
429
+ ];
430
+ return p.viewBox = D.join(" "), {
431
+ attributes: p,
432
+ viewBox: D,
433
+ body: i
434
+ };
435
+ }
436
+ const Tn = /\sid="(\S+)"/g, Vt = /* @__PURE__ */ new Map();
437
+ function xn(t) {
438
+ t = t.replace(/[0-9]+$/, "") || "a";
439
+ const s = Vt.get(t) || 0;
440
+ return Vt.set(t, s + 1), s ? `${t}${s}` : t;
441
+ }
442
+ function Rn(t) {
443
+ const s = [];
444
+ let e;
445
+ for (; e = Tn.exec(t); ) s.push(e[1]);
446
+ if (!s.length) return t;
447
+ const o = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
448
+ return s.forEach((n) => {
449
+ const i = xn(n), a = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
450
+ t = t.replace(new RegExp('([#;"])(' + a + ')([")]|\\.[a-z])', "g"), "$1" + i + o + "$3");
451
+ }), t = t.replace(new RegExp(o, "g"), ""), t;
452
+ }
453
+ const Rt = /* @__PURE__ */ Object.create(null);
454
+ function On(t, s) {
455
+ Rt[t] = s;
456
+ }
457
+ function Ot(t) {
458
+ return Rt[t] || Rt[""];
459
+ }
460
+ function Dt(t) {
461
+ let s;
462
+ if (typeof t.resources == "string") s = [t.resources];
463
+ else if (s = t.resources, !(s instanceof Array) || !s.length) return null;
464
+ return {
465
+ resources: s,
466
+ path: t.path || "/",
467
+ maxURL: t.maxURL || 500,
468
+ rotate: t.rotate || 750,
469
+ timeout: t.timeout || 5e3,
470
+ random: t.random === !0,
471
+ index: t.index || 0,
472
+ dataAfterTimeout: t.dataAfterTimeout !== !1
473
+ };
474
+ }
475
+ const Lt = /* @__PURE__ */ Object.create(null), st = ["https://api.simplesvg.com", "https://api.unisvg.com"], pt = [];
476
+ for (; st.length > 0; ) st.length === 1 || Math.random() > 0.5 ? pt.push(st.shift()) : pt.push(st.pop());
477
+ Lt[""] = Dt({ resources: ["https://api.iconify.design"].concat(pt) });
478
+ function Mn(t, s) {
479
+ const e = Dt(s);
480
+ return e === null ? !1 : (Lt[t] = e, !0);
481
+ }
482
+ function Ht(t) {
483
+ return Lt[t];
484
+ }
485
+ const Pn = () => {
486
+ let t;
487
+ try {
488
+ if (t = fetch, typeof t == "function") return t;
489
+ } catch {
490
+ }
491
+ };
492
+ let Wt = Pn();
493
+ function Dn(t, s) {
494
+ const e = Ht(t);
495
+ if (!e) return 0;
496
+ let o;
497
+ if (!e.maxURL) o = 0;
498
+ else {
499
+ let n = 0;
500
+ e.resources.forEach((a) => {
501
+ n = Math.max(n, a.length);
502
+ });
503
+ const i = s + ".json?icons=";
504
+ o = e.maxURL - n - e.path.length - i.length;
505
+ }
506
+ return o;
507
+ }
508
+ function Ln(t) {
509
+ return t === 404;
510
+ }
511
+ const Hn = (t, s, e) => {
512
+ const o = [], n = Dn(t, s), i = "icons";
513
+ let a = {
514
+ type: i,
515
+ provider: t,
516
+ prefix: s,
517
+ icons: []
518
+ }, c = 0;
519
+ return e.forEach((f, r) => {
520
+ c += f.length + 1, c >= n && r > 0 && (o.push(a), a = {
521
+ type: i,
522
+ provider: t,
523
+ prefix: s,
524
+ icons: []
525
+ }, c = f.length), a.icons.push(f);
526
+ }), o.push(a), o;
527
+ };
528
+ function Nn(t) {
529
+ if (typeof t == "string") {
530
+ const s = Ht(t);
531
+ if (s) return s.path;
532
+ }
533
+ return "/";
534
+ }
535
+ const $n = (t, s, e) => {
536
+ if (!Wt) {
537
+ e("abort", 424);
538
+ return;
539
+ }
540
+ let o = Nn(s.provider);
541
+ switch (s.type) {
542
+ case "icons": {
543
+ const i = s.prefix, a = s.icons.join(","), c = new URLSearchParams({ icons: a });
544
+ o += i + ".json?" + c.toString();
545
+ break;
546
+ }
547
+ case "custom": {
548
+ const i = s.uri;
549
+ o += i.slice(0, 1) === "/" ? i.slice(1) : i;
550
+ break;
551
+ }
552
+ default:
553
+ e("abort", 400);
554
+ return;
555
+ }
556
+ let n = 503;
557
+ Wt(t + o).then((i) => {
558
+ const a = i.status;
559
+ if (a !== 200) {
560
+ setTimeout(() => {
561
+ e(Ln(a) ? "abort" : "next", a);
562
+ });
563
+ return;
564
+ }
565
+ return n = 501, i.json();
566
+ }).then((i) => {
567
+ if (typeof i != "object" || i === null) {
568
+ setTimeout(() => {
569
+ i === 404 ? e("abort", i) : e("next", n);
570
+ });
571
+ return;
572
+ }
573
+ setTimeout(() => {
574
+ e("success", i);
575
+ });
576
+ }).catch(() => {
577
+ e("next", n);
578
+ });
579
+ }, Fn = {
580
+ prepare: Hn,
581
+ send: $n
582
+ };
583
+ function ce(t, s) {
584
+ t.forEach((e) => {
585
+ const o = e.loaderCallbacks;
586
+ o && (e.loaderCallbacks = o.filter((n) => n.id !== s));
587
+ });
588
+ }
589
+ function jn(t) {
590
+ t.pendingCallbacksFlag || (t.pendingCallbacksFlag = !0, setTimeout(() => {
591
+ t.pendingCallbacksFlag = !1;
592
+ const s = t.loaderCallbacks ? t.loaderCallbacks.slice(0) : [];
593
+ if (!s.length) return;
594
+ let e = !1;
595
+ const o = t.provider, n = t.prefix;
596
+ s.forEach((i) => {
597
+ const a = i.icons, c = a.pending.length;
598
+ a.pending = a.pending.filter((f) => {
599
+ if (f.prefix !== n) return !0;
600
+ const r = f.name;
601
+ if (t.icons[r]) a.loaded.push({
602
+ provider: o,
603
+ prefix: n,
604
+ name: r
605
+ });
606
+ else if (t.missing.has(r)) a.missing.push({
607
+ provider: o,
608
+ prefix: n,
609
+ name: r
610
+ });
611
+ else
612
+ return e = !0, !0;
613
+ return !1;
614
+ }), a.pending.length !== c && (e || ce([t], i.id), i.callback(a.loaded.slice(0), a.missing.slice(0), a.pending.slice(0), i.abort));
615
+ });
616
+ }));
617
+ }
618
+ let Bn = 0;
619
+ function In(t, s, e) {
620
+ const o = Bn++, n = ce.bind(null, e, o);
621
+ if (!s.pending.length) return n;
622
+ const i = {
623
+ id: o,
624
+ icons: s,
625
+ callback: t,
626
+ abort: n
627
+ };
628
+ return e.forEach((a) => {
629
+ (a.loaderCallbacks || (a.loaderCallbacks = [])).push(i);
630
+ }), n;
631
+ }
632
+ function Qn(t) {
633
+ const s = {
634
+ loaded: [],
635
+ missing: [],
636
+ pending: []
637
+ }, e = /* @__PURE__ */ Object.create(null);
638
+ t.sort((n, i) => n.provider !== i.provider ? n.provider.localeCompare(i.provider) : n.prefix !== i.prefix ? n.prefix.localeCompare(i.prefix) : n.name.localeCompare(i.name));
639
+ let o = {
640
+ provider: "",
641
+ prefix: "",
642
+ name: ""
643
+ };
644
+ return t.forEach((n) => {
645
+ if (o.name === n.name && o.prefix === n.prefix && o.provider === n.provider) return;
646
+ o = n;
647
+ const i = n.provider, a = n.prefix, c = n.name, f = e[i] || (e[i] = /* @__PURE__ */ Object.create(null)), r = f[a] || (f[a] = nt(i, a));
648
+ let u;
649
+ c in r.icons ? u = s.loaded : a === "" || r.missing.has(c) ? u = s.missing : u = s.pending;
650
+ const d = {
651
+ provider: i,
652
+ prefix: a,
653
+ name: c
654
+ };
655
+ u.push(d);
656
+ }), s;
657
+ }
658
+ function _n(t, s = !0, e = !1) {
659
+ const o = [];
660
+ return t.forEach((n) => {
661
+ const i = typeof n == "string" ? kt(n, s, e) : n;
662
+ i && o.push(i);
663
+ }), o;
664
+ }
665
+ const Yn = {
666
+ resources: [],
667
+ index: 0,
668
+ timeout: 2e3,
669
+ rotate: 750,
670
+ random: !1,
671
+ dataAfterTimeout: !1
672
+ };
673
+ function Vn(t, s, e, o) {
674
+ const n = t.resources.length, i = t.random ? Math.floor(Math.random() * n) : t.index;
675
+ let a;
676
+ if (t.random) {
677
+ let m = t.resources.slice(0);
678
+ for (a = []; m.length > 1; ) {
679
+ const L = Math.floor(Math.random() * m.length);
680
+ a.push(m[L]), m = m.slice(0, L).concat(m.slice(L + 1));
681
+ }
682
+ a = a.concat(m);
683
+ } else a = t.resources.slice(i).concat(t.resources.slice(0, i));
684
+ const c = Date.now();
685
+ let f = "pending", r = 0, u, d = null, p = [], E = [];
686
+ typeof o == "function" && E.push(o);
687
+ function D() {
688
+ d && (clearTimeout(d), d = null);
689
+ }
690
+ function y() {
691
+ f === "pending" && (f = "aborted"), D(), p.forEach((m) => {
692
+ m.status === "pending" && (m.status = "aborted");
693
+ }), p = [];
694
+ }
695
+ function v(m, L) {
696
+ L && (E = []), typeof m == "function" && E.push(m);
697
+ }
698
+ function l() {
699
+ return {
700
+ startTime: c,
701
+ payload: s,
702
+ status: f,
703
+ queriesSent: r,
704
+ queriesPending: p.length,
705
+ subscribe: v,
706
+ abort: y
707
+ };
708
+ }
709
+ function g() {
710
+ f = "failed", E.forEach((m) => {
711
+ m(void 0, u);
712
+ });
713
+ }
714
+ function A() {
715
+ p.forEach((m) => {
716
+ m.status === "pending" && (m.status = "aborted");
717
+ }), p = [];
718
+ }
719
+ function w(m, L, T) {
720
+ const k = L !== "success";
721
+ switch (p = p.filter((C) => C !== m), f) {
722
+ case "pending":
723
+ break;
724
+ case "failed":
725
+ if (k || !t.dataAfterTimeout) return;
726
+ break;
727
+ default:
728
+ return;
729
+ }
730
+ if (L === "abort") {
731
+ u = T, g();
732
+ return;
733
+ }
734
+ if (k) {
735
+ u = T, p.length || (a.length ? S() : g());
736
+ return;
737
+ }
738
+ if (D(), A(), !t.random) {
739
+ const C = t.resources.indexOf(m.resource);
740
+ C !== -1 && C !== t.index && (t.index = C);
741
+ }
742
+ f = "completed", E.forEach((C) => {
743
+ C(T);
744
+ });
745
+ }
746
+ function S() {
747
+ if (f !== "pending") return;
748
+ D();
749
+ const m = a.shift();
750
+ if (m === void 0) {
751
+ if (p.length) {
752
+ d = setTimeout(() => {
753
+ D(), f === "pending" && (A(), g());
754
+ }, t.timeout);
755
+ return;
756
+ }
757
+ g();
758
+ return;
759
+ }
760
+ const L = {
761
+ status: "pending",
762
+ resource: m,
763
+ callback: (T, k) => {
764
+ w(L, T, k);
765
+ }
766
+ };
767
+ p.push(L), r++, d = setTimeout(S, t.rotate), e(m, s, L.callback);
768
+ }
769
+ return setTimeout(S), l;
770
+ }
771
+ function ue(t) {
772
+ const s = {
773
+ ...Yn,
774
+ ...t
775
+ };
776
+ let e = [];
777
+ function o() {
778
+ e = e.filter((a) => a().status === "pending");
779
+ }
780
+ function n(a, c, f) {
781
+ const r = Vn(s, a, c, (u, d) => {
782
+ o(), f && f(u, d);
783
+ });
784
+ return e.push(r), r;
785
+ }
786
+ function i(a) {
787
+ return e.find((c) => a(c)) || null;
788
+ }
789
+ return {
790
+ query: n,
791
+ find: i,
792
+ setIndex: (a) => {
793
+ s.index = a;
794
+ },
795
+ getIndex: () => s.index,
796
+ cleanup: o
797
+ };
798
+ }
799
+ function Xt() {
800
+ }
801
+ const Et = /* @__PURE__ */ Object.create(null);
802
+ function Wn(t) {
803
+ if (!Et[t]) {
804
+ const s = Ht(t);
805
+ if (!s) return;
806
+ Et[t] = {
807
+ config: s,
808
+ redundancy: ue(s)
809
+ };
810
+ }
811
+ return Et[t];
812
+ }
813
+ function Xn(t, s, e) {
814
+ let o, n;
815
+ if (typeof t == "string") {
816
+ const i = Ot(t);
817
+ if (!i)
818
+ return e(void 0, 424), Xt;
819
+ n = i.send;
820
+ const a = Wn(t);
821
+ a && (o = a.redundancy);
822
+ } else {
823
+ const i = Dt(t);
824
+ if (i) {
825
+ o = ue(i);
826
+ const a = Ot(t.resources ? t.resources[0] : "");
827
+ a && (n = a.send);
828
+ }
829
+ }
830
+ return !o || !n ? (e(void 0, 424), Xt) : o.query(s, n, e)().abort;
831
+ }
832
+ function Gt() {
833
+ }
834
+ function Gn(t) {
835
+ t.iconsLoaderFlag || (t.iconsLoaderFlag = !0, setTimeout(() => {
836
+ t.iconsLoaderFlag = !1, jn(t);
837
+ }));
838
+ }
839
+ function Un(t) {
840
+ const s = [], e = [];
841
+ return t.forEach((o) => {
842
+ (o.match(ee) ? s : e).push(o);
843
+ }), {
844
+ valid: s,
845
+ invalid: e
846
+ };
847
+ }
848
+ function ot(t, s, e) {
849
+ function o() {
850
+ const n = t.pendingIcons;
851
+ s.forEach((i) => {
852
+ n && n.delete(i), t.icons[i] || t.missing.add(i);
853
+ });
854
+ }
855
+ if (e && typeof e == "object") try {
856
+ if (!ie(t, e).length) {
857
+ o();
858
+ return;
859
+ }
860
+ } catch (n) {
861
+ console.error(n);
862
+ }
863
+ o(), Gn(t);
864
+ }
865
+ function Ut(t, s) {
866
+ t instanceof Promise ? t.then((e) => {
867
+ s(e);
868
+ }).catch(() => {
869
+ s(null);
870
+ }) : s(t);
871
+ }
872
+ function zn(t, s) {
873
+ t.iconsToLoad ? t.iconsToLoad = t.iconsToLoad.concat(s).sort() : t.iconsToLoad = s, t.iconsQueueFlag || (t.iconsQueueFlag = !0, setTimeout(() => {
874
+ t.iconsQueueFlag = !1;
875
+ const { provider: e, prefix: o } = t, n = t.iconsToLoad;
876
+ if (delete t.iconsToLoad, !n || !n.length) return;
877
+ const i = t.loadIcon;
878
+ if (t.loadIcons && (n.length > 1 || !i)) {
879
+ Ut(t.loadIcons(n, o, e), (r) => {
880
+ ot(t, n, r);
881
+ });
882
+ return;
883
+ }
884
+ if (i) {
885
+ n.forEach((r) => {
886
+ Ut(i(r, o, e), (u) => {
887
+ ot(t, [r], u ? {
888
+ prefix: o,
889
+ icons: { [r]: u }
890
+ } : null);
891
+ });
892
+ });
893
+ return;
894
+ }
895
+ const { valid: a, invalid: c } = Un(n);
896
+ if (c.length && ot(t, c, null), !a.length) return;
897
+ const f = o.match(ee) ? Ot(e) : null;
898
+ if (!f) {
899
+ ot(t, a, null);
900
+ return;
901
+ }
902
+ f.prepare(e, o, a).forEach((r) => {
903
+ Xn(e, r, (u) => {
904
+ ot(t, r.icons, u);
905
+ });
906
+ });
907
+ }));
908
+ }
909
+ const Jn = (t, s) => {
910
+ const e = Qn(_n(t, !0, ae()));
911
+ if (!e.pending.length) {
912
+ let c = !0;
913
+ return s && setTimeout(() => {
914
+ c && s(e.loaded, e.missing, e.pending, Gt);
915
+ }), () => {
916
+ c = !1;
917
+ };
918
+ }
919
+ const o = /* @__PURE__ */ Object.create(null), n = [];
920
+ let i, a;
921
+ return e.pending.forEach((c) => {
922
+ const { provider: f, prefix: r } = c;
923
+ if (r === a && f === i) return;
924
+ i = f, a = r, n.push(nt(f, r));
925
+ const u = o[f] || (o[f] = /* @__PURE__ */ Object.create(null));
926
+ u[r] || (u[r] = []);
927
+ }), e.pending.forEach((c) => {
928
+ const { provider: f, prefix: r, name: u } = c, d = nt(f, r), p = d.pendingIcons || (d.pendingIcons = /* @__PURE__ */ new Set());
929
+ p.has(u) || (p.add(u), o[f][r].push(u));
930
+ }), n.forEach((c) => {
931
+ const f = o[c.provider][c.prefix];
932
+ f.length && zn(c, f);
933
+ }), s ? In(s, e, n) : Gt;
934
+ };
935
+ function qn(t, s) {
936
+ const e = { ...t };
937
+ for (const o in s) {
938
+ const n = s[o], i = typeof n;
939
+ o in re ? (n === null || n && (i === "string" || i === "number")) && (e[o] = n) : i === typeof e[o] && (e[o] = o === "rotate" ? n % 4 : n);
940
+ }
941
+ return e;
942
+ }
943
+ const Kn = /[\s,]+/;
944
+ function Zn(t, s) {
945
+ s.split(Kn).forEach((e) => {
946
+ switch (e.trim()) {
947
+ case "horizontal":
948
+ t.hFlip = !0;
949
+ break;
950
+ case "vertical":
951
+ t.vFlip = !0;
952
+ break;
953
+ }
954
+ });
955
+ }
956
+ function ts(t, s = 0) {
957
+ const e = t.replace(/^-?[0-9.]*/, "");
958
+ function o(n) {
959
+ for (; n < 0; ) n += 4;
960
+ return n % 4;
961
+ }
962
+ if (e === "") {
963
+ const n = parseInt(t);
964
+ return isNaN(n) ? 0 : o(n);
965
+ } else if (e !== t) {
966
+ let n = 0;
967
+ switch (e) {
968
+ case "%":
969
+ n = 25;
970
+ break;
971
+ case "deg":
972
+ n = 90;
973
+ }
974
+ if (n) {
975
+ let i = parseFloat(t.slice(0, t.length - e.length));
976
+ return isNaN(i) ? 0 : (i = i / n, i % 1 === 0 ? o(i) : 0);
977
+ }
978
+ }
979
+ return s;
980
+ }
981
+ function es(t, s) {
982
+ let e = t.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
983
+ for (const o in s) e += " " + o + '="' + s[o] + '"';
984
+ return '<svg xmlns="http://www.w3.org/2000/svg"' + e + ">" + t + "</svg>";
985
+ }
986
+ function ns(t) {
987
+ return t.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
988
+ }
989
+ function ss(t) {
990
+ return "data:image/svg+xml," + ns(t);
991
+ }
992
+ function os(t) {
993
+ return 'url("' + ss(t) + '")';
994
+ }
995
+ const zt = {
996
+ ...le,
997
+ inline: !1
998
+ }, is = {
999
+ xmlns: "http://www.w3.org/2000/svg",
1000
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
1001
+ "aria-hidden": !0,
1002
+ role: "img"
1003
+ }, as = {
1004
+ display: "inline-block"
1005
+ }, Mt = {
1006
+ backgroundColor: "currentColor"
1007
+ }, fe = {
1008
+ backgroundColor: "transparent"
1009
+ }, Jt = {
1010
+ Image: "var(--svg)",
1011
+ Repeat: "no-repeat",
1012
+ Size: "100% 100%"
1013
+ }, qt = {
1014
+ webkitMask: Mt,
1015
+ mask: Mt,
1016
+ background: fe
1017
+ };
1018
+ for (const t in qt) {
1019
+ const s = qt[t];
1020
+ for (const e in Jt)
1021
+ s[t + e] = Jt[e];
1022
+ }
1023
+ const vt = {};
1024
+ ["horizontal", "vertical"].forEach((t) => {
1025
+ const s = t.slice(0, 1) + "Flip";
1026
+ vt[t + "-flip"] = s, vt[t.slice(0, 1) + "-flip"] = s, vt[t + "Flip"] = s;
1027
+ });
1028
+ function Kt(t) {
1029
+ return t + (t.match(/^[-0-9.]+$/) ? "px" : "");
1030
+ }
1031
+ const Zt = (t, s) => {
1032
+ const e = qn(zt, s), o = { ...is }, n = s.mode || "svg", i = {}, a = s.style, c = typeof a == "object" && !(a instanceof Array) ? a : {};
1033
+ for (let y in s) {
1034
+ const v = s[y];
1035
+ if (v !== void 0)
1036
+ switch (y) {
1037
+ // Properties to ignore
1038
+ case "icon":
1039
+ case "style":
1040
+ case "onLoad":
1041
+ case "mode":
1042
+ case "ssr":
1043
+ case "customise":
1044
+ break;
1045
+ // Boolean attributes
1046
+ case "inline":
1047
+ case "hFlip":
1048
+ case "vFlip":
1049
+ e[y] = v === !0 || v === "true" || v === 1;
1050
+ break;
1051
+ // Flip as string: 'horizontal,vertical'
1052
+ case "flip":
1053
+ typeof v == "string" && Zn(e, v);
1054
+ break;
1055
+ // Color: override style
1056
+ case "color":
1057
+ i.color = v;
1058
+ break;
1059
+ // Rotation as string
1060
+ case "rotate":
1061
+ typeof v == "string" ? e[y] = ts(v) : typeof v == "number" && (e[y] = v);
1062
+ break;
1063
+ // Remove aria-hidden
1064
+ case "ariaHidden":
1065
+ case "aria-hidden":
1066
+ v !== !0 && v !== "true" && delete o["aria-hidden"];
1067
+ break;
1068
+ default: {
1069
+ const l = vt[y];
1070
+ l ? (v === !0 || v === "true" || v === 1) && (e[l] = !0) : zt[y] === void 0 && (o[y] = v);
1071
+ }
1072
+ }
1073
+ }
1074
+ const f = En(t, e), r = f.attributes;
1075
+ if (e.inline && (i.verticalAlign = "-0.125em"), n === "svg")
1076
+ return o.style = {
1077
+ ...i,
1078
+ ...c
1079
+ }, Object.assign(o, r), o.innerHTML = Rn(f.body), $t("svg", o);
1080
+ const { body: u, width: d, height: p } = t, E = n === "mask" || (n === "bg" ? !1 : u.indexOf("currentColor") !== -1), D = es(u, {
1081
+ ...r,
1082
+ width: d + "",
1083
+ height: p + ""
1084
+ });
1085
+ return o.style = {
1086
+ ...i,
1087
+ "--svg": os(D),
1088
+ width: Kt(r.width),
1089
+ height: Kt(r.height),
1090
+ ...as,
1091
+ ...E ? Mt : fe,
1092
+ ...c
1093
+ }, $t("span", o);
1094
+ };
1095
+ ae(!0);
1096
+ On("", Fn);
1097
+ if (typeof document < "u" && typeof window < "u") {
1098
+ const t = window;
1099
+ if (t.IconifyPreload !== void 0) {
1100
+ const s = t.IconifyPreload, e = "Invalid IconifyPreload syntax.";
1101
+ typeof s == "object" && s !== null && (s instanceof Array ? s : [s]).forEach((o) => {
1102
+ try {
1103
+ // Check if item is an object and not null/array
1104
+ (typeof o != "object" || o === null || o instanceof Array || // Check for 'icons' and 'prefix'
1105
+ typeof o.icons != "object" || typeof o.prefix != "string" || // Add icon set
1106
+ !yn(o)) && console.error(e);
1107
+ } catch {
1108
+ console.error(e);
1109
+ }
1110
+ });
1111
+ }
1112
+ if (t.IconifyProviders !== void 0) {
1113
+ const s = t.IconifyProviders;
1114
+ if (typeof s == "object" && s !== null)
1115
+ for (let e in s) {
1116
+ const o = "IconifyProviders[" + e + "] is invalid.";
1117
+ try {
1118
+ const n = s[e];
1119
+ if (typeof n != "object" || !n || n.resources === void 0)
1120
+ continue;
1121
+ Mn(e, n) || console.error(o);
1122
+ } catch {
1123
+ console.error(o);
1124
+ }
1125
+ }
1126
+ }
1127
+ }
1128
+ const rs = {
1129
+ ...bt,
1130
+ body: ""
1131
+ }, Tt = q((t, { emit: s }) => {
1132
+ const e = M(null);
1133
+ function o() {
1134
+ var r, u;
1135
+ e.value && ((u = (r = e.value).abort) == null || u.call(r), e.value = null);
1136
+ }
1137
+ const n = M(!!t.ssr), i = M(""), a = ve(null);
1138
+ function c() {
1139
+ const r = t.icon;
1140
+ if (typeof r == "object" && r !== null && typeof r.body == "string")
1141
+ return i.value = "", {
1142
+ data: r
1143
+ };
1144
+ let u;
1145
+ if (typeof r != "string" || (u = kt(r, !1, !0)) === null)
1146
+ return null;
1147
+ let d = vn(u);
1148
+ if (!d) {
1149
+ const D = e.value;
1150
+ return (!D || D.name !== r) && (d === null ? e.value = {
1151
+ name: r
1152
+ } : e.value = {
1153
+ name: r,
1154
+ abort: Jn([u], f)
1155
+ }), null;
1156
+ }
1157
+ o(), i.value !== r && (i.value = r, lt(() => {
1158
+ s("load", r);
1159
+ }));
1160
+ const p = t.customise;
1161
+ if (p) {
1162
+ d = Object.assign({}, d);
1163
+ const D = p(d.body, u.name, u.prefix, u.provider);
1164
+ typeof D == "string" && (d.body = D);
1165
+ }
1166
+ const E = ["iconify"];
1167
+ return u.prefix !== "" && E.push("iconify--" + u.prefix), u.provider !== "" && E.push("iconify--" + u.provider), { data: d, classes: E };
1168
+ }
1169
+ function f() {
1170
+ var u;
1171
+ const r = c();
1172
+ r ? r.data !== ((u = a.value) == null ? void 0 : u.data) && (a.value = r) : a.value = null;
1173
+ }
1174
+ return n.value ? f() : W(() => {
1175
+ n.value = !0, f();
1176
+ }), Pt(() => t.icon, f), mt(o), () => {
1177
+ const r = a.value;
1178
+ if (!r)
1179
+ return Zt(rs, t);
1180
+ let u = t;
1181
+ return r.classes && (u = {
1182
+ ...t,
1183
+ class: r.classes.join(" ")
1184
+ }), Zt({
1185
+ ...bt,
1186
+ ...r.data
1187
+ }, u);
1188
+ };
1189
+ }, {
1190
+ props: [
1191
+ // Icon and render mode
1192
+ "icon",
1193
+ "mode",
1194
+ "ssr",
1195
+ // Layout and style
1196
+ "width",
1197
+ "height",
1198
+ "style",
1199
+ "color",
1200
+ "inline",
1201
+ // Transformations
1202
+ "rotate",
1203
+ "hFlip",
1204
+ "horizontalFlip",
1205
+ "vFlip",
1206
+ "verticalFlip",
1207
+ "flip",
1208
+ // Misc
1209
+ "id",
1210
+ "ariaHidden",
1211
+ "customise",
1212
+ "title"
1213
+ ],
1214
+ emits: ["load"]
1215
+ }), ls = { class: "input-container" }, cs = ["value", "disabled"], us = {
143
1216
  key: 0,
144
- class: "tooltip-enhanced",
145
- "data-tooltip": "重新回答"
146
- }, ke = ["src"], we = ["src"], Ce = ["value", "disabled"], $e = {
147
- key: 2,
148
1217
  class: "tooltip-enhanced stop",
149
- "data-tooltip": "停止回答"
150
- }, Se = ["src"], _e = {
151
- key: 3,
152
- class: "tooltip-enhanced send",
153
- "data-tooltip": "开始回答"
154
- }, be = ["src"], Te = {
155
- key: 4,
1218
+ "data-tooltip": "停止生成"
1219
+ }, fs = ["data-tooltip"], ds = {
1220
+ key: 2,
156
1221
  class: "moveTB"
157
- }, Ae = ["src"], Ee = /* @__PURE__ */ U({
1222
+ }, hs = /* @__PURE__ */ q({
158
1223
  __name: "ChatInput",
159
1224
  props: {
160
1225
  modelValue: {},
@@ -163,500 +1228,500 @@ const ee = {
163
1228
  hasScroll: { type: Boolean },
164
1229
  isAtBottom: { type: Boolean }
165
1230
  },
166
- emits: ["update:modelValue", "send", "regenerate", "stop", "scroll-to-bottom"],
1231
+ emits: ["update:modelValue", "send", "stop", "scroll-to-bottom"],
167
1232
  setup(t) {
168
- return (a, o) => (g(), p("div", pe, [
169
- t.lastUserMessage ? (g(), p("div", ye, [
170
- n("img", {
171
- class: "refresh",
172
- onClick: o[0] || (o[0] = (l) => a.$emit("regenerate")),
173
- src: R(mt)
174
- }, null, 8, ke)
175
- ])) : (g(), p("img", {
176
- key: 1,
177
- class: "refresh",
178
- src: R(mt)
179
- }, null, 8, we)),
180
- n("input", {
1233
+ return (s, e) => (b(), O("div", ls, [
1234
+ h("input", {
181
1235
  value: t.modelValue,
182
1236
  type: "text",
183
- placeholder: "输入消息...",
184
- onInput: o[1] || (o[1] = (l) => a.$emit("update:modelValue", l.target.value)),
185
- onKeyup: o[2] || (o[2] = Tt((l) => a.$emit("send"), ["enter"])),
1237
+ placeholder: "给AI助手发送消息...",
1238
+ onInput: e[0] || (e[0] = (o) => s.$emit("update:modelValue", o.target.value)),
1239
+ onKeyup: e[1] || (e[1] = me((o) => t.modelValue.trim() && s.$emit("send"), ["enter"])),
186
1240
  disabled: t.isGenerating
187
- }, null, 40, Ce),
188
- t.isGenerating && t.lastUserMessage ? (g(), p("div", $e, [
189
- n("img", {
190
- src: R(Kt),
191
- onClick: o[3] || (o[3] = (l) => a.$emit("stop"))
192
- }, null, 8, Se)
193
- ])) : (g(), p("div", _e, [
194
- n("img", {
195
- src: R(qt),
196
- onClick: o[4] || (o[4] = (l) => a.$emit("send"))
197
- }, null, 8, be)
198
- ])),
199
- t.hasScroll && !t.isAtBottom ? (g(), p("div", Te, [
200
- n("img", {
201
- onClick: o[5] || (o[5] = (l) => a.$emit("scroll-to-bottom")),
202
- src: R(Qt)
203
- }, null, 8, Ae)
204
- ])) : X("", !0)
1241
+ }, null, 40, cs),
1242
+ t.isGenerating && t.lastUserMessage ? (b(), O("div", us, [
1243
+ G(N(Tt), {
1244
+ class: "op-icon stop-icon",
1245
+ icon: "heroicons-solid:stop",
1246
+ onClick: e[2] || (e[2] = (o) => s.$emit("stop"))
1247
+ })
1248
+ ])) : (b(), O("div", {
1249
+ key: 1,
1250
+ class: X(["tooltip-enhanced send", { disabled: !t.modelValue.trim() }]),
1251
+ "data-tooltip": t.modelValue.trim() ? "开始回答" : "请输入你的问题"
1252
+ }, [
1253
+ G(N(Tt), {
1254
+ class: "op-icon",
1255
+ icon: "fluent-color:send-16",
1256
+ onClick: e[3] || (e[3] = (o) => t.modelValue.trim() && s.$emit("send"))
1257
+ })
1258
+ ], 10, fs)),
1259
+ t.hasScroll && !t.isAtBottom ? (b(), O("div", ds, [
1260
+ G(N(Tt), {
1261
+ class: "op-icon",
1262
+ icon: "ep:bottom",
1263
+ onClick: e[4] || (e[4] = (o) => s.$emit("scroll-to-bottom"))
1264
+ })
1265
+ ])) : j("", !0)
205
1266
  ]));
206
1267
  }
207
1268
  });
208
- function Me(t) {
209
- const a = T(!0), o = T(!1);
210
- function l() {
211
- rt(() => {
1269
+ function gs(t) {
1270
+ const s = M(!0), e = M(!1);
1271
+ function o() {
1272
+ lt(() => {
212
1273
  t.value && (t.value.scrollTop = t.value.scrollHeight);
213
1274
  });
214
1275
  }
215
- function i() {
1276
+ function n() {
216
1277
  if (!t.value) return;
217
- const s = t.value, m = s.scrollTop + s.clientHeight >= s.scrollHeight - 1, c = s.scrollHeight > s.clientHeight;
218
- a.value = m, o.value = c;
219
- }
220
- return { isAtBottom: a, hasScroll: o, scrollToBottom: l, checkScrollStatus: i };
221
- }
222
- function Re() {
223
- function t(a) {
224
- a.querySelectorAll("pre").forEach((l) => {
225
- if (l.querySelector(".copy-button")) return;
226
- const i = l.querySelector("code");
227
- if (!i) return;
228
- const m = (Array.from(i.classList).find((d) => d.startsWith("language-")) || "").replace("language-", "");
229
- if (m) {
230
- const d = document.createElement("span");
231
- d.className = "code-lang", d.textContent = m, l.appendChild(d);
1278
+ const i = t.value, a = i.scrollTop + i.clientHeight >= i.scrollHeight - 1, c = i.scrollHeight > i.clientHeight;
1279
+ s.value = a, e.value = c;
1280
+ }
1281
+ return { isAtBottom: s, hasScroll: e, scrollToBottom: o, checkScrollStatus: n };
1282
+ }
1283
+ function ps() {
1284
+ function t(s) {
1285
+ s.querySelectorAll("pre").forEach((o) => {
1286
+ if (o.querySelector(".copy-button")) return;
1287
+ const n = o.querySelector("code");
1288
+ if (!n) return;
1289
+ const a = (Array.from(n.classList).find((f) => f.startsWith("language-")) || "").replace("language-", "");
1290
+ if (a) {
1291
+ const f = document.createElement("span");
1292
+ f.className = "code-lang", f.textContent = a, o.appendChild(f);
232
1293
  }
233
1294
  const c = document.createElement("button");
234
1295
  c.className = "copy-button", c.textContent = "复制", c.onclick = () => {
235
- navigator.clipboard.writeText(i.textContent || "").then(() => {
1296
+ navigator.clipboard.writeText(n.textContent || "").then(() => {
236
1297
  c.textContent = "已复制", setTimeout(() => {
237
1298
  c.textContent = "复制";
238
1299
  }, 2e3);
239
1300
  });
240
- }, l.appendChild(c);
1301
+ }, o.appendChild(c);
241
1302
  });
242
1303
  }
243
1304
  return { enhanceCodeBlocks: t };
244
1305
  }
245
- function De(t) {
246
- let a = null, o = 0;
247
- function l(s) {
248
- a = s(a || [...t.value]), o || (o = requestAnimationFrame(() => {
249
- o = 0, a && (t.value = a, a = null);
1306
+ function vs(t) {
1307
+ let s = null, e = 0;
1308
+ function o(i) {
1309
+ s = i(s || [...t.value]), e || (e = requestAnimationFrame(() => {
1310
+ e = 0, s && (t.value = s, s = null);
250
1311
  }));
251
1312
  }
252
- function i() {
253
- o && (cancelAnimationFrame(o), o = 0), a && (t.value = a, a = null);
1313
+ function n() {
1314
+ e && (cancelAnimationFrame(e), e = 0), s && (t.value = s, s = null);
254
1315
  }
255
- return { batchMessagesUpdate: l, flushMessagesBatch: i };
1316
+ return { batchMessagesUpdate: o, flushMessagesBatch: n };
256
1317
  }
257
- function Ne(t, a, o) {
258
- const l = x(/* @__PURE__ */ new Map()), i = T(/* @__PURE__ */ new Map());
259
- let s = 0, m = 0;
1318
+ function ms(t, s, e) {
1319
+ const o = J(/* @__PURE__ */ new Map()), n = M(/* @__PURE__ */ new Map());
1320
+ let i = 0, a = 0;
260
1321
  function c() {
261
- if (s) return;
262
- const r = 16, b = 1, P = 40, W = (A) => {
263
- if (A - m >= r) {
264
- m = A;
265
- let L = !1;
266
- if (t.value.forEach((u, D) => {
267
- if (u.type !== "ai" || u.status !== o) return;
268
- const $ = u.content, C = i.value.get(D) ?? 0, N = $.length - C;
269
- if (N > 0) {
270
- L = !0;
271
- const O = N > 15 ? Math.min(Math.ceil(N * 0.3), P) : b, S = Math.min(C + O, $.length);
272
- i.value.set(D, S), l.set(D, $.slice(0, S));
1322
+ if (i) return;
1323
+ const d = 16, p = 1, E = 40, D = (y) => {
1324
+ if (y - a >= d) {
1325
+ a = y;
1326
+ let v = !1;
1327
+ if (t.value.forEach((g, A) => {
1328
+ if (g.type !== "ai" || g.status !== e) return;
1329
+ const w = g.content, S = n.value.get(A) ?? 0, m = w.length - S;
1330
+ if (m > 0) {
1331
+ v = !0;
1332
+ const L = m > 15 ? Math.min(Math.ceil(m * 0.3), E) : p, T = Math.min(S + L, w.length);
1333
+ n.value.set(A, T), o.set(A, w.slice(0, T));
273
1334
  }
274
- }), L && a(), !t.value.some((u) => u.type === "ai" && u.status === o)) {
275
- s = 0;
1335
+ }), v && s(), !t.value.some((g) => g.type === "ai" && g.status === e)) {
1336
+ i = 0;
276
1337
  return;
277
1338
  }
278
1339
  }
279
- s = requestAnimationFrame(W);
1340
+ i = requestAnimationFrame(D);
280
1341
  };
281
- s = requestAnimationFrame(W);
1342
+ i = requestAnimationFrame(D);
282
1343
  }
283
- function d() {
284
- s && (cancelAnimationFrame(s), s = 0), t.value.forEach((r, b) => {
285
- r.type === "ai" && (l.set(b, r.content), i.value.set(b, r.content.length));
1344
+ function f() {
1345
+ i && (cancelAnimationFrame(i), i = 0), t.value.forEach((d, p) => {
1346
+ d.type === "ai" && (o.set(p, d.content), n.value.set(p, d.content.length));
286
1347
  });
287
1348
  }
288
- function f() {
289
- s && (cancelAnimationFrame(s), s = 0);
290
- }
291
- function v(r, b, P, W) {
292
- if (P.type !== "answer" || W.status !== o) return P.content;
293
- const A = W.segments || [];
294
- if (A.slice(b + 1).some(($) => $.type === "answer")) return P.content;
295
- const e = i.value.get(r);
296
- if (e == null) return P.content;
297
- let u = 0;
298
- for (let $ = 0; $ < b; $++)
299
- A[$].type === "answer" && (u += A[$].content.length);
300
- const D = u + P.content.length;
301
- return e >= D ? P.content : e <= u ? "" : P.content.slice(0, e - u);
302
- }
303
- return { displayedContent: l, streamingIndexRef: i, startTypewriter: c, flushTypewriter: d, getSegmentDisplayContent: v, stopTypewriter: f };
304
- }
305
- function He({
1349
+ function r() {
1350
+ i && (cancelAnimationFrame(i), i = 0);
1351
+ }
1352
+ function u(d, p, E, D) {
1353
+ if (E.type !== "answer" || D.status !== e) return E.content;
1354
+ const y = D.segments || [];
1355
+ if (y.slice(p + 1).some((w) => w.type === "answer")) return E.content;
1356
+ const l = n.value.get(d);
1357
+ if (l == null) return E.content;
1358
+ let g = 0;
1359
+ for (let w = 0; w < p; w++)
1360
+ y[w].type === "answer" && (g += y[w].content.length);
1361
+ const A = g + E.content.length;
1362
+ return l >= A ? E.content : l <= g ? "" : E.content.slice(0, l - g);
1363
+ }
1364
+ return { displayedContent: o, streamingIndexRef: n, startTypewriter: c, flushTypewriter: f, getSegmentDisplayContent: u, stopTypewriter: r };
1365
+ }
1366
+ function ys({
306
1367
  messages: t,
307
- isGenerating: a,
308
- lastUserMessage: o,
309
- batchMessagesUpdate: l,
310
- flushMessagesBatch: i,
311
- STATUS: s,
312
- cfg: m
1368
+ isGenerating: s,
1369
+ lastUserMessage: e,
1370
+ batchMessagesUpdate: o,
1371
+ flushMessagesBatch: n,
1372
+ STATUS: i,
1373
+ cfg: a
313
1374
  }) {
314
- const c = T(/* @__PURE__ */ new Map()), d = T(/* @__PURE__ */ new Map()), f = T(/* @__PURE__ */ new Map()), v = T(/* @__PURE__ */ new Map()), r = T(!1);
315
- function b(A) {
316
- const L = c.value.get(A) || [];
317
- l((e) => {
318
- if (e[A]) {
319
- const u = [...e];
320
- return u[A] = { ...u[A], segments: L.map((D) => ({ ...D })) }, u;
1375
+ const c = M(/* @__PURE__ */ new Map()), f = M(/* @__PURE__ */ new Map()), r = M(/* @__PURE__ */ new Map()), u = M(/* @__PURE__ */ new Map()), d = M(!1);
1376
+ function p(y) {
1377
+ const v = c.value.get(y) || [];
1378
+ o((l) => {
1379
+ if (l[y]) {
1380
+ const g = [...l];
1381
+ return g[y] = { ...g[y], segments: v.map((A) => ({ ...A })) }, g;
321
1382
  }
322
- return e;
1383
+ return l;
323
1384
  });
324
1385
  }
325
- function P(A) {
326
- const L = c.value.get(A) || [], e = f.value.get(A);
327
- let u = 0, D = !1;
328
- L.forEach(($) => {
329
- if ($.type === "thinking" && $.duration == null) {
330
- const C = e ? Math.round((Date.now() - e) / 1e3 * 10) / 10 : 0;
331
- $.duration = C, u += C, D = !0;
1386
+ function E(y) {
1387
+ const v = c.value.get(y) || [], l = r.value.get(y);
1388
+ let g = 0, A = !1;
1389
+ v.forEach((w) => {
1390
+ if (w.type === "thinking" && w.duration == null) {
1391
+ const S = l ? Math.round((Date.now() - l) / 1e3 * 10) / 10 : 0;
1392
+ w.duration = S, g += S, A = !0;
332
1393
  }
333
- }), D && (c.value.set(A, L), l(($) => {
334
- if ($[A]) {
335
- const C = [...$];
336
- return C[A] = {
337
- ...C[A],
338
- segments: L.map((N) => ({ ...N })),
339
- thinkingDuration: (C[A].thinkingDuration || 0) + u
340
- }, C;
1394
+ }), A && (c.value.set(y, v), o((w) => {
1395
+ if (w[y]) {
1396
+ const S = [...w];
1397
+ return S[y] = {
1398
+ ...S[y],
1399
+ segments: v.map((m) => ({ ...m })),
1400
+ thinkingDuration: (S[y].thinkingDuration || 0) + g
1401
+ }, S;
341
1402
  }
342
- return $;
1403
+ return w;
343
1404
  }));
344
1405
  }
345
- async function W(A, L, e, u, D = !1) {
346
- r.value = !1, c.value.set(e, []), a.value = !0;
1406
+ async function D(y, v, l, g, A = !1) {
1407
+ d.value = !1, c.value.set(l, []), s.value = !0;
347
1408
  try {
348
- const $ = m.baseUrl.replace(/\/+$/, "") + "/" + A.replace(/^\/+/, "");
349
- await zt($, {
1409
+ const w = a.baseUrl.replace(/\/+$/, "") + "/" + y.replace(/^\/+/, "");
1410
+ await je(w, {
350
1411
  method: "POST",
351
1412
  headers: { "Content-Type": "application/json" },
352
- body: JSON.stringify({ app: m.app ?? 1, data: L }),
353
- signal: u,
1413
+ body: JSON.stringify({ app: a.app ?? 1, data: v }),
1414
+ signal: g,
354
1415
  openWhenHidden: !0,
355
- async onopen(C) {
1416
+ async onopen(S) {
1417
+ S.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", S.status, S.statusText);
356
1418
  },
357
- onmessage(C) {
358
- var N;
1419
+ onmessage(S) {
1420
+ var m;
359
1421
  try {
360
- let O = C.data || "";
361
- if (O.startsWith("data:") && (O = O.replace(/^data:\s*/, "")), !O) return;
362
- let S;
1422
+ let L = S.data || "";
1423
+ for (; L.startsWith("data:"); )
1424
+ L = L.replace(/^data:\s*/, "");
1425
+ if (!L) return;
1426
+ let T;
363
1427
  try {
364
- S = JSON.parse(O);
1428
+ T = JSON.parse(L);
365
1429
  } catch {
366
1430
  return;
367
1431
  }
368
- switch (S.event) {
1432
+ switch (T.event) {
369
1433
  case "message_start":
370
- D || (o.value = S.id), d.value.set(e, "answer");
1434
+ A || (e.value = T.id), f.value.set(l, "answer");
371
1435
  break;
372
1436
  case "think_message_output_start": {
373
- f.value.set(e, Date.now()), d.value.set(e, "thinking");
374
- const h = c.value.get(e) || [];
375
- c.value.set(e, [...h, { type: "thinking", content: "" }]), b(e);
1437
+ r.value.set(l, Date.now()), f.value.set(l, "thinking");
1438
+ const k = c.value.get(l) || [];
1439
+ c.value.set(l, [...k, { type: "thinking", content: "" }]), p(l);
376
1440
  break;
377
1441
  }
378
1442
  case "agent_thought": {
379
- const h = S.thought || S.thinking || "", w = c.value.get(e) || [], k = w[w.length - 1];
380
- k && k.type === "agent_thought" ? k.content += h : (d.value.set(e, "agent_thought"), w.push({ type: "agent_thought", content: h }), v.value.set(e, Date.now())), c.value.set(e, w), l((_) => {
381
- if (_[e]) {
382
- const M = [..._];
383
- return M[e] = {
384
- ...M[e],
385
- segments: w.map((H) => ({ ...H })),
386
- thinkingContent: (M[e].thinkingContent || "") + h,
387
- status: s.THINKING
388
- }, M;
1443
+ const k = T.thought || T.thinking || "", C = c.value.get(l) || [], R = C[C.length - 1];
1444
+ R && R.type === "agent_thought" ? R.content += k : (f.value.set(l, "agent_thought"), C.push({ type: "agent_thought", content: k }), u.value.set(l, Date.now())), c.value.set(l, C), o((P) => {
1445
+ if (P[l]) {
1446
+ const $ = [...P];
1447
+ return $[l] = {
1448
+ ...$[l],
1449
+ segments: C.map((F) => ({ ...F })),
1450
+ thinkingContent: ($[l].thinkingContent || "") + k,
1451
+ status: i.THINKING
1452
+ }, $;
389
1453
  }
390
- return _;
1454
+ return P;
391
1455
  });
392
1456
  break;
393
1457
  }
394
1458
  case "think_message": {
395
- const h = S.thinking || S.answer || S.text || "", w = c.value.get(e) || [], k = w[w.length - 1];
396
- k && k.type === "thinking" ? k.content += h : (w.push({ type: "thinking", content: h }), f.value.set(e, Date.now())), c.value.set(e, w), l((_) => {
397
- if (_[e]) {
398
- const M = [..._];
399
- return M[e] = {
400
- ...M[e],
401
- segments: w.map((H) => ({ ...H })),
402
- thinkingContent: (M[e].thinkingContent || "") + h,
403
- status: s.THINKING
404
- }, M;
1459
+ const k = T.thinking || T.answer || T.text || "", C = c.value.get(l) || [], R = C[C.length - 1];
1460
+ R && R.type === "thinking" ? R.content += k : (C.push({ type: "thinking", content: k }), r.value.set(l, Date.now())), c.value.set(l, C), o((P) => {
1461
+ if (P[l]) {
1462
+ const $ = [...P];
1463
+ return $[l] = {
1464
+ ...$[l],
1465
+ segments: C.map((F) => ({ ...F })),
1466
+ thinkingContent: ($[l].thinkingContent || "") + k,
1467
+ status: i.THINKING
1468
+ }, $;
405
1469
  }
406
- return _;
1470
+ return P;
407
1471
  });
408
1472
  break;
409
1473
  }
410
1474
  case "agent_thought_end": {
411
- const h = v.value.get(e), w = h ? Math.round((Date.now() - h) / 1e3 * 10) / 10 : 0, k = c.value.get(e) || [], _ = k[k.length - 1];
412
- _ && _.type === "agent_thought" && (_.duration = w), c.value.set(e, k), l((M) => {
413
- if (M[e]) {
414
- const H = [...M];
415
- return H[e] = {
416
- ...H[e],
417
- segments: k.map((K) => ({ ...K })),
418
- thinkingDuration: (H[e].thinkingDuration || 0) + w
419
- }, H;
1475
+ const k = u.value.get(l), C = k ? Math.round((Date.now() - k) / 1e3 * 10) / 10 : 0, R = c.value.get(l) || [], P = R[R.length - 1];
1476
+ P && P.type === "agent_thought" && (P.duration = C), c.value.set(l, R), o(($) => {
1477
+ if ($[l]) {
1478
+ const F = [...$];
1479
+ return F[l] = {
1480
+ ...F[l],
1481
+ segments: R.map((Y) => ({ ...Y })),
1482
+ thinkingDuration: (F[l].thinkingDuration || 0) + C
1483
+ }, F;
420
1484
  }
421
- return M;
1485
+ return $;
422
1486
  });
423
1487
  break;
424
1488
  }
425
1489
  case "think_message_output_end": {
426
- const h = f.value.get(e), w = h ? Math.round((Date.now() - h) / 1e3 * 10) / 10 : 0, k = c.value.get(e) || [], _ = k[k.length - 1];
427
- _ && _.type === "thinking" && (_.duration = w), c.value.set(e, k), l((M) => {
428
- if (M[e]) {
429
- const H = [...M];
430
- return H[e] = {
431
- ...H[e],
432
- segments: k.map((K) => ({ ...K })),
433
- thinkingDuration: (H[e].thinkingDuration || 0) + w
434
- }, H;
1490
+ const k = r.value.get(l), C = k ? Math.round((Date.now() - k) / 1e3 * 10) / 10 : 0, R = c.value.get(l) || [], P = R[R.length - 1];
1491
+ P && P.type === "thinking" && (P.duration = C), c.value.set(l, R), o(($) => {
1492
+ if ($[l]) {
1493
+ const F = [...$];
1494
+ return F[l] = {
1495
+ ...F[l],
1496
+ segments: R.map((Y) => ({ ...Y })),
1497
+ thinkingDuration: (F[l].thinkingDuration || 0) + C
1498
+ }, F;
435
1499
  }
436
- return M;
1500
+ return $;
437
1501
  });
438
1502
  break;
439
1503
  }
440
1504
  case "tool_message": {
441
- const h = S.answer || S.text || S.content || "";
442
- if (!h) break;
443
- const w = c.value.get(e) || [];
444
- w.push({ type: "answer", content: h }), c.value.set(e, w), b(e);
1505
+ const k = T.answer || T.text || T.content || "";
1506
+ if (!k) break;
1507
+ const C = c.value.get(l) || [];
1508
+ C.push({ type: "answer", content: k }), c.value.set(l, C), p(l);
445
1509
  break;
446
1510
  }
447
1511
  case "message_output_start":
448
- d.value.set(e, "answer"), P(e);
1512
+ f.value.set(l, "answer"), E(l);
449
1513
  break;
450
1514
  case "message": {
451
- const h = S.answer || "", w = d.value.get(e), k = c.value.get(e) || [], _ = k[k.length - 1];
452
- w === "answer" && _ && _.type === "answer" ? _.content += h : (P(e), d.value.set(e, "answer"), k.push({ type: "answer", content: h })), c.value.set(e, k);
453
- const M = k.filter((H) => H.type === "answer").map((H) => H.content).join("");
454
- l((H) => {
455
- if (H[e]) {
456
- const K = [...H];
457
- return K[e] = {
458
- ...K[e],
459
- segments: k.map((I) => ({ ...I })),
460
- content: M,
461
- status: r.value ? s.STOP : s.ANSWERING
462
- }, K;
1515
+ const k = T.answer || "", C = f.value.get(l), R = c.value.get(l) || [], P = R[R.length - 1];
1516
+ C === "answer" && P && P.type === "answer" ? P.content += k : (E(l), f.value.set(l, "answer"), R.push({ type: "answer", content: k })), c.value.set(l, R);
1517
+ const $ = R.filter((F) => F.type === "answer").map((F) => F.content).join("");
1518
+ o((F) => {
1519
+ if (F[l]) {
1520
+ const Y = [...F];
1521
+ return Y[l] = {
1522
+ ...Y[l],
1523
+ segments: R.map((K) => ({ ...K })),
1524
+ content: $,
1525
+ status: d.value ? i.STOP : i.ANSWERING
1526
+ }, Y;
463
1527
  }
464
- return H;
1528
+ return F;
465
1529
  });
466
1530
  break;
467
1531
  }
468
1532
  case "message_end": {
469
- i();
470
- const h = [...t.value];
471
- h[e] && (h[e] = { ...h[e], status: r.value ? s.STOP : s.COMPLETED }), t.value = h, a.value = !1;
1533
+ n();
1534
+ const k = [...t.value];
1535
+ k[l] && (k[l] = { ...k[l], status: d.value ? i.STOP : i.COMPLETED }), t.value = k, s.value = !1;
472
1536
  break;
473
1537
  }
474
1538
  case "agent_error":
475
1539
  case "message_failed": {
476
- i();
477
- const h = [...t.value];
478
- h[e] && (h[e] = {
479
- ...h[e],
480
- status: s.ERROR,
481
- content: S.error_msg || S.message || "请求失败",
482
- errorMessage: S.error_msg || S.message || "请求失败"
483
- }, t.value = h), a.value = !1;
1540
+ n();
1541
+ const k = [...t.value];
1542
+ k[l] && (k[l] = {
1543
+ ...k[l],
1544
+ status: i.ERROR,
1545
+ content: T.error_msg || T.message || "请求失败",
1546
+ errorMessage: T.error_msg || T.message || "请求失败"
1547
+ }, t.value = k), s.value = !1;
484
1548
  break;
485
1549
  }
486
1550
  case "message_replace": {
487
- const h = S.answer || "", w = c.value.get(e) || [], k = (N = w.map((_, M) => ({ s: _, i: M })).reverse().find((_) => _.s.type === "answer")) == null ? void 0 : N.i;
488
- k != null ? w[k] = { ...w[k], content: h } : w.push({ type: "answer", content: h }), c.value.set(e, w), l((_) => {
489
- if (_[e]) {
490
- const M = [..._];
491
- return M[e] = {
492
- ...M[e],
493
- segments: w.map((H) => ({ ...H })),
494
- content: h
495
- }, M;
1551
+ const k = T.answer || "", C = c.value.get(l) || [], R = (m = C.map((P, $) => ({ s: P, i: $ })).reverse().find((P) => P.s.type === "answer")) == null ? void 0 : m.i;
1552
+ R != null ? C[R] = { ...C[R], content: k } : C.push({ type: "answer", content: k }), c.value.set(l, C), o((P) => {
1553
+ if (P[l]) {
1554
+ const $ = [...P];
1555
+ return $[l] = {
1556
+ ...$[l],
1557
+ segments: C.map((F) => ({ ...F })),
1558
+ content: k
1559
+ }, $;
496
1560
  }
497
- return _;
1561
+ return P;
498
1562
  });
499
1563
  break;
500
1564
  }
501
1565
  case "message_cost": {
502
- const h = {
503
- inputTokens: S.input_tokens || 0,
504
- outputTokens: S.output_tokens || 0,
505
- latency: S.latency || 0,
506
- latencyFirstResp: S.latency_first_resp
1566
+ const k = {
1567
+ inputTokens: T.input_tokens || 0,
1568
+ outputTokens: T.output_tokens || 0,
1569
+ latency: T.latency || 0,
1570
+ latencyFirstResp: T.latency_first_resp
507
1571
  };
508
- l((w) => {
509
- if (w[e]) {
510
- const k = [...w];
511
- return k[e] = { ...k[e], cost: h }, k;
1572
+ o((C) => {
1573
+ if (C[l]) {
1574
+ const R = [...C];
1575
+ return R[l] = { ...R[l], cost: k }, R;
512
1576
  }
513
- return w;
1577
+ return C;
514
1578
  });
515
1579
  break;
516
1580
  }
517
1581
  default:
518
1582
  }
519
- } catch (O) {
520
- console.error("[ai-assist-sdk] onmessage 解析失败:", O);
1583
+ } catch (L) {
1584
+ console.error("[ai-assist-sdk] onmessage 解析失败:", L);
521
1585
  }
522
1586
  },
523
1587
  onclose() {
524
- i(), P(e), i();
525
- const N = (c.value.get(e) || []).filter((S) => S.type === "answer").map((S) => S.content).join(""), O = [...t.value];
526
- O[e] && O[e].status !== s.ERROR && (O[e] = {
527
- ...O[e],
528
- content: r.value && !N ? "已停止回答" : N,
529
- status: r.value ? s.STOP : s.COMPLETED
530
- }), t.value = O, a.value = !1;
1588
+ n(), E(l), n();
1589
+ const m = (c.value.get(l) || []).filter((T) => T.type === "answer").map((T) => T.content).join(""), L = [...t.value];
1590
+ L[l] && L[l].status !== i.ERROR && (L[l] = {
1591
+ ...L[l],
1592
+ content: d.value && !m ? "已停止回答" : m,
1593
+ status: d.value ? i.STOP : i.COMPLETED
1594
+ }), t.value = L, s.value = !1;
531
1595
  },
532
- onerror(C) {
533
- console.error("[ai-assist-sdk] ❌ 连接错误:", C), i();
534
- const N = [...t.value];
535
- N[e] && (N[e] = { ...N[e], content: `
536
- ⚠️ 请求异常,已终止`, status: s.ERROR }), t.value = N, a.value = !1;
1596
+ onerror(S) {
1597
+ console.error("[ai-assist-sdk] ❌ 连接错误:", S), n();
1598
+ const m = [...t.value];
1599
+ m[l] && (m[l] = { ...m[l], content: `
1600
+ ⚠️ 请求异常,已终止`, status: i.ERROR }), t.value = m, s.value = !1;
537
1601
  }
538
1602
  });
539
- } catch ($) {
540
- if (console.error("[ai-assist-sdk] doStreamRequest error:", $), !r.value) {
541
- i();
542
- const C = [...t.value];
543
- C[e] && (C[e] = { ...C[e], content: "服务连接失败,请稍后重试", status: s.ERROR }), t.value = C, a.value = !1;
1603
+ } catch (w) {
1604
+ if (console.error("[ai-assist-sdk] doStreamRequest error:", w), !d.value) {
1605
+ n();
1606
+ const S = [...t.value];
1607
+ S[l] && (S[l] = { ...S[l], content: "服务连接失败,请稍后重试", status: i.ERROR }), t.value = S, s.value = !1;
544
1608
  }
545
1609
  }
546
1610
  }
547
- return { doStreamRequest: W, issTop: r };
1611
+ return { doStreamRequest: D, issTop: d };
548
1612
  }
549
- function Pe(t) {
550
- var a;
1613
+ function ws(t) {
1614
+ var s;
551
1615
  if (typeof t == "string") {
552
- const o = Bt(t);
553
- return Wt(o) || t;
1616
+ const e = xe(t);
1617
+ return Re(e) || t;
554
1618
  }
555
- return (t == null ? void 0 : t.answer) || ((a = t == null ? void 0 : t.data) == null ? void 0 : a.answer) || String(t || "");
1619
+ return (t == null ? void 0 : t.answer) || ((s = t == null ? void 0 : t.data) == null ? void 0 : s.answer) || String(t || "");
556
1620
  }
557
- function Le(t) {
1621
+ function ks(t) {
558
1622
  return t.queryAgainStreamApi || t.queryAgainApi || t.chatQueryStreamApi || t.chatQueryApi;
559
1623
  }
560
- function Oe({
1624
+ function bs({
561
1625
  messages: t,
562
- userInput: a,
563
- isGenerating: o,
564
- lastUserMessage: l,
565
- conversationId: i,
566
- doStreamRequest: s,
567
- issTop: m,
1626
+ userInput: s,
1627
+ isGenerating: e,
1628
+ lastUserMessage: o,
1629
+ conversationId: n,
1630
+ doStreamRequest: i,
1631
+ issTop: a,
568
1632
  scrollToBottom: c,
569
- STATUS: d,
570
- cfg: f
1633
+ STATUS: f,
1634
+ cfg: r
571
1635
  }) {
572
- const v = f.apis, r = x({
1636
+ const u = r.apis, d = J({
573
1637
  first: new AbortController(),
574
1638
  again: new AbortController()
575
1639
  });
576
- async function b() {
577
- const e = a.value.trim();
578
- if (!e || o.value) return;
579
- const u = [
1640
+ async function p() {
1641
+ const l = s.value.trim();
1642
+ if (!l || e.value) return;
1643
+ const g = [
580
1644
  ...t.value,
581
- { type: "user", content: e },
582
- { type: "ai", content: "", status: d.THINKING }
1645
+ { type: "user", content: l },
1646
+ { type: "ai", content: "", status: f.THINKING }
583
1647
  ];
584
- t.value = u, a.value = "", c();
585
- const D = u.length - 1;
586
- if (v.chatQueryStreamApi) {
587
- console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", v.chatQueryStreamApi), await s(v.chatQueryStreamApi, {
588
- Query: e,
589
- AppConversationID: i.value,
1648
+ t.value = g, s.value = "", c();
1649
+ const A = g.length - 1;
1650
+ if (u.chatQueryStreamApi) {
1651
+ console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", u.chatQueryStreamApi), await i(u.chatQueryStreamApi, {
1652
+ Query: l,
1653
+ AppConversationID: n.value,
590
1654
  ResponseMode: "streaming"
591
- }, D, r.first.signal);
1655
+ }, A, d.first.signal);
592
1656
  return;
593
1657
  }
594
1658
  console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
595
1659
  try {
596
- const C = await Ot().post(v.chatQueryApi, {
597
- app: f.app ?? 1,
598
- data: { Query: e, AppConversationID: i.value }
599
- }), N = Pe(C.data);
600
- t.value = [...t.value.slice(0, -1), { type: "ai", content: N, status: d.COMPLETED }];
601
- } catch ($) {
602
- t.value = [...t.value.slice(0, -1), { type: "ai", content: ($ == null ? void 0 : $.message) || "服务连接失败,请稍后重试", status: d.ERROR }];
1660
+ const S = await Te().post(u.chatQueryApi, {
1661
+ app: r.app ?? 1,
1662
+ data: { Query: l, AppConversationID: n.value }
1663
+ }), m = ws(S.data);
1664
+ t.value = [...t.value.slice(0, -1), { type: "ai", content: m, status: f.COMPLETED }];
1665
+ } catch (w) {
1666
+ t.value = [...t.value.slice(0, -1), { type: "ai", content: (w == null ? void 0 : w.message) || "服务连接失败,请稍后重试", status: f.ERROR }];
603
1667
  }
604
1668
  }
605
- async function P() {
606
- if (!l.value || o.value) return;
607
- const e = [...t.value];
608
- e.length > 0 && e[e.length - 1].type === "ai" && e.pop(), e.push({ type: "ai", content: "", status: d.RETHINKING }), t.value = e, c();
609
- const u = t.value.length;
610
- await s(Le(v), {
611
- MessageID: l.value,
612
- AppConversationID: i.value,
1669
+ async function E() {
1670
+ if (!o.value || e.value) return;
1671
+ d.again.abort(), d.again = new AbortController();
1672
+ const l = [...t.value];
1673
+ l.length > 0 && l[l.length - 1].type === "ai" && l.pop(), l.push({ type: "ai", content: "", status: f.RETHINKING }), t.value = l, c();
1674
+ const g = t.value.length - 1, A = ks(u);
1675
+ await i(A, {
1676
+ MessageID: o.value,
1677
+ AppConversationID: n.value,
613
1678
  ResponseMode: "streaming"
614
- }, u, r.again.signal, !0);
1679
+ }, g, d.again.signal, !0);
615
1680
  }
616
- async function W() {
617
- if (!v.stopMessageApi || !o.value) return;
618
- const e = t.value.length - 1;
1681
+ async function D() {
1682
+ if (!u.stopMessageApi || !e.value) return;
1683
+ const l = t.value.length - 1 - 1;
619
1684
  try {
620
- await Lt(v, l.value);
621
- const u = [...t.value];
622
- u[e] && (u[e] = { ...u[e], content: u[e].content || "已停止回答", status: d.STOP }), t.value = u, o.value = !1, r.first.abort(), r.first = new AbortController(), r.again.abort(), r.again = new AbortController(), m.value = !0;
623
- } catch (u) {
624
- const D = [...t.value];
625
- D[e] && (D[e] = { ...D[e], content: (u == null ? void 0 : u.message) || "系统繁忙,请稍后再试", status: d.ERROR }), t.value = D;
1685
+ await Ee(u, o.value);
1686
+ const g = [...t.value];
1687
+ g[l] && (g[l] = { ...g[l], content: g[l].content || "已停止回答", status: f.STOP }), t.value = g, e.value = !1, d.first.abort(), d.first = new AbortController(), d.again.abort(), d.again = new AbortController(), a.value = !0;
1688
+ } catch (g) {
1689
+ const A = [...t.value];
1690
+ A[l] && (A[l] = { ...A[l], content: (g == null ? void 0 : g.message) || "系统繁忙,请稍后再试", status: f.ERROR }), t.value = A;
626
1691
  }
627
1692
  }
628
- async function A(e) {
629
- var u, D, $;
630
- i.value = e;
1693
+ async function y(l) {
1694
+ var g, A, w;
1695
+ n.value = l;
631
1696
  try {
632
- const C = await Pt(v, e), N = ($ = (D = (u = C == null ? void 0 : C.messages) == null ? void 0 : u[0]) == null ? void 0 : D.answerInfo) == null ? void 0 : $.answer;
633
- N && (t.value = [...t.value, { type: "ai", content: N, status: d.COMPLETED }]);
634
- } catch (C) {
635
- ot((C == null ? void 0 : C.message) || "加载历史会话失败");
1697
+ const S = await Se(u, l), m = (w = (A = (g = S == null ? void 0 : S.messages) == null ? void 0 : g[0]) == null ? void 0 : A.answerInfo) == null ? void 0 : w.answer;
1698
+ m && (t.value = [...t.value, { type: "ai", content: m, status: f.COMPLETED }]);
1699
+ } catch (S) {
1700
+ ct((S == null ? void 0 : S.message) || "加载历史会话失败");
636
1701
  }
637
1702
  }
638
- async function L() {
639
- var e;
1703
+ async function v() {
1704
+ var l;
640
1705
  try {
641
- const u = await Ht(v);
642
- (e = u == null ? void 0 : u.conversation) != null && e.appConversationID && (i.value = u.conversation.appConversationID);
643
- } catch (u) {
644
- ot((u == null ? void 0 : u.message) || "创建会话失败");
1706
+ const g = await Ae(u);
1707
+ (l = g == null ? void 0 : g.conversation) != null && l.appConversationID && (n.value = g.conversation.appConversationID);
1708
+ } catch (g) {
1709
+ ct((g == null ? void 0 : g.message) || "创建会话失败");
645
1710
  }
646
1711
  }
647
- return { sendMessage: b, regenerateResponse: P, toggleStop: W, goHistoryMessage: A, initConversation: L, controllers: r };
1712
+ return { sendMessage: p, regenerateResponse: E, toggleStop: D, goHistoryMessage: y, initConversation: v, controllers: d };
648
1713
  }
649
- const Be = { class: "container" }, We = { class: "message ai-message greet-message" }, Xe = { class: "ai-greet" }, Ge = {
1714
+ const Cs = { class: "container" }, As = { class: "message ai-message greet-message" }, Ss = { class: "ai-greet" }, Es = {
650
1715
  key: 0,
651
1716
  class: "message ai-message recommend-message"
652
- }, Ve = { class: "ai-recommend" }, Fe = { class: "recommend-header" }, Ke = ["src"], qe = ["onClick"], Qe = /* @__PURE__ */ U({
1717
+ }, Ts = { class: "ai-recommend" }, xs = { class: "recommend-header" }, Rs = ["src"], Os = ["onClick"], Ms = /* @__PURE__ */ q({
653
1718
  __name: "Answer",
654
1719
  props: {
655
1720
  defaultSayhello: {},
656
1721
  defaultRecommend: {}
657
1722
  },
658
- setup(t, { expose: a }) {
659
- const o = {
1723
+ setup(t, { expose: s }) {
1724
+ const e = {
660
1725
  THINKING: "thinking",
661
1726
  RETHINKING: "rethinking",
662
1727
  ANSWERING: "answering",
@@ -664,466 +1729,467 @@ const Be = { class: "container" }, We = { class: "message ai-message greet-messa
664
1729
  COMPLETED: "completed",
665
1730
  STOP: "stop",
666
1731
  ERROR: "error"
667
- }, l = t, i = ut(), s = T([]), m = T(""), c = T(!1), d = T(""), f = T(""), v = T(null), r = x({ text1: "", text2: "" }), b = T([]), P = T(0), W = Z(
668
- () => b.value[P.value % (b.value.length || 1)]
1732
+ }, o = t, n = wt(), i = M([]), a = M(""), c = M(!1), f = M(""), r = M(""), u = M(null), d = J({ text1: "", text2: "" }), p = M([]), E = M(0), D = et(
1733
+ () => p.value[E.value % (p.value.length || 1)]
669
1734
  );
670
- function A() {
671
- P.value++;
1735
+ function y() {
1736
+ E.value++;
672
1737
  }
673
- function L(V) {
674
- m.value = V;
1738
+ function v(Q) {
1739
+ a.value = Q;
675
1740
  }
676
- const { isAtBottom: e, hasScroll: u, scrollToBottom: D, checkScrollStatus: $ } = Me(v), { enhanceCodeBlocks: C } = Re(), { batchMessagesUpdate: N, flushMessagesBatch: O } = De(s), { displayedContent: S, streamingIndexRef: h, startTypewriter: w, stopTypewriter: k, getSegmentDisplayContent: _ } = Ne(
677
- s,
678
- D,
679
- o.ANSWERING
680
- ), { doStreamRequest: M, issTop: H } = He({
681
- messages: s,
1741
+ const { isAtBottom: l, hasScroll: g, scrollToBottom: A, checkScrollStatus: w } = gs(u), { enhanceCodeBlocks: S } = ps(), { batchMessagesUpdate: m, flushMessagesBatch: L } = vs(i), { displayedContent: T, streamingIndexRef: k, startTypewriter: C, stopTypewriter: R, getSegmentDisplayContent: P } = ms(
1742
+ i,
1743
+ A,
1744
+ e.ANSWERING
1745
+ ), { doStreamRequest: $, issTop: F } = ys({
1746
+ messages: i,
682
1747
  isGenerating: c,
683
- lastUserMessage: d,
684
- batchMessagesUpdate: N,
685
- flushMessagesBatch: O,
686
- STATUS: o,
687
- cfg: i
688
- }), { sendMessage: K, regenerateResponse: I, toggleStop: vt, goHistoryMessage: at, initConversation: y } = Oe({
689
- messages: s,
690
- userInput: m,
1748
+ lastUserMessage: f,
1749
+ batchMessagesUpdate: m,
1750
+ flushMessagesBatch: L,
1751
+ STATUS: e,
1752
+ cfg: n
1753
+ }), { sendMessage: Y, regenerateResponse: K, toggleStop: Ct, goHistoryMessage: ft, initConversation: x } = bs({
1754
+ messages: i,
1755
+ userInput: a,
691
1756
  isGenerating: c,
692
- lastUserMessage: d,
693
- conversationId: f,
694
- doStreamRequest: M,
695
- issTop: H,
696
- scrollToBottom: D,
697
- STATUS: o,
698
- cfg: i
1757
+ lastUserMessage: f,
1758
+ conversationId: r,
1759
+ doStreamRequest: $,
1760
+ issTop: F,
1761
+ scrollToBottom: A,
1762
+ STATUS: e,
1763
+ cfg: n
699
1764
  });
700
- function E() {
701
- s.value = [], d.value = "", y();
1765
+ function H() {
1766
+ i.value = [], f.value = "", x();
702
1767
  }
703
- const G = Z(() => !!f.value && s.value.length === 0);
704
- a({ goHistoryMessage: at, createNewConversation: E, isEmptyConversation: G });
705
- const q = T(/* @__PURE__ */ new Map());
706
- function it(V, F) {
707
- V ? q.value.set(F, V) : q.value.delete(F);
1768
+ const I = et(() => !!r.value && i.value.length === 0);
1769
+ s({ goHistoryMessage: ft, createNewConversation: H, isEmptyConversation: I });
1770
+ const V = M(/* @__PURE__ */ new Map());
1771
+ function dt(Q, _) {
1772
+ Q ? V.value.set(_, Q) : V.value.delete(_);
708
1773
  }
709
- wt(s, () => {
710
- rt(() => {
711
- s.value.forEach((V, F) => {
712
- V.type === "ai" && V.status !== o.ANSWERING && (S.set(F, V.content), h.value.set(F, V.content.length));
713
- }), w(), q.value.forEach((V) => {
714
- C(V);
1774
+ Pt(i, () => {
1775
+ lt(() => {
1776
+ i.value.forEach((Q, _) => {
1777
+ Q.type === "ai" && Q.status !== e.ANSWERING && (T.set(_, Q.content), k.value.set(_, Q.content.length));
1778
+ }), C(), V.value.forEach((Q) => {
1779
+ S(Q);
715
1780
  });
716
1781
  });
717
1782
  }, { deep: !0 });
718
- let j = null;
719
- return Q(() => {
720
- l.defaultSayhello && (r.text1 = l.defaultSayhello.text1, r.text2 = l.defaultSayhello.text2), l.defaultRecommend && (b.value = Xt(l.defaultRecommend));
721
- }), Q(() => {
722
- y();
723
- }), Q(() => {
724
- v.value && (j = () => $(), v.value.addEventListener("scroll", j));
725
- }), gt(() => {
726
- k(), v.value && j && v.value.removeEventListener("scroll", j);
727
- }), (V, F) => {
728
- var ft;
729
- return g(), p("div", Be, [
730
- n("div", {
1783
+ let Z = null;
1784
+ return W(() => {
1785
+ o.defaultSayhello && (d.text1 = o.defaultSayhello.text1, d.text2 = o.defaultSayhello.text2), o.defaultRecommend && (p.value = Oe(o.defaultRecommend));
1786
+ }), W(() => {
1787
+ x();
1788
+ }), W(() => {
1789
+ u.value && (Z = () => w(), u.value.addEventListener("scroll", Z));
1790
+ }), mt(() => {
1791
+ R(), u.value && Z && u.value.removeEventListener("scroll", Z);
1792
+ }), (Q, _) => {
1793
+ var Nt;
1794
+ return b(), O("div", Cs, [
1795
+ h("div", {
731
1796
  class: "chat-box scrollWrap",
732
1797
  ref_key: "chatBoxRef",
733
- ref: v
1798
+ ref: u
734
1799
  }, [
735
- n("div", We, [
736
- n("div", Xe, [
737
- n("h1", null, B(r.text1), 1),
738
- n("p", null, B(r.text2), 1)
1800
+ h("div", As, [
1801
+ h("div", Ss, [
1802
+ h("h1", null, B(d.text1), 1),
1803
+ h("p", null, B(d.text2), 1)
739
1804
  ])
740
1805
  ]),
741
- (ft = W.value) != null && ft.length ? (g(), p("div", Ge, [
742
- n("div", Ve, [
743
- n("div", Fe, [
744
- F[2] || (F[2] = n("span", null, "你可以尝试这样问我:", -1)),
745
- n("p", {
1806
+ (Nt = D.value) != null && Nt.length ? (b(), O("div", Es, [
1807
+ h("div", Ts, [
1808
+ h("div", xs, [
1809
+ _[2] || (_[2] = h("span", null, "你可以尝试这样问我:", -1)),
1810
+ h("p", {
746
1811
  class: "refresh-btn",
747
- onClick: A
1812
+ onClick: y
748
1813
  }, [
749
- n("img", { src: R(mt) }, null, 8, Ke),
750
- F[1] || (F[1] = n("span", null, "换一换", -1))
1814
+ h("img", { src: N(We) }, null, 8, Rs),
1815
+ _[1] || (_[1] = h("span", null, "换一换", -1))
751
1816
  ])
752
1817
  ]),
753
- n("ul", null, [
754
- (g(!0), p(Y, null, st(W.value, (J, lt) => (g(), p("li", {
755
- key: lt,
756
- onClick: (Hn) => L(J)
757
- }, B(J), 9, qe))), 128))
1818
+ h("ul", null, [
1819
+ (b(!0), O(U, null, rt(D.value, (tt, ht) => (b(), O("li", {
1820
+ key: ht,
1821
+ onClick: (yo) => v(tt)
1822
+ }, B(tt), 9, Os))), 128))
758
1823
  ])
759
1824
  ])
760
- ])) : X("", !0),
761
- (g(!0), p(Y, null, st(s.value, (J, lt) => (g(), et(he, {
762
- key: lt,
763
- msg: J,
764
- index: lt,
765
- STATUS: o,
766
- displayedContent: R(S),
767
- getSegmentDisplayContent: R(_),
768
- setMessageRef: it
769
- }, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent"]))), 128))
1825
+ ])) : j("", !0),
1826
+ (b(!0), O(U, null, rt(i.value, (tt, ht) => (b(), z(cn, {
1827
+ key: ht,
1828
+ msg: tt,
1829
+ index: ht,
1830
+ STATUS: e,
1831
+ displayedContent: N(T),
1832
+ getSegmentDisplayContent: N(P),
1833
+ setMessageRef: dt,
1834
+ onRegenerate: N(K)
1835
+ }, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent", "onRegenerate"]))), 128))
770
1836
  ], 512),
771
- ct(Ee, {
772
- modelValue: m.value,
773
- "onUpdate:modelValue": F[0] || (F[0] = (J) => m.value = J),
1837
+ G(hs, {
1838
+ modelValue: a.value,
1839
+ "onUpdate:modelValue": _[0] || (_[0] = (tt) => a.value = tt),
774
1840
  isGenerating: c.value,
775
- lastUserMessage: d.value,
776
- hasScroll: R(u),
777
- isAtBottom: R(e),
778
- onSend: R(K),
779
- onRegenerate: R(I),
780
- onStop: R(vt),
781
- onScrollToBottom: R(D)
1841
+ lastUserMessage: f.value,
1842
+ hasScroll: N(g),
1843
+ isAtBottom: N(l),
1844
+ onSend: N(Y),
1845
+ onRegenerate: N(K),
1846
+ onStop: N(Ct),
1847
+ onScrollToBottom: N(A)
782
1848
  }, null, 8, ["modelValue", "isGenerating", "lastUserMessage", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"])
783
1849
  ]);
784
1850
  };
785
1851
  }
786
- }), ze = { class: "ai-history" }, Ye = { class: "content" }, je = { key: 0 }, Je = ["onClick"], Ze = { class: "info-pic" }, xe = { class: "info-content" }, Ue = { class: "info-content-title" }, Ie = { class: "info-content-time" }, tn = ["onClick"], en = ["src"], nn = { class: "ai-modal" }, sn = { class: "ai-modal-footer" }, on = /* @__PURE__ */ U({
1852
+ }), Ps = { class: "ai-history" }, Ds = { class: "content" }, Ls = { key: 0 }, Hs = ["onClick"], Ns = { class: "info-pic" }, $s = { class: "info-content" }, Fs = { class: "info-content-title" }, js = { class: "info-content-time" }, Bs = ["onClick"], Is = ["src"], Qs = { class: "ai-modal" }, _s = { class: "ai-modal-footer" }, Ys = /* @__PURE__ */ q({
787
1853
  __name: "History",
788
1854
  emits: ["history-detail", "new-answer"],
789
- setup(t, { emit: a }) {
790
- const l = ut().apis, i = T([]), s = T(!1), m = T("");
1855
+ setup(t, { emit: s }) {
1856
+ const o = wt().apis, n = M([]), i = M(!1), a = M("");
791
1857
  async function c() {
792
1858
  try {
793
- const v = await Gt(l);
794
- v != null && v.conversationList && (i.value = v.conversationList.filter((r) => r !== null).map((r) => ({ ...r, selected: !1 })));
795
- } catch (v) {
796
- ot((v == null ? void 0 : v.message) || "获取历史记录失败");
1859
+ const u = await Me(o);
1860
+ u != null && u.conversationList && (n.value = u.conversationList.filter((d) => d !== null).map((d) => ({ ...d, selected: !1 })));
1861
+ } catch (u) {
1862
+ ct((u == null ? void 0 : u.message) || "获取历史记录失败");
797
1863
  }
798
1864
  }
799
- function d(v) {
800
- m.value = v, s.value = !0;
1865
+ function f(u) {
1866
+ a.value = u, i.value = !0;
801
1867
  }
802
- async function f() {
803
- s.value = !1;
1868
+ async function r() {
1869
+ i.value = !1;
804
1870
  try {
805
- await Vt(l, m.value), await c();
806
- } catch (v) {
807
- ot((v == null ? void 0 : v.message) || "删除失败"), await c();
1871
+ await Pe(o, a.value), await c();
1872
+ } catch (u) {
1873
+ ct((u == null ? void 0 : u.message) || "删除失败"), await c();
808
1874
  }
809
1875
  }
810
- return Q(() => {
1876
+ return W(() => {
811
1877
  c();
812
- }), (v, r) => (g(), p("div", ze, [
813
- n("div", Ye, [
814
- i.value.length > 0 ? (g(), p("div", je, [
815
- (g(!0), p(Y, null, st(i.value, (b) => (g(), p("div", {
816
- key: b.appConversationID,
1878
+ }), (u, d) => (b(), O("div", Ps, [
1879
+ h("div", Ds, [
1880
+ n.value.length > 0 ? (b(), O("div", Ls, [
1881
+ (b(!0), O(U, null, rt(n.value, (p) => (b(), O("div", {
1882
+ key: p.appConversationID,
817
1883
  class: "info",
818
- onClick: (P) => v.$emit("history-detail", b.appConversationID)
1884
+ onClick: (E) => u.$emit("history-detail", p.appConversationID)
819
1885
  }, [
820
- n("div", Ze, B(b.conversationName.slice(0, 1)), 1),
821
- n("div", xe, [
822
- n("div", Ue, B(b.conversationName), 1),
823
- n("div", Ie, B(b.createTime), 1)
1886
+ h("div", Ns, B(p.conversationName.slice(0, 1)), 1),
1887
+ h("div", $s, [
1888
+ h("div", Fs, B(p.conversationName), 1),
1889
+ h("div", js, B(p.createTime), 1)
824
1890
  ]),
825
- n("div", {
1891
+ h("div", {
826
1892
  class: "clear-history",
827
- onClick: ht((P) => d(b.appConversationID), ["stop"])
828
- }, "删除", 8, tn)
829
- ], 8, Je))), 128))
830
- ])) : X("", !0)
1893
+ onClick: Ft((E) => f(p.appConversationID), ["stop"])
1894
+ }, "删除", 8, Bs)
1895
+ ], 8, Hs))), 128))
1896
+ ])) : j("", !0)
831
1897
  ]),
832
- n("div", {
1898
+ h("div", {
833
1899
  class: "ai-add",
834
- onClick: r[0] || (r[0] = (b) => v.$emit("new-answer"))
1900
+ onClick: d[0] || (d[0] = (p) => u.$emit("new-answer"))
835
1901
  }, [
836
- n("img", { src: R(Yt) }, null, 8, en),
837
- r[3] || (r[3] = n("span", { style: { color: "#333333" } }, "新建AI对话", -1))
1902
+ h("img", { src: N(Be) }, null, 8, Is),
1903
+ d[3] || (d[3] = h("span", { style: { color: "#333333" } }, "新建AI对话", -1))
838
1904
  ]),
839
- (g(), et(At, { to: "body" }, [
840
- s.value ? (g(), p("div", {
1905
+ (b(), z(ye, { to: "body" }, [
1906
+ i.value ? (b(), O("div", {
841
1907
  key: 0,
842
1908
  class: "ai-modal-overlay",
843
- onClick: r[2] || (r[2] = ht((b) => s.value = !1, ["self"]))
1909
+ onClick: d[2] || (d[2] = Ft((p) => i.value = !1, ["self"]))
844
1910
  }, [
845
- n("div", nn, [
846
- r[4] || (r[4] = n("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
847
- r[5] || (r[5] = n("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
848
- n("div", sn, [
849
- n("button", {
1911
+ h("div", Qs, [
1912
+ d[4] || (d[4] = h("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
1913
+ d[5] || (d[5] = h("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
1914
+ h("div", _s, [
1915
+ h("button", {
850
1916
  class: "ai-modal-btn cancel",
851
- onClick: r[1] || (r[1] = (b) => s.value = !1)
1917
+ onClick: d[1] || (d[1] = (p) => i.value = !1)
852
1918
  }, "取消"),
853
- n("button", {
1919
+ h("button", {
854
1920
  class: "ai-modal-btn confirm",
855
- onClick: f
1921
+ onClick: r
856
1922
  }, "确定")
857
1923
  ])
858
1924
  ])
859
- ])) : X("", !0)
1925
+ ])) : j("", !0)
860
1926
  ]))
861
1927
  ]));
862
1928
  }
863
- }), an = (t, a) => {
864
- const o = t.__vccOpts || t;
865
- for (const [l, i] of a)
866
- o[l] = i;
867
- return o;
868
- }, ln = /* @__PURE__ */ an(on, [["__scopeId", "data-v-9267d81a"]]), cn = { class: "container info" }, rn = { class: "info-item" }, un = { class: "basic-content" }, vn = { class: "basic-content-text" }, dn = { class: "basic-content" }, gn = { class: "basic-content-text" }, mn = { class: "info-item" }, fn = { class: "permission-content" }, hn = { class: "info-item" }, pn = { class: "basic-content" }, yn = { class: "basic-content-text" }, kn = { class: "basic-content" }, wn = { class: "basic-content-text" }, Cn = /* @__PURE__ */ U({
1929
+ }), Vs = (t, s) => {
1930
+ const e = t.__vccOpts || t;
1931
+ for (const [o, n] of s)
1932
+ e[o] = n;
1933
+ return e;
1934
+ }, Ws = /* @__PURE__ */ Vs(Ys, [["__scopeId", "data-v-9267d81a"]]), Xs = { class: "container info" }, Gs = { class: "info-item" }, Us = { class: "basic-content" }, zs = { class: "basic-content-text" }, Js = { class: "basic-content" }, qs = { class: "basic-content-text" }, Ks = { class: "info-item" }, Zs = { class: "permission-content" }, to = { class: "info-item" }, eo = { class: "basic-content" }, no = { class: "basic-content-text" }, so = { class: "basic-content" }, oo = { class: "basic-content-text" }, io = /* @__PURE__ */ q({
869
1935
  __name: "Info",
870
1936
  setup(t) {
871
- const a = ut(), o = T(null);
872
- return Q(async () => {
1937
+ const s = wt(), e = M(null);
1938
+ return W(async () => {
873
1939
  try {
874
- o.value = await Ft(a.apis);
875
- } catch (l) {
876
- ot((l == null ? void 0 : l.message) || "获取个人信息失败");
1940
+ e.value = await De(s.apis);
1941
+ } catch (o) {
1942
+ ct((o == null ? void 0 : o.message) || "获取个人信息失败");
877
1943
  }
878
- }), (l, i) => {
879
- var s, m, c, d, f;
880
- return g(), p("div", cn, [
881
- n("div", rn, [
882
- i[2] || (i[2] = n("div", { class: "heading" }, [
883
- n("div", { class: "heading-column" }),
884
- n("div", { class: "heading-title" }, "基本信息")
1944
+ }), (o, n) => {
1945
+ var i, a, c, f, r;
1946
+ return b(), O("div", Xs, [
1947
+ h("div", Gs, [
1948
+ n[2] || (n[2] = h("div", { class: "heading" }, [
1949
+ h("div", { class: "heading-column" }),
1950
+ h("div", { class: "heading-title" }, "基本信息")
885
1951
  ], -1)),
886
- n("div", un, [
887
- i[0] || (i[0] = n("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
888
- n("div", vn, B(((s = o.value) == null ? void 0 : s.name) || ""), 1)
1952
+ h("div", Us, [
1953
+ n[0] || (n[0] = h("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
1954
+ h("div", zs, B(((i = e.value) == null ? void 0 : i.name) || ""), 1)
889
1955
  ]),
890
- n("div", dn, [
891
- i[1] || (i[1] = n("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
892
- n("div", gn, B(((m = o.value) == null ? void 0 : m.userName) || ""), 1)
1956
+ h("div", Js, [
1957
+ n[1] || (n[1] = h("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
1958
+ h("div", qs, B(((a = e.value) == null ? void 0 : a.userName) || ""), 1)
893
1959
  ])
894
1960
  ]),
895
- n("div", mn, [
896
- i[3] || (i[3] = n("div", { class: "heading" }, [
897
- n("div", { class: "heading-column" }),
898
- n("div", { class: "heading-title" }, "数据权限")
1961
+ h("div", Ks, [
1962
+ n[3] || (n[3] = h("div", { class: "heading" }, [
1963
+ h("div", { class: "heading-column" }),
1964
+ h("div", { class: "heading-title" }, "数据权限")
899
1965
  ], -1)),
900
- n("div", fn, [
901
- (g(!0), p(Y, null, st((c = o.value) == null ? void 0 : c.ptnameList, (v, r) => (g(), p("div", {
902
- key: r,
1966
+ h("div", Zs, [
1967
+ (b(!0), O(U, null, rt((c = e.value) == null ? void 0 : c.ptnameList, (u, d) => (b(), O("div", {
1968
+ key: d,
903
1969
  class: "permission-content-text"
904
- }, B(v), 1))), 128))
1970
+ }, B(u), 1))), 128))
905
1971
  ])
906
1972
  ]),
907
- n("div", hn, [
908
- i[6] || (i[6] = n("div", { class: "heading" }, [
909
- n("div", { class: "heading-column" }),
910
- n("div", { class: "heading-title" }, "帮助信息")
1973
+ h("div", to, [
1974
+ n[6] || (n[6] = h("div", { class: "heading" }, [
1975
+ h("div", { class: "heading-column" }),
1976
+ h("div", { class: "heading-title" }, "帮助信息")
911
1977
  ], -1)),
912
- n("div", pn, [
913
- i[4] || (i[4] = n("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
914
- n("div", yn, B(((d = o.value) == null ? void 0 : d.dept) || ""), 1)
1978
+ h("div", eo, [
1979
+ n[4] || (n[4] = h("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
1980
+ h("div", no, B(((f = e.value) == null ? void 0 : f.dept) || ""), 1)
915
1981
  ]),
916
- n("div", kn, [
917
- i[5] || (i[5] = n("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
918
- n("div", wn, B(((f = o.value) == null ? void 0 : f.email) || ""), 1)
1982
+ h("div", so, [
1983
+ n[5] || (n[5] = h("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
1984
+ h("div", oo, B(((r = e.value) == null ? void 0 : r.email) || ""), 1)
919
1985
  ])
920
1986
  ])
921
1987
  ]);
922
1988
  };
923
1989
  }
924
- }), $n = { class: "header" }, Sn = ["src"], _n = { class: "header-title" }, bn = ["src"], Tn = ["src"], An = { class: "setTitle" }, En = { class: "content" }, Mn = { class: "main" }, Rn = { class: "btn" }, Dn = ["src"], Nn = 117, tt = 118, $t = /* @__PURE__ */ U({
1990
+ }), ao = { class: "header" }, ro = ["src"], lo = { class: "header-title" }, co = ["src"], uo = ["src"], fo = { class: "setTitle" }, ho = { class: "content" }, go = { class: "main" }, po = { class: "btn" }, vo = ["src"], mo = 117, it = 118, de = /* @__PURE__ */ q({
925
1991
  __name: "AiAssist",
926
1992
  setup(t) {
927
- const a = Nn / 2, o = ut(), l = T(!1), i = T(!1), s = T("answer"), m = T(!1), c = T(""), d = T(""), f = x({
928
- x: window.innerWidth - a,
929
- y: window.innerHeight / 2 - tt / 2
930
- }), v = T(!1), r = T(!1), b = T("right"), P = T("left"), W = x({ x: 0, y: 0 }), A = T(!1), L = T(null);
931
- let e = null;
932
- const u = Z(() => {
933
- const y = window.innerWidth / 2;
934
- return f.x + a < y ? 5 : -5;
935
- }), D = Z(() => i.value ? "" : `panel-${b.value}`), $ = Z(() => {
936
- var y;
937
- return !((y = L.value) != null && y.isEmptyConversation);
938
- }), C = Z(() => ({
939
- left: `${f.x}px`,
940
- top: `${f.y}px`,
941
- transition: v.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
942
- "--direction": String(u.value)
1993
+ const s = mo / 2, e = wt(), o = M(!1), n = M(!1), i = M("answer"), a = M(!1), c = M(""), f = M(""), r = J({
1994
+ x: window.innerWidth - s,
1995
+ y: window.innerHeight / 2 - it / 2
1996
+ }), u = M(!1), d = M(!1), p = M("right"), E = M("left"), D = J({ x: 0, y: 0 }), y = M(!1), v = M(null);
1997
+ let l = null;
1998
+ const g = et(() => {
1999
+ const x = window.innerWidth / 2;
2000
+ return r.x + s < x ? 5 : -5;
2001
+ }), A = et(() => n.value ? "" : `panel-${p.value}`), w = et(() => {
2002
+ var x;
2003
+ return !((x = v.value) != null && x.isEmptyConversation);
2004
+ }), S = et(() => ({
2005
+ left: `${r.x}px`,
2006
+ top: `${r.y}px`,
2007
+ transition: u.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
2008
+ "--direction": String(g.value)
943
2009
  }));
944
- function N() {
945
- const y = window.innerWidth / 2;
946
- f.x + a < y ? (b.value = "left", P.value = "right") : (b.value = "right", P.value = "left");
2010
+ function m() {
2011
+ const x = window.innerWidth / 2;
2012
+ r.x + s < x ? (p.value = "left", E.value = "right") : (p.value = "right", E.value = "left");
947
2013
  }
948
- function O() {
949
- const y = window.innerWidth, E = Math.max(0, Math.min(f.y, window.innerHeight - tt));
950
- return { x: f.x + a >= y / 2 ? y - a : -a, y: E };
2014
+ function L() {
2015
+ const x = window.innerWidth, H = Math.max(0, Math.min(r.y, window.innerHeight - it));
2016
+ return { x: r.x + s >= x / 2 ? x - s : -s, y: H };
951
2017
  }
952
- function S() {
953
- r.value = !0;
954
- const y = O();
955
- f.x = y.x, f.y = y.y, setTimeout(() => {
956
- r.value = !1, N(), h();
2018
+ function T() {
2019
+ d.value = !0;
2020
+ const x = L();
2021
+ r.x = x.x, r.y = x.y, setTimeout(() => {
2022
+ d.value = !1, m(), k();
957
2023
  }, 400);
958
2024
  }
959
- function h() {
2025
+ function k() {
960
2026
  try {
961
- localStorage.setItem("characterPosition", JSON.stringify({ x: f.x, y: f.y })), localStorage.setItem("panelPosition", b.value), localStorage.setItem("backPosition", P.value);
2027
+ localStorage.setItem("characterPosition", JSON.stringify({ x: r.x, y: r.y })), localStorage.setItem("panelPosition", p.value), localStorage.setItem("backPosition", E.value);
962
2028
  } catch {
963
2029
  }
964
2030
  }
965
- function w() {
966
- const y = localStorage.getItem("characterPosition");
967
- if (y) {
968
- const q = JSON.parse(y);
969
- f.x = q.x, f.y = Math.min(Math.max(q.y, 0), window.innerHeight - tt);
2031
+ function C() {
2032
+ const x = localStorage.getItem("characterPosition");
2033
+ if (x) {
2034
+ const V = JSON.parse(x);
2035
+ r.x = V.x, r.y = Math.min(Math.max(V.y, 0), window.innerHeight - it);
970
2036
  } else
971
- f.x = window.innerWidth - a, f.y = window.innerHeight / 2 - tt / 2;
972
- const E = localStorage.getItem("panelPosition"), G = localStorage.getItem("backPosition");
973
- E && (b.value = E), G && (P.value = G);
2037
+ r.x = window.innerWidth - s, r.y = window.innerHeight / 2 - it / 2;
2038
+ const H = localStorage.getItem("panelPosition"), I = localStorage.getItem("backPosition");
2039
+ H && (p.value = H), I && (E.value = I);
974
2040
  }
975
- function k(y) {
976
- if (!v.value) return;
977
- const E = "touches" in y ? y.touches[0].clientX : y.clientX, G = "touches" in y ? y.touches[0].clientY : y.clientY, q = E - W.x, it = Math.max(0, Math.min(G - W.y, window.innerHeight - tt)), j = Math.abs(q - f.x), V = Math.abs(it - f.y);
978
- j + V > 5 && (A.value = !0), f.x = q, f.y = it;
2041
+ function R(x) {
2042
+ if (!u.value) return;
2043
+ const H = "touches" in x ? x.touches[0].clientX : x.clientX, I = "touches" in x ? x.touches[0].clientY : x.clientY, V = H - D.x, dt = Math.max(0, Math.min(I - D.y, window.innerHeight - it)), Z = Math.abs(V - r.x), Q = Math.abs(dt - r.y);
2044
+ Z + Q > 5 && (y.value = !0), r.x = V, r.y = dt;
979
2045
  }
980
- function _() {
981
- v.value && (v.value = !1, A.value && (S(), A.value = !1));
2046
+ function P() {
2047
+ u.value && (u.value = !1, y.value && (T(), y.value = !1));
982
2048
  }
983
- function M(y) {
984
- r.value = !1, v.value = !0, A.value = !1;
985
- const E = "touches" in y ? y.touches[0].clientX : y.clientX, G = "touches" in y ? y.touches[0].clientY : y.clientY;
986
- W.x = E - f.x, W.y = G - f.y;
2049
+ function $(x) {
2050
+ d.value = !1, u.value = !0, y.value = !1;
2051
+ const H = "touches" in x ? x.touches[0].clientX : x.clientX, I = "touches" in x ? x.touches[0].clientY : x.clientY;
2052
+ D.x = H - r.x, D.y = I - r.y;
987
2053
  }
988
- function H() {
989
- !A.value && !r.value ? (N(), l.value = !0) : A.value = !1;
2054
+ function F() {
2055
+ !y.value && !d.value ? (m(), o.value = !0) : y.value = !1;
990
2056
  }
991
- function K(y) {
992
- s.value = "answer", rt(() => {
993
- var E;
994
- (E = L.value) == null || E.goHistoryMessage(y);
2057
+ function Y(x) {
2058
+ i.value = "answer", lt(() => {
2059
+ var H;
2060
+ (H = v.value) == null || H.goHistoryMessage(x);
995
2061
  });
996
2062
  }
997
- function I() {
998
- s.value = "answer", rt(() => {
999
- var y;
1000
- (y = L.value) == null || y.createNewConversation();
2063
+ function K() {
2064
+ i.value = "answer", lt(() => {
2065
+ var x;
2066
+ (x = v.value) == null || x.createNewConversation();
1001
2067
  });
1002
2068
  }
1003
- function vt() {
1004
- d.value = c.value, m.value = !1;
2069
+ function Ct() {
2070
+ f.value = c.value, a.value = !1;
1005
2071
  }
1006
- wt(i, (y) => {
1007
- y ? b.value = "center" : N();
1008
- }), Q(() => {
1009
- w();
2072
+ Pt(n, (x) => {
2073
+ x ? p.value = "center" : m();
2074
+ }), W(() => {
2075
+ C();
1010
2076
  });
1011
- function at() {
1012
- e && clearTimeout(e), e = setTimeout(() => S(), 100);
2077
+ function ft() {
2078
+ l && clearTimeout(l), l = setTimeout(() => T(), 100);
1013
2079
  }
1014
- return Q(() => {
1015
- window.addEventListener("resize", at);
1016
- }), gt(() => {
1017
- window.removeEventListener("resize", at), e && clearTimeout(e);
1018
- }), Q(() => {
1019
- document.addEventListener("mousemove", k), document.addEventListener("touchmove", k, { passive: !0 }), document.addEventListener("mouseup", _), document.addEventListener("touchend", _);
1020
- }), gt(() => {
1021
- document.removeEventListener("mousemove", k), document.removeEventListener("touchmove", k), document.removeEventListener("mouseup", _), document.removeEventListener("touchend", _);
1022
- }), (y, E) => (g(), p("div", null, [
1023
- l.value ? (g(), p("div", {
2080
+ return W(() => {
2081
+ window.addEventListener("resize", ft);
2082
+ }), mt(() => {
2083
+ window.removeEventListener("resize", ft), l && clearTimeout(l);
2084
+ }), W(() => {
2085
+ document.addEventListener("mousemove", R), document.addEventListener("touchmove", R, { passive: !0 }), document.addEventListener("mouseup", P), document.addEventListener("touchend", P);
2086
+ }), mt(() => {
2087
+ document.removeEventListener("mousemove", R), document.removeEventListener("touchmove", R), document.removeEventListener("mouseup", P), document.removeEventListener("touchend", P);
2088
+ }), (x, H) => (b(), O("div", null, [
2089
+ o.value ? (b(), O("div", {
1024
2090
  key: 0,
1025
- class: z(["ai-panel", i.value ? "maxWrap" : "minWrap", D.value])
2091
+ class: X(["ai-panel", n.value ? "maxWrap" : "minWrap", A.value])
1026
2092
  }, [
1027
- n("div", $n, [
1028
- n("p", null, [
1029
- s.value === "info" || s.value === "history" ? (g(), p("span", {
2093
+ h("div", ao, [
2094
+ h("p", null, [
2095
+ i.value === "info" || i.value === "history" ? (b(), O("span", {
1030
2096
  key: 0,
1031
- class: z(["back", P.value]),
1032
- onClick: E[0] || (E[0] = (G) => s.value = "answer")
1033
- }, [...E[6] || (E[6] = [
1034
- n("span", { style: { "font-size": "18px" } }, "←", -1)
1035
- ])], 2)) : (g(), p("img", {
2097
+ class: X(["back", E.value]),
2098
+ onClick: H[0] || (H[0] = (I) => i.value = "answer")
2099
+ }, [...H[6] || (H[6] = [
2100
+ h("span", { style: { "font-size": "18px" } }, "←", -1)
2101
+ ])], 2)) : (b(), O("img", {
1036
2102
  key: 1,
1037
- src: R(jt)
1038
- }, null, 8, Sn))
2103
+ src: N(Ie)
2104
+ }, null, 8, ro))
1039
2105
  ]),
1040
- n("div", _n, [
1041
- n("span", null, B(s.value === "info" ? "个人信息" : s.value === "history" ? "历史信息" : R(o).name), 1)
2106
+ h("div", lo, [
2107
+ h("span", null, B(i.value === "info" ? "个人信息" : i.value === "history" ? "历史信息" : N(e).name), 1)
1042
2108
  ]),
1043
- n("p", null, [
1044
- dt(ct(R(te), {
2109
+ h("p", null, [
2110
+ At(G(N(Fe), {
1045
2111
  class: "op-icon",
1046
- onClick: I
2112
+ onClick: K
1047
2113
  }, null, 512), [
1048
- [pt, $.value]
2114
+ [jt, w.value]
1049
2115
  ]),
1050
- n("img", {
1051
- onClick: E[1] || (E[1] = (G) => i.value = !i.value),
1052
- src: i.value ? R(Jt) : R(Zt)
1053
- }, null, 8, bn),
1054
- n("img", {
1055
- onClick: E[2] || (E[2] = (G) => l.value = !1),
1056
- src: R(xt)
1057
- }, null, 8, Tn)
2116
+ h("img", {
2117
+ onClick: H[1] || (H[1] = (I) => n.value = !n.value),
2118
+ src: n.value ? N(Qe) : N(_e)
2119
+ }, null, 8, co),
2120
+ h("img", {
2121
+ onClick: H[2] || (H[2] = (I) => o.value = !1),
2122
+ src: N(Ye)
2123
+ }, null, 8, uo)
1058
2124
  ])
1059
2125
  ]),
1060
- s.value === "answer" ? (g(), et(Qe, {
2126
+ i.value === "answer" ? (b(), z(Ms, {
1061
2127
  key: 0,
1062
2128
  ref_key: "answerRef",
1063
- ref: L,
1064
- defaultSayhello: R(o).defaultSayhello,
1065
- defaultRecommend: R(o).defaultRecommend
1066
- }, null, 8, ["defaultSayhello", "defaultRecommend"])) : X("", !0),
1067
- s.value === "history" ? (g(), et(ln, {
2129
+ ref: v,
2130
+ defaultSayhello: N(e).defaultSayhello,
2131
+ defaultRecommend: N(e).defaultRecommend
2132
+ }, null, 8, ["defaultSayhello", "defaultRecommend"])) : j("", !0),
2133
+ i.value === "history" ? (b(), z(Ws, {
1068
2134
  key: 1,
1069
- onHistoryDetail: K,
1070
- onNewAnswer: E[3] || (E[3] = (G) => s.value = "answer")
1071
- })) : X("", !0),
1072
- s.value === "info" ? (g(), et(Cn, { key: 2 })) : X("", !0),
1073
- dt(n("div", An, [
1074
- n("div", En, [
1075
- n("div", Mn, [
1076
- E[7] || (E[7] = n("p", { class: "title" }, "修改标题", -1)),
1077
- dt(n("textarea", {
1078
- "onUpdate:modelValue": E[4] || (E[4] = (G) => c.value = G),
2135
+ onHistoryDetail: Y,
2136
+ onNewAnswer: H[3] || (H[3] = (I) => i.value = "answer")
2137
+ })) : j("", !0),
2138
+ i.value === "info" ? (b(), z(io, { key: 2 })) : j("", !0),
2139
+ At(h("div", fo, [
2140
+ h("div", ho, [
2141
+ h("div", go, [
2142
+ H[7] || (H[7] = h("p", { class: "title" }, "修改标题", -1)),
2143
+ At(h("textarea", {
2144
+ "onUpdate:modelValue": H[4] || (H[4] = (I) => c.value = I),
1079
2145
  placeholder: "请输入新标题"
1080
2146
  }, null, 512), [
1081
- [Et, c.value]
2147
+ [we, c.value]
1082
2148
  ]),
1083
- n("p", Rn, [
1084
- n("span", {
1085
- onClick: E[5] || (E[5] = (G) => m.value = !1)
2149
+ h("p", po, [
2150
+ h("span", {
2151
+ onClick: H[5] || (H[5] = (I) => a.value = !1)
1086
2152
  }, "取消"),
1087
- n("span", { onClick: vt }, "确定")
2153
+ h("span", { onClick: Ct }, "确定")
1088
2154
  ])
1089
2155
  ])
1090
2156
  ])
1091
2157
  ], 512), [
1092
- [pt, m.value]
2158
+ [jt, a.value]
1093
2159
  ])
1094
- ], 2)) : X("", !0),
1095
- l.value ? X("", !0) : (g(), p("div", {
2160
+ ], 2)) : j("", !0),
2161
+ o.value ? j("", !0) : (b(), O("div", {
1096
2162
  key: 1,
1097
- class: z(["character", { dragging: v.value, recycling: r.value }]),
1098
- style: Mt(C.value),
1099
- onMousedown: M,
1100
- onTouchstart: M,
1101
- onClick: H
2163
+ class: X(["character", { dragging: u.value, recycling: d.value }]),
2164
+ style: ke(S.value),
2165
+ onMousedown: $,
2166
+ onTouchstart: $,
2167
+ onClick: F
1102
2168
  }, [
1103
- n("img", { src: R(Ut) }, null, 8, Dn)
2169
+ h("img", { src: N(Ve) }, null, 8, vo)
1104
2170
  ], 38))
1105
2171
  ]));
1106
2172
  }
1107
2173
  });
1108
- let nt = null;
1109
- const Wn = (t) => {
1110
- Ct(t);
1111
- }, Xn = (t) => {
1112
- const a = t || document.body, o = document.createElement("div");
1113
- o.id = "ai-assist-root", a.appendChild(o), nt = Rt($t), nt.mount(o);
1114
- }, Gn = () => {
1115
- nt && (nt.unmount(), nt = null);
2174
+ let at = null;
2175
+ const Ao = (t) => {
2176
+ te(t);
2177
+ }, So = (t) => {
2178
+ const s = t || document.body, e = document.createElement("div");
2179
+ e.id = "ai-assist-root", s.appendChild(e), at = be(de), at.mount(e);
2180
+ }, Eo = () => {
2181
+ at && (at.unmount(), at = null);
1116
2182
  const t = document.getElementById("ai-assist-root");
1117
2183
  t && t.remove();
1118
- }, Vn = {
1119
- install(t, a) {
1120
- Ct(a), t.component("AiAssist", $t);
2184
+ }, To = {
2185
+ install(t, s) {
2186
+ te(s), t.component("AiAssist", de);
1121
2187
  }
1122
2188
  };
1123
2189
  export {
1124
- $t as AiAssist,
1125
- Vn as default,
1126
- Wn as initAiAssist,
1127
- Xn as mountAiAssist,
1128
- Gn as unmountAiAssist
2190
+ de as AiAssist,
2191
+ To as default,
2192
+ Ao as initAiAssist,
2193
+ So as mountAiAssist,
2194
+ Eo as unmountAiAssist
1129
2195
  };