@marimo-team/islands 0.22.5-dev4 → 0.22.5-dev7

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.
@@ -5,7 +5,7 @@ import { s as __toESM, t as __commonJSMin } from "./chunk-BNovOVIE.js";
5
5
  import { t as require_react } from "./react-Bs6Z0kvn.js";
6
6
  import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
7
7
  import { r as toast } from "./copy-BRF7ryOP.js";
8
- import { A as MarimoIncomingMessageEvent, At as moveToEndOfEditor, Bn as CircleX, C as contextToXml, D as AccordionContent, Dn as Wrench, Dt as createVariableInfoElement, E as Accordion, Fn as File$1, Gt as dataSourceConnectionsAtom, I as ChatBubbleIcon, Jt as getRequestClient, Kt as getTableType, Lt as jotaiJsonStorage, Mn as LoaderCircle, O as AccordionItem, On as Trash2, Pn as Info, Q as cellErrorsAtom, Qt as singleFacet, Rt as variablesAtom, S as Sections, T as AIContextRegistry, U as deserializeBlob, W as base64ToDataURL, Wt as allTablesAtom, Z as renderHTML, a as toPng, bt as displayCellName, cn as CellOutputId, d as Spinner, f as Popover, g as isOutputEmpty, h as PopoverTrigger, k as AccordionTrigger, m as PopoverContent, n as blobToString, nt as notebookAtom, o as MarkdownRenderer, rn as ZodLocalStorage, t as processOutput, w as AIContextProvider, x as Boosts, xn as Anchor2, y as DatasourceContextProvider, yn as atomWithStorage, zt as PluralWord } from "./process-output-BvkX_OeE.js";
8
+ import { $t as singleFacet, A as MarimoIncomingMessageEvent, Bt as PluralWord, C as contextToXml, D as AccordionContent, E as Accordion, Fn as Info, Gt as allTablesAtom, I as ChatBubbleIcon, In as File$1, Kt as dataSourceConnectionsAtom, Nn as LoaderCircle, O as AccordionItem, On as Wrench, Ot as createVariableInfoElement, Q as cellErrorsAtom, Rt as jotaiJsonStorage, S as Sections, Sn as Anchor2, T as AIContextRegistry, U as deserializeBlob, Vn as CircleX, W as base64ToDataURL, Yt as getRequestClient, Z as renderHTML, a as toPng, bn as atomWithStorage, d as Spinner, f as Popover, g as isOutputEmpty, h as PopoverTrigger, in as ZodLocalStorage, jt as moveToEndOfEditor, k as AccordionTrigger, kn as Trash2, ln as CellOutputId, m as PopoverContent, n as blobToString, nt as notebookAtom, o as MarkdownRenderer, qt as getTableType, t as processOutput, w as AIContextProvider, x as Boosts, xt as displayCellName, y as DatasourceContextProvider, zt as variablesAtom } from "./process-output-C0tmJosY.js";
9
9
  import "./chunk-5FQGJX7Z-C428iZBW.js";
10
10
  import { u as createLucideIcon } from "./dist-D56NKWim.js";
11
11
  import { C as logNever, I as X, n as Strings, t as Label } from "./label-CIR53v8V.js";
@@ -6355,21 +6355,21 @@ var import_compiler_runtime$3 = require_compiler_runtime();
6355
6355
  const ReasoningAccordion = (e18) => {
6356
6356
  let _ = (0, import_compiler_runtime$3.c)(13), { reasoning: v, index: y, isStreaming: b } = e18, x = y === void 0 ? 0 : y, S = b === void 0 ? false : b, C = S ? "reasoning" : void 0, w;
6357
6357
  _[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-3 w-3" }), _[0] = w) : w = _[0];
6358
- let E = S ? "Thinking" : "View reasoning", D;
6359
- _[1] !== v.length || _[2] !== E ? (D = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6358
+ let D = S ? "Thinking" : "View reasoning", O;
6359
+ _[1] !== v.length || _[2] !== D ? (O = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6360
6360
  className: "text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",
6361
6361
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6362
6362
  className: "flex items-center gap-2",
6363
6363
  children: [
6364
6364
  w,
6365
- E,
6365
+ D,
6366
6366
  " (",
6367
6367
  v.length,
6368
6368
  " ",
6369
6369
  "chars)"
6370
6370
  ]
6371
6371
  })
6372
- }), _[1] = v.length, _[2] = E, _[3] = D) : D = _[3];
6372
+ }), _[1] = v.length, _[2] = D, _[3] = O) : O = _[3];
6373
6373
  let k;
