@silurus/ooxml 0.89.7 → 0.89.9

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 (74) hide show
  1. package/README.md +9 -3
  2. package/dist/assets/render-worker-CSJJ7vFD.js +15 -0
  3. package/dist/assets/render-worker-Ck21oePL.js +16 -0
  4. package/dist/assets/render-worker-jGsxSIGb.js +35 -0
  5. package/dist/{bounded-raw-part-cache-B8t03tSP.js → bounded-raw-part-cache-B5a6cGKO.js} +1713 -1515
  6. package/dist/{canvas-viewer-mechanics-DI38gHNV.js → canvas-viewer-mechanics-BsqaoYgK.js} +2 -2
  7. package/dist/{cfb-guard-BIaHdonq.js → cfb-guard-DzYlucez.js} +1 -1
  8. package/dist/chart-ex.mjs +367 -367
  9. package/dist/{comment-overlay-controller-Crm5Syhx.js → comment-overlay-controller-b3tKmzMa.js} +29 -25
  10. package/dist/{comment-ui-runtime-DKlEfBPp.js → comment-ui-runtime-BlgDzQx_.js} +3 -3
  11. package/dist/{comment-ui-runtime-BfEPgl5r.js → comment-ui-runtime-Bp37ytDC.js} +3 -3
  12. package/dist/{document-model-source-xnkMoTZ_.js → document-model-source-BlMfm6po.js} +37 -37
  13. package/dist/{document-pull-client-CzhPbnY_.js → document-pull-client-_G-DIh2T.js} +17071 -13819
  14. package/dist/{document-pull-worker-Bkewz-So.js → document-pull-worker-hMKJ5RdB.js} +14 -14
  15. package/dist/{docx-BWyACb-n.js → docx-DE-Di6SH.js} +33 -33
  16. package/dist/{docx-BgCQiuuN.js → docx-Do90Z4L7.js} +593 -593
  17. package/dist/{docx-model-source-DCRFgO7-.js → docx-model-source-zYIufUjR.js} +6 -6
  18. package/dist/docx.mjs +4 -4
  19. package/dist/docx_parser_bg.wasm +0 -0
  20. package/dist/{drawingml-shape-BcXkRayC.js → drawingml-shape-B1_kg4BV.js} +55 -55
  21. package/dist/{duotone-BI7CoghW.js → duotone-GK4Hqn7f.js} +1 -1
  22. package/dist/{emf-DgUBx9BU.js → emf--QWY-UlT.js} +50 -50
  23. package/dist/{font-preload-demand-B6HPFxDp.js → font-preload-demand-NqcVKIpX.js} +2 -2
  24. package/dist/{grid-geometry-CqTDvpDr.js → grid-geometry-DpMAiSZb.js} +1 -1
  25. package/dist/{host-layout-measure-CXKOWA5J.js → host-layout-measure-IFLllYwV.js} +1 -1
  26. package/dist/index.mjs +3 -3
  27. package/dist/internal-companion.mjs +2 -2
  28. package/dist/{line-distribute-DR9Qwd3u.js → line-distribute-CwtditQo.js} +31 -25
  29. package/dist/{model-source-DcI3vC00.js → model-source-Cch44xsb.js} +2 -2
  30. package/dist/{model-source-session-BlQWNyj2.js → model-source-session-ClNCRDOg.js} +21 -21
  31. package/dist/{model-source-session-D0LF49Ve.js → model-source-session-DRcqFGfM.js} +2 -2
  32. package/dist/{model-source-session-BCteVilS.js → model-source-session-DSABX94B.js} +2 -2
  33. package/dist/node.mjs +5 -5
  34. package/dist/{plot-area-frame-D3JtHvov.js → plot-area-frame-DNYMd9Pf.js} +1914 -1890
  35. package/dist/{pptx-SmjDGyub.js → pptx-C1CiFW1D.js} +35 -33
  36. package/dist/{pptx-CfCiVlNB.js → pptx-DbjWegUB.js} +283 -266
  37. package/dist/{pptx-model-source-B2Irk68a.js → pptx-model-source-C9TuBisH.js} +18 -12
  38. package/dist/pptx-parsed-slides-BMGr4khe.js +8 -0
  39. package/dist/pptx.mjs +5 -5
  40. package/dist/pptx_parser_bg.wasm +0 -0
  41. package/dist/{presentation-model-source-DL6duh5l.js → presentation-model-source-DLNioq7T.js} +6 -6
  42. package/dist/region-map.mjs +39 -39
  43. package/dist/{render-CMUEAeHp.js → render-Bf_Gywxw.js} +32 -30
  44. package/dist/{render-worker-host-CZHIKTtZ.js → render-worker-host-CVr53kg0.js} +1 -1
  45. package/dist/{render-worker-host-CtlBbau5.js → render-worker-host-EgUrirnQ.js} +1 -1
  46. package/dist/{render-worker-host-G1fnymI8.js → render-worker-host-pKls3F_t.js} +1 -1
  47. package/dist/renderer-DpTePxGq.js +5887 -0
  48. package/dist/{renderer-B4KIpz-2.js → renderer-DuYC3xXi.js} +1336 -1224
  49. package/dist/{resource-measurement-D2bu0Qfx.js → resource-measurement-CfJtbwiR.js} +129 -129
  50. package/dist/{session-KIWcCCP2.js → session-DPXK_lpI.js} +64 -64
  51. package/dist/{slide-pull-client-BUuJQQVE.js → slide-pull-client-3g6TxaKa.js} +1421 -1421
  52. package/dist/{three-d-ByHGsYrX.js → three-d-BfMZVR0w.js} +98 -98
  53. package/dist/three-d.mjs +678 -678
  54. package/dist/types/chart-ex.d.ts +5 -2
  55. package/dist/types/docx.d.ts +30 -8
  56. package/dist/types/index.d.ts +37 -12
  57. package/dist/types/node.d.ts +28 -6
  58. package/dist/types/pptx.d.ts +13 -7
  59. package/dist/types/region-map.d.ts +5 -2
  60. package/dist/types/three-d.d.ts +5 -2
  61. package/dist/types/xlsx.d.ts +10 -7
  62. package/dist/{wasm-runtime-generation-BLweKv8r.js → wasm-runtime-generation-D97yoAXz.js} +17 -17
  63. package/dist/{workbook-model-source-J9ir5Kov.js → workbook-model-source-D1dmkDMP.js} +6 -6
  64. package/dist/{worksheet-pull-client-Du0MuIro.js → worksheet-pull-client-BudfclVl.js} +84 -84
  65. package/dist/{xlsx-BbQ7RcNc.js → xlsx-DA0uR1B1.js} +44 -44
  66. package/dist/{xlsx-ClQiNSrr.js → xlsx-DBhYlJKp.js} +728 -716
  67. package/dist/{xlsx-model-source-C-Riw89p.js → xlsx-model-source-zemVDAfl.js} +36 -36
  68. package/dist/xlsx.mjs +5 -5
  69. package/dist/xlsx_parser_bg.wasm +0 -0
  70. package/package.json +1 -1
  71. package/dist/assets/render-worker-B3hF7Akg.js +0 -35
  72. package/dist/assets/render-worker-B5HWxkbU.js +0 -16
  73. package/dist/assets/render-worker-DNGf06QT.js +0 -15
  74. package/dist/renderer-xdugdcMd.js +0 -5769
