@hiai-gg/docsmint 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/index.js +1 -1
- package/dist/frontend/CategoryDialog--rIE7FrH.js +580 -0
- package/dist/frontend/ConfirmDialog-Cpzyb55f.js +212 -0
- package/dist/frontend/CreateSnapshotDialog-CmkV-n2A.js +216 -0
- package/dist/frontend/DatePicker-Byynca7V.js +257 -0
- package/dist/frontend/DeleteDialog-ap6nOywZ.js +174 -0
- package/dist/frontend/FolderDialog-DmN_trV0.js +247 -0
- package/dist/frontend/FolderNode-C4B8a2fd.js +317 -0
- package/dist/frontend/FolderTreeSelector-D6ijiZTA.js +100 -0
- package/dist/frontend/Icon-DtNo0N1U.js +64 -0
- package/dist/frontend/SettingsDialog-2kTaTXAs.js +992 -0
- package/dist/frontend/ShareDialog-BBDGNF5n.js +165 -0
- package/dist/frontend/TagCreateDialog-DiLZnJo4.js +258 -0
- package/dist/frontend/api/attachments.d.ts +6 -0
- package/dist/frontend/api/attachments.js +2 -0
- package/dist/frontend/api/categories.js +1 -1
- package/dist/frontend/api/documents.js +1 -1
- package/dist/frontend/api/folders.js +1 -1
- package/dist/frontend/api/settings.js +1 -1
- package/dist/frontend/api/share.d.ts +5 -0
- package/dist/frontend/api/share.js +2 -0
- package/dist/frontend/api/tags.js +1 -1
- package/dist/frontend/api-keys-CpkrA8rD.js +35 -0
- package/dist/frontend/attachments-BuILSs56.js +50 -0
- package/dist/frontend/{settings-PCrOtied.js → auth-client-Cygmp1I2.js} +205 -265
- package/dist/frontend/awareness-snQ3RD9f.js +3714 -0
- package/dist/frontend/bundle-mjs-CP6Owz-8.js +1723 -0
- package/dist/frontend/camera-B7dAOd4s.js +28 -0
- package/dist/frontend/{categories-BE6ZpZl8.js → categories-izQovv2w.js} +1 -1
- package/dist/frontend/check-CDwRlG9T.js +24 -0
- package/dist/frontend/chevron-down-B7ZrjUmT.js +24 -0
- package/dist/frontend/circle-check-CDqeMB2d.js +28 -0
- package/dist/frontend/{client-C6QQGb0e.js → client-Bc5Fzx40.js} +833 -814
- package/dist/frontend/{client-B9hzI0W8.js → client-GbtOH90i.js} +1 -1
- package/dist/frontend/clipboard-Cgzxc0_R.js +16 -0
- package/dist/frontend/clock-Ck5Sn-Zl.js +28 -0
- package/dist/frontend/clsx-nmtDPO_P.js +16 -0
- package/dist/frontend/collaboration.d.ts +6 -0
- package/dist/frontend/collaboration.js +182 -0
- package/dist/frontend/components/category-dialog.d.ts +2 -0
- package/dist/frontend/components/category-dialog.js +2 -0
- package/dist/frontend/components/create-snapshot-dialog.d.ts +2 -0
- package/dist/frontend/components/create-snapshot-dialog.js +2 -0
- package/dist/frontend/components/delete-dialog.d.ts +2 -0
- package/dist/frontend/components/delete-dialog.js +2 -0
- package/dist/frontend/components/editor/document-editor.d.ts +3 -0
- package/dist/frontend/components/editor/document-editor.js +3021 -0
- package/dist/frontend/components/editor/document-title.d.ts +2 -0
- package/dist/frontend/components/editor/document-title.js +31 -0
- package/dist/frontend/components/editor/docx-serializer.d.ts +2 -0
- package/dist/frontend/components/editor/docx-serializer.js +14600 -0
- package/dist/frontend/components/editor/extensions.d.ts +2 -0
- package/dist/frontend/components/editor/extensions.js +2 -0
- package/dist/frontend/components/editor/markdown-toggle.d.ts +2 -0
- package/dist/frontend/components/editor/markdown-toggle.js +72 -0
- package/dist/frontend/components/editor/markdown.d.ts +1 -0
- package/dist/frontend/components/editor/markdown.js +2 -0
- package/dist/frontend/components/folder-node.d.ts +3 -0
- package/dist/frontend/components/folder-node.js +2 -0
- package/dist/frontend/components/folder-tree-selector.d.ts +2 -0
- package/dist/frontend/components/folder-tree-selector.js +2 -0
- package/dist/frontend/components/save-as-dialog.d.ts +2 -0
- package/dist/frontend/components/save-as-dialog.js +254 -0
- package/dist/frontend/components/settings.js +1 -1
- package/dist/frontend/components/share-dialog.d.ts +2 -0
- package/dist/frontend/components/share-dialog.js +2 -0
- package/dist/frontend/components/sidebar.js +1206 -3762
- package/dist/frontend/components/tag-create-dialog.d.ts +2 -0
- package/dist/frontend/components/tag-create-dialog.js +2 -0
- package/dist/frontend/components/version-history.d.ts +2 -0
- package/dist/frontend/components/version-history.js +293 -0
- package/dist/frontend/{context-DbnW5yib.js → context-BMD6XTPe.js} +0 -3
- package/dist/frontend/copy-CMAA6GP0.js +31 -0
- package/dist/frontend/dashboard.js +1148 -1224
- package/dist/frontend/{SettingsDialog-D4pgFD0D.js → db-ByrlYfaI.js} +923 -2002
- package/dist/frontend/dialog-BDkiG42a.js +213 -0
- package/dist/frontend/disclose-version-5I57E3LD.js +3 -0
- package/dist/frontend/dndzone-BzsOINtP.js +1199 -0
- package/dist/frontend/doc-tabs.d.ts +7 -0
- package/dist/frontend/doc-tabs.js +14 -0
- package/dist/frontend/document-drop-coordinator-C4xHMjwC.js +68 -0
- package/dist/frontend/document-drop-coordinator.d.ts +2 -0
- package/dist/frontend/document-drop-coordinator.js +2 -0
- package/dist/frontend/{documents-DFVS9SsL.js → documents-BsDkvzCm.js} +1 -1
- package/dist/frontend/editorExtensions-BMHvUbdk.js +27021 -0
- package/dist/frontend/ellipsis-vertical-BBuPldbW.js +519 -0
- package/dist/frontend/extension.js +6 -5
- package/dist/frontend/floating-layer-anchor-C51M4l6v.js +4513 -0
- package/dist/frontend/folder-TQjKY4yn.js +44 -0
- package/dist/frontend/folder-refresh.d.ts +8 -0
- package/dist/frontend/folder-refresh.js +2 -0
- package/dist/frontend/{folders-CGe9diAG.js → folders-CTuV_JtU.js} +1 -1
- package/dist/frontend/frontend.css +1 -1
- package/dist/frontend/i18n.js +1 -1
- package/dist/frontend/identity-DyWeNzu_.js +69 -0
- package/dist/frontend/index-client-jobkrWVL.js +86 -0
- package/dist/frontend/input-CBI6p4Xl.js +23 -0
- package/dist/frontend/keyboard.d.ts +14 -0
- package/dist/frontend/keyboard.js +2 -0
- package/dist/frontend/keyboard.svelte-D7H8DihC.js +133 -0
- package/dist/frontend/label-C-GkhEp4.js +30 -0
- package/dist/frontend/loader-circle-Bk-WFz9g.js +267 -0
- package/dist/frontend/markdown-BwnyjITU.js +11 -0
- package/dist/frontend/messages-BpYaLbzE.js +1091 -0
- package/dist/frontend/offline/identity.d.ts +6 -0
- package/dist/frontend/offline/identity.js +2 -0
- package/dist/frontend/resolve-BG4HgzpN.js +19 -0
- package/dist/frontend/rolldown-runtime-CWhphoD1.js +23 -0
- package/dist/frontend/rotate-ccw-CleZtJ5D.js +24 -0
- package/dist/frontend/search.js +637 -628
- package/dist/frontend/select-value-CvrWRkXW.js +1436 -0
- package/dist/frontend/settings-blyobazp.js +62 -0
- package/dist/frontend/share-Cu7SSJuJ.js +28 -0
- package/dist/frontend/shared-document.js +41 -40
- package/dist/frontend/subfolders-refresh-store.svelte-BsheoQma.js +65 -0
- package/dist/frontend/{tag-C5xrg-bb.js → tag-Dx3SmucJ.js} +7 -7
- package/dist/frontend/tag-store.svelte-CIaF4sdZ.js +29 -0
- package/dist/frontend/{tags-DVXTut0p.js → tags-CtCV0Djo.js} +1 -1
- package/dist/frontend/textarea-Dfp78XlL.js +23 -0
- package/dist/frontend/theme.js +1 -1
- package/dist/frontend/{theme.svelte-ei0QxXa8.js → theme.svelte-CROg1Hi5.js} +7 -7
- package/dist/frontend/types.d.ts +6 -0
- package/dist/frontend/types.js +0 -0
- package/dist/frontend/utils/clipboard.d.ts +1 -0
- package/dist/frontend/utils/clipboard.js +2 -0
- package/dist/frontend/utils/dndzone.d.ts +4 -0
- package/dist/frontend/utils/dndzone.js +2 -0
- package/dist/frontend/utils-C0OW2678.js +20 -0
- package/dist/frontend/utils-D8kmM3ub.js +8 -0
- package/dist/frontend/utils.d.ts +4 -0
- package/dist/frontend/utils.js +2 -0
- package/dist/frontend/x-DaTdeDXv.js +24 -0
- package/package.json +109 -1
- package/packages/cli/src/index.ts +1 -1
- package/packages/mcp-server/src/index.ts +1 -1
- package/dist/frontend/DatePicker-BcMD49PV.js +0 -275
- package/dist/frontend/ShareDialog-Dzh7rV7J.js +0 -1317
- package/dist/frontend/input-ieWIt8I7.js +0 -257
- package/dist/frontend/messages-CTGAsqFu.js +0 -1106
- package/dist/frontend/resolve-Bl6xmJl_.js +0 -2068
- package/dist/frontend/tag-store.svelte-B3839FYq.js +0 -6152
|
@@ -0,0 +1,3714 @@
|
|
|
1
|
+
//#region ../node_modules/.bun/lib0@0.2.117/node_modules/lib0/map.js
|
|
2
|
+
var e = () => /* @__PURE__ */ new Map(), t = (t) => {
|
|
3
|
+
let n = e();
|
|
4
|
+
return t.forEach((e, t) => {
|
|
5
|
+
n.set(t, e);
|
|
6
|
+
}), n;
|
|
7
|
+
}, n = (e, t, n) => {
|
|
8
|
+
let r = e.get(t);
|
|
9
|
+
return r === void 0 && e.set(t, r = n()), r;
|
|
10
|
+
}, r = (e, t) => {
|
|
11
|
+
let n = [];
|
|
12
|
+
for (let [r, i] of e) n.push(t(i, r));
|
|
13
|
+
return n;
|
|
14
|
+
}, i = (e, t) => {
|
|
15
|
+
for (let [n, r] of e) if (t(r, n)) return !0;
|
|
16
|
+
return !1;
|
|
17
|
+
}, a = () => /* @__PURE__ */ new Set(), o = (e) => e[e.length - 1], s = (e, t) => {
|
|
18
|
+
for (let n = 0; n < t.length; n++) e.push(t[n]);
|
|
19
|
+
}, c = Array.from, l = (e, t) => {
|
|
20
|
+
for (let n = 0; n < e.length; n++) if (!t(e[n], n, e)) return !1;
|
|
21
|
+
return !0;
|
|
22
|
+
}, u = (e, t) => {
|
|
23
|
+
for (let n = 0; n < e.length; n++) if (t(e[n], n, e)) return !0;
|
|
24
|
+
return !1;
|
|
25
|
+
}, d = (e, t) => {
|
|
26
|
+
let n = Array(e);
|
|
27
|
+
for (let r = 0; r < e; r++) n[r] = t(r, n);
|
|
28
|
+
return n;
|
|
29
|
+
}, f = Array.isArray, p = class {
|
|
30
|
+
constructor() {
|
|
31
|
+
this._observers = e();
|
|
32
|
+
}
|
|
33
|
+
on(e, t) {
|
|
34
|
+
return n(this._observers, e, a).add(t), t;
|
|
35
|
+
}
|
|
36
|
+
once(e, t) {
|
|
37
|
+
let n = (...r) => {
|
|
38
|
+
this.off(e, n), t(...r);
|
|
39
|
+
};
|
|
40
|
+
this.on(e, n);
|
|
41
|
+
}
|
|
42
|
+
off(e, t) {
|
|
43
|
+
let n = this._observers.get(e);
|
|
44
|
+
n !== void 0 && (n.delete(t), n.size === 0 && this._observers.delete(e));
|
|
45
|
+
}
|
|
46
|
+
emit(t, n) {
|
|
47
|
+
return c((this._observers.get(t) || e()).values()).forEach((e) => e(...n));
|
|
48
|
+
}
|
|
49
|
+
destroy() {
|
|
50
|
+
this._observers = e();
|
|
51
|
+
}
|
|
52
|
+
}, ee = class {
|
|
53
|
+
constructor() {
|
|
54
|
+
this._observers = e();
|
|
55
|
+
}
|
|
56
|
+
on(e, t) {
|
|
57
|
+
n(this._observers, e, a).add(t);
|
|
58
|
+
}
|
|
59
|
+
once(e, t) {
|
|
60
|
+
let n = (...r) => {
|
|
61
|
+
this.off(e, n), t(...r);
|
|
62
|
+
};
|
|
63
|
+
this.on(e, n);
|
|
64
|
+
}
|
|
65
|
+
off(e, t) {
|
|
66
|
+
let n = this._observers.get(e);
|
|
67
|
+
n !== void 0 && (n.delete(t), n.size === 0 && this._observers.delete(e));
|
|
68
|
+
}
|
|
69
|
+
emit(t, n) {
|
|
70
|
+
return c((this._observers.get(t) || e()).values()).forEach((e) => e(...n));
|
|
71
|
+
}
|
|
72
|
+
destroy() {
|
|
73
|
+
this._observers = e();
|
|
74
|
+
}
|
|
75
|
+
}, m = Math.floor, te = Math.abs, ne = (e, t) => e < t ? e : t, h = (e, t) => e > t ? e : t;
|
|
76
|
+
Number.isNaN;
|
|
77
|
+
var re = Math.pow, ie = (e) => e === 0 ? 1 / e < 0 : e < 0, ae = 1 << 17, oe = 1 << 18, se = 1 << 19, ce = 1 << 20, le = 1 << 21, ue = 1 << 22, de = 1 << 23, fe = 1 << 24, pe = 1 << 25, me = 1 << 26, he = 1 << 27, ge = 1 << 28, _e = 1 << 29;
|
|
78
|
+
ae - 1, oe - 1, se - 1, ce - 1, le - 1, ue - 1, de - 1, fe - 1, pe - 1, me - 1, he - 1, ge - 1, _e - 1;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region ../node_modules/.bun/lib0@0.2.117/node_modules/lib0/number.js
|
|
81
|
+
var ve = 2 ** 53 - 1, ye = -(2 ** 53 - 1), be = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && m(e) === e);
|
|
82
|
+
Number.isNaN, Number.parseInt;
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region ../node_modules/.bun/lib0@0.2.117/node_modules/lib0/string.js
|
|
85
|
+
var xe = String.fromCharCode;
|
|
86
|
+
String.fromCodePoint, xe(65535);
|
|
87
|
+
var Se = (e) => e.toLowerCase(), Ce = /^\s*/g, we = (e) => e.replace(Ce, ""), Te = /([A-Z])/g, Ee = (e, t) => we(e.replace(Te, (e) => `${t}${Se(e)}`)), De = (e) => {
|
|
88
|
+
let t = unescape(encodeURIComponent(e)), n = t.length, r = new Uint8Array(n);
|
|
89
|
+
for (let e = 0; e < n; e++) r[e] = t.codePointAt(e);
|
|
90
|
+
return r;
|
|
91
|
+
}, Oe = typeof TextEncoder < "u" ? new TextEncoder() : null, ke = Oe ? (e) => Oe.encode(e) : De, Ae = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", {
|
|
92
|
+
fatal: !0,
|
|
93
|
+
ignoreBOM: !0
|
|
94
|
+
});
|
|
95
|
+
/* c8 ignore start */
|
|
96
|
+
Ae && Ae.decode(/* @__PURE__ */ new Uint8Array()).length === 1 && (Ae = null);
|
|
97
|
+
var je = (e, t) => d(t, () => e).join(""), Me = class {
|
|
98
|
+
constructor() {
|
|
99
|
+
this.cpos = 0, this.cbuf = /* @__PURE__ */ new Uint8Array(100), this.bufs = [];
|
|
100
|
+
}
|
|
101
|
+
}, g = () => new Me(), Ne = (e) => {
|
|
102
|
+
let t = g();
|
|
103
|
+
return e(t), _(t);
|
|
104
|
+
}, Pe = (e) => {
|
|
105
|
+
let t = e.cpos;
|
|
106
|
+
for (let n = 0; n < e.bufs.length; n++) t += e.bufs[n].length;
|
|
107
|
+
return t;
|
|
108
|
+
}, _ = (e) => {
|
|
109
|
+
let t = new Uint8Array(Pe(e)), n = 0;
|
|
110
|
+
for (let r = 0; r < e.bufs.length; r++) {
|
|
111
|
+
let i = e.bufs[r];
|
|
112
|
+
t.set(i, n), n += i.length;
|
|
113
|
+
}
|
|
114
|
+
return t.set(new Uint8Array(e.cbuf.buffer, 0, e.cpos), n), t;
|
|
115
|
+
}, Fe = (e, t) => {
|
|
116
|
+
let n = e.cbuf.length;
|
|
117
|
+
n - e.cpos < t && (e.bufs.push(new Uint8Array(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(h(n, t) * 2), e.cpos = 0);
|
|
118
|
+
}, v = (e, t) => {
|
|
119
|
+
let n = e.cbuf.length;
|
|
120
|
+
e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
|
|
121
|
+
}, Ie = v, y = (e, t) => {
|
|
122
|
+
for (; t > 127;) v(e, 128 | 127 & t), t = m(t / 128);
|
|
123
|
+
v(e, 127 & t);
|
|
124
|
+
}, Le = (e, t) => {
|
|
125
|
+
let n = ie(t);
|
|
126
|
+
for (n && (t = -t), v(e, (t > 63 ? 128 : 0) | (n ? 64 : 0) | 63 & t), t = m(t / 64); t > 0;) v(e, (t > 127 ? 128 : 0) | 127 & t), t = m(t / 128);
|
|
127
|
+
}, Re = /* @__PURE__ */ new Uint8Array(3e4), ze = Re.length / 3, b = Oe && Oe.encodeInto ? (e, t) => {
|
|
128
|
+
if (t.length < ze) {
|
|
129
|
+
/* c8 ignore next */
|
|
130
|
+
let n = Oe.encodeInto(t, Re).written || 0;
|
|
131
|
+
y(e, n);
|
|
132
|
+
for (let t = 0; t < n; t++) v(e, Re[t]);
|
|
133
|
+
} else x(e, ke(t));
|
|
134
|
+
} : (e, t) => {
|
|
135
|
+
let n = unescape(encodeURIComponent(t)), r = n.length;
|
|
136
|
+
y(e, r);
|
|
137
|
+
for (let t = 0; t < r; t++) v(e, n.codePointAt(t));
|
|
138
|
+
}, Be = (e, t) => {
|
|
139
|
+
let n = e.cbuf.length, r = e.cpos, i = ne(n - r, t.length), a = t.length - i;
|
|
140
|
+
e.cbuf.set(t.subarray(0, i), r), e.cpos += i, a > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(h(n * 2, a)), e.cbuf.set(t.subarray(i)), e.cpos = a);
|
|
141
|
+
}, x = (e, t) => {
|
|
142
|
+
y(e, t.byteLength), Be(e, t);
|
|
143
|
+
}, Ve = (e, t) => {
|
|
144
|
+
Fe(e, t);
|
|
145
|
+
let n = new DataView(e.cbuf.buffer, e.cpos, t);
|
|
146
|
+
return e.cpos += t, n;
|
|
147
|
+
}, He = (e, t) => Ve(e, 4).setFloat32(0, t, !1), Ue = (e, t) => Ve(e, 8).setFloat64(0, t, !1), We = (e, t) => Ve(e, 8).setBigInt64(0, t, !1), Ge = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4)), Ke = (e) => (Ge.setFloat32(0, e), Ge.getFloat32(0) === e), qe = (e, t) => {
|
|
148
|
+
switch (typeof t) {
|
|
149
|
+
case "string":
|
|
150
|
+
v(e, 119), b(e, t);
|
|
151
|
+
break;
|
|
152
|
+
case "number":
|
|
153
|
+
be(t) && te(t) <= 2147483647 ? (v(e, 125), Le(e, t)) : Ke(t) ? (v(e, 124), He(e, t)) : (v(e, 123), Ue(e, t));
|
|
154
|
+
break;
|
|
155
|
+
case "bigint":
|
|
156
|
+
v(e, 122), We(e, t);
|
|
157
|
+
break;
|
|
158
|
+
case "object":
|
|
159
|
+
if (t === null) v(e, 126);
|
|
160
|
+
else if (f(t)) {
|
|
161
|
+
v(e, 117), y(e, t.length);
|
|
162
|
+
for (let n = 0; n < t.length; n++) qe(e, t[n]);
|
|
163
|
+
} else if (t instanceof Uint8Array) v(e, 116), x(e, t);
|
|
164
|
+
else {
|
|
165
|
+
v(e, 118);
|
|
166
|
+
let n = Object.keys(t);
|
|
167
|
+
y(e, n.length);
|
|
168
|
+
for (let r = 0; r < n.length; r++) {
|
|
169
|
+
let i = n[r];
|
|
170
|
+
b(e, i), qe(e, t[i]);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
case "boolean":
|
|
175
|
+
v(e, t ? 120 : 121);
|
|
176
|
+
break;
|
|
177
|
+
default: v(e, 127);
|
|
178
|
+
}
|
|
179
|
+
}, Je = class extends Me {
|
|
180
|
+
constructor(e) {
|
|
181
|
+
super(), this.w = e, this.s = null, this.count = 0;
|
|
182
|
+
}
|
|
183
|
+
write(e) {
|
|
184
|
+
this.s === e ? this.count++ : (this.count > 0 && y(this, this.count - 1), this.count = 1, this.w(this, e), this.s = e);
|
|
185
|
+
}
|
|
186
|
+
}, Ye = (e) => {
|
|
187
|
+
e.count > 0 && (Le(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && y(e.encoder, e.count - 2));
|
|
188
|
+
}, Xe = class {
|
|
189
|
+
constructor() {
|
|
190
|
+
this.encoder = new Me(), this.s = 0, this.count = 0;
|
|
191
|
+
}
|
|
192
|
+
write(e) {
|
|
193
|
+
this.s === e ? this.count++ : (Ye(this), this.count = 1, this.s = e);
|
|
194
|
+
}
|
|
195
|
+
toUint8Array() {
|
|
196
|
+
return Ye(this), _(this.encoder);
|
|
197
|
+
}
|
|
198
|
+
}, Ze = (e) => {
|
|
199
|
+
if (e.count > 0) {
|
|
200
|
+
let t = e.diff * 2 + (e.count === 1 ? 0 : 1);
|
|
201
|
+
Le(e.encoder, t), e.count > 1 && y(e.encoder, e.count - 2);
|
|
202
|
+
}
|
|
203
|
+
}, Qe = class {
|
|
204
|
+
constructor() {
|
|
205
|
+
this.encoder = new Me(), this.s = 0, this.count = 0, this.diff = 0;
|
|
206
|
+
}
|
|
207
|
+
write(e) {
|
|
208
|
+
this.diff === e - this.s ? (this.s = e, this.count++) : (Ze(this), this.count = 1, this.diff = e - this.s, this.s = e);
|
|
209
|
+
}
|
|
210
|
+
toUint8Array() {
|
|
211
|
+
return Ze(this), _(this.encoder);
|
|
212
|
+
}
|
|
213
|
+
}, $e = class {
|
|
214
|
+
constructor() {
|
|
215
|
+
this.sarr = [], this.s = "", this.lensE = new Xe();
|
|
216
|
+
}
|
|
217
|
+
write(e) {
|
|
218
|
+
this.s += e, this.s.length > 19 && (this.sarr.push(this.s), this.s = ""), this.lensE.write(e.length);
|
|
219
|
+
}
|
|
220
|
+
toUint8Array() {
|
|
221
|
+
let e = new Me();
|
|
222
|
+
return this.sarr.push(this.s), this.s = "", b(e, this.sarr.join("")), Be(e, this.lensE.toUint8Array()), _(e);
|
|
223
|
+
}
|
|
224
|
+
}, S = (e) => Error(e), C = () => {
|
|
225
|
+
throw S("Method unimplemented");
|
|
226
|
+
}, w = () => {
|
|
227
|
+
throw S("Unexpected case");
|
|
228
|
+
}, et = S("Unexpected end of array"), tt = S("Integer out of Range"), nt = class {
|
|
229
|
+
constructor(e) {
|
|
230
|
+
this.arr = e, this.pos = 0;
|
|
231
|
+
}
|
|
232
|
+
}, T = (e) => new nt(e), rt = (e) => e.pos !== e.arr.length, it = (e, t) => {
|
|
233
|
+
let n = new Uint8Array(e.arr.buffer, e.pos + e.arr.byteOffset, t);
|
|
234
|
+
return e.pos += t, n;
|
|
235
|
+
}, E = (e) => it(e, D(e)), at = (e) => e.arr[e.pos++], D = (e) => {
|
|
236
|
+
let t = 0, n = 1, r = e.arr.length;
|
|
237
|
+
for (; e.pos < r;) {
|
|
238
|
+
let r = e.arr[e.pos++];
|
|
239
|
+
if (t += (r & 127) * n, n *= 128, r < 128) return t;
|
|
240
|
+
/* c8 ignore start */
|
|
241
|
+
if (t > ve) throw tt;
|
|
242
|
+
}
|
|
243
|
+
throw et;
|
|
244
|
+
}, ot = (e) => {
|
|
245
|
+
let t = e.arr[e.pos++], n = t & 63, r = 64, i = (t & 64) > 0 ? -1 : 1;
|
|
246
|
+
if (!(t & 128)) return i * n;
|
|
247
|
+
let a = e.arr.length;
|
|
248
|
+
for (; e.pos < a;) {
|
|
249
|
+
if (t = e.arr[e.pos++], n += (t & 127) * r, r *= 128, t < 128) return i * n;
|
|
250
|
+
/* c8 ignore start */
|
|
251
|
+
if (n > ve) throw tt;
|
|
252
|
+
}
|
|
253
|
+
throw et;
|
|
254
|
+
}, O = Ae ? (e) => Ae.decode(E(e)) : (e) => {
|
|
255
|
+
let t = D(e);
|
|
256
|
+
if (t === 0) return "";
|
|
257
|
+
{
|
|
258
|
+
let n = String.fromCodePoint(at(e));
|
|
259
|
+
if (--t < 100) for (; t--;) n += String.fromCodePoint(at(e));
|
|
260
|
+
else for (; t > 0;) {
|
|
261
|
+
let r = t < 1e4 ? t : 1e4, i = e.arr.subarray(e.pos, e.pos + r);
|
|
262
|
+
e.pos += r, n += String.fromCodePoint.apply(null, i), t -= r;
|
|
263
|
+
}
|
|
264
|
+
return decodeURIComponent(escape(n));
|
|
265
|
+
}
|
|
266
|
+
}, st = (e, t) => {
|
|
267
|
+
let n = new DataView(e.arr.buffer, e.arr.byteOffset + e.pos, t);
|
|
268
|
+
return e.pos += t, n;
|
|
269
|
+
}, ct = [
|
|
270
|
+
(e) => void 0,
|
|
271
|
+
(e) => null,
|
|
272
|
+
ot,
|
|
273
|
+
(e) => st(e, 4).getFloat32(0, !1),
|
|
274
|
+
(e) => st(e, 8).getFloat64(0, !1),
|
|
275
|
+
(e) => st(e, 8).getBigInt64(0, !1),
|
|
276
|
+
(e) => !1,
|
|
277
|
+
(e) => !0,
|
|
278
|
+
O,
|
|
279
|
+
(e) => {
|
|
280
|
+
let t = D(e), n = {};
|
|
281
|
+
for (let r = 0; r < t; r++) {
|
|
282
|
+
let t = O(e);
|
|
283
|
+
n[t] = lt(e);
|
|
284
|
+
}
|
|
285
|
+
return n;
|
|
286
|
+
},
|
|
287
|
+
(e) => {
|
|
288
|
+
let t = D(e), n = [];
|
|
289
|
+
for (let r = 0; r < t; r++) n.push(lt(e));
|
|
290
|
+
return n;
|
|
291
|
+
},
|
|
292
|
+
E
|
|
293
|
+
], lt = (e) => ct[127 - at(e)](e), ut = class extends nt {
|
|
294
|
+
constructor(e, t) {
|
|
295
|
+
super(e), this.reader = t, this.s = null, this.count = 0;
|
|
296
|
+
}
|
|
297
|
+
read() {
|
|
298
|
+
return this.count === 0 && (this.s = this.reader(this), rt(this) ? this.count = D(this) + 1 : this.count = -1), this.count--, this.s;
|
|
299
|
+
}
|
|
300
|
+
}, dt = class extends nt {
|
|
301
|
+
constructor(e) {
|
|
302
|
+
super(e), this.s = 0, this.count = 0;
|
|
303
|
+
}
|
|
304
|
+
read() {
|
|
305
|
+
if (this.count === 0) {
|
|
306
|
+
this.s = ot(this);
|
|
307
|
+
let e = ie(this.s);
|
|
308
|
+
this.count = 1, e && (this.s = -this.s, this.count = D(this) + 2);
|
|
309
|
+
}
|
|
310
|
+
return this.count--, this.s;
|
|
311
|
+
}
|
|
312
|
+
}, ft = class extends nt {
|
|
313
|
+
constructor(e) {
|
|
314
|
+
super(e), this.s = 0, this.count = 0, this.diff = 0;
|
|
315
|
+
}
|
|
316
|
+
read() {
|
|
317
|
+
if (this.count === 0) {
|
|
318
|
+
let e = ot(this), t = e & 1;
|
|
319
|
+
this.diff = m(e / 2), this.count = 1, t && (this.count = D(this) + 2);
|
|
320
|
+
}
|
|
321
|
+
return this.s += this.diff, this.count--, this.s;
|
|
322
|
+
}
|
|
323
|
+
}, pt = class {
|
|
324
|
+
constructor(e) {
|
|
325
|
+
this.decoder = new dt(e), this.str = O(this.decoder), this.spos = 0;
|
|
326
|
+
}
|
|
327
|
+
read() {
|
|
328
|
+
let e = this.spos + this.decoder.read(), t = this.str.slice(this.spos, e);
|
|
329
|
+
return this.spos = e, t;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
crypto.subtle;
|
|
333
|
+
var mt = crypto.getRandomValues.bind(crypto), ht = Math.random, gt = () => mt(/* @__PURE__ */ new Uint32Array(1))[0], _t = (e) => e[m(ht() * e.length)], vt = "10000000-1000-4000-8000-100000000000", yt = () => vt.replace(/[018]/g, (e) => (e ^ gt() & 15 >> e / 4).toString(16)), bt = Date.now, xt = (e) => new Promise(e);
|
|
334
|
+
Promise.all.bind(Promise);
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region ../node_modules/.bun/lib0@0.2.117/node_modules/lib0/conditions.js
|
|
337
|
+
/* c8 ignore next */
|
|
338
|
+
var St = (e) => e === void 0 ? null : e, Ct = new class {
|
|
339
|
+
constructor() {
|
|
340
|
+
this.map = /* @__PURE__ */ new Map();
|
|
341
|
+
}
|
|
342
|
+
setItem(e, t) {
|
|
343
|
+
this.map.set(e, t);
|
|
344
|
+
}
|
|
345
|
+
getItem(e) {
|
|
346
|
+
return this.map.get(e);
|
|
347
|
+
}
|
|
348
|
+
}(), wt = !0;
|
|
349
|
+
/* c8 ignore start */
|
|
350
|
+
try {
|
|
351
|
+
typeof localStorage < "u" && localStorage && (Ct = localStorage, wt = !1);
|
|
352
|
+
} catch {}
|
|
353
|
+
/* c8 ignore stop */
|
|
354
|
+
/* c8 ignore next */
|
|
355
|
+
var Tt = Ct, Et = (e) => wt || addEventListener("storage", e), Dt = (e) => wt || removeEventListener("storage", e), Ot = Symbol("Equality"), kt = (e, t) => e === t || !!e?.[Ot]?.(t) || !1, At = (e) => typeof e == "object", jt = Object.assign, Mt = Object.keys, Nt = (e, t) => {
|
|
356
|
+
for (let n in e) t(e[n], n);
|
|
357
|
+
}, Pt = (e, t) => {
|
|
358
|
+
let n = [];
|
|
359
|
+
for (let r in e) n.push(t(e[r], r));
|
|
360
|
+
return n;
|
|
361
|
+
}, Ft = (e) => Mt(e).length, It = (e) => {
|
|
362
|
+
for (let t in e) return !1;
|
|
363
|
+
return !0;
|
|
364
|
+
}, Lt = (e, t) => {
|
|
365
|
+
for (let n in e) if (!t(e[n], n)) return !1;
|
|
366
|
+
return !0;
|
|
367
|
+
}, Rt = (e, t) => Object.prototype.hasOwnProperty.call(e, t), zt = (e, t) => e === t || Ft(e) === Ft(t) && Lt(e, (e, n) => (e !== void 0 || Rt(t, n)) && kt(t[n], e)), Bt = Object.freeze, Vt = (e) => {
|
|
368
|
+
for (let t in e) {
|
|
369
|
+
let n = e[t];
|
|
370
|
+
(typeof n == "object" || typeof n == "function") && Vt(e[t]);
|
|
371
|
+
}
|
|
372
|
+
return Bt(e);
|
|
373
|
+
}, Ht = (e, t, n = 0) => {
|
|
374
|
+
try {
|
|
375
|
+
for (; n < e.length; n++) e[n](...t);
|
|
376
|
+
} finally {
|
|
377
|
+
n < e.length && Ht(e, t, n + 1);
|
|
378
|
+
}
|
|
379
|
+
}, Ut = (e) => e, Wt = (e, t) => {
|
|
380
|
+
if (e === t) return !0;
|
|
381
|
+
if (e == null || t == null || e.constructor !== t.constructor && (e.constructor || Object) !== (t.constructor || Object)) return !1;
|
|
382
|
+
if (e[Ot] != null) return e[Ot](t);
|
|
383
|
+
switch (e.constructor) {
|
|
384
|
+
case ArrayBuffer: e = new Uint8Array(e), t = new Uint8Array(t);
|
|
385
|
+
case Uint8Array:
|
|
386
|
+
if (e.byteLength !== t.byteLength) return !1;
|
|
387
|
+
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
|
|
388
|
+
break;
|
|
389
|
+
case Set:
|
|
390
|
+
if (e.size !== t.size) return !1;
|
|
391
|
+
for (let n of e) if (!t.has(n)) return !1;
|
|
392
|
+
break;
|
|
393
|
+
case Map:
|
|
394
|
+
if (e.size !== t.size) return !1;
|
|
395
|
+
for (let n of e.keys()) if (!t.has(n) || !Wt(e.get(n), t.get(n))) return !1;
|
|
396
|
+
break;
|
|
397
|
+
case void 0:
|
|
398
|
+
case Object:
|
|
399
|
+
if (Ft(e) !== Ft(t)) return !1;
|
|
400
|
+
for (let n in e) if (!Rt(e, n) || !Wt(e[n], t[n])) return !1;
|
|
401
|
+
break;
|
|
402
|
+
case Array:
|
|
403
|
+
if (e.length !== t.length) return !1;
|
|
404
|
+
for (let n = 0; n < e.length; n++) if (!Wt(e[n], t[n])) return !1;
|
|
405
|
+
break;
|
|
406
|
+
default: return !1;
|
|
407
|
+
}
|
|
408
|
+
return !0;
|
|
409
|
+
}, Gt = (e, t) => t.includes(e), Kt = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", qt = typeof window < "u" && typeof document < "u" && !Kt;
|
|
410
|
+
typeof navigator < "u" && /Mac/.test(navigator.platform);
|
|
411
|
+
var k, Jt = [], Yt = () => {
|
|
412
|
+
if (k === void 0) if (Kt) {
|
|
413
|
+
k = e();
|
|
414
|
+
let t = process.argv, n = null;
|
|
415
|
+
for (let e = 0; e < t.length; e++) {
|
|
416
|
+
let r = t[e];
|
|
417
|
+
r[0] === "-" ? (n !== null && k.set(n, ""), n = r) : n === null ? Jt.push(r) : (k.set(n, r), n = null);
|
|
418
|
+
}
|
|
419
|
+
n !== null && k.set(n, "");
|
|
420
|
+
} else typeof location == "object" ? (k = e(), (location.search || "?").slice(1).split("&").forEach((e) => {
|
|
421
|
+
if (e.length !== 0) {
|
|
422
|
+
let [t, n] = e.split("=");
|
|
423
|
+
k.set(`--${Ee(t, "-")}`, n), k.set(`-${Ee(t, "-")}`, n);
|
|
424
|
+
}
|
|
425
|
+
})) : k = e();
|
|
426
|
+
return k;
|
|
427
|
+
}, Xt = (e) => Yt().has(e), Zt = (e) => St(Kt ? process.env[e.toUpperCase().replaceAll("-", "_")] : Tt.getItem(e)), Qt = (e) => Xt("--" + e) || Zt(e) !== null, $t = Qt("production"), en = Kt && Gt(process.env.FORCE_COLOR, [
|
|
428
|
+
"true",
|
|
429
|
+
"1",
|
|
430
|
+
"2"
|
|
431
|
+
]) || !Xt("--no-colors") && !Qt("no-color") && (!Kt || process.stdout.isTTY) && (!Kt || Xt("--color") || Zt("COLORTERM") !== null || (Zt("TERM") || "").includes("color")), tn = (e) => new Uint8Array(e), nn = (e, t, n) => new Uint8Array(e, t, n), rn = (e) => new Uint8Array(e), an = (e) => {
|
|
432
|
+
let t = "";
|
|
433
|
+
for (let n = 0; n < e.byteLength; n++) t += xe(e[n]);
|
|
434
|
+
return btoa(t);
|
|
435
|
+
}, on = (e) => Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("base64"), sn = (e) => {
|
|
436
|
+
let t = atob(e), n = tn(t.length);
|
|
437
|
+
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
438
|
+
return n;
|
|
439
|
+
}, cn = (e) => {
|
|
440
|
+
let t = Buffer.from(e, "base64");
|
|
441
|
+
return nn(t.buffer, t.byteOffset, t.byteLength);
|
|
442
|
+
}, ln = qt ? an : on, un = qt ? sn : cn, dn = (e) => {
|
|
443
|
+
let t = tn(e.byteLength);
|
|
444
|
+
return t.set(e), t;
|
|
445
|
+
}, fn = (e) => Ne((t) => qe(t, e)), pn = class {
|
|
446
|
+
constructor(e, t) {
|
|
447
|
+
this.left = e, this.right = t;
|
|
448
|
+
}
|
|
449
|
+
}, A = (e, t) => new pn(e, t), mn = (e) => e.next() >= .5, hn = (e, t, n) => m(e.next() * (n + 1 - t) + t), gn = (e, t, n) => m(e.next() * (n + 1 - t) + t), _n = (e, t, n) => gn(e, t, n), vn = (e) => xe(_n(e, 97, 122)), yn = (e, t = 0, n = 20) => {
|
|
450
|
+
let r = _n(e, t, n), i = "";
|
|
451
|
+
for (let t = 0; t < r; t++) i += vn(e);
|
|
452
|
+
return i;
|
|
453
|
+
}, bn = (e, t) => t[_n(e, 0, t.length - 1)], xn = Symbol("0schema"), Sn = class {
|
|
454
|
+
constructor() {
|
|
455
|
+
this._rerrs = [];
|
|
456
|
+
}
|
|
457
|
+
extend(e, t, n, r = null) {
|
|
458
|
+
this._rerrs.push({
|
|
459
|
+
path: e,
|
|
460
|
+
expected: t,
|
|
461
|
+
has: n,
|
|
462
|
+
message: r
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
toString() {
|
|
466
|
+
let e = [];
|
|
467
|
+
for (let t = this._rerrs.length - 1; t > 0; t--) {
|
|
468
|
+
let n = this._rerrs[t];
|
|
469
|
+
/* c8 ignore next */
|
|
470
|
+
e.push(je(" ", (this._rerrs.length - t) * 2) + `${n.path == null ? "" : `[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`);
|
|
471
|
+
}
|
|
472
|
+
return e.join("\n");
|
|
473
|
+
}
|
|
474
|
+
}, Cn = (e, t) => e === t ? !0 : e == null || t == null || e.constructor !== t.constructor ? !1 : e[Ot] ? kt(e, t) : f(e) ? l(e, (e) => u(t, (t) => Cn(e, t))) : At(e) ? Lt(e, (e, n) => Cn(e, t[n])) : !1, j = class {
|
|
475
|
+
static _dilutes = !1;
|
|
476
|
+
extends(e) {
|
|
477
|
+
let [t, n] = [this.shape, e.shape];
|
|
478
|
+
return this.constructor._dilutes && ([n, t] = [t, n]), Cn(t, n);
|
|
479
|
+
}
|
|
480
|
+
equals(e) {
|
|
481
|
+
return this.constructor === e.constructor && Wt(this.shape, e.shape);
|
|
482
|
+
}
|
|
483
|
+
[xn]() {
|
|
484
|
+
return !0;
|
|
485
|
+
}
|
|
486
|
+
[Ot](e) {
|
|
487
|
+
return this.equals(e);
|
|
488
|
+
}
|
|
489
|
+
validate(e) {
|
|
490
|
+
return this.check(e);
|
|
491
|
+
}
|
|
492
|
+
/* c8 ignore start */
|
|
493
|
+
check(e, t) {
|
|
494
|
+
C();
|
|
495
|
+
}
|
|
496
|
+
/* c8 ignore stop */
|
|
497
|
+
get nullable() {
|
|
498
|
+
return er(this, hr);
|
|
499
|
+
}
|
|
500
|
+
get optional() {
|
|
501
|
+
return new Mn(this);
|
|
502
|
+
}
|
|
503
|
+
cast(e) {
|
|
504
|
+
return yr(e, this), e;
|
|
505
|
+
}
|
|
506
|
+
expect(e) {
|
|
507
|
+
return yr(e, this), e;
|
|
508
|
+
}
|
|
509
|
+
}, wn = class extends j {
|
|
510
|
+
constructor(e, t) {
|
|
511
|
+
super(), this.shape = e, this._c = t;
|
|
512
|
+
}
|
|
513
|
+
check(e, t = void 0) {
|
|
514
|
+
let n = e?.constructor === this.shape && (this._c == null || this._c(e));
|
|
515
|
+
return !n && t?.extend(null, this.shape.name, e?.constructor.name, e?.constructor === this.shape ? "Check failed" : "Constructor match failed"), n;
|
|
516
|
+
}
|
|
517
|
+
}, M = (e, t = null) => new wn(e, t);
|
|
518
|
+
M(wn);
|
|
519
|
+
var Tn = class extends j {
|
|
520
|
+
constructor(e) {
|
|
521
|
+
super(), this.shape = e;
|
|
522
|
+
}
|
|
523
|
+
check(e, t) {
|
|
524
|
+
let n = this.shape(e);
|
|
525
|
+
return !n && t?.extend(null, "custom prop", e?.constructor.name, "failed to check custom prop"), n;
|
|
526
|
+
}
|
|
527
|
+
}, N = (e) => new Tn(e);
|
|
528
|
+
M(Tn);
|
|
529
|
+
var En = class extends j {
|
|
530
|
+
constructor(e) {
|
|
531
|
+
super(), this.shape = e;
|
|
532
|
+
}
|
|
533
|
+
check(e, t) {
|
|
534
|
+
let n = this.shape.some((t) => t === e);
|
|
535
|
+
return !n && t?.extend(null, this.shape.join(" | "), e.toString()), n;
|
|
536
|
+
}
|
|
537
|
+
}, Dn = (...e) => new En(e), On = M(En), kn = RegExp.escape || ((e) => e.replace(/[().|&,$^[\]]/g, (e) => "\\" + e)), An = (e) => {
|
|
538
|
+
if (ur.check(e)) return [kn(e)];
|
|
539
|
+
if (On.check(e)) return e.shape.map((e) => e + "");
|
|
540
|
+
if (lr.check(e)) return ["[+-]?\\d+.?\\d*"];
|
|
541
|
+
if (dr.check(e)) return [".*"];
|
|
542
|
+
if (tr.check(e)) return e.shape.map(An).flat(1);
|
|
543
|
+
/* c8 ignore next 2 */
|
|
544
|
+
w();
|
|
545
|
+
};
|
|
546
|
+
M(class extends j {
|
|
547
|
+
constructor(e) {
|
|
548
|
+
super(), this.shape = e, this._r = RegExp("^" + e.map(An).map((e) => `(${e.join("|")})`).join("") + "$");
|
|
549
|
+
}
|
|
550
|
+
check(e, t) {
|
|
551
|
+
let n = this._r.exec(e) != null;
|
|
552
|
+
return !n && t?.extend(null, this._r.toString(), e.toString(), "String doesn't match string template."), n;
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
var jn = Symbol("optional"), Mn = class extends j {
|
|
556
|
+
constructor(e) {
|
|
557
|
+
super(), this.shape = e;
|
|
558
|
+
}
|
|
559
|
+
check(e, t) {
|
|
560
|
+
let n = e === void 0 || this.shape.check(e);
|
|
561
|
+
return !n && t?.extend(null, "undefined (optional)", "()"), n;
|
|
562
|
+
}
|
|
563
|
+
get [jn]() {
|
|
564
|
+
return !0;
|
|
565
|
+
}
|
|
566
|
+
}, Nn = M(Mn), Pn = class extends j {
|
|
567
|
+
check(e, t) {
|
|
568
|
+
return t?.extend(null, "never", typeof e), !1;
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
new Pn(), M(Pn);
|
|
572
|
+
var Fn = class e extends j {
|
|
573
|
+
constructor(e, t = !1) {
|
|
574
|
+
super(), this.shape = e, this._isPartial = t;
|
|
575
|
+
}
|
|
576
|
+
static _dilutes = !0;
|
|
577
|
+
get partial() {
|
|
578
|
+
return new e(this.shape, !0);
|
|
579
|
+
}
|
|
580
|
+
check(e, t) {
|
|
581
|
+
return e == null ? (t?.extend(null, "object", "null"), !1) : Lt(this.shape, (n, r) => {
|
|
582
|
+
let i = this._isPartial && !Rt(e, r) || n.check(e[r], t);
|
|
583
|
+
return !i && t?.extend(r.toString(), n.toString(), typeof e[r], "Object property does not match"), i;
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
}, In = (e) => new Fn(e), Ln = M(Fn), Rn = N((e) => e != null && (e.constructor === Object || e.constructor == null)), zn = class extends j {
|
|
587
|
+
constructor(e, t) {
|
|
588
|
+
super(), this.shape = {
|
|
589
|
+
keys: e,
|
|
590
|
+
values: t
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
check(e, t) {
|
|
594
|
+
return e != null && Lt(e, (n, r) => {
|
|
595
|
+
let i = this.shape.keys.check(r, t);
|
|
596
|
+
return !i && t?.extend(r + "", "Record", typeof e, i ? "Key doesn't match schema" : "Value doesn't match value"), i && this.shape.values.check(n, t);
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
}, Bn = (e, t) => new zn(e, t), Vn = M(zn), Hn = class extends j {
|
|
600
|
+
constructor(e) {
|
|
601
|
+
super(), this.shape = e;
|
|
602
|
+
}
|
|
603
|
+
check(e, t) {
|
|
604
|
+
return e != null && Lt(this.shape, (n, r) => {
|
|
605
|
+
let i = n.check(e[r], t);
|
|
606
|
+
return !i && t?.extend(r.toString(), "Tuple", typeof n), i;
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
}, Un = (...e) => new Hn(e);
|
|
610
|
+
M(Hn);
|
|
611
|
+
var Wn = class extends j {
|
|
612
|
+
constructor(e) {
|
|
613
|
+
super(), this.shape = e.length === 1 ? e[0] : new $n(e);
|
|
614
|
+
}
|
|
615
|
+
check(e, t) {
|
|
616
|
+
let n = f(e) && l(e, (e) => this.shape.check(e));
|
|
617
|
+
return !n && t?.extend(null, "Array", ""), n;
|
|
618
|
+
}
|
|
619
|
+
}, Gn = (...e) => new Wn(e), Kn = M(Wn), qn = N((e) => f(e)), Jn = class extends j {
|
|
620
|
+
constructor(e, t) {
|
|
621
|
+
super(), this.shape = e, this._c = t;
|
|
622
|
+
}
|
|
623
|
+
check(e, t) {
|
|
624
|
+
let n = e instanceof this.shape && (this._c == null || this._c(e));
|
|
625
|
+
return !n && t?.extend(null, this.shape.name, e?.constructor.name), n;
|
|
626
|
+
}
|
|
627
|
+
}, Yn = (e, t = null) => new Jn(e, t);
|
|
628
|
+
M(Jn);
|
|
629
|
+
var Xn = Yn(j), Zn = M(class extends j {
|
|
630
|
+
constructor(e) {
|
|
631
|
+
super(), this.len = e.length - 1, this.args = Un(...e.slice(-1)), this.res = e[this.len];
|
|
632
|
+
}
|
|
633
|
+
check(e, t) {
|
|
634
|
+
let n = e.constructor === Function && e.length <= this.len;
|
|
635
|
+
return !n && t?.extend(null, "function", typeof e), n;
|
|
636
|
+
}
|
|
637
|
+
}), Qn = N((e) => typeof e == "function");
|
|
638
|
+
M(class extends j {
|
|
639
|
+
constructor(e) {
|
|
640
|
+
super(), this.shape = e;
|
|
641
|
+
}
|
|
642
|
+
check(e, t) {
|
|
643
|
+
let n = l(this.shape, (n) => n.check(e, t));
|
|
644
|
+
return !n && t?.extend(null, "Intersectinon", typeof e), n;
|
|
645
|
+
}
|
|
646
|
+
}, (e) => e.shape.length > 0);
|
|
647
|
+
var $n = class extends j {
|
|
648
|
+
static _dilutes = !0;
|
|
649
|
+
constructor(e) {
|
|
650
|
+
super(), this.shape = e;
|
|
651
|
+
}
|
|
652
|
+
check(e, t) {
|
|
653
|
+
let n = u(this.shape, (n) => n.check(e, t));
|
|
654
|
+
return t?.extend(null, "Union", typeof e), n;
|
|
655
|
+
}
|
|
656
|
+
}, er = (...e) => e.findIndex((e) => tr.check(e)) >= 0 ? er(...e.map((e) => vr(e)).map((e) => tr.check(e) ? e.shape : [e]).flat(1)) : e.length === 1 ? e[0] : new $n(e), tr = M($n), nr = () => !0, rr = N(nr), ir = M(Tn, (e) => e.shape === nr), ar = N((e) => typeof e == "bigint"), or = N((e) => e === ar), sr = N((e) => typeof e == "symbol");
|
|
657
|
+
N((e) => e === sr);
|
|
658
|
+
var cr = N((e) => typeof e == "number"), lr = N((e) => e === cr), ur = N((e) => typeof e == "string"), dr = N((e) => e === ur), fr = N((e) => typeof e == "boolean"), pr = N((e) => e === fr), mr = Dn(void 0);
|
|
659
|
+
M(En, (e) => e.shape.length === 1 && e.shape[0] === void 0), Dn(void 0);
|
|
660
|
+
var hr = Dn(null), gr = M(En, (e) => e.shape.length === 1 && e.shape[0] === null);
|
|
661
|
+
M(Uint8Array), M(wn, (e) => e.shape === Uint8Array);
|
|
662
|
+
var _r = er(cr, ur, hr, mr, ar, fr, sr);
|
|
663
|
+
(() => {
|
|
664
|
+
let e = Gn(rr), t = Bn(ur, rr), n = er(cr, ur, hr, fr, e, t);
|
|
665
|
+
return e.shape = n, t.shape.values = n, n;
|
|
666
|
+
})();
|
|
667
|
+
var vr = (e) => {
|
|
668
|
+
if (Xn.check(e)) return e;
|
|
669
|
+
if (Rn.check(e)) {
|
|
670
|
+
let t = {};
|
|
671
|
+
for (let n in e) t[n] = vr(e[n]);
|
|
672
|
+
return In(t);
|
|
673
|
+
} else if (qn.check(e)) return er(...e.map(vr));
|
|
674
|
+
else if (_r.check(e)) return Dn(e);
|
|
675
|
+
else if (Qn.check(e)) return M(e);
|
|
676
|
+
/* c8 ignore next */
|
|
677
|
+
w();
|
|
678
|
+
}, yr = $t ? () => {} : (e, t) => {
|
|
679
|
+
let n = new Sn();
|
|
680
|
+
if (!t.check(e, n)) throw S(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`);
|
|
681
|
+
}, br = class {
|
|
682
|
+
constructor(e) {
|
|
683
|
+
this.patterns = [], this.$state = e;
|
|
684
|
+
}
|
|
685
|
+
if(e, t) {
|
|
686
|
+
return this.patterns.push({
|
|
687
|
+
if: vr(e),
|
|
688
|
+
h: t
|
|
689
|
+
}), this;
|
|
690
|
+
}
|
|
691
|
+
else(e) {
|
|
692
|
+
return this.if(rr, e);
|
|
693
|
+
}
|
|
694
|
+
done() {
|
|
695
|
+
return (e, t) => {
|
|
696
|
+
for (let n = 0; n < this.patterns.length; n++) {
|
|
697
|
+
let r = this.patterns[n];
|
|
698
|
+
if (r.if.check(e)) return r.h(e, t);
|
|
699
|
+
}
|
|
700
|
+
throw S("Unhandled pattern");
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
}, xr = ((e) => new br(e))(rr).if(lr, (e, t) => hn(t, ye, ve)).if(dr, (e, t) => yn(t)).if(pr, (e, t) => mn(t)).if(or, (e, t) => BigInt(hn(t, ye, ve))).if(tr, (e, t) => Sr(t, bn(t, e.shape))).if(Ln, (e, t) => {
|
|
704
|
+
let n = {};
|
|
705
|
+
for (let r in e.shape) {
|
|
706
|
+
let i = e.shape[r];
|
|
707
|
+
if (Nn.check(i)) {
|
|
708
|
+
if (mn(t)) continue;
|
|
709
|
+
i = i.shape;
|
|
710
|
+
}
|
|
711
|
+
n[r] = xr(i, t);
|
|
712
|
+
}
|
|
713
|
+
return n;
|
|
714
|
+
}).if(Kn, (e, t) => {
|
|
715
|
+
let n = [], r = gn(t, 0, 42);
|
|
716
|
+
for (let i = 0; i < r; i++) n.push(Sr(t, e.shape));
|
|
717
|
+
return n;
|
|
718
|
+
}).if(On, (e, t) => bn(t, e.shape)).if(gr, (e, t) => null).if(Zn, (e, t) => {
|
|
719
|
+
let n = Sr(t, e.res);
|
|
720
|
+
return () => n;
|
|
721
|
+
}).if(ir, (e, t) => Sr(t, bn(t, [
|
|
722
|
+
cr,
|
|
723
|
+
ur,
|
|
724
|
+
hr,
|
|
725
|
+
mr,
|
|
726
|
+
ar,
|
|
727
|
+
fr,
|
|
728
|
+
Gn(cr),
|
|
729
|
+
Bn(er("a", "b", "c"), cr)
|
|
730
|
+
]))).if(Vn, (e, t) => {
|
|
731
|
+
let n = {}, r = hn(t, 0, 3);
|
|
732
|
+
for (let i = 0; i < r; i++) {
|
|
733
|
+
let r = Sr(t, e.shape.keys);
|
|
734
|
+
n[r] = Sr(t, e.shape.values);
|
|
735
|
+
}
|
|
736
|
+
return n;
|
|
737
|
+
}).done(), Sr = (e, t) => xr(vr(t), e), P = typeof document < "u" ? document : {};
|
|
738
|
+
N((e) => e.nodeType === Dr), typeof DOMParser < "u" && new DOMParser(), N((e) => e.nodeType === wr), N((e) => e.nodeType === Tr);
|
|
739
|
+
var Cr = (e) => r(e, (e, t) => `${t}:${e};`).join(""), wr = P.ELEMENT_NODE, Tr = P.TEXT_NODE;
|
|
740
|
+
P.CDATA_SECTION_NODE, P.COMMENT_NODE;
|
|
741
|
+
var Er = P.DOCUMENT_NODE;
|
|
742
|
+
P.DOCUMENT_TYPE_NODE;
|
|
743
|
+
var Dr = P.DOCUMENT_FRAGMENT_NODE;
|
|
744
|
+
N((e) => e.nodeType === Er);
|
|
745
|
+
/* c8 ignore stop */
|
|
746
|
+
//#endregion
|
|
747
|
+
//#region ../node_modules/.bun/lib0@0.2.117/node_modules/lib0/eventloop.js
|
|
748
|
+
var Or = ((e) => class {
|
|
749
|
+
constructor(e) {
|
|
750
|
+
this._ = e;
|
|
751
|
+
}
|
|
752
|
+
destroy() {
|
|
753
|
+
e(this._);
|
|
754
|
+
}
|
|
755
|
+
})(clearTimeout), kr = (e, t) => new Or(setTimeout(t, e)), F = Symbol, Ar = F(), jr = F(), Mr = F(), Nr = F(), Pr = F(), Fr = F(), Ir = F(), Lr = F(), Rr = F(), zr = (e) => {
|
|
756
|
+
e.length === 1 && e[0]?.constructor === Function && (e = e[0]());
|
|
757
|
+
let t = [], n = [], r = 0;
|
|
758
|
+
for (; r < e.length; r++) {
|
|
759
|
+
let n = e[r];
|
|
760
|
+
if (n === void 0) break;
|
|
761
|
+
if (n.constructor === String || n.constructor === Number) t.push(n);
|
|
762
|
+
else if (n.constructor === Object) break;
|
|
763
|
+
}
|
|
764
|
+
for (r > 0 && n.push(t.join("")); r < e.length; r++) {
|
|
765
|
+
let t = e[r];
|
|
766
|
+
t instanceof Symbol || n.push(t);
|
|
767
|
+
}
|
|
768
|
+
return n;
|
|
769
|
+
};
|
|
770
|
+
bt();
|
|
771
|
+
/* c8 ignore stop */
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region ../node_modules/.bun/lib0@0.2.117/node_modules/lib0/logging.js
|
|
774
|
+
var Br = {
|
|
775
|
+
[Ar]: A("font-weight", "bold"),
|
|
776
|
+
[jr]: A("font-weight", "normal"),
|
|
777
|
+
[Mr]: A("color", "blue"),
|
|
778
|
+
[Pr]: A("color", "green"),
|
|
779
|
+
[Nr]: A("color", "grey"),
|
|
780
|
+
[Fr]: A("color", "red"),
|
|
781
|
+
[Ir]: A("color", "purple"),
|
|
782
|
+
[Lr]: A("color", "orange"),
|
|
783
|
+
[Rr]: A("color", "black")
|
|
784
|
+
}, Vr = en ? (t) => {
|
|
785
|
+
t.length === 1 && t[0]?.constructor === Function && (t = t[0]());
|
|
786
|
+
let n = [], r = [], i = e(), a = [], o = 0;
|
|
787
|
+
for (; o < t.length; o++) {
|
|
788
|
+
let e = t[o], a = Br[e];
|
|
789
|
+
if (a !== void 0) i.set(a.left, a.right);
|
|
790
|
+
else {
|
|
791
|
+
if (e === void 0) break;
|
|
792
|
+
if (e.constructor === String || e.constructor === Number) {
|
|
793
|
+
let t = Cr(i);
|
|
794
|
+
o > 0 || t.length > 0 ? (n.push("%c" + e), r.push(t)) : n.push(e);
|
|
795
|
+
} else break;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
for (o > 0 && (a = r, a.unshift(n.join(""))); o < t.length; o++) {
|
|
799
|
+
let e = t[o];
|
|
800
|
+
e instanceof Symbol || a.push(e);
|
|
801
|
+
}
|
|
802
|
+
return a;
|
|
803
|
+
} : zr, Hr = (...e) => {
|
|
804
|
+
/* c8 ignore next */
|
|
805
|
+
console.log(...Vr(e)), Wr.forEach((t) => t.print(e));
|
|
806
|
+
}, Ur = (...e) => {
|
|
807
|
+
console.warn(...Vr(e)), e.unshift(Lr), Wr.forEach((t) => t.print(e));
|
|
808
|
+
}, Wr = a(), Gr = (e) => ({
|
|
809
|
+
[Symbol.iterator]() {
|
|
810
|
+
return this;
|
|
811
|
+
},
|
|
812
|
+
next: e
|
|
813
|
+
}), Kr = (e, t) => Gr(() => {
|
|
814
|
+
let n;
|
|
815
|
+
do
|
|
816
|
+
n = e.next();
|
|
817
|
+
while (!n.done && !t(n.value));
|
|
818
|
+
return n;
|
|
819
|
+
}), qr = (e, t) => Gr(() => {
|
|
820
|
+
let { done: n, value: r } = e.next();
|
|
821
|
+
return {
|
|
822
|
+
done: n,
|
|
823
|
+
value: n ? void 0 : t(r)
|
|
824
|
+
};
|
|
825
|
+
}), Jr = class {
|
|
826
|
+
constructor(e, t) {
|
|
827
|
+
this.clock = e, this.len = t;
|
|
828
|
+
}
|
|
829
|
+
}, Yr = class {
|
|
830
|
+
constructor() {
|
|
831
|
+
this.clients = /* @__PURE__ */ new Map();
|
|
832
|
+
}
|
|
833
|
+
}, I = (e, t, n) => t.clients.forEach((t, r) => {
|
|
834
|
+
let i = e.doc.store.clients.get(r);
|
|
835
|
+
if (i != null) {
|
|
836
|
+
let r = i[i.length - 1], a = r.id.clock + r.length;
|
|
837
|
+
for (let r = 0, o = t[r]; r < t.length && o.clock < a; o = t[++r]) sa(e, i, o.clock, o.len, n);
|
|
838
|
+
}
|
|
839
|
+
}), Xr = (e, t) => {
|
|
840
|
+
let n = 0, r = e.length - 1;
|
|
841
|
+
for (; n <= r;) {
|
|
842
|
+
let i = m((n + r) / 2), a = e[i], o = a.clock;
|
|
843
|
+
if (o <= t) {
|
|
844
|
+
if (t < o + a.len) return i;
|
|
845
|
+
n = i + 1;
|
|
846
|
+
} else r = i - 1;
|
|
847
|
+
}
|
|
848
|
+
return null;
|
|
849
|
+
}, Zr = (e, t) => {
|
|
850
|
+
let n = e.clients.get(t.client);
|
|
851
|
+
return n !== void 0 && Xr(n, t.clock) !== null;
|
|
852
|
+
}, Qr = (e) => {
|
|
853
|
+
e.clients.forEach((e) => {
|
|
854
|
+
e.sort((e, t) => e.clock - t.clock);
|
|
855
|
+
let t, n;
|
|
856
|
+
for (t = 1, n = 1; t < e.length; t++) {
|
|
857
|
+
let r = e[n - 1], i = e[t];
|
|
858
|
+
r.clock + r.len >= i.clock ? e[n - 1] = new Jr(r.clock, h(r.len, i.clock + i.len - r.clock)) : (n < t && (e[n] = i), n++);
|
|
859
|
+
}
|
|
860
|
+
e.length = n;
|
|
861
|
+
});
|
|
862
|
+
}, $r = (e) => {
|
|
863
|
+
let t = new Yr();
|
|
864
|
+
for (let n = 0; n < e.length; n++) e[n].clients.forEach((r, i) => {
|
|
865
|
+
if (!t.clients.has(i)) {
|
|
866
|
+
let a = r.slice();
|
|
867
|
+
for (let t = n + 1; t < e.length; t++) s(a, e[t].clients.get(i) || []);
|
|
868
|
+
t.clients.set(i, a);
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
return Qr(t), t;
|
|
872
|
+
}, ei = (e, t, r, i) => {
|
|
873
|
+
n(e.clients, t, () => []).push(new Jr(r, i));
|
|
874
|
+
}, ti = () => new Yr(), ni = (e) => {
|
|
875
|
+
let t = ti();
|
|
876
|
+
return e.clients.forEach((e, n) => {
|
|
877
|
+
let r = [];
|
|
878
|
+
for (let t = 0; t < e.length; t++) {
|
|
879
|
+
let n = e[t];
|
|
880
|
+
if (n.deleted) {
|
|
881
|
+
let i = n.id.clock, a = n.length;
|
|
882
|
+
if (t + 1 < e.length) for (let n = e[t + 1]; t + 1 < e.length && n.deleted; n = e[++t + 1]) a += n.length;
|
|
883
|
+
r.push(new Jr(i, a));
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
r.length > 0 && t.clients.set(n, r);
|
|
887
|
+
}), t;
|
|
888
|
+
}, ri = (e, t) => {
|
|
889
|
+
y(e.restEncoder, t.clients.size), c(t.clients.entries()).sort((e, t) => t[0] - e[0]).forEach(([t, n]) => {
|
|
890
|
+
e.resetDsCurVal(), y(e.restEncoder, t);
|
|
891
|
+
let r = n.length;
|
|
892
|
+
y(e.restEncoder, r);
|
|
893
|
+
for (let t = 0; t < r; t++) {
|
|
894
|
+
let r = n[t];
|
|
895
|
+
e.writeDsClock(r.clock), e.writeDsLen(r.len);
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
}, ii = (e) => {
|
|
899
|
+
let t = new Yr(), r = D(e.restDecoder);
|
|
900
|
+
for (let i = 0; i < r; i++) {
|
|
901
|
+
e.resetDsCurVal();
|
|
902
|
+
let r = D(e.restDecoder), i = D(e.restDecoder);
|
|
903
|
+
if (i > 0) {
|
|
904
|
+
let a = n(t.clients, r, () => []);
|
|
905
|
+
for (let t = 0; t < i; t++) a.push(new Jr(e.readDsClock(), e.readDsLen()));
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
return t;
|
|
909
|
+
}, ai = (e, t, n) => {
|
|
910
|
+
let r = new Yr(), i = D(e.restDecoder);
|
|
911
|
+
for (let a = 0; a < i; a++) {
|
|
912
|
+
e.resetDsCurVal();
|
|
913
|
+
let i = D(e.restDecoder), a = D(e.restDecoder), o = n.clients.get(i) || [], s = B(n, i);
|
|
914
|
+
for (let n = 0; n < a; n++) {
|
|
915
|
+
let n = e.readDsClock(), a = n + e.readDsLen();
|
|
916
|
+
if (n < s) {
|
|
917
|
+
s < a && ei(r, i, s, a - s);
|
|
918
|
+
let e = V(o, n), c = o[e];
|
|
919
|
+
for (!c.deleted && c.id.clock < n && (o.splice(e + 1, 0, gs(t, c, n - c.id.clock)), e++); e < o.length && (c = o[e++], c.id.clock < a);) c.deleted || (a < c.id.clock + c.length && o.splice(e, 0, gs(t, c, a - c.id.clock)), c.delete(t));
|
|
920
|
+
} else ei(r, i, n, a - n);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
if (r.clients.size > 0) {
|
|
924
|
+
let e = new L();
|
|
925
|
+
return y(e.restEncoder, 0), ri(e, r), e.toUint8Array();
|
|
926
|
+
}
|
|
927
|
+
return null;
|
|
928
|
+
}, oi = gt, si = class e extends p {
|
|
929
|
+
constructor({ guid: e = yt(), collectionid: t = null, gc: n = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: a = !1, shouldLoad: o = !0 } = {}) {
|
|
930
|
+
super(), this.gc = n, this.gcFilter = r, this.clientID = oi(), this.guid = e, this.collectionid = t, this.share = /* @__PURE__ */ new Map(), this.store = new ea(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = o, this.autoLoad = a, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = xt((e) => {
|
|
931
|
+
this.on("load", () => {
|
|
932
|
+
this.isLoaded = !0, e(this);
|
|
933
|
+
});
|
|
934
|
+
});
|
|
935
|
+
let s = () => xt((e) => {
|
|
936
|
+
let t = (n) => {
|
|
937
|
+
(n === void 0 || n === !0) && (this.off("sync", t), e());
|
|
938
|
+
};
|
|
939
|
+
this.on("sync", t);
|
|
940
|
+
});
|
|
941
|
+
this.on("sync", (e) => {
|
|
942
|
+
e === !1 && this.isSynced && (this.whenSynced = s()), this.isSynced = e === void 0 || e === !0, this.isSynced && !this.isLoaded && this.emit("load", [this]);
|
|
943
|
+
}), this.whenSynced = s();
|
|
944
|
+
}
|
|
945
|
+
load() {
|
|
946
|
+
let e = this._item;
|
|
947
|
+
e !== null && !this.shouldLoad && U(e.parent.doc, (e) => {
|
|
948
|
+
e.subdocsLoaded.add(this);
|
|
949
|
+
}, null, !0), this.shouldLoad = !0;
|
|
950
|
+
}
|
|
951
|
+
getSubdocs() {
|
|
952
|
+
return this.subdocs;
|
|
953
|
+
}
|
|
954
|
+
getSubdocGuids() {
|
|
955
|
+
return new Set(c(this.subdocs).map((e) => e.guid));
|
|
956
|
+
}
|
|
957
|
+
transact(e, t = null) {
|
|
958
|
+
return U(this, e, t);
|
|
959
|
+
}
|
|
960
|
+
get(e, t = K) {
|
|
961
|
+
let r = n(this.share, e, () => {
|
|
962
|
+
let e = new t();
|
|
963
|
+
return e._integrate(this, null), e;
|
|
964
|
+
}), i = r.constructor;
|
|
965
|
+
if (t !== K && i !== t) if (i === K) {
|
|
966
|
+
let n = new t();
|
|
967
|
+
n._map = r._map, r._map.forEach((e) => {
|
|
968
|
+
for (; e !== null; e = e.left) e.parent = n;
|
|
969
|
+
}), n._start = r._start;
|
|
970
|
+
for (let e = n._start; e !== null; e = e.right) e.parent = n;
|
|
971
|
+
return n._length = r._length, this.share.set(e, n), n._integrate(this, null), n;
|
|
972
|
+
} else throw Error(`Type with the name ${e} has already been defined with a different constructor`);
|
|
973
|
+
return r;
|
|
974
|
+
}
|
|
975
|
+
getArray(e = "") {
|
|
976
|
+
return this.get(e, co);
|
|
977
|
+
}
|
|
978
|
+
getText(e = "") {
|
|
979
|
+
return this.get(e, ko);
|
|
980
|
+
}
|
|
981
|
+
getMap(e = "") {
|
|
982
|
+
return this.get(e, fo);
|
|
983
|
+
}
|
|
984
|
+
getXmlElement(e = "") {
|
|
985
|
+
return this.get(e, Po);
|
|
986
|
+
}
|
|
987
|
+
getXmlFragment(e = "") {
|
|
988
|
+
return this.get(e, Mo);
|
|
989
|
+
}
|
|
990
|
+
toJSON() {
|
|
991
|
+
let e = {};
|
|
992
|
+
return this.share.forEach((t, n) => {
|
|
993
|
+
e[n] = t.toJSON();
|
|
994
|
+
}), e;
|
|
995
|
+
}
|
|
996
|
+
destroy() {
|
|
997
|
+
this.isDestroyed = !0, c(this.subdocs).forEach((e) => e.destroy());
|
|
998
|
+
let t = this._item;
|
|
999
|
+
if (t !== null) {
|
|
1000
|
+
this._item = null;
|
|
1001
|
+
let n = t.content;
|
|
1002
|
+
n.doc = new e({
|
|
1003
|
+
guid: this.guid,
|
|
1004
|
+
...n.opts,
|
|
1005
|
+
shouldLoad: !1
|
|
1006
|
+
}), n.doc._item = t, U(t.parent.doc, (e) => {
|
|
1007
|
+
let r = n.doc;
|
|
1008
|
+
t.deleted || e.subdocsAdded.add(r), e.subdocsRemoved.add(this);
|
|
1009
|
+
}, null, !0);
|
|
1010
|
+
}
|
|
1011
|
+
this.emit("destroyed", [!0]), this.emit("destroy", [this]), super.destroy();
|
|
1012
|
+
}
|
|
1013
|
+
}, ci = class {
|
|
1014
|
+
constructor(e) {
|
|
1015
|
+
this.restDecoder = e;
|
|
1016
|
+
}
|
|
1017
|
+
resetDsCurVal() {}
|
|
1018
|
+
readDsClock() {
|
|
1019
|
+
return D(this.restDecoder);
|
|
1020
|
+
}
|
|
1021
|
+
readDsLen() {
|
|
1022
|
+
return D(this.restDecoder);
|
|
1023
|
+
}
|
|
1024
|
+
}, li = class extends ci {
|
|
1025
|
+
readLeftID() {
|
|
1026
|
+
return R(D(this.restDecoder), D(this.restDecoder));
|
|
1027
|
+
}
|
|
1028
|
+
readRightID() {
|
|
1029
|
+
return R(D(this.restDecoder), D(this.restDecoder));
|
|
1030
|
+
}
|
|
1031
|
+
readClient() {
|
|
1032
|
+
return D(this.restDecoder);
|
|
1033
|
+
}
|
|
1034
|
+
readInfo() {
|
|
1035
|
+
return at(this.restDecoder);
|
|
1036
|
+
}
|
|
1037
|
+
readString() {
|
|
1038
|
+
return O(this.restDecoder);
|
|
1039
|
+
}
|
|
1040
|
+
readParentInfo() {
|
|
1041
|
+
return D(this.restDecoder) === 1;
|
|
1042
|
+
}
|
|
1043
|
+
readTypeRef() {
|
|
1044
|
+
return D(this.restDecoder);
|
|
1045
|
+
}
|
|
1046
|
+
readLen() {
|
|
1047
|
+
return D(this.restDecoder);
|
|
1048
|
+
}
|
|
1049
|
+
readAny() {
|
|
1050
|
+
return lt(this.restDecoder);
|
|
1051
|
+
}
|
|
1052
|
+
readBuf() {
|
|
1053
|
+
return dn(E(this.restDecoder));
|
|
1054
|
+
}
|
|
1055
|
+
readJSON() {
|
|
1056
|
+
return JSON.parse(O(this.restDecoder));
|
|
1057
|
+
}
|
|
1058
|
+
readKey() {
|
|
1059
|
+
return O(this.restDecoder);
|
|
1060
|
+
}
|
|
1061
|
+
}, ui = class {
|
|
1062
|
+
constructor(e) {
|
|
1063
|
+
this.dsCurrVal = 0, this.restDecoder = e;
|
|
1064
|
+
}
|
|
1065
|
+
resetDsCurVal() {
|
|
1066
|
+
this.dsCurrVal = 0;
|
|
1067
|
+
}
|
|
1068
|
+
readDsClock() {
|
|
1069
|
+
return this.dsCurrVal += D(this.restDecoder), this.dsCurrVal;
|
|
1070
|
+
}
|
|
1071
|
+
readDsLen() {
|
|
1072
|
+
let e = D(this.restDecoder) + 1;
|
|
1073
|
+
return this.dsCurrVal += e, e;
|
|
1074
|
+
}
|
|
1075
|
+
}, di = class extends ui {
|
|
1076
|
+
constructor(e) {
|
|
1077
|
+
super(e), this.keys = [], D(e), this.keyClockDecoder = new ft(E(e)), this.clientDecoder = new dt(E(e)), this.leftClockDecoder = new ft(E(e)), this.rightClockDecoder = new ft(E(e)), this.infoDecoder = new ut(E(e), at), this.stringDecoder = new pt(E(e)), this.parentInfoDecoder = new ut(E(e), at), this.typeRefDecoder = new dt(E(e)), this.lenDecoder = new dt(E(e));
|
|
1078
|
+
}
|
|
1079
|
+
readLeftID() {
|
|
1080
|
+
return new Li(this.clientDecoder.read(), this.leftClockDecoder.read());
|
|
1081
|
+
}
|
|
1082
|
+
readRightID() {
|
|
1083
|
+
return new Li(this.clientDecoder.read(), this.rightClockDecoder.read());
|
|
1084
|
+
}
|
|
1085
|
+
readClient() {
|
|
1086
|
+
return this.clientDecoder.read();
|
|
1087
|
+
}
|
|
1088
|
+
readInfo() {
|
|
1089
|
+
return this.infoDecoder.read();
|
|
1090
|
+
}
|
|
1091
|
+
readString() {
|
|
1092
|
+
return this.stringDecoder.read();
|
|
1093
|
+
}
|
|
1094
|
+
readParentInfo() {
|
|
1095
|
+
return this.parentInfoDecoder.read() === 1;
|
|
1096
|
+
}
|
|
1097
|
+
readTypeRef() {
|
|
1098
|
+
return this.typeRefDecoder.read();
|
|
1099
|
+
}
|
|
1100
|
+
readLen() {
|
|
1101
|
+
return this.lenDecoder.read();
|
|
1102
|
+
}
|
|
1103
|
+
readAny() {
|
|
1104
|
+
return lt(this.restDecoder);
|
|
1105
|
+
}
|
|
1106
|
+
readBuf() {
|
|
1107
|
+
return E(this.restDecoder);
|
|
1108
|
+
}
|
|
1109
|
+
readJSON() {
|
|
1110
|
+
return lt(this.restDecoder);
|
|
1111
|
+
}
|
|
1112
|
+
readKey() {
|
|
1113
|
+
let e = this.keyClockDecoder.read();
|
|
1114
|
+
if (e < this.keys.length) return this.keys[e];
|
|
1115
|
+
{
|
|
1116
|
+
let e = this.stringDecoder.read();
|
|
1117
|
+
return this.keys.push(e), e;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
}, fi = class {
|
|
1121
|
+
constructor() {
|
|
1122
|
+
this.restEncoder = g();
|
|
1123
|
+
}
|
|
1124
|
+
toUint8Array() {
|
|
1125
|
+
return _(this.restEncoder);
|
|
1126
|
+
}
|
|
1127
|
+
resetDsCurVal() {}
|
|
1128
|
+
writeDsClock(e) {
|
|
1129
|
+
y(this.restEncoder, e);
|
|
1130
|
+
}
|
|
1131
|
+
writeDsLen(e) {
|
|
1132
|
+
y(this.restEncoder, e);
|
|
1133
|
+
}
|
|
1134
|
+
}, pi = class extends fi {
|
|
1135
|
+
writeLeftID(e) {
|
|
1136
|
+
y(this.restEncoder, e.client), y(this.restEncoder, e.clock);
|
|
1137
|
+
}
|
|
1138
|
+
writeRightID(e) {
|
|
1139
|
+
y(this.restEncoder, e.client), y(this.restEncoder, e.clock);
|
|
1140
|
+
}
|
|
1141
|
+
writeClient(e) {
|
|
1142
|
+
y(this.restEncoder, e);
|
|
1143
|
+
}
|
|
1144
|
+
writeInfo(e) {
|
|
1145
|
+
Ie(this.restEncoder, e);
|
|
1146
|
+
}
|
|
1147
|
+
writeString(e) {
|
|
1148
|
+
b(this.restEncoder, e);
|
|
1149
|
+
}
|
|
1150
|
+
writeParentInfo(e) {
|
|
1151
|
+
y(this.restEncoder, +!!e);
|
|
1152
|
+
}
|
|
1153
|
+
writeTypeRef(e) {
|
|
1154
|
+
y(this.restEncoder, e);
|
|
1155
|
+
}
|
|
1156
|
+
writeLen(e) {
|
|
1157
|
+
y(this.restEncoder, e);
|
|
1158
|
+
}
|
|
1159
|
+
writeAny(e) {
|
|
1160
|
+
qe(this.restEncoder, e);
|
|
1161
|
+
}
|
|
1162
|
+
writeBuf(e) {
|
|
1163
|
+
x(this.restEncoder, e);
|
|
1164
|
+
}
|
|
1165
|
+
writeJSON(e) {
|
|
1166
|
+
b(this.restEncoder, JSON.stringify(e));
|
|
1167
|
+
}
|
|
1168
|
+
writeKey(e) {
|
|
1169
|
+
b(this.restEncoder, e);
|
|
1170
|
+
}
|
|
1171
|
+
}, mi = class {
|
|
1172
|
+
constructor() {
|
|
1173
|
+
this.restEncoder = g(), this.dsCurrVal = 0;
|
|
1174
|
+
}
|
|
1175
|
+
toUint8Array() {
|
|
1176
|
+
return _(this.restEncoder);
|
|
1177
|
+
}
|
|
1178
|
+
resetDsCurVal() {
|
|
1179
|
+
this.dsCurrVal = 0;
|
|
1180
|
+
}
|
|
1181
|
+
writeDsClock(e) {
|
|
1182
|
+
let t = e - this.dsCurrVal;
|
|
1183
|
+
this.dsCurrVal = e, y(this.restEncoder, t);
|
|
1184
|
+
}
|
|
1185
|
+
writeDsLen(e) {
|
|
1186
|
+
e === 0 && w(), y(this.restEncoder, e - 1), this.dsCurrVal += e;
|
|
1187
|
+
}
|
|
1188
|
+
}, L = class extends mi {
|
|
1189
|
+
constructor() {
|
|
1190
|
+
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Qe(), this.clientEncoder = new Xe(), this.leftClockEncoder = new Qe(), this.rightClockEncoder = new Qe(), this.infoEncoder = new Je(Ie), this.stringEncoder = new $e(), this.parentInfoEncoder = new Je(Ie), this.typeRefEncoder = new Xe(), this.lenEncoder = new Xe();
|
|
1191
|
+
}
|
|
1192
|
+
toUint8Array() {
|
|
1193
|
+
let e = g();
|
|
1194
|
+
return y(e, 0), x(e, this.keyClockEncoder.toUint8Array()), x(e, this.clientEncoder.toUint8Array()), x(e, this.leftClockEncoder.toUint8Array()), x(e, this.rightClockEncoder.toUint8Array()), x(e, _(this.infoEncoder)), x(e, this.stringEncoder.toUint8Array()), x(e, _(this.parentInfoEncoder)), x(e, this.typeRefEncoder.toUint8Array()), x(e, this.lenEncoder.toUint8Array()), Be(e, _(this.restEncoder)), _(e);
|
|
1195
|
+
}
|
|
1196
|
+
writeLeftID(e) {
|
|
1197
|
+
this.clientEncoder.write(e.client), this.leftClockEncoder.write(e.clock);
|
|
1198
|
+
}
|
|
1199
|
+
writeRightID(e) {
|
|
1200
|
+
this.clientEncoder.write(e.client), this.rightClockEncoder.write(e.clock);
|
|
1201
|
+
}
|
|
1202
|
+
writeClient(e) {
|
|
1203
|
+
this.clientEncoder.write(e);
|
|
1204
|
+
}
|
|
1205
|
+
writeInfo(e) {
|
|
1206
|
+
this.infoEncoder.write(e);
|
|
1207
|
+
}
|
|
1208
|
+
writeString(e) {
|
|
1209
|
+
this.stringEncoder.write(e);
|
|
1210
|
+
}
|
|
1211
|
+
writeParentInfo(e) {
|
|
1212
|
+
this.parentInfoEncoder.write(+!!e);
|
|
1213
|
+
}
|
|
1214
|
+
writeTypeRef(e) {
|
|
1215
|
+
this.typeRefEncoder.write(e);
|
|
1216
|
+
}
|
|
1217
|
+
writeLen(e) {
|
|
1218
|
+
this.lenEncoder.write(e);
|
|
1219
|
+
}
|
|
1220
|
+
writeAny(e) {
|
|
1221
|
+
qe(this.restEncoder, e);
|
|
1222
|
+
}
|
|
1223
|
+
writeBuf(e) {
|
|
1224
|
+
x(this.restEncoder, e);
|
|
1225
|
+
}
|
|
1226
|
+
writeJSON(e) {
|
|
1227
|
+
qe(this.restEncoder, e);
|
|
1228
|
+
}
|
|
1229
|
+
writeKey(e) {
|
|
1230
|
+
let t = this.keyMap.get(e);
|
|
1231
|
+
t === void 0 ? (this.keyClockEncoder.write(this.keyClock++), this.stringEncoder.write(e)) : this.keyClockEncoder.write(t);
|
|
1232
|
+
}
|
|
1233
|
+
}, hi = (e, t, n, r) => {
|
|
1234
|
+
r = h(r, t[0].id.clock);
|
|
1235
|
+
let i = V(t, r);
|
|
1236
|
+
y(e.restEncoder, t.length - i), e.writeClient(n), y(e.restEncoder, r);
|
|
1237
|
+
let a = t[i];
|
|
1238
|
+
a.write(e, r - a.id.clock);
|
|
1239
|
+
for (let n = i + 1; n < t.length; n++) t[n].write(e, 0);
|
|
1240
|
+
}, gi = (e, t, n) => {
|
|
1241
|
+
let r = /* @__PURE__ */ new Map();
|
|
1242
|
+
n.forEach((e, n) => {
|
|
1243
|
+
B(t, n) > e && r.set(n, e);
|
|
1244
|
+
}), ta(t).forEach((e, t) => {
|
|
1245
|
+
n.has(t) || r.set(t, 0);
|
|
1246
|
+
}), y(e.restEncoder, r.size), c(r.entries()).sort((e, t) => t[0] - e[0]).forEach(([n, r]) => {
|
|
1247
|
+
hi(e, t.clients.get(n), n, r);
|
|
1248
|
+
});
|
|
1249
|
+
}, _i = (t, n) => {
|
|
1250
|
+
let r = e(), i = D(t.restDecoder);
|
|
1251
|
+
for (let e = 0; e < i; e++) {
|
|
1252
|
+
let e = D(t.restDecoder), i = Array(e), a = t.readClient(), o = D(t.restDecoder);
|
|
1253
|
+
r.set(a, {
|
|
1254
|
+
i: 0,
|
|
1255
|
+
refs: i
|
|
1256
|
+
});
|
|
1257
|
+
for (let r = 0; r < e; r++) {
|
|
1258
|
+
let e = t.readInfo();
|
|
1259
|
+
switch (31 & e) {
|
|
1260
|
+
case 0: {
|
|
1261
|
+
let e = t.readLen();
|
|
1262
|
+
i[r] = new J(R(a, o), e), o += e;
|
|
1263
|
+
break;
|
|
1264
|
+
}
|
|
1265
|
+
case 10: {
|
|
1266
|
+
let e = D(t.restDecoder);
|
|
1267
|
+
i[r] = new $(R(a, o), e), o += e;
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
default: {
|
|
1271
|
+
let s = (e & 192) == 0, c = new Q(R(a, o), null, (e & 128) == 128 ? t.readLeftID() : null, null, (e & 64) == 64 ? t.readRightID() : null, s ? t.readParentInfo() ? n.get(t.readString()) : t.readLeftID() : null, s && (e & 32) == 32 ? t.readString() : null, ys(t, e));
|
|
1272
|
+
i[r] = c, o += c.length;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
return r;
|
|
1278
|
+
}, vi = (e, t, r) => {
|
|
1279
|
+
let i = [], a = c(r.keys()).sort((e, t) => e - t);
|
|
1280
|
+
if (a.length === 0) return null;
|
|
1281
|
+
let o = () => {
|
|
1282
|
+
if (a.length === 0) return null;
|
|
1283
|
+
let e = r.get(a[a.length - 1]);
|
|
1284
|
+
for (; e.refs.length === e.i;) if (a.pop(), a.length > 0) e = r.get(a[a.length - 1]);
|
|
1285
|
+
else return null;
|
|
1286
|
+
return e;
|
|
1287
|
+
}, s = o();
|
|
1288
|
+
if (s === null) return null;
|
|
1289
|
+
let l = new ea(), u = /* @__PURE__ */ new Map(), d = (e, t) => {
|
|
1290
|
+
let n = u.get(e);
|
|
1291
|
+
(n == null || n > t) && u.set(e, t);
|
|
1292
|
+
}, f = s.refs[s.i++], p = /* @__PURE__ */ new Map(), ee = () => {
|
|
1293
|
+
for (let e of i) {
|
|
1294
|
+
let t = e.id.client, n = r.get(t);
|
|
1295
|
+
n ? (n.i--, l.clients.set(t, n.refs.slice(n.i)), r.delete(t), n.i = 0, n.refs = []) : l.clients.set(t, [e]), a = a.filter((e) => e !== t);
|
|
1296
|
+
}
|
|
1297
|
+
i.length = 0;
|
|
1298
|
+
};
|
|
1299
|
+
for (;;) {
|
|
1300
|
+
if (f.constructor !== $) {
|
|
1301
|
+
let a = n(p, f.id.client, () => B(t, f.id.client)) - f.id.clock;
|
|
1302
|
+
if (a < 0) i.push(f), d(f.id.client, f.id.clock - 1), ee();
|
|
1303
|
+
else {
|
|
1304
|
+
let n = f.getMissing(e, t);
|
|
1305
|
+
if (n !== null) {
|
|
1306
|
+
i.push(f);
|
|
1307
|
+
let e = r.get(n) || {
|
|
1308
|
+
refs: [],
|
|
1309
|
+
i: 0
|
|
1310
|
+
};
|
|
1311
|
+
if (e.refs.length === e.i) d(n, B(t, n)), ee();
|
|
1312
|
+
else {
|
|
1313
|
+
f = e.refs[e.i++];
|
|
1314
|
+
continue;
|
|
1315
|
+
}
|
|
1316
|
+
} else (a === 0 || a < f.length) && (f.integrate(e, a), p.set(f.id.client, f.id.clock + f.length));
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
if (i.length > 0) f = i.pop();
|
|
1320
|
+
else if (s !== null && s.i < s.refs.length) f = s.refs[s.i++];
|
|
1321
|
+
else {
|
|
1322
|
+
if (s = o(), s === null) break;
|
|
1323
|
+
f = s.refs[s.i++];
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
if (l.clients.size > 0) {
|
|
1327
|
+
let e = new L();
|
|
1328
|
+
return gi(e, l, /* @__PURE__ */ new Map()), y(e.restEncoder, 0), {
|
|
1329
|
+
missing: u,
|
|
1330
|
+
update: e.toUint8Array()
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
return null;
|
|
1334
|
+
}, yi = (e, t) => gi(e, t.doc.store, t.beforeState), bi = (e, t, n, r = new di(e)) => U(t, (e) => {
|
|
1335
|
+
e.local = !1;
|
|
1336
|
+
let t = !1, n = e.doc, i = n.store, a = vi(e, i, _i(r, n)), o = i.pendingStructs;
|
|
1337
|
+
if (o) {
|
|
1338
|
+
for (let [e, n] of o.missing) if (n < B(i, e)) {
|
|
1339
|
+
t = !0;
|
|
1340
|
+
break;
|
|
1341
|
+
}
|
|
1342
|
+
if (a) {
|
|
1343
|
+
for (let [e, t] of a.missing) {
|
|
1344
|
+
let n = o.missing.get(e);
|
|
1345
|
+
(n == null || n > t) && o.missing.set(e, t);
|
|
1346
|
+
}
|
|
1347
|
+
o.update = wa([o.update, a.update]);
|
|
1348
|
+
}
|
|
1349
|
+
} else i.pendingStructs = a;
|
|
1350
|
+
let s = ai(r, e, i);
|
|
1351
|
+
if (i.pendingDs) {
|
|
1352
|
+
let t = new di(T(i.pendingDs));
|
|
1353
|
+
D(t.restDecoder);
|
|
1354
|
+
let n = ai(t, e, i);
|
|
1355
|
+
s && n ? i.pendingDs = wa([s, n]) : i.pendingDs = s || n;
|
|
1356
|
+
} else i.pendingDs = s;
|
|
1357
|
+
if (t) {
|
|
1358
|
+
let t = i.pendingStructs.update;
|
|
1359
|
+
i.pendingStructs = null, xi(e.doc, t);
|
|
1360
|
+
}
|
|
1361
|
+
}, n, !1), xi = (e, t, n, r = di) => {
|
|
1362
|
+
let i = T(t);
|
|
1363
|
+
bi(i, e, n, new r(i));
|
|
1364
|
+
}, Si = (e, t, n) => xi(e, t, n, li), Ci = (e, t, n = /* @__PURE__ */ new Map()) => {
|
|
1365
|
+
gi(e, t.store, n), ri(e, ni(t.store));
|
|
1366
|
+
}, wi = (e, t = new Uint8Array([0]), n = new L()) => {
|
|
1367
|
+
Ci(n, e, Di(t));
|
|
1368
|
+
let r = [n.toUint8Array()];
|
|
1369
|
+
if (e.store.pendingDs && r.push(e.store.pendingDs), e.store.pendingStructs && r.push(Ta(e.store.pendingStructs.update, t)), r.length > 1) {
|
|
1370
|
+
if (n.constructor === pi) return Sa(r.map((e, t) => t === 0 ? e : ka(e)));
|
|
1371
|
+
if (n.constructor === L) return wa(r);
|
|
1372
|
+
}
|
|
1373
|
+
return r[0];
|
|
1374
|
+
}, Ti = (e, t) => wi(e, t, new pi()), Ei = (e) => {
|
|
1375
|
+
let t = /* @__PURE__ */ new Map(), n = D(e.restDecoder);
|
|
1376
|
+
for (let r = 0; r < n; r++) {
|
|
1377
|
+
let n = D(e.restDecoder), r = D(e.restDecoder);
|
|
1378
|
+
t.set(n, r);
|
|
1379
|
+
}
|
|
1380
|
+
return t;
|
|
1381
|
+
}, Di = (e) => Ei(new ci(T(e))), Oi = (e, t) => (y(e.restEncoder, t.size), c(t.entries()).sort((e, t) => t[0] - e[0]).forEach(([t, n]) => {
|
|
1382
|
+
y(e.restEncoder, t), y(e.restEncoder, n);
|
|
1383
|
+
}), e), ki = (e, t) => Oi(e, ta(t.store)), Ai = (e, t = new mi()) => (e instanceof Map ? Oi(t, e) : ki(t, e), t.toUint8Array()), ji = (e) => Ai(e, new fi()), Mi = class {
|
|
1384
|
+
constructor() {
|
|
1385
|
+
this.l = [];
|
|
1386
|
+
}
|
|
1387
|
+
}, Ni = () => new Mi(), Pi = (e, t) => e.l.push(t), Fi = (e, t) => {
|
|
1388
|
+
let n = e.l, r = n.length;
|
|
1389
|
+
e.l = n.filter((e) => t !== e), r === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
|
|
1390
|
+
}, Ii = (e, t, n) => Ht(e.l, [t, n]), Li = class {
|
|
1391
|
+
constructor(e, t) {
|
|
1392
|
+
this.client = e, this.clock = t;
|
|
1393
|
+
}
|
|
1394
|
+
}, Ri = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, R = (e, t) => new Li(e, t), zi = (e) => {
|
|
1395
|
+
for (let [t, n] of e.doc.share.entries()) if (n === e) return t;
|
|
1396
|
+
throw w();
|
|
1397
|
+
}, Bi = (e, t) => {
|
|
1398
|
+
for (; t !== null;) {
|
|
1399
|
+
if (t.parent === e) return !0;
|
|
1400
|
+
t = t.parent._item;
|
|
1401
|
+
}
|
|
1402
|
+
return !1;
|
|
1403
|
+
}, Vi = class {
|
|
1404
|
+
constructor(e, t, n, r = 0) {
|
|
1405
|
+
this.type = e, this.tname = t, this.item = n, this.assoc = r;
|
|
1406
|
+
}
|
|
1407
|
+
}, Hi = (e) => new Vi(e.type == null ? null : R(e.type.client, e.type.clock), e.tname ?? null, e.item == null ? null : R(e.item.client, e.item.clock), e.assoc == null ? 0 : e.assoc), Ui = class {
|
|
1408
|
+
constructor(e, t, n = 0) {
|
|
1409
|
+
this.type = e, this.index = t, this.assoc = n;
|
|
1410
|
+
}
|
|
1411
|
+
}, Wi = (e, t, n = 0) => new Ui(e, t, n), Gi = (e, t, n) => {
|
|
1412
|
+
let r = null, i = null;
|
|
1413
|
+
return e._item === null ? i = zi(e) : r = R(e._item.id.client, e._item.id.clock), new Vi(r, i, t, n);
|
|
1414
|
+
}, Ki = (e, t, n = 0) => {
|
|
1415
|
+
let r = e._start;
|
|
1416
|
+
if (n < 0) {
|
|
1417
|
+
if (t === 0) return Gi(e, null, n);
|
|
1418
|
+
t--;
|
|
1419
|
+
}
|
|
1420
|
+
for (; r !== null;) {
|
|
1421
|
+
if (!r.deleted && r.countable) {
|
|
1422
|
+
if (r.length > t) return Gi(e, R(r.id.client, r.id.clock + t), n);
|
|
1423
|
+
t -= r.length;
|
|
1424
|
+
}
|
|
1425
|
+
if (r.right === null && n < 0) return Gi(e, r.lastId, n);
|
|
1426
|
+
r = r.right;
|
|
1427
|
+
}
|
|
1428
|
+
return Gi(e, null, n);
|
|
1429
|
+
}, qi = (e, t) => {
|
|
1430
|
+
let n = ra(e, t);
|
|
1431
|
+
return {
|
|
1432
|
+
item: n,
|
|
1433
|
+
diff: t.clock - n.id.clock
|
|
1434
|
+
};
|
|
1435
|
+
}, Ji = (e, t, n = !0) => {
|
|
1436
|
+
let r = t.store, i = e.item, a = e.type, o = e.tname, s = e.assoc, c = null, l = 0;
|
|
1437
|
+
if (i !== null) {
|
|
1438
|
+
if (B(r, i.client) <= i.clock) return null;
|
|
1439
|
+
let e = n ? ms(r, i) : qi(r, i), t = e.item;
|
|
1440
|
+
if (!(t instanceof Q)) return null;
|
|
1441
|
+
if (c = t.parent, c._item === null || !c._item.deleted) {
|
|
1442
|
+
l = t.deleted || !t.countable ? 0 : e.diff + (s >= 0 ? 0 : 1);
|
|
1443
|
+
let n = t.left;
|
|
1444
|
+
for (; n !== null;) !n.deleted && n.countable && (l += n.length), n = n.left;
|
|
1445
|
+
}
|
|
1446
|
+
} else {
|
|
1447
|
+
if (o !== null) c = t.get(o);
|
|
1448
|
+
else if (a !== null) {
|
|
1449
|
+
if (B(r, a.client) <= a.clock) return null;
|
|
1450
|
+
let { item: e } = n ? ms(r, a) : { item: ra(r, a) };
|
|
1451
|
+
if (e instanceof Q && e.content instanceof Z) c = e.content.type;
|
|
1452
|
+
else return null;
|
|
1453
|
+
} else throw w();
|
|
1454
|
+
l = s >= 0 ? c._length : 0;
|
|
1455
|
+
}
|
|
1456
|
+
return Wi(c, l, e.assoc);
|
|
1457
|
+
}, Yi = (e, t) => e === t || e !== null && t !== null && e.tname === t.tname && Ri(e.item, t.item) && Ri(e.type, t.type) && e.assoc === t.assoc, Xi = class {
|
|
1458
|
+
constructor(e, t) {
|
|
1459
|
+
this.ds = e, this.sv = t;
|
|
1460
|
+
}
|
|
1461
|
+
}, Zi = (e, t) => new Xi(e, t);
|
|
1462
|
+
Zi(ti(), /* @__PURE__ */ new Map());
|
|
1463
|
+
var Qi = (e) => Zi(ni(e.store), ta(e.store)), z = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !Zr(t.ds, e.id), $i = (e, t) => {
|
|
1464
|
+
let r = n(e.meta, $i, a), i = e.doc.store;
|
|
1465
|
+
r.has(t) || (t.sv.forEach((t, n) => {
|
|
1466
|
+
t < B(i, n) && H(e, R(n, t));
|
|
1467
|
+
}), I(e, t.ds, (e) => {}), r.add(t));
|
|
1468
|
+
}, ea = class {
|
|
1469
|
+
constructor() {
|
|
1470
|
+
this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
|
|
1471
|
+
}
|
|
1472
|
+
}, ta = (e) => {
|
|
1473
|
+
let t = /* @__PURE__ */ new Map();
|
|
1474
|
+
return e.clients.forEach((e, n) => {
|
|
1475
|
+
let r = e[e.length - 1];
|
|
1476
|
+
t.set(n, r.id.clock + r.length);
|
|
1477
|
+
}), t;
|
|
1478
|
+
}, B = (e, t) => {
|
|
1479
|
+
let n = e.clients.get(t);
|
|
1480
|
+
if (n === void 0) return 0;
|
|
1481
|
+
let r = n[n.length - 1];
|
|
1482
|
+
return r.id.clock + r.length;
|
|
1483
|
+
}, na = (e, t) => {
|
|
1484
|
+
let n = e.clients.get(t.id.client);
|
|
1485
|
+
if (n === void 0) n = [], e.clients.set(t.id.client, n);
|
|
1486
|
+
else {
|
|
1487
|
+
let e = n[n.length - 1];
|
|
1488
|
+
if (e.id.clock + e.length !== t.id.clock) throw w();
|
|
1489
|
+
}
|
|
1490
|
+
n.push(t);
|
|
1491
|
+
}, V = (e, t) => {
|
|
1492
|
+
let n = 0, r = e.length - 1, i = e[r], a = i.id.clock;
|
|
1493
|
+
if (a === t) return r;
|
|
1494
|
+
let o = m(t / (a + i.length - 1) * r);
|
|
1495
|
+
for (; n <= r;) {
|
|
1496
|
+
if (i = e[o], a = i.id.clock, a <= t) {
|
|
1497
|
+
if (t < a + i.length) return o;
|
|
1498
|
+
n = o + 1;
|
|
1499
|
+
} else r = o - 1;
|
|
1500
|
+
o = m((n + r) / 2);
|
|
1501
|
+
}
|
|
1502
|
+
throw w();
|
|
1503
|
+
}, ra = (e, t) => {
|
|
1504
|
+
let n = e.clients.get(t.client);
|
|
1505
|
+
return n[V(n, t.clock)];
|
|
1506
|
+
}, ia = (e, t, n) => {
|
|
1507
|
+
let r = V(t, n), i = t[r];
|
|
1508
|
+
return i.id.clock < n && i instanceof Q ? (t.splice(r + 1, 0, gs(e, i, n - i.id.clock)), r + 1) : r;
|
|
1509
|
+
}, H = (e, t) => {
|
|
1510
|
+
let n = e.doc.store.clients.get(t.client);
|
|
1511
|
+
return n[ia(e, n, t.clock)];
|
|
1512
|
+
}, aa = (e, t, n) => {
|
|
1513
|
+
let r = t.clients.get(n.client), i = V(r, n.clock), a = r[i];
|
|
1514
|
+
return n.clock !== a.id.clock + a.length - 1 && a.constructor !== J && r.splice(i + 1, 0, gs(e, a, n.clock - a.id.clock + 1)), a;
|
|
1515
|
+
}, oa = (e, t, n) => {
|
|
1516
|
+
let r = e.clients.get(t.id.client);
|
|
1517
|
+
r[V(r, t.id.clock)] = n;
|
|
1518
|
+
}, sa = (e, t, n, r, i) => {
|
|
1519
|
+
if (r === 0) return;
|
|
1520
|
+
let a = n + r, o = ia(e, t, n), s;
|
|
1521
|
+
do
|
|
1522
|
+
s = t[o++], a < s.id.clock + s.length && ia(e, t, a), i(s);
|
|
1523
|
+
while (o < t.length && t[o].id.clock < a);
|
|
1524
|
+
}, ca = class {
|
|
1525
|
+
constructor(e, t, n) {
|
|
1526
|
+
this.doc = e, this.deleteSet = new Yr(), this.beforeState = ta(e.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = t, this.meta = /* @__PURE__ */ new Map(), this.local = n, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
|
|
1527
|
+
}
|
|
1528
|
+
}, la = (e, t) => t.deleteSet.clients.size === 0 && !i(t.afterState, (e, n) => t.beforeState.get(n) !== e) ? !1 : (Qr(t.deleteSet), yi(e, t), ri(e, t.deleteSet), !0), ua = (e, t, r) => {
|
|
1529
|
+
let i = t._item;
|
|
1530
|
+
(i === null || i.id.clock < (e.beforeState.get(i.id.client) || 0) && !i.deleted) && n(e.changed, t, a).add(r);
|
|
1531
|
+
}, da = (e, t) => {
|
|
1532
|
+
let n = e[t], r = e[t - 1], i = t;
|
|
1533
|
+
for (; i > 0; n = r, r = e[--i - 1]) {
|
|
1534
|
+
if (r.deleted === n.deleted && r.constructor === n.constructor && r.mergeWith(n)) {
|
|
1535
|
+
n instanceof Q && n.parentSub !== null && n.parent._map.get(n.parentSub) === n && n.parent._map.set(n.parentSub, r);
|
|
1536
|
+
continue;
|
|
1537
|
+
}
|
|
1538
|
+
break;
|
|
1539
|
+
}
|
|
1540
|
+
let a = t - i;
|
|
1541
|
+
return a && e.splice(t + 1 - a, a), a;
|
|
1542
|
+
}, fa = (e, t, n) => {
|
|
1543
|
+
for (let [r, i] of e.clients.entries()) {
|
|
1544
|
+
let e = t.clients.get(r);
|
|
1545
|
+
for (let r = i.length - 1; r >= 0; r--) {
|
|
1546
|
+
let a = i[r], o = a.clock + a.len;
|
|
1547
|
+
for (let r = V(e, a.clock), i = e[r]; r < e.length && i.id.clock < o; i = e[++r]) {
|
|
1548
|
+
let i = e[r];
|
|
1549
|
+
if (a.clock + a.len <= i.id.clock) break;
|
|
1550
|
+
i instanceof Q && i.deleted && !i.keep && n(i) && i.gc(t, !1);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}, pa = (e, t) => {
|
|
1555
|
+
e.clients.forEach((e, n) => {
|
|
1556
|
+
let r = t.clients.get(n);
|
|
1557
|
+
for (let t = e.length - 1; t >= 0; t--) {
|
|
1558
|
+
let n = e[t], i = ne(r.length - 1, 1 + V(r, n.clock + n.len - 1));
|
|
1559
|
+
for (let e = i, t = r[e]; e > 0 && t.id.clock >= n.clock; t = r[e]) e -= 1 + da(r, e);
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1562
|
+
}, ma = (e, t) => {
|
|
1563
|
+
if (t < e.length) {
|
|
1564
|
+
let n = e[t], r = n.doc, i = r.store, a = n.deleteSet, o = n._mergeStructs;
|
|
1565
|
+
try {
|
|
1566
|
+
Qr(a), n.afterState = ta(n.doc.store), r.emit("beforeObserverCalls", [n, r]);
|
|
1567
|
+
let e = [];
|
|
1568
|
+
n.changed.forEach((t, r) => e.push(() => {
|
|
1569
|
+
(r._item === null || !r._item.deleted) && r._callObserver(n, t);
|
|
1570
|
+
})), e.push(() => {
|
|
1571
|
+
n.changedParentTypes.forEach((t, r) => {
|
|
1572
|
+
r._dEH.l.length > 0 && (r._item === null || !r._item.deleted) && (t = t.filter((e) => e.target._item === null || !e.target._item.deleted), t.forEach((e) => {
|
|
1573
|
+
e.currentTarget = r, e._path = null;
|
|
1574
|
+
}), t.sort((e, t) => e.path.length - t.path.length), e.push(() => {
|
|
1575
|
+
Ii(r._dEH, t, n);
|
|
1576
|
+
}));
|
|
1577
|
+
}), e.push(() => r.emit("afterTransaction", [n, r])), e.push(() => {
|
|
1578
|
+
n._needFormattingCleanup && Eo(n);
|
|
1579
|
+
});
|
|
1580
|
+
}), Ht(e, []);
|
|
1581
|
+
} finally {
|
|
1582
|
+
r.gc && fa(a, i, r.gcFilter), pa(a, i), n.afterState.forEach((e, t) => {
|
|
1583
|
+
let r = n.beforeState.get(t) || 0;
|
|
1584
|
+
if (r !== e) {
|
|
1585
|
+
let e = i.clients.get(t), n = h(V(e, r), 1);
|
|
1586
|
+
for (let t = e.length - 1; t >= n;) t -= 1 + da(e, t);
|
|
1587
|
+
}
|
|
1588
|
+
});
|
|
1589
|
+
for (let e = o.length - 1; e >= 0; e--) {
|
|
1590
|
+
let { client: t, clock: n } = o[e].id, r = i.clients.get(t), a = V(r, n);
|
|
1591
|
+
a + 1 < r.length && da(r, a + 1) > 1 || a > 0 && da(r, a);
|
|
1592
|
+
}
|
|
1593
|
+
if (!n.local && n.afterState.get(r.clientID) !== n.beforeState.get(r.clientID) && (Hr(Lr, Ar, "[yjs] ", jr, Fr, "Changed the client-id because another client seems to be using it."), r.clientID = oi()), r.emit("afterTransactionCleanup", [n, r]), r._observers.has("update")) {
|
|
1594
|
+
let e = new pi();
|
|
1595
|
+
la(e, n) && r.emit("update", [
|
|
1596
|
+
e.toUint8Array(),
|
|
1597
|
+
n.origin,
|
|
1598
|
+
r,
|
|
1599
|
+
n
|
|
1600
|
+
]);
|
|
1601
|
+
}
|
|
1602
|
+
if (r._observers.has("updateV2")) {
|
|
1603
|
+
let e = new L();
|
|
1604
|
+
la(e, n) && r.emit("updateV2", [
|
|
1605
|
+
e.toUint8Array(),
|
|
1606
|
+
n.origin,
|
|
1607
|
+
r,
|
|
1608
|
+
n
|
|
1609
|
+
]);
|
|
1610
|
+
}
|
|
1611
|
+
let { subdocsAdded: s, subdocsLoaded: c, subdocsRemoved: l } = n;
|
|
1612
|
+
(s.size > 0 || l.size > 0 || c.size > 0) && (s.forEach((e) => {
|
|
1613
|
+
e.clientID = r.clientID, e.collectionid ??= r.collectionid, r.subdocs.add(e);
|
|
1614
|
+
}), l.forEach((e) => r.subdocs.delete(e)), r.emit("subdocs", [
|
|
1615
|
+
{
|
|
1616
|
+
loaded: c,
|
|
1617
|
+
added: s,
|
|
1618
|
+
removed: l
|
|
1619
|
+
},
|
|
1620
|
+
r,
|
|
1621
|
+
n
|
|
1622
|
+
]), l.forEach((e) => e.destroy())), e.length <= t + 1 ? (r._transactionCleanups = [], r.emit("afterAllTransactions", [r, e])) : ma(e, t + 1);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
}, U = (e, t, n = null, r = !0) => {
|
|
1626
|
+
let i = e._transactionCleanups, a = !1, o = null;
|
|
1627
|
+
e._transaction === null && (a = !0, e._transaction = new ca(e, n, r), i.push(e._transaction), i.length === 1 && e.emit("beforeAllTransactions", [e]), e.emit("beforeTransaction", [e._transaction, e]));
|
|
1628
|
+
try {
|
|
1629
|
+
o = t(e._transaction);
|
|
1630
|
+
} finally {
|
|
1631
|
+
if (a) {
|
|
1632
|
+
let t = e._transaction === i[0];
|
|
1633
|
+
e._transaction = null, t && ma(i, 0);
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
return o;
|
|
1637
|
+
}, ha = class {
|
|
1638
|
+
constructor(e, t) {
|
|
1639
|
+
this.insertions = t, this.deletions = e, this.meta = /* @__PURE__ */ new Map();
|
|
1640
|
+
}
|
|
1641
|
+
}, ga = (e, t, n) => {
|
|
1642
|
+
I(e, n.deletions, (n) => {
|
|
1643
|
+
n instanceof Q && t.scope.some((t) => t === e.doc || Bi(t, n)) && hs(n, !1);
|
|
1644
|
+
});
|
|
1645
|
+
}, _a = (e, t, n) => {
|
|
1646
|
+
let r = null, i = e.doc, a = e.scope;
|
|
1647
|
+
U(i, (n) => {
|
|
1648
|
+
for (; t.length > 0 && e.currStackItem === null;) {
|
|
1649
|
+
let r = i.store, o = t.pop(), s = /* @__PURE__ */ new Set(), c = [], l = !1;
|
|
1650
|
+
I(n, o.insertions, (e) => {
|
|
1651
|
+
if (e instanceof Q) {
|
|
1652
|
+
if (e.redone !== null) {
|
|
1653
|
+
let { item: t, diff: i } = ms(r, e.id);
|
|
1654
|
+
i > 0 && (t = H(n, R(t.id.client, t.id.clock + i))), e = t;
|
|
1655
|
+
}
|
|
1656
|
+
!e.deleted && a.some((t) => t === n.doc || Bi(t, e)) && c.push(e);
|
|
1657
|
+
}
|
|
1658
|
+
}), I(n, o.deletions, (e) => {
|
|
1659
|
+
e instanceof Q && a.some((t) => t === n.doc || Bi(t, e)) && !Zr(o.insertions, e.id) && s.add(e);
|
|
1660
|
+
}), s.forEach((t) => {
|
|
1661
|
+
l = vs(n, t, s, o.insertions, e.ignoreRemoteMapChanges, e) !== null || l;
|
|
1662
|
+
});
|
|
1663
|
+
for (let t = c.length - 1; t >= 0; t--) {
|
|
1664
|
+
let r = c[t];
|
|
1665
|
+
e.deleteFilter(r) && (r.delete(n), l = !0);
|
|
1666
|
+
}
|
|
1667
|
+
e.currStackItem = l ? o : null;
|
|
1668
|
+
}
|
|
1669
|
+
n.changed.forEach((e, t) => {
|
|
1670
|
+
e.has(null) && t._searchMarker && (t._searchMarker.length = 0);
|
|
1671
|
+
}), r = n;
|
|
1672
|
+
}, e);
|
|
1673
|
+
let o = e.currStackItem;
|
|
1674
|
+
if (o != null) {
|
|
1675
|
+
let t = r.changedParentTypes;
|
|
1676
|
+
e.emit("stack-item-popped", [{
|
|
1677
|
+
stackItem: o,
|
|
1678
|
+
type: n,
|
|
1679
|
+
changedParentTypes: t,
|
|
1680
|
+
origin: e
|
|
1681
|
+
}, e]), e.currStackItem = null;
|
|
1682
|
+
}
|
|
1683
|
+
return o;
|
|
1684
|
+
}, va = class extends p {
|
|
1685
|
+
constructor(e, { captureTimeout: t = 500, captureTransaction: n = (e) => !0, deleteFilter: r = () => !0, trackedOrigins: i = /* @__PURE__ */ new Set([null]), ignoreRemoteMapChanges: a = !1, doc: o = f(e) ? e[0].doc : e instanceof si ? e : e.doc } = {}) {
|
|
1686
|
+
super(), this.scope = [], this.doc = o, this.addToScope(e), this.deleteFilter = r, i.add(this), this.trackedOrigins = i, this.captureTransaction = n, this.undoStack = [], this.redoStack = [], this.undoing = !1, this.redoing = !1, this.currStackItem = null, this.lastChange = 0, this.ignoreRemoteMapChanges = a, this.captureTimeout = t, this.afterTransactionHandler = (e) => {
|
|
1687
|
+
if (!this.captureTransaction(e) || !this.scope.some((t) => e.changedParentTypes.has(t) || t === this.doc) || !this.trackedOrigins.has(e.origin) && (!e.origin || !this.trackedOrigins.has(e.origin.constructor))) return;
|
|
1688
|
+
let t = this.undoing, n = this.redoing, r = t ? this.redoStack : this.undoStack;
|
|
1689
|
+
t ? this.stopCapturing() : n || this.clear(!1, !0);
|
|
1690
|
+
let i = new Yr();
|
|
1691
|
+
e.afterState.forEach((t, n) => {
|
|
1692
|
+
let r = e.beforeState.get(n) || 0, a = t - r;
|
|
1693
|
+
a > 0 && ei(i, n, r, a);
|
|
1694
|
+
});
|
|
1695
|
+
let a = bt(), o = !1;
|
|
1696
|
+
if (this.lastChange > 0 && a - this.lastChange < this.captureTimeout && r.length > 0 && !t && !n) {
|
|
1697
|
+
let t = r[r.length - 1];
|
|
1698
|
+
t.deletions = $r([t.deletions, e.deleteSet]), t.insertions = $r([t.insertions, i]);
|
|
1699
|
+
} else r.push(new ha(e.deleteSet, i)), o = !0;
|
|
1700
|
+
!t && !n && (this.lastChange = a), I(e, e.deleteSet, (t) => {
|
|
1701
|
+
t instanceof Q && this.scope.some((n) => n === e.doc || Bi(n, t)) && hs(t, !0);
|
|
1702
|
+
});
|
|
1703
|
+
let s = [{
|
|
1704
|
+
stackItem: r[r.length - 1],
|
|
1705
|
+
origin: e.origin,
|
|
1706
|
+
type: t ? "redo" : "undo",
|
|
1707
|
+
changedParentTypes: e.changedParentTypes
|
|
1708
|
+
}, this];
|
|
1709
|
+
o ? this.emit("stack-item-added", s) : this.emit("stack-item-updated", s);
|
|
1710
|
+
}, this.doc.on("afterTransaction", this.afterTransactionHandler), this.doc.on("destroy", () => {
|
|
1711
|
+
this.destroy();
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
addToScope(e) {
|
|
1715
|
+
let t = new Set(this.scope);
|
|
1716
|
+
e = f(e) ? e : [e], e.forEach((e) => {
|
|
1717
|
+
t.has(e) || (t.add(e), (e instanceof K ? e.doc !== this.doc : e !== this.doc) && Ur("[yjs#509] Not same Y.Doc"), this.scope.push(e));
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
addTrackedOrigin(e) {
|
|
1721
|
+
this.trackedOrigins.add(e);
|
|
1722
|
+
}
|
|
1723
|
+
removeTrackedOrigin(e) {
|
|
1724
|
+
this.trackedOrigins.delete(e);
|
|
1725
|
+
}
|
|
1726
|
+
clear(e = !0, t = !0) {
|
|
1727
|
+
(e && this.canUndo() || t && this.canRedo()) && this.doc.transact((n) => {
|
|
1728
|
+
e && (this.undoStack.forEach((e) => ga(n, this, e)), this.undoStack = []), t && (this.redoStack.forEach((e) => ga(n, this, e)), this.redoStack = []), this.emit("stack-cleared", [{
|
|
1729
|
+
undoStackCleared: e,
|
|
1730
|
+
redoStackCleared: t
|
|
1731
|
+
}]);
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
stopCapturing() {
|
|
1735
|
+
this.lastChange = 0;
|
|
1736
|
+
}
|
|
1737
|
+
undo() {
|
|
1738
|
+
this.undoing = !0;
|
|
1739
|
+
let e;
|
|
1740
|
+
try {
|
|
1741
|
+
e = _a(this, this.undoStack, "undo");
|
|
1742
|
+
} finally {
|
|
1743
|
+
this.undoing = !1;
|
|
1744
|
+
}
|
|
1745
|
+
return e;
|
|
1746
|
+
}
|
|
1747
|
+
redo() {
|
|
1748
|
+
this.redoing = !0;
|
|
1749
|
+
let e;
|
|
1750
|
+
try {
|
|
1751
|
+
e = _a(this, this.redoStack, "redo");
|
|
1752
|
+
} finally {
|
|
1753
|
+
this.redoing = !1;
|
|
1754
|
+
}
|
|
1755
|
+
return e;
|
|
1756
|
+
}
|
|
1757
|
+
canUndo() {
|
|
1758
|
+
return this.undoStack.length > 0;
|
|
1759
|
+
}
|
|
1760
|
+
canRedo() {
|
|
1761
|
+
return this.redoStack.length > 0;
|
|
1762
|
+
}
|
|
1763
|
+
destroy() {
|
|
1764
|
+
this.trackedOrigins.delete(this), this.doc.off("afterTransaction", this.afterTransactionHandler), super.destroy();
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1767
|
+
function* ya(e) {
|
|
1768
|
+
let t = D(e.restDecoder);
|
|
1769
|
+
for (let n = 0; n < t; n++) {
|
|
1770
|
+
let t = D(e.restDecoder), n = e.readClient(), r = D(e.restDecoder);
|
|
1771
|
+
for (let i = 0; i < t; i++) {
|
|
1772
|
+
let t = e.readInfo();
|
|
1773
|
+
if (t === 10) {
|
|
1774
|
+
let t = D(e.restDecoder);
|
|
1775
|
+
yield new $(R(n, r), t), r += t;
|
|
1776
|
+
} else if (31 & t) {
|
|
1777
|
+
let i = (t & 192) == 0, a = new Q(R(n, r), null, (t & 128) == 128 ? e.readLeftID() : null, null, (t & 64) == 64 ? e.readRightID() : null, i ? e.readParentInfo() ? e.readString() : e.readLeftID() : null, i && (t & 32) == 32 ? e.readString() : null, ys(e, t));
|
|
1778
|
+
yield a, r += a.length;
|
|
1779
|
+
} else {
|
|
1780
|
+
let t = e.readLen();
|
|
1781
|
+
yield new J(R(n, r), t), r += t;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
var ba = class {
|
|
1787
|
+
constructor(e, t) {
|
|
1788
|
+
this.gen = ya(e), this.curr = null, this.done = !1, this.filterSkips = t, this.next();
|
|
1789
|
+
}
|
|
1790
|
+
next() {
|
|
1791
|
+
do
|
|
1792
|
+
this.curr = this.gen.next().value || null;
|
|
1793
|
+
while (this.filterSkips && this.curr !== null && this.curr.constructor === $);
|
|
1794
|
+
return this.curr;
|
|
1795
|
+
}
|
|
1796
|
+
}, xa = class {
|
|
1797
|
+
constructor(e) {
|
|
1798
|
+
this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = e, this.clientStructs = [];
|
|
1799
|
+
}
|
|
1800
|
+
}, Sa = (e) => wa(e, li, pi), Ca = (e, t) => {
|
|
1801
|
+
if (e.constructor === J) {
|
|
1802
|
+
let { client: n, clock: r } = e.id;
|
|
1803
|
+
return new J(R(n, r + t), e.length - t);
|
|
1804
|
+
} else if (e.constructor === $) {
|
|
1805
|
+
let { client: n, clock: r } = e.id;
|
|
1806
|
+
return new $(R(n, r + t), e.length - t);
|
|
1807
|
+
} else {
|
|
1808
|
+
let n = e, { client: r, clock: i } = n.id;
|
|
1809
|
+
return new Q(R(r, i + t), null, R(r, i + t - 1), null, n.rightOrigin, n.parent, n.parentSub, n.content.splice(t));
|
|
1810
|
+
}
|
|
1811
|
+
}, wa = (e, t = di, n = L) => {
|
|
1812
|
+
if (e.length === 1) return e[0];
|
|
1813
|
+
let r = e.map((e) => new t(T(e))), i = r.map((e) => new ba(e, !0)), a = null, o = new n(), s = new xa(o);
|
|
1814
|
+
for (; i = i.filter((e) => e.curr !== null), i.sort((e, t) => {
|
|
1815
|
+
if (e.curr.id.client === t.curr.id.client) {
|
|
1816
|
+
let n = e.curr.id.clock - t.curr.id.clock;
|
|
1817
|
+
return n === 0 ? e.curr.constructor === t.curr.constructor ? 0 : e.curr.constructor === $ ? 1 : -1 : n;
|
|
1818
|
+
} else return t.curr.id.client - e.curr.id.client;
|
|
1819
|
+
}), i.length !== 0;) {
|
|
1820
|
+
let e = i[0], t = e.curr.id.client;
|
|
1821
|
+
if (a !== null) {
|
|
1822
|
+
let n = e.curr, r = !1;
|
|
1823
|
+
for (; n !== null && n.id.clock + n.length <= a.struct.id.clock + a.struct.length && n.id.client >= a.struct.id.client;) n = e.next(), r = !0;
|
|
1824
|
+
if (n === null || n.id.client !== t || r && n.id.clock > a.struct.id.clock + a.struct.length) continue;
|
|
1825
|
+
if (t !== a.struct.id.client) W(s, a.struct, a.offset), a = {
|
|
1826
|
+
struct: n,
|
|
1827
|
+
offset: 0
|
|
1828
|
+
}, e.next();
|
|
1829
|
+
else if (a.struct.id.clock + a.struct.length < n.id.clock) if (a.struct.constructor === $) a.struct.length = n.id.clock + n.length - a.struct.id.clock;
|
|
1830
|
+
else {
|
|
1831
|
+
W(s, a.struct, a.offset);
|
|
1832
|
+
let e = n.id.clock - a.struct.id.clock - a.struct.length;
|
|
1833
|
+
a = {
|
|
1834
|
+
struct: new $(R(t, a.struct.id.clock + a.struct.length), e),
|
|
1835
|
+
offset: 0
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
else {
|
|
1839
|
+
let t = a.struct.id.clock + a.struct.length - n.id.clock;
|
|
1840
|
+
t > 0 && (a.struct.constructor === $ ? a.struct.length -= t : n = Ca(n, t)), a.struct.mergeWith(n) || (W(s, a.struct, a.offset), a = {
|
|
1841
|
+
struct: n,
|
|
1842
|
+
offset: 0
|
|
1843
|
+
}, e.next());
|
|
1844
|
+
}
|
|
1845
|
+
} else a = {
|
|
1846
|
+
struct: e.curr,
|
|
1847
|
+
offset: 0
|
|
1848
|
+
}, e.next();
|
|
1849
|
+
for (let n = e.curr; n !== null && n.id.client === t && n.id.clock === a.struct.id.clock + a.struct.length && n.constructor !== $; n = e.next()) W(s, a.struct, a.offset), a = {
|
|
1850
|
+
struct: n,
|
|
1851
|
+
offset: 0
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
return a !== null && (W(s, a.struct, a.offset), a = null), Da(s), ri(o, $r(r.map((e) => ii(e)))), o.toUint8Array();
|
|
1855
|
+
}, Ta = (e, t, n = di, r = L) => {
|
|
1856
|
+
let i = Di(t), a = new r(), o = new xa(a), s = new n(T(e)), c = new ba(s, !1);
|
|
1857
|
+
for (; c.curr;) {
|
|
1858
|
+
let e = c.curr, t = e.id.client, n = i.get(t) || 0;
|
|
1859
|
+
if (c.curr.constructor === $) {
|
|
1860
|
+
c.next();
|
|
1861
|
+
continue;
|
|
1862
|
+
}
|
|
1863
|
+
if (e.id.clock + e.length > n) for (W(o, e, h(n - e.id.clock, 0)), c.next(); c.curr && c.curr.id.client === t;) W(o, c.curr, 0), c.next();
|
|
1864
|
+
else for (; c.curr && c.curr.id.client === t && c.curr.id.clock + c.curr.length <= n;) c.next();
|
|
1865
|
+
}
|
|
1866
|
+
return Da(o), ri(a, ii(s)), a.toUint8Array();
|
|
1867
|
+
}, Ea = (e) => {
|
|
1868
|
+
e.written > 0 && (e.clientStructs.push({
|
|
1869
|
+
written: e.written,
|
|
1870
|
+
restEncoder: _(e.encoder.restEncoder)
|
|
1871
|
+
}), e.encoder.restEncoder = g(), e.written = 0);
|
|
1872
|
+
}, W = (e, t, n) => {
|
|
1873
|
+
e.written > 0 && e.currClient !== t.id.client && Ea(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), y(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
|
|
1874
|
+
}, Da = (e) => {
|
|
1875
|
+
Ea(e);
|
|
1876
|
+
let t = e.encoder.restEncoder;
|
|
1877
|
+
y(t, e.clientStructs.length);
|
|
1878
|
+
for (let n = 0; n < e.clientStructs.length; n++) {
|
|
1879
|
+
let r = e.clientStructs[n];
|
|
1880
|
+
y(t, r.written), Be(t, r.restEncoder);
|
|
1881
|
+
}
|
|
1882
|
+
}, Oa = (e, t, n, r) => {
|
|
1883
|
+
let i = new n(T(e)), a = new ba(i, !1), o = new r(), s = new xa(o);
|
|
1884
|
+
for (let e = a.curr; e !== null; e = a.next()) W(s, t(e), 0);
|
|
1885
|
+
return Da(s), ri(o, ii(i)), o.toUint8Array();
|
|
1886
|
+
}, ka = (e) => Oa(e, Ut, di, pi), Aa = "You must not compute changes after the event-handler fired.", ja = class {
|
|
1887
|
+
constructor(e, t) {
|
|
1888
|
+
this.target = e, this.currentTarget = e, this.transaction = t, this._changes = null, this._keys = null, this._delta = null, this._path = null;
|
|
1889
|
+
}
|
|
1890
|
+
get path() {
|
|
1891
|
+
return this._path ||= Ma(this.currentTarget, this.target);
|
|
1892
|
+
}
|
|
1893
|
+
deletes(e) {
|
|
1894
|
+
return Zr(this.transaction.deleteSet, e.id);
|
|
1895
|
+
}
|
|
1896
|
+
get keys() {
|
|
1897
|
+
if (this._keys === null) {
|
|
1898
|
+
if (this.transaction.doc._transactionCleanups.length === 0) throw S(Aa);
|
|
1899
|
+
let e = /* @__PURE__ */ new Map(), t = this.target;
|
|
1900
|
+
this.transaction.changed.get(t).forEach((n) => {
|
|
1901
|
+
if (n !== null) {
|
|
1902
|
+
let r = t._map.get(n), i, a;
|
|
1903
|
+
if (this.adds(r)) {
|
|
1904
|
+
let e = r.left;
|
|
1905
|
+
for (; e !== null && this.adds(e);) e = e.left;
|
|
1906
|
+
if (this.deletes(r)) if (e !== null && this.deletes(e)) i = "delete", a = o(e.content.getContent());
|
|
1907
|
+
else return;
|
|
1908
|
+
else e !== null && this.deletes(e) ? (i = "update", a = o(e.content.getContent())) : (i = "add", a = void 0);
|
|
1909
|
+
} else if (this.deletes(r)) i = "delete", a = o(r.content.getContent());
|
|
1910
|
+
else return;
|
|
1911
|
+
e.set(n, {
|
|
1912
|
+
action: i,
|
|
1913
|
+
oldValue: a
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
}), this._keys = e;
|
|
1917
|
+
}
|
|
1918
|
+
return this._keys;
|
|
1919
|
+
}
|
|
1920
|
+
get delta() {
|
|
1921
|
+
return this.changes.delta;
|
|
1922
|
+
}
|
|
1923
|
+
adds(e) {
|
|
1924
|
+
return e.id.clock >= (this.transaction.beforeState.get(e.id.client) || 0);
|
|
1925
|
+
}
|
|
1926
|
+
get changes() {
|
|
1927
|
+
let e = this._changes;
|
|
1928
|
+
if (e === null) {
|
|
1929
|
+
if (this.transaction.doc._transactionCleanups.length === 0) throw S(Aa);
|
|
1930
|
+
let t = this.target, n = a(), r = a(), i = [];
|
|
1931
|
+
if (e = {
|
|
1932
|
+
added: n,
|
|
1933
|
+
deleted: r,
|
|
1934
|
+
delta: i,
|
|
1935
|
+
keys: this.keys
|
|
1936
|
+
}, this.transaction.changed.get(t).has(null)) {
|
|
1937
|
+
let e = null, a = () => {
|
|
1938
|
+
e && i.push(e);
|
|
1939
|
+
};
|
|
1940
|
+
for (let i = t._start; i !== null; i = i.right) i.deleted ? this.deletes(i) && !this.adds(i) && ((e === null || e.delete === void 0) && (a(), e = { delete: 0 }), e.delete += i.length, r.add(i)) : this.adds(i) ? ((e === null || e.insert === void 0) && (a(), e = { insert: [] }), e.insert = e.insert.concat(i.content.getContent()), n.add(i)) : ((e === null || e.retain === void 0) && (a(), e = { retain: 0 }), e.retain += i.length);
|
|
1941
|
+
e !== null && e.retain === void 0 && a();
|
|
1942
|
+
}
|
|
1943
|
+
this._changes = e;
|
|
1944
|
+
}
|
|
1945
|
+
return e;
|
|
1946
|
+
}
|
|
1947
|
+
}, Ma = (e, t) => {
|
|
1948
|
+
let n = [];
|
|
1949
|
+
for (; t._item !== null && t !== e;) {
|
|
1950
|
+
if (t._item.parentSub !== null) n.unshift(t._item.parentSub);
|
|
1951
|
+
else {
|
|
1952
|
+
let e = 0, r = t._item.parent._start;
|
|
1953
|
+
for (; r !== t._item && r !== null;) !r.deleted && r.countable && (e += r.length), r = r.right;
|
|
1954
|
+
n.unshift(e);
|
|
1955
|
+
}
|
|
1956
|
+
t = t._item.parent;
|
|
1957
|
+
}
|
|
1958
|
+
return n;
|
|
1959
|
+
}, G = () => {
|
|
1960
|
+
Ur("Invalid access: Add Yjs type to a document before reading data.");
|
|
1961
|
+
}, Na = 80, Pa = 0, Fa = class {
|
|
1962
|
+
constructor(e, t) {
|
|
1963
|
+
e.marker = !0, this.p = e, this.index = t, this.timestamp = Pa++;
|
|
1964
|
+
}
|
|
1965
|
+
}, Ia = (e) => {
|
|
1966
|
+
e.timestamp = Pa++;
|
|
1967
|
+
}, La = (e, t, n) => {
|
|
1968
|
+
e.p.marker = !1, e.p = t, t.marker = !0, e.index = n, e.timestamp = Pa++;
|
|
1969
|
+
}, Ra = (e, t, n) => {
|
|
1970
|
+
if (e.length >= Na) {
|
|
1971
|
+
let r = e.reduce((e, t) => e.timestamp < t.timestamp ? e : t);
|
|
1972
|
+
return La(r, t, n), r;
|
|
1973
|
+
} else {
|
|
1974
|
+
let r = new Fa(t, n);
|
|
1975
|
+
return e.push(r), r;
|
|
1976
|
+
}
|
|
1977
|
+
}, za = (e, t) => {
|
|
1978
|
+
if (e._start === null || t === 0 || e._searchMarker === null) return null;
|
|
1979
|
+
let n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((e, n) => te(t - e.index) < te(t - n.index) ? e : n), r = e._start, i = 0;
|
|
1980
|
+
for (n !== null && (r = n.p, i = n.index, Ia(n)); r.right !== null && i < t;) {
|
|
1981
|
+
if (!r.deleted && r.countable) {
|
|
1982
|
+
if (t < i + r.length) break;
|
|
1983
|
+
i += r.length;
|
|
1984
|
+
}
|
|
1985
|
+
r = r.right;
|
|
1986
|
+
}
|
|
1987
|
+
for (; r.left !== null && i > t;) r = r.left, !r.deleted && r.countable && (i -= r.length);
|
|
1988
|
+
for (; r.left !== null && r.left.id.client === r.id.client && r.left.id.clock + r.left.length === r.id.clock;) r = r.left, !r.deleted && r.countable && (i -= r.length);
|
|
1989
|
+
return n !== null && te(n.index - i) < r.parent.length / Na ? (La(n, r, i), n) : Ra(e._searchMarker, r, i);
|
|
1990
|
+
}, Ba = (e, t, n) => {
|
|
1991
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
1992
|
+
let i = e[r];
|
|
1993
|
+
if (n > 0) {
|
|
1994
|
+
let t = i.p;
|
|
1995
|
+
for (t.marker = !1; t && (t.deleted || !t.countable);) t = t.left, t && !t.deleted && t.countable && (i.index -= t.length);
|
|
1996
|
+
if (t === null || t.marker === !0) {
|
|
1997
|
+
e.splice(r, 1);
|
|
1998
|
+
continue;
|
|
1999
|
+
}
|
|
2000
|
+
i.p = t, t.marker = !0;
|
|
2001
|
+
}
|
|
2002
|
+
(t < i.index || n > 0 && t === i.index) && (i.index = h(t, i.index + n));
|
|
2003
|
+
}
|
|
2004
|
+
}, Va = (e, t, r) => {
|
|
2005
|
+
let i = e, a = t.changedParentTypes;
|
|
2006
|
+
for (; n(a, e, () => []).push(r), e._item !== null;) e = e._item.parent;
|
|
2007
|
+
Ii(i._eH, r, t);
|
|
2008
|
+
}, K = class {
|
|
2009
|
+
constructor() {
|
|
2010
|
+
this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = Ni(), this._dEH = Ni(), this._searchMarker = null;
|
|
2011
|
+
}
|
|
2012
|
+
get parent() {
|
|
2013
|
+
return this._item ? this._item.parent : null;
|
|
2014
|
+
}
|
|
2015
|
+
_integrate(e, t) {
|
|
2016
|
+
this.doc = e, this._item = t;
|
|
2017
|
+
}
|
|
2018
|
+
_copy() {
|
|
2019
|
+
throw C();
|
|
2020
|
+
}
|
|
2021
|
+
clone() {
|
|
2022
|
+
throw C();
|
|
2023
|
+
}
|
|
2024
|
+
_write(e) {}
|
|
2025
|
+
get _first() {
|
|
2026
|
+
let e = this._start;
|
|
2027
|
+
for (; e !== null && e.deleted;) e = e.right;
|
|
2028
|
+
return e;
|
|
2029
|
+
}
|
|
2030
|
+
_callObserver(e, t) {
|
|
2031
|
+
!e.local && this._searchMarker && (this._searchMarker.length = 0);
|
|
2032
|
+
}
|
|
2033
|
+
observe(e) {
|
|
2034
|
+
Pi(this._eH, e);
|
|
2035
|
+
}
|
|
2036
|
+
observeDeep(e) {
|
|
2037
|
+
Pi(this._dEH, e);
|
|
2038
|
+
}
|
|
2039
|
+
unobserve(e) {
|
|
2040
|
+
Fi(this._eH, e);
|
|
2041
|
+
}
|
|
2042
|
+
unobserveDeep(e) {
|
|
2043
|
+
Fi(this._dEH, e);
|
|
2044
|
+
}
|
|
2045
|
+
toJSON() {}
|
|
2046
|
+
}, Ha = (e, t, n) => {
|
|
2047
|
+
e.doc ?? G(), t < 0 && (t = e._length + t), n < 0 && (n = e._length + n);
|
|
2048
|
+
let r = n - t, i = [], a = e._start;
|
|
2049
|
+
for (; a !== null && r > 0;) {
|
|
2050
|
+
if (a.countable && !a.deleted) {
|
|
2051
|
+
let e = a.content.getContent();
|
|
2052
|
+
if (e.length <= t) t -= e.length;
|
|
2053
|
+
else {
|
|
2054
|
+
for (let n = t; n < e.length && r > 0; n++) i.push(e[n]), r--;
|
|
2055
|
+
t = 0;
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
a = a.right;
|
|
2059
|
+
}
|
|
2060
|
+
return i;
|
|
2061
|
+
}, Ua = (e) => {
|
|
2062
|
+
e.doc ?? G();
|
|
2063
|
+
let t = [], n = e._start;
|
|
2064
|
+
for (; n !== null;) {
|
|
2065
|
+
if (n.countable && !n.deleted) {
|
|
2066
|
+
let e = n.content.getContent();
|
|
2067
|
+
for (let n = 0; n < e.length; n++) t.push(e[n]);
|
|
2068
|
+
}
|
|
2069
|
+
n = n.right;
|
|
2070
|
+
}
|
|
2071
|
+
return t;
|
|
2072
|
+
}, Wa = (e, t) => {
|
|
2073
|
+
let n = [], r = e._start;
|
|
2074
|
+
for (; r !== null;) {
|
|
2075
|
+
if (r.countable && z(r, t)) {
|
|
2076
|
+
let e = r.content.getContent();
|
|
2077
|
+
for (let t = 0; t < e.length; t++) n.push(e[t]);
|
|
2078
|
+
}
|
|
2079
|
+
r = r.right;
|
|
2080
|
+
}
|
|
2081
|
+
return n;
|
|
2082
|
+
}, Ga = (e, t) => {
|
|
2083
|
+
let n = 0, r = e._start;
|
|
2084
|
+
for (e.doc ?? G(); r !== null;) {
|
|
2085
|
+
if (r.countable && !r.deleted) {
|
|
2086
|
+
let i = r.content.getContent();
|
|
2087
|
+
for (let r = 0; r < i.length; r++) t(i[r], n++, e);
|
|
2088
|
+
}
|
|
2089
|
+
r = r.right;
|
|
2090
|
+
}
|
|
2091
|
+
}, Ka = (e, t) => {
|
|
2092
|
+
let n = [];
|
|
2093
|
+
return Ga(e, (r, i) => {
|
|
2094
|
+
n.push(t(r, i, e));
|
|
2095
|
+
}), n;
|
|
2096
|
+
}, qa = (e) => {
|
|
2097
|
+
let t = e._start, n = null, r = 0;
|
|
2098
|
+
return {
|
|
2099
|
+
[Symbol.iterator]() {
|
|
2100
|
+
return this;
|
|
2101
|
+
},
|
|
2102
|
+
next: () => {
|
|
2103
|
+
if (n === null) {
|
|
2104
|
+
for (; t !== null && t.deleted;) t = t.right;
|
|
2105
|
+
if (t === null) return {
|
|
2106
|
+
done: !0,
|
|
2107
|
+
value: void 0
|
|
2108
|
+
};
|
|
2109
|
+
n = t.content.getContent(), r = 0, t = t.right;
|
|
2110
|
+
}
|
|
2111
|
+
let e = n[r++];
|
|
2112
|
+
return n.length <= r && (n = null), {
|
|
2113
|
+
done: !1,
|
|
2114
|
+
value: e
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
}, Ja = (e, t) => {
|
|
2119
|
+
e.doc ?? G();
|
|
2120
|
+
let n = za(e, t), r = e._start;
|
|
2121
|
+
for (n !== null && (r = n.p, t -= n.index); r !== null; r = r.right) if (!r.deleted && r.countable) {
|
|
2122
|
+
if (t < r.length) return r.content.getContent()[t];
|
|
2123
|
+
t -= r.length;
|
|
2124
|
+
}
|
|
2125
|
+
}, Ya = (e, t, n, r) => {
|
|
2126
|
+
let i = n, a = e.doc, o = a.clientID, s = a.store, c = n === null ? t._start : n.right, l = [], u = () => {
|
|
2127
|
+
l.length > 0 && (i = new Q(R(o, B(s, o)), i, i && i.lastId, c, c && c.id, t, null, new ns(l)), i.integrate(e, 0), l = []);
|
|
2128
|
+
};
|
|
2129
|
+
r.forEach((n) => {
|
|
2130
|
+
if (n === null) l.push(n);
|
|
2131
|
+
else switch (n.constructor) {
|
|
2132
|
+
case Number:
|
|
2133
|
+
case Object:
|
|
2134
|
+
case Boolean:
|
|
2135
|
+
case Array:
|
|
2136
|
+
case String:
|
|
2137
|
+
l.push(n);
|
|
2138
|
+
break;
|
|
2139
|
+
default: switch (u(), n.constructor) {
|
|
2140
|
+
case Uint8Array:
|
|
2141
|
+
case ArrayBuffer:
|
|
2142
|
+
i = new Q(R(o, B(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Uo(new Uint8Array(n))), i.integrate(e, 0);
|
|
2143
|
+
break;
|
|
2144
|
+
case si:
|
|
2145
|
+
i = new Q(R(o, B(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Jo(n)), i.integrate(e, 0);
|
|
2146
|
+
break;
|
|
2147
|
+
default: if (n instanceof K) i = new Q(R(o, B(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Z(n)), i.integrate(e, 0);
|
|
2148
|
+
else throw Error("Unexpected content type in insert operation");
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}), u();
|
|
2152
|
+
}, Xa = () => S("Length exceeded!"), Za = (e, t, n, r) => {
|
|
2153
|
+
if (n > t._length) throw Xa();
|
|
2154
|
+
if (n === 0) return t._searchMarker && Ba(t._searchMarker, n, r.length), Ya(e, t, null, r);
|
|
2155
|
+
let i = n, a = za(t, n), o = t._start;
|
|
2156
|
+
for (a !== null && (o = a.p, n -= a.index, n === 0 && (o = o.prev, n += o && o.countable && !o.deleted ? o.length : 0)); o !== null; o = o.right) if (!o.deleted && o.countable) {
|
|
2157
|
+
if (n <= o.length) {
|
|
2158
|
+
n < o.length && H(e, R(o.id.client, o.id.clock + n));
|
|
2159
|
+
break;
|
|
2160
|
+
}
|
|
2161
|
+
n -= o.length;
|
|
2162
|
+
}
|
|
2163
|
+
return t._searchMarker && Ba(t._searchMarker, i, r.length), Ya(e, t, o, r);
|
|
2164
|
+
}, Qa = (e, t, n) => {
|
|
2165
|
+
let r = (t._searchMarker || []).reduce((e, t) => t.index > e.index ? t : e, {
|
|
2166
|
+
index: 0,
|
|
2167
|
+
p: t._start
|
|
2168
|
+
}).p;
|
|
2169
|
+
if (r) for (; r.right;) r = r.right;
|
|
2170
|
+
return Ya(e, t, r, n);
|
|
2171
|
+
}, $a = (e, t, n, r) => {
|
|
2172
|
+
if (r === 0) return;
|
|
2173
|
+
let i = n, a = r, o = za(t, n), s = t._start;
|
|
2174
|
+
for (o !== null && (s = o.p, n -= o.index); s !== null && n > 0; s = s.right) !s.deleted && s.countable && (n < s.length && H(e, R(s.id.client, s.id.clock + n)), n -= s.length);
|
|
2175
|
+
for (; r > 0 && s !== null;) s.deleted || (r < s.length && H(e, R(s.id.client, s.id.clock + r)), s.delete(e), r -= s.length), s = s.right;
|
|
2176
|
+
if (r > 0) throw Xa();
|
|
2177
|
+
t._searchMarker && Ba(t._searchMarker, i, -a + r);
|
|
2178
|
+
}, eo = (e, t, n) => {
|
|
2179
|
+
let r = t._map.get(n);
|
|
2180
|
+
r !== void 0 && r.delete(e);
|
|
2181
|
+
}, to = (e, t, n, r) => {
|
|
2182
|
+
let i = t._map.get(n) || null, a = e.doc, o = a.clientID, s;
|
|
2183
|
+
if (r == null) s = new ns([r]);
|
|
2184
|
+
else switch (r.constructor) {
|
|
2185
|
+
case Number:
|
|
2186
|
+
case Object:
|
|
2187
|
+
case Boolean:
|
|
2188
|
+
case Array:
|
|
2189
|
+
case String:
|
|
2190
|
+
case Date:
|
|
2191
|
+
case BigInt:
|
|
2192
|
+
s = new ns([r]);
|
|
2193
|
+
break;
|
|
2194
|
+
case Uint8Array:
|
|
2195
|
+
s = new Uo(r);
|
|
2196
|
+
break;
|
|
2197
|
+
case si:
|
|
2198
|
+
s = new Jo(r);
|
|
2199
|
+
break;
|
|
2200
|
+
default: if (r instanceof K) s = new Z(r);
|
|
2201
|
+
else throw Error("Unexpected content type");
|
|
2202
|
+
}
|
|
2203
|
+
new Q(R(o, B(a.store, o)), i, i && i.lastId, null, null, t, n, s).integrate(e, 0);
|
|
2204
|
+
}, no = (e, t) => {
|
|
2205
|
+
e.doc ?? G();
|
|
2206
|
+
let n = e._map.get(t);
|
|
2207
|
+
return n !== void 0 && !n.deleted ? n.content.getContent()[n.length - 1] : void 0;
|
|
2208
|
+
}, ro = (e) => {
|
|
2209
|
+
let t = {};
|
|
2210
|
+
return e.doc ?? G(), e._map.forEach((e, n) => {
|
|
2211
|
+
e.deleted || (t[n] = e.content.getContent()[e.length - 1]);
|
|
2212
|
+
}), t;
|
|
2213
|
+
}, io = (e, t) => {
|
|
2214
|
+
e.doc ?? G();
|
|
2215
|
+
let n = e._map.get(t);
|
|
2216
|
+
return n !== void 0 && !n.deleted;
|
|
2217
|
+
}, ao = (e, t) => {
|
|
2218
|
+
let n = {};
|
|
2219
|
+
return e._map.forEach((e, r) => {
|
|
2220
|
+
let i = e;
|
|
2221
|
+
for (; i !== null && (!t.sv.has(i.id.client) || i.id.clock >= (t.sv.get(i.id.client) || 0));) i = i.left;
|
|
2222
|
+
i !== null && z(i, t) && (n[r] = i.content.getContent()[i.length - 1]);
|
|
2223
|
+
}), n;
|
|
2224
|
+
}, oo = (e) => (e.doc ?? G(), Kr(e._map.entries(), (e) => !e[1].deleted)), so = class extends ja {}, co = class e extends K {
|
|
2225
|
+
constructor() {
|
|
2226
|
+
super(), this._prelimContent = [], this._searchMarker = [];
|
|
2227
|
+
}
|
|
2228
|
+
static from(t) {
|
|
2229
|
+
let n = new e();
|
|
2230
|
+
return n.push(t), n;
|
|
2231
|
+
}
|
|
2232
|
+
_integrate(e, t) {
|
|
2233
|
+
super._integrate(e, t), this.insert(0, this._prelimContent), this._prelimContent = null;
|
|
2234
|
+
}
|
|
2235
|
+
_copy() {
|
|
2236
|
+
return new e();
|
|
2237
|
+
}
|
|
2238
|
+
clone() {
|
|
2239
|
+
let t = new e();
|
|
2240
|
+
return t.insert(0, this.toArray().map((e) => e instanceof K ? e.clone() : e)), t;
|
|
2241
|
+
}
|
|
2242
|
+
get length() {
|
|
2243
|
+
return this.doc ?? G(), this._length;
|
|
2244
|
+
}
|
|
2245
|
+
_callObserver(e, t) {
|
|
2246
|
+
super._callObserver(e, t), Va(this, e, new so(this, e));
|
|
2247
|
+
}
|
|
2248
|
+
insert(e, t) {
|
|
2249
|
+
this.doc === null ? this._prelimContent.splice(e, 0, ...t) : U(this.doc, (n) => {
|
|
2250
|
+
Za(n, this, e, t);
|
|
2251
|
+
});
|
|
2252
|
+
}
|
|
2253
|
+
push(e) {
|
|
2254
|
+
this.doc === null ? this._prelimContent.push(...e) : U(this.doc, (t) => {
|
|
2255
|
+
Qa(t, this, e);
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
unshift(e) {
|
|
2259
|
+
this.insert(0, e);
|
|
2260
|
+
}
|
|
2261
|
+
delete(e, t = 1) {
|
|
2262
|
+
this.doc === null ? this._prelimContent.splice(e, t) : U(this.doc, (n) => {
|
|
2263
|
+
$a(n, this, e, t);
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
get(e) {
|
|
2267
|
+
return Ja(this, e);
|
|
2268
|
+
}
|
|
2269
|
+
toArray() {
|
|
2270
|
+
return Ua(this);
|
|
2271
|
+
}
|
|
2272
|
+
slice(e = 0, t = this.length) {
|
|
2273
|
+
return Ha(this, e, t);
|
|
2274
|
+
}
|
|
2275
|
+
toJSON() {
|
|
2276
|
+
return this.map((e) => e instanceof K ? e.toJSON() : e);
|
|
2277
|
+
}
|
|
2278
|
+
map(e) {
|
|
2279
|
+
return Ka(this, e);
|
|
2280
|
+
}
|
|
2281
|
+
forEach(e) {
|
|
2282
|
+
Ga(this, e);
|
|
2283
|
+
}
|
|
2284
|
+
[Symbol.iterator]() {
|
|
2285
|
+
return qa(this);
|
|
2286
|
+
}
|
|
2287
|
+
_write(e) {
|
|
2288
|
+
e.writeTypeRef(os);
|
|
2289
|
+
}
|
|
2290
|
+
}, lo = (e) => new co(), uo = class extends ja {
|
|
2291
|
+
constructor(e, t, n) {
|
|
2292
|
+
super(e, t), this.keysChanged = n;
|
|
2293
|
+
}
|
|
2294
|
+
}, fo = class e extends K {
|
|
2295
|
+
constructor(e) {
|
|
2296
|
+
super(), this._prelimContent = null, e === void 0 ? this._prelimContent = /* @__PURE__ */ new Map() : this._prelimContent = new Map(e);
|
|
2297
|
+
}
|
|
2298
|
+
_integrate(e, t) {
|
|
2299
|
+
super._integrate(e, t), this._prelimContent.forEach((e, t) => {
|
|
2300
|
+
this.set(t, e);
|
|
2301
|
+
}), this._prelimContent = null;
|
|
2302
|
+
}
|
|
2303
|
+
_copy() {
|
|
2304
|
+
return new e();
|
|
2305
|
+
}
|
|
2306
|
+
clone() {
|
|
2307
|
+
let t = new e();
|
|
2308
|
+
return this.forEach((e, n) => {
|
|
2309
|
+
t.set(n, e instanceof K ? e.clone() : e);
|
|
2310
|
+
}), t;
|
|
2311
|
+
}
|
|
2312
|
+
_callObserver(e, t) {
|
|
2313
|
+
Va(this, e, new uo(this, e, t));
|
|
2314
|
+
}
|
|
2315
|
+
toJSON() {
|
|
2316
|
+
this.doc ?? G();
|
|
2317
|
+
let e = {};
|
|
2318
|
+
return this._map.forEach((t, n) => {
|
|
2319
|
+
if (!t.deleted) {
|
|
2320
|
+
let r = t.content.getContent()[t.length - 1];
|
|
2321
|
+
e[n] = r instanceof K ? r.toJSON() : r;
|
|
2322
|
+
}
|
|
2323
|
+
}), e;
|
|
2324
|
+
}
|
|
2325
|
+
get size() {
|
|
2326
|
+
return [...oo(this)].length;
|
|
2327
|
+
}
|
|
2328
|
+
keys() {
|
|
2329
|
+
return qr(oo(this), (e) => e[0]);
|
|
2330
|
+
}
|
|
2331
|
+
values() {
|
|
2332
|
+
return qr(oo(this), (e) => e[1].content.getContent()[e[1].length - 1]);
|
|
2333
|
+
}
|
|
2334
|
+
entries() {
|
|
2335
|
+
return qr(oo(this), (e) => [e[0], e[1].content.getContent()[e[1].length - 1]]);
|
|
2336
|
+
}
|
|
2337
|
+
forEach(e) {
|
|
2338
|
+
this.doc ?? G(), this._map.forEach((t, n) => {
|
|
2339
|
+
t.deleted || e(t.content.getContent()[t.length - 1], n, this);
|
|
2340
|
+
});
|
|
2341
|
+
}
|
|
2342
|
+
[Symbol.iterator]() {
|
|
2343
|
+
return this.entries();
|
|
2344
|
+
}
|
|
2345
|
+
delete(e) {
|
|
2346
|
+
this.doc === null ? this._prelimContent.delete(e) : U(this.doc, (t) => {
|
|
2347
|
+
eo(t, this, e);
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
set(e, t) {
|
|
2351
|
+
return this.doc === null ? this._prelimContent.set(e, t) : U(this.doc, (n) => {
|
|
2352
|
+
to(n, this, e, t);
|
|
2353
|
+
}), t;
|
|
2354
|
+
}
|
|
2355
|
+
get(e) {
|
|
2356
|
+
return no(this, e);
|
|
2357
|
+
}
|
|
2358
|
+
has(e) {
|
|
2359
|
+
return io(this, e);
|
|
2360
|
+
}
|
|
2361
|
+
clear() {
|
|
2362
|
+
this.doc === null ? this._prelimContent.clear() : U(this.doc, (e) => {
|
|
2363
|
+
this.forEach(function(t, n, r) {
|
|
2364
|
+
eo(e, r, n);
|
|
2365
|
+
});
|
|
2366
|
+
});
|
|
2367
|
+
}
|
|
2368
|
+
_write(e) {
|
|
2369
|
+
e.writeTypeRef(ss);
|
|
2370
|
+
}
|
|
2371
|
+
}, po = (e) => new fo(), q = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && zt(e, t), mo = class {
|
|
2372
|
+
constructor(e, t, n, r) {
|
|
2373
|
+
this.left = e, this.right = t, this.index = n, this.currentAttributes = r;
|
|
2374
|
+
}
|
|
2375
|
+
forward() {
|
|
2376
|
+
switch (this.right === null && w(), this.right.content.constructor) {
|
|
2377
|
+
case Y:
|
|
2378
|
+
this.right.deleted || vo(this.currentAttributes, this.right.content);
|
|
2379
|
+
break;
|
|
2380
|
+
default:
|
|
2381
|
+
this.right.deleted || (this.index += this.right.length);
|
|
2382
|
+
break;
|
|
2383
|
+
}
|
|
2384
|
+
this.left = this.right, this.right = this.right.right;
|
|
2385
|
+
}
|
|
2386
|
+
}, ho = (e, t, n) => {
|
|
2387
|
+
for (; t.right !== null && n > 0;) {
|
|
2388
|
+
switch (t.right.content.constructor) {
|
|
2389
|
+
case Y:
|
|
2390
|
+
t.right.deleted || vo(t.currentAttributes, t.right.content);
|
|
2391
|
+
break;
|
|
2392
|
+
default:
|
|
2393
|
+
t.right.deleted || (n < t.right.length && H(e, R(t.right.id.client, t.right.id.clock + n)), t.index += t.right.length, n -= t.right.length);
|
|
2394
|
+
break;
|
|
2395
|
+
}
|
|
2396
|
+
t.left = t.right, t.right = t.right.right;
|
|
2397
|
+
}
|
|
2398
|
+
return t;
|
|
2399
|
+
}, go = (e, t, n, r) => {
|
|
2400
|
+
let i = /* @__PURE__ */ new Map(), a = r ? za(t, n) : null;
|
|
2401
|
+
return a ? ho(e, new mo(a.p.left, a.p, a.index, i), n - a.index) : ho(e, new mo(null, t._start, 0, i), n);
|
|
2402
|
+
}, _o = (e, t, n, r) => {
|
|
2403
|
+
for (; n.right !== null && (n.right.deleted === !0 || n.right.content.constructor === Y && q(r.get(n.right.content.key), n.right.content.value));) n.right.deleted || r.delete(n.right.content.key), n.forward();
|
|
2404
|
+
let i = e.doc, a = i.clientID;
|
|
2405
|
+
r.forEach((r, o) => {
|
|
2406
|
+
let s = n.left, c = n.right, l = new Q(R(a, B(i.store, a)), s, s && s.lastId, c, c && c.id, t, null, new Y(o, r));
|
|
2407
|
+
l.integrate(e, 0), n.right = l, n.forward();
|
|
2408
|
+
});
|
|
2409
|
+
}, vo = (e, t) => {
|
|
2410
|
+
let { key: n, value: r } = t;
|
|
2411
|
+
r === null ? e.delete(n) : e.set(n, r);
|
|
2412
|
+
}, yo = (e, t) => {
|
|
2413
|
+
for (; e.right !== null && (e.right.deleted || e.right.content.constructor === Y && q(t[e.right.content.key] ?? null, e.right.content.value));) e.forward();
|
|
2414
|
+
}, bo = (e, t, n, r) => {
|
|
2415
|
+
let i = e.doc, a = i.clientID, o = /* @__PURE__ */ new Map();
|
|
2416
|
+
for (let s in r) {
|
|
2417
|
+
let c = r[s], l = n.currentAttributes.get(s) ?? null;
|
|
2418
|
+
if (!q(l, c)) {
|
|
2419
|
+
o.set(s, l);
|
|
2420
|
+
let { left: r, right: u } = n;
|
|
2421
|
+
n.right = new Q(R(a, B(i.store, a)), r, r && r.lastId, u, u && u.id, t, null, new Y(s, c)), n.right.integrate(e, 0), n.forward();
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
return o;
|
|
2425
|
+
}, xo = (e, t, n, r, i) => {
|
|
2426
|
+
n.currentAttributes.forEach((e, t) => {
|
|
2427
|
+
i[t] === void 0 && (i[t] = null);
|
|
2428
|
+
});
|
|
2429
|
+
let a = e.doc, o = a.clientID;
|
|
2430
|
+
yo(n, i);
|
|
2431
|
+
let s = bo(e, t, n, i), c = r.constructor === String ? new X(r) : r instanceof K ? new Z(r) : new Xo(r), { left: l, right: u, index: d } = n;
|
|
2432
|
+
t._searchMarker && Ba(t._searchMarker, n.index, c.getLength()), u = new Q(R(o, B(a.store, o)), l, l && l.lastId, u, u && u.id, t, null, c), u.integrate(e, 0), n.right = u, n.index = d, n.forward(), _o(e, t, n, s);
|
|
2433
|
+
}, So = (e, t, n, r, i) => {
|
|
2434
|
+
let a = e.doc, o = a.clientID;
|
|
2435
|
+
yo(n, i);
|
|
2436
|
+
let s = bo(e, t, n, i);
|
|
2437
|
+
iterationLoop: for (; n.right !== null && (r > 0 || s.size > 0 && (n.right.deleted || n.right.content.constructor === Y));) {
|
|
2438
|
+
if (!n.right.deleted) switch (n.right.content.constructor) {
|
|
2439
|
+
case Y: {
|
|
2440
|
+
let { key: t, value: a } = n.right.content, o = i[t];
|
|
2441
|
+
if (o !== void 0) {
|
|
2442
|
+
if (q(o, a)) s.delete(t);
|
|
2443
|
+
else {
|
|
2444
|
+
if (r === 0) break iterationLoop;
|
|
2445
|
+
s.set(t, a);
|
|
2446
|
+
}
|
|
2447
|
+
n.right.delete(e);
|
|
2448
|
+
} else n.currentAttributes.set(t, a);
|
|
2449
|
+
break;
|
|
2450
|
+
}
|
|
2451
|
+
default:
|
|
2452
|
+
r < n.right.length && H(e, R(n.right.id.client, n.right.id.clock + r)), r -= n.right.length;
|
|
2453
|
+
break;
|
|
2454
|
+
}
|
|
2455
|
+
n.forward();
|
|
2456
|
+
}
|
|
2457
|
+
if (r > 0) {
|
|
2458
|
+
let i = "";
|
|
2459
|
+
for (; r > 0; r--) i += "\n";
|
|
2460
|
+
n.right = new Q(R(o, B(a.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new X(i)), n.right.integrate(e, 0), n.forward();
|
|
2461
|
+
}
|
|
2462
|
+
_o(e, t, n, s);
|
|
2463
|
+
}, Co = (t, n, r, i, a) => {
|
|
2464
|
+
let o = n, s = e();
|
|
2465
|
+
for (; o && (!o.countable || o.deleted);) {
|
|
2466
|
+
if (!o.deleted && o.content.constructor === Y) {
|
|
2467
|
+
let e = o.content;
|
|
2468
|
+
s.set(e.key, e);
|
|
2469
|
+
}
|
|
2470
|
+
o = o.right;
|
|
2471
|
+
}
|
|
2472
|
+
let c = 0, l = !1;
|
|
2473
|
+
for (; n !== o;) {
|
|
2474
|
+
if (r === n && (l = !0), !n.deleted) {
|
|
2475
|
+
let e = n.content;
|
|
2476
|
+
switch (e.constructor) {
|
|
2477
|
+
case Y: {
|
|
2478
|
+
let { key: r, value: o } = e, u = i.get(r) ?? null;
|
|
2479
|
+
(s.get(r) !== e || u === o) && (n.delete(t), c++, !l && (a.get(r) ?? null) === o && u !== o && (u === null ? a.delete(r) : a.set(r, u))), !l && !n.deleted && vo(a, e);
|
|
2480
|
+
break;
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
n = n.right;
|
|
2485
|
+
}
|
|
2486
|
+
return c;
|
|
2487
|
+
}, wo = (e, t) => {
|
|
2488
|
+
for (; t && t.right && (t.right.deleted || !t.right.countable);) t = t.right;
|
|
2489
|
+
let n = /* @__PURE__ */ new Set();
|
|
2490
|
+
for (; t && (t.deleted || !t.countable);) {
|
|
2491
|
+
if (!t.deleted && t.content.constructor === Y) {
|
|
2492
|
+
let r = t.content.key;
|
|
2493
|
+
n.has(r) ? t.delete(e) : n.add(r);
|
|
2494
|
+
}
|
|
2495
|
+
t = t.left;
|
|
2496
|
+
}
|
|
2497
|
+
}, To = (n) => {
|
|
2498
|
+
let r = 0;
|
|
2499
|
+
return U(n.doc, (i) => {
|
|
2500
|
+
let a = n._start, o = n._start, s = e(), c = t(s);
|
|
2501
|
+
for (; o;) {
|
|
2502
|
+
if (o.deleted === !1) switch (o.content.constructor) {
|
|
2503
|
+
case Y:
|
|
2504
|
+
vo(c, o.content);
|
|
2505
|
+
break;
|
|
2506
|
+
default:
|
|
2507
|
+
r += Co(i, a, o, s, c), s = t(c), a = o;
|
|
2508
|
+
break;
|
|
2509
|
+
}
|
|
2510
|
+
o = o.right;
|
|
2511
|
+
}
|
|
2512
|
+
}), r;
|
|
2513
|
+
}, Eo = (e) => {
|
|
2514
|
+
let t = /* @__PURE__ */ new Set(), n = e.doc;
|
|
2515
|
+
for (let [r, i] of e.afterState.entries()) {
|
|
2516
|
+
let a = e.beforeState.get(r) || 0;
|
|
2517
|
+
i !== a && sa(e, n.store.clients.get(r), a, i, (e) => {
|
|
2518
|
+
!e.deleted && e.content.constructor === Y && e.constructor !== J && t.add(e.parent);
|
|
2519
|
+
});
|
|
2520
|
+
}
|
|
2521
|
+
U(n, (n) => {
|
|
2522
|
+
I(e, e.deleteSet, (e) => {
|
|
2523
|
+
if (e instanceof J || !e.parent._hasFormatting || t.has(e.parent)) return;
|
|
2524
|
+
let r = e.parent;
|
|
2525
|
+
e.content.constructor === Y ? t.add(r) : wo(n, e);
|
|
2526
|
+
});
|
|
2527
|
+
for (let e of t) To(e);
|
|
2528
|
+
});
|
|
2529
|
+
}, Do = (e, n, r) => {
|
|
2530
|
+
let i = r, a = t(n.currentAttributes), o = n.right;
|
|
2531
|
+
for (; r > 0 && n.right !== null;) {
|
|
2532
|
+
if (n.right.deleted === !1) switch (n.right.content.constructor) {
|
|
2533
|
+
case Z:
|
|
2534
|
+
case Xo:
|
|
2535
|
+
case X:
|
|
2536
|
+
r < n.right.length && H(e, R(n.right.id.client, n.right.id.clock + r)), r -= n.right.length, n.right.delete(e);
|
|
2537
|
+
break;
|
|
2538
|
+
}
|
|
2539
|
+
n.forward();
|
|
2540
|
+
}
|
|
2541
|
+
o && Co(e, o, n.right, a, n.currentAttributes);
|
|
2542
|
+
let s = (n.left || n.right).parent;
|
|
2543
|
+
return s._searchMarker && Ba(s._searchMarker, n.index, -i + r), n;
|
|
2544
|
+
}, Oo = class extends ja {
|
|
2545
|
+
constructor(e, t, n) {
|
|
2546
|
+
super(e, t), this.childListChanged = !1, this.keysChanged = /* @__PURE__ */ new Set(), n.forEach((e) => {
|
|
2547
|
+
e === null ? this.childListChanged = !0 : this.keysChanged.add(e);
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
get changes() {
|
|
2551
|
+
if (this._changes === null) {
|
|
2552
|
+
let e = {
|
|
2553
|
+
keys: this.keys,
|
|
2554
|
+
delta: this.delta,
|
|
2555
|
+
added: /* @__PURE__ */ new Set(),
|
|
2556
|
+
deleted: /* @__PURE__ */ new Set()
|
|
2557
|
+
};
|
|
2558
|
+
this._changes = e;
|
|
2559
|
+
}
|
|
2560
|
+
return this._changes;
|
|
2561
|
+
}
|
|
2562
|
+
get delta() {
|
|
2563
|
+
if (this._delta === null) {
|
|
2564
|
+
let e = this.target.doc, t = [];
|
|
2565
|
+
U(e, (e) => {
|
|
2566
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = this.target._start, a = null, o = {}, s = "", c = 0, l = 0, u = () => {
|
|
2567
|
+
if (a !== null) {
|
|
2568
|
+
let e = null;
|
|
2569
|
+
switch (a) {
|
|
2570
|
+
case "delete":
|
|
2571
|
+
l > 0 && (e = { delete: l }), l = 0;
|
|
2572
|
+
break;
|
|
2573
|
+
case "insert":
|
|
2574
|
+
(typeof s == "object" || s.length > 0) && (e = { insert: s }, n.size > 0 && (e.attributes = {}, n.forEach((t, n) => {
|
|
2575
|
+
t !== null && (e.attributes[n] = t);
|
|
2576
|
+
}))), s = "";
|
|
2577
|
+
break;
|
|
2578
|
+
case "retain":
|
|
2579
|
+
c > 0 && (e = { retain: c }, It(o) || (e.attributes = jt({}, o))), c = 0;
|
|
2580
|
+
break;
|
|
2581
|
+
}
|
|
2582
|
+
e && t.push(e), a = null;
|
|
2583
|
+
}
|
|
2584
|
+
};
|
|
2585
|
+
for (; i !== null;) {
|
|
2586
|
+
switch (i.content.constructor) {
|
|
2587
|
+
case Z:
|
|
2588
|
+
case Xo:
|
|
2589
|
+
this.adds(i) ? this.deletes(i) || (u(), a = "insert", s = i.content.getContent()[0], u()) : this.deletes(i) ? (a !== "delete" && (u(), a = "delete"), l += 1) : i.deleted || (a !== "retain" && (u(), a = "retain"), c += 1);
|
|
2590
|
+
break;
|
|
2591
|
+
case X:
|
|
2592
|
+
this.adds(i) ? this.deletes(i) || (a !== "insert" && (u(), a = "insert"), s += i.content.str) : this.deletes(i) ? (a !== "delete" && (u(), a = "delete"), l += i.length) : i.deleted || (a !== "retain" && (u(), a = "retain"), c += i.length);
|
|
2593
|
+
break;
|
|
2594
|
+
case Y: {
|
|
2595
|
+
let { key: t, value: s } = i.content;
|
|
2596
|
+
if (this.adds(i)) this.deletes(i) || (q(n.get(t) ?? null, s) ? s !== null && i.delete(e) : (a === "retain" && u(), q(s, r.get(t) ?? null) ? delete o[t] : o[t] = s));
|
|
2597
|
+
else if (this.deletes(i)) {
|
|
2598
|
+
r.set(t, s);
|
|
2599
|
+
let e = n.get(t) ?? null;
|
|
2600
|
+
q(e, s) || (a === "retain" && u(), o[t] = e);
|
|
2601
|
+
} else if (!i.deleted) {
|
|
2602
|
+
r.set(t, s);
|
|
2603
|
+
let n = o[t];
|
|
2604
|
+
n !== void 0 && (q(n, s) ? n !== null && i.delete(e) : (a === "retain" && u(), s === null ? delete o[t] : o[t] = s));
|
|
2605
|
+
}
|
|
2606
|
+
i.deleted || (a === "insert" && u(), vo(n, i.content));
|
|
2607
|
+
break;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
i = i.right;
|
|
2611
|
+
}
|
|
2612
|
+
for (u(); t.length > 0;) {
|
|
2613
|
+
let e = t[t.length - 1];
|
|
2614
|
+
if (e.retain !== void 0 && e.attributes === void 0) t.pop();
|
|
2615
|
+
else break;
|
|
2616
|
+
}
|
|
2617
|
+
}), this._delta = t;
|
|
2618
|
+
}
|
|
2619
|
+
return this._delta;
|
|
2620
|
+
}
|
|
2621
|
+
}, ko = class e extends K {
|
|
2622
|
+
constructor(e) {
|
|
2623
|
+
super(), this._pending = e === void 0 ? [] : [() => this.insert(0, e)], this._searchMarker = [], this._hasFormatting = !1;
|
|
2624
|
+
}
|
|
2625
|
+
get length() {
|
|
2626
|
+
return this.doc ?? G(), this._length;
|
|
2627
|
+
}
|
|
2628
|
+
_integrate(e, t) {
|
|
2629
|
+
super._integrate(e, t);
|
|
2630
|
+
try {
|
|
2631
|
+
this._pending.forEach((e) => e());
|
|
2632
|
+
} catch (e) {
|
|
2633
|
+
console.error(e);
|
|
2634
|
+
}
|
|
2635
|
+
this._pending = null;
|
|
2636
|
+
}
|
|
2637
|
+
_copy() {
|
|
2638
|
+
return new e();
|
|
2639
|
+
}
|
|
2640
|
+
clone() {
|
|
2641
|
+
let t = new e();
|
|
2642
|
+
return t.applyDelta(this.toDelta()), t;
|
|
2643
|
+
}
|
|
2644
|
+
_callObserver(e, t) {
|
|
2645
|
+
super._callObserver(e, t);
|
|
2646
|
+
let n = new Oo(this, e, t);
|
|
2647
|
+
Va(this, e, n), !e.local && this._hasFormatting && (e._needFormattingCleanup = !0);
|
|
2648
|
+
}
|
|
2649
|
+
toString() {
|
|
2650
|
+
this.doc ?? G();
|
|
2651
|
+
let e = "", t = this._start;
|
|
2652
|
+
for (; t !== null;) !t.deleted && t.countable && t.content.constructor === X && (e += t.content.str), t = t.right;
|
|
2653
|
+
return e;
|
|
2654
|
+
}
|
|
2655
|
+
toJSON() {
|
|
2656
|
+
return this.toString();
|
|
2657
|
+
}
|
|
2658
|
+
applyDelta(e, { sanitize: t = !0 } = {}) {
|
|
2659
|
+
this.doc === null ? this._pending.push(() => this.applyDelta(e)) : U(this.doc, (n) => {
|
|
2660
|
+
let r = new mo(null, this._start, 0, /* @__PURE__ */ new Map());
|
|
2661
|
+
for (let i = 0; i < e.length; i++) {
|
|
2662
|
+
let a = e[i];
|
|
2663
|
+
if (a.insert !== void 0) {
|
|
2664
|
+
let o = !t && typeof a.insert == "string" && i === e.length - 1 && r.right === null && a.insert.slice(-1) === "\n" ? a.insert.slice(0, -1) : a.insert;
|
|
2665
|
+
(typeof o != "string" || o.length > 0) && xo(n, this, r, o, a.attributes || {});
|
|
2666
|
+
} else a.retain === void 0 ? a.delete !== void 0 && Do(n, r, a.delete) : So(n, this, r, a.retain, a.attributes || {});
|
|
2667
|
+
}
|
|
2668
|
+
});
|
|
2669
|
+
}
|
|
2670
|
+
toDelta(e, t, n) {
|
|
2671
|
+
this.doc ?? G();
|
|
2672
|
+
let r = [], i = /* @__PURE__ */ new Map(), a = this.doc, o = "", s = this._start;
|
|
2673
|
+
function c() {
|
|
2674
|
+
if (o.length > 0) {
|
|
2675
|
+
let e = {}, t = !1;
|
|
2676
|
+
i.forEach((n, r) => {
|
|
2677
|
+
t = !0, e[r] = n;
|
|
2678
|
+
});
|
|
2679
|
+
let n = { insert: o };
|
|
2680
|
+
t && (n.attributes = e), r.push(n), o = "";
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
let l = () => {
|
|
2684
|
+
for (; s !== null;) {
|
|
2685
|
+
if (z(s, e) || t !== void 0 && z(s, t)) switch (s.content.constructor) {
|
|
2686
|
+
case X: {
|
|
2687
|
+
let r = i.get("ychange");
|
|
2688
|
+
e !== void 0 && !z(s, e) ? (r === void 0 || r.user !== s.id.client || r.type !== "removed") && (c(), i.set("ychange", n ? n("removed", s.id) : { type: "removed" })) : t !== void 0 && !z(s, t) ? (r === void 0 || r.user !== s.id.client || r.type !== "added") && (c(), i.set("ychange", n ? n("added", s.id) : { type: "added" })) : r !== void 0 && (c(), i.delete("ychange")), o += s.content.str;
|
|
2689
|
+
break;
|
|
2690
|
+
}
|
|
2691
|
+
case Z:
|
|
2692
|
+
case Xo: {
|
|
2693
|
+
c();
|
|
2694
|
+
let e = { insert: s.content.getContent()[0] };
|
|
2695
|
+
if (i.size > 0) {
|
|
2696
|
+
let t = {};
|
|
2697
|
+
e.attributes = t, i.forEach((e, n) => {
|
|
2698
|
+
t[n] = e;
|
|
2699
|
+
});
|
|
2700
|
+
}
|
|
2701
|
+
r.push(e);
|
|
2702
|
+
break;
|
|
2703
|
+
}
|
|
2704
|
+
case Y:
|
|
2705
|
+
z(s, e) && (c(), vo(i, s.content));
|
|
2706
|
+
break;
|
|
2707
|
+
}
|
|
2708
|
+
s = s.right;
|
|
2709
|
+
}
|
|
2710
|
+
c();
|
|
2711
|
+
};
|
|
2712
|
+
return e || t ? U(a, (n) => {
|
|
2713
|
+
e && $i(n, e), t && $i(n, t), l();
|
|
2714
|
+
}, "cleanup") : l(), r;
|
|
2715
|
+
}
|
|
2716
|
+
insert(e, t, n) {
|
|
2717
|
+
if (t.length <= 0) return;
|
|
2718
|
+
let r = this.doc;
|
|
2719
|
+
r === null ? this._pending.push(() => this.insert(e, t, n)) : U(r, (r) => {
|
|
2720
|
+
let i = go(r, this, e, !n);
|
|
2721
|
+
n || (n = {}, i.currentAttributes.forEach((e, t) => {
|
|
2722
|
+
n[t] = e;
|
|
2723
|
+
})), xo(r, this, i, t, n);
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
insertEmbed(e, t, n) {
|
|
2727
|
+
let r = this.doc;
|
|
2728
|
+
r === null ? this._pending.push(() => this.insertEmbed(e, t, n || {})) : U(r, (r) => {
|
|
2729
|
+
let i = go(r, this, e, !n);
|
|
2730
|
+
xo(r, this, i, t, n || {});
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
delete(e, t) {
|
|
2734
|
+
if (t === 0) return;
|
|
2735
|
+
let n = this.doc;
|
|
2736
|
+
n === null ? this._pending.push(() => this.delete(e, t)) : U(n, (n) => {
|
|
2737
|
+
Do(n, go(n, this, e, !0), t);
|
|
2738
|
+
});
|
|
2739
|
+
}
|
|
2740
|
+
format(e, t, n) {
|
|
2741
|
+
if (t === 0) return;
|
|
2742
|
+
let r = this.doc;
|
|
2743
|
+
r === null ? this._pending.push(() => this.format(e, t, n)) : U(r, (r) => {
|
|
2744
|
+
let i = go(r, this, e, !1);
|
|
2745
|
+
i.right !== null && So(r, this, i, t, n);
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2748
|
+
removeAttribute(e) {
|
|
2749
|
+
this.doc === null ? this._pending.push(() => this.removeAttribute(e)) : U(this.doc, (t) => {
|
|
2750
|
+
eo(t, this, e);
|
|
2751
|
+
});
|
|
2752
|
+
}
|
|
2753
|
+
setAttribute(e, t) {
|
|
2754
|
+
this.doc === null ? this._pending.push(() => this.setAttribute(e, t)) : U(this.doc, (n) => {
|
|
2755
|
+
to(n, this, e, t);
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2758
|
+
getAttribute(e) {
|
|
2759
|
+
return no(this, e);
|
|
2760
|
+
}
|
|
2761
|
+
getAttributes() {
|
|
2762
|
+
return ro(this);
|
|
2763
|
+
}
|
|
2764
|
+
_write(e) {
|
|
2765
|
+
e.writeTypeRef(cs);
|
|
2766
|
+
}
|
|
2767
|
+
}, Ao = (e) => new ko(), jo = class {
|
|
2768
|
+
constructor(e, t = () => !0) {
|
|
2769
|
+
this._filter = t, this._root = e, this._currentNode = e._start, this._firstCall = !0, e.doc ?? G();
|
|
2770
|
+
}
|
|
2771
|
+
[Symbol.iterator]() {
|
|
2772
|
+
return this;
|
|
2773
|
+
}
|
|
2774
|
+
next() {
|
|
2775
|
+
let e = this._currentNode, t = e && e.content && e.content.type;
|
|
2776
|
+
if (e !== null && (!this._firstCall || e.deleted || !this._filter(t))) do
|
|
2777
|
+
if (t = e.content.type, !e.deleted && (t.constructor === Po || t.constructor === Mo) && t._start !== null) e = t._start;
|
|
2778
|
+
else for (; e !== null;) {
|
|
2779
|
+
let t = e.next;
|
|
2780
|
+
if (t !== null) {
|
|
2781
|
+
e = t;
|
|
2782
|
+
break;
|
|
2783
|
+
} else e = e.parent === this._root ? null : e.parent._item;
|
|
2784
|
+
}
|
|
2785
|
+
while (e !== null && (e.deleted || !this._filter(e.content.type)));
|
|
2786
|
+
return this._firstCall = !1, e === null ? {
|
|
2787
|
+
value: void 0,
|
|
2788
|
+
done: !0
|
|
2789
|
+
} : (this._currentNode = e, {
|
|
2790
|
+
value: e.content.type,
|
|
2791
|
+
done: !1
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2794
|
+
}, Mo = class e extends K {
|
|
2795
|
+
constructor() {
|
|
2796
|
+
super(), this._prelimContent = [];
|
|
2797
|
+
}
|
|
2798
|
+
get firstChild() {
|
|
2799
|
+
let e = this._first;
|
|
2800
|
+
return e ? e.content.getContent()[0] : null;
|
|
2801
|
+
}
|
|
2802
|
+
_integrate(e, t) {
|
|
2803
|
+
super._integrate(e, t), this.insert(0, this._prelimContent), this._prelimContent = null;
|
|
2804
|
+
}
|
|
2805
|
+
_copy() {
|
|
2806
|
+
return new e();
|
|
2807
|
+
}
|
|
2808
|
+
clone() {
|
|
2809
|
+
let t = new e();
|
|
2810
|
+
return t.insert(0, this.toArray().map((e) => e instanceof K ? e.clone() : e)), t;
|
|
2811
|
+
}
|
|
2812
|
+
get length() {
|
|
2813
|
+
return this.doc ?? G(), this._prelimContent === null ? this._length : this._prelimContent.length;
|
|
2814
|
+
}
|
|
2815
|
+
createTreeWalker(e) {
|
|
2816
|
+
return new jo(this, e);
|
|
2817
|
+
}
|
|
2818
|
+
querySelector(e) {
|
|
2819
|
+
e = e.toUpperCase();
|
|
2820
|
+
let t = new jo(this, (t) => t.nodeName && t.nodeName.toUpperCase() === e).next();
|
|
2821
|
+
return t.done ? null : t.value;
|
|
2822
|
+
}
|
|
2823
|
+
querySelectorAll(e) {
|
|
2824
|
+
return e = e.toUpperCase(), c(new jo(this, (t) => t.nodeName && t.nodeName.toUpperCase() === e));
|
|
2825
|
+
}
|
|
2826
|
+
_callObserver(e, t) {
|
|
2827
|
+
Va(this, e, new Io(this, t, e));
|
|
2828
|
+
}
|
|
2829
|
+
toString() {
|
|
2830
|
+
return Ka(this, (e) => e.toString()).join("");
|
|
2831
|
+
}
|
|
2832
|
+
toJSON() {
|
|
2833
|
+
return this.toString();
|
|
2834
|
+
}
|
|
2835
|
+
toDOM(e = document, t = {}, n) {
|
|
2836
|
+
let r = e.createDocumentFragment();
|
|
2837
|
+
return n !== void 0 && n._createAssociation(r, this), Ga(this, (i) => {
|
|
2838
|
+
r.insertBefore(i.toDOM(e, t, n), null);
|
|
2839
|
+
}), r;
|
|
2840
|
+
}
|
|
2841
|
+
insert(e, t) {
|
|
2842
|
+
this.doc === null ? this._prelimContent.splice(e, 0, ...t) : U(this.doc, (n) => {
|
|
2843
|
+
Za(n, this, e, t);
|
|
2844
|
+
});
|
|
2845
|
+
}
|
|
2846
|
+
insertAfter(e, t) {
|
|
2847
|
+
if (this.doc !== null) U(this.doc, (n) => {
|
|
2848
|
+
let r = e && e instanceof K ? e._item : e;
|
|
2849
|
+
Ya(n, this, r, t);
|
|
2850
|
+
});
|
|
2851
|
+
else {
|
|
2852
|
+
let n = this._prelimContent, r = e === null ? 0 : n.findIndex((t) => t === e) + 1;
|
|
2853
|
+
if (r === 0 && e !== null) throw S("Reference item not found");
|
|
2854
|
+
n.splice(r, 0, ...t);
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
delete(e, t = 1) {
|
|
2858
|
+
this.doc === null ? this._prelimContent.splice(e, t) : U(this.doc, (n) => {
|
|
2859
|
+
$a(n, this, e, t);
|
|
2860
|
+
});
|
|
2861
|
+
}
|
|
2862
|
+
toArray() {
|
|
2863
|
+
return Ua(this);
|
|
2864
|
+
}
|
|
2865
|
+
push(e) {
|
|
2866
|
+
this.insert(this.length, e);
|
|
2867
|
+
}
|
|
2868
|
+
unshift(e) {
|
|
2869
|
+
this.insert(0, e);
|
|
2870
|
+
}
|
|
2871
|
+
get(e) {
|
|
2872
|
+
return Ja(this, e);
|
|
2873
|
+
}
|
|
2874
|
+
slice(e = 0, t = this.length) {
|
|
2875
|
+
return Ha(this, e, t);
|
|
2876
|
+
}
|
|
2877
|
+
forEach(e) {
|
|
2878
|
+
Ga(this, e);
|
|
2879
|
+
}
|
|
2880
|
+
_write(e) {
|
|
2881
|
+
e.writeTypeRef(us);
|
|
2882
|
+
}
|
|
2883
|
+
}, No = (e) => new Mo(), Po = class e extends Mo {
|
|
2884
|
+
constructor(e = "UNDEFINED") {
|
|
2885
|
+
super(), this.nodeName = e, this._prelimAttrs = /* @__PURE__ */ new Map();
|
|
2886
|
+
}
|
|
2887
|
+
get nextSibling() {
|
|
2888
|
+
let e = this._item ? this._item.next : null;
|
|
2889
|
+
return e ? e.content.type : null;
|
|
2890
|
+
}
|
|
2891
|
+
get prevSibling() {
|
|
2892
|
+
let e = this._item ? this._item.prev : null;
|
|
2893
|
+
return e ? e.content.type : null;
|
|
2894
|
+
}
|
|
2895
|
+
_integrate(e, t) {
|
|
2896
|
+
super._integrate(e, t), this._prelimAttrs.forEach((e, t) => {
|
|
2897
|
+
this.setAttribute(t, e);
|
|
2898
|
+
}), this._prelimAttrs = null;
|
|
2899
|
+
}
|
|
2900
|
+
_copy() {
|
|
2901
|
+
return new e(this.nodeName);
|
|
2902
|
+
}
|
|
2903
|
+
clone() {
|
|
2904
|
+
let t = new e(this.nodeName);
|
|
2905
|
+
return Nt(this.getAttributes(), (e, n) => {
|
|
2906
|
+
t.setAttribute(n, e);
|
|
2907
|
+
}), t.insert(0, this.toArray().map((e) => e instanceof K ? e.clone() : e)), t;
|
|
2908
|
+
}
|
|
2909
|
+
toString() {
|
|
2910
|
+
let e = this.getAttributes(), t = [], n = [];
|
|
2911
|
+
for (let t in e) n.push(t);
|
|
2912
|
+
n.sort();
|
|
2913
|
+
let r = n.length;
|
|
2914
|
+
for (let i = 0; i < r; i++) {
|
|
2915
|
+
let r = n[i];
|
|
2916
|
+
t.push(r + "=\"" + e[r] + "\"");
|
|
2917
|
+
}
|
|
2918
|
+
let i = this.nodeName.toLocaleLowerCase();
|
|
2919
|
+
return `<${i}${t.length > 0 ? " " + t.join(" ") : ""}>${super.toString()}</${i}>`;
|
|
2920
|
+
}
|
|
2921
|
+
removeAttribute(e) {
|
|
2922
|
+
this.doc === null ? this._prelimAttrs.delete(e) : U(this.doc, (t) => {
|
|
2923
|
+
eo(t, this, e);
|
|
2924
|
+
});
|
|
2925
|
+
}
|
|
2926
|
+
setAttribute(e, t) {
|
|
2927
|
+
this.doc === null ? this._prelimAttrs.set(e, t) : U(this.doc, (n) => {
|
|
2928
|
+
to(n, this, e, t);
|
|
2929
|
+
});
|
|
2930
|
+
}
|
|
2931
|
+
getAttribute(e) {
|
|
2932
|
+
return no(this, e);
|
|
2933
|
+
}
|
|
2934
|
+
hasAttribute(e) {
|
|
2935
|
+
return io(this, e);
|
|
2936
|
+
}
|
|
2937
|
+
getAttributes(e) {
|
|
2938
|
+
return e ? ao(this, e) : ro(this);
|
|
2939
|
+
}
|
|
2940
|
+
toDOM(e = document, t = {}, n) {
|
|
2941
|
+
let r = e.createElement(this.nodeName), i = this.getAttributes();
|
|
2942
|
+
for (let e in i) {
|
|
2943
|
+
let t = i[e];
|
|
2944
|
+
typeof t == "string" && r.setAttribute(e, t);
|
|
2945
|
+
}
|
|
2946
|
+
return Ga(this, (i) => {
|
|
2947
|
+
r.appendChild(i.toDOM(e, t, n));
|
|
2948
|
+
}), n !== void 0 && n._createAssociation(r, this), r;
|
|
2949
|
+
}
|
|
2950
|
+
_write(e) {
|
|
2951
|
+
e.writeTypeRef(ls), e.writeKey(this.nodeName);
|
|
2952
|
+
}
|
|
2953
|
+
}, Fo = (e) => new Po(e.readKey()), Io = class extends ja {
|
|
2954
|
+
constructor(e, t, n) {
|
|
2955
|
+
super(e, n), this.childListChanged = !1, this.attributesChanged = /* @__PURE__ */ new Set(), t.forEach((e) => {
|
|
2956
|
+
e === null ? this.childListChanged = !0 : this.attributesChanged.add(e);
|
|
2957
|
+
});
|
|
2958
|
+
}
|
|
2959
|
+
}, Lo = class e extends fo {
|
|
2960
|
+
constructor(e) {
|
|
2961
|
+
super(), this.hookName = e;
|
|
2962
|
+
}
|
|
2963
|
+
_copy() {
|
|
2964
|
+
return new e(this.hookName);
|
|
2965
|
+
}
|
|
2966
|
+
clone() {
|
|
2967
|
+
let t = new e(this.hookName);
|
|
2968
|
+
return this.forEach((e, n) => {
|
|
2969
|
+
t.set(n, e);
|
|
2970
|
+
}), t;
|
|
2971
|
+
}
|
|
2972
|
+
toDOM(e = document, t = {}, n) {
|
|
2973
|
+
let r = t[this.hookName], i;
|
|
2974
|
+
return i = r === void 0 ? document.createElement(this.hookName) : r.createDom(this), i.setAttribute("data-yjs-hook", this.hookName), n !== void 0 && n._createAssociation(i, this), i;
|
|
2975
|
+
}
|
|
2976
|
+
_write(e) {
|
|
2977
|
+
e.writeTypeRef(ds), e.writeKey(this.hookName);
|
|
2978
|
+
}
|
|
2979
|
+
}, Ro = (e) => new Lo(e.readKey()), zo = class e extends ko {
|
|
2980
|
+
get nextSibling() {
|
|
2981
|
+
let e = this._item ? this._item.next : null;
|
|
2982
|
+
return e ? e.content.type : null;
|
|
2983
|
+
}
|
|
2984
|
+
get prevSibling() {
|
|
2985
|
+
let e = this._item ? this._item.prev : null;
|
|
2986
|
+
return e ? e.content.type : null;
|
|
2987
|
+
}
|
|
2988
|
+
_copy() {
|
|
2989
|
+
return new e();
|
|
2990
|
+
}
|
|
2991
|
+
clone() {
|
|
2992
|
+
let t = new e();
|
|
2993
|
+
return t.applyDelta(this.toDelta()), t;
|
|
2994
|
+
}
|
|
2995
|
+
toDOM(e = document, t, n) {
|
|
2996
|
+
let r = e.createTextNode(this.toString());
|
|
2997
|
+
return n !== void 0 && n._createAssociation(r, this), r;
|
|
2998
|
+
}
|
|
2999
|
+
toString() {
|
|
3000
|
+
return this.toDelta().map((e) => {
|
|
3001
|
+
let t = [];
|
|
3002
|
+
for (let n in e.attributes) {
|
|
3003
|
+
let r = [];
|
|
3004
|
+
for (let t in e.attributes[n]) r.push({
|
|
3005
|
+
key: t,
|
|
3006
|
+
value: e.attributes[n][t]
|
|
3007
|
+
});
|
|
3008
|
+
r.sort((e, t) => e.key < t.key ? -1 : 1), t.push({
|
|
3009
|
+
nodeName: n,
|
|
3010
|
+
attrs: r
|
|
3011
|
+
});
|
|
3012
|
+
}
|
|
3013
|
+
t.sort((e, t) => e.nodeName < t.nodeName ? -1 : 1);
|
|
3014
|
+
let n = "";
|
|
3015
|
+
for (let e = 0; e < t.length; e++) {
|
|
3016
|
+
let r = t[e];
|
|
3017
|
+
n += `<${r.nodeName}`;
|
|
3018
|
+
for (let e = 0; e < r.attrs.length; e++) {
|
|
3019
|
+
let t = r.attrs[e];
|
|
3020
|
+
n += ` ${t.key}="${t.value}"`;
|
|
3021
|
+
}
|
|
3022
|
+
n += ">";
|
|
3023
|
+
}
|
|
3024
|
+
n += e.insert;
|
|
3025
|
+
for (let e = t.length - 1; e >= 0; e--) n += `</${t[e].nodeName}>`;
|
|
3026
|
+
return n;
|
|
3027
|
+
}).join("");
|
|
3028
|
+
}
|
|
3029
|
+
toJSON() {
|
|
3030
|
+
return this.toString();
|
|
3031
|
+
}
|
|
3032
|
+
_write(e) {
|
|
3033
|
+
e.writeTypeRef(fs);
|
|
3034
|
+
}
|
|
3035
|
+
}, Bo = (e) => new zo(), Vo = class {
|
|
3036
|
+
constructor(e, t) {
|
|
3037
|
+
this.id = e, this.length = t;
|
|
3038
|
+
}
|
|
3039
|
+
get deleted() {
|
|
3040
|
+
throw C();
|
|
3041
|
+
}
|
|
3042
|
+
mergeWith(e) {
|
|
3043
|
+
return !1;
|
|
3044
|
+
}
|
|
3045
|
+
write(e, t, n) {
|
|
3046
|
+
throw C();
|
|
3047
|
+
}
|
|
3048
|
+
integrate(e, t) {
|
|
3049
|
+
throw C();
|
|
3050
|
+
}
|
|
3051
|
+
}, Ho = 0, J = class extends Vo {
|
|
3052
|
+
get deleted() {
|
|
3053
|
+
return !0;
|
|
3054
|
+
}
|
|
3055
|
+
delete() {}
|
|
3056
|
+
mergeWith(e) {
|
|
3057
|
+
return this.constructor === e.constructor ? (this.length += e.length, !0) : !1;
|
|
3058
|
+
}
|
|
3059
|
+
integrate(e, t) {
|
|
3060
|
+
t > 0 && (this.id.clock += t, this.length -= t), na(e.doc.store, this);
|
|
3061
|
+
}
|
|
3062
|
+
write(e, t) {
|
|
3063
|
+
e.writeInfo(Ho), e.writeLen(this.length - t);
|
|
3064
|
+
}
|
|
3065
|
+
getMissing(e, t) {
|
|
3066
|
+
return null;
|
|
3067
|
+
}
|
|
3068
|
+
}, Uo = class e {
|
|
3069
|
+
constructor(e) {
|
|
3070
|
+
this.content = e;
|
|
3071
|
+
}
|
|
3072
|
+
getLength() {
|
|
3073
|
+
return 1;
|
|
3074
|
+
}
|
|
3075
|
+
getContent() {
|
|
3076
|
+
return [this.content];
|
|
3077
|
+
}
|
|
3078
|
+
isCountable() {
|
|
3079
|
+
return !0;
|
|
3080
|
+
}
|
|
3081
|
+
copy() {
|
|
3082
|
+
return new e(this.content);
|
|
3083
|
+
}
|
|
3084
|
+
splice(e) {
|
|
3085
|
+
throw C();
|
|
3086
|
+
}
|
|
3087
|
+
mergeWith(e) {
|
|
3088
|
+
return !1;
|
|
3089
|
+
}
|
|
3090
|
+
integrate(e, t) {}
|
|
3091
|
+
delete(e) {}
|
|
3092
|
+
gc(e) {}
|
|
3093
|
+
write(e, t) {
|
|
3094
|
+
e.writeBuf(this.content);
|
|
3095
|
+
}
|
|
3096
|
+
getRef() {
|
|
3097
|
+
return 3;
|
|
3098
|
+
}
|
|
3099
|
+
}, Wo = (e) => new Uo(e.readBuf()), Go = class e {
|
|
3100
|
+
constructor(e) {
|
|
3101
|
+
this.len = e;
|
|
3102
|
+
}
|
|
3103
|
+
getLength() {
|
|
3104
|
+
return this.len;
|
|
3105
|
+
}
|
|
3106
|
+
getContent() {
|
|
3107
|
+
return [];
|
|
3108
|
+
}
|
|
3109
|
+
isCountable() {
|
|
3110
|
+
return !1;
|
|
3111
|
+
}
|
|
3112
|
+
copy() {
|
|
3113
|
+
return new e(this.len);
|
|
3114
|
+
}
|
|
3115
|
+
splice(t) {
|
|
3116
|
+
let n = new e(this.len - t);
|
|
3117
|
+
return this.len = t, n;
|
|
3118
|
+
}
|
|
3119
|
+
mergeWith(e) {
|
|
3120
|
+
return this.len += e.len, !0;
|
|
3121
|
+
}
|
|
3122
|
+
integrate(e, t) {
|
|
3123
|
+
ei(e.deleteSet, t.id.client, t.id.clock, this.len), t.markDeleted();
|
|
3124
|
+
}
|
|
3125
|
+
delete(e) {}
|
|
3126
|
+
gc(e) {}
|
|
3127
|
+
write(e, t) {
|
|
3128
|
+
e.writeLen(this.len - t);
|
|
3129
|
+
}
|
|
3130
|
+
getRef() {
|
|
3131
|
+
return 1;
|
|
3132
|
+
}
|
|
3133
|
+
}, Ko = (e) => new Go(e.readLen()), qo = (e, t) => new si({
|
|
3134
|
+
guid: e,
|
|
3135
|
+
...t,
|
|
3136
|
+
shouldLoad: t.shouldLoad || t.autoLoad || !1
|
|
3137
|
+
}), Jo = class e {
|
|
3138
|
+
constructor(e) {
|
|
3139
|
+
e._item && console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."), this.doc = e;
|
|
3140
|
+
let t = {};
|
|
3141
|
+
this.opts = t, e.gc || (t.gc = !1), e.autoLoad && (t.autoLoad = !0), e.meta !== null && (t.meta = e.meta);
|
|
3142
|
+
}
|
|
3143
|
+
getLength() {
|
|
3144
|
+
return 1;
|
|
3145
|
+
}
|
|
3146
|
+
getContent() {
|
|
3147
|
+
return [this.doc];
|
|
3148
|
+
}
|
|
3149
|
+
isCountable() {
|
|
3150
|
+
return !0;
|
|
3151
|
+
}
|
|
3152
|
+
copy() {
|
|
3153
|
+
return new e(qo(this.doc.guid, this.opts));
|
|
3154
|
+
}
|
|
3155
|
+
splice(e) {
|
|
3156
|
+
throw C();
|
|
3157
|
+
}
|
|
3158
|
+
mergeWith(e) {
|
|
3159
|
+
return !1;
|
|
3160
|
+
}
|
|
3161
|
+
integrate(e, t) {
|
|
3162
|
+
this.doc._item = t, e.subdocsAdded.add(this.doc), this.doc.shouldLoad && e.subdocsLoaded.add(this.doc);
|
|
3163
|
+
}
|
|
3164
|
+
delete(e) {
|
|
3165
|
+
e.subdocsAdded.has(this.doc) ? e.subdocsAdded.delete(this.doc) : e.subdocsRemoved.add(this.doc);
|
|
3166
|
+
}
|
|
3167
|
+
gc(e) {}
|
|
3168
|
+
write(e, t) {
|
|
3169
|
+
e.writeString(this.doc.guid), e.writeAny(this.opts);
|
|
3170
|
+
}
|
|
3171
|
+
getRef() {
|
|
3172
|
+
return 9;
|
|
3173
|
+
}
|
|
3174
|
+
}, Yo = (e) => new Jo(qo(e.readString(), e.readAny())), Xo = class e {
|
|
3175
|
+
constructor(e) {
|
|
3176
|
+
this.embed = e;
|
|
3177
|
+
}
|
|
3178
|
+
getLength() {
|
|
3179
|
+
return 1;
|
|
3180
|
+
}
|
|
3181
|
+
getContent() {
|
|
3182
|
+
return [this.embed];
|
|
3183
|
+
}
|
|
3184
|
+
isCountable() {
|
|
3185
|
+
return !0;
|
|
3186
|
+
}
|
|
3187
|
+
copy() {
|
|
3188
|
+
return new e(this.embed);
|
|
3189
|
+
}
|
|
3190
|
+
splice(e) {
|
|
3191
|
+
throw C();
|
|
3192
|
+
}
|
|
3193
|
+
mergeWith(e) {
|
|
3194
|
+
return !1;
|
|
3195
|
+
}
|
|
3196
|
+
integrate(e, t) {}
|
|
3197
|
+
delete(e) {}
|
|
3198
|
+
gc(e) {}
|
|
3199
|
+
write(e, t) {
|
|
3200
|
+
e.writeJSON(this.embed);
|
|
3201
|
+
}
|
|
3202
|
+
getRef() {
|
|
3203
|
+
return 5;
|
|
3204
|
+
}
|
|
3205
|
+
}, Zo = (e) => new Xo(e.readJSON()), Y = class e {
|
|
3206
|
+
constructor(e, t) {
|
|
3207
|
+
this.key = e, this.value = t;
|
|
3208
|
+
}
|
|
3209
|
+
getLength() {
|
|
3210
|
+
return 1;
|
|
3211
|
+
}
|
|
3212
|
+
getContent() {
|
|
3213
|
+
return [];
|
|
3214
|
+
}
|
|
3215
|
+
isCountable() {
|
|
3216
|
+
return !1;
|
|
3217
|
+
}
|
|
3218
|
+
copy() {
|
|
3219
|
+
return new e(this.key, this.value);
|
|
3220
|
+
}
|
|
3221
|
+
splice(e) {
|
|
3222
|
+
throw C();
|
|
3223
|
+
}
|
|
3224
|
+
mergeWith(e) {
|
|
3225
|
+
return !1;
|
|
3226
|
+
}
|
|
3227
|
+
integrate(e, t) {
|
|
3228
|
+
let n = t.parent;
|
|
3229
|
+
n._searchMarker = null, n._hasFormatting = !0;
|
|
3230
|
+
}
|
|
3231
|
+
delete(e) {}
|
|
3232
|
+
gc(e) {}
|
|
3233
|
+
write(e, t) {
|
|
3234
|
+
e.writeKey(this.key), e.writeJSON(this.value);
|
|
3235
|
+
}
|
|
3236
|
+
getRef() {
|
|
3237
|
+
return 6;
|
|
3238
|
+
}
|
|
3239
|
+
}, Qo = (e) => new Y(e.readKey(), e.readJSON()), $o = class e {
|
|
3240
|
+
constructor(e) {
|
|
3241
|
+
this.arr = e;
|
|
3242
|
+
}
|
|
3243
|
+
getLength() {
|
|
3244
|
+
return this.arr.length;
|
|
3245
|
+
}
|
|
3246
|
+
getContent() {
|
|
3247
|
+
return this.arr;
|
|
3248
|
+
}
|
|
3249
|
+
isCountable() {
|
|
3250
|
+
return !0;
|
|
3251
|
+
}
|
|
3252
|
+
copy() {
|
|
3253
|
+
return new e(this.arr);
|
|
3254
|
+
}
|
|
3255
|
+
splice(t) {
|
|
3256
|
+
let n = new e(this.arr.slice(t));
|
|
3257
|
+
return this.arr = this.arr.slice(0, t), n;
|
|
3258
|
+
}
|
|
3259
|
+
mergeWith(e) {
|
|
3260
|
+
return this.arr = this.arr.concat(e.arr), !0;
|
|
3261
|
+
}
|
|
3262
|
+
integrate(e, t) {}
|
|
3263
|
+
delete(e) {}
|
|
3264
|
+
gc(e) {}
|
|
3265
|
+
write(e, t) {
|
|
3266
|
+
let n = this.arr.length;
|
|
3267
|
+
e.writeLen(n - t);
|
|
3268
|
+
for (let r = t; r < n; r++) {
|
|
3269
|
+
let t = this.arr[r];
|
|
3270
|
+
e.writeString(t === void 0 ? "undefined" : JSON.stringify(t));
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
getRef() {
|
|
3274
|
+
return 2;
|
|
3275
|
+
}
|
|
3276
|
+
}, es = (e) => {
|
|
3277
|
+
let t = e.readLen(), n = [];
|
|
3278
|
+
for (let r = 0; r < t; r++) {
|
|
3279
|
+
let t = e.readString();
|
|
3280
|
+
t === "undefined" ? n.push(void 0) : n.push(JSON.parse(t));
|
|
3281
|
+
}
|
|
3282
|
+
return new $o(n);
|
|
3283
|
+
}, ts = Zt("node_env") === "development", ns = class e {
|
|
3284
|
+
constructor(e) {
|
|
3285
|
+
this.arr = e, ts && Vt(e);
|
|
3286
|
+
}
|
|
3287
|
+
getLength() {
|
|
3288
|
+
return this.arr.length;
|
|
3289
|
+
}
|
|
3290
|
+
getContent() {
|
|
3291
|
+
return this.arr;
|
|
3292
|
+
}
|
|
3293
|
+
isCountable() {
|
|
3294
|
+
return !0;
|
|
3295
|
+
}
|
|
3296
|
+
copy() {
|
|
3297
|
+
return new e(this.arr);
|
|
3298
|
+
}
|
|
3299
|
+
splice(t) {
|
|
3300
|
+
let n = new e(this.arr.slice(t));
|
|
3301
|
+
return this.arr = this.arr.slice(0, t), n;
|
|
3302
|
+
}
|
|
3303
|
+
mergeWith(e) {
|
|
3304
|
+
return this.arr = this.arr.concat(e.arr), !0;
|
|
3305
|
+
}
|
|
3306
|
+
integrate(e, t) {}
|
|
3307
|
+
delete(e) {}
|
|
3308
|
+
gc(e) {}
|
|
3309
|
+
write(e, t) {
|
|
3310
|
+
let n = this.arr.length;
|
|
3311
|
+
e.writeLen(n - t);
|
|
3312
|
+
for (let r = t; r < n; r++) {
|
|
3313
|
+
let t = this.arr[r];
|
|
3314
|
+
e.writeAny(t);
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
getRef() {
|
|
3318
|
+
return 8;
|
|
3319
|
+
}
|
|
3320
|
+
}, rs = (e) => {
|
|
3321
|
+
let t = e.readLen(), n = [];
|
|
3322
|
+
for (let r = 0; r < t; r++) n.push(e.readAny());
|
|
3323
|
+
return new ns(n);
|
|
3324
|
+
}, X = class e {
|
|
3325
|
+
constructor(e) {
|
|
3326
|
+
this.str = e;
|
|
3327
|
+
}
|
|
3328
|
+
getLength() {
|
|
3329
|
+
return this.str.length;
|
|
3330
|
+
}
|
|
3331
|
+
getContent() {
|
|
3332
|
+
return this.str.split("");
|
|
3333
|
+
}
|
|
3334
|
+
isCountable() {
|
|
3335
|
+
return !0;
|
|
3336
|
+
}
|
|
3337
|
+
copy() {
|
|
3338
|
+
return new e(this.str);
|
|
3339
|
+
}
|
|
3340
|
+
splice(t) {
|
|
3341
|
+
let n = new e(this.str.slice(t));
|
|
3342
|
+
this.str = this.str.slice(0, t);
|
|
3343
|
+
let r = this.str.charCodeAt(t - 1);
|
|
3344
|
+
return r >= 55296 && r <= 56319 && (this.str = this.str.slice(0, t - 1) + "�", n.str = "�" + n.str.slice(1)), n;
|
|
3345
|
+
}
|
|
3346
|
+
mergeWith(e) {
|
|
3347
|
+
return this.str += e.str, !0;
|
|
3348
|
+
}
|
|
3349
|
+
integrate(e, t) {}
|
|
3350
|
+
delete(e) {}
|
|
3351
|
+
gc(e) {}
|
|
3352
|
+
write(e, t) {
|
|
3353
|
+
e.writeString(t === 0 ? this.str : this.str.slice(t));
|
|
3354
|
+
}
|
|
3355
|
+
getRef() {
|
|
3356
|
+
return 4;
|
|
3357
|
+
}
|
|
3358
|
+
}, is = (e) => new X(e.readString()), as = [
|
|
3359
|
+
lo,
|
|
3360
|
+
po,
|
|
3361
|
+
Ao,
|
|
3362
|
+
Fo,
|
|
3363
|
+
No,
|
|
3364
|
+
Ro,
|
|
3365
|
+
Bo
|
|
3366
|
+
], os = 0, ss = 1, cs = 2, ls = 3, us = 4, ds = 5, fs = 6, Z = class e {
|
|
3367
|
+
constructor(e) {
|
|
3368
|
+
this.type = e;
|
|
3369
|
+
}
|
|
3370
|
+
getLength() {
|
|
3371
|
+
return 1;
|
|
3372
|
+
}
|
|
3373
|
+
getContent() {
|
|
3374
|
+
return [this.type];
|
|
3375
|
+
}
|
|
3376
|
+
isCountable() {
|
|
3377
|
+
return !0;
|
|
3378
|
+
}
|
|
3379
|
+
copy() {
|
|
3380
|
+
return new e(this.type._copy());
|
|
3381
|
+
}
|
|
3382
|
+
splice(e) {
|
|
3383
|
+
throw C();
|
|
3384
|
+
}
|
|
3385
|
+
mergeWith(e) {
|
|
3386
|
+
return !1;
|
|
3387
|
+
}
|
|
3388
|
+
integrate(e, t) {
|
|
3389
|
+
this.type._integrate(e.doc, t);
|
|
3390
|
+
}
|
|
3391
|
+
delete(e) {
|
|
3392
|
+
let t = this.type._start;
|
|
3393
|
+
for (; t !== null;) t.deleted ? t.id.clock < (e.beforeState.get(t.id.client) || 0) && e._mergeStructs.push(t) : t.delete(e), t = t.right;
|
|
3394
|
+
this.type._map.forEach((t) => {
|
|
3395
|
+
t.deleted ? t.id.clock < (e.beforeState.get(t.id.client) || 0) && e._mergeStructs.push(t) : t.delete(e);
|
|
3396
|
+
}), e.changed.delete(this.type);
|
|
3397
|
+
}
|
|
3398
|
+
gc(e) {
|
|
3399
|
+
let t = this.type._start;
|
|
3400
|
+
for (; t !== null;) t.gc(e, !0), t = t.right;
|
|
3401
|
+
this.type._start = null, this.type._map.forEach((t) => {
|
|
3402
|
+
for (; t !== null;) t.gc(e, !0), t = t.left;
|
|
3403
|
+
}), this.type._map = /* @__PURE__ */ new Map();
|
|
3404
|
+
}
|
|
3405
|
+
write(e, t) {
|
|
3406
|
+
this.type._write(e);
|
|
3407
|
+
}
|
|
3408
|
+
getRef() {
|
|
3409
|
+
return 7;
|
|
3410
|
+
}
|
|
3411
|
+
}, ps = (e) => new Z(as[e.readTypeRef()](e)), ms = (e, t) => {
|
|
3412
|
+
let n = t, r = 0, i;
|
|
3413
|
+
do
|
|
3414
|
+
r > 0 && (n = R(n.client, n.clock + r)), i = ra(e, n), r = n.clock - i.id.clock, n = i.redone;
|
|
3415
|
+
while (n !== null && i instanceof Q);
|
|
3416
|
+
return {
|
|
3417
|
+
item: i,
|
|
3418
|
+
diff: r
|
|
3419
|
+
};
|
|
3420
|
+
}, hs = (e, t) => {
|
|
3421
|
+
for (; e !== null && e.keep !== t;) e.keep = t, e = e.parent._item;
|
|
3422
|
+
}, gs = (e, t, n) => {
|
|
3423
|
+
let { client: r, clock: i } = t.id, a = new Q(R(r, i + n), t, R(r, i + n - 1), t.right, t.rightOrigin, t.parent, t.parentSub, t.content.splice(n));
|
|
3424
|
+
return t.deleted && a.markDeleted(), t.keep && (a.keep = !0), t.redone !== null && (a.redone = R(t.redone.client, t.redone.clock + n)), t.right = a, a.right !== null && (a.right.left = a), e._mergeStructs.push(a), a.parentSub !== null && a.right === null && a.parent._map.set(a.parentSub, a), t.length = n, a;
|
|
3425
|
+
}, _s = (e, t) => u(e, (e) => Zr(e.deletions, t)), vs = (e, t, n, r, i, a) => {
|
|
3426
|
+
let o = e.doc, s = o.store, c = o.clientID, l = t.redone;
|
|
3427
|
+
if (l !== null) return H(e, l);
|
|
3428
|
+
let u = t.parent._item, d = null, f;
|
|
3429
|
+
if (u !== null && u.deleted === !0) {
|
|
3430
|
+
if (u.redone === null && (!n.has(u) || vs(e, u, n, r, i, a) === null)) return null;
|
|
3431
|
+
for (; u.redone !== null;) u = H(e, u.redone);
|
|
3432
|
+
}
|
|
3433
|
+
let p = u === null ? t.parent : u.content.type;
|
|
3434
|
+
if (t.parentSub === null) {
|
|
3435
|
+
for (d = t.left, f = t; d !== null;) {
|
|
3436
|
+
let t = d;
|
|
3437
|
+
for (; t !== null && t.parent._item !== u;) t = t.redone === null ? null : H(e, t.redone);
|
|
3438
|
+
if (t !== null && t.parent._item === u) {
|
|
3439
|
+
d = t;
|
|
3440
|
+
break;
|
|
3441
|
+
}
|
|
3442
|
+
d = d.left;
|
|
3443
|
+
}
|
|
3444
|
+
for (; f !== null;) {
|
|
3445
|
+
let t = f;
|
|
3446
|
+
for (; t !== null && t.parent._item !== u;) t = t.redone === null ? null : H(e, t.redone);
|
|
3447
|
+
if (t !== null && t.parent._item === u) {
|
|
3448
|
+
f = t;
|
|
3449
|
+
break;
|
|
3450
|
+
}
|
|
3451
|
+
f = f.right;
|
|
3452
|
+
}
|
|
3453
|
+
} else {
|
|
3454
|
+
if (f = null, t.right && !i) {
|
|
3455
|
+
for (d = t; d !== null && d.right !== null && (d.right.redone || Zr(r, d.right.id) || _s(a.undoStack, d.right.id) || _s(a.redoStack, d.right.id));) for (d = d.right; d.redone;) d = H(e, d.redone);
|
|
3456
|
+
if (d && d.right !== null) return null;
|
|
3457
|
+
} else d = p._map.get(t.parentSub) || null;
|
|
3458
|
+
d !== null && d.parent._item !== u && (d = p._map.get(t.parentSub) || null);
|
|
3459
|
+
}
|
|
3460
|
+
let ee = R(c, B(s, c)), m = new Q(ee, d, d && d.lastId, f, f && f.id, p, t.parentSub, t.content.copy());
|
|
3461
|
+
return t.redone = ee, hs(m, !0), m.integrate(e, 0), m;
|
|
3462
|
+
}, Q = class e extends Vo {
|
|
3463
|
+
constructor(e, t, n, r, i, a, o, s) {
|
|
3464
|
+
super(e, s.getLength()), this.origin = n, this.left = t, this.right = r, this.rightOrigin = i, this.parent = a, this.parentSub = o, this.redone = null, this.content = s, this.info = this.content.isCountable() ? 2 : 0;
|
|
3465
|
+
}
|
|
3466
|
+
set marker(e) {
|
|
3467
|
+
(this.info & 8) > 0 !== e && (this.info ^= 8);
|
|
3468
|
+
}
|
|
3469
|
+
get marker() {
|
|
3470
|
+
return (this.info & 8) > 0;
|
|
3471
|
+
}
|
|
3472
|
+
get keep() {
|
|
3473
|
+
return (this.info & 1) > 0;
|
|
3474
|
+
}
|
|
3475
|
+
set keep(e) {
|
|
3476
|
+
this.keep !== e && (this.info ^= 1);
|
|
3477
|
+
}
|
|
3478
|
+
get countable() {
|
|
3479
|
+
return (this.info & 2) > 0;
|
|
3480
|
+
}
|
|
3481
|
+
get deleted() {
|
|
3482
|
+
return (this.info & 4) > 0;
|
|
3483
|
+
}
|
|
3484
|
+
set deleted(e) {
|
|
3485
|
+
this.deleted !== e && (this.info ^= 4);
|
|
3486
|
+
}
|
|
3487
|
+
markDeleted() {
|
|
3488
|
+
this.info |= 4;
|
|
3489
|
+
}
|
|
3490
|
+
getMissing(t, n) {
|
|
3491
|
+
if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= B(n, this.origin.client)) return this.origin.client;
|
|
3492
|
+
if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= B(n, this.rightOrigin.client)) return this.rightOrigin.client;
|
|
3493
|
+
if (this.parent && this.parent.constructor === Li && this.id.client !== this.parent.client && this.parent.clock >= B(n, this.parent.client)) return this.parent.client;
|
|
3494
|
+
if (this.origin &&= (this.left = aa(t, n, this.origin), this.left.lastId), this.rightOrigin &&= (this.right = H(t, this.rightOrigin), this.right.id), this.left && this.left.constructor === J || this.right && this.right.constructor === J) this.parent = null;
|
|
3495
|
+
else if (!this.parent) this.left && this.left.constructor === e ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === e && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
|
|
3496
|
+
else if (this.parent.constructor === Li) {
|
|
3497
|
+
let e = ra(n, this.parent);
|
|
3498
|
+
e.constructor === J ? this.parent = null : this.parent = e.content.type;
|
|
3499
|
+
}
|
|
3500
|
+
return null;
|
|
3501
|
+
}
|
|
3502
|
+
integrate(e, t) {
|
|
3503
|
+
if (t > 0 && (this.id.clock += t, this.left = aa(e, e.doc.store, R(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(t), this.length -= t), this.parent) {
|
|
3504
|
+
if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
|
|
3505
|
+
let t = this.left, n;
|
|
3506
|
+
if (t !== null) n = t.right;
|
|
3507
|
+
else if (this.parentSub !== null) for (n = this.parent._map.get(this.parentSub) || null; n !== null && n.left !== null;) n = n.left;
|
|
3508
|
+
else n = this.parent._start;
|
|
3509
|
+
let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
3510
|
+
for (; n !== null && n !== this.right;) {
|
|
3511
|
+
if (i.add(n), r.add(n), Ri(this.origin, n.origin)) {
|
|
3512
|
+
if (n.id.client < this.id.client) t = n, r.clear();
|
|
3513
|
+
else if (Ri(this.rightOrigin, n.rightOrigin)) break;
|
|
3514
|
+
} else if (n.origin !== null && i.has(ra(e.doc.store, n.origin))) r.has(ra(e.doc.store, n.origin)) || (t = n, r.clear());
|
|
3515
|
+
else break;
|
|
3516
|
+
n = n.right;
|
|
3517
|
+
}
|
|
3518
|
+
this.left = t;
|
|
3519
|
+
}
|
|
3520
|
+
if (this.left !== null) {
|
|
3521
|
+
let e = this.left.right;
|
|
3522
|
+
this.right = e, this.left.right = this;
|
|
3523
|
+
} else {
|
|
3524
|
+
let e;
|
|
3525
|
+
if (this.parentSub !== null) for (e = this.parent._map.get(this.parentSub) || null; e !== null && e.left !== null;) e = e.left;
|
|
3526
|
+
else e = this.parent._start, this.parent._start = this;
|
|
3527
|
+
this.right = e;
|
|
3528
|
+
}
|
|
3529
|
+
this.right === null ? this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(e)) : this.right.left = this, this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), na(e.doc.store, this), this.content.integrate(e, this), ua(e, this.parent, this.parentSub), (this.parent._item !== null && this.parent._item.deleted || this.parentSub !== null && this.right !== null) && this.delete(e);
|
|
3530
|
+
} else new J(this.id, this.length).integrate(e, 0);
|
|
3531
|
+
}
|
|
3532
|
+
get next() {
|
|
3533
|
+
let e = this.right;
|
|
3534
|
+
for (; e !== null && e.deleted;) e = e.right;
|
|
3535
|
+
return e;
|
|
3536
|
+
}
|
|
3537
|
+
get prev() {
|
|
3538
|
+
let e = this.left;
|
|
3539
|
+
for (; e !== null && e.deleted;) e = e.left;
|
|
3540
|
+
return e;
|
|
3541
|
+
}
|
|
3542
|
+
get lastId() {
|
|
3543
|
+
return this.length === 1 ? this.id : R(this.id.client, this.id.clock + this.length - 1);
|
|
3544
|
+
}
|
|
3545
|
+
mergeWith(e) {
|
|
3546
|
+
if (this.constructor === e.constructor && Ri(e.origin, this.lastId) && this.right === e && Ri(this.rightOrigin, e.rightOrigin) && this.id.client === e.id.client && this.id.clock + this.length === e.id.clock && this.deleted === e.deleted && this.redone === null && e.redone === null && this.content.constructor === e.content.constructor && this.content.mergeWith(e.content)) {
|
|
3547
|
+
let t = this.parent._searchMarker;
|
|
3548
|
+
return t && t.forEach((t) => {
|
|
3549
|
+
t.p === e && (t.p = this, !this.deleted && this.countable && (t.index -= this.length));
|
|
3550
|
+
}), e.keep && (this.keep = !0), this.right = e.right, this.right !== null && (this.right.left = this), this.length += e.length, !0;
|
|
3551
|
+
}
|
|
3552
|
+
return !1;
|
|
3553
|
+
}
|
|
3554
|
+
delete(e) {
|
|
3555
|
+
if (!this.deleted) {
|
|
3556
|
+
let t = this.parent;
|
|
3557
|
+
this.countable && this.parentSub === null && (t._length -= this.length), this.markDeleted(), ei(e.deleteSet, this.id.client, this.id.clock, this.length), ua(e, t, this.parentSub), this.content.delete(e);
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
gc(e, t) {
|
|
3561
|
+
if (!this.deleted) throw w();
|
|
3562
|
+
this.content.gc(e), t ? oa(e, this, new J(this.id, this.length)) : this.content = new Go(this.length);
|
|
3563
|
+
}
|
|
3564
|
+
write(e, t) {
|
|
3565
|
+
let n = t > 0 ? R(this.id.client, this.id.clock + t - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, a = this.content.getRef() & 31 | (n === null ? 0 : 128) | (r === null ? 0 : 64) | (i === null ? 0 : 32);
|
|
3566
|
+
if (e.writeInfo(a), n !== null && e.writeLeftID(n), r !== null && e.writeRightID(r), n === null && r === null) {
|
|
3567
|
+
let t = this.parent;
|
|
3568
|
+
if (t._item !== void 0) {
|
|
3569
|
+
let n = t._item;
|
|
3570
|
+
if (n === null) {
|
|
3571
|
+
let n = zi(t);
|
|
3572
|
+
e.writeParentInfo(!0), e.writeString(n);
|
|
3573
|
+
} else e.writeParentInfo(!1), e.writeLeftID(n.id);
|
|
3574
|
+
} else t.constructor === String ? (e.writeParentInfo(!0), e.writeString(t)) : t.constructor === Li ? (e.writeParentInfo(!1), e.writeLeftID(t)) : w();
|
|
3575
|
+
i !== null && e.writeString(i);
|
|
3576
|
+
}
|
|
3577
|
+
this.content.write(e, t);
|
|
3578
|
+
}
|
|
3579
|
+
}, ys = (e, t) => bs[t & 31](e), bs = [
|
|
3580
|
+
() => {
|
|
3581
|
+
w();
|
|
3582
|
+
},
|
|
3583
|
+
Ko,
|
|
3584
|
+
es,
|
|
3585
|
+
Wo,
|
|
3586
|
+
is,
|
|
3587
|
+
Zo,
|
|
3588
|
+
Qo,
|
|
3589
|
+
ps,
|
|
3590
|
+
rs,
|
|
3591
|
+
Yo,
|
|
3592
|
+
() => {
|
|
3593
|
+
w();
|
|
3594
|
+
}
|
|
3595
|
+
], xs = 10, $ = class extends Vo {
|
|
3596
|
+
get deleted() {
|
|
3597
|
+
return !0;
|
|
3598
|
+
}
|
|
3599
|
+
delete() {}
|
|
3600
|
+
mergeWith(e) {
|
|
3601
|
+
return this.constructor === e.constructor ? (this.length += e.length, !0) : !1;
|
|
3602
|
+
}
|
|
3603
|
+
integrate(e, t) {
|
|
3604
|
+
w();
|
|
3605
|
+
}
|
|
3606
|
+
write(e, t) {
|
|
3607
|
+
e.writeInfo(xs), y(e.restEncoder, this.length - t);
|
|
3608
|
+
}
|
|
3609
|
+
getMissing(e, t) {
|
|
3610
|
+
return null;
|
|
3611
|
+
}
|
|
3612
|
+
}, Ss = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}, Cs = "__ $YJS$ __";
|
|
3613
|
+
Ss[Cs] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"), Ss[Cs] = !0;
|
|
3614
|
+
//#endregion
|
|
3615
|
+
//#region ../node_modules/.bun/y-protocols@1.0.7+253afa400b9c0a30/node_modules/y-protocols/awareness.js
|
|
3616
|
+
var ws = 3e4, Ts = class extends ee {
|
|
3617
|
+
constructor(e) {
|
|
3618
|
+
super(), this.doc = e, this.clientID = e.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = setInterval(() => {
|
|
3619
|
+
let e = bt();
|
|
3620
|
+
this.getLocalState() !== null && 3e4 / 2 <= e - this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
|
|
3621
|
+
let t = [];
|
|
3622
|
+
this.meta.forEach((n, r) => {
|
|
3623
|
+
r !== this.clientID && 3e4 <= e - n.lastUpdated && this.states.has(r) && t.push(r);
|
|
3624
|
+
}), t.length > 0 && Es(this, t, "timeout");
|
|
3625
|
+
}, m(ws / 10)), e.on("destroy", () => {
|
|
3626
|
+
this.destroy();
|
|
3627
|
+
}), this.setLocalState({});
|
|
3628
|
+
}
|
|
3629
|
+
destroy() {
|
|
3630
|
+
this.emit("destroy", [this]), this.setLocalState(null), super.destroy(), clearInterval(this._checkInterval);
|
|
3631
|
+
}
|
|
3632
|
+
getLocalState() {
|
|
3633
|
+
return this.states.get(this.clientID) || null;
|
|
3634
|
+
}
|
|
3635
|
+
setLocalState(e) {
|
|
3636
|
+
let t = this.clientID, n = this.meta.get(t), r = n === void 0 ? 0 : n.clock + 1, i = this.states.get(t);
|
|
3637
|
+
e === null ? this.states.delete(t) : this.states.set(t, e), this.meta.set(t, {
|
|
3638
|
+
clock: r,
|
|
3639
|
+
lastUpdated: bt()
|
|
3640
|
+
});
|
|
3641
|
+
let a = [], o = [], s = [], c = [];
|
|
3642
|
+
e === null ? c.push(t) : i == null ? e != null && a.push(t) : (o.push(t), Wt(i, e) || s.push(t)), (a.length > 0 || s.length > 0 || c.length > 0) && this.emit("change", [{
|
|
3643
|
+
added: a,
|
|
3644
|
+
updated: s,
|
|
3645
|
+
removed: c
|
|
3646
|
+
}, "local"]), this.emit("update", [{
|
|
3647
|
+
added: a,
|
|
3648
|
+
updated: o,
|
|
3649
|
+
removed: c
|
|
3650
|
+
}, "local"]);
|
|
3651
|
+
}
|
|
3652
|
+
setLocalStateField(e, t) {
|
|
3653
|
+
let n = this.getLocalState();
|
|
3654
|
+
n !== null && this.setLocalState({
|
|
3655
|
+
...n,
|
|
3656
|
+
[e]: t
|
|
3657
|
+
});
|
|
3658
|
+
}
|
|
3659
|
+
getStates() {
|
|
3660
|
+
return this.states;
|
|
3661
|
+
}
|
|
3662
|
+
}, Es = (e, t, n) => {
|
|
3663
|
+
let r = [];
|
|
3664
|
+
for (let n = 0; n < t.length; n++) {
|
|
3665
|
+
let i = t[n];
|
|
3666
|
+
if (e.states.has(i)) {
|
|
3667
|
+
if (e.states.delete(i), i === e.clientID) {
|
|
3668
|
+
let t = e.meta.get(i);
|
|
3669
|
+
e.meta.set(i, {
|
|
3670
|
+
clock: t.clock + 1,
|
|
3671
|
+
lastUpdated: bt()
|
|
3672
|
+
});
|
|
3673
|
+
}
|
|
3674
|
+
r.push(i);
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
r.length > 0 && (e.emit("change", [{
|
|
3678
|
+
added: [],
|
|
3679
|
+
updated: [],
|
|
3680
|
+
removed: r
|
|
3681
|
+
}, n]), e.emit("update", [{
|
|
3682
|
+
added: [],
|
|
3683
|
+
updated: [],
|
|
3684
|
+
removed: r
|
|
3685
|
+
}, n]));
|
|
3686
|
+
}, Ds = (e, t, n = e.states) => {
|
|
3687
|
+
let r = t.length, i = g();
|
|
3688
|
+
y(i, r);
|
|
3689
|
+
for (let a = 0; a < r; a++) {
|
|
3690
|
+
let r = t[a], o = n.get(r) || null, s = e.meta.get(r).clock;
|
|
3691
|
+
y(i, r), y(i, s), b(i, JSON.stringify(o));
|
|
3692
|
+
}
|
|
3693
|
+
return _(i);
|
|
3694
|
+
}, Os = (e, t, n) => {
|
|
3695
|
+
let r = T(t), i = bt(), a = [], o = [], s = [], c = [], l = D(r);
|
|
3696
|
+
for (let t = 0; t < l; t++) {
|
|
3697
|
+
let t = D(r), n = D(r), l = JSON.parse(O(r)), u = e.meta.get(t), d = e.states.get(t), f = u === void 0 ? 0 : u.clock;
|
|
3698
|
+
(f < n || f === n && l === null && e.states.has(t)) && (l === null ? t === e.clientID && e.getLocalState() != null ? n++ : e.states.delete(t) : e.states.set(t, l), e.meta.set(t, {
|
|
3699
|
+
clock: n,
|
|
3700
|
+
lastUpdated: i
|
|
3701
|
+
}), u === void 0 && l !== null ? a.push(t) : u !== void 0 && l === null ? c.push(t) : l !== null && (Wt(l, d) || s.push(t), o.push(t)));
|
|
3702
|
+
}
|
|
3703
|
+
(a.length > 0 || s.length > 0 || c.length > 0) && e.emit("change", [{
|
|
3704
|
+
added: a,
|
|
3705
|
+
updated: s,
|
|
3706
|
+
removed: c
|
|
3707
|
+
}, n]), (a.length > 0 || o.length > 0 || c.length > 0) && e.emit("update", [{
|
|
3708
|
+
added: a,
|
|
3709
|
+
updated: o,
|
|
3710
|
+
removed: c
|
|
3711
|
+
}, n]);
|
|
3712
|
+
};
|
|
3713
|
+
//#endregion
|
|
3714
|
+
export { E as $, Bi as A, qt as B, Ki as C, V as D, ji as E, P as F, Dt as G, Lt as H, rn as I, bt as J, Et as K, fn as L, Qi as M, Wa as N, zi as O, kr as P, D as Q, un as R, Hi as S, Ti as T, Mt as U, Kt as V, Pt as W, T as X, _t as Y, O as Z, xi as _, Y as a, y as at, ti as b, si as c, h as ct, Xi as d, p as dt, C as et, va as f, a as ft, Si as g, zo as h, Es as i, _ as it, I as j, Zr as k, Q as l, ne as lt, Po as m, n as mt, Os as n, g as nt, X as o, x as ot, ko as p, e as pt, Tt as q, Ds as r, Pe as rt, Z as s, _e as st, Ts as t, w as tt, Vi as u, re as ut, Yi as v, Zi as w, R as x, Ji as y, ln as z };
|