@blocknote/xl-ai 0.44.0 → 0.44.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,6 +1,6 @@
1
1
  import { Chat as te } from "@ai-sdk/react";
2
2
  import { createExtension as oe, createStore as V, getNodeById as ne, UnreachableCaseError as re, mergeCSSClasses as ie } from "@blocknote/core";
3
- import { ForkYDocExtension as M, ShowSelectionExtension as T, filterSuggestionItems as ae, FormattingToolbarExtension as se } from "@blocknote/core/extensions";
3
+ import { ForkYDocExtension as L, ShowSelectionExtension as T, filterSuggestionItems as ae, FormattingToolbarExtension as se } from "@blocknote/core/extensions";
4
4
  import { suggestChanges as le, revertSuggestions as H, applySuggestions as ce } from "@blocknote/prosemirror-suggest-changes";
5
5
  import { Slice as j, Fragment as R } from "prosemirror-model";
6
6
  import { Plugin as K, PluginKey as W } from "prosemirror-state";
@@ -8,13 +8,13 @@ import { fixTablesKey as ue } from "prosemirror-tables";
8
8
  import { DecorationSet as q, Decoration as Z } from "prosemirror-view";
9
9
  import { defaultSelectionBuilder as me } from "y-prosemirror";
10
10
  import { b as de, s as fe, c as w, a as y } from "./client-C4uaJa77.js";
11
- import { C as dt, P as ft, S as gt, g as pt, d as ht, f as Ct, h as bt, j as vt, m as St, o as yt, n as wt, k as kt, p as It, i as _t, e as xt, l as Lt, t as Mt } from "./client-C4uaJa77.js";
11
+ import { C as ft, P as gt, S as pt, g as ht, d as Ct, f as bt, h as vt, j as St, m as yt, o as wt, n as kt, k as It, p as _t, i as xt, e as Mt, l as Lt, t as Tt } from "./client-C4uaJa77.js";
12
12
  import { jsxs as ge, jsx as l } from "react/jsx-runtime";
13
13
  import { useBlockNoteContext as pe, useComponentsContext as P, useSuggestionMenuKeyboardHandler as he, useBlockNoteEditor as A, useExtension as _, useExtensionState as G, BlockPopover as Ce } from "@blocknote/react";
14
14
  import S, { useState as $, useCallback as I, useMemo as k, useEffect as Y } from "react";
15
- import { offset as be, size as ve } from "@floating-ui/react";
15
+ import { offset as be, size as ve, autoUpdate as Se } from "@floating-ui/react";
16
16
  const D = new W("blocknote-agent-cursor");