@@ -1,5 +1,5 @@
1
- import { _o as e } from "./plot-area-frame-D3JtHvov.js";
2
- import { C as t, Qt as n, b as r, g as i, h as a, on as o, sn as s, tn as c, w as l, x as u } from "./bounded-raw-part-cache-B8t03tSP.js";
1
+ import { So as e } from "./plot-area-frame-DNYMd9Pf.js";
2
+ import { C as t, D as n, E as r, in as i, ln as a, tn as o, un as s, v as c, w as l, y as u } from "./bounded-raw-part-cache-B5a6cGKO.js";
3
3
  function d(e, t, n, r, i, a = 0) {
4
4
  let o = e.map((e) => e.width), s = (t) => {
5
5
  let n = 0;
@@ -27,35 +27,35 @@ function d(e, t, n, r, i, a = 0) {
27
27
  return o;
28
28
  }
29
29
  var f = /^\p{Script_Extensions=Latin}$/u, p = (e) => e.type === "text" && e.text === " ", m = (e) => e.type === "text" && s(e.text.codePointAt(0) ?? 0);
30
- function h(e, i) {
31
- let a = i.sameStyle ?? ((e, t) => e === t), s = [[]], h = [], g = [-1], _ = [], v = 0;
30
+ function h(e, s) {
31
+ let c = s.sameStyle ?? ((e, t) => e === t), u = [[]], h = [], g = [-1], _ = [], v = 0;
32
32
  for (let t of e) {
33
- if (h.push(s.length - 1), t.type === "break") {
34
- _[s.length - 1] = v, s.push([]), g.push(-1), v++;
33
+ if (h.push(u.length - 1), t.type === "break") {
34
+ _[u.length - 1] = v, u.push([]), g.push(-1), v++;
35
35
  continue;
36
36
  }
37
37
  if (t.type === "object") {
38
- t.display && s.at(-1).length > 0 && (s.push([]), g.push(-1)), s.at(-1).push({
38
+ t.display && u.at(-1).length > 0 && (u.push([]), g.push(-1)), u.at(-1).push({
39
39
  type: "object",
40
40
  style: t.style,
41
41
  run: v,
42
42
  width: t.width,
43
43
  payload: t.payload
44
- }), t.display && (s.push([]), g.push(-1)), v++;
44
+ }), t.display && (u.push([]), g.push(-1)), v++;
45
45
  continue;
46
46
  }
47
47
  let e = [
48
48
  0,
49
- ...c(t.text),
49
+ ...i(t.text),
50
50
  t.text.length
51
51
  ];
52
52
  for (let n = 0; n + 1 < e.length; n++) {
53
53
  let r = t.text.slice(e[n], e[n + 1]);
54
- r === "\n" ? (s.push([]), g.push(v)) : r === " " ? s.at(-1).push({
54
+ r === "\n" ? (u.push([]), g.push(v)) : r === " " ? u.at(-1).push({
55
55
  type: "tab",
56
56
  style: t.style,
57
57
  run: v
58
- }) : r !== "\r" && s.at(-1).push({
58
+ }) : r !== "\r" && u.at(-1).push({
59
59
  type: "text",
60
60
  text: r,
61
61
  style: t.style,
@@ -65,46 +65,46 @@ function h(e, i) {
65
65
  v++;
66
66
  }
67
67
  let y = [], b = [], x = [], S = new Uint8Array(e.length);
68
- for (let e = 0; e < s.length; e++) {
69
- let c = s[e];
70
- if (b.push(y.length), e === s.length - 1) for (; c.length > 0 && p(c.at(-1));) c.pop();
71
- let h = c.length, v = /* @__PURE__ */ new Set();
72
- if (c.some((e) => e.type === "text" && n(e.text))) {
68
+ for (let e = 0; e < u.length; e++) {
69
+ let i = u[e];
70
+ if (b.push(y.length), e === u.length - 1) for (; i.length > 0 && p(i.at(-1));) i.pop();
71
+ let h = i.length, v = /* @__PURE__ */ new Set();
72
+ if (i.some((e) => e.type === "text" && o(e.text))) {
73
73
  let e = "", t = [0];
74
- for (let n of c) e += n.type === "text" ? n.text : "", t.push(e.length);
75
- let n = new Set(o(e, { cjk: !0 }));
74
+ for (let n of i) e += n.type === "text" ? n.text : "", t.push(e.length);
75
+ let n = new Set(a(e, { cjk: !0 }));
76
76
  for (let e = 1; e < t.length; e++) n.has(t[e]) && v.add(e);
77
77
  }
78
- let C = i.eastAsianLineBreak !== !1, w = (e) => e === 160 || e === 8239 || e === 8288 || e === 65279, T = (e) => {
78
+ let C = s.eastAsianLineBreak !== !1, w = (e) => e === 160 || e === 8239 || e === 8288 || e === 65279, T = (e) => {
79
79
  if (e <= 0 || e >= h) return !1;
80
- let t = c[e - 1], n = c[e];
81
- if (n.type === "tab") return !0;
82
- if (t.type === "tab") return !1;
83
- if (p(t) || p(n) || v.has(e) || t.type === "object" || n.type === "object") return !0;
84
- let i = [...t.text].at(-1)?.codePointAt(0), a = n.text.codePointAt(0);
85
- if (i === void 0 || a === void 0) return !1;
86
- if (i === 8203 || !C && (m(t) || m(n)) && !w(i) && !w(a)) return !0;
87
- if (r(i, a)) return !1;
88
- if (m(t) || m(n)) return !0;
89
- if (e > 1 && (u(i) === "HY" || u(i) === "HH")) {
90
- let t = c[e - 2];
91
- if (t.type === "text" && f.test([...t.text].at(-1) ?? "") && f.test([...n.text][0] ?? "")) return !0;
80
+ let n = i[e - 1], r = i[e];
81
+ if (r.type === "tab") return !0;
82
+ if (n.type === "tab") return !1;
83
+ if (p(n) || p(r) || v.has(e) || n.type === "object" || r.type === "object") return !0;
84
+ let a = [...n.text].at(-1)?.codePointAt(0), o = r.text.codePointAt(0);
85
+ if (a === void 0 || o === void 0) return !1;
86
+ if (a === 8203 || !C && (m(n) || m(r)) && !w(a) && !w(o)) return !0;
87
+ if (t(a, o)) return !1;
88
+ if (m(n) || m(r)) return !0;
89
+ if (e > 1 && (l(a) === "HY" || l(a) === "HH")) {
90
+ let t = i[e - 2];
91
+ if (t.type === "text" && f.test([...t.text].at(-1) ?? "") && f.test([...r.text][0] ?? "")) return !0;
92
92
  }
93
93
  return !1;
94
94
  }, E = new Uint8Array(h + 1);
95
95
  for (let e = 1; e < h; e++) E[e] = +!!T(e);
96
- let D = c[0]?.style, O = h > 0 && c.every((e) => e.type === "text" && a(D, e.style)) ? c.map((e) => e.type === "text" ? e.text : "").join("") : null, k = O === null ? null : new Int32Array(h + 1);
96
+ let D = i[0]?.style, O = h > 0 && i.every((e) => e.type === "text" && c(D, e.style)) ? i.map((e) => e.type === "text" ? e.text : "").join("") : null, k = O === null ? null : new Int32Array(h + 1);
97
97
  if (k) for (let e = 0; e < h; e++) {
98
- let t = c[e];
98
+ let t = i[e];
99
99
  k[e + 1] = k[e] + (t.type === "text" ? t.text.length : 0);
100
100
  }
101
101
  let A = null, j = 0, M = (e) => {
102
- let t = c[e], n = c[e + 1];
103
- if (t?.type !== "tab" || !i.tabStops?.length || n?.type !== "text" || !/^[\p{Script_Extensions=Latin}\p{Number}]$/u.test(n.text)) return !1;
102
+ let t = i[e], n = i[e + 1];
103
+ if (t?.type !== "tab" || !s.tabStops?.length || n?.type !== "text" || !/^[\p{Script_Extensions=Latin}\p{Number}]$/u.test(n.text)) return !1;
104
104
  if (A === null) {
105
105
  j = $, A = new Uint8Array(h - j + 1), A[h - j] = 1;
106
106
  for (let e = h - 1; e >= j; e--) {
107
- let t = c[e], n = e - j;
107
+ let t = i[e], n = e - j;
108
108
  A[n] = A[n + 1] && t.type === "text" && !p(t) && !m(t) ? 1 : 0;
109
109
  }
110
110
  }
@@ -114,7 +114,7 @@ function h(e, i) {
114
114
  P = $;
115
115
  let e = [], t = new Int32Array(h - P + 1);
116
116
  for (let n = P; n < h; n++) {
117
- let r = c[n];
117
+ let r = i[n];
118
118
  if (r.type === "text") for (let t of r.text) e.push(t);
119
119
  t[n + 1 - P] = e.length;
120
120
  }
@@ -124,12 +124,12 @@ function h(e, i) {
124
124
  };
125
125
  }
126
126
  return N;
127
- }, I = (e, t) => e.type === "text" && t.type === "text" && i.kinsokuAcrossRuns?.(e.style, t.style, e.text, t.text) === !0, L = null, R = 0, z = (e) => {
127
+ }, I = (e, t) => e.type === "text" && t.type === "text" && s.kinsokuAcrossRuns?.(e.style, t.style, e.text, t.text) === !0, L = null, R = 0, z = (e) => {
128
128
  if (L === null) {
129
129
  R = $, L = new Int32Array(h - $ + 1);
130
130
  let e = $ + 1;
131
131
  for (let t = $ + 1; t < h; t++) {
132
- let n = c[t - 1], r = c[t];
132
+ let n = i[t - 1], r = i[t];
133
133
  (n.type !== "text" || r.type !== "text" || n.run !== r.run && !I(n, r)) && (e = t), L[t - R] = e;
134
134
  }
135
135
  }
@@ -137,7 +137,7 @@ function h(e, i) {
137
137
  }, B = (e, t) => {
138
138
  if (t.type === "text") {
139
139
  let n = e.at(-1);
140
- if (n?.type === "text" && a(n.style, t.style)) {
140
+ if (n?.type === "text" && c(n.style, t.style)) {
141
141
  n.text += t.text;
142
142
  return;
143
143
  }
@@ -160,23 +160,23 @@ function h(e, i) {
160
160
  }, V = (e, t) => {
161
161
  let n = 0, r = e.map((t, r) => {
162
162
  if (t.type === "text") {
163
- t.width = i.measureText(t.text, t.style);
163
+ t.width = s.measureText(t.text, t.style);
164
164
  let n = e[r - 1];
165
- n?.type === "text" && (t.width += i.boundaryAdvance?.(n.style, t.style) ?? 0);
165
+ n?.type === "text" && (t.width += s.boundaryAdvance?.(n.style, t.style) ?? 0);
166
166
  }
167
- return t.type === "tab" && (t.width = 0, n = i.measureText(" ", t.style)), {
167
+ return t.type === "tab" && (t.width = 0, n = s.measureText(" ", t.style)), {
168
168
  isTab: t.type === "tab",
169
169
  width: t.width
170
170
  };
171
171
  });
172
172
  if (r.some((e) => e.isTab)) {
173
- let a = d(r, i.tabStops ?? [], i.tabStartPen?.(t) ?? (t === 0 ? i.firstLineIndent ?? 0 : 0), Infinity, n, i.defaultTabSize ?? 0);
174
- for (let t = 0; t < e.length; t++) e[t].width = a[t];
173
+ let i = d(r, s.tabStops ?? [], s.tabStartPen?.(t) ?? (t === 0 ? s.firstLineIndent ?? 0 : 0), Infinity, n, s.defaultTabSize ?? 0);
174
+ for (let t = 0; t < e.length; t++) e[t].width = i[t];
175
175
  }
176
176
  return e.reduce((e, t) => e + t.width, 0);
177
177
  }, H = (e, t, n) => {
178
178
  if (O !== null && k && D !== void 0) {
179
- let n = O.slice(k[e], k[t]), r = i.measureText(n, D);
179
+ let n = O.slice(k[e], k[t]), r = s.measureText(n, D);
180
180
  return {
181
181
  segments: [{
182
182
  type: "text",
@@ -188,7 +188,7 @@ function h(e, i) {
188
188
  };
189
189
  }
190
190
  let r = [];
191
- for (let n = e; n < t; n++) B(r, c[n]);
191
+ for (let n = e; n < t; n++) B(r, i[n]);
192
192
  return {
193
193
  segments: r,
194
194
  width: V(r, n)
@@ -196,7 +196,7 @@ function h(e, i) {
196
196
  }, U = null, W = (e, t) => {
197
197
  let n = "";
198
198
  for (let r = e; r < t; r++) {
199
- let e = c[r];
199
+ let e = i[r];
200
200
  e.type === "text" && (n += e.text);
201
201
  }
202
202
  return n;
@@ -208,33 +208,33 @@ function h(e, i) {
208
208
  }
209
209
  return t;
210
210
  }, K = () => {
211
- let e = new Int32Array(h).fill(-1), t = new Int32Array(h).fill(-1), n = new Float64Array(h).fill(NaN), r = new Float64Array(h), o = new Float64Array(h + 1), s = new Float64Array(h + 1), l = new Int32Array(h + 1), u = -1, d, f = null, p = 0, m = 0, g = (e) => {
211
+ let e = new Int32Array(h).fill(-1), t = new Int32Array(h).fill(-1), n = new Float64Array(h).fill(NaN), r = new Float64Array(h), a = new Float64Array(h + 1), o = new Float64Array(h + 1), l = new Int32Array(h + 1), u = -1, d, f = null, p = 0, m = 0, g = (e) => {
212
212
  for (let n = u; u >= 0 && n < e; n++) t[n] = e;
213
213
  };
214
214
  for (let t = 0; t < h; t++) {
215
- let h = c[t];
216
- if (l[t + 1] = l[t] + +(h.type === "tab"), h.type === "text" && u >= 0 && a(d, h.style) || (g(t), p = s[t], h.type === "text" ? (f = u >= 0 ? i.boundaryAdvance?.(d, h.style) ?? 0 : null, u = t, d = h.style) : (u = -1, d = void 0)), h.type === "text") {
217
- let a = d;
218
- if (e[t] = u, t - u <= 8) m = i.measureText(W(u, t + 1), a), n[t] = m;
215
+ let h = i[t];
216
+ if (l[t + 1] = l[t] + +(h.type === "tab"), h.type === "text" && u >= 0 && c(d, h.style) || (g(t), p = o[t], h.type === "text" ? (f = u >= 0 ? s.boundaryAdvance?.(d, h.style) ?? 0 : null, u = t, d = h.style) : (u = -1, d = void 0)), h.type === "text") {
217
+ let i = d;
218
+ if (e[t] = u, t - u <= 8) m = s.measureText(W(u, t + 1), i), n[t] = m;
219
219
  else {
220
220
  let e = W(t - 8, t);
221
- r[t] = i.measureText(e + h.text, a) - i.measureText(e, a), m += r[t];
221
+ r[t] = s.measureText(e + h.text, i) - s.measureText(e, i), m += r[t];
222
222
  }
223
- s[t + 1] = p + (f === null ? m : m + f);
224
- } else s[t + 1] = p + (h.type === "object" ? h.width : 0);
225
- o[t + 1] = o[t] + r[t];
223
+ o[t + 1] = p + (f === null ? m : m + f);
224
+ } else o[t + 1] = p + (h.type === "object" ? h.width : 0);
225
+ a[t + 1] = a[t] + r[t];
226
226
  }
227
227
  g(h);
228
228
  let _ = new Float64Array(h + 1);
229
- _[h] = s[h];
230
- for (let e = h - 1; e >= 0; e--) _[e] = Math.min(s[e], _[e + 1]);
229
+ _[h] = o[h];
230
+ for (let e = h - 1; e >= 0; e--) _[e] = Math.min(o[e], _[e + 1]);
231
231
  let v = new Float64Array(h + 1).fill(Infinity);
232
- for (let e = h; e >= 1; e--) c[e - 1].type === "text" && (v[e] = e === t[e - 1] ? o[e] : Math.min(o[e], v[e + 1]));
232
+ for (let e = h; e >= 1; e--) i[e - 1].type === "text" && (v[e] = e === t[e - 1] ? a[e] : Math.min(a[e], v[e + 1]));
233
233
  let y = new Int32Array(h), b = [];
234
234
  for (let e = 0; e < h; e++) {
235
- let t = c[e];
236
- if (t.type !== "tab" || (i.defaultTabSize ?? 0) > 0) continue;
237
- let n = i.measureText(" ", t.style), r = b.indexOf(n);
235
+ let t = i[e];
236
+ if (t.type !== "tab" || (s.defaultTabSize ?? 0) > 0) continue;
237
+ let n = s.measureText(" ", t.style), r = b.indexOf(n);
238
238
  r < 0 && (r = b.push(n) - 1), y[e] = r;
239
239
  }
240
240
  return b.length === 0 && b.push(0), {
@@ -242,10 +242,10 @@ function h(e, i) {
242
242
  segEnd: t,
243
243
  head: n,
244
244
  tail: r,
245
- tailSum: o,
246
- tailBlockMin: G(o),
247
- natural: s,
248
- naturalBlockMin: G(s),
245
+ tailSum: a,
246
+ tailBlockMin: G(a),
247
+ natural: o,
248
+ naturalBlockMin: G(o),
249
249
  naturalSuffixMin: _,
250
250
  tailSuffixMin: v,
251
251
  tabsBefore: l,
@@ -270,16 +270,16 @@ function h(e, i) {
270
270
  return e.head[r] + (e.tailSum[n] - e.tailSum[r + 1]);
271
271
  }
272
272
  let r = Math.min(n, t + 8 + 1), a = J.get(r);
273
- return a === void 0 && (a = i.measureText(W(t, r), c[t].style), J.set(r, a)), a + (e.tailSum[n] - e.tailSum[r]);
273
+ return a === void 0 && (a = s.measureText(W(t, r), i[t].style), J.set(r, a)), a + (e.tailSum[n] - e.tailSum[r]);
274
274
  }, ee = (e, t, n) => {
275
275
  let r = U ??= K();
276
276
  if (J.clear(), r.tabsBefore[h] !== r.tabsBefore[e]) return te(r, e, t, n);
277
- let a = c[e], o = a.type === "text" ? r.segEnd[e] : e + 1, s = a.type === "text" ? Y(r, e, o) : a.type === "object" ? a.width : 0;
277
+ let a = i[e], o = a.type === "text" ? r.segEnd[e] : e + 1, c = a.type === "text" ? Y(r, e, o) : a.type === "object" ? a.width : 0;
278
278
  if (o < h) {
279
- let t = c[o], l = a.type === "text" && t.type === "text" && i.boundaryAdvance ? i.boundaryAdvance(a.style, t.style) - i.boundaryAdvance(c[r.segStart[e]].style, t.style) : 0, u = q(r.natural, r.naturalBlockMin, s + l - r.natural[o], o, h, n);
279
+ let t = i[o], l = a.type === "text" && t.type === "text" && s.boundaryAdvance ? s.boundaryAdvance(a.style, t.style) - s.boundaryAdvance(i[r.segStart[e]].style, t.style) : 0, u = q(r.natural, r.naturalBlockMin, c + l - r.natural[o], o, h, n);
280
280
  if (u >= 0) return u;
281
281
  }
282
- if (s <= n) return o;
282
+ if (c <= n) return o;
283
283
  if (a.type !== "text") return e;
284
284
  let l = e + 8 + 1;
285
285
  if (o - 1 > l) {
@@ -289,13 +289,13 @@ function h(e, i) {
289
289
  for (let t = Math.min(o - 1, l); t > e; t--) if (Y(r, e, t) <= n) return t;
290
290
  return e;
291
291
  }, te = (e, t, n, r) => {
292
- let a = i.tabStartPen?.(n) ?? (n === 0 ? i.firstLineIndent ?? 0 : 0), o = i.tabStops ?? [], s = i.defaultTabSize ?? 0, l = e.gapValues, u = l.length, d = new Float64Array(u), f = new Float64Array(u).fill(a), p = new Float64Array(u), m = new Float64Array(u), g = new Float64Array(u), _ = new Uint8Array(u), v = new Float64Array(u), y = !1, b = 0, x = 0, S = !1, C = c[t], w = C.type === "text" ? e.segEnd[t] : t + 1, T = C.type === "text" ? Y(e, t, w) : C.type === "object" ? C.width : 0, E = c[w], D = T + (w < h && C.type === "text" && E.type === "text" && i.boundaryAdvance ? i.boundaryAdvance(C.style, E.style) - i.boundaryAdvance(c[e.segStart[t]].style, E.style) : 0) - e.natural[w], O = t + 8 + 1, k = C.type === "text" && w > O ? Y(e, t, O) - e.tailSum[O] : 0, A = l.every((e) => e >= 0), j = 1e-9 * Math.max(1, Math.abs(r)), M = (t) => {
292
+ let a = s.tabStartPen?.(n) ?? (n === 0 ? s.firstLineIndent ?? 0 : 0), o = s.tabStops ?? [], c = s.defaultTabSize ?? 0, l = e.gapValues, u = l.length, d = new Float64Array(u), f = new Float64Array(u).fill(a), p = new Float64Array(u), m = new Float64Array(u), g = new Float64Array(u), _ = new Uint8Array(u), v = new Float64Array(u), y = !1, b = 0, x = 0, S = !1, C = i[t], w = C.type === "text" ? e.segEnd[t] : t + 1, T = C.type === "text" ? Y(e, t, w) : C.type === "object" ? C.width : 0, E = i[w], D = T + (w < h && C.type === "text" && E.type === "text" && s.boundaryAdvance ? s.boundaryAdvance(C.style, E.style) - s.boundaryAdvance(i[e.segStart[t]].style, E.style) : 0) - e.natural[w], O = t + 8 + 1, k = C.type === "text" && w > O ? Y(e, t, O) - e.tailSum[O] : 0, A = l.every((e) => e >= 0), j = 1e-9 * Math.max(1, Math.abs(r)), M = (t) => {
293
293
  if (!A || t < O && t < w) return !1;
294
294
  let n = Infinity;
295
295
  return t < w && (n = k + e.tailSuffixMin[t + 1]), w < h && (n = Math.min(n, D + e.naturalSuffixMin[Math.max(t + 1, w + 1)])), n > r + j;
296
296
  }, N = t, P = -1, F = null;
297
297
  for (let n = t + 1; n <= h; n++) {
298
- let a = n - 1, C = c[a];
298
+ let a = n - 1, C = i[a];
299
299
  if (C.type === "text" && P >= 0 && e.segStart[a] === e.segStart[a - 1]) {
300
300
  let r = X(e, P, t, n);
301
301
  x = F === null ? r : r + F;
@@ -310,15 +310,15 @@ function h(e, i) {
310
310
  p[e] = f[e];
311
311
  let t = null;
312
312
  for (let n of o) n.pos > f[e] && (t === null || n.pos < t.pos) && (t = n);
313
- t === null && s > 0 && (t = {
314
- pos: (Math.floor(f[e] / s) + 1) * s,
313
+ t === null && c > 0 && (t = {
314
+ pos: (Math.floor(f[e] / c) + 1) * c,
315
315
  algn: "l"
316
316
  }), _[e] = +(t === null), m[e] = t?.pos ?? 0, g[e] = t?.algn === "ctr" ? .5 : +(t?.algn === "r" || t?.algn === "dec"), v[e] = 0;
317
317
  }
318
318
  y = !0, b = e.tabGap[a], P = -1, x = 0, S = !1;
319
319
  } else if (C.type === "text") {
320
- let r = P >= 0 ? c[P] : void 0;
321
- F = r?.type === "text" ? i.boundaryAdvance?.(r.style, C.style) ?? 0 : null, P = a;
320
+ let r = P >= 0 ? i[P] : void 0;
321
+ F = r?.type === "text" ? s.boundaryAdvance?.(r.style, C.style) ?? 0 : null, P = a;
322
322
  let o = X(e, P, t, n);
323
323
  x = F === null ? o : o + F, S = !0;
324
324
  } else P = -1, x = C.width, S = !0;
@@ -343,66 +343,66 @@ function h(e, i) {
343
343
  }, X = (e, t, n, r) => t === n ? Y(e, n, r) : Y(e, t, r), Z = new Int32Array(h).fill(-1);
344
344
  x.push(Z);
345
345
  let Q = (e, t) => {
346
- for (let n = e; n < t; n++) Z[n] = y.length - 1, S[c[n].run] = 1;
346
+ for (let n = e; n < t; n++) Z[n] = y.length - 1, S[i[n].run] = 1;
347
347
  }, $ = 0;
348
348
  if (h === 0) {
349
349
  y.push({
350
350
  segments: [],
351
351
  width: 0,
352
- ...e + 1 < s.length ? { endsWithBreak: !0 } : {},
352
+ ...e + 1 < u.length ? { endsWithBreak: !0 } : {},
353
353
  ...g[e] >= 0 ? { lineFeedRun: g[e] } : {},
354
354
  ..._[e] === void 0 ? {} : { endBreakRun: _[e] }
355
355
  });
356
356
  continue;
357
357
  }
358
358
  for (; $ < h;) {
359
- let n = y.length, r = i.maxWidth - (n === 0 ? i.firstLineIndent ?? 0 : 0), a = (e) => O !== null && k && D !== void 0 ? i.measureText(O.slice(k[$], k[e]), D) : H($, e, n).width, o = h;
360
- if (Number.isFinite(r) && i.nonMonotoneMeasure) o = ee($, n, r);
361
- else if (Number.isFinite(r)) {
359
+ let t = y.length, a = s.maxWidth - (t === 0 ? s.firstLineIndent ?? 0 : 0), o = (e) => O !== null && k && D !== void 0 ? s.measureText(O.slice(k[$], k[e]), D) : H($, e, t).width, c = h;
360
+ if (Number.isFinite(a) && s.nonMonotoneMeasure) c = ee($, t, a);
361
+ else if (Number.isFinite(a)) {
362
362
  let e = $, t = h, n = 1;
363
363
  for (; e < h;) {
364
- let i = Math.min(h, $ + n);
365
- if (a(i) <= r) {
366
- if (e = i, i === h) break;
364
+ let r = Math.min(h, $ + n);
365
+ if (o(r) <= a) {
366
+ if (e = r, r === h) break;
367
367
  n *= 2;
368
368
  } else {
369
- t = i - 1;
369
+ t = r - 1;
370
370
  break;
371
371
  }
372
372
  }
373
373
  for (; e < t;) {
374
374
  let n = Math.ceil((e + t) / 2);
375
- a(n) <= r ? e = n : t = n - 1;
375
+ o(n) <= a ? e = n : t = n - 1;
376
376
  }
377
- o = e;
377
+ c = e;
378
378
  }
379
- if (o >= h) {
380
- let t = H($, h, n);
381
- e + 1 < s.length && (t.endsWithBreak = !0), y.push(t), Q($, h);
379
+ if (c >= h) {
380
+ let n = H($, h, t);
381
+ e + 1 < u.length && (n.endsWithBreak = !0), y.push(n), Q($, h);
382
382
  break;
383
383
  }
384
- let u = 0;
385
- for (let e = $ + 1; e <= o; e++) E[e] && (u = e);
386
- if (u > $ && M(u) && (u = h), M($)) for (u = $ + 2; u < h && !p(c[u]) && c[u].type !== "tab";) u++;
387
- if (u === 0) if (c[$].type === "tab" && o <= $ + 1) {
388
- if (u = $ + 1, u < h && c[u].type === "text") for (u++; u < h && !E[u];) u++;
389
- } else u = Math.max($ + 1, o);
390
- let d = c[u - 1], f = u < h ? c[u] : void 0;
384
+ let l = 0;
385
+ for (let e = $ + 1; e <= c; e++) E[e] && (l = e);
386
+ if (l > $ && M(l) && (l = h), M($)) for (l = $ + 2; l < h && !p(i[l]) && i[l].type !== "tab";) l++;
387
+ if (l === 0) if (i[$].type === "tab" && c <= $ + 1) {
388
+ if (l = $ + 1, l < h && i[l].type === "text") for (l++; l < h && !E[l];) l++;
389
+ } else l = Math.max($ + 1, c);
390
+ let d = i[l - 1], f = l < h ? i[l] : void 0;
391
391
  if (C && f && (m(d) || m(f)) && (d.run === f.run || I(d, f))) {
392
- let { chars: e, offsets: n } = F(), r = n[$ - P], i = n[u - P];
393
- if (i - r > 1 && i < e.length) {
394
- let a = d.run !== f.run, o = a ? z(u) : $ + 1, s = t(e, i, l, a ? n[o - P] : r + 1), c = i - s;
395
- if (c > 0) if (a) {
396
- let e = o, t = u;
397
- for (; e < t;) {
398
- let r = Math.floor((e + t) / 2);
399
- n[r - P] < s ? e = r + 1 : t = r;
392
+ let { chars: e, offsets: t } = F(), i = t[$ - P], a = t[l - P];
393
+ if (a - i > 1 && a < e.length) {
394
+ let o = d.run !== f.run, s = o ? z(l) : $ + 1, c = r(e, a, n, o ? t[s - P] : i + 1), u = a - c;
395
+ if (u > 0) if (o) {
396
+ let e = s, n = l;
397
+ for (; e < n;) {
398
+ let r = Math.floor((e + n) / 2);
399
+ t[r - P] < c ? e = r + 1 : n = r;
400
400
  }
401
- u = e;
402
- } else u - c > $ && (u -= c);
401
+ l = e;
402
+ } else l - u > $ && (l -= u);
403
403
  }
404
404
  }
405
- for (y.push(H($, u, n)), Q($, u), $ = u; $ < h && p(c[$]);) $++;
405
+ for (y.push(H($, l, t)), Q($, l), $ = l; $ < h && p(i[$]);) $++;
406
406
  }
407
407
  }
408
408
  for (let e = 0; e < _.length; e++) {
@@ -413,17 +413,17 @@ function h(e, i) {
413
413
  }
414
414
  for (let t = 0; t < e.length; t++) {
415
415
  if (e[t].type !== "text" || S[t]) continue;
416
- let n = h[t], r = s[n], i = x[n], a = 0, o = r.length;
416
+ let n = h[t], r = u[n], i = x[n], a = 0, o = r.length;
417
417
  for (; a < o;) {
418
418
  let e = a + o >> 1;
419
419
  r[e].run < t ? a = e + 1 : o = e;
420
420
  }
421
- let c = b[n];
421
+ let s = b[n];
422
422
  for (let e = a - 1; e >= 0; e--) if (i[e] >= 0) {
423
- c = i[e];
423
+ s = i[e];
424
424
  break;
425
425
  }
426
- (y[c].hiddenRuns ??= []).push(t);
426
+ (y[s].hiddenRuns ??= []).push(t);
427
427
  }
428
428
  return y;
429
429
  }
@@ -620,29 +620,29 @@ function j(e, t, n = !1, r = !1) {
620
620
  return i?.stackedVerticalGlyphs?.includes(a) ? "vert" : t >= 128 && i?.stackedVrt2OnlyGlyphs?.includes(a) ? "nominal" : void 0;
621
621
  }
622
622
  function M(e, t, n, r = !1) {
623
- let i = [], a = c(e);
624
- a.push(e.length);
625
- let o = 0;
626
- for (let s of a) {
627
- let a = e.slice(o, s);
628
- if (o = s, !a) continue;
629
- let c = a.codePointAt(0) ?? 0, l = r ? void 0 : j(t.family, c, t.bold, t.italic);
630
- r || !A(c) ? i.push({
631
- text: a,
623
+ let a = [], o = i(e);
624
+ o.push(e.length);
625
+ let s = 0;
626
+ for (let i of o) {
627
+ let o = e.slice(s, i);
628
+ if (s = i, !o) continue;
629
+ let c = o.codePointAt(0) ?? 0, l = r ? void 0 : j(t.family, c, t.bold, t.italic);
630
+ r || !A(c) ? a.push({
631
+ text: o,
632
632
  kind: "upright",
633
633
  advance: n.upright
634
- }) : l ? i.push({
635
- text: a,
634
+ }) : l ? a.push({
635
+ text: o,
636
636
  kind: "verticalGlyph",
637
637
  advance: n.verticalGlyph,
638
638
  ...l === "nominal" ? { nominal: !0 } : {}
639
- }) : i.push({
640
- text: a,
639
+ }) : a.push({
640
+ text: o,
641
641
  kind: "rotated",
642
- advance: n.rotated(a)
642
+ advance: n.rotated(o)
643
643
  });
644
644
  }
645
- return i;
645
+ return a;
646
646
  }
647
647
  function N(e) {
648
648
  return e.nominal ? e.text : P(e.text);
@@ -650,7 +650,7 @@ function N(e) {
650
650
  function P(e) {
651
651
  let t = e.codePointAt(0) ?? 0;
652
652
  if (String.fromCodePoint(t) !== e) return null;
653
- let n = i(t) ?? a(t);
653
+ let n = u(t) ?? c(t);
654
654
  return n === null ? null : String.fromCodePoint(n);
655
655
  }
656
656
  function F(e, t, n, r) {