@silurus/ooxml 0.87.0 → 0.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +118 -23
  2. package/THIRD_PARTY_NOTICES.md +7 -6
  3. package/dist/abort-VrnK7mdP.js +10 -0
  4. package/dist/assets/render-worker-CUOU6mL2.js +16 -0
  5. package/dist/assets/render-worker-DOqrFhSU.js +15 -0
  6. package/dist/assets/render-worker-DvWUdZUN.js +35 -0
  7. package/dist/bounded-raw-part-cache-B7JoC1CD.js +64586 -0
  8. package/dist/bundled-asset-url-E2nXURF9.js +15 -0
  9. package/dist/canvas-viewer-mechanics-DfQqRKkD.js +675 -0
  10. package/dist/cfb-guard-9QTRTg7f.js +528 -0
  11. package/dist/chart-ex.mjs +708 -739
  12. package/dist/comment-overlay-controller-B5_zGgG5.js +994 -0
  13. package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
  14. package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-D_sb2K6s.js} +5 -5
  15. package/dist/{comment-ui-runtime-BfE7MJZn.js → comment-ui-runtime-Jy-3goA9.js} +5 -5
  16. package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
  17. package/dist/document-model-source-BKNrXjAL.js +249 -0
  18. package/dist/document-pull-client-CxONDGbk.js +37833 -0
  19. package/dist/document-pull-worker-AMyXYpPq.js +104 -0
  20. package/dist/docx-D91ER1_S.js +495 -0
  21. package/dist/docx-DhDnKEI6.js +3563 -0
  22. package/dist/docx-model-source-CdrSt3hF.js +98 -0
  23. package/dist/docx-source-worker.mjs +455 -0
  24. package/dist/docx.mjs +7 -7
  25. package/dist/docx_parser_bg.wasm +0 -0
  26. package/dist/drawingml-shape-ChcGZNd8.js +310 -0
  27. package/dist/duotone-ekYik4ix.js +126 -0
  28. package/dist/emf-UT6I8rVi.js +1790 -0
  29. package/dist/font-preload-demand-CdJZUMCT.js +2058 -0
  30. package/dist/grid-geometry-uQOgViJU.js +384 -0
  31. package/dist/host-layout-DVMw8hDY.js +56 -0
  32. package/dist/host-layout-measure-CCEgaC_v.js +7 -0
  33. package/dist/in-process-pull-transport-DuXcPZng.js +29 -0
  34. package/dist/index.mjs +4 -4
  35. package/dist/internal-companion.mjs +12 -0
  36. package/dist/line-distribute-CPOV6csk.js +2716 -0
  37. package/dist/math.mjs +2 -2
  38. package/dist/mathjax-stix2.js +10 -10
  39. package/dist/model-source-DJGzDtGb.js +61 -0
  40. package/dist/model-source-kz_NkZqT.js +179 -0
  41. package/dist/model-source-session-Bu9CHFHc.js +71 -0
  42. package/dist/model-source-session-CDuijwv1.js +85 -0
  43. package/dist/model-source-session-sKpNiIJI.js +58 -0
  44. package/dist/node.mjs +7 -1327
  45. package/dist/{pixel-budget-Dgjw269h.js → pixel-budget-BpTYrepD.js} +13 -10
  46. package/dist/plot-area-frame-CaJFvZ7p.js +8502 -0
  47. package/dist/pptx-CDP9dZHe.js +2936 -0
  48. package/dist/pptx-C_uxLVKB.js +183 -0
  49. package/dist/pptx-model-source-O7LhpOjz.js +37 -0
  50. package/dist/pptx-source-worker.mjs +446 -0
  51. package/dist/pptx.mjs +8 -7
  52. package/dist/pptx_parser_bg.wasm +0 -0
  53. package/dist/presentation-model-source-tmROzteR.js +77 -0
  54. package/dist/raster-target-YQ4G6rxo.js +42 -0
  55. package/dist/region-map.mjs +114 -150
  56. package/dist/{render-8Zo7dnds.js → render-CJVglUHl.js} +3 -3
  57. package/dist/{render-worker-host-BfbnEChF.js → render-worker-host-BseIaVvm.js} +1 -1
  58. package/dist/{render-worker-host-DNL9dWRh.js → render-worker-host-CyxPU4JU.js} +1 -1
  59. package/dist/{render-worker-host-IkHrYOci.js → render-worker-host-aF6aWkC0.js} +1 -1
  60. package/dist/renderer-CkGLj0CC.js +5170 -0
  61. package/dist/renderer-Czw1cCC7.js +5823 -0
  62. package/dist/resource-measurement-mXw-WjMF.js +771 -0
  63. package/dist/session-Csv9maad.js +656 -0
  64. package/dist/slide-pull-client-DRZYwBTu.js +6515 -0
  65. package/dist/three-d-BK5siJgJ.js +878 -0
  66. package/dist/three-d.mjs +871 -764
  67. package/dist/{raster-target-ojDdQizC.js → tiff-contract-C6M3QcPp.js} +1 -42
  68. package/dist/tiff.mjs +401 -248
  69. package/dist/types/chart-ex.d.ts +289 -4
  70. package/dist/types/docx.d.ts +473 -98
  71. package/dist/types/index.d.ts +674 -303
  72. package/dist/types/internal-companion.d.ts +11 -0
  73. package/dist/types/math.d.ts +1 -1
  74. package/dist/types/node.d.ts +530 -11
  75. package/dist/types/pptx.d.ts +410 -97
  76. package/dist/types/region-map.d.ts +289 -4
  77. package/dist/types/three-d.d.ts +289 -4
  78. package/dist/types/tiff.d.ts +1 -1
  79. package/dist/types/xlsx.d.ts +483 -134
  80. package/dist/wasm-loader-rlgHmcSv.js +35 -0
  81. package/dist/wasm-runtime-generation-DX4y0Ecl.js +97 -0
  82. package/dist/workbook-model-source-BTC4ISTS.js +94 -0
  83. package/dist/worker-source-I1cIYBel.js +22 -0
  84. package/dist/worker-source-SbudzjYL.js +22 -0
  85. package/dist/worker-source-UAi3GNcM.js +22 -0
  86. package/dist/worksheet-pull-client-CkHgbtyM.js +579 -0
  87. package/dist/xlsx-CpSDPAEU.js +5809 -0
  88. package/dist/xlsx-D5569TPf.js +534 -0
  89. package/dist/xlsx-model-source-DPSkjFic.js +309 -0
  90. package/dist/xlsx-source-worker.mjs +525 -0
  91. package/dist/xlsx.mjs +8 -7
  92. package/dist/xlsx_parser_bg.wasm +0 -0
  93. package/package.json +42 -16
  94. package/dist/assets/render-worker-CeK_iqK3.js +0 -10
  95. package/dist/assets/render-worker-DusrDhPk.js +0 -11
  96. package/dist/assets/render-worker-n2ZG0lrQ.js +0 -31
  97. package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
  98. package/dist/canvas-viewer-mechanics-Cpk0YFvM.js +0 -1384
  99. package/dist/cjk-fallback-bLI3z70h.js +0 -46
  100. package/dist/comment-occurrence-C8Y2uoVr.js +0 -6
  101. package/dist/comment-ui-runtime-BsK8pmUT.js +0 -2
  102. package/dist/comments-Diid5ujN.js +0 -246
  103. package/dist/delimited-text-worker-host-BVY-Ecni.js +0 -27
  104. package/dist/document-pull-client-yKxI8aDH.js +0 -27251
  105. package/dist/docx-BkSRiy07.js +0 -2995
  106. package/dist/dom-interaction-boundary-CBUQJsIM.js +0 -223
  107. package/dist/highlight-rect-C5hkRqUr.js +0 -13
  108. package/dist/hyperlink-ArrU3ArU.js +0 -36447
  109. package/dist/line-distribute-Dtudnqhs.js +0 -1023
  110. package/dist/line-metrics-B60C86uh.js +0 -60
  111. package/dist/plot-area-frame-D5hEOgkJ.js +0 -2903
  112. package/dist/pptx-62MmVbYB.js +0 -3063
  113. package/dist/renderer-XFSCOT6m.js +0 -5857
  114. package/dist/resource-measurement-CJsgolre.js +0 -150
  115. package/dist/session-CrU8f8DI.js +0 -743
  116. package/dist/slide-pull-client-B9KA8bU6.js +0 -6253
  117. package/dist/source-key-DIJG8BA0.js +0 -42
  118. package/dist/three-d-YYghQndN.js +0 -1346
  119. package/dist/transfer-p6iCC2R7.js +0 -6
  120. package/dist/units-EJdC96r6.js +0 -4
  121. package/dist/worksheet-pull-client-eIcQ-xlD.js +0 -458
  122. package/dist/xlsx-CRcSzZNq.js +0 -8482
  123. /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
  124. /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
  125. /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
  126. /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
  127. /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
  128. /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