6374
6374
  _[4] === v ? k = _[5] : (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6375
6375
  className: "pb-2 px-2",
@@ -6382,11 +6382,11 @@ const ReasoningAccordion = (e18) => {
6382
6382
  })
6383
6383
  }), _[4] = v, _[5] = k);
6384
6384
  let A;
6385
- _[6] !== D || _[7] !== k ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6385
+ _[6] !== O || _[7] !== k ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
6386
6386
  value: "reasoning",
6387
6387
  className: "border-0",
6388
- children: [D, k]
6389
- }), _[6] = D, _[7] = k, _[8] = A) : A = _[8];
6388
+ children: [O, k]
6389
+ }), _[6] = O, _[7] = k, _[8] = A) : A = _[8];
6390
6390
  let j;
6391
6391
  return _[9] !== x || _[10] !== C || _[11] !== A ? (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6392
6392
  type: "single",
@@ -6411,36 +6411,36 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6411
6411
  className: "text-xs font-semibold text-muted-foreground",
6412
6412
  children: "Tool Result"
6413
6413
  }), _[2] = E) : E = _[2];
6414
- let D;
6415
- _[3] === e19 ? D = _[4] : (D = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6414
+ let O;
6415
+ _[3] === e19 ? O = _[4] : (O = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6416
6416
  className: "text-xs px-2 py-0.5 bg-[var(--grass-2)] text-[var(--grass-11)] rounded-full font-medium capitalize",
6417
6417
  children: e19
6418
- }), _[3] = e19, _[4] = D);
6419
- let O;
6420
- _[5] === b ? O = _[6] : (O = b && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6418
+ }), _[3] = e19, _[4] = O);
6419
+ let k;
6420
+ _[5] === b ? k = _[6] : (k = b && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
6421
6421
  className: "text-xs px-2 py-0.5 bg-[var(--amber-2)] text-[var(--amber-11)] rounded-full",
6422
6422
  children: "Auth Required"
6423
- }), _[5] = b, _[6] = O);
6424
- let k;
6425
- _[7] !== D || _[8] !== O ? (k = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6423
+ }), _[5] = b, _[6] = k);
6424
+ let A;
6425
+ _[7] !== O || _[8] !== k ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6426
6426
  className: "flex items-center justify-between",
6427
6427
  children: [E, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6428
6428
  className: "flex items-center gap-2",
6429
- children: [D, O]
6429
+ children: [O, k]
6430
6430
  })]
6431
- }), _[7] = D, _[8] = O, _[9] = k) : k = _[9];
6432
- let A;
6433
- _[10] === w ? A = _[11] : (A = w && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6431
+ }), _[7] = O, _[8] = k, _[9] = A) : A = _[9];
6432
+ let j;
6433
+ _[10] === w ? j = _[11] : (j = w && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6434
6434
  className: "flex items-start gap-2",
6435
6435
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "h-3 w-3 text-[var(--blue-11)] mt-0.5 flex-shrink-0" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6436
6436
  className: "text-xs text-foreground",
6437
6437
  children: w
6438
6438
  })]
6439
- }), _[10] = w, _[11] = A), y = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6439
+ }), _[10] = w, _[11] = j), y = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6440
6440
  className: "flex flex-col gap-1.5",
6441
6441
  children: [
6442
- k,
6443
6442
  A,
6443
+ j,
6444
6444
  T && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6445
6445
  className: "space-y-3",
6446
6446
  children: Object.entries(T).map(_temp$1)
@@ -6486,9 +6486,9 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
6486
6486
  }), _[7] = C, _[8] = w), w;
6487
6487
  };
