reactjs-tiptap-editor 1.0.2 → 1.0.4
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/lib/{ActionMenuButton-DgjFjzC8.js → ActionMenuButton-71gCEVbv.js} +4 -4
- package/lib/{ActionMenuButton-BRWFTb3V.cjs → ActionMenuButton-Bzr6ICxv.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +4 -4
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +3 -3
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +3 -3
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +3 -3
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +3 -3
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +4 -4
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +3 -3
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +5 -5
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +3 -3
- package/lib/{Drawer-1_PmP-H0.cjs → Drawer-DlX87Cl4.cjs} +1 -1
- package/lib/{Drawer-DNnkwfnI.js → Drawer-GRyIh2y1.js} +6 -6
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +1 -1
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +5 -5
- package/lib/{Excalidraw-DreGyrmJ.cjs → Excalidraw-Bkq1fXLL.cjs} +1 -1
- package/lib/{Excalidraw-StBAUhjt.js → Excalidraw-BmyhdJCU.js} +5 -5
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +1 -1
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +3 -3
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +3 -3
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +5 -5
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +5 -5
- package/lib/History.cjs +1 -1
- package/lib/History.js +3 -3
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +3 -3
- package/lib/{Icon-D3AdnMCj.js → Icon-1z7VnLgz.js} +1 -1
- package/lib/{Icon-B9hI3gal.cjs → Icon-ztD4g9N4.cjs} +1 -1
- package/lib/{Iframe-BIgQtyZo.js → Iframe-AiP8qPGF.js} +5 -5
- package/lib/{Iframe-BDm-w-lg.cjs → Iframe-DhUlC9-Y.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +12 -12
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +6 -6
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +4 -4
- package/lib/{Indent-CnPAv7eT.js → Indent-CBoQDISv.js} +3 -3
- package/lib/{Indent-BzyTbroV.cjs → Indent-fphgO8Eo.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +1 -1
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +3 -3
- package/lib/{Katex-BE_GROI2.cjs → Katex-AfmTUUNS.cjs} +1 -1
- package/lib/{Katex-D-SUWkkU.js → Katex-n2PVzaMd.js} +7 -7
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +1 -1
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +6 -6
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +1 -1
- package/lib/{LinkEditBlock-DcxIMK_D.js → LinkEditBlock-CoXwYHlj.js} +315 -306
- package/lib/{LinkEditBlock-5NRB9DRC.cjs → LinkEditBlock-sADc32hF.cjs} +3 -3
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +6 -6
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +3 -3
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +10 -10
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +5 -5
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +3 -3
- package/lib/{Table-BYg26eMf.cjs → Table-BLb5576a.cjs} +1 -1
- package/lib/{Table-DtC2-bqx.js → Table-BshvoFRh.js} +5 -5
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +3 -3
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +6 -6
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +6 -6
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +3 -3
- package/lib/{Twitter-B3n8vc45.js → Twitter-CLVet4OM.js} +10 -10
- package/lib/{Twitter-DJ6JzZPJ.cjs → Twitter-DEKTLWO5.cjs} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +8 -8
- package/lib/bubble.cjs +4 -4
- package/lib/bubble.js +1026 -980
- package/lib/{button-DHZeIKzF.js → button-BnN1L5_T.js} +1 -1
- package/lib/{button-BTnV4TZ7.cjs → button-CjAogRMZ.cjs} +1 -1
- package/lib/{checkbox-BoBTXwkF.cjs → checkbox-BFgaCetY.cjs} +1 -1
- package/lib/{checkbox-Dm8Nfwg8.js → checkbox-sSQSzjls.js} +1 -1
- package/lib/{dialog-DXF2Q8LZ.cjs → dialog-CUP7QBaG.cjs} +1 -1
- package/lib/{dialog-xrO7nV_z.js → dialog-CzZSyyxS.js} +1 -1
- package/lib/{dropdown-menu-Bh-wEgI8.cjs → dropdown-menu-CwHOwzLr.cjs} +1 -1
- package/lib/{dropdown-menu-ByeBPPyv.js → dropdown-menu-y1rPk4dr.js} +1 -1
- package/lib/extensions/Link/components/LinkEditBlock.d.ts +1 -0
- package/lib/{index-ClAEwR0V.js → index--XZPCi0O.js} +1 -1
- package/lib/{index-DM3mpxB-.cjs → index-CnbtiTqP.cjs} +1 -1
- package/lib/index-D4d-0Hqh.cjs +1 -0
- package/lib/{index-CEbbM7Gx.js → index-DGihe-wH.js} +6 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +2 -2
- package/lib/{input-U-XBy56K.js → input-Byg4PPou.js} +1 -1
- package/lib/{input-CadAYBdT.cjs → input-Dikmsjjj.cjs} +1 -1
- package/lib/{label-23SJWQ49.js → label-BX7OqM6p.js} +1 -1
- package/lib/{label-C09fAh5p.cjs → label-ChxDmW-K.cjs} +1 -1
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/en.d.ts +1 -0
- package/lib/locales/fi.d.ts +1 -0
- package/lib/locales/hu.d.ts +1 -0
- package/lib/locales/index.d.ts +30 -0
- package/lib/locales/pt-br.d.ts +1 -0
- package/lib/locales/vi.d.ts +1 -0
- package/lib/locales/zh-cn.d.ts +1 -0
- package/lib/{popover-ydZ2mHXy.js → popover-CheVmqgb.js} +1 -1
- package/lib/{popover-C64cn4Pd.cjs → popover-DVD1y8Z_.cjs} +1 -1
- package/lib/{separator-BoKhvBG9.cjs → separator-CSuS-D6T.cjs} +1 -1
- package/lib/{separator-DqqiRHfY.js → separator-Y_Pbpi-5.js} +5 -5
- package/lib/{store-Cu0gDf4G.js → store-BVm_SgvL.js} +1 -1
- package/lib/{store-BPiGnThe.cjs → store-DznMm4Ug.cjs} +1 -1
- package/lib/style.css +1 -1
- package/lib/{tabs-DebGjFBg.cjs → tabs-B9ooipwg.cjs} +1 -1
- package/lib/{tabs-BiYU230B.js → tabs-p4pJGb6o.js} +1 -1
- package/lib/{textarea--_-Ve3AB.js → textarea-Byts1Pn0.js} +1 -1
- package/lib/{textarea-BIkB9h_0.cjs → textarea-L53EceuF.cjs} +1 -1
- package/lib/theme/theme.d.ts +1 -1
- package/lib/theme.cjs +1 -1
- package/lib/theme.js +1 -1
- package/lib/{toggle-BWfca8kh.cjs → toggle-DUPu3nnZ.cjs} +1 -1
- package/lib/{toggle-Crvm3Tcn.js → toggle-WBgzE8Jm.js} +3 -3
- package/lib/{tooltip-D_0vo9Xj.js → tooltip-BOMwAoO1.js} +1 -1
- package/lib/{tooltip-9jtsGIcX.cjs → tooltip-DD5Ii8qI.cjs} +1 -1
- package/lib/{useButtonProps--5ytUuGi.js → useButtonProps-BIOoOg6h.js} +2 -2
- package/lib/{useButtonProps-DJ51kDtM.cjs → useButtonProps-C4SCmCVo.cjs} +1 -1
- package/package.json +1 -1
- package/lib/index-B0fWAhpK.cjs +0 -1
package/lib/bubble.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsx as p, Fragment as
|
|
2
|
-
import ms, { useRef as Lt, useEffect as st, useCallback as
|
|
1
|
+
import { jsx as p, Fragment as M, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import ms, { useRef as Lt, useEffect as st, useCallback as L, useState as z, useMemo as Pt, Fragment as ti } from "react";
|
|
3
3
|
import { a3 as Yr, f as ws, E as ke, a4 as Gr, a5 as Jr, O as bs, a6 as ve, a7 as qr, U as ei, Q as ys, x as Ie, F as Oe, T as ni, A as Xr, v as Zr, a8 as Qr, a9 as to } from "./index-nFjllrEl.js";
|
|
4
4
|
import { f as xs, s as Ss, o as ks, a as vs, b as Cs, d as _s, h as Es, i as Ts, c as ii } from "./floating-ui.dom-U1vPFQ5f.js";
|
|
5
5
|
import { Plugin as Ce, PluginKey as te, NodeSelection as eo, TextSelection as no, SelectionRange as io, Selection as so } from "@tiptap/pm/state";
|
|
6
|
-
import { C as ro, T as oo } from "./Table-
|
|
6
|
+
import { C as ro, T as oo } from "./Table-BshvoFRh.js";
|
|
7
7
|
import { createPortal as Ds } from "react-dom";
|
|
8
|
-
import { A as y } from "./toggle-
|
|
8
|
+
import { A as y } from "./toggle-WBgzE8Jm.js";
|
|
9
9
|
import { MultipleColumnNode as _i } from "./Column.js";
|
|
10
|
-
import { u as X, p as je, V as Ei } from "./index-
|
|
11
|
-
import { c as Y, d as As } from "./useButtonProps
|
|
12
|
-
import { b as Z } from "./index
|
|
10
|
+
import { u as X, p as je, V as Ei } from "./index-DGihe-wH.js";
|
|
11
|
+
import { c as Y, d as As } from "./useButtonProps-BIOoOg6h.js";
|
|
12
|
+
import { b as Z } from "./index--XZPCi0O.js";
|
|
13
13
|
import { d as _e } from "./delete-node-IyVmiRbI.js";
|
|
14
|
-
import { C as lo, D as kn } from "./Drawer-
|
|
14
|
+
import { C as lo, D as kn } from "./Drawer-GRyIh2y1.js";
|
|
15
15
|
import { Editor as co, makeDropdownToolbar as ao } from "easydrawer";
|
|
16
16
|
import { s as Is, i as Os } from "./shortId-WJVkrvml.js";
|
|
17
|
-
import { D as on, a as ln, b as cn, c as an, d as hn, e as ho } from "./dialog-
|
|
17
|
+
import { D as on, a as ln, b as cn, c as an, d as hn, e as ho } from "./dialog-CzZSyyxS.js";
|
|
18
18
|
import { d as Ms } from "./file-BLas99n7.js";
|
|
19
|
-
import { B as Jt } from "./button-
|
|
20
|
-
import { u as ee, K as Ke } from "./Katex-
|
|
21
|
-
import { S as Nt } from "./separator-
|
|
22
|
-
import { L as vn } from "./label-
|
|
23
|
-
import { P as uo, a as fo, b as po } from "./popover-
|
|
24
|
-
import { I as Be } from "./input-
|
|
25
|
-
import { E as oe, t as go } from "./Excalidraw-
|
|
26
|
-
import { I as le, g as mo } from "./Iframe-
|
|
19
|
+
import { B as Jt } from "./button-BnN1L5_T.js";
|
|
20
|
+
import { u as ee, K as Ke } from "./Katex-n2PVzaMd.js";
|
|
21
|
+
import { S as Nt } from "./separator-Y_Pbpi-5.js";
|
|
22
|
+
import { L as vn } from "./label-BX7OqM6p.js";
|
|
23
|
+
import { P as uo, a as fo, b as po } from "./popover-CheVmqgb.js";
|
|
24
|
+
import { I as Be } from "./input-Byg4PPou.js";
|
|
25
|
+
import { E as oe, t as go } from "./Excalidraw-BmyhdJCU.js";
|
|
26
|
+
import { I as le, g as mo } from "./Iframe-AiP8qPGF.js";
|
|
27
27
|
import wo from "katex";
|
|
28
28
|
import { Pencil as bo, Trash2 as yo } from "lucide-react";
|
|
29
|
-
import { T as Rs } from "./textarea
|
|
30
|
-
import { L as Ti, a as xo, R as So } from "./LinkEditBlock-
|
|
29
|
+
import { T as Rs } from "./textarea-Byts1Pn0.js";
|
|
30
|
+
import { L as Ti, a as xo, R as So } from "./LinkEditBlock-CoXwYHlj.js";
|
|
31
31
|
import { Image as ko } from "./Image.js";
|
|
32
32
|
import { ImageGif as vo } from "./ImageGif.js";
|
|
33
33
|
import { Video as Co } from "./Video.js";
|
|
@@ -41,13 +41,13 @@ import { RichTextItalic as Ao } from "./Italic.js";
|
|
|
41
41
|
import { RichTextStrike as Io } from "./Strike.js";
|
|
42
42
|
import { RichTextAlign as Oo, TextAlign as Mo } from "./TextAlign.js";
|
|
43
43
|
import { RichTextUnderline as Di } from "./TextUnderline.js";
|
|
44
|
-
import { T as Ai, F as Ro } from "./Twitter-
|
|
44
|
+
import { T as Ai, F as Ro } from "./Twitter-CLVet4OM.js";
|
|
45
45
|
import { DecorationSet as Ii, Decoration as No } from "@tiptap/pm/view";
|
|
46
46
|
import { NodeRange as Uo } from "@tiptap/pm/model";
|
|
47
47
|
import { Clear as Lo } from "./Clear.js";
|
|
48
|
-
import { I as Po, a as Oi, s as Mi } from "./Indent-
|
|
49
|
-
import { D as Bo, a as Vo, b as Ho, f as mt, d as $o, g as Ri, h as Ni, i as Ui, j as Li } from "./dropdown-menu-
|
|
50
|
-
import { I as rt } from "./Icon-
|
|
48
|
+
import { I as Po, a as Oi, s as Mi } from "./Indent-CBoQDISv.js";
|
|
49
|
+
import { D as Bo, a as Vo, b as Ho, f as mt, d as $o, g as Ri, h as Ni, i as Ui, j as Li } from "./dropdown-menu-y1rPk4dr.js";
|
|
50
|
+
import { I as rt } from "./Icon-1z7VnLgz.js";
|
|
51
51
|
function Fo(e, t) {
|
|
52
52
|
const n = Math.min(e.top, t.top), i = Math.max(e.bottom, t.bottom), s = Math.min(e.left, t.left), o = Math.max(e.right, t.right) - s, l = i - n, c = s, a = n;
|
|
53
53
|
return new DOMRect(c, a, o, l);
|
|
@@ -79,9 +79,9 @@ var zo = class {
|
|
|
79
79
|
onHide: void 0,
|
|
80
80
|
onUpdate: void 0,
|
|
81
81
|
onDestroy: void 0
|
|
82
|
-
}, this.shouldShow = ({ view:
|
|
83
|
-
const { doc: g, selection: m } =
|
|
84
|
-
return !(!(
|
|
82
|
+
}, this.shouldShow = ({ view: d, state: h, from: u, to: f }) => {
|
|
83
|
+
const { doc: g, selection: m } = h, { empty: b } = m, w = !g.textBetween(u, f).length && Yr(h.selection), D = this.element.contains(document.activeElement);
|
|
84
|
+
return !(!(d.hasFocus() || D) || b || w || !this.editor.isEditable);
|
|
85
85
|
}, this.mousedownHandler = () => {
|
|
86
86
|
this.preventHide = !0;
|
|
87
87
|
}, this.dragstartHandler = () => {
|
|
@@ -92,8 +92,8 @@ var zo = class {
|
|
|
92
92
|
}, this.resizeDelay);
|
|
93
93
|
}, this.focusHandler = () => {
|
|
94
94
|
setTimeout(() => this.update(this.editor.view));
|
|
95
|
-
}, this.blurHandler = ({ event:
|
|
96
|
-
var
|
|
95
|
+
}, this.blurHandler = ({ event: d }) => {
|
|
96
|
+
var h;
|
|
97
97
|
if (this.editor.isDestroyed) {
|
|
98
98
|
this.destroy();
|
|
99
99
|
return;
|
|
@@ -102,23 +102,23 @@ var zo = class {
|
|
|
102
102
|
this.preventHide = !1;
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
}, this.handleDebouncedUpdate = (
|
|
107
|
-
const u = !(
|
|
105
|
+
d != null && d.relatedTarget && ((h = this.element.parentNode) != null && h.contains(d.relatedTarget)) || (d == null ? void 0 : d.relatedTarget) !== this.editor.view.dom && this.hide();
|
|
106
|
+
}, this.handleDebouncedUpdate = (d, h) => {
|
|
107
|
+
const u = !(h != null && h.selection.eq(d.state.selection)), f = !(h != null && h.doc.eq(d.state.doc));
|
|
108
108
|
!u && !f || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
|
|
109
|
-
this.updateHandler(
|
|
109
|
+
this.updateHandler(d, u, f, h);
|
|
110
110
|
}, this.updateDelay));
|
|
111
|
-
}, this.updateHandler = (
|
|
112
|
-
const { composing: g } =
|
|
113
|
-
if (g || !
|
|
111
|
+
}, this.updateHandler = (d, h, u, f) => {
|
|
112
|
+
const { composing: g } = d;
|
|
113
|
+
if (g || !h && !u)
|
|
114
114
|
return;
|
|
115
115
|
if (!this.getShouldShow(f)) {
|
|
116
116
|
this.hide();
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
this.updatePosition(), this.show();
|
|
120
|
-
}, this.transactionHandler = ({ transaction:
|
|
121
|
-
|
|
120
|
+
}, this.transactionHandler = ({ transaction: d }) => {
|
|
121
|
+
d.getMeta("bubbleMenu") === "updatePosition" && this.updatePosition();
|
|
122
122
|
};
|
|
123
123
|
var a;
|
|
124
124
|
this.editor = e, this.element = t, this.view = n, this.updateDelay = i, this.resizeDelay = s, this.appendTo = o, this.scrollTarget = (a = c == null ? void 0 : c.scrollTarget) != null ? a : window, this.getReferencedVirtualElement = l, this.floatingUIOptions = {
|
|
@@ -159,16 +159,16 @@ var zo = class {
|
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
if (t instanceof ro) {
|
|
162
|
-
const { $anchorCell: r, $headCell: o } = t, l = r ? r.pos : o.pos, c = o ? o.pos : r.pos, a = this.view.nodeDOM(l),
|
|
163
|
-
if (!a || !
|
|
162
|
+
const { $anchorCell: r, $headCell: o } = t, l = r ? r.pos : o.pos, c = o ? o.pos : r.pos, a = this.view.nodeDOM(l), d = this.view.nodeDOM(c);
|
|
163
|
+
if (!a || !d)
|
|
164
164
|
return;
|
|
165
|
-
const
|
|
165
|
+
const h = a === d ? a.getBoundingClientRect() : Fo(
|
|
166
166
|
a.getBoundingClientRect(),
|
|
167
|
-
|
|
167
|
+
d.getBoundingClientRect()
|
|
168
168
|
);
|
|
169
169
|
s = {
|
|
170
|
-
getBoundingClientRect: () =>
|
|
171
|
-
getClientRects: () => [
|
|
170
|
+
getBoundingClientRect: () => h,
|
|
171
|
+
getClientRects: () => [h]
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
return s;
|
|
@@ -252,8 +252,8 @@ ke.create({
|
|
|
252
252
|
var Wo = class {
|
|
253
253
|
constructor({ editor: e, element: t, view: n, options: i, appendTo: s, shouldShow: r }) {
|
|
254
254
|
this.preventHide = !1, this.isVisible = !1, this.shouldShow = ({ view: o, state: l }) => {
|
|
255
|
-
const { selection: c } = l, { $anchor: a, empty:
|
|
256
|
-
return !(!o.hasFocus() || !
|
|
255
|
+
const { selection: c } = l, { $anchor: a, empty: d } = c, h = a.depth === 1, u = a.parent.isTextblock && !a.parent.type.spec.code && !a.parent.textContent && a.parent.childCount === 0 && !this.getTextContent(a.parent);
|
|
256
|
+
return !(!o.hasFocus() || !d || !h || !u || !this.editor.isEditable);
|
|
257
257
|
}, this.floatingUIOptions = {
|
|
258
258
|
strategy: "absolute",
|
|
259
259
|
placement: "right",
|
|
@@ -266,8 +266,8 @@ var Wo = class {
|
|
|
266
266
|
hide: !1,
|
|
267
267
|
inline: !1
|
|
268
268
|
}, this.updateHandler = (o, l, c, a) => {
|
|
269
|
-
const { composing:
|
|
270
|
-
if (
|
|
269
|
+
const { composing: d } = o;
|
|
270
|
+
if (d || !l && !c)
|
|
271
271
|
return;
|
|
272
272
|
if (!this.getShouldShow(a)) {
|
|
273
273
|
this.hide();
|
|
@@ -390,9 +390,9 @@ var tt = ms.forwardRef(
|
|
|
390
390
|
options: l,
|
|
391
391
|
children: c,
|
|
392
392
|
...a
|
|
393
|
-
},
|
|
394
|
-
const
|
|
395
|
-
typeof
|
|
393
|
+
}, d) => {
|
|
394
|
+
const h = Lt(document.createElement("div"));
|
|
395
|
+
typeof d == "function" ? d(h.current) : d && (d.current = h.current);
|
|
396
396
|
const { editor: u } = bs(), f = t || u, g = {
|
|
397
397
|
updateDelay: n,
|
|
398
398
|
resizeDelay: i,
|
|
@@ -409,21 +409,21 @@ var tt = ms.forwardRef(
|
|
|
409
409
|
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
410
410
|
return;
|
|
411
411
|
}
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
const
|
|
412
|
+
const b = h.current;
|
|
413
|
+
b.style.visibility = "hidden", b.style.position = "absolute";
|
|
414
|
+
const w = Ns({
|
|
415
415
|
...m.current,
|
|
416
416
|
editor: f,
|
|
417
|
-
element:
|
|
417
|
+
element: b
|
|
418
418
|
});
|
|
419
|
-
f.registerPlugin(
|
|
420
|
-
const
|
|
419
|
+
f.registerPlugin(w);
|
|
420
|
+
const D = m.current.pluginKey;
|
|
421
421
|
return () => {
|
|
422
|
-
f.unregisterPlugin(
|
|
423
|
-
|
|
422
|
+
f.unregisterPlugin(D), window.requestAnimationFrame(() => {
|
|
423
|
+
b.parentNode && b.parentNode.removeChild(b);
|
|
424
424
|
});
|
|
425
425
|
};
|
|
426
|
-
}, [f]), Ds(/* @__PURE__ */ p("div", { ...a, children: c }),
|
|
426
|
+
}, [f]), Ds(/* @__PURE__ */ p("div", { ...a, children: c }), h.current);
|
|
427
427
|
}
|
|
428
428
|
);
|
|
429
429
|
ms.forwardRef(
|
|
@@ -432,34 +432,34 @@ ms.forwardRef(
|
|
|
432
432
|
typeof l == "function" ? l(c.current) : l && (l.current = c.current);
|
|
433
433
|
const { editor: a } = bs();
|
|
434
434
|
return st(() => {
|
|
435
|
-
const
|
|
436
|
-
if (
|
|
435
|
+
const d = c.current;
|
|
436
|
+
if (d.style.visibility = "hidden", d.style.position = "absolute", t != null && t.isDestroyed || a != null && a.isDestroyed)
|
|
437
437
|
return;
|
|
438
|
-
const
|
|
439
|
-
if (!
|
|
438
|
+
const h = t || a;
|
|
439
|
+
if (!h) {
|
|
440
440
|
console.warn(
|
|
441
441
|
"FloatingMenu component is not rendered inside of an editor component or does not have editor prop."
|
|
442
442
|
);
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
445
445
|
const u = Us({
|
|
446
|
-
editor:
|
|
447
|
-
element:
|
|
446
|
+
editor: h,
|
|
447
|
+
element: d,
|
|
448
448
|
pluginKey: e,
|
|
449
449
|
appendTo: n,
|
|
450
450
|
shouldShow: i,
|
|
451
451
|
options: s
|
|
452
452
|
});
|
|
453
|
-
return
|
|
454
|
-
|
|
455
|
-
|
|
453
|
+
return h.registerPlugin(u), () => {
|
|
454
|
+
h.unregisterPlugin(e), window.requestAnimationFrame(() => {
|
|
455
|
+
d.parentNode && d.parentNode.removeChild(d);
|
|
456
456
|
});
|
|
457
457
|
};
|
|
458
458
|
}, [t, a, n, e, i, s]), Ds(/* @__PURE__ */ p("div", { ...o, children: r }), c.current);
|
|
459
459
|
}
|
|
460
460
|
);
|
|
461
|
-
function
|
|
462
|
-
const e = Z(), t = Y(), { t: n } = X(), i =
|
|
461
|
+
function zd() {
|
|
462
|
+
const e = Z(), t = Y(), { t: n } = X(), i = L(() => t.isActive(_i.name), [t]), s = L(() => _e(_i.name, t), [t]), r = L(() => t.chain().focus().addColBefore().run(), [t]), o = L(() => t.chain().focus().addColAfter().run(), [t]), l = L(() => t.chain().focus().deleteCol().run(), [t]);
|
|
463
463
|
return e ? /* @__PURE__ */ p(
|
|
464
464
|
tt,
|
|
465
465
|
{
|
|
@@ -501,7 +501,7 @@ function Wd() {
|
|
|
501
501
|
)
|
|
502
502
|
] })
|
|
503
503
|
}
|
|
504
|
-
) : /* @__PURE__ */ p(
|
|
504
|
+
) : /* @__PURE__ */ p(M, {});
|
|
505
505
|
}
|
|
506
506
|
function jo(e, t) {
|
|
507
507
|
const n = ["size-small", "size-medium", "size-large"], i = [
|
|
@@ -799,7 +799,7 @@ function il(e, t) {
|
|
|
799
799
|
}
|
|
800
800
|
let ce = !1;
|
|
801
801
|
function sl({ editor: e, attrs: t, extension: n }) {
|
|
802
|
-
const [i, s] = z(!1), r = Lt(null), o = Lt(null), { alt: l, align: c } = t, a = n == null ? void 0 : n.options.upload,
|
|
802
|
+
const [i, s] = z(!1), r = Lt(null), o = Lt(null), { alt: l, align: c } = t, a = n == null ? void 0 : n.options.upload, d = () => {
|
|
803
803
|
(async () => {
|
|
804
804
|
const x = document.querySelector("#easydrawer");
|
|
805
805
|
x && (r.current = new co(x, {
|
|
@@ -810,21 +810,21 @@ function sl({ editor: e, attrs: t, extension: n }) {
|
|
|
810
810
|
};
|
|
811
811
|
st(() => {
|
|
812
812
|
i && setTimeout(() => {
|
|
813
|
-
|
|
813
|
+
d();
|
|
814
814
|
}, 200);
|
|
815
815
|
}, [i]);
|
|
816
|
-
const
|
|
816
|
+
const h = async () => {
|
|
817
817
|
if (r.current) {
|
|
818
818
|
const E = r.current.toSVG(), x = E.outerHTML, k = `drawer-${Is()}.svg`;
|
|
819
|
-
let
|
|
819
|
+
let N = Os(E.outerHTML);
|
|
820
820
|
if (a) {
|
|
821
|
-
const H = Ms(
|
|
822
|
-
|
|
821
|
+
const H = Ms(N, k);
|
|
822
|
+
N = await a(H);
|
|
823
823
|
}
|
|
824
824
|
e == null || e.chain().focus().setDrawer(
|
|
825
825
|
{
|
|
826
826
|
type: "drawer",
|
|
827
|
-
src:
|
|
827
|
+
src: N,
|
|
828
828
|
alt: encodeURIComponent(x),
|
|
829
829
|
width: 426,
|
|
830
830
|
height: 212
|
|
@@ -845,13 +845,13 @@ function sl({ editor: e, attrs: t, extension: n }) {
|
|
|
845
845
|
}, m = (E) => {
|
|
846
846
|
const x = o.current.getWidgetById("shape");
|
|
847
847
|
x && x.setShapeType(E);
|
|
848
|
-
},
|
|
848
|
+
}, b = (E) => {
|
|
849
849
|
const x = r.current.toolController.getPrimaryTools()[5], k = o.current.getWidgetById("shape");
|
|
850
850
|
x && k && (x.setColor(E), k.serializeState());
|
|
851
|
-
},
|
|
851
|
+
}, w = (E) => {
|
|
852
852
|
const x = r.current.toolController.getPrimaryTools()[5], k = o.current.getWidgetById("shape");
|
|
853
853
|
x && k && (x.setThickness(E), k.serializeState());
|
|
854
|
-
},
|
|
854
|
+
}, D = (E) => {
|
|
855
855
|
const x = r.current.toolController.getPrimaryTools()[5], k = o.current.getWidgetById("shape");
|
|
856
856
|
x && k && (x.setBorderColor(E), k.serializeState());
|
|
857
857
|
}, A = () => {
|
|
@@ -890,8 +890,8 @@ function sl({ editor: e, attrs: t, extension: n }) {
|
|
|
890
890
|
/* @__PURE__ */ p(
|
|
891
891
|
lo,
|
|
892
892
|
{
|
|
893
|
-
changeBorderColorShape:
|
|
894
|
-
changeColorShape:
|
|
893
|
+
changeBorderColorShape: D,
|
|
894
|
+
changeColorShape: b,
|
|
895
895
|
changeShape: m,
|
|
896
896
|
onClear: () => {
|
|
897
897
|
if (!ce) {
|
|
@@ -903,7 +903,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
|
|
|
903
903
|
onRedo: () => {
|
|
904
904
|
ce || r.current.history.redo();
|
|
905
905
|
},
|
|
906
|
-
onThicknessChange:
|
|
906
|
+
onThicknessChange: w,
|
|
907
907
|
onUndo: A,
|
|
908
908
|
refEditor: r,
|
|
909
909
|
setColorHighlight: g,
|
|
@@ -915,7 +915,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
|
|
|
915
915
|
/* @__PURE__ */ p(hn, { children: /* @__PURE__ */ p(
|
|
916
916
|
Jt,
|
|
917
917
|
{
|
|
918
|
-
onClick:
|
|
918
|
+
onClick: h,
|
|
919
919
|
type: "button",
|
|
920
920
|
children: "Save changes"
|
|
921
921
|
}
|
|
@@ -941,13 +941,13 @@ function rl({ item: e, disabled: t, editor: n }) {
|
|
|
941
941
|
disabled: t || ((s = e == null ? void 0 : e.componentProps) == null ? void 0 : s.disabled),
|
|
942
942
|
editor: n
|
|
943
943
|
}
|
|
944
|
-
) }) : /* @__PURE__ */ p(
|
|
944
|
+
) }) : /* @__PURE__ */ p(M, {});
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function Wd() {
|
|
947
947
|
const { lang: e, t } = X(), n = Z(), i = Y(), s = ee(i, kn.name), r = As(kn.name), o = ({ editor: c }) => {
|
|
948
|
-
const { selection: a } = c.view.state, { $from:
|
|
948
|
+
const { selection: a } = c.view.state, { $from: d, to: h } = a;
|
|
949
949
|
let u = !1;
|
|
950
|
-
return c.view.state.doc.nodesBetween(
|
|
950
|
+
return c.view.state.doc.nodesBetween(d.pos, h, (f) => {
|
|
951
951
|
if (f.type.name === kn.name)
|
|
952
952
|
return u = !0, !1;
|
|
953
953
|
}), u;
|
|
@@ -973,11 +973,11 @@ function jd() {
|
|
|
973
973
|
item: c
|
|
974
974
|
},
|
|
975
975
|
`bubbleMenu-drawer-${a}`
|
|
976
|
-
)) }) : /* @__PURE__ */ p(
|
|
976
|
+
)) }) : /* @__PURE__ */ p(M, {})
|
|
977
977
|
}
|
|
978
|
-
) : /* @__PURE__ */ p(
|
|
978
|
+
) : /* @__PURE__ */ p(M, {});
|
|
979
979
|
}
|
|
980
|
-
const
|
|
980
|
+
const Ls = ({ width: e, maxWidth: t, height: n, onOk: i, children: s }) => {
|
|
981
981
|
const { t: r } = X(), [o, l] = z({
|
|
982
982
|
width: "",
|
|
983
983
|
height: "",
|
|
@@ -995,42 +995,56 @@ const ol = { padding: "0 12px 12px" }, Ls = ({ width: e, maxWidth: t, height: n,
|
|
|
995
995
|
}
|
|
996
996
|
return /* @__PURE__ */ S(uo, { modal: !0, children: [
|
|
997
997
|
/* @__PURE__ */ p(fo, { asChild: !0, children: s }),
|
|
998
|
-
/* @__PURE__ */ p(po, { children: /* @__PURE__ */
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
998
|
+
/* @__PURE__ */ p(po, { children: /* @__PURE__ */ S(
|
|
999
|
+
"form",
|
|
1000
|
+
{
|
|
1001
|
+
className: "richtext-flex richtext-flex-col richtext-gap-2",
|
|
1002
|
+
onSubmit: c,
|
|
1003
|
+
children: [
|
|
1004
|
+
/* @__PURE__ */ p(vn, { className: "mb-[6px]", children: "Width" }),
|
|
1005
|
+
/* @__PURE__ */ p("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ p("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ p(
|
|
1006
|
+
Be,
|
|
1007
|
+
{
|
|
1008
|
+
onChange: (a) => l({ ...o, width: a.target.value }),
|
|
1009
|
+
required: !0,
|
|
1010
|
+
type: "number",
|
|
1011
|
+
value: o.width
|
|
1012
|
+
}
|
|
1013
|
+
) }) }),
|
|
1014
|
+
/* @__PURE__ */ p(vn, { className: "mb-[6px]", children: "Max Width" }),
|
|
1015
|
+
/* @__PURE__ */ p("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ p("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ p(
|
|
1016
|
+
Be,
|
|
1017
|
+
{
|
|
1018
|
+
onChange: (a) => l({ ...o, maxWidth: a.target.value }),
|
|
1019
|
+
required: !0,
|
|
1020
|
+
type: "number",
|
|
1021
|
+
value: o.maxWidth
|
|
1022
|
+
}
|
|
1023
|
+
) }) }),
|
|
1024
|
+
/* @__PURE__ */ p(vn, { className: "mb-[6px]", children: "Height" }),
|
|
1025
|
+
/* @__PURE__ */ p("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ p("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ p(
|
|
1026
|
+
Be,
|
|
1027
|
+
{
|
|
1028
|
+
onChange: (a) => l({ ...o, height: a.target.value }),
|
|
1029
|
+
required: !0,
|
|
1030
|
+
type: "number",
|
|
1031
|
+
value: o.height
|
|
1032
|
+
}
|
|
1033
|
+
) }) }),
|
|
1034
|
+
/* @__PURE__ */ p(
|
|
1035
|
+
Jt,
|
|
1036
|
+
{
|
|
1037
|
+
className: "richtext-mt-2 richtext-self-end",
|
|
1038
|
+
type: "submit",
|
|
1039
|
+
children: r("editor.link.dialog.button.apply")
|
|
1040
|
+
}
|
|
1041
|
+
)
|
|
1042
|
+
]
|
|
1043
|
+
}
|
|
1044
|
+
) })
|
|
1031
1045
|
] });
|
|
1032
1046
|
}, Mt = /* @__PURE__ */ new Map();
|
|
1033
|
-
function
|
|
1047
|
+
function ol(e) {
|
|
1034
1048
|
const t = e.options.element;
|
|
1035
1049
|
Mt.has("width") || Mt.set("width", t.clientWidth), Mt.has("width") && Mt.get("width") <= 0 && Mt.set("width", t.clientWidth);
|
|
1036
1050
|
const n = { attributes: !0, childList: !0, subtree: !0 }, i = function() {
|
|
@@ -1040,33 +1054,33 @@ function ll(e) {
|
|
|
1040
1054
|
s.disconnect();
|
|
1041
1055
|
}), { width: Mt.get("width") };
|
|
1042
1056
|
}
|
|
1043
|
-
function
|
|
1044
|
-
const e = Z(), t = Y(), { t: n } = X(), { width: i } =
|
|
1057
|
+
function jd() {
|
|
1058
|
+
const e = Z(), t = Y(), { t: n } = X(), { width: i } = ol(t), s = ee(t, oe.name, {
|
|
1045
1059
|
defaultShowPicker: !1,
|
|
1046
1060
|
createUser: "",
|
|
1047
1061
|
width: 0,
|
|
1048
1062
|
height: 0
|
|
1049
|
-
}), { defaultShowPicker: r, createUser: o, width: l, height: c } = s, a =
|
|
1063
|
+
}), { defaultShowPicker: r, createUser: o, width: l, height: c } = s, a = L(
|
|
1050
1064
|
(f) => {
|
|
1051
1065
|
t.chain().updateAttributes(oe.name, f).setNodeSelection(t.state.selection.from).focus().run();
|
|
1052
1066
|
},
|
|
1053
1067
|
[t]
|
|
1054
|
-
),
|
|
1068
|
+
), d = L(() => {
|
|
1055
1069
|
go({ ...s, editor: t });
|
|
1056
|
-
}, [t, s]),
|
|
1070
|
+
}, [t, s]), h = L(() => t.isActive(oe.name), [t]), u = L(() => _e(oe.name, t), [t]);
|
|
1057
1071
|
return st(() => {
|
|
1058
|
-
r && (
|
|
1059
|
-
}, [o, r, t,
|
|
1072
|
+
r && (d(), t.chain().updateAttributes(oe.name, { defaultShowPicker: !1 }).focus().run());
|
|
1073
|
+
}, [o, r, t, d]), e ? /* @__PURE__ */ p(
|
|
1060
1074
|
tt,
|
|
1061
1075
|
{
|
|
1062
1076
|
editor: t,
|
|
1063
1077
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1064
|
-
shouldShow:
|
|
1078
|
+
shouldShow: h,
|
|
1065
1079
|
children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
|
|
1066
1080
|
/* @__PURE__ */ p(
|
|
1067
1081
|
y,
|
|
1068
1082
|
{
|
|
1069
|
-
action:
|
|
1083
|
+
action: d,
|
|
1070
1084
|
icon: "Pencil",
|
|
1071
1085
|
tooltip: n("editor.edit")
|
|
1072
1086
|
}
|
|
@@ -1097,36 +1111,39 @@ function Kd() {
|
|
|
1097
1111
|
)
|
|
1098
1112
|
] })
|
|
1099
1113
|
}
|
|
1100
|
-
) : /* @__PURE__ */ p(
|
|
1114
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1101
1115
|
}
|
|
1102
|
-
function
|
|
1116
|
+
function Kd() {
|
|
1103
1117
|
const e = Z(), t = Y(), { t: n } = X(), { width: i, height: s, src: r } = ee(t, le.name, {
|
|
1104
1118
|
width: 0,
|
|
1105
1119
|
height: 0,
|
|
1106
1120
|
src: "",
|
|
1107
1121
|
defaultShowPicker: !1
|
|
1108
|
-
}), [o, l] = z(!1), [c, a] = z(""),
|
|
1109
|
-
|
|
1122
|
+
}), [o, l] = z(!1), [c, a] = z(""), d = L((w) => {
|
|
1123
|
+
var D;
|
|
1124
|
+
(D = w == null ? void 0 : w.preventDefault) == null || D.call(w), l(!1);
|
|
1110
1125
|
}, [l]);
|
|
1111
1126
|
st(() => {
|
|
1112
1127
|
o && a(r);
|
|
1113
1128
|
}, [o, r]);
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1129
|
+
const h = L((w) => {
|
|
1130
|
+
var A;
|
|
1131
|
+
(A = w == null ? void 0 : w.preventDefault) == null || A.call(w);
|
|
1132
|
+
const D = mo(c);
|
|
1116
1133
|
t.chain().updateAttributes(le.name, {
|
|
1117
|
-
src: (
|
|
1134
|
+
src: (D == null ? void 0 : D.src) || c
|
|
1118
1135
|
}).setNodeSelection(t.state.selection.from).focus().run(), l(!1);
|
|
1119
|
-
}, [t, c, l]), u =
|
|
1136
|
+
}, [t, c, l]), u = L(() => {
|
|
1120
1137
|
window.open(r, "_blank");
|
|
1121
|
-
}, [r]), f =
|
|
1138
|
+
}, [r]), f = L(() => {
|
|
1122
1139
|
l(!0);
|
|
1123
|
-
}, [l]), g =
|
|
1124
|
-
(
|
|
1125
|
-
t.chain().updateAttributes(le.name,
|
|
1140
|
+
}, [l]), g = L(
|
|
1141
|
+
(w) => {
|
|
1142
|
+
t.chain().updateAttributes(le.name, w).setNodeSelection(t.state.selection.from).focus().run();
|
|
1126
1143
|
},
|
|
1127
1144
|
[t]
|
|
1128
|
-
), m =
|
|
1129
|
-
return e ? /* @__PURE__ */ S(
|
|
1145
|
+
), m = L(() => t.isActive(le.name) && !r, [t, r]), b = L(() => _e(le.name, t), [t]);
|
|
1146
|
+
return e ? /* @__PURE__ */ S(M, { children: [
|
|
1130
1147
|
/* @__PURE__ */ p(
|
|
1131
1148
|
tt,
|
|
1132
1149
|
{
|
|
@@ -1168,7 +1185,7 @@ function Yd() {
|
|
|
1168
1185
|
/* @__PURE__ */ p(
|
|
1169
1186
|
y,
|
|
1170
1187
|
{
|
|
1171
|
-
action:
|
|
1188
|
+
action: b,
|
|
1172
1189
|
icon: "Trash2",
|
|
1173
1190
|
tooltip: n("editor.delete")
|
|
1174
1191
|
}
|
|
@@ -1189,23 +1206,37 @@ function Yd() {
|
|
|
1189
1206
|
Be,
|
|
1190
1207
|
{
|
|
1191
1208
|
autoFocus: !0,
|
|
1192
|
-
onInput: (
|
|
1209
|
+
onInput: (w) => a(w.target.value),
|
|
1193
1210
|
placeholder: "Enter link",
|
|
1194
1211
|
type: "url",
|
|
1195
1212
|
value: c
|
|
1196
1213
|
}
|
|
1197
1214
|
),
|
|
1198
1215
|
/* @__PURE__ */ S(hn, { children: [
|
|
1199
|
-
/* @__PURE__ */ p(
|
|
1200
|
-
|
|
1216
|
+
/* @__PURE__ */ p(
|
|
1217
|
+
Jt,
|
|
1218
|
+
{
|
|
1219
|
+
onClick: d,
|
|
1220
|
+
type: "button",
|
|
1221
|
+
children: "Cancel"
|
|
1222
|
+
}
|
|
1223
|
+
),
|
|
1224
|
+
/* @__PURE__ */ p(
|
|
1225
|
+
Jt,
|
|
1226
|
+
{
|
|
1227
|
+
onClick: h,
|
|
1228
|
+
type: "button",
|
|
1229
|
+
children: "OK"
|
|
1230
|
+
}
|
|
1231
|
+
)
|
|
1201
1232
|
] })
|
|
1202
1233
|
] })
|
|
1203
1234
|
]
|
|
1204
1235
|
}
|
|
1205
1236
|
)
|
|
1206
|
-
] }) : /* @__PURE__ */ p(
|
|
1237
|
+
] }) : /* @__PURE__ */ p(M, {});
|
|
1207
1238
|
}
|
|
1208
|
-
function
|
|
1239
|
+
function ll({
|
|
1209
1240
|
children: e,
|
|
1210
1241
|
visible: t,
|
|
1211
1242
|
toggleVisible: n
|
|
@@ -1219,17 +1250,17 @@ function cl({
|
|
|
1219
1250
|
}, [t]), st(() => {
|
|
1220
1251
|
l && (n(!0), s.chain().updateAttributes(Ke.name, { defaultShowPicker: !1 }).focus().run());
|
|
1221
1252
|
}, [s, l, n]);
|
|
1222
|
-
const
|
|
1253
|
+
const d = L(() => {
|
|
1223
1254
|
s.chain().focus().setKatex({ text: c }).run(), a(""), n(!1);
|
|
1224
|
-
}, [s, c, n]),
|
|
1255
|
+
}, [s, c, n]), h = Pt(() => {
|
|
1225
1256
|
try {
|
|
1226
1257
|
return wo.renderToString(`${c}`);
|
|
1227
1258
|
} catch {
|
|
1228
1259
|
return c;
|
|
1229
1260
|
}
|
|
1230
1261
|
}, [c]), u = Pt(
|
|
1231
|
-
() => `${c}`.trim() ?
|
|
1232
|
-
[c,
|
|
1262
|
+
() => `${c}`.trim() ? h : null,
|
|
1263
|
+
[c, h]
|
|
1233
1264
|
);
|
|
1234
1265
|
return /* @__PURE__ */ S(
|
|
1235
1266
|
on,
|
|
@@ -1280,7 +1311,7 @@ function cl({
|
|
|
1280
1311
|
/* @__PURE__ */ p(hn, { children: /* @__PURE__ */ p(
|
|
1281
1312
|
Jt,
|
|
1282
1313
|
{
|
|
1283
|
-
onClick:
|
|
1314
|
+
onClick: d,
|
|
1284
1315
|
type: "button",
|
|
1285
1316
|
children: "Save changes"
|
|
1286
1317
|
}
|
|
@@ -1290,8 +1321,8 @@ function cl({
|
|
|
1290
1321
|
}
|
|
1291
1322
|
);
|
|
1292
1323
|
}
|
|
1293
|
-
function
|
|
1294
|
-
const e = Z(), t = Y(), [n, i] = z(!1), s =
|
|
1324
|
+
function Yd() {
|
|
1325
|
+
const e = Z(), t = Y(), [n, i] = z(!1), s = L(() => t.isActive(Ke.name), [t]), r = L(() => _e(Ke.name, t), [t]);
|
|
1295
1326
|
return e ? /* @__PURE__ */ p(
|
|
1296
1327
|
tt,
|
|
1297
1328
|
{
|
|
@@ -1300,7 +1331,7 @@ function Gd() {
|
|
|
1300
1331
|
shouldShow: s,
|
|
1301
1332
|
children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
|
|
1302
1333
|
/* @__PURE__ */ p(
|
|
1303
|
-
|
|
1334
|
+
ll,
|
|
1304
1335
|
{
|
|
1305
1336
|
toggleVisible: i,
|
|
1306
1337
|
visible: n,
|
|
@@ -1324,11 +1355,11 @@ function Gd() {
|
|
|
1324
1355
|
)
|
|
1325
1356
|
] })
|
|
1326
1357
|
}
|
|
1327
|
-
) : /* @__PURE__ */ p(
|
|
1358
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1328
1359
|
}
|
|
1329
|
-
function
|
|
1360
|
+
function cl(e) {
|
|
1330
1361
|
const { t } = X();
|
|
1331
|
-
return /* @__PURE__ */
|
|
1362
|
+
return /* @__PURE__ */ S("div", { className: "richtext-flex richtext-flex-nowrap", children: [
|
|
1332
1363
|
/* @__PURE__ */ p(
|
|
1333
1364
|
y,
|
|
1334
1365
|
{
|
|
@@ -1363,11 +1394,11 @@ function al(e) {
|
|
|
1363
1394
|
}
|
|
1364
1395
|
}
|
|
1365
1396
|
)
|
|
1366
|
-
] })
|
|
1397
|
+
] });
|
|
1367
1398
|
}
|
|
1368
|
-
function
|
|
1369
|
-
const e = Z(), t = Y(), [n, i] = z(!1), s = ee(t, Ti.name), r = s == null ? void 0 : s.href, o =
|
|
1370
|
-
const
|
|
1399
|
+
function Gd() {
|
|
1400
|
+
const e = Z(), t = Y(), [n, i] = z(!1), s = ee(t, Ti.name), r = s == null ? void 0 : s.href, o = L(({ editor: d }) => d.isActive(Ti.name), []), l = (d, h, u) => {
|
|
1401
|
+
const f = t.state.selection, { from: g } = f, m = (h == null ? void 0 : h.length) ?? 0, b = g + m;
|
|
1371
1402
|
t.chain().extendMarkRange("link").insertContent({
|
|
1372
1403
|
type: "text",
|
|
1373
1404
|
text: h,
|
|
@@ -1375,40 +1406,55 @@ function Jd() {
|
|
|
1375
1406
|
{
|
|
1376
1407
|
type: "link",
|
|
1377
1408
|
attrs: {
|
|
1378
|
-
href:
|
|
1379
|
-
target:
|
|
1409
|
+
href: d,
|
|
1410
|
+
target: u ? "_blank" : ""
|
|
1380
1411
|
}
|
|
1381
1412
|
}
|
|
1382
1413
|
]
|
|
1383
|
-
}).setLink({ href:
|
|
1384
|
-
}, c =
|
|
1414
|
+
}).setLink({ href: d }).setTextSelection({ from: g, to: b }).focus().run(), i(!1);
|
|
1415
|
+
}, c = L(() => {
|
|
1385
1416
|
t.chain().extendMarkRange("link").unsetLink().focus().run(), i(!1);
|
|
1386
|
-
}, [t])
|
|
1417
|
+
}, [t]), a = () => {
|
|
1418
|
+
i(!1);
|
|
1419
|
+
};
|
|
1387
1420
|
return e ? /* @__PURE__ */ p(
|
|
1388
1421
|
tt,
|
|
1389
1422
|
{
|
|
1390
1423
|
editor: t,
|
|
1391
1424
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1392
1425
|
shouldShow: o,
|
|
1393
|
-
children: /* @__PURE__ */ p(
|
|
1394
|
-
|
|
1426
|
+
children: /* @__PURE__ */ p(M, { children: n ? /* @__PURE__ */ p(
|
|
1427
|
+
"div",
|
|
1395
1428
|
{
|
|
1396
|
-
|
|
1397
|
-
|
|
1429
|
+
className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",
|
|
1430
|
+
children: /* @__PURE__ */ p(
|
|
1431
|
+
xo,
|
|
1432
|
+
{
|
|
1433
|
+
editor: t,
|
|
1434
|
+
onClose: a,
|
|
1435
|
+
onSetLink: l
|
|
1436
|
+
}
|
|
1437
|
+
)
|
|
1398
1438
|
}
|
|
1399
1439
|
) : /* @__PURE__ */ p(
|
|
1400
|
-
|
|
1440
|
+
"div",
|
|
1401
1441
|
{
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1442
|
+
className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",
|
|
1443
|
+
children: /* @__PURE__ */ p(
|
|
1444
|
+
cl,
|
|
1445
|
+
{
|
|
1446
|
+
editor: t,
|
|
1447
|
+
link: r,
|
|
1448
|
+
onClear: c,
|
|
1449
|
+
onEdit: () => {
|
|
1450
|
+
i(!0);
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
)
|
|
1408
1454
|
}
|
|
1409
1455
|
) })
|
|
1410
1456
|
}
|
|
1411
|
-
) : /* @__PURE__ */ p(
|
|
1457
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1412
1458
|
}
|
|
1413
1459
|
function si({ item: e, disabled: t, editor: n }) {
|
|
1414
1460
|
const i = e.component;
|
|
@@ -1425,25 +1471,25 @@ function si({ item: e, disabled: t, editor: n }) {
|
|
|
1425
1471
|
disabled: t || (e == null ? void 0 : e.componentdisabled),
|
|
1426
1472
|
editor: n
|
|
1427
1473
|
}
|
|
1428
|
-
) }) : /* @__PURE__ */ p(
|
|
1474
|
+
) }) : /* @__PURE__ */ p(M, {});
|
|
1429
1475
|
}
|
|
1430
|
-
function
|
|
1476
|
+
function al(e) {
|
|
1431
1477
|
return e.type.name === ko.name;
|
|
1432
1478
|
}
|
|
1433
|
-
function
|
|
1479
|
+
function hl(e) {
|
|
1434
1480
|
return e.type.name === vo.name;
|
|
1435
1481
|
}
|
|
1436
|
-
function
|
|
1482
|
+
function dl(e) {
|
|
1437
1483
|
return e.type.name === Co.name;
|
|
1438
1484
|
}
|
|
1439
|
-
function
|
|
1485
|
+
function Jd() {
|
|
1440
1486
|
const { lang: e, t } = X(), n = Z(), i = Y(), s = ({ editor: o }) => {
|
|
1441
1487
|
const { selection: l } = o.view.state, { $from: c, to: a } = l;
|
|
1442
|
-
let
|
|
1443
|
-
return o.view.state.doc.nodesBetween(c.pos, a, (
|
|
1444
|
-
if (
|
|
1445
|
-
return
|
|
1446
|
-
}),
|
|
1488
|
+
let d = !1;
|
|
1489
|
+
return o.view.state.doc.nodesBetween(c.pos, a, (h) => {
|
|
1490
|
+
if (al(h))
|
|
1491
|
+
return d = !0, !1;
|
|
1492
|
+
}), d;
|
|
1447
1493
|
}, r = Pt(() => Qo(i, t), [i, e, t]);
|
|
1448
1494
|
return n ? /* @__PURE__ */ p(
|
|
1449
1495
|
tt,
|
|
@@ -1458,18 +1504,18 @@ function qd() {
|
|
|
1458
1504
|
item: o
|
|
1459
1505
|
},
|
|
1460
1506
|
`bubbleMenu-image-${l}`
|
|
1461
|
-
)) }) : /* @__PURE__ */ p(
|
|
1507
|
+
)) }) : /* @__PURE__ */ p(M, {})
|
|
1462
1508
|
}
|
|
1463
|
-
) : /* @__PURE__ */ p(
|
|
1509
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1464
1510
|
}
|
|
1465
|
-
function
|
|
1511
|
+
function qd() {
|
|
1466
1512
|
const { lang: e, t } = X(), n = Z(), i = Y(), s = ({ editor: o }) => {
|
|
1467
1513
|
const { selection: l } = o.view.state, { $from: c, to: a } = l;
|
|
1468
|
-
let
|
|
1469
|
-
return o.view.state.doc.nodesBetween(c.pos, a, (
|
|
1470
|
-
if (
|
|
1471
|
-
return
|
|
1472
|
-
}),
|
|
1514
|
+
let d = !1;
|
|
1515
|
+
return o.view.state.doc.nodesBetween(c.pos, a, (h) => {
|
|
1516
|
+
if (hl(h))
|
|
1517
|
+
return d = !0, !1;
|
|
1518
|
+
}), d;
|
|
1473
1519
|
}, r = Pt(() => tl(i, t), [i, t, e]);
|
|
1474
1520
|
return n ? /* @__PURE__ */ p(
|
|
1475
1521
|
tt,
|
|
@@ -1484,16 +1530,16 @@ function Xd() {
|
|
|
1484
1530
|
item: o
|
|
1485
1531
|
},
|
|
1486
1532
|
`bubbleMenu-image-gif-${l}`
|
|
1487
|
-
)) }) : /* @__PURE__ */ p(
|
|
1533
|
+
)) }) : /* @__PURE__ */ p(M, {})
|
|
1488
1534
|
}
|
|
1489
|
-
) : /* @__PURE__ */ p(
|
|
1535
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1490
1536
|
}
|
|
1491
|
-
function
|
|
1537
|
+
function Xd() {
|
|
1492
1538
|
const { t: e } = X(), t = Z(), n = Y(), i = ({ editor: r }) => {
|
|
1493
1539
|
const { selection: o } = r.view.state, { $from: l, to: c } = o;
|
|
1494
1540
|
let a = !1;
|
|
1495
|
-
return r.view.state.doc.nodesBetween(l.pos, c, (
|
|
1496
|
-
if (
|
|
1541
|
+
return r.view.state.doc.nodesBetween(l.pos, c, (d) => {
|
|
1542
|
+
if (dl(d))
|
|
1497
1543
|
return a = !0, !1;
|
|
1498
1544
|
}), a;
|
|
1499
1545
|
}, s = Pt(() => il(n, e), [n, e]);
|
|
@@ -1510,49 +1556,49 @@ function Zd() {
|
|
|
1510
1556
|
item: r
|
|
1511
1557
|
},
|
|
1512
1558
|
`bubbleMenu-video-${o}`
|
|
1513
|
-
)) }) : /* @__PURE__ */ p(
|
|
1559
|
+
)) }) : /* @__PURE__ */ p(M, {})
|
|
1514
1560
|
}
|
|
1515
|
-
) : /* @__PURE__ */ p(
|
|
1561
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1516
1562
|
}
|
|
1517
1563
|
const Pi = `graph TB
|
|
1518
|
-
a-->b`,
|
|
1519
|
-
const { alt: i, align: s } = t, [r, o] = z(decodeURIComponent(i ?? Pi)), [l, c] = z(""), [a,
|
|
1564
|
+
a-->b`, ul = ({ editor: e, attrs: t, extension: n }) => {
|
|
1565
|
+
const { alt: i, align: s } = t, [r, o] = z(decodeURIComponent(i ?? Pi)), [l, c] = z(""), [a, d] = z(!1), h = Lt(null), [u, f] = z(null), g = n == null ? void 0 : n.options.upload, m = L(
|
|
1520
1566
|
(A) => {
|
|
1521
1567
|
A && import("mermaid").then((v) => {
|
|
1522
1568
|
f(v.default);
|
|
1523
1569
|
});
|
|
1524
1570
|
},
|
|
1525
1571
|
[]
|
|
1526
|
-
),
|
|
1572
|
+
), b = async (A) => {
|
|
1527
1573
|
try {
|
|
1528
1574
|
const { svg: v } = await u.render("mermaid-svg", A);
|
|
1529
1575
|
c(v);
|
|
1530
1576
|
} catch {
|
|
1531
1577
|
c("");
|
|
1532
1578
|
}
|
|
1533
|
-
},
|
|
1579
|
+
}, w = () => {
|
|
1534
1580
|
u.initialize({
|
|
1535
1581
|
darkMode: !1,
|
|
1536
1582
|
startOnLoad: !1,
|
|
1537
1583
|
// fontFamily:'',
|
|
1538
1584
|
fontSize: 12,
|
|
1539
1585
|
theme: "base"
|
|
1540
|
-
}),
|
|
1586
|
+
}), b(r);
|
|
1541
1587
|
};
|
|
1542
1588
|
return st(() => {
|
|
1543
|
-
u && a &&
|
|
1589
|
+
u && a && w();
|
|
1544
1590
|
}, [u, a]), st(() => {
|
|
1545
|
-
u && a &&
|
|
1591
|
+
u && a && b(r);
|
|
1546
1592
|
}, [u, r]), /* @__PURE__ */ S(
|
|
1547
1593
|
on,
|
|
1548
1594
|
{
|
|
1549
|
-
onOpenChange:
|
|
1595
|
+
onOpenChange: d,
|
|
1550
1596
|
open: a,
|
|
1551
1597
|
children: [
|
|
1552
1598
|
/* @__PURE__ */ p(ln, { asChild: !0, children: /* @__PURE__ */ p(
|
|
1553
1599
|
y,
|
|
1554
1600
|
{
|
|
1555
|
-
action: () =>
|
|
1601
|
+
action: () => d(!0),
|
|
1556
1602
|
icon: "Pencil",
|
|
1557
1603
|
tooltip: "Edit Mermaid"
|
|
1558
1604
|
}
|
|
@@ -1586,7 +1632,7 @@ a-->b`, fl = ({ editor: e, attrs: t, extension: n }) => {
|
|
|
1586
1632
|
{
|
|
1587
1633
|
className: "richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",
|
|
1588
1634
|
dangerouslySetInnerHTML: { __html: l },
|
|
1589
|
-
ref:
|
|
1635
|
+
ref: h,
|
|
1590
1636
|
style: { height: "100%", border: "1px solid hsl(var(--border))", minHeight: 500 }
|
|
1591
1637
|
}
|
|
1592
1638
|
)
|
|
@@ -1599,7 +1645,7 @@ a-->b`, fl = ({ editor: e, attrs: t, extension: n }) => {
|
|
|
1599
1645
|
onClick: async () => {
|
|
1600
1646
|
if (r !== "") {
|
|
1601
1647
|
if (r) {
|
|
1602
|
-
const A =
|
|
1648
|
+
const A = h.current.querySelector("svg"), { width: v, height: P } = A.getBoundingClientRect(), E = `mermaid-${Is()}.svg`;
|
|
1603
1649
|
let x = Os(A.outerHTML);
|
|
1604
1650
|
if (g) {
|
|
1605
1651
|
const k = Ms(x, E);
|
|
@@ -1616,7 +1662,7 @@ a-->b`, fl = ({ editor: e, attrs: t, extension: n }) => {
|
|
|
1616
1662
|
!!r
|
|
1617
1663
|
).run(), e == null || e.commands.setAlignImageMermaid(s);
|
|
1618
1664
|
}
|
|
1619
|
-
|
|
1665
|
+
d(!1);
|
|
1620
1666
|
}
|
|
1621
1667
|
},
|
|
1622
1668
|
type: "button",
|
|
@@ -1628,7 +1674,7 @@ a-->b`, fl = ({ editor: e, attrs: t, extension: n }) => {
|
|
|
1628
1674
|
}
|
|
1629
1675
|
);
|
|
1630
1676
|
};
|
|
1631
|
-
function
|
|
1677
|
+
function fl({ item: e, disabled: t, editor: n }) {
|
|
1632
1678
|
var s;
|
|
1633
1679
|
const i = e.component;
|
|
1634
1680
|
return i ? /* @__PURE__ */ p(ti, { children: e.type === "divider" ? /* @__PURE__ */ p(
|
|
@@ -1644,17 +1690,17 @@ function pl({ item: e, disabled: t, editor: n }) {
|
|
|
1644
1690
|
disabled: t || ((s = e == null ? void 0 : e.componentProps) == null ? void 0 : s.disabled),
|
|
1645
1691
|
editor: n
|
|
1646
1692
|
}
|
|
1647
|
-
) }) : /* @__PURE__ */ p(
|
|
1693
|
+
) }) : /* @__PURE__ */ p(M, {});
|
|
1648
1694
|
}
|
|
1649
|
-
function
|
|
1695
|
+
function pl(e) {
|
|
1650
1696
|
return e.type.name === Un.name;
|
|
1651
1697
|
}
|
|
1652
|
-
function
|
|
1698
|
+
function Zd() {
|
|
1653
1699
|
const { lang: e, t } = X(), n = Z(), i = Y(), s = ee(i, Un.name), r = As(Un.name), o = ({ editor: c }) => {
|
|
1654
|
-
const { selection: a } = c.view.state, { $from:
|
|
1700
|
+
const { selection: a } = c.view.state, { $from: d, to: h } = a;
|
|
1655
1701
|
let u = !1;
|
|
1656
|
-
return c.view.state.doc.nodesBetween(
|
|
1657
|
-
if (
|
|
1702
|
+
return c.view.state.doc.nodesBetween(d.pos, h, (f) => {
|
|
1703
|
+
if (pl(f))
|
|
1658
1704
|
return u = !0, !1;
|
|
1659
1705
|
}), u;
|
|
1660
1706
|
}, l = Pt(() => el(i, t), [i, e, t]);
|
|
@@ -1665,7 +1711,7 @@ function Qd() {
|
|
|
1665
1711
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1666
1712
|
shouldShow: o,
|
|
1667
1713
|
children: l != null && l.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: l == null ? void 0 : l.map((c, a) => c.type === "edit" && (s != null && s.src) ? /* @__PURE__ */ p(
|
|
1668
|
-
|
|
1714
|
+
ul,
|
|
1669
1715
|
{
|
|
1670
1716
|
attrs: s,
|
|
1671
1717
|
editor: i,
|
|
@@ -1673,18 +1719,18 @@ function Qd() {
|
|
|
1673
1719
|
},
|
|
1674
1720
|
`bubbleMenu-mermaid-${a}`
|
|
1675
1721
|
) : /* @__PURE__ */ p(
|
|
1676
|
-
|
|
1722
|
+
fl,
|
|
1677
1723
|
{
|
|
1678
1724
|
editor: i,
|
|
1679
1725
|
item: c
|
|
1680
1726
|
},
|
|
1681
1727
|
`bubbleMenu-mermaid-${a}`
|
|
1682
|
-
)) }) : /* @__PURE__ */ p(
|
|
1728
|
+
)) }) : /* @__PURE__ */ p(M, {})
|
|
1683
1729
|
}
|
|
1684
|
-
) : /* @__PURE__ */ p(
|
|
1730
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1685
1731
|
}
|
|
1686
|
-
function
|
|
1687
|
-
var m,
|
|
1732
|
+
function Qd({ hiddenActions: e = [] }) {
|
|
1733
|
+
var m, b, w, D, A, v, P, E, x, k, N, H, et, It, Ot, _, ft, re;
|
|
1688
1734
|
const { t } = X(), n = Z(), i = Y(), s = ({ editor: Wt }) => qr(Wt.view.state, oo.name), r = (Wt) => e.includes(Wt);
|
|
1689
1735
|
function o() {
|
|
1690
1736
|
i.chain().focus().addColumnBefore().run();
|
|
@@ -1698,10 +1744,10 @@ function tu({ hiddenActions: e = [] }) {
|
|
|
1698
1744
|
function a() {
|
|
1699
1745
|
i.chain().focus().addRowBefore().run();
|
|
1700
1746
|
}
|
|
1701
|
-
function
|
|
1747
|
+
function d() {
|
|
1702
1748
|
i.chain().focus().addRowAfter().run();
|
|
1703
1749
|
}
|
|
1704
|
-
function
|
|
1750
|
+
function h() {
|
|
1705
1751
|
i.chain().focus().deleteRow().run();
|
|
1706
1752
|
}
|
|
1707
1753
|
function u() {
|
|
@@ -1725,7 +1771,7 @@ function tu({ hiddenActions: e = [] }) {
|
|
|
1725
1771
|
y,
|
|
1726
1772
|
{
|
|
1727
1773
|
action: o,
|
|
1728
|
-
disabled: !((
|
|
1774
|
+
disabled: !((b = (m = i == null ? void 0 : i.can()) == null ? void 0 : m.addColumnBefore) != null && b.call(m)),
|
|
1729
1775
|
icon: "BetweenHorizonalEnd",
|
|
1730
1776
|
tooltip: t("editor.table.menu.insertColumnBefore"),
|
|
1731
1777
|
tooltipOptions: { sideOffset: 15 }
|
|
@@ -1735,7 +1781,7 @@ function tu({ hiddenActions: e = [] }) {
|
|
|
1735
1781
|
y,
|
|
1736
1782
|
{
|
|
1737
1783
|
action: l,
|
|
1738
|
-
disabled: !((
|
|
1784
|
+
disabled: !((D = (w = i == null ? void 0 : i.can()) == null ? void 0 : w.addColumnAfter) != null && D.call(w)),
|
|
1739
1785
|
icon: "BetweenHorizonalStart",
|
|
1740
1786
|
tooltip: t("editor.table.menu.insertColumnAfter"),
|
|
1741
1787
|
tooltipOptions: { sideOffset: 15 }
|
|
@@ -1771,7 +1817,7 @@ function tu({ hiddenActions: e = [] }) {
|
|
|
1771
1817
|
!r("addRowBelow") && /* @__PURE__ */ p(
|
|
1772
1818
|
y,
|
|
1773
1819
|
{
|
|
1774
|
-
action:
|
|
1820
|
+
action: d,
|
|
1775
1821
|
disabled: !((k = (x = i == null ? void 0 : i.can()) == null ? void 0 : x.addRowAfter) != null && k.call(x)),
|
|
1776
1822
|
icon: "BetweenVerticalStart",
|
|
1777
1823
|
tooltip: t("editor.table.menu.insertRowBelow"),
|
|
@@ -1781,8 +1827,8 @@ function tu({ hiddenActions: e = [] }) {
|
|
|
1781
1827
|
!r("deleteRow") && /* @__PURE__ */ p(
|
|
1782
1828
|
y,
|
|
1783
1829
|
{
|
|
1784
|
-
action:
|
|
1785
|
-
disabled: !((H = (
|
|
1830
|
+
action: h,
|
|
1831
|
+
disabled: !((H = (N = i == null ? void 0 : i.can()) == null ? void 0 : N.deleteRow) != null && H.call(N)),
|
|
1786
1832
|
icon: "DeleteRow",
|
|
1787
1833
|
tooltip: t("editor.table.menu.deleteRow"),
|
|
1788
1834
|
tooltipOptions: { sideOffset: 15 }
|
|
@@ -1834,10 +1880,10 @@ function tu({ hiddenActions: e = [] }) {
|
|
|
1834
1880
|
)
|
|
1835
1881
|
] })
|
|
1836
1882
|
}
|
|
1837
|
-
) : /* @__PURE__ */ p(
|
|
1883
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1838
1884
|
}
|
|
1839
|
-
function
|
|
1840
|
-
return /* @__PURE__ */ S(
|
|
1885
|
+
function gl() {
|
|
1886
|
+
return /* @__PURE__ */ S(M, { children: [
|
|
1841
1887
|
/* @__PURE__ */ p(_o, {}),
|
|
1842
1888
|
/* @__PURE__ */ p(Ao, {}),
|
|
1843
1889
|
/* @__PURE__ */ p(Di, {}),
|
|
@@ -1857,7 +1903,7 @@ function ml() {
|
|
|
1857
1903
|
/* @__PURE__ */ p(Oo, {})
|
|
1858
1904
|
] });
|
|
1859
1905
|
}
|
|
1860
|
-
function
|
|
1906
|
+
function tu({ buttonBubble: e }) {
|
|
1861
1907
|
const t = Y(), n = Z(), i = ({ editor: s }) => {
|
|
1862
1908
|
const { selection: r } = s.view.state, { $from: o, to: l } = r;
|
|
1863
1909
|
return o.pos === l ? !1 : r instanceof no;
|
|
@@ -1868,27 +1914,27 @@ function eu({ buttonBubble: e }) {
|
|
|
1868
1914
|
editor: t,
|
|
1869
1915
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1870
1916
|
shouldShow: i,
|
|
1871
|
-
children: e ? /* @__PURE__ */ p(
|
|
1917
|
+
children: e ? /* @__PURE__ */ p(M, { children: e }) : /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: /* @__PURE__ */ p(gl, {}) })
|
|
1872
1918
|
}
|
|
1873
|
-
) : /* @__PURE__ */ p(
|
|
1919
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1874
1920
|
}
|
|
1875
|
-
function
|
|
1876
|
-
const { t: e } = X(), t = Z(), n = Y(), [i, s] = z(!1), r =
|
|
1921
|
+
function eu() {
|
|
1922
|
+
const { t: e } = X(), t = Z(), n = Y(), [i, s] = z(!1), r = L(({ editor: c }) => c.isActive(Ai.name), []), o = (c) => {
|
|
1877
1923
|
n.commands.updateTweet({ src: c }), s(!1);
|
|
1878
|
-
}, l =
|
|
1924
|
+
}, l = L(() => _e(Ai.name, n), [n]);
|
|
1879
1925
|
return t ? /* @__PURE__ */ p(
|
|
1880
1926
|
tt,
|
|
1881
1927
|
{
|
|
1882
1928
|
editor: n,
|
|
1883
1929
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1884
1930
|
shouldShow: r,
|
|
1885
|
-
children: /* @__PURE__ */ p(
|
|
1931
|
+
children: /* @__PURE__ */ p(M, { children: i ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: /* @__PURE__ */ p(
|
|
1886
1932
|
Ro,
|
|
1887
1933
|
{
|
|
1888
1934
|
editor: n,
|
|
1889
1935
|
onSetLink: o
|
|
1890
1936
|
}
|
|
1891
|
-
) : /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
|
|
1937
|
+
) }) : /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
|
|
1892
1938
|
/* @__PURE__ */ p(
|
|
1893
1939
|
y,
|
|
1894
1940
|
{
|
|
@@ -1911,7 +1957,7 @@ function nu() {
|
|
|
1911
1957
|
)
|
|
1912
1958
|
] }) })
|
|
1913
1959
|
}
|
|
1914
|
-
) : /* @__PURE__ */ p(
|
|
1960
|
+
) : /* @__PURE__ */ p(M, {});
|
|
1915
1961
|
}
|
|
1916
1962
|
const ct = () => /* @__PURE__ */ new Map(), Ln = (e) => {
|
|
1917
1963
|
const t = ct();
|
|
@@ -1921,20 +1967,20 @@ const ct = () => /* @__PURE__ */ new Map(), Ln = (e) => {
|
|
|
1921
1967
|
}, St = (e, t, n) => {
|
|
1922
1968
|
let i = e.get(t);
|
|
1923
1969
|
return i === void 0 && e.set(t, i = n()), i;
|
|
1924
|
-
},
|
|
1970
|
+
}, ml = (e, t) => {
|
|
1925
1971
|
const n = [];
|
|
1926
1972
|
for (const [i, s] of e)
|
|
1927
1973
|
n.push(t(s, i));
|
|
1928
1974
|
return n;
|
|
1929
|
-
},
|
|
1975
|
+
}, wl = (e, t) => {
|
|
1930
1976
|
for (const [n, i] of e)
|
|
1931
1977
|
if (t(i, n))
|
|
1932
1978
|
return !0;
|
|
1933
1979
|
return !1;
|
|
1934
|
-
}, Bt = () => /* @__PURE__ */ new Set(), Cn = (e) => e[e.length - 1],
|
|
1980
|
+
}, Bt = () => /* @__PURE__ */ new Set(), Cn = (e) => e[e.length - 1], bl = (e, t) => {
|
|
1935
1981
|
for (let n = 0; n < t.length; n++)
|
|
1936
1982
|
e.push(t[n]);
|
|
1937
|
-
}, Vt = Array.from,
|
|
1983
|
+
}, Vt = Array.from, yl = (e, t) => {
|
|
1938
1984
|
for (let n = 0; n < e.length; n++)
|
|
1939
1985
|
if (t(e[n], n, e))
|
|
1940
1986
|
return !0;
|
|
@@ -2002,7 +2048,7 @@ class Ps {
|
|
|
2002
2048
|
this._observers = ct();
|
|
2003
2049
|
}
|
|
2004
2050
|
}
|
|
2005
|
-
const xt = Math.floor, Ve = Math.abs, qt = (e, t) => e < t ? e : t, Et = (e, t) => e > t ? e : t, Bs = (e) => e !== 0 ? e < 0 : 1 / e < 0, Bi = 1, Vi = 2, _n = 4, En = 8, ue = 32, bt = 64, K = 128,
|
|
2051
|
+
const xt = Math.floor, Ve = Math.abs, qt = (e, t) => e < t ? e : t, Et = (e, t) => e > t ? e : t, Bs = (e) => e !== 0 ? e < 0 : 1 / e < 0, Bi = 1, Vi = 2, _n = 4, En = 8, ue = 32, bt = 64, K = 128, xl = 1 << 29, dn = 31, Bn = 63, Ut = 127, Sl = 2147483647, Vs = Number.MAX_SAFE_INTEGER, kl = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && xt(e) === e), vl = String.fromCharCode, Cl = (e) => e.toLowerCase(), _l = /^\s*/g, El = (e) => e.replace(_l, ""), Tl = /([A-Z])/g, Hi = (e, t) => El(e.replace(Tl, (n) => `${t}${Cl(n)}`)), Dl = (e) => {
|
|
2006
2052
|
const t = unescape(encodeURIComponent(e)), n = t.length, i = new Uint8Array(n);
|
|
2007
2053
|
for (let s = 0; s < n; s++)
|
|
2008
2054
|
i[s] = /** @type {number} */
|
|
@@ -2011,7 +2057,7 @@ const xt = Math.floor, Ve = Math.abs, qt = (e, t) => e < t ? e : t, Et = (e, t)
|
|
|
2011
2057
|
}, fe = (
|
|
2012
2058
|
/** @type {TextEncoder} */
|
|
2013
2059
|
typeof TextEncoder < "u" ? new TextEncoder() : null
|
|
2014
|
-
),
|
|
2060
|
+
), Al = (e) => fe.encode(e), Il = fe ? Al : Dl;
|
|
2015
2061
|
let he = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
|
|
2016
2062
|
he && he.decode(new Uint8Array()).length === 1 && (he = null);
|
|
2017
2063
|
class Ee {
|
|
@@ -2019,23 +2065,23 @@ class Ee {
|
|
|
2019
2065
|
this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
|
|
2020
2066
|
}
|
|
2021
2067
|
}
|
|
2022
|
-
const Te = () => new Ee(),
|
|
2068
|
+
const Te = () => new Ee(), Ol = (e) => {
|
|
2023
2069
|
const t = Te();
|
|
2024
2070
|
return e(t), lt(t);
|
|
2025
|
-
},
|
|
2071
|
+
}, Ml = (e) => {
|
|
2026
2072
|
let t = e.cpos;
|
|
2027
2073
|
for (let n = 0; n < e.bufs.length; n++)
|
|
2028
2074
|
t += e.bufs[n].length;
|
|
2029
2075
|
return t;
|
|
2030
2076
|
}, lt = (e) => {
|
|
2031
|
-
const t = new Uint8Array(
|
|
2077
|
+
const t = new Uint8Array(Ml(e));
|
|
2032
2078
|
let n = 0;
|
|
2033
2079
|
for (let i = 0; i < e.bufs.length; i++) {
|
|
2034
2080
|
const s = e.bufs[i];
|
|
2035
2081
|
t.set(s, n), n += s.length;
|
|
2036
2082
|
}
|
|
2037
2083
|
return t.set(new Uint8Array(e.cbuf.buffer, 0, e.cpos), n), t;
|
|
2038
|
-
},
|
|
2084
|
+
}, Rl = (e, t) => {
|
|
2039
2085
|
const n = e.cbuf.length;
|
|
2040
2086
|
n - e.cpos < t && (e.bufs.push(new Uint8Array(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(Et(n, t) * 2), e.cpos = 0);
|
|
2041
2087
|
}, $ = (e, t) => {
|
|
@@ -2049,15 +2095,15 @@ const Te = () => new Ee(), Ml = (e) => {
|
|
|
2049
2095
|
const n = Bs(t);
|
|
2050
2096
|
for (n && (t = -t), $(e, (t > Bn ? K : 0) | (n ? bt : 0) | Bn & t), t = xt(t / 64); t > 0; )
|
|
2051
2097
|
$(e, (t > Ut ? K : 0) | Ut & t), t = xt(t / 128);
|
|
2052
|
-
}, Hn = new Uint8Array(3e4),
|
|
2053
|
-
if (t.length <
|
|
2098
|
+
}, Hn = new Uint8Array(3e4), Nl = Hn.length / 3, Ul = (e, t) => {
|
|
2099
|
+
if (t.length < Nl) {
|
|
2054
2100
|
const n = fe.encodeInto(t, Hn).written || 0;
|
|
2055
2101
|
T(e, n);
|
|
2056
2102
|
for (let i = 0; i < n; i++)
|
|
2057
2103
|
$(e, Hn[i]);
|
|
2058
2104
|
} else
|
|
2059
|
-
Q(e,
|
|
2060
|
-
},
|
|
2105
|
+
Q(e, Il(t));
|
|
2106
|
+
}, Ll = (e, t) => {
|
|
2061
2107
|
const n = unescape(encodeURIComponent(t)), i = n.length;
|
|
2062
2108
|
T(e, i);
|
|
2063
2109
|
for (let s = 0; s < i; s++)
|
|
@@ -2067,28 +2113,28 @@ const Te = () => new Ee(), Ml = (e) => {
|
|
|
2067
2113
|
n.codePointAt(s)
|
|
2068
2114
|
);
|
|
2069
2115
|
}, jt = fe && /** @type {any} */
|
|
2070
|
-
fe.encodeInto ?
|
|
2116
|
+
fe.encodeInto ? Ul : Ll, un = (e, t) => {
|
|
2071
2117
|
const n = e.cbuf.length, i = e.cpos, s = qt(n - i, t.length), r = t.length - s;
|
|
2072
2118
|
e.cbuf.set(t.subarray(0, s), i), e.cpos += s, r > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(Et(n * 2, r)), e.cbuf.set(t.subarray(s)), e.cpos = r);
|
|
2073
2119
|
}, Q = (e, t) => {
|
|
2074
2120
|
T(e, t.byteLength), un(e, t);
|
|
2075
2121
|
}, oi = (e, t) => {
|
|
2076
|
-
|
|
2122
|
+
Rl(e, t);
|
|
2077
2123
|
const n = new DataView(e.cbuf.buffer, e.cpos, t);
|
|
2078
2124
|
return e.cpos += t, n;
|
|
2079
|
-
},
|
|
2125
|
+
}, Pl = (e, t) => oi(e, 4).setFloat32(0, t, !1), Bl = (e, t) => oi(e, 8).setFloat64(0, t, !1), Vl = (e, t) => (
|
|
2080
2126
|
/** @type {any} */
|
|
2081
2127
|
oi(e, 8).setBigInt64(0, t, !1)
|
|
2082
|
-
), $i = new DataView(new ArrayBuffer(4)),
|
|
2128
|
+
), $i = new DataView(new ArrayBuffer(4)), Hl = (e) => ($i.setFloat32(0, e), $i.getFloat32(0) === e), Xt = (e, t) => {
|
|
2083
2129
|
switch (typeof t) {
|
|
2084
2130
|
case "string":
|
|
2085
2131
|
$(e, 119), jt(e, t);
|
|
2086
2132
|
break;
|
|
2087
2133
|
case "number":
|
|
2088
|
-
|
|
2134
|
+
kl(t) && Ve(t) <= Sl ? ($(e, 125), ri(e, t)) : Hl(t) ? ($(e, 124), Pl(e, t)) : ($(e, 123), Bl(e, t));
|
|
2089
2135
|
break;
|
|
2090
2136
|
case "bigint":
|
|
2091
|
-
$(e, 122),
|
|
2137
|
+
$(e, 122), Vl(e, t);
|
|
2092
2138
|
break;
|
|
2093
2139
|
case "object":
|
|
2094
2140
|
if (t === null)
|
|
@@ -2177,7 +2223,7 @@ class Tn {
|
|
|
2177
2223
|
return Wi(this), lt(this.encoder);
|
|
2178
2224
|
}
|
|
2179
2225
|
}
|
|
2180
|
-
class
|
|
2226
|
+
class $l {
|
|
2181
2227
|
constructor() {
|
|
2182
2228
|
this.sarr = [], this.s = "", this.lensE = new He();
|
|
2183
2229
|
}
|
|
@@ -2205,10 +2251,10 @@ class fn {
|
|
|
2205
2251
|
this.arr = t, this.pos = 0;
|
|
2206
2252
|
}
|
|
2207
2253
|
}
|
|
2208
|
-
const li = (e) => new fn(e),
|
|
2254
|
+
const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) => {
|
|
2209
2255
|
const n = new Uint8Array(e.arr.buffer, e.pos + e.arr.byteOffset, t);
|
|
2210
2256
|
return e.pos += t, n;
|
|
2211
|
-
}, nt = (e) =>
|
|
2257
|
+
}, nt = (e) => zl(e, R(e)), pe = (e) => e.arr[e.pos++], R = (e) => {
|
|
2212
2258
|
let t = 0, n = 1;
|
|
2213
2259
|
const i = e.arr.length;
|
|
2214
2260
|
for (; e.pos < i; ) {
|
|
@@ -2232,8 +2278,8 @@ const li = (e) => new fn(e), zl = (e) => e.pos !== e.arr.length, Wl = (e, t) =>
|
|
|
2232
2278
|
throw $s;
|
|
2233
2279
|
}
|
|
2234
2280
|
throw Hs;
|
|
2235
|
-
},
|
|
2236
|
-
let t =
|
|
2281
|
+
}, Wl = (e) => {
|
|
2282
|
+
let t = R(e);
|
|
2237
2283
|
if (t === 0)
|
|
2238
2284
|
return "";
|
|
2239
2285
|
{
|
|
@@ -2252,16 +2298,16 @@ const li = (e) => new fn(e), zl = (e) => e.pos !== e.arr.length, Wl = (e, t) =>
|
|
|
2252
2298
|
}
|
|
2253
2299
|
return decodeURIComponent(escape(n));
|
|
2254
2300
|
}
|
|
2255
|
-
},
|
|
2301
|
+
}, jl = (e) => (
|
|
2256
2302
|
/** @type any */
|
|
2257
2303
|
he.decode(nt(e))
|
|
2258
|
-
), $n = he ?
|
|
2304
|
+
), $n = he ? jl : Wl, ai = (e, t) => {
|
|
2259
2305
|
const n = new DataView(e.arr.buffer, e.arr.byteOffset + e.pos, t);
|
|
2260
2306
|
return e.pos += t, n;
|
|
2261
|
-
},
|
|
2307
|
+
}, Kl = (e) => ai(e, 4).getFloat32(0, !1), Yl = (e) => ai(e, 8).getFloat64(0, !1), Gl = (e) => (
|
|
2262
2308
|
/** @type {any} */
|
|
2263
2309
|
ai(e, 8).getBigInt64(0, !1)
|
|
2264
|
-
),
|
|
2310
|
+
), Jl = [
|
|
2265
2311
|
(e) => {
|
|
2266
2312
|
},
|
|
2267
2313
|
// CASE 127: undefined
|
|
@@ -2269,11 +2315,11 @@ const li = (e) => new fn(e), zl = (e) => e.pos !== e.arr.length, Wl = (e, t) =>
|
|
|
2269
2315
|
// CASE 126: null
|
|
2270
2316
|
ci,
|
|
2271
2317
|
// CASE 125: integer
|
|
2272
|
-
|
|
2318
|
+
Kl,
|
|
2273
2319
|
// CASE 124: float32
|
|
2274
|
-
|
|
2320
|
+
Yl,
|
|
2275
2321
|
// CASE 123: float64
|
|
2276
|
-
|
|
2322
|
+
Gl,
|
|
2277
2323
|
// CASE 122: bigint
|
|
2278
2324
|
(e) => !1,
|
|
2279
2325
|
// CASE 121: boolean (false)
|
|
@@ -2282,7 +2328,7 @@ const li = (e) => new fn(e), zl = (e) => e.pos !== e.arr.length, Wl = (e, t) =>
|
|
|
2282
2328
|
$n,
|
|
2283
2329
|
// CASE 119: string
|
|
2284
2330
|
(e) => {
|
|
2285
|
-
const t =
|
|
2331
|
+
const t = R(e), n = {};
|
|
2286
2332
|
for (let i = 0; i < t; i++) {
|
|
2287
2333
|
const s = $n(e);
|
|
2288
2334
|
n[s] = Ye(e);
|
|
@@ -2290,14 +2336,14 @@ const li = (e) => new fn(e), zl = (e) => e.pos !== e.arr.length, Wl = (e, t) =>
|
|
|
2290
2336
|
return n;
|
|
2291
2337
|
},
|
|
2292
2338
|
(e) => {
|
|
2293
|
-
const t =
|
|
2339
|
+
const t = R(e), n = [];
|
|
2294
2340
|
for (let i = 0; i < t; i++)
|
|
2295
2341
|
n.push(Ye(e));
|
|
2296
2342
|
return n;
|
|
2297
2343
|
},
|
|
2298
2344
|
nt
|
|
2299
2345
|
// CASE 116: Uint8Array
|
|
2300
|
-
], Ye = (e) =>
|
|
2346
|
+
], Ye = (e) => Jl[127 - pe(e)](e);
|
|
2301
2347
|
class ji extends fn {
|
|
2302
2348
|
/**
|
|
2303
2349
|
* @param {Uint8Array} uint8Array
|
|
@@ -2307,7 +2353,7 @@ class ji extends fn {
|
|
|
2307
2353
|
super(t), this.reader = n, this.s = null, this.count = 0;
|
|
2308
2354
|
}
|
|
2309
2355
|
read() {
|
|
2310
|
-
return this.count === 0 && (this.s = this.reader(this),
|
|
2356
|
+
return this.count === 0 && (this.s = this.reader(this), Fl(this) ? this.count = R(this) + 1 : this.count = -1), this.count--, /** @type {T} */
|
|
2311
2357
|
this.s;
|
|
2312
2358
|
}
|
|
2313
2359
|
}
|
|
@@ -2322,7 +2368,7 @@ class $e extends fn {
|
|
|
2322
2368
|
if (this.count === 0) {
|
|
2323
2369
|
this.s = ci(this);
|
|
2324
2370
|
const t = Bs(this.s);
|
|
2325
|
-
this.count = 1, t && (this.s = -this.s, this.count =
|
|
2371
|
+
this.count = 1, t && (this.s = -this.s, this.count = R(this) + 2);
|
|
2326
2372
|
}
|
|
2327
2373
|
return this.count--, /** @type {number} */
|
|
2328
2374
|
this.s;
|
|
@@ -2341,12 +2387,12 @@ class Dn extends fn {
|
|
|
2341
2387
|
read() {
|
|
2342
2388
|
if (this.count === 0) {
|
|
2343
2389
|
const t = ci(this), n = t & 1;
|
|
2344
|
-
this.diff = xt(t / 2), this.count = 1, n && (this.count =
|
|
2390
|
+
this.diff = xt(t / 2), this.count = 1, n && (this.count = R(this) + 2);
|
|
2345
2391
|
}
|
|
2346
2392
|
return this.s += this.diff, this.count--, this.s;
|
|
2347
2393
|
}
|
|
2348
2394
|
}
|
|
2349
|
-
class
|
|
2395
|
+
class ql {
|
|
2350
2396
|
/**
|
|
2351
2397
|
* @param {Uint8Array} uint8Array
|
|
2352
2398
|
*/
|
|
@@ -2361,17 +2407,17 @@ class Xl {
|
|
|
2361
2407
|
return this.spos = t, n;
|
|
2362
2408
|
}
|
|
2363
2409
|
}
|
|
2364
|
-
const
|
|
2410
|
+
const Xl = crypto.getRandomValues.bind(crypto), Zl = Math.random, Fs = () => Xl(new Uint32Array(1))[0], Ql = (e) => e[xt(Zl() * e.length)], tc = "10000000-1000-4000-8000" + -1e11, ec = () => tc.replace(
|
|
2365
2411
|
/[018]/g,
|
|
2366
2412
|
/** @param {number} c */
|
|
2367
2413
|
(e) => (e ^ Fs() & 15 >> e / 4).toString(16)
|
|
2368
|
-
),
|
|
2414
|
+
), nc = Date.now, Ki = (e) => (
|
|
2369
2415
|
/** @type {Promise<T>} */
|
|
2370
2416
|
new Promise(e)
|
|
2371
2417
|
);
|
|
2372
2418
|
Promise.all.bind(Promise);
|
|
2373
2419
|
const Yi = (e) => e === void 0 ? null : e;
|
|
2374
|
-
class
|
|
2420
|
+
class ic {
|
|
2375
2421
|
constructor() {
|
|
2376
2422
|
this.map = /* @__PURE__ */ new Map();
|
|
2377
2423
|
}
|
|
@@ -2389,15 +2435,15 @@ class sc {
|
|
|
2389
2435
|
return this.map.get(t);
|
|
2390
2436
|
}
|
|
2391
2437
|
}
|
|
2392
|
-
let zs = new
|
|
2438
|
+
let zs = new ic(), sc = !0;
|
|
2393
2439
|
try {
|
|
2394
|
-
typeof localStorage < "u" && localStorage && (zs = localStorage,
|
|
2440
|
+
typeof localStorage < "u" && localStorage && (zs = localStorage, sc = !1);
|
|
2395
2441
|
} catch {
|
|
2396
2442
|
}
|
|
2397
|
-
const
|
|
2443
|
+
const rc = zs, oc = Object.assign, Ws = Object.keys, lc = (e, t) => {
|
|
2398
2444
|
for (const n in e)
|
|
2399
2445
|
t(e[n], n);
|
|
2400
|
-
}, Gi = (e) => Ws(e).length,
|
|
2446
|
+
}, Gi = (e) => Ws(e).length, cc = (e) => {
|
|
2401
2447
|
for (const t in e)
|
|
2402
2448
|
return !1;
|
|
2403
2449
|
return !0;
|
|
@@ -2406,12 +2452,12 @@ const oc = zs, lc = Object.assign, Ws = Object.keys, cc = (e, t) => {
|
|
|
2406
2452
|
if (!t(e[n], n))
|
|
2407
2453
|
return !1;
|
|
2408
2454
|
return !0;
|
|
2409
|
-
},
|
|
2455
|
+
}, ac = (e, t) => Object.prototype.hasOwnProperty.call(e, t), hc = (e, t) => e === t || Gi(e) === Gi(t) && js(e, (n, i) => (n !== void 0 || ac(t, i)) && t[i] === n), dc = Object.freeze, Ks = (e) => {
|
|
2410
2456
|
for (const t in e) {
|
|
2411
2457
|
const n = e[t];
|
|
2412
2458
|
(typeof n == "object" || typeof n == "function") && Ks(e[t]);
|
|
2413
2459
|
}
|
|
2414
|
-
return
|
|
2460
|
+
return dc(e);
|
|
2415
2461
|
}, hi = (e, t, n = 0) => {
|
|
2416
2462
|
try {
|
|
2417
2463
|
for (; n < e.length; n++)
|
|
@@ -2419,9 +2465,9 @@ const oc = zs, lc = Object.assign, Ws = Object.keys, cc = (e, t) => {
|
|
|
2419
2465
|
} finally {
|
|
2420
2466
|
n < e.length && hi(e, t, n + 1);
|
|
2421
2467
|
}
|
|
2422
|
-
},
|
|
2468
|
+
}, uc = (e, t) => t.includes(e), Zt = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", Ys = typeof window < "u" && typeof document < "u" && !Zt;
|
|
2423
2469
|
let pt;
|
|
2424
|
-
const
|
|
2470
|
+
const fc = () => {
|
|
2425
2471
|
if (pt === void 0)
|
|
2426
2472
|
if (Zt) {
|
|
2427
2473
|
pt = ct();
|
|
@@ -2439,16 +2485,16 @@ const pc = () => {
|
|
|
2439
2485
|
}
|
|
2440
2486
|
})) : pt = ct();
|
|
2441
2487
|
return pt;
|
|
2442
|
-
}, Fn = (e) =>
|
|
2488
|
+
}, Fn = (e) => fc().has(e), Ge = (e) => Yi(Zt ? process.env[e.toUpperCase().replaceAll("-", "_")] : rc.getItem(e)), Gs = (e) => Fn("--" + e) || Ge(e) !== null;
|
|
2443
2489
|
Gs("production");
|
|
2444
|
-
const
|
|
2445
|
-
!Gs("no-color") && (!Zt || process.stdout.isTTY) && (!Zt || Fn("--color") || Ge("COLORTERM") !== null || (Ge("TERM") || "").includes("color")),
|
|
2490
|
+
const pc = Zt && uc(process.env.FORCE_COLOR, ["true", "1", "2"]), gc = pc || !Fn("--no-colors") && // @todo deprecate --no-colors
|
|
2491
|
+
!Gs("no-color") && (!Zt || process.stdout.isTTY) && (!Zt || Fn("--color") || Ge("COLORTERM") !== null || (Ge("TERM") || "").includes("color")), mc = (e) => {
|
|
2446
2492
|
let t = "";
|
|
2447
2493
|
for (let n = 0; n < e.byteLength; n++)
|
|
2448
|
-
t +=
|
|
2494
|
+
t += vl(e[n]);
|
|
2449
2495
|
return btoa(t);
|
|
2450
|
-
},
|
|
2451
|
-
class
|
|
2496
|
+
}, wc = (e) => Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("base64"), bc = Ys ? mc : wc, yc = (e) => Ol((t) => Xt(t, e));
|
|
2497
|
+
class xc {
|
|
2452
2498
|
/**
|
|
2453
2499
|
* @param {L} left
|
|
2454
2500
|
* @param {R} right
|
|
@@ -2457,12 +2503,12 @@ class Sc {
|
|
|
2457
2503
|
this.left = t, this.right = n;
|
|
2458
2504
|
}
|
|
2459
2505
|
}
|
|
2460
|
-
const wt = (e, t) => new
|
|
2506
|
+
const wt = (e, t) => new xc(e, t), Sc = (
|
|
2461
2507
|
/** @type {Document} */
|
|
2462
2508
|
typeof document < "u" ? document : {}
|
|
2463
2509
|
);
|
|
2464
2510
|
typeof DOMParser < "u" && new DOMParser();
|
|
2465
|
-
const
|
|
2511
|
+
const kc = (e) => ml(e, (t, n) => `${n}:${t};`).join(""), vc = (e) => class {
|
|
2466
2512
|
/**
|
|
2467
2513
|
* @param {number} timeoutId
|
|
2468
2514
|
*/
|
|
@@ -2472,7 +2518,7 @@ const vc = (e) => wl(e, (t, n) => `${n}:${t};`).join(""), Cc = (e) => class {
|
|
|
2472
2518
|
destroy() {
|
|
2473
2519
|
e(this._);
|
|
2474
2520
|
}
|
|
2475
|
-
},
|
|
2521
|
+
}, Cc = vc(clearTimeout), Js = (e, t) => new Cc(setTimeout(t, e)), kt = Symbol, qs = kt(), Xs = kt(), _c = kt(), Ec = kt(), Tc = kt(), Zs = kt(), Dc = kt(), di = kt(), Ac = kt(), Ic = (e) => {
|
|
2476
2522
|
var s;
|
|
2477
2523
|
e.length === 1 && ((s = e[0]) == null ? void 0 : s.constructor) === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
|
|
2478
2524
|
/** @type {[function]} */
|
|
@@ -2493,18 +2539,18 @@ const vc = (e) => wl(e, (t, n) => `${n}:${t};`).join(""), Cc = (e) => class {
|
|
|
2493
2539
|
r instanceof Symbol || n.push(r);
|
|
2494
2540
|
}
|
|
2495
2541
|
return n;
|
|
2496
|
-
},
|
|
2542
|
+
}, Oc = {
|
|
2497
2543
|
[qs]: wt("font-weight", "bold"),
|
|
2498
2544
|
[Xs]: wt("font-weight", "normal"),
|
|
2499
|
-
[
|
|
2500
|
-
[
|
|
2501
|
-
[
|
|
2545
|
+
[_c]: wt("color", "blue"),
|
|
2546
|
+
[Tc]: wt("color", "green"),
|
|
2547
|
+
[Ec]: wt("color", "grey"),
|
|
2502
2548
|
[Zs]: wt("color", "red"),
|
|
2503
|
-
[
|
|
2549
|
+
[Dc]: wt("color", "purple"),
|
|
2504
2550
|
[di]: wt("color", "orange"),
|
|
2505
2551
|
// not well supported in chrome when debugging node with inspector - TODO: deprecate
|
|
2506
|
-
[
|
|
2507
|
-
},
|
|
2552
|
+
[Ac]: wt("color", "black")
|
|
2553
|
+
}, Mc = (e) => {
|
|
2508
2554
|
var o;
|
|
2509
2555
|
e.length === 1 && ((o = e[0]) == null ? void 0 : o.constructor) === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
|
|
2510
2556
|
/** @type {[function]} */
|
|
@@ -2512,14 +2558,14 @@ const vc = (e) => wl(e, (t, n) => `${n}:${t};`).join(""), Cc = (e) => class {
|
|
|
2512
2558
|
const t = [], n = [], i = ct();
|
|
2513
2559
|
let s = [], r = 0;
|
|
2514
2560
|
for (; r < e.length; r++) {
|
|
2515
|
-
const l = e[r], c =
|
|
2561
|
+
const l = e[r], c = Oc[l];
|
|
2516
2562
|
if (c !== void 0)
|
|
2517
2563
|
i.set(c.left, c.right);
|
|
2518
2564
|
else {
|
|
2519
2565
|
if (l === void 0)
|
|
2520
2566
|
break;
|
|
2521
2567
|
if (l.constructor === String || l.constructor === Number) {
|
|
2522
|
-
const a =
|
|
2568
|
+
const a = kc(i);
|
|
2523
2569
|
r > 0 || a.length > 0 ? (t.push("%c" + l), n.push(a)) : t.push(l);
|
|
2524
2570
|
} else
|
|
2525
2571
|
break;
|
|
@@ -2530,7 +2576,7 @@ const vc = (e) => wl(e, (t, n) => `${n}:${t};`).join(""), Cc = (e) => class {
|
|
|
2530
2576
|
l instanceof Symbol || s.push(l);
|
|
2531
2577
|
}
|
|
2532
2578
|
return s;
|
|
2533
|
-
}, Qs =
|
|
2579
|
+
}, Qs = gc ? Mc : Ic, Rc = (...e) => {
|
|
2534
2580
|
console.log(...Qs(e)), er.forEach((t) => t.print(e));
|
|
2535
2581
|
}, tr = (...e) => {
|
|
2536
2582
|
console.warn(...Qs(e)), e.unshift(di), er.forEach((t) => t.print(e));
|
|
@@ -2543,7 +2589,7 @@ const vc = (e) => wl(e, (t, n) => `${n}:${t};`).join(""), Cc = (e) => class {
|
|
|
2543
2589
|
},
|
|
2544
2590
|
// @ts-ignore
|
|
2545
2591
|
next: e
|
|
2546
|
-
}),
|
|
2592
|
+
}), Nc = (e, t) => nr(() => {
|
|
2547
2593
|
let n;
|
|
2548
2594
|
do
|
|
2549
2595
|
n = e.next();
|
|
@@ -2577,7 +2623,7 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
|
|
|
2577
2623
|
for (let c = 0, a = i[c]; c < i.length && a.clock < l; a = i[++c])
|
|
2578
2624
|
hr(e, r, a.clock, a.len, n);
|
|
2579
2625
|
}
|
|
2580
|
-
}),
|
|
2626
|
+
}), Uc = (e, t) => {
|
|
2581
2627
|
let n = 0, i = e.length - 1;
|
|
2582
2628
|
for (; n <= i; ) {
|
|
2583
2629
|
const s = xt((n + i) / 2), r = e[s], o = r.clock;
|
|
@@ -2591,7 +2637,7 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
|
|
|
2591
2637
|
return null;
|
|
2592
2638
|
}, ie = (e, t) => {
|
|
2593
2639
|
const n = e.clients.get(t.client);
|
|
2594
|
-
return n !== void 0 &&
|
|
2640
|
+
return n !== void 0 && Uc(n, t.clock) !== null;
|
|
2595
2641
|
}, fi = (e) => {
|
|
2596
2642
|
e.clients.forEach((t) => {
|
|
2597
2643
|
t.sort((s, r) => s.clock - r.clock);
|
|
@@ -2609,7 +2655,7 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
|
|
|
2609
2655
|
if (!t.clients.has(s)) {
|
|
2610
2656
|
const r = i.slice();
|
|
2611
2657
|
for (let o = n + 1; o < e.length; o++)
|
|
2612
|
-
|
|
2658
|
+
bl(r, e[o].clients.get(s) || []);
|
|
2613
2659
|
t.clients.set(s, r);
|
|
2614
2660
|
}
|
|
2615
2661
|
});
|
|
@@ -2619,7 +2665,7 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
|
|
|
2619
2665
|
/** @type {Array<DeleteItem>} */
|
|
2620
2666
|
[]
|
|
2621
2667
|
)).push(new ui(n, i));
|
|
2622
|
-
}, ir = () => new ne(),
|
|
2668
|
+
}, ir = () => new ne(), Lc = (e) => {
|
|
2623
2669
|
const t = ir();
|
|
2624
2670
|
return e.clients.forEach((n, i) => {
|
|
2625
2671
|
const s = [];
|
|
@@ -2646,11 +2692,11 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
|
|
|
2646
2692
|
e.writeDsClock(o.clock), e.writeDsLen(o.len);
|
|
2647
2693
|
}
|
|
2648
2694
|
});
|
|
2649
|
-
},
|
|
2650
|
-
const t = new ne(), n =
|
|
2695
|
+
}, Pc = (e) => {
|
|
2696
|
+
const t = new ne(), n = R(e.restDecoder);
|
|
2651
2697
|
for (let i = 0; i < n; i++) {
|
|
2652
2698
|
e.resetDsCurVal();
|
|
2653
|
-
const s =
|
|
2699
|
+
const s = R(e.restDecoder), r = R(e.restDecoder);
|
|
2654
2700
|
if (r > 0) {
|
|
2655
2701
|
const o = St(t.clients, s, () => (
|
|
2656
2702
|
/** @type {Array<DeleteItem>} */
|
|
@@ -2662,19 +2708,19 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
|
|
|
2662
2708
|
}
|
|
2663
2709
|
return t;
|
|
2664
2710
|
}, Ji = (e, t, n) => {
|
|
2665
|
-
const i = new ne(), s =
|
|
2711
|
+
const i = new ne(), s = R(e.restDecoder);
|
|
2666
2712
|
for (let r = 0; r < s; r++) {
|
|
2667
2713
|
e.resetDsCurVal();
|
|
2668
|
-
const o =
|
|
2669
|
-
for (let
|
|
2670
|
-
const
|
|
2671
|
-
if (
|
|
2714
|
+
const o = R(e.restDecoder), l = R(e.restDecoder), c = n.clients.get(o) || [], a = B(n, o);
|
|
2715
|
+
for (let d = 0; d < l; d++) {
|
|
2716
|
+
const h = e.readDsClock(), u = h + e.readDsLen();
|
|
2717
|
+
if (h < a) {
|
|
2672
2718
|
a < u && ge(i, o, a, u - a);
|
|
2673
|
-
let f = ht(c,
|
|
2674
|
-
for (!g.deleted && g.id.clock <
|
|
2719
|
+
let f = ht(c, h), g = c[f];
|
|
2720
|
+
for (!g.deleted && g.id.clock < h && (c.splice(f + 1, 0, en(t, g, h - g.id.clock)), f++); f < c.length && (g = c[f++], g.id.clock < u); )
|
|
2675
2721
|
g.deleted || (u < g.id.clock + g.length && c.splice(f, 0, en(t, g, u - g.id.clock)), g.delete(t));
|
|
2676
2722
|
} else
|
|
2677
|
-
ge(i, o,
|
|
2723
|
+
ge(i, o, h, u - h);
|
|
2678
2724
|
}
|
|
2679
2725
|
}
|
|
2680
2726
|
if (i.clients.size > 0) {
|
|
@@ -2687,17 +2733,17 @@ class Ft extends Ps {
|
|
|
2687
2733
|
/**
|
|
2688
2734
|
* @param {DocOpts} opts configuration
|
|
2689
2735
|
*/
|
|
2690
|
-
constructor({ guid: t =
|
|
2736
|
+
constructor({ guid: t = ec(), collectionid: n = null, gc: i = !0, gcFilter: s = () => !0, meta: r = null, autoLoad: o = !1, shouldLoad: l = !0 } = {}) {
|
|
2691
2737
|
super(), this.gc = i, this.gcFilter = s, this.clientID = sr(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new cr(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = l, this.autoLoad = o, this.meta = r, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = Ki((a) => {
|
|
2692
2738
|
this.on("load", () => {
|
|
2693
2739
|
this.isLoaded = !0, a(this);
|
|
2694
2740
|
});
|
|
2695
2741
|
});
|
|
2696
2742
|
const c = () => Ki((a) => {
|
|
2697
|
-
const
|
|
2698
|
-
(
|
|
2743
|
+
const d = (h) => {
|
|
2744
|
+
(h === void 0 || h === !0) && (this.off("sync", d), a());
|
|
2699
2745
|
};
|
|
2700
|
-
this.on("sync",
|
|
2746
|
+
this.on("sync", d);
|
|
2701
2747
|
});
|
|
2702
2748
|
this.on("sync", (a) => {
|
|
2703
2749
|
a === !1 && this.isSynced && (this.whenSynced = c()), this.isSynced = a === void 0 || a === !0, this.isSynced && !this.isLoaded && this.emit("load", [this]);
|
|
@@ -2712,7 +2758,7 @@ class Ft extends Ps {
|
|
|
2712
2758
|
*/
|
|
2713
2759
|
load() {
|
|
2714
2760
|
const t = this._item;
|
|
2715
|
-
t !== null && !this.shouldLoad &&
|
|
2761
|
+
t !== null && !this.shouldLoad && O(
|
|
2716
2762
|
/** @type {any} */
|
|
2717
2763
|
t.parent.doc,
|
|
2718
2764
|
(n) => {
|
|
@@ -2742,7 +2788,7 @@ class Ft extends Ps {
|
|
|
2742
2788
|
* @public
|
|
2743
2789
|
*/
|
|
2744
2790
|
transact(t, n = null) {
|
|
2745
|
-
return
|
|
2791
|
+
return O(this, t, n);
|
|
2746
2792
|
}
|
|
2747
2793
|
/**
|
|
2748
2794
|
* Define a shared data type.
|
|
@@ -2882,7 +2928,7 @@ class Ft extends Ps {
|
|
|
2882
2928
|
/** @type {ContentDoc} */
|
|
2883
2929
|
t.content
|
|
2884
2930
|
);
|
|
2885
|
-
n.doc = new Ft({ guid: this.guid, ...n.opts, shouldLoad: !1 }), n.doc._item = t,
|
|
2931
|
+
n.doc = new Ft({ guid: this.guid, ...n.opts, shouldLoad: !1 }), n.doc._item = t, O(
|
|
2886
2932
|
/** @type {any} */
|
|
2887
2933
|
t.parent.doc,
|
|
2888
2934
|
(i) => {
|
|
@@ -2896,7 +2942,7 @@ class Ft extends Ps {
|
|
|
2896
2942
|
this.emit("destroyed", [!0]), this.emit("destroy", [this]), super.destroy();
|
|
2897
2943
|
}
|
|
2898
2944
|
}
|
|
2899
|
-
class
|
|
2945
|
+
class Bc {
|
|
2900
2946
|
/**
|
|
2901
2947
|
* @param {decoding.Decoder} decoder
|
|
2902
2948
|
*/
|
|
@@ -2910,22 +2956,22 @@ class Vc {
|
|
|
2910
2956
|
* @return {number}
|
|
2911
2957
|
*/
|
|
2912
2958
|
readDsClock() {
|
|
2913
|
-
return this.dsCurrVal +=
|
|
2959
|
+
return this.dsCurrVal += R(this.restDecoder), this.dsCurrVal;
|
|
2914
2960
|
}
|
|
2915
2961
|
/**
|
|
2916
2962
|
* @return {number}
|
|
2917
2963
|
*/
|
|
2918
2964
|
readDsLen() {
|
|
2919
|
-
const t =
|
|
2965
|
+
const t = R(this.restDecoder) + 1;
|
|
2920
2966
|
return this.dsCurrVal += t, t;
|
|
2921
2967
|
}
|
|
2922
2968
|
}
|
|
2923
|
-
class Je extends
|
|
2969
|
+
class Je extends Bc {
|
|
2924
2970
|
/**
|
|
2925
2971
|
* @param {decoding.Decoder} decoder
|
|
2926
2972
|
*/
|
|
2927
2973
|
constructor(t) {
|
|
2928
|
-
super(t), this.keys = [],
|
|
2974
|
+
super(t), this.keys = [], R(t), this.keyClockDecoder = new Dn(nt(t)), this.clientDecoder = new $e(nt(t)), this.leftClockDecoder = new Dn(nt(t)), this.rightClockDecoder = new Dn(nt(t)), this.infoDecoder = new ji(nt(t), pe), this.stringDecoder = new ql(nt(t)), this.parentInfoDecoder = new ji(nt(t), pe), this.typeRefDecoder = new $e(nt(t)), this.lenDecoder = new $e(nt(t));
|
|
2929
2975
|
}
|
|
2930
2976
|
/**
|
|
2931
2977
|
* @return {ID}
|
|
@@ -3016,7 +3062,7 @@ class Je extends Vc {
|
|
|
3016
3062
|
}
|
|
3017
3063
|
}
|
|
3018
3064
|
}
|
|
3019
|
-
class
|
|
3065
|
+
class Vc {
|
|
3020
3066
|
constructor() {
|
|
3021
3067
|
this.restEncoder = Te();
|
|
3022
3068
|
}
|
|
@@ -3038,7 +3084,7 @@ class Hc {
|
|
|
3038
3084
|
T(this.restEncoder, t);
|
|
3039
3085
|
}
|
|
3040
3086
|
}
|
|
3041
|
-
class
|
|
3087
|
+
class Hc extends Vc {
|
|
3042
3088
|
/**
|
|
3043
3089
|
* @param {ID} id
|
|
3044
3090
|
*/
|
|
@@ -3115,7 +3161,7 @@ class $c extends Hc {
|
|
|
3115
3161
|
jt(this.restEncoder, t);
|
|
3116
3162
|
}
|
|
3117
3163
|
}
|
|
3118
|
-
class
|
|
3164
|
+
class $c {
|
|
3119
3165
|
constructor() {
|
|
3120
3166
|
this.restEncoder = Te(), this.dsCurrVal = 0;
|
|
3121
3167
|
}
|
|
@@ -3139,9 +3185,9 @@ class Fc {
|
|
|
3139
3185
|
t === 0 && q(), T(this.restEncoder, t - 1), this.dsCurrVal += t;
|
|
3140
3186
|
}
|
|
3141
3187
|
}
|
|
3142
|
-
class pn extends
|
|
3188
|
+
class pn extends $c {
|
|
3143
3189
|
constructor() {
|
|
3144
|
-
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Tn(), this.clientEncoder = new He(), this.leftClockEncoder = new Tn(), this.rightClockEncoder = new Tn(), this.infoEncoder = new Fi(Vn), this.stringEncoder = new
|
|
3190
|
+
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Tn(), this.clientEncoder = new He(), this.leftClockEncoder = new Tn(), this.rightClockEncoder = new Tn(), this.infoEncoder = new Fi(Vn), this.stringEncoder = new $l(), this.parentInfoEncoder = new Fi(Vn), this.typeRefEncoder = new He(), this.lenEncoder = new He();
|
|
3145
3191
|
}
|
|
3146
3192
|
toUint8Array() {
|
|
3147
3193
|
const t = Te();
|
|
@@ -3232,7 +3278,7 @@ class pn extends Fc {
|
|
|
3232
3278
|
n === void 0 ? (this.keyClockEncoder.write(this.keyClock++), this.stringEncoder.write(t)) : this.keyClockEncoder.write(n);
|
|
3233
3279
|
}
|
|
3234
3280
|
}
|
|
3235
|
-
const
|
|
3281
|
+
const Fc = (e, t, n, i) => {
|
|
3236
3282
|
i = Et(i, t[0].id.clock);
|
|
3237
3283
|
const s = ht(t, i);
|
|
3238
3284
|
T(e.restEncoder, t.length - s), e.writeClient(n), T(e.restEncoder, i);
|
|
@@ -3247,7 +3293,7 @@ const zc = (e, t, n, i) => {
|
|
|
3247
3293
|
}), gn(t).forEach((s, r) => {
|
|
3248
3294
|
n.has(r) || i.set(r, 0);
|
|
3249
3295
|
}), T(e.restEncoder, i.size), Vt(i.entries()).sort((s, r) => r[0] - s[0]).forEach(([s, r]) => {
|
|
3250
|
-
|
|
3296
|
+
Fc(
|
|
3251
3297
|
e,
|
|
3252
3298
|
/** @type {Array<GC|Item>} */
|
|
3253
3299
|
t.clients.get(s),
|
|
@@ -3255,41 +3301,41 @@ const zc = (e, t, n, i) => {
|
|
|
3255
3301
|
r
|
|
3256
3302
|
);
|
|
3257
3303
|
});
|
|
3258
|
-
},
|
|
3259
|
-
const n = ct(), i =
|
|
3304
|
+
}, zc = (e, t) => {
|
|
3305
|
+
const n = ct(), i = R(e.restDecoder);
|
|
3260
3306
|
for (let s = 0; s < i; s++) {
|
|
3261
|
-
const r =
|
|
3262
|
-
let c =
|
|
3307
|
+
const r = R(e.restDecoder), o = new Array(r), l = e.readClient();
|
|
3308
|
+
let c = R(e.restDecoder);
|
|
3263
3309
|
n.set(l, { i: 0, refs: o });
|
|
3264
3310
|
for (let a = 0; a < r; a++) {
|
|
3265
|
-
const
|
|
3266
|
-
switch (dn &
|
|
3311
|
+
const d = e.readInfo();
|
|
3312
|
+
switch (dn & d) {
|
|
3267
3313
|
case 0: {
|
|
3268
|
-
const
|
|
3269
|
-
o[a] = new it(C(l, c),
|
|
3314
|
+
const h = e.readLen();
|
|
3315
|
+
o[a] = new it(C(l, c), h), c += h;
|
|
3270
3316
|
break;
|
|
3271
3317
|
}
|
|
3272
3318
|
case 10: {
|
|
3273
|
-
const
|
|
3274
|
-
o[a] = new ot(C(l, c),
|
|
3319
|
+
const h = R(e.restDecoder);
|
|
3320
|
+
o[a] = new ot(C(l, c), h), c += h;
|
|
3275
3321
|
break;
|
|
3276
3322
|
}
|
|
3277
3323
|
default: {
|
|
3278
|
-
const
|
|
3324
|
+
const h = (d & (bt | K)) === 0, u = new I(
|
|
3279
3325
|
C(l, c),
|
|
3280
3326
|
null,
|
|
3281
3327
|
// left
|
|
3282
|
-
(
|
|
3328
|
+
(d & K) === K ? e.readLeftID() : null,
|
|
3283
3329
|
// origin
|
|
3284
3330
|
null,
|
|
3285
3331
|
// right
|
|
3286
|
-
(
|
|
3332
|
+
(d & bt) === bt ? e.readRightID() : null,
|
|
3287
3333
|
// right origin
|
|
3288
|
-
|
|
3334
|
+
h ? e.readParentInfo() ? t.get(e.readString()) : e.readLeftID() : null,
|
|
3289
3335
|
// parent
|
|
3290
|
-
|
|
3336
|
+
h && (d & ue) === ue ? e.readString() : null,
|
|
3291
3337
|
// parentSub
|
|
3292
|
-
Mr(e,
|
|
3338
|
+
Mr(e, d)
|
|
3293
3339
|
// item content
|
|
3294
3340
|
);
|
|
3295
3341
|
o[a] = u, c += u.length;
|
|
@@ -3298,7 +3344,7 @@ const zc = (e, t, n, i) => {
|
|
|
3298
3344
|
}
|
|
3299
3345
|
}
|
|
3300
3346
|
return n;
|
|
3301
|
-
},
|
|
3347
|
+
}, Wc = (e, t, n) => {
|
|
3302
3348
|
const i = [];
|
|
3303
3349
|
let s = Vt(n.keys()).sort((f, g) => f - g);
|
|
3304
3350
|
if (s.length === 0)
|
|
@@ -3325,56 +3371,56 @@ const zc = (e, t, n, i) => {
|
|
|
3325
3371
|
const m = c.get(f);
|
|
3326
3372
|
(m == null || m > g) && c.set(f, g);
|
|
3327
3373
|
};
|
|
3328
|
-
let
|
|
3374
|
+
let d = (
|
|
3329
3375
|
/** @type {any} */
|
|
3330
3376
|
o.refs[
|
|
3331
3377
|
/** @type {any} */
|
|
3332
3378
|
o.i++
|
|
3333
3379
|
]
|
|
3334
3380
|
);
|
|
3335
|
-
const
|
|
3381
|
+
const h = /* @__PURE__ */ new Map(), u = () => {
|
|
3336
3382
|
for (const f of i) {
|
|
3337
3383
|
const g = f.id.client, m = n.get(g);
|
|
3338
|
-
m ? (m.i--, l.clients.set(g, m.refs.slice(m.i)), n.delete(g), m.i = 0, m.refs = []) : l.clients.set(g, [f]), s = s.filter((
|
|
3384
|
+
m ? (m.i--, l.clients.set(g, m.refs.slice(m.i)), n.delete(g), m.i = 0, m.refs = []) : l.clients.set(g, [f]), s = s.filter((b) => b !== g);
|
|
3339
3385
|
}
|
|
3340
3386
|
i.length = 0;
|
|
3341
3387
|
};
|
|
3342
3388
|
for (; ; ) {
|
|
3343
|
-
if (
|
|
3344
|
-
const g = St(
|
|
3389
|
+
if (d.constructor !== ot) {
|
|
3390
|
+
const g = St(h, d.id.client, () => B(t, d.id.client)) - d.id.clock;
|
|
3345
3391
|
if (g < 0)
|
|
3346
|
-
i.push(
|
|
3392
|
+
i.push(d), a(d.id.client, d.id.clock - 1), u();
|
|
3347
3393
|
else {
|
|
3348
|
-
const m =
|
|
3394
|
+
const m = d.getMissing(e, t);
|
|
3349
3395
|
if (m !== null) {
|
|
3350
|
-
i.push(
|
|
3351
|
-
const
|
|
3396
|
+
i.push(d);
|
|
3397
|
+
const b = n.get(
|
|
3352
3398
|
/** @type {number} */
|
|
3353
3399
|
m
|
|
3354
3400
|
) || { refs: [], i: 0 };
|
|
3355
|
-
if (
|
|
3401
|
+
if (b.refs.length === b.i)
|
|
3356
3402
|
a(
|
|
3357
3403
|
/** @type {number} */
|
|
3358
3404
|
m,
|
|
3359
3405
|
B(t, m)
|
|
3360
3406
|
), u();
|
|
3361
3407
|
else {
|
|
3362
|
-
|
|
3408
|
+
d = b.refs[b.i++];
|
|
3363
3409
|
continue;
|
|
3364
3410
|
}
|
|
3365
|
-
} else (g === 0 || g <
|
|
3411
|
+
} else (g === 0 || g < d.length) && (d.integrate(e, g), h.set(d.id.client, d.id.clock + d.length));
|
|
3366
3412
|
}
|
|
3367
3413
|
}
|
|
3368
3414
|
if (i.length > 0)
|
|
3369
|
-
|
|
3415
|
+
d = /** @type {GC|Item} */
|
|
3370
3416
|
i.pop();
|
|
3371
3417
|
else if (o !== null && o.i < o.refs.length)
|
|
3372
|
-
|
|
3418
|
+
d = /** @type {GC|Item} */
|
|
3373
3419
|
o.refs[o.i++];
|
|
3374
3420
|
else {
|
|
3375
3421
|
if (o = r(), o === null)
|
|
3376
3422
|
break;
|
|
3377
|
-
|
|
3423
|
+
d = /** @type {GC|Item} */
|
|
3378
3424
|
o.refs[o.i++];
|
|
3379
3425
|
}
|
|
3380
3426
|
}
|
|
@@ -3383,33 +3429,33 @@ const zc = (e, t, n, i) => {
|
|
|
3383
3429
|
return rr(f, l, /* @__PURE__ */ new Map()), T(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
|
|
3384
3430
|
}
|
|
3385
3431
|
return null;
|
|
3386
|
-
},
|
|
3432
|
+
}, jc = (e, t) => rr(e, t.doc.store, t.beforeState), Kc = (e, t, n, i = new Je(e)) => O(t, (s) => {
|
|
3387
3433
|
s.local = !1;
|
|
3388
3434
|
let r = !1;
|
|
3389
|
-
const o = s.doc, l = o.store, c =
|
|
3390
|
-
if (
|
|
3391
|
-
for (const [u, f] of
|
|
3435
|
+
const o = s.doc, l = o.store, c = zc(i, o), a = Wc(s, l, c), d = l.pendingStructs;
|
|
3436
|
+
if (d) {
|
|
3437
|
+
for (const [u, f] of d.missing)
|
|
3392
3438
|
if (f < B(l, u)) {
|
|
3393
3439
|
r = !0;
|
|
3394
3440
|
break;
|
|
3395
3441
|
}
|
|
3396
3442
|
if (a) {
|
|
3397
3443
|
for (const [u, f] of a.missing) {
|
|
3398
|
-
const g =
|
|
3399
|
-
(g == null || g > f) &&
|
|
3444
|
+
const g = d.missing.get(u);
|
|
3445
|
+
(g == null || g > f) && d.missing.set(u, f);
|
|
3400
3446
|
}
|
|
3401
|
-
|
|
3447
|
+
d.update = ss([d.update, a.update]);
|
|
3402
3448
|
}
|
|
3403
3449
|
} else
|
|
3404
3450
|
l.pendingStructs = a;
|
|
3405
|
-
const
|
|
3451
|
+
const h = Ji(i, s, l);
|
|
3406
3452
|
if (l.pendingDs) {
|
|
3407
3453
|
const u = new Je(li(l.pendingDs));
|
|
3408
|
-
|
|
3454
|
+
R(u.restDecoder);
|
|
3409
3455
|
const f = Ji(u, s, l);
|
|
3410
|
-
|
|
3456
|
+
h && f ? l.pendingDs = ss([h, f]) : l.pendingDs = h || f;
|
|
3411
3457
|
} else
|
|
3412
|
-
l.pendingDs =
|
|
3458
|
+
l.pendingDs = h;
|
|
3413
3459
|
if (r) {
|
|
3414
3460
|
const u = (
|
|
3415
3461
|
/** @type {{update: Uint8Array}} */
|
|
@@ -3419,14 +3465,14 @@ const zc = (e, t, n, i) => {
|
|
|
3419
3465
|
}
|
|
3420
3466
|
}, n, !1), Wn = (e, t, n, i = Je) => {
|
|
3421
3467
|
const s = li(t);
|
|
3422
|
-
|
|
3468
|
+
Kc(s, e, n, new i(s));
|
|
3423
3469
|
};
|
|
3424
|
-
class
|
|
3470
|
+
class Yc {
|
|
3425
3471
|
constructor() {
|
|
3426
3472
|
this.l = [];
|
|
3427
3473
|
}
|
|
3428
3474
|
}
|
|
3429
|
-
const qi = () => new
|
|
3475
|
+
const qi = () => new Yc(), Xi = (e, t) => e.l.push(t), Zi = (e, t) => {
|
|
3430
3476
|
const n = e.l, i = n.length;
|
|
3431
3477
|
e.l = n.filter((s) => t !== s), i === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
|
|
3432
3478
|
}, or = (e, t, n) => hi(e.l, [t, n]);
|
|
@@ -3464,7 +3510,7 @@ class qe {
|
|
|
3464
3510
|
this.type = t, this.tname = n, this.item = i, this.assoc = s;
|
|
3465
3511
|
}
|
|
3466
3512
|
}
|
|
3467
|
-
class
|
|
3513
|
+
class Gc {
|
|
3468
3514
|
/**
|
|
3469
3515
|
* @param {AbstractType<any>} type
|
|
3470
3516
|
* @param {number} index
|
|
@@ -3474,7 +3520,7 @@ class Jc {
|
|
|
3474
3520
|
this.type = t, this.index = n, this.assoc = i;
|
|
3475
3521
|
}
|
|
3476
3522
|
}
|
|
3477
|
-
const
|
|
3523
|
+
const Jc = (e, t, n = 0) => new Gc(e, t, n), Re = (e, t, n) => {
|
|
3478
3524
|
let i = null, s = null;
|
|
3479
3525
|
return e._item === null ? s = me(e) : i = C(e._item.id.client, e._item.id.clock), new qe(i, s, t, n);
|
|
3480
3526
|
}, In = (e, t, n = 0) => {
|
|
@@ -3495,25 +3541,25 @@ const qc = (e, t, n = 0) => new Jc(e, t, n), Re = (e, t, n) => {
|
|
|
3495
3541
|
i = i.right;
|
|
3496
3542
|
}
|
|
3497
3543
|
return Re(e, null, n);
|
|
3498
|
-
},
|
|
3544
|
+
}, qc = (e, t) => {
|
|
3499
3545
|
const n = Yt(e, t), i = t.clock - n.id.clock;
|
|
3500
3546
|
return {
|
|
3501
3547
|
item: n,
|
|
3502
3548
|
diff: i
|
|
3503
3549
|
};
|
|
3504
|
-
},
|
|
3550
|
+
}, Xc = (e, t, n = !0) => {
|
|
3505
3551
|
const i = t.store, s = e.item, r = e.type, o = e.tname, l = e.assoc;
|
|
3506
3552
|
let c = null, a = 0;
|
|
3507
3553
|
if (s !== null) {
|
|
3508
3554
|
if (B(i, s.client) <= s.clock)
|
|
3509
3555
|
return null;
|
|
3510
|
-
const
|
|
3511
|
-
if (!(
|
|
3556
|
+
const d = n ? Gn(i, s) : qc(i, s), h = d.item;
|
|
3557
|
+
if (!(h instanceof I))
|
|
3512
3558
|
return null;
|
|
3513
3559
|
if (c = /** @type {AbstractType<any>} */
|
|
3514
|
-
|
|
3515
|
-
a =
|
|
3516
|
-
let u =
|
|
3560
|
+
h.parent, c._item === null || !c._item.deleted) {
|
|
3561
|
+
a = h.deleted || !h.countable ? 0 : d.diff + (l >= 0 ? 0 : 1);
|
|
3562
|
+
let u = h.left;
|
|
3517
3563
|
for (; u !== null; )
|
|
3518
3564
|
!u.deleted && u.countable && (a += u.length), u = u.left;
|
|
3519
3565
|
}
|
|
@@ -3523,16 +3569,16 @@ const qc = (e, t, n = 0) => new Jc(e, t, n), Re = (e, t, n) => {
|
|
|
3523
3569
|
else if (r !== null) {
|
|
3524
3570
|
if (B(i, r.client) <= r.clock)
|
|
3525
3571
|
return null;
|
|
3526
|
-
const { item:
|
|
3527
|
-
if (
|
|
3528
|
-
c =
|
|
3572
|
+
const { item: d } = n ? Gn(i, r) : { item: Yt(i, r) };
|
|
3573
|
+
if (d instanceof I && d.content instanceof ut)
|
|
3574
|
+
c = d.content.type;
|
|
3529
3575
|
else
|
|
3530
3576
|
return null;
|
|
3531
3577
|
} else
|
|
3532
3578
|
throw q();
|
|
3533
3579
|
l >= 0 ? a = c._length : a = 0;
|
|
3534
3580
|
}
|
|
3535
|
-
return
|
|
3581
|
+
return Jc(c, a, e.assoc);
|
|
3536
3582
|
};
|
|
3537
3583
|
class gi {
|
|
3538
3584
|
/**
|
|
@@ -3543,7 +3589,7 @@ class gi {
|
|
|
3543
3589
|
this.ds = t, this.sv = n;
|
|
3544
3590
|
}
|
|
3545
3591
|
}
|
|
3546
|
-
const lr = (e, t) => new gi(e, t), On = (e) => lr(
|
|
3592
|
+
const lr = (e, t) => new gi(e, t), On = (e) => lr(Lc(e.store), gn(e.store)), Rt = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ie(t.ds, e.id), jn = (e, t) => {
|
|
3547
3593
|
const n = St(e.meta, jn, Bt), i = e.doc.store;
|
|
3548
3594
|
n.has(t) || (t.sv.forEach((s, r) => {
|
|
3549
3595
|
s < B(i, r) && G(e, C(r, s));
|
|
@@ -3592,15 +3638,15 @@ const gn = (e) => {
|
|
|
3592
3638
|
o = xt((n + i) / 2);
|
|
3593
3639
|
}
|
|
3594
3640
|
throw q();
|
|
3595
|
-
},
|
|
3641
|
+
}, Zc = (e, t) => {
|
|
3596
3642
|
const n = e.clients.get(t.client);
|
|
3597
3643
|
return n[ht(n, t.clock)];
|
|
3598
3644
|
}, Yt = (
|
|
3599
3645
|
/** @type {function(StructStore,ID):Item} */
|
|
3600
|
-
|
|
3646
|
+
Zc
|
|
3601
3647
|
), Kn = (e, t, n) => {
|
|
3602
3648
|
const i = ht(t, n), s = t[i];
|
|
3603
|
-
return s.id.clock < n && s instanceof
|
|
3649
|
+
return s.id.clock < n && s instanceof I ? (t.splice(i + 1, 0, en(e, s, n - s.id.clock)), i + 1) : i;
|
|
3604
3650
|
}, G = (e, t) => {
|
|
3605
3651
|
const n = (
|
|
3606
3652
|
/** @type {Array<Item>} */
|
|
@@ -3610,7 +3656,7 @@ const gn = (e) => {
|
|
|
3610
3656
|
}, Qi = (e, t, n) => {
|
|
3611
3657
|
const i = t.clients.get(n.client), s = ht(i, n.clock), r = i[s];
|
|
3612
3658
|
return n.clock !== r.id.clock + r.length - 1 && r.constructor !== it && i.splice(s + 1, 0, en(e, r, n.clock - r.id.clock + 1)), r;
|
|
3613
|
-
},
|
|
3659
|
+
}, Qc = (e, t, n) => {
|
|
3614
3660
|
const i = (
|
|
3615
3661
|
/** @type {Array<GC|Item>} */
|
|
3616
3662
|
e.clients.get(t.id.client)
|
|
@@ -3625,7 +3671,7 @@ const gn = (e) => {
|
|
|
3625
3671
|
l = t[o++], r < l.id.clock + l.length && Kn(e, t, r), s(l);
|
|
3626
3672
|
while (o < t.length && t[o].id.clock < r);
|
|
3627
3673
|
};
|
|
3628
|
-
class
|
|
3674
|
+
class ta {
|
|
3629
3675
|
/**
|
|
3630
3676
|
* @param {Doc} doc
|
|
3631
3677
|
* @param {any} origin
|
|
@@ -3635,14 +3681,14 @@ class ea {
|
|
|
3635
3681
|
this.doc = t, this.deleteSet = new ne(), this.beforeState = gn(t.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = n, this.meta = /* @__PURE__ */ new Map(), this.local = i, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
|
|
3636
3682
|
}
|
|
3637
3683
|
}
|
|
3638
|
-
const ts = (e, t) => t.deleteSet.clients.size === 0 && !
|
|
3684
|
+
const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i) => t.beforeState.get(i) !== n) ? !1 : (fi(t.deleteSet), jc(e, t), pi(e, t.deleteSet), !0), es = (e, t, n) => {
|
|
3639
3685
|
const i = t._item;
|
|
3640
3686
|
(i === null || i.id.clock < (e.beforeState.get(i.id.client) || 0) && !i.deleted) && St(e.changed, t, Bt).add(n);
|
|
3641
3687
|
}, Fe = (e, t) => {
|
|
3642
3688
|
let n = e[t], i = e[t - 1], s = t;
|
|
3643
3689
|
for (; s > 0; n = i, i = e[--s - 1]) {
|
|
3644
3690
|
if (i.deleted === n.deleted && i.constructor === n.constructor && i.mergeWith(n)) {
|
|
3645
|
-
n instanceof
|
|
3691
|
+
n instanceof I && n.parentSub !== null && /** @type {AbstractType<any>} */
|
|
3646
3692
|
n.parent._map.get(n.parentSub) === n && n.parent._map.set(
|
|
3647
3693
|
n.parentSub,
|
|
3648
3694
|
/** @type {Item} */
|
|
@@ -3654,7 +3700,7 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !bl(t.afterState, (n, i)
|
|
|
3654
3700
|
}
|
|
3655
3701
|
const r = t - s;
|
|
3656
3702
|
return r && e.splice(t + 1 - r, r), r;
|
|
3657
|
-
},
|
|
3703
|
+
}, ea = (e, t, n) => {
|
|
3658
3704
|
for (const [i, s] of e.clients.entries()) {
|
|
3659
3705
|
const r = (
|
|
3660
3706
|
/** @type {Array<GC|Item>} */
|
|
@@ -3662,15 +3708,15 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !bl(t.afterState, (n, i)
|
|
|
3662
3708
|
);
|
|
3663
3709
|
for (let o = s.length - 1; o >= 0; o--) {
|
|
3664
3710
|
const l = s[o], c = l.clock + l.len;
|
|
3665
|
-
for (let a = ht(r, l.clock),
|
|
3666
|
-
const
|
|
3667
|
-
if (l.clock + l.len <=
|
|
3711
|
+
for (let a = ht(r, l.clock), d = r[a]; a < r.length && d.id.clock < c; d = r[++a]) {
|
|
3712
|
+
const h = r[a];
|
|
3713
|
+
if (l.clock + l.len <= h.id.clock)
|
|
3668
3714
|
break;
|
|
3669
|
-
|
|
3715
|
+
h instanceof I && h.deleted && !h.keep && n(h) && h.gc(t, !1);
|
|
3670
3716
|
}
|
|
3671
3717
|
}
|
|
3672
3718
|
}
|
|
3673
|
-
},
|
|
3719
|
+
}, na = (e, t) => {
|
|
3674
3720
|
e.clients.forEach((n, i) => {
|
|
3675
3721
|
const s = (
|
|
3676
3722
|
/** @type {Array<GC|Item>} */
|
|
@@ -3695,49 +3741,49 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !bl(t.afterState, (n, i)
|
|
|
3695
3741
|
), l.push(() => {
|
|
3696
3742
|
n.changedParentTypes.forEach((c, a) => {
|
|
3697
3743
|
a._dEH.l.length > 0 && (a._item === null || !a._item.deleted) && (c = c.filter(
|
|
3698
|
-
(
|
|
3699
|
-
), c.forEach((
|
|
3700
|
-
|
|
3701
|
-
}), c.sort((
|
|
3744
|
+
(d) => d.target._item === null || !d.target._item.deleted
|
|
3745
|
+
), c.forEach((d) => {
|
|
3746
|
+
d.currentTarget = a, d._path = null;
|
|
3747
|
+
}), c.sort((d, h) => d.path.length - h.path.length), or(a._dEH, c, n));
|
|
3702
3748
|
});
|
|
3703
|
-
}), l.push(() => i.emit("afterTransaction", [n, i])), hi(l, []), n._needFormattingCleanup &&
|
|
3749
|
+
}), l.push(() => i.emit("afterTransaction", [n, i])), hi(l, []), n._needFormattingCleanup && ka(n);
|
|
3704
3750
|
} finally {
|
|
3705
|
-
i.gc &&
|
|
3706
|
-
const u = n.beforeState.get(
|
|
3707
|
-
if (u !==
|
|
3751
|
+
i.gc && ea(r, s, i.gcFilter), na(r, s), n.afterState.forEach((d, h) => {
|
|
3752
|
+
const u = n.beforeState.get(h) || 0;
|
|
3753
|
+
if (u !== d) {
|
|
3708
3754
|
const f = (
|
|
3709
3755
|
/** @type {Array<GC|Item>} */
|
|
3710
|
-
s.clients.get(
|
|
3756
|
+
s.clients.get(h)
|
|
3711
3757
|
), g = Et(ht(f, u), 1);
|
|
3712
3758
|
for (let m = f.length - 1; m >= g; )
|
|
3713
3759
|
m -= 1 + Fe(f, m);
|
|
3714
3760
|
}
|
|
3715
3761
|
});
|
|
3716
|
-
for (let
|
|
3717
|
-
const { client:
|
|
3762
|
+
for (let d = o.length - 1; d >= 0; d--) {
|
|
3763
|
+
const { client: h, clock: u } = o[d].id, f = (
|
|
3718
3764
|
/** @type {Array<GC|Item>} */
|
|
3719
|
-
s.clients.get(
|
|
3765
|
+
s.clients.get(h)
|
|
3720
3766
|
), g = ht(f, u);
|
|
3721
3767
|
g + 1 < f.length && Fe(f, g + 1) > 1 || g > 0 && Fe(f, g);
|
|
3722
3768
|
}
|
|
3723
|
-
if (!n.local && n.afterState.get(i.clientID) !== n.beforeState.get(i.clientID) && (
|
|
3724
|
-
const
|
|
3725
|
-
ts(
|
|
3769
|
+
if (!n.local && n.afterState.get(i.clientID) !== n.beforeState.get(i.clientID) && (Rc(di, qs, "[yjs] ", Xs, Zs, "Changed the client-id because another client seems to be using it."), i.clientID = sr()), i.emit("afterTransactionCleanup", [n, i]), i._observers.has("update")) {
|
|
3770
|
+
const d = new Hc();
|
|
3771
|
+
ts(d, n) && i.emit("update", [d.toUint8Array(), n.origin, i, n]);
|
|
3726
3772
|
}
|
|
3727
3773
|
if (i._observers.has("updateV2")) {
|
|
3728
|
-
const
|
|
3729
|
-
ts(
|
|
3774
|
+
const d = new pn();
|
|
3775
|
+
ts(d, n) && i.emit("updateV2", [d.toUint8Array(), n.origin, i, n]);
|
|
3730
3776
|
}
|
|
3731
3777
|
const { subdocsAdded: l, subdocsLoaded: c, subdocsRemoved: a } = n;
|
|
3732
|
-
(l.size > 0 || a.size > 0 || c.size > 0) && (l.forEach((
|
|
3733
|
-
|
|
3734
|
-
}), a.forEach((
|
|
3778
|
+
(l.size > 0 || a.size > 0 || c.size > 0) && (l.forEach((d) => {
|
|
3779
|
+
d.clientID = i.clientID, d.collectionid == null && (d.collectionid = i.collectionid), i.subdocs.add(d);
|
|
3780
|
+
}), a.forEach((d) => i.subdocs.delete(d)), i.emit("subdocs", [{ loaded: c, added: l, removed: a }, i, n]), a.forEach((d) => d.destroy())), e.length <= t + 1 ? (i._transactionCleanups = [], i.emit("afterAllTransactions", [i, e])) : dr(e, t + 1);
|
|
3735
3781
|
}
|
|
3736
3782
|
}
|
|
3737
|
-
},
|
|
3783
|
+
}, O = (e, t, n = null, i = !0) => {
|
|
3738
3784
|
const s = e._transactionCleanups;
|
|
3739
3785
|
let r = !1, o = null;
|
|
3740
|
-
e._transaction === null && (r = !0, e._transaction = new
|
|
3786
|
+
e._transaction === null && (r = !0, e._transaction = new ta(e, n, i), s.push(e._transaction), s.length === 1 && e.emit("beforeAllTransactions", [e]), e.emit("beforeTransaction", [e._transaction, e]));
|
|
3741
3787
|
try {
|
|
3742
3788
|
o = t(e._transaction);
|
|
3743
3789
|
} finally {
|
|
@@ -3748,7 +3794,7 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !bl(t.afterState, (n, i)
|
|
|
3748
3794
|
}
|
|
3749
3795
|
return o;
|
|
3750
3796
|
};
|
|
3751
|
-
class
|
|
3797
|
+
class ia {
|
|
3752
3798
|
/**
|
|
3753
3799
|
* @param {DeleteSet} deletions
|
|
3754
3800
|
* @param {DeleteSet} insertions
|
|
@@ -3759,7 +3805,7 @@ class sa {
|
|
|
3759
3805
|
}
|
|
3760
3806
|
const ns = (e, t, n) => {
|
|
3761
3807
|
Dt(e, n.deletions, (i) => {
|
|
3762
|
-
i instanceof
|
|
3808
|
+
i instanceof I && t.scope.some((s) => s === e.doc || we(
|
|
3763
3809
|
/** @type {AbstractType<any>} */
|
|
3764
3810
|
s,
|
|
3765
3811
|
i
|
|
@@ -3768,15 +3814,15 @@ const ns = (e, t, n) => {
|
|
|
3768
3814
|
}, is = (e, t, n) => {
|
|
3769
3815
|
let i = null;
|
|
3770
3816
|
const s = e.doc, r = e.scope;
|
|
3771
|
-
|
|
3817
|
+
O(s, (l) => {
|
|
3772
3818
|
for (; t.length > 0 && e.currStackItem === null; ) {
|
|
3773
3819
|
const c = s.store, a = (
|
|
3774
3820
|
/** @type {StackItem} */
|
|
3775
3821
|
t.pop()
|
|
3776
|
-
),
|
|
3822
|
+
), d = /* @__PURE__ */ new Set(), h = [];
|
|
3777
3823
|
let u = !1;
|
|
3778
3824
|
Dt(l, a.insertions, (f) => {
|
|
3779
|
-
if (f instanceof
|
|
3825
|
+
if (f instanceof I) {
|
|
3780
3826
|
if (f.redone !== null) {
|
|
3781
3827
|
let { item: g, diff: m } = Gn(c, f.id);
|
|
3782
3828
|
m > 0 && (g = G(l, C(g.id.client, g.id.clock + m))), f = g;
|
|
@@ -3786,20 +3832,20 @@ const ns = (e, t, n) => {
|
|
|
3786
3832
|
g,
|
|
3787
3833
|
/** @type {Item} */
|
|
3788
3834
|
f
|
|
3789
|
-
)) &&
|
|
3835
|
+
)) && h.push(f);
|
|
3790
3836
|
}
|
|
3791
3837
|
}), Dt(l, a.deletions, (f) => {
|
|
3792
|
-
f instanceof
|
|
3838
|
+
f instanceof I && r.some((g) => g === l.doc || we(
|
|
3793
3839
|
/** @type {AbstractType<any>} */
|
|
3794
3840
|
g,
|
|
3795
3841
|
f
|
|
3796
3842
|
)) && // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval.
|
|
3797
|
-
!ie(a.insertions, f.id) &&
|
|
3798
|
-
}),
|
|
3799
|
-
u = Or(l, f,
|
|
3843
|
+
!ie(a.insertions, f.id) && d.add(f);
|
|
3844
|
+
}), d.forEach((f) => {
|
|
3845
|
+
u = Or(l, f, d, a.insertions, e.ignoreRemoteMapChanges, e) !== null || u;
|
|
3800
3846
|
});
|
|
3801
|
-
for (let f =
|
|
3802
|
-
const g =
|
|
3847
|
+
for (let f = h.length - 1; f >= 0; f--) {
|
|
3848
|
+
const g = h[f];
|
|
3803
3849
|
e.deleteFilter(g) && (g.delete(l), u = !0);
|
|
3804
3850
|
}
|
|
3805
3851
|
e.currStackItem = u ? a : null;
|
|
@@ -3832,38 +3878,38 @@ class ur extends Ps {
|
|
|
3832
3878
|
)
|
|
3833
3879
|
} = {}) {
|
|
3834
3880
|
super(), this.scope = [], this.doc = l, this.addToScope(t), this.deleteFilter = s, r.add(this), this.trackedOrigins = r, this.captureTransaction = i, this.undoStack = [], this.redoStack = [], this.undoing = !1, this.redoing = !1, this.currStackItem = null, this.lastChange = 0, this.ignoreRemoteMapChanges = o, this.captureTimeout = n, this.afterTransactionHandler = (c) => {
|
|
3835
|
-
if (!this.captureTransaction(c) || !this.scope.some((
|
|
3881
|
+
if (!this.captureTransaction(c) || !this.scope.some((b) => c.changedParentTypes.has(
|
|
3836
3882
|
/** @type {AbstractType<any>} */
|
|
3837
|
-
|
|
3838
|
-
) ||
|
|
3883
|
+
b
|
|
3884
|
+
) || b === this.doc) || !this.trackedOrigins.has(c.origin) && (!c.origin || !this.trackedOrigins.has(c.origin.constructor)))
|
|
3839
3885
|
return;
|
|
3840
|
-
const a = this.undoing,
|
|
3841
|
-
a ? this.stopCapturing() :
|
|
3886
|
+
const a = this.undoing, d = this.redoing, h = a ? this.redoStack : this.undoStack;
|
|
3887
|
+
a ? this.stopCapturing() : d || this.clear(!1, !0);
|
|
3842
3888
|
const u = new ne();
|
|
3843
|
-
c.afterState.forEach((
|
|
3844
|
-
const
|
|
3845
|
-
A > 0 && ge(u,
|
|
3889
|
+
c.afterState.forEach((b, w) => {
|
|
3890
|
+
const D = c.beforeState.get(w) || 0, A = b - D;
|
|
3891
|
+
A > 0 && ge(u, w, D, A);
|
|
3846
3892
|
});
|
|
3847
|
-
const f =
|
|
3893
|
+
const f = nc();
|
|
3848
3894
|
let g = !1;
|
|
3849
|
-
if (this.lastChange > 0 && f - this.lastChange < this.captureTimeout &&
|
|
3850
|
-
const
|
|
3851
|
-
|
|
3895
|
+
if (this.lastChange > 0 && f - this.lastChange < this.captureTimeout && h.length > 0 && !a && !d) {
|
|
3896
|
+
const b = h[h.length - 1];
|
|
3897
|
+
b.deletions = zn([b.deletions, c.deleteSet]), b.insertions = zn([b.insertions, u]);
|
|
3852
3898
|
} else
|
|
3853
|
-
|
|
3854
|
-
!a && !
|
|
3899
|
+
h.push(new ia(c.deleteSet, u)), g = !0;
|
|
3900
|
+
!a && !d && (this.lastChange = f), Dt(
|
|
3855
3901
|
c,
|
|
3856
3902
|
c.deleteSet,
|
|
3857
3903
|
/** @param {Item|GC} item */
|
|
3858
|
-
(
|
|
3859
|
-
|
|
3904
|
+
(b) => {
|
|
3905
|
+
b instanceof I && this.scope.some((w) => w === c.doc || we(
|
|
3860
3906
|
/** @type {AbstractType<any>} */
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
)) && xi(
|
|
3907
|
+
w,
|
|
3908
|
+
b
|
|
3909
|
+
)) && xi(b, !0);
|
|
3864
3910
|
}
|
|
3865
3911
|
);
|
|
3866
|
-
const m = [{ stackItem:
|
|
3912
|
+
const m = [{ stackItem: h[h.length - 1], origin: c.origin, type: a ? "redo" : "undo", changedParentTypes: c.changedParentTypes }, this];
|
|
3867
3913
|
g ? this.emit("stack-item-added", m) : this.emit("stack-item-updated", m);
|
|
3868
3914
|
}, this.doc.on("afterTransaction", this.afterTransactionHandler), this.doc.on("destroy", () => {
|
|
3869
3915
|
this.destroy();
|
|
@@ -3970,18 +4016,18 @@ class ur extends Ps {
|
|
|
3970
4016
|
this.trackedOrigins.delete(this), this.doc.off("afterTransaction", this.afterTransactionHandler), super.destroy();
|
|
3971
4017
|
}
|
|
3972
4018
|
}
|
|
3973
|
-
function*
|
|
3974
|
-
const t =
|
|
4019
|
+
function* sa(e) {
|
|
4020
|
+
const t = R(e.restDecoder);
|
|
3975
4021
|
for (let n = 0; n < t; n++) {
|
|
3976
|
-
const i =
|
|
3977
|
-
let r =
|
|
4022
|
+
const i = R(e.restDecoder), s = e.readClient();
|
|
4023
|
+
let r = R(e.restDecoder);
|
|
3978
4024
|
for (let o = 0; o < i; o++) {
|
|
3979
4025
|
const l = e.readInfo();
|
|
3980
4026
|
if (l === 10) {
|
|
3981
|
-
const c =
|
|
4027
|
+
const c = R(e.restDecoder);
|
|
3982
4028
|
yield new ot(C(s, r), c), r += c;
|
|
3983
4029
|
} else if ((dn & l) !== 0) {
|
|
3984
|
-
const c = (l & (bt | K)) === 0, a = new
|
|
4030
|
+
const c = (l & (bt | K)) === 0, a = new I(
|
|
3985
4031
|
C(s, r),
|
|
3986
4032
|
null,
|
|
3987
4033
|
// left
|
|
@@ -4007,13 +4053,13 @@ function* ra(e) {
|
|
|
4007
4053
|
}
|
|
4008
4054
|
}
|
|
4009
4055
|
}
|
|
4010
|
-
class
|
|
4056
|
+
class ra {
|
|
4011
4057
|
/**
|
|
4012
4058
|
* @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
|
|
4013
4059
|
* @param {boolean} filterSkips
|
|
4014
4060
|
*/
|
|
4015
4061
|
constructor(t, n) {
|
|
4016
|
-
this.gen =
|
|
4062
|
+
this.gen = sa(t), this.curr = null, this.done = !1, this.filterSkips = n, this.next();
|
|
4017
4063
|
}
|
|
4018
4064
|
/**
|
|
4019
4065
|
* @return {Item | GC | Skip |null}
|
|
@@ -4025,7 +4071,7 @@ class oa {
|
|
|
4025
4071
|
return this.curr;
|
|
4026
4072
|
}
|
|
4027
4073
|
}
|
|
4028
|
-
class
|
|
4074
|
+
class oa {
|
|
4029
4075
|
/**
|
|
4030
4076
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
4031
4077
|
*/
|
|
@@ -4033,7 +4079,7 @@ class la {
|
|
|
4033
4079
|
this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = t, this.clientStructs = [];
|
|
4034
4080
|
}
|
|
4035
4081
|
}
|
|
4036
|
-
const
|
|
4082
|
+
const la = (e, t) => {
|
|
4037
4083
|
if (e.constructor === it) {
|
|
4038
4084
|
const { client: n, clock: i } = e.id;
|
|
4039
4085
|
return new it(C(n, i + t), e.length - t);
|
|
@@ -4045,7 +4091,7 @@ const ca = (e, t) => {
|
|
|
4045
4091
|
/** @type {Item} */
|
|
4046
4092
|
e
|
|
4047
4093
|
), { client: i, clock: s } = n.id;
|
|
4048
|
-
return new
|
|
4094
|
+
return new I(
|
|
4049
4095
|
C(i, s + t),
|
|
4050
4096
|
null,
|
|
4051
4097
|
C(i, s + t - 1),
|
|
@@ -4059,9 +4105,9 @@ const ca = (e, t) => {
|
|
|
4059
4105
|
}, ss = (e, t = Je, n = pn) => {
|
|
4060
4106
|
if (e.length === 1)
|
|
4061
4107
|
return e[0];
|
|
4062
|
-
const i = e.map((
|
|
4063
|
-
let s = i.map((
|
|
4064
|
-
const o = new n(), l = new
|
|
4108
|
+
const i = e.map((d) => new t(li(d)));
|
|
4109
|
+
let s = i.map((d) => new ra(d, !0)), r = null;
|
|
4110
|
+
const o = new n(), l = new oa(o);
|
|
4065
4111
|
for (; s = s.filter((u) => u.curr !== null), s.sort(
|
|
4066
4112
|
/** @type {function(any,any):number} */
|
|
4067
4113
|
(u, f) => {
|
|
@@ -4072,54 +4118,54 @@ const ca = (e, t) => {
|
|
|
4072
4118
|
return f.curr.id.client - u.curr.id.client;
|
|
4073
4119
|
}
|
|
4074
4120
|
), s.length !== 0; ) {
|
|
4075
|
-
const
|
|
4121
|
+
const d = s[0], h = (
|
|
4076
4122
|
/** @type {Item | GC} */
|
|
4077
|
-
|
|
4123
|
+
d.curr.id.client
|
|
4078
4124
|
);
|
|
4079
4125
|
if (r !== null) {
|
|
4080
4126
|
let u = (
|
|
4081
4127
|
/** @type {Item | GC | null} */
|
|
4082
|
-
|
|
4128
|
+
d.curr
|
|
4083
4129
|
), f = !1;
|
|
4084
4130
|
for (; u !== null && u.id.clock + u.length <= r.struct.id.clock + r.struct.length && u.id.client >= r.struct.id.client; )
|
|
4085
|
-
u =
|
|
4131
|
+
u = d.next(), f = !0;
|
|
4086
4132
|
if (u === null || // current decoder is empty
|
|
4087
|
-
u.id.client !==
|
|
4133
|
+
u.id.client !== h || // check whether there is another decoder that has has updates from `firstClient`
|
|
4088
4134
|
f && u.id.clock > r.struct.id.clock + r.struct.length)
|
|
4089
4135
|
continue;
|
|
4090
|
-
if (
|
|
4091
|
-
ae(l, r.struct, r.offset), r = { struct: u, offset: 0 },
|
|
4136
|
+
if (h !== r.struct.id.client)
|
|
4137
|
+
ae(l, r.struct, r.offset), r = { struct: u, offset: 0 }, d.next();
|
|
4092
4138
|
else if (r.struct.id.clock + r.struct.length < u.id.clock)
|
|
4093
4139
|
if (r.struct.constructor === ot)
|
|
4094
4140
|
r.struct.length = u.id.clock + u.length - r.struct.id.clock;
|
|
4095
4141
|
else {
|
|
4096
4142
|
ae(l, r.struct, r.offset);
|
|
4097
4143
|
const g = u.id.clock - r.struct.id.clock - r.struct.length;
|
|
4098
|
-
r = { struct: new ot(C(
|
|
4144
|
+
r = { struct: new ot(C(h, r.struct.id.clock + r.struct.length), g), offset: 0 };
|
|
4099
4145
|
}
|
|
4100
4146
|
else {
|
|
4101
4147
|
const g = r.struct.id.clock + r.struct.length - u.id.clock;
|
|
4102
|
-
g > 0 && (r.struct.constructor === ot ? r.struct.length -= g : u =
|
|
4148
|
+
g > 0 && (r.struct.constructor === ot ? r.struct.length -= g : u = la(u, g)), r.struct.mergeWith(
|
|
4103
4149
|
/** @type {any} */
|
|
4104
4150
|
u
|
|
4105
|
-
) || (ae(l, r.struct, r.offset), r = { struct: u, offset: 0 },
|
|
4151
|
+
) || (ae(l, r.struct, r.offset), r = { struct: u, offset: 0 }, d.next());
|
|
4106
4152
|
}
|
|
4107
4153
|
} else
|
|
4108
4154
|
r = { struct: (
|
|
4109
4155
|
/** @type {Item | GC} */
|
|
4110
|
-
|
|
4111
|
-
), offset: 0 },
|
|
4112
|
-
for (let u =
|
|
4156
|
+
d.curr
|
|
4157
|
+
), offset: 0 }, d.next();
|
|
4158
|
+
for (let u = d.curr; u !== null && u.id.client === h && u.id.clock === r.struct.id.clock + r.struct.length && u.constructor !== ot; u = d.next())
|
|
4113
4159
|
ae(l, r.struct, r.offset), r = { struct: u, offset: 0 };
|
|
4114
4160
|
}
|
|
4115
|
-
r !== null && (ae(l, r.struct, r.offset), r = null),
|
|
4116
|
-
const c = i.map((
|
|
4161
|
+
r !== null && (ae(l, r.struct, r.offset), r = null), ca(l);
|
|
4162
|
+
const c = i.map((d) => Pc(d)), a = zn(c);
|
|
4117
4163
|
return pi(o, a), o.toUint8Array();
|
|
4118
4164
|
}, fr = (e) => {
|
|
4119
4165
|
e.written > 0 && (e.clientStructs.push({ written: e.written, restEncoder: lt(e.encoder.restEncoder) }), e.encoder.restEncoder = Te(), e.written = 0);
|
|
4120
4166
|
}, ae = (e, t, n) => {
|
|
4121
4167
|
e.written > 0 && e.currClient !== t.id.client && fr(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), T(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
|
|
4122
|
-
},
|
|
4168
|
+
}, ca = (e) => {
|
|
4123
4169
|
fr(e);
|
|
4124
4170
|
const t = e.encoder.restEncoder;
|
|
4125
4171
|
T(t, e.clientStructs.length);
|
|
@@ -4150,7 +4196,7 @@ class mn {
|
|
|
4150
4196
|
* type === event.target // => true
|
|
4151
4197
|
*/
|
|
4152
4198
|
get path() {
|
|
4153
|
-
return this._path || (this._path =
|
|
4199
|
+
return this._path || (this._path = aa(this.currentTarget, this.target));
|
|
4154
4200
|
}
|
|
4155
4201
|
/**
|
|
4156
4202
|
* Check if a struct is deleted by this event.
|
|
@@ -4262,7 +4308,7 @@ class mn {
|
|
|
4262
4308
|
);
|
|
4263
4309
|
}
|
|
4264
4310
|
}
|
|
4265
|
-
const
|
|
4311
|
+
const aa = (e, t) => {
|
|
4266
4312
|
const n = [];
|
|
4267
4313
|
for (; t._item !== null && t !== e; ) {
|
|
4268
4314
|
if (t._item.parentSub !== null)
|
|
@@ -4284,7 +4330,7 @@ const ha = (e, t) => {
|
|
|
4284
4330
|
tr("Invalid access: Add Yjs type to a document before reading data.");
|
|
4285
4331
|
}, pr = 80;
|
|
4286
4332
|
let mi = 0;
|
|
4287
|
-
class
|
|
4333
|
+
class ha {
|
|
4288
4334
|
/**
|
|
4289
4335
|
* @param {Item} p
|
|
4290
4336
|
* @param {number} index
|
|
@@ -4293,16 +4339,16 @@ class da {
|
|
|
4293
4339
|
t.marker = !0, this.p = t, this.index = n, this.timestamp = mi++;
|
|
4294
4340
|
}
|
|
4295
4341
|
}
|
|
4296
|
-
const
|
|
4342
|
+
const da = (e) => {
|
|
4297
4343
|
e.timestamp = mi++;
|
|
4298
4344
|
}, gr = (e, t, n) => {
|
|
4299
4345
|
e.p.marker = !1, e.p = t, t.marker = !0, e.index = n, e.timestamp = mi++;
|
|
4300
|
-
},
|
|
4346
|
+
}, ua = (e, t, n) => {
|
|
4301
4347
|
if (e.length >= pr) {
|
|
4302
4348
|
const i = e.reduce((s, r) => s.timestamp < r.timestamp ? s : r);
|
|
4303
4349
|
return gr(i, t, n), i;
|
|
4304
4350
|
} else {
|
|
4305
|
-
const i = new
|
|
4351
|
+
const i = new ha(t, n);
|
|
4306
4352
|
return e.push(i), i;
|
|
4307
4353
|
}
|
|
4308
4354
|
}, wn = (e, t) => {
|
|
@@ -4310,7 +4356,7 @@ const ua = (e) => {
|
|
|
4310
4356
|
return null;
|
|
4311
4357
|
const n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((r, o) => Ve(t - r.index) < Ve(t - o.index) ? r : o);
|
|
4312
4358
|
let i = e._start, s = 0;
|
|
4313
|
-
for (n !== null && (i = n.p, s = n.index,
|
|
4359
|
+
for (n !== null && (i = n.p, s = n.index, da(n)); i.right !== null && s < t; ) {
|
|
4314
4360
|
if (!i.deleted && i.countable) {
|
|
4315
4361
|
if (t < s + i.length)
|
|
4316
4362
|
break;
|
|
@@ -4323,7 +4369,7 @@ const ua = (e) => {
|
|
|
4323
4369
|
for (; i.left !== null && i.left.id.client === i.id.client && i.left.id.clock + i.left.length === i.id.clock; )
|
|
4324
4370
|
i = i.left, !i.deleted && i.countable && (s -= i.length);
|
|
4325
4371
|
return n !== null && Ve(n.index - s) < /** @type {YText|YArray<any>} */
|
|
4326
|
-
i.parent.length / pr ? (gr(n, i, s), n) :
|
|
4372
|
+
i.parent.length / pr ? (gr(n, i, s), n) : ua(e._searchMarker, i, s);
|
|
4327
4373
|
}, be = (e, t, n) => {
|
|
4328
4374
|
for (let i = e.length - 1; i >= 0; i--) {
|
|
4329
4375
|
const s = e[i];
|
|
@@ -4510,7 +4556,7 @@ const mr = (e, t, n) => {
|
|
|
4510
4556
|
return ye(e, (i, s) => {
|
|
4511
4557
|
n.push(t(i, s, e));
|
|
4512
4558
|
}), n;
|
|
4513
|
-
},
|
|
4559
|
+
}, fa = (e) => {
|
|
4514
4560
|
let t = e._start, n = null, i = 0;
|
|
4515
4561
|
return {
|
|
4516
4562
|
[Symbol.iterator]() {
|
|
@@ -4548,44 +4594,44 @@ const mr = (e, t, n) => {
|
|
|
4548
4594
|
let s = n;
|
|
4549
4595
|
const r = e.doc, o = r.clientID, l = r.store, c = n === null ? t._start : n.right;
|
|
4550
4596
|
let a = [];
|
|
4551
|
-
const
|
|
4552
|
-
a.length > 0 && (s = new
|
|
4597
|
+
const d = () => {
|
|
4598
|
+
a.length > 0 && (s = new I(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new $t(a)), s.integrate(e, 0), a = []);
|
|
4553
4599
|
};
|
|
4554
|
-
i.forEach((
|
|
4555
|
-
if (
|
|
4556
|
-
a.push(
|
|
4600
|
+
i.forEach((h) => {
|
|
4601
|
+
if (h === null)
|
|
4602
|
+
a.push(h);
|
|
4557
4603
|
else
|
|
4558
|
-
switch (
|
|
4604
|
+
switch (h.constructor) {
|
|
4559
4605
|
case Number:
|
|
4560
4606
|
case Object:
|
|
4561
4607
|
case Boolean:
|
|
4562
4608
|
case Array:
|
|
4563
4609
|
case String:
|
|
4564
|
-
a.push(
|
|
4610
|
+
a.push(h);
|
|
4565
4611
|
break;
|
|
4566
4612
|
default:
|
|
4567
|
-
switch (
|
|
4613
|
+
switch (d(), h.constructor) {
|
|
4568
4614
|
case Uint8Array:
|
|
4569
4615
|
case ArrayBuffer:
|
|
4570
|
-
s = new
|
|
4616
|
+
s = new I(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new De(new Uint8Array(
|
|
4571
4617
|
/** @type {Uint8Array} */
|
|
4572
|
-
|
|
4618
|
+
h
|
|
4573
4619
|
))), s.integrate(e, 0);
|
|
4574
4620
|
break;
|
|
4575
4621
|
case Ft:
|
|
4576
|
-
s = new
|
|
4622
|
+
s = new I(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new Ae(
|
|
4577
4623
|
/** @type {Doc} */
|
|
4578
|
-
|
|
4624
|
+
h
|
|
4579
4625
|
)), s.integrate(e, 0);
|
|
4580
4626
|
break;
|
|
4581
4627
|
default:
|
|
4582
|
-
if (
|
|
4583
|
-
s = new
|
|
4628
|
+
if (h instanceof F)
|
|
4629
|
+
s = new I(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new ut(h)), s.integrate(e, 0);
|
|
4584
4630
|
else
|
|
4585
4631
|
throw new Error("Unexpected content type in insert operation");
|
|
4586
4632
|
}
|
|
4587
4633
|
}
|
|
4588
|
-
}),
|
|
4634
|
+
}), d();
|
|
4589
4635
|
}, Sr = () => Tt("Length exceeded!"), kr = (e, t, n, i) => {
|
|
4590
4636
|
if (n > t._length)
|
|
4591
4637
|
throw Sr();
|
|
@@ -4602,7 +4648,7 @@ const mr = (e, t, n) => {
|
|
|
4602
4648
|
n -= o.length;
|
|
4603
4649
|
}
|
|
4604
4650
|
return t._searchMarker && be(t._searchMarker, s, i.length), Xe(e, t, o, i);
|
|
4605
|
-
},
|
|
4651
|
+
}, pa = (e, t, n) => {
|
|
4606
4652
|
let s = (t._searchMarker || []).reduce((r, o) => o.index > r.index ? o : r, { index: 0, p: t._start }).p;
|
|
4607
4653
|
if (s)
|
|
4608
4654
|
for (; s.right; )
|
|
@@ -4662,7 +4708,7 @@ const mr = (e, t, n) => {
|
|
|
4662
4708
|
else
|
|
4663
4709
|
throw new Error("Unexpected content type");
|
|
4664
4710
|
}
|
|
4665
|
-
new
|
|
4711
|
+
new I(C(o, B(r.store, o)), s, s && s.lastId, null, null, t, n, l).integrate(e, 0);
|
|
4666
4712
|
}, bi = (e, t) => {
|
|
4667
4713
|
e.doc ?? j();
|
|
4668
4714
|
const n = e._map.get(t);
|
|
@@ -4676,7 +4722,7 @@ const mr = (e, t, n) => {
|
|
|
4676
4722
|
e.doc ?? j();
|
|
4677
4723
|
const n = e._map.get(t);
|
|
4678
4724
|
return n !== void 0 && !n.deleted;
|
|
4679
|
-
},
|
|
4725
|
+
}, ga = (e, t) => {
|
|
4680
4726
|
const n = {};
|
|
4681
4727
|
return e._map.forEach((i, s) => {
|
|
4682
4728
|
let r = i;
|
|
@@ -4684,12 +4730,12 @@ const mr = (e, t, n) => {
|
|
|
4684
4730
|
r = r.left;
|
|
4685
4731
|
r !== null && Rt(r, t) && (n[s] = r.content.getContent()[r.length - 1]);
|
|
4686
4732
|
}), n;
|
|
4687
|
-
}, Ne = (e) => (e.doc ?? j(),
|
|
4733
|
+
}, Ne = (e) => (e.doc ?? j(), Nc(
|
|
4688
4734
|
e._map.entries(),
|
|
4689
4735
|
/** @param {any} entry */
|
|
4690
4736
|
(t) => !t[1].deleted
|
|
4691
4737
|
));
|
|
4692
|
-
class
|
|
4738
|
+
class ma extends mn {
|
|
4693
4739
|
}
|
|
4694
4740
|
class Gt extends F {
|
|
4695
4741
|
constructor() {
|
|
@@ -4754,7 +4800,7 @@ class Gt extends F {
|
|
|
4754
4800
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
4755
4801
|
*/
|
|
4756
4802
|
_callObserver(t, n) {
|
|
4757
|
-
super._callObserver(t, n), bn(this, t, new
|
|
4803
|
+
super._callObserver(t, n), bn(this, t, new ma(this, t));
|
|
4758
4804
|
}
|
|
4759
4805
|
/**
|
|
4760
4806
|
* Inserts new content at an index.
|
|
@@ -4773,7 +4819,7 @@ class Gt extends F {
|
|
|
4773
4819
|
* @param {Array<T>} content The array of content
|
|
4774
4820
|
*/
|
|
4775
4821
|
insert(t, n) {
|
|
4776
|
-
this.doc !== null ?
|
|
4822
|
+
this.doc !== null ? O(this.doc, (i) => {
|
|
4777
4823
|
kr(
|
|
4778
4824
|
i,
|
|
4779
4825
|
this,
|
|
@@ -4791,8 +4837,8 @@ class Gt extends F {
|
|
|
4791
4837
|
* @todo Use the following implementation in all types.
|
|
4792
4838
|
*/
|
|
4793
4839
|
push(t) {
|
|
4794
|
-
this.doc !== null ?
|
|
4795
|
-
|
|
4840
|
+
this.doc !== null ? O(this.doc, (n) => {
|
|
4841
|
+
pa(
|
|
4796
4842
|
n,
|
|
4797
4843
|
this,
|
|
4798
4844
|
/** @type {any} */
|
|
@@ -4815,7 +4861,7 @@ class Gt extends F {
|
|
|
4815
4861
|
* @param {number} length The number of elements to remove. Defaults to 1.
|
|
4816
4862
|
*/
|
|
4817
4863
|
delete(t, n = 1) {
|
|
4818
|
-
this.doc !== null ?
|
|
4864
|
+
this.doc !== null ? O(this.doc, (i) => {
|
|
4819
4865
|
vr(i, this, t, n);
|
|
4820
4866
|
}) : this._prelimContent.splice(t, n);
|
|
4821
4867
|
}
|
|
@@ -4883,17 +4929,17 @@ class Gt extends F {
|
|
|
4883
4929
|
* @return {IterableIterator<T>}
|
|
4884
4930
|
*/
|
|
4885
4931
|
[Symbol.iterator]() {
|
|
4886
|
-
return
|
|
4932
|
+
return fa(this);
|
|
4887
4933
|
}
|
|
4888
4934
|
/**
|
|
4889
4935
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
4890
4936
|
*/
|
|
4891
4937
|
_write(t) {
|
|
4892
|
-
t.writeTypeRef(
|
|
4938
|
+
t.writeTypeRef($a);
|
|
4893
4939
|
}
|
|
4894
4940
|
}
|
|
4895
|
-
const
|
|
4896
|
-
class
|
|
4941
|
+
const wa = (e) => new Gt();
|
|
4942
|
+
class ba extends mn {
|
|
4897
4943
|
/**
|
|
4898
4944
|
* @param {YMap<T>} ymap The YArray that changed.
|
|
4899
4945
|
* @param {Transaction} transaction
|
|
@@ -4955,7 +5001,7 @@ class Qt extends F {
|
|
|
4955
5001
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
4956
5002
|
*/
|
|
4957
5003
|
_callObserver(t, n) {
|
|
4958
|
-
bn(this, t, new
|
|
5004
|
+
bn(this, t, new ba(this, t, n));
|
|
4959
5005
|
}
|
|
4960
5006
|
/**
|
|
4961
5007
|
* Transforms this Shared Type to a JSON object.
|
|
@@ -5043,7 +5089,7 @@ class Qt extends F {
|
|
|
5043
5089
|
* @param {string} key The key of the element to remove.
|
|
5044
5090
|
*/
|
|
5045
5091
|
delete(t) {
|
|
5046
|
-
this.doc !== null ?
|
|
5092
|
+
this.doc !== null ? O(this.doc, (n) => {
|
|
5047
5093
|
Ze(n, this, t);
|
|
5048
5094
|
}) : this._prelimContent.delete(t);
|
|
5049
5095
|
}
|
|
@@ -5056,7 +5102,7 @@ class Qt extends F {
|
|
|
5056
5102
|
* @return {VAL}
|
|
5057
5103
|
*/
|
|
5058
5104
|
set(t, n) {
|
|
5059
|
-
return this.doc !== null ?
|
|
5105
|
+
return this.doc !== null ? O(this.doc, (i) => {
|
|
5060
5106
|
wi(
|
|
5061
5107
|
i,
|
|
5062
5108
|
this,
|
|
@@ -5091,7 +5137,7 @@ class Qt extends F {
|
|
|
5091
5137
|
* Removes all elements from this YMap.
|
|
5092
5138
|
*/
|
|
5093
5139
|
clear() {
|
|
5094
|
-
this.doc !== null ?
|
|
5140
|
+
this.doc !== null ? O(this.doc, (t) => {
|
|
5095
5141
|
this.forEach(function(n, i, s) {
|
|
5096
5142
|
Ze(t, s, i);
|
|
5097
5143
|
});
|
|
@@ -5101,10 +5147,10 @@ class Qt extends F {
|
|
|
5101
5147
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
5102
5148
|
*/
|
|
5103
5149
|
_write(t) {
|
|
5104
|
-
t.writeTypeRef(
|
|
5150
|
+
t.writeTypeRef(Fa);
|
|
5105
5151
|
}
|
|
5106
5152
|
}
|
|
5107
|
-
const
|
|
5153
|
+
const ya = (e) => new Qt(), Ct = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && hc(e, t);
|
|
5108
5154
|
class Yn {
|
|
5109
5155
|
/**
|
|
5110
5156
|
* @param {Item|null} left
|
|
@@ -5175,8 +5221,8 @@ const os = (e, t, n) => {
|
|
|
5175
5221
|
), n.forward();
|
|
5176
5222
|
const s = e.doc, r = s.clientID;
|
|
5177
5223
|
i.forEach((o, l) => {
|
|
5178
|
-
const c = n.left, a = n.right,
|
|
5179
|
-
|
|
5224
|
+
const c = n.left, a = n.right, d = new I(C(r, B(s.store, r)), c, c && c.lastId, a, a && a.id, t, null, new V(l, o));
|
|
5225
|
+
d.integrate(e, 0), n.right = d, n.forward();
|
|
5180
5226
|
});
|
|
5181
5227
|
}, se = (e, t) => {
|
|
5182
5228
|
const { key: n, value: i } = t;
|
|
@@ -5199,8 +5245,8 @@ const os = (e, t, n) => {
|
|
|
5199
5245
|
const c = i[l], a = n.currentAttributes.get(l) ?? null;
|
|
5200
5246
|
if (!Ct(a, c)) {
|
|
5201
5247
|
o.set(l, a);
|
|
5202
|
-
const { left:
|
|
5203
|
-
n.right = new
|
|
5248
|
+
const { left: d, right: h } = n;
|
|
5249
|
+
n.right = new I(C(r, B(s.store, r)), d, d && d.lastId, h, h && h.id, t, null, new V(l, c)), n.right.integrate(e, 0), n.forward();
|
|
5204
5250
|
}
|
|
5205
5251
|
}
|
|
5206
5252
|
return o;
|
|
@@ -5214,8 +5260,8 @@ const os = (e, t, n) => {
|
|
|
5214
5260
|
/** @type {string} */
|
|
5215
5261
|
i
|
|
5216
5262
|
) : i instanceof F ? new ut(i) : new zt(i);
|
|
5217
|
-
let { left: a, right:
|
|
5218
|
-
t._searchMarker && be(t._searchMarker, n.index, c.getLength()),
|
|
5263
|
+
let { left: a, right: d, index: h } = n;
|
|
5264
|
+
t._searchMarker && be(t._searchMarker, n.index, c.getLength()), d = new I(C(o, B(r.store, o)), a, a && a.lastId, d, d && d.id, t, null, c), d.integrate(e, 0), n.right = d, n.index = h, n.forward(), Er(e, t, n, l);
|
|
5219
5265
|
}, ls = (e, t, n, i, s) => {
|
|
5220
5266
|
const r = e.doc, o = r.clientID;
|
|
5221
5267
|
Tr(n, s);
|
|
@@ -5227,9 +5273,9 @@ const os = (e, t, n) => {
|
|
|
5227
5273
|
const { key: c, value: a } = (
|
|
5228
5274
|
/** @type {ContentFormat} */
|
|
5229
5275
|
n.right.content
|
|
5230
|
-
),
|
|
5231
|
-
if (
|
|
5232
|
-
if (Ct(
|
|
5276
|
+
), d = s[c];
|
|
5277
|
+
if (d !== void 0) {
|
|
5278
|
+
if (Ct(d, a))
|
|
5233
5279
|
l.delete(c);
|
|
5234
5280
|
else {
|
|
5235
5281
|
if (i === 0)
|
|
@@ -5252,7 +5298,7 @@ const os = (e, t, n) => {
|
|
|
5252
5298
|
for (; i > 0; i--)
|
|
5253
5299
|
c += `
|
|
5254
5300
|
`;
|
|
5255
|
-
n.right = new
|
|
5301
|
+
n.right = new I(C(o, B(r.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new dt(c)), n.right.integrate(e, 0), n.forward();
|
|
5256
5302
|
}
|
|
5257
5303
|
Er(e, t, n, l);
|
|
5258
5304
|
}, Ar = (e, t, n, i, s) => {
|
|
@@ -5274,11 +5320,11 @@ const os = (e, t, n) => {
|
|
|
5274
5320
|
const a = t.content;
|
|
5275
5321
|
switch (a.constructor) {
|
|
5276
5322
|
case V: {
|
|
5277
|
-
const { key:
|
|
5323
|
+
const { key: d, value: h } = (
|
|
5278
5324
|
/** @type {ContentFormat} */
|
|
5279
5325
|
a
|
|
5280
|
-
), u = i.get(
|
|
5281
|
-
(o.get(
|
|
5326
|
+
), u = i.get(d) ?? null;
|
|
5327
|
+
(o.get(d) !== a || u === h) && (t.delete(e), l++, !c && (s.get(d) ?? null) === h && u !== h && (u === null ? s.delete(d) : s.set(d, u))), !c && !t.deleted && se(
|
|
5282
5328
|
s,
|
|
5283
5329
|
/** @type {ContentFormat} */
|
|
5284
5330
|
a
|
|
@@ -5291,7 +5337,7 @@ const os = (e, t, n) => {
|
|
|
5291
5337
|
t.right;
|
|
5292
5338
|
}
|
|
5293
5339
|
return l;
|
|
5294
|
-
},
|
|
5340
|
+
}, xa = (e, t) => {
|
|
5295
5341
|
for (; t && t.right && (t.right.deleted || !t.right.countable); )
|
|
5296
5342
|
t = t.right;
|
|
5297
5343
|
const n = /* @__PURE__ */ new Set();
|
|
@@ -5305,9 +5351,9 @@ const os = (e, t, n) => {
|
|
|
5305
5351
|
}
|
|
5306
5352
|
t = t.left;
|
|
5307
5353
|
}
|
|
5308
|
-
},
|
|
5354
|
+
}, Sa = (e) => {
|
|
5309
5355
|
let t = 0;
|
|
5310
|
-
return
|
|
5356
|
+
return O(
|
|
5311
5357
|
/** @type {Doc} */
|
|
5312
5358
|
e.doc,
|
|
5313
5359
|
(n) => {
|
|
@@ -5334,7 +5380,7 @@ const os = (e, t, n) => {
|
|
|
5334
5380
|
}
|
|
5335
5381
|
}
|
|
5336
5382
|
), t;
|
|
5337
|
-
},
|
|
5383
|
+
}, ka = (e) => {
|
|
5338
5384
|
const t = /* @__PURE__ */ new Set(), n = e.doc;
|
|
5339
5385
|
for (const [i, s] of e.afterState.entries()) {
|
|
5340
5386
|
const r = e.beforeState.get(i) || 0;
|
|
@@ -5353,7 +5399,7 @@ const os = (e, t, n) => {
|
|
|
5353
5399
|
}
|
|
5354
5400
|
);
|
|
5355
5401
|
}
|
|
5356
|
-
|
|
5402
|
+
O(n, (i) => {
|
|
5357
5403
|
Dt(e, e.deleteSet, (s) => {
|
|
5358
5404
|
if (s instanceof it || !/** @type {YText} */
|
|
5359
5405
|
s.parent._hasFormatting || t.has(
|
|
@@ -5365,10 +5411,10 @@ const os = (e, t, n) => {
|
|
|
5365
5411
|
/** @type {YText} */
|
|
5366
5412
|
s.parent
|
|
5367
5413
|
);
|
|
5368
|
-
s.content.constructor === V ? t.add(r) :
|
|
5414
|
+
s.content.constructor === V ? t.add(r) : xa(i, s);
|
|
5369
5415
|
});
|
|
5370
5416
|
for (const s of t)
|
|
5371
|
-
|
|
5417
|
+
Sa(s);
|
|
5372
5418
|
});
|
|
5373
5419
|
}, cs = (e, t, n) => {
|
|
5374
5420
|
const i = n, s = Ln(t.currentAttributes), r = t.right;
|
|
@@ -5391,7 +5437,7 @@ const os = (e, t, n) => {
|
|
|
5391
5437
|
);
|
|
5392
5438
|
return o._searchMarker && be(o._searchMarker, t.index, -i + n), t;
|
|
5393
5439
|
};
|
|
5394
|
-
class
|
|
5440
|
+
class va extends mn {
|
|
5395
5441
|
/**
|
|
5396
5442
|
* @param {YText} ytext
|
|
5397
5443
|
* @param {Transaction} transaction
|
|
@@ -5434,17 +5480,17 @@ class Ca extends mn {
|
|
|
5434
5480
|
/** @type {Doc} */
|
|
5435
5481
|
this.target.doc
|
|
5436
5482
|
), n = [];
|
|
5437
|
-
|
|
5483
|
+
O(t, (i) => {
|
|
5438
5484
|
const s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
5439
5485
|
let o = this.target._start, l = null;
|
|
5440
5486
|
const c = {};
|
|
5441
|
-
let a = "",
|
|
5487
|
+
let a = "", d = 0, h = 0;
|
|
5442
5488
|
const u = () => {
|
|
5443
5489
|
if (l !== null) {
|
|
5444
5490
|
let f = null;
|
|
5445
5491
|
switch (l) {
|
|
5446
5492
|
case "delete":
|
|
5447
|
-
|
|
5493
|
+
h > 0 && (f = { delete: h }), h = 0;
|
|
5448
5494
|
break;
|
|
5449
5495
|
case "insert":
|
|
5450
5496
|
(typeof a == "object" || a.length > 0) && (f = { insert: a }, s.size > 0 && (f.attributes = {}, s.forEach((g, m) => {
|
|
@@ -5452,7 +5498,7 @@ class Ca extends mn {
|
|
|
5452
5498
|
}))), a = "";
|
|
5453
5499
|
break;
|
|
5454
5500
|
case "retain":
|
|
5455
|
-
|
|
5501
|
+
d > 0 && (f = { retain: d }, cc(c) || (f.attributes = oc({}, c))), d = 0;
|
|
5456
5502
|
break;
|
|
5457
5503
|
}
|
|
5458
5504
|
f && n.push(f), l = null;
|
|
@@ -5462,11 +5508,11 @@ class Ca extends mn {
|
|
|
5462
5508
|
switch (o.content.constructor) {
|
|
5463
5509
|
case ut:
|
|
5464
5510
|
case zt:
|
|
5465
|
-
this.adds(o) ? this.deletes(o) || (u(), l = "insert", a = o.content.getContent()[0], u()) : this.deletes(o) ? (l !== "delete" && (u(), l = "delete"),
|
|
5511
|
+
this.adds(o) ? this.deletes(o) || (u(), l = "insert", a = o.content.getContent()[0], u()) : this.deletes(o) ? (l !== "delete" && (u(), l = "delete"), h += 1) : o.deleted || (l !== "retain" && (u(), l = "retain"), d += 1);
|
|
5466
5512
|
break;
|
|
5467
5513
|
case dt:
|
|
5468
5514
|
this.adds(o) ? this.deletes(o) || (l !== "insert" && (u(), l = "insert"), a += /** @type {ContentString} */
|
|
5469
|
-
o.content.str) : this.deletes(o) ? (l !== "delete" && (u(), l = "delete"),
|
|
5515
|
+
o.content.str) : this.deletes(o) ? (l !== "delete" && (u(), l = "delete"), h += o.length) : o.deleted || (l !== "retain" && (u(), l = "retain"), d += o.length);
|
|
5470
5516
|
break;
|
|
5471
5517
|
case V: {
|
|
5472
5518
|
const { key: f, value: g } = (
|
|
@@ -5562,7 +5608,7 @@ class At extends F {
|
|
|
5562
5608
|
*/
|
|
5563
5609
|
_callObserver(t, n) {
|
|
5564
5610
|
super._callObserver(t, n);
|
|
5565
|
-
const i = new
|
|
5611
|
+
const i = new va(this, t, n);
|
|
5566
5612
|
bn(this, t, i), !t.local && this._hasFormatting && (t._needFormattingCleanup = !0);
|
|
5567
5613
|
}
|
|
5568
5614
|
/**
|
|
@@ -5598,7 +5644,7 @@ class At extends F {
|
|
|
5598
5644
|
* @public
|
|
5599
5645
|
*/
|
|
5600
5646
|
applyDelta(t, { sanitize: n = !0 } = {}) {
|
|
5601
|
-
this.doc !== null ?
|
|
5647
|
+
this.doc !== null ? O(this.doc, (i) => {
|
|
5602
5648
|
const s = new Yn(null, this._start, 0, /* @__PURE__ */ new Map());
|
|
5603
5649
|
for (let r = 0; r < t.length; r++) {
|
|
5604
5650
|
const o = t[r];
|
|
@@ -5629,29 +5675,29 @@ class At extends F {
|
|
|
5629
5675
|
let l = "", c = this._start;
|
|
5630
5676
|
function a() {
|
|
5631
5677
|
if (l.length > 0) {
|
|
5632
|
-
const
|
|
5678
|
+
const h = {};
|
|
5633
5679
|
let u = !1;
|
|
5634
5680
|
r.forEach((g, m) => {
|
|
5635
|
-
u = !0,
|
|
5681
|
+
u = !0, h[m] = g;
|
|
5636
5682
|
});
|
|
5637
5683
|
const f = { insert: l };
|
|
5638
|
-
u && (f.attributes =
|
|
5684
|
+
u && (f.attributes = h), s.push(f), l = "";
|
|
5639
5685
|
}
|
|
5640
5686
|
}
|
|
5641
|
-
const
|
|
5687
|
+
const d = () => {
|
|
5642
5688
|
for (; c !== null; ) {
|
|
5643
5689
|
if (Rt(c, t) || n !== void 0 && Rt(c, n))
|
|
5644
5690
|
switch (c.content.constructor) {
|
|
5645
5691
|
case dt: {
|
|
5646
|
-
const
|
|
5647
|
-
t !== void 0 && !Rt(c, t) ? (
|
|
5692
|
+
const h = r.get("ychange");
|
|
5693
|
+
t !== void 0 && !Rt(c, t) ? (h === void 0 || h.user !== c.id.client || h.type !== "removed") && (a(), r.set("ychange", i ? i("removed", c.id) : { type: "removed" })) : n !== void 0 && !Rt(c, n) ? (h === void 0 || h.user !== c.id.client || h.type !== "added") && (a(), r.set("ychange", i ? i("added", c.id) : { type: "added" })) : h !== void 0 && (a(), r.delete("ychange")), l += /** @type {ContentString} */
|
|
5648
5694
|
c.content.str;
|
|
5649
5695
|
break;
|
|
5650
5696
|
}
|
|
5651
5697
|
case ut:
|
|
5652
5698
|
case zt: {
|
|
5653
5699
|
a();
|
|
5654
|
-
const
|
|
5700
|
+
const h = {
|
|
5655
5701
|
insert: c.content.getContent()[0]
|
|
5656
5702
|
};
|
|
5657
5703
|
if (r.size > 0) {
|
|
@@ -5659,11 +5705,11 @@ class At extends F {
|
|
|
5659
5705
|
/** @type {Object<string,any>} */
|
|
5660
5706
|
{}
|
|
5661
5707
|
);
|
|
5662
|
-
|
|
5708
|
+
h.attributes = u, r.forEach((f, g) => {
|
|
5663
5709
|
u[g] = f;
|
|
5664
5710
|
});
|
|
5665
5711
|
}
|
|
5666
|
-
s.push(
|
|
5712
|
+
s.push(h);
|
|
5667
5713
|
break;
|
|
5668
5714
|
}
|
|
5669
5715
|
case V:
|
|
@@ -5678,9 +5724,9 @@ class At extends F {
|
|
|
5678
5724
|
}
|
|
5679
5725
|
a();
|
|
5680
5726
|
};
|
|
5681
|
-
return t || n ?
|
|
5682
|
-
t && jn(
|
|
5683
|
-
}, "cleanup") :
|
|
5727
|
+
return t || n ? O(o, (h) => {
|
|
5728
|
+
t && jn(h, t), n && jn(h, n), d();
|
|
5729
|
+
}, "cleanup") : d(), s;
|
|
5684
5730
|
}
|
|
5685
5731
|
/**
|
|
5686
5732
|
* Insert text at a given index.
|
|
@@ -5696,7 +5742,7 @@ class At extends F {
|
|
|
5696
5742
|
if (n.length <= 0)
|
|
5697
5743
|
return;
|
|
5698
5744
|
const s = this.doc;
|
|
5699
|
-
s !== null ?
|
|
5745
|
+
s !== null ? O(s, (r) => {
|
|
5700
5746
|
const o = Ue(r, this, t, !i);
|
|
5701
5747
|
i || (i = {}, o.currentAttributes.forEach((l, c) => {
|
|
5702
5748
|
i[c] = l;
|
|
@@ -5715,7 +5761,7 @@ class At extends F {
|
|
|
5715
5761
|
*/
|
|
5716
5762
|
insertEmbed(t, n, i) {
|
|
5717
5763
|
const s = this.doc;
|
|
5718
|
-
s !== null ?
|
|
5764
|
+
s !== null ? O(s, (r) => {
|
|
5719
5765
|
const o = Ue(r, this, t, !i);
|
|
5720
5766
|
Mn(r, this, o, n, i || {});
|
|
5721
5767
|
}) : this._pending.push(() => this.insertEmbed(t, n, i || {}));
|
|
@@ -5732,7 +5778,7 @@ class At extends F {
|
|
|
5732
5778
|
if (n === 0)
|
|
5733
5779
|
return;
|
|
5734
5780
|
const i = this.doc;
|
|
5735
|
-
i !== null ?
|
|
5781
|
+
i !== null ? O(i, (s) => {
|
|
5736
5782
|
cs(s, Ue(s, this, t, !0), n);
|
|
5737
5783
|
}) : this._pending.push(() => this.delete(t, n));
|
|
5738
5784
|
}
|
|
@@ -5750,7 +5796,7 @@ class At extends F {
|
|
|
5750
5796
|
if (n === 0)
|
|
5751
5797
|
return;
|
|
5752
5798
|
const s = this.doc;
|
|
5753
|
-
s !== null ?
|
|
5799
|
+
s !== null ? O(s, (r) => {
|
|
5754
5800
|
const o = Ue(r, this, t, !1);
|
|
5755
5801
|
o.right !== null && ls(r, this, o, n, i);
|
|
5756
5802
|
}) : this._pending.push(() => this.format(t, n, i));
|
|
@@ -5765,7 +5811,7 @@ class At extends F {
|
|
|
5765
5811
|
* @public
|
|
5766
5812
|
*/
|
|
5767
5813
|
removeAttribute(t) {
|
|
5768
|
-
this.doc !== null ?
|
|
5814
|
+
this.doc !== null ? O(this.doc, (n) => {
|
|
5769
5815
|
Ze(n, this, t);
|
|
5770
5816
|
}) : this._pending.push(() => this.removeAttribute(t));
|
|
5771
5817
|
}
|
|
@@ -5780,7 +5826,7 @@ class At extends F {
|
|
|
5780
5826
|
* @public
|
|
5781
5827
|
*/
|
|
5782
5828
|
setAttribute(t, n) {
|
|
5783
|
-
this.doc !== null ?
|
|
5829
|
+
this.doc !== null ? O(this.doc, (i) => {
|
|
5784
5830
|
wi(i, this, t, n);
|
|
5785
5831
|
}) : this._pending.push(() => this.setAttribute(t, n));
|
|
5786
5832
|
}
|
|
@@ -5817,10 +5863,10 @@ class At extends F {
|
|
|
5817
5863
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
5818
5864
|
*/
|
|
5819
5865
|
_write(t) {
|
|
5820
|
-
t.writeTypeRef(
|
|
5866
|
+
t.writeTypeRef(za);
|
|
5821
5867
|
}
|
|
5822
5868
|
}
|
|
5823
|
-
const
|
|
5869
|
+
const Ca = (e) => new At();
|
|
5824
5870
|
class Rn {
|
|
5825
5871
|
/**
|
|
5826
5872
|
* @param {YXmlFragment | YXmlElement} root
|
|
@@ -5973,7 +6019,7 @@ class Ht extends F {
|
|
|
5973
6019
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
5974
6020
|
*/
|
|
5975
6021
|
_callObserver(t, n) {
|
|
5976
|
-
bn(this, t, new
|
|
6022
|
+
bn(this, t, new Ta(this, n, t));
|
|
5977
6023
|
}
|
|
5978
6024
|
/**
|
|
5979
6025
|
* Get the string representation of all the children of this YXmlFragment.
|
|
@@ -6021,7 +6067,7 @@ class Ht extends F {
|
|
|
6021
6067
|
* @param {Array<YXmlElement|YXmlText>} content The array of content
|
|
6022
6068
|
*/
|
|
6023
6069
|
insert(t, n) {
|
|
6024
|
-
this.doc !== null ?
|
|
6070
|
+
this.doc !== null ? O(this.doc, (i) => {
|
|
6025
6071
|
kr(i, this, t, n);
|
|
6026
6072
|
}) : this._prelimContent.splice(t, 0, ...n);
|
|
6027
6073
|
}
|
|
@@ -6037,7 +6083,7 @@ class Ht extends F {
|
|
|
6037
6083
|
*/
|
|
6038
6084
|
insertAfter(t, n) {
|
|
6039
6085
|
if (this.doc !== null)
|
|
6040
|
-
|
|
6086
|
+
O(this.doc, (i) => {
|
|
6041
6087
|
const s = t && t instanceof F ? t._item : t;
|
|
6042
6088
|
Xe(i, this, s, n);
|
|
6043
6089
|
});
|
|
@@ -6058,7 +6104,7 @@ class Ht extends F {
|
|
|
6058
6104
|
* @param {number} [length=1] The number of elements to remove. Defaults to 1.
|
|
6059
6105
|
*/
|
|
6060
6106
|
delete(t, n = 1) {
|
|
6061
|
-
this.doc !== null ?
|
|
6107
|
+
this.doc !== null ? O(this.doc, (i) => {
|
|
6062
6108
|
vr(i, this, t, n);
|
|
6063
6109
|
}) : this._prelimContent.splice(t, n);
|
|
6064
6110
|
}
|
|
@@ -6123,10 +6169,10 @@ class Ht extends F {
|
|
|
6123
6169
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
|
6124
6170
|
*/
|
|
6125
6171
|
_write(t) {
|
|
6126
|
-
t.writeTypeRef(
|
|
6172
|
+
t.writeTypeRef(ja);
|
|
6127
6173
|
}
|
|
6128
6174
|
}
|
|
6129
|
-
const
|
|
6175
|
+
const _a = (e) => new Ht();
|
|
6130
6176
|
class W extends Ht {
|
|
6131
6177
|
constructor(t = "UNDEFINED") {
|
|
6132
6178
|
super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
|
|
@@ -6186,7 +6232,7 @@ class W extends Ht {
|
|
|
6186
6232
|
*/
|
|
6187
6233
|
clone() {
|
|
6188
6234
|
const t = new W(this.nodeName), n = this.getAttributes();
|
|
6189
|
-
return
|
|
6235
|
+
return lc(n, (i, s) => {
|
|
6190
6236
|
typeof i == "string" && t.setAttribute(s, i);
|
|
6191
6237
|
}), t.insert(0, this.toArray().map((i) => i instanceof F ? i.clone() : i)), t;
|
|
6192
6238
|
}
|
|
@@ -6220,7 +6266,7 @@ class W extends Ht {
|
|
|
6220
6266
|
* @public
|
|
6221
6267
|
*/
|
|
6222
6268
|
removeAttribute(t) {
|
|
6223
|
-
this.doc !== null ?
|
|
6269
|
+
this.doc !== null ? O(this.doc, (n) => {
|
|
6224
6270
|
Ze(n, this, t);
|
|
6225
6271
|
}) : this._prelimAttrs.delete(t);
|
|
6226
6272
|
}
|
|
@@ -6235,7 +6281,7 @@ class W extends Ht {
|
|
|
6235
6281
|
* @public
|
|
6236
6282
|
*/
|
|
6237
6283
|
setAttribute(t, n) {
|
|
6238
|
-
this.doc !== null ?
|
|
6284
|
+
this.doc !== null ? O(this.doc, (i) => {
|
|
6239
6285
|
wi(i, this, t, n);
|
|
6240
6286
|
}) : this._prelimAttrs.set(t, n);
|
|
6241
6287
|
}
|
|
@@ -6281,7 +6327,7 @@ class W extends Ht {
|
|
|
6281
6327
|
getAttributes(t) {
|
|
6282
6328
|
return (
|
|
6283
6329
|
/** @type {any} */
|
|
6284
|
-
t ?
|
|
6330
|
+
t ? ga(this, t) : Cr(this)
|
|
6285
6331
|
);
|
|
6286
6332
|
}
|
|
6287
6333
|
/**
|
|
@@ -6318,11 +6364,11 @@ class W extends Ht {
|
|
|
6318
6364
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
|
6319
6365
|
*/
|
|
6320
6366
|
_write(t) {
|
|
6321
|
-
t.writeTypeRef(
|
|
6367
|
+
t.writeTypeRef(Wa), t.writeKey(this.nodeName);
|
|
6322
6368
|
}
|
|
6323
6369
|
}
|
|
6324
|
-
const
|
|
6325
|
-
class
|
|
6370
|
+
const Ea = (e) => new W(e.readKey());
|
|
6371
|
+
class Ta extends mn {
|
|
6326
6372
|
/**
|
|
6327
6373
|
* @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
|
|
6328
6374
|
* @param {Set<string|null>} subs The set of changed attributes. `null` is included if the
|
|
@@ -6391,10 +6437,10 @@ class Qe extends Qt {
|
|
|
6391
6437
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
|
6392
6438
|
*/
|
|
6393
6439
|
_write(t) {
|
|
6394
|
-
t.writeTypeRef(
|
|
6440
|
+
t.writeTypeRef(Ka), t.writeKey(this.hookName);
|
|
6395
6441
|
}
|
|
6396
6442
|
}
|
|
6397
|
-
const
|
|
6443
|
+
const Da = (e) => new Qe(e.readKey());
|
|
6398
6444
|
class J extends At {
|
|
6399
6445
|
/**
|
|
6400
6446
|
* @type {YXmlElement|YXmlText|null}
|
|
@@ -6487,10 +6533,10 @@ class J extends At {
|
|
|
6487
6533
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
6488
6534
|
*/
|
|
6489
6535
|
_write(t) {
|
|
6490
|
-
t.writeTypeRef(
|
|
6536
|
+
t.writeTypeRef(Ya);
|
|
6491
6537
|
}
|
|
6492
6538
|
}
|
|
6493
|
-
const
|
|
6539
|
+
const Aa = (e) => new J();
|
|
6494
6540
|
class yi {
|
|
6495
6541
|
/**
|
|
6496
6542
|
* @param {ID} id
|
|
@@ -6531,7 +6577,7 @@ class yi {
|
|
|
6531
6577
|
throw at();
|
|
6532
6578
|
}
|
|
6533
6579
|
}
|
|
6534
|
-
const
|
|
6580
|
+
const Ia = 0;
|
|
6535
6581
|
class it extends yi {
|
|
6536
6582
|
get deleted() {
|
|
6537
6583
|
return !0;
|
|
@@ -6557,7 +6603,7 @@ class it extends yi {
|
|
|
6557
6603
|
* @param {number} offset
|
|
6558
6604
|
*/
|
|
6559
6605
|
write(t, n) {
|
|
6560
|
-
t.writeInfo(
|
|
6606
|
+
t.writeInfo(Ia), t.writeLen(this.length - n);
|
|
6561
6607
|
}
|
|
6562
6608
|
/**
|
|
6563
6609
|
* @param {Transaction} transaction
|
|
@@ -6643,7 +6689,7 @@ class De {
|
|
|
6643
6689
|
return 3;
|
|
6644
6690
|
}
|
|
6645
6691
|
}
|
|
6646
|
-
const
|
|
6692
|
+
const Oa = (e) => new De(e.readBuf());
|
|
6647
6693
|
class xe {
|
|
6648
6694
|
/**
|
|
6649
6695
|
* @param {number} len
|
|
@@ -6721,7 +6767,7 @@ class xe {
|
|
|
6721
6767
|
return 1;
|
|
6722
6768
|
}
|
|
6723
6769
|
}
|
|
6724
|
-
const
|
|
6770
|
+
const Ma = (e) => new xe(e.readLen()), Ir = (e, t) => new Ft({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
|
|
6725
6771
|
class Ae {
|
|
6726
6772
|
/**
|
|
6727
6773
|
* @param {Doc} doc
|
|
@@ -6801,7 +6847,7 @@ class Ae {
|
|
|
6801
6847
|
return 9;
|
|
6802
6848
|
}
|
|
6803
6849
|
}
|
|
6804
|
-
const
|
|
6850
|
+
const Ra = (e) => new Ae(Ir(e.readString(), e.readAny()));
|
|
6805
6851
|
class zt {
|
|
6806
6852
|
/**
|
|
6807
6853
|
* @param {Object} embed
|
|
@@ -6877,7 +6923,7 @@ class zt {
|
|
|
6877
6923
|
return 5;
|
|
6878
6924
|
}
|
|
6879
6925
|
}
|
|
6880
|
-
const
|
|
6926
|
+
const Na = (e) => new zt(e.readJSON());
|
|
6881
6927
|
class V {
|
|
6882
6928
|
/**
|
|
6883
6929
|
* @param {string} key
|
|
@@ -6959,7 +7005,7 @@ class V {
|
|
|
6959
7005
|
return 6;
|
|
6960
7006
|
}
|
|
6961
7007
|
}
|
|
6962
|
-
const
|
|
7008
|
+
const Ua = (e) => new V(e.readKey(), e.readJSON());
|
|
6963
7009
|
class tn {
|
|
6964
7010
|
/**
|
|
6965
7011
|
* @param {Array<any>} arr
|
|
@@ -7041,20 +7087,20 @@ class tn {
|
|
|
7041
7087
|
return 2;
|
|
7042
7088
|
}
|
|
7043
7089
|
}
|
|
7044
|
-
const
|
|
7090
|
+
const La = (e) => {
|
|
7045
7091
|
const t = e.readLen(), n = [];
|
|
7046
7092
|
for (let i = 0; i < t; i++) {
|
|
7047
7093
|
const s = e.readString();
|
|
7048
7094
|
s === "undefined" ? n.push(void 0) : n.push(JSON.parse(s));
|
|
7049
7095
|
}
|
|
7050
7096
|
return new tn(n);
|
|
7051
|
-
},
|
|
7097
|
+
}, Pa = Ge("node_env") === "development";
|
|
7052
7098
|
class $t {
|
|
7053
7099
|
/**
|
|
7054
7100
|
* @param {Array<any>} arr
|
|
7055
7101
|
*/
|
|
7056
7102
|
constructor(t) {
|
|
7057
|
-
this.arr = t,
|
|
7103
|
+
this.arr = t, Pa && Ks(t);
|
|
7058
7104
|
}
|
|
7059
7105
|
/**
|
|
7060
7106
|
* @return {number}
|
|
@@ -7130,7 +7176,7 @@ class $t {
|
|
|
7130
7176
|
return 8;
|
|
7131
7177
|
}
|
|
7132
7178
|
}
|
|
7133
|
-
const
|
|
7179
|
+
const Ba = (e) => {
|
|
7134
7180
|
const t = e.readLen(), n = [];
|
|
7135
7181
|
for (let i = 0; i < t; i++)
|
|
7136
7182
|
n.push(e.readAny());
|
|
@@ -7214,15 +7260,15 @@ class dt {
|
|
|
7214
7260
|
return 4;
|
|
7215
7261
|
}
|
|
7216
7262
|
}
|
|
7217
|
-
const
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
Ta,
|
|
7263
|
+
const Va = (e) => new dt(e.readString()), Ha = [
|
|
7264
|
+
wa,
|
|
7265
|
+
ya,
|
|
7266
|
+
Ca,
|
|
7222
7267
|
Ea,
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7268
|
+
_a,
|
|
7269
|
+
Da,
|
|
7270
|
+
Aa
|
|
7271
|
+
], $a = 0, Fa = 1, za = 2, Wa = 3, ja = 4, Ka = 5, Ya = 6;
|
|
7226
7272
|
class ut {
|
|
7227
7273
|
/**
|
|
7228
7274
|
* @param {AbstractType<any>} type
|
|
@@ -7315,11 +7361,11 @@ class ut {
|
|
|
7315
7361
|
return 7;
|
|
7316
7362
|
}
|
|
7317
7363
|
}
|
|
7318
|
-
const
|
|
7364
|
+
const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
|
|
7319
7365
|
let n = t, i = 0, s;
|
|
7320
7366
|
do
|
|
7321
7367
|
i > 0 && (n = C(n.client, n.clock + i)), s = Yt(e, n), i = n.clock - s.id.clock, n = s.redone;
|
|
7322
|
-
while (n !== null && s instanceof
|
|
7368
|
+
while (n !== null && s instanceof I);
|
|
7323
7369
|
return {
|
|
7324
7370
|
item: s,
|
|
7325
7371
|
diff: i
|
|
@@ -7329,7 +7375,7 @@ const Ja = (e) => new ut($a[e.readTypeRef()](e)), Gn = (e, t) => {
|
|
|
7329
7375
|
e.keep = t, e = /** @type {AbstractType<any>} */
|
|
7330
7376
|
e.parent._item;
|
|
7331
7377
|
}, en = (e, t, n) => {
|
|
7332
|
-
const { client: i, clock: s } = t.id, r = new
|
|
7378
|
+
const { client: i, clock: s } = t.id, r = new I(
|
|
7333
7379
|
C(i, s + n),
|
|
7334
7380
|
t,
|
|
7335
7381
|
C(i, s + n - 1),
|
|
@@ -7340,7 +7386,7 @@ const Ja = (e) => new ut($a[e.readTypeRef()](e)), Gn = (e, t) => {
|
|
|
7340
7386
|
t.content.splice(n)
|
|
7341
7387
|
);
|
|
7342
7388
|
return t.deleted && r.markDeleted(), t.keep && (r.keep = !0), t.redone !== null && (r.redone = C(t.redone.client, t.redone.clock + n)), t.right = r, r.right !== null && (r.right.left = r), e._mergeStructs.push(r), r.parentSub !== null && r.right === null && r.parent._map.set(r.parentSub, r), t.length = n, r;
|
|
7343
|
-
}, as = (e, t) =>
|
|
7389
|
+
}, as = (e, t) => yl(
|
|
7344
7390
|
e,
|
|
7345
7391
|
/** @param {StackItem} s */
|
|
7346
7392
|
(n) => ie(n.deletions, t)
|
|
@@ -7348,68 +7394,68 @@ const Ja = (e) => new ut($a[e.readTypeRef()](e)), Gn = (e, t) => {
|
|
|
7348
7394
|
const o = e.doc, l = o.store, c = o.clientID, a = t.redone;
|
|
7349
7395
|
if (a !== null)
|
|
7350
7396
|
return G(e, a);
|
|
7351
|
-
let
|
|
7397
|
+
let d = (
|
|
7352
7398
|
/** @type {AbstractType<any>} */
|
|
7353
7399
|
t.parent._item
|
|
7354
|
-
),
|
|
7355
|
-
if (
|
|
7356
|
-
if (
|
|
7400
|
+
), h = null, u;
|
|
7401
|
+
if (d !== null && d.deleted === !0) {
|
|
7402
|
+
if (d.redone === null && (!n.has(d) || Or(e, d, n, i, s, r) === null))
|
|
7357
7403
|
return null;
|
|
7358
|
-
for (;
|
|
7359
|
-
|
|
7404
|
+
for (; d.redone !== null; )
|
|
7405
|
+
d = G(e, d.redone);
|
|
7360
7406
|
}
|
|
7361
|
-
const f =
|
|
7407
|
+
const f = d === null ? (
|
|
7362
7408
|
/** @type {AbstractType<any>} */
|
|
7363
7409
|
t.parent
|
|
7364
7410
|
) : (
|
|
7365
7411
|
/** @type {ContentType} */
|
|
7366
|
-
|
|
7412
|
+
d.content.type
|
|
7367
7413
|
);
|
|
7368
7414
|
if (t.parentSub === null) {
|
|
7369
|
-
for (
|
|
7370
|
-
let
|
|
7371
|
-
for (;
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
if (
|
|
7375
|
-
|
|
7376
|
-
|
|
7415
|
+
for (h = t.left, u = t; h !== null; ) {
|
|
7416
|
+
let w = h;
|
|
7417
|
+
for (; w !== null && /** @type {AbstractType<any>} */
|
|
7418
|
+
w.parent._item !== d; )
|
|
7419
|
+
w = w.redone === null ? null : G(e, w.redone);
|
|
7420
|
+
if (w !== null && /** @type {AbstractType<any>} */
|
|
7421
|
+
w.parent._item === d) {
|
|
7422
|
+
h = w;
|
|
7377
7423
|
break;
|
|
7378
7424
|
}
|
|
7379
|
-
|
|
7425
|
+
h = h.left;
|
|
7380
7426
|
}
|
|
7381
7427
|
for (; u !== null; ) {
|
|
7382
|
-
let
|
|
7383
|
-
for (;
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
if (
|
|
7387
|
-
|
|
7388
|
-
u =
|
|
7428
|
+
let w = u;
|
|
7429
|
+
for (; w !== null && /** @type {AbstractType<any>} */
|
|
7430
|
+
w.parent._item !== d; )
|
|
7431
|
+
w = w.redone === null ? null : G(e, w.redone);
|
|
7432
|
+
if (w !== null && /** @type {AbstractType<any>} */
|
|
7433
|
+
w.parent._item === d) {
|
|
7434
|
+
u = w;
|
|
7389
7435
|
break;
|
|
7390
7436
|
}
|
|
7391
7437
|
u = u.right;
|
|
7392
7438
|
}
|
|
7393
7439
|
} else if (u = null, t.right && !s) {
|
|
7394
|
-
for (
|
|
7395
|
-
for (
|
|
7396
|
-
if (
|
|
7440
|
+
for (h = t; h !== null && h.right !== null && (h.right.redone || ie(i, h.right.id) || as(r.undoStack, h.right.id) || as(r.redoStack, h.right.id)); )
|
|
7441
|
+
for (h = h.right; h.redone; ) h = G(e, h.redone);
|
|
7442
|
+
if (h && h.right !== null)
|
|
7397
7443
|
return null;
|
|
7398
7444
|
} else
|
|
7399
|
-
|
|
7400
|
-
const g = B(l, c), m = C(c, g),
|
|
7445
|
+
h = f._map.get(t.parentSub) || null;
|
|
7446
|
+
const g = B(l, c), m = C(c, g), b = new I(
|
|
7401
7447
|
m,
|
|
7402
|
-
|
|
7403
|
-
|
|
7448
|
+
h,
|
|
7449
|
+
h && h.lastId,
|
|
7404
7450
|
u,
|
|
7405
7451
|
u && u.id,
|
|
7406
7452
|
f,
|
|
7407
7453
|
t.parentSub,
|
|
7408
7454
|
t.content.copy()
|
|
7409
7455
|
);
|
|
7410
|
-
return t.redone = m, xi(
|
|
7456
|
+
return t.redone = m, xi(b, !0), b.integrate(e, 0), b;
|
|
7411
7457
|
};
|
|
7412
|
-
class
|
|
7458
|
+
class I extends yi {
|
|
7413
7459
|
/**
|
|
7414
7460
|
* @param {ID} id
|
|
7415
7461
|
* @param {Item | null} left
|
|
@@ -7476,7 +7522,7 @@ class D extends yi {
|
|
|
7476
7522
|
if (this.origin && (this.left = Qi(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = G(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === it || this.right && this.right.constructor === it)
|
|
7477
7523
|
this.parent = null;
|
|
7478
7524
|
else if (!this.parent)
|
|
7479
|
-
this.left && this.left.constructor ===
|
|
7525
|
+
this.left && this.left.constructor === I ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === I && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
|
|
7480
7526
|
else if (this.parent.constructor === Kt) {
|
|
7481
7527
|
const i = Yt(n, this.parent);
|
|
7482
7528
|
i.constructor === it ? this.parent = null : this.parent = /** @type {ContentType} */
|
|
@@ -7604,7 +7650,7 @@ class D extends yi {
|
|
|
7604
7650
|
gc(t, n) {
|
|
7605
7651
|
if (!this.deleted)
|
|
7606
7652
|
throw q();
|
|
7607
|
-
this.content.gc(t), n ?
|
|
7653
|
+
this.content.gc(t), n ? Qc(t, this, new it(this.id, this.length)) : this.content = new xe(this.length);
|
|
7608
7654
|
}
|
|
7609
7655
|
/**
|
|
7610
7656
|
* Transform the properties of this type to binary and write it to an
|
|
@@ -7637,34 +7683,34 @@ class D extends yi {
|
|
|
7637
7683
|
this.content.write(t, n);
|
|
7638
7684
|
}
|
|
7639
7685
|
}
|
|
7640
|
-
const Mr = (e, t) =>
|
|
7686
|
+
const Mr = (e, t) => Ja[t & dn](e), Ja = [
|
|
7641
7687
|
() => {
|
|
7642
7688
|
q();
|
|
7643
7689
|
},
|
|
7644
7690
|
// GC is not ItemContent
|
|
7645
|
-
|
|
7691
|
+
Ma,
|
|
7646
7692
|
// 1
|
|
7647
|
-
|
|
7693
|
+
La,
|
|
7648
7694
|
// 2
|
|
7649
|
-
|
|
7695
|
+
Oa,
|
|
7650
7696
|
// 3
|
|
7651
|
-
|
|
7697
|
+
Va,
|
|
7652
7698
|
// 4
|
|
7653
|
-
|
|
7699
|
+
Na,
|
|
7654
7700
|
// 5
|
|
7655
|
-
|
|
7701
|
+
Ua,
|
|
7656
7702
|
// 6
|
|
7657
|
-
|
|
7703
|
+
Ga,
|
|
7658
7704
|
// 7
|
|
7659
|
-
|
|
7705
|
+
Ba,
|
|
7660
7706
|
// 8
|
|
7661
|
-
|
|
7707
|
+
Ra,
|
|
7662
7708
|
// 9
|
|
7663
7709
|
() => {
|
|
7664
7710
|
q();
|
|
7665
7711
|
}
|
|
7666
7712
|
// 10 - Skip is not ItemContent
|
|
7667
|
-
],
|
|
7713
|
+
], qa = 10;
|
|
7668
7714
|
class ot extends yi {
|
|
7669
7715
|
get deleted() {
|
|
7670
7716
|
return !0;
|
|
@@ -7690,7 +7736,7 @@ class ot extends yi {
|
|
|
7690
7736
|
* @param {number} offset
|
|
7691
7737
|
*/
|
|
7692
7738
|
write(t, n) {
|
|
7693
|
-
t.writeInfo(
|
|
7739
|
+
t.writeInfo(qa), T(t.restEncoder, this.length - n);
|
|
7694
7740
|
}
|
|
7695
7741
|
/**
|
|
7696
7742
|
* @param {Transaction} transaction
|
|
@@ -7707,7 +7753,7 @@ const Rr = (
|
|
|
7707
7753
|
), Nr = "__ $YJS$ __";
|
|
7708
7754
|
Rr[Nr] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
|
|
7709
7755
|
Rr[Nr] = !0;
|
|
7710
|
-
const
|
|
7756
|
+
const Xa = () => {
|
|
7711
7757
|
let e = !0;
|
|
7712
7758
|
return (t, n) => {
|
|
7713
7759
|
if (e) {
|
|
@@ -7719,18 +7765,18 @@ const Za = () => {
|
|
|
7719
7765
|
}
|
|
7720
7766
|
} else n !== void 0 && n();
|
|
7721
7767
|
};
|
|
7722
|
-
},
|
|
7768
|
+
}, Za = /[\uD800-\uDBFF]/, Qa = /[\uDC00-\uDFFF]/, th = (e, t) => {
|
|
7723
7769
|
let n = 0, i = 0;
|
|
7724
7770
|
for (; n < e.length && n < t.length && e[n] === t[n]; )
|
|
7725
7771
|
n++;
|
|
7726
|
-
for (n > 0 &&
|
|
7772
|
+
for (n > 0 && Za.test(e[n - 1]) && n--; i + n < e.length && i + n < t.length && e[e.length - i - 1] === t[t.length - i - 1]; )
|
|
7727
7773
|
i++;
|
|
7728
|
-
return i > 0 &&
|
|
7774
|
+
return i > 0 && Qa.test(e[e.length - i]) && i--, {
|
|
7729
7775
|
index: n,
|
|
7730
7776
|
remove: e.length - n - i,
|
|
7731
7777
|
insert: t.slice(n, t.length - i)
|
|
7732
7778
|
};
|
|
7733
|
-
},
|
|
7779
|
+
}, eh = th, gt = (e, t) => e >>> t | e << 32 - t, nh = (e) => gt(e, 2) ^ gt(e, 13) ^ gt(e, 22), ih = (e) => gt(e, 6) ^ gt(e, 11) ^ gt(e, 25), sh = (e) => gt(e, 7) ^ gt(e, 18) ^ e >>> 3, rh = (e) => gt(e, 17) ^ gt(e, 19) ^ e >>> 10, oh = new Uint32Array([
|
|
7734
7780
|
1116352408,
|
|
7735
7781
|
1899447441,
|
|
7736
7782
|
3049323471,
|
|
@@ -7795,7 +7841,7 @@ const Za = () => {
|
|
|
7795
7841
|
2756734187,
|
|
7796
7842
|
3204031479,
|
|
7797
7843
|
3329325298
|
|
7798
|
-
]),
|
|
7844
|
+
]), lh = new Uint32Array([
|
|
7799
7845
|
1779033703,
|
|
7800
7846
|
3144134277,
|
|
7801
7847
|
1013904242,
|
|
@@ -7805,19 +7851,19 @@ const Za = () => {
|
|
|
7805
7851
|
528734635,
|
|
7806
7852
|
1541459225
|
|
7807
7853
|
]);
|
|
7808
|
-
class
|
|
7854
|
+
class ch {
|
|
7809
7855
|
constructor() {
|
|
7810
7856
|
const t = new ArrayBuffer(320);
|
|
7811
|
-
this._H = new Uint32Array(t, 0, 8), this._H.set(
|
|
7857
|
+
this._H = new Uint32Array(t, 0, 8), this._H.set(lh), this._W = new Uint32Array(t, 64, 64);
|
|
7812
7858
|
}
|
|
7813
7859
|
_updateHash() {
|
|
7814
7860
|
const t = this._H, n = this._W;
|
|
7815
|
-
for (let
|
|
7816
|
-
n[
|
|
7817
|
-
let i = t[0], s = t[1], r = t[2], o = t[3], l = t[4], c = t[5], a = t[6],
|
|
7818
|
-
for (let
|
|
7819
|
-
u =
|
|
7820
|
-
t[0] += i, t[1] += s, t[2] += r, t[3] += o, t[4] += l, t[5] += c, t[6] += a, t[7] +=
|
|
7861
|
+
for (let h = 16; h < 64; h++)
|
|
7862
|
+
n[h] = rh(n[h - 2]) + n[h - 7] + sh(n[h - 15]) + n[h - 16];
|
|
7863
|
+
let i = t[0], s = t[1], r = t[2], o = t[3], l = t[4], c = t[5], a = t[6], d = t[7];
|
|
7864
|
+
for (let h = 0, u, f; h < 64; h++)
|
|
7865
|
+
u = d + ih(l) + (l & c ^ ~l & a) + oh[h] + n[h] >>> 0, f = nh(i) + (i & s ^ i & r ^ s & r) >>> 0, d = a, a = c, c = l, l = o + u >>> 0, o = r, r = s, s = i, i = u + f >>> 0;
|
|
7866
|
+
t[0] += i, t[1] += s, t[2] += r, t[3] += o, t[4] += l, t[5] += c, t[6] += a, t[7] += d;
|
|
7821
7867
|
}
|
|
7822
7868
|
/**
|
|
7823
7869
|
* Returns a 32-byte hash.
|
|
@@ -7843,7 +7889,7 @@ class ah {
|
|
|
7843
7889
|
for (; n < t.length; s++)
|
|
7844
7890
|
for (let o = 3; o >= 0 && n < t.length; o--)
|
|
7845
7891
|
this._W[s] |= t[n++] << o * 8;
|
|
7846
|
-
i || (this._W[s - (n % 4 === 0 ? 0 : 1)] |= K << (3 - n % 4) * 8), this._W[14] = t.byteLength /
|
|
7892
|
+
i || (this._W[s - (n % 4 === 0 ? 0 : 1)] |= K << (3 - n % 4) * 8), this._W[14] = t.byteLength / xl, this._W[15] = t.byteLength * 8, this._updateHash();
|
|
7847
7893
|
const r = new Uint8Array(32);
|
|
7848
7894
|
for (let o = 0; o < this._H.length; o++)
|
|
7849
7895
|
for (let l = 0; l < 4; l++)
|
|
@@ -7851,27 +7897,27 @@ class ah {
|
|
|
7851
7897
|
return r;
|
|
7852
7898
|
}
|
|
7853
7899
|
}
|
|
7854
|
-
const
|
|
7900
|
+
const ah = (e) => new ch().digest(e), U = new ei("y-sync"), yt = new ei("y-undo");
|
|
7855
7901
|
new ei("yjs-cursor");
|
|
7856
|
-
const
|
|
7902
|
+
const hh = (e) => {
|
|
7857
7903
|
for (let n = 6; n < e.length; n++)
|
|
7858
7904
|
e[n % 6] = e[n % 6] ^ e[n];
|
|
7859
7905
|
return e.slice(0, 6);
|
|
7860
|
-
},
|
|
7861
|
-
t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id),
|
|
7906
|
+
}, dh = (e) => bc(hh(ah(yc(e)))), nn = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && /** @type {number} */
|
|
7907
|
+
t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), uh = [{ light: "#ecd44433", dark: "#ecd444" }], fh = (e, t, n) => {
|
|
7862
7908
|
if (!e.has(n)) {
|
|
7863
7909
|
if (e.size < t.length) {
|
|
7864
7910
|
const i = Bt();
|
|
7865
7911
|
e.forEach((s) => i.add(s)), t = t.filter((s) => !i.has(s));
|
|
7866
7912
|
}
|
|
7867
|
-
e.set(n,
|
|
7913
|
+
e.set(n, Ql(t));
|
|
7868
7914
|
}
|
|
7869
7915
|
return (
|
|
7870
7916
|
/** @type {ColorDef} */
|
|
7871
7917
|
e.get(n)
|
|
7872
7918
|
);
|
|
7873
|
-
},
|
|
7874
|
-
colors: t =
|
|
7919
|
+
}, ph = (e, {
|
|
7920
|
+
colors: t = uh,
|
|
7875
7921
|
colorMapping: n = /* @__PURE__ */ new Map(),
|
|
7876
7922
|
permanentUserData: i = null,
|
|
7877
7923
|
onFirstRender: s = () => {
|
|
@@ -7879,19 +7925,19 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), fh = [{ light: "#ecd44433
|
|
|
7879
7925
|
mapping: r
|
|
7880
7926
|
} = {}) => {
|
|
7881
7927
|
let o = !1;
|
|
7882
|
-
const l = new
|
|
7928
|
+
const l = new wh(e, r), c = new ys({
|
|
7883
7929
|
props: {
|
|
7884
7930
|
editable: (a) => {
|
|
7885
|
-
const
|
|
7886
|
-
return
|
|
7931
|
+
const d = U.getState(a);
|
|
7932
|
+
return d.snapshot == null && d.prevSnapshot == null;
|
|
7887
7933
|
}
|
|
7888
7934
|
},
|
|
7889
|
-
key:
|
|
7935
|
+
key: U,
|
|
7890
7936
|
state: {
|
|
7891
7937
|
/**
|
|
7892
7938
|
* @returns {any}
|
|
7893
7939
|
*/
|
|
7894
|
-
init: (a,
|
|
7940
|
+
init: (a, d) => ({
|
|
7895
7941
|
type: e,
|
|
7896
7942
|
doc: e.doc,
|
|
7897
7943
|
binding: l,
|
|
@@ -7904,47 +7950,47 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), fh = [{ light: "#ecd44433
|
|
|
7904
7950
|
colorMapping: n,
|
|
7905
7951
|
permanentUserData: i
|
|
7906
7952
|
}),
|
|
7907
|
-
apply: (a,
|
|
7908
|
-
const
|
|
7909
|
-
if (
|
|
7910
|
-
|
|
7911
|
-
for (const u in
|
|
7912
|
-
|
|
7953
|
+
apply: (a, d) => {
|
|
7954
|
+
const h = a.getMeta(U);
|
|
7955
|
+
if (h !== void 0) {
|
|
7956
|
+
d = Object.assign({}, d);
|
|
7957
|
+
for (const u in h)
|
|
7958
|
+
d[u] = h[u];
|
|
7913
7959
|
}
|
|
7914
|
-
return
|
|
7915
|
-
l.prosemirrorView != null && (
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7960
|
+
return d.addToHistory = a.getMeta("addToHistory") !== !1, d.isChangeOrigin = h !== void 0 && !!h.isChangeOrigin, d.isUndoRedoOperation = h !== void 0 && !!h.isChangeOrigin && !!h.isUndoRedoOperation, l.prosemirrorView !== null && h !== void 0 && (h.snapshot != null || h.prevSnapshot != null) && Js(0, () => {
|
|
7961
|
+
l.prosemirrorView != null && (h.restore == null ? l._renderSnapshot(
|
|
7962
|
+
h.snapshot,
|
|
7963
|
+
h.prevSnapshot,
|
|
7964
|
+
d
|
|
7919
7965
|
) : (l._renderSnapshot(
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
), delete
|
|
7966
|
+
h.snapshot,
|
|
7967
|
+
h.snapshot,
|
|
7968
|
+
d
|
|
7969
|
+
), delete d.restore, delete d.snapshot, delete d.prevSnapshot, l.mux(() => {
|
|
7924
7970
|
l._prosemirrorChanged(
|
|
7925
7971
|
l.prosemirrorView.state.doc
|
|
7926
7972
|
);
|
|
7927
7973
|
})));
|
|
7928
|
-
}),
|
|
7974
|
+
}), d;
|
|
7929
7975
|
}
|
|
7930
7976
|
},
|
|
7931
7977
|
view: (a) => (l.initView(a), r == null && l._forceRerender(), s(), {
|
|
7932
7978
|
update: () => {
|
|
7933
|
-
const
|
|
7934
|
-
if (
|
|
7979
|
+
const d = c.getState(a.state);
|
|
7980
|
+
if (d.snapshot == null && d.prevSnapshot == null && // If the content doesn't change initially, we don't render anything to Yjs
|
|
7935
7981
|
// If the content was cleared by a user action, we want to catch the change and
|
|
7936
7982
|
// represent it in Yjs
|
|
7937
7983
|
(o || a.state.doc.content.findDiffStart(
|
|
7938
7984
|
a.state.doc.type.createAndFill().content
|
|
7939
7985
|
) !== null)) {
|
|
7940
|
-
if (o = !0,
|
|
7941
|
-
const
|
|
7986
|
+
if (o = !0, d.addToHistory === !1 && !d.isChangeOrigin) {
|
|
7987
|
+
const h = yt.getState(a.state), u = h && h.undoManager;
|
|
7942
7988
|
u && u.stopCapturing();
|
|
7943
7989
|
}
|
|
7944
7990
|
l.mux(() => {
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
},
|
|
7991
|
+
d.doc.transact((h) => {
|
|
7992
|
+
h.meta.set("addToHistory", d.addToHistory), l._prosemirrorChanged(a.state.doc);
|
|
7993
|
+
}, U);
|
|
7948
7994
|
});
|
|
7949
7995
|
}
|
|
7950
7996
|
},
|
|
@@ -7954,7 +8000,7 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), fh = [{ light: "#ecd44433
|
|
|
7954
8000
|
})
|
|
7955
8001
|
});
|
|
7956
8002
|
return c;
|
|
7957
|
-
},
|
|
8003
|
+
}, gh = (e, t, n) => {
|
|
7958
8004
|
if (t !== null && t.anchor !== null && t.head !== null)
|
|
7959
8005
|
if (t.type === "all")
|
|
7960
8006
|
e.setSelection(new Xr(e.doc));
|
|
@@ -7965,7 +8011,7 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), fh = [{ light: "#ecd44433
|
|
|
7965
8011
|
t.anchor,
|
|
7966
8012
|
n.mapping
|
|
7967
8013
|
);
|
|
7968
|
-
e.setSelection(
|
|
8014
|
+
e.setSelection(mh(e, i));
|
|
7969
8015
|
} else {
|
|
7970
8016
|
const i = de(
|
|
7971
8017
|
n.doc,
|
|
@@ -7980,7 +8026,7 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), fh = [{ light: "#ecd44433
|
|
|
7980
8026
|
);
|
|
7981
8027
|
i !== null && s !== null && e.setSelection(ni.between(e.doc.resolve(i), e.doc.resolve(s)));
|
|
7982
8028
|
}
|
|
7983
|
-
},
|
|
8029
|
+
}, mh = (e, t) => {
|
|
7984
8030
|
const n = e.doc.resolve(t);
|
|
7985
8031
|
return n.nodeAfter ? Zr.create(e.doc, t) : ni.near(n);
|
|
7986
8032
|
}, Jn = (e, t) => ({
|
|
@@ -7999,13 +8045,13 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), fh = [{ light: "#ecd44433
|
|
|
7999
8045
|
e.mapping
|
|
8000
8046
|
)
|
|
8001
8047
|
});
|
|
8002
|
-
class
|
|
8048
|
+
class wh {
|
|
8003
8049
|
/**
|
|
8004
8050
|
* @param {Y.XmlFragment} yXmlFragment The bind source
|
|
8005
8051
|
* @param {ProsemirrorMapping} mapping
|
|
8006
8052
|
*/
|
|
8007
8053
|
constructor(t, n = /* @__PURE__ */ new Map()) {
|
|
8008
|
-
this.type = t, this.prosemirrorView = null, this.mux =
|
|
8054
|
+
this.type = t, this.prosemirrorView = null, this.mux = Xa(), this.mapping = n, this.isOMark = /* @__PURE__ */ new Map(), this._observeFunction = this._typeChanged.bind(this), this.doc = t.doc, this.beforeTransactionSelection = null, this.beforeAllTransactions = () => {
|
|
8009
8055
|
this.beforeTransactionSelection === null && this.prosemirrorView != null && (this.beforeTransactionSelection = Jn(
|
|
8010
8056
|
this,
|
|
8011
8057
|
this.prosemirrorView.state
|
|
@@ -8032,7 +8078,7 @@ class bh {
|
|
|
8032
8078
|
if (t == null || t.anchorNode == null) return !1;
|
|
8033
8079
|
const n = this.prosemirrorView._root.createRange();
|
|
8034
8080
|
n.setStart(t.anchorNode, t.anchorOffset), n.setEnd(t.focusNode, t.focusOffset), n.getClientRects().length === 0 && n.startContainer && n.collapsed && n.selectNodeContents(n.startContainer);
|
|
8035
|
-
const s = n.getBoundingClientRect(), r =
|
|
8081
|
+
const s = n.getBoundingClientRect(), r = Sc.documentElement;
|
|
8036
8082
|
return s.bottom >= 0 && s.right >= 0 && s.left <= (window.innerWidth || r.clientWidth || 0) && s.top <= (window.innerHeight || r.clientHeight || 0);
|
|
8037
8083
|
}
|
|
8038
8084
|
/**
|
|
@@ -8041,7 +8087,7 @@ class bh {
|
|
|
8041
8087
|
*/
|
|
8042
8088
|
renderSnapshot(t, n) {
|
|
8043
8089
|
n || (n = lr(ir(), /* @__PURE__ */ new Map())), this.prosemirrorView.dispatch(
|
|
8044
|
-
this._tr.setMeta(
|
|
8090
|
+
this._tr.setMeta(U, { snapshot: t, prevSnapshot: n })
|
|
8045
8091
|
);
|
|
8046
8092
|
}
|
|
8047
8093
|
unrenderSnapshot() {
|
|
@@ -8058,7 +8104,7 @@ class bh {
|
|
|
8058
8104
|
this.prosemirrorView.state.doc.content.size,
|
|
8059
8105
|
new Ie(Oe.from(t), 0, 0)
|
|
8060
8106
|
);
|
|
8061
|
-
n.setMeta(
|
|
8107
|
+
n.setMeta(U, { snapshot: null, prevSnapshot: null }), this.prosemirrorView.dispatch(n);
|
|
8062
8108
|
});
|
|
8063
8109
|
}
|
|
8064
8110
|
_forceRerender() {
|
|
@@ -8080,7 +8126,7 @@ class bh {
|
|
|
8080
8126
|
i.setSelection(ni.create(i.doc, s, r));
|
|
8081
8127
|
}
|
|
8082
8128
|
this.prosemirrorView.dispatch(
|
|
8083
|
-
i.setMeta(
|
|
8129
|
+
i.setMeta(U, { isChangeOrigin: !0, binding: this })
|
|
8084
8130
|
);
|
|
8085
8131
|
});
|
|
8086
8132
|
}
|
|
@@ -8110,16 +8156,16 @@ class bh {
|
|
|
8110
8156
|
this.mapping.clear(), this.mux(() => {
|
|
8111
8157
|
s.transact((o) => {
|
|
8112
8158
|
const l = i.permanentUserData;
|
|
8113
|
-
l && l.dss.forEach((
|
|
8114
|
-
Dt(o,
|
|
8159
|
+
l && l.dss.forEach((h) => {
|
|
8160
|
+
Dt(o, h, (u) => {
|
|
8115
8161
|
});
|
|
8116
8162
|
});
|
|
8117
|
-
const c = (
|
|
8118
|
-
const f =
|
|
8163
|
+
const c = (h, u) => {
|
|
8164
|
+
const f = h === "added" ? l.getUserByClientId(u.client) : l.getUserByDeletedId(u);
|
|
8119
8165
|
return {
|
|
8120
8166
|
user: f,
|
|
8121
|
-
type:
|
|
8122
|
-
color:
|
|
8167
|
+
type: h,
|
|
8168
|
+
color: fh(
|
|
8123
8169
|
i.colorMapping,
|
|
8124
8170
|
i.colors,
|
|
8125
8171
|
f
|
|
@@ -8128,22 +8174,22 @@ class bh {
|
|
|
8128
8174
|
}, a = br(
|
|
8129
8175
|
r,
|
|
8130
8176
|
new gi(n.ds, t.sv)
|
|
8131
|
-
).map((
|
|
8132
|
-
|
|
8177
|
+
).map((h) => !h._item.deleted || nn(h._item, t) || nn(h._item, n) ? ze(
|
|
8178
|
+
h,
|
|
8133
8179
|
this.prosemirrorView.state.schema,
|
|
8134
8180
|
{ mapping: /* @__PURE__ */ new Map(), isOMark: /* @__PURE__ */ new Map() },
|
|
8135
8181
|
t,
|
|
8136
8182
|
n,
|
|
8137
8183
|
c
|
|
8138
|
-
) : null).filter((
|
|
8184
|
+
) : null).filter((h) => h !== null), d = this._tr.replace(
|
|
8139
8185
|
0,
|
|
8140
8186
|
this.prosemirrorView.state.doc.content.size,
|
|
8141
8187
|
new Ie(Oe.from(a), 0, 0)
|
|
8142
8188
|
);
|
|
8143
8189
|
this.prosemirrorView.dispatch(
|
|
8144
|
-
|
|
8190
|
+
d.setMeta(U, { isChangeOrigin: !0 })
|
|
8145
8191
|
);
|
|
8146
|
-
},
|
|
8192
|
+
}, U);
|
|
8147
8193
|
});
|
|
8148
8194
|
}
|
|
8149
8195
|
/**
|
|
@@ -8152,7 +8198,7 @@ class bh {
|
|
|
8152
8198
|
*/
|
|
8153
8199
|
_typeChanged(t, n) {
|
|
8154
8200
|
if (this.prosemirrorView == null) return;
|
|
8155
|
-
const i =
|
|
8201
|
+
const i = U.getState(this.prosemirrorView.state);
|
|
8156
8202
|
if (t.length === 0 || i.snapshot != null || i.prevSnapshot != null) {
|
|
8157
8203
|
this.renderSnapshot(i.snapshot, i.prevSnapshot);
|
|
8158
8204
|
return;
|
|
@@ -8163,7 +8209,7 @@ class bh {
|
|
|
8163
8209
|
n,
|
|
8164
8210
|
n.deleteSet,
|
|
8165
8211
|
(l) => {
|
|
8166
|
-
if (l.constructor ===
|
|
8212
|
+
if (l.constructor === I) {
|
|
8167
8213
|
const c = (
|
|
8168
8214
|
/** @type {Y.ContentType} */
|
|
8169
8215
|
/** @type {Y.Item} */
|
|
@@ -8186,7 +8232,7 @@ class bh {
|
|
|
8186
8232
|
this.prosemirrorView.state.doc.content.size,
|
|
8187
8233
|
new Ie(Oe.from(r), 0, 0)
|
|
8188
8234
|
);
|
|
8189
|
-
|
|
8235
|
+
gh(o, this.beforeTransactionSelection, this), o = o.setMeta(U, { isChangeOrigin: !0, isUndoRedoOperation: n.origin instanceof ur }), this.beforeTransactionSelection !== null && this._isLocalCursorInView() && o.scrollIntoView(), this.prosemirrorView.dispatch(o);
|
|
8190
8236
|
});
|
|
8191
8237
|
}
|
|
8192
8238
|
/**
|
|
@@ -8198,7 +8244,7 @@ class bh {
|
|
|
8198
8244
|
this,
|
|
8199
8245
|
this.prosemirrorView.state
|
|
8200
8246
|
);
|
|
8201
|
-
},
|
|
8247
|
+
}, U);
|
|
8202
8248
|
}
|
|
8203
8249
|
/**
|
|
8204
8250
|
* View is ready to listen to changes. Register observers.
|
|
@@ -8231,9 +8277,9 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8231
8277
|
return o;
|
|
8232
8278
|
}, ze = (e, t, n, i, s, r) => {
|
|
8233
8279
|
const o = [], l = (c) => {
|
|
8234
|
-
var a,
|
|
8280
|
+
var a, d;
|
|
8235
8281
|
if (c instanceof W) {
|
|
8236
|
-
const
|
|
8282
|
+
const h = Ur(
|
|
8237
8283
|
c,
|
|
8238
8284
|
t,
|
|
8239
8285
|
n,
|
|
@@ -8241,19 +8287,19 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8241
8287
|
s,
|
|
8242
8288
|
r
|
|
8243
8289
|
);
|
|
8244
|
-
|
|
8290
|
+
h !== null && o.push(h);
|
|
8245
8291
|
} else {
|
|
8246
|
-
const
|
|
8292
|
+
const h = (
|
|
8247
8293
|
/** @type {Y.ContentType} */
|
|
8248
|
-
(
|
|
8294
|
+
(d = (a = c._item.right) == null ? void 0 : a.content) == null ? void 0 : d.type
|
|
8249
8295
|
);
|
|
8250
|
-
|
|
8296
|
+
h instanceof At && !h._item.deleted && h._item.id.client === h.doc.clientID && (c.applyDelta([
|
|
8251
8297
|
{ retain: c.length },
|
|
8252
|
-
...
|
|
8253
|
-
]),
|
|
8254
|
-
|
|
8298
|
+
...h.toDelta()
|
|
8299
|
+
]), h.doc.transact((f) => {
|
|
8300
|
+
h._item.delete(f);
|
|
8255
8301
|
}));
|
|
8256
|
-
const u =
|
|
8302
|
+
const u = bh(
|
|
8257
8303
|
c,
|
|
8258
8304
|
t,
|
|
8259
8305
|
n,
|
|
@@ -8291,29 +8337,29 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8291
8337
|
} catch {
|
|
8292
8338
|
return e.doc.transact((a) => {
|
|
8293
8339
|
e._item.delete(a);
|
|
8294
|
-
},
|
|
8340
|
+
}, U), n.mapping.delete(e), null;
|
|
8295
8341
|
}
|
|
8296
|
-
},
|
|
8342
|
+
}, bh = (e, t, n, i, s, r) => {
|
|
8297
8343
|
const o = [], l = e.toDelta(i, s, r);
|
|
8298
8344
|
try {
|
|
8299
8345
|
for (let c = 0; c < l.length; c++) {
|
|
8300
8346
|
const a = l[c];
|
|
8301
|
-
o.push(t.text(a.insert,
|
|
8347
|
+
o.push(t.text(a.insert, Ch(a.attributes, t)));
|
|
8302
8348
|
}
|
|
8303
8349
|
} catch {
|
|
8304
8350
|
return e.doc.transact((a) => {
|
|
8305
8351
|
e._item.delete(a);
|
|
8306
|
-
},
|
|
8352
|
+
}, U), null;
|
|
8307
8353
|
}
|
|
8308
8354
|
return o;
|
|
8309
|
-
},
|
|
8355
|
+
}, yh = (e, t) => {
|
|
8310
8356
|
const n = new J(), i = e.map((s) => ({
|
|
8311
8357
|
// @ts-ignore
|
|
8312
8358
|
insert: s.text,
|
|
8313
8359
|
attributes: Pr(s.marks, t)
|
|
8314
8360
|
}));
|
|
8315
8361
|
return n.applyDelta(i), t.mapping.set(n, e), n;
|
|
8316
|
-
},
|
|
8362
|
+
}, xh = (e, t) => {
|
|
8317
8363
|
const n = new W(e.type.name);
|
|
8318
8364
|
for (const i in e.attrs) {
|
|
8319
8365
|
const s = e.attrs[i];
|
|
@@ -8325,7 +8371,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8325
8371
|
(i) => qn(i, t)
|
|
8326
8372
|
)
|
|
8327
8373
|
), t.mapping.set(n, e), n;
|
|
8328
|
-
}, qn = (e, t) => e instanceof Array ?
|
|
8374
|
+
}, qn = (e, t) => e instanceof Array ? yh(e, t) : xh(e, t), hs = (e) => typeof e == "object" && e !== null, Si = (e, t) => {
|
|
8329
8375
|
const n = Object.keys(e).filter((s) => e[s] !== null);
|
|
8330
8376
|
let i = n.length === Object.keys(t).filter((s) => t[s] !== null).length;
|
|
8331
8377
|
for (let s = 0; s < n.length && i; s++) {
|
|
@@ -8352,15 +8398,15 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8352
8398
|
/** @type {(d:any,i:number) => boolean} */
|
|
8353
8399
|
(i, s) => i.insert === /** @type {any} */
|
|
8354
8400
|
t[s].text && Ws(i.attributes || {}).length === t[s].marks.length && js(i.attributes, (r, o) => {
|
|
8355
|
-
var
|
|
8401
|
+
var d;
|
|
8356
8402
|
const l = ki(o), c = t[s].marks;
|
|
8357
8403
|
return c.find(
|
|
8358
8404
|
/** @param {any} mark */
|
|
8359
|
-
(
|
|
8360
|
-
) ? Si(r, (
|
|
8405
|
+
(h) => h.type.name === l
|
|
8406
|
+
) ? Si(r, (d = c.find(
|
|
8361
8407
|
/** @param {any} mark */
|
|
8362
|
-
(
|
|
8363
|
-
)) == null ? void 0 :
|
|
8408
|
+
(h) => h.type.name === l
|
|
8409
|
+
)) == null ? void 0 : d.attrs) : !1;
|
|
8364
8410
|
})
|
|
8365
8411
|
);
|
|
8366
8412
|
}, Se = (e, t) => {
|
|
@@ -8375,26 +8421,26 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8375
8421
|
(n, i) => t[i] === n
|
|
8376
8422
|
), ds = (e, t, n) => {
|
|
8377
8423
|
const i = e.toArray(), s = yn(t), r = s.length, o = i.length, l = qt(o, r);
|
|
8378
|
-
let c = 0, a = 0,
|
|
8424
|
+
let c = 0, a = 0, d = !1;
|
|
8379
8425
|
for (; c < l; c++) {
|
|
8380
|
-
const
|
|
8381
|
-
if (sn(n.mapping.get(
|
|
8382
|
-
|
|
8383
|
-
else if (!Se(
|
|
8426
|
+
const h = i[c], u = s[c];
|
|
8427
|
+
if (sn(n.mapping.get(h), u))
|
|
8428
|
+
d = !0;
|
|
8429
|
+
else if (!Se(h, u))
|
|
8384
8430
|
break;
|
|
8385
8431
|
}
|
|
8386
8432
|
for (; c + a < l; a++) {
|
|
8387
|
-
const
|
|
8388
|
-
if (sn(n.mapping.get(
|
|
8389
|
-
|
|
8390
|
-
else if (!Se(
|
|
8433
|
+
const h = i[o - a - 1], u = s[r - a - 1];
|
|
8434
|
+
if (sn(n.mapping.get(h), u))
|
|
8435
|
+
d = !0;
|
|
8436
|
+
else if (!Se(h, u))
|
|
8391
8437
|
break;
|
|
8392
8438
|
}
|
|
8393
8439
|
return {
|
|
8394
8440
|
equalityFactor: c + a,
|
|
8395
|
-
foundMappedChild:
|
|
8441
|
+
foundMappedChild: d
|
|
8396
8442
|
};
|
|
8397
|
-
},
|
|
8443
|
+
}, Sh = (e) => {
|
|
8398
8444
|
let t = "", n = e._start;
|
|
8399
8445
|
const i = {};
|
|
8400
8446
|
for (; n !== null; )
|
|
@@ -8403,25 +8449,25 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8403
8449
|
str: t,
|
|
8404
8450
|
nAttrs: i
|
|
8405
8451
|
};
|
|
8406
|
-
},
|
|
8452
|
+
}, kh = (e, t, n) => {
|
|
8407
8453
|
n.mapping.set(e, t);
|
|
8408
|
-
const { nAttrs: i, str: s } =
|
|
8454
|
+
const { nAttrs: i, str: s } = Sh(e), r = t.map((a) => ({
|
|
8409
8455
|
insert: (
|
|
8410
8456
|
/** @type {any} */
|
|
8411
8457
|
a.text
|
|
8412
8458
|
),
|
|
8413
8459
|
attributes: Object.assign({}, i, Pr(a.marks, n))
|
|
8414
|
-
})), { insert: o, remove: l, index: c } =
|
|
8460
|
+
})), { insert: o, remove: l, index: c } = eh(
|
|
8415
8461
|
s,
|
|
8416
8462
|
r.map((a) => a.insert).join("")
|
|
8417
8463
|
);
|
|
8418
8464
|
e.delete(c, l), e.insert(c, o), e.applyDelta(
|
|
8419
8465
|
r.map((a) => ({ retain: a.insert.length, attributes: a.attributes }))
|
|
8420
8466
|
);
|
|
8421
|
-
},
|
|
8467
|
+
}, vh = /(.*)(--[a-zA-Z0-9+/=]{8})$/, ki = (e) => {
|
|
8422
8468
|
var t;
|
|
8423
|
-
return ((t =
|
|
8424
|
-
},
|
|
8469
|
+
return ((t = vh.exec(e)) == null ? void 0 : t[1]) ?? e;
|
|
8470
|
+
}, Ch = (e, t) => {
|
|
8425
8471
|
const n = [];
|
|
8426
8472
|
for (const i in e)
|
|
8427
8473
|
n.push(t.mark(ki(i), e[i]));
|
|
@@ -8431,46 +8477,46 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8431
8477
|
return e.forEach((i) => {
|
|
8432
8478
|
if (i.type.name !== "ychange") {
|
|
8433
8479
|
const s = St(t.isOMark, i.type, () => !i.type.excludes(i.type));
|
|
8434
|
-
n[s ? `${i.type.name}--${
|
|
8480
|
+
n[s ? `${i.type.name}--${dh(i.toJSON())}` : i.type.name] = i.attrs;
|
|
8435
8481
|
}
|
|
8436
8482
|
}), n;
|
|
8437
8483
|
}, Xn = (e, t, n, i) => {
|
|
8438
8484
|
if (t instanceof W && t.nodeName !== n.type.name)
|
|
8439
8485
|
throw new Error("node name mismatch!");
|
|
8440
8486
|
if (i.mapping.set(t, n), t instanceof W) {
|
|
8441
|
-
const
|
|
8487
|
+
const h = t.getAttributes(), u = n.attrs;
|
|
8442
8488
|
for (const f in u)
|
|
8443
|
-
u[f] !== null ?
|
|
8444
|
-
for (const f in
|
|
8489
|
+
u[f] !== null ? h[f] !== u[f] && f !== "ychange" && t.setAttribute(f, u[f]) : t.removeAttribute(f);
|
|
8490
|
+
for (const f in h)
|
|
8445
8491
|
u[f] === void 0 && t.removeAttribute(f);
|
|
8446
8492
|
}
|
|
8447
8493
|
const s = yn(n), r = s.length, o = t.toArray(), l = o.length, c = qt(r, l);
|
|
8448
|
-
let a = 0,
|
|
8494
|
+
let a = 0, d = 0;
|
|
8449
8495
|
for (; a < c; a++) {
|
|
8450
|
-
const
|
|
8451
|
-
if (!sn(i.mapping.get(
|
|
8452
|
-
if (Se(
|
|
8453
|
-
i.mapping.set(
|
|
8496
|
+
const h = o[a], u = s[a];
|
|
8497
|
+
if (!sn(i.mapping.get(h), u))
|
|
8498
|
+
if (Se(h, u))
|
|
8499
|
+
i.mapping.set(h, u);
|
|
8454
8500
|
else
|
|
8455
8501
|
break;
|
|
8456
8502
|
}
|
|
8457
|
-
for (;
|
|
8458
|
-
const
|
|
8459
|
-
if (!sn(i.mapping.get(
|
|
8460
|
-
if (Se(
|
|
8461
|
-
i.mapping.set(
|
|
8503
|
+
for (; d + a + 1 < c; d++) {
|
|
8504
|
+
const h = o[l - d - 1], u = s[r - d - 1];
|
|
8505
|
+
if (!sn(i.mapping.get(h), u))
|
|
8506
|
+
if (Se(h, u))
|
|
8507
|
+
i.mapping.set(h, u);
|
|
8462
8508
|
else
|
|
8463
8509
|
break;
|
|
8464
8510
|
}
|
|
8465
8511
|
e.transact(() => {
|
|
8466
|
-
for (; l - a -
|
|
8467
|
-
const u = o[a], f = s[a], g = o[l -
|
|
8512
|
+
for (; l - a - d > 0 && r - a - d > 0; ) {
|
|
8513
|
+
const u = o[a], f = s[a], g = o[l - d - 1], m = s[r - d - 1];
|
|
8468
8514
|
if (u instanceof J && f instanceof Array)
|
|
8469
|
-
Lr(u, f) ||
|
|
8515
|
+
Lr(u, f) || kh(u, f, i), a += 1;
|
|
8470
8516
|
else {
|
|
8471
|
-
let
|
|
8472
|
-
if (
|
|
8473
|
-
const
|
|
8517
|
+
let b = u instanceof W && Zn(u, f), w = g instanceof W && Zn(g, m);
|
|
8518
|
+
if (b && w) {
|
|
8519
|
+
const D = ds(
|
|
8474
8520
|
/** @type {Y.XmlElement} */
|
|
8475
8521
|
u,
|
|
8476
8522
|
/** @type {PModel.Node} */
|
|
@@ -8483,35 +8529,35 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8483
8529
|
m,
|
|
8484
8530
|
i
|
|
8485
8531
|
);
|
|
8486
|
-
|
|
8532
|
+
D.foundMappedChild && !A.foundMappedChild ? w = !1 : !D.foundMappedChild && A.foundMappedChild || D.equalityFactor < A.equalityFactor ? b = !1 : w = !1;
|
|
8487
8533
|
}
|
|
8488
|
-
|
|
8534
|
+
b ? (Xn(
|
|
8489
8535
|
e,
|
|
8490
8536
|
/** @type {Y.XmlFragment} */
|
|
8491
8537
|
u,
|
|
8492
8538
|
/** @type {PModel.Node} */
|
|
8493
8539
|
f,
|
|
8494
8540
|
i
|
|
8495
|
-
), a += 1) :
|
|
8541
|
+
), a += 1) : w ? (Xn(
|
|
8496
8542
|
e,
|
|
8497
8543
|
/** @type {Y.XmlFragment} */
|
|
8498
8544
|
g,
|
|
8499
8545
|
/** @type {PModel.Node} */
|
|
8500
8546
|
m,
|
|
8501
8547
|
i
|
|
8502
|
-
),
|
|
8548
|
+
), d += 1) : (i.mapping.delete(t.get(a)), t.delete(a, 1), t.insert(a, [
|
|
8503
8549
|
qn(f, i)
|
|
8504
8550
|
]), a += 1);
|
|
8505
8551
|
}
|
|
8506
8552
|
}
|
|
8507
|
-
const
|
|
8508
|
-
if (l === 1 && r === 0 && o[0] instanceof J ? (i.mapping.delete(o[0]), o[0].delete(0, o[0].length)) :
|
|
8553
|
+
const h = l - a - d;
|
|
8554
|
+
if (l === 1 && r === 0 && o[0] instanceof J ? (i.mapping.delete(o[0]), o[0].delete(0, o[0].length)) : h > 0 && (t.slice(a, a + h).forEach((u) => i.mapping.delete(u)), t.delete(a, h)), a + d < r) {
|
|
8509
8555
|
const u = [];
|
|
8510
|
-
for (let f = a; f < r -
|
|
8556
|
+
for (let f = a; f < r - d; f++)
|
|
8511
8557
|
u.push(qn(s[f], i));
|
|
8512
8558
|
t.insert(a, u);
|
|
8513
8559
|
}
|
|
8514
|
-
},
|
|
8560
|
+
}, U);
|
|
8515
8561
|
}, Zn = (e, t) => !(t instanceof Array) && e.nodeName === t.type.name, rn = (e, t, n) => {
|
|
8516
8562
|
if (e === 0)
|
|
8517
8563
|
return In(t, 0, -1);
|
|
@@ -8568,14 +8614,14 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8568
8614
|
if (i === null)
|
|
8569
8615
|
throw q();
|
|
8570
8616
|
if (e === 0 && i.constructor !== J && i !== t)
|
|
8571
|
-
return
|
|
8617
|
+
return _h(i._item.parent, i._item);
|
|
8572
8618
|
}
|
|
8573
8619
|
return In(t, t._length, -1);
|
|
8574
|
-
},
|
|
8620
|
+
}, _h = (e, t) => {
|
|
8575
8621
|
let n = null, i = null;
|
|
8576
8622
|
return e._item === null ? i = me(e) : n = C(e._item.id.client, e._item.id.clock), new qe(n, i, t.id);
|
|
8577
8623
|
}, de = (e, t, n, i) => {
|
|
8578
|
-
const s =
|
|
8624
|
+
const s = Xc(n, e);
|
|
8579
8625
|
if (s === null || s.type !== t && !we(t, s.type._item))
|
|
8580
8626
|
return null;
|
|
8581
8627
|
let r = s.type, o = 0;
|
|
@@ -8621,7 +8667,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8621
8667
|
}
|
|
8622
8668
|
return o - 1;
|
|
8623
8669
|
};
|
|
8624
|
-
function
|
|
8670
|
+
function Eh(e) {
|
|
8625
8671
|
const t = e.toArray(), n = (i) => {
|
|
8626
8672
|
let s;
|
|
8627
8673
|
if (i instanceof J)
|
|
@@ -8633,10 +8679,10 @@ function Th(e) {
|
|
|
8633
8679
|
text: o.insert
|
|
8634
8680
|
};
|
|
8635
8681
|
return o.attributes && (l.marks = Object.keys(o.attributes).map((c) => {
|
|
8636
|
-
const a = o.attributes[c],
|
|
8682
|
+
const a = o.attributes[c], h = {
|
|
8637
8683
|
type: ki(c)
|
|
8638
8684
|
};
|
|
8639
|
-
return Object.keys(a) && (
|
|
8685
|
+
return Object.keys(a) && (h.attrs = a), h;
|
|
8640
8686
|
})), l;
|
|
8641
8687
|
}
|
|
8642
8688
|
);
|
|
@@ -8657,21 +8703,21 @@ function Th(e) {
|
|
|
8657
8703
|
content: t.map(n)
|
|
8658
8704
|
};
|
|
8659
8705
|
}
|
|
8660
|
-
const
|
|
8706
|
+
const Th = (e) => {
|
|
8661
8707
|
const t = yt.getState(e).undoManager;
|
|
8662
8708
|
if (t != null)
|
|
8663
8709
|
return t.undo(), !0;
|
|
8664
|
-
},
|
|
8710
|
+
}, Dh = (e) => {
|
|
8665
8711
|
const t = yt.getState(e).undoManager;
|
|
8666
8712
|
if (t != null)
|
|
8667
8713
|
return t.redo(), !0;
|
|
8668
|
-
},
|
|
8714
|
+
}, Ah = /* @__PURE__ */ new Set(["paragraph"]), Ih = (e, t) => !(e instanceof I) || !(e.content instanceof ut) || !(e.content.type instanceof At || e.content.type instanceof W && t.has(e.content.type.nodeName)) || e.content.type._length === 0, Oh = ({ protectedNodes: e = Ah, trackedOrigins: t = [], undoManager: n = null } = {}) => new ys({
|
|
8669
8715
|
key: yt,
|
|
8670
8716
|
state: {
|
|
8671
8717
|
init: (i, s) => {
|
|
8672
|
-
const r =
|
|
8673
|
-
trackedOrigins: new Set([
|
|
8674
|
-
deleteFilter: (l) =>
|
|
8718
|
+
const r = U.getState(s), o = n || new ur(r.type, {
|
|
8719
|
+
trackedOrigins: new Set([U].concat(t)),
|
|
8720
|
+
deleteFilter: (l) => Ih(l, e),
|
|
8675
8721
|
captureTransaction: (l) => l.meta.get("addToHistory") !== !1
|
|
8676
8722
|
});
|
|
8677
8723
|
return {
|
|
@@ -8685,20 +8731,20 @@ const Dh = (e) => {
|
|
|
8685
8731
|
* @returns {any}
|
|
8686
8732
|
*/
|
|
8687
8733
|
apply: (i, s, r, o) => {
|
|
8688
|
-
const l =
|
|
8734
|
+
const l = U.getState(o).binding, c = s.undoManager, a = c.undoStack.length > 0, d = c.redoStack.length > 0;
|
|
8689
8735
|
return l ? {
|
|
8690
8736
|
undoManager: c,
|
|
8691
8737
|
prevSel: Jn(l, r),
|
|
8692
8738
|
hasUndoOps: a,
|
|
8693
|
-
hasRedoOps:
|
|
8694
|
-
} : a !== s.hasUndoOps ||
|
|
8739
|
+
hasRedoOps: d
|
|
8740
|
+
} : a !== s.hasUndoOps || d !== s.hasRedoOps ? Object.assign({}, s, {
|
|
8695
8741
|
hasUndoOps: c.undoStack.length > 0,
|
|
8696
8742
|
hasRedoOps: c.redoStack.length > 0
|
|
8697
8743
|
}) : s;
|
|
8698
8744
|
}
|
|
8699
8745
|
},
|
|
8700
8746
|
view: (i) => {
|
|
8701
|
-
const s =
|
|
8747
|
+
const s = U.getState(i.state), r = yt.getState(i.state).undoManager;
|
|
8702
8748
|
return r.on("stack-item-added", ({ stackItem: o }) => {
|
|
8703
8749
|
const l = s.binding;
|
|
8704
8750
|
l && o.meta.set(l, yt.getState(i.state).prevSel);
|
|
@@ -8713,14 +8759,14 @@ const Dh = (e) => {
|
|
|
8713
8759
|
}
|
|
8714
8760
|
});
|
|
8715
8761
|
function Br(e) {
|
|
8716
|
-
return !!e.getMeta(
|
|
8762
|
+
return !!e.getMeta(U);
|
|
8717
8763
|
}
|
|
8718
|
-
function
|
|
8719
|
-
const n =
|
|
8764
|
+
function Mh(e, t) {
|
|
8765
|
+
const n = U.getState(e);
|
|
8720
8766
|
return de(n.doc, n.type, t, n.binding.mapping) || 0;
|
|
8721
8767
|
}
|
|
8722
8768
|
function Vr(e, t) {
|
|
8723
|
-
const n =
|
|
8769
|
+
const n = U.getState(e);
|
|
8724
8770
|
return rn(t, n.type, n.binding.mapping);
|
|
8725
8771
|
}
|
|
8726
8772
|
var We = class Hr extends to {
|
|
@@ -8743,14 +8789,14 @@ var We = class Hr extends to {
|
|
|
8743
8789
|
};
|
|
8744
8790
|
}
|
|
8745
8791
|
};
|
|
8746
|
-
function
|
|
8792
|
+
function Rh(e, t) {
|
|
8747
8793
|
const n = Vr(t, e);
|
|
8748
8794
|
return new We(e, n);
|
|
8749
8795
|
}
|
|
8750
|
-
function
|
|
8796
|
+
function Nh(e, t, n) {
|
|
8751
8797
|
const i = e instanceof We ? e.yRelativePosition : null;
|
|
8752
8798
|
if (Br(t) && i) {
|
|
8753
|
-
const o =
|
|
8799
|
+
const o = Mh(n, i);
|
|
8754
8800
|
return {
|
|
8755
8801
|
position: new We(o, i),
|
|
8756
8802
|
mapResult: null
|
|
@@ -8787,12 +8833,12 @@ ke.create({
|
|
|
8787
8833
|
);
|
|
8788
8834
|
},
|
|
8789
8835
|
onBeforeCreate() {
|
|
8790
|
-
this.editor.utils.getUpdatedPosition = (e, t) =>
|
|
8836
|
+
this.editor.utils.getUpdatedPosition = (e, t) => Nh(e, t, this.editor.state), this.editor.utils.createMappablePosition = (e) => Rh(e, this.editor.state);
|
|
8791
8837
|
},
|
|
8792
8838
|
addCommands() {
|
|
8793
8839
|
return {
|
|
8794
|
-
undo: () => ({ tr: e, state: t, dispatch: n }) => (e.setMeta("preventDispatch", !0), yt.getState(t).undoManager.undoStack.length === 0 ? !1 : n ?
|
|
8795
|
-
redo: () => ({ tr: e, state: t, dispatch: n }) => (e.setMeta("preventDispatch", !0), yt.getState(t).undoManager.redoStack.length === 0 ? !1 : n ?
|
|
8840
|
+
undo: () => ({ tr: e, state: t, dispatch: n }) => (e.setMeta("preventDispatch", !0), yt.getState(t).undoManager.undoStack.length === 0 ? !1 : n ? Th(t) : !0),
|
|
8841
|
+
redo: () => ({ tr: e, state: t, dispatch: n }) => (e.setMeta("preventDispatch", !0), yt.getState(t).undoManager.redoStack.length === 0 ? !1 : n ? Dh(t) : !0)
|
|
8796
8842
|
};
|
|
8797
8843
|
},
|
|
8798
8844
|
addKeyboardShortcuts() {
|
|
@@ -8804,7 +8850,7 @@ ke.create({
|
|
|
8804
8850
|
},
|
|
8805
8851
|
addProseMirrorPlugins() {
|
|
8806
8852
|
var e;
|
|
8807
|
-
const t = this.options.fragment ? this.options.fragment : this.options.document.getXmlFragment(this.options.field), n =
|
|
8853
|
+
const t = this.options.fragment ? this.options.fragment : this.options.document.getXmlFragment(this.options.field), n = Oh(this.options.yUndoOptions), i = n.spec.view;
|
|
8808
8854
|
n.spec.view = (o) => {
|
|
8809
8855
|
const { undoManager: l } = yt.getState(o.state);
|
|
8810
8856
|
l.restore && (l.restore(), l.restore = () => {
|
|
@@ -8812,9 +8858,9 @@ ke.create({
|
|
|
8812
8858
|
const c = i ? i(o) : void 0;
|
|
8813
8859
|
return {
|
|
8814
8860
|
destroy: () => {
|
|
8815
|
-
const a = l.trackedOrigins.has(l),
|
|
8861
|
+
const a = l.trackedOrigins.has(l), d = l._observers;
|
|
8816
8862
|
l.restore = () => {
|
|
8817
|
-
a && l.trackedOrigins.add(l), l.doc.on("afterTransaction", l.afterTransactionHandler), l._observers =
|
|
8863
|
+
a && l.trackedOrigins.add(l), l.doc.on("afterTransaction", l.afterTransactionHandler), l._observers = d;
|
|
8818
8864
|
}, c != null && c.destroy && c.destroy();
|
|
8819
8865
|
}
|
|
8820
8866
|
};
|
|
@@ -8822,10 +8868,10 @@ ke.create({
|
|
|
8822
8868
|
const s = {
|
|
8823
8869
|
...this.options.ySyncOptions,
|
|
8824
8870
|
onFirstRender: this.options.onFirstRender
|
|
8825
|
-
}, r =
|
|
8871
|
+
}, r = ph(t, s);
|
|
8826
8872
|
return this.editor.options.enableContentCheck && ((e = t.doc) == null || e.on("beforeTransaction", () => {
|
|
8827
8873
|
try {
|
|
8828
|
-
const o =
|
|
8874
|
+
const o = Eh(t);
|
|
8829
8875
|
if (o.content.length === 0)
|
|
8830
8876
|
return;
|
|
8831
8877
|
this.editor.schema.nodeFromJSON(o).check();
|
|
@@ -8871,14 +8917,14 @@ function xn(e, t, n) {
|
|
|
8871
8917
|
typeof n == "number" && n >= 0 || (e.sameParent(t) ? n = Math.max(0, e.sharedDepth(t.pos) - 1) : n = e.sharedDepth(t.pos));
|
|
8872
8918
|
const r = new Uo(e, t, n), o = r.depth === 0 ? 0 : s.resolve(r.start).posAtIndex(0);
|
|
8873
8919
|
return r.parent.forEach((l, c) => {
|
|
8874
|
-
const a = o + c,
|
|
8920
|
+
const a = o + c, d = a + l.nodeSize;
|
|
8875
8921
|
if (a < r.start || a >= r.end)
|
|
8876
8922
|
return;
|
|
8877
|
-
const
|
|
8878
|
-
i.push(
|
|
8923
|
+
const h = new io(s.resolve(a), s.resolve(d));
|
|
8924
|
+
i.push(h);
|
|
8879
8925
|
}), i;
|
|
8880
8926
|
}
|
|
8881
|
-
var
|
|
8927
|
+
var Uh = class $r {
|
|
8882
8928
|
constructor(t, n) {
|
|
8883
8929
|
this.anchor = t, this.head = n;
|
|
8884
8930
|
}
|
|
@@ -8891,8 +8937,8 @@ var Lh = class $r {
|
|
|
8891
8937
|
}
|
|
8892
8938
|
}, _t = class vt extends so {
|
|
8893
8939
|
constructor(t, n, i, s = 1) {
|
|
8894
|
-
const { doc: r } = t, o = t === n, l = t.pos === r.content.size && n.pos === r.content.size, c = o && !l ? r.resolve(n.pos + (s > 0 ? 1 : -1)) : n, a = o && l ? r.resolve(t.pos - (s > 0 ? 1 : -1)) : t,
|
|
8895
|
-
super(
|
|
8940
|
+
const { doc: r } = t, o = t === n, l = t.pos === r.content.size && n.pos === r.content.size, c = o && !l ? r.resolve(n.pos + (s > 0 ? 1 : -1)) : n, a = o && l ? r.resolve(t.pos - (s > 0 ? 1 : -1)) : t, d = xn(a.min(c), a.max(c), i), h = c.pos >= t.pos ? d[0].$from : d[d.length - 1].$to, u = c.pos >= t.pos ? d[d.length - 1].$to : d[0].$from;
|
|
8941
|
+
super(h, u, d), this.depth = i;
|
|
8896
8942
|
}
|
|
8897
8943
|
// we can safely ignore this TypeScript error: https://github.com/Microsoft/TypeScript/issues/338
|
|
8898
8944
|
// @ts-ignore
|
|
@@ -8944,7 +8990,7 @@ var Lh = class $r {
|
|
|
8944
8990
|
return new this(t.resolve(n), t.resolve(i), s, r);
|
|
8945
8991
|
}
|
|
8946
8992
|
getBookmark() {
|
|
8947
|
-
return new
|
|
8993
|
+
return new Uh(this.anchor, this.head);
|
|
8948
8994
|
}
|
|
8949
8995
|
};
|
|
8950
8996
|
_t.prototype.visible = !1;
|
|
@@ -8965,8 +9011,8 @@ ke.create({
|
|
|
8965
9011
|
"Shift-ArrowUp": ({ editor: e }) => {
|
|
8966
9012
|
const { depth: t } = this.options, { view: n, state: i } = e, { doc: s, selection: r, tr: o } = i, { anchor: l, head: c } = r;
|
|
8967
9013
|
if (!Le(r)) {
|
|
8968
|
-
const
|
|
8969
|
-
return o.setSelection(
|
|
9014
|
+
const d = _t.create(s, l, c, t, -1);
|
|
9015
|
+
return o.setSelection(d), n.dispatch(o), !0;
|
|
8970
9016
|
}
|
|
8971
9017
|
const a = r.extendBackwards();
|
|
8972
9018
|
return o.setSelection(a), n.dispatch(o), !0;
|
|
@@ -8975,8 +9021,8 @@ ke.create({
|
|
|
8975
9021
|
"Shift-ArrowDown": ({ editor: e }) => {
|
|
8976
9022
|
const { depth: t } = this.options, { view: n, state: i } = e, { doc: s, selection: r, tr: o } = i, { anchor: l, head: c } = r;
|
|
8977
9023
|
if (!Le(r)) {
|
|
8978
|
-
const
|
|
8979
|
-
return o.setSelection(
|
|
9024
|
+
const d = _t.create(s, l, c, t);
|
|
9025
|
+
return o.setSelection(d), n.dispatch(o), !0;
|
|
8980
9026
|
}
|
|
8981
9027
|
const a = r.extendForwards();
|
|
8982
9028
|
return o.setSelection(a), n.dispatch(o), !0;
|
|
@@ -9003,16 +9049,16 @@ ke.create({
|
|
|
9003
9049
|
} : { class: "" },
|
|
9004
9050
|
handleDOMEvents: {
|
|
9005
9051
|
mousedown: (n, i) => {
|
|
9006
|
-
const { key: s } = this.options, r = /Mac/.test(navigator.platform), o = !!i.shiftKey, l = !!i.ctrlKey, c = !!i.altKey, a = !!i.metaKey,
|
|
9007
|
-
return (s == null || s === "Shift" && o || s === "Control" && l || s === "Alt" && c || s === "Meta" && a || s === "Mod" &&
|
|
9052
|
+
const { key: s } = this.options, r = /Mac/.test(navigator.platform), o = !!i.shiftKey, l = !!i.ctrlKey, c = !!i.altKey, a = !!i.metaKey, d = r ? a : l;
|
|
9053
|
+
return (s == null || s === "Shift" && o || s === "Control" && l || s === "Alt" && c || s === "Meta" && a || s === "Mod" && d) && (t = !0), t && document.addEventListener(
|
|
9008
9054
|
"mouseup",
|
|
9009
9055
|
() => {
|
|
9010
9056
|
t = !1;
|
|
9011
|
-
const { state:
|
|
9012
|
-
if (m.sameParent(
|
|
9057
|
+
const { state: h } = n, { doc: u, selection: f, tr: g } = h, { $anchor: m, $head: b } = f;
|
|
9058
|
+
if (m.sameParent(b))
|
|
9013
9059
|
return;
|
|
9014
|
-
const
|
|
9015
|
-
g.setSelection(
|
|
9060
|
+
const w = _t.create(u, m.pos, b.pos, this.options.depth);
|
|
9061
|
+
g.setSelection(w), n.dispatch(g);
|
|
9016
9062
|
},
|
|
9017
9063
|
{ once: !0 }
|
|
9018
9064
|
), !1;
|
|
@@ -9035,66 +9081,66 @@ ke.create({
|
|
|
9035
9081
|
];
|
|
9036
9082
|
}
|
|
9037
9083
|
});
|
|
9038
|
-
function
|
|
9084
|
+
function Lh(e) {
|
|
9039
9085
|
let t = "";
|
|
9040
9086
|
const n = getComputedStyle(e);
|
|
9041
9087
|
for (let i = 0; i < n.length; i += 1)
|
|
9042
9088
|
t += `${n[i]}:${n.getPropertyValue(n[i])};`;
|
|
9043
9089
|
return t;
|
|
9044
9090
|
}
|
|
9045
|
-
function
|
|
9091
|
+
function Ph(e) {
|
|
9046
9092
|
const t = e.cloneNode(!0), n = [e, ...Array.from(e.getElementsByTagName("*"))], i = [t, ...Array.from(t.getElementsByTagName("*"))];
|
|
9047
9093
|
return n.forEach((s, r) => {
|
|
9048
|
-
i[r].style.cssText =
|
|
9094
|
+
i[r].style.cssText = Lh(s);
|
|
9049
9095
|
}), t;
|
|
9050
9096
|
}
|
|
9051
|
-
function
|
|
9097
|
+
function Bh(e, t) {
|
|
9052
9098
|
let n = e;
|
|
9053
9099
|
for (; n != null && n.parentElement && n.parentElement !== t.dom; )
|
|
9054
9100
|
n = n.parentElement;
|
|
9055
9101
|
return (n == null ? void 0 : n.parentElement) === t.dom ? n : void 0;
|
|
9056
9102
|
}
|
|
9057
|
-
function
|
|
9103
|
+
function Vh(e, t, n, i = 5) {
|
|
9058
9104
|
const s = e.dom, r = s.firstElementChild, o = s.lastElementChild;
|
|
9059
9105
|
if (!r || !o)
|
|
9060
9106
|
return { x: t, y: n };
|
|
9061
|
-
const l = r.getBoundingClientRect(), c = o.getBoundingClientRect(), a = Math.min(Math.max(l.top + i, n), c.bottom - i),
|
|
9107
|
+
const l = r.getBoundingClientRect(), c = o.getBoundingClientRect(), a = Math.min(Math.max(l.top + i, n), c.bottom - i), d = 0.5, h = Math.abs(l.left - c.left) < d, u = Math.abs(l.right - c.right) < d;
|
|
9062
9108
|
let f = l;
|
|
9063
|
-
return
|
|
9109
|
+
return h && u && (f = l), { x: Math.min(Math.max(f.left + i, t), f.right - i), y: a };
|
|
9064
9110
|
}
|
|
9065
9111
|
var Fr = (e) => {
|
|
9066
|
-
const { x: t, y: n, editor: i } = e, { view: s, state: r } = i, { x: o, y: l } =
|
|
9112
|
+
const { x: t, y: n, editor: i } = e, { view: s, state: r } = i, { x: o, y: l } = Vh(s, t, n, 5), c = s.root.elementsFromPoint(o, l);
|
|
9067
9113
|
let a;
|
|
9068
9114
|
if (Array.prototype.some.call(c, (u) => {
|
|
9069
9115
|
if (!s.dom.contains(u))
|
|
9070
9116
|
return !1;
|
|
9071
|
-
const f =
|
|
9117
|
+
const f = Bh(u, s);
|
|
9072
9118
|
return f ? (a = f, !0) : !1;
|
|
9073
9119
|
}), !a)
|
|
9074
9120
|
return { resultElement: null, resultNode: null, pos: null };
|
|
9075
|
-
let
|
|
9121
|
+
let d;
|
|
9076
9122
|
try {
|
|
9077
|
-
|
|
9123
|
+
d = s.posAtDOM(a, 0);
|
|
9078
9124
|
} catch {
|
|
9079
9125
|
return { resultElement: null, resultNode: null, pos: null };
|
|
9080
9126
|
}
|
|
9081
|
-
const
|
|
9127
|
+
const h = r.doc.nodeAt(d);
|
|
9082
9128
|
return {
|
|
9083
9129
|
resultElement: a,
|
|
9084
|
-
resultNode:
|
|
9085
|
-
pos:
|
|
9130
|
+
resultNode: h,
|
|
9131
|
+
pos: d
|
|
9086
9132
|
};
|
|
9087
9133
|
};
|
|
9088
9134
|
function Pe(e, t) {
|
|
9089
9135
|
return window.getComputedStyle(e)[t];
|
|
9090
9136
|
}
|
|
9091
|
-
function
|
|
9137
|
+
function Hh(e = 0, t = 0, n = 0) {
|
|
9092
9138
|
return Math.min(Math.max(e, t), n);
|
|
9093
9139
|
}
|
|
9094
|
-
function
|
|
9140
|
+
function $h(e, t, n) {
|
|
9095
9141
|
const i = parseInt(Pe(e.dom, "paddingLeft"), 10), s = parseInt(Pe(e.dom, "paddingRight"), 10), r = parseInt(Pe(e.dom, "borderLeftWidth"), 10), o = parseInt(Pe(e.dom, "borderLeftWidth"), 10), l = e.dom.getBoundingClientRect();
|
|
9096
9142
|
return {
|
|
9097
|
-
left:
|
|
9143
|
+
left: Hh(t, l.left + i + r, l.right - s - o),
|
|
9098
9144
|
top: n
|
|
9099
9145
|
};
|
|
9100
9146
|
}
|
|
@@ -9102,7 +9148,7 @@ function zr(e) {
|
|
|
9102
9148
|
var t;
|
|
9103
9149
|
(t = e.parentNode) == null || t.removeChild(e);
|
|
9104
9150
|
}
|
|
9105
|
-
function
|
|
9151
|
+
function Fh(e, t) {
|
|
9106
9152
|
const { doc: n } = t.view.state, i = Fr({
|
|
9107
9153
|
editor: t,
|
|
9108
9154
|
x: e.clientX,
|
|
@@ -9110,27 +9156,27 @@ function zh(e, t) {
|
|
|
9110
9156
|
});
|
|
9111
9157
|
if (!i.resultNode || i.pos === null)
|
|
9112
9158
|
return [];
|
|
9113
|
-
const s = e.clientX, r =
|
|
9159
|
+
const s = e.clientX, r = $h(t.view, s, e.clientY), o = t.view.posAtCoords(r);
|
|
9114
9160
|
if (!o)
|
|
9115
9161
|
return [];
|
|
9116
9162
|
const { pos: l } = o;
|
|
9117
9163
|
if (!n.resolve(l).parent)
|
|
9118
9164
|
return [];
|
|
9119
|
-
const a = n.resolve(i.pos),
|
|
9120
|
-
return xn(a,
|
|
9165
|
+
const a = n.resolve(i.pos), d = n.resolve(i.pos + 1);
|
|
9166
|
+
return xn(a, d, 0);
|
|
9121
9167
|
}
|
|
9122
|
-
function
|
|
9168
|
+
function zh(e, t) {
|
|
9123
9169
|
const { view: n } = t;
|
|
9124
9170
|
if (!e.dataTransfer)
|
|
9125
9171
|
return;
|
|
9126
|
-
const { empty: i, $from: s, $to: r } = n.state.selection, o =
|
|
9172
|
+
const { empty: i, $from: s, $to: r } = n.state.selection, o = Fh(e, t), l = xn(s, r, 0), c = l.some((b) => o.find((w) => w.$from === b.$from && w.$to === b.$to)), a = i || !c ? o : l;
|
|
9127
9173
|
if (!a.length)
|
|
9128
9174
|
return;
|
|
9129
|
-
const { tr:
|
|
9130
|
-
a.forEach((
|
|
9131
|
-
const
|
|
9132
|
-
|
|
9133
|
-
}),
|
|
9175
|
+
const { tr: d } = n.state, h = document.createElement("div"), u = a[0].$from.pos, f = a[a.length - 1].$to.pos, g = _t.create(n.state.doc, u, f), m = g.content();
|
|
9176
|
+
a.forEach((b) => {
|
|
9177
|
+
const w = n.nodeDOM(b.$from.pos), D = Ph(w);
|
|
9178
|
+
h.append(D);
|
|
9179
|
+
}), h.style.position = "absolute", h.style.top = "-10000px", document.body.append(h), e.dataTransfer.clearData(), e.dataTransfer.setDragImage(h, 0, 0), n.dragging = { slice: m, move: !0 }, d.setSelection(g), n.dispatch(d), document.addEventListener("drop", () => zr(h), { once: !0 });
|
|
9134
9180
|
}
|
|
9135
9181
|
var fs = (e, t) => {
|
|
9136
9182
|
const n = e.resolve(t), { depth: i } = n;
|
|
@@ -9144,10 +9190,10 @@ var fs = (e, t) => {
|
|
|
9144
9190
|
}
|
|
9145
9191
|
return r;
|
|
9146
9192
|
}, Nn = (e, t) => {
|
|
9147
|
-
const n =
|
|
9193
|
+
const n = U.getState(e);
|
|
9148
9194
|
return n ? rn(t, n.type, n.binding.mapping) : null;
|
|
9149
|
-
},
|
|
9150
|
-
const n =
|
|
9195
|
+
}, Wh = (e, t) => {
|
|
9196
|
+
const n = U.getState(e);
|
|
9151
9197
|
return n ? de(n.doc, n.type, t, n.binding.mapping) || 0 : -1;
|
|
9152
9198
|
}, gs = (e, t) => {
|
|
9153
9199
|
let n = t;
|
|
@@ -9165,11 +9211,11 @@ var fs = (e, t) => {
|
|
|
9165
9211
|
onElementDragEnd: l
|
|
9166
9212
|
}) => {
|
|
9167
9213
|
const c = document.createElement("div");
|
|
9168
|
-
let a = !1,
|
|
9214
|
+
let a = !1, d = null, h = -1, u, f = null, g = null;
|
|
9169
9215
|
function m() {
|
|
9170
9216
|
t && (t.style.visibility = "hidden", t.style.pointerEvents = "none");
|
|
9171
9217
|
}
|
|
9172
|
-
function
|
|
9218
|
+
function b() {
|
|
9173
9219
|
if (t) {
|
|
9174
9220
|
if (!n.isEditable) {
|
|
9175
9221
|
m();
|
|
@@ -9178,7 +9224,7 @@ var fs = (e, t) => {
|
|
|
9178
9224
|
t.style.visibility = "", t.style.pointerEvents = "auto";
|
|
9179
9225
|
}
|
|
9180
9226
|
}
|
|
9181
|
-
function
|
|
9227
|
+
function w(v) {
|
|
9182
9228
|
const P = (s == null ? void 0 : s()) || {
|
|
9183
9229
|
getBoundingClientRect: () => v.getBoundingClientRect()
|
|
9184
9230
|
};
|
|
@@ -9190,17 +9236,17 @@ var fs = (e, t) => {
|
|
|
9190
9236
|
});
|
|
9191
9237
|
});
|
|
9192
9238
|
}
|
|
9193
|
-
function
|
|
9194
|
-
o == null || o(v),
|
|
9239
|
+
function D(v) {
|
|
9240
|
+
o == null || o(v), zh(v, n), t && (t.dataset.dragging = "true"), setTimeout(() => {
|
|
9195
9241
|
t && (t.style.pointerEvents = "none");
|
|
9196
9242
|
}, 0);
|
|
9197
9243
|
}
|
|
9198
9244
|
function A(v) {
|
|
9199
9245
|
l == null || l(v), m(), t && (t.style.pointerEvents = "auto", t.dataset.dragging = "false");
|
|
9200
9246
|
}
|
|
9201
|
-
return t.addEventListener("dragstart",
|
|
9247
|
+
return t.addEventListener("dragstart", D), t.addEventListener("dragend", A), c.appendChild(t), {
|
|
9202
9248
|
unbind() {
|
|
9203
|
-
t.removeEventListener("dragstart",
|
|
9249
|
+
t.removeEventListener("dragstart", D), t.removeEventListener("dragend", A), f && (cancelAnimationFrame(f), f = null, g = null);
|
|
9204
9250
|
},
|
|
9205
9251
|
plugin: new Ce({
|
|
9206
9252
|
key: typeof e == "string" ? new te(e) : e,
|
|
@@ -9209,16 +9255,16 @@ var fs = (e, t) => {
|
|
|
9209
9255
|
return { locked: !1 };
|
|
9210
9256
|
},
|
|
9211
9257
|
apply(v, P, E, x) {
|
|
9212
|
-
const k = v.getMeta("lockDragHandle"),
|
|
9213
|
-
if (k !== void 0 && (a = k),
|
|
9214
|
-
return m(), a = !1,
|
|
9215
|
-
if (v.docChanged &&
|
|
9258
|
+
const k = v.getMeta("lockDragHandle"), N = v.getMeta("hideDragHandle");
|
|
9259
|
+
if (k !== void 0 && (a = k), N)
|
|
9260
|
+
return m(), a = !1, d = null, h = -1, r == null || r({ editor: n, node: null, pos: -1 }), P;
|
|
9261
|
+
if (v.docChanged && h !== -1 && t)
|
|
9216
9262
|
if (Br(v)) {
|
|
9217
|
-
const H =
|
|
9218
|
-
H !==
|
|
9263
|
+
const H = Wh(x, u);
|
|
9264
|
+
H !== h && (h = H);
|
|
9219
9265
|
} else {
|
|
9220
|
-
const H = v.mapping.map(
|
|
9221
|
-
H !==
|
|
9266
|
+
const H = v.mapping.map(h);
|
|
9267
|
+
H !== h && (h = H, u = Nn(x, h));
|
|
9222
9268
|
}
|
|
9223
9269
|
return P;
|
|
9224
9270
|
}
|
|
@@ -9233,13 +9279,13 @@ var fs = (e, t) => {
|
|
|
9233
9279
|
m();
|
|
9234
9280
|
return;
|
|
9235
9281
|
}
|
|
9236
|
-
if (a ? t.draggable = !1 : t.draggable = !0, v.state.doc.eq(x.doc) ||
|
|
9282
|
+
if (a ? t.draggable = !1 : t.draggable = !0, v.state.doc.eq(x.doc) || h === -1)
|
|
9237
9283
|
return;
|
|
9238
|
-
let k = v.nodeDOM(
|
|
9284
|
+
let k = v.nodeDOM(h);
|
|
9239
9285
|
if (k = gs(v, k), k === v.dom || (k == null ? void 0 : k.nodeType) !== 1)
|
|
9240
9286
|
return;
|
|
9241
|
-
const
|
|
9242
|
-
|
|
9287
|
+
const N = v.posAtDOM(k, 0), H = ps(n.state.doc, N), et = fs(n.state.doc, N);
|
|
9288
|
+
d = H, h = et, u = Nn(v.state, h), r == null || r({ editor: n, node: d, pos: h }), w(k);
|
|
9243
9289
|
},
|
|
9244
9290
|
// TODO: Kills even on hot reload
|
|
9245
9291
|
destroy() {
|
|
@@ -9250,10 +9296,10 @@ var fs = (e, t) => {
|
|
|
9250
9296
|
props: {
|
|
9251
9297
|
handleDOMEvents: {
|
|
9252
9298
|
keydown(v) {
|
|
9253
|
-
return !t || a || v.hasFocus() && (m(),
|
|
9299
|
+
return !t || a || v.hasFocus() && (m(), d = null, h = -1, r == null || r({ editor: n, node: null, pos: -1 })), !1;
|
|
9254
9300
|
},
|
|
9255
9301
|
mouseleave(v, P) {
|
|
9256
|
-
return a || P.target && !c.contains(P.relatedTarget) && (m(),
|
|
9302
|
+
return a || P.target && !c.contains(P.relatedTarget) && (m(), d = null, h = -1, r == null || r({ editor: n, node: null, pos: -1 })), !1;
|
|
9257
9303
|
},
|
|
9258
9304
|
mousemove(v, P) {
|
|
9259
9305
|
return !t || a || (g = { x: P.clientX, y: P.clientY }, f) || (f = requestAnimationFrame(() => {
|
|
@@ -9268,13 +9314,13 @@ var fs = (e, t) => {
|
|
|
9268
9314
|
});
|
|
9269
9315
|
if (!k.resultElement)
|
|
9270
9316
|
return;
|
|
9271
|
-
let
|
|
9272
|
-
if (
|
|
9317
|
+
let N = k.resultElement;
|
|
9318
|
+
if (N = gs(v, N), N === v.dom || (N == null ? void 0 : N.nodeType) !== 1)
|
|
9273
9319
|
return;
|
|
9274
|
-
const H = v.posAtDOM(
|
|
9275
|
-
if (et !==
|
|
9320
|
+
const H = v.posAtDOM(N, 0), et = ps(n.state.doc, H);
|
|
9321
|
+
if (et !== d) {
|
|
9276
9322
|
const It = fs(n.state.doc, H);
|
|
9277
|
-
|
|
9323
|
+
d = et, h = It, u = Nn(v.state, h), r == null || r({ editor: n, node: d, pos: h }), w(N), b();
|
|
9278
9324
|
}
|
|
9279
9325
|
})), !1;
|
|
9280
9326
|
}
|
|
@@ -9323,7 +9369,7 @@ ke.create({
|
|
|
9323
9369
|
];
|
|
9324
9370
|
}
|
|
9325
9371
|
});
|
|
9326
|
-
var
|
|
9372
|
+
var jh = (e) => {
|
|
9327
9373
|
const {
|
|
9328
9374
|
className: t = "drag-handle",
|
|
9329
9375
|
children: n,
|
|
@@ -9333,12 +9379,12 @@ var Kh = (e) => {
|
|
|
9333
9379
|
onElementDragStart: o,
|
|
9334
9380
|
onElementDragEnd: l,
|
|
9335
9381
|
computePositionConfig: c = Qn
|
|
9336
|
-
} = e, [a,
|
|
9382
|
+
} = e, [a, d] = z(null), h = Lt(null);
|
|
9337
9383
|
return st(() => {
|
|
9338
9384
|
let u = null;
|
|
9339
9385
|
return a ? i.isDestroyed ? () => {
|
|
9340
|
-
|
|
9341
|
-
} : (
|
|
9386
|
+
h.current = null;
|
|
9387
|
+
} : (h.current || (u = jr({
|
|
9342
9388
|
editor: i,
|
|
9343
9389
|
element: a,
|
|
9344
9390
|
pluginKey: s,
|
|
@@ -9349,10 +9395,10 @@ var Kh = (e) => {
|
|
|
9349
9395
|
onElementDragStart: o,
|
|
9350
9396
|
onElementDragEnd: l,
|
|
9351
9397
|
onNodeChange: r
|
|
9352
|
-
}),
|
|
9353
|
-
i.unregisterPlugin(s),
|
|
9398
|
+
}), h.current = u.plugin, i.registerPlugin(h.current)), () => {
|
|
9399
|
+
i.unregisterPlugin(s), h.current = null, u && (u.unbind(), u = null);
|
|
9354
9400
|
}) : () => {
|
|
9355
|
-
|
|
9401
|
+
h.current = null;
|
|
9356
9402
|
};
|
|
9357
9403
|
}, [a, i, r, s, c, o, l]), /* @__PURE__ */ p(
|
|
9358
9404
|
"div",
|
|
@@ -9360,14 +9406,14 @@ var Kh = (e) => {
|
|
|
9360
9406
|
className: t,
|
|
9361
9407
|
style: { visibility: "hidden", position: "absolute" },
|
|
9362
9408
|
"data-dragging": "false",
|
|
9363
|
-
ref:
|
|
9409
|
+
ref: d,
|
|
9364
9410
|
children: n
|
|
9365
9411
|
}
|
|
9366
9412
|
);
|
|
9367
|
-
},
|
|
9368
|
-
function
|
|
9369
|
-
var E, x, k,
|
|
9370
|
-
const e = Y(), t = Z(), { t: n } = X(), [i, s] = z(null), [r, o] = z(-1), [l, c] = z(!1), a = (x = (E = e == null ? void 0 : e.extensionManager) == null ? void 0 : E.extensions) == null ? void 0 : x.some((_) => (_ == null ? void 0 : _.name) === Mo.name),
|
|
9413
|
+
}, Kh = jh;
|
|
9414
|
+
function iu() {
|
|
9415
|
+
var E, x, k, N, H, et, It, Ot;
|
|
9416
|
+
const e = Y(), t = Z(), { t: n } = X(), [i, s] = z(null), [r, o] = z(-1), [l, c] = z(!1), a = (x = (E = e == null ? void 0 : e.extensionManager) == null ? void 0 : E.extensions) == null ? void 0 : x.some((_) => (_ == null ? void 0 : _.name) === Mo.name), d = (N = (k = e == null ? void 0 : e.extensionManager) == null ? void 0 : k.extensions) == null ? void 0 : N.some((_) => (_ == null ? void 0 : _.name) === Po.name), h = (et = (H = e == null ? void 0 : e.extensionManager) == null ? void 0 : H.extensions) == null ? void 0 : et.some((_) => (_ == null ? void 0 : _.name) === Lo.name);
|
|
9371
9417
|
function u() {
|
|
9372
9418
|
const _ = e.chain();
|
|
9373
9419
|
_.setNodeSelection(r).unsetAllMarks(), (i == null ? void 0 : i.type.name) !== "paragraph" && _.setParagraph(), _.run();
|
|
@@ -9383,15 +9429,15 @@ function su() {
|
|
|
9383
9429
|
function m(_) {
|
|
9384
9430
|
e.commands.setTextAlign(_);
|
|
9385
9431
|
}
|
|
9386
|
-
function
|
|
9432
|
+
function b() {
|
|
9387
9433
|
const _ = Mi(e.state.tr, r, 1);
|
|
9388
9434
|
_.setMeta("hideDragHandle", !0), e.view.dispatch && e.view.dispatch(_);
|
|
9389
9435
|
}
|
|
9390
|
-
function
|
|
9436
|
+
function w() {
|
|
9391
9437
|
const _ = Mi(e.state.tr, r, -1);
|
|
9392
9438
|
e.view.dispatch && e.view.dispatch(_);
|
|
9393
9439
|
}
|
|
9394
|
-
function
|
|
9440
|
+
function D() {
|
|
9395
9441
|
e.chain().setMeta("hideDragHandle", !0).setNodeSelection(r).deleteSelection().run();
|
|
9396
9442
|
}
|
|
9397
9443
|
function A({ node: _, pos: ft }) {
|
|
@@ -9413,9 +9459,9 @@ function su() {
|
|
|
9413
9459
|
const P = (_) => {
|
|
9414
9460
|
t && c(_);
|
|
9415
9461
|
};
|
|
9416
|
-
return /* @__PURE__ */ S(
|
|
9462
|
+
return /* @__PURE__ */ S(M, { children: [
|
|
9417
9463
|
/* @__PURE__ */ p(
|
|
9418
|
-
|
|
9464
|
+
Kh,
|
|
9419
9465
|
{
|
|
9420
9466
|
editor: e,
|
|
9421
9467
|
onNodeChange: A,
|
|
@@ -9463,14 +9509,14 @@ function su() {
|
|
|
9463
9509
|
mt,
|
|
9464
9510
|
{
|
|
9465
9511
|
className: "richtext-flex richtext-gap-3 richtext-bg-opacity-10 hover:richtext-bg-red-400 hover:richtext-bg-opacity-20 focus:richtext-bg-red-400 focus:richtext-bg-opacity-30 focus:richtext-text-red-500 dark:hover:richtext-bg-opacity-20 dark:hover:richtext-text-red-500",
|
|
9466
|
-
onClick:
|
|
9512
|
+
onClick: D,
|
|
9467
9513
|
children: [
|
|
9468
9514
|
/* @__PURE__ */ p(rt, { name: "Trash2" }),
|
|
9469
9515
|
/* @__PURE__ */ p("span", { children: n("editor.remove") })
|
|
9470
9516
|
]
|
|
9471
9517
|
}
|
|
9472
9518
|
),
|
|
9473
|
-
|
|
9519
|
+
h ? /* @__PURE__ */ S(
|
|
9474
9520
|
mt,
|
|
9475
9521
|
{
|
|
9476
9522
|
className: "richtext-flex richtext-gap-3",
|
|
@@ -9503,7 +9549,7 @@ function su() {
|
|
|
9503
9549
|
]
|
|
9504
9550
|
}
|
|
9505
9551
|
),
|
|
9506
|
-
a ||
|
|
9552
|
+
a || d ? /* @__PURE__ */ p($o, {}) : null,
|
|
9507
9553
|
a ? /* @__PURE__ */ S(Ri, { children: [
|
|
9508
9554
|
/* @__PURE__ */ S(Ni, { className: "richtext-flex richtext-gap-3", children: [
|
|
9509
9555
|
/* @__PURE__ */ p(rt, { name: "AlignCenter" }),
|
|
@@ -9545,7 +9591,7 @@ function su() {
|
|
|
9545
9591
|
)
|
|
9546
9592
|
] }) })
|
|
9547
9593
|
] }) : null,
|
|
9548
|
-
|
|
9594
|
+
d ? /* @__PURE__ */ S(Ri, { children: [
|
|
9549
9595
|
/* @__PURE__ */ S(Ni, { className: "richtext-flex richtext-gap-3", children: [
|
|
9550
9596
|
/* @__PURE__ */ p(rt, { name: "IndentIncrease" }),
|
|
9551
9597
|
/* @__PURE__ */ p("span", { children: n("editor.indent") })
|
|
@@ -9556,7 +9602,7 @@ function su() {
|
|
|
9556
9602
|
{
|
|
9557
9603
|
className: "richtext-flex richtext-gap-3",
|
|
9558
9604
|
disabled: ((It = i == null ? void 0 : i.attrs) == null ? void 0 : It.indent) >= Oi.max,
|
|
9559
|
-
onClick:
|
|
9605
|
+
onClick: b,
|
|
9560
9606
|
children: [
|
|
9561
9607
|
/* @__PURE__ */ p(rt, { name: "IndentIncrease" }),
|
|
9562
9608
|
/* @__PURE__ */ p("span", { children: n("editor.indent.tooltip") })
|
|
@@ -9568,7 +9614,7 @@ function su() {
|
|
|
9568
9614
|
{
|
|
9569
9615
|
className: "richtext-flex richtext-gap-3",
|
|
9570
9616
|
disabled: ((Ot = i == null ? void 0 : i.attrs) == null ? void 0 : Ot.indent) <= Oi.min,
|
|
9571
|
-
onClick:
|
|
9617
|
+
onClick: w,
|
|
9572
9618
|
children: [
|
|
9573
9619
|
/* @__PURE__ */ p(rt, { name: "IndentDecrease" }),
|
|
9574
9620
|
/* @__PURE__ */ p("span", { children: n("editor.outdent.tooltip") })
|
|
@@ -9586,18 +9632,18 @@ function su() {
|
|
|
9586
9632
|
] });
|
|
9587
9633
|
}
|
|
9588
9634
|
export {
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9635
|
+
zd as RichTextBubbleColumns,
|
|
9636
|
+
Wd as RichTextBubbleDrawer,
|
|
9637
|
+
jd as RichTextBubbleExcalidraw,
|
|
9638
|
+
Kd as RichTextBubbleIframe,
|
|
9639
|
+
Jd as RichTextBubbleImage,
|
|
9640
|
+
qd as RichTextBubbleImageGif,
|
|
9641
|
+
Yd as RichTextBubbleKatex,
|
|
9642
|
+
Gd as RichTextBubbleLink,
|
|
9643
|
+
iu as RichTextBubbleMenuDragHandle,
|
|
9644
|
+
Zd as RichTextBubbleMermaid,
|
|
9645
|
+
Qd as RichTextBubbleTable,
|
|
9646
|
+
tu as RichTextBubbleText,
|
|
9647
|
+
eu as RichTextBubbleTwitter,
|
|
9648
|
+
Xd as RichTextBubbleVideo
|
|
9603
9649
|
};
|