@@ -0,0 +1,309 @@
1
+ import { eo as e } from "./plot-area-frame-CaJFvZ7p.js";
2
+ import { A as t, H as n, j as r, k as i, q as a } from "./bounded-raw-part-cache-B7JoC1CD.js";
3
+ import { S as o, b as s, c, d as l, f as u, g as d, i as f, p, u as m, y as h } from "./worksheet-pull-client-CkHgbtyM.js";
4
+ import { t as g } from "./grid-geometry-uQOgViJU.js";
5
+ import { o as _, t as v } from "./xlsx-D5569TPf.js";
6
+ import { t as y } from "./model-source-DJGzDtGb.js";
7
+ //#region packages/xlsx/src/worksheet-pull-source-worker.ts
8
+ var b = 64 * 1024 * 1024, x = class {
9
+ archive;
10
+ acceptWorksheet;
11
+ executeArchive;
12
+ prepareRows;
13
+ provisional;
14
+ worksheetPolicy;
15
+ coordinator = new r();
16
+ sessions = /* @__PURE__ */ new Map();
17
+ operationTail = Promise.resolve();
18
+ pendingOpens = /* @__PURE__ */ new Map();
19
+ resourceFailure;
20
+ constructor(e, t, n = (e) => e(this.requireArchive()), r, i, a = () => h) {
21
+ this.archive = e, this.acceptWorksheet = t, this.executeArchive = n, this.prepareRows = r, this.provisional = i, this.worksheetPolicy = a;
22
+ }
23
+ reserveOpen(e) {
24
+ this.pendingOpens.set(e.sessionId, {
25
+ identity: e,
26
+ canceled: !1
27
+ });
28
+ }
29
+ abandonOpen(e) {
30
+ this.pendingOpens.delete(e);
31
+ }
32
+ get pendingOpenCount() {
33
+ return this.pendingOpens.size;
34
+ }
35
+ runDuringPull(t) {
36
+ return this.sessions.size === 0 ? this.run(t) : this.coordinator.enqueue(async () => {
37
+ if (this.resourceFailure) throw this.resourceFailure;
38
+ try {
39
+ return t();
40
+ } catch (t) {
41
+ throw t instanceof e && (this.resourceFailure ??= t), t;
42
+ }
43
+ });
44
+ }
45
+ async open(n, r, i) {
46
+ if (this.resourceFailure) throw this.resourceFailure;
47
+ let a = this.pendingOpens.get(i.sessionId);
48
+ if (!a || a.identity.operationId !== i.operationId || a.identity.generation !== i.generation) throw Error("worksheet pull session open reservation is stale or missing");
49
+ let s = this.worksheetPolicy(), h, g = new Promise((e) => {
50
+ h = e;
51
+ }), _ = this.operationTail.then(() => this.coordinator.enqueue(async () => {
52
+ if (a.canceled) throw Error("worksheet pull session open was canceled");
53
+ this.executeArchive((e) => e.open_sheet_cursor(n, r));
54
+ let g = [], _ = {
55
+ rows: 0,
56
+ cells: 0,
57
+ ownedUtf8Bytes: 0
58
+ }, v, y = !1, x = new t({
59
+ ...i,
60
+ maxByteCredit: b,
61
+ coordinator: this.coordinator,
62
+ driver: {
63
+ pull: () => {
64
+ let t = this.executeArchive((e) => e.pull_sheet_cursor(128)), r = this.executeArchive((e) => e.sheet_cursor_pull_finished());
65
+ if (this.acceptWorksheet) {
66
+ let i = f(t, r, void 0, this.prepareRows);
67
+ try {
68
+ if (i.kind === "preview") i.worksheet && (i.worksheet.rows = g, d(i.worksheet, s), this.provisional?.preview(n, i.worksheet));
69
+ else if (i.kind === "rows") {
70
+ let e = c(_, p(i.rows, s), s);
71
+ l(e, "get-worksheet-worker", void 0, this.readResourceUsage(), s), g.push(...i.rows), _ = e;
72
+ } else i.kind === "finished" && (v = i.worksheet);
73
+ } catch (t) {
74
+ throw t instanceof e && (this.resourceFailure ??= t), t;
75
+ }
76
+ }
77
+ y = r;
78
+ let i = o(t);
79
+ return {
80
+ payload: i,
81
+ byteLength: i.byteLength,
82
+ done: r,
83
+ transfer: [i]
84
+ };
85
+ },
86
+ measureChunk: ({ payload: e }) => e.byteLength,
87
+ acknowledge: () => {
88
+ if (!y) return;
89
+ let t, r;
90
+ try {
91
+ if (this.acceptWorksheet) {
92
+ if (!v) throw Error("worksheet terminal payload is missing");
93
+ v.rows = v.parseError ? [] : g;
94
+ let e = v.parseError ? {
95
+ rows: 0,
96
+ cells: 0,
97
+ ownedUtf8Bytes: 0
98
+ } : _, i = u(v, e, s), a = this.readResourceUsage();
99
+ l(i, "get-worksheet-worker", void 0, a, s), m(i.jsonBytes, "get-worksheet-worker", void 0, a, s), d(v, s);
100
+ let o = this.acceptWorksheet(n, v, i, a);
101
+ typeof o == "function" ? t = o : o && ({rollback: t, commit: r} = o);
102
+ }
103
+ this.executeArchive((e) => e.acknowledge_sheet_cursor_terminal()), r?.();
104
+ } catch (n) {
105
+ throw t?.(), n instanceof e && (this.resourceFailure ??= n), n;
106
+ }
107
+ y = !1, this.sessions.delete(i.sessionId), this.provisional?.stop(n), h();
108
+ },
109
+ cancel: () => {
110
+ try {
111
+ this.archive() && this.executeArchive((e) => e.cancel_sheet_cursor());
112
+ } finally {
113
+ this.sessions.delete(i.sessionId), this.provisional?.stop(n), h();
114
+ }
115
+ },
116
+ close: () => {
117
+ try {
118
+ this.archive() && this.executeArchive((e) => e.close_sheet_cursor());
119
+ } finally {
120
+ this.sessions.delete(i.sessionId), this.provisional?.stop(n), h();
121
+ }
122
+ },
123
+ resourceUsage: () => this.readResourceUsage()
124
+ }
125
+ });
126
+ this.sessions.set(i.sessionId, {
127
+ host: x,
128
+ identity: i
129
+ }), this.pendingOpens.delete(i.sessionId);
130
+ }));
131
+ this.operationTail = _.then(() => g, () => void 0);
132
+ try {
133
+ await _;
134
+ } catch (e) {
135
+ throw this.pendingOpens.delete(i.sessionId), h(), e;
136
+ }
137
+ }
138
+ async postOpenedSafely(e, t, n) {
139
+ try {
140
+ t();
141
+ } catch (t) {
142
+ await this.closeIdentity(e);
143
+ try {
144
+ n(t);
145
+ } catch {}
146
+ }
147
+ }
148
+ dispatch(e, t) {
149
+ let n = this.sessions.get(e.sessionId);
150
+ if (n) return n.host.dispatch(e, t);
151
+ let r = this.pendingOpens.get(e.sessionId);
152
+ if (r && (e.kind === "cancel" || e.kind === "close")) {
153
+ let n = r.identity.operationId === e.operationId && r.identity.generation === e.generation;
154
+ return n && (r.canceled = !0), t(n ? {
155
+ protocol: i,
156
+ kind: "accepted",
157
+ sessionId: e.sessionId,
158
+ operationId: e.operationId,
159
+ generation: e.generation,
160
+ requestId: e.requestId,
161
+ command: e.kind
162
+ } : {
163
+ protocol: i,
164
+ kind: "error",
165
+ sessionId: e.sessionId,
166
+ operationId: e.operationId,
167
+ generation: e.generation,
168
+ requestId: e.requestId,
169
+ error: {
170
+ message: "stale lifecycle targets another pending worksheet operation",
171
+ errorName: "PullSessionProtocolError",
172
+ code: "ooxml-stale-lifecycle"
173
+ }
174
+ }), Promise.resolve();
175
+ }
176
+ return e.kind === "cancel" || e.kind === "close" ? (t({
177
+ protocol: i,
178
+ kind: "accepted",
179
+ sessionId: e.sessionId,
180
+ operationId: e.operationId,
181
+ generation: e.generation,
182
+ requestId: e.requestId,
183
+ command: e.kind
184
+ }), Promise.resolve()) : (t({
185
+ protocol: i,
186
+ kind: "error",
187
+ sessionId: e.sessionId,
188
+ operationId: e.operationId,
189
+ generation: e.generation,
190
+ requestId: e.requestId,
191
+ error: a(/* @__PURE__ */ Error("worksheet pull session is not open"))
192
+ }), Promise.resolve());
193
+ }
194
+ async dispatchSafely(e, t) {
195
+ try {
196
+ await this.dispatch(e, t);
197
+ } catch (n) {
198
+ try {
199
+ t({
200
+ protocol: i,
201
+ kind: "error",
202
+ sessionId: e.sessionId,
203
+ operationId: e.operationId,
204
+ generation: e.generation,
205
+ requestId: e.requestId,
206
+ error: a(n)
207
+ });
208
+ } catch {}
209
+ }
210
+ }
211
+ run(t) {
212
+ let n = this.operationTail.then(() => this.coordinator.enqueue(async () => {
213
+ if (this.resourceFailure) throw this.resourceFailure;
214
+ return t();
215
+ })).catch((t) => {
216
+ throw t instanceof e && (this.resourceFailure ??= t), t;
217
+ });
218
+ return this.operationTail = n.then(() => void 0, () => void 0), n;
219
+ }
220
+ async reset() {
221
+ for (let e of this.pendingOpens.values()) e.canceled = !0;
222
+ let e = 1;
223
+ for (let { host: t, identity: n } of [...this.sessions.values()]) await t.dispatch({
224
+ protocol: i,
225
+ kind: "close",
226
+ ...n,
227
+ requestId: e++
228
+ }, () => void 0);
229
+ this.sessions.clear(), await this.operationTail, this.pendingOpens.clear(), this.resourceFailure = void 0;
230
+ }
231
+ requireArchive() {
232
+ let e = this.archive();
233
+ if (!e) throw Error("Workbook not loaded");
234
+ return e;
235
+ }
236
+ async closeIdentity(e) {
237
+ let t = this.sessions.get(e.sessionId);
238
+ if (t) {
239
+ await t.host.dispatch({
240
+ protocol: i,
241
+ kind: "close",
242
+ ...e,
243
+ requestId: 1
244
+ }, () => void 0);
245
+ return;
246
+ }
247
+ let n = this.pendingOpens.get(e.sessionId);
248
+ n && n.identity.operationId === e.operationId && n.identity.generation === e.generation && (n.canceled = !0);
249
+ }
250
+ readResourceUsage() {
251
+ let e = this.executeArchive((e) => e.sheet_cursor_resource_usage?.());
252
+ return e === void 0 ? void 0 : n(e);
253
+ }
254
+ };
255
+ //#endregion
256
+ //#region packages/node/src/xlsx-model-source.ts
257
+ async function S(e, t, n) {
258
+ return new C(await w(e, t, n), t.signal);
259
+ }
260
+ var C = class extends v {
261
+ constructor(e, t) {
262
+ super(e.closeArchive, e.archive, e.workbookIndex, e.metrics, e.usage, t, e.worksheetPolicy);
263
+ let n = e.worksheetPolicy;
264
+ this.pull = new x(() => e.archive, void 0, void 0, void 0, void 0, () => n);
265
+ }
266
+ async *worksheetRows(e) {
267
+ for await (let t of super.worksheetRows(e)) {
268
+ if (t.kind === "finished") {
269
+ let e = this.workbookIndex.layoutMetrics?.maximumDigitWidth;
270
+ e !== void 0 && g.forWorksheet(t.worksheet, e);
271
+ }
272
+ yield t;
273
+ }
274
+ }
275
+ };
276
+ async function w(e, t, n) {
277
+ let r = s(t), i = {
278
+ ...t,
279
+ xlsxWorksheetLimits: r.worksheet
280
+ }, { acquireXlsxSessionFromArchive: a, configureHostLayout: o, validateXlsxModelSourceArchive: c, validateXlsxModelSourceViewDefaults: l } = await import("./model-source-session-Bu9CHFHc.js"), u = await y(e, "xlsx", {
281
+ ...i,
282
+ source: i.legacyXls
283
+ }, c);
284
+ if (u.kind === "ooxml") return _(u.bytes, n(), i);
285
+ let { opened: d } = u, f;
286
+ try {
287
+ if (l(d.viewDefaults), f = await o(d.archive, async (e) => {
288
+ if (!t.factory) return;
289
+ let { measureHostLayoutFont: n } = await import("./host-layout-measure-CCEgaC_v.js"), r = t.factory.createCanvas(1, 1).getContext("2d");
290
+ return r ? n(e, r) : void 0;
291
+ }), t.signal?.aborted) {
292
+ let e = /* @__PURE__ */ Error("XLSX workbook session was aborted");
293
+ throw e.name = "AbortError", e;
294
+ }
295
+ } catch (e) {
296
+ try {
297
+ d.close();
298
+ } catch {}
299
+ throw e;
300
+ }
301
+ return a({
302
+ archive: d.archive,
303
+ sourceByteLength: u.sourceByteLength,
304
+ ...f === void 0 ? {} : { layoutMetrics: { maximumDigitWidth: f } },
305
+ closeArchive: d.close
306
+ }, i);
307
+ }
308
+ //#endregion
309
+ export { S as openXlsxSource };