6488
6488
  const ToolCallAccordion = (e18) => {
6489
- let _ = (0, import_compiler_runtime$2.c)(38), { toolName: v, result: y, error: b, index: x, state: S, className: w, input: D } = e18, k = x === void 0 ? 0 : x, A = S === "output-available" && (y || b), j = b ? "error" : A ? "success" : "loading", M;
6490
- _[0] === j ? M = _[1] : (M = () => {
6491
- switch (j) {
6489
+ let _ = (0, import_compiler_runtime$2.c)(38), { toolName: v, result: y, error: b, index: x, state: S, className: C, input: w } = e18, D = x === void 0 ? 0 : x, O = S === "output-available" && (y || b), k = b ? "error" : O ? "success" : "loading", A;
6490
+ _[0] === k ? A = _[1] : (A = () => {
6491
+ switch (k) {
6492
6492
  case "loading":
6493
6493
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-3 w-3 animate-spin" });
6494
6494
  case "error":
@@ -6498,16 +6498,16 @@ const ToolCallAccordion = (e18) => {
6498
6498
  default:
6499
6499
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Wrench, { className: "h-3 w-3" });
6500
6500
  }
6501
- }, _[0] = j, _[1] = M);
6502
- let N = M, P;
6503
- _[2] !== b || _[3] !== A || _[4] !== j ? (P = () => j === "loading" ? "Running" : b ? "Failed" : A ? "Done" : "Tool call", _[2] = b, _[3] = A, _[4] = j, _[5] = P) : P = _[5];
6504
- let L = P, R = `tool-${k}`, z;
6505
- _[6] === w ? z = _[7] : (z = cn("w-full", w), _[6] = w, _[7] = z);
6506
- let B = j === "error" && "text-[var(--red-11)]/80", V = j === "success" && "text-[var(--grass-11)]/80", H;
6507
- _[8] !== B || _[9] !== V ? (H = cn("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline", B, V), _[8] = B, _[9] = V, _[10] = H) : H = _[10];
6501
+ }, _[0] = k, _[1] = A);
6502
+ let j = A, F;
6503
+ _[2] !== b || _[3] !== O || _[4] !== k ? (F = () => k === "loading" ? "Running" : b ? "Failed" : O ? "Done" : "Tool call", _[2] = b, _[3] = O, _[4] = k, _[5] = F) : F = _[5];
6504
+ let I = F, L = `tool-${D}`, R;
6505
+ _[6] === C ? R = _[7] : (R = cn("w-full", C), _[6] = C, _[7] = R);
6506
+ let z = k === "error" && "text-[var(--red-11)]/80", B = k === "success" && "text-[var(--grass-11)]/80", V;
6507
+ _[8] !== z || _[9] !== B ? (V = cn("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline", z, B), _[8] = z, _[9] = B, _[10] = V) : V = _[10];
6508
6508
  let U;
6509
- _[11] === N ? U = _[12] : (U = N(), _[11] = N, _[12] = U);
6510
- let W = L(), G;
6509
+ _[11] === j ? U = _[12] : (U = j(), _[11] = j, _[12] = U);
6510
+ let W = I(), G;
6511
6511
  _[13] === v ? G = _[14] : (G = formatToolName(v), _[13] = v, _[14] = G);
6512
6512
  let K;
6513
6513
  _[15] === G ? K = _[16] : (K = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
@@ -6525,15 +6525,15 @@ const ToolCallAccordion = (e18) => {
6525
6525
  ]
6526
6526
  }), _[17] = W, _[18] = K, _[19] = U, _[20] = q) : q = _[20];
6527
6527
  let J;
6528
- _[21] !== q || _[22] !== H ? (J = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6529
- className: H,
6528
+ _[21] !== q || _[22] !== V ? (J = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
6529
+ className: V,
6530
6530
  children: q
6531
- }), _[21] = q, _[22] = H, _[23] = J) : J = _[23];
6531
+ }), _[21] = q, _[22] = V, _[23] = J) : J = _[23];
6532
6532
  let Y;
6533
- _[24] !== b || _[25] !== A || _[26] !== D || _[27] !== y ? (Y = A && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6533
+ _[24] !== b || _[25] !== O || _[26] !== w || _[27] !== y ? (Y = O && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6534
6534
  className: "space-y-3",
6535
6535
  children: [
6536
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: D }),
6536
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: w }),
6537
6537
  y != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResultRenderer, { result: y }),
6538
6538
  b && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6539
6539
  className: "bg-[var(--red-2)] border border-[var(--red-6)] rounded-lg p-3",
