@qfei-design/make-ai-assistant 0.1.7 → 0.1.8

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.
package/dist/react.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { jsxs as i, jsx as a, Fragment as P } from "react/jsx-runtime";
2
- import { resolveArtifactTemplate as ot, createArtifactTemplateRegistry as De, createArtifactCapabilities as ct } from "./index.mjs";
3
- import { extendArtifactTemplateRegistry as Xt } from "./index.mjs";
4
- import { useState as S, useRef as R, useMemo as Le, useEffect as he } from "react";
5
- import { a as me, r as ue, c as pe, M as b, b as lt, p as dt } from "./conversation-B7eGUXi-.js";
6
- import { d as ta, e as aa, f as sa, g as na, v as ra } from "./conversation-B7eGUXi-.js";
7
- function mt({
1
+ import { jsxs as i, jsx as a, Fragment as B } from "react/jsx-runtime";
2
+ import { resolveArtifactTemplate as lt, createArtifactTemplateRegistry as Ue, createArtifactCapabilities as dt } from "./index.mjs";
3
+ import { extendArtifactTemplateRegistry as ta } from "./index.mjs";
4
+ import { useState as R, useRef as x, useMemo as Fe, useEffect as fe } from "react";
5
+ import { a as pe, r as he, c as ge, M as I, b as mt, p as ut } from "./conversation-B7eGUXi-.js";
6
+ import { d as sa, e as na, f as ra, g as ia, v as oa } from "./conversation-B7eGUXi-.js";
7
+ function pt({
8
8
  artifact: e,
9
9
  context: t,
10
10
  fallback: s,
@@ -12,8 +12,8 @@ function mt({
12
12
  onActionError: o,
13
13
  registry: c
14
14
  }) {
15
- const m = ot(c, e, t);
16
- if (!m)
15
+ const d = lt(c, e, t);
16
+ if (!d)
17
17
  return s ? s(e) : /* @__PURE__ */ i("section", { className: "make-ai-artifact make-ai-artifact--unsupported", role: "status", children: [
18
18
  /* @__PURE__ */ a("strong", { children: "暂不支持展示此结果" }),
19
19
  /* @__PURE__ */ i("span", { children: [
@@ -26,9 +26,9 @@ function mt({
26
26
  onAction: r,
27
27
  onActionError: o
28
28
  };
29
- return m.template.render(e, t, u);
29
+ return d.template.render(e, t, u);
30
30
  }
31
- const B = (e, t, s) => {
31
+ const D = (e, t, s) => {
32
32
  if (e == null || e === "") return "—";
33
33
  if (typeof e == "boolean") return e ? "是" : "否";
34
34
  if (typeof e != "number") return `${e}${t?.unit ?? ""}`;
@@ -43,12 +43,12 @@ const B = (e, t, s) => {
43
43
  } catch {
44
44
  return `${e}${t?.unit ?? ""}`;
45
45
  }
46
- }, Ue = (e) => {
46
+ }, Ve = (e) => {
47
47
  let t = Number.POSITIVE_INFINITY, s = Number.NEGATIVE_INFINITY;
48
48
  for (const r of e)
49
49
  t = Math.min(t, r), s = Math.max(s, r);
50
50
  return Number.isFinite(t) && Number.isFinite(s) ? { min: t, max: s } : { min: 0, max: 0 };
51
- }, Ve = (e, t, s) => {
51
+ }, qe = (e, t, s) => {
52
52
  if (!s.onAction) return;
53
53
  const r = (c) => {
54
54
  console.error("[make-ai-assistant] host action error handler failed", {
@@ -63,8 +63,8 @@ const B = (e, t, s) => {
63
63
  Promise.resolve(
64
64
  s.onActionError(c, e, t)
65
65
  ).catch(r);
66
- } catch (m) {
67
- r(m);
66
+ } catch (d) {
67
+ r(d);
68
68
  }
69
69
  return;
70
70
  }
@@ -80,19 +80,19 @@ const B = (e, t, s) => {
80
80
  } catch (c) {
81
81
  o(c);
82
82
  }
83
- }, W = (e, t) => e.actions?.length && t.onAction ? /* @__PURE__ */ a("div", { className: "make-ai-artifact__actions", children: e.actions.map((s) => /* @__PURE__ */ i(
83
+ }, G = (e, t) => e.actions?.length && t.onAction ? /* @__PURE__ */ a("div", { className: "make-ai-artifact__actions", children: e.actions.map((s) => /* @__PURE__ */ i(
84
84
  "button",
85
85
  {
86
86
  className: `make-ai-artifact__action make-ai-artifact__action--${s.appearance ?? "link"}`,
87
87
  type: "button",
88
- onClick: () => Ve(s, { artifact: e, context: t.context }, t),
88
+ onClick: () => qe(s, { artifact: e, context: t.context }, t),
89
89
  children: [
90
90
  s.label,
91
91
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "→" })
92
92
  ]
93
93
  },
94
94
  s.id
95
- )) }) : null, J = (e, t, s = "") => /* @__PURE__ */ i(
95
+ )) }) : null, Y = (e, t, s = "") => /* @__PURE__ */ i(
96
96
  "section",
97
97
  {
98
98
  "aria-label": e.title ?? `${e.kind} result`,
@@ -105,19 +105,19 @@ const B = (e, t, s) => {
105
105
  t
106
106
  ]
107
107
  }
108
- ), ut = ({
108
+ ), ht = ({
109
109
  artifact: e,
110
110
  renderContext: t
111
111
  }) => {
112
- const s = e.data.delta, r = s ? B(
112
+ const s = e.data.delta, r = s ? D(
113
113
  s.value,
114
114
  s.format === "percent" ? { style: "percent" } : void 0,
115
115
  t.context.locale
116
116
  ) : void 0;
117
- return J(
117
+ return Y(
118
118
  e,
119
- /* @__PURE__ */ i(P, { children: [
120
- /* @__PURE__ */ a("div", { className: "make-ai-artifact__metric-value", children: B(
119
+ /* @__PURE__ */ i(B, { children: [
120
+ /* @__PURE__ */ a("div", { className: "make-ai-artifact__metric-value", children: D(
121
121
  e.data.value,
122
122
  e.data.format,
123
123
  t.context.locale
@@ -134,51 +134,51 @@ const B = (e, t, s) => {
134
134
  }
135
135
  ) : null,
136
136
  e.data.context ? /* @__PURE__ */ a("p", { className: "make-ai-artifact__context", children: e.data.context }) : null,
137
- W(e, t)
137
+ G(e, t)
138
138
  ] }),
139
139
  "make-ai-artifact--metric"
140
140
  );
141
- }, pt = ({
141
+ }, gt = ({
142
142
  artifact: e,
143
143
  renderContext: t
144
- }) => J(
144
+ }) => Y(
145
145
  e,
146
- /* @__PURE__ */ i(P, { children: [
146
+ /* @__PURE__ */ i(B, { children: [
147
147
  /* @__PURE__ */ a("div", { className: "make-ai-artifact__comparison", children: e.data.items.map((s) => /* @__PURE__ */ i("div", { className: "make-ai-artifact__comparison-item", children: [
148
148
  /* @__PURE__ */ a("span", { children: s.label }),
149
- /* @__PURE__ */ a("strong", { children: B(s.value, s.format, t.context.locale) }),
149
+ /* @__PURE__ */ a("strong", { children: D(s.value, s.format, t.context.locale) }),
150
150
  s.hint ? /* @__PURE__ */ a("small", { children: s.hint }) : null
151
151
  ] }, s.id)) }),
152
- W(e, t)
152
+ G(e, t)
153
153
  ] }),
154
154
  "make-ai-artifact--comparison"
155
- ), ht = ({
155
+ ), ft = ({
156
156
  artifact: e,
157
157
  renderContext: t
158
158
  }) => {
159
- const s = e.data.series.flatMap((m) => m.points.map((u) => u.y)), { max: r, min: o } = Ue(s), c = r - o || 1;
160
- return J(
159
+ const s = e.data.series.flatMap((d) => d.points.map((u) => u.y)), { max: r, min: o } = Ve(s), c = r - o || 1;
160
+ return Y(
161
161
  e,
162
- /* @__PURE__ */ i(P, { children: [
163
- /* @__PURE__ */ a("div", { className: "make-ai-artifact__trend", children: e.data.series.map((m) => /* @__PURE__ */ i("div", { className: "make-ai-artifact__trend-series", children: [
164
- /* @__PURE__ */ a("div", { className: "make-ai-artifact__trend-label", children: m.label }),
165
- /* @__PURE__ */ a("div", { className: "make-ai-artifact__trend-bars", children: m.points.map((u, h) => {
162
+ /* @__PURE__ */ i(B, { children: [
163
+ /* @__PURE__ */ a("div", { className: "make-ai-artifact__trend", children: e.data.series.map((d) => /* @__PURE__ */ i("div", { className: "make-ai-artifact__trend-series", children: [
164
+ /* @__PURE__ */ a("div", { className: "make-ai-artifact__trend-label", children: d.label }),
165
+ /* @__PURE__ */ a("div", { className: "make-ai-artifact__trend-bars", children: d.points.map((u, h) => {
166
166
  const k = 18 + (u.y - o) / c * 70;
167
167
  return /* @__PURE__ */ i("div", { className: "make-ai-artifact__trend-point", children: [
168
168
  /* @__PURE__ */ a(
169
169
  "span",
170
170
  {
171
- "aria-label": `${u.x}: ${B(
171
+ "aria-label": `${u.x}: ${D(
172
172
  u.y,
173
- m.format,
173
+ d.format,
174
174
  t.context.locale
175
175
  )}`,
176
176
  className: "make-ai-artifact__trend-bar",
177
177
  role: "img",
178
178
  style: { height: `${k}%` },
179
- title: `${u.x}: ${B(
179
+ title: `${u.x}: ${D(
180
180
  u.y,
181
- m.format,
181
+ d.format,
182
182
  t.context.locale
183
183
  )}`
184
184
  }
@@ -186,21 +186,21 @@ const B = (e, t, s) => {
186
186
  /* @__PURE__ */ a("small", { children: u.x })
187
187
  ] }, `${u.x}-${h}`);
188
188
  }) })
189
- ] }, m.id)) }),
190
- W(e, t)
189
+ ] }, d.id)) }),
190
+ G(e, t)
191
191
  ] }),
192
192
  "make-ai-artifact--trend"
193
193
  );
194
- }, gt = ({
194
+ }, _t = ({
195
195
  artifact: e,
196
196
  renderContext: t
197
197
  }) => {
198
- const { max: s } = Ue(
198
+ const { max: s } = Ve(
199
199
  e.data.items.map((o) => Math.abs(o.value))
200
200
  ), r = Math.max(s, 1);
201
- return J(
201
+ return Y(
202
202
  e,
203
- /* @__PURE__ */ i(P, { children: [
203
+ /* @__PURE__ */ i(B, { children: [
204
204
  /* @__PURE__ */ a("ol", { className: "make-ai-artifact__ranking", children: e.data.items.map((o, c) => /* @__PURE__ */ i("li", { children: [
205
205
  /* @__PURE__ */ a("span", { className: "make-ai-artifact__rank", children: c + 1 }),
206
206
  /* @__PURE__ */ i("span", { className: "make-ai-artifact__ranking-label", children: [
@@ -208,29 +208,29 @@ const B = (e, t, s) => {
208
208
  o.description ? /* @__PURE__ */ a("small", { children: o.description }) : null
209
209
  ] }),
210
210
  /* @__PURE__ */ a("span", { className: "make-ai-artifact__ranking-track", "aria-hidden": "true", children: /* @__PURE__ */ a("span", { style: { width: `${Math.abs(o.value) / r * 100}%` } }) }),
211
- /* @__PURE__ */ a("strong", { children: B(o.value, o.format, t.context.locale) })
211
+ /* @__PURE__ */ a("strong", { children: D(o.value, o.format, t.context.locale) })
212
212
  ] }, o.id)) }),
213
- W(e, t)
213
+ G(e, t)
214
214
  ] }),
215
215
  "make-ai-artifact--ranking"
216
216
  );
217
- }, ft = (e, t) => t.action ?? {
217
+ }, vt = (e, t) => t.action ?? {
218
218
  id: `open-${t.id}`,
219
219
  label: t.title ?? t.id,
220
220
  intent: "open-record",
221
221
  target: { entityKey: e.data.entity.key, recordId: t.id }
222
- }, _t = ({
222
+ }, yt = ({
223
223
  artifact: e,
224
224
  renderContext: t
225
- }) => J(
225
+ }) => Y(
226
226
  e,
227
- /* @__PURE__ */ i(P, { children: [
227
+ /* @__PURE__ */ i(B, { children: [
228
228
  /* @__PURE__ */ a("div", { className: "make-ai-artifact__record-list", children: e.data.records.length === 0 ? /* @__PURE__ */ a("p", { className: "make-ai-artifact__empty", children: "没有符合条件的记录" }) : e.data.records.map((s) => {
229
- const r = ft(e, s), o = /* @__PURE__ */ i(P, { children: [
229
+ const r = vt(e, s), o = /* @__PURE__ */ i(B, { children: [
230
230
  /* @__PURE__ */ a("strong", { children: s.title ?? s.id }),
231
231
  /* @__PURE__ */ a("span", { className: "make-ai-artifact__record-values", children: e.data.columns.map((c) => /* @__PURE__ */ i("span", { children: [
232
232
  /* @__PURE__ */ a("small", { children: c.label }),
233
- B(
233
+ D(
234
234
  s.values[c.key],
235
235
  c.format,
236
236
  t.context.locale
@@ -243,7 +243,7 @@ const B = (e, t, s) => {
243
243
  {
244
244
  className: "make-ai-artifact__record",
245
245
  type: "button",
246
- onClick: () => Ve(r, {
246
+ onClick: () => qe(r, {
247
247
  artifact: e,
248
248
  context: t.context
249
249
  }, t),
@@ -257,37 +257,37 @@ const B = (e, t, s) => {
257
257
  e.data.total,
258
258
  " 条"
259
259
  ] }) : null,
260
- W(e, t)
260
+ G(e, t)
261
261
  ] }),
262
262
  "make-ai-artifact--record-list"
263
- ), vt = ({
263
+ ), kt = ({
264
264
  artifact: e,
265
265
  renderContext: t
266
- }) => J(
266
+ }) => Y(
267
267
  e,
268
- /* @__PURE__ */ i(P, { children: [
268
+ /* @__PURE__ */ i(B, { children: [
269
269
  /* @__PURE__ */ i("div", { className: `make-ai-artifact__notice make-ai-artifact__notice--${e.data.tone}`, children: [
270
270
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: e.data.tone === "success" ? "✓" : e.data.tone === "warning" ? "!" : e.data.tone === "danger" ? "×" : "i" }),
271
271
  /* @__PURE__ */ a("p", { children: e.data.body })
272
272
  ] }),
273
- W(e, t)
273
+ G(e, t)
274
274
  ] }),
275
275
  "make-ai-artifact--notice"
276
- ), Y = (e, t, s) => ({ id: e, kinds: [t], priority: 0, render: s }), yt = [
277
- Y("platform.metric.default", "metric", (e, t, s) => /* @__PURE__ */ a(ut, { artifact: e, renderContext: s })),
278
- Y("platform.comparison.default", "comparison", (e, t, s) => /* @__PURE__ */ a(pt, { artifact: e, renderContext: s })),
279
- Y("platform.trend.default", "trend", (e, t, s) => /* @__PURE__ */ a(ht, { artifact: e, renderContext: s })),
280
- Y("platform.ranking.default", "ranking", (e, t, s) => /* @__PURE__ */ a(gt, { artifact: e, renderContext: s })),
281
- Y("platform.record-list.default", "record-list", (e, t, s) => /* @__PURE__ */ a(_t, { artifact: e, renderContext: s })),
282
- Y("platform.notice.default", "notice", (e, t, s) => /* @__PURE__ */ a(vt, { artifact: e, renderContext: s }))
283
- ], kt = De(yt).templates, At = (e = kt) => De(e), bt = (e) => `${e}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, It = "Make", Nt = [
276
+ ), Z = (e, t, s) => ({ id: e, kinds: [t], priority: 0, render: s }), At = [
277
+ Z("platform.metric.default", "metric", (e, t, s) => /* @__PURE__ */ a(ht, { artifact: e, renderContext: s })),
278
+ Z("platform.comparison.default", "comparison", (e, t, s) => /* @__PURE__ */ a(gt, { artifact: e, renderContext: s })),
279
+ Z("platform.trend.default", "trend", (e, t, s) => /* @__PURE__ */ a(ft, { artifact: e, renderContext: s })),
280
+ Z("platform.ranking.default", "ranking", (e, t, s) => /* @__PURE__ */ a(_t, { artifact: e, renderContext: s })),
281
+ Z("platform.record-list.default", "record-list", (e, t, s) => /* @__PURE__ */ a(yt, { artifact: e, renderContext: s })),
282
+ Z("platform.notice.default", "notice", (e, t, s) => /* @__PURE__ */ a(kt, { artifact: e, renderContext: s }))
283
+ ], bt = Ue(At).templates, It = (e = bt) => Ue(e), Nt = (e) => `${e}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, wt = "Make", Mt = [
284
284
  "总结当前页面数据",
285
285
  "找出需要关注的记录",
286
286
  "列出我有权限查看的数据对象"
287
- ], qe = (e, t) => t ?? `${e?.trim() || It} AI 助手`, wt = (e) => e ?? Nt;
288
- class p extends Error {
287
+ ], He = (e, t) => t ?? `${e?.trim() || wt} AI 助手`, Tt = (e) => e ?? Mt;
288
+ class g extends Error {
289
289
  }
290
- const Fe = (e) => {
290
+ const Pe = (e) => {
291
291
  try {
292
292
  const t = e?.return?.();
293
293
  if (!t) return;
@@ -301,7 +301,7 @@ const Fe = (e) => {
301
301
  errorType: t instanceof Error ? t.name : typeof t
302
302
  });
303
303
  }
304
- }, Mt = async (e) => {
304
+ }, Ct = async (e) => {
305
305
  if (globalThis.navigator?.clipboard?.writeText) {
306
306
  await globalThis.navigator.clipboard.writeText(e);
307
307
  return;
@@ -313,39 +313,39 @@ const Fe = (e) => {
313
313
  const s = document.execCommand("copy");
314
314
  if (t.remove(), !s)
315
315
  throw new Error("Clipboard copy failed");
316
- }, He = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
316
+ }, Ke = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
317
317
  /* @__PURE__ */ a("path", { d: "M12 2.8c.5 4.4 2.8 6.8 7.2 7.2-4.4.5-6.8 2.8-7.2 7.2-.5-4.4-2.8-6.8-7.2-7.2 4.4-.5 6.8-2.8 7.2-7.2Z" }),
318
318
  /* @__PURE__ */ a("path", { d: "M18.3 16.1c.2 1.8 1.2 2.8 3 3-1.8.2-2.8 1.2-3 3-.2-1.8-1.2-2.8-3-3 1.8-.2 2.8-1.2 3-3Z" })
319
- ] }), Tt = () => /* @__PURE__ */ a("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ a("path", { d: "m6 6 12 12M18 6 6 18" }) }), Ct = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
319
+ ] }), $t = () => /* @__PURE__ */ a("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ a("path", { d: "m6 6 12 12M18 6 6 18" }) }), Et = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
320
320
  /* @__PURE__ */ a("path", { d: "M8 8h10v12H8z" }),
321
321
  /* @__PURE__ */ a("path", { d: "M6 16H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
322
- ] }), $t = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
322
+ ] }), St = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
323
323
  /* @__PURE__ */ a("path", { d: "M5 10v4" }),
324
324
  /* @__PURE__ */ a("path", { d: "M8 9v6l6 3V6L8 9Z" }),
325
325
  /* @__PURE__ */ a("path", { d: "M17 9.2a4.2 4.2 0 0 1 0 5.6" }),
326
326
  /* @__PURE__ */ a("path", { d: "M19.4 6.8a7.6 7.6 0 0 1 0 10.4" })
327
- ] }), Et = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
327
+ ] }), Rt = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
328
328
  /* @__PURE__ */ a("path", { d: "M12 4v11" }),
329
329
  /* @__PURE__ */ a("path", { d: "m7 10 5 5 5-5" }),
330
330
  /* @__PURE__ */ a("path", { d: "M5 20h14" })
331
- ] }), St = () => /* @__PURE__ */ a("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ a("path", { d: "M12 5v14M5 12h14" }) }), Rt = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
331
+ ] }), xt = () => /* @__PURE__ */ a("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ a("path", { d: "M12 5v14M5 12h14" }) }), Lt = () => /* @__PURE__ */ i("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
332
332
  /* @__PURE__ */ a("path", { d: "m4 4 17 8-17 8 3-8-3-8Z" }),
333
333
  /* @__PURE__ */ a("path", { d: "M7 12h14" })
334
- ] }), te = ({ className: e = "" }) => /* @__PURE__ */ a("span", { className: `make-ai-assistant__avatar ${e}`.trim(), "aria-hidden": "true", children: /* @__PURE__ */ a(He, {}) }), xt = ({ src: e }) => e ? /* @__PURE__ */ a("span", { className: "make-ai-assistant__user-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a("img", { alt: "", src: e }) }) : null, Lt = ({
334
+ ] }), ae = ({ className: e = "" }) => /* @__PURE__ */ a("span", { className: `make-ai-assistant__avatar ${e}`.trim(), "aria-hidden": "true", children: /* @__PURE__ */ a(Ke, {}) }), Ft = ({ src: e }) => e ? /* @__PURE__ */ a("span", { className: "make-ai-assistant__user-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a("img", { alt: "", src: e }) }) : null, Pt = ({
335
335
  userAvatarUrl: e,
336
336
  userName: t
337
337
  }) => {
338
338
  const s = t?.trim();
339
339
  return !s && !e ? null : /* @__PURE__ */ i("div", { className: "make-ai-assistant__message-identity", children: [
340
340
  s ? /* @__PURE__ */ a("span", { className: "make-ai-assistant__message-sender", children: s }) : null,
341
- /* @__PURE__ */ a(xt, { src: e })
341
+ /* @__PURE__ */ a(Ft, { src: e })
342
342
  ] });
343
- }, Ft = (e) => {
343
+ }, Bt = (e) => {
344
344
  const t = [], s = [], r = [], o = [], c = () => {
345
345
  const h = s.join(`
346
346
  `).trim();
347
347
  s.length = 0, h && t.push({ type: "paragraph", text: h });
348
- }, m = () => {
348
+ }, d = () => {
349
349
  r.length && t.push({ type: "list", items: r.splice(0) });
350
350
  }, u = () => {
351
351
  const h = o.join(`
@@ -357,65 +357,65 @@ const Fe = (e) => {
357
357
  `)) {
358
358
  const k = h.trim();
359
359
  if (!k) {
360
- c(), m(), u();
360
+ c(), d(), u();
361
361
  continue;
362
362
  }
363
363
  if (/^\s*\|.+\|\s*$/.test(h)) {
364
- c(), m(), o.push(h.trim());
364
+ c(), d(), o.push(h.trim());
365
365
  continue;
366
366
  }
367
- const v = /^\s*[-*]\s+(.+)$/.exec(h);
368
- if (v) {
369
- c(), u(), r.push(v[1]?.trim() ?? "");
367
+ const _ = /^\s*[-*]\s+(.+)$/.exec(h);
368
+ if (_) {
369
+ c(), u(), r.push(_[1]?.trim() ?? "");
370
370
  continue;
371
371
  }
372
- m(), u(), s.push(k);
372
+ d(), u(), s.push(k);
373
373
  }
374
- return c(), m(), u(), t;
375
- }, Pe = (e) => {
374
+ return c(), d(), u(), t;
375
+ }, Be = (e) => {
376
376
  const t = [], s = /(\*\*[^*]+\*\*|`[^`]+`)/g;
377
377
  let r = 0;
378
378
  for (const o of e.matchAll(s)) {
379
- const c = o[0], m = o.index ?? 0;
380
- m > r && t.push(e.slice(r, m)), c.startsWith("**") ? t.push(/* @__PURE__ */ a("strong", { children: c.slice(2, -2) }, `${m}-strong`)) : t.push(/* @__PURE__ */ a("code", { children: c.slice(1, -1) }, `${m}-code`)), r = m + c.length;
379
+ const c = o[0], d = o.index ?? 0;
380
+ d > r && t.push(e.slice(r, d)), c.startsWith("**") ? t.push(/* @__PURE__ */ a("strong", { children: c.slice(2, -2) }, `${d}-strong`)) : t.push(/* @__PURE__ */ a("code", { children: c.slice(1, -1) }, `${d}-code`)), r = d + c.length;
381
381
  }
382
382
  return r < e.length && t.push(e.slice(r)), t;
383
- }, Pt = ({ content: e }) => {
384
- const t = Ft(e);
385
- return t.length ? /* @__PURE__ */ a("div", { className: "make-ai-assistant__bubble make-ai-assistant__assistant-text", children: t.map((s, r) => s.type === "paragraph" ? /* @__PURE__ */ a("p", { children: Pe(s.text) }, `${r}-paragraph`) : s.type === "pre" ? /* @__PURE__ */ a("pre", { children: /* @__PURE__ */ a("code", { children: s.text }) }, `${r}-pre`) : /* @__PURE__ */ a("ul", { children: s.items.map((o, c) => /* @__PURE__ */ a("li", { children: Pe(o) }, `${c}-${o}`)) }, `${r}-list`)) }) : null;
386
- }, Ke = ({ assistantName: e }) => /* @__PURE__ */ i("div", { className: "make-ai-assistant__message-identity", children: [
387
- /* @__PURE__ */ a(te, { className: "make-ai-assistant__avatar--message" }),
383
+ }, Dt = ({ content: e }) => {
384
+ const t = Bt(e);
385
+ return t.length ? /* @__PURE__ */ a("div", { className: "make-ai-assistant__bubble make-ai-assistant__assistant-text", children: t.map((s, r) => s.type === "paragraph" ? /* @__PURE__ */ a("p", { children: Be(s.text) }, `${r}-paragraph`) : s.type === "pre" ? /* @__PURE__ */ a("pre", { children: /* @__PURE__ */ a("code", { children: s.text }) }, `${r}-pre`) : /* @__PURE__ */ a("ul", { children: s.items.map((o, c) => /* @__PURE__ */ a("li", { children: Be(o) }, `${c}-${o}`)) }, `${r}-list`)) }) : null;
386
+ }, ze = ({ assistantName: e }) => /* @__PURE__ */ i("div", { className: "make-ai-assistant__message-identity", children: [
387
+ /* @__PURE__ */ a(ae, { className: "make-ai-assistant__avatar--message" }),
388
388
  /* @__PURE__ */ a("span", { className: "make-ai-assistant__message-sender", children: e })
389
- ] }), ze = (e) => {
389
+ ] }), Oe = (e) => {
390
390
  for (let t = e.messages.length - 1; t >= 0; t -= 1) {
391
391
  const s = e.messages[t];
392
392
  if (s.role === "assistant" && s.status === "streaming")
393
393
  return s.id;
394
394
  }
395
- }, Bt = (e) => {
395
+ }, Ut = (e) => {
396
396
  for (let t = e.messages.length - 1; t >= 0; t -= 1)
397
397
  if (e.messages[t].role === "user") return t;
398
398
  return -1;
399
- }, Oe = (e) => {
400
- const t = Bt(e);
399
+ }, je = (e) => {
400
+ const t = Ut(e);
401
401
  if (!(t < 0))
402
402
  for (let s = e.messages.length - 1; s > t; s -= 1) {
403
403
  const r = e.messages[s];
404
404
  if (r.role === "assistant") return r.id;
405
405
  }
406
- }, Dt = (e) => {
406
+ }, Vt = (e) => {
407
407
  if (e.status === "idle")
408
408
  for (let t = e.messages.length - 1; t >= 0; t -= 1) {
409
409
  const s = e.messages[t];
410
410
  if (s.role === "assistant" && s.status === "complete")
411
411
  return s.id;
412
412
  }
413
- }, Ut = (e) => {
413
+ }, qt = (e) => {
414
414
  for (let t = e.messages.length - 1; t >= 0; t -= 1) {
415
415
  const s = e.messages[t];
416
416
  if (s.role === "user") return s;
417
417
  }
418
- }, Vt = (e, t) => {
418
+ }, Ht = (e, t) => {
419
419
  const s = e.messages.findIndex(
420
420
  (r) => r.id === t && r.role === "user"
421
421
  );
@@ -426,7 +426,7 @@ const Fe = (e) => {
426
426
  status: "streaming",
427
427
  messages: s < 0 ? e.messages : e.messages.slice(0, s + 1)
428
428
  };
429
- }, qt = (e) => e.scrollHeight - e.scrollTop - e.clientHeight <= 48, Ht = (e = "smooth") => globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : e, je = ({
429
+ }, Kt = (e) => e.scrollHeight - e.scrollTop - e.clientHeight <= 48, zt = (e = "smooth") => globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : e, Ze = ({
430
430
  error: e,
431
431
  onRetry: t
432
432
  }) => /* @__PURE__ */ i("div", { className: "make-ai-assistant__message-status make-ai-assistant__message-status--error", role: "alert", children: [
@@ -441,7 +441,7 @@ const Fe = (e) => {
441
441
  children: "重新发送"
442
442
  }
443
443
  ) : null
444
- ] }), Ze = ({
444
+ ] }), Ge = ({
445
445
  active: e,
446
446
  steps: t
447
447
  }) => {
@@ -470,7 +470,7 @@ const Fe = (e) => {
470
470
  `${o}-${r}`
471
471
  )) })
472
472
  ] });
473
- }, Kt = ({
473
+ }, Ot = ({
474
474
  copyFeedback: e,
475
475
  onCopy: t,
476
476
  onRegenerate: s
@@ -482,7 +482,7 @@ const Fe = (e) => {
482
482
  className: "make-ai-assistant__reply-action make-ai-assistant__reply-copy",
483
483
  type: "button",
484
484
  onClick: t,
485
- children: /* @__PURE__ */ a(Ct, {})
485
+ children: /* @__PURE__ */ a(Et, {})
486
486
  }
487
487
  ) : null,
488
488
  s ? /* @__PURE__ */ a(
@@ -503,7 +503,7 @@ const Fe = (e) => {
503
503
  children: e.message
504
504
  }
505
505
  ) : null
506
- ] }), Be = ({
506
+ ] }), De = ({
507
507
  assistantName: e,
508
508
  error: t,
509
509
  onRetry: s,
@@ -518,332 +518,333 @@ const Fe = (e) => {
518
518
  "data-message-role": "assistant",
519
519
  "data-message-state": o,
520
520
  children: /* @__PURE__ */ i("div", { className: "make-ai-assistant__message-turn", children: [
521
- /* @__PURE__ */ a(Ke, { assistantName: e }),
522
- /* @__PURE__ */ a("div", { className: "make-ai-assistant__message-stack", children: t ? /* @__PURE__ */ a(je, { error: t, onRetry: s }) : /* @__PURE__ */ a(Ze, { active: !0, steps: r?.steps }) })
521
+ /* @__PURE__ */ a(ze, { assistantName: e }),
522
+ /* @__PURE__ */ a("div", { className: "make-ai-assistant__message-stack", children: t ? /* @__PURE__ */ a(Ze, { error: t, onRetry: s }) : /* @__PURE__ */ a(Ge, { active: !0, steps: r?.steps }) })
523
523
  ] })
524
524
  }
525
525
  ) : null;
526
- }, zt = (e, t, s, r, o, c, m, u, h, k, v, y, D) => {
527
- const w = Oe(e), U = ze(e), x = Dt(e);
528
- let L;
529
- return e.messages.map((l) => {
530
- const f = l.role === "assistant", V = L;
531
- f || (L = l);
532
- const q = l.id === U, T = l.id === w ? e.error : void 0, H = l.error ?? T, C = !f && !!(u?.trim() || h), ge = f ? c : u?.trim() || "用户", fe = f && l.status === "complete" && !H && (l.content.trim() || l.id === x);
526
+ }, jt = (e, t, s, r, o, c, d, u, h, k, _, L, y) => {
527
+ const M = je(e), W = Oe(e), J = Vt(e);
528
+ let Q;
529
+ return e.messages.map((m) => {
530
+ const b = m.role === "assistant", p = Q;
531
+ b || (Q = m);
532
+ const T = m.id === W, U = m.id === M ? e.error : void 0, C = m.error ?? U, $ = !b && !!(u?.trim() || h), _e = b ? c : u?.trim() || "用户", F = b && m.status === "complete" && !C && (m.content.trim() || m.id === J);
533
533
  return /* @__PURE__ */ a(
534
534
  "article",
535
535
  {
536
- "aria-label": `${ge}的消息`,
537
- className: `make-ai-assistant__message make-ai-assistant__message--${l.role}`,
538
- "data-message-role": l.role,
539
- "data-message-state": H ? "error" : void 0,
540
- "data-message-status": l.status,
541
- "data-message-has-identity": f || C ? !0 : void 0,
536
+ "aria-label": `${_e}的消息`,
537
+ className: `make-ai-assistant__message make-ai-assistant__message--${m.role}`,
538
+ "data-message-role": m.role,
539
+ "data-message-state": C ? "error" : void 0,
540
+ "data-message-status": m.status,
541
+ "data-message-has-identity": b || $ ? !0 : void 0,
542
542
  children: /* @__PURE__ */ i("div", { className: "make-ai-assistant__message-turn", children: [
543
- f ? /* @__PURE__ */ a(Ke, { assistantName: c }) : C ? /* @__PURE__ */ a(Lt, { userAvatarUrl: h, userName: u }) : null,
543
+ b ? /* @__PURE__ */ a(ze, { assistantName: c }) : $ ? /* @__PURE__ */ a(Pt, { userAvatarUrl: h, userName: u }) : null,
544
544
  /* @__PURE__ */ i("div", { className: "make-ai-assistant__message-stack", children: [
545
- l.content ? f ? /* @__PURE__ */ a(Pt, { content: l.content }) : /* @__PURE__ */ a("div", { className: "make-ai-assistant__bubble", children: l.content }) : l.status === "streaming" ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__typing", "aria-label": `${c}正在思考`, children: [
545
+ m.content ? b ? /* @__PURE__ */ a(Dt, { content: m.content }) : /* @__PURE__ */ a("div", { className: "make-ai-assistant__bubble", children: m.content }) : m.status === "streaming" ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__typing", "aria-label": `${c}正在思考`, children: [
546
546
  /* @__PURE__ */ a("span", {}),
547
547
  /* @__PURE__ */ a("span", {}),
548
548
  /* @__PURE__ */ a("span", {})
549
549
  ] }) : null,
550
- f ? /* @__PURE__ */ a(
551
- Ze,
550
+ b ? /* @__PURE__ */ a(
551
+ Ge,
552
552
  {
553
- active: q && e.status === "streaming",
554
- steps: l.progressSteps
553
+ active: T && e.status === "streaming",
554
+ steps: m.progressSteps
555
555
  }
556
556
  ) : null,
557
- H ? /* @__PURE__ */ a(
558
- je,
557
+ C ? /* @__PURE__ */ a(
558
+ Ze,
559
559
  {
560
- error: H,
561
- onRetry: T ? m : void 0
560
+ error: C,
561
+ onRetry: U ? d : void 0
562
562
  }
563
563
  ) : null,
564
- l.artifacts.map((M) => /* @__PURE__ */ a(
565
- mt,
564
+ m.artifacts.map((se) => /* @__PURE__ */ a(
565
+ pt,
566
566
  {
567
- artifact: M,
567
+ artifact: se,
568
568
  context: t,
569
569
  onAction: r,
570
570
  onActionError: o,
571
571
  registry: s
572
572
  },
573
- M.id
573
+ se.id
574
574
  )),
575
- fe ? /* @__PURE__ */ a(
576
- Kt,
575
+ F ? /* @__PURE__ */ a(
576
+ Ot,
577
577
  {
578
- copyFeedback: k?.messageId === l.id ? {
578
+ copyFeedback: k?.messageId === m.id ? {
579
579
  message: k.message,
580
580
  status: k.status
581
581
  } : void 0,
582
- onCopy: l.content.trim() ? () => y(l.id, l.content) : void 0,
583
- onRegenerate: v && l.id === x && V ? () => D({
584
- userMessage: V,
585
- assistantMessage: l
582
+ onCopy: m.content.trim() ? () => L(m.id, m.content) : void 0,
583
+ onRegenerate: _ && m.id === J && p ? () => y({
584
+ userMessage: p,
585
+ assistantMessage: m
586
586
  }) : void 0
587
587
  }
588
588
  ) : null
589
589
  ] })
590
590
  ] })
591
591
  },
592
- l.id
592
+ m.id
593
593
  );
594
594
  });
595
595
  };
596
- function Ot({
596
+ function Zt({
597
597
  assistantName: e = "AI 助手",
598
598
  brandName: t,
599
599
  context: s,
600
600
  onAction: r,
601
601
  onActionError: o,
602
602
  onClose: c,
603
- onNewConversation: m,
604
- registry: u,
605
- subtitle: h,
606
- suggestions: k,
607
- title: v,
603
+ onNewConversation: d,
604
+ privacyNotice: u,
605
+ registry: h,
606
+ subtitle: k,
607
+ suggestions: _,
608
+ title: L,
608
609
  transport: y,
609
- userAvatarUrl: D,
610
- userName: w
610
+ userAvatarUrl: M,
611
+ userName: W
611
612
  }) {
612
- const U = qe(t, v), [x, L] = S(""), [l, f] = S(me), V = R(l);
613
- V.current = l;
614
- const [q, T] = S(void 0), [H, C] = S(void 0), [ge, fe] = S(0), [M, ae] = S(() => y.loadConversation ? "loading" : "ready"), [Ge, K] = S(!1), z = R(void 0), O = R(void 0), j = R(0), se = R(null), F = R(!0), ke = R(s.app.id), Ae = Le(
615
- () => u ?? At(),
616
- [u]
617
- ), be = Le(
618
- () => wt(k),
619
- [k]
620
- ), ne = (n) => {
621
- const g = z.current, _ = O.current?.iterator;
622
- return !g && !_ ? !1 : (j.current += 1, z.current = void 0, O.current = void 0, console.info("[make-ai-assistant] local run cancellation requested", { reason: n }), g?.abort(), Fe(_), !0);
613
+ const J = He(t, L), Q = u?.trim(), [m, b] = R(""), [p, T] = R(pe), U = x(p);
614
+ U.current = p;
615
+ const [C, $] = R(void 0), [_e, F] = R(void 0), [se, Ye] = R(0), [V, ne] = R(() => y.loadConversation ? "loading" : "ready"), [We, q] = R(!1), H = x(void 0), K = x(void 0), z = x(0), re = x(null), P = x(!0), Ae = x(s.app.id), be = Fe(
616
+ () => h ?? It(),
617
+ [h]
618
+ ), Ie = Fe(
619
+ () => Tt(_),
620
+ [_]
621
+ ), ie = (n) => {
622
+ const f = H.current, v = K.current?.iterator;
623
+ return !f && !v ? !1 : (z.current += 1, H.current = void 0, K.current = void 0, console.info("[make-ai-assistant] local run cancellation requested", { reason: n }), f?.abort(), Pe(v), !0);
623
624
  };
624
- he(() => () => {
625
- ne("unmount");
626
- }, []), he(() => {
627
- const n = y.loadConversation, g = ke.current !== s.app.id;
628
- if (ke.current = s.app.id, ne("reinitialize"), g && (L(""), F.current = !0), T(void 0), C(void 0), K(!1), f(me()), !n) {
629
- ae("ready");
625
+ fe(() => () => {
626
+ ie("unmount");
627
+ }, []), fe(() => {
628
+ const n = y.loadConversation, f = Ae.current !== s.app.id;
629
+ if (Ae.current = s.app.id, ie("reinitialize"), f && (b(""), P.current = !0), $(void 0), F(void 0), q(!1), T(pe()), !n) {
630
+ ne("ready");
630
631
  return;
631
632
  }
632
- const _ = new AbortController();
633
- return ae("loading"), console.info("[make-ai-assistant] conversation load start", {
633
+ const v = new AbortController();
634
+ return ne("loading"), console.info("[make-ai-assistant] conversation load start", {
634
635
  appId: s.app.id
635
- }), n.call(y, s, { signal: _.signal }).then((I) => {
636
- _.signal.aborted || (f(me(I)), ae("ready"), console.info("[make-ai-assistant] conversation load success", {
636
+ }), n.call(y, s, { signal: v.signal }).then((N) => {
637
+ v.signal.aborted || (T(pe(N)), ne("ready"), console.info("[make-ai-assistant] conversation load success", {
637
638
  appId: s.app.id,
638
- messageCount: I.messages.length
639
+ messageCount: N.messages.length
639
640
  }));
640
- }).catch((I) => {
641
- _.signal.aborted || (console.error("[make-ai-assistant] conversation load failed", {
641
+ }).catch((N) => {
642
+ v.signal.aborted || (console.error("[make-ai-assistant] conversation load failed", {
642
643
  appId: s.app.id,
643
- errorType: I instanceof Error ? I.name : typeof I
644
- }), ae("error"));
645
- }), () => _.abort();
646
- }, [s.app.id, ge, y]), he(() => {
647
- const n = se.current;
648
- if (!n || !F.current) return;
649
- K(!1);
650
- const g = requestAnimationFrame(() => {
651
- if (!F.current) return;
652
- const _ = l.status === "streaming" || globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
653
- typeof n.scrollTo == "function" ? n.scrollTo({ top: n.scrollHeight, behavior: _ }) : n.scrollTop = n.scrollHeight;
644
+ errorType: N instanceof Error ? N.name : typeof N
645
+ }), ne("error"));
646
+ }), () => v.abort();
647
+ }, [s.app.id, se, y]), fe(() => {
648
+ const n = re.current;
649
+ if (!n || !P.current) return;
650
+ q(!1);
651
+ const f = requestAnimationFrame(() => {
652
+ if (!P.current) return;
653
+ const v = p.status === "streaming" || globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
654
+ typeof n.scrollTo == "function" ? n.scrollTo({ top: n.scrollHeight, behavior: v }) : n.scrollTop = n.scrollHeight;
654
655
  });
655
- return () => cancelAnimationFrame(g);
656
- }, [l.messages, l.progress, l.status]);
657
- const Ye = () => {
658
- const n = se.current;
656
+ return () => cancelAnimationFrame(f);
657
+ }, [p.messages, p.progress, p.status]);
658
+ const Je = () => {
659
+ const n = re.current;
659
660
  if (!n) return;
660
- const g = qt(n);
661
- F.current = g, K(!g && V.current.messages.length > 0);
662
- }, We = () => {
663
- const n = se.current;
661
+ const f = Kt(n);
662
+ P.current = f, q(!f && U.current.messages.length > 0);
663
+ }, Qe = () => {
664
+ const n = re.current;
664
665
  if (!n) return;
665
- F.current = !0, K(!1);
666
- const g = Ht();
667
- typeof n.scrollTo == "function" ? n.scrollTo({ top: n.scrollHeight, behavior: g }) : n.scrollTop = n.scrollHeight;
668
- }, Ie = async (n, g) => {
669
- const _ = n.trim(), I = V.current, $ = g?.regenerateFrom, _e = y.regenerate;
670
- if (!_ || M !== "ready" || I.status === "streaming" || z.current || $ && !_e) return;
671
- if (pe(
672
- _,
673
- b.messageCharacters
674
- ) > b.messageCharacters) {
675
- T(
676
- `输入内容过长,请控制在 ${b.messageCharacters} 个字符以内`
666
+ P.current = !0, q(!1);
667
+ const f = zt();
668
+ typeof n.scrollTo == "function" ? n.scrollTo({ top: n.scrollHeight, behavior: f }) : n.scrollTop = n.scrollHeight;
669
+ }, Ne = async (n, f) => {
670
+ const v = n.trim(), N = U.current, E = f?.regenerateFrom, ve = y.regenerate;
671
+ if (!v || V !== "ready" || N.status === "streaming" || H.current || E && !ve) return;
672
+ if (ge(
673
+ v,
674
+ I.messageCharacters
675
+ ) > I.messageCharacters) {
676
+ $(
677
+ `输入内容过长,请控制在 ${I.messageCharacters} 个字符以内`
677
678
  );
678
679
  return;
679
680
  }
680
- const oe = {
681
- id: $?.userMessage.id ?? bt("user"),
682
- content: _
683
- }, ce = $ ? Vt(I, $.userMessage.id) : lt(I, oe), le = new AbortController(), Z = j.current + 1;
684
- j.current = Z, z.current = le, T(void 0), C(void 0), K(!F.current && I.messages.length > 0), $ || L(""), f(ce);
681
+ const le = {
682
+ id: E?.userMessage.id ?? Nt("user"),
683
+ content: v
684
+ }, de = E ? Ht(N, E.userMessage.id) : mt(N, le), me = new AbortController(), O = z.current + 1;
685
+ z.current = O, H.current = me, $(void 0), F(void 0), q(!P.current && N.messages.length > 0), E || b(""), T(de);
685
686
  try {
686
- let E = !1, A, we = 0, Me = 0, Te = 0, ve = 0, Q = 0;
687
- const X = /* @__PURE__ */ new Map(), Ce = /* @__PURE__ */ new Set(), $e = /* @__PURE__ */ new Set(
687
+ let S = !1, A, Me = 0, Te = 0, Ce = 0, ye = 0, X = 0;
688
+ const ee = /* @__PURE__ */ new Map(), $e = /* @__PURE__ */ new Set(), Ee = /* @__PURE__ */ new Set(
688
689
  [
689
- ...ce.messages.map((de) => de.id),
690
- oe.id
690
+ ...de.messages.map((ue) => ue.id),
691
+ le.id
691
692
  ]
692
- ), ee = /* @__PURE__ */ new Set(), Ee = ct(Ae), Se = { signal: le.signal };
693
- let ye;
694
- if ($) {
695
- if (!_e)
696
- throw new p("当前 AI 助手不支持重新生成");
697
- ye = _e({
698
- threadId: ce.threadId,
699
- message: oe,
693
+ ), te = /* @__PURE__ */ new Set(), Se = dt(be), Re = { signal: me.signal };
694
+ let ke;
695
+ if (E) {
696
+ if (!ve)
697
+ throw new g("当前 AI 助手不支持重新生成");
698
+ ke = ve({
699
+ threadId: de.threadId,
700
+ message: le,
700
701
  assistantMessage: {
701
- id: $.assistantMessage.id,
702
- content: $.assistantMessage.content
702
+ id: E.assistantMessage.id,
703
+ content: E.assistantMessage.content
703
704
  },
704
705
  context: s,
705
- capabilities: Ee
706
- }, Se);
706
+ capabilities: Se
707
+ }, Re);
707
708
  } else
708
- ye = y.run(
709
+ ke = y.run(
709
710
  {
710
- threadId: ce.threadId,
711
- message: oe,
711
+ threadId: de.threadId,
712
+ message: le,
712
713
  context: s,
713
- capabilities: Ee
714
+ capabilities: Se
714
715
  },
715
- Se
716
+ Re
716
717
  );
717
- const Re = ye[Symbol.asyncIterator]();
718
- for (O.current = { iterator: Re, requestVersion: Z }; ; ) {
719
- const de = await Re.next();
720
- if (j.current !== Z || de.done) break;
721
- let d;
718
+ const xe = ke[Symbol.asyncIterator]();
719
+ for (K.current = { iterator: xe, requestVersion: O }; ; ) {
720
+ const ue = await xe.next();
721
+ if (z.current !== O || ue.done) break;
722
+ let l;
722
723
  try {
723
- d = dt(de.value);
724
- } catch (N) {
725
- throw new p(
726
- N instanceof Error ? N.message : "Invalid assistant event"
724
+ l = ut(ue.value);
725
+ } catch (w) {
726
+ throw new g(
727
+ w instanceof Error ? w.message : "Invalid assistant event"
727
728
  );
728
729
  }
729
- if (d.type === "message.start") {
730
- if (A !== void 0 && A !== d.runId)
731
- throw new p("AI 助手响应 run id 不一致");
732
- if (A ??= d.runId, Me += 1, Me > b.assistantMessagesPerRun)
733
- throw new p("AI 助手单次响应消息数量超过限制");
734
- if ($e.has(d.messageId))
735
- throw new p("AI 助手响应包含重复的 message id");
736
- $e.add(d.messageId), ee.add(d.messageId), X.set(d.messageId, 0);
730
+ if (l.type === "message.start") {
731
+ if (A !== void 0 && A !== l.runId)
732
+ throw new g("AI 助手响应 run id 不一致");
733
+ if (A ??= l.runId, Te += 1, Te > I.assistantMessagesPerRun)
734
+ throw new g("AI 助手单次响应消息数量超过限制");
735
+ if (Ee.has(l.messageId))
736
+ throw new g("AI 助手响应包含重复的 message id");
737
+ Ee.add(l.messageId), te.add(l.messageId), ee.set(l.messageId, 0);
737
738
  }
738
- if (d.type === "message.delta") {
739
- if (!ee.has(d.messageId))
740
- throw new p("AI 助手响应事件顺序无效");
741
- const N = X.get(d.messageId) ?? 0, G = pe(
742
- d.delta,
743
- b.messageCharacters - Q
739
+ if (l.type === "message.delta") {
740
+ if (!te.has(l.messageId))
741
+ throw new g("AI 助手响应事件顺序无效");
742
+ const w = ee.get(l.messageId) ?? 0, j = ge(
743
+ l.delta,
744
+ I.messageCharacters - X
744
745
  );
745
- if (Q + G > b.messageCharacters)
746
- throw new p("AI 助手响应文本超过大小限制");
747
- Q += G, X.set(
748
- d.messageId,
749
- N + G
746
+ if (X + j > I.messageCharacters)
747
+ throw new g("AI 助手响应文本超过大小限制");
748
+ X += j, ee.set(
749
+ l.messageId,
750
+ w + j
750
751
  );
751
752
  }
752
- if (d.type === "message.replace") {
753
- if (!ee.has(d.messageId))
754
- throw new p("AI 助手响应事件顺序无效");
755
- const N = X.get(d.messageId) ?? 0, G = pe(
756
- d.content,
757
- b.messageCharacters
758
- ), xe = Q - N + G;
759
- if (xe > b.messageCharacters)
760
- throw new p("AI 助手响应文本超过大小限制");
761
- Q = xe, X.set(d.messageId, G);
753
+ if (l.type === "message.replace") {
754
+ if (!te.has(l.messageId))
755
+ throw new g("AI 助手响应事件顺序无效");
756
+ const w = ee.get(l.messageId) ?? 0, j = ge(
757
+ l.content,
758
+ I.messageCharacters
759
+ ), Le = X - w + j;
760
+ if (Le > I.messageCharacters)
761
+ throw new g("AI 助手响应文本超过大小限制");
762
+ X = Le, ee.set(l.messageId, j);
762
763
  }
763
- if (d.type === "run.progress") {
764
- if (A !== void 0 && A !== d.runId)
765
- throw new p("AI 助手响应 run id 不一致");
766
- if (A ??= d.runId, Te += 1, Te > b.progressStepsPerRun)
767
- throw new p("AI 助手处理过程数量超过限制");
768
- const N = pe(
769
- d.message,
770
- b.progressCharactersPerRun - ve
764
+ if (l.type === "run.progress") {
765
+ if (A !== void 0 && A !== l.runId)
766
+ throw new g("AI 助手响应 run id 不一致");
767
+ if (A ??= l.runId, Ce += 1, Ce > I.progressStepsPerRun)
768
+ throw new g("AI 助手处理过程数量超过限制");
769
+ const w = ge(
770
+ l.message,
771
+ I.progressCharactersPerRun - ye
771
772
  );
772
- if (ve + N > b.progressCharactersPerRun)
773
- throw new p("AI 助手处理过程文本超过大小限制");
774
- ve += N;
773
+ if (ye + w > I.progressCharactersPerRun)
774
+ throw new g("AI 助手处理过程文本超过大小限制");
775
+ ye += w;
775
776
  }
776
- if (d.type === "artifact") {
777
- if (!ee.has(d.messageId))
778
- throw new p("AI 助手响应事件顺序无效");
779
- if (we += 1, we > b.artifactsPerRun)
780
- throw new p("AI 助手单次响应 Artifact 数量超过限制");
781
- if (Ce.has(d.artifact.id))
782
- throw new p("AI 助手响应包含重复的 Artifact id");
783
- Ce.add(d.artifact.id);
777
+ if (l.type === "artifact") {
778
+ if (!te.has(l.messageId))
779
+ throw new g("AI 助手响应事件顺序无效");
780
+ if (Me += 1, Me > I.artifactsPerRun)
781
+ throw new g("AI 助手单次响应 Artifact 数量超过限制");
782
+ if ($e.has(l.artifact.id))
783
+ throw new g("AI 助手响应包含重复的 Artifact id");
784
+ $e.add(l.artifact.id);
784
785
  }
785
- if (d.type === "message.complete" && !ee.delete(d.messageId))
786
- throw new p("AI 助手响应事件顺序无效");
787
- if (d.type === "run.complete" && A !== void 0 && A !== d.runId)
788
- throw new p("AI 助手响应 run id 不一致");
789
- if (d.type === "run.cancelled" && d.runId !== void 0 && A !== void 0 && A !== d.runId)
790
- throw new p("AI 助手响应 run id 不一致");
791
- if (f((N) => ue(N, d)), d.type === "error" || d.type === "run.cancelled" || d.type === "run.complete") {
792
- E = !0;
786
+ if (l.type === "message.complete" && !te.delete(l.messageId))
787
+ throw new g("AI 助手响应事件顺序无效");
788
+ if (l.type === "run.complete" && A !== void 0 && A !== l.runId)
789
+ throw new g("AI 助手响应 run id 不一致");
790
+ if (l.type === "run.cancelled" && l.runId !== void 0 && A !== void 0 && A !== l.runId)
791
+ throw new g("AI 助手响应 run id 不一致");
792
+ if (T((w) => he(w, l)), l.type === "error" || l.type === "run.cancelled" || l.type === "run.complete") {
793
+ S = !0;
793
794
  break;
794
795
  }
795
796
  }
796
- if (!E)
797
- throw new p("AI 助手流式响应在终止事件前结束");
798
- } catch (E) {
799
- if (j.current !== Z) return;
800
- if (le.signal.aborted) {
801
- f(
802
- (A) => ue(A, { type: "run.cancelled" })
797
+ if (!S)
798
+ throw new g("AI 助手流式响应在终止事件前结束");
799
+ } catch (S) {
800
+ if (z.current !== O) return;
801
+ if (me.signal.aborted) {
802
+ T(
803
+ (A) => he(A, { type: "run.cancelled" })
803
804
  );
804
805
  return;
805
806
  }
806
807
  console.error("[make-ai-assistant] assistant run failed", {
807
808
  appId: s.app.id,
808
- errorType: E instanceof Error ? E.name : typeof E
809
- }), f(
810
- (A) => ue(A, {
809
+ errorType: S instanceof Error ? S.name : typeof S
810
+ }), T(
811
+ (A) => he(A, {
811
812
  type: "error",
812
813
  code: "TRANSPORT_ERROR",
813
- message: E instanceof p ? E.message : "连接失败,请重试",
814
+ message: S instanceof g ? S.message : "连接失败,请重试",
814
815
  retryable: !0
815
816
  })
816
817
  );
817
818
  } finally {
818
- j.current === Z && z.current === le && (z.current = void 0), O.current?.requestVersion === Z && (Fe(O.current.iterator), O.current = void 0);
819
+ z.current === O && H.current === me && (H.current = void 0), K.current?.requestVersion === O && (Pe(K.current.iterator), K.current = void 0);
819
820
  }
820
- }, re = (n) => Ie(n), Je = (n) => Ie(n.userMessage.content, { regenerateFrom: n }), Qe = async (n, g) => {
821
+ }, oe = (n) => Ne(n), Xe = (n) => Ne(n.userMessage.content, { regenerateFrom: n }), et = async (n, f) => {
821
822
  try {
822
- await Mt(g), C({ messageId: n, message: "已复制", status: "success" });
823
- } catch (_) {
823
+ await Ct(f), F({ messageId: n, message: "已复制", status: "success" });
824
+ } catch (v) {
824
825
  console.error("[make-ai-assistant] copy answer failed", {
825
- errorType: _ instanceof Error ? _.name : typeof _
826
- }), C({ messageId: n, message: "复制失败", status: "error" });
826
+ errorType: v instanceof Error ? v.name : typeof v
827
+ }), F({ messageId: n, message: "复制失败", status: "error" });
827
828
  }
828
- }, Xe = (n) => {
829
- n.preventDefault(), re(x);
830
- }, et = (n) => {
831
- n.key === "Enter" && !n.shiftKey && !n.nativeEvent.isComposing && (n.preventDefault(), re(x));
832
- }, tt = () => {
833
- ne("stop") && f(
834
- (n) => ue(n, { type: "run.cancelled" })
829
+ }, tt = (n) => {
830
+ n.preventDefault(), oe(m);
831
+ }, at = (n) => {
832
+ n.key === "Enter" && !n.shiftKey && !n.nativeEvent.isComposing && (n.preventDefault(), oe(m));
833
+ }, st = () => {
834
+ ie("stop") && T(
835
+ (n) => he(n, { type: "run.cancelled" })
835
836
  );
836
- }, at = () => {
837
- ne("new-conversation"), L(""), T(void 0), C(void 0), K(!1), F.current = !0, f(me()), m?.();
838
- }, st = y.features?.remoteCancellation === !1 ? "停止接收" : "停止生成", nt = ze(l), rt = Oe(l), ie = Ut(l), it = typeof y.regenerate == "function" && y.features?.regeneration !== !1, Ne = () => {
839
- ie && re(ie.content);
837
+ }, nt = () => {
838
+ ie("new-conversation"), b(""), $(void 0), F(void 0), q(!1), P.current = !0, T(pe()), d?.();
839
+ }, rt = y.features?.remoteCancellation === !1 ? "停止接收" : "停止生成", it = Oe(p), ot = je(p), ce = qt(p), ct = typeof y.regenerate == "function" && y.features?.regeneration !== !1, we = () => {
840
+ ce && oe(ce.content);
840
841
  };
841
842
  return /* @__PURE__ */ i("section", { className: "make-ai-assistant make-ai-assistant__panel", children: [
842
843
  /* @__PURE__ */ i("header", { className: "make-ai-assistant__header", children: [
843
- /* @__PURE__ */ a(te, {}),
844
+ /* @__PURE__ */ a(ae, {}),
844
845
  /* @__PURE__ */ i("div", { children: [
845
- /* @__PURE__ */ a("h2", { children: U }),
846
- /* @__PURE__ */ a("p", { children: h ?? `当前应用:${s.app.name ?? "未命名应用"}` })
846
+ /* @__PURE__ */ a("h2", { children: J }),
847
+ /* @__PURE__ */ a("p", { children: k ?? `当前应用:${s.app.name ?? "未命名应用"}` })
847
848
  ] }),
848
849
  /* @__PURE__ */ i("div", { className: "make-ai-assistant__header-actions", children: [
849
850
  y.features?.newConversation !== !1 ? /* @__PURE__ */ a(
@@ -852,42 +853,42 @@ function Ot({
852
853
  "aria-label": "新建对话",
853
854
  className: "make-ai-assistant__icon-button",
854
855
  type: "button",
855
- onClick: at,
856
- children: /* @__PURE__ */ a(St, {})
856
+ onClick: nt,
857
+ children: /* @__PURE__ */ a(xt, {})
857
858
  }
858
859
  ) : null,
859
860
  c ? /* @__PURE__ */ a(
860
861
  "button",
861
862
  {
862
- "aria-label": `关闭 ${U}`,
863
+ "aria-label": `关闭 ${J}`,
863
864
  className: "make-ai-assistant__icon-button",
864
865
  type: "button",
865
866
  onClick: c,
866
- children: /* @__PURE__ */ a(Tt, {})
867
+ children: /* @__PURE__ */ a($t, {})
867
868
  }
868
869
  ) : null
869
870
  ] })
870
871
  ] }),
871
- /* @__PURE__ */ i("div", { className: "make-ai-assistant__privacy-note", role: "note", children: [
872
- /* @__PURE__ */ a("span", { className: "make-ai-assistant__privacy-icon", "aria-hidden": "true", children: /* @__PURE__ */ a($t, {}) }),
873
- /* @__PURE__ */ a("span", { children: "当前页面上下文会随请求发送,最终以宿主服务端对当前登录人的权限校验为准" })
874
- ] }),
872
+ Q ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__privacy-note", role: "note", children: [
873
+ /* @__PURE__ */ a("span", { className: "make-ai-assistant__privacy-icon", "aria-hidden": "true", children: /* @__PURE__ */ a(St, {}) }),
874
+ /* @__PURE__ */ a("span", { children: Q })
875
+ ] }) : null,
875
876
  /* @__PURE__ */ i(
876
877
  "div",
877
878
  {
878
879
  className: "make-ai-assistant__body",
879
880
  "aria-live": "polite",
880
881
  "aria-relevant": "additions text",
881
- ref: se,
882
+ ref: re,
882
883
  role: "log",
883
- onScroll: Ye,
884
+ onScroll: Je,
884
885
  children: [
885
- M === "loading" ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__empty", role: "status", children: [
886
- /* @__PURE__ */ a(te, {}),
886
+ V === "loading" ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__empty", role: "status", children: [
887
+ /* @__PURE__ */ a(ae, {}),
887
888
  /* @__PURE__ */ a("h3", { children: "正在恢复对话" }),
888
889
  /* @__PURE__ */ a("p", { children: "正在读取当前 App 的历史消息…" })
889
- ] }) : M === "error" ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__empty", role: "alert", children: [
890
- /* @__PURE__ */ a(te, {}),
890
+ ] }) : V === "error" ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__empty", role: "alert", children: [
891
+ /* @__PURE__ */ a(ae, {}),
891
892
  /* @__PURE__ */ a("h3", { children: "暂时无法加载对话" }),
892
893
  /* @__PURE__ */ a("p", { children: "请检查网络后重试。" }),
893
894
  /* @__PURE__ */ a(
@@ -895,98 +896,98 @@ function Ot({
895
896
  {
896
897
  className: "make-ai-assistant__retry",
897
898
  type: "button",
898
- onClick: () => fe((n) => n + 1),
899
+ onClick: () => Ye((n) => n + 1),
899
900
  children: "重新加载"
900
901
  }
901
902
  )
902
- ] }) : l.messages.length === 0 ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__empty", children: [
903
- /* @__PURE__ */ a(te, {}),
903
+ ] }) : p.messages.length === 0 ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__empty", children: [
904
+ /* @__PURE__ */ a(ae, {}),
904
905
  /* @__PURE__ */ a("h3", { children: "有什么可以帮你?" }),
905
906
  /* @__PURE__ */ a("p", { children: "我会结合当前 App、页面位置和宿主允许的上下文回答,并把过程与结果分开展示。" })
906
- ] }) : zt(
907
- l,
907
+ ] }) : jt(
908
+ p,
908
909
  s,
909
- Ae,
910
+ be,
910
911
  r,
911
912
  o,
912
913
  e,
913
- ie ? Ne : void 0,
914
- w,
915
- D,
916
- H,
917
- it,
918
- (n, g) => {
919
- Qe(n, g);
914
+ ce ? we : void 0,
915
+ W,
916
+ M,
917
+ _e,
918
+ ct,
919
+ (n, f) => {
920
+ et(n, f);
920
921
  },
921
922
  (n) => {
922
- Je(n);
923
+ Xe(n);
923
924
  }
924
925
  ),
925
- l.progress && !nt ? /* @__PURE__ */ a(
926
- Be,
926
+ p.progress && !it ? /* @__PURE__ */ a(
927
+ De,
927
928
  {
928
929
  assistantName: e,
929
- progress: l.progress
930
+ progress: p.progress
930
931
  }
931
932
  ) : null,
932
- l.error && !rt ? /* @__PURE__ */ a(
933
- Be,
933
+ p.error && !ot ? /* @__PURE__ */ a(
934
+ De,
934
935
  {
935
936
  assistantName: e,
936
- error: l.error,
937
- onRetry: ie ? Ne : void 0
937
+ error: p.error,
938
+ onRetry: ce ? we : void 0
938
939
  }
939
940
  ) : null
940
941
  ]
941
942
  }
942
943
  ),
943
- Ge ? /* @__PURE__ */ a(
944
+ We ? /* @__PURE__ */ a(
944
945
  "button",
945
946
  {
946
947
  "aria-label": "回到最新消息",
947
948
  className: "make-ai-assistant__back-to-latest",
948
949
  type: "button",
949
- onClick: We,
950
- children: /* @__PURE__ */ a(Et, {})
950
+ onClick: Qe,
951
+ children: /* @__PURE__ */ a(Rt, {})
951
952
  }
952
953
  ) : null,
953
954
  /* @__PURE__ */ i("footer", { className: "make-ai-assistant__composer-region", children: [
954
- M === "ready" && be.length > 0 && l.messages.length === 0 ? /* @__PURE__ */ a("div", { className: "make-ai-assistant__suggestions", "aria-label": "推荐问题", children: be.map((n, g) => /* @__PURE__ */ a(
955
+ V === "ready" && Ie.length > 0 && p.messages.length === 0 ? /* @__PURE__ */ a("div", { className: "make-ai-assistant__suggestions", "aria-label": "推荐问题", children: Ie.map((n, f) => /* @__PURE__ */ a(
955
956
  "button",
956
957
  {
957
958
  type: "button",
958
959
  onClick: () => {
959
- re(n);
960
+ oe(n);
960
961
  },
961
962
  children: n
962
963
  },
963
- `${g}-${n}`
964
+ `${f}-${n}`
964
965
  )) }) : null,
965
- /* @__PURE__ */ i("form", { className: "make-ai-assistant__composer", onSubmit: Xe, children: [
966
+ /* @__PURE__ */ i("form", { className: "make-ai-assistant__composer", onSubmit: tt, children: [
966
967
  /* @__PURE__ */ a(
967
968
  "textarea",
968
969
  {
969
970
  "aria-label": `向 ${e} 提问`,
970
- "aria-describedby": q ? "make-ai-composer-error" : void 0,
971
- "aria-invalid": q ? !0 : void 0,
971
+ "aria-describedby": C ? "make-ai-composer-error" : void 0,
972
+ "aria-invalid": C ? !0 : void 0,
972
973
  autoFocus: !0,
973
- disabled: M !== "ready" || l.status === "streaming",
974
+ disabled: V !== "ready" || p.status === "streaming",
974
975
  placeholder: `询问当前 ${s.app.name ?? "App"} 中的数据…`,
975
976
  rows: 2,
976
- value: x,
977
+ value: m,
977
978
  onChange: (n) => {
978
- L(n.currentTarget.value), T(void 0);
979
+ b(n.currentTarget.value), $(void 0);
979
980
  },
980
- onKeyDown: et
981
+ onKeyDown: at
981
982
  }
982
983
  ),
983
- l.status === "streaming" ? /* @__PURE__ */ a(
984
+ p.status === "streaming" ? /* @__PURE__ */ a(
984
985
  "button",
985
986
  {
986
- "aria-label": st,
987
+ "aria-label": rt,
987
988
  className: "make-ai-assistant__send make-ai-assistant__send--stop",
988
989
  type: "button",
989
- onClick: tt,
990
+ onClick: st,
990
991
  children: /* @__PURE__ */ a("span", { "aria-hidden": "true" })
991
992
  }
992
993
  ) : /* @__PURE__ */ a(
@@ -994,18 +995,18 @@ function Ot({
994
995
  {
995
996
  "aria-label": "发送",
996
997
  className: "make-ai-assistant__send",
997
- disabled: M !== "ready" || !x.trim(),
998
+ disabled: V !== "ready" || !m.trim(),
998
999
  type: "submit",
999
- children: /* @__PURE__ */ a(Rt, {})
1000
+ children: /* @__PURE__ */ a(Lt, {})
1000
1001
  }
1001
1002
  )
1002
1003
  ] }),
1003
- q ? /* @__PURE__ */ a("p", { id: "make-ai-composer-error", role: "alert", children: q }) : null,
1004
+ C ? /* @__PURE__ */ a("p", { id: "make-ai-composer-error", role: "alert", children: C }) : null,
1004
1005
  /* @__PURE__ */ a("p", { children: "AI 生成的结果可能存在偏差,重要数据请核对明细。" })
1005
1006
  ] })
1006
1007
  ] });
1007
1008
  }
1008
- function Wt({
1009
+ function Qt({
1009
1010
  defaultOpen: e = !1,
1010
1011
  hideLauncher: t = !1,
1011
1012
  launcher: s,
@@ -1013,62 +1014,62 @@ function Wt({
1013
1014
  open: o,
1014
1015
  ...c
1015
1016
  }) {
1016
- const m = qe(c.brandName, c.title), [u, h] = S(e), k = R(null), v = o ?? u, y = (w) => {
1017
- o === void 0 && h(w), r?.(w), w || requestAnimationFrame(() => k.current?.focus());
1018
- }, D = () => y(!v);
1019
- return he(() => {
1020
- if (!v) return;
1021
- const w = (U) => {
1022
- U.key === "Escape" && (y(!1), requestAnimationFrame(() => k.current?.focus()));
1017
+ const d = He(c.brandName, c.title), [u, h] = R(e), k = x(null), _ = o ?? u, L = (M) => {
1018
+ o === void 0 && h(M), r?.(M), M || requestAnimationFrame(() => k.current?.focus());
1019
+ }, y = () => L(!_);
1020
+ return fe(() => {
1021
+ if (!_) return;
1022
+ const M = (W) => {
1023
+ W.key === "Escape" && (L(!1), requestAnimationFrame(() => k.current?.focus()));
1023
1024
  };
1024
- return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
1025
- }, [r, v]), /* @__PURE__ */ i("div", { className: "make-ai-assistant", "data-open": v || void 0, children: [
1026
- !t && (!v || s) ? s ? s({ open: v, toggle: D }) : /* @__PURE__ */ i(
1025
+ return document.addEventListener("keydown", M), () => document.removeEventListener("keydown", M);
1026
+ }, [r, _]), /* @__PURE__ */ i("div", { className: "make-ai-assistant", "data-open": _ || void 0, children: [
1027
+ !t && (!_ || s) ? s ? s({ open: _, toggle: y }) : /* @__PURE__ */ i(
1027
1028
  "button",
1028
1029
  {
1029
- "aria-label": v ? `关闭 ${m}` : `打开 ${m}`,
1030
- "aria-expanded": v,
1030
+ "aria-label": _ ? `关闭 ${d}` : `打开 ${d}`,
1031
+ "aria-expanded": _,
1031
1032
  className: "make-ai-assistant__launcher",
1032
1033
  ref: k,
1033
1034
  type: "button",
1034
- onClick: D,
1035
+ onClick: y,
1035
1036
  children: [
1036
1037
  /* @__PURE__ */ a("span", { className: "make-ai-assistant__launcher-orbit", "aria-hidden": "true" }),
1037
- /* @__PURE__ */ a(He, {})
1038
+ /* @__PURE__ */ a(Ke, {})
1038
1039
  ]
1039
1040
  }
1040
1041
  ) : null,
1041
- v ? /* @__PURE__ */ a(
1042
+ _ ? /* @__PURE__ */ a(
1042
1043
  "aside",
1043
1044
  {
1044
- "aria-label": m,
1045
+ "aria-label": d,
1045
1046
  "aria-modal": "false",
1046
1047
  className: "make-ai-assistant__drawer",
1047
1048
  role: "dialog",
1048
- children: /* @__PURE__ */ a(Ot, { ...c, onClose: () => y(!1) })
1049
+ children: /* @__PURE__ */ a(Zt, { ...c, onClose: () => L(!1) })
1049
1050
  }
1050
1051
  ) : null
1051
1052
  ] });
1052
1053
  }
1053
1054
  export {
1054
- mt as ArtifactRenderer,
1055
- Ot as AssistantPanel,
1056
- ta as MAKE_AI_ARTIFACT_KINDS,
1057
- aa as MAKE_AI_ARTIFACT_LIMITS,
1058
- sa as MAKE_AI_ARTIFACT_SCHEMA_VERSION,
1059
- b as MAKE_AI_CONVERSATION_LIMITS,
1060
- Wt as MakeAiAssistant,
1061
- lt as appendUserMessage,
1062
- ct as createArtifactCapabilities,
1063
- De as createArtifactTemplateRegistry,
1064
- me as createAssistantConversationState,
1065
- At as createPlatformArtifactRegistry,
1066
- Xt as extendArtifactTemplateRegistry,
1067
- B as formatArtifactValue,
1068
- na as parseArtifact,
1069
- dt as parseAssistantEvent,
1070
- kt as platformArtifactTemplates,
1071
- ue as reduceAssistantEvent,
1072
- ot as resolveArtifactTemplate,
1073
- ra as validateArtifact
1055
+ pt as ArtifactRenderer,
1056
+ Zt as AssistantPanel,
1057
+ sa as MAKE_AI_ARTIFACT_KINDS,
1058
+ na as MAKE_AI_ARTIFACT_LIMITS,
1059
+ ra as MAKE_AI_ARTIFACT_SCHEMA_VERSION,
1060
+ I as MAKE_AI_CONVERSATION_LIMITS,
1061
+ Qt as MakeAiAssistant,
1062
+ mt as appendUserMessage,
1063
+ dt as createArtifactCapabilities,
1064
+ Ue as createArtifactTemplateRegistry,
1065
+ pe as createAssistantConversationState,
1066
+ It as createPlatformArtifactRegistry,
1067
+ ta as extendArtifactTemplateRegistry,
1068
+ D as formatArtifactValue,
1069
+ ia as parseArtifact,
1070
+ ut as parseAssistantEvent,
1071
+ bt as platformArtifactTemplates,
1072
+ he as reduceAssistantEvent,
1073
+ lt as resolveArtifactTemplate,
1074
+ oa as validateArtifact
1074
1075
  };