@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
@@ -1,6 +0,0 @@
1
- //#region packages/core/src/worker/transfer.ts
2
- function e(e) {
3
- return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength && e.buffer instanceof ArrayBuffer ? e.buffer : e.slice().buffer;
4
- }
5
- //#endregion
6
- export { e as t };
@@ -1,4 +0,0 @@
1
- //#region packages/core/src/units.ts
2
- var e = 12700, t = 9525, n = 4 / 3, r = 91440, i = 45720;
3
- //#endregion
4
- export { n as a, t as i, i as n, e as r, r as t };
@@ -1,458 +0,0 @@
1
- import { F as e, G as t, H as n, M as r, N as i, P as a, an as o, cn as s, in as c, nn as l, on as u, rn as d, sn as f, tn as p, un as m } from "./hyperlink-Cxzhet30.js";
2
- import { n as h, r as g, t as _ } from "./resource-measurement-SHQCbkh2.js";
3
- import { t as v } from "./transfer-p6iCC2R7.js";
4
- //#region packages/xlsx/src/worksheet-resource-limits.ts
5
- var y = s, b = o, x = u, S = f, C = c, w = p, T = l, E = d, D = Object.freeze({
6
- archiveEntryCount: 0,
7
- declaredInflatedBytes: 0,
8
- distinctInflatedBytes: 0,
9
- operationInflatedBytes: 0
10
- });
11
- function O(e) {
12
- let t = e.reduce((e, t) => _(e, t.cells.length, b), 0);
13
- return {
14
- rows: e.length,
15
- cells: t,
16
- ownedUtf8Bytes: e.reduce((e, t) => t.cells.reduce((e, t) => {
17
- let n = h(t.value, x).stringValueUtf8Bytes;
18
- return _(e, _(n, t.formula === void 0 ? 0 : g(t.formula, x), x), x);
19
- }, e), 0)
20
- };
21
- }
22
- function k(e) {
23
- return A(e, O(e.rows));
24
- }
25
- function A(e, t) {
26
- let n = h(e, Math.max(x, S));
27
- return {
28
- ...t,
29
- jsonBytes: n.jsonBytes
30
- };
31
- }
32
- function j(e, t) {
33
- return {
34
- rows: _(e.rows, t.rows, y),
35
- cells: _(e.cells, t.cells, b),
36
- ownedUtf8Bytes: _(e.ownedUtf8Bytes, t.ownedUtf8Bytes, x)
37
- };
38
- }
39
- function M(e, t, n = {}) {
40
- let r = e.rows - (n.rows ?? 0), i = e.cells - (n.cells ?? 0), a = e.ownedUtf8Bytes - (n.ownedUtf8Bytes ?? 0), o = e.jsonBytes - (n.jsonBytes ?? 0);
41
- if (r < 0 || i < 0 || a < 0 || o < 0) throw Error("worksheet cache accounting underflow");
42
- return {
43
- rows: _(r, t.rows, C),
44
- cells: _(i, t.cells, w),
45
- ownedUtf8Bytes: _(a, t.ownedUtf8Bytes, T),
46
- jsonBytes: _(o, t.jsonBytes, E)
47
- };
48
- }
49
- function N(e, t, n, r, i, a, o) {
50
- let s = n === "worksheet-json" ? "serialization" : "parsing";
51
- return new m(`OOXML resource limit exceeded${t ? ` for ${t}` : ""}: ${r} ${a} > ${i}`, {
52
- stage: s,
53
- violation: {
54
- format: "xlsx",
55
- operation: e,
56
- resource: n,
57
- metric: r,
58
- ...t === void 0 ? {} : { part: t },
59
- limit: i,
60
- observed: Math.min(a, i + 1),
61
- configurable: !1,
62
- usage: o ?? D
63
- }
64
- });
65
- }
66
- function P(e, t, n, r) {
67
- let i = [
68
- [
69
- "rows",
70
- e.rows,
71
- y
72
- ],
73
- [
74
- "cells",
75
- e.cells,
76
- b
77
- ],
78
- [
79
- "owned-utf8-bytes",
80
- e.ownedUtf8Bytes,
81
- x
82
- ]
83
- ];
84
- for (let [e, a, o] of i) if (a > o) throw N(t, n, e === "owned-utf8-bytes" ? "worksheet-cell-content" : "worksheet-model", e, o, a, r);
85
- }
86
- function F(e, t, n, r) {
87
- if (e > S) throw N(t, n, "worksheet-json", "bytes", S, e, r);
88
- }
89
- function I(e, t, n, r) {
90
- if (e.rows > C) throw N(t, n, "worksheet-cache", "rows", C, e.rows, r);
91
- if (e.cells > w) throw N(t, n, "worksheet-cache", "cells", w, e.cells, r);
92
- if (e.ownedUtf8Bytes > T) throw N(t, n, "worksheet-cache", "owned-utf8-bytes", T, e.ownedUtf8Bytes, r);
93
- if (e.jsonBytes > E) throw N(t, n, "worksheet-cache", "bytes", E, e.jsonBytes, r);
94
- }
95
- //#endregion
96
- //#region packages/xlsx/src/shared-strings.ts
97
- function L(e, t) {
98
- return R(e.rows, t), e;
99
- }
100
- function R(e, t) {
101
- for (let n of e) for (let e of n.cells) {
102
- let n = e.value;
103
- if (n.type === "shared") {
104
- let r = t[n.si];
105
- if (r) {
106
- let t = {
107
- type: "text",
108
- text: r.text
109
- };
110
- r.runs !== void 0 && (t.runs = r.runs), r.phoneticRuns !== void 0 && (t.phoneticRuns = r.phoneticRuns), r.phoneticPr !== void 0 && (t.phoneticPr = r.phoneticPr), e.value = t;
111
- } else e.value = {
112
- type: "text",
113
- text: ""
114
- };
115
- }
116
- }
117
- return e;
118
- }
119
- //#endregion
120
- //#region packages/xlsx/src/worksheet-pull-codec.ts
121
- function z(e, t, n, r) {
122
- let i = e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength), a = JSON.parse(new TextDecoder().decode(i));
123
- if (!a || typeof a != "object" || !("kind" in a)) throw Error("worksheet cursor returned an invalid unit");
124
- let o = a;
125
- if (t !== (o.kind === "finished")) throw Error("worksheet cursor terminal marker mismatch");
126
- if (o.kind === "rows") {
127
- if (!Array.isArray(o.rows)) throw Error("worksheet row unit is missing rows");
128
- return n && R(o.rows, n), r?.(o.rows), {
129
- kind: "rows",
130
- rows: o.rows
131
- };
132
- }
133
- if (o.kind === "finished") {
134
- if (!o.worksheet || typeof o.worksheet != "object") throw Error("worksheet terminal unit is missing its worksheet");
135
- return o.worksheet.rows = [], {
136
- kind: "finished",
137
- worksheet: o.worksheet
138
- };
139
- }
140
- throw Error("worksheet cursor returned an unknown unit kind");
141
- }
142
- //#endregion
143
- //#region packages/xlsx/src/worksheet-pull-worker.ts
144
- var B = 64 * 1024 * 1024, V = class {
145
- coordinator = new e();
146
- sessions = /* @__PURE__ */ new Map();
147
- operationTail = Promise.resolve();
148
- pendingOpens = /* @__PURE__ */ new Map();
149
- resourceFailure;
150
- constructor(e, t, n = (e) => e(this.requireArchive()), r) {
151
- this.archive = e, this.acceptWorksheet = t, this.executeArchive = n, this.prepareRows = r;
152
- }
153
- reserveOpen(e) {
154
- this.pendingOpens.set(e.sessionId, {
155
- identity: e,
156
- canceled: !1
157
- });
158
- }
159
- abandonOpen(e) {
160
- this.pendingOpens.delete(e);
161
- }
162
- get pendingOpenCount() {
163
- return this.pendingOpens.size;
164
- }
165
- async open(e, t, n) {
166
- if (this.resourceFailure) throw this.resourceFailure;
167
- let r = this.pendingOpens.get(n.sessionId);
168
- if (!r || r.identity.operationId !== n.operationId || r.identity.generation !== n.generation) throw Error("worksheet pull session open reservation is stale or missing");
169
- let i, o = new Promise((e) => {
170
- i = e;
171
- }), s = this.operationTail.then(() => this.coordinator.enqueue(async () => {
172
- if (r.canceled) throw Error("worksheet pull session open was canceled");
173
- this.executeArchive((n) => n.open_sheet_cursor(e, t));
174
- let o = [], s = {
175
- rows: 0,
176
- cells: 0,
177
- ownedUtf8Bytes: 0
178
- }, c, l = !1, u = new a({
179
- ...n,
180
- maxByteCredit: B,
181
- coordinator: this.coordinator,
182
- driver: {
183
- pull: () => {
184
- let e = this.executeArchive((e) => e.pull_sheet_cursor(128)), t = this.executeArchive((e) => e.sheet_cursor_pull_finished());
185
- if (this.acceptWorksheet) {
186
- let n = z(e, t, void 0, this.prepareRows);
187
- try {
188
- if (n.kind === "rows") {
189
- let e = j(s, O(n.rows));
190
- P(e, "get-worksheet-worker", void 0, this.readResourceUsage()), o.push(...n.rows), s = e;
191
- } else c = n.worksheet;
192
- } catch (e) {
193
- throw e instanceof m && (this.resourceFailure ??= e), e;
194
- }
195
- }
196
- l = t;
197
- let n = v(e);
198
- return {
199
- payload: n,
200
- byteLength: n.byteLength,
201
- done: t,
202
- transfer: [n]
203
- };
204
- },
205
- measureChunk: ({ payload: e }) => e.byteLength,
206
- acknowledge: () => {
207
- if (!l) return;
208
- let t, r;
209
- try {
210
- if (this.acceptWorksheet) {
211
- if (!c) throw Error("worksheet terminal payload is missing");
212
- c.rows = c.parseError ? [] : o;
213
- let n = c.parseError ? {
214
- rows: 0,
215
- cells: 0,
216
- ownedUtf8Bytes: 0
217
- } : s, i = A(c, n), a = this.readResourceUsage();
218
- P(i, "get-worksheet-worker", void 0, a), F(i.jsonBytes, "get-worksheet-worker", void 0, a);
219
- let l = this.acceptWorksheet(e, c, i, a);
220
- typeof l == "function" ? t = l : l && ({rollback: t, commit: r} = l);
221
- }
222
- this.executeArchive((e) => e.acknowledge_sheet_cursor_terminal()), r?.();
223
- } catch (e) {
224
- throw t?.(), e instanceof m && (this.resourceFailure ??= e), e;
225
- }
226
- l = !1, this.sessions.delete(n.sessionId), i();
227
- },
228
- cancel: () => {
229
- try {
230
- this.archive() && this.executeArchive((e) => e.cancel_sheet_cursor());
231
- } finally {
232
- this.sessions.delete(n.sessionId), i();
233
- }
234
- },
235
- close: () => {
236
- try {
237
- this.archive() && this.executeArchive((e) => e.close_sheet_cursor());
238
- } finally {
239
- this.sessions.delete(n.sessionId), i();
240
- }
241
- },
242
- resourceUsage: () => this.readResourceUsage()
243
- }
244
- });
245
- this.sessions.set(n.sessionId, {
246
- host: u,
247
- identity: n
248
- }), this.pendingOpens.delete(n.sessionId);
249
- }));
250
- this.operationTail = s.then(() => o, () => void 0);
251
- try {
252
- await s;
253
- } catch (e) {
254
- throw this.pendingOpens.delete(n.sessionId), i(), e;
255
- }
256
- }
257
- async postOpenedSafely(e, t, n) {
258
- try {
259
- t();
260
- } catch (t) {
261
- await this.closeIdentity(e);
262
- try {
263
- n(t);
264
- } catch {}
265
- }
266
- }
267
- dispatch(e, n) {
268
- let r = this.sessions.get(e.sessionId);
269
- if (r) return r.host.dispatch(e, n);
270
- let a = this.pendingOpens.get(e.sessionId);
271
- if (a && (e.kind === "cancel" || e.kind === "close")) {
272
- let t = a.identity.operationId === e.operationId && a.identity.generation === e.generation;
273
- return t && (a.canceled = !0), n(t ? {
274
- protocol: i,
275
- kind: "accepted",
276
- sessionId: e.sessionId,
277
- operationId: e.operationId,
278
- generation: e.generation,
279
- requestId: e.requestId,
280
- command: e.kind
281
- } : {
282
- protocol: i,
283
- kind: "error",
284
- sessionId: e.sessionId,
285
- operationId: e.operationId,
286
- generation: e.generation,
287
- requestId: e.requestId,
288
- error: {
289
- message: "stale lifecycle targets another pending worksheet operation",
290
- errorName: "PullSessionProtocolError",
291
- code: "ooxml-stale-lifecycle"
292
- }
293
- }), Promise.resolve();
294
- }
295
- return e.kind === "cancel" || e.kind === "close" ? (n({
296
- protocol: i,
297
- kind: "accepted",
298
- sessionId: e.sessionId,
299
- operationId: e.operationId,
300
- generation: e.generation,
301
- requestId: e.requestId,
302
- command: e.kind
303
- }), Promise.resolve()) : (n({
304
- protocol: i,
305
- kind: "error",
306
- sessionId: e.sessionId,
307
- operationId: e.operationId,
308
- generation: e.generation,
309
- requestId: e.requestId,
310
- error: t(/* @__PURE__ */ Error("worksheet pull session is not open"))
311
- }), Promise.resolve());
312
- }
313
- async dispatchSafely(e, n) {
314
- try {
315
- await this.dispatch(e, n);
316
- } catch (r) {
317
- try {
318
- n({
319
- protocol: i,
320
- kind: "error",
321
- sessionId: e.sessionId,
322
- operationId: e.operationId,
323
- generation: e.generation,
324
- requestId: e.requestId,
325
- error: t(r)
326
- });
327
- } catch {}
328
- }
329
- }
330
- run(e) {
331
- let t = this.operationTail.then(() => this.coordinator.enqueue(async () => {
332
- if (this.resourceFailure) throw this.resourceFailure;
333
- return e();
334
- })).catch((e) => {
335
- throw e instanceof m && (this.resourceFailure ??= e), e;
336
- });
337
- return this.operationTail = t.then(() => void 0, () => void 0), t;
338
- }
339
- async reset() {
340
- for (let e of this.pendingOpens.values()) e.canceled = !0;
341
- let e = 1;
342
- for (let { host: t, identity: n } of [...this.sessions.values()]) await t.dispatch({
343
- protocol: i,
344
- kind: "close",
345
- ...n,
346
- requestId: e++
347
- }, () => void 0);
348
- this.sessions.clear(), await this.operationTail, this.pendingOpens.clear(), this.resourceFailure = void 0;
349
- }
350
- requireArchive() {
351
- let e = this.archive();
352
- if (!e) throw Error("Workbook not loaded");
353
- return e;
354
- }
355
- async closeIdentity(e) {
356
- let t = this.sessions.get(e.sessionId);
357
- if (t) {
358
- await t.host.dispatch({
359
- protocol: i,
360
- kind: "close",
361
- ...e,
362
- requestId: 1
363
- }, () => void 0);
364
- return;
365
- }
366
- let n = this.pendingOpens.get(e.sessionId);
367
- n && n.identity.operationId === e.operationId && n.identity.generation === e.generation && (n.canceled = !0);
368
- }
369
- readResourceUsage() {
370
- try {
371
- return n(this.executeArchive((e) => e.sheet_cursor_resource_usage()));
372
- } catch (e) {
373
- if (String(e).includes("worksheet cursor usage is unavailable")) return;
374
- throw e;
375
- }
376
- }
377
- }, H = class {
378
- active = /* @__PURE__ */ new Set();
379
- nextSessionId = 1;
380
- constructor(e) {
381
- if (this.options = e, e.generation !== void 0 && (!Number.isSafeInteger(e.generation) || e.generation <= 0)) throw TypeError("generation must be a positive safe integer");
382
- }
383
- async *stream(e, t, n) {
384
- if (!Number.isSafeInteger(e) || e < 0) throw RangeError("sheetIndex must be a non-negative safe integer");
385
- if (!t) throw TypeError("sheetName must be non-empty");
386
- G(n);
387
- let i = this.nextSessionId++, a = {
388
- sessionId: i,
389
- operationId: i,
390
- generation: this.options.generation ?? 1
391
- }, o = new r(this.options.transport, {
392
- ...a,
393
- maxByteCredit: B,
394
- timeoutMs: this.options.timeoutMs,
395
- disposeTransferred: this.options.disposeTransferred
396
- });
397
- this.active.add(o);
398
- let s = !1, c;
399
- try {
400
- for (await this.options.open(e, t, a, this.options.timeoutMs);;) {
401
- G(n);
402
- let e = await o.pull(B, { signal: n });
403
- try {
404
- let t = e.usage ?? o.usageCheckpoint;
405
- t && this.options.onUsage?.(t);
406
- let r = z(e.payload, e.done, this.options.sharedStrings);
407
- if (yield r.kind === "rows" ? {
408
- kind: "rows",
409
- rows: r.rows,
410
- sequence: e.sequence,
411
- wireBytes: e.byteLength,
412
- usage: t
413
- } : {
414
- kind: "finished",
415
- worksheet: r.worksheet,
416
- sequence: e.sequence,
417
- wireBytes: e.byteLength,
418
- usage: t
419
- }, await e.ack({ signal: n }), r.kind === "finished") {
420
- s = !0;
421
- return;
422
- }
423
- } finally {
424
- e.disposeTransferred();
425
- }
426
- }
427
- } catch (e) {
428
- throw c = e, e;
429
- } finally {
430
- let e;
431
- try {
432
- s || await o.cancel(W(c));
433
- } catch (t) {
434
- e = t;
435
- } finally {
436
- this.active.delete(o);
437
- }
438
- if (c === void 0 && e !== void 0) throw e;
439
- }
440
- }
441
- async cancelAll(e = "closed") {
442
- let t = (await Promise.allSettled([...this.active].map((t) => t.cancel(e)))).find((e) => e.status === "rejected");
443
- if (t) throw t.reason;
444
- }
445
- };
446
- function U(e) {
447
- return !!e && typeof e == "object" && e.protocol === "ooxml-pull-v1";
448
- }
449
- function W(e) {
450
- return e && typeof e == "object" && "name" in e && e.name === "AbortError" ? "abort" : e === void 0 ? "closed" : "request-error";
451
- }
452
- function G(e) {
453
- if (!e?.aborted) return;
454
- let t = /* @__PURE__ */ Error("XLSX workbook session was aborted");
455
- throw t.name = "AbortError", t;
456
- }
457
- //#endregion
458
- export { S as a, I as c, A as d, O as f, L as i, F as l, N as m, U as n, M as o, k as p, V as r, j as s, H as t, P as u };