@@ -6546,7 +6546,7 @@ const ToolCallAccordion = (e18) => {
6546
6546
  })]
6547
6547
  })
6548
6548
  ]
6549
- }), _[24] = b, _[25] = A, _[26] = D, _[27] = y, _[28] = Y) : Y = _[28];
6549
+ }), _[24] = b, _[25] = O, _[26] = w, _[27] = y, _[28] = Y) : Y = _[28];
6550
6550
  let Z;
6551
6551
  _[29] === Y ? Z = _[30] : (Z = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
6552
6552
  className: "py-2 px-2",
@@ -6559,12 +6559,12 @@ const ToolCallAccordion = (e18) => {
6559
6559
  children: [J, Z]
6560
6560
  }), _[31] = J, _[32] = Z, _[33] = Q) : Q = _[33];
6561
6561
  let $;
6562
- return _[34] !== Q || _[35] !== R || _[36] !== z ? ($ = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6562
+ return _[34] !== Q || _[35] !== L || _[36] !== R ? ($ = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
6563
6563
  type: "single",
6564
6564
  collapsible: true,
6565
- className: z,
6565
+ className: R,
6566
6566
  children: Q
6567
- }, R), _[34] = Q, _[35] = R, _[36] = z, _[37] = $) : $ = _[37], $;
6567
+ }, L), _[34] = Q, _[35] = L, _[36] = R, _[37] = $) : $ = _[37], $;
6568
6568
  };
6569
6569
  function formatToolName(e18) {
6570
6570
  return e18.replace("tool-", "");
@@ -7160,24 +7160,24 @@ var import_compiler_runtime = require_compiler_runtime(), PopoverAnchor = Anchor
7160
7160
  });
