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