17
- function Se(e) {
17
+ function ye(e) {
18
18
  return new K({
19
19
  key: D,
20
20
  view: (t) => ({}),
@@ -37,14 +37,14 @@ function Se(e) {
37
37
  if (!o)
38
38
  return q.create(n, []);
39
39
  a.push(
40
- Z.widget(o.head, () => ye(e), {
40
+ Z.widget(o.head, () => we(e), {
41
41
  key: "agent-cursor",
42
42
  side: 10
43
43
  })
44
44
  );
45
- const c = Math.min(o.anchor, o.head), i = Math.max(o.anchor, o.head);
45
+ const u = Math.min(o.anchor, o.head), i = Math.max(o.anchor, o.head);
46
46
  return a.push(
47
- Z.inline(c, i, me(e), {
47
+ Z.inline(u, i, me(e), {
48
48
  inclusiveEnd: !0,
49
49
  inclusiveStart: !1
50
50
  })
@@ -53,14 +53,14 @@ function Se(e) {
53
53
  }
54
54
  });
55
55
  }
56
- const ye = (e) => {
56
+ const we = (e) => {
57
57
  const t = document.createElement("span");
58
58
  t.classList.add("bn-collaboration-cursor__base"), t.setAttribute("data-active", "true");
59
59
  const n = document.createElement("span");
60
60
  n.setAttribute("contentedEditable", "false"), n.classList.add("bn-collaboration-cursor__caret"), n.setAttribute("style", `background-color: ${e.color}`);
61
61
  const o = document.createElement("span");
62
62
  return o.classList.add("bn-collaboration-cursor__label"), o.setAttribute("style", `background-color: ${e.color}`), o.insertBefore(document.createTextNode(e.name), null), n.insertBefore(o, null), t.insertBefore(document.createTextNode("⁠"), null), t.insertBefore(n, null), t.insertBefore(document.createTextNode("⁠"), null), t;
63
- }, we = new W("blocknote-ai-plugin"), b = oe(
63
+ }, ke = new W("blocknote-ai-plugin"), b = oe(
64
64
  ({
65
65
  editor: e,
66
66
  options: t
@@ -68,7 +68,7 @@ const ye = (e) => {
68
68
  const n = V(t ?? {}), o = V({
69
69
  aiMenuState: "closed"
70
70
  });
71
- let a, c = !1;
71
+ let a, u = !1;
72
72
  return {
73
73
  key: "ai",
74
74
  options: n,
@@ -78,7 +78,7 @@ const ye = (e) => {
78
78
  document.addEventListener(
79
79
  "scroll",
80
80
  () => {
81
- r && (c = !1), r = !0;
81
+ r && (u = !1), r = !0;
82
82
  },
83
83
  {
84
84
  capture: !0,
@@ -97,7 +97,7 @@ const ye = (e) => {
97
97
  },
98
98
  prosemirrorPlugins: [
99
99
  new K({
100
- key: we,
100
+ key: ke,
101
101
  filterTransaction: (i) => {
102
102
  var s;
103
103
  const r = o.state.aiMenuState;
@@ -105,7 +105,7 @@ const ye = (e) => {
105
105
  }
106
106
  }),
107
107
  le(),
108
- Se(
108
+ ye(
109
109
  (t == null ? void 0 : t.agentCursor) || { name: "AI", color: "#8bc6ff" }
110
110
  )
111
111
  ],
@@ -113,14 +113,14 @@ const ye = (e) => {
113
113
  * Open the AI menu at a specific block
114
114
  */
115
115
  openAIMenuAtBlock(i) {
116
- var s, u;
116
+ var s, c;
117
117
  (s = e.getExtension(T)) == null || s.showSelection(!0), e.isEditable = !1, o.setState({
118
118
  aiMenuState: {
119
119
  blockId: i,
120
120
  status: "user-input"
121
121
  }
122
122
  });
123
- const r = (u = e.domElement) == null ? void 0 : u.querySelector(
123
+ const r = (c = e.domElement) == null ? void 0 : c.querySelector(
124
124
  `[data-node-type="blockContainer"][data-id="${i}"]`
125
125
  );
126
126
  r == null || r.scrollIntoView({ block: "center" });
@@ -140,9 +140,9 @@ const ye = (e) => {
140
140
  acceptChanges() {
141
141
  var r;
142
142
  const i = e.prosemirrorState.doc;
143
- e.exec((s, u) => H(s, (d) => {
144
- u == null || u(d.setMeta("addToHistory", !1));
145
- })), e.exec((s, u) => {
143
+ e.exec((s, c) => H(s, (d) => {
144
+ c == null || c(d.setMeta("addToHistory", !1));
145
+ })), e.exec((s, c) => {
146
146
  const d = s.tr;
147
147
  d.replace(
148
148
  0,
@@ -151,7 +151,7 @@ const ye = (e) => {
151
151
  );
152
152
  const g = s.apply(d);
153
153
  return ce(g, (p) => {
154
- u == null || u(
154
+ c == null || c(
155
155
  d.replace(
156
156
  0,
157
157
  d.doc.content.size,
@@ -159,16 +159,16 @@ const ye = (e) => {
159
159
  )
160
160
  );
161
161
  });
162
- }), (r = e.getExtension(M)) == null || r.merge({ keepChanges: !0 }), this.closeAIMenu();
162
+ }), (r = e.getExtension(L)) == null || r.merge({ keepChanges: !0 }), this.closeAIMenu();
163
163
  },
164
164
  /**
165
165
  * Reject the changes made by the LLM
166
166
  */
167
167
  rejectChanges() {
168
168
  var i;
169
- e.exec((r, s) => H(r, (u) => {
170
- s == null || s(u.setMeta("addToHistory", !1));
171
- })), (i = e.getExtension(M)) == null || i.merge({ keepChanges: !1 }), this.closeAIMenu();
169
+ e.exec((r, s) => H(r, (c) => {
170
+ s == null || s(c.setMeta("addToHistory", !1));
171
+ })), (i = e.getExtension(L)) == null || i.merge({ keepChanges: !1 }), this.closeAIMenu();
172
172
  },
173
173
  /**
174
174
  * Abort the current LLM request.
@@ -241,13 +241,13 @@ const ye = (e) => {
241
241
  * Execute a call to an LLM and apply the result to the editor
242
242
  */
243
243
  async invokeAI(i) {
244
- var r, s, u, d;
245
- this.setAIResponseStatus("thinking"), (r = e.getExtension(M)) == null || r.fork();
244
+ var r, s, c, d;
245
+ this.setAIResponseStatus("thinking"), (r = e.getExtension(L)) == null || r.fork();
246
246
  try {
247
247
  const g = new AbortController();
248
248
  a ? (a.previousRequestOptions = i, a.abortController = g) : a = {
249
249
  previousRequestOptions: i,
250
- chat: ((s = i.chatProvider) == null ? void 0 : s.call(i)) || ((d = (u = this.options.state).chatProvider) == null ? void 0 : d.call(u)) || new te({
250
+ chat: ((s = i.chatProvider) == null ? void 0 : s.call(i)) || ((d = (c = this.options.state).chatProvider) == null ? void 0 : d.call(c)) || new te({
251
251
  sendAutomaticallyWhen: () => !1,
252
252
  transport: i.transport || this.options.state.transport
253
253
  }),
@@ -277,14 +277,14 @@ const ye = (e) => {
277
277
  blockId: v,
278
278
  status: "ai-writing"
279
279
  }
280
- }), c && e.prosemirrorView.domAtPos(
280
+ }), u && e.prosemirrorView.domAtPos(
281
281
  z.posBeforeNode + 1
282
282
  ).node.scrollIntoView({
283
283
  block: "center"
284
284
  }));
285
285
  },
286
286
  onStart: () => {
287
- c = !0, this.setAIResponseStatus("ai-writing"), h.emptyCursorBlockToDelete && h.editor.getBlock(h.emptyCursorBlockToDelete) && h.editor.removeBlocks([
287
+ u = !0, this.setAIResponseStatus("ai-writing"), h.emptyCursorBlockToDelete && h.editor.getBlock(h.emptyCursorBlockToDelete) && h.editor.removeBlocks([
288
288
  h.emptyCursorBlockToDelete
289
289
  ]);
290
290
  }
@@ -331,18 +331,18 @@ var J = {
331
331
  className: void 0,
332
332
  style: void 0,
333
333
  attr: void 0
334
- }, N = S.createContext && /* @__PURE__ */ S.createContext(J), ke = ["attr", "size", "title"];
335
- function Ie(e, t) {
334
+ }, N = S.createContext && /* @__PURE__ */ S.createContext(J), Ie = ["attr", "size", "title"];
335
+ function _e(e, t) {
336
336
  if (e == null) return {};
337
- var n = _e(e, t), o, a;
337
+ var n = xe(e, t), o, a;
338
338
  if (Object.getOwnPropertySymbols) {
339
- var c = Object.getOwnPropertySymbols(e);
340
- for (a = 0; a < c.length; a++)
341
- o = c[a], !(t.indexOf(o) >= 0) && Object.prototype.propertyIsEnumerable.call(e, o) && (n[o] = e[o]);
339
+ var u = Object.getOwnPropertySymbols(e);
340
+ for (a = 0; a < u.length; a++)
341
+ o = u[a], !(t.indexOf(o) >= 0) && Object.prototype.propertyIsEnumerable.call(e, o) && (n[o] = e[o]);
342
342
  }
343
343
  return n;
344
344
  }
345
- function _e(e, t) {
345
+ function xe(e, t) {
346
346
  if (e == null) return {};
347
347
  var n = {};
348
348
  for (var o in e)
@@ -372,25 +372,25 @@ function F(e, t) {
372
372
  }
373
373
  return n;
374
374
  }
375
- function L(e) {
375
+ function M(e) {
376
376
  for (var t = 1; t < arguments.length; t++) {
377
377
  var n = arguments[t] != null ? arguments[t] : {};
378
378
  t % 2 ? F(Object(n), !0).forEach(function(o) {
379
- xe(e, o, n[o]);
379
+ Me(e, o, n[o]);
380
380
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : F(Object(n)).forEach(function(o) {
381
381
  Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(n, o));
382
382
  });
383
383
  }
384
384
  return e;
385
385
  }
386
- function xe(e, t, n) {
386
+ function Me(e, t, n) {
387
387
  return t = Le(t), t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
388
388
  }
389
389
  function Le(e) {
390
- var t = Me(e, "string");
390
+ var t = Te(e, "string");
391
391
  return typeof t == "symbol" ? t : t + "";
392
392
  }
393
- function Me(e, t) {
393
+ function Te(e, t) {
394
394
  if (typeof e != "object" || !e) return e;
395
395
  var n = e[Symbol.toPrimitive];
396
396
  if (n !== void 0) {
@@ -401,35 +401,35 @@ function Me(e, t) {
401
401
  return (t === "string" ? String : Number)(e);
402
402
  }
403
403
  function Q(e) {
404
- return e && e.map((t, n) => /* @__PURE__ */ S.createElement(t.tag, L({
404
+ return e && e.map((t, n) => /* @__PURE__ */ S.createElement(t.tag, M({
405
405
  key: n
406
406
  }, t.attr), Q(t.child)));
407
407
  }
408
408
  function C(e) {
409
- return (t) => /* @__PURE__ */ S.createElement(Te, x({
410
- attr: L({}, e.attr)
409
+ return (t) => /* @__PURE__ */ S.createElement(Pe, x({
410
+ attr: M({}, e.attr)
411
411
  }, t), Q(e.child));
412
412
  }
413
- function Te(e) {
413
+ function Pe(e) {
414
414
  var t = (n) => {
415
415
  var {
416
416
  attr: o,
417
417
  size: a,
418
- title: c
419
- } = e, i = Ie(e, ke), r = a || n.size || "1em", s;
418
+ title: u
419
+ } = e, i = _e(e, Ie), r = a || n.size || "1em", s;
420
420
  return n.className && (s = n.className), e.className && (s = (s ? s + " " : "") + e.className), /* @__PURE__ */ S.createElement("svg", x({
421
421
  stroke: "currentColor",
422
422
  fill: "currentColor",
423
423
  strokeWidth: "0"
424
424
  }, n.attr, o, i, {
425
425
  className: s,
426
- style: L(L({
426
+ style: M(M({
427
427
  color: e.color || n.color
428
428
  }, n.style), e.style),
429
429
  height: r,
430
430
  width: r,
431
431
  xmlns: "http://www.w3.org/2000/svg"
432
- }), c && /* @__PURE__ */ S.createElement("title", null, c), e.children);
432
+ }), u && /* @__PURE__ */ S.createElement("title", null, u), e.children);
433
433
  };
434
434
  return N !== void 0 ? /* @__PURE__ */ S.createElement(N.Consumer, null, (n) => t(n)) : t(J);
435
435
  }
@@ -439,28 +439,28 @@ function X(e) {
439
439
  function U(e) {
440
440
  return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M17.8492 11.6983L17.1421 10.9912L7.24264 20.8907H3V16.648L14.3137 5.33432L19.9706 10.9912C20.3611 11.3817 20.3611 12.0149 19.9706 12.4054L12.8995 19.4765L11.4853 18.0622L17.8492 11.6983ZM15.7279 9.57696L14.3137 8.16274L5 17.4765V18.8907H6.41421L15.7279 9.57696ZM18.5563 2.50589L21.3848 5.33432C21.7753 5.72484 21.7753 6.35801 21.3848 6.74853L19.9706 8.16274L15.7279 3.9201L17.1421 2.50589C17.5327 2.11537 18.1658 2.11537 18.5563 2.50589Z" }, child: [] }] })(e);
441
441
  }
442
- function Pe(e) {
443
- return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M15.1986 9.94447C14.7649 9.5337 14.4859 8.98613 14.4085 8.39384L14.0056 5.31138L11.275 6.79724C10.7503 7.08274 10.1433 7.17888 9.55608 7.06948L6.49998 6.50015L7.06931 9.55625C7.17871 10.1435 7.08257 10.7505 6.79707 11.2751L5.31121 14.0057L8.39367 14.4086C8.98596 14.4861 9.53353 14.7651 9.94431 15.1987L12.0821 17.4557L13.4178 14.6486C13.6745 14.1092 14.109 13.6747 14.6484 13.418L17.4555 12.0823L15.1986 9.94447ZM15.2238 15.5079L13.0111 20.1581C12.8687 20.4573 12.5107 20.5844 12.2115 20.442C12.1448 20.4103 12.0845 20.3665 12.0337 20.3129L8.49229 16.5741C8.39749 16.474 8.27113 16.4096 8.13445 16.3918L3.02816 15.7243C2.69958 15.6814 2.46804 15.3802 2.51099 15.0516C2.52056 14.9784 2.54359 14.9075 2.5789 14.8426L5.04031 10.3192C5.1062 10.1981 5.12839 10.058 5.10314 9.92253L4.16 4.85991C4.09931 4.53414 4.3142 4.22086 4.63997 4.16017C4.7126 4.14664 4.78711 4.14664 4.85974 4.16017L9.92237 5.10331C10.0579 5.12855 10.198 5.10637 10.319 5.04048L14.8424 2.57907C15.1335 2.42068 15.4979 2.52825 15.6562 2.81931C15.6916 2.88421 15.7146 2.95507 15.7241 3.02833L16.3916 8.13462C16.4095 8.2713 16.4739 8.39766 16.5739 8.49245L20.3127 12.0338C20.5533 12.2617 20.5636 12.6415 20.3357 12.8821C20.2849 12.9357 20.2246 12.9795 20.1579 13.0112L15.5078 15.224C15.3833 15.2832 15.283 15.3835 15.2238 15.5079ZM16.0206 17.435L17.4348 16.0208L21.6775 20.2634L20.2633 21.6776L16.0206 17.435Z" }, child: [] }] })(e);
444
- }
445
442
  function Ae(e) {
446
- return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z" }, child: [] }] })(e);
443
+ return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M15.1986 9.94447C14.7649 9.5337 14.4859 8.98613 14.4085 8.39384L14.0056 5.31138L11.275 6.79724C10.7503 7.08274 10.1433 7.17888 9.55608 7.06948L6.49998 6.50015L7.06931 9.55625C7.17871 10.1435 7.08257 10.7505 6.79707 11.2751L5.31121 14.0057L8.39367 14.4086C8.98596 14.4861 9.53353 14.7651 9.94431 15.1987L12.0821 17.4557L13.4178 14.6486C13.6745 14.1092 14.109 13.6747 14.6484 13.418L17.4555 12.0823L15.1986 9.94447ZM15.2238 15.5079L13.0111 20.1581C12.8687 20.4573 12.5107 20.5844 12.2115 20.442C12.1448 20.4103 12.0845 20.3665 12.0337 20.3129L8.49229 16.5741C8.39749 16.474 8.27113 16.4096 8.13445 16.3918L3.02816 15.7243C2.69958 15.6814 2.46804 15.3802 2.51099 15.0516C2.52056 14.9784 2.54359 14.9075 2.5789 14.8426L5.04031 10.3192C5.1062 10.1981 5.12839 10.058 5.10314 9.92253L4.16 4.85991C4.09931 4.53414 4.3142 4.22086 4.63997 4.16017C4.7126 4.14664 4.78711 4.14664 4.85974 4.16017L9.92237 5.10331C10.0579 5.12855 10.198 5.10637 10.319 5.04048L14.8424 2.57907C15.1335 2.42068 15.4979 2.52825 15.6562 2.81931C15.6916 2.88421 15.7146 2.95507 15.7241 3.02833L16.3916 8.13462C16.4095 8.2713 16.4739 8.39766 16.5739 8.49245L20.3127 12.0338C20.5533 12.2617 20.5636 12.6415 20.3357 12.8821C20.2849 12.9357 20.2246 12.9795 20.1579 13.0112L15.5078 15.224C15.3833 15.2832 15.283 15.3835 15.2238 15.5079ZM16.0206 17.435L17.4348 16.0208L21.6775 20.2634L20.2633 21.6776L16.0206 17.435Z" }, child: [] }] })(e);
447
444
  }
448
445
  function Ee(e) {
449
- return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M15 18H16.5C17.8807 18 19 16.8807 19 15.5C19 14.1193 17.8807 13 16.5 13H3V11H16.5C18.9853 11 21 13.0147 21 15.5C21 17.9853 18.9853 20 16.5 20H15V22L11 19L15 16V18ZM3 4H21V6H3V4ZM9 18V20H3V18H9Z" }, child: [] }] })(e);
446
+ return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z" }, child: [] }] })(e);
450
447
  }
451
448
  function Be(e) {
452
- return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M13 6V21H11V6H5V4H19V6H13Z" }, child: [] }] })(e);
449
+ return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M15 18H16.5C17.8807 18 19 16.8807 19 15.5C19 14.1193 17.8807 13 16.5 13H3V11H16.5C18.9853 11 21 13.0147 21 15.5C21 17.9853 18.9853 20 16.5 20H15V22L11 19L15 16V18ZM3 4H21V6H3V4ZM9 18V20H3V18H9Z" }, child: [] }] })(e);
453
450
  }
454
451
  function Oe(e) {
455
- return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M6.23509 6.45329C4.85101 7.89148 4 9.84636 4 12C4 16.4183 7.58172 20 12 20C13.0808 20 14.1116 19.7857 15.0521 19.3972C15.1671 18.6467 14.9148 17.9266 14.8116 17.6746C14.582 17.115 13.8241 16.1582 12.5589 14.8308C12.2212 14.4758 12.2429 14.2035 12.3636 13.3943L12.3775 13.3029C12.4595 12.7486 12.5971 12.4209 14.4622 12.1248C15.4097 11.9746 15.6589 12.3533 16.0043 12.8777C16.0425 12.9358 16.0807 12.9928 16.1198 13.0499C16.4479 13.5297 16.691 13.6394 17.0582 13.8064C17.2227 13.881 17.428 13.9751 17.7031 14.1314C18.3551 14.504 18.3551 14.9247 18.3551 15.8472V15.9518C18.3551 16.3434 18.3168 16.6872 18.2566 16.9859C19.3478 15.6185 20 13.8854 20 12C20 8.70089 18.003 5.8682 15.1519 4.64482C14.5987 5.01813 13.8398 5.54726 13.575 5.91C13.4396 6.09538 13.2482 7.04166 12.6257 7.11976C12.4626 7.14023 12.2438 7.12589 12.012 7.11097C11.3905 7.07058 10.5402 7.01606 10.268 7.75495C10.0952 8.2232 10.0648 9.49445 10.6239 10.1543C10.7134 10.2597 10.7307 10.4547 10.6699 10.6735C10.59 10.9608 10.4286 11.1356 10.3783 11.1717C10.2819 11.1163 10.0896 10.8931 9.95938 10.7412C9.64554 10.3765 9.25405 9.92233 8.74797 9.78176C8.56395 9.73083 8.36166 9.68867 8.16548 9.64736C7.6164 9.53227 6.99443 9.40134 6.84992 9.09302C6.74442 8.8672 6.74488 8.55621 6.74529 8.22764C6.74529 7.8112 6.74529 7.34029 6.54129 6.88256C6.46246 6.70541 6.35689 6.56446 6.23509 6.45329ZM12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22Z" }, child: [] }] })(e);
452
+ return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M13 6V21H11V6H5V4H19V6H13Z" }, child: [] }] })(e);
456
453
  }
457
454
  function ze(e) {
458
- return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z" }, child: [] }] })(e);
455
+ return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M6.23509 6.45329C4.85101 7.89148 4 9.84636 4 12C4 16.4183 7.58172 20 12 20C13.0808 20 14.1116 19.7857 15.0521 19.3972C15.1671 18.6467 14.9148 17.9266 14.8116 17.6746C14.582 17.115 13.8241 16.1582 12.5589 14.8308C12.2212 14.4758 12.2429 14.2035 12.3636 13.3943L12.3775 13.3029C12.4595 12.7486 12.5971 12.4209 14.4622 12.1248C15.4097 11.9746 15.6589 12.3533 16.0043 12.8777C16.0425 12.9358 16.0807 12.9928 16.1198 13.0499C16.4479 13.5297 16.691 13.6394 17.0582 13.8064C17.2227 13.881 17.428 13.9751 17.7031 14.1314C18.3551 14.504 18.3551 14.9247 18.3551 15.8472V15.9518C18.3551 16.3434 18.3168 16.6872 18.2566 16.9859C19.3478 15.6185 20 13.8854 20 12C20 8.70089 18.003 5.8682 15.1519 4.64482C14.5987 5.01813 13.8398 5.54726 13.575 5.91C13.4396 6.09538 13.2482 7.04166 12.6257 7.11976C12.4626 7.14023 12.2438 7.12589 12.012 7.11097C11.3905 7.07058 10.5402 7.01606 10.268 7.75495C10.0952 8.2232 10.0648 9.49445 10.6239 10.1543C10.7134 10.2597 10.7307 10.4547 10.6699 10.6735C10.59 10.9608 10.4286 11.1356 10.3783 11.1717C10.2819 11.1163 10.0896 10.8931 9.95938 10.7412C9.64554 10.3765 9.25405 9.92233 8.74797 9.78176C8.56395 9.73083 8.36166 9.68867 8.16548 9.64736C7.6164 9.53227 6.99443 9.40134 6.84992 9.09302C6.74442 8.8672 6.74488 8.55621 6.74529 8.22764C6.74529 7.8112 6.74529 7.34029 6.54129 6.88256C6.46246 6.70541 6.35689 6.56446 6.23509 6.45329ZM12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22Z" }, child: [] }] })(e);
459
456
  }
460
457
  function Ve(e) {
461
458
  return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z" }, child: [] }] })(e);
462
459
  }
463
460
  function He(e) {
461
+ return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z" }, child: [] }] })(e);
462
+ }
463
+ function je(e) {
464
464
  return C({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M12 4C9.4095 4 7.10606 5.23053 5.64274 7.14274L8 9.5H2V3.5L4.21863 5.71863C6.05061 3.452 8.85558 2 12 2 17.5228 2 22 6.47715 22 12H20C20 7.58172 16.4183 4 12 4ZM4 12C4 16.4183 7.58172 20 12 20 14.5905 20 16.894 18.7695 18.3573 16.8573L16 14.5 22 14.5V20.5L19.7814 18.2814C17.9494 20.548 15.1444 22 12 22 6.47715 22 2 17.5228 2 12H4Z" }, child: [] }] })(e);
465
465
  }
466
466
  function E(e) {
@@ -470,13 +470,13 @@ function ee() {
470
470
  const e = pe();
471
471
  return w(e.editor);
472
472
  }
473
- const je = (e) => {
474
- const t = P(), { onManualPromptSubmit: n, promptText: o, onPromptTextChange: a } = e, [c, i] = $(""), r = o || c, s = I(
473
+ const Re = (e) => {
474
+ const t = P(), { onManualPromptSubmit: n, promptText: o, onPromptTextChange: a } = e, [u, i] = $(""), r = o || u, s = I(
475
475
  async (m) => {
476
476
  m.key === "Enter" && n(r);
477
477
  },
478
478
  [r, n]
479
- ), u = I(
479
+ ), c = I(
480
480
  (m) => {
481
481
  const v = m.currentTarget.value;
482
482
  a && a(v), o === void 0 && i(v);
@@ -503,7 +503,7 @@ const je = (e) => {
503
503
  placeholder: e.placeholder,
504
504
  disabled: e.disabled,
505
505
  onKeyDown: h,
506
- onChange: u,
506
+ onChange: c,
507
507
  autoComplete: "off",
508
508
  rightSection: e.rightSection
509
509
  },
@@ -532,7 +532,7 @@ const je = (e) => {
532
532
  )
533
533
  ] });
534
534
  };
535
- function Re(e) {
535
+ function qe(e) {
536
536
  const t = w(e), n = e.getExtension(b);
537
537
  return n ? [
538
538
  {
@@ -559,7 +559,7 @@ function Re(e) {
559
559
  key: "summarize",
560
560
  title: t.ai_default_commands.summarize.title,
561
561
  aliases: t.ai_default_commands.summarize.aliases,
562
- icon: /* @__PURE__ */ l(Ee, { size: 18 }),
562
+ icon: /* @__PURE__ */ l(Be, { size: 18 }),
563
563
  onItemClick: async () => {
564
564
  await n.invokeAI({
565
565
  userPrompt: "Summarize",
@@ -579,7 +579,7 @@ function Re(e) {
579
579
  key: "action_items",
580
580
  title: t.ai_default_commands.add_action_items.title,
581
581
  aliases: t.ai_default_commands.add_action_items.aliases,
582
- icon: /* @__PURE__ */ l(Ae, { size: 18 }),
582
+ icon: /* @__PURE__ */ l(Ee, { size: 18 }),
583
583
  onItemClick: async () => {
584
584
  await n.invokeAI({
585
585
  userPrompt: "Add action items",
@@ -607,14 +607,14 @@ function Re(e) {
607
607
  }
608
608
  ] : [];
609
609
  }
610
- function qe(e) {
610
+ function Ze(e) {
611
611
  const t = w(e), n = e.getExtension(b);
612
612
  return n ? [
613
613
  {
614
614
  key: "improve_writing",
615
615
  title: t.ai_default_commands.improve_writing.title,
616
616
  aliases: t.ai_default_commands.improve_writing.aliases,
617
- icon: /* @__PURE__ */ l(Be, { size: 18 }),
617
+ icon: /* @__PURE__ */ l(Oe, { size: 18 }),
618
618
  onItemClick: async () => {
619
619
  await n.invokeAI({
620
620
  useSelection: !0,
@@ -635,7 +635,7 @@ function qe(e) {
635
635
  key: "fix_spelling",
636
636
  title: t.ai_default_commands.fix_spelling.title,
637
637
  aliases: t.ai_default_commands.fix_spelling.aliases,
638
- icon: /* @__PURE__ */ l(Ve, { size: 18 }),
638
+ icon: /* @__PURE__ */ l(He, { size: 18 }),
639
639
  onItemClick: async () => {
640
640
  await n.invokeAI({
641
641
  useSelection: !0,
@@ -656,7 +656,7 @@ function qe(e) {
656
656
  key: "translate",
657
657
  title: t.ai_default_commands.translate.title,
658
658
  aliases: t.ai_default_commands.translate.aliases,
659
- icon: /* @__PURE__ */ l(Oe, { size: 18 }),
659
+ icon: /* @__PURE__ */ l(ze, { size: 18 }),
660
660
  onItemClick: (o) => {
661
661
  o(t.ai_default_commands.translate.prompt_placeholder);
662
662
  },
@@ -666,7 +666,7 @@ function qe(e) {
666
666
  key: "simplify",
667
667
  title: t.ai_default_commands.simplify.title,
668
668
  aliases: t.ai_default_commands.simplify.aliases,
669
- icon: /* @__PURE__ */ l(Pe, { size: 18 }),
669
+ icon: /* @__PURE__ */ l(Ae, { size: 18 }),
670
670
  onItemClick: async () => {
671
671
  await n.invokeAI({
672
672
  useSelection: !0,
@@ -685,14 +685,14 @@ function qe(e) {
685
685
  }
686
686
  ] : [];
687
687
  }
688
- function Ze(e) {
688
+ function De(e) {
689
689
  const t = w(e), n = e.getExtension(b);
690
690
  return n ? [
691
691
  {
692
692
  key: "accept",
693
693
  title: t.ai_menu.actions.accept.title,
694
694
  aliases: t.ai_menu.actions.accept.aliases,
695
- icon: /* @__PURE__ */ l(ze, { size: 18 }),
695
+ icon: /* @__PURE__ */ l(Ve, { size: 18 }),
696
696
  onItemClick: () => {
697
697
  n.acceptChanges();
698
698
  },
@@ -710,14 +710,14 @@ function Ze(e) {
710
710
  }
711
711
  ] : [];
712
712
  }
713
- function De(e) {
713
+ function Ne(e) {
714
714
  const t = w(e), n = e.getExtension(b);
715
715
  return n ? [
716
716
  {
717
717
  key: "retry",
718
718
  title: t.ai_menu.actions.retry.title,
719
719
  aliases: t.ai_menu.actions.retry.aliases,
720
- icon: /* @__PURE__ */ l(He, { size: 18 }),
720
+ icon: /* @__PURE__ */ l(je, { size: 18 }),
721
721
  onItemClick: async () => {
722
722
  await n.retry();
723
723
  },
@@ -735,15 +735,15 @@ function De(e) {
735
735
  }
736
736
  ] : [];
737
737
  }
738
- function Ne(e, t) {
739
- return t === "user-input" ? e.getSelection() ? qe(e) : Re(e) : t === "user-reviewing" ? Ze(e) : t === "error" ? De(e) : [];
738
+ function Fe(e, t) {
739
+ return t === "user-input" ? e.getSelection() ? Ze(e) : qe(e) : t === "user-reviewing" ? De(e) : t === "error" ? Ne(e) : [];
740
740
  }
741
- const Fe = (e) => {
742
- const t = A(), [n, o] = $(""), a = ee(), c = P(), i = _(b), r = G(b, {
741
+ const Ue = (e) => {
742
+ const t = A(), [n, o] = $(""), a = ee(), u = P(), i = _(b), r = G(b, {
743
743
  selector: (f) => f.aiMenuState !== "closed" ? f.aiMenuState.status : "closed"
744
- }), { items: s } = e, u = k(() => {
744
+ }), { items: s } = e, c = k(() => {
745
745
  let f = [];
746
- return s ? f = s(t, r) : f = Ne(t, r), f.map((h) => ({
746
+ return s ? f = s(t, r) : f = Fe(t, r), f.map((h) => ({
747
747
  ...h,
748
748
  onItemClick: () => {
749
749
  h.onItemClick(o);
@@ -764,7 +764,7 @@ const Fe = (e) => {
764
764
  const g = k(() => r === "thinking" ? a.ai_menu.status.thinking : r === "ai-writing" ? a.ai_menu.status.editing : r === "error" ? a.ai_menu.status.error : a.ai_menu.input_placeholder, [r, a]), p = k(() => {
765
765
  if (r === "thinking" || r === "ai-writing")
766
766
  return /* @__PURE__ */ l(
767
- c.SuggestionMenu.Loader,
767
+ u.SuggestionMenu.Loader,
768
768
  {
769
769
  className: "bn-suggestion-menu-loader bn-combobox-right-section"
770
770
  }
@@ -781,12 +781,12 @@ const Fe = (e) => {
781
781
  children: /* @__PURE__ */ l("path", { d: "M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm0-160q17 0 28.5-11.5T520-480v-160q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v160q0 17 11.5 28.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z" })
782
782
  }
783
783
  ) });
784
- }, [c, r]);
784
+ }, [u, r]);
785
785
  return /* @__PURE__ */ l(
786
- je,
786
+ Re,
787
787
  {
788
788
  onManualPromptSubmit: e.onManualPromptSubmit || d,
789
- items: u,
789
+ items: c,
790
790
  promptText: n,
791
791
  onPromptTextChange: o,
792
792
  placeholder: g,
@@ -795,11 +795,11 @@ const Fe = (e) => {
795
795
  rightSection: p
796
796
  }
797
797
  );
798
- }, st = (e) => {
798
+ }, lt = (e) => {
799
799
  const t = A(), n = _(b), o = G(b, {
800
800
  editor: t,
801
801
  selector: (r) => r.aiMenuState
802
- }), a = o === "closed" ? void 0 : o.blockId, c = k(
802
+ }), a = o === "closed" ? void 0 : o.blockId, u = k(
803
803
  () => ({
804
804
  useFloatingOptions: {
805
805
  open: o !== "closed",
@@ -817,6 +817,11 @@ const Fe = (e) => {
817
817
  ],
818
818
  onOpenChange: (r) => {
819
819
  r || o === "closed" || (o.status === "user-input" ? n.closeAIMenu() : (o.status === "user-reviewing" || o.status === "error") && n.rejectChanges());
820
+ },
821
+ whileElementsMounted(r, s, c) {
822
+ return Se(r, s, c, {
823
+ animationFrame: !0
824
+ });
820
825
  }
821
826
  },
822
827
  useDismissProps: {
@@ -840,10 +845,10 @@ const Fe = (e) => {
840
845
  ...e.floatingUIOptions
841
846
  }),
842
847
  [n, o, a, e.floatingUIOptions]
843
- ), i = e.aiMenu || Fe;
844
- return /* @__PURE__ */ l(Ce, { blockId: a, ...c, children: o !== "closed" && /* @__PURE__ */ l(i, {}) });
845
- }, lt = () => {
846
- const e = ee(), t = P(), n = A(), o = _(b), a = _(se), c = () => {
848
+ ), i = e.aiMenu || Ue;
849
+ return /* @__PURE__ */ l(Ce, { blockId: a, ...u, children: o !== "closed" && /* @__PURE__ */ l(i, {}) });
850
+ }, ct = () => {
851
+ const e = ee(), t = P(), n = A(), o = _(b), a = _(se), u = () => {
847
852
  const i = n.getSelection();
848
853
  if (!i)
849
854
  throw new Error("No selection");
@@ -857,13 +862,13 @@ const Fe = (e) => {
857
862
  label: e.formatting_toolbar.ai.tooltip,
858
863
  mainTooltip: e.formatting_toolbar.ai.tooltip,
859
864
  icon: /* @__PURE__ */ l(E, {}),
860
- onClick: c
865
+ onClick: u
861
866
  }
862
867
  ) : null;
863
- }, Ue = {
868
+ }, Ke = {
864
869
  AI: E
865
870
  };
866
- function ct(e) {
871
+ function ut(e) {
867
872
  const t = e.getExtension(b);
868
873
  return t ? [
869
874
  {
@@ -874,39 +879,39 @@ function ct(e) {
874
879
  o.block.content.length === 0 && o.prevBlock ? t.openAIMenuAtBlock(o.prevBlock.id) : t.openAIMenuAtBlock(o.block.id);
875
880
  },
876
881
  ...w(e).slash_menu.ai,
877
- icon: /* @__PURE__ */ l(Ue.AI, {})
882
+ icon: /* @__PURE__ */ l(Ke.AI, {})
878
883
  }
879
884
  ] : [];
880
885
  }
881
886
  export {
882
887
  b as AIExtension,
883
- Fe as AIMenu,
884
- st as AIMenuController,
885
- lt as AIToolbarButton,
886
- dt as ClientSideTransport,
887
- ft as PROVIDER_OVERRIDES,
888
- je as PromptSuggestionMenu,
889
- gt as StreamToolExecutor,
890
- pt as _getApplySuggestionsTr,
888
+ Ue as AIMenu,
889
+ lt as AIMenuController,
890
+ ct as AIToolbarButton,
891
+ ft as ClientSideTransport,
892
+ gt as PROVIDER_OVERRIDES,
893
+ Re as PromptSuggestionMenu,
894
+ pt as StreamToolExecutor,
895
+ ht as _getApplySuggestionsTr,
891
896
  y as aiDocumentFormats,
892
897
  de as buildAIRequest,
893
- ht as createStreamToolsArraySchema,
894
- Ct as fetchViaProxy,
898
+ Ct as createStreamToolsArraySchema,
899
+ bt as fetchViaProxy,
895
900
  w as getAIDictionary,
896
- ct as getAISlashMenuItems,
897
- Ne as getDefaultAIMenuItems,
898
- bt as getProviderOverrides,
899
- vt as injectDocumentStateMessages,
900
- St as makeDocumentStateBuilder,
901
- yt as objectAsToolCallInUIMessageStream,
902
- wt as objectStreamToOperationsResult,
903
- kt as partialObjectStreamAsToolCallInUIMessageStream,
904
- It as promptHelpers,
901
+ ut as getAISlashMenuItems,
902
+ Fe as getDefaultAIMenuItems,
903
+ vt as getProviderOverrides,
904
+ St as injectDocumentStateMessages,
905
+ yt as makeDocumentStateBuilder,
906
+ wt as objectAsToolCallInUIMessageStream,
907
+ kt as objectStreamToOperationsResult,
908
+ It as partialObjectStreamAsToolCallInUIMessageStream,
909
+ _t as promptHelpers,
905
910
  fe as sendMessageWithAIRequest,
906
- _t as setupToolCallStreaming,
907
- xt as streamToolsToToolSet,
911
+ xt as setupToolCallStreaming,
912
+ Mt as streamToolsToToolSet,
908
913
  Lt as toolDefinitionsToToolSet,
909
- Mt as toolSetToToolDefinitions,
914
+ Tt as toolSetToToolDefinitions,
910
915
  ee as useAIDictionary
911
916
  };
912
917
  //# sourceMappingURL=blocknote-xl-ai.js.map