7161
7161
  const Chatbot = (e18) => {
7162
7162
  var _a;
7163
- let [_, v] = (0, import_react.useState)(""), [y, b] = (0, import_react.useState)(e18.config), [C, w] = (0, import_react.useState)(e18.config), [T, E] = (0, import_react.useState)(void 0), D = (0, import_react.useRef)(null), O = (0, import_react.useRef)(null), k = (0, import_react.useRef)(null), A = (0, import_react.useRef)(null);
7164
- Object.keys(e18.config).some((_2) => e18.config[_2] !== C[_2]) && (b(e18.config), w(e18.config));
7165
- let j = (0, import_react.useRef)(y);
7166
- j.current = y;
7167
- let M = (0, import_react.useRef)({
7163
+ let [_, v] = (0, import_react.useState)(""), [y, b] = (0, import_react.useState)(e18.config), [x, C] = (0, import_react.useState)(e18.config), [w, T] = (0, import_react.useState)(void 0), E = (0, import_react.useRef)(null), D = (0, import_react.useRef)(null), O = (0, import_react.useRef)(null), k = (0, import_react.useRef)(null);
7164
+ Object.keys(e18.config).some((_2) => e18.config[_2] !== x[_2]) && (b(e18.config), C(e18.config));
7165
+ let A = (0, import_react.useRef)(y);
7166
+ A.current = y;
7167
+ let j = (0, import_react.useRef)({
7168
7168
  backendMessageId: null,
7169
7169
  frontendMessageIndex: null
7170
- }), N = (0, import_react.useRef)(null), { data: P } = useAsyncData(async () => (await e18.get_chat_history({})).messages, []), F = e18.value.length > 0 ? e18.value : P, { messages: I, sendMessage: R, setMessages: z, status: B, stop: V, error: H, regenerate: U, clearError: W } = useChat({
7170
+ }), M = (0, import_react.useRef)(null), { data: N } = useAsyncData(async () => (await e18.get_chat_history({})).messages, []), P = e18.value.length > 0 ? e18.value : N, { messages: F, sendMessage: I, setMessages: L, status: R, stop: z, error: B, regenerate: V, clearError: H } = useChat({
7171
7171
  transport: new DefaultChatTransport({ fetch: async (_2, v2) => {
7172
7172
  var _a2;
7173
7173
  if (v2 === void 0) return fetch(_2);
7174
- let y2 = JSON.parse(v2.body), b2 = v2.signal, x = {
7175
- max_tokens: j.current.max_tokens,
7176
- temperature: j.current.temperature,
7177
- top_p: j.current.top_p,
7178
- top_k: j.current.top_k,
7179
- frequency_penalty: j.current.frequency_penalty,
7180
- presence_penalty: j.current.presence_penalty
7174
+ let y2 = JSON.parse(v2.body), b2 = v2.signal, x2 = {
7175
+ max_tokens: A.current.max_tokens,
7176
+ temperature: A.current.temperature,
7177
+ top_p: A.current.top_p,
7178
+ top_k: A.current.top_k,
7179
+ frequency_penalty: A.current.frequency_penalty,
7180
+ presence_penalty: A.current.presence_penalty
7181
7181
  };
7182
7182
  try {
7183
7183
  let _3 = y2.messages.map((e19) => {
@@ -7188,32 +7188,32 @@ const Chatbot = (e18) => {
7188
7188
  };
7189
7189
  }), v3 = new ReadableStream({
7190
7190
  start(e19) {
7191
- N.current = e19;
7191
+ M.current = e19;
7192
7192
  let _4 = () => {
7193
7193
  try {
7194
7194
  e19.close();
7195
7195
  } catch (e20) {
7196
7196
  Logger.debug("Controller may already be closed", { error: e20 });
7197
7197
  }
7198
- N.current = null;
7198
+ M.current = null;
7199
7199
  };
7200
7200
  return b2 == null ? void 0 : b2.addEventListener("abort", _4), () => {
7201
7201
  b2 == null ? void 0 : b2.removeEventListener("abort", _4);
7202
7202
  };
7203
7203
  },
7204
7204
  cancel() {
7205
- N.current = null;
7205
+ M.current = null;
7206
7206
  }
7207
7207
  });
7208
7208
  return e18.send_prompt({
7209
7209
  messages: _3,
7210
- config: x
7210
+ config: x2
7211
7211
  }).catch((e19) => {
7212
7212
  var _a3;
7213
- (_a3 = N.current) == null ? void 0 : _a3.error(e19), N.current = null;
7213
+ (_a3 = M.current) == null ? void 0 : _a3.error(e19), M.current = null;
7214
7214
  }), createUIMessageStreamResponse({ stream: v3 });
7215
7215
  } catch (e19) {
7216
- if (M.current = {
7216
+ if (j.current = {
7217
7217
  backendMessageId: null,
7218
7218
  frontendMessageIndex: null
7219
7219
  }, e19 instanceof Error && e19.name === "AbortError") return new Response("Aborted", { status: 499 });
@@ -7221,15 +7221,15 @@ const Chatbot = (e18) => {
7221
7221
  return new Response(_3, { status: 400 });
7222
7222
  }
7223
7223
  } }),
7224
- messages: F,
7224
+ messages: P,
7225
7225
  onFinish: (_2) => {
7226
- E(void 0), D.current && (D.current.value = ""), Logger.debug("Finished streaming message:", _2), M.current = {
7226
+ T(void 0), E.current && (E.current.value = ""), Logger.debug("Finished streaming message:", _2), j.current = {
7227
7227
  backendMessageId: null,
7228
7228
  frontendMessageIndex: null
7229
7229
  }, e18.setValue(_2.messages);
7230
7230
  },
7231
7231
  onError: (e19) => {
7232
- Logger.error("An error occurred:", e19), M.current = {
7232
+ Logger.error("An error occurred:", e19), j.current = {
7233
7233
  backendMessageId: null,
7234
7234
  frontendMessageIndex: null
7235
7235
  };
@@ -7238,34 +7238,34 @@ const Chatbot = (e18) => {
7238
7238
  useEventListener(e18.host, MarimoIncomingMessageEvent.TYPE, (e19) => {
7239
7239
  let _2 = ChatMessageIncomingSchema.safeParse(e19.detail.message);
7240
7240
  if (!_2.success) return;
7241
- let v2 = _2.data, y2 = N.current;
7242
- y2 && (v2.content && y2.enqueue(v2.content), v2.is_final && (y2.close(), N.current = null));
7241
+ let v2 = _2.data, y2 = M.current;
7242
+ y2 && (v2.content && y2.enqueue(v2.content), v2.is_final && (y2.close(), M.current = null));
7243
7243
  });
7244
- let G = B === "submitted" || B === "streaming", K = (_2) => {
7245
- let v2 = I.findIndex((e19) => e19.id === _2);
7244
+ let U = R === "submitted" || R === "streaming", W = (_2) => {
7245
+ let v2 = F.findIndex((e19) => e19.id === _2);
7246
7246
  if (v2 !== -1) {
7247
- let y2 = I.filter((e19) => e19.id !== _2);
7248
- e18.delete_chat_message({ index: v2 }), z(y2), e18.setValue(y2);
7247
+ let y2 = F.filter((e19) => e19.id !== _2);
7248
+ e18.delete_chat_message({ index: v2 }), L(y2), e18.setValue(y2);
7249
7249
  }
7250
- }, q = Array.isArray(e18.allowAttachments) && e18.allowAttachments.length > 0 || e18.allowAttachments === true, J = {
7250
+ }, G = Array.isArray(e18.allowAttachments) && e18.allowAttachments.length > 0 || e18.allowAttachments === true, K = {
7251
7251
  triggerCompletionRegex: /^\/(\w+)?/,
7252
7252
  completions: e18.prompts.map((e19) => ({
7253
7253
  label: `/${e19}`,
7254
7254
  displayLabel: e19,
7255
7255
  apply: e19
7256
7256
  }))
7257
- }, Y = e18.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
7257
+ }, q = e18.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
7258
7258
  (0, import_react.useEffect)(() => {
7259
7259
  var _a2;
7260
- (_a2 = A.current) == null ? void 0 : _a2.scrollTo({
7261
- top: A.current.scrollHeight,
7260
+ (_a2 = k.current) == null ? void 0 : _a2.scrollTo({
7261
+ top: k.current.scrollHeight,
7262
7262
  behavior: "smooth"
7263
7263
  });
7264
- }, [I.length, A]);
7265
- let Z = (_a = k.current) == null ? void 0 : _a.view, $ = () => {
7266
- if (Z) {
7267
- let e19 = Z.state.doc.length;
7268
- Z.dispatch({ changes: {
7264
+ }, [F.length, k]);
7265
+ let Y = (_a = O.current) == null ? void 0 : _a.view, Z = () => {
7266
+ if (Y) {
7267
+ let e19 = Y.state.doc.length;
7268
+ Y.dispatch({ changes: {
7269
7269
  from: 0,
7270
7270
  to: e19,
7271
7271
  insert: ""
@@ -7282,18 +7282,18 @@ const Chatbot = (e18) => {
7282
7282
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
7283
7283
  variant: "text",
7284
7284
  size: "icon",
7285
- disabled: I.length === 0,
7285
+ disabled: F.length === 0,
7286
7286
  onClick: () => {
7287
- z([]), e18.setValue([]), e18.delete_chat_history({}), W();
7287
+ L([]), e18.setValue([]), e18.delete_chat_history({}), H();
7288
7288
  },
7289
7289
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RotateCw, { className: "h-3 w-3" })
7290
7290
  })
7291
7291
  }),
7292
7292
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7293
7293
  className: "grow overflow-y-auto gap-4 pt-8 pb-4 px-2 flex flex-col",
7294
- ref: A,
7294
+ ref: k,
7295
7295
  children: [
7296
- I.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7296
+ F.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7297
7297
  className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
7298
7298
  children: [
7299
7299
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-12 w-12 mb-4" }),
@@ -7307,16 +7307,16 @@ const Chatbot = (e18) => {
7307
7307
  })
7308
7308
  ]
7309
7309
  }),
7310
- I.map((e19, _2) => {
7310
+ F.map((e19, _2) => {
7311
7311
  var _a2;
7312
- let v2 = (_a2 = e19.parts) == null ? void 0 : _a2.filter((e20) => e20.type === "text").map((e20) => e20.text).join("\n"), y2 = _2 === I.length - 1;
7312
+ let v2 = (_a2 = e19.parts) == null ? void 0 : _a2.filter((e20) => e20.type === "text").map((e20) => e20.text).join("\n"), y2 = _2 === F.length - 1;
7313
7313
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7314
7314
  className: cn("flex flex-col group gap-2", e19.role === "user" ? "items-end" : "items-start"),
7315
7315
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
7316
7316
  className: `max-w-[80%] p-3 rounded-lg ${e19.role === "user" ? "bg-(--sky-11) text-(--slate-1) whitespace-pre-wrap" : "bg-(--slate-4) text-(--slate-12)"}`,
7317
7317
  children: renderUIMessage({
7318
7318
  message: e19,
7319
- isStreamingReasoning: B === "streaming",
7319
+ isStreamingReasoning: R === "streaming",
7320
7320
  isLast: y2
7321
7321
  })
7322
7322
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
@@ -7327,29 +7327,29 @@ const Chatbot = (e18) => {
7327
7327
  buttonClassName: "text-xs text-(--slate-9) hover:text-(--slate-11)"
7328
7328
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
7329
7329
  type: "button",
7330
- onClick: () => K(e19.id),
7330
+ onClick: () => W(e19.id),
7331
7331
  className: "text-xs text-(--slate-9) hover:text-(--slate-11)",
7332
7332
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "h-3 w-3 text-(--red-9)" })
7333
7333
  })]
7334
7334
  })]
7335
7335
  }, `${e19.id}-${_2}`);
7336
7336
  }),
7337
- G && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7337
+ U && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7338
7338
  className: "flex items-center justify-center space-x-2 mb-4",
7339
7339
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: "small" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
7340
7340
  variant: "link",
7341
7341
  size: "sm",
7342
- onClick: () => V(),
7342
+ onClick: () => z(),
7343
7343
  className: "text-(--red-9) hover:text-(--red-11)",
7344
7344
  children: "Stop"
7345
7345
  })]
7346
7346
  }),
7347
- H && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7347
+ B && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7348
7348
  className: "flex items-center justify-center space-x-2 mb-4",
7349
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, { error: H }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
7349
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, { error: B }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
7350
7350
  variant: "outline",
7351
7351
  size: "sm",
7352
- onClick: () => U(),
7352
+ onClick: () => V(),
7353
7353
  children: "Retry"
7354
7354
  })]
7355
7355
  })
