@silurus/ooxml 0.88.0 → 0.89.1

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 (127) hide show
  1. package/README.md +118 -23
  2. package/THIRD_PARTY_NOTICES.md +8 -7
  3. package/dist/abort-VrnK7mdP.js +10 -0
  4. package/dist/assets/render-worker-C5G_Nr_A.js +35 -0
  5. package/dist/assets/render-worker-DQfWdNsm.js +16 -0
  6. package/dist/assets/render-worker-Ds7LjwU-.js +15 -0
  7. package/dist/{hyperlink-Cxzhet30.js → bounded-raw-part-cache-CsnNptAy.js} +4937 -7458
  8. package/dist/bundled-asset-url-E2nXURF9.js +15 -0
  9. package/dist/canvas-viewer-mechanics-BZ8QCrRi.js +675 -0
  10. package/dist/cfb-guard-dNeUiANF.js +528 -0
  11. package/dist/chart-ex.mjs +667 -663
  12. package/dist/comment-overlay-controller-CBvQx-En.js +994 -0
  13. package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
  14. package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-BKidRH36.js} +5 -5
  15. package/dist/{comment-ui-runtime-CWGqn5Vr.js → comment-ui-runtime-C47QoDUy.js} +5 -5
  16. package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
  17. package/dist/document-model-source-MzFPrxt0.js +249 -0
  18. package/dist/document-pull-client-BoJeuURD.js +35941 -0
  19. package/dist/document-pull-worker-CaP8XESP.js +104 -0
  20. package/dist/docx-BN70UhvX.js +495 -0
  21. package/dist/docx-BRRtSvk3.js +3563 -0
  22. package/dist/docx-model-source-CTO9iw_W.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-CHmq8kpM.js +310 -0
  27. package/dist/duotone-DN8P4aXe.js +126 -0
  28. package/dist/emf-CGFQIz6c.js +1790 -0
  29. package/dist/font-preload-demand-Dmy31xt-.js +2058 -0
  30. package/dist/grid-geometry-C3IG20ut.js +384 -0
  31. package/dist/host-layout-DVMw8hDY.js +56 -0
  32. package/dist/host-layout-measure-DsuQ2UJs.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-Bu8psjGd.js +2799 -0
  37. package/dist/math.mjs +2 -2
  38. package/dist/mathjax-stix2.js +10 -10
  39. package/dist/model-source-kz_NkZqT.js +179 -0
  40. package/dist/model-source-s5hRpk4w.js +61 -0
  41. package/dist/model-source-session-6fuaqbGs.js +71 -0
  42. package/dist/model-source-session-DqrR4XHR.js +85 -0
  43. package/dist/model-source-session-cPJSF_Ak.js +58 -0
  44. package/dist/node.mjs +7 -1327
  45. package/dist/{pixel-budget-9P63Bsk5.js → pixel-budget-BpTYrepD.js} +13 -10
  46. package/dist/plot-area-frame-Bs_j4uu7.js +41811 -0
  47. package/dist/pptx-CaJ6ILnw.js +183 -0
  48. package/dist/pptx-_BOGcBym.js +2936 -0
  49. package/dist/pptx-model-source-B_9afw9R.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-CGHLyX32.js +77 -0
  54. package/dist/raster-target-YQ4G6rxo.js +42 -0
  55. package/dist/region-map.mjs +117 -153
  56. package/dist/{render-D3iqVKCo.js → render-CzbDzRKa.js} +3 -3
  57. package/dist/{render-worker-host-B5wQfB7U.js → render-worker-host-B1u6BOUd.js} +1 -1
  58. package/dist/{render-worker-host-D4123J27.js → render-worker-host-C-EECo68.js} +1 -1
  59. package/dist/{render-worker-host-Di3LxLc0.js → render-worker-host-DDqZTCVf.js} +1 -1
  60. package/dist/renderer-CD2cvVAF.js +5823 -0
  61. package/dist/renderer-DRoeb14O.js +5170 -0
  62. package/dist/resource-measurement-Dhhm7P_l.js +772 -0
  63. package/dist/session-XPmC0CUd.js +656 -0
  64. package/dist/slide-pull-client-tq7U_fYg.js +6485 -0
  65. package/dist/three-d-BKwNPAP4.js +878 -0
  66. package/dist/three-d.mjs +925 -910
  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 +149 -2
  70. package/dist/types/docx.d.ts +333 -96
  71. package/dist/types/index.d.ts +566 -301
  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 +422 -9
  75. package/dist/types/pptx.d.ts +302 -95
  76. package/dist/types/region-map.d.ts +149 -2
  77. package/dist/types/three-d.d.ts +149 -2
  78. package/dist/types/tiff.d.ts +1 -1
  79. package/dist/types/xlsx.d.ts +343 -132
  80. package/dist/wasm-loader-rlgHmcSv.js +35 -0
  81. package/dist/wasm-runtime-generation-D6TKZdNb.js +97 -0
  82. package/dist/workbook-model-source-BIGrfZy6.js +94 -0
  83. package/dist/worker-source-DrwhR9fw.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-ClvPO_Jf.js +579 -0
  87. package/dist/xlsx-CsmREBaZ.js +5819 -0
  88. package/dist/xlsx-DmHfeNNp.js +534 -0
  89. package/dist/xlsx-model-source-D1flORqy.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-1uPAxMZr.js +0 -31
  95. package/dist/assets/render-worker-BlvJybji.js +0 -10
  96. package/dist/assets/render-worker-CzmiJfFL.js +0 -11
  97. package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
  98. package/dist/canvas-viewer-mechanics-DbLz0rYW.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-B9PTM-pL.js +0 -27280
  105. package/dist/docx-BF9WXrYH.js +0 -3103
  106. package/dist/dom-interaction-boundary-Cnm8DSBN.js +0 -223
  107. package/dist/highlight-rect-C5hkRqUr.js +0 -13
  108. package/dist/line-distribute-D1WNHKz_.js +0 -1023
  109. package/dist/line-metrics-B60C86uh.js +0 -60
  110. package/dist/plot-area-frame-DLTYKHNP.js +0 -4354
  111. package/dist/pptx-DkyYBYoL.js +0 -3065
  112. package/dist/renderer-B4GZb5We.js +0 -6492
  113. package/dist/resource-measurement-SHQCbkh2.js +0 -150
  114. package/dist/session-BGq81gRQ.js +0 -743
  115. package/dist/slide-pull-client-DiPnm240.js +0 -6253
  116. package/dist/source-key-DIJG8BA0.js +0 -42
  117. package/dist/three-d-DJBl8g8M.js +0 -1162
  118. package/dist/transfer-p6iCC2R7.js +0 -6
  119. package/dist/units-BzZ0gAxs.js +0 -4
  120. package/dist/worksheet-pull-client-BM8ywvbu.js +0 -458
  121. package/dist/xlsx-C9NVjgaV.js +0 -8484
  122. /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
  123. /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
  124. /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
  125. /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
  126. /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
  127. /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
