@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,534 @@
1
+ import { t as e } from "./chunk-Dy4uBu1J.js";
2
+ import { F as t, G as n, H as r, L as i, N as a, W as o } from "./bounded-raw-part-cache-B7JoC1CD.js";
3
+ import { n as s, t as c } from "./abort-VrnK7mdP.js";
4
+ import { b as l, c as u, d, f, g as p, l as m, p as h, r as g, s as _, t as v, u as y, x as ee, y as b } from "./worksheet-pull-client-CkHgbtyM.js";
5
+ import { n as x, r as S, t as te } from "./wasm-loader-rlgHmcSv.js";
6
+ import { t as ne } from "./wasm-runtime-generation-DX4y0Ecl.js";
7
+ import { t as re } from "./in-process-pull-transport-DuXcPZng.js";
8
+ //#region packages/xlsx/src/internal/archive-bootstrap.ts
9
+ function ie(e, t) {
10
+ return {
11
+ workbook: e(),
12
+ usage: r(t())
13
+ };
14
+ }
15
+ //#endregion
16
+ //#region packages/xlsx/src/wasm/xlsx_parser.js
17
+ var C = /* @__PURE__ */ e({
18
+ XlsxArchive: () => w,
19
+ default: () => W,
20
+ extract_image: () => ae,
21
+ initSync: () => ue,
22
+ parse_xlsx: () => oe,
23
+ reinit: () => de,
24
+ xlsx_to_markdown: () => se
25
+ }), w = class {
26
+ __destroy_into_raw() {
27
+ let e = this.__wbg_ptr;
28
+ return this.__wbg_ptr = 0, E.unregister(this), e;
29
+ }
30
+ free() {
31
+ let e = this.__destroy_into_raw();
32
+ V.__wbg_xlsxarchive_free(e, 0);
33
+ }
34
+ acknowledge_sheet_cursor_terminal() {
35
+ let e = V.xlsxarchive_acknowledge_sheet_cursor_terminal(this.__wbg_ptr);
36
+ if (e[1]) throw I(e[0]);
37
+ }
38
+ assert_healthy() {
39
+ let e = V.xlsxarchive_assert_healthy(this.__wbg_ptr);
40
+ if (e[1]) throw I(e[0]);
41
+ }
42
+ cancel_sheet_cursor() {
43
+ V.xlsxarchive_cancel_sheet_cursor(this.__wbg_ptr);
44
+ }
45
+ close_sheet_cursor() {
46
+ V.xlsxarchive_close_sheet_cursor(this.__wbg_ptr);
47
+ }
48
+ extract_image(e) {
49
+ let t = F(e, V.__wbindgen_malloc, V.__wbindgen_realloc), n = B, r = V.xlsxarchive_extract_image(this.__wbg_ptr, t, n);
50
+ if (r[3]) throw I(r[2]);
51
+ var i = D(r[0], r[1]).slice();
52
+ return V.__wbindgen_free(r[0], r[1] * 1, 1), i;
53
+ }
54
+ constructor(e, t, n, r) {
55
+ let i = P(e, V.__wbindgen_malloc), a = B, o = V.xlsxarchive_new(i, a, !N(t), N(t) ? BigInt(0) : t, !N(n), N(n) ? BigInt(0) : n, !N(r), N(r) ? BigInt(0) : r);
56
+ if (o[2]) throw I(o[1]);
57
+ return this.__wbg_ptr = o[0] >>> 0, E.register(this, this.__wbg_ptr, this), this;
58
+ }
59
+ open_sheet_cursor(e, t) {
60
+ let n = F(t, V.__wbindgen_malloc, V.__wbindgen_realloc), r = B, i = V.xlsxarchive_open_sheet_cursor(this.__wbg_ptr, e, n, r);
61
+ if (i[1]) throw I(i[0]);
62
+ }
63
+ parse() {
64
+ let e = V.xlsxarchive_parse(this.__wbg_ptr);
65
+ if (e[3]) throw I(e[2]);
66
+ var t = D(e[0], e[1]).slice();
67
+ return V.__wbindgen_free(e[0], e[1] * 1, 1), t;
68
+ }
69
+ pull_sheet_cursor(e) {
70
+ let t = V.xlsxarchive_pull_sheet_cursor(this.__wbg_ptr, e);
71
+ if (t[3]) throw I(t[2]);
72
+ var n = D(t[0], t[1]).slice();
73
+ return V.__wbindgen_free(t[0], t[1] * 1, 1), n;
74
+ }
75
+ resource_usage() {
76
+ let e = V.xlsxarchive_resource_usage(this.__wbg_ptr);
77
+ if (e[3]) throw I(e[2]);
78
+ var t = D(e[0], e[1]).slice();
79
+ return V.__wbindgen_free(e[0], e[1] * 1, 1), t;
80
+ }
81
+ set_worksheet_limits(e, t, n, r) {
82
+ let i = V.xlsxarchive_set_worksheet_limits(this.__wbg_ptr, e, t, n, r);
83
+ if (i[1]) throw I(i[0]);
84
+ }
85
+ sheet_cursor_pull_finished() {
86
+ return V.xlsxarchive_sheet_cursor_pull_finished(this.__wbg_ptr) !== 0;
87
+ }
88
+ sheet_cursor_resource_usage() {
89
+ let e = V.xlsxarchive_sheet_cursor_resource_usage(this.__wbg_ptr);
90
+ if (e[3]) throw I(e[2]);
91
+ var t = D(e[0], e[1]).slice();
92
+ return V.__wbindgen_free(e[0], e[1] * 1, 1), t;
93
+ }
94
+ to_markdown() {
95
+ let e, t;
96
+ try {
97
+ let i = V.xlsxarchive_to_markdown(this.__wbg_ptr);
98
+ var n = i[0], r = i[1];
99
+ if (i[3]) throw n = 0, r = 0, I(i[2]);
100
+ return e = n, t = r, A(n, r);
101
+ } finally {
102
+ V.__wbindgen_free(e, t, 1);
103
+ }
104
+ }
105
+ };
106
+ Symbol.dispose && (w.prototype[Symbol.dispose] = w.prototype.free);
107
+ function ae(e, t, n, r) {
108
+ let i = P(e, V.__wbindgen_malloc), a = B, o = F(t, V.__wbindgen_malloc, V.__wbindgen_realloc), s = B, c = V.extract_image(i, a, o, s, !N(n), N(n) ? BigInt(0) : n, !N(r), N(r) ? BigInt(0) : r);
109
+ if (c[3]) throw I(c[2]);
110
+ var l = D(c[0], c[1]).slice();
111
+ return V.__wbindgen_free(c[0], c[1] * 1, 1), l;
112
+ }
113
+ function oe(e, t, n) {
114
+ let r = P(e, V.__wbindgen_malloc), i = B, a = V.parse_xlsx(r, i, !N(t), N(t) ? BigInt(0) : t, !N(n), N(n) ? BigInt(0) : n);
115
+ if (a[3]) throw I(a[2]);
116
+ var o = D(a[0], a[1]).slice();
117
+ return V.__wbindgen_free(a[0], a[1] * 1, 1), o;
118
+ }
119
+ function se(e, t, n) {
120
+ let r, i;
121
+ try {
122
+ let s = P(e, V.__wbindgen_malloc), c = B, l = V.xlsx_to_markdown(s, c, !N(t), N(t) ? BigInt(0) : t, !N(n), N(n) ? BigInt(0) : n);
123
+ var a = l[0], o = l[1];
124
+ if (l[3]) throw a = 0, o = 0, I(l[2]);
125
+ return r = a, i = o, A(a, o);
126
+ } finally {
127
+ V.__wbindgen_free(r, i, 1);
128
+ }
129
+ }
130
+ function T() {
131
+ return {
132
+ __proto__: null,
133
+ "./xlsx_parser_bg.js": {
134
+ __proto__: null,
135
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(e, t) {
136
+ throw Error(A(e, t));
137
+ },
138
+ __wbg_error_a6fa202b58aa1cd3: function(e, t) {
139
+ let n, r;
140
+ try {
141
+ n = e, r = t, console.error(A(e, t));
142
+ } finally {
143
+ V.__wbindgen_free(n, r, 1);
144
+ }
145
+ },
146
+ __wbg_new_227d7c05414eb861: function() {
147
+ return /* @__PURE__ */ Error();
148
+ },
149
+ __wbg_stack_3b0d974bbf31e44f: function(e, t) {
150
+ let n = t.stack, r = F(n, V.__wbindgen_malloc, V.__wbindgen_realloc), i = B;
151
+ k().setInt32(e + 4, i, !0), k().setInt32(e + 0, r, !0);
152
+ },
153
+ __wbindgen_cast_0000000000000001: function(e, t) {
154
+ return A(e, t);
155
+ },
156
+ __wbindgen_init_externref_table: function() {
157
+ let e = V.__wbindgen_externrefs, t = e.grow(4);
158
+ 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);
159
+ }
160
+ }
161
+ };
162
+ }
163
+ var E = typeof FinalizationRegistry > "u" ? {
164
+ register: () => {},
165
+ unregister: () => {}
166
+ } : new FinalizationRegistry((e) => V.__wbg_xlsxarchive_free(e >>> 0, 1));
167
+ function D(e, t) {
168
+ return e >>>= 0, M().subarray(e / 1, e / 1 + t);
169
+ }
170
+ var O = null;
171
+ function k() {
172
+ return (O === null || O.buffer.detached === !0 || O.buffer.detached === void 0 && O.buffer !== V.memory.buffer) && (O = new DataView(V.memory.buffer)), O;
173
+ }
174
+ function A(e, t) {
175
+ return e >>>= 0, le(e, t);
176
+ }
177
+ var j = null;
178
+ function M() {
179
+ return (j === null || j.byteLength === 0) && (j = new Uint8Array(V.memory.buffer)), j;
180
+ }
181
+ function N(e) {
182
+ return e == null;
183
+ }
184
+ function P(e, t) {
185
+ let n = t(e.length * 1, 1) >>> 0;
186
+ return M().set(e, n / 1), B = e.length, n;
187
+ }
188
+ function F(e, t, n) {
189
+ if (n === void 0) {
190
+ let n = z.encode(e), r = t(n.length, 1) >>> 0;
191
+ return M().subarray(r, r + n.length).set(n), B = n.length, r;
192
+ }
193
+ let r = e.length, i = t(r, 1) >>> 0, a = M(), o = 0;
194
+ for (; o < r; o++) {
195
+ let t = e.charCodeAt(o);
196
+ if (t > 127) break;
197
+ a[i + o] = t;
198
+ }
199
+ if (o !== r) {
200
+ o !== 0 && (e = e.slice(o)), i = n(i, r, r = o + e.length * 3, 1) >>> 0;
201
+ let t = M().subarray(i + o, i + r), a = z.encodeInto(e, t);
202
+ o += a.written, i = n(i, r, o, 1) >>> 0;
203
+ }
204
+ return B = o, i;
205
+ }
206
+ function I(e) {
207
+ let t = V.__wbindgen_externrefs.get(e);
208
+ return V.__externref_table_dealloc(e), t;
209
+ }
210
+ var L = new TextDecoder("utf-8", {
211
+ ignoreBOM: !0,
212
+ fatal: !0
213
+ });
214
+ L.decode();
215
+ var ce = 2146435072, R = 0;
216
+ function le(e, t) {
217
+ return R += t, R >= ce && (L = new TextDecoder("utf-8", {
218
+ ignoreBOM: !0,
219
+ fatal: !0
220
+ }), L.decode(), R = t), L.decode(M().subarray(e, e + t));
221
+ }
222
+ var z = new TextEncoder();
223
+ "encodeInto" in z || (z.encodeInto = function(e, t) {
224
+ let n = z.encode(e);
225
+ return t.set(n), {
226
+ read: e.length,
227
+ written: n.length
228
+ };
229
+ });
230
+ var B = 0, V;
231
+ function H(e, t) {
232
+ return V = e.exports, O = null, j = null, V.__wbindgen_start(), V;
233
+ }
234
+ async function U(e, t) {
235
+ if (typeof Response == "function" && e instanceof Response) {
236
+ if (typeof WebAssembly.instantiateStreaming == "function") try {
237
+ return await WebAssembly.instantiateStreaming(e, t);
238
+ } catch (t) {
239
+ 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);
240
+ else throw t;
241
+ }
242
+ let r = await e.arrayBuffer();
243
+ return await WebAssembly.instantiate(r, t);
244
+ } else {
245
+ let n = await WebAssembly.instantiate(e, t);
246
+ return n instanceof WebAssembly.Instance ? {
247
+ instance: n,
248
+ module: e
249
+ } : n;
250
+ }
251
+ function n(e) {
252
+ switch (e) {
253
+ case "basic":
254
+ case "cors":
255
+ case "default": return !0;
256
+ }
257
+ return !1;
258
+ }
259
+ }
260
+ function ue(e) {
261
+ if (V !== void 0) return V;
262
+ e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module: e} = e : console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));
263
+ let t = T();
264
+ return e instanceof WebAssembly.Module || (e = new WebAssembly.Module(e)), H(new WebAssembly.Instance(e, t), e);
265
+ }
266
+ async function W(e) {
267
+ if (V !== void 0) return V;
268
+ 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"));
269
+ let t = T();
270
+ (typeof e == "string" || typeof Request == "function" && e instanceof Request || typeof URL == "function" && e instanceof URL) && (e = fetch(e));
271
+ let { instance: n, module: r } = await U(await e, t);
272
+ return H(n, r);
273
+ }
274
+ async function de(e) {
275
+ return V = void 0, O = null, j = null, W(e);
276
+ }
277
+ //#endregion
278
+ //#region packages/xlsx/src/internal/node-acquisition.ts
279
+ var G = "XLSX workbook session was aborted", fe = ne(C, "XLSX");
280
+ async function K(e, r, o = {}) {
281
+ let u = l(o), d = t(o), f = new a({
282
+ enabled: d.debug || d.onResourceMetrics !== void 0,
283
+ format: "xlsx",
284
+ mode: "node",
285
+ scope: "session",
286
+ policy: d.policy,
287
+ formatLimits: { xlsxWorksheetLimits: { ...u.worksheet } },
288
+ onMetrics: d.onResourceMetrics,
289
+ emitToConsole: d.debug
290
+ });
291
+ f.setSourceBytes(e.byteLength);
292
+ let p;
293
+ try {
294
+ s(o.signal, G);
295
+ let [t, n, a] = i(d.policy), l = w;
296
+ p = await fe(r).open(() => new l(e, t, n, a), {
297
+ signal: o.signal,
298
+ abortError: () => c(G),
299
+ disposeOnAbort: (e) => e.free()
300
+ }), s(o.signal, G);
301
+ let m = p.proxy, [h, g, _, v] = ee(u);
302
+ m.set_worksheet_limits(h, g, _, v);
303
+ let { workbook: y, usage: b } = ie(() => JSON.parse(new TextDecoder().decode(m.parse())), () => m.resource_usage());
304
+ return f.observeUsage(b), f.checkpoint("workbook index ready"), {
305
+ archive: m,
306
+ workbookIndex: y,
307
+ usage: b,
308
+ metrics: f,
309
+ worksheetPolicy: u,
310
+ closeArchive: () => p?.close((e) => e.free())
311
+ };
312
+ } catch (e) {
313
+ try {
314
+ p?.close((e) => e.free());
315
+ } catch {}
316
+ let t = n(e) ?? e;
317
+ throw f.fail(t), t;
318
+ }
319
+ }
320
+ //#endregion
321
+ //#region packages/node/src/xlsx.ts
322
+ var q = te(() => x(import.meta.url, "xlsx_parser_bg.wasm", "@silurus/ooxml-xlsx/wasm-binary"));
323
+ async function J(e, t = {}) {
324
+ let n = l(t);
325
+ if (t = {
326
+ ...t,
327
+ xlsxWorksheetLimits: n.worksheet
328
+ }, t.legacyXls !== void 0) {
329
+ let { openXlsxSource: n } = await import("./xlsx-model-source-DPSkjFic.js");
330
+ return n(e, t, q);
331
+ }
332
+ let r = await K(_e(e), q(), t);
333
+ return new Z(r.closeArchive, r.archive, r.workbookIndex, r.metrics, r.usage, t.signal, r.worksheetPolicy);
334
+ }
335
+ var Y = /* @__PURE__ */ new WeakMap();
336
+ function X(e) {
337
+ return Y.get(e) ?? b;
338
+ }
339
+ var Z = class {
340
+ closeArchive;
341
+ archive;
342
+ metrics;
343
+ signal;
344
+ workbookIndex;
345
+ sheetCount;
346
+ sheetNames;
347
+ pull;
348
+ transport;
349
+ worksheetPullClient;
350
+ active;
351
+ closed = !1;
352
+ closePromise;
353
+ lastUsage;
354
+ completedWorksheets = 0;
355
+ rowBatches = 0;
356
+ emittedRows = 0;
357
+ constructor(e, t, n, r, i, a, o = b) {
358
+ this.closeArchive = e, this.archive = t, this.metrics = r, this.signal = a, Y.set(this, o), this.workbookIndex = $(n), this.sheetNames = Object.freeze(this.workbookIndex.workbook.sheets.map((e) => e.name)), this.sheetCount = this.sheetNames.length, this.lastUsage = i, this.pull = new g(() => this.archive), this.transport = new re((e, t) => this.pull.dispatchSafely(e, t), () => void 0), this.worksheetPullClient = new v({
359
+ transport: this.transport,
360
+ sharedStrings: n.sharedStrings,
361
+ open: async (e, t, n) => {
362
+ this.pull.reserveOpen(n), await this.pull.open(e, t, n);
363
+ },
364
+ onUsage: (e) => {
365
+ this.lastUsage = e, this.metrics.observeUsage(e);
366
+ }
367
+ });
368
+ }
369
+ get resourceUsage() {
370
+ if (this.closed) return this.lastUsage;
371
+ try {
372
+ this.lastUsage = ge(this.archive.resource_usage());
373
+ } catch {}
374
+ return this.lastUsage;
375
+ }
376
+ async *worksheetRows(e) {
377
+ if (this.closed) throw Error("XLSX workbook session is closed");
378
+ if (this.active) throw Error("another XLSX worksheet row stream is already active");
379
+ if (!Number.isSafeInteger(e) || e < 0) throw RangeError("sheetIndex must be a non-negative safe integer");
380
+ let t = this.requireSheetName(e), n = {};
381
+ this.active = n;
382
+ let r;
383
+ try {
384
+ for await (let n of this.worksheetPullClient.stream(e, t, this.signal)) {
385
+ if (this.closed) throw Error("XLSX workbook session is closed");
386
+ if (n.kind !== "preview") {
387
+ if (n.kind === "rows") {
388
+ this.rowBatches += 1, this.emittedRows += n.rows.length, yield {
389
+ kind: "rows",
390
+ rows: n.rows,
391
+ sequence: n.sequence,
392
+ wireBytes: n.wireBytes,
393
+ usage: n.usage
394
+ };
395
+ continue;
396
+ }
397
+ p(n.worksheet, X(this)), yield {
398
+ kind: "finished",
399
+ worksheet: n.worksheet,
400
+ sequence: n.sequence,
401
+ wireBytes: n.wireBytes,
402
+ usage: n.usage
403
+ };
404
+ }
405
+ }
406
+ this.completedWorksheets += 1, this.metrics.checkpoint("worksheet stream complete", this.lastUsage);
407
+ } catch (e) {
408
+ throw r = o(e) ?? e, this.metrics.fail(r), await this.close().catch(() => void 0), r;
409
+ } finally {
410
+ try {
411
+ await this.cleanupOperation(n, r === void 0 ? "closed" : "request-error");
412
+ } catch (e) {
413
+ if (r === void 0) {
414
+ let t = o(e) ?? e;
415
+ throw this.metrics.fail(t), await this.close().catch(() => void 0), t;
416
+ }
417
+ }
418
+ }
419
+ }
420
+ close() {
421
+ return this.closePromise ? this.closePromise : (this.closed = !0, this.closePromise = this.release(), this.closePromise);
422
+ }
423
+ cleanupOperation(e, t) {
424
+ return e.cleanupPromise ||= (async () => {
425
+ let n;
426
+ try {
427
+ await this.worksheetPullClient.cancelAll(t);
428
+ } catch (e) {
429
+ n = o(e) ?? e;
430
+ }
431
+ try {
432
+ await this.pull.reset();
433
+ } catch (e) {
434
+ n ??= o(e) ?? e;
435
+ }
436
+ if (this.active === e && (this.active = void 0), n !== void 0) throw n;
437
+ })(), e.cleanupPromise;
438
+ }
439
+ async release() {
440
+ let e;
441
+ if (this.active) try {
442
+ await this.cleanupOperation(this.active, "closed");
443
+ } catch (t) {
444
+ e = o(t) ?? t;
445
+ }
446
+ this.transport.terminate();
447
+ try {
448
+ this.closeArchive();
449
+ } catch (t) {
450
+ e ??= o(t) ?? t;
451
+ }
452
+ if (e !== void 0) throw this.metrics.fail(e), e;
453
+ this.metrics.checkpoint("workbook session closed", this.lastUsage), this.metrics.succeed({
454
+ worksheets: this.completedWorksheets,
455
+ "row-batches": this.rowBatches,
456
+ rows: this.emittedRows
457
+ });
458
+ }
459
+ requireSheetName(e) {
460
+ let t = this.workbookIndex.workbook.sheets[e];
461
+ if (!t) throw RangeError(`Sheet index ${e} out of range`);
462
+ return t.name;
463
+ }
464
+ };
465
+ async function pe(e, t = {}) {
466
+ return S(() => J(e, t), async (e) => structuredClone(e.workbookIndex));
467
+ }
468
+ async function me(e, t, n = {}) {
469
+ return S(() => J(e, n), async (e) => (await Q(e, t)).worksheet);
470
+ }
471
+ async function he(e, t = {}) {
472
+ return S(() => J(e, t), async (e) => {
473
+ let t = X(e), n = [], r = {
474
+ rows: 0,
475
+ cells: 0,
476
+ ownedUtf8Bytes: 0,
477
+ jsonBytes: 0
478
+ };
479
+ for (let i = 0; i < e.sheetCount; i += 1) {
480
+ let a = await Q(e, i), o = _(r, a.usage, {}, t);
481
+ m(o, "materialize-workbook", void 0, a.resourceUsage, t), r = o, n.push(a.worksheet);
482
+ }
483
+ return {
484
+ workbookIndex: structuredClone(e.workbookIndex),
485
+ worksheets: Object.freeze(n)
486
+ };
487
+ });
488
+ }
489
+ async function Q(e, t) {
490
+ let n = X(e), r = [], i = {
491
+ rows: 0,
492
+ cells: 0,
493
+ ownedUtf8Bytes: 0
494
+ }, a, o, s;
495
+ for await (let c of e.worksheetRows(t)) if (s = c.usage ?? s, c.kind === "rows") {
496
+ let e = u(i, h(c.rows, n), n);
497
+ d(e, "materialize-worksheet", void 0, s, n), r.push(...c.rows), i = e;
498
+ } else {
499
+ o = c.worksheet, p(o, n), o.rows = o.parseError ? [] : r;
500
+ let e = f(o, o.parseError ? {
501
+ rows: 0,
502
+ cells: 0,
503
+ ownedUtf8Bytes: 0
504
+ } : i, n);
505
+ d(e, "materialize-worksheet", void 0, s, n), y(e.jsonBytes, "materialize-worksheet", void 0, s, n), i = e, a = e;
506
+ }
507
+ if (!o || !a) throw Error(`XLSX worksheet ${t} did not produce a terminal model`);
508
+ return {
509
+ worksheet: o,
510
+ usage: a,
511
+ resourceUsage: s
512
+ };
513
+ }
514
+ function $(e, t = /* @__PURE__ */ new WeakSet()) {
515
+ if (typeof e != "object" || !e) return e;
516
+ let n = e;
517
+ if (t.has(n)) return e;
518
+ t.add(n);
519
+ for (let e of Object.values(n)) $(e, t);
520
+ return Object.freeze(e);
521
+ }
522
+ function ge(e) {
523
+ try {
524
+ return r(e);
525
+ } catch (e) {
526
+ if (String(e).includes("worksheet cursor usage is unavailable")) return;
527
+ throw e;
528
+ }
529
+ }
530
+ function _e(e) {
531
+ return e instanceof Uint8Array ? e : new Uint8Array(e);
532
+ }
533
+ //#endregion
534
+ export { J as a, me as i, he as n, K as o, pe as r, Z as t };