@@ -7358,16 +7358,16 @@ const Chatbot = (e18) => {
7358
7358
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
7359
7359
  onSubmit: async (v2) => {
7360
7360
  if (v2.preventDefault(), e18.disabled) return;
7361
- let y2 = T ? await convertToFileUIPart(T) : void 0;
7362
- R({
7361
+ let y2 = w ? await convertToFileUIPart(w) : void 0;
7362
+ I({
7363
7363
  role: "user",
7364
7364
  parts: [{
7365
7365
  type: "text",
7366
7366
  text: _
7367
7367
  }, ...y2 ?? []]
7368
- }), $();
7368
+ }), Z();
7369
7369
  },
7370
- ref: O,
7370
+ ref: D,
7371
7371
  inert: e18.disabled || void 0,
7372
7372
  className: cn("flex w-full border-t border-(--slate-6) px-2 py-1 items-center", e18.disabled && "opacity-50 cursor-not-allowed"),
7373
7373
  children: [
@@ -7379,66 +7379,66 @@ const Chatbot = (e18) => {
7379
7379
  prompts: e18.prompts,
7380
7380
  onSelect: (e19) => {
7381
7381
  v(e19), requestAnimationFrame(() => {
7382
- Z == null ? void 0 : Z.focus(), moveToEndOfEditor(Z);
7382
+ Y == null ? void 0 : Y.focus(), moveToEndOfEditor(Y);
7383
7383
  });
7384
7384
  }
7385
7385
  }),
7386
7386
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PromptInput, {
7387
7387
  className: "rounded-sm mr-2",
7388
- placeholder: Y,
7388
+ placeholder: q,
7389
7389
  value: _,
7390
- inputRef: k,
7390
+ inputRef: O,
7391
7391
  maxHeight: e18.maxHeight ? `${e18.maxHeight / 2}px` : void 0,
7392
7392
  onChange: v,
7393
7393
  onSubmit: (e19, _2) => {
7394
7394
  var _a2;
7395
- _2.trim() && ((_a2 = O.current) == null ? void 0 : _a2.requestSubmit());
7395
+ _2.trim() && ((_a2 = D.current) == null ? void 0 : _a2.requestSubmit());
7396
7396
  },
7397
7397
  onClose: () => {
7398
7398
  },
7399
- additionalCompletions: J
7399
+ additionalCompletions: K
7400
7400
  }),
