@silurus/ooxml 0.89.7 → 0.89.8

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.
Files changed (73) hide show
  1. package/dist/assets/render-worker-Ck21oePL.js +16 -0
  2. package/dist/assets/render-worker-DJiGqgi0.js +15 -0
  3. package/dist/assets/render-worker-hPLJ82d2.js +35 -0
  4. package/dist/{bounded-raw-part-cache-B8t03tSP.js → bounded-raw-part-cache-B5a6cGKO.js} +1713 -1515
  5. package/dist/{canvas-viewer-mechanics-DI38gHNV.js → canvas-viewer-mechanics-BsqaoYgK.js} +2 -2
  6. package/dist/{cfb-guard-BIaHdonq.js → cfb-guard-DzYlucez.js} +1 -1
  7. package/dist/chart-ex.mjs +367 -367
  8. package/dist/{comment-overlay-controller-Crm5Syhx.js → comment-overlay-controller-B7AoyoDK.js} +18 -18
  9. package/dist/{comment-ui-runtime-DKlEfBPp.js → comment-ui-runtime-C5eWtZSW.js} +3 -3
  10. package/dist/{comment-ui-runtime-BfEPgl5r.js → comment-ui-runtime-CV0I9faV.js} +3 -3
  11. package/dist/{document-model-source-xnkMoTZ_.js → document-model-source-90ext13g.js} +37 -37
  12. package/dist/{document-pull-client-CzhPbnY_.js → document-pull-client-DSYpUET2.js} +17109 -13858
  13. package/dist/{document-pull-worker-Bkewz-So.js → document-pull-worker-hMKJ5RdB.js} +14 -14
  14. package/dist/{docx-BgCQiuuN.js → docx-DCCDnwrG.js} +593 -593
  15. package/dist/{docx-BWyACb-n.js → docx-G7pt7ajR.js} +33 -33
  16. package/dist/{docx-model-source-DCRFgO7-.js → docx-model-source-Beon3BD5.js} +6 -6
  17. package/dist/docx.mjs +4 -4
  18. package/dist/docx_parser_bg.wasm +0 -0
  19. package/dist/{drawingml-shape-BcXkRayC.js → drawingml-shape-B1_kg4BV.js} +55 -55
  20. package/dist/{duotone-BI7CoghW.js → duotone-GK4Hqn7f.js} +1 -1
  21. package/dist/{emf-DgUBx9BU.js → emf--QWY-UlT.js} +50 -50
  22. package/dist/{font-preload-demand-B6HPFxDp.js → font-preload-demand-NqcVKIpX.js} +2 -2
  23. package/dist/{grid-geometry-CqTDvpDr.js → grid-geometry-DpMAiSZb.js} +1 -1
  24. package/dist/{host-layout-measure-CXKOWA5J.js → host-layout-measure-Z2fIsmDw.js} +1 -1
  25. package/dist/index.mjs +3 -3
  26. package/dist/internal-companion.mjs +2 -2
  27. package/dist/{line-distribute-DR9Qwd3u.js → line-distribute-CwtditQo.js} +31 -25
  28. package/dist/{model-source-DcI3vC00.js → model-source-Cch44xsb.js} +2 -2
  29. package/dist/{model-source-session-BlQWNyj2.js → model-source-session-ClNCRDOg.js} +21 -21
  30. package/dist/{model-source-session-D0LF49Ve.js → model-source-session-DRcqFGfM.js} +2 -2
  31. package/dist/{model-source-session-BCteVilS.js → model-source-session-DSABX94B.js} +2 -2
  32. package/dist/node.mjs +5 -5
  33. package/dist/{plot-area-frame-D3JtHvov.js → plot-area-frame-DNYMd9Pf.js} +1914 -1890
  34. package/dist/{pptx-SmjDGyub.js → pptx-C1CiFW1D.js} +35 -33
  35. package/dist/{pptx-CfCiVlNB.js → pptx-Ci1Y9SS_.js} +261 -259
  36. package/dist/{pptx-model-source-B2Irk68a.js → pptx-model-source-C9TuBisH.js} +18 -12
  37. package/dist/pptx-parsed-slides-BMGr4khe.js +8 -0
  38. package/dist/pptx.mjs +5 -5
  39. package/dist/pptx_parser_bg.wasm +0 -0
  40. package/dist/{presentation-model-source-DL6duh5l.js → presentation-model-source-3N7xLtmI.js} +6 -6
  41. package/dist/region-map.mjs +39 -39
  42. package/dist/{render-CMUEAeHp.js → render-Bf_Gywxw.js} +32 -30
  43. package/dist/{render-worker-host-CZHIKTtZ.js → render-worker-host-BZoh-wqR.js} +1 -1
  44. package/dist/{render-worker-host-CtlBbau5.js → render-worker-host-BmVeB_mR.js} +1 -1
  45. package/dist/{render-worker-host-G1fnymI8.js → render-worker-host-CVr53kg0.js} +1 -1
  46. package/dist/{renderer-B4KIpz-2.js → renderer-CCA_bQB8.js} +439 -439
  47. package/dist/renderer-DpTePxGq.js +5887 -0
  48. package/dist/{resource-measurement-D2bu0Qfx.js → resource-measurement-CfJtbwiR.js} +129 -129
  49. package/dist/{session-KIWcCCP2.js → session-DPXK_lpI.js} +64 -64
  50. package/dist/{slide-pull-client-BUuJQQVE.js → slide-pull-client-3g6TxaKa.js} +1421 -1421
  51. package/dist/{three-d-ByHGsYrX.js → three-d-BfMZVR0w.js} +98 -98
  52. package/dist/three-d.mjs +678 -678
  53. package/dist/types/chart-ex.d.ts +5 -2
  54. package/dist/types/docx.d.ts +29 -7
  55. package/dist/types/index.d.ts +34 -11
  56. package/dist/types/node.d.ts +27 -5
  57. package/dist/types/pptx.d.ts +11 -7
  58. package/dist/types/region-map.d.ts +5 -2
  59. package/dist/types/three-d.d.ts +5 -2
  60. package/dist/types/xlsx.d.ts +10 -7
  61. package/dist/{wasm-runtime-generation-BLweKv8r.js → wasm-runtime-generation-D97yoAXz.js} +17 -17
  62. package/dist/{workbook-model-source-J9ir5Kov.js → workbook-model-source-BHR8shXr.js} +6 -6
  63. package/dist/{worksheet-pull-client-Du0MuIro.js → worksheet-pull-client-BudfclVl.js} +84 -84
  64. package/dist/{xlsx-BbQ7RcNc.js → xlsx-7aY3Pbvh.js} +44 -44
  65. package/dist/{xlsx-ClQiNSrr.js → xlsx-DTtDjzFq.js} +299 -299
  66. package/dist/{xlsx-model-source-C-Riw89p.js → xlsx-model-source-DXKvb90T.js} +36 -36
  67. package/dist/xlsx.mjs +5 -5
  68. package/dist/xlsx_parser_bg.wasm +0 -0
  69. package/package.json +1 -1
  70. package/dist/assets/render-worker-B3hF7Akg.js +0 -35
  71. package/dist/assets/render-worker-B5HWxkbU.js +0 -16
  72. package/dist/assets/render-worker-DNGf06QT.js +0 -15
  73. package/dist/renderer-xdugdcMd.js +0 -5769
@@ -1,14 +1,14 @@
1
1
  import { t as e } from "./chunk-D5OxutzX.js";
