pptx-svelte-viewer 4.24.3 → 4.26.0
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/CHANGELOG.md +67 -0
- package/README.md +8 -8
- package/dist/{AiChatPanel-NszDzi2K.js → AiChatPanel-DYLU7_DQ.js} +2 -2
- package/dist/awareness-BwmJcSKy.js +533 -0
- package/dist/{export-By5DD9XI.js → export-iyQ8bG1f.js} +30865 -30444
- package/dist/i18n/de.cjs +1 -0
- package/dist/i18n/de.mjs +1 -0
- package/dist/i18n/es.cjs +1 -0
- package/dist/i18n/es.mjs +1 -0
- package/dist/i18n/fr.cjs +1 -0
- package/dist/i18n/fr.mjs +1 -0
- package/dist/i18n/zh-CN.cjs +1 -0
- package/dist/i18n/zh-CN.mjs +1 -0
- package/dist/i18n.js +1 -1
- package/dist/index.js +46 -46
- package/dist/internals.js +17 -17
- package/dist/smartart-layouts-YQN30k2p.js +2157 -0
- package/dist/{transition-overlay-Bp4BTtV-.js → transition-overlay-BkW9yQMT.js} +45216 -44322
- package/dist/{translator-BW2KgOs0.js → translator-DwgZZEZm.js} +1 -0
- package/dist/viewer/index.d.ts +1 -39
- package/dist/viewer/index.js +10 -10
- package/dist/{y-webrtc-y-xCsKw4.js → y-webrtc-DPABhqQq.js} +1 -1
- package/dist/{y-websocket-Uj4wJVyw.js → y-websocket-B2EqYBBC.js} +1 -1
- package/package.json +8 -7
- package/dist/awareness-CWh9V5ZH.js +0 -530
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
import * as D from "yjs";
|
|
2
|
+
var h = () => /* @__PURE__ */ new Map(), F = (t, e, r) => {
|
|
3
|
+
let s = t.get(e);
|
|
4
|
+
return s === void 0 && t.set(e, s = r()), s;
|
|
5
|
+
}, we = (t, e) => {
|
|
6
|
+
const r = [];
|
|
7
|
+
for (const [s, a] of t) r.push(e(a, s));
|
|
8
|
+
return r;
|
|
9
|
+
}, V = () => /* @__PURE__ */ new Set(), K = Array.from, me = (t, e) => {
|
|
10
|
+
for (let r = 0; r < t.length; r++) if (!e(t[r], r, t)) return !1;
|
|
11
|
+
return !0;
|
|
12
|
+
}, Se = (t, e) => {
|
|
13
|
+
for (let r = 0; r < t.length; r++) if (e(t[r], r, t)) return !0;
|
|
14
|
+
return !1;
|
|
15
|
+
}, ft = (t, e) => {
|
|
16
|
+
const r = new Array(t);
|
|
17
|
+
for (let s = 0; s < t; s++) r[s] = e(s, r);
|
|
18
|
+
return r;
|
|
19
|
+
}, ct = Array.isArray, Ue = class {
|
|
20
|
+
constructor() {
|
|
21
|
+
this._observers = h();
|
|
22
|
+
}
|
|
23
|
+
on(t, e) {
|
|
24
|
+
return F(this._observers, t, V).add(e), e;
|
|
25
|
+
}
|
|
26
|
+
once(t, e) {
|
|
27
|
+
const r = (...s) => {
|
|
28
|
+
this.off(t, r), e(...s);
|
|
29
|
+
};
|
|
30
|
+
this.on(t, r);
|
|
31
|
+
}
|
|
32
|
+
off(t, e) {
|
|
33
|
+
const r = this._observers.get(t);
|
|
34
|
+
r !== void 0 && (r.delete(e), r.size === 0 && this._observers.delete(t));
|
|
35
|
+
}
|
|
36
|
+
emit(t, e) {
|
|
37
|
+
return K((this._observers.get(t) || h()).values()).forEach((r) => r(...e));
|
|
38
|
+
}
|
|
39
|
+
destroy() {
|
|
40
|
+
this._observers = h();
|
|
41
|
+
}
|
|
42
|
+
}, ut = class {
|
|
43
|
+
constructor() {
|
|
44
|
+
this._observers = h();
|
|
45
|
+
}
|
|
46
|
+
on(t, e) {
|
|
47
|
+
F(this._observers, t, V).add(e);
|
|
48
|
+
}
|
|
49
|
+
once(t, e) {
|
|
50
|
+
const r = (...s) => {
|
|
51
|
+
this.off(t, r), e(...s);
|
|
52
|
+
};
|
|
53
|
+
this.on(t, r);
|
|
54
|
+
}
|
|
55
|
+
off(t, e) {
|
|
56
|
+
const r = this._observers.get(t);
|
|
57
|
+
r !== void 0 && (r.delete(e), r.size === 0 && this._observers.delete(t));
|
|
58
|
+
}
|
|
59
|
+
emit(t, e) {
|
|
60
|
+
return K((this._observers.get(t) || h()).values()).forEach((r) => r(...e));
|
|
61
|
+
}
|
|
62
|
+
destroy() {
|
|
63
|
+
this._observers = h();
|
|
64
|
+
}
|
|
65
|
+
}, w = Math.floor, vt = Math.abs, Ae = Math.log10, ht = (t, e) => t < e ? t : e, Q = (t, e) => t > e ? t : e, Ie = Number.isNaN, Ce = Math.pow, pt = (t) => t !== 0 ? t < 0 : 1 / t < 0, I = Date.now, C = (t) => new Error(t), _e = () => {
|
|
66
|
+
throw C("Method unimplemented");
|
|
67
|
+
}, ke = () => {
|
|
68
|
+
throw C("Unexpected case");
|
|
69
|
+
};
|
|
70
|
+
var W = Number.MAX_SAFE_INTEGER, Le = Number.MIN_SAFE_INTEGER, gt = Number.isInteger || ((t) => typeof t == "number" && isFinite(t) && w(t) === t), Ee = Number.isNaN, Ne = Number.parseInt, H = String.fromCharCode, Be = String.fromCodePoint, Te = H(65535), yt = (t) => t.toLowerCase(), bt = /^\s*/g, dt = (t) => t.replace(bt, ""), wt = /([A-Z])/g, Y = (t, e) => dt(t.replace(wt, (r) => `${e}${yt(r)}`)), mt = (t) => {
|
|
71
|
+
const e = unescape(encodeURIComponent(t)), r = e.length, s = new Uint8Array(r);
|
|
72
|
+
for (let a = 0; a < r; a++) s[a] = e.codePointAt(a);
|
|
73
|
+
return s;
|
|
74
|
+
}, m = typeof TextEncoder < "u" ? new TextEncoder() : null, St = (t) => m.encode(t), Ut = m ? St : mt, b = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", {
|
|
75
|
+
fatal: !0,
|
|
76
|
+
ignoreBOM: !0
|
|
77
|
+
});
|
|
78
|
+
b && b.decode(/* @__PURE__ */ new Uint8Array()).length === 1 && (b = null);
|
|
79
|
+
var Me = (t, e) => ft(e, () => t).join(""), At = class {
|
|
80
|
+
constructor() {
|
|
81
|
+
this.cpos = 0, this.cbuf = /* @__PURE__ */ new Uint8Array(100), this.bufs = [];
|
|
82
|
+
}
|
|
83
|
+
}, It = () => new At(), Ct = (t) => {
|
|
84
|
+
let e = t.cpos;
|
|
85
|
+
for (let r = 0; r < t.bufs.length; r++) e += t.bufs[r].length;
|
|
86
|
+
return e;
|
|
87
|
+
}, _t = (t) => {
|
|
88
|
+
const e = new Uint8Array(Ct(t));
|
|
89
|
+
let r = 0;
|
|
90
|
+
for (let s = 0; s < t.bufs.length; s++) {
|
|
91
|
+
const a = t.bufs[s];
|
|
92
|
+
e.set(a, r), r += a.length;
|
|
93
|
+
}
|
|
94
|
+
return e.set(new Uint8Array(t.cbuf.buffer, 0, t.cpos), r), e;
|
|
95
|
+
}, kt = (t, e) => {
|
|
96
|
+
const r = t.cbuf.length;
|
|
97
|
+
r - t.cpos < e && (t.bufs.push(new Uint8Array(t.cbuf.buffer, 0, t.cpos)), t.cbuf = new Uint8Array(Q(r, e) * 2), t.cpos = 0);
|
|
98
|
+
}, o = (t, e) => {
|
|
99
|
+
const r = t.cbuf.length;
|
|
100
|
+
t.cpos === r && (t.bufs.push(t.cbuf), t.cbuf = new Uint8Array(r * 2), t.cpos = 0), t.cbuf[t.cpos++] = e;
|
|
101
|
+
}, Oe = o, c = (t, e) => {
|
|
102
|
+
for (; e > 127; )
|
|
103
|
+
o(t, 128 | 127 & e), e = w(e / 128);
|
|
104
|
+
o(t, 127 & e);
|
|
105
|
+
}, Lt = (t, e) => {
|
|
106
|
+
const r = pt(e);
|
|
107
|
+
for (r && (e = -e), o(t, (e > 63 ? 128 : 0) | (r ? 64 : 0) | 63 & e), e = w(e / 64); e > 0; )
|
|
108
|
+
o(t, (e > 127 ? 128 : 0) | 127 & e), e = w(e / 128);
|
|
109
|
+
}, L = /* @__PURE__ */ new Uint8Array(3e4), Et = L.length / 3, Nt = (t, e) => {
|
|
110
|
+
if (e.length < Et) {
|
|
111
|
+
const r = m.encodeInto(e, L).written || 0;
|
|
112
|
+
c(t, r);
|
|
113
|
+
for (let s = 0; s < r; s++) o(t, L[s]);
|
|
114
|
+
} else S(t, Ut(e));
|
|
115
|
+
}, Bt = (t, e) => {
|
|
116
|
+
const r = unescape(encodeURIComponent(e)), s = r.length;
|
|
117
|
+
c(t, s);
|
|
118
|
+
for (let a = 0; a < s; a++) o(t, r.codePointAt(a));
|
|
119
|
+
}, E = m && m.encodeInto ? Nt : Bt, Tt = (t, e) => {
|
|
120
|
+
const r = t.cbuf.length, s = t.cpos, a = ht(r - s, e.length), n = e.length - a;
|
|
121
|
+
t.cbuf.set(e.subarray(0, a), s), t.cpos += a, n > 0 && (t.bufs.push(t.cbuf), t.cbuf = new Uint8Array(Q(r * 2, n)), t.cbuf.set(e.subarray(a)), t.cpos = n);
|
|
122
|
+
}, S = (t, e) => {
|
|
123
|
+
c(t, e.byteLength), Tt(t, e);
|
|
124
|
+
}, P = (t, e) => {
|
|
125
|
+
kt(t, e);
|
|
126
|
+
const r = new DataView(t.cbuf.buffer, t.cpos, e);
|
|
127
|
+
return t.cpos += e, r;
|
|
128
|
+
}, Mt = (t, e) => P(t, 4).setFloat32(0, e, !1), Ot = (t, e) => P(t, 8).setFloat64(0, e, !1), Dt = (t, e) => P(t, 8).setBigInt64(0, e, !1), q = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4)), Ft = (t) => (q.setFloat32(0, t), q.getFloat32(0) === t), G = (t, e) => {
|
|
129
|
+
switch (typeof e) {
|
|
130
|
+
case "string":
|
|
131
|
+
o(t, 119), E(t, e);
|
|
132
|
+
break;
|
|
133
|
+
case "number":
|
|
134
|
+
gt(e) && vt(e) <= 2147483647 ? (o(t, 125), Lt(t, e)) : Ft(e) ? (o(t, 124), Mt(t, e)) : (o(t, 123), Ot(t, e));
|
|
135
|
+
break;
|
|
136
|
+
case "bigint":
|
|
137
|
+
o(t, 122), Dt(t, e);
|
|
138
|
+
break;
|
|
139
|
+
case "object":
|
|
140
|
+
if (e === null) o(t, 126);
|
|
141
|
+
else if (ct(e)) {
|
|
142
|
+
o(t, 117), c(t, e.length);
|
|
143
|
+
for (let r = 0; r < e.length; r++) G(t, e[r]);
|
|
144
|
+
} else if (e instanceof Uint8Array)
|
|
145
|
+
o(t, 116), S(t, e);
|
|
146
|
+
else {
|
|
147
|
+
o(t, 118);
|
|
148
|
+
const r = Object.keys(e);
|
|
149
|
+
c(t, r.length);
|
|
150
|
+
for (let s = 0; s < r.length; s++) {
|
|
151
|
+
const a = r[s];
|
|
152
|
+
E(t, a), G(t, e[a]);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
case "boolean":
|
|
157
|
+
o(t, e ? 120 : 121);
|
|
158
|
+
break;
|
|
159
|
+
default:
|
|
160
|
+
o(t, 127);
|
|
161
|
+
}
|
|
162
|
+
}, _ = C("Unexpected end of array"), tt = C("Integer out of Range"), Vt = (t, e, r) => {
|
|
163
|
+
if (e < 0 || r < 0 || e + r > t.length) throw _;
|
|
164
|
+
return new Uint8Array(t.buffer, t.byteOffset + e, r);
|
|
165
|
+
}, Pt = (t, e, r) => {
|
|
166
|
+
if (e < 0 || r < 0 || e + r > t.length) throw _;
|
|
167
|
+
return new DataView(t.buffer, t.byteOffset + e, r);
|
|
168
|
+
}, xt = class {
|
|
169
|
+
constructor(t) {
|
|
170
|
+
this.arr = t, this.pos = 0;
|
|
171
|
+
}
|
|
172
|
+
}, Rt = (t) => new xt(t), jt = (t, e) => {
|
|
173
|
+
const r = Vt(t.arr, t.pos, e);
|
|
174
|
+
return t.pos += e, r;
|
|
175
|
+
}, k = (t) => jt(t, p(t)), N = (t) => t.arr[t.pos++], p = (t) => {
|
|
176
|
+
let e = 0, r = 1;
|
|
177
|
+
const s = t.arr.length;
|
|
178
|
+
for (; t.pos < s; ) {
|
|
179
|
+
const a = t.arr[t.pos++];
|
|
180
|
+
if (e = e + (a & 127) * r, r *= 128, a < 128) return e;
|
|
181
|
+
if (e > W) throw tt;
|
|
182
|
+
}
|
|
183
|
+
throw _;
|
|
184
|
+
}, zt = (t) => {
|
|
185
|
+
let e = t.arr[t.pos++], r = e & 63, s = 64;
|
|
186
|
+
const a = (e & 64) > 0 ? -1 : 1;
|
|
187
|
+
if ((e & 128) === 0) return a * r;
|
|
188
|
+
const n = t.arr.length;
|
|
189
|
+
for (; t.pos < n; ) {
|
|
190
|
+
if (e = t.arr[t.pos++], r = r + (e & 127) * s, s *= 128, e < 128) return a * r;
|
|
191
|
+
if (r > W) throw tt;
|
|
192
|
+
}
|
|
193
|
+
throw _;
|
|
194
|
+
}, $t = (t) => {
|
|
195
|
+
let e = p(t);
|
|
196
|
+
if (e === 0) return "";
|
|
197
|
+
{
|
|
198
|
+
let r = String.fromCodePoint(N(t));
|
|
199
|
+
if (--e < 100) for (; e--; ) r += String.fromCodePoint(N(t));
|
|
200
|
+
else for (; e > 0; ) {
|
|
201
|
+
const s = e < 1e4 ? e : 1e4, a = t.arr.subarray(t.pos, t.pos + s);
|
|
202
|
+
t.pos += s, r += String.fromCodePoint.apply(null, a), e -= s;
|
|
203
|
+
}
|
|
204
|
+
return decodeURIComponent(escape(r));
|
|
205
|
+
}
|
|
206
|
+
}, Yt = (t) => b.decode(k(t)), B = b ? Yt : $t, x = (t, e) => {
|
|
207
|
+
const r = Pt(t.arr, t.pos, e);
|
|
208
|
+
return t.pos += e, r;
|
|
209
|
+
}, qt = (t) => x(t, 4).getFloat32(0, !1), Gt = (t) => x(t, 8).getFloat64(0, !1), Xt = (t) => x(t, 8).getBigInt64(0, !1), Jt = [
|
|
210
|
+
(t) => {
|
|
211
|
+
},
|
|
212
|
+
(t) => null,
|
|
213
|
+
zt,
|
|
214
|
+
qt,
|
|
215
|
+
Gt,
|
|
216
|
+
Xt,
|
|
217
|
+
(t) => !1,
|
|
218
|
+
(t) => !0,
|
|
219
|
+
B,
|
|
220
|
+
(t) => {
|
|
221
|
+
const e = p(t), r = {};
|
|
222
|
+
for (let s = 0; s < e; s++) {
|
|
223
|
+
const a = B(t);
|
|
224
|
+
r[a] = X(t);
|
|
225
|
+
}
|
|
226
|
+
return r;
|
|
227
|
+
},
|
|
228
|
+
(t) => {
|
|
229
|
+
const e = p(t), r = [];
|
|
230
|
+
for (let s = 0; s < e; s++) r.push(X(t));
|
|
231
|
+
return r;
|
|
232
|
+
},
|
|
233
|
+
k
|
|
234
|
+
], X = (t) => Jt[127 - N(t)](t), J = (t) => t === void 0 ? null : t, Zt = class {
|
|
235
|
+
constructor() {
|
|
236
|
+
this.map = /* @__PURE__ */ new Map();
|
|
237
|
+
}
|
|
238
|
+
setItem(t, e) {
|
|
239
|
+
this.map.set(t, e);
|
|
240
|
+
}
|
|
241
|
+
getItem(t) {
|
|
242
|
+
return this.map.get(t);
|
|
243
|
+
}
|
|
244
|
+
}, et = new Zt(), R = !0;
|
|
245
|
+
try {
|
|
246
|
+
typeof localStorage < "u" && localStorage && (et = localStorage, R = !1);
|
|
247
|
+
} catch {
|
|
248
|
+
}
|
|
249
|
+
var rt = et, Kt = (t) => R || addEventListener("storage", t), Qt = (t) => R || removeEventListener("storage", t), T = /* @__PURE__ */ Symbol("Equality"), De = (t, e) => t === e || !!t?.[T]?.(e) || !1, Fe = (t) => typeof t == "object", Wt = Object.keys, Ve = (t, e) => {
|
|
250
|
+
const r = [];
|
|
251
|
+
for (const s in t) r.push(e(t[s], s));
|
|
252
|
+
return r;
|
|
253
|
+
}, Z = (t) => Wt(t).length, Pe = (t, e) => {
|
|
254
|
+
for (const r in t) if (!e(t[r], r)) return !1;
|
|
255
|
+
return !0;
|
|
256
|
+
}, Ht = (t, e) => Object.prototype.hasOwnProperty.call(t, e), xe = () => {
|
|
257
|
+
}, d = (t, e) => {
|
|
258
|
+
if (t === e) return !0;
|
|
259
|
+
if (t == null || e == null || t.constructor !== e.constructor && (t.constructor || Object) !== (e.constructor || Object)) return !1;
|
|
260
|
+
if (t[T] != null) return t[T](e);
|
|
261
|
+
switch (t.constructor) {
|
|
262
|
+
case ArrayBuffer:
|
|
263
|
+
t = new Uint8Array(t), e = new Uint8Array(e);
|
|
264
|
+
case Uint8Array:
|
|
265
|
+
if (t.byteLength !== e.byteLength) return !1;
|
|
266
|
+
for (let r = 0; r < t.length; r++) if (t[r] !== e[r]) return !1;
|
|
267
|
+
break;
|
|
268
|
+
case Set:
|
|
269
|
+
if (t.size !== e.size) return !1;
|
|
270
|
+
for (const r of t) if (!e.has(r)) return !1;
|
|
271
|
+
break;
|
|
272
|
+
case Map:
|
|
273
|
+
if (t.size !== e.size) return !1;
|
|
274
|
+
for (const r of t.keys()) if (!e.has(r) || !d(t.get(r), e.get(r))) return !1;
|
|
275
|
+
break;
|
|
276
|
+
case void 0:
|
|
277
|
+
case Object:
|
|
278
|
+
if (Z(t) !== Z(e)) return !1;
|
|
279
|
+
for (const r in t) if (!Ht(t, r) || !d(t[r], e[r])) return !1;
|
|
280
|
+
break;
|
|
281
|
+
case Array:
|
|
282
|
+
if (t.length !== e.length) return !1;
|
|
283
|
+
for (let r = 0; r < t.length; r++) if (!d(t[r], e[r])) return !1;
|
|
284
|
+
break;
|
|
285
|
+
default:
|
|
286
|
+
return !1;
|
|
287
|
+
}
|
|
288
|
+
return !0;
|
|
289
|
+
}, te = (t, e) => e.includes(t), y = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", st = typeof window < "u" && typeof document < "u" && !y, Re = typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1, u, ee = [], re = () => {
|
|
290
|
+
if (u === void 0)
|
|
291
|
+
if (y) {
|
|
292
|
+
u = h();
|
|
293
|
+
const t = process.argv;
|
|
294
|
+
let e = null;
|
|
295
|
+
for (let r = 0; r < t.length; r++) {
|
|
296
|
+
const s = t[r];
|
|
297
|
+
s[0] === "-" ? (e !== null && u.set(e, ""), e = s) : e !== null ? (u.set(e, s), e = null) : ee.push(s);
|
|
298
|
+
}
|
|
299
|
+
e !== null && u.set(e, "");
|
|
300
|
+
} else typeof location == "object" ? (u = h(), (location.search || "?").slice(1).split("&").forEach((t) => {
|
|
301
|
+
if (t.length !== 0) {
|
|
302
|
+
const [e, r] = t.split("=");
|
|
303
|
+
u.set(`--${Y(e, "-")}`, r), u.set(`-${Y(e, "-")}`, r);
|
|
304
|
+
}
|
|
305
|
+
})) : u = h();
|
|
306
|
+
return u;
|
|
307
|
+
}, M = (t) => re().has(t), O = (t) => J(y ? process.env[t.toUpperCase().replaceAll("-", "_")] : rt.getItem(t)), at = (t) => M("--" + t) || O(t) !== null, je = at("production"), se = y && te(process.env.FORCE_COLOR, [
|
|
308
|
+
"true",
|
|
309
|
+
"1",
|
|
310
|
+
"2"
|
|
311
|
+
]), ze = se || !M("--no-colors") && !at("no-color") && (!y || process.stdout.isTTY) && (!y || M("--color") || O("COLORTERM") !== null || (O("TERM") || "").includes("color")), ae = (t) => new Uint8Array(t), ne = (t) => new Uint8Array(t), oe = (t) => {
|
|
312
|
+
let e = "";
|
|
313
|
+
for (let r = 0; r < t.byteLength; r++) e += H(t[r]);
|
|
314
|
+
return btoa(e);
|
|
315
|
+
}, le = (t) => Buffer.from(t.buffer, t.byteOffset, t.byteLength).toString("base64"), ie = (t) => {
|
|
316
|
+
const e = atob(t), r = ae(e.length);
|
|
317
|
+
for (let s = 0; s < e.length; s++) r[s] = e.charCodeAt(s);
|
|
318
|
+
return r;
|
|
319
|
+
}, fe = (t) => new Uint8Array(Buffer.from(t, "base64")), ce = st ? oe : le, ue = st ? ie : fe, nt = /* @__PURE__ */ new Map(), ve = class {
|
|
320
|
+
constructor(t) {
|
|
321
|
+
this.room = t, this.onmessage = null, this._onChange = (e) => e.key === t && this.onmessage !== null && this.onmessage({ data: ue(e.newValue || "") }), Kt(this._onChange);
|
|
322
|
+
}
|
|
323
|
+
postMessage(t) {
|
|
324
|
+
rt.setItem(this.room, ce(ne(t)));
|
|
325
|
+
}
|
|
326
|
+
close() {
|
|
327
|
+
Qt(this._onChange);
|
|
328
|
+
}
|
|
329
|
+
}, he = typeof BroadcastChannel > "u" ? ve : BroadcastChannel, j = (t) => F(nt, t, () => {
|
|
330
|
+
const e = V(), r = new he(t);
|
|
331
|
+
return r.onmessage = (s) => e.forEach((a) => a(s.data, "broadcastchannel")), {
|
|
332
|
+
bc: r,
|
|
333
|
+
subs: e
|
|
334
|
+
};
|
|
335
|
+
}), $e = (t, e) => (j(t).subs.add(e), e), Ye = (t, e) => {
|
|
336
|
+
const r = j(t), s = r.subs.delete(e);
|
|
337
|
+
return s && r.subs.size === 0 && (r.bc.close(), nt.delete(t)), s;
|
|
338
|
+
}, qe = (t, e, r = null) => {
|
|
339
|
+
const s = j(t);
|
|
340
|
+
s.bc.postMessage(e), s.subs.forEach((a) => a(e, r));
|
|
341
|
+
};
|
|
342
|
+
var Ge = (t, e) => {
|
|
343
|
+
c(t, 0);
|
|
344
|
+
const r = D.encodeStateVector(e);
|
|
345
|
+
S(t, r);
|
|
346
|
+
}, pe = (t, e, r) => {
|
|
347
|
+
c(t, 1), S(t, D.encodeStateAsUpdate(e, r));
|
|
348
|
+
}, ge = (t, e, r) => pe(e, r, k(t)), ot = (t, e, r, s) => {
|
|
349
|
+
try {
|
|
350
|
+
D.applyUpdate(e, k(t), r);
|
|
351
|
+
} catch (a) {
|
|
352
|
+
s?.(a), console.error("Caught error while handling a Yjs update", a);
|
|
353
|
+
}
|
|
354
|
+
}, Xe = (t, e) => {
|
|
355
|
+
c(t, 2), S(t, e);
|
|
356
|
+
}, ye = ot, Je = (t, e, r, s, a) => {
|
|
357
|
+
const n = p(t);
|
|
358
|
+
switch (n) {
|
|
359
|
+
case 0:
|
|
360
|
+
ge(t, e, r);
|
|
361
|
+
break;
|
|
362
|
+
case 1:
|
|
363
|
+
ot(t, r, s, a);
|
|
364
|
+
break;
|
|
365
|
+
case 2:
|
|
366
|
+
ye(t, r, s, a);
|
|
367
|
+
break;
|
|
368
|
+
default:
|
|
369
|
+
throw new Error("Unknown message type");
|
|
370
|
+
}
|
|
371
|
+
return n;
|
|
372
|
+
}, be = 3e4, Ze = class extends ut {
|
|
373
|
+
constructor(t) {
|
|
374
|
+
super(), this.doc = t, this.clientID = t.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = setInterval(() => {
|
|
375
|
+
const e = I();
|
|
376
|
+
this.getLocalState() !== null && 3e4 / 2 <= e - this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
|
|
377
|
+
const r = [];
|
|
378
|
+
this.meta.forEach((s, a) => {
|
|
379
|
+
a !== this.clientID && 3e4 <= e - s.lastUpdated && this.states.has(a) && r.push(a);
|
|
380
|
+
}), r.length > 0 && de(this, r, "timeout");
|
|
381
|
+
}, w(be / 10)), t.on("destroy", () => {
|
|
382
|
+
this.destroy();
|
|
383
|
+
}), this.setLocalState({});
|
|
384
|
+
}
|
|
385
|
+
destroy() {
|
|
386
|
+
this.emit("destroy", [this]), this.setLocalState(null), super.destroy(), clearInterval(this._checkInterval);
|
|
387
|
+
}
|
|
388
|
+
getLocalState() {
|
|
389
|
+
return this.states.get(this.clientID) || null;
|
|
390
|
+
}
|
|
391
|
+
setLocalState(t) {
|
|
392
|
+
const e = this.clientID, r = this.meta.get(e), s = r === void 0 ? 0 : r.clock + 1, a = this.states.get(e);
|
|
393
|
+
t === null ? this.states.delete(e) : this.states.set(e, t), this.meta.set(e, {
|
|
394
|
+
clock: s,
|
|
395
|
+
lastUpdated: I()
|
|
396
|
+
});
|
|
397
|
+
const n = [], l = [], v = [], i = [];
|
|
398
|
+
t === null ? i.push(e) : a == null ? t != null && n.push(e) : (l.push(e), d(a, t) || v.push(e)), (n.length > 0 || v.length > 0 || i.length > 0) && this.emit("change", [{
|
|
399
|
+
added: n,
|
|
400
|
+
updated: v,
|
|
401
|
+
removed: i
|
|
402
|
+
}, "local"]), this.emit("update", [{
|
|
403
|
+
added: n,
|
|
404
|
+
updated: l,
|
|
405
|
+
removed: i
|
|
406
|
+
}, "local"]);
|
|
407
|
+
}
|
|
408
|
+
setLocalStateField(t, e) {
|
|
409
|
+
const r = this.getLocalState();
|
|
410
|
+
r !== null && this.setLocalState({
|
|
411
|
+
...r,
|
|
412
|
+
[t]: e
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
getStates() {
|
|
416
|
+
return this.states;
|
|
417
|
+
}
|
|
418
|
+
}, de = (t, e, r) => {
|
|
419
|
+
const s = [];
|
|
420
|
+
for (let a = 0; a < e.length; a++) {
|
|
421
|
+
const n = e[a];
|
|
422
|
+
if (t.states.has(n)) {
|
|
423
|
+
if (t.states.delete(n), n === t.clientID) {
|
|
424
|
+
const l = t.meta.get(n);
|
|
425
|
+
t.meta.set(n, {
|
|
426
|
+
clock: l.clock + 1,
|
|
427
|
+
lastUpdated: I()
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
s.push(n);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
s.length > 0 && (t.emit("change", [{
|
|
434
|
+
added: [],
|
|
435
|
+
updated: [],
|
|
436
|
+
removed: s
|
|
437
|
+
}, r]), t.emit("update", [{
|
|
438
|
+
added: [],
|
|
439
|
+
updated: [],
|
|
440
|
+
removed: s
|
|
441
|
+
}, r]));
|
|
442
|
+
}, Ke = (t, e, r = t.states) => {
|
|
443
|
+
const s = e.length, a = It();
|
|
444
|
+
c(a, s);
|
|
445
|
+
for (let n = 0; n < s; n++) {
|
|
446
|
+
const l = e[n], v = r.get(l) || null, i = t.meta.get(l).clock;
|
|
447
|
+
c(a, l), c(a, i), E(a, JSON.stringify(v));
|
|
448
|
+
}
|
|
449
|
+
return _t(a);
|
|
450
|
+
}, Qe = (t, e, r) => {
|
|
451
|
+
const s = Rt(e), a = I(), n = [], l = [], v = [], i = [], lt = p(s);
|
|
452
|
+
for (let z = 0; z < lt; z++) {
|
|
453
|
+
const f = p(s);
|
|
454
|
+
let U = p(s);
|
|
455
|
+
const g = JSON.parse(B(s)), A = t.meta.get(f), it = t.states.get(f), $ = A === void 0 ? 0 : A.clock;
|
|
456
|
+
($ < U || $ === U && g === null && t.states.has(f)) && (g === null ? f === t.clientID && t.getLocalState() != null ? U++ : t.states.delete(f) : t.states.set(f, g), t.meta.set(f, {
|
|
457
|
+
clock: U,
|
|
458
|
+
lastUpdated: a
|
|
459
|
+
}), A === void 0 && g !== null ? n.push(f) : A !== void 0 && g === null ? i.push(f) : g !== null && (d(g, it) || v.push(f), l.push(f)));
|
|
460
|
+
}
|
|
461
|
+
(n.length > 0 || v.length > 0 || i.length > 0) && t.emit("change", [{
|
|
462
|
+
added: n,
|
|
463
|
+
updated: v,
|
|
464
|
+
removed: i
|
|
465
|
+
}, r]), (n.length > 0 || l.length > 0 || i.length > 0) && t.emit("update", [{
|
|
466
|
+
added: n,
|
|
467
|
+
updated: l,
|
|
468
|
+
removed: i
|
|
469
|
+
}, r]);
|
|
470
|
+
};
|
|
471
|
+
export {
|
|
472
|
+
ut as $,
|
|
473
|
+
p as A,
|
|
474
|
+
Ut as B,
|
|
475
|
+
Ve as C,
|
|
476
|
+
X as D,
|
|
477
|
+
Rt as E,
|
|
478
|
+
G as F,
|
|
479
|
+
C as G,
|
|
480
|
+
Me as H,
|
|
481
|
+
Oe as I,
|
|
482
|
+
I as J,
|
|
483
|
+
_e as K,
|
|
484
|
+
E as L,
|
|
485
|
+
It as M,
|
|
486
|
+
Ct as N,
|
|
487
|
+
N as O,
|
|
488
|
+
_t as P,
|
|
489
|
+
Ce as Q,
|
|
490
|
+
c as R,
|
|
491
|
+
Fe as S,
|
|
492
|
+
De as T,
|
|
493
|
+
W as U,
|
|
494
|
+
H as V,
|
|
495
|
+
Le as W,
|
|
496
|
+
Ae as X,
|
|
497
|
+
w as Y,
|
|
498
|
+
ht as Z,
|
|
499
|
+
ze as _,
|
|
500
|
+
Je as a,
|
|
501
|
+
h as at,
|
|
502
|
+
Pe as b,
|
|
503
|
+
Xe as c,
|
|
504
|
+
Ye as d,
|
|
505
|
+
Ue as et,
|
|
506
|
+
ue as f,
|
|
507
|
+
je as g,
|
|
508
|
+
y as h,
|
|
509
|
+
de as i,
|
|
510
|
+
V as it,
|
|
511
|
+
k as j,
|
|
512
|
+
B as k,
|
|
513
|
+
qe as l,
|
|
514
|
+
O as m,
|
|
515
|
+
Qe as n,
|
|
516
|
+
ct as nt,
|
|
517
|
+
Ge as o,
|
|
518
|
+
we as ot,
|
|
519
|
+
ce as p,
|
|
520
|
+
ke as q,
|
|
521
|
+
Ke as r,
|
|
522
|
+
Se as rt,
|
|
523
|
+
pe as s,
|
|
524
|
+
F as st,
|
|
525
|
+
Ze as t,
|
|
526
|
+
me as tt,
|
|
527
|
+
$e as u,
|
|
528
|
+
d as v,
|
|
529
|
+
T as w,
|
|
530
|
+
Ht as x,
|
|
531
|
+
xe as y,
|
|
532
|
+
S as z
|
|
533
|
+
};
|