@silurus/ooxml 0.85.2 → 0.86.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.
- package/README.md +39 -7
- package/dist/assets/render-worker-BCGnuBLj.js +10 -0
- package/dist/assets/render-worker-CB4DxjXg.js +31 -0
- package/dist/assets/render-worker-CHW0F0n6.js +11 -0
- package/dist/{bounded-raw-part-cache-C6ro6Ezf.js → bounded-raw-part-cache-DVx3Camo.js} +12 -10
- package/dist/{canvas-viewer-mechanics-CDNMJ-Yz.js → canvas-viewer-mechanics-B3A7KLLi.js} +1 -1
- package/dist/{comment-ui-runtime-DAKBCpsM.js → comment-ui-runtime-DEtgcmj7.js} +5 -5
- package/dist/comment-ui-runtime-TLHustXJ.js +2 -0
- package/dist/{comment-ui-runtime-CAbpuWi_.js → comment-ui-runtime-ssI6IE39.js} +4 -4
- package/dist/{comments-Brfxa3hQ.js → comments-CAn2A_Xh.js} +1 -1
- package/dist/delimited-text-worker-host-DcHj_JZt.js +27 -0
- package/dist/{document-pull-client-BssAk95w.js → document-pull-client-xZrA2IjM.js} +3349 -3347
- package/dist/{docx-BY7oyoml.js → docx-DzDiGvqe.js} +67 -64
- package/dist/docx.mjs +5 -5
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{dom-interaction-boundary-CDGegIB5.js → dom-interaction-boundary-DK1JLkrz.js} +2 -2
- package/dist/{line-metrics-BGtFM-ec.js → hyperlink-enyPbflR.js} +847 -877
- package/dist/index.mjs +3 -3
- package/dist/line-distribute-BFB575d6.js +1023 -0
- package/dist/line-metrics-CBbw80Ko.js +60 -0
- package/dist/node.mjs +91 -91
- package/dist/{pptx-C4z96sAA.js → pptx-D_U62nl-.js} +75 -72
- package/dist/pptx.mjs +5 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{render-Dxvwes39.js → render-DSn0d35X.js} +1 -1
- package/dist/{render-worker-host-BAXcBGq3.js → render-worker-host-BHz9vjxB.js} +1 -1
- package/dist/{render-worker-host-CXTCU4PO.js → render-worker-host-CO0UYoQh.js} +1 -1
- package/dist/{render-worker-host-CNKQ76tu.js → render-worker-host-CbYDBg7U.js} +1 -1
- package/dist/{resource-measurement-D41R-0Bl.js → resource-measurement-Do07ZRcR.js} +7 -7
- package/dist/{session-BmP4lcEo.js → session-C1GYhr6n.js} +77 -77
- package/dist/{slide-pull-client-RTwQbJiy.js → slide-pull-client-DuEaUxPw.js} +1128 -1120
- package/dist/types/chart-ex.d.ts +2 -2
- package/dist/types/docx.d.ts +10 -10
- package/dist/types/index.d.ts +38 -18
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +6 -5
- package/dist/types/pptx.d.ts +10 -10
- package/dist/types/region-map.d.ts +2 -2
- package/dist/types/three-d.d.ts +2 -2
- package/dist/types/tiff.d.ts +1 -1
- package/dist/types/xlsx.d.ts +34 -14
- package/dist/{worksheet-pull-client-C9sC36Vu.js → worksheet-pull-client-eDiHHEG2.js} +99 -96
- package/dist/{xlsx-DSU6pV1O.js → xlsx-CMHmYTHP.js} +1629 -1469
- package/dist/xlsx.mjs +5 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +1 -1
- package/dist/assets/render-worker-CV9Mg4j9.js +0 -10
- package/dist/assets/render-worker-DHP0rgcW.js +0 -24
- package/dist/assets/render-worker-DdvOGyrn.js +0 -11
- package/dist/comment-ui-runtime-DTaaZdXC.js +0 -2
- package/dist/line-distribute-BsV4MVZ2.js +0 -1023
- /package/dist/{comment-occurrence-tj54AXXB.js → comment-occurrence-Dhdplprg.js} +0 -0
- /package/dist/{highlight-rect-DBcYVJDv.js → highlight-rect-FuUSmL3a.js} +0 -0
- /package/dist/{read-only-comment-decoration-Mv_SAiHy.js → read-only-comment-decoration-BTnWEeo5.js} +0 -0
- /package/dist/{read-only-comment-margin-Cqu-Ir0C.js → read-only-comment-margin-plStyGfE.js} +0 -0
- /package/dist/{source-key-BkBB3X82.js → source-key-Ktb1GRE5.js} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//#region packages/core/src/text/line-metrics.ts
|
|
2
|
+
var e = [
|
|
3
|
+
[(e) => e.includes("meiryo ui") || e.includes("meiryoui") || e.includes("メイリオ") && e.includes("ui"), {
|
|
4
|
+
asc: 2171 * 1.3 / 2048,
|
|
5
|
+
desc: 430 * 1.3 / 2048,
|
|
6
|
+
eaOnly: !0
|
|
7
|
+
}],
|
|
8
|
+
[(e) => e.includes("meiryo") || e.includes("メイリオ"), {
|
|
9
|
+
asc: 2210 / 2048,
|
|
10
|
+
desc: 1059 / 2048
|
|
11
|
+
}],
|
|
12
|
+
[(e) => !e.includes("ui") && (e.includes("yu mincho") || e.includes("yumincho") || e.includes("游明朝") || e.includes("yu gothic") || e.includes("yugothic") || e.includes("游ゴシック")), {
|
|
13
|
+
asc: 1802 * 1.3 / 2048,
|
|
14
|
+
desc: 455 * 1.3 / 2048,
|
|
15
|
+
eaOnly: !0
|
|
16
|
+
}],
|
|
17
|
+
[(e) => e.includes("sakkal majalla") || e.includes("majalla"), {
|
|
18
|
+
asc: 1810 / 2048,
|
|
19
|
+
desc: 1050 / 2048
|
|
20
|
+
}],
|
|
21
|
+
[(e) => e === "times new roman", {
|
|
22
|
+
asc: 1825 / 2048,
|
|
23
|
+
desc: 530 / 2048
|
|
24
|
+
}],
|
|
25
|
+
[(e) => e === "arial", {
|
|
26
|
+
asc: 1854 / 2048,
|
|
27
|
+
desc: 501 / 2048
|
|
28
|
+
}]
|
|
29
|
+
];
|
|
30
|
+
function t(t, n) {
|
|
31
|
+
if (!t) return null;
|
|
32
|
+
let r = t.toLowerCase();
|
|
33
|
+
for (let [t, i] of e) if (t(r) && (n || !i.eaOnly)) return i;
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function n(e, n = !1) {
|
|
37
|
+
let r = t(e, n);
|
|
38
|
+
return r === null ? null : r.asc + r.desc;
|
|
39
|
+
}
|
|
40
|
+
function r(e, t, r = !1) {
|
|
41
|
+
let i = n(e, r);
|
|
42
|
+
return i === null ? 0 : i * t;
|
|
43
|
+
}
|
|
44
|
+
function i(e, n, r, i, a = !1) {
|
|
45
|
+
let o = t(e, a);
|
|
46
|
+
if (o === null) return {
|
|
47
|
+
ascent: r,
|
|
48
|
+
descent: i
|
|
49
|
+
};
|
|
50
|
+
let s = (o.asc + o.desc) * n;
|
|
51
|
+
return r + i <= s ? {
|
|
52
|
+
ascent: r,
|
|
53
|
+
descent: i
|
|
54
|
+
} : {
|
|
55
|
+
ascent: o.asc * n,
|
|
56
|
+
descent: o.desc * n
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { r as n, i as t };
|
package/dist/node.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as e } from "./chunk-DmhlhrBa.js";
|
|
2
|
-
import { t } from "./slide-pull-client-
|
|
3
|
-
import { B as n,
|
|
4
|
-
import { t as ee } from "./bounded-raw-part-cache-
|
|
5
|
-
import { a as te, c as ne, i as re, l as ie, r as ae, u as oe } from "./document-pull-client-
|
|
2
|
+
import { t } from "./slide-pull-client-DuEaUxPw.js";
|
|
3
|
+
import { B as n, G as r, Gt as i, I as a, M as o, N as s, P as c, R as l, U as u, V as d, W as f, Wt as p, Xt as m, ct as h, dt as g, sn as _ } from "./hyperlink-enyPbflR.js";
|
|
4
|
+
import { t as ee } from "./bounded-raw-part-cache-DVx3Camo.js";
|
|
5
|
+
import { a as te, c as ne, i as re, l as ie, r as ae, u as oe } from "./document-pull-client-xZrA2IjM.js";
|
|
6
6
|
import { l as se, s as ce } from "./pixel-budget-Dgjw269h.js";
|
|
7
7
|
import { t as le } from "./transfer-mIj7E7NB.js";
|
|
8
|
-
import {
|
|
9
|
-
import { a as ye, i as be, n as xe, r as Se } from "./session-
|
|
10
|
-
import { a as Ce, n as we, r as Te, t as Ee } from "./render-
|
|
8
|
+
import { c as ue, d as de, f as fe, l as pe, o as me, r as he, s as ge, t as _e, u as ve } from "./worksheet-pull-client-eDiHHEG2.js";
|
|
9
|
+
import { a as ye, i as be, n as xe, r as Se } from "./session-C1GYhr6n.js";
|
|
10
|
+
import { a as Ce, n as we, r as Te, t as Ee } from "./render-DSn0d35X.js";
|
|
11
11
|
import { existsSync as De, readFileSync as Oe } from "node:fs";
|
|
12
12
|
import { fileURLToPath as ke } from "node:url";
|
|
13
13
|
import { basename as Ae, dirname as je, resolve as Me } from "node:path";
|
|
@@ -96,7 +96,7 @@ var Re = class {
|
|
|
96
96
|
fetchMedia = (e) => this.getPartInternal(e, "application/octet-stream", (t) => t.extract_media(e));
|
|
97
97
|
rawParts = new ee({
|
|
98
98
|
maxEntries: 64,
|
|
99
|
-
maxBytes:
|
|
99
|
+
maxBytes: m
|
|
100
100
|
});
|
|
101
101
|
constructor(e, n, r, i, a) {
|
|
102
102
|
this.closeArchive = e, this.archive = n, this.bootstrap = r, this.metrics = i, this.signal = a, this.slideCount = r.slideCount, this.slideWidth = r.slideWidth, this.slideHeight = r.slideHeight, this.slidePull = new be(() => this.archive), this.transport = new y((e, t) => this.slidePull.dispatchSafely(e, t), () => void 0), this.slideClient = new t({
|
|
@@ -134,7 +134,7 @@ var Re = class {
|
|
|
134
134
|
async renderSlide(e, t, n) {
|
|
135
135
|
return this.assertOpen(), this.enqueueRender(async () => {
|
|
136
136
|
S(this.signal);
|
|
137
|
-
let { renderSlideNode: r } = await import("./render-
|
|
137
|
+
let { renderSlideNode: r } = await import("./render-DSn0d35X.js").then((e) => e.i);
|
|
138
138
|
await r(e, {
|
|
139
139
|
slideWidth: this.slideWidth,
|
|
140
140
|
slideHeight: this.slideHeight,
|
|
@@ -167,7 +167,7 @@ var Re = class {
|
|
|
167
167
|
this.usage ??= await this.slidePull.run(() => ye((e) => e(this.archive))), this.metrics.observeUsage(this.usage), this.consumedSlides = e + 1, yield t;
|
|
168
168
|
}
|
|
169
169
|
} catch (t) {
|
|
170
|
-
throw e =
|
|
170
|
+
throw e = u(t) ?? t, this.metrics.fail(e), e;
|
|
171
171
|
} finally {
|
|
172
172
|
try {
|
|
173
173
|
await this.close();
|
|
@@ -181,17 +181,17 @@ var Re = class {
|
|
|
181
181
|
}
|
|
182
182
|
async release() {
|
|
183
183
|
let e;
|
|
184
|
-
await this.renderTail,
|
|
184
|
+
await this.renderTail, g(this.fetchImage), h(this.fetchImage);
|
|
185
185
|
try {
|
|
186
186
|
await this.slidePull.reset();
|
|
187
187
|
} catch (t) {
|
|
188
|
-
e =
|
|
188
|
+
e = u(t) ?? t;
|
|
189
189
|
}
|
|
190
190
|
this.transport.terminate(), this.rawParts.clear();
|
|
191
191
|
try {
|
|
192
192
|
this.closeArchive();
|
|
193
193
|
} catch (t) {
|
|
194
|
-
e ??=
|
|
194
|
+
e ??= u(t) ?? t;
|
|
195
195
|
}
|
|
196
196
|
if (e !== void 0) throw this.metrics.fail(e), e;
|
|
197
197
|
this.metrics.checkpoint("presentation session closed"), this.metrics.succeed({ slides: this.consumedSlides });
|
|
@@ -209,7 +209,7 @@ var Re = class {
|
|
|
209
209
|
}
|
|
210
210
|
refreshResourceUsage() {
|
|
211
211
|
try {
|
|
212
|
-
this.usage =
|
|
212
|
+
this.usage = d(this.archive.resource_usage()), this.metrics.observeUsage(this.usage);
|
|
213
213
|
} catch {}
|
|
214
214
|
return this.usage;
|
|
215
215
|
}
|
|
@@ -218,8 +218,8 @@ var Re = class {
|
|
|
218
218
|
if (this.resourceFailure) throw this.resourceFailure;
|
|
219
219
|
}
|
|
220
220
|
failOperation(e) {
|
|
221
|
-
let t =
|
|
222
|
-
throw t instanceof
|
|
221
|
+
let t = u(e) ?? e;
|
|
222
|
+
throw t instanceof _ && (this.resourceFailure ??= t), this.metrics.fail(t), t;
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
225
|
async function ze(e, t = {}) {
|
|
@@ -239,8 +239,8 @@ function S(e) {
|
|
|
239
239
|
}
|
|
240
240
|
//#endregion
|
|
241
241
|
//#region packages/docx/src/document-pull-worker.ts
|
|
242
|
-
var Ve = Math.max(
|
|
243
|
-
coordinator = new
|
|
242
|
+
var Ve = Math.max(p, i), He = class {
|
|
243
|
+
coordinator = new c();
|
|
244
244
|
host = null;
|
|
245
245
|
identity = null;
|
|
246
246
|
constructor(e, t = (e) => e(this.requireArchive())) {
|
|
@@ -252,24 +252,24 @@ var Ve = Math.max(a, l), He = class {
|
|
|
252
252
|
t.open_document_cursor(e.operationId, e.generation);
|
|
253
253
|
});
|
|
254
254
|
let t = 0;
|
|
255
|
-
this.identity = e, this.host = new
|
|
255
|
+
this.identity = e, this.host = new s({
|
|
256
256
|
...e,
|
|
257
257
|
maxByteCredit: Ve,
|
|
258
258
|
coordinator: this.coordinator,
|
|
259
259
|
driver: {
|
|
260
260
|
pull: (n) => {
|
|
261
|
-
let
|
|
261
|
+
let i;
|
|
262
262
|
try {
|
|
263
|
-
|
|
263
|
+
i = this.executeArchive((r) => r.pull_document_chunk(t, e.operationId, e.generation, n));
|
|
264
264
|
} catch (e) {
|
|
265
|
-
throw
|
|
265
|
+
throw r(e, n, Ve) || e;
|
|
266
266
|
}
|
|
267
|
-
let
|
|
267
|
+
let a = le(i);
|
|
268
268
|
return {
|
|
269
|
-
payload:
|
|
270
|
-
byteLength:
|
|
269
|
+
payload: a,
|
|
270
|
+
byteLength: a.byteLength,
|
|
271
271
|
done: this.executeArchive((e) => e.document_chunk_done()),
|
|
272
|
-
transfer: [
|
|
272
|
+
transfer: [a]
|
|
273
273
|
};
|
|
274
274
|
},
|
|
275
275
|
measureChunk: ({ payload: e }) => e.byteLength,
|
|
@@ -281,27 +281,27 @@ var Ve = Math.max(a, l), He = class {
|
|
|
281
281
|
close: () => this.executeArchive((e) => e.close_document_session()),
|
|
282
282
|
resourceUsage: () => {
|
|
283
283
|
let e = this.executeArchive((e) => e.document_cursor_resource_usage?.());
|
|
284
|
-
return e ?
|
|
284
|
+
return e ? d(e) : void 0;
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
289
|
dispatch(e, t) {
|
|
290
290
|
return !this.host || !this.identity ? (t({
|
|
291
|
-
protocol:
|
|
291
|
+
protocol: o,
|
|
292
292
|
kind: "error",
|
|
293
293
|
sessionId: e.sessionId,
|
|
294
294
|
operationId: e.operationId,
|
|
295
295
|
generation: e.generation,
|
|
296
296
|
requestId: e.requestId,
|
|
297
|
-
error:
|
|
297
|
+
error: f(/* @__PURE__ */ Error("DOCX document pull session is not open"))
|
|
298
298
|
}), Promise.resolve()) : this.host.dispatch(e, t);
|
|
299
299
|
}
|
|
300
300
|
async reset() {
|
|
301
301
|
if (this.host) try {
|
|
302
302
|
this.archive() && this.executeArchive((e) => e.close_document_session());
|
|
303
303
|
} finally {
|
|
304
|
-
this.host = null, this.identity = null, this.coordinator = new
|
|
304
|
+
this.host = null, this.identity = null, this.coordinator = new c();
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
requireArchive() {
|
|
@@ -575,59 +575,59 @@ function at(e) {
|
|
|
575
575
|
else if (rt !== e) throw Error("DOCX runtime was already initialized with another WebAssembly.Module");
|
|
576
576
|
return it;
|
|
577
577
|
}
|
|
578
|
-
async function ot(e, t, r,
|
|
579
|
-
let
|
|
580
|
-
enabled:
|
|
578
|
+
async function ot(e, t, r, i) {
|
|
579
|
+
let o = l(r), s = new a({
|
|
580
|
+
enabled: o.debug || o.onResourceMetrics !== void 0,
|
|
581
581
|
format: "docx",
|
|
582
582
|
mode: "node",
|
|
583
583
|
scope: "session",
|
|
584
|
-
policy:
|
|
585
|
-
onMetrics:
|
|
586
|
-
emitToConsole:
|
|
584
|
+
policy: o.policy,
|
|
585
|
+
onMetrics: o.onResourceMetrics,
|
|
586
|
+
emitToConsole: o.debug
|
|
587
587
|
});
|
|
588
|
-
|
|
589
|
-
let
|
|
588
|
+
s.setSourceBytes(e.byteLength);
|
|
589
|
+
let c, d, f;
|
|
590
590
|
try {
|
|
591
591
|
ct(r.signal);
|
|
592
|
-
let [
|
|
593
|
-
|
|
592
|
+
let [a, l, u] = n(o.policy), p = C;
|
|
593
|
+
c = await at(t).open(() => new p(e, a, l, u), {
|
|
594
594
|
signal: r.signal,
|
|
595
595
|
abortError: lt,
|
|
596
596
|
disposeOnAbort: (e) => e.free()
|
|
597
597
|
}), ct(r.signal);
|
|
598
|
-
let m =
|
|
599
|
-
|
|
598
|
+
let m = c.proxy;
|
|
599
|
+
s.checkpoint("container ready"), d = new He(() => m);
|
|
600
600
|
let h = {
|
|
601
601
|
sessionId: 1,
|
|
602
602
|
operationId: 1,
|
|
603
603
|
generation: 1
|
|
604
604
|
};
|
|
605
|
-
|
|
606
|
-
let g, _ = await
|
|
605
|
+
d.open(h), f = new y((e, t) => d?.dispatch(e, t), () => void 0);
|
|
606
|
+
let g, _ = await i(f, h, {
|
|
607
607
|
signal: r.signal,
|
|
608
608
|
onUsage: (e) => {
|
|
609
|
-
g = e,
|
|
609
|
+
g = e, s.observeUsage(e);
|
|
610
610
|
}
|
|
611
611
|
});
|
|
612
|
-
return g ??= st(m.document_cursor_resource_usage()),
|
|
612
|
+
return g ??= st(m.document_cursor_resource_usage()), s.observeUsage(g), s.checkpoint("model streamed"), await d.reset(), f.terminate(), {
|
|
613
613
|
archive: m,
|
|
614
614
|
result: _,
|
|
615
615
|
usage: g,
|
|
616
|
-
metrics:
|
|
617
|
-
closeArchive: () =>
|
|
616
|
+
metrics: s,
|
|
617
|
+
closeArchive: () => c?.close((e) => e.free())
|
|
618
618
|
};
|
|
619
619
|
} catch (e) {
|
|
620
|
-
await
|
|
620
|
+
await d?.reset().catch(() => void 0), f?.terminate();
|
|
621
621
|
try {
|
|
622
|
-
|
|
622
|
+
c?.close((e) => e.free());
|
|
623
623
|
} catch {}
|
|
624
|
-
let t =
|
|
625
|
-
throw
|
|
624
|
+
let t = u(e) ?? e;
|
|
625
|
+
throw s.fail(t), t;
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
function st(e) {
|
|
629
629
|
try {
|
|
630
|
-
return
|
|
630
|
+
return d(e);
|
|
631
631
|
} catch {
|
|
632
632
|
return;
|
|
633
633
|
}
|
|
@@ -653,7 +653,7 @@ async function dt(e, t) {
|
|
|
653
653
|
try {
|
|
654
654
|
n.closeArchive();
|
|
655
655
|
} catch {}
|
|
656
|
-
let t =
|
|
656
|
+
let t = u(e) ?? e;
|
|
657
657
|
throw n.metrics.fail(t), t;
|
|
658
658
|
}
|
|
659
659
|
}
|
|
@@ -710,7 +710,7 @@ var pt = class {
|
|
|
710
710
|
}
|
|
711
711
|
refreshResourceUsage() {
|
|
712
712
|
try {
|
|
713
|
-
this.lastResourceUsage =
|
|
713
|
+
this.lastResourceUsage = d(this.archive.resource_usage()), this.metrics.observeUsage(this.lastResourceUsage);
|
|
714
714
|
} catch {}
|
|
715
715
|
return this.lastResourceUsage;
|
|
716
716
|
}
|
|
@@ -734,8 +734,8 @@ var pt = class {
|
|
|
734
734
|
fetchImage: this.fetchImage
|
|
735
735
|
})), gt(this.signal), r;
|
|
736
736
|
}).catch((e) => {
|
|
737
|
-
let t =
|
|
738
|
-
throw t instanceof
|
|
737
|
+
let t = u(e) ?? e;
|
|
738
|
+
throw t instanceof _ && (this.resourceFailure ??= t), this.metrics.fail(t), t;
|
|
739
739
|
}));
|
|
740
740
|
}
|
|
741
741
|
async *pages(e = {}) {
|
|
@@ -753,7 +753,7 @@ var pt = class {
|
|
|
753
753
|
};
|
|
754
754
|
}
|
|
755
755
|
} catch (e) {
|
|
756
|
-
throw t =
|
|
756
|
+
throw t = u(e) ?? e, t;
|
|
757
757
|
} finally {
|
|
758
758
|
try {
|
|
759
759
|
await this.close();
|
|
@@ -770,11 +770,11 @@ var pt = class {
|
|
|
770
770
|
return this.renderTail = t.then(() => void 0, () => void 0), t;
|
|
771
771
|
}
|
|
772
772
|
async release() {
|
|
773
|
-
await this.renderTail,
|
|
773
|
+
await this.renderTail, g(this.fetchImage), h(this.fetchImage), this.state = null;
|
|
774
774
|
try {
|
|
775
775
|
this.closeArchive();
|
|
776
776
|
} catch (e) {
|
|
777
|
-
let t =
|
|
777
|
+
let t = u(e) ?? e;
|
|
778
778
|
throw this.metrics.fail(t), t;
|
|
779
779
|
}
|
|
780
780
|
this.metrics.checkpoint("document session closed", this.lastResourceUsage), this.metrics.succeed({ pages: this.pageCount });
|
|
@@ -805,7 +805,7 @@ function vt(e, t) {
|
|
|
805
805
|
try {
|
|
806
806
|
return {
|
|
807
807
|
workbook: n,
|
|
808
|
-
usage:
|
|
808
|
+
usage: d(t())
|
|
809
809
|
};
|
|
810
810
|
} catch (e) {
|
|
811
811
|
if ((e instanceof Error ? e.message : String(e)) === _t) return {
|
|
@@ -1082,39 +1082,39 @@ function Ft(e) {
|
|
|
1082
1082
|
return Q;
|
|
1083
1083
|
}
|
|
1084
1084
|
async function It(e, t, r = {}) {
|
|
1085
|
-
let
|
|
1086
|
-
enabled:
|
|
1085
|
+
let i = l(r), o = new a({
|
|
1086
|
+
enabled: i.debug || i.onResourceMetrics !== void 0,
|
|
1087
1087
|
format: "xlsx",
|
|
1088
1088
|
mode: "node",
|
|
1089
1089
|
scope: "session",
|
|
1090
|
-
policy:
|
|
1091
|
-
onMetrics:
|
|
1092
|
-
emitToConsole:
|
|
1090
|
+
policy: i.policy,
|
|
1091
|
+
onMetrics: i.onResourceMetrics,
|
|
1092
|
+
emitToConsole: i.debug
|
|
1093
1093
|
});
|
|
1094
|
-
|
|
1095
|
-
let
|
|
1094
|
+
o.setSourceBytes(e.byteLength);
|
|
1095
|
+
let s;
|
|
1096
1096
|
try {
|
|
1097
1097
|
Lt(r.signal);
|
|
1098
|
-
let [
|
|
1099
|
-
|
|
1098
|
+
let [a, c, l] = n(i.policy), u = R;
|
|
1099
|
+
s = await Ft(t).open(() => new u(e, a, c, l), {
|
|
1100
1100
|
signal: r.signal,
|
|
1101
1101
|
abortError: Rt,
|
|
1102
1102
|
disposeOnAbort: (e) => e.free()
|
|
1103
1103
|
}), Lt(r.signal);
|
|
1104
|
-
let d =
|
|
1105
|
-
return
|
|
1104
|
+
let d = s.proxy, { workbook: f, usage: p } = vt(() => JSON.parse(new TextDecoder().decode(d.parse())), () => d.resource_usage());
|
|
1105
|
+
return o.observeUsage(p), o.checkpoint("workbook index ready"), {
|
|
1106
1106
|
archive: d,
|
|
1107
1107
|
workbookIndex: f,
|
|
1108
1108
|
usage: p,
|
|
1109
|
-
metrics:
|
|
1110
|
-
closeArchive: () =>
|
|
1109
|
+
metrics: o,
|
|
1110
|
+
closeArchive: () => s?.close((e) => e.free())
|
|
1111
1111
|
};
|
|
1112
1112
|
} catch (e) {
|
|
1113
1113
|
try {
|
|
1114
|
-
|
|
1114
|
+
s?.close((e) => e.free());
|
|
1115
1115
|
} catch {}
|
|
1116
|
-
let t =
|
|
1117
|
-
throw
|
|
1116
|
+
let t = u(e) ?? e;
|
|
1117
|
+
throw o.fail(t), t;
|
|
1118
1118
|
}
|
|
1119
1119
|
}
|
|
1120
1120
|
function Lt(e) {
|
|
@@ -1194,13 +1194,13 @@ var Bt = class {
|
|
|
1194
1194
|
}
|
|
1195
1195
|
this.completedWorksheets += 1, this.metrics.checkpoint("worksheet stream complete", this.lastUsage);
|
|
1196
1196
|
} catch (e) {
|
|
1197
|
-
throw r =
|
|
1197
|
+
throw r = u(e) ?? e, this.metrics.fail(r), await this.close().catch(() => void 0), r;
|
|
1198
1198
|
} finally {
|
|
1199
1199
|
try {
|
|
1200
1200
|
await this.cleanupOperation(n, r === void 0 ? "closed" : "request-error");
|
|
1201
1201
|
} catch (e) {
|
|
1202
1202
|
if (r === void 0) {
|
|
1203
|
-
let t =
|
|
1203
|
+
let t = u(e) ?? e;
|
|
1204
1204
|
throw this.metrics.fail(t), await this.close().catch(() => void 0), t;
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
@@ -1215,12 +1215,12 @@ var Bt = class {
|
|
|
1215
1215
|
try {
|
|
1216
1216
|
await this.worksheetPullClient.cancelAll(t);
|
|
1217
1217
|
} catch (e) {
|
|
1218
|
-
n =
|
|
1218
|
+
n = u(e) ?? e;
|
|
1219
1219
|
}
|
|
1220
1220
|
try {
|
|
1221
1221
|
await this.pull.reset();
|
|
1222
1222
|
} catch (e) {
|
|
1223
|
-
n ??=
|
|
1223
|
+
n ??= u(e) ?? e;
|
|
1224
1224
|
}
|
|
1225
1225
|
if (this.active === e && (this.active = void 0), n !== void 0) throw n;
|
|
1226
1226
|
})(), e.cleanupPromise;
|
|
@@ -1230,13 +1230,13 @@ var Bt = class {
|
|
|
1230
1230
|
if (this.active) try {
|
|
1231
1231
|
await this.cleanupOperation(this.active, "closed");
|
|
1232
1232
|
} catch (t) {
|
|
1233
|
-
e =
|
|
1233
|
+
e = u(t) ?? t;
|
|
1234
1234
|
}
|
|
1235
1235
|
this.transport.terminate();
|
|
1236
1236
|
try {
|
|
1237
1237
|
this.closeArchive();
|
|
1238
1238
|
} catch (t) {
|
|
1239
|
-
e ??=
|
|
1239
|
+
e ??= u(t) ?? t;
|
|
1240
1240
|
}
|
|
1241
1241
|
if (e !== void 0) throw this.metrics.fail(e), e;
|
|
1242
1242
|
this.metrics.checkpoint("workbook session closed", this.lastUsage), this.metrics.succeed({
|
|
@@ -1266,8 +1266,8 @@ async function Ut(e, t = {}) {
|
|
|
1266
1266
|
jsonBytes: 0
|
|
1267
1267
|
};
|
|
1268
1268
|
for (let r = 0; r < e.sheetCount; r += 1) {
|
|
1269
|
-
let i = await Wt(e, r), a =
|
|
1270
|
-
|
|
1269
|
+
let i = await Wt(e, r), a = me(n, i.usage);
|
|
1270
|
+
ue(a, "materialize-workbook", void 0, i.resourceUsage), n = a, t.push(i.worksheet);
|
|
1271
1271
|
}
|
|
1272
1272
|
return {
|
|
1273
1273
|
workbookIndex: structuredClone(e.workbookIndex),
|
|
@@ -1282,16 +1282,16 @@ async function Wt(e, t) {
|
|
|
1282
1282
|
ownedUtf8Bytes: 0
|
|
1283
1283
|
}, i, a, o;
|
|
1284
1284
|
for await (let s of e.worksheetRows(t)) if (o = s.usage ?? o, s.kind === "rows") {
|
|
1285
|
-
let e =
|
|
1286
|
-
|
|
1285
|
+
let e = ge(r, fe(s.rows));
|
|
1286
|
+
ve(e, "materialize-worksheet", void 0, o), n.push(...s.rows), r = e;
|
|
1287
1287
|
} else {
|
|
1288
1288
|
a = s.worksheet, a.rows = a.parseError ? [] : n;
|
|
1289
|
-
let e =
|
|
1289
|
+
let e = de(a, a.parseError ? {
|
|
1290
1290
|
rows: 0,
|
|
1291
1291
|
cells: 0,
|
|
1292
1292
|
ownedUtf8Bytes: 0
|
|
1293
1293
|
} : r);
|
|
1294
|
-
|
|
1294
|
+
ve(e, "materialize-worksheet", void 0, o), pe(e.jsonBytes, "materialize-worksheet", void 0, o), r = e, i = e;
|
|
1295
1295
|
}
|
|
1296
1296
|
if (!a || !i) throw Error(`XLSX worksheet ${t} did not produce a terminal model`);
|
|
1297
1297
|
return {
|
|
@@ -1310,7 +1310,7 @@ function Gt(e, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
1310
1310
|
}
|
|
1311
1311
|
function Kt(e) {
|
|
1312
1312
|
try {
|
|
1313
|
-
return
|
|
1313
|
+
return d(e);
|
|
1314
1314
|
} catch (e) {
|
|
1315
1315
|
if (String(e).includes("worksheet cursor usage is unavailable")) return;
|
|
1316
1316
|
throw e;
|
|
@@ -1320,4 +1320,4 @@ function qt(e) {
|
|
|
1320
1320
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1321
1321
|
}
|
|
1322
1322
|
//#endregion
|
|
1323
|
-
export { ce as OoxmlDecodedImageLimitError,
|
|
1323
|
+
export { ce as OoxmlDecodedImageLimitError, _ as OoxmlResourceLimitError, Ee as installImageBitmapShim, we as installOffscreenCanvasShim, se as isOoxmlDecodedImageLimitError, ft as materializeDocxDocument, ze as materializePptxPresentation, Ut as materializeXlsxWorkbook, Vt as materializeXlsxWorkbookIndex, Ht as materializeXlsxWorksheet, dt as openDocxDocument, Ie as openPptxPresentation, $ as openXlsxWorkbook, Te as renderSlideNode };
|