7401
- T && T.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
7402
- title: T[0].name,
7401
+ w && w.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
7402
+ title: w[0].name,
7403
7403
  className: "text-sm text-(--slate-11) truncate shrink-0 w-fit max-w-24",
7404
- children: T[0].name
7404
+ children: w[0].name
7405
7405
  }),
7406
- T && T.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
7407
- title: [...T].map((e19) => e19.name).join("\n"),
7406
+ w && w.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
7407
+ title: [...w].map((e19) => e19.name).join("\n"),
7408
7408
  className: "text-sm text-(--slate-11) truncate shrink-0",
7409
- children: [T.length, " files"]
7409
+ children: [w.length, " files"]
7410
7410
  }),
7411
- T && T.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
7411
+ w && w.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
7412
7412
  type: "button",
7413
7413
  variant: "text",
7414
7414
  size: "sm",
7415
7415
  onClick: () => {
7416
- E(void 0), D.current && (D.current.value = "");
7416
+ T(void 0), E.current && (E.current.value = "");
7417
7417
  },
7418
7418
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-3" })
7419
7419
  }),
7420
- q && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
7420
+ G && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
7421
7421
  type: "button",
7422
7422
  variant: "text",
7423
7423
  size: "sm",
7424
7424
  onClick: () => {
7425
7425
  var _a2;
7426
- return (_a2 = D.current) == null ? void 0 : _a2.click();
7426
+ return (_a2 = E.current) == null ? void 0 : _a2.click();
7427
7427
  },