@@ -0,0 +1,309 @@
1
+ import { yo as e } from "./plot-area-frame-Bs_j4uu7.js";
2
+ import { B as t, D as n, G as r, O as i, k as a } from "./bounded-raw-part-cache-CsnNptAy.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-ClvPO_Jf.js";
4
+ import { t as g } from "./grid-geometry-C3IG20ut.js";
5
+ import { o as _, t as v } from "./xlsx-DmHfeNNp.js";
6
+ import { t as y } from "./model-source-s5hRpk4w.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 a();
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(t, n, r) {
46
+ if (this.resourceFailure) throw this.resourceFailure;
47
+ let a = this.pendingOpens.get(r.sessionId);
48
+ if (!a || a.identity.operationId !== r.operationId || a.identity.generation !== r.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(t, n));
54
+ let g = [], _ = {
55
+ rows: 0,
56
+ cells: 0,
57
+ ownedUtf8Bytes: 0
58
+ }, v, y = !1, x = new i({
59
+ ...r,
60
+ maxByteCredit: b,
61
+ coordinator: this.coordinator,
62
+ driver: {
63
+ pull: () => {
64
+ let n = 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(n, 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(t, 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(n);
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 n, i;
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
+ } : _, r = u(v, e, s), a = this.readResourceUsage();
99
+ l(r, "get-worksheet-worker", void 0, a, s), m(r.jsonBytes, "get-worksheet-worker", void 0, a, s), d(v, s);
100
+ let o = this.acceptWorksheet(t, v, r, a);
101
+ typeof o == "function" ? n = o : o && ({rollback: n, commit: i} = o);
102
+ }
103
+ this.executeArchive((e) => e.acknowledge_sheet_cursor_terminal()), i?.();
104
+ } catch (t) {
105
+ throw n?.(), t instanceof e && (this.resourceFailure ??= t), t;
106
+ }
107
+ y = !1, this.sessions.delete(r.sessionId), this.provisional?.stop(t), h();
108
+ },
109
+ cancel: () => {
110
+ try {
111
+ this.archive() && this.executeArchive((e) => e.cancel_sheet_cursor());
112
+ } finally {
113
+ this.sessions.delete(r.sessionId), this.provisional?.stop(t), h();
114
+ }
115
+ },
116
+ close: () => {
117
+ try {
118
+ this.archive() && this.executeArchive((e) => e.close_sheet_cursor());
119
+ } finally {
120
+ this.sessions.delete(r.sessionId), this.provisional?.stop(t), h();
121
+ }
122
+ },
123
+ resourceUsage: () => this.readResourceUsage()
124
+ }
125
+ });
126
+ this.sessions.set(r.sessionId, {
127
+ host: x,
128
+ identity: r
129
+ }), this.pendingOpens.delete(r.sessionId);
130
+ }));
131
+ this.operationTail = _.then(() => g, () => void 0);
132
+ try {
133
+ await _;
134
+ } catch (e) {
135
+ throw this.pendingOpens.delete(r.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 i = this.sessions.get(e.sessionId);
150
+ if (i) return i.host.dispatch(e, t);
151
+ let a = this.pendingOpens.get(e.sessionId);
152
+ if (a && (e.kind === "cancel" || e.kind === "close")) {
153
+ let r = a.identity.operationId === e.operationId && a.identity.generation === e.generation;
154
+ return r && (a.canceled = !0), t(r ? {
155
+ protocol: n,
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: n,
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: n,
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: n,
186
+ kind: "error",
187
+ sessionId: e.sessionId,
188
+ operationId: e.operationId,
189
+ generation: e.generation,
190
+ requestId: e.requestId,
191
+ error: r(/* @__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 (i) {
198
+ try {
199
+ t({
200
+ protocol: n,
201
+ kind: "error",
202
+ sessionId: e.sessionId,
203
+ operationId: e.operationId,
204
+ generation: e.generation,
205
+ requestId: e.requestId,
206
+ error: r(i)
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: r } of [...this.sessions.values()]) await t.dispatch({
224
+ protocol: n,
225
+ kind: "close",
226
+ ...r,
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: n,
241
+ kind: "close",
242
+ ...e,
243
+ requestId: 1
244
+ }, () => void 0);
245
+ return;
246
+ }
247
+ let r = this.pendingOpens.get(e.sessionId);
248
+ r && r.identity.operationId === e.operationId && r.identity.generation === e.generation && (r.canceled = !0);
249
+ }
250
+ readResourceUsage() {
251
+ let e = this.executeArchive((e) => e.sheet_cursor_resource_usage?.());
252
+ return e === void 0 ? void 0 : t(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-6fuaqbGs.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-DsuQ2UJs.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 };