2
- import { _o as t, ja as n, vo as r, yo as i } from "./plot-area-frame-D3JtHvov.js";
3
- import { n as a, t as o } from "./cfb-guard-BIaHdonq.js";
4
- import { Dn as s, En as c, H as l, M as u, N as d, On as f, V as p, Xt as m, Y as h, Yt as g, hn as _, j as v, lt as y, mt as b, ot as x, qt as S, t as ee, u as C } from "./bounded-raw-part-cache-B8t03tSP.js";
5
- import { A as te, C as w, D as ne, E as T, M as re, N as ie, P as E, S as ae, T as D, _ as oe, a as se, b as ce, c as le, d as ue, f as de, g as fe, h as pe, i as me, j as he, k as ge, l as _e, m as ve, n as ye, o as be, p as xe, r as Se, t as Ce, u as we, v as Te, w as Ee, x as De, y as Oe } from "./comment-overlay-controller-Crm5Syhx.js";
6
- import { A as ke, B as Ae, C as je, D as O, E as Me, F as Ne, I as Pe, L as k, M as Fe, N as A, O as Ie, P as Le, R as Re, S as ze, T as Be, V as j, _ as Ve, a as He, b as Ue, c as We, f as Ge, h as Ke, j as M, k as qe, l as Je, m as Ye, n as Xe, o as Ze, p as Qe, s as $e, t as et, u as tt, v as nt, w as rt, x as it, y as N, z as at } from "./document-pull-client-CzhPbnY_.js";
7
- import { f as ot, u as st } from "./pixel-budget-DI82Hn3R.js";
8
- import { i as ct, t as lt } from "./tiff-contract-DEd8CGuz.js";
9
- import { D as ut, E as dt, T as ft, a as pt, b as mt, c as ht, d as gt, f as _t, i as vt, l as yt, n as bt, o as xt, p as St, r as Ct, s as wt, t as Tt, u as Et, v as Dt, w as Ot, x as kt, y as At } from "./canvas-viewer-mechanics-DI38gHNV.js";
10
- import { n as jt } from "./renderer-module-contract-BuTx2FWJ.js";
11
- var P = (e) => (e.charCodeAt(0) << 24 >>> 0 | e.charCodeAt(1) << 16 | e.charCodeAt(2) << 8 | e.charCodeAt(3)) >>> 0, Mt = P("ttcf"), Nt = P("OTTO"), Pt = P("true"), Ft = P("typ1"), It = P("head"), Lt = P("hhea"), Rt = P("OS/2"), zt = P("cmap"), Bt = P("fvar"), F = [
2
+ import { Co as t, Fo as n, Ia as r, So as i, wo as a } from "./plot-area-frame-DNYMd9Pf.js";
3
+ import { n as o, t as s } from "./cfb-guard-DzYlucez.js";
4
+ import { $t as c, An as l, F as u, G as d, I as f, P as p, Q as m, Qt as h, W as g, Xt as _, _t as ee, ft as v, jn as y, kn as te, lt as b, p as x, t as ne, vn as re } from "./bounded-raw-part-cache-B5a6cGKO.js";
5
+ import { A as S, C as ie, D as C, E as w, M as ae, N as oe, P as T, S as se, T as E, _ as ce, a as le, b as ue, c as de, d as fe, f as pe, g as me, h as he, i as ge, j as _e, k as ve, l as ye, m as be, n as xe, o as Se, p as Ce, r as we, t as Te, u as Ee, v as De, w as Oe, x as ke, y as Ae } from "./comment-overlay-controller-B7AoyoDK.js";
6
+ import { A as je, B as Me, C as Ne, D, E as Pe, F as Fe, I as Ie, L as O, M as Le, N as k, O as Re, P as ze, R as Be, S as Ve, T as He, V as A, _ as Ue, a as We, b as Ge, c as Ke, f as qe, h as Je, j, k as Ye, l as Xe, m as Ze, n as Qe, o as $e, p as et, s as tt, t as nt, u as rt, v as it, w as at, x as ot, y as M, z as st } from "./document-pull-client-DSYpUET2.js";
7
+ import { f as ct, u as lt } from "./pixel-budget-DI82Hn3R.js";
8
+ import { i as ut, t as dt } from "./tiff-contract-DEd8CGuz.js";
9
+ import { D as ft, E as pt, T as mt, a as ht, b as gt, c as _t, d as vt, f as yt, i as bt, l as xt, n as St, o as Ct, p as wt, r as Tt, s as Et, t as Dt, u as Ot, v as kt, w as At, x as jt, y as Mt } from "./canvas-viewer-mechanics-BsqaoYgK.js";
10
+ import { n as Nt } from "./renderer-module-contract-BuTx2FWJ.js";
11
+ var N = (e) => (e.charCodeAt(0) << 24 >>> 0 | e.charCodeAt(1) << 16 | e.charCodeAt(2) << 8 | e.charCodeAt(3)) >>> 0, Pt = N("ttcf"), Ft = N("OTTO"), It = N("true"), Lt = N("typ1"), Rt = N("head"), zt = N("hhea"), Bt = N("OS/2"), Vt = N("cmap"), Ht = N("fvar"), P = [
12
12
  [4352, 4607],
13
13
  [11904, 12287],
14
14
  [12352, 12543],
@@ -24,10 +24,10 @@ var P = (e) => (e.charCodeAt(0) << 24 >>> 0 | e.charCodeAt(1) << 16 | e.charCode
24
24
  [63744, 64255],
25
25
  [131072, 205743]
26
26
  ];
27
- function I(e, t, n) {
27
+ function F(e, t, n) {
28
28
  return Number.isSafeInteger(t) && Number.isSafeInteger(n) && t >= 0 && n >= 0 && t <= e - n;
29
29
  }
30
- function Vt(e, t, n) {
30
+ function Ut(e, t, n) {
31
31
  if (n < 16) return !1;
32
32
  let r = e.getUint16(t + 2);
33
33
  if (r < 16 || r > n) return !1;
@@ -43,7 +43,7 @@ function Vt(e, t, n) {
43
43
  }
44
44
  for (let n = 0; n < a; n++) {
45
45
  let i = e.getUint16(s + n * 2), a = e.getUint16(o + n * 2), u = e.getInt16(c + n * 2), d = l + n * 2, f = e.getUint16(d);
46
- for (let [n, o] of F) {
46
+ for (let [n, o] of P) {
47
47
  let s = Math.max(i, n), c = Math.min(a, o);
48
48
  if (!(s > c)) {
49
49
  if (f === 0) {
@@ -61,7 +61,7 @@ function Vt(e, t, n) {
61
61
  }
62
62
  return !1;
63
63
  }
64
- function Ht(e, t, n, r) {
64
+ function Wt(e, t, n, r) {
65
65
  if (n < 16) return !1;
66
66
  let i = e.getUint32(t + 4), a = e.getUint32(t + 12);
67
67
  if (i < 16 || i > n || a > (i - 16) / 12) return !1;
@@ -69,8 +69,8 @@ function Ht(e, t, n, r) {
69
69
  for (let n = 0; n < a; n++) {
70
70
  let i = t + 16 + n * 12, a = e.getUint32(i), s = e.getUint32(i + 4), c = e.getUint32(i + 8);
71
71
  if (a > s || s > 1114111 || a <= o) return !1;
72
- if (o = s, a > F[F.length - 1][1]) break;
73
- for (let [e, t] of F) {
72
+ if (o = s, a > P[P.length - 1][1]) break;
73
+ for (let [e, t] of P) {
74
74
  let n = Math.max(a, e), i = Math.min(s, t);
75
75
  if (!(n > i)) {
76
76
  if (r) {
@@ -81,7 +81,7 @@ function Ht(e, t, n, r) {
81
81
  }
82
82
  return !1;
83
83
  }
84
- function Ut(e, t) {
84
+ function Gt(e, t) {
85
85
  if (!t || t.length < 4) return !1;
86
86
  let n = e.getUint16(t.offset + 2);
87
87
  if (4 + n * 8 > t.length) return !1;
@@ -91,12 +91,12 @@ function Ut(e, t) {
91
91
  let o = e.getUint32(n + 4);
92
92
  if (o > t.length - 2) continue;
93
93
  let s = t.offset + o, c = t.length - o, l = e.getUint16(s);
94
- if (l === 4 && Vt(e, s, c) || l === 12 && Ht(e, s, c, !1) || l === 13 && Ht(e, s, c, !0)) return !0;
94
+ if (l === 4 && Ut(e, s, c) || l === 12 && Wt(e, s, c, !1) || l === 13 && Wt(e, s, c, !0)) return !0;
95
95
  }
96
96
  return !1;
97
97
  }
98
- var Wt = 32768, Gt = 4096, Kt = 8, qt = 262144;
99
- function Jt(e, t, n, r) {
98
+ var Kt = 32768, qt = 4096, Jt = 8, Yt = 262144;
99
+ function Xt(e, t, n, r) {
100
100
  if (n < 16) return null;
101
101
  let i = e.getUint16(t + 2);
102
102
  if (i < 16 || i > n) return null;
@@ -117,14 +117,14 @@ function Jt(e, t, n, r) {
117
117
  if (r + 2 > t + i) return 0;
118
118
  let o = e.getUint16(r);
119
119
  return o === 0 ? 0 : o + f & 65535;
120
- })()) !== 0 && m(n), d.length > Wt)) return null;
120
+ })()) !== 0 && m(n), d.length > Kt)) return null;
121
121
  }
122
122
  return d;
123
123
  }
124
- function Yt(e, t, n, r, i) {
124
+ function Zt(e, t, n, r, i) {
125
125
  if (n < 16) return null;
126
126
  let a = e.getUint32(t + 4), o = e.getUint32(t + 12);
127
- if (a < 16 || a > n || o > (a - 16) / 12 || o > Wt) return null;
127
+ if (a < 16 || a > n || o > (a - 16) / 12 || o > Kt) return null;
128
128
  let s = [], c = -1;
129
129
  for (let n = 0; n < o; n++) {
130
130
  if (--i.remaining < 0) return null;
@@ -138,10 +138,10 @@ function Yt(e, t, n, r, i) {
138
138
  }
139
139
  return s;
140
140
  }
141
- function Xt(e, t) {
141
+ function Qt(e, t) {
142
142
  if (!t || t.length < 4) return [];
143
143
  let n = e.getUint16(t.offset + 2);
144
- if (n > Gt || 4 + n * 8 > t.length) return [];
144
+ if (n > qt || 4 + n * 8 > t.length) return [];
145
145
  let r = /* @__PURE__ */ new Set(), i = [];
146
146
  for (let a = 0; a < n; a++) {
147
147
  let n = t.offset + 4 + a * 8, o = e.getUint16(n), s = e.getUint16(n + 2);
@@ -152,7 +152,7 @@ function Xt(e, t) {
152
152
  if (!(o === 0 && s === 5 && d === 14)) {
153
153
  if (d !== 4 && d !== 12 && d !== 13) return [];
154
154
  if (!r.has(c)) {
155
- if (r.add(c), r.size > Kt) return [];
155
+ if (r.add(c), r.size > Jt) return [];
156
156
  i.push({
157
157
  subtable: l,
158
158
  availableLength: u,
@@ -161,9 +161,9 @@ function Xt(e, t) {
161
161
  }
162
162
  }
163
163
  }
164
- let a = { remaining: qt }, o = null;
164
+ let a = { remaining: Yt }, o = null;
165
165
  for (let t of i) {
166
- let n = t.format === 4 ? Jt(e, t.subtable, t.availableLength, a) : Yt(e, t.subtable, t.availableLength, t.format === 13, a);
166
+ let n = t.format === 4 ? Xt(e, t.subtable, t.availableLength, a) : Zt(e, t.subtable, t.availableLength, t.format === 13, a);
167
167
  if (!n?.length) return [];
168
168
  if (o === null) {
169
169
  o = n;
@@ -177,7 +177,7 @@ function Xt(e, t) {
177
177
  let e = r.at(-1);
178
178
  if (e && e[1] + 1 === c) r[r.length - 1] = [e[0], l];
179
179
  else {
180
- if (r.length >= Wt) return [];
180
+ if (r.length >= Kt) return [];
181
181
  r.push([c, l]);
182
182
  }
183
183
  }
@@ -188,48 +188,48 @@ function Xt(e, t) {
188
188
  }
189
189
  return Object.freeze((o ?? []).map((e) => Object.freeze(e)));
190
190
  }
191
- function Zt(e) {
191
+ function $t(e) {
192
192
  let t = 0, n = 0;
193
- for (; t < e.length && n < F.length;) {
194
- let [r, i] = e[t], [a, o] = F[n];
193
+ for (; t < e.length && n < P.length;) {
194
+ let [r, i] = e[t], [a, o] = P[n];
195
195
  if (i < a) t++;
196
196
  else if (o < r) n++;
197
197
  else return !0;
198
198
  }
199
199
  return !1;
200
200
  }
201
- function Qt(e, t) {
202
- return $t(e, t, !0);
201
+ function en(e, t) {
202
+ return tn(e, t, !0);
203
203
  }
204
- function $t(e, t, n) {
204
+ function tn(e, t, n) {
205
205
  if (t !== void 0 && (!Number.isSafeInteger(t) || t < 0) || e.byteLength < 12) return null;
206
206
  let r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = 0;
207
- if (r.getUint32(0) === Mt) {
207
+ if (r.getUint32(0) === Pt) {
208
208
  if (t === void 0 || e.byteLength < 12) return null;
209
209
  let n = r.getUint32(8);
210
- if (t >= n || !I(e.byteLength, 12, n * 4)) return null;
210
+ if (t >= n || !F(e.byteLength, 12, n * 4)) return null;
211
211
  i = r.getUint32(12 + t * 4);
212
212
  } else if (t !== void 0 && t !== 0) return null;
213
- if (!I(e.byteLength, i, 12)) return null;
213
+ if (!F(e.byteLength, i, 12)) return null;
214
214
  let a = r.getUint32(i);
215
- if (a !== 65536 && a !== Nt && a !== Pt && a !== Ft) return null;
215
+ if (a !== 65536 && a !== Ft && a !== It && a !== Lt) return null;
216
216
  let o = r.getUint16(i + 4);
217
- if (!I(e.byteLength, i + 12, o * 16)) return null;
217
+ if (!F(e.byteLength, i + 12, o * 16)) return null;
218
218
  let s = /* @__PURE__ */ new Map();
219
219
  for (let t = 0; t < o; t++) {
220
220
  let n = i + 12 + t * 16, a = r.getUint32(n), o = r.getUint32(n + 8), c = r.getUint32(n + 12);
221
- if (s.has(a) || !I(e.byteLength, o, c)) return null;
221
+ if (s.has(a) || !F(e.byteLength, o, c)) return null;
222
222
  s.set(a, {
223
223
  offset: o,
224
224
  length: c
225
225
  });
226
226
  }
227
- if (n && s.has(Bt)) return null;
228
- let c = s.get(It), l = s.get(Lt);
227
+ if (n && s.has(Ht)) return null;
228
+ let c = s.get(Rt), l = s.get(zt);
229
229
  if (!c || c.length < 20 || !l || l.length < 10) return null;
230
230
  let u = r.getUint16(c.offset + 18);
231
231
  if (u < 16 || u > 16384) return null;
232
- let d = s.get(Rt), f = d !== void 0 && d.length >= 4 ? r.getInt16(d.offset + 2) : 0, p = d !== void 0 && d.length >= 78, m = d !== void 0 && d.length >= 86 && r.getUint16(d.offset) >= 1, h = n ? Xt(r, s.get(zt)) : void 0;
232
+ let d = s.get(Bt), f = d !== void 0 && d.length >= 4 ? r.getInt16(d.offset + 2) : 0, p = d !== void 0 && d.length >= 78, m = d !== void 0 && d.length >= 86 && r.getUint16(d.offset) >= 1, h = n ? Qt(r, s.get(Vt)) : void 0;
233
233
  return Object.freeze({
234
234
  unitsPerEm: u,
235
235
  ...f > 0 ? { averageCharWidthRatio: f / u } : {},
@@ -237,7 +237,7 @@ function $t(e, t, n) {
237
237
  hheaDescent: r.getInt16(l.offset + 6),
238
238
  hheaLineGap: r.getInt16(l.offset + 8),
239
239
  farEastCodePage: m ? (r.getUint32(d.offset + 78) & 1966080) != 0 : null,
240
- hasEastAsianCmap: h ? Zt(h) : Ut(r, s.get(zt)),
240
+ hasEastAsianCmap: h ? $t(h) : Gt(r, s.get(Vt)),
241
241
  ...h === void 0 ? {} : { unicodeRanges: h },
242
242
  ...p ? {
243
243
  typoAscent: r.getInt16(d.offset + 68),
@@ -249,36 +249,36 @@ function $t(e, t, n) {
249
249
  } : {}
250
250
  });
251
251
  }
252
- function en(e, n) {
253
- if (e.metric.lineHeightRatio != null || !n) return e.metric;
254
- let r = t(e.requestedFamily, {
252
+ function nn(e, t) {
253
+ if (e.metric.lineHeightRatio != null || !t) return e.metric;
254
+ let n = i(e.requestedFamily, {
255
255
  weight: e.weight,
256
256
  style: e.style
257
257
  });
258
- if (e.source !== "substitute" && r.some((e) => e.farEastCodePage !== !1)) return e.metric;
259
- let i = n.ascentRatio + n.lineGapRatio, a = n.descentRatio;
260
- return Number.isFinite(i) && Number.isFinite(a) && i >= 0 && a >= 0 && i + a > 0 ? Object.freeze({
258
+ if (e.source !== "substitute" && n.some((e) => e.farEastCodePage !== !1)) return e.metric;
259
+ let r = t.ascentRatio + t.lineGapRatio, a = t.descentRatio;
260
+ return Number.isFinite(r) && Number.isFinite(a) && r >= 0 && a >= 0 && r + a > 0 ? Object.freeze({
261
261
  ...e.metric,
262
262
  requiresGlyphCoverage: !0,
263
- lineHeightRatio: i + a,
264
- designAscentRatio: i,
263
+ lineHeightRatio: r + a,
264
+ designAscentRatio: r,
265
265
  designDescentRatio: a,
266
- lineGapRatio: n.lineGapRatio,
267
- ...r.length > 0 && e.source === "local" ? { farEastCodePage: !1 } : {}
266
+ lineGapRatio: t.lineGapRatio,
267
+ ...n.length > 0 && e.source === "local" ? { farEastCodePage: !1 } : {}
268
268
  }) : e.metric;
269
269
  }
270
- function tn(e) {
270
+ function rn(e) {
271
271
  if (e.metric.lineHeightRatio != null) return;
272
- let n = t(e.requestedFamily, {
272
+ let t = i(e.requestedFamily, {
273
273
  weight: e.weight,
274
274
  style: e.style
275
275
  });
276
- return e.source === "substitute" || n.every((e) => e.farEastCodePage === !1) ? n[0]?.unitsPerEm : void 0;
276
+ return e.source === "substitute" || t.every((e) => e.farEastCodePage === !1) ? t[0]?.unitsPerEm : void 0;
277
277
  }
278
- async function nn(e) {
278
+ async function an(e) {
279
279
  let t = typeof document > "u" ? null : document;
280
280
  return Promise.all(e.map(async (e) => {
281
- let n = tn(e), r = an(e), i = t?.body && r && n ? await Ae(r, e.family, e.weight, e.style, n, t) : null;
281
+ let n = rn(e), r = sn(e), i = t?.body && r && n ? await Me(r, e.family, e.weight, e.style, n, t) : null;
282
282
  return {
283
283
  resourceIdentity: e.resourceIdentity,
284
284
  weight: e.weight,
@@ -287,27 +287,27 @@ async function nn(e) {
287
287
  };
288
288
  }));
289
289
  }
290
- function rn(e) {
290
+ function on(e) {
291
291
  if (e.source !== "local" || e.weight !== 400 || e.style !== "normal") return !1;
292
- let n = t(e.requestedFamily);
293
- return !n.some((e) => e.weight >= 600 && e.style === "normal") || !n.some((e) => e.style === "italic");
292
+ let t = i(e.requestedFamily);
293
+ return !t.some((e) => e.weight >= 600 && e.style === "normal") || !t.some((e) => e.style === "italic");
294
294
  }
295
- function an(e) {
295
+ function sn(e) {
296
296
  return e.source === "local" && e.resourceIdentity.startsWith("office-local:local(") ? e.resourceIdentity.slice(13) : void 0;
297
297
  }
298
- async function on(e, t, n) {
299
- let r = typeof document > "u" ? null : document;
298
+ async function cn(e, t, r) {
299
+ let i = typeof document > "u" ? null : document;
300
300
  if (!t) return e;
301
- let i = r?.body && r.fonts === t ? r.createElement("canvas").getContext("2d") : null, a = /* @__PURE__ */ new Map(), o = await Promise.all(Object.entries(e.routes).map(async ([o, s]) => {
302
- let c = e.faces.find((e) => e.family === s.family), l = tn(s), u = n?.find((e) => e.resourceIdentity === s.resourceIdentity && e.weight === s.weight && e.style === s.style), d = en(s, c && l && i && r?.body ? at(c, t, i, l, r) : u?.measured ?? null), f = an(s), p = null, m;
303
- if (c && f && rn(s)) {
304
- let e = a.get(c);
305
- e || (e = Re(c, f, t), a.set(c, e)), m = (await e)?.family;
301
+ let a = i?.body && i.fonts === t ? i.createElement("canvas").getContext("2d") : null, o = /* @__PURE__ */ new Map(), s = await Promise.all(Object.entries(e.routes).map(async ([n, s]) => {
302
+ let c = e.faces.find((e) => e.family === s.family), l = rn(s), u = r?.find((e) => e.resourceIdentity === s.resourceIdentity && e.weight === s.weight && e.style === s.style), d = nn(s, c && l && a && i?.body ? st(c, t, a, l, i) : u?.measured ?? null), f = sn(s), p = null, m;
303
+ if (c && f && on(s)) {
304
+ let e = o.get(c);
305
+ e || (e = Be(c, f, t), o.set(c, e)), m = (await e)?.family;
306
306
  }
307
307
  if (d !== s.metric) {
308
308
  if (c && f) {
309
- let e = a.get(c);
310
- e || (e = Re(c, f, t), a.set(c, e)), p = await e;
309
+ let e = o.get(c);
310
+ e || (e = Be(c, f, t), o.set(c, e)), p = await e;
311
311
  }
312
312
  d = p ? Object.freeze({
313
313
  ...d,
@@ -315,7 +315,7 @@ async function on(e, t, n) {
315
315
  }) : s.metric;
316
316
  }
317
317
  return {
318
- key: o,
318
+ key: n,
319
319
  route: {
320
320
  ...s,
321
321
  metric: d,
@@ -323,34 +323,34 @@ async function on(e, t, n) {
323
323
  },
324
324
  probe: p
325
325
  };
326
- })), s = {};
327
- for (let e of o) s[e.key] = e.route;
328
- for (let t of a.values()) {
326
+ })), c = n();
327
+ for (let e of s) c[e.key] = e.route;
328
+ for (let t of o.values()) {
329
329
  let n = await t;
330
330
  n && e.faces.push(n);
331
331
  }
332
332
  return {
333
333
  ...e,
334
- routes: s
334
+ routes: c
335
335
  };
336
336
  }
337
- async function sn(...e) {
338
- return on(await g(...e), e[1] === void 0 ? c() : e[1]);
337
+ async function ln(...e) {
338
+ return cn(await h(...e), e[1] === void 0 ? te() : e[1]);
339
339
  }
340
- var cn = /* @__PURE__ */ new WeakMap();
341
- function L(e, t = []) {
342
- let n = cn.get(e) ?? [], r = new Map(n.map((e) => [JSON.stringify(e), e]));
340
+ var un = /* @__PURE__ */ new WeakMap();
341
+ function I(e, t = []) {
342
+ let n = un.get(e) ?? [], r = new Map(n.map((e) => [JSON.stringify(e), e]));
343
343
  for (let e of t) r.set(JSON.stringify(e), Object.freeze({ ...e }));
344
- cn.set(e, Object.freeze([...r.values()]));
344
+ un.set(e, Object.freeze([...r.values()]));
345
345
  }
346
- function ln(e) {
347
- return cn.get(e) ?? [];
346
+ function dn(e) {
347
+ return un.get(e) ?? [];
348
348
  }
349
- var un = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var n,r,i=e((()=>{n=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},r=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function a(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function o(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function s(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!a(r)||!o(i)||!o(s)||s<=i?void 0:{metric:r,limit:i,observed:s}}catch{return}}var c,l,u,d,f,ee=e((()=>{c=1<<25,l=1<<27,c*4,l*4,u=Math.floor(c/4),d=l,d/u,f=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function te(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var ne=e((()=>{}));function p(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function re(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return p(t.requiredBytes)&&p(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var m=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function h(e){if(e instanceof m)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!re(r)))return new m(r)}function ie(e,t,n){let r=h(e);if(!(!r||r.offeredBytes!==t||r.requiredBytes>n))return r}i(),ee(),ne();const g=`OOXML_RESOURCE_LIMIT:`;function _(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return _(t.archiveEntryCount)&&_(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||_(t.largestInflatedEntryBytes))&&_(t.distinctInflatedBytes)&&_(t.operationInflatedBytes)}function y(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!v(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function ae(e){return e===`docx`||e===`xlsx`||e===`pptx`}function oe(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function b(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function x(e){return b(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function se(e){return!b(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const S=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),ce=new Set([...S.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),le=new Set([...S.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function ue(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!ae(t.format)||!b(t.operation,256)||!x(t.resource)||!x(t.metric)||!_(t.limit)||!_(t.observed)||typeof t.configurable!=`boolean`||!v(t.usage)?!1:!(`part`in t)||se(t.part)}function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!oe(t.stage)||!ue(t.violation))return!1;let n=t.violation,r=S.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(ce.has(n.resource)&&le.has(n.metric))}function de(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function fe(e){if(!C(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:de(t.usage)}};return C(n)?n:void 0}function pe(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function w(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(g))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let i=n;if(!(i.code!==`ooxml-resource-limit`||!C(i.details)))return new r(pe(i.details),i.details)}function me(e){try{return e()}catch(e){throw e instanceof r||typeof e!=`string`&&!(e instanceof Error)?e:w(e)??e}}function he(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(`OOXML_NOT_OOXML:`))return new n(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function T(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!x(n)||r!==`source-subset`))return{format:n,reason:r}}function E(e){return new n(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function ge(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=T(JSON.parse(t.slice(25)));return e?E(e):void 0}catch{return}}function _e(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new n(`unsupported-encryption`,`The configured source cannot decrypt this input.`):ge(e)??w(e)??he(e)}function ve(e){let t=s(e);if(t){let e=new f(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let i=te(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=h(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof n||e instanceof r?e:_e(e),c=o??e;if(o instanceof r||c&&typeof c==`object`&&c.code===`ooxml-resource-limit`){let e=c,t=fe(e.details);return t?{message:typeof e.message==`string`?e.message:pe(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(c&&typeof c==`object`&&c.code===`unsupported-content`){let e=T(c.details);return e?{message:E(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof n)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:b(o.name,128)?o.name:`OoxmlError`,...x(o.code)?{code:o.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(g))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let u=e instanceof Error?e:Error(l),d=u;return{message:typeof u.message==`string`?u.message:String(u.message),errorName:b(u.name,128)?u.name:`Error`,...typeof d.code==`string`?{code:d.code}:{}}}function D(e){try{return ve(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}var ye=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},O=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function be(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function xe(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function Se(e,t){return e({module_or_path:t})}var Ce=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new ye(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),we),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return me(()=>this.runtime.run(e))}poison(){this.runtime.poison(new O(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):Se(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,xe(e)}};function we(e){return be(e)?new O(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function Te(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function Ee(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const k=`ooxml-pull-v1`;function A(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function De(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var j=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,A(this.maxRetainedBytes,`max retained lease bytes`),A(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},Oe=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){De(e.sessionId),A(e.operationId,`operation id`),A(e.generation,`generation`),A(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&A(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=D(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(A(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:k,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){A(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(A(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:k,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:k,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};i();function ke(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_DOCX_ILVL:`))return;let r=t.slice(16);if(r===`repair-required:level-definition`)return new n(`invalid-numbering`,`The DOCX defines a numbering level outside Word’s supported 0–8 range and requires repair.`);if(r===`cannot-open:whitespace`||r===`cannot-open:non-decimal`)return new n(`invalid-numbering`,`Word cannot open this DOCX numbering level (${r.slice(12)}).`)}function M(e){try{return ke(e)??e}catch{return e}}function Ae(e){try{return e()}catch(e){throw M(e)}}var N=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),e}free(){let e=this.__destroy_into_raw();J.__wbg_docxarchive_free(e,0)}acknowledge_document_chunk(e,t,n){let r=J.docxarchive_acknowledge_document_chunk(this.__wbg_ptr,e,t,n);if(r[1])throw U(r[0])}assert_healthy(){let e=J.docxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw U(e[0])}cancel_document_cursor(){J.docxarchive_cancel_document_cursor(this.__wbg_ptr)}close_document_session(){J.docxarchive_close_document_session(this.__wbg_ptr)}document_chunk_done(){let e=J.docxarchive_document_chunk_done(this.__wbg_ptr);if(e[2])throw U(e[1]);return e[0]!==0}document_cursor_resource_usage(){let e=J.docxarchive_document_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);let t;return e[0]!==0&&(t=F(e[0],e[1]).slice(),J.__wbindgen_free(e[0],e[1]*1,1)),t}extract_image(e){let t=H(e,J.__wbindgen_malloc,J.__wbindgen_realloc),n=q,r=J.docxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw U(r[2]);var i=F(r[0],r[1]).slice();return J.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=Me(e,J.__wbindgen_malloc),a=q,o=J.docxarchive_new(i,a,!V(t),V(t)?BigInt(0):t,!V(n),V(n)?BigInt(0):n,!V(r),V(r)?BigInt(0):r);if(o[2])throw U(o[1]);return this.__wbg_ptr=o[0]>>>0,P.register(this,this.__wbg_ptr,this),this}open_document_cursor(e,t){let n=J.docxarchive_open_document_cursor(this.__wbg_ptr,e,t);if(n[1])throw U(n[0])}parse(){let e=J.docxarchive_parse(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}pull_document_chunk(e,t,n,r){let i=J.docxarchive_pull_document_chunk(this.__wbg_ptr,e,t,n,r);if(i[3])throw U(i[2]);var a=F(i[0],i[1]).slice();return J.__wbindgen_free(i[0],i[1]*1,1),a}resource_usage(){let e=J.docxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=J.docxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,U(i[2]);return e=n,t=r,R(n,r)}finally{J.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free);function je(){return{__proto__:null,\"./docx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(R(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(R(e,t))}finally{J.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=H(n,J.__wbindgen_malloc,J.__wbindgen_realloc),i=q;L().setInt32(e+4,i,!0),L().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return R(e,t)},__wbindgen_init_externref_table:function(){let e=J.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const P=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>J.__wbg_docxarchive_free(e>>>0,1));function F(e,t){return e>>>=0,B().subarray(e/1,e/1+t)}let I=null;function L(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==J.memory.buffer)&&(I=new DataView(J.memory.buffer)),I}function R(e,t){return e>>>=0,Ne(e,t)}let z=null;function B(){return(z===null||z.byteLength===0)&&(z=new Uint8Array(J.memory.buffer)),z}function V(e){return e==null}function Me(e,t){let n=t(e.length*1,1)>>>0;return B().set(e,n/1),q=e.length,n}function H(e,t,n){if(n===void 0){let n=K.encode(e),r=t(n.length,1)>>>0;return B().subarray(r,r+n.length).set(n),q=n.length,r}let r=e.length,i=t(r,1)>>>0,a=B(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=B().subarray(i+o,i+r),a=K.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return q=o,i}function U(e){let t=J.__wbindgen_externrefs.get(e);return J.__externref_table_dealloc(e),t}let W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});W.decode();let G=0;function Ne(e,t){return G+=t,G>=2146435072&&(W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),W.decode(),G=t),W.decode(B().subarray(e,e+t))}const K=new TextEncoder;`encodeInto`in K||(K.encodeInto=function(e,t){let n=K.encode(e);return t.set(n),{read:e.length,written:n.length}});let q=0,J;function Pe(e,t){return J=e.exports,I=null,z=null,J.__wbindgen_start(),J}async function Fe(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function Y(e){if(J!==void 0)return J;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=je();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Fe(await e,t);return Pe(n,r)}async function Ie(e){return J=void 0,I=null,z=null,Y(e)}function Le(e){let t=e(e=>e.document_cursor_resource_usage?.());return t?y(t):void 0}const Re=67108864;var ze=class{archive;coordinator=new j;host=null;identity=null;executeArchive;constructor(e,t=e=>e(this.requireArchive())){this.archive=e,this.executeArchive=e=>Ae(()=>t(e))}open(e){if(this.host)throw Error(`a DOCX document pull session is already active`);this.executeArchive(t=>{t.open_document_cursor(e.operationId,e.generation)});let t=0;this.identity=e,this.host=new Oe({...e,maxByteCredit:Re,coordinator:this.coordinator,driver:{pull:n=>{let r;try{r=this.executeArchive(r=>r.pull_document_chunk(t,e.operationId,e.generation,n))}catch(e){throw ie(e,n,Re)||e}let i=Te(r);return{payload:i,byteLength:i.byteLength,done:this.executeArchive(e=>e.document_chunk_done()),transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:n=>{if(n!==t)throw Error(`DOCX document acknowledgement sequence mismatch`);this.executeArchive(n=>n.acknowledge_document_chunk(t,e.operationId,e.generation)),t+=1},cancel:()=>this.executeArchive(e=>e.cancel_document_cursor()),close:()=>this.executeArchive(e=>e.close_document_session()),resourceUsage:()=>Le(this.executeArchive)}})}dispatch(e,t){return!this.host||!this.identity?(t({protocol:k,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:D(Error(`DOCX document pull session is not open`))}),Promise.resolve()):this.host.dispatch(e,t)}async reset(){if(this.host)try{this.archive()&&this.executeArchive(e=>e.close_document_session())}finally{this.host=null,this.identity=null,this.coordinator=new j}}requireArchive(){let e=this.archive();if(!e)throw Error(`No docx loaded`);return e}};function Be(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const X=new Ce(Y,{freeArchive:e=>e.free(),reinit:Ie}),Z=new ze(()=>X.archive,e=>X.run(()=>{let t=X.archive;if(!t)throw Error(`No docx loaded`);return e(t)}));let Q=0;const $=(e,t)=>self.postMessage(e,t);self.onmessage=async e=>{let n=e.data;if(Be(n)){try{await Z.dispatch(n,$)}catch(e){$({protocol:k,kind:`error`,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation,requestId:n.requestId,error:D(M(e))})}return}if(n.type===`init`){X.setWasmInput(t(n.wasmUrl)??n.wasmUrl);return}let r=n.id;try{if(await X.ensureReady(),n.type!==`parse`&&X.archive){let e=X.archive;X.run(()=>e.assert_healthy())}if(n.type===`parse`){await Z.reset();let[e,t,i]=Ee(n.resourcePolicy),a=new Uint8Array(n.data);X.run(()=>{let n=new N(a,e,t,i);X.setArchive(n)}),Q+=1;let o={sessionId:Q,operationId:Q,generation:Q};Z.open(o),$({type:`documentSessionOpened`,id:r,...o});return}let e=X.archive;if(n.type===`extractImage`){if(!e)throw Error(`No docx loaded`);let t=X.run(()=>e.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.type===`resourceUsage`){if(!e)throw Error(`No docx loaded`);$({type:`resourceUsage`,id:r,usage:y(X.run(()=>e.resource_usage()))});return}if(n.type===`toMarkdown`){if(!e)throw Error(`No docx loaded`);$({type:`markdownRendered`,id:r,markdown:X.run(()=>e.to_markdown())});return}}catch(e){$({type:`error`,id:r,...D(M(e))})}};", dn = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", un], { type: "text/javascript;charset=utf-8" });
350
- function fn(e) {
349
+ var fn = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var n,r,i=e((()=>{n=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},r=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function a(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function o(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function s(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!a(r)||!o(i)||!o(s)||s<=i?void 0:{metric:r,limit:i,observed:s}}catch{return}}var c,l,u,d,f,ee=e((()=>{c=1<<25,l=1<<27,c*4,l*4,u=Math.floor(c/4),d=l,d/u,f=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function te(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var ne=e((()=>{}));function p(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function re(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return p(t.requiredBytes)&&p(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var m=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function h(e){if(e instanceof m)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!re(r)))return new m(r)}function ie(e,t,n){let r=h(e);if(!(!r||r.offeredBytes!==t||r.requiredBytes>n))return r}i(),ee(),ne();const g=`OOXML_RESOURCE_LIMIT:`;function _(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return _(t.archiveEntryCount)&&_(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||_(t.largestInflatedEntryBytes))&&_(t.distinctInflatedBytes)&&_(t.operationInflatedBytes)}function y(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!v(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function ae(e){return e===`docx`||e===`xlsx`||e===`pptx`}function oe(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function b(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function x(e){return b(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function se(e){return!b(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const S=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),ce=new Set([...S.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),le=new Set([...S.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function ue(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!ae(t.format)||!b(t.operation,256)||!x(t.resource)||!x(t.metric)||!_(t.limit)||!_(t.observed)||typeof t.configurable!=`boolean`||!v(t.usage)?!1:!(`part`in t)||se(t.part)}function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!oe(t.stage)||!ue(t.violation))return!1;let n=t.violation,r=S.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(ce.has(n.resource)&&le.has(n.metric))}function de(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function fe(e){if(!C(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:de(t.usage)}};return C(n)?n:void 0}function pe(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function w(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(g))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let i=n;if(!(i.code!==`ooxml-resource-limit`||!C(i.details)))return new r(pe(i.details),i.details)}function me(e){try{return e()}catch(e){throw e instanceof r||typeof e!=`string`&&!(e instanceof Error)?e:w(e)??e}}function he(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(`OOXML_NOT_OOXML:`))return new n(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function T(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!x(n)||r!==`source-subset`))return{format:n,reason:r}}function E(e){return new n(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function ge(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=T(JSON.parse(t.slice(25)));return e?E(e):void 0}catch{return}}function _e(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new n(`unsupported-encryption`,`The configured source cannot decrypt this input.`):ge(e)??w(e)??he(e)}function ve(e){let t=s(e);if(t){let e=new f(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let i=te(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=h(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof n||e instanceof r?e:_e(e),c=o??e;if(o instanceof r||c&&typeof c==`object`&&c.code===`ooxml-resource-limit`){let e=c,t=fe(e.details);return t?{message:typeof e.message==`string`?e.message:pe(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(c&&typeof c==`object`&&c.code===`unsupported-content`){let e=T(c.details);return e?{message:E(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof n)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:b(o.name,128)?o.name:`OoxmlError`,...x(o.code)?{code:o.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(g))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let u=e instanceof Error?e:Error(l),d=u;return{message:typeof u.message==`string`?u.message:String(u.message),errorName:b(u.name,128)?u.name:`Error`,...typeof d.code==`string`?{code:d.code}:{}}}function D(e){try{return ve(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}var ye=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},O=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function be(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function xe(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function Se(e,t){return e({module_or_path:t})}var Ce=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new ye(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),we),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return me(()=>this.runtime.run(e))}poison(){this.runtime.poison(new O(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):Se(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,xe(e)}};function we(e){return be(e)?new O(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function Te(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function Ee(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const k=`ooxml-pull-v1`;function A(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function De(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var j=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,A(this.maxRetainedBytes,`max retained lease bytes`),A(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},Oe=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){De(e.sessionId),A(e.operationId,`operation id`),A(e.generation,`generation`),A(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&A(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=D(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(A(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:k,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){A(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(A(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:k,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:k,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};i();function ke(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_DOCX_ILVL:`))return;let r=t.slice(16);if(r===`repair-required:level-definition`)return new n(`invalid-numbering`,`The DOCX defines a numbering level outside Word’s supported 0–8 range and requires repair.`);if(r===`cannot-open:whitespace`||r===`cannot-open:non-decimal`)return new n(`invalid-numbering`,`Word cannot open this DOCX numbering level (${r.slice(12)}).`)}function M(e){try{return ke(e)??e}catch{return e}}function Ae(e){try{return e()}catch(e){throw M(e)}}var N=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),e}free(){let e=this.__destroy_into_raw();J.__wbg_docxarchive_free(e,0)}acknowledge_document_chunk(e,t,n){let r=J.docxarchive_acknowledge_document_chunk(this.__wbg_ptr,e,t,n);if(r[1])throw U(r[0])}assert_healthy(){let e=J.docxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw U(e[0])}cancel_document_cursor(){J.docxarchive_cancel_document_cursor(this.__wbg_ptr)}close_document_session(){J.docxarchive_close_document_session(this.__wbg_ptr)}document_chunk_done(){let e=J.docxarchive_document_chunk_done(this.__wbg_ptr);if(e[2])throw U(e[1]);return e[0]!==0}document_cursor_resource_usage(){let e=J.docxarchive_document_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);let t;return e[0]!==0&&(t=F(e[0],e[1]).slice(),J.__wbindgen_free(e[0],e[1]*1,1)),t}extract_image(e){let t=H(e,J.__wbindgen_malloc,J.__wbindgen_realloc),n=q,r=J.docxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw U(r[2]);var i=F(r[0],r[1]).slice();return J.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=Me(e,J.__wbindgen_malloc),a=q,o=J.docxarchive_new(i,a,!V(t),V(t)?BigInt(0):t,!V(n),V(n)?BigInt(0):n,!V(r),V(r)?BigInt(0):r);if(o[2])throw U(o[1]);return this.__wbg_ptr=o[0]>>>0,P.register(this,this.__wbg_ptr,this),this}open_document_cursor(e,t){let n=J.docxarchive_open_document_cursor(this.__wbg_ptr,e,t);if(n[1])throw U(n[0])}parse(){let e=J.docxarchive_parse(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}pull_document_chunk(e,t,n,r){let i=J.docxarchive_pull_document_chunk(this.__wbg_ptr,e,t,n,r);if(i[3])throw U(i[2]);var a=F(i[0],i[1]).slice();return J.__wbindgen_free(i[0],i[1]*1,1),a}resource_usage(){let e=J.docxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=J.docxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,U(i[2]);return e=n,t=r,R(n,r)}finally{J.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free);function je(){return{__proto__:null,\"./docx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(R(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(R(e,t))}finally{J.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=H(n,J.__wbindgen_malloc,J.__wbindgen_realloc),i=q;L().setInt32(e+4,i,!0),L().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return R(e,t)},__wbindgen_init_externref_table:function(){let e=J.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const P=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>J.__wbg_docxarchive_free(e>>>0,1));function F(e,t){return e>>>=0,B().subarray(e/1,e/1+t)}let I=null;function L(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==J.memory.buffer)&&(I=new DataView(J.memory.buffer)),I}function R(e,t){return e>>>=0,Ne(e,t)}let z=null;function B(){return(z===null||z.byteLength===0)&&(z=new Uint8Array(J.memory.buffer)),z}function V(e){return e==null}function Me(e,t){let n=t(e.length*1,1)>>>0;return B().set(e,n/1),q=e.length,n}function H(e,t,n){if(n===void 0){let n=K.encode(e),r=t(n.length,1)>>>0;return B().subarray(r,r+n.length).set(n),q=n.length,r}let r=e.length,i=t(r,1)>>>0,a=B(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=B().subarray(i+o,i+r),a=K.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return q=o,i}function U(e){let t=J.__wbindgen_externrefs.get(e);return J.__externref_table_dealloc(e),t}let W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});W.decode();let G=0;function Ne(e,t){return G+=t,G>=2146435072&&(W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),W.decode(),G=t),W.decode(B().subarray(e,e+t))}const K=new TextEncoder;`encodeInto`in K||(K.encodeInto=function(e,t){let n=K.encode(e);return t.set(n),{read:e.length,written:n.length}});let q=0,J;function Pe(e,t){return J=e.exports,I=null,z=null,J.__wbindgen_start(),J}async function Fe(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function Y(e){if(J!==void 0)return J;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=je();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Fe(await e,t);return Pe(n,r)}async function Ie(e){return J=void 0,I=null,z=null,Y(e)}function Le(e){let t=e(e=>e.document_cursor_resource_usage?.());return t?y(t):void 0}const Re=67108864;var ze=class{archive;coordinator=new j;host=null;identity=null;executeArchive;constructor(e,t=e=>e(this.requireArchive())){this.archive=e,this.executeArchive=e=>Ae(()=>t(e))}open(e){if(this.host)throw Error(`a DOCX document pull session is already active`);this.executeArchive(t=>{t.open_document_cursor(e.operationId,e.generation)});let t=0;this.identity=e,this.host=new Oe({...e,maxByteCredit:Re,coordinator:this.coordinator,driver:{pull:n=>{let r;try{r=this.executeArchive(r=>r.pull_document_chunk(t,e.operationId,e.generation,n))}catch(e){throw ie(e,n,Re)||e}let i=Te(r);return{payload:i,byteLength:i.byteLength,done:this.executeArchive(e=>e.document_chunk_done()),transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:n=>{if(n!==t)throw Error(`DOCX document acknowledgement sequence mismatch`);this.executeArchive(n=>n.acknowledge_document_chunk(t,e.operationId,e.generation)),t+=1},cancel:()=>this.executeArchive(e=>e.cancel_document_cursor()),close:()=>this.executeArchive(e=>e.close_document_session()),resourceUsage:()=>Le(this.executeArchive)}})}dispatch(e,t){return!this.host||!this.identity?(t({protocol:k,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:D(Error(`DOCX document pull session is not open`))}),Promise.resolve()):this.host.dispatch(e,t)}async reset(){if(this.host)try{this.archive()&&this.executeArchive(e=>e.close_document_session())}finally{this.host=null,this.identity=null,this.coordinator=new j}}requireArchive(){let e=this.archive();if(!e)throw Error(`No docx loaded`);return e}};function Be(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const X=new Ce(Y,{freeArchive:e=>e.free(),reinit:Ie}),Z=new ze(()=>X.archive,e=>X.run(()=>{let t=X.archive;if(!t)throw Error(`No docx loaded`);return e(t)}));let Q=0;const $=(e,t)=>self.postMessage(e,t);self.onmessage=async e=>{let n=e.data;if(Be(n)){try{await Z.dispatch(n,$)}catch(e){$({protocol:k,kind:`error`,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation,requestId:n.requestId,error:D(M(e))})}return}if(n.type===`init`){X.setWasmInput(t(n.wasmUrl)??n.wasmUrl);return}let r=n.id;try{if(await X.ensureReady(),n.type!==`parse`&&X.archive){let e=X.archive;X.run(()=>e.assert_healthy())}if(n.type===`parse`){await Z.reset();let[e,t,i]=Ee(n.resourcePolicy),a=new Uint8Array(n.data);X.run(()=>{let n=new N(a,e,t,i);X.setArchive(n)}),Q+=1;let o={sessionId:Q,operationId:Q,generation:Q};Z.open(o),$({type:`documentSessionOpened`,id:r,...o});return}let e=X.archive;if(n.type===`extractImage`){if(!e)throw Error(`No docx loaded`);let t=X.run(()=>e.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.type===`resourceUsage`){if(!e)throw Error(`No docx loaded`);$({type:`resourceUsage`,id:r,usage:y(X.run(()=>e.resource_usage()))});return}if(n.type===`toMarkdown`){if(!e)throw Error(`No docx loaded`);$({type:`markdownRendered`,id:r,markdown:X.run(()=>e.to_markdown())});return}}catch(e){$({type:`error`,id:r,...D(M(e))})}};", pn = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", fn], { type: "text/javascript;charset=utf-8" });
350
+ function mn(e) {
351
351
  let t;
352
352
  try {
353
- if (t = dn && (self.URL || self.webkitURL).createObjectURL(dn), !t) throw "";
353
+ if (t = pn && (self.URL || self.webkitURL).createObjectURL(pn), !t) throw "";
354
354
  let n = new Worker(t, {
355
355
  type: "module",
356
356
  name: e?.name
@@ -359,22 +359,22 @@ function fn(e) {
359
359
  (self.URL || self.webkitURL).revokeObjectURL(t);
360
360
  }), n;
361
361
  } catch {
362
- return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(un), {
362
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(fn), {
363
363
  type: "module",
364
364
  name: e?.name
365
365
  });
366
366
  }
367
367
  }
368
- var pn = new URL("docx_parser_bg.wasm", import.meta.url).href;
369
- function mn(e) {
368
+ var hn = new URL("docx_parser_bg.wasm", import.meta.url).href;
369
+ function gn(e) {
370
370
  return e === "nativeRouteSentinels" ? "[ooxml] mode: 'worker' fell back to main-thread rendering because the worker cannot register the font probes that size absent-font lines." : "[ooxml] mode: 'worker' fell back to main-thread rendering because this document requires DOM OpenType vertical glyph selection.";
371
371
  }
372
- function hn(e) {
372
+ function _n(e) {
373
373
  let t = /* @__PURE__ */ new Map();
374
374
  for (let n of e.pages) for (let e of n.bookmarkStarts) e.name !== "" && !t.has(e.name) && t.set(e.name, n.pageIndex);
375
375
  return t;
376
376
  }
377
- var gn = new Uint32Array([
377
+ var vn = new Uint32Array([
378
378
  1116352408,
379
379
  1899447441,
380
380
  3049323471,
@@ -440,7 +440,7 @@ var gn = new Uint32Array([
440
440
  3204031479,
441
441
  3329325298
442
442
  ]);
443
- function _n(e) {
443
+ function yn(e) {
444
444
  let t = new Uint32Array([
445
445
  1779033703,
446
446
  3144134277,
@@ -462,7 +462,7 @@ function _n(e) {
462
462
  }
463
463
  let [r, i, s, c, l, u, d, f] = t;
464
464
  for (let e = 0; e < 64; e++) {
465
- let t = o(l, 6) ^ o(l, 11) ^ o(l, 25), a = l & u ^ ~l & d, p = f + t + a + gn[e] + n[e] >>> 0, m = (o(r, 2) ^ o(r, 13) ^ o(r, 22)) + (r & i ^ r & s ^ i & s) >>> 0;
465
+ let t = o(l, 6) ^ o(l, 11) ^ o(l, 25), a = l & u ^ ~l & d, p = f + t + a + vn[e] + n[e] >>> 0, m = (o(r, 2) ^ o(r, 13) ^ o(r, 22)) + (r & i ^ r & s ^ i & s) >>> 0;
466
466
  f = d, d = u, u = l, l = c + p >>> 0, c = s, s = i, i = r, r = p + m >>> 0;
467
467
  }
468
468
  t[0] = t[0] + r >>> 0, t[1] = t[1] + i >>> 0, t[2] = t[2] + s >>> 0, t[3] = t[3] + c >>> 0, t[4] = t[4] + l >>> 0, t[5] = t[5] + u >>> 0, t[6] = t[6] + d >>> 0, t[7] = t[7] + f >>> 0;
@@ -470,60 +470,60 @@ function _n(e) {
470
470
  let s = new Uint8Array(32), c = new DataView(s.buffer);
471
471
  return t.forEach((e, t) => c.setUint32(t * 4, e)), s;
472
472
  }
473
- var vn = _, yn = 64, R = 2;
474
- async function bn(e, t) {
473
+ var bn = re, xn = 64, L = 2;
474
+ async function Sn(e, t) {
475
475
  let n;
476
476
  try {
477
- n = globalThis.crypto?.subtle ? new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", e.slice().buffer)) : _n(e);
477
+ n = globalThis.crypto?.subtle ? new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", e.slice().buffer)) : yn(e);
478
478
  } catch {
479
- n = _n(e);
479
+ n = yn(e);
480
480
  }
481
481
  let r = Array.from(n, (e) => e.toString(16).padStart(2, "0")).join(""), i = 2166136261;
482
482
  for (let e of t.trim().toLowerCase()) i ^= e.codePointAt(0), i = Math.imul(i, 16777619);
483
483
  return `__ooxml_docx_embedded_${r}_${(i >>> 0).toString(16)}`;
484
484
  }
485
- async function xn(e, t) {
485
+ async function Cn(e, t) {
486
486
  let n = e.embeddedFonts;
487
487
  if (!n || n.length === 0) return {
488
488
  faces: [],
489
489
  metrics: {},
490
490
  routes: []
491
491
  };
492
- let r = [], a = /* @__PURE__ */ new Set();
492
+ let r = [], i = /* @__PURE__ */ new Set();
493
493
  for (let e of n) {
494
- let t = Sn(e.style) === "bold" ? 700 : 400, n = Cn(e.style), i = `${j(e.fontName)}:${t}:${n}`;
495
- a.has(i) || (a.add(i), r.push(e));
494
+ let t = wn(e.style) === "bold" ? 700 : 400, n = Tn(e.style), a = `${A(e.fontName)}:${t}:${n}`;
495
+ i.has(a) || (i.add(a), r.push(e));
496
496
  }
497
- let o = [], s = 0, c = Math.min(r.length, yn), u = r.length - c;
498
- for (let e = 0; e < c; e += R) {
499
- let n = r.slice(e, Math.min(e + R, c)), a = await Promise.all(n.map(async (e) => {
497
+ let o = [], s = 0, c = Math.min(r.length, xn), l = r.length - c;
498
+ for (let e = 0; e < c; e += L) {
499
+ let n = r.slice(e, Math.min(e + L, c)), i = await Promise.all(n.map(async (e) => {
500
500
  try {
501
501
  return await t(e.partPath);
502
502
  } catch (e) {
503
- if (e instanceof i || ot(e)) throw e;
504
- let t = l(e);
503
+ if (e instanceof a || ct(e)) throw e;
504
+ let t = d(e);
505
505
  if (t) throw t;
506
506
  return null;
507
507
  }
508
508
  }));
509
509
  for (let e = 0; e < n.length; e++) {
510
- let t = n[e], r = a[e];
510
+ let t = n[e], r = i[e];
511
511
  if (r) {
512
- if (!re(r) || r.byteLength > vn - s) {
513
- u++;
512
+ if (!ae(r) || r.byteLength > bn - s) {
513
+ l++;
514
514
  continue;
515
515
  }
516
516
  try {
517
- let e = t.partPath.toLowerCase().endsWith(".odttf") ? he(r, t.fontKey ?? "") : r, n = await bn(e, t.fontName), i = {
517
+ let e = t.partPath.toLowerCase().endsWith(".odttf") ? _e(r, t.fontKey ?? "") : r, n = await Sn(e, t.fontName), i = {
518
518
  family: n,
519
519
  bytes: e,
520
520
  odttf: !1,
521
521
  fontKey: "",
522
- weight: Sn(t.style),
523
- style: Cn(t.style)
522
+ weight: wn(t.style),
523
+ style: Tn(t.style)
524
524
  }, a = null;
525
525
  try {
526
- let r = Qt(e), o = r?.farEastCodePage == null ? null : ke({
526
+ let r = en(e), o = r?.farEastCodePage == null ? null : je({
527
527
  ...r,
528
528
  farEastCodePage: r.farEastCodePage
529
529
  });
@@ -561,51 +561,51 @@ async function xn(e, t) {
561
561
  }
562
562
  }
563
563
  }
564
- let d = Object.freeze(u > 0 ? [Object.freeze({
564
+ let u = Object.freeze(l > 0 ? [Object.freeze({
565
565
  code: "MISSING_RESOURCE",
566
566
  severity: "warning",
567
- message: `Skipped ${u} embedded font face(s) under the document font resource limits; fallback fonts are used`
567
+ message: `Skipped ${l} embedded font face(s) under the document font resource limits; fallback fonts are used`
568
568
  })] : []), f = o;
569
569
  if (f.length === 0) return {
570
570
  faces: [],
571
571
  metrics: {},
572
572
  routes: [],
573
- diagnostics: d
573
+ diagnostics: u
574
574
  };
575
575
  let p = [], m = /* @__PURE__ */ new Set();
576
576
  try {
577
- for (let e = 0; e < f.length; e += R) {
578
- let t = f.slice(e, e + R);
579
- for (let e of await ie(t.map((e) => e.face))) m.has(e) ? E([e]) : (m.add(e), p.push(e));
577
+ for (let e = 0; e < f.length; e += L) {
578
+ let t = f.slice(e, e + L);
579
+ for (let e of await oe(t.map((e) => e.face))) m.has(e) ? T([e]) : (m.add(e), p.push(e));
580
580
  }
581
581
  } catch (e) {
582
- throw E(p), e;
582
+ throw T(p), e;
583
583
  }
584
584
  let h = new Set(p.map((e) => {
585
585
  let t = e.family.trim().replace(/^(['"])(.*)\1$/, "$2"), n = e.weight === "bold" ? 700 : Number(e.weight) || 400, r = e.style === "italic" ? "italic" : "normal";
586
- return `${j(t)}:${n}:${r}`;
587
- })), g = {}, _ = [];
586
+ return `${A(t)}:${n}:${r}`;
587
+ })), g = Object.create(null), _ = [];
588
588
  for (let e of f) {
589
- let t = j(e.face.family), n = e.face.weight === "bold" ? 700 : 400, r = e.face.style, i = `${t}:${n}:${r}`;
589
+ let t = A(e.face.family), n = e.face.weight === "bold" ? 700 : 400, r = e.face.style, i = `${t}:${n}:${r}`;
590
590
  if (!h.has(i) || (_.push(Object.freeze(e.route)), !e.metric)) continue;
591
- let a = j(e.route.requestedFamily);
591
+ let a = A(e.route.requestedFamily);
592
592
  g[n === 400 && r === "normal" ? a : `${a}:${n}:${r}`] = e.metric;
593
593
  }
594
594
  return {
595
595
  faces: p,
596
596
  metrics: Object.freeze(g),
597
597
  routes: Object.freeze(_),
598
- diagnostics: d
598
+ diagnostics: u
599
599
  };
600
600
  }
601
- function Sn(e) {
601
+ function wn(e) {
602
602
  return e === "bold" || e === "boldItalic" ? "bold" : "normal";
603
603
  }
604
- function Cn(e) {
604
+ function Tn(e) {
605
605
  return e === "italic" || e === "boldItalic" ? "italic" : "normal";
606
606
  }
607
- var wn = gt, Tn = 16384;
608
- function En(e, t) {
607
+ var En = vt, Dn = 16384;
608
+ function On(e, t) {
609
609
  let n = [], r = 0, i = !1;
610
610
  for (let a of e) {
611
611
  if (a.length === 0) continue;
@@ -616,7 +616,7 @@ function En(e, t) {
616
616
  }
617
617
  n.push("\n"), r++;
618
618
  }
619
- let e = St(a, Math.max(0, t - r));
619
+ let e = wt(a, Math.max(0, t - r));
620
620
  if (n.push(e), r += e.length, e.length < a.length) {
621
621
  i = !0;
622
622
  break;
@@ -628,7 +628,7 @@ function En(e, t) {
628
628
  truncated: i
629
629
  };
630
630
  }
631
- function* z(e) {
631
+ function* R(e) {
632
632
  if (e.kind === "paragraph") {
633
633
  for (let t of e.lines) {
634
634
  let e = t.placements.flatMap((e) => e.kind === "text" && !e.optionalHyphenGlyph ? [e.text] : []).join("");
@@ -637,46 +637,46 @@ function* z(e) {
637
637
  return;
638
638
  }
639
639
  if (e.kind === "table") {
640
- for (let t of e.rows) for (let e of t.cells) for (let t of e.blocks) yield* z(t.layout);
640
+ for (let t of e.rows) for (let e of t.cells) for (let t of e.blocks) yield* R(t.layout);
641
641
  return;
642
642
  }
643
643
  if (e.kind === "note") {
644
- e.leading?.paragraph && (yield* z(e.leading.paragraph));
645
- for (let t of e.story.blocks) yield* z(t);
646
- e.trailing?.paragraph && (yield* z(e.trailing.paragraph));
647
- } else if (e.kind === "textbox") for (let t of e.story.blocks) yield* z(t);
644
+ e.leading?.paragraph && (yield* R(e.leading.paragraph));
645
+ for (let t of e.story.blocks) yield* R(t);
646
+ e.trailing?.paragraph && (yield* R(e.trailing.paragraph));
647
+ } else if (e.kind === "textbox") for (let t of e.story.blocks) yield* R(t);
648
648
  }
649
- function* Dn(e) {
649
+ function* kn(e) {
650
650
  for (let t of e.drawing.commands) (t.kind === "text" || t.kind === "watermark-text") && (yield t.text);
651
- for (let t of e.textBoxes) yield* z(t);
651
+ for (let t of e.textBoxes) yield* R(t);
652
652
  }
653
- function On(e) {
654
- let t = e ?? Tn;
653
+ function An(e) {
654
+ let t = e ?? Dn;
655
655
  if (!Number.isFinite(t) || t < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
656
- return Math.min(wn, Math.floor(t));
656
+ return Math.min(En, Math.floor(t));
657
657
  }
658
- function kn(e) {
658
+ function jn(e) {
659
659
  return {
660
660
  story: e.story,
661
661
  storyInstance: e.storyInstance,
662
662
  path: [...e.path]
663
663
  };
664
664
  }
665
- function An(e) {
665
+ function Mn(e) {
666
666
  return "drawing" in e ? e.drawing.inkBounds : e.placement.bounds;
667
667
  }
668
- function jn(e) {
669
- let t = An(e), n = [
670
- O(e.pointToPage, t),
671
- O(e.pointToPage, {
668
+ function Nn(e) {
669
+ let t = Mn(e), n = [
670
+ D(e.pointToPage, t),
671
+ D(e.pointToPage, {
672
672
  xPt: t.xPt + t.widthPt,
673
673
  yPt: t.yPt
674
674
  }),
675
- O(e.pointToPage, {
675
+ D(e.pointToPage, {
676
676
  xPt: t.xPt,
677
677
  yPt: t.yPt + t.heightPt
678
678
  }),
679
- O(e.pointToPage, {
679
+ D(e.pointToPage, {
680
680
  xPt: t.xPt + t.widthPt,
681
681
  yPt: t.yPt + t.heightPt
682
682
  })
@@ -688,10 +688,10 @@ function jn(e) {
688
688
  heightPt: o - i
689
689
  };
690
690
  }
691
- function B(e, t) {
691
+ function z(e, t) {
692
692
  return t.xPt >= e.xPt && t.xPt <= e.xPt + e.widthPt && t.yPt >= e.yPt && t.yPt <= e.yPt + e.heightPt;
693
693
  }
694
- function Mn(e, t) {
694
+ function Pn(e, t) {
695
695
  let n = !1;
696
696
  for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
697
697
  let a = t[r], o = t[i];
@@ -699,35 +699,35 @@ function Mn(e, t) {
699
699
  }
700
700
  return n;
701
701
  }
702
- function Nn(e, t) {
703
- return B(e.inkBounds, t) ? e.clip ? e.clip.kind === "rect" ? B(e.clip.rect, t) : Mn(t, e.clip.points) : !0 : !1;
702
+ function Fn(e, t) {
703
+ return z(e.inkBounds, t) ? e.clip ? e.clip.kind === "rect" ? z(e.clip.rect, t) : Pn(t, e.clip.points) : !0 : !1;
704
704
  }
705
- function Pn(e, t, n) {
705
+ function In(e, t, n) {
706
706
  for (let n of e.clips) {
707
- let e = Me(n.pointToPage, t);
708
- if (!e || !B(n.bounds, e)) return !1;
707
+ let e = Pe(n.pointToPage, t);
708
+ if (!e || !z(n.bounds, e)) return !1;
709
709
  }
710
- return "drawing" in e ? Nn(e.drawing, n) : B(e.placement.bounds, n);
710
+ return "drawing" in e ? Fn(e.drawing, n) : z(e.placement.bounds, n);
711
711
  }
712
- function V(e, t) {
712
+ function B(e, t) {
713
713
  return e.commands.find((e) => e.kind === "resource" && e.resourceKind === t);
714
714
  }
715
- function Fn(e) {
716
- return V(e, "chart") ? "chart" : e.commands.some((e) => e.kind === "drawingml-shape" || e.kind === "drawingml-image-fill" || e.kind === "fill-rect" || e.kind === "stroke-rect" || e.kind === "text" || e.kind === "watermark-text") ? "shape" : V(e, "image") ? "image" : null;
715
+ function Ln(e) {
716
+ return B(e, "chart") ? "chart" : e.commands.some((e) => e.kind === "drawingml-shape" || e.kind === "drawingml-image-fill" || e.kind === "fill-rect" || e.kind === "stroke-rect" || e.kind === "text" || e.kind === "watermark-text") ? "shape" : B(e, "image") ? "image" : null;
717
717
  }
718
- function In(e, t, n, r, i, a) {
719
- let o = "drawing" in e ? Fn(e.drawing) : e.placement.resourceKind;
718
+ function Rn(e, t, n, r, i, a) {
719
+ let o = "drawing" in e ? Ln(e.drawing) : e.placement.resourceKind;
720
720
  if (!o) return null;
721
721
  let s, c = !1, l, u;
722
722
  if (o === "chart") {
723
- let t = "drawing" in e ? V(e.drawing, "chart").resourceKey : e.placement.resourceKey, n = i.resolve(t, "chart"), r = _t(n.model, a);
723
+ let t = "drawing" in e ? B(e.drawing, "chart").resourceKey : e.placement.resourceKey, n = i.resolve(t, "chart"), r = yt(n.model, a);
724
724
  s = r.text, c = r.truncated, u = n.model.series.length;
725
725
  } else if (o === "image") {
726
- let t = "drawing" in e ? V(e.drawing, "image").resourceKey : e.placement.resourceKey, n = i.descriptors.find((e) => e.resourceKey === t && e.kind === "image" && "mimeType" in e);
726
+ let t = "drawing" in e ? B(e.drawing, "image").resourceKey : e.placement.resourceKey, n = i.descriptors.find((e) => e.resourceKey === t && e.kind === "image" && "mimeType" in e);
727
727
  if (!n) throw Error(`Unknown image paint resource: ${t}`);
728
728
  l = n.mimeType;
729
729
  } else {
730
- let t = En(Dn(e), a);
730
+ let t = On(kn(e), a);
731
731
  s = t.text, c = t.truncated;
732
732
  }
733
733
  return {
@@ -737,8 +737,8 @@ function In(e, t, n, r, i, a) {
737
737
  elementIndex: n,
738
738
  elementType: o,
739
739
  point: { ...r },
740
- bounds: jn(e),
741
- source: kn("drawing" in e ? e.drawing.source : e.source),
740
+ bounds: Nn(e),
741
+ source: jn("drawing" in e ? e.drawing.source : e.source),
742
742
  ...s === void 0 ? {} : { text: s },
743
743
  ...l === void 0 ? {} : { mimeType: l },
744
744
  ...u === void 0 ? {} : { seriesCount: u },
@@ -748,26 +748,26 @@ function In(e, t, n, r, i, a) {
748
748
  maxTextCharacters: a
749
749
  };
750
750
  }
751
- function Ln(e, t, n, r, i = {}) {
751
+ function zn(e, t, n, r, i = {}) {
752
752
  if (!Number.isFinite(n.xPt) || !Number.isFinite(n.yPt)) throw RangeError("DOCX hit-test point must contain finite page coordinates.");
753
- let a = On(i.maxTextCharacters), o = rt(e, t);
753
+ let a = An(i.maxTextCharacters), o = at(e, t);
754
754
  for (let e = o.length - 1; e >= 0; e--) {
755
- let i = o[e], s = Me(i.pointToPage, n);
756
- if (!s || !Pn(i, n, s)) continue;
757
- let c = In(i, t, e, n, r, a);
755
+ let i = o[e], s = Pe(i.pointToPage, n);
756
+ if (!s || !In(i, n, s)) continue;
757
+ let c = Rn(i, t, e, n, r, a);
758
758
  if (c) return c;
759
759
  }
760
760
  return null;
761
761
  }
762
- function Rn(e, t, n, r) {
763
- return Ln(Ie(e, {
762
+ function Bn(e, t, n, r) {
763
+ return zn(Re(e, {
764
764
  currentDate: r.currentDate,
765
765
  defaultCurrentDateMs: r.defaultCurrentDateMs,
766
766
  showTrackedChanges: r.showTrackedChanges
767
- }, t).layout, t, n, Ne(e), r);
767
+ }, t).layout, t, n, Fe(e), r);
768
768
  }
769
- function zn(e, t) {
770
- let n = On(t), r = e.text === void 0 ? void 0 : St(e.text, n), i = e.truncated || e.text !== void 0 && r.length < e.text.length;
769
+ function Vn(e, t) {
770
+ let n = An(t), r = e.text === void 0 ? void 0 : wt(e.text, n), i = e.truncated || e.text !== void 0 && r.length < e.text.length;
771
771
  return {
772
772
  ...structuredClone(e),
773
773
  ...r === void 0 ? {} : { text: r },
@@ -777,7 +777,7 @@ function zn(e, t) {
777
777
  maxTextCharacters: n
778
778
  };
779
779
  }
780
- function Bn(e) {
780
+ function Hn(e) {
781
781
  if (e === void 0) return;
782
782
  let t = e.replace(/^[\t\n\r ]+|[\t\n\r ]+$/g, "");
783
783
  if (/^[+-]?\d+$/.test(t)) try {
@@ -786,41 +786,41 @@ function Bn(e) {
786
786
  return;
787
787
  }
788
788
  }
789
- function Vn(e) {
789
+ function Un(e) {
790
790
  return Object.freeze({
791
791
  ...e,
792
792
  path: Object.freeze([...e.path])
793
793
  });
794
794
  }
795
- function Hn(e) {
795
+ function Wn(e) {
796
796
  return Object.freeze({
797
- source: Vn(e.source),
797
+ source: Un(e.source),
798
798
  runIndex: e.boundary,
799
799
  affinity: e.boundary < e.runCount ? "following" : "preceding"
800
800
  });
801
801
  }
802
- function H(e, t) {
802
+ function V(e, t) {
803
803
  let n = e.runs, r = 0;
804
804
  for (let e = 0; e < Math.min(t, n.length); e += 1) n[e]?.type !== "unavailableDrawing" && (r += 1);
805
805
  return r;
806
806
  }
807
- function Un(e, t, n, r, i = t.boundary) {
807
+ function Gn(e, t, n, r, i = t.boundary) {
808
808
  return Object.freeze({
809
809
  commentId: e,
810
- source: Vn(t.source),
810
+ source: Un(t.source),
811
811
  startRunIndex: t.boundary,
812
812
  endRunIndex: i,
813
- reference: Hn(n),
813
+ reference: Wn(n),
814
814
  ...r === void 0 ? {} : { geometryFallback: Object.freeze({
815
- source: Vn(r.source),
815
+ source: Un(r.source),
816
816
  sourceRunIndex: r.boundary
817
817
  }) }
818
818
  });
819
819
  }
820
- function Wn(e, t) {
820
+ function Kn(e, t) {
821
821
  let n = e.flatMap(({ paragraph: e, source: n }, r) => {
822
- let i = H(e, e.runs.length);
823
- return [...t.get(k(n)) ?? []].sort((e, t) => e - t).map((e) => ({
822
+ let i = V(e, e.runs.length);
823
+ return [...t.get(O(n)) ?? []].sort((e, t) => e - t).map((e) => ({
824
824
  paragraphIndex: r,
825
825
  source: n,
826
826
  boundary: e,
@@ -832,31 +832,31 @@ function Wn(e, t) {
832
832
  paragraphIndices: new Set(n.map(({ paragraphIndex: e }) => e))
833
833
  };
834
834
  }
835
- function Gn(e, t) {
835
+ function qn(e, t) {
836
836
  return e.paragraphIndex - t.paragraphIndex || e.boundary - t.boundary;
837
837
  }
838
- function Kn(e, t) {
838
+ function Jn(e, t) {
839
839
  let n = 0, r = e.length;
840
840
  for (; n < r;) {
841
841
  let i = n + Math.floor((r - n) / 2);
842
- Gn(e[i], t) < 0 ? n = i + 1 : r = i;
842
+ qn(e[i], t) < 0 ? n = i + 1 : r = i;
843
843
  }
844
844
  return n;
845
845
  }
846
- function qn(e, t) {
846
+ function Yn(e, t) {
847
847
  if (t.paragraphIndices.has(e.paragraphIndex)) return;
848
- let n = Kn(t.locations, e), r = t.locations[n], i = n > 0 ? t.locations[n - 1] : void 0;
849
- return Hn(e).affinity === "following" ? r ?? i : i ?? r;
848
+ let n = Jn(t.locations, e), r = t.locations[n], i = n > 0 ? t.locations[n - 1] : void 0;
849
+ return Wn(e).affinity === "following" ? r ?? i : i ?? r;
850
850
  }
851
- function Jn(e, t, n) {
851
+ function Xn(e, t, n) {
852
852
  let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
853
853
  for (let e of t) {
854
- let t = Bn(e);
854
+ let t = Hn(e);
855
855
  t === void 0 || i.has(t) || (r.has(t) ? (r.delete(t), i.add(t)) : r.set(t, e));
856
856
  }
857
857
  let a = /* @__PURE__ */ new Map();
858
858
  for (let [t, { paragraph: n, source: r }] of e.entries()) for (let e of n.commentMarks ?? []) {
859
- let i = Bn(e.id);
859
+ let i = Hn(e.id);
860
860
  if (i === void 0) continue;
861
861
  let o = a.get(i) ?? {
862
862
  starts: [],
@@ -867,12 +867,12 @@ function Jn(e, t, n) {
867
867
  let s = {
868
868
  paragraphIndex: t,
869
869
  source: r,
870
- boundary: H(n, e.runIndex),
871
- runCount: H(n, n.runs.length)
870
+ boundary: V(n, e.runIndex),
871
+ runCount: V(n, n.runs.length)
872
872
  };
873
873
  e.kind === "rangeStart" ? o.starts.push(s) : e.kind === "rangeEnd" ? o.ends.push(s) : e.kind === "reference" && o.references.push(s);
874
874
  }
875
- let o = [], s = Wn(e, n);
875
+ let o = [], s = Kn(e, n);
876
876
  for (let [t, n] of a) {
877
877
  let i = r.get(t);
878
878
  if (i === void 0 || n.references.length !== 1) continue;
@@ -880,26 +880,26 @@ function Jn(e, t, n) {
880
880
  if (n.starts.length > 1 || n.ends.length > 1) continue;
881
881
  let c = n.starts.length === 1 ? n.starts[0] : void 0, l = n.ends.length === 1 ? n.ends[0] : void 0;
882
882
  if (c && l && (c.paragraphIndex < l.paragraphIndex || c.paragraphIndex === l.paragraphIndex && c.boundary <= l.boundary)) {
883
- let t = qn(c.paragraphIndex === l.paragraphIndex && c.boundary === l.boundary ? c : a, s);
883
+ let t = Yn(c.paragraphIndex === l.paragraphIndex && c.boundary === l.boundary ? c : a, s);
884
884
  for (let n = c.paragraphIndex; n <= l.paragraphIndex; n += 1) {
885
- let r = e[n], s = n === c.paragraphIndex ? c.boundary : 0, u = n === l.paragraphIndex ? l.boundary : H(r.paragraph, r.paragraph.runs.length);
886
- o.push(Un(i, {
885
+ let r = e[n], s = n === c.paragraphIndex ? c.boundary : 0, u = n === l.paragraphIndex ? l.boundary : V(r.paragraph, r.paragraph.runs.length);
886
+ o.push(Gn(i, {
887
887
  paragraphIndex: n,
888
888
  source: r.source,
889
889
  boundary: s,
890
- runCount: H(r.paragraph, r.paragraph.runs.length)
890
+ runCount: V(r.paragraph, r.paragraph.runs.length)
891
891
  }, a, t, Math.max(s, u)));
892
892
  }
893
893
  continue;
894
894
  }
895
895
  let u = c && n.ends.length === 0 ? c : l && n.starts.length === 0 ? l : void 0;
896
896
  if (c && l) continue;
897
- let d = u ?? a, f = qn(d, s);
898
- o.push(Un(i, d, a, f));
897
+ let d = u ?? a, f = Yn(d, s);
898
+ o.push(Gn(i, d, a, f));
899
899
  }
900
900
  return o;
901
901
  }
902
- function Yn(e, t, n = /* @__PURE__ */ new Map()) {
902
+ function Zn(e, t, n = /* @__PURE__ */ new Map()) {
903
903
  let r = new Set(e.map(({ id: e }) => e)), i = /* @__PURE__ */ new Map();
904
904
  for (let e of t.blocks.sources) {
905
905
  let n = t.blocks.resolve(e);
@@ -910,21 +910,21 @@ function Yn(e, t, n = /* @__PURE__ */ new Map()) {
910
910
  source: e
911
911
  });
912
912
  }
913
- return [...i.values()].flatMap((e) => Jn(e, r, n));
913
+ return [...i.values()].flatMap((e) => Xn(e, r, n));
914
914
  }
915
- function Xn(e, t, n = /* @__PURE__ */ new Map(), r = {}) {
915
+ function Qn(e, t, n = /* @__PURE__ */ new Map(), r = {}) {
916
916
  if ((e?.length ?? 0) === 0) return [];
917
- let i = Yn(e ?? [], t, n), a = r.completedSourceKeys;
917
+ let i = Zn(e ?? [], t, n), a = r.completedSourceKeys;
918
918
  return a === void 0 ? i : i.filter((e) => {
919
- let t = n.get(k(e.source)) ?? /* @__PURE__ */ new Set(), r = e.startRunIndex < e.endRunIndex ? [...t].some((t) => t >= e.startRunIndex && t < e.endRunIndex) : t.has(e.reference.affinity === "following" ? e.startRunIndex : e.startRunIndex - 1), i = n.get(k(e.reference.source))?.has(e.reference.affinity === "following" ? e.reference.runIndex : e.reference.runIndex - 1) === !0;
920
- return r || i || a.has(k(e.source)) || a.has(k(e.reference.source));
919
+ let t = n.get(O(e.source)) ?? /* @__PURE__ */ new Set(), r = e.startRunIndex < e.endRunIndex ? [...t].some((t) => t >= e.startRunIndex && t < e.endRunIndex) : t.has(e.reference.affinity === "following" ? e.startRunIndex : e.startRunIndex - 1), i = n.get(O(e.reference.source))?.has(e.reference.affinity === "following" ? e.reference.runIndex : e.reference.runIndex - 1) === !0;
920
+ return r || i || a.has(O(e.source)) || a.has(O(e.reference.source));
921
921
  });
922
922
  }
923
- function U(e, t) {
923
+ function H(e, t) {
924
924
  return e !== void 0 && e.story === t.story && e.storyInstance === t.storyInstance && e.path.length === t.path.length && e.path.every((e, n) => e === t.path[n]);
925
925
  }
926
- function W(e, t) {
927
- let n = t.filter((t) => t.sourceRunIndex !== void 0 && U(t.source, e.source)), r = n.filter((t) => t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
926
+ function U(e, t) {
927
+ let n = t.filter((t) => t.sourceRunIndex !== void 0 && H(t.source, e.source)), r = n.filter((t) => t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
928
928
  if (r.length > 0) return r;
929
929
  if (e.startRunIndex === e.endRunIndex && n.length > 0) {
930
930
  let t = n.reduce((t, n) => {
@@ -936,7 +936,7 @@ function W(e, t) {
936
936
  }, void 0), i = t ?? r;
937
937
  if (i !== void 0) return n.filter((e) => e.sourceRunIndex === i);
938
938
  }
939
- let i = t.filter((t) => t.sourceRunIndex !== void 0 && U(t.source, e.reference.source)), a = i.reduce((t, n) => {
939
+ let i = t.filter((t) => t.sourceRunIndex !== void 0 && H(t.source, e.reference.source)), a = i.reduce((t, n) => {
940
940
  let r = n.sourceRunIndex;
941
941
  return r < e.reference.runIndex ? t : t === void 0 || r < t ? r : t;
942
942
  }, void 0), o = i.reduce((t, n) => {
@@ -945,12 +945,12 @@ function W(e, t) {
945
945
  }, void 0), s = e.reference.affinity === "following" ? a ?? o : o ?? a;
946
946
  if (s !== void 0) return i.filter((e) => e.sourceRunIndex === s);
947
947
  let c = e.geometryFallback;
948
- return c === void 0 ? [] : t.filter((e) => e.sourceRunIndex === c.sourceRunIndex && U(e.source, c.source));
948
+ return c === void 0 ? [] : t.filter((e) => e.sourceRunIndex === c.sourceRunIndex && H(e.source, c.source));
949
949
  }
950
- function Zn(e, t) {
951
- return t.some((t) => t.sourceRunIndex !== void 0 && U(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex) ? "range" : t.some((t) => U(t.source, e.source) || U(t.source, e.reference.source)) ? "point" : "fallback";
950
+ function $n(e, t) {
951
+ return t.some((t) => t.sourceRunIndex !== void 0 && H(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex) ? "range" : t.some((t) => H(t.source, e.source) || H(t.source, e.reference.source)) ? "point" : "fallback";
952
952
  }
953
- function Qn(e) {
953
+ function er(e) {
954
954
  let t = e.map((e) => {
955
955
  let t = e.highlightBounds;
956
956
  return {
@@ -974,7 +974,7 @@ function Qn(e) {
974
974
  }
975
975
  return Object.freeze(n);
976
976
  }
977
- function $n(e, t, n, r = {}) {
977
+ function tr(e, t, n, r = {}) {
978
978
  let i = new Map(e.map((e) => [e.id, e])), a = e.filter((e) => e.parentId === void 0), o = new Map(a.map((e) => [e.id, e])), s = /* @__PURE__ */ new Map(), c = new Map(a.map((e) => [e.id, e.id]));
979
979
  for (let t of e) {
980
980
  if (t.parentId === void 0) continue;
@@ -993,18 +993,18 @@ function $n(e, t, n, r = {}) {
993
993
  s.has(n.id) || s.set(n.id, r), r.push(t);
994
994
  }
995
995
  let l = /* @__PURE__ */ new Set();
996
- for (let e of n) e.source && l.add(k(e.source));
996
+ for (let e of n) e.source && l.add(O(e.source));
997
997
  let u = /* @__PURE__ */ new Map();
998
998
  for (let e of t) {
999
999
  let t = c.get(e.commentId);
1000
- if (t === void 0 || !(l.has(k(e.source)) || l.has(k(e.reference.source)) || e.geometryFallback !== void 0 && l.has(k(e.geometryFallback.source)))) continue;
1001
- let r = W(e, n);
1000
+ if (t === void 0 || !(l.has(O(e.source)) || l.has(O(e.reference.source)) || e.geometryFallback !== void 0 && l.has(O(e.geometryFallback.source)))) continue;
1001
+ let r = U(e, n);
1002
1002
  if (r.length === 0) continue;
1003
1003
  let i = u.get(t) ?? [];
1004
1004
  u.has(t) || u.set(t, i), i.push(Object.freeze({
1005
1005
  anchor: e,
1006
- kind: Zn(e, r),
1007
- rects: Qn(r)
1006
+ kind: $n(e, r),
1007
+ rects: er(r)
1008
1008
  }));
1009
1009
  }
1010
1010
  return Object.freeze(a.flatMap((e) => {
@@ -1017,20 +1017,20 @@ function $n(e, t, n, r = {}) {
1017
1017
  })] : [];
1018
1018
  }));
1019
1019
  }
1020
- function er(e) {
1021
- let t = Bn(e.id);
1020
+ function nr(e) {
1021
+ let t = Hn(e.id);
1022
1022
  return t === void 0 ? void 0 : `${e.kind}\u0000${t}`;
1023
1023
  }
1024
- function G(e) {
1024
+ function W(e) {
1025
1025
  return Object.freeze({
1026
1026
  ...e,
1027
1027
  path: Object.freeze([...e.path])
1028
1028
  });
1029
1029
  }
1030
- function tr(e, t) {
1030
+ function rr(e, t) {
1031
1031
  return e !== void 0 && e.story === t.story && e.storyInstance === t.storyInstance && e.path.length === t.path.length && e.path.every((e, n) => e === t.path[n]);
1032
1032
  }
1033
- function nr(e, t) {
1033
+ function ir(e, t) {
1034
1034
  let n = 0, r = e.length;
1035
1035
  for (; n < r;) {
1036
1036
  let i = n + Math.floor((r - n) / 2);
@@ -1038,22 +1038,22 @@ function nr(e, t) {
1038
1038
  }
1039
1039
  return n;
1040
1040
  }
1041
- function rr(e, t) {
1041
+ function ar(e, t) {
1042
1042
  let n = Array(e.length), r;
1043
1043
  for (let i = e.length - 1; i >= 0; --i) {
1044
1044
  n[i] = r;
1045
- let a = e[i], o = t.get(k(a.source))?.[0];
1045
+ let a = e[i], o = t.get(O(a.source))?.[0];
1046
1046
  o !== void 0 && (r = Object.freeze({
1047
- source: G(a.source),
1047
+ source: W(a.source),
1048
1048
  sourceRunIndex: o
1049
1049
  }));
1050
1050
  }
1051
1051
  let i = Array(e.length), a;
1052
1052
  for (let n = 0; n < e.length; n += 1) {
1053
1053
  i[n] = a;
1054
- let r = e[n], o = t.get(k(r.source))?.at(-1);
1054
+ let r = e[n], o = t.get(O(r.source))?.at(-1);
1055
1055
  o !== void 0 && (a = Object.freeze({
1056
- source: G(r.source),
1056
+ source: W(r.source),
1057
1057
  sourceRunIndex: o
1058
1058
  }));
1059
1059
  }
@@ -1062,17 +1062,17 @@ function rr(e, t) {
1062
1062
  preceding: i
1063
1063
  };
1064
1064
  }
1065
- function ir(e, t, n, r, i, a) {
1066
- let o = r[e], s = i.get(k(o.source)) ?? [], c = s[nr(s, n)], l = s[nr(s, t) - 1], u = c ?? l;
1065
+ function or(e, t, n, r, i, a) {
1066
+ let o = r[e], s = i.get(O(o.source)) ?? [], c = s[ir(s, n)], l = s[ir(s, t) - 1], u = c ?? l;
1067
1067
  return u === void 0 ? a.following[e] ?? a.preceding[e] : Object.freeze({
1068
- source: G(o.source),
1068
+ source: W(o.source),
1069
1069
  sourceRunIndex: u
1070
1070
  });
1071
1071
  }
1072
- function ar(e, t, n = /* @__PURE__ */ new Map()) {
1072
+ function sr(e, t, n = /* @__PURE__ */ new Map()) {
1073
1073
  let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
1074
1074
  e.forEach((e, t) => {
1075
- let n = er(e);
1075
+ let n = nr(e);
1076
1076
  n === void 0 || i.has(n) || (r.has(n) ? (r.delete(n), i.add(n)) : r.set(n, t));
1077
1077
  });
1078
1078
  let a = t.blocks.sources.flatMap((e) => {
@@ -1082,11 +1082,11 @@ function ar(e, t, n = /* @__PURE__ */ new Map()) {
1082
1082
  source: e,
1083
1083
  runs: n.runs
1084
1084
  }] : [];
1085
- }), o = new Map([...n].map(([e, t]) => [e, Object.freeze([...t].sort((e, t) => e - t))])), s = rr(a, o), c = [];
1085
+ }), o = new Map([...n].map(([e, t]) => [e, Object.freeze([...t].sort((e, t) => e - t))])), s = ar(a, o), c = [];
1086
1086
  for (let [e, t] of a.entries()) {
1087
1087
  let n = 0;
1088
1088
  for (; n < t.runs.length;) {
1089
- let i = t.runs[n], l = i.revision?.kind ? er({
1089
+ let i = t.runs[n], l = i.revision?.kind ? nr({
1090
1090
  kind: i.revision.kind,
1091
1091
  id: i.revision.id
1092
1092
  }) : void 0, u = l === void 0 ? void 0 : r.get(l);
@@ -1097,16 +1097,16 @@ function ar(e, t, n = /* @__PURE__ */ new Map()) {
1097
1097
  let d = n;
1098
1098
  for (n += 1; n < t.runs.length;) {
1099
1099
  let e = t.runs[n].revision;
1100
- if (!e?.kind || er({
1100
+ if (!e?.kind || nr({
1101
1101
  kind: e.kind,
1102
1102
  id: e.id
1103
1103
  }) !== l) break;
1104
1104
  n += 1;
1105
1105
  }
1106
- let f = n, p = o.get(k(t.source)) ?? [], m = (p[nr(p, d)] ?? f) < f ? void 0 : ir(e, d, f, a, o, s);
1106
+ let f = n, p = o.get(O(t.source)) ?? [], m = (p[ir(p, d)] ?? f) < f ? void 0 : or(e, d, f, a, o, s);
1107
1107
  c.push(Object.freeze({
1108
1108
  revisionIndex: u,
1109
- source: G(t.source),
1109
+ source: W(t.source),
1110
1110
  startRunIndex: d,
1111
1111
  endRunIndex: f,
1112
1112
  ...m === void 0 ? {} : { geometryFallback: m }
@@ -1115,24 +1115,24 @@ function ar(e, t, n = /* @__PURE__ */ new Map()) {
1115
1115
  }
1116
1116
  return c;
1117
1117
  }
1118
- function or(e, t, n = /* @__PURE__ */ new Map(), r = {}) {
1118
+ function cr(e, t, n = /* @__PURE__ */ new Map(), r = {}) {
1119
1119
  if ((e?.length ?? 0) === 0) return [];
1120
- let i = ar(e ?? [], t, n), a = r.completedSourceKeys;
1120
+ let i = sr(e ?? [], t, n), a = r.completedSourceKeys;
1121
1121
  return a === void 0 ? i : i.filter((e) => {
1122
- let t = n.get(k(e.source));
1123
- return t !== void 0 && [...t].some((t) => t >= e.startRunIndex && t < e.endRunIndex) || a.has(k(e.source));
1122
+ let t = n.get(O(e.source));
1123
+ return t !== void 0 && [...t].some((t) => t >= e.startRunIndex && t < e.endRunIndex) || a.has(O(e.source));
1124
1124
  });
1125
1125
  }
1126
- function sr(e, t) {
1127
- let n = t.filter((t) => t.sourceRunIndex !== void 0 && tr(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
1126
+ function lr(e, t) {
1127
+ let n = t.filter((t) => t.sourceRunIndex !== void 0 && rr(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
1128
1128
  if (n.length > 0) return n;
1129
1129
  let r = e.geometryFallback;
1130
- return r === void 0 ? [] : t.filter((e) => e.sourceRunIndex === r.sourceRunIndex && tr(e.source, r.source));
1130
+ return r === void 0 ? [] : t.filter((e) => e.sourceRunIndex === r.sourceRunIndex && rr(e.source, r.source));
1131
1131
  }
1132
- var cr = 12;
1133
- async function lr(e, t, n, r = {}) {
1132
+ var ur = 12;
1133
+ async function dr(e, t, n, r = {}) {
1134
1134
  let { onPreview: i, scheduler: a } = r;
1135
- return Ue(it(e, t, n, i && e.sequence.length > cr ? { onPages: (e, t) => {
1135
+ return Ge(ot(e, t, n, i && e.sequence.length > ur ? { onPages: (e, t) => {
1136
1136
  i(Object.freeze({
1137
1137
  layout: e,
1138
1138
  exact: !1,
@@ -1140,10 +1140,10 @@ async function lr(e, t, n, r = {}) {
1140
1140
  }));
1141
1141
  } } : void 0), a);
1142
1142
  }
1143
- var K = /* @__PURE__ */ new WeakMap();
1144
- function q(e, t) {
1143
+ var G = /* @__PURE__ */ new WeakMap();
1144
+ function K(e, t) {
1145
1145
  let n = Object.freeze({ ...t });
1146
- for (let t of [...K.get(e) ?? []]) try {
1146
+ for (let t of [...G.get(e) ?? []]) try {
1147
1147
  t.notify(n);
1148
1148
  } catch (e) {
1149
1149
  try {
@@ -1151,9 +1151,9 @@ function q(e, t) {
1151
1151
  } catch {}
1152
1152
  }
1153
1153
  }
1154
- function ur(e, t, n, r) {
1155
- let i = K.get(e);
1156
- i || (i = /* @__PURE__ */ new Set(), K.set(e, i));
1154
+ function fr(e, t, n, r) {
1155
+ let i = G.get(e);
1156
+ i || (i = /* @__PURE__ */ new Set(), G.set(e, i));
1157
1157
  let a = Object.freeze({
1158
1158
  notify: n,
1159
1159
  report: r
@@ -1167,61 +1167,61 @@ function ur(e, t, n, r) {
1167
1167
  } catch {}
1168
1168
  }
1169
1169
  return () => {
1170
- i?.delete(a), i?.size === 0 && K.delete(e);
1170
+ i?.delete(a), i?.size === 0 && G.delete(e);
1171
1171
  };
1172
1172
  }
1173
- function dr(e, t) {
1173
+ function pr(e, t) {
1174
1174
  if (!e) return 0;
1175
1175
  let n = Math.min(e.length, t.length), r = 0;
1176
- for (; r < n && fr(e[r], t[r]);) r += 1;
1176
+ for (; r < n && mr(e[r], t[r]);) r += 1;
1177
1177
  return r;
1178
1178
  }
1179
- function fr(e, t) {
1179
+ function mr(e, t) {
1180
1180
  if (e === t) return !0;
1181
1181
  if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
1182
1182
  if (Array.isArray(e)) {
1183
1183
  if (!Array.isArray(t) || e.length !== t.length) return !1;
1184
- for (let n = 0; n < e.length; n += 1) if (!fr(e[n], t[n])) return !1;
1184
+ for (let n = 0; n < e.length; n += 1) if (!mr(e[n], t[n])) return !1;
1185
1185
  return !0;
1186
1186
  }
1187
1187
  if (Array.isArray(t)) return !1;
1188
1188
  let n = Object.keys(e);
1189
1189
  if (n.length !== Object.keys(t).length) return !1;
1190
- for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !fr(e[r], t[r])) return !1;
1190
+ for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !mr(e[r], t[r])) return !1;
1191
1191
  return !0;
1192
1192
  }
1193
- var J = /* @__PURE__ */ new WeakMap(), pr = /* @__PURE__ */ new WeakMap(), mr = Symbol("docxLayoutViewRequester");
1194
- function Y(e) {
1195
- let t = A(e), n = t.activeLayoutOptions;
1193
+ var q = /* @__PURE__ */ new WeakMap(), hr = /* @__PURE__ */ new WeakMap(), gr = Symbol("docxLayoutViewRequester");
1194
+ function J(e) {
1195
+ let t = k(e), n = t.activeLayoutOptions;
1196
1196
  return {
1197
1197
  showTrackedChanges: n?.showTrackedChanges === !0,
1198
1198
  currentDate: n?.currentDateMs ?? t.defaultCurrentDateMs
1199
1199
  };
1200
1200
  }
1201
- async function X(e, t, n) {
1202
- let r = A(e), i = M(t.currentDate, r.defaultCurrentDateMs, t.showTrackedChanges === !0), a = Object.freeze({
1201
+ async function Y(e, t, n) {
1202
+ let r = k(e), i = j(t.currentDate, r.defaultCurrentDateMs, t.showTrackedChanges === !0), a = Object.freeze({
1203
1203
  showTrackedChanges: i.showTrackedChanges === !0,
1204
1204
  currentDate: i.currentDateMs
1205
1205
  }), o = {
1206
1206
  showTrackedChanges: a.showTrackedChanges,
1207
1207
  currentDate: a.currentDate,
1208
- [mr]: n
1208
+ [gr]: n
1209
1209
  };
1210
1210
  await e.setLayoutView(o);
1211
- let s = Y(e);
1211
+ let s = J(e);
1212
1212
  return s.currentDate === a.currentDate && s.showTrackedChanges === a.showTrackedChanges;
1213
1213
  }
1214
- async function hr(e, t, n, r, i) {
1214
+ async function _r(e, t, n, r, i) {
1215
1215
  let a = !1, o = () => {
1216
1216
  a || (a = !0, e.destroy());
1217
1217
  };
1218
1218
  try {
1219
1219
  for (; !t.aborted;) {
1220
1220
  let a = n();
1221
- if (a === void 0 || Y(e).showTrackedChanges === a) break;
1221
+ if (a === void 0 || J(e).showTrackedChanges === a) break;
1222
1222
  t.addEventListener("abort", o, { once: !0 });
1223
1223
  try {
1224
- await X(e, {
1224
+ await Y(e, {
1225
1225
  showTrackedChanges: a,
1226
1226
  currentDate: r()
1227
1227
  }, i);
@@ -1233,15 +1233,15 @@ async function hr(e, t, n, r, i) {
1233
1233
  throw o(), e;
1234
1234
  }
1235
1235
  }
1236
- function gr(e, t) {
1237
- let n = Object.freeze({ ...Y(e) }), r = (pr.get(e) ?? 0) + 1;
1238
- pr.set(e, r);
1236
+ function vr(e, t) {
1237
+ let n = Object.freeze({ ...J(e) }), r = (hr.get(e) ?? 0) + 1;
1238
+ hr.set(e, r);
1239
1239
  let i = Object.freeze({
1240
1240
  view: n,
1241
1241
  generation: r,
1242
1242
  requester: t
1243
1243
  });
1244
- for (let t of [...J.get(e) ?? []]) try {
1244
+ for (let t of [...q.get(e) ?? []]) try {
1245
1245
  t.notify(i);
1246
1246
  } catch (e) {
1247
1247
  try {
@@ -1249,37 +1249,37 @@ function gr(e, t) {
1249
1249
  } catch {}
1250
1250
  }
1251
1251
  }
1252
- function _r(e, t, n) {
1253
- let r = J.get(e);
1254
- r || (r = /* @__PURE__ */ new Set(), J.set(e, r));
1252
+ function yr(e, t, n) {
1253
+ let r = q.get(e);
1254
+ r || (r = /* @__PURE__ */ new Set(), q.set(e, r));
1255
1255
  let i = Object.freeze({
1256
1256
  notify: t,
1257
1257
  report: n
1258
1258
  });
1259
1259
  return r.add(i), () => {
1260
- r?.delete(i), r?.size === 0 && J.delete(e);
1260
+ r?.delete(i), r?.size === 0 && q.delete(e);
1261
1261
  };
1262
1262
  }
1263
- var vr = Symbol("docxViewerLoadSignal");
1264
- function yr(e, t) {
1263
+ var br = Symbol("docxViewerLoadSignal");
1264
+ function xr(e, t) {
1265
1265
  return e !== null && e.currentDateMs === t.currentDateMs && e.showTrackedChanges === !0 == (t.showTrackedChanges === !0);
1266
1266
  }
1267
- var br = Object.freeze([]), xr = Object.freeze([]), Sr = Object.freeze({
1267
+ var Sr = Object.freeze([]), Cr = Object.freeze([]), wr = Object.freeze({
1268
1268
  comments: Object.freeze([]),
1269
1269
  revisions: Object.freeze([])
1270
1270
  });
1271
- function Z(e, t) {
1272
- return Pe({
1271
+ function X(e, t) {
1272
+ return Ie({
1273
1273
  comments: e,
1274
1274
  revisions: t
1275
1275
  }, "DOCX review metadata");
1276
1276
  }
1277
- var Q = class e {
1277
+ var Z = class e {
1278
1278
  get diagnostics() {
1279
- return Pe([
1279
+ return Ie([
1280
1280
  ...this._mode === "worker" ? this._meta?.diagnostics ?? [] : this._getLayout()?.diagnostics ?? [],
1281
1281
  ...this._meta?.resourceDiagnostics ?? [],
1282
- ...ln(this)
1282
+ ...dn(this)
1283
1283
  ], "DOCX diagnostics");
1284
1284
  }
1285
1285
  _metrics = null;
@@ -1288,9 +1288,9 @@ var Q = class e {
1288
1288
  _document = null;
1289
1289
  _source = null;
1290
1290
  _meta = null;
1291
- _review = Sr;
1292
- _layoutLifecycle = new ae();
1293
- _layoutObservers = new De();
1291
+ _review = wr;
1292
+ _layoutLifecycle = new se();
1293
+ _layoutObservers = new ke();
1294
1294
  _layoutCompletion = null;
1295
1295
  _layoutAbort = null;
1296
1296
  _bookmarkPages = null;
@@ -1309,9 +1309,9 @@ var Q = class e {
1309
1309
  _tiff;
1310
1310
  _worker;
1311
1311
  _bridge;
1312
- _rawParts = new ee({
1312
+ _rawParts = new ne({
1313
1313
  maxEntries: 64,
1314
- maxBytes: _
1314
+ maxBytes: re
1315
1315
  });
1316
1316
  _embeddedFontFaces = [];
1317
1317
  _officeFontFaces = [];
@@ -1321,11 +1321,11 @@ var Q = class e {
1321
1321
  _googleFontFaces = [];
1322
1322
  _fetchImage = (e, t) => this.getImage(e, t);
1323
1323
  constructor(e, t, n, r) {
1324
- this._worker = e, this._mode = t, Fe(this, n), this._bridge = new dt(this._worker, {
1324
+ this._worker = e, this._mode = t, Le(this, n), this._bridge = new pt(this._worker, {
1325
1325
  correlate: (e) => "protocol" in e && e.protocol === "ooxml-pull-v1" ? e.requestId : "id" in e ? e.id : void 0,
1326
1326
  onUnsolicited: (e) => this._onWorkerLayoutPush(e),
1327
1327
  toError: (e) => {
1328
- if (!("protocol" in e || e.type !== "error")) return Object.assign(p(e), {
1328
+ if (!("protocol" in e || e.type !== "error")) return Object.assign(g(e), {
1329
1329
  ...e.reason === void 0 ? {} : { reason: e.reason },
1330
1330
  ...e.outgoingColumnIndex === void 0 ? {} : { outgoingColumnIndex: e.outgoingColumnIndex },
1331
1331
  ...e.outgoingColumnCount === void 0 ? {} : { outgoingColumnCount: e.outgoingColumnCount },
@@ -1333,126 +1333,126 @@ var Q = class e {
1333
1333
  });
1334
1334
  }
1335
1335
  });
1336
- let i = new URL(r ?? pn, location.href).href;
1336
+ let i = new URL(r ?? hn, location.href).href;
1337
1337
  this._bridge.post({
1338
1338
  type: "init",
1339
1339
  wasmUrl: i
1340
1340
  });
1341
1341
  }
1342
1342
  static async load(t, n = {}) {
1343
- let r = n[vr], i = r?.signal, l = () => {
1344
- if (i?.aborted) throw new N();
1343
+ let r = n[br], i = r?.signal, a = () => {
1344
+ if (i?.aborted) throw new M();
1345
1345
  };
1346
- if (l(), n.legacyDoc !== void 0) {
1347
- let { loadDocxModelSource: e } = await import("./document-model-source-xnkMoTZ_.js"), a = await e(t, n, r);
1348
- if (i?.aborted) throw a.destroy(), new N();
1346
+ if (a(), n.legacyDoc !== void 0) {
1347
+ let { loadDocxModelSource: e } = await import("./document-model-source-90ext13g.js"), a = await e(t, n, r);
1348
+ if (i?.aborted) throw a.destroy(), new M();
1349
1349
  return a;
1350
1350
  }
1351
- let u = S(n.cjkFallback), p = d(n), h = Date.now(), g = n.mode ?? "main", _ = new v({
1351
+ let u = _(n.cjkFallback), d = f(n), m = Date.now(), h = n.mode ?? "main", g = new p({
1352
1352
  enabled: !0,
1353
1353
  format: "docx",
1354
- mode: g,
1355
- policy: p.policy,
1356
- onMetrics: p.onResourceMetrics,
1357
- emitToConsole: p.debug
1354
+ mode: h,
1355
+ policy: d.policy,
1356
+ onMetrics: d.onResourceMetrics,
1357
+ emitToConsole: d.debug
1358
1358
  });
1359
1359
  try {
1360
- if (g === "worker" && (typeof Worker > "u" || typeof OffscreenCanvas > "u")) throw Error("mode: 'worker' requires Worker and OffscreenCanvas support");
1361
- let d;
1360
+ if (h === "worker" && (typeof Worker > "u" || typeof OffscreenCanvas > "u")) throw Error("mode: 'worker' requires Worker and OffscreenCanvas support");
1361
+ let f;
1362
1362
  if (typeof t == "string") {
1363
1363
  let e = await fetch(t, { signal: i });
1364
1364
  if (!e.ok) throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);
1365
- d = await e.arrayBuffer();
1366
- } else d = t;
1367
- l(), d = a(await o(d, n.password)), l(), _.setSourceBytes(d.byteLength), _.checkpoint("container ready");
1368
- let v = g === "worker" ? (await import("./render-worker-host-G1fnymI8.js")).createRenderWorker() : new fn(), y = g === "worker" ? jt(n) : void 0, b = g === "worker" && !!n.progressiveLayout, x, S = !1, ee = () => {
1369
- S || !x || (S = !0, x.destroy());
1365
+ f = await e.arrayBuffer();
1366
+ } else f = t;
1367
+ a(), f = o(await s(f, n.password)), a(), g.setSourceBytes(f.byteLength), g.checkpoint("container ready");
1368
+ let p = h === "worker" ? (await import("./render-worker-host-BmVeB_mR.js")).createRenderWorker() : new mn(), _ = h === "worker" ? Nt(n) : void 0, ee = h === "worker" && !!n.progressiveLayout, v, b = !1, x = () => {
1369
+ b || !v || (b = !0, v.destroy());
1370
1370
  };
1371
1371
  try {
1372
- x = new e(v, g, h, n.wasmUrl), i?.addEventListener("abort", ee, { once: !0 }), l(), x._metrics = _, x._cjkFallback = u, x._allowFootnoteContinuation = n.allowFootnoteContinuation !== !1;
1373
- let t = A(x), a = M(n.currentDate, t.defaultCurrentDateMs, n.showTrackedChanges === !0);
1374
- t.activeLayoutOptions = a, await x._parse(d, p.policy, g === "worker" ? !!n.useGoogleFonts : !1, n.workerTimeoutMs, (e) => _.observeUsage(e), y, b ? {
1372
+ v = new e(p, h, m, n.wasmUrl), i?.addEventListener("abort", x, { once: !0 }), a(), v._metrics = g, v._cjkFallback = u, v._allowFootnoteContinuation = n.allowFootnoteContinuation !== !1;
1373
+ let t = k(v), o = j(n.currentDate, t.defaultCurrentDateMs, n.showTrackedChanges === !0);
1374
+ t.activeLayoutOptions = o, await v._parse(f, d.policy, h === "worker" ? !!n.useGoogleFonts : !1, n.workerTimeoutMs, (e) => g.observeUsage(e), _, ee ? {
1375
1375
  onPartial: n.onLayoutPartial,
1376
1376
  onComplete: n.onLayoutComplete,
1377
1377
  onProgress: n.onLayoutProgress,
1378
- layoutOptions: a,
1378
+ layoutOptions: o,
1379
1379
  abort: new AbortController(),
1380
- firstPublication: ce(),
1380
+ firstPublication: ue(),
1381
1381
  published: !1,
1382
1382
  settled: !1
1383
- } : void 0), l(), g === "worker" && x._mode === "main" && (_.setMode("main"), console.warn(mn(x._mainThreadFallbackReason))), n.math && x._mode === "worker" && !y?.math && console.warn("[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math."), n.threeD && x._mode === "worker" && !y?.threeD && console.warn("[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d."), x._threeD = x._mode === "worker" ? void 0 : n.threeD, n.regionMap && x._mode === "worker" && !y?.regionMap && console.warn("[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map."), x._regionMap = x._mode === "worker" ? void 0 : n.regionMap, n.chartEx && x._mode === "worker" && !y?.chartEx && console.warn("[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex."), x._chartEx = x._mode === "worker" ? void 0 : n.chartEx, n.tiff && x._mode === "worker" && !y?.tiff && console.warn("[ooxml] a custom TIFF codec cannot cross the worker boundary; recognized TIFF images will use an unavailable-image placeholder in mode: 'worker'. Use the codec from @silurus/ooxml/tiff to display them."), x._tiff = x._mode === "worker" ? void 0 : n.tiff;
1384
- let o, S, C = x, te = x._mode === "main" && x._document && x._source ? Ke(tt(x._source, x._document, {
1383
+ } : void 0), a(), h === "worker" && v._mode === "main" && (g.setMode("main"), console.warn(gn(v._mainThreadFallbackReason))), n.math && v._mode === "worker" && !_?.math && console.warn("[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math."), n.threeD && v._mode === "worker" && !_?.threeD && console.warn("[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d."), v._threeD = v._mode === "worker" ? void 0 : n.threeD, n.regionMap && v._mode === "worker" && !_?.regionMap && console.warn("[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map."), v._regionMap = v._mode === "worker" ? void 0 : n.regionMap, n.chartEx && v._mode === "worker" && !_?.chartEx && console.warn("[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex."), v._chartEx = v._mode === "worker" ? void 0 : n.chartEx, n.tiff && v._mode === "worker" && !_?.tiff && console.warn("[ooxml] a custom TIFF codec cannot cross the worker boundary; recognized TIFF images will use an unavailable-image placeholder in mode: 'worker'. Use the codec from @silurus/ooxml/tiff to display them."), v._tiff = v._mode === "worker" ? void 0 : n.tiff;
1384
+ let s, b, ne = v, re = v._mode === "main" && v._document && v._source ? Je(rt(v._source, v._document, {
1385
1385
  useGoogleFonts: !!n.useGoogleFonts,
1386
1386
  cjkFallback: u
1387
- }), !0).then((e) => C._nativeRouteFacesReleased ? (m(e.faces), null) : (C._nativeRouteFaces.push(...e.faces), e), () => null) : null;
1388
- if (x._mode === "main" && x._document?.embeddedFonts?.length) {
1389
- let e = x, t = await xn(x._document, (t) => e.getFontBytes(t));
1390
- if (i?.aborted) throw E(t.faces), new N();
1391
- L(x, t.diagnostics), x._embeddedFontFaces = t.faces, o = t.metrics, S = t.routes;
1387
+ }), !0).then((e) => ne._nativeRouteFacesReleased ? (c(e.faces), null) : (ne._nativeRouteFaces.push(...e.faces), e), () => null) : null;
1388
+ if (v._mode === "main" && v._document?.embeddedFonts?.length) {
1389
+ let e = v, t = await Cn(v._document, (t) => e.getFontBytes(t));
1390
+ if (i?.aborted) throw T(t.faces), new M();
1391
+ I(v, t.diagnostics), v._embeddedFontFaces = t.faces, s = t.metrics, b = t.routes;
1392
1392
  }
1393
- let w = x._mode === "main" && x._document ? await sn(Qe(x._document, {
1393
+ let S = v._mode === "main" && v._document ? await ln(et(v._document, {
1394
1394
  useGoogleFonts: n.useGoogleFonts,
1395
1395
  cjkFallback: u
1396
- }).filter((e) => e.presenceOnly || !S?.some((t) => t.requestedFamily.toLowerCase() === e.family.toLowerCase() && t.weight === (e.weight ?? 400) && t.style === (e.style ?? "normal")))) : {
1396
+ }).filter((e) => e.presenceOnly || !b?.some((t) => t.requestedFamily.toLowerCase() === e.family.toLowerCase() && t.weight === (e.weight ?? 400) && t.style === (e.style ?? "normal")))) : {
1397
1397
  faces: [],
1398
1398
  routes: {}
1399
1399
  };
1400
- if (i?.aborted) throw m(w.faces), new N();
1401
- x._officeFontFaces = w.faces;
1402
- let ne = [];
1403
- if (x._mode === "main" && n.useGoogleFonts && x._document) {
1404
- let e = Ge(x._document, u, w);
1405
- ne = e.installedSubstituteFamilies;
1406
- let t = await s(e.names, Ve);
1407
- if (i?.aborted) throw f(t), new N();
1408
- x._googleFontFaces = t;
1400
+ if (i?.aborted) throw c(S.faces), new M();
1401
+ v._officeFontFaces = S.faces;
1402
+ let ie = [];
1403
+ if (v._mode === "main" && n.useGoogleFonts && v._document) {
1404
+ let e = qe(v._document, u, S);
1405
+ ie = e.installedSubstituteFamilies;
1406
+ let t = await l(e.names, Ue);
1407
+ if (i?.aborted) throw y(t), new M();
1408
+ v._googleFontFaces = t;
1409
1409
  }
1410
- let T;
1411
- if (x._mode === "main" && n.math && x._document && Ze(x._document) && (T = await $e(x._document, n.math)), l(), x._mode === "main" && x._document && x._source) {
1412
- let e = x, t = A(x), a = {
1413
- allowFootnoteContinuation: x._allowFootnoteContinuation,
1414
- fontMetrics: o,
1410
+ let C;
1411
+ if (v._mode === "main" && n.math && v._document && $e(v._document) && (C = await tt(v._document, n.math)), a(), v._mode === "main" && v._document && v._source) {
1412
+ let e = v, t = k(v), o = {
1413
+ allowFootnoteContinuation: v._allowFootnoteContinuation,
1414
+ fontMetrics: s,
1415
1415
  useGoogleFonts: !!n.useGoogleFonts,
1416
1416
  cjkFallback: u,
1417
- embeddedRoutes: S,
1418
- officeRoutes: Object.values(w.routes),
1419
- googleFaces: x._googleFontFaces,
1420
- installedSubstituteFamilies: ne,
1421
- installedFamilies: "installed" in w ? w.installed : void 0,
1422
- mathResources: T?.records,
1423
- mathDrawables: T?.drawables
1424
- }, s = await te;
1425
- l(), t.services = Je(x._source, {
1426
- ...a,
1427
- nativeRouteMetrics: s && s.faces.length > 0 ? Ye(s.lines, c()) : void 0
1417
+ embeddedRoutes: b,
1418
+ officeRoutes: Object.values(S.routes),
1419
+ googleFaces: v._googleFontFaces,
1420
+ installedSubstituteFamilies: ie,
1421
+ installedFamilies: "installed" in S ? S.installed : void 0,
1422
+ mathResources: C?.records,
1423
+ mathDrawables: C?.drawables
1424
+ }, c = await re;
1425
+ a(), t.services = Xe(v._source, {
1426
+ ...o,
1427
+ nativeRouteMetrics: c && c.faces.length > 0 ? Ze(c.lines, te()) : void 0
1428
1428
  });
1429
- let d = t.services, f = He(x._source, d, t.defaultCurrentDateMs), p = x._source.fatalParse === null, m = t.activeLayoutOptions;
1430
- if (!m) throw Error("Active layout view was not recorded at load");
1431
- let h = { onProgress: n.onLayoutProgress ? (t) => e._layoutObservers.notify("onLayoutProgress", n.onLayoutProgress, { committedUnits: t }) : void 0 };
1432
- if (p && n.progressiveLayout) {
1433
- let e = f.layoutVariants, t = x, r = new AbortController();
1429
+ let l = t.services, d = We(v._source, l, t.defaultCurrentDateMs), f = v._source.fatalParse === null, p = t.activeLayoutOptions;
1430
+ if (!p) throw Error("Active layout view was not recorded at load");
1431
+ let m = { onProgress: n.onLayoutProgress ? (t) => e._layoutObservers.notify("onLayoutProgress", n.onLayoutProgress, { committedUnits: t }) : void 0 };
1432
+ if (f && n.progressiveLayout) {
1433
+ let e = d.layoutVariants, t = v, r = new AbortController();
1434
1434
  t._layoutAbort = r;
1435
- let i = ce(), a = null, o = !0;
1436
- t._layoutCompletion = lr(x._source.bodyLayoutInput, d, m, {
1435
+ let i = ue(), a = null, o = !0;
1436
+ t._layoutCompletion = dr(v._source.bodyLayoutInput, l, p, {
1437
1437
  scheduler: {
1438
- ...h,
1438
+ ...m,
1439
1439
  signal: r.signal
1440
1440
  },
1441
1441
  onPreview: (r) => {
1442
1442
  if (!o) return;
1443
- let s = a === null, c = dr(a?.pages, r.layout.pages), l = t._replaceMainLayoutPublication(e, m, a, r.layout);
1443
+ let s = a === null, c = pr(a?.pages, r.layout.pages), l = t._replaceMainLayoutPublication(e, p, a, r.layout);
1444
1444
  if (l === null) {
1445
1445
  o = !1;
1446
1446
  return;
1447
1447
  }
1448
- if (a = l, s) t._layoutLifecycle.begin(), q(t, {
1448
+ if (a = l, s) t._layoutLifecycle.begin(), K(t, {
1449
1449
  pageCount: r.layout.pages.length,
1450
1450
  exact: r.exact,
1451
1451
  complete: !1
1452
1452
  }), i.resolve();
1453
1453
  else {
1454
- if (!t._isLayoutViewActive(m)) return;
1455
- q(t, {
1454
+ if (!t._isLayoutViewActive(p)) return;
1455
+ K(t, {
1456
1456
  pageCount: r.layout.pages.length,
1457
1457
  exact: r.exact,
1458
1458
  complete: !1,
@@ -1465,63 +1465,63 @@ var Q = class e {
1465
1465
  }
1466
1466
  }).then((r) => {
1467
1467
  let s;
1468
- o && (s = dr(a?.pages, r.pages), t._replaceMainLayoutPublication(e, m, a, r) === null && (o = !1)), t._layoutLifecycle.succeed(), q(t, {
1468
+ o && (s = pr(a?.pages, r.pages), t._replaceMainLayoutPublication(e, p, a, r) === null && (o = !1)), t._layoutLifecycle.succeed(), K(t, {
1469
1469
  pageCount: t.pageCount,
1470
1470
  exact: !0,
1471
1471
  complete: !0,
1472
- ...o && t._isLayoutViewActive(m) && s !== void 0 ? { unchangedPages: s } : {}
1472
+ ...o && t._isLayoutViewActive(p) && s !== void 0 ? { unchangedPages: s } : {}
1473
1473
  }), t._layoutObservers.notify("onLayoutComplete", n.onLayoutComplete), i.resolve();
1474
1474
  }).catch((e) => {
1475
1475
  if (a === null) {
1476
1476
  i.reject(e);
1477
1477
  return;
1478
1478
  }
1479
- if (e instanceof N) {
1479
+ if (e instanceof M) {
1480
1480
  t._layoutLifecycle.succeed();
1481
1481
  return;
1482
1482
  }
1483
1483
  let r = t._layoutLifecycle.fail(e);
1484
- q(t, {
1484
+ K(t, {
1485
1485
  pageCount: t.pageCount,
1486
1486
  exact: !1,
1487
1487
  complete: !1,
1488
1488
  error: r
1489
1489
  }), t._layoutObservers.notify("onLayoutComplete", n.onLayoutComplete, r);
1490
1490
  }), await i.promise;
1491
- } else if (p && (n.sliceLayout !== !1 || n.onLayoutProgress)) for (;;) {
1492
- l();
1493
- let e = r?.requestedView(), a = e === void 0 ? m : M(n.currentDate, t.defaultCurrentDateMs, e);
1494
- t.activeLayoutOptions = a;
1495
- let o = new AbortController(), s = !1, c = r?.subscribeViewChange(() => {
1491
+ } else if (f && (n.sliceLayout !== !1 || n.onLayoutProgress)) for (;;) {
1492
+ a();
1493
+ let e = r?.requestedView(), o = e === void 0 ? p : j(n.currentDate, t.defaultCurrentDateMs, e);
1494
+ t.activeLayoutOptions = o;
1495
+ let s = new AbortController(), c = !1, u = r?.subscribeViewChange(() => {
1496
1496
  let e = r.requestedView();
1497
- s || e === void 0 || e === !0 == (a.showTrackedChanges === !0) || (s = !0, o.abort());
1497
+ c || e === void 0 || e === !0 == (o.showTrackedChanges === !0) || (c = !0, s.abort());
1498
1498
  });
1499
- x._layoutAbort = o;
1499
+ v._layoutAbort = s;
1500
1500
  try {
1501
- let e = await nt(x._source.bodyLayoutInput, d, a, {
1502
- ...h,
1503
- signal: o.signal
1501
+ let e = await it(v._source.bodyLayoutInput, l, o, {
1502
+ ...m,
1503
+ signal: s.signal
1504
1504
  });
1505
- if (l(), s) continue;
1506
- f.layoutVariants.prime(a, e);
1505
+ if (a(), c) continue;
1506
+ d.layoutVariants.prime(o, e);
1507
1507
  break;
1508
1508
  } catch (e) {
1509
- if (e instanceof N && s && !i?.aborted) continue;
1509
+ if (e instanceof M && c && !i?.aborted) continue;
1510
1510
  throw e;
1511
1511
  } finally {
1512
- c?.(), x._layoutAbort = null;
1512
+ u?.(), v._layoutAbort = null;
1513
1513
  }
1514
1514
  }
1515
- else f.layoutVariants.layoutFor(m);
1515
+ else d.layoutVariants.layoutFor(p);
1516
1516
  }
1517
- return l(), await x._resourceUsage(n.workerTimeoutMs ?? 1e3).then((e) => _.observeUsage(e), () => void 0), _.checkpoint("model and layout ready"), l(), _.succeed({ pages: x.pageCount }), x;
1517
+ return a(), await v._resourceUsage(n.workerTimeoutMs ?? 1e3).then((e) => g.observeUsage(e), () => void 0), g.checkpoint("model and layout ready"), a(), g.succeed({ pages: v.pageCount }), v;
1518
1518
  } catch (e) {
1519
- throw ft(v, x ? ee : void 0), e;
1519
+ throw mt(p, v ? x : void 0), e;
1520
1520
  } finally {
1521
- i?.removeEventListener("abort", ee);
1521
+ i?.removeEventListener("abort", x);
1522
1522
  }
1523
1523
  } catch (e) {
1524
- throw _.fail(e), e;
1524
+ throw g.fail(e), e;
1525
1525
  }
1526
1526
  }
1527
1527
  async _parse(e, t, n = !1, r, i, a, o) {
@@ -1537,7 +1537,7 @@ var Q = class e {
1537
1537
  useGoogleFonts: n,
1538
1538
  allowFootnoteContinuation: this._allowFootnoteContinuation,
1539
1539
  cjkFallback: this._cjkFallback,
1540
- defaultCurrentDateMs: A(this).defaultCurrentDateMs,
1540
+ defaultCurrentDateMs: k(this).defaultCurrentDateMs,
1541
1541
  ...this._parseViewFields(),
1542
1542
  renderers: a
1543
1543
  } : {
@@ -1548,25 +1548,25 @@ var Q = class e {
1548
1548
  }), [e], { timeoutMs: r });
1549
1549
  if (this._parseRequestId = null, "protocol" in s) throw Error("DOCX parse open returned a pull-protocol response");
1550
1550
  if (this._mode === "worker") if ("usage" in s && s.usage && i?.(s.usage), s.type === "mainThreadVerticalFallback") {
1551
- let e = await Xe(this._bridge.transport(et), s, {
1551
+ let e = await Qe(this._bridge.transport(nt), s, {
1552
1552
  timeoutMs: r,
1553
1553
  onUsage: i
1554
1554
  });
1555
1555
  this._source = e.source, this._document = e.document, this._meta = null, this._mode = "main", this._mainThreadFallbackReason = s.reason ?? "vertical";
1556
1556
  } else this._meta = s.meta;
1557
1557
  else {
1558
- let e = s, t = await Xe(this._bridge.transport(et), e, {
1558
+ let e = s, t = await Qe(this._bridge.transport(nt), e, {
1559
1559
  timeoutMs: r,
1560
1560
  onUsage: i
1561
1561
  });
1562
1562
  this._source = t.source, this._document = t.document;
1563
1563
  }
1564
- this._review = Z(this._meta?.comments ?? this._document?.comments ?? [], this._meta?.revisions ?? this._document?.revisions ?? []);
1564
+ this._review = X(this._meta?.comments ?? this._document?.comments ?? [], this._meta?.revisions ?? this._document?.revisions ?? []);
1565
1565
  }
1566
1566
  _onWorkerLayoutPush(e) {
1567
- if (Ot((e, t) => this._worker.postMessage(e, t), e) || !("forId" in e) || e.forId !== this._parseRequestId) return;
1567
+ if (At((e, t) => this._worker.postMessage(e, t), e) || !("forId" in e) || e.forId !== this._parseRequestId) return;
1568
1568
  if (this._rearmParseWatchdog(), e.type === "measureHostFontLines") {
1569
- nn(e.routes).catch(() => []).then((t) => {
1569
+ an(e.routes).catch(() => []).then((t) => {
1570
1570
  e.forId === this._parseRequestId && this._worker.postMessage({
1571
1571
  type: "hostFontLinesMeasured",
1572
1572
  forId: e.forId,
@@ -1576,7 +1576,7 @@ var Q = class e {
1576
1576
  return;
1577
1577
  }
1578
1578
  if (e.type === "measureNativeRouteLines") {
1579
- Ke(e.requests, !1).then((e) => e.lines, () => e.requests.map(() => null)).then((t) => {
1579
+ Je(e.requests, !1).then((e) => e.lines, () => e.requests.map(() => null)).then((t) => {
1580
1580
  e.forId === this._parseRequestId && this._worker.postMessage({
1581
1581
  type: "nativeRouteLinesMeasured",
1582
1582
  forId: e.forId,
@@ -1595,7 +1595,7 @@ var Q = class e {
1595
1595
  let n = !t.published || this._isLayoutViewActive(t.layoutOptions);
1596
1596
  if (n && this._applyLayoutPartial(e.partial), t.published) {
1597
1597
  if (!n) return;
1598
- q(this, {
1598
+ K(this, {
1599
1599
  pageCount: e.partial.pageCount,
1600
1600
  exact: e.partial.exact,
1601
1601
  complete: !1,
@@ -1606,7 +1606,7 @@ var Q = class e {
1606
1606
  });
1607
1607
  return;
1608
1608
  }
1609
- t.published = !0, this._layoutLifecycle.begin(), q(this, {
1609
+ t.published = !0, this._layoutLifecycle.begin(), K(this, {
1610
1610
  pageCount: e.partial.pageCount,
1611
1611
  exact: e.partial.exact,
1612
1612
  complete: !1
@@ -1626,7 +1626,7 @@ var Q = class e {
1626
1626
  resourceDiagnostics: e.review?.resourceDiagnostics ?? this._meta?.resourceDiagnostics,
1627
1627
  commentAnchorRanges: e.commentAnchorRanges,
1628
1628
  revisionAnchorRanges: e.revisionAnchorRanges
1629
- }, e.review && (this._review = Z(e.review.comments, e.review.revisions)), this._invalidateLayoutDerivedCaches();
1629
+ }, e.review && (this._review = X(e.review.comments, e.review.revisions)), this._invalidateLayoutDerivedCaches();
1630
1630
  }
1631
1631
  _onAuthoritativeMeta(e, t) {
1632
1632
  this._clearParseWatchdog();
@@ -1646,7 +1646,7 @@ var Q = class e {
1646
1646
  revisionAnchorRanges: t.revisionAnchorRanges
1647
1647
  };
1648
1648
  }
1649
- this._invalidateLayoutDerivedCaches(), this._review = Z(e.comments, e.revisions), n && (n.settled = !0, this._layoutLifecycle.succeed(), q(this, {
1649
+ this._invalidateLayoutDerivedCaches(), this._review = X(e.comments, e.revisions), n && (n.settled = !0, this._layoutLifecycle.succeed(), K(this, {
1650
1650
  pageCount: this.pageCount,
1651
1651
  exact: !0,
1652
1652
  complete: !0,
@@ -1661,7 +1661,7 @@ var Q = class e {
1661
1661
  return i !== null && this._isLayoutViewActive(t) && this._invalidateLayoutDerivedCaches(), i;
1662
1662
  }
1663
1663
  _isLayoutViewActive(e) {
1664
- return yr(A(this).activeLayoutOptions, e);
1664
+ return xr(k(this).activeLayoutOptions, e);
1665
1665
  }
1666
1666
  _rearmParseWatchdog() {
1667
1667
  this._parseWatchdogMs !== void 0 && (clearTimeout(this._parseWatchdog), this._parseWatchdog = setTimeout(() => this._onParseWentSilent(), this._parseWatchdogMs));
@@ -1682,7 +1682,7 @@ var Q = class e {
1682
1682
  return;
1683
1683
  }
1684
1684
  let n = this._layoutLifecycle.fail(t);
1685
- q(this, {
1685
+ K(this, {
1686
1686
  pageCount: this.pageCount,
1687
1687
  exact: !1,
1688
1688
  complete: !1,
@@ -1690,7 +1690,7 @@ var Q = class e {
1690
1690
  }), this._layoutObservers.notify("onLayoutComplete", e.onComplete, n);
1691
1691
  }
1692
1692
  _parseViewFields() {
1693
- let e = A(this), t = e.activeLayoutOptions;
1693
+ let e = k(this), t = e.activeLayoutOptions;
1694
1694
  return t ? {
1695
1695
  ...t.currentDateMs === e.defaultCurrentDateMs ? {} : { currentDateMs: t.currentDateMs },
1696
1696
  ...t.showTrackedChanges === !0 ? { showTrackedChanges: !0 } : {}
@@ -1706,7 +1706,7 @@ var Q = class e {
1706
1706
  useGoogleFonts: n,
1707
1707
  allowFootnoteContinuation: this._allowFootnoteContinuation,
1708
1708
  cjkFallback: this._cjkFallback,
1709
- defaultCurrentDateMs: A(this).defaultCurrentDateMs,
1709
+ defaultCurrentDateMs: k(this).defaultCurrentDateMs,
1710
1710
  ...this._parseViewFields(),
1711
1711
  renderers: a,
1712
1712
  progressiveLayout: !0
@@ -1715,11 +1715,11 @@ var Q = class e {
1715
1715
  if (this._parseRequestId = null, "protocol" in e) throw Error("DOCX parse open returned a pull-protocol response");
1716
1716
  if ("usage" in e && e.usage && i?.(e.usage), e.type === "mainThreadVerticalFallback") {
1717
1717
  this._clearParseWatchdog(), o.settled = !0, this._progressive = null, this._layoutAbort = null;
1718
- let t = await Xe(this._bridge.transport(et), e, {
1718
+ let t = await Qe(this._bridge.transport(nt), e, {
1719
1719
  timeoutMs: r,
1720
1720
  onUsage: i
1721
1721
  });
1722
- this._source = t.source, this._document = t.document, this._meta = null, this._mode = "main", this._mainThreadFallbackReason = e.reason ?? "vertical", this._review = Z(t.document.comments ?? [], t.document.revisions ?? []), o.firstPublication.resolve();
1722
+ this._source = t.source, this._document = t.document, this._meta = null, this._mode = "main", this._mainThreadFallbackReason = e.reason ?? "vertical", this._review = X(t.document.comments ?? [], t.document.revisions ?? []), o.firstPublication.resolve();
1723
1723
  return;
1724
1724
  }
1725
1725
  let t = e;
@@ -1735,7 +1735,7 @@ var Q = class e {
1735
1735
  }), this._rearmParseWatchdog(), await o.firstPublication.promise;
1736
1736
  }
1737
1737
  destroy() {
1738
- this._layoutAbort?.abort(), this._layoutAbort = null, this._clearParseWatchdog(), this._parseRequestId = null, this._progressive = null, this._layoutViewGeneration++, this._bridge.terminate(), this._document = null, this._source = null, this._meta = null, this._review = Sr, A(this).services = null, this._bookmarkPages = null, this._commentAnchorRanges = null, this._revisionAnchorRanges = null, this._reviewProjectionIndex = null, this._rawParts.clear(), this._embeddedFontFaces.length > 0 && (E(this._embeddedFontFaces), this._embeddedFontFaces = []), this._officeFontFaces.length > 0 && (m(this._officeFontFaces), this._officeFontFaces = []), this._nativeRouteFacesReleased = !0, this._nativeRouteFaces?.length > 0 && (m(this._nativeRouteFaces), this._nativeRouteFaces = []), this._googleFontFaces.length > 0 && (f(this._googleFontFaces), this._googleFontFaces = []), y(this._fetchImage), x(this._fetchImage);
1738
+ this._layoutAbort?.abort(), this._layoutAbort = null, this._clearParseWatchdog(), this._parseRequestId = null, this._progressive = null, this._layoutViewGeneration++, this._bridge.terminate(), this._document = null, this._source = null, this._meta = null, this._review = wr, k(this).services = null, this._bookmarkPages = null, this._commentAnchorRanges = null, this._revisionAnchorRanges = null, this._reviewProjectionIndex = null, this._rawParts.clear(), this._embeddedFontFaces.length > 0 && (T(this._embeddedFontFaces), this._embeddedFontFaces = []), this._officeFontFaces.length > 0 && (c(this._officeFontFaces), this._officeFontFaces = []), this._nativeRouteFacesReleased = !0, this._nativeRouteFaces?.length > 0 && (c(this._nativeRouteFaces), this._nativeRouteFaces = []), this._googleFontFaces.length > 0 && (y(this._googleFontFaces), this._googleFontFaces = []), v(this._fetchImage), b(this._fetchImage);
1739
1739
  }
1740
1740
  async getImage(e, t) {
1741
1741
  return this._rawParts.get(e, t, () => this._bridge.request((t) => ({
@@ -1796,35 +1796,35 @@ var Q = class e {
1796
1796
  return this._reviewSnapshot().revisions;
1797
1797
  }
1798
1798
  commentAnchorRanges() {
1799
- if (this._meta) return this._meta.commentAnchorRanges ?? br;
1799
+ if (this._meta) return this._meta.commentAnchorRanges ?? Sr;
1800
1800
  if (!this._document || !this._source) return [];
1801
1801
  let e = this._reviewSnapshot().comments;
1802
- if (e.length === 0) return br;
1803
- let t = A(this), n = t.services;
1802
+ if (e.length === 0) return Sr;
1803
+ let t = k(this), n = t.services;
1804
1804
  if (!n) throw Error("Document layout services are not initialized");
1805
- let r = Le(n);
1805
+ let r = ze(n);
1806
1806
  if (!r) throw Error("Document layout variant store is not initialized");
1807
1807
  let i = t.activeLayoutOptions, a = i ? r.layoutFor(i) : r.defaultLayout;
1808
- this._reviewProjectionIndex ??= Be(a);
1808
+ this._reviewProjectionIndex ??= He(a);
1809
1809
  let o = this._layoutLifecycle?.complete ?? !0 ? void 0 : { completedSourceKeys: this._reviewProjectionIndex.completedSourceKeys };
1810
- return this._commentAnchorRanges ??= Xn(e, this._source, this._reviewProjectionIndex.renderedRunIndex, o), this._commentAnchorRanges;
1810
+ return this._commentAnchorRanges ??= Qn(e, this._source, this._reviewProjectionIndex.renderedRunIndex, o), this._commentAnchorRanges;
1811
1811
  }
1812
1812
  revisionAnchorRanges() {
1813
- if (this._meta) return this._meta.revisionAnchorRanges ?? xr;
1813
+ if (this._meta) return this._meta.revisionAnchorRanges ?? Cr;
1814
1814
  if (!this._document || !this._source) return [];
1815
1815
  let e = this._reviewSnapshot().revisions;
1816
- if (e.length === 0) return xr;
1817
- let t = A(this), n = t.services;
1816
+ if (e.length === 0) return Cr;
1817
+ let t = k(this), n = t.services;
1818
1818
  if (!n) throw Error("Document layout services are not initialized");
1819
- let r = Le(n);
1819
+ let r = ze(n);
1820
1820
  if (!r) throw Error("Document layout variant store is not initialized");
1821
1821
  let i = t.activeLayoutOptions, a = i ? r.layoutFor(i) : r.defaultLayout;
1822
- this._reviewProjectionIndex ??= Be(a);
1822
+ this._reviewProjectionIndex ??= He(a);
1823
1823
  let o = this._layoutLifecycle?.complete ?? !0 ? void 0 : { completedSourceKeys: this._reviewProjectionIndex.completedSourceKeys };
1824
- return this._revisionAnchorRanges ??= or(e, this._source, this._reviewProjectionIndex.renderedRunIndex, o), this._revisionAnchorRanges;
1824
+ return this._revisionAnchorRanges ??= cr(e, this._source, this._reviewProjectionIndex.renderedRunIndex, o), this._revisionAnchorRanges;
1825
1825
  }
1826
1826
  _reviewSnapshot() {
1827
- return this._review ||= Z(this._meta?.comments ?? this._document?.comments ?? [], this._meta?.revisions ?? this._document?.revisions ?? []), this._review;
1827
+ return this._review ||= X(this._meta?.comments ?? this._document?.comments ?? [], this._meta?.revisions ?? this._document?.revisions ?? []), this._review;
1828
1828
  }
1829
1829
  get footnotes() {
1830
1830
  return this._meta?.footnotes ?? this._document?.footnotes ?? [];
@@ -1834,16 +1834,16 @@ var Q = class e {
1834
1834
  }
1835
1835
  _getLayout() {
1836
1836
  if (!this._document) return null;
1837
- let e = A(this), t = e.services;
1837
+ let e = k(this), t = e.services;
1838
1838
  if (!t) throw Error("Document layout services are not initialized");
1839
- let n = Le(t);
1839
+ let n = ze(t);
1840
1840
  if (!n) throw Error("Document layout variant store is not initialized");
1841
1841
  let r = e.activeLayoutOptions;
1842
1842
  return r ? n.layoutFor(r) : n.defaultLayout;
1843
1843
  }
1844
1844
  async setLayoutView(e = {}) {
1845
- let t = e[mr], n = A(this), r = M(e.currentDate, n.defaultCurrentDateMs, e.showTrackedChanges === !0), i = ++this._layoutViewGeneration, a = n.activeLayoutOptions;
1846
- if (!yr(a, r)) {
1845
+ let t = e[gr], n = k(this), r = j(e.currentDate, n.defaultCurrentDateMs, e.showTrackedChanges === !0), i = ++this._layoutViewGeneration, a = n.activeLayoutOptions;
1846
+ if (!xr(a, r)) {
1847
1847
  if (this._mode === "worker" && this._meta) {
1848
1848
  let e = await this._bridge.request((e) => ({
1849
1849
  type: "selectLayoutView",
@@ -1856,17 +1856,17 @@ var Q = class e {
1856
1856
  n.activeLayoutOptions = r, this._meta = {
1857
1857
  ...this._meta,
1858
1858
  ...a.meta
1859
- }, this._invalidateLayoutDerivedCaches(), gr(this, t);
1859
+ }, this._invalidateLayoutDerivedCaches(), vr(this, t);
1860
1860
  return;
1861
1861
  }
1862
- n.activeLayoutOptions = r, this._invalidateLayoutDerivedCaches(), gr(this, t);
1862
+ n.activeLayoutOptions = r, this._invalidateLayoutDerivedCaches(), vr(this, t);
1863
1863
  }
1864
1864
  }
1865
1865
  _getBookmarkPages() {
1866
1866
  if (this._bookmarkPages) return this._bookmarkPages;
1867
1867
  if (this._meta) return this._bookmarkPages = new Map(this._meta.bookmarkPages), this._bookmarkPages;
1868
1868
  let e = this._getLayout();
1869
- return e ? (this._bookmarkPages = hn(e), this._bookmarkPages) : null;
1869
+ return e ? (this._bookmarkPages = _n(e), this._bookmarkPages) : null;
1870
1870
  }
1871
1871
  getBookmarkPage(e) {
1872
1872
  return this._getBookmarkPages()?.get(e);
@@ -1898,7 +1898,7 @@ var Q = class e {
1898
1898
  };
1899
1899
  }
1900
1900
  _withActiveView(e) {
1901
- let t = A(this).activeLayoutOptions;
1901
+ let t = k(this).activeLayoutOptions;
1902
1902
  if (!t) return e;
1903
1903
  let n = { ...e };
1904
1904
  return e.currentDate === void 0 && (n.currentDate = t.currentDateMs), e.showTrackedChanges === void 0 && t.showTrackedChanges === !0 && (n.showTrackedChanges = !0), n;
@@ -1909,13 +1909,13 @@ var Q = class e {
1909
1909
  _renderPageWithTargetOwnership(e, t, n, r) {
1910
1910
  if (this._mode === "worker") throw Error("renderPage(canvas) is unavailable in mode: 'worker'; use renderPageToBitmap() and paint it via an ImageBitmapRenderingContext");
1911
1911
  if (!this._source) throw Error("Document not loaded");
1912
- return We(this._source, e, t, {
1912
+ return Ke(this._source, e, t, {
1913
1913
  ...this._withActiveView(n),
1914
- onDiagnostic: (e) => L(this, [e]),
1914
+ onDiagnostic: (e) => I(this, [e]),
1915
1915
  callerOwnedCanvasTarget: r,
1916
1916
  fetchImage: this._fetchImage,
1917
- layoutServices: A(this).services ?? void 0,
1918
- defaultCurrentDateMs: A(this).defaultCurrentDateMs,
1917
+ layoutServices: k(this).services ?? void 0,
1918
+ defaultCurrentDateMs: k(this).defaultCurrentDateMs,
1919
1919
  threeD: this._threeD,
1920
1920
  regionMap: this._regionMap,
1921
1921
  chartEx: this._chartEx,
@@ -1925,7 +1925,7 @@ var Q = class e {
1925
1925
  async renderPageToBitmap(e, t = {}) {
1926
1926
  let { onTextRun: n, ...r } = t, i = {
1927
1927
  ...this._withActiveView(r),
1928
- dpr: r.dpr ?? h()
1928
+ dpr: r.dpr ?? m()
1929
1929
  };
1930
1930
  if (this._mode === "worker") {
1931
1931
  let t = new OffscreenCanvas(1, 1), r = await this._bridge.request((n) => ({
@@ -1936,9 +1936,9 @@ var Q = class e {
1936
1936
  canvas: t
1937
1937
  }), [t]);
1938
1938
  try {
1939
- if (L(this, r.diagnostics), n) for (let e of r.runs) n(e);
1939
+ if (I(this, r.diagnostics), n) for (let e of r.runs) n(e);
1940
1940
  } catch (e) {
1941
- throw b(r.bitmap), e;
1941
+ throw ee(r.bitmap), e;
1942
1942
  }
1943
1943
  return r.bitmap;
1944
1944
  }
@@ -1956,9 +1956,9 @@ var Q = class e {
1956
1956
  pageIndex: e,
1957
1957
  opts: n
1958
1958
  }))).runs;
1959
- let r = A(this), i = r.services;
1959
+ let r = k(this), i = r.services;
1960
1960
  if (!i) throw Error("Document layout services are not initialized");
1961
- return je(i, e, {
1961
+ return Ne(i, e, {
1962
1962
  currentDate: n.currentDate,
1963
1963
  defaultCurrentDateMs: r.defaultCurrentDateMs,
1964
1964
  width: n.width,
@@ -1967,7 +1967,7 @@ var Q = class e {
1967
1967
  }
1968
1968
  async getCommentThreads(e, t = {}) {
1969
1969
  let { includeResolved: n, ...r } = t, i = await this.collectPageRuns(e, r);
1970
- return $n(this.comments, this.commentAnchorRanges(), i, { includeResolved: n });
1970
+ return tr(this.comments, this.commentAnchorRanges(), i, { includeResolved: n });
1971
1971
  }
1972
1972
  async getElementContextAt(e, t, n = {}) {
1973
1973
  let r = this._withActiveView(n);
@@ -1978,37 +1978,37 @@ var Q = class e {
1978
1978
  point: t,
1979
1979
  opts: r
1980
1980
  }))).context;
1981
- let i = A(this), a = i.services;
1981
+ let i = k(this), a = i.services;
1982
1982
  if (!a) throw Error("Document layout services are not initialized");
1983
- return Rn(a, e, t, {
1983
+ return Bn(a, e, t, {
1984
1984
  ...r,
1985
1985
  defaultCurrentDateMs: i.defaultCurrentDateMs
1986
1986
  });
1987
1987
  }
1988
1988
  };
1989
- function Cr(e, t) {
1989
+ function Tr(e, t) {
1990
1990
  if (!e.eastAsianVert) return 1;
1991
1991
  let n = t(e.text);
1992
1992
  return !(n > 0) || e.w >= n ? 1 : e.w / n;
1993
1993
  }
1994
- function wr(e, t, n, r, i, a, o) {
1995
- e.innerHTML = "", D(e, "ooxmlSelectionSurface", "docx"), D(e, "pageIndex", o === void 0 ? void 0 : String(o));
1994
+ function Er(e, t, n, r, i, a, o) {
1995
+ e.innerHTML = "", E(e, "ooxmlSelectionSurface", "docx"), E(e, "pageIndex", o === void 0 ? void 0 : String(o));
1996
1996
  let s = e.ownerDocument ?? document;
1997
1997
  for (let [o, c] of t.entries()) {
1998
1998
  let t = s.createElement("span");
1999
- D(t, "ooxmlSelectionRun", "docx"), D(t, "runIndex", String(o)), c.paragraphId !== void 0 && D(t, "paragraphId", c.paragraphId), c.source !== void 0 && (D(t, "sourceStory", c.source.story), D(t, "sourceStoryInstance", c.source.storyInstance), D(t, "sourcePath", JSON.stringify(c.source.path))), t.textContent = c.text;
1999
+ E(t, "ooxmlSelectionRun", "docx"), E(t, "runIndex", String(o)), c.paragraphId !== void 0 && E(t, "paragraphId", c.paragraphId), c.source !== void 0 && (E(t, "sourceStory", c.source.story), E(t, "sourceStoryInstance", c.source.storyInstance), E(t, "sourcePath", JSON.stringify(c.source.path))), t.textContent = c.text;
2000
2000
  let l = c.transform ?? "";
2001
2001
  if (a && c.eastAsianVert) {
2002
- let e = Cr(c, a(c.font));
2002
+ let e = Tr(c, a(c.font));
2003
2003
  e !== 1 && (l = `${l ? `${l} ` : ""}scaleX(${e})`);
2004
2004
  }
2005
- let u = l ? `transform:${l};transform-origin:top left;` : "", d = i ? c.hyperlink : void 0, f = d ? "pointer" : "text", p = c.letterSpacingPx === void 0 ? "0" : `${c.letterSpacingPx}px`, m = c.trailingSpaceCompressionPx === void 0 ? "" : `width:${T(c.w, n)};overflow:hidden;`;
2006
- t.style.cssText = `position:absolute;left:${T(c.x, n)};top:${T(c.y, r)};font:${c.font};line-height:${c.h}px;letter-spacing:${p};` + m + u + `white-space:pre;color:transparent;cursor:${f};pointer-events:all;`, d && i && (t.title = d.kind === "external" ? d.url : d.ref, t.addEventListener("click", (e) => {
2005
+ let u = l ? `transform:${l};transform-origin:top left;` : "", d = i ? c.hyperlink : void 0, f = d ? "pointer" : "text", p = c.letterSpacingPx === void 0 ? "0" : `${c.letterSpacingPx}px`, m = c.trailingSpaceCompressionPx === void 0 ? "" : `width:${w(c.w, n)};overflow:hidden;`;
2006
+ t.style.cssText = `position:absolute;left:${w(c.x, n)};top:${w(c.y, r)};font:${c.font};line-height:${c.h}px;letter-spacing:${p};` + m + u + `white-space:pre;color:transparent;cursor:${f};pointer-events:all;`, d && i && (t.title = d.kind === "external" ? d.url : d.ref, t.addEventListener("click", (e) => {
2007
2007
  e.preventDefault(), i(d);
2008
2008
  })), e.appendChild(t);
2009
2009
  }
2010
2010
  }
2011
- function Tr(e, t, n, r, i, a, o = {}) {
2011
+ function Dr(e, t, n, r, i, a, o = {}) {
2012
2012
  e.innerHTML = "";
2013
2013
  let s = o.match ?? "rgba(255, 214, 0, 0.42)", c = o.active ?? "rgba(255, 140, 0, 0.55)";
2014
2014
  for (let o of n) {
@@ -2016,14 +2016,14 @@ function Tr(e, t, n, r, i, a, o = {}) {
2016
2016
  for (let s of o.slices) {
2017
2017
  let o = t[s.runIndex];
2018
2018
  if (!o) continue;
2019
- let c = a(o.font), l = ne(o.text, s.start, s.end, c), u = o.letterSpacingPx ?? 0, d = Math.max(0, Math.min(s.start, o.text.length)), f = Math.max(d, Math.min(s.end, o.text.length)), p = qe(o.text.slice(d, f)).pitchBearing, m = qe(o.text.slice(0, d)).pitchBearing, h = l.x + m * u, g = l.width + Math.max(0, p - 1) * u, _ = Cr(o, c), v = h * _, y = g * _;
2020
- if (y <= 0) continue;
2021
- let b = document.createElement("div"), x = o.transform ? `transform:${o.transform};transform-origin:top left;` : "";
2022
- b.style.cssText = `position:absolute;left:${T(o.x + v, r)};top:${T(o.y, i)};width:${T(y, r)};height:${T(o.h, i)};` + x + `background:${n};pointer-events:none;`, e.appendChild(b);
2019
+ let c = a(o.font), l = C(o.text, s.start, s.end, c), u = o.letterSpacingPx ?? 0, d = Math.max(0, Math.min(s.start, o.text.length)), f = Math.max(d, Math.min(s.end, o.text.length)), p = Ye(o.text.slice(d, f)).pitchBearing, m = Ye(o.text.slice(0, d)).pitchBearing, h = l.x + m * u, g = l.width + Math.max(0, p - 1) * u, _ = Tr(o, c), ee = h * _, v = g * _;
2020
+ if (v <= 0) continue;
2021
+ let y = document.createElement("div"), te = o.transform ? `transform:${o.transform};transform-origin:top left;` : "";
2022
+ y.style.cssText = `position:absolute;left:${w(o.x + ee, r)};top:${w(o.y, i)};width:${w(v, r)};height:${w(o.h, i)};` + te + `background:${n};pointer-events:none;`, e.appendChild(y);
2023
2023
  }
2024
2024
  }
2025
2025
  }
2026
- var Er = class extends w {
2026
+ var Or = class extends ie {
2027
2027
  constructor(e, t) {
2028
2028
  super(e, t, (e) => ({ page: e }));
2029
2029
  }
@@ -2040,7 +2040,7 @@ var Er = class extends w {
2040
2040
  return this.activeUnit();
2041
2041
  }
2042
2042
  };
2043
- function Dr(e, t, n, r, i = {}) {
2043
+ function kr(e, t, n, r, i = {}) {
2044
2044
  let a = e.find((e) => e.id === n && e.parentId === void 0);
2045
2045
  if (!a) return null;
2046
2046
  let o = new Map(e.map((e) => [e.id, e])), s = e.filter((e) => {
@@ -2054,7 +2054,7 @@ function Dr(e, t, n, r, i = {}) {
2054
2054
  t = e;
2055
2055
  }
2056
2056
  return !1;
2057
- }), c = Oe({
2057
+ }), c = Ae({
2058
2058
  id: a.id,
2059
2059
  author: a.author,
2060
2060
  date: a.date,
@@ -2083,14 +2083,14 @@ function Dr(e, t, n, r, i = {}) {
2083
2083
  maxTextCharacters: c.maxTextCharacters
2084
2084
  });
2085
2085
  }
2086
- function Or(e) {
2086
+ function Ar(e) {
2087
2087
  for (let t = e; t; t = t.parentElement) {
2088
- let e = Ee(t.dataset.pageIndex);
2088
+ let e = Oe(t.dataset.pageIndex);
2089
2089
  if (e !== null) return e;
2090
2090
  }
2091
2091
  return null;
2092
2092
  }
2093
- var kr = new Set([
2093
+ var jr = new Set([
2094
2094
  "body",
2095
2095
  "header",
2096
2096
  "footer",
@@ -2098,9 +2098,9 @@ var kr = new Set([
2098
2098
  "endnote",
2099
2099
  "textbox"
2100
2100
  ]);
2101
- function Ar(e) {
2101
+ function Mr(e) {
2102
2102
  let t = e.dataset.sourceStory, n = e.dataset.sourceStoryInstance, r = e.dataset.sourcePath;
2103
- if (!t || !kr.has(t) || !n || !r) return null;
2103
+ if (!t || !jr.has(t) || !n || !r) return null;
2104
2104
  try {
2105
2105
  let e = JSON.parse(r);
2106
2106
  return !Array.isArray(e) || e.length === 0 || e.length > 32 || !e.every((e) => Number.isSafeInteger(e) && e >= 0) ? null : {
@@ -2112,14 +2112,14 @@ function Ar(e) {
2112
2112
  return null;
2113
2113
  }
2114
2114
  }
2115
- function $(e, t, n = {}) {
2116
- let r = ht(e, t, (e) => {
2117
- let t = Or(e), n = Ee(e.dataset.runIndex);
2115
+ function Q(e, t, n = {}) {
2116
+ let r = _t(e, t, (e) => {
2117
+ let t = Ar(e), n = Oe(e.dataset.runIndex);
2118
2118
  return t === null || n === null ? null : {
2119
2119
  pageIndex: t,
2120
2120
  runIndex: n,
2121
2121
  ...e.dataset.paragraphId === void 0 ? {} : { paragraphId: e.dataset.paragraphId },
2122
- ...Ar(e) === null ? {} : { source: Ar(e) }
2122
+ ...Mr(e) === null ? {} : { source: Mr(e) }
2123
2123
  };
2124
2124
  }, {
2125
2125
  maxChars: n.maxTextCharacters,
@@ -2141,10 +2141,10 @@ function $(e, t, n = {}) {
2141
2141
  maxRunLocators: r.maxLocators
2142
2142
  };
2143
2143
  }
2144
- function jr(e, t, n, r, i) {
2144
+ function $(e, t, n, r, i) {
2145
2145
  return r === "worker" ? e.renderPageToBitmap(n, i) : e.renderPage(t, n, i);
2146
2146
  }
2147
- var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2147
+ var Nr = Symbol("DocxViewer.borrowedDocument"), Pr = class e {
2148
2148
  _pendingLoadAbort = null;
2149
2149
  _pendingRequestedView;
2150
2150
  _pendingViewChanged = null;
@@ -2186,30 +2186,30 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2186
2186
  _elementClickListener = null;
2187
2187
  _contextMenuListener = null;
2188
2188
  static fromDocument(t, n, r = {}) {
2189
- let i = Y(n);
2189
+ let i = J(n);
2190
2190
  return new e(t, {
2191
2191
  ...r,
2192
2192
  currentDate: i.currentDate,
2193
2193
  showTrackedChanges: i.showTrackedChanges,
2194
- [Mr]: n
2194
+ [Nr]: n
2195
2195
  });
2196
2196
  }
2197
2197
  constructor(e, t = {}) {
2198
2198
  this._canvas = e, this._opts = t, this._showTrackedChangesExplicit = t.showTrackedChanges !== void 0;
2199
- let n = t[Mr];
2200
- this._borrowed = n !== void 0, this._mode = Et("DocxViewer", t.mode, n), this._documentOwner = new xt("DocxViewer", n ?? null, !1);
2199
+ let n = t[Nr];
2200
+ this._borrowed = n !== void 0, this._mode = Ot("DocxViewer", t.mode, n), this._documentOwner = new Ct("DocxViewer", n ?? null, !1);
2201
2201
  let r = e.ownerDocument?.defaultView ?? (typeof window < "u" ? window : null);
2202
2202
  if (!r) throw Error("DocxViewer requires a canvas with an active Window");
2203
- this._hostWindow = r, this._canvasMount = new Tt(e, {
2203
+ this._hostWindow = r, this._canvasMount = new Dt(e, {
2204
2204
  wrapperCssText: "position:relative;display:inline-block;vertical-align:top;",
2205
2205
  forceDisplayBlock: !0
2206
- }), this._wrapper = this._canvasMount.wrapper, this._renderDispatcher = new pt(e, this._mode === "worker"), this._errorRouter = new vt("DocxViewer", t.onError);
2207
- let i = new Ct(this._wrapper, t.enableTextSelection === !0, t.enableElementSelection === !0);
2208
- this._textLayer = i.textLayer, this._highlightLayer = i.highlightLayer, this._elementLayer = i.elementLayer, this._loadingIndicator = new bt(this._wrapper, "Loading page");
2206
+ }), this._wrapper = this._canvasMount.wrapper, this._renderDispatcher = new ht(e, this._mode === "worker"), this._errorRouter = new bt("DocxViewer", t.onError);
2207
+ let i = new Tt(this._wrapper, t.enableTextSelection === !0, t.enableElementSelection === !0);
2208
+ this._textLayer = i.textLayer, this._highlightLayer = i.highlightLayer, this._elementLayer = i.elementLayer, this._loadingIndicator = new St(this._wrapper, "Loading page");
2209
2209
  let a = this._wrapper.ownerDocument.createElement("progress");
2210
2210
  a.setAttribute("aria-hidden", "true"), this._loadingIndicator.layer.appendChild(a), this._wrapper.insertBefore(this._loadingIndicator.layer, this._elementLayer), this._textLayer && (t.onSelectionContextChange || t.enableElementSelection) && (this._selectionChangeListener = () => this._emitSelectionContextChange(), this._wrapper.ownerDocument.addEventListener("selectionchange", this._selectionChangeListener)), t.enableElementSelection && (this._elementClickListener = (e) => {
2211
2211
  this._onElementClick(e).catch((e) => this._reportRenderError(e));
2212
- }, this._wrapper.addEventListener("click", this._elementClickListener)), t.onContextMenu && (this._contextMenuListener = (e) => this._onContextMenu(e), this._wrapper.addEventListener("contextmenu", this._contextMenuListener)), this._find = new Er(() => this.pageCount, (e) => this._collectPageRuns(e)), n && this._bindLayoutDocument(n);
2212
+ }, this._wrapper.addEventListener("click", this._elementClickListener)), t.onContextMenu && (this._contextMenuListener = (e) => this._onContextMenu(e), this._wrapper.addEventListener("contextmenu", this._contextMenuListener)), this._find = new Or(() => this.pageCount, (e) => this._collectPageRuns(e)), n && this._bindLayoutDocument(n);
2213
2213
  }
2214
2214
  async load(e) {
2215
2215
  if (this._destroyed) throw Error("DocxViewer is destroyed");
@@ -2220,7 +2220,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2220
2220
  this._pendingLoadAbort = r, this._pendingRequestedView = n;
2221
2221
  try {
2222
2222
  let i = await this._documentOwner.replace(async () => {
2223
- let t = await Q.load(e, {
2223
+ let t = await Z.load(e, {
2224
2224
  password: this._opts.password,
2225
2225
  useGoogleFonts: this._opts.useGoogleFonts,
2226
2226
  allowFootnoteContinuation: this._opts.allowFootnoteContinuation,
@@ -2239,7 +2239,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2239
2239
  mode: this._mode,
2240
2240
  ...this._opts.progressiveLayout ? { progressiveLayout: !0 } : {},
2241
2241
  ...this._opts.sliceLayout === void 0 ? {} : { sliceLayout: this._opts.sliceLayout },
2242
- [vr]: {
2242
+ [br]: {
2243
2243
  signal: r.signal,
2244
2244
  requestedView: () => this._pendingRequestedView,
2245
2245
  subscribeViewChange: (e) => (this._pendingViewChanged = e, () => {
@@ -2253,7 +2253,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2253
2253
  ...this._opts.legacyDoc === void 0 ? void 0 : { legacyDoc: this._opts.legacyDoc },
2254
2254
  ...this._opts.currentDate === void 0 ? {} : { currentDate: this._opts.currentDate }
2255
2255
  });
2256
- return await hr(t, r.signal, () => this._pendingRequestedView, () => this._opts.currentDate, this), t;
2256
+ return await _r(t, r.signal, () => this._pendingRequestedView, () => this._opts.currentDate, this), t;
2257
2257
  }, () => {
2258
2258
  this._invalidateElementContext(!1), t = !0, this._renderDispatcher.begin(), this._findRequestGeneration++, this._find.invalidate(), this._unbindLayoutDocument();
2259
2259
  });
@@ -2312,7 +2312,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2312
2312
  await this.goToPage(this._currentPage - 1);
2313
2313
  }
2314
2314
  _naturalWidthPx() {
2315
- return !this._doc || this._doc.pageCount === 0 ? 0 : this._doc.pageSize(this._currentPage).widthPt * n;
2315
+ return !this._doc || this._doc.pageCount === 0 ? 0 : this._doc.pageSize(this._currentPage).widthPt * r;
2316
2316
  }
2317
2317
  _renderWidth() {
2318
2318
  if (this._scale === null) return this._opts.width;
@@ -2331,14 +2331,14 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2331
2331
  return this._opts.zoomMax ?? 4;
2332
2332
  }
2333
2333
  async setScale(e) {
2334
- let t = Dt(e, this._zoomMin(), this._zoomMax()), n = t !== this.getScale();
2334
+ let t = kt(e, this._zoomMin(), this._zoomMax()), n = t !== this.getScale();
2335
2335
  this._scale = t, await this._render(), n && this._opts.onScaleChange?.(t);
2336
2336
  }
2337
2337
  async zoomIn() {
2338
- await this.setScale(mt(this.getScale()));
2338
+ await this.setScale(gt(this.getScale()));
2339
2339
  }
2340
2340
  async zoomOut() {
2341
- await this.setScale(kt(this.getScale()));
2341
+ await this.setScale(jt(this.getScale()));
2342
2342
  }
2343
2343
  async fitWidth() {
2344
2344
  await this._fit("width");
@@ -2348,13 +2348,13 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2348
2348
  }
2349
2349
  async _fit(e) {
2350
2350
  if (!this._doc || this._doc.pageCount === 0) return;
2351
- let t = this._doc.pageSize(this._currentPage), r = this._fitContainer();
2352
- if (!r) return;
2353
- let i = At({
2354
- contentWidth: t.widthPt * n,
2355
- contentHeight: t.heightPt * n,
2356
- containerWidth: r.clientWidth,
2357
- containerHeight: r.clientHeight
2351
+ let t = this._doc.pageSize(this._currentPage), n = this._fitContainer();
2352
+ if (!n) return;
2353
+ let i = Mt({
2354
+ contentWidth: t.widthPt * r,
2355
+ contentHeight: t.heightPt * r,
2356
+ containerWidth: n.clientWidth,
2357
+ containerHeight: n.clientHeight
2358
2358
  }, e);
2359
2359
  i <= 0 || await this.setScale(i);
2360
2360
  }
@@ -2391,7 +2391,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2391
2391
  }
2392
2392
  getSelectionContext(e = {}) {
2393
2393
  if (this._destroyed) throw Error("DocxViewer is destroyed");
2394
- return (this._textLayer ? $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null, e) : null) ?? (this._elementContext ? zn(this._elementContext, e.maxTextCharacters) : null);
2394
+ return (this._textLayer ? Q(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null, e) : null) ?? (this._elementContext ? Vn(this._elementContext, e.maxTextCharacters) : null);
2395
2395
  }
2396
2396
  _emitSelectionContextChange() {
2397
2397
  let e = this.getSelectionContext();
@@ -2408,11 +2408,11 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2408
2408
  _redrawElementOutline() {
2409
2409
  let e = this._elementContext, t = this._doc;
2410
2410
  if (!e || !t || e.pageIndex !== this._currentPage) {
2411
- yt(this._elementLayer, null);
2411
+ xt(this._elementLayer, null);
2412
2412
  return;
2413
2413
  }
2414
2414
  let n = t.pageSize(e.pageIndex);
2415
- yt(this._elementLayer, {
2415
+ xt(this._elementLayer, {
2416
2416
  x: e.bounds.xPt / n.widthPt,
2417
2417
  y: e.bounds.yPt / n.heightPt,
2418
2418
  width: e.bounds.widthPt / n.widthPt,
@@ -2432,7 +2432,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2432
2432
  async _resolveContextAt(e) {
2433
2433
  let t = this._doc;
2434
2434
  if (this._destroyed || !t) return null;
2435
- if (this._textLayer && $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null)) return this._emitSelectionContextChange(), this._destroyed ? null : this.getSelectionContext();
2435
+ if (this._textLayer && Q(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null)) return this._emitSelectionContextChange(), this._destroyed ? null : this.getSelectionContext();
2436
2436
  if (!this._opts.enableElementSelection) return this.getSelectionContext();
2437
2437
  let n = this._canvas.getBoundingClientRect();
2438
2438
  if (n.width <= 0 || n.height <= 0) return this._invalidateElementContext(), null;
@@ -2446,7 +2446,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2446
2446
  }, {
2447
2447
  currentDate: this._opts.currentDate,
2448
2448
  showTrackedChanges: this._opts.showTrackedChanges,
2449
- maxTextCharacters: wn
2449
+ maxTextCharacters: En
2450
2450
  });
2451
2451
  } catch (e) {
2452
2452
  if (this._destroyed || a !== this._elementHitGeneration || o !== this._currentPage || t !== this._doc) return null;
@@ -2455,7 +2455,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2455
2455
  return this._destroyed || a !== this._elementHitGeneration || o !== this._currentPage || t !== this._doc ? null : (this._setElementContext(c), this._destroyed ? null : this.getSelectionContext());
2456
2456
  }
2457
2457
  destroy() {
2458
- this._destroyed || (this._destroyed = !0, this._pendingLoadAbort?.abort(), this._pendingLoadAbort = null, this._pendingViewChanged = null, this._findRequestGeneration++, this._layoutViewGeneration++, this._unbindLayoutDocument(), this._errorRouter.close(), this._renderDispatcher.destroy(), ze(this._canvas), this._documentOwner.close(), this._find.invalidate(), this._selectionChangeListener &&= (this._wrapper.ownerDocument.removeEventListener("selectionchange", this._selectionChangeListener), null), this._elementHitGeneration++, this._elementClickListener &&= (this._wrapper.removeEventListener("click", this._elementClickListener), null), this._contextMenuListener &&= (this._wrapper.removeEventListener("contextmenu", this._contextMenuListener), null), this._elementContext = null, this._canvasMount.restore());
2458
+ this._destroyed || (this._destroyed = !0, this._pendingLoadAbort?.abort(), this._pendingLoadAbort = null, this._pendingViewChanged = null, this._findRequestGeneration++, this._layoutViewGeneration++, this._unbindLayoutDocument(), this._errorRouter.close(), this._renderDispatcher.destroy(), Ve(this._canvas), this._documentOwner.close(), this._find.invalidate(), this._selectionChangeListener &&= (this._wrapper.ownerDocument.removeEventListener("selectionchange", this._selectionChangeListener), null), this._elementHitGeneration++, this._elementClickListener &&= (this._wrapper.removeEventListener("click", this._elementClickListener), null), this._contextMenuListener &&= (this._wrapper.removeEventListener("contextmenu", this._contextMenuListener), null), this._elementContext = null, this._canvasMount.restore());
2459
2459
  }
2460
2460
  async _render() {
2461
2461
  let e = this._renderDispatcher.begin();
@@ -2471,7 +2471,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2471
2471
  }
2472
2472
  async _renderPage(e) {
2473
2473
  if (!this._doc) return;
2474
- let t = this._mode === "worker", n = this._renderWidth(), r = this._doc.pageSize(this._currentPage), i = n ?? r.widthPt * 1.3333333333333333, a = r.widthPt > 0 ? i * r.heightPt / r.widthPt : 0, o = [], s = (e) => o.push(e), c = this._opts.dpr ?? h(), l = {
2474
+ let t = this._mode === "worker", n = this._renderWidth(), r = this._doc.pageSize(this._currentPage), i = n ?? r.widthPt * 1.3333333333333333, a = r.widthPt > 0 ? i * r.heightPt / r.widthPt : 0, o = [], s = (e) => o.push(e), c = this._opts.dpr ?? m(), l = {
2475
2475
  width: n,
2476
2476
  dpr: this._opts.dpr,
2477
2477
  imageResources: this._opts.imageResources,
@@ -2481,20 +2481,20 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2481
2481
  onTextRun: s
2482
2482
  };
2483
2483
  if (t) {
2484
- let t = await jr(this._doc, this._canvas, this._currentPage, "worker", l);
2484
+ let t = await $(this._doc, this._canvas, this._currentPage, "worker", l);
2485
2485
  if (!this._renderDispatcher.commitBitmap(e, t, {
2486
2486
  cssWidth: i > 0 ? i : Math.round(t.width / c),
2487
2487
  cssHeight: a > 0 ? a : Math.round(t.height / c)
2488
2488
  })) return;
2489
- } else if (await jr(this._doc, this._canvas, this._currentPage, "main", l), !this._renderDispatcher.isCurrent(e)) return;
2489
+ } else if (await $(this._doc, this._canvas, this._currentPage, "main", l), !this._renderDispatcher.isCurrent(e)) return;
2490
2490
  this._textLayer && this._buildTextLayer(this._textLayer, o), this._find.setPageRuns(this._currentPage, o), this._buildHighlightLayer(o), this._opts.onPageChange?.(this._currentPage, this.pageCount, this.layoutComplete);
2491
2491
  }
2492
2492
  _clearPresentedPage() {
2493
- this._renderDispatcher.begin(), ze(this._canvas), this._canvas.width = 0, this._canvas.height = 0, this._textLayer?.replaceChildren(), this._find.invalidate();
2493
+ this._renderDispatcher.begin(), Ve(this._canvas), this._canvas.width = 0, this._canvas.height = 0, this._textLayer?.replaceChildren(), this._find.invalidate();
2494
2494
  }
2495
2495
  _bindLayoutDocument(e) {
2496
2496
  this._unbindLayoutDocument(), this._layoutFailed = !1, this._layoutViewPublicationGeneration = 0;
2497
- let t = _r(e, (t) => this._onLayoutViewPublication(e, t), (e) => this._reportRenderError(e)), n = !0, r = ur(e, () => ({
2497
+ let t = yr(e, (t) => this._onLayoutViewPublication(e, t), (e) => this._reportRenderError(e)), n = !0, r = fr(e, () => ({
2498
2498
  pageCount: e.pageCount,
2499
2499
  exact: e.layoutComplete,
2500
2500
  complete: e.layoutComplete
@@ -2553,12 +2553,12 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2553
2553
  let t = this._pendingRequestedView !== e;
2554
2554
  this._pendingRequestedView = e, t && this._pendingViewChanged?.();
2555
2555
  }
2556
- let n = this._doc, r = this._opts.legacyDoc === void 0 ? this._opts.showTrackedChanges === !0 : n ? Y(n).showTrackedChanges : this._opts.showTrackedChanges === !0;
2556
+ let n = this._doc, r = this._opts.legacyDoc === void 0 ? this._opts.showTrackedChanges === !0 : n ? J(n).showTrackedChanges : this._opts.showTrackedChanges === !0;
2557
2557
  if ((!n || r === e) && (this._showTrackedChangesExplicit = !0, this._opts = {
2558
2558
  ...this._opts,
2559
2559
  showTrackedChanges: e
2560
2560
  }), r === e) {
2561
- n && await X(n, {
2561
+ n && await Y(n, {
2562
2562
  showTrackedChanges: e,
2563
2563
  currentDate: this._opts.currentDate
2564
2564
  }, this);
@@ -2568,7 +2568,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2568
2568
  ...this._opts,
2569
2569
  showTrackedChanges: e
2570
2570
  };
2571
- (!n || await X(n, {
2571
+ (!n || await Y(n, {
2572
2572
  showTrackedChanges: e,
2573
2573
  currentDate: i.currentDate
2574
2574
  }, this)) && (this._destroyed || t !== this._layoutViewGeneration || n !== this._doc || (this._showTrackedChangesExplicit = !0, this._opts = i, this._find.invalidate(), this._currentPage = Math.max(0, Math.min(this._currentPage, this.pageCount - 1)), await this._render()));
@@ -2577,7 +2577,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2577
2577
  let t = this._highlightLayer;
2578
2578
  if (!t) return;
2579
2579
  let { width: n, height: r } = this._canvasCssPx();
2580
- Tr(t, e, this._find.pageHighlights(this._currentPage), n, r, (e) => this._measureForFont(e), this._opts.findHighlightColors);
2580
+ Dr(t, e, this._find.pageHighlights(this._currentPage), n, r, (e) => this._measureForFont(e), this._opts.findHighlightColors);
2581
2581
  }
2582
2582
  _canvasCssPx() {
2583
2583
  return {
@@ -2602,12 +2602,12 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2602
2602
  }
2603
2603
  _buildTextLayer(e, t) {
2604
2604
  let { width: n, height: r } = this._canvasCssPx();
2605
- wr(e, t, n, r, this._hyperlinkHandler(), (e) => this._measureForFont(e), this._currentPage);
2605
+ Er(e, t, n, r, this._hyperlinkHandler(), (e) => this._measureForFont(e), this._currentPage);
2606
2606
  }
2607
2607
  _hyperlinkHandler() {
2608
2608
  return this._opts.enableHyperlinks === !1 ? void 0 : this._opts.onHyperlinkClick || ((e) => {
2609
2609
  if (e.kind === "external") {
2610
- C(e.url, void 0, this._hostWindow);
2610
+ x(e.url, void 0, this._hostWindow);
2611
2611
  return;
2612
2612
  }
2613
2613
  let t = this._doc;
@@ -2621,7 +2621,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2621
2621
  let r = e.getBookmarkPage(t);
2622
2622
  r !== void 0 && await this.goToPage(r);
2623
2623
  }
2624
- }, Pr = class {
2624
+ }, Fr = class {
2625
2625
  hooks;
2626
2626
  pageById = /* @__PURE__ */ new Map();
2627
2627
  runsByPage = /* @__PURE__ */ new Map();
@@ -2644,7 +2644,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2644
2644
  }
2645
2645
  indexPage(e, t, n) {
2646
2646
  if (!this.indexedPages.has(e)) {
2647
- for (let r of n) !this.pageById.has(r.commentId) && W(r, t).length > 0 && this.pageById.set(r.commentId, e);
2647
+ for (let r of n) !this.pageById.has(r.commentId) && U(r, t).length > 0 && this.pageById.set(r.commentId, e);
2648
2648
  for (this.indexedPages.add(e); this.indexedPages.has(this.frontier);) this.frontier++;
2649
2649
  }
2650
2650
  }
@@ -2694,13 +2694,13 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2694
2694
  let l = await this.runsForPage(s, n);
2695
2695
  if (this.hooks.destroyed()) throw Error("DocxScrollViewer is destroyed");
2696
2696
  if (this.hooks.document() !== n || r !== this.generation || !l) return !1;
2697
- let u = a.flatMap((e) => W(e, l))[0];
2697
+ let u = a.flatMap((e) => U(e, l))[0];
2698
2698
  return u ? (this.hooks.select(e, s, u, t), !0) : !1;
2699
2699
  }
2700
2700
  destroy() {
2701
2701
  this.reset();
2702
2702
  }
2703
- }, Fr = class {
2703
+ }, Ir = class {
2704
2704
  hooks;
2705
2705
  unsubscribe = null;
2706
2706
  viewGeneration = 0;
@@ -2716,7 +2716,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2716
2716
  }
2717
2717
  bind(e) {
2718
2718
  this.unbind(), this.viewGeneration = 0, this.prefix = e.pageCount;
2719
- let t = _r(e, (t) => this.onViewPublication(e, t), this.hooks.report), n = !0, r = ur(e, () => ({
2719
+ let t = yr(e, (t) => this.onViewPublication(e, t), this.hooks.report), n = !0, r = fr(e, () => ({
2720
2720
  pageCount: e.pageCount,
2721
2721
  exact: e.layoutComplete,
2722
2722
  complete: e.layoutComplete
@@ -2758,11 +2758,11 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
2758
2758
  destroy() {
2759
2759
  this.unbind();
2760
2760
  }
2761
- }, Ir = 12, Lr = 13, Rr = Symbol("DocxScrollViewer.borrowedDocument"), zr;
2762
- function Br() {
2763
- return zr ??= import("./comment-ui-runtime-DKlEfBPp.js");
2761
+ }, Lr = 12, Rr = 13, zr = Symbol("DocxScrollViewer.borrowedDocument"), Br;
2762
+ function Vr() {
2763
+ return Br ??= import("./comment-ui-runtime-C5eWtZSW.js");
2764
2764
  }
2765
- var Vr = class e {
2765
+ var Hr = class e {
2766
2766
  _pendingLoadAbort = null;
2767
2767
  _pendingRequestedView;
2768
2768
  _pendingViewChanged = null;
@@ -2785,12 +2785,12 @@ var Vr = class e {
2785
2785
  return this._shell.spacer;
2786
2786
  }
2787
2787
  _mode;
2788
- _viewport = new le({
2788
+ _viewport = new de({
2789
2789
  options: () => this._opts,
2790
2790
  container: () => this._container,
2791
2791
  scrollHost: () => this._scrollHost
2792
2792
  });
2793
- _zoom = new Se({
2793
+ _zoom = new we({
2794
2794
  scrollHost: () => this._scrollHost,
2795
2795
  spacer: () => this._spacer,
2796
2796
  count: () => this._doc?.pageCount ?? 0,
@@ -2802,8 +2802,8 @@ var Vr = class e {
2802
2802
  if (!this._doc) return null;
2803
2803
  let t = this._doc.pageSize(0);
2804
2804
  return {
2805
- width: (e === "width" ? this._widestPageWidthPt() : t.widthPt) * n,
2806
- height: t.heightPt * n
2805
+ width: (e === "width" ? this._widestPageWidthPt() : t.widthPt) * r,
2806
+ height: t.heightPt * r
2807
2807
  };
2808
2808
  },
2809
2809
  indexAt: (e) => this._pageIndexAtOffset(this._range(), e),
@@ -2829,7 +2829,7 @@ var Vr = class e {
2829
2829
  get _scaleEstablished() {
2830
2830
  return this._zoom.established;
2831
2831
  }
2832
- _scroller = new ue({
2832
+ _scroller = new fe({
2833
2833
  spacer: () => this._spacer,
2834
2834
  count: () => this._doc?.pageCount ?? 0,
2835
2835
  range: () => this._range(),
@@ -2847,7 +2847,7 @@ var Vr = class e {
2847
2847
  onExistingSlot: (e, t, n) => this._renderSlot(e, t, n)
2848
2848
  });
2849
2849
  _slots = this._scroller.slots;
2850
- _layout = new Fr({
2850
+ _layout = new Ir({
2851
2851
  current: () => this._doc,
2852
2852
  destroyed: () => this._destroyed,
2853
2853
  report: (e) => this._reportRenderError(e),
@@ -2879,14 +2879,14 @@ var Vr = class e {
2879
2879
  wantRuns: (e) => !!(this._opts.enableTextSelection && e.textLayer) || this._findActive || !!e.commentTintLayer,
2880
2880
  reportError: (e) => this._reportRenderError(e)
2881
2881
  };
2882
- _bitmap = new fe({
2882
+ _bitmap = new me({
2883
2883
  ...this._renderHooks,
2884
2884
  inFlight: () => this._scroller.inFlight,
2885
2885
  destroyed: () => this._destroyed,
2886
2886
  width: (e) => this._pageWidthPx(e),
2887
2887
  dpr: () => this._viewport.dpr(),
2888
2888
  canRetry: () => !0,
2889
- render: (e, t, n, r, i) => jr(this._doc, t, e, "worker", {
2889
+ render: (e, t, n, r, i) => $(this._doc, t, e, "worker", {
2890
2890
  width: n,
2891
2891
  dpr: r,
2892
2892
  imageResources: this._opts.imageResources,
@@ -2901,9 +2901,9 @@ var Vr = class e {
2901
2901
  }),
2902
2902
  commitRuns: (e, t, n, r, i) => this._commitRenderedRuns(e, t, n, t.canvas, i, !0)
2903
2903
  });
2904
- _main = new pe({
2904
+ _main = new he({
2905
2905
  ...this._renderHooks,
2906
- render: (e, t, n, r, i) => jr(this._doc, t, e, "main", {
2906
+ render: (e, t, n, r, i) => $(this._doc, t, e, "main", {
2907
2907
  width: n,
2908
2908
  dpr: r,
2909
2909
  imageResources: this._opts.imageResources,
@@ -2915,7 +2915,7 @@ var Vr = class e {
2915
2915
  commitRuns: (e, t, n, r, i, a, o) => this._commitRenderedRuns(e, t, n, r, a, o),
2916
2916
  shadow: () => this._pageShadow
2917
2917
  });
2918
- _navigation = new _e({
2918
+ _navigation = new ye({
2919
2919
  host: () => this._scrollHost,
2920
2920
  spacer: () => this._spacer,
2921
2921
  count: () => this.pageCount,
@@ -2929,7 +2929,7 @@ var Vr = class e {
2929
2929
  marginOrigin: () => this._commentMargin.originPx,
2930
2930
  mount: () => this._mountVisible()
2931
2931
  });
2932
- _selection = new ye({
2932
+ _selection = new xe({
2933
2933
  wrapper: () => this._wrapper,
2934
2934
  scrollHost: () => this._scrollHost,
2935
2935
  slots: () => this._slots,
@@ -2937,7 +2937,7 @@ var Vr = class e {
2937
2937
  destroyed: () => this._destroyed,
2938
2938
  textSelectionEnabled: () => this._opts.enableTextSelection === !0,
2939
2939
  elementSelectionEnabled: () => this._opts.enableElementSelection === !0,
2940
- textSelected: () => $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null) !== null,
2940
+ textSelected: () => Q(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null) !== null,
2941
2941
  getContext: () => this.getSelectionContext(),
2942
2942
  hitTest: (e, t, n, r) => {
2943
2943
  let i = e.pageSize(t);
@@ -2947,7 +2947,7 @@ var Vr = class e {
2947
2947
  }, {
2948
2948
  currentDate: this._currentDate,
2949
2949
  ...this._showTrackedChanges ? { showTrackedChanges: !0 } : {},
2950
- maxTextCharacters: wn
2950
+ maxTextCharacters: En
2951
2951
  });
2952
2952
  },
2953
2953
  outline: (e, t, n) => {
@@ -2972,8 +2972,8 @@ var Vr = class e {
2972
2972
  offsets: [],
2973
2973
  totalHeight: 0
2974
2974
  };
2975
- _visibleEvents = new be((e, t, n) => this._opts.onVisiblePageChange?.(e, t, n));
2976
- _loader = new se({
2975
+ _visibleEvents = new Se((e, t, n) => this._opts.onVisiblePageChange?.(e, t, n));
2976
+ _loader = new le({
2977
2977
  name: () => "DocxScrollViewer",
2978
2978
  borrowed: () => this._borrowed,
2979
2979
  borrowedMessage: () => "DocxScrollViewer.load() is unsupported on a Viewer created by fromDocument(); the borrowed document is already loaded.",
@@ -2990,7 +2990,7 @@ var Vr = class e {
2990
2990
  this._pendingLoadAbort === e && (this._pendingLoadAbort = null, this._pendingRequestedView = void 0, this._pendingViewChanged = null);
2991
2991
  },
2992
2992
  acquire: async (e, t) => {
2993
- let n = this._pendingRequestedView, r = await Q.load(e, {
2993
+ let n = this._pendingRequestedView, r = await Z.load(e, {
2994
2994
  password: this._opts.password,
2995
2995
  useGoogleFonts: this._opts.useGoogleFonts,
2996
2996
  allowFootnoteContinuation: this._opts.allowFootnoteContinuation,
@@ -3012,7 +3012,7 @@ var Vr = class e {
3012
3012
  ...this._opts.legacyDoc === void 0 ? void 0 : { legacyDoc: this._opts.legacyDoc },
3013
3013
  ...this._opts.progressiveLayout ? { progressiveLayout: !0 } : {},
3014
3014
  ...this._opts.sliceLayout === void 0 ? {} : { sliceLayout: this._opts.sliceLayout },
3015
- [vr]: {
3015
+ [br]: {
3016
3016
  signal: t.signal,
3017
3017
  requestedView: () => this._pendingRequestedView,
3018
3018
  subscribeViewChange: (e) => (this._pendingViewChanged = e, () => {
@@ -3023,7 +3023,7 @@ var Vr = class e {
3023
3023
  onLayoutPartial: this._opts.onLayoutPartial,
3024
3024
  onLayoutComplete: this._opts.onLayoutComplete
3025
3025
  });
3026
- return await hr(r, t.signal, () => this._pendingRequestedView, () => this._currentDate, this), r;
3026
+ return await _r(r, t.signal, () => this._pendingRequestedView, () => this._currentDate, this), r;
3027
3027
  },
3028
3028
  beforeReplace: (e) => {
3029
3029
  if (this._selection.invalidateElementContext(!1), this._findRequestGeneration++, this._find.invalidate(), this._findActive = !1, this._activeCommentId = null, this._activeCommentPage = null, this._commentNavigation.reset(), this._layout.unbind(), e) {
@@ -3032,7 +3032,7 @@ var Vr = class e {
3032
3032
  }
3033
3033
  },
3034
3034
  afterReplace: (e) => {
3035
- this._pendingRequestedView !== void 0 && (this._showTrackedChanges = this._pendingRequestedView, this._requestedShowTrackedChanges = this._pendingRequestedView), this._opts.legacyDoc !== void 0 && (this._showTrackedChanges = Y(e).showTrackedChanges), this._layout.bind(e), this._find.invalidate(), this._findActive = !1, this._activeCommentId = null, this._activeCommentPage = null, this._commentNavigation.reset();
3035
+ this._pendingRequestedView !== void 0 && (this._showTrackedChanges = this._pendingRequestedView, this._requestedShowTrackedChanges = this._pendingRequestedView), this._opts.legacyDoc !== void 0 && (this._showTrackedChanges = J(e).showTrackedChanges), this._layout.bind(e), this._find.invalidate(), this._findActive = !1, this._activeCommentId = null, this._activeCommentPage = null, this._commentNavigation.reset();
3036
3036
  },
3037
3037
  mountOpeningWindow: async () => {
3038
3038
  let e = [];
@@ -3046,7 +3046,7 @@ var Vr = class e {
3046
3046
  _internalHyperlinkGeneration = 0;
3047
3047
  _commentAnchorRangesForMargin = null;
3048
3048
  _commentAnchorIds = /* @__PURE__ */ new Set();
3049
- _commentMargin = new me({
3049
+ _commentMargin = new ge({
3050
3050
  container: () => this._container,
3051
3051
  scrollHost: () => this._scrollHost,
3052
3052
  spacer: () => this._spacer,
@@ -3055,11 +3055,11 @@ var Vr = class e {
3055
3055
  hasDisplayableComments: () => this._hasDisplayableComments(),
3056
3056
  requestedSide: () => this._commentsOptions()?.side,
3057
3057
  zoom: () => this._scaleEstablished ? this._scale : 1,
3058
- gapPx: Ir,
3058
+ gapPx: Lr,
3059
3059
  widthPx: 280,
3060
- fontSizePx: Lr
3060
+ fontSizePx: Rr
3061
3061
  });
3062
- _layers = new we({
3062
+ _layers = new Ee({
3063
3063
  markerLayer: (e) => e.commentTintLayer,
3064
3064
  syncMargin: (e) => this._commentMargin.syncMargin(e),
3065
3065
  marginSide: () => this._commentMargin.side(),
@@ -3077,7 +3077,7 @@ var Vr = class e {
3077
3077
  resetMarkerTransform: () => !0,
3078
3078
  resetDecorationVisibility: () => !1
3079
3079
  });
3080
- _commentNavigation = new Pr({
3080
+ _commentNavigation = new Fr({
3081
3081
  document: () => this._doc,
3082
3082
  destroyed: () => this._destroyed,
3083
3083
  scale: () => this._scale,
@@ -3091,7 +3091,7 @@ var Vr = class e {
3091
3091
  this._selection.emitChange();
3092
3092
  }
3093
3093
  });
3094
- _commentOverlay = new Ce({
3094
+ _commentOverlay = new Te({
3095
3095
  slots: () => this._slots,
3096
3096
  scale: () => this._scale,
3097
3097
  destroyed: () => this._destroyed,
@@ -3118,14 +3118,14 @@ var Vr = class e {
3118
3118
  this._zoom.prevBase = e;
3119
3119
  }
3120
3120
  _pageShadow;
3121
- _find = new Er(() => this.pageCount, (e) => this._collectPageRuns(e));
3121
+ _find = new Or(() => this.pageCount, (e) => this._collectPageRuns(e));
3122
3122
  _findActive = !1;
3123
- _highlights = new oe({
3123
+ _highlights = new ce({
3124
3124
  slots: () => this._slots,
3125
3125
  active: () => this._findActive,
3126
3126
  runs: (e) => this._find.pageRuns(e),
3127
3127
  setRuns: (e, t) => this._find.setPageRuns(e, t),
3128
- paint: (e, t, n, r) => Tr(t.highlightLayer, n, this._find.pageHighlights(e), this._pageWidthPx(e), this._pageHeightPx(e), r, this._opts.findHighlightColors),
3128
+ paint: (e, t, n, r) => Dr(t.highlightLayer, n, this._find.pageHighlights(e), this._pageWidthPx(e), this._pageHeightPx(e), r, this._opts.findHighlightColors),
3129
3129
  reveal: (e) => this.scrollToPage(e),
3130
3130
  unitOf: (e) => e.page
3131
3131
  });
@@ -3134,19 +3134,19 @@ var Vr = class e {
3134
3134
  _currentDate;
3135
3135
  _layoutViewGeneration = 0;
3136
3136
  static fromDocument(t, n, r = {}) {
3137
- let i = Y(n);
3137
+ let i = J(n);
3138
3138
  return new e(t, {
3139
3139
  ...r,
3140
3140
  currentDate: i.currentDate,
3141
3141
  showTrackedChanges: i.showTrackedChanges,
3142
- [Rr]: n
3142
+ [zr]: n
3143
3143
  });
3144
3144
  }
3145
3145
  constructor(e, t = {}) {
3146
3146
  if (e.tagName === "CANVAS") throw Error("DocxScrollViewer takes a container element (e.g. a <div>), not a <canvas> — the viewer creates and manages its own canvases. Pass a block container; for the single-page canvas API use DocxViewer.");
3147
- this._container = e, this._opts = t, this._errorRouter = new vt("DocxScrollViewer", t.onError), this._showTrackedChanges = t.showTrackedChanges === !0, t.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = t.showTrackedChanges), this._currentDate = t.currentDate, this._pageShadow = t.pageShadow ?? "0 1px 3px rgba(0,0,0,0.2)";
3148
- let n = t[Rr];
3149
- this._borrowed = n !== void 0, n ? (this._documentOwner = new xt("DocxScrollViewer", n, !1), this._mode = Et("DocxScrollViewer", t.mode, n)) : (this._documentOwner = new xt("DocxScrollViewer"), this._mode = Et("DocxScrollViewer", t.mode, void 0)), this._shell = new Te(e, {
3147
+ this._container = e, this._opts = t, this._errorRouter = new bt("DocxScrollViewer", t.onError), this._showTrackedChanges = t.showTrackedChanges === !0, t.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = t.showTrackedChanges), this._currentDate = t.currentDate, this._pageShadow = t.pageShadow ?? "0 1px 3px rgba(0,0,0,0.2)";
3148
+ let n = t[zr];
3149
+ this._borrowed = n !== void 0, n ? (this._documentOwner = new Ct("DocxScrollViewer", n, !1), this._mode = Ot("DocxScrollViewer", t.mode, n)) : (this._documentOwner = new Ct("DocxScrollViewer"), this._mode = Ot("DocxScrollViewer", t.mode, void 0)), this._shell = new De(e, {
3150
3150
  background: t.background,
3151
3151
  comments: !!t.comments,
3152
3152
  onScroll: () => this._onScroll(),
@@ -3157,7 +3157,7 @@ var Vr = class e {
3157
3157
  this._selection.emitChange();
3158
3158
  }
3159
3159
  }
3160
- }), this._commentsEnabled() && Br().then((e) => {
3160
+ }), this._commentsEnabled() && Vr().then((e) => {
3161
3161
  if (!this._destroyed) {
3162
3162
  this._commentUi = e;
3163
3163
  for (let [e, t] of this._slots) this._redrawSlotComments(e, t);
@@ -3185,10 +3185,10 @@ var Vr = class e {
3185
3185
  }
3186
3186
  }
3187
3187
  _pageWidthPx(e) {
3188
- return this._doc.pageSize(e).widthPt * n * this._scale;
3188
+ return this._doc.pageSize(e).widthPt * r * this._scale;
3189
3189
  }
3190
3190
  _pageHeightPx(e) {
3191
- return this._doc.pageSize(e).heightPt * n * this._scale;
3191
+ return this._doc.pageSize(e).heightPt * r * this._scale;
3192
3192
  }
3193
3193
  _hasDisplayableComments() {
3194
3194
  if (!this._commentsEnabled()) return !1;
@@ -3219,7 +3219,7 @@ var Vr = class e {
3219
3219
  let e = this._viewport.fitWidth();
3220
3220
  if (e <= 0) return 0;
3221
3221
  let t = this._widestPageWidthPt();
3222
- return t <= 0 ? 0 : e / (t * n);
3222
+ return t <= 0 ? 0 : e / (t * r);
3223
3223
  }
3224
3224
  relayout() {
3225
3225
  this._relayout();
@@ -3240,7 +3240,7 @@ var Vr = class e {
3240
3240
  _recomputeHeights() {
3241
3241
  let e = Math.min(this._layout.presentedPageCount, this._doc.pageCount), t = Array(e);
3242
3242
  for (let n = 0; n < e; n++) t[n] = this._pageHeightPx(n);
3243
- this._heights = t, this._scrollGeometry = te(t, this._viewport.gap(), this._viewport.verticalPadding());
3243
+ this._heights = t, this._scrollGeometry = S(t, this._viewport.gap(), this._viewport.verticalPadding());
3244
3244
  }
3245
3245
  _pageIndexAtOffset(e, t) {
3246
3246
  let { offsets: n } = e, r = 0, i = n.length - 1, a = 0;
@@ -3251,7 +3251,7 @@ var Vr = class e {
3251
3251
  return a;
3252
3252
  }
3253
3253
  _range() {
3254
- return ge(this._scrollGeometry, this._scrollHost.scrollTop, this._scrollHost.clientHeight, this._viewport.overscan());
3254
+ return ve(this._scrollGeometry, this._scrollHost.scrollTop, this._scrollHost.clientHeight, this._viewport.overscan());
3255
3255
  }
3256
3256
  _syncSpacer() {
3257
3257
  this._scroller.syncSpacer();
@@ -3274,7 +3274,7 @@ var Vr = class e {
3274
3274
  this._doc && this._visibleEvents.publish(e, this._doc.pageCount, this.layoutComplete);
3275
3275
  }
3276
3276
  _createSlot() {
3277
- let { wrapper: e, canvas: t, textLayer: n, highlightLayer: r } = ve(this._scrollHost, this._opts.enableTextSelection === !0, this._pageShadow), { markerLayer: i, margin: a, decorationLayer: o } = xe(e, this._commentsEnabled(), this._commentsOptions()?.cards !== !1, this._commentsOptions()?.connectors !== void 0, (e) => this._commentMargin.syncMargin(e)), s = wt(e, this._opts.enableElementSelection === !0);
3277
+ let { wrapper: e, canvas: t, textLayer: n, highlightLayer: r } = be(this._scrollHost, this._opts.enableTextSelection === !0, this._pageShadow), { markerLayer: i, margin: a, decorationLayer: o } = Ce(e, this._commentsEnabled(), this._commentsOptions()?.cards !== !1, this._commentsOptions()?.connectors !== void 0, (e) => this._commentMargin.syncMargin(e)), s = Et(e, this._opts.enableElementSelection === !0);
3278
3278
  return this._scrollHost.appendChild(e), {
3279
3279
  wrapper: e,
3280
3280
  canvas: t,
@@ -3288,14 +3288,14 @@ var Vr = class e {
3288
3288
  commentGeometry: null,
3289
3289
  renderedPage: -1,
3290
3290
  renderedScale: -1,
3291
- dispatcher: new pt(t, this._mode === "worker")
3291
+ dispatcher: new ht(t, this._mode === "worker")
3292
3292
  };
3293
3293
  }
3294
3294
  _recycleSlot(e, t) {
3295
3295
  this._scroller.recycleSlot(e, t);
3296
3296
  }
3297
3297
  _resetSlot(e, t) {
3298
- t.dispatcher.destroy(), this._destroyed || (t.dispatcher = new pt(t.canvas, this._mode === "worker")), this._layers.reset(t), t.commentRuns = Object.freeze([]), t.commentGeometry = null, t.renderedPage = -1, t.renderedScale = -1, t.wrapper.remove();
3298
+ t.dispatcher.destroy(), this._destroyed || (t.dispatcher = new ht(t.canvas, this._mode === "worker")), this._layers.reset(t), t.commentRuns = Object.freeze([]), t.commentGeometry = null, t.renderedPage = -1, t.renderedScale = -1, t.wrapper.remove();
3299
3299
  }
3300
3300
  _positionSlot(e, t, n) {
3301
3301
  this._layers.position(t, e, n.offsets[t], this._pageWidthPx(t), this._pageHeightPx(t), this._scrollHost.clientWidth, this._viewport.horizontalPadding().left);
@@ -3309,7 +3309,7 @@ var Vr = class e {
3309
3309
  _hyperlinkHandler() {
3310
3310
  return this._opts.enableHyperlinks === !1 ? void 0 : this._opts.onHyperlinkClick || ((e) => {
3311
3311
  if (e.kind === "external") {
3312
- C(e.url);
3312
+ x(e.url);
3313
3313
  return;
3314
3314
  }
3315
3315
  let t = this._doc;
@@ -3332,7 +3332,7 @@ var Vr = class e {
3332
3332
  _commitRenderedRuns(e, t, n, r, i, a) {
3333
3333
  if (t.textLayer && (a && this._clearTextLayerPreview(t.textLayer), this._opts.enableTextSelection)) {
3334
3334
  let { width: i, height: a } = this._canvasCssPx(r);
3335
- wr(t.textLayer, n, i, a, this._hyperlinkHandler(), (e) => this._highlights.measure(e), e);
3335
+ Er(t.textLayer, n, i, a, this._hyperlinkHandler(), (e) => this._highlights.measure(e), e);
3336
3336
  }
3337
3337
  i && this._highlights.refreshRuns(e, n), this._commitCommentRuns(e, t, n), this._highlights.redrawSlot(e, t);
3338
3338
  }
@@ -3367,7 +3367,7 @@ var Vr = class e {
3367
3367
  this._positionSlot(e, t, n), this._layers.preview(e, this._pageWidthPx(t), this._pageHeightPx(t), this._scale);
3368
3368
  }
3369
3369
  _clearTextLayerPreview(e) {
3370
- de(e);
3370
+ pe(e);
3371
3371
  }
3372
3372
  _scheduleSettle() {
3373
3373
  this._scroller.scheduleSettle(150);
@@ -3389,13 +3389,13 @@ var Vr = class e {
3389
3389
  }
3390
3390
  let n = this._doc;
3391
3391
  if (this._opts.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = e), this._showTrackedChanges === e) {
3392
- n && await X(n, {
3392
+ n && await Y(n, {
3393
3393
  showTrackedChanges: e,
3394
3394
  currentDate: this._currentDate
3395
3395
  }, this);
3396
3396
  return;
3397
3397
  }
3398
- (!n || await X(n, {
3398
+ (!n || await Y(n, {
3399
3399
  showTrackedChanges: e,
3400
3400
  currentDate: this._currentDate
3401
3401
  }, this)) && (this._destroyed || t !== this._layoutViewGeneration || n !== this._doc || (this._showTrackedChanges = e, this._opts.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = e), this._find.invalidate(), this._layout.apply({
@@ -3472,13 +3472,13 @@ var Vr = class e {
3472
3472
  }
3473
3473
  getSelectionContext(e = {}) {
3474
3474
  if (this._destroyed) throw Error("DocxScrollViewer is destroyed");
3475
- return (this._doc && this._activeCommentId !== null && this._activeCommentPage !== null ? Dr(this._doc.comments, this._doc.commentAnchorRanges(), this._activeCommentId, this._activeCommentPage, e) : null) || ((this._opts.enableTextSelection ? $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null, e) : null) ?? (this._selection.elementContext ? zn(this._selection.elementContext, e.maxTextCharacters) : null));
3475
+ return (this._doc && this._activeCommentId !== null && this._activeCommentPage !== null ? kr(this._doc.comments, this._doc.commentAnchorRanges(), this._activeCommentId, this._activeCommentPage, e) : null) || ((this._opts.enableTextSelection ? Q(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null, e) : null) ?? (this._selection.elementContext ? Vn(this._selection.elementContext, e.maxTextCharacters) : null));
3476
3476
  }
3477
3477
  destroy() {
3478
3478
  this._destroyed || (this._destroyed = !0, this._pendingLoadAbort?.abort(), this._pendingLoadAbort = null, this._pendingViewChanged = null, this._findRequestGeneration++, this._errorRouter.close(), this._layout.unbind(), this._layoutViewGeneration++, this._commentNavigation.reset(), this._find.invalidate(), this._findActive = !1, this._selection.destroy(), this._highlights.destroy(), this._commentOverlay.destroy(), this._selection.clearElementContext(), this._scroller.destroy(), this._zoom.destroy(), this._commentMargin.destroy(), this._documentOwner.close(), this._shell.destroy());
3479
3479
  }
3480
3480
  };
3481
- function Hr(e) {
3481
+ function Ur(e) {
3482
3482
  let t = [];
3483
3483
  for (let n of e.content) {
3484
3484
  if (n.type !== "paragraph") continue;
@@ -3488,24 +3488,24 @@ function Hr(e) {
3488
3488
  }
3489
3489
  return t.join(" ");
3490
3490
  }
3491
- var Ur = /* @__PURE__ */ e({
3492
- DocxDocument: () => Q,
3493
- DocxScrollViewer: () => Vr,
3494
- DocxViewer: () => Nr,
3495
- OoxmlDecodedImageLimitError: () => st,
3496
- OoxmlError: () => r,
3497
- OoxmlResourceLimitError: () => i,
3498
- TiffDecodeError: () => lt,
3499
- autoResize: () => ut,
3500
- buildDocxHighlightLayer: () => Tr,
3501
- buildDocxTextLayer: () => wr,
3502
- isOoxmlDecodedImageLimitError: () => ot,
3503
- isTiffDecodeError: () => ct,
3504
- noteText: () => Hr,
3505
- openExternalHyperlink: () => C,
3506
- readDocxTextSelectionContext: () => $,
3507
- resolveCommentAnchorRuns: () => W,
3508
- resolveDocxCommentThreads: () => $n,
3509
- resolveRevisionAnchorRuns: () => sr
3491
+ var Wr = /* @__PURE__ */ e({
3492
+ DocxDocument: () => Z,
3493
+ DocxScrollViewer: () => Hr,
3494
+ DocxViewer: () => Pr,
3495
+ OoxmlDecodedImageLimitError: () => lt,
3496
+ OoxmlError: () => t,
3497
+ OoxmlResourceLimitError: () => a,
3498
+ TiffDecodeError: () => dt,
3499
+ autoResize: () => ft,
3500
+ buildDocxHighlightLayer: () => Dr,
3501
+ buildDocxTextLayer: () => Er,
3502
+ isOoxmlDecodedImageLimitError: () => ct,
3503
+ isTiffDecodeError: () => ut,
3504
+ noteText: () => Ur,
3505
+ openExternalHyperlink: () => x,
3506
+ readDocxTextSelectionContext: () => Q,
3507
+ resolveCommentAnchorRuns: () => U,
3508
+ resolveDocxCommentThreads: () => tr,
3509
+ resolveRevisionAnchorRuns: () => lr
3510
3510
  });
3511
- export { sn as _, $ as a, Q as c, sr as d, W as f, L as g, mn as h, Nr as i, q as l, xn as m, Hr as n, Tr as o, $n as p, Vr as r, wr as s, Ur as t, lr as u };
3511
+ export { ln as _, Q as a, Z as c, lr as d, U as f, I as g, gn as h, Pr as i, K as l, Cn as m, Ur as n, Dr as o, tr as p, Hr as r, Er as s, Wr as t, dr as u };