7428
7428
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Paperclip, { className: "h-4" })
7429
7429
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
7430
7430
  type: "file",
7431
- ref: D,
7431
+ ref: E,
7432
7432
  className: "hidden",
7433
7433
  multiple: true,
7434
7434
  accept: Array.isArray(e18.allowAttachments) ? e18.allowAttachments.join(",") : void 0,
7435
7435
  onChange: (e19) => {
7436
- e19.target.files && E([...e19.target.files]);
7436
+ e19.target.files && T([...e19.target.files]);
7437
7437
  }
7438
7438
  })] }),
7439
7439
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
7440
7440
  type: "submit",
7441
- disabled: G || !_,
7441
+ disabled: U || !_,
7442
7442
  variant: "outline",
7443
7443
  size: "xs",
7444
7444
  className: "text-(--slate-11)",
@@ -7600,25 +7600,25 @@ var configDescriptions = {
7600
7600
  className: "w-64 max-h-96 overflow-y-auto",
7601
7601
  children: D
7602
7602
  })] }) }), _[8] = D, _[9] = O);
7603
- let k;
7604
- _[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = () => x(false), _[10] = k) : k = _[10];
7605
7603
  let A;
7606
- _[11] !== y || _[12] !== S ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContent, {
7604
+ _[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (A = () => x(false), _[10] = A) : A = _[10];
7605
+ let j;
7606
+ _[11] !== y || _[12] !== S ? (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContent, {
7607
7607
  side: "right",
7608
7608
  align: "end",
7609
7609
  className: "min-w-80 px-2",
7610
7610
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PromptVariablesForm, {
7611
7611
  prompt: S,
7612
- onClose: k,
7612
+ onClose: A,
7613
7613
  onSelect: y
7614
7614
  })
7615
- }), _[11] = y, _[12] = S, _[13] = A) : A = _[13];
7615
+ }), _[11] = y, _[12] = S, _[13] = j) : j = _[13];
7616
7616
  let M;
7617
- return _[14] !== b || _[15] !== O || _[16] !== A ? (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, {
7617
+ return _[14] !== b || _[15] !== O || _[16] !== j ? (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, {
7618
7618
  open: b,
7619
7619
  onOpenChange: x,
7620
- children: [O, A]
7621
- }), _[14] = b, _[15] = O, _[16] = A, _[17] = M) : M = _[17], M;
7620
+ children: [O, j]
7621
+ }), _[14] = b, _[15] = O, _[16] = j, _[17] = M) : M = _[17], M;
7622
7622
  }, PromptVariablesForm = (e18) => {
7623
7623
  let _ = (0, import_compiler_runtime.c)(32), { prompt: v, onClose: y, onSelect: b } = e18, x;
7624
7624
  _[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = {}, _[0] = x) : x = _[0];