pptx-svelte-viewer 4.24.2 → 4.25.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
@@ -1,5 +1,52 @@
1
1
  # Changelog
2
2
 
3
+ All notable changes to this project are documented here.
4
+ This file is generated from [Conventional Commits](https://www.conventionalcommits.org)
5
+ by [git-cliff](https://git-cliff.org); do not edit it by hand.
6
+ A release listed with no entries carried no Conventional Commit in this package's
7
+ scope: scripts/release-plan.mjs releases whenever any published file changes, not only on
8
+ conventional commits.
9
+
10
+ ## [4.25.0](https://github.com/ChristopherVR/ooxml/releases/tag/pptx-svelte-viewer@4.25.0) - 2026-10-06
11
+
12
+ ### Features
13
+
14
+ - **pptx:** Parse chart legend overlay from c:overlay ([dce36c6](https://github.com/ChristopherVR/ooxml/commit/dce36c6134cdaded271b73f541091b37223b6da2))
15
+ - **chart:** Move pie, radar, treemap and trendline helpers from pptx viewer ([c08a02b](https://github.com/ChristopherVR/ooxml/commit/c08a02b91b210c0f99c8c2dfbde02c2e1329fc57))
16
+ - **color:** Move text contrast and unit rgb helpers from pptx viewer ([2dcc341](https://github.com/ChristopherVR/ooxml/commit/2dcc341bd931610a9e9a8f4e8d53483cffbed8ec))
17
+ - **text:** Move tab leader and decimal tab helpers from pptx viewer ([3a5bcf0](https://github.com/ChristopherVR/ooxml/commit/3a5bcf0f4675db3d6831430c37db0c66c6814ef3))
18
+ - **geometry:** Move snap guides and align/distribute from pptx viewer ([3400e87](https://github.com/ChristopherVR/ooxml/commit/3400e8776661df9e2148e1be78819b1c12564b79))
19
+ - **pptx:** Forward the viewer's duplicated chart and theme helpers ([c22b276](https://github.com/ChristopherVR/ooxml/commit/c22b2766272ec08218ea14fadfc3cafd3c2b9ff6))
20
+
21
+ ### Bug Fixes
22
+
23
+ - **pptx:** Clear the old layout definition on a SmartArt layout switch ([086e06c](https://github.com/ChristopherVR/ooxml/commit/086e06cc28b0389da820f35b5fd4f482f2312de8))
24
+ - **shared:** Make 3D SmartArt editing and layout switching reliable in every binding ([43e3e07](https://github.com/ChristopherVR/ooxml/commit/43e3e07e6f4996c9777d175ffd3536a341dadc86))
25
+ - **shared:** Hide the fill swatches when the pointer leaves a 3D SmartArt node ([c718e77](https://github.com/ChristopherVR/ooxml/commit/c718e77bb15f7d74721c252189bf99b1f77a9d0d))
26
+ - **ci:** Resolve pptx-viewer-core/ui in the binding test and demo configs ([dfffe69](https://github.com/ChristopherVR/ooxml/commit/dfffe6988b58d3765cf748df5adbd4c3b86b5fbe))
27
+ - **xlsx:** Harden code-scanning findings across areas ([90ee4b3](https://github.com/ChristopherVR/ooxml/commit/90ee4b33e1253f21cd0df299af468d550f85eddc))
28
+ - **xlsx:** Use Reflect for dynamic property writes and tighten sanitizers ([b663413](https://github.com/ChristopherVR/ooxml/commit/b66341384d972d73182b06c6b4c706c0462f9364))
29
+
30
+ ### Refactor
31
+
32
+ - Move the library into src/core, next to src/ui ([3933a88](https://github.com/ChristopherVR/ooxml/commit/3933a88e36784ce5f4bfab0af1ca12eb65d3cd0c))
33
+
34
+ ### Documentation
35
+
36
+ - Bring the pptx docs and agent guide up to date with the move ([8cc3f5e](https://github.com/ChristopherVR/ooxml/commit/8cc3f5e364232d39d2a2286e25056fd67b594108))
37
+
38
+ ### Build & CI
39
+
40
+ - **deps:** Adopt ooxml-ui 0.29.1 and ooxml-core 0.21.1 ([56e1979](https://github.com/ChristopherVR/ooxml/commit/56e197912df02e3d6ce674025115dab206338138))
41
+ - **pptx:** Move the pptx demos and browser tests to the repository root ([a23994d](https://github.com/ChristopherVR/ooxml/commit/a23994d534fc34721f182d5eba9cd4abb97e44f8))
42
+ - **release:** Publish the pptx viewer packages from this repository ([21e790f](https://github.com/ChristopherVR/ooxml/commit/21e790f582b3d7072f3770d7a1bd9fc2ad035e53))
43
+
44
+ ### Chores
45
+
46
+ - **viewers:** Import the pptx-viewer repository with its history ([dde62be](https://github.com/ChristopherVR/ooxml/commit/dde62beb12d38f53fcddf016a4de243fe7151712))
47
+
48
+ # Changelog
49
+
3
50
  All notable changes to this project are documented here.
4
51
  This file is generated from [Conventional Commits](https://www.conventionalcommits.org)
5
52
  by [git-cliff](https://git-cliff.org); do not edit it by hand.
@@ -7,6 +54,21 @@ A release listed with no entries carried no Conventional Commit in this package'
7
54
  scope: scripts/release-plan.mjs re-releases a package whenever any of its files
8
55
  change, not only on conventional ones.
9
56
 
57
+ ## [4.24.3](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-svelte-viewer@4.24.3) - 2026-10-06
58
+
59
+ ### Bug Fixes
60
+
61
+ - **shared:** Make 3D SmartArt rotate, edit and recolour like the 2D diagram (by @ChristopherVR) ([29473d4](https://github.com/ChristopherVR/pptx-viewer/commit/29473d42fdfd8a1b5dff4f2259ecad68ecbd57bc))
62
+ - Draw no default table cell border, and let the ooxml sync push to main ([#408](https://github.com/ChristopherVR/pptx-viewer/issues/408)) (by @ChristopherVR) ([11914db](https://github.com/ChristopherVR/pptx-viewer/commit/11914db10cd8f65504e1e5a777848731d88a949a))
63
+
64
+ ## [4.24.2](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-svelte-viewer@4.24.2) - 2026-10-05
65
+
66
+ ### Bug Fixes
67
+
68
+ - **shared:** Draw zero-height and zero-width line shapes ([#404](https://github.com/ChristopherVR/pptx-viewer/issues/404)) (by @IHAGI-c) ([8366e0c](https://github.com/ChristopherVR/pptx-viewer/commit/8366e0c672c0838dfc2a5ab894797774d37860d6))
69
+ - **shared:** Skip defining the 3D view element without HTMLElement (by @ChristopherVR) ([8a08d33](https://github.com/ChristopherVR/pptx-viewer/commit/8a08d33560c06c555bf137465022d1a30fdc402a))
70
+ - **vanilla:** Follow the ooxml-ui 0.28 gallery and select contracts (by @ChristopherVR) ([2dd5a64](https://github.com/ChristopherVR/pptx-viewer/commit/2dd5a646ff526a1065fea853e29d25b056e231dc))
71
+
10
72
  ## [4.24.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-svelte-viewer@4.24.1) - 2026-10-05
11
73
 
12
74
  ### Testing
package/README.md CHANGED
@@ -1,18 +1,18 @@
1
1
  # pptx-svelte-viewer
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/pptx-svelte-viewer.svg)](https://www.npmjs.com/package/pptx-svelte-viewer)
4
- [![license](https://img.shields.io/npm/l/pptx-svelte-viewer.svg)](https://github.com/ChristopherVR/pptx-viewer/blob/main/LICENSE)
4
+ [![license](https://img.shields.io/npm/l/pptx-svelte-viewer.svg)](https://github.com/ChristopherVR/ooxml/blob/main/viewers/pptx/LICENSE)
5
5
 
6
6
  Show, edit, and present Microsoft PowerPoint (`.pptx`) files directly in a
7
7
  Svelte 5 app: no server, no conversion step, no PowerPoint install required.
8
8
  Drop in a `<PowerPointViewer>` component (built with runes), hand it the
9
9
  file's bytes, and it renders slides as real HTML and CSS.
10
10
 
11
- ![A PowerPoint deck rendered by the Svelte 5 viewer demo](https://raw.githubusercontent.com/ChristopherVR/pptx-viewer/main/.github/assets/packages/svelte-demo.gif)
11
+ ![A PowerPoint deck rendered by the Svelte 5 viewer demo](https://raw.githubusercontent.com/ChristopherVR/ooxml/main/viewers/pptx/.github/assets/packages/svelte-demo.gif)
12
12
 
13
13
  The rendering is done by the framework-agnostic [`pptx-viewer-core`](https://www.npmjs.com/package/pptx-viewer-core) engine, which turns a `.pptx` file into a structured slide model. This package is the Svelte layer that draws that model on screen, and the engine is **bundled in**, so you install just one package.
14
14
 
15
- <samp>**[▶️ Try the live demo](https://christophervr.github.io/pptx-viewer/demo-svelte/)** · **[📦 npm](https://www.npmjs.com/package/pptx-svelte-viewer)** · **[📖 Full docs](https://christophervr.github.io/pptx-viewer/svelte/)** · **[🧩 Core SDK](https://www.npmjs.com/package/pptx-viewer-core)**</samp>
15
+ <samp>**[▶️ Try the live demo](https://christophervr.github.io/ooxml/pptx/demo-svelte/)** · **[📦 npm](https://www.npmjs.com/package/pptx-svelte-viewer)** · **[📖 Full docs](https://christophervr.github.io/ooxml/pptx/svelte/)** · **[🧩 Core SDK](https://www.npmjs.com/package/pptx-viewer-core)**</samp>
16
16
 
17
17
  ## Features
18
18
 
@@ -113,7 +113,7 @@ or fullscreen fitting. See the [cross-binding defaults](../../docs/guide/viewpor
113
113
  | `showToolbar` | `boolean` | `true` | Navigation/zoom/fullscreen toolbar. |
114
114
  | `showNotes` | `boolean` | `true` | Speaker-notes panel and its toolbar toggle. |
115
115
  | `hiddenActions` | `ToolbarActionId[]` | - | Toolbar buttons/ribbon tabs to hide individually (e.g. `['share', 'broadcast']`), instead of hiding the whole toolbar. |
116
- | `customization` | `ViewerCustomization` | - | Hide, lock or remap any part of the UI (ribbon tabs/buttons, File > Options pages/sections/settings, File tab, context menus, shortcuts, panels, AI/collaboration, dialogs); the same helpers (`hideRibbonTab`, `lockSetting`, ...) are on the `bind:this` instance. See the [UI Customization guide](https://christophervr.github.io/pptx-viewer/guide/customization). |
116
+ | `customization` | `ViewerCustomization` | - | Hide, lock or remap any part of the UI (ribbon tabs/buttons, File > Options pages/sections/settings, File tab, context menus, shortcuts, panels, AI/collaboration, dialogs); the same helpers (`hideRibbonTab`, `lockSetting`, ...) are on the `bind:this` instance. See the [UI Customization guide](https://christophervr.github.io/ooxml/pptx/guide/customization). |
117
117
  | `editable` | `boolean` | `false` | Ribbon editing, insertion, arrange, and save. |
118
118
  | `smartArt3D` | `boolean` | `false` | Opt-in Three.js 3D SmartArt renderer (needs the optional `three` peer; falls back to SVG without it). |
119
119
  | `surfaceChart3D`, `barChart3D`, `lineChart3D`, `areaChart3D`, `pieChart3D` | `boolean` | `false` | Independently opt in to interactive Three.js renderers for the matching 3D chart kinds; each falls back to SVG when WebGL is unavailable. |
@@ -188,10 +188,10 @@ editing and export methods (the `PowerPointViewerApi` type):
188
188
  `exportPdf(options?)`, `exportGif(options?)`, `exportVideo(options?)`,
189
189
  `print(options?)`.
190
190
 
191
- See [element insertion](https://christophervr.github.io/pptx-viewer/svelte/api#add-element)
191
+ See [element insertion](https://christophervr.github.io/ooxml/pptx/svelte/api#add-element)
192
192
  for the `addElement` contract and a core-factory example.
193
193
 
194
- See the [full docs](https://christophervr.github.io/pptx-viewer/svelte/) for
194
+ See the [full docs](https://christophervr.github.io/ooxml/pptx/svelte/) for
195
195
  the complete props/events contract, theming, and localization guides.
196
196
 
197
197
  ### Composing a custom viewer shell
@@ -202,7 +202,7 @@ keep a host-owned configuration reactive. Its `shellState` exposes effective
202
202
  uses the same editability rule as the native editor. `EditorLayer`,
203
203
  `CollaborationCursors`, `RemoteSelectionOverlay` and their prop types are exported
204
204
  from `/viewer` for composing the real editing and presence layers with `SlideCanvas`.
205
- See the [custom-shell collaboration guide](https://christophervr.github.io/pptx-viewer/svelte/collaboration#custom-host-chrome)
205
+ See the [custom-shell collaboration guide](https://christophervr.github.io/ooxml/pptx/svelte/collaboration#custom-host-chrome)
206
206
  and `demos/demo-svelte/src/HostOwnedHeadlessEditor.svelte` for complete wiring.
207
207
 
208
208
  `<PowerPointViewer>` bundles the slide canvas, ribbon, thumbnail rail,
@@ -324,7 +324,7 @@ import { translationsZhCN } from 'pptx-svelte-viewer/i18n/zh-CN';
324
324
 
325
325
  The other subpaths are `i18n/fr` (`translationsFr`), `i18n/es`
326
326
  (`translationsEs`), and `i18n/de` (`translationsDe`). See the
327
- [localization guide](https://christophervr.github.io/pptx-viewer/guide/localization)
327
+ [localization guide](https://christophervr.github.io/ooxml/pptx/guide/localization)
328
328
  for registration and runtime switching. Existing English imports are unchanged.
329
329
 
330
330
  ## License
@@ -1,5 +1,5 @@
1
- import { E as V } from "./transition-overlay-CKLt2lTg.js";
2
- import { B as ce, C as pe, E as de, F as ve, H as Y, I as U, L as $, P as O, R as ue, S as he, T as _e, U as A, V as ge, _ as xe, b as fe, g as me, h as be, m as ye, v as ke, w as we, x as Ce, y as Me, z as ze } from "./export-BBxggq0e.js";
1
+ import { E as V } from "./transition-overlay-B2a8i_wG.js";
2
+ import { B as ce, C as pe, E as de, F as ve, H as Y, I as U, L as $, P as O, R as ue, S as he, T as _e, U as A, V as ge, _ as xe, b as fe, g as me, h as be, m as ye, v as ke, w as we, x as Ce, y as Me, z as ze } from "./export-CS0tkkRj.js";
3
3
  import "svelte/internal/disclose-version";
4
4
  import * as e from "svelte/internal/client";
5
5
  import { onMount as Se, untrack as R } from "svelte";
@@ -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
+ };