@blocknote/xl-ai 0.51.4 → 0.52.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.
- package/dist/blocknote-xl-ai.cjs +1 -1
- package/dist/blocknote-xl-ai.cjs.map +1 -1
- package/dist/blocknote-xl-ai.js +503 -107
- package/dist/blocknote-xl-ai.js.map +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js.map +1 -1
- package/dist/{server-JIYg7ELG.js → server-CafGbRLa.js} +35 -31
- package/dist/server-CafGbRLa.js.map +1 -0
- package/dist/server-CxZHspeS.cjs +36 -0
- package/dist/server-CxZHspeS.cjs.map +1 -0
- package/dist/server.cjs +1 -1
- package/dist/server.js +1 -2
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +12 -25
- package/src/AIExtension.ts +12 -7
- package/src/api/formats/base-tools/createAddBlocksTool.ts +4 -4
- package/src/api/formats/base-tools/createUpdateBlockTool.ts +4 -4
- package/src/api/formats/html-blocks/columnContainerDocumentState.test.ts +1 -1
- package/src/api/formats/html-blocks/htmlBlocks.test.ts +6 -8
- package/src/api/formats/html-blocks/tools/getPartialHTML.test.ts +1 -1
- package/src/api/formats/html-blocks/tools/index.ts +15 -21
- package/src/api/formats/html-blocks/tools/rebaseTool.ts +3 -3
- package/src/api/formats/json/errorHandling.test.ts +8 -1
- package/src/api/formats/json/json.test.ts +1 -1
- package/src/api/formats/json/tools/index.ts +4 -4
- package/src/api/formats/json/tools/jsontools.test.ts +1 -1
- package/src/api/formats/markdown-blocks/markdownBlocks.test.ts +1 -1
- package/src/api/formats/markdown-blocks/tools/index.ts +9 -11
- package/src/api/formats/markdown-blocks/tools/rebaseTool.ts +3 -3
- package/src/api/formats/tests/sharedTestCases.ts +2 -3
- package/src/api/formats/tests/snapshotPath.ts +2 -2
- package/src/api/formats/tests/validateTestEnvironment.test.ts +1 -1
- package/src/api/promptHelpers/suffixIds.ts +1 -1
- package/src/api/schema/__snapshots__/schemaToJSONSchema.test.ts.snap +1 -1
- package/src/api/schema/schemaToJSONSchema.test.ts +3 -3
- package/src/api/schema/schemaToJSONSchema.ts +5 -3
- package/src/components/AIMenu/PromptSuggestionMenu.tsx +1 -1
- package/src/plugins/AgentCursorPlugin.ts +8 -1
- package/src/prosemirror/AttributionMarks.ts +204 -0
- package/src/prosemirror/__snapshots__/agent.test.ts.snap +16 -265
- package/src/prosemirror/__snapshots__/rebaseTool.test.ts.snap +4 -4
- package/src/prosemirror/agent.test.ts +8 -10
- package/src/prosemirror/agent.ts +1 -1
- package/src/prosemirror/changeset.test.ts +1 -1
- package/src/prosemirror/fragmentUtil.test.ts +1 -1
- package/src/prosemirror/rebaseTool.test.ts +8 -3
- package/src/server.ts +0 -1
- package/src/streamTool/filterNewOrUpdatedOperations.test.ts +1 -1
- package/src/streamTool/filterValidOperations.test.ts +1 -1
- package/src/streamTool/preprocess.test.ts +1 -1
- package/src/streamTool/toValidatedOperations.test.ts +1 -1
- package/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.ts +8 -5
- package/src/streamTool/vercelAiSdk/util/appendableStream.test.ts +15 -15
- package/src/streamTool/vercelAiSdk/util/chatHandlers.test.ts +10 -1
- package/src/streamTool/vercelAiSdk/util/chatHandlers.ts +7 -7
- package/src/style.css +0 -19
- package/src/testUtil/suggestChangesTestUtil.ts +1 -1
- package/src/util/stream.ts +1 -1
- package/src/vite-env.d.ts +1 -0
- package/types/src/AIExtension.d.ts +4 -0
- package/types/src/api/formats/base-tools/createAddBlocksTool.d.ts +2 -2
- package/types/src/api/formats/base-tools/createUpdateBlockTool.d.ts +2 -2
- package/types/src/api/formats/formats.d.ts +3 -3
- package/types/src/api/formats/html-blocks/tools/rebaseTool.d.ts +2 -2
- package/types/src/api/formats/json/json.d.ts +3 -3
- package/types/src/api/formats/markdown-blocks/tools/rebaseTool.d.ts +2 -2
- package/types/src/api/schema/schemaToJSONSchema.d.ts +3 -3
- package/types/src/prosemirror/AttributionMarks.d.ts +15 -0
- package/types/src/testUtil/cases/editors/blockFormatting.d.ts +17 -17
- package/types/src/testUtil/cases/editors/formattingAndMentions.d.ts +17 -17
- package/types/src/testUtil/cases/editors/simpleEditor.d.ts +51 -51
- package/types/src/testUtil/cases/editors/tables.d.ts +17 -17
- package/types/src/testUtil/cases/schemas/mention.d.ts +17 -17
- package/dist/server-D-Xyj9BS.cjs +0 -36
- package/dist/server-D-Xyj9BS.cjs.map +0 -1
- package/dist/server-JIYg7ELG.js.map +0 -1
package/dist/blocknote-xl-ai.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "./server-
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "./server-CafGbRLa.js";
|
|
2
2
|
import { Chat as ee } from "@ai-sdk/react";
|
|
3
|
-
import { UnreachableCaseError as te, createExtension as
|
|
4
|
-
import {
|
|
5
|
-
import { applySuggestions as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { Plugin as
|
|
8
|
-
import { fixTablesKey as
|
|
9
|
-
import { Decoration as
|
|
10
|
-
import {
|
|
11
|
-
import { BlockPopover as
|
|
12
|
-
import { useCallback as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { autoUpdate as _e, flip as ve, offset as ye, size as be } from "@floating-ui/react";
|
|
3
|
+
import { BLOCK_LEVEL_SUGGESTION_GROUP as y, NON_FORMATTING_MARK_GROUP as b, UnreachableCaseError as te, createExtension as x, createStore as S, getNodeById as ne, mergeCSSClasses as re } from "@blocknote/core";
|
|
4
|
+
import { FormattingToolbarExtension as ie, ShowSelectionExtension as C, filterSuggestionItems as ae } from "@blocknote/core/extensions";
|
|
5
|
+
import { applySuggestions as oe, revertSuggestions as se, suggestChanges as ce } from "@handlewithcare/prosemirror-suggest-changes";
|
|
6
|
+
import { Fragment as w, Slice as T } from "prosemirror-model";
|
|
7
|
+
import { Plugin as E, PluginKey as D } from "prosemirror-state";
|
|
8
|
+
import { fixTablesKey as le } from "prosemirror-tables";
|
|
9
|
+
import { Decoration as O, DecorationSet as k } from "prosemirror-view";
|
|
10
|
+
import { Mark as A } from "@tiptap/core";
|
|
11
|
+
import { BlockPopover as ue, useBlockNoteContext as de, useBlockNoteEditor as j, useComponentsContext as M, useExtension as N, useExtensionState as fe, useSuggestionMenuKeyboardHandler as pe } from "@blocknote/react";
|
|
12
|
+
import P, { useCallback as F, useEffect as I, useMemo as L, useRef as R, useState as z } from "react";
|
|
13
|
+
import { jsx as B, jsxs as me } from "react/jsx-runtime";
|
|
14
|
+
import { autoUpdate as he, flip as ge, offset as _e, size as ve } from "@floating-ui/react";
|
|
16
15
|
//#region src/plugins/AgentCursorPlugin.ts
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
var ye = (e) => ({
|
|
17
|
+
style: `background-color: ${e.color}70`,
|
|
18
|
+
class: "ProseMirror-yjs-selection"
|
|
19
|
+
}), V = new D("blocknote-agent-cursor");
|
|
20
|
+
function be(e) {
|
|
21
|
+
return new E({
|
|
22
|
+
key: V,
|
|
21
23
|
view: (e) => ({}),
|
|
22
24
|
state: {
|
|
23
25
|
init: () => ({ selection: void 0 }),
|
|
@@ -27,33 +29,168 @@ function xe(e) {
|
|
|
27
29
|
}
|
|
28
30
|
},
|
|
29
31
|
props: { decorations: (t) => {
|
|
30
|
-
let { doc: n } = t, { selection: r } =
|
|
31
|
-
if (!r) return
|
|
32
|
-
i.push(
|
|
32
|
+
let { doc: n } = t, { selection: r } = V.getState(t), i = [];
|
|
33
|
+
if (!r) return k.create(n, []);
|
|
34
|
+
i.push(O.widget(r.head, () => xe(e), {
|
|
33
35
|
key: "agent-cursor",
|
|
34
36
|
side: 10
|
|
35
37
|
}));
|
|
36
38
|
let a = Math.min(r.anchor, r.head), o = Math.max(r.anchor, r.head);
|
|
37
|
-
return i.push(
|
|
39
|
+
return i.push(O.inline(a, o, ye(e), {
|
|
38
40
|
inclusiveEnd: !0,
|
|
39
41
|
inclusiveStart: !1
|
|
40
|
-
})),
|
|
42
|
+
})), k.create(n, i);
|
|
41
43
|
} }
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
|
-
var
|
|
46
|
+
var xe = (e) => {
|
|
45
47
|
let t = document.createElement("span");
|
|
46
48
|
t.classList.add("bn-collaboration-cursor__base"), t.setAttribute("data-active", "true");
|
|
47
49
|
let n = document.createElement("span");
|
|
48
50
|
n.setAttribute("contentedEditable", "false"), n.classList.add("bn-collaboration-cursor__caret"), n.setAttribute("style", `background-color: ${e.color}`);
|
|
49
51
|
let r = document.createElement("span");
|
|
50
52
|
return r.classList.add("bn-collaboration-cursor__label"), r.setAttribute("style", `background-color: ${e.color}`), r.insertBefore(document.createTextNode(e.name), null), n.insertBefore(r, null), t.insertBefore(document.createTextNode(""), null), t.insertBefore(n, null), t.insertBefore(document.createTextNode(""), null), t;
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
+
}, Se = A.create({
|
|
54
|
+
name: "insertion",
|
|
55
|
+
inclusive: !1,
|
|
56
|
+
excludes: "deletion modification insertion",
|
|
57
|
+
group: `${y} ${b}`,
|
|
58
|
+
addAttributes() {
|
|
59
|
+
return { id: {
|
|
60
|
+
default: null,
|
|
61
|
+
validate: "number"
|
|
62
|
+
} };
|
|
63
|
+
},
|
|
64
|
+
extendMarkSchema(e) {
|
|
65
|
+
return e.name === "insertion" ? {
|
|
66
|
+
blocknoteIgnore: !0,
|
|
67
|
+
inclusive: !1,
|
|
68
|
+
toDOM(e, t) {
|
|
69
|
+
return [
|
|
70
|
+
"ins",
|
|
71
|
+
{
|
|
72
|
+
"data-id": String(e.attrs.id),
|
|
73
|
+
"data-inline": String(t),
|
|
74
|
+
...!t && { style: "display: contents" }
|
|
75
|
+
},
|
|
76
|
+
0
|
|
77
|
+
];
|
|
78
|
+
},
|
|
79
|
+
parseDOM: [{
|
|
80
|
+
tag: "ins",
|
|
81
|
+
getAttrs(e) {
|
|
82
|
+
return e.dataset.id ? { id: parseInt(e.dataset.id, 10) } : !1;
|
|
83
|
+
}
|
|
84
|
+
}]
|
|
85
|
+
} : {};
|
|
86
|
+
}
|
|
87
|
+
}), Ce = A.create({
|
|
88
|
+
name: "deletion",
|
|
89
|
+
inclusive: !1,
|
|
90
|
+
excludes: "insertion modification deletion",
|
|
91
|
+
group: `${y} ${b}`,
|
|
92
|
+
addAttributes() {
|
|
93
|
+
return { id: {
|
|
94
|
+
default: null,
|
|
95
|
+
validate: "number"
|
|
96
|
+
} };
|
|
97
|
+
},
|
|
98
|
+
extendMarkSchema(e) {
|
|
99
|
+
return e.name === "deletion" ? {
|
|
100
|
+
blocknoteIgnore: !0,
|
|
101
|
+
inclusive: !1,
|
|
102
|
+
toDOM(e, t) {
|
|
103
|
+
return [
|
|
104
|
+
"del",
|
|
105
|
+
{
|
|
106
|
+
"data-id": String(e.attrs.id),
|
|
107
|
+
"data-inline": String(t),
|
|
108
|
+
...!t && { style: "display: contents" }
|
|
109
|
+
},
|
|
110
|
+
0
|
|
111
|
+
];
|
|
112
|
+
},
|
|
113
|
+
parseDOM: [{
|
|
114
|
+
tag: "del",
|
|
115
|
+
getAttrs(e) {
|
|
116
|
+
return e.dataset.id ? { id: parseInt(e.dataset.id, 10) } : !1;
|
|
117
|
+
}
|
|
118
|
+
}]
|
|
119
|
+
} : {};
|
|
120
|
+
}
|
|
121
|
+
}), we = A.create({
|
|
122
|
+
name: "modification",
|
|
123
|
+
inclusive: !1,
|
|
124
|
+
excludes: "deletion insertion",
|
|
125
|
+
group: `${y} ${b}`,
|
|
126
|
+
addAttributes() {
|
|
127
|
+
return {
|
|
128
|
+
id: {
|
|
129
|
+
default: null,
|
|
130
|
+
validate: "number"
|
|
131
|
+
},
|
|
132
|
+
type: { validate: "string" },
|
|
133
|
+
attrName: {
|
|
134
|
+
default: null,
|
|
135
|
+
validate: "string|null"
|
|
136
|
+
},
|
|
137
|
+
previousValue: { default: null },
|
|
138
|
+
newValue: { default: null }
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
extendMarkSchema(e) {
|
|
142
|
+
return e.name === "modification" ? {
|
|
143
|
+
blocknoteIgnore: !0,
|
|
144
|
+
inclusive: !1,
|
|
145
|
+
toDOM(e, t) {
|
|
146
|
+
return [
|
|
147
|
+
t ? "span" : "div",
|
|
148
|
+
{
|
|
149
|
+
"data-type": "modification",
|
|
150
|
+
"data-id": String(e.attrs.id),
|
|
151
|
+
"data-mod-type": e.attrs.type,
|
|
152
|
+
"data-mod-prev-val": JSON.stringify(e.attrs.previousValue),
|
|
153
|
+
"data-mod-new-val": JSON.stringify(e.attrs.newValue)
|
|
154
|
+
},
|
|
155
|
+
0
|
|
156
|
+
];
|
|
157
|
+
},
|
|
158
|
+
parseDOM: [{
|
|
159
|
+
tag: "span[data-type='modification']",
|
|
160
|
+
getAttrs(e) {
|
|
161
|
+
return e.dataset.id ? {
|
|
162
|
+
id: parseInt(e.dataset.id, 10),
|
|
163
|
+
type: e.dataset.modType,
|
|
164
|
+
previousValue: e.dataset.modPrevVal,
|
|
165
|
+
newValue: e.dataset.modNewVal
|
|
166
|
+
} : !1;
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
tag: "div[data-type='modification']",
|
|
170
|
+
getAttrs(e) {
|
|
171
|
+
return e.dataset.id ? {
|
|
172
|
+
id: parseInt(e.dataset.id, 10),
|
|
173
|
+
type: e.dataset.modType,
|
|
174
|
+
previousValue: e.dataset.modPrevVal
|
|
175
|
+
} : !1;
|
|
176
|
+
}
|
|
177
|
+
}]
|
|
178
|
+
} : {};
|
|
179
|
+
}
|
|
180
|
+
}), Te = x(() => ({
|
|
181
|
+
key: "aiAttributionMarks",
|
|
182
|
+
tiptapExtensions: [
|
|
183
|
+
Se,
|
|
184
|
+
Ce,
|
|
185
|
+
we
|
|
186
|
+
]
|
|
187
|
+
})), Ee = new D("blocknote-ai-plugin"), H = x(({ editor: e, options: t }) => {
|
|
188
|
+
let n = S(t ?? {}), r = S({ aiMenuState: "closed" }), i, a = !1, o = ce();
|
|
53
189
|
return o.props.decorations = void 0, {
|
|
54
190
|
key: "ai",
|
|
55
191
|
options: n,
|
|
56
192
|
store: r,
|
|
193
|
+
blockNoteExtensions: [Te()],
|
|
57
194
|
mount({ signal: e }) {
|
|
58
195
|
let t = !1;
|
|
59
196
|
document.addEventListener("scroll", () => {
|
|
@@ -69,15 +206,15 @@ var Se = (e) => {
|
|
|
69
206
|
});
|
|
70
207
|
},
|
|
71
208
|
prosemirrorPlugins: [
|
|
72
|
-
new
|
|
73
|
-
key:
|
|
209
|
+
new E({
|
|
210
|
+
key: Ee,
|
|
74
211
|
filterTransaction: (e) => {
|
|
75
212
|
let t = r.state.aiMenuState;
|
|
76
|
-
return !(t !== "closed" && t.status === "ai-writing" && e.getMeta(
|
|
213
|
+
return !(t !== "closed" && t.status === "ai-writing" && e.getMeta(le)?.fixTables);
|
|
77
214
|
}
|
|
78
215
|
}),
|
|
79
216
|
o,
|
|
80
|
-
|
|
217
|
+
be(t?.agentCursor || {
|
|
81
218
|
name: "AI",
|
|
82
219
|
color: "#8bc6ff"
|
|
83
220
|
})
|
|
@@ -93,19 +230,19 @@ var Se = (e) => {
|
|
|
93
230
|
},
|
|
94
231
|
acceptChanges() {
|
|
95
232
|
let t = e.prosemirrorState.doc;
|
|
96
|
-
e.exec((e, t) =>
|
|
233
|
+
e.exec((e, t) => se(e, (e) => {
|
|
97
234
|
t?.(e.setMeta("addToHistory", !1));
|
|
98
235
|
})), e.exec((e, n) => {
|
|
99
236
|
let r = e.tr;
|
|
100
|
-
return r.replace(0, r.doc.content.size, new
|
|
101
|
-
n?.(r.replace(0, r.doc.content.size, new
|
|
237
|
+
return r.replace(0, r.doc.content.size, new T(w.from(t), 0, 0)), oe(e.apply(r), (e) => {
|
|
238
|
+
n?.(r.replace(0, r.doc.content.size, new T(w.from(e.doc), 0, 0)));
|
|
102
239
|
});
|
|
103
|
-
}), e.getExtension(
|
|
240
|
+
}), e.getExtension("yForkDoc")?.merge({ keepChanges: !0 }), this.closeAIMenu();
|
|
104
241
|
},
|
|
105
242
|
rejectChanges() {
|
|
106
|
-
e.exec((e, t) =>
|
|
243
|
+
e.exec((e, t) => se(e, (e) => {
|
|
107
244
|
t?.(e.setMeta("addToHistory", !1));
|
|
108
|
-
})), e.getExtension(
|
|
245
|
+
})), e.getExtension("yForkDoc")?.merge({ keepChanges: !1 }), this.closeAIMenu();
|
|
109
246
|
},
|
|
110
247
|
async abort(e) {
|
|
111
248
|
let { aiMenuState: t } = r.state;
|
|
@@ -142,7 +279,7 @@ var Se = (e) => {
|
|
|
142
279
|
return this.invokeAI(e);
|
|
143
280
|
},
|
|
144
281
|
async invokeAI(t) {
|
|
145
|
-
this.setAIResponseStatus("thinking"), e.getExtension(
|
|
282
|
+
this.setAIResponseStatus("thinking"), e.getExtension("yForkDoc")?.fork();
|
|
146
283
|
try {
|
|
147
284
|
let o = new AbortController();
|
|
148
285
|
i ? (i.previousRequestOptions = t, i.abortController = o) : i = {
|
|
@@ -167,7 +304,7 @@ var Se = (e) => {
|
|
|
167
304
|
onBlockUpdated: (t) => {
|
|
168
305
|
let n = r.state.aiMenuState, i = n === "closed" ? void 0 : n;
|
|
169
306
|
if (!i || i.status !== "ai-writing") return;
|
|
170
|
-
let o =
|
|
307
|
+
let o = ne(t, e.prosemirrorState.doc);
|
|
171
308
|
o && (r.setState({ aiMenuState: {
|
|
172
309
|
blockId: t,
|
|
173
310
|
status: "ai-writing"
|
|
@@ -199,40 +336,299 @@ var Se = (e) => {
|
|
|
199
336
|
}
|
|
200
337
|
}
|
|
201
338
|
};
|
|
202
|
-
})
|
|
339
|
+
}), U = {
|
|
340
|
+
color: void 0,
|
|
341
|
+
size: void 0,
|
|
342
|
+
className: void 0,
|
|
343
|
+
style: void 0,
|
|
344
|
+
attr: void 0
|
|
345
|
+
}, W = P.createContext && /*#__PURE__*/ P.createContext(U), De = [
|
|
346
|
+
"attr",
|
|
347
|
+
"size",
|
|
348
|
+
"title"
|
|
349
|
+
];
|
|
350
|
+
function Oe(e, t) {
|
|
351
|
+
if (e == null) return {};
|
|
352
|
+
var n, r, i = ke(e, t);
|
|
353
|
+
if (Object.getOwnPropertySymbols) {
|
|
354
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
355
|
+
for (r = 0; r < a.length; r++) n = a[r], t.indexOf(n) === -1 && {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
356
|
+
}
|
|
357
|
+
return i;
|
|
358
|
+
}
|
|
359
|
+
function ke(e, t) {
|
|
360
|
+
if (e == null) return {};
|
|
361
|
+
var n = {};
|
|
362
|
+
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
363
|
+
if (t.indexOf(r) !== -1) continue;
|
|
364
|
+
n[r] = e[r];
|
|
365
|
+
}
|
|
366
|
+
return n;
|
|
367
|
+
}
|
|
368
|
+
function G() {
|
|
369
|
+
return G = Object.assign ? Object.assign.bind() : function(e) {
|
|
370
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
371
|
+
var n = arguments[t];
|
|
372
|
+
for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
373
|
+
}
|
|
374
|
+
return e;
|
|
375
|
+
}, G.apply(null, arguments);
|
|
376
|
+
}
|
|
377
|
+
function K(e, t) {
|
|
378
|
+
var n = Object.keys(e);
|
|
379
|
+
if (Object.getOwnPropertySymbols) {
|
|
380
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
381
|
+
t && (r = r.filter(function(t) {
|
|
382
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
383
|
+
})), n.push.apply(n, r);
|
|
384
|
+
}
|
|
385
|
+
return n;
|
|
386
|
+
}
|
|
387
|
+
function q(e) {
|
|
388
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
389
|
+
var n = arguments[t] == null ? {} : arguments[t];
|
|
390
|
+
t % 2 ? K(Object(n), !0).forEach(function(t) {
|
|
391
|
+
Ae(e, t, n[t]);
|
|
392
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : K(Object(n)).forEach(function(t) {
|
|
393
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
return e;
|
|
397
|
+
}
|
|
398
|
+
function Ae(e, t, n) {
|
|
399
|
+
return (t = je(t)) in e ? Object.defineProperty(e, t, {
|
|
400
|
+
value: n,
|
|
401
|
+
enumerable: !0,
|
|
402
|
+
configurable: !0,
|
|
403
|
+
writable: !0
|
|
404
|
+
}) : e[t] = n, e;
|
|
405
|
+
}
|
|
406
|
+
function je(e) {
|
|
407
|
+
var t = Me(e, "string");
|
|
408
|
+
return typeof t == "symbol" ? t : t + "";
|
|
409
|
+
}
|
|
410
|
+
function Me(e, t) {
|
|
411
|
+
if (typeof e != "object" || !e) return e;
|
|
412
|
+
var n = e[Symbol.toPrimitive];
|
|
413
|
+
if (n !== void 0) {
|
|
414
|
+
var r = n.call(e, t || "default");
|
|
415
|
+
if (typeof r != "object") return r;
|
|
416
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
417
|
+
}
|
|
418
|
+
return (t === "string" ? String : Number)(e);
|
|
419
|
+
}
|
|
420
|
+
function J(e) {
|
|
421
|
+
return e && e.map((e, t) => /*#__PURE__*/ P.createElement(e.tag, q({ key: t }, e.attr), J(e.child)));
|
|
422
|
+
}
|
|
423
|
+
function Y(e) {
|
|
424
|
+
return (t) => /*#__PURE__*/ P.createElement(Ne, G({ attr: q({}, e.attr) }, t), J(e.child));
|
|
425
|
+
}
|
|
426
|
+
function Ne(e) {
|
|
427
|
+
var t = (t) => {
|
|
428
|
+
var { attr: n, size: r, title: i } = e, a = Oe(e, De), o = r || t.size || "1em", s;
|
|
429
|
+
return t.className && (s = t.className), e.className && (s = (s ? s + " " : "") + e.className), /*#__PURE__*/ P.createElement("svg", G({
|
|
430
|
+
stroke: "currentColor",
|
|
431
|
+
fill: "currentColor",
|
|
432
|
+
strokeWidth: "0"
|
|
433
|
+
}, t.attr, n, a, {
|
|
434
|
+
className: s,
|
|
435
|
+
style: q(q({ color: e.color || t.color }, t.style), e.style),
|
|
436
|
+
height: o,
|
|
437
|
+
width: o,
|
|
438
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
439
|
+
}), i && /*#__PURE__*/ P.createElement("title", null, i), e.children);
|
|
440
|
+
};
|
|
441
|
+
return W === void 0 ? t(U) : /*#__PURE__*/ P.createElement(W.Consumer, null, (e) => t(e));
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region ../../node_modules/.pnpm/react-icons@5.6.0_react@19.2.5/node_modules/react-icons/ri/index.mjs
|
|
445
|
+
function X(e) {
|
|
446
|
+
return Y({
|
|
447
|
+
tag: "svg",
|
|
448
|
+
attr: {
|
|
449
|
+
viewBox: "0 0 24 24",
|
|
450
|
+
fill: "currentColor"
|
|
451
|
+
},
|
|
452
|
+
child: [{
|
|
453
|
+
tag: "path",
|
|
454
|
+
attr: { d: "M17.0007 1.20825 18.3195 3.68108 20.7923 4.99992 18.3195 6.31876 17.0007 8.79159 15.6818 6.31876 13.209 4.99992 15.6818 3.68108 17.0007 1.20825ZM8.00065 4.33325 10.6673 9.33325 15.6673 11.9999 10.6673 14.6666 8.00065 19.6666 5.33398 14.6666.333984 11.9999 5.33398 9.33325 8.00065 4.33325ZM19.6673 16.3333 18.0007 13.2083 16.334 16.3333 13.209 17.9999 16.334 19.6666 18.0007 22.7916 19.6673 19.6666 22.7923 17.9999 19.6673 16.3333Z" },
|
|
455
|
+
child: []
|
|
456
|
+
}]
|
|
457
|
+
})(e);
|
|
458
|
+
}
|
|
459
|
+
function Pe(e) {
|
|
460
|
+
return Y({
|
|
461
|
+
tag: "svg",
|
|
462
|
+
attr: {
|
|
463
|
+
viewBox: "0 0 24 24",
|
|
464
|
+
fill: "currentColor"
|
|
465
|
+
},
|
|
466
|
+
child: [{
|
|
467
|
+
tag: "path",
|
|
468
|
+
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" },
|
|
469
|
+
child: []
|
|
470
|
+
}]
|
|
471
|
+
})(e);
|
|
472
|
+
}
|
|
473
|
+
function Fe(e) {
|
|
474
|
+
return Y({
|
|
475
|
+
tag: "svg",
|
|
476
|
+
attr: {
|
|
477
|
+
viewBox: "0 0 24 24",
|
|
478
|
+
fill: "currentColor"
|
|
479
|
+
},
|
|
480
|
+
child: [{
|
|
481
|
+
tag: "path",
|
|
482
|
+
attr: { d: "M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z" },
|
|
483
|
+
child: []
|
|
484
|
+
}]
|
|
485
|
+
})(e);
|
|
486
|
+
}
|
|
487
|
+
function Ie(e) {
|
|
488
|
+
return Y({
|
|
489
|
+
tag: "svg",
|
|
490
|
+
attr: {
|
|
491
|
+
viewBox: "0 0 24 24",
|
|
492
|
+
fill: "currentColor"
|
|
493
|
+
},
|
|
494
|
+
child: [{
|
|
495
|
+
tag: "path",
|
|
496
|
+
attr: { d: "M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z" },
|
|
497
|
+
child: []
|
|
498
|
+
}]
|
|
499
|
+
})(e);
|
|
500
|
+
}
|
|
501
|
+
function Le(e) {
|
|
502
|
+
return Y({
|
|
503
|
+
tag: "svg",
|
|
504
|
+
attr: {
|
|
505
|
+
viewBox: "0 0 24 24",
|
|
506
|
+
fill: "currentColor"
|
|
507
|
+
},
|
|
508
|
+
child: [{
|
|
509
|
+
tag: "path",
|
|
510
|
+
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" },
|
|
511
|
+
child: []
|
|
512
|
+
}]
|
|
513
|
+
})(e);
|
|
514
|
+
}
|
|
515
|
+
function Re(e) {
|
|
516
|
+
return Y({
|
|
517
|
+
tag: "svg",
|
|
518
|
+
attr: {
|
|
519
|
+
viewBox: "0 0 24 24",
|
|
520
|
+
fill: "currentColor"
|
|
521
|
+
},
|
|
522
|
+
child: [{
|
|
523
|
+
tag: "path",
|
|
524
|
+
attr: { d: "M13 6V21H11V6H5V4H19V6H13Z" },
|
|
525
|
+
child: []
|
|
526
|
+
}]
|
|
527
|
+
})(e);
|
|
528
|
+
}
|
|
529
|
+
function ze(e) {
|
|
530
|
+
return Y({
|
|
531
|
+
tag: "svg",
|
|
532
|
+
attr: {
|
|
533
|
+
viewBox: "0 0 24 24",
|
|
534
|
+
fill: "currentColor"
|
|
535
|
+
},
|
|
536
|
+
child: [{
|
|
537
|
+
tag: "path",
|
|
538
|
+
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" },
|
|
539
|
+
child: []
|
|
540
|
+
}]
|
|
541
|
+
})(e);
|
|
542
|
+
}
|
|
543
|
+
function Be(e) {
|
|
544
|
+
return Y({
|
|
545
|
+
tag: "svg",
|
|
546
|
+
attr: {
|
|
547
|
+
viewBox: "0 0 24 24",
|
|
548
|
+
fill: "currentColor"
|
|
549
|
+
},
|
|
550
|
+
child: [{
|
|
551
|
+
tag: "path",
|
|
552
|
+
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" },
|
|
553
|
+
child: []
|
|
554
|
+
}]
|
|
555
|
+
})(e);
|
|
556
|
+
}
|
|
557
|
+
function Ve(e) {
|
|
558
|
+
return Y({
|
|
559
|
+
tag: "svg",
|
|
560
|
+
attr: {
|
|
561
|
+
viewBox: "0 0 24 24",
|
|
562
|
+
fill: "currentColor"
|
|
563
|
+
},
|
|
564
|
+
child: [{
|
|
565
|
+
tag: "path",
|
|
566
|
+
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" },
|
|
567
|
+
child: []
|
|
568
|
+
}]
|
|
569
|
+
})(e);
|
|
570
|
+
}
|
|
571
|
+
function Z(e) {
|
|
572
|
+
return Y({
|
|
573
|
+
tag: "svg",
|
|
574
|
+
attr: {
|
|
575
|
+
viewBox: "0 0 24 24",
|
|
576
|
+
fill: "currentColor"
|
|
577
|
+
},
|
|
578
|
+
child: [{
|
|
579
|
+
tag: "path",
|
|
580
|
+
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" },
|
|
581
|
+
child: []
|
|
582
|
+
}]
|
|
583
|
+
})(e);
|
|
584
|
+
}
|
|
585
|
+
function Q(e) {
|
|
586
|
+
return Y({
|
|
587
|
+
tag: "svg",
|
|
588
|
+
attr: {
|
|
589
|
+
viewBox: "0 0 24 24",
|
|
590
|
+
fill: "currentColor"
|
|
591
|
+
},
|
|
592
|
+
child: [{
|
|
593
|
+
tag: "path",
|
|
594
|
+
attr: { d: "M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z" },
|
|
595
|
+
child: []
|
|
596
|
+
}]
|
|
597
|
+
})(e);
|
|
598
|
+
}
|
|
203
599
|
//#endregion
|
|
204
600
|
//#region src/hooks/useAIDictionary.ts
|
|
205
|
-
function
|
|
206
|
-
return u(
|
|
601
|
+
function $() {
|
|
602
|
+
return u(de().editor);
|
|
207
603
|
}
|
|
208
604
|
//#endregion
|
|
209
605
|
//#region src/components/AIMenu/PromptSuggestionMenu.tsx
|
|
210
|
-
var
|
|
211
|
-
let t =
|
|
606
|
+
var He = (e) => {
|
|
607
|
+
let t = M(), { onManualPromptSubmit: n, promptText: r, onPromptTextChange: i, disabled: a } = e, [o, s] = z(""), c = r || o, l = F(async (e) => {
|
|
212
608
|
e.key === "Enter" && !e.nativeEvent.isComposing && n(c);
|
|
213
|
-
}, [c, n]), u =
|
|
609
|
+
}, [c, n]), u = F((e) => {
|
|
214
610
|
let t = e.currentTarget.value;
|
|
215
611
|
i && i(t), r === void 0 && s(t);
|
|
216
612
|
}, [
|
|
217
613
|
i,
|
|
218
614
|
s,
|
|
219
615
|
r
|
|
220
|
-
]), d =
|
|
616
|
+
]), d = L(() => ae(e.items, c), [c, e.items]), { selectedIndex: f, setSelectedIndex: p, handler: m } = pe(d, (e) => e.onItemClick()), h = d.length > 0 && f >= 0 && f < d.length ? `bn-suggestion-menu-item-${f}` : void 0, g = F((e) => {
|
|
221
617
|
e.key === "Enter" && !e.nativeEvent.isComposing ? d.length > 0 ? m(e) : l(e) : m(e);
|
|
222
618
|
}, [
|
|
223
619
|
l,
|
|
224
620
|
m,
|
|
225
621
|
d.length
|
|
226
622
|
]);
|
|
227
|
-
|
|
623
|
+
I(() => {
|
|
228
624
|
p(0);
|
|
229
625
|
}, [c, p]);
|
|
230
|
-
let _ =
|
|
231
|
-
return
|
|
626
|
+
let _ = R(null), v = R(a);
|
|
627
|
+
return I(() => {
|
|
232
628
|
_.current && v.current && !a && _.current.focus(), a && (v.current = !0);
|
|
233
|
-
}, [a]), /* @__PURE__ */
|
|
629
|
+
}, [a]), /* @__PURE__ */ me("div", {
|
|
234
630
|
className: "bn-combobox",
|
|
235
|
-
children: [/* @__PURE__ */
|
|
631
|
+
children: [/* @__PURE__ */ B(t.Generic.Form.Root, { children: /* @__PURE__ */ B(t.Generic.Form.TextInput, {
|
|
236
632
|
ref: _,
|
|
237
633
|
className: "bn-combobox-input",
|
|
238
634
|
name: "ai-prompt",
|
|
@@ -246,11 +642,11 @@ var Z = (e) => {
|
|
|
246
642
|
autoComplete: "off",
|
|
247
643
|
rightSection: e.rightSection,
|
|
248
644
|
"aria-activedescendant": h
|
|
249
|
-
}) }), d.length > 0 && /* @__PURE__ */
|
|
645
|
+
}) }), d.length > 0 && /* @__PURE__ */ B(t.SuggestionMenu.Root, {
|
|
250
646
|
className: "bn-combobox-items",
|
|
251
647
|
id: "ai-suggestion-menu",
|
|
252
|
-
children: d.map((e, n) => /* @__PURE__ */
|
|
253
|
-
className:
|
|
648
|
+
children: d.map((e, n) => /* @__PURE__ */ B(t.SuggestionMenu.Item, {
|
|
649
|
+
className: re("bn-suggestion-menu-item", e.size === "small" ? "bn-suggestion-menu-item-small" : ""),
|
|
254
650
|
id: `bn-suggestion-menu-item-${n}`,
|
|
255
651
|
isSelected: n === f,
|
|
256
652
|
onClick: e.onItemClick,
|
|
@@ -261,14 +657,14 @@ var Z = (e) => {
|
|
|
261
657
|
};
|
|
262
658
|
//#endregion
|
|
263
659
|
//#region src/components/AIMenu/getDefaultAIMenuItems.tsx
|
|
264
|
-
function
|
|
265
|
-
let t = u(e), n = e.getExtension(
|
|
660
|
+
function Ue(e) {
|
|
661
|
+
let t = u(e), n = e.getExtension(H);
|
|
266
662
|
return n ? [
|
|
267
663
|
{
|
|
268
664
|
key: "continue_writing",
|
|
269
665
|
title: t.ai_default_commands.continue_writing.title,
|
|
270
666
|
aliases: t.ai_default_commands.continue_writing.aliases,
|
|
271
|
-
icon: /* @__PURE__ */
|
|
667
|
+
icon: /* @__PURE__ */ B(Z, { size: 18 }),
|
|
272
668
|
onItemClick: async () => {
|
|
273
669
|
await n.invokeAI({
|
|
274
670
|
userPrompt: "Continue writing at the current cursor position related to the previous text. Add multiple blocks if needed. If the document looks like a template / draft, follow the template. Be extensive if needed.",
|
|
@@ -285,7 +681,7 @@ function we(e) {
|
|
|
285
681
|
key: "summarize",
|
|
286
682
|
title: t.ai_default_commands.summarize.title,
|
|
287
683
|
aliases: t.ai_default_commands.summarize.aliases,
|
|
288
|
-
icon: /* @__PURE__ */
|
|
684
|
+
icon: /* @__PURE__ */ B(ze, { size: 18 }),
|
|
289
685
|
onItemClick: async () => {
|
|
290
686
|
await n.invokeAI({
|
|
291
687
|
userPrompt: "Summarize",
|
|
@@ -302,7 +698,7 @@ function we(e) {
|
|
|
302
698
|
key: "action_items",
|
|
303
699
|
title: t.ai_default_commands.add_action_items.title,
|
|
304
700
|
aliases: t.ai_default_commands.add_action_items.aliases,
|
|
305
|
-
icon: /* @__PURE__ */
|
|
701
|
+
icon: /* @__PURE__ */ B(Be, { size: 18 }),
|
|
306
702
|
onItemClick: async () => {
|
|
307
703
|
await n.invokeAI({
|
|
308
704
|
userPrompt: "Add action items",
|
|
@@ -319,7 +715,7 @@ function we(e) {
|
|
|
319
715
|
key: "write_anything",
|
|
320
716
|
title: t.ai_default_commands.write_anything.title,
|
|
321
717
|
aliases: t.ai_default_commands.write_anything.aliases,
|
|
322
|
-
icon: /* @__PURE__ */
|
|
718
|
+
icon: /* @__PURE__ */ B(Z, { size: 18 }),
|
|
323
719
|
onItemClick: (e) => {
|
|
324
720
|
e(t.ai_default_commands.write_anything.prompt_placeholder);
|
|
325
721
|
},
|
|
@@ -327,14 +723,14 @@ function we(e) {
|
|
|
327
723
|
}
|
|
328
724
|
] : [];
|
|
329
725
|
}
|
|
330
|
-
function
|
|
331
|
-
let t = u(e), n = e.getExtension(
|
|
726
|
+
function We(e) {
|
|
727
|
+
let t = u(e), n = e.getExtension(H);
|
|
332
728
|
return n ? [
|
|
333
729
|
{
|
|
334
730
|
key: "improve_writing",
|
|
335
731
|
title: t.ai_default_commands.improve_writing.title,
|
|
336
732
|
aliases: t.ai_default_commands.improve_writing.aliases,
|
|
337
|
-
icon: /* @__PURE__ */
|
|
733
|
+
icon: /* @__PURE__ */ B(Re, { size: 18 }),
|
|
338
734
|
onItemClick: async () => {
|
|
339
735
|
await n.invokeAI({
|
|
340
736
|
useSelection: !0,
|
|
@@ -352,7 +748,7 @@ function Te(e) {
|
|
|
352
748
|
key: "fix_spelling",
|
|
353
749
|
title: t.ai_default_commands.fix_spelling.title,
|
|
354
750
|
aliases: t.ai_default_commands.fix_spelling.aliases,
|
|
355
|
-
icon: /* @__PURE__ */
|
|
751
|
+
icon: /* @__PURE__ */ B(Fe, { size: 18 }),
|
|
356
752
|
onItemClick: async () => {
|
|
357
753
|
await n.invokeAI({
|
|
358
754
|
useSelection: !0,
|
|
@@ -370,7 +766,7 @@ function Te(e) {
|
|
|
370
766
|
key: "translate",
|
|
371
767
|
title: t.ai_default_commands.translate.title,
|
|
372
768
|
aliases: t.ai_default_commands.translate.aliases,
|
|
373
|
-
icon: /* @__PURE__ */
|
|
769
|
+
icon: /* @__PURE__ */ B(Le, { size: 18 }),
|
|
374
770
|
onItemClick: (e) => {
|
|
375
771
|
e(t.ai_default_commands.translate.prompt_placeholder);
|
|
376
772
|
},
|
|
@@ -380,7 +776,7 @@ function Te(e) {
|
|
|
380
776
|
key: "simplify",
|
|
381
777
|
title: t.ai_default_commands.simplify.title,
|
|
382
778
|
aliases: t.ai_default_commands.simplify.aliases,
|
|
383
|
-
icon: /* @__PURE__ */
|
|
779
|
+
icon: /* @__PURE__ */ B(Ve, { size: 18 }),
|
|
384
780
|
onItemClick: async () => {
|
|
385
781
|
await n.invokeAI({
|
|
386
782
|
useSelection: !0,
|
|
@@ -396,13 +792,13 @@ function Te(e) {
|
|
|
396
792
|
}
|
|
397
793
|
] : [];
|
|
398
794
|
}
|
|
399
|
-
function
|
|
400
|
-
let t = u(e), n = e.getExtension(
|
|
795
|
+
function Ge(e) {
|
|
796
|
+
let t = u(e), n = e.getExtension(H);
|
|
401
797
|
return n ? [{
|
|
402
798
|
key: "accept",
|
|
403
799
|
title: t.ai_menu.actions.accept.title,
|
|
404
800
|
aliases: t.ai_menu.actions.accept.aliases,
|
|
405
|
-
icon: /* @__PURE__ */
|
|
801
|
+
icon: /* @__PURE__ */ B(Ie, { size: 18 }),
|
|
406
802
|
onItemClick: () => {
|
|
407
803
|
n.acceptChanges();
|
|
408
804
|
},
|
|
@@ -411,20 +807,20 @@ function Ee(e) {
|
|
|
411
807
|
key: "revert",
|
|
412
808
|
title: t.ai_menu.actions.revert.title,
|
|
413
809
|
aliases: t.ai_menu.actions.revert.aliases,
|
|
414
|
-
icon: /* @__PURE__ */
|
|
810
|
+
icon: /* @__PURE__ */ B(Q, { size: 18 }),
|
|
415
811
|
onItemClick: () => {
|
|
416
812
|
n.rejectChanges();
|
|
417
813
|
},
|
|
418
814
|
size: "small"
|
|
419
815
|
}] : [];
|
|
420
816
|
}
|
|
421
|
-
function
|
|
422
|
-
let t = u(e), n = e.getExtension(
|
|
817
|
+
function Ke(e) {
|
|
818
|
+
let t = u(e), n = e.getExtension(H);
|
|
423
819
|
return n ? [{
|
|
424
820
|
key: "retry",
|
|
425
821
|
title: t.ai_menu.actions.retry.title,
|
|
426
822
|
aliases: t.ai_menu.actions.retry.aliases,
|
|
427
|
-
icon: /* @__PURE__ */
|
|
823
|
+
icon: /* @__PURE__ */ B(Pe, { size: 18 }),
|
|
428
824
|
onItemClick: async () => {
|
|
429
825
|
await n.retry();
|
|
430
826
|
},
|
|
@@ -433,22 +829,22 @@ function De(e) {
|
|
|
433
829
|
key: "cancel",
|
|
434
830
|
title: t.ai_menu.actions.cancel.title,
|
|
435
831
|
aliases: t.ai_menu.actions.cancel.aliases,
|
|
436
|
-
icon: /* @__PURE__ */
|
|
832
|
+
icon: /* @__PURE__ */ B(Q, { size: 18 }),
|
|
437
833
|
onItemClick: () => {
|
|
438
834
|
n.rejectChanges();
|
|
439
835
|
},
|
|
440
836
|
size: "small"
|
|
441
837
|
}] : [];
|
|
442
838
|
}
|
|
443
|
-
function
|
|
444
|
-
return t === "user-input" ? e.getSelection() ?
|
|
839
|
+
function qe(e, t) {
|
|
840
|
+
return t === "user-input" ? e.getSelection() ? We(e) : Ue(e) : t === "user-reviewing" ? Ge(e) : t === "error" ? Ke(e) : [];
|
|
445
841
|
}
|
|
446
842
|
//#endregion
|
|
447
843
|
//#region src/components/AIMenu/AIMenu.tsx
|
|
448
|
-
var
|
|
449
|
-
let t =
|
|
844
|
+
var Je = (e) => {
|
|
845
|
+
let t = j(), [n, r] = z(""), i = $(), a = M(), o = N(H), s = fe(H, { selector: (e) => e.aiMenuState === "closed" ? "closed" : e.aiMenuState.status }), { items: c } = e, l = L(() => {
|
|
450
846
|
let e = [];
|
|
451
|
-
return e = c ? c(t, s) :
|
|
847
|
+
return e = c ? c(t, s) : qe(t, s), e.map((e) => ({
|
|
452
848
|
...e,
|
|
453
849
|
onItemClick: () => {
|
|
454
850
|
e.onItemClick(r);
|
|
@@ -458,55 +854,55 @@ var $ = (e) => {
|
|
|
458
854
|
c,
|
|
459
855
|
s,
|
|
460
856
|
t
|
|
461
|
-
]), u =
|
|
857
|
+
]), u = F(async (e) => {
|
|
462
858
|
await o.invokeAI({
|
|
463
859
|
userPrompt: e,
|
|
464
860
|
useSelection: t.getSelection() !== void 0
|
|
465
861
|
});
|
|
466
862
|
}, [o, t]);
|
|
467
|
-
|
|
863
|
+
I(() => {
|
|
468
864
|
(s === "ai-writing" || s === "user-reviewing" || s === "error") && r("");
|
|
469
865
|
}, [s]);
|
|
470
|
-
let d =
|
|
471
|
-
if (s === "thinking" || s === "ai-writing") return /* @__PURE__ */
|
|
472
|
-
if (s === "error") return /* @__PURE__ */
|
|
866
|
+
let d = L(() => s === "thinking" ? i.ai_menu.status.thinking : s === "ai-writing" ? i.ai_menu.status.editing : s === "error" ? i.ai_menu.status.error : i.ai_menu.input_placeholder, [s, i]), f = L(() => {
|
|
867
|
+
if (s === "thinking" || s === "ai-writing") return /* @__PURE__ */ B(a.SuggestionMenu.Loader, { className: "bn-suggestion-menu-loader bn-combobox-right-section" });
|
|
868
|
+
if (s === "error") return /* @__PURE__ */ B("div", {
|
|
473
869
|
className: "bn-combobox-right-section bn-combobox-error",
|
|
474
|
-
children: /* @__PURE__ */
|
|
870
|
+
children: /* @__PURE__ */ B("svg", {
|
|
475
871
|
xmlns: "http://www.w3.org/2000/svg",
|
|
476
872
|
height: "1em",
|
|
477
873
|
viewBox: "0 -960 960 960",
|
|
478
874
|
width: "1em",
|
|
479
875
|
fill: "currentColor",
|
|
480
|
-
children: /* @__PURE__ */
|
|
876
|
+
children: /* @__PURE__ */ B("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" })
|
|
481
877
|
})
|
|
482
878
|
});
|
|
483
879
|
}, [a, s]);
|
|
484
|
-
return /* @__PURE__ */
|
|
880
|
+
return /* @__PURE__ */ B(He, {
|
|
485
881
|
onManualPromptSubmit: e.onManualPromptSubmit || u,
|
|
486
882
|
items: l,
|
|
487
883
|
promptText: n,
|
|
488
884
|
onPromptTextChange: r,
|
|
489
885
|
placeholder: d,
|
|
490
886
|
disabled: s === "thinking" || s === "ai-writing",
|
|
491
|
-
icon: /* @__PURE__ */
|
|
887
|
+
icon: /* @__PURE__ */ B("div", {
|
|
492
888
|
className: "bn-combobox-icon",
|
|
493
|
-
children: /* @__PURE__ */
|
|
889
|
+
children: /* @__PURE__ */ B(X, {})
|
|
494
890
|
}),
|
|
495
891
|
rightSection: f
|
|
496
892
|
});
|
|
497
|
-
},
|
|
498
|
-
let t =
|
|
893
|
+
}, Ye = (e) => {
|
|
894
|
+
let t = j(), n = N(H), r = fe(H, {
|
|
499
895
|
editor: t,
|
|
500
896
|
selector: (e) => e.aiMenuState
|
|
501
|
-
}), i = r === "closed" ? void 0 : r.blockId, a =
|
|
897
|
+
}), i = r === "closed" ? void 0 : r.blockId, a = L(() => ({
|
|
502
898
|
...e.floatingUIOptions,
|
|
503
899
|
useFloatingOptions: {
|
|
504
900
|
open: r !== "closed",
|
|
505
901
|
placement: "bottom",
|
|
506
902
|
middleware: [
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
903
|
+
_e(10),
|
|
904
|
+
ge(),
|
|
905
|
+
ve({ apply({ rects: e, elements: t }) {
|
|
510
906
|
Object.assign(t.floating.style, { width: `${e.reference.width}px` });
|
|
511
907
|
} })
|
|
512
908
|
],
|
|
@@ -514,7 +910,7 @@ var $ = (e) => {
|
|
|
514
910
|
e || r === "closed" || (r.status === "user-input" ? n.closeAIMenu() : (r.status === "user-reviewing" || r.status === "error") && n.rejectChanges());
|
|
515
911
|
},
|
|
516
912
|
whileElementsMounted(e, t, n) {
|
|
517
|
-
return
|
|
913
|
+
return he(e, t, n, { animationFrame: !0 });
|
|
518
914
|
},
|
|
519
915
|
...e.floatingUIOptions?.useFloatingOptions
|
|
520
916
|
},
|
|
@@ -544,19 +940,19 @@ var $ = (e) => {
|
|
|
544
940
|
i,
|
|
545
941
|
e.floatingUIOptions,
|
|
546
942
|
t.domElement
|
|
547
|
-
]), o = e.aiMenu ||
|
|
548
|
-
return /* @__PURE__ */
|
|
943
|
+
]), o = e.aiMenu || Je;
|
|
944
|
+
return /* @__PURE__ */ B(ue, {
|
|
549
945
|
blockId: i,
|
|
550
946
|
...a,
|
|
551
|
-
children: r !== "closed" && /* @__PURE__ */
|
|
947
|
+
children: r !== "closed" && /* @__PURE__ */ B(o, {})
|
|
552
948
|
});
|
|
553
|
-
},
|
|
554
|
-
let e =
|
|
555
|
-
return n.isEditable ? /* @__PURE__ */
|
|
949
|
+
}, Xe = () => {
|
|
950
|
+
let e = $(), t = M(), n = j(), r = N(H), i = N(ie);
|
|
951
|
+
return n.isEditable ? /* @__PURE__ */ B(t.Generic.Toolbar.Button, {
|
|
556
952
|
className: "bn-button",
|
|
557
953
|
label: e.formatting_toolbar.ai.tooltip,
|
|
558
954
|
mainTooltip: e.formatting_toolbar.ai.tooltip,
|
|
559
|
-
icon: /* @__PURE__ */
|
|
955
|
+
icon: /* @__PURE__ */ B(X, {}),
|
|
560
956
|
onClick: () => {
|
|
561
957
|
let e = n.getSelection();
|
|
562
958
|
if (!e) throw Error("No selection");
|
|
@@ -564,9 +960,9 @@ var $ = (e) => {
|
|
|
564
960
|
r.openAIMenuAtBlock(t), i.store.setState(!1);
|
|
565
961
|
}
|
|
566
962
|
}) : null;
|
|
567
|
-
},
|
|
568
|
-
function
|
|
569
|
-
let t = e.getExtension(
|
|
963
|
+
}, Ze = { AI: X };
|
|
964
|
+
function Qe(e) {
|
|
965
|
+
let t = e.getExtension(H);
|
|
570
966
|
return t ? [{
|
|
571
967
|
key: "ai",
|
|
572
968
|
onItemClick: () => {
|
|
@@ -574,10 +970,10 @@ function je(e) {
|
|
|
574
970
|
n.block.content && Array.isArray(n.block.content) && n.block.content.length === 0 && n.prevBlock ? t.openAIMenuAtBlock(n.prevBlock.id) : t.openAIMenuAtBlock(n.block.id);
|
|
575
971
|
},
|
|
576
972
|
...u(e).slash_menu.ai,
|
|
577
|
-
icon: /* @__PURE__ */
|
|
973
|
+
icon: /* @__PURE__ */ B(Ze.AI, {})
|
|
578
974
|
}] : [];
|
|
579
975
|
}
|
|
580
976
|
//#endregion
|
|
581
|
-
export {
|
|
977
|
+
export { H as AIExtension, Je as AIMenu, Ye as AIMenuController, Xe as AIToolbarButton, g as ClientSideTransport, r as PROVIDER_OVERRIDES, He as PromptSuggestionMenu, a as StreamToolExecutor, t as _getApplySuggestionsTr, s as aiDocumentFormats, v as buildAIRequest, e as createStreamToolsArraySchema, h as fetchViaProxy, u as getAIDictionary, Qe as getAISlashMenuItems, qe as getDefaultAIMenuItems, i as getProviderOverrides, o as injectDocumentStateMessages, d as makeDocumentStateBuilder, c as objectStreamToOperationsResult, p as promptHelpers, m as sendMessageWithAIRequest, n as setupToolCallStreaming, _ as streamToolsToToolSet, f as toolDefinitionsToToolSet, l as toolSetToToolDefinitions, $ as useAIDictionary };
|
|
582
978
|
|
|
583
979
|
//# sourceMappingURL=blocknote-xl-ai.js.map
|