@silurus/ooxml 0.74.5 → 0.75.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 +105 -6
- package/dist/bounded-raw-part-cache-BTfZD_Sz.js +1248 -0
- package/dist/{docx-DftZMp7R.js → document-pull-client-H80_E10V.js} +11165 -11517
- package/dist/docx-BX0mJqS1.js +1274 -0
- package/dist/docx.mjs +6 -3
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/duotone-bitmap-by-path-Dv5Ikbzl.js +28 -0
- package/dist/find-cursor-Dc5iM6s7.js +815 -0
- package/dist/highlight-rect-cCvVU-MW.js +48 -0
- package/dist/hyperlink-D85FexTa.js +27 -0
- package/dist/index.mjs +4 -4
- package/dist/{highlight-rect-IjFkGg4X.js → line-distribute-DkLgIa7B.js} +37 -84
- package/dist/{find-cursor-DtgyGs5V.js → line-metrics-qwIyTk7Q.js} +1169 -3641
- package/dist/math.mjs +1 -1
- package/dist/node.mjs +998 -0
- package/dist/pptx-BEYjiTnZ.js +822 -0
- package/dist/pptx-CXgyi7wu.js +1705 -0
- package/dist/pptx.mjs +7 -3
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/preload-BEouWnlI.js +132 -0
- package/dist/render-C0wMf5eT.js +71 -0
- package/dist/render-worker-host-CLdOlxFu.js +27 -0
- package/dist/render-worker-host-DZ4u0RFs.js +27 -0
- package/dist/render-worker-host-s3J-mWBP.js +27 -0
- package/dist/renderer-CwzTv9hH.js +5225 -0
- package/dist/resource-measurement-6aReN3K0.js +93 -0
- package/dist/slide-pull-client-D_T0AIoX.js +175 -0
- package/dist/svg-image-by-path-C1M3N2pT.js +1623 -0
- package/dist/transfer-3QEJrsJa.js +6 -0
- package/dist/types/docx.d.ts +290 -105
- package/dist/types/index.d.ts +399 -142
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +4855 -0
- package/dist/types/pptx.d.ts +431 -245
- package/dist/types/xlsx.d.ts +320 -120
- package/dist/visible-index-CKvgpUrf.js +17 -0
- package/dist/worksheet-pull-worker-DCei8u-4.js +347 -0
- package/dist/{xlsx-BqMHvfsE.js → xlsx-DJyPlzjB.js} +1499 -1284
- package/dist/xlsx.mjs +7 -3
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +12 -2
- package/dist/pptx-BxU0Lb3J.js +0 -6761
- package/dist/render-worker-host-Bcm9j4-H.js +0 -27
- package/dist/render-worker-host-BqSTDaYt.js +0 -27
- package/dist/render-worker-host-C523QxVw.js +0 -27
- package/dist/visible-index-C3_3gBg-.js +0 -50
- /package/dist/{mathjax-BPjQ2C_j.js → mathjax-Dqo857oC.js} +0 -0
|
@@ -0,0 +1,822 @@
|
|
|
1
|
+
import { t as e } from "./chunk-DmhlhrBa.js";
|
|
2
|
+
import { D as t, E as n, N as r, O as i, T as a, _ as o, a as s, c, f as l, g as u, i as d, k as ee, o as f, t as te, u as ne } from "./bounded-raw-part-cache-BTfZD_Sz.js";
|
|
3
|
+
import { i as p, t as re } from "./svg-image-by-path-C1M3N2pT.js";
|
|
4
|
+
import { t as m } from "./transfer-3QEJrsJa.js";
|
|
5
|
+
import { i as ie, t as ae } from "./slide-pull-client-D_T0AIoX.js";
|
|
6
|
+
import { existsSync as oe, readFileSync as h } from "node:fs";
|
|
7
|
+
import { fileURLToPath as se } from "node:url";
|
|
8
|
+
import { basename as ce, dirname as le, resolve as g } from "node:path";
|
|
9
|
+
//#region packages/pptx/src/wasm/pptx_parser.js
|
|
10
|
+
var ue = /* @__PURE__ */ e({
|
|
11
|
+
PptxArchive: () => _,
|
|
12
|
+
default: () => V,
|
|
13
|
+
extract_image: () => v,
|
|
14
|
+
extract_media: () => y,
|
|
15
|
+
initSync: () => pe,
|
|
16
|
+
parse_pptx: () => b,
|
|
17
|
+
pptx_to_markdown: () => x,
|
|
18
|
+
reinit: () => me
|
|
19
|
+
}), _ = class {
|
|
20
|
+
__destroy_into_raw() {
|
|
21
|
+
let e = this.__wbg_ptr;
|
|
22
|
+
return this.__wbg_ptr = 0, C.unregister(this), e;
|
|
23
|
+
}
|
|
24
|
+
free() {
|
|
25
|
+
let e = this.__destroy_into_raw();
|
|
26
|
+
R.__wbg_pptxarchive_free(e, 0);
|
|
27
|
+
}
|
|
28
|
+
acknowledge_slide(e, t) {
|
|
29
|
+
let n = R.pptxarchive_acknowledge_slide(this.__wbg_ptr, e, t);
|
|
30
|
+
if (n[1]) throw N(n[0]);
|
|
31
|
+
}
|
|
32
|
+
assert_healthy() {
|
|
33
|
+
let e = R.pptxarchive_assert_healthy(this.__wbg_ptr);
|
|
34
|
+
if (e[1]) throw N(e[0]);
|
|
35
|
+
}
|
|
36
|
+
cancel_slide() {
|
|
37
|
+
R.pptxarchive_cancel_slide(this.__wbg_ptr);
|
|
38
|
+
}
|
|
39
|
+
close_presentation_session() {
|
|
40
|
+
R.pptxarchive_close_presentation_session(this.__wbg_ptr);
|
|
41
|
+
}
|
|
42
|
+
extract_image(e) {
|
|
43
|
+
let t = M(e, R.__wbindgen_malloc, R.__wbindgen_realloc), n = L, r = R.pptxarchive_extract_image(this.__wbg_ptr, t, n);
|
|
44
|
+
if (r[3]) throw N(r[2]);
|
|
45
|
+
var i = w(r[0], r[1]).slice();
|
|
46
|
+
return R.__wbindgen_free(r[0], r[1] * 1, 1), i;
|
|
47
|
+
}
|
|
48
|
+
extract_media(e) {
|
|
49
|
+
let t = M(e, R.__wbindgen_malloc, R.__wbindgen_realloc), n = L, r = R.pptxarchive_extract_media(this.__wbg_ptr, t, n);
|
|
50
|
+
if (r[3]) throw N(r[2]);
|
|
51
|
+
var i = w(r[0], r[1]).slice();
|
|
52
|
+
return R.__wbindgen_free(r[0], r[1] * 1, 1), i;
|
|
53
|
+
}
|
|
54
|
+
constructor(e, t, n) {
|
|
55
|
+
let r = j(e, R.__wbindgen_malloc), i = L, a = R.pptxarchive_new(r, i, !A(t), A(t) ? BigInt(0) : t, !A(n), A(n) ? BigInt(0) : n);
|
|
56
|
+
if (a[2]) throw N(a[1]);
|
|
57
|
+
return this.__wbg_ptr = a[0] >>> 0, C.register(this, this.__wbg_ptr, this), this;
|
|
58
|
+
}
|
|
59
|
+
parse() {
|
|
60
|
+
let e = R.pptxarchive_parse(this.__wbg_ptr);
|
|
61
|
+
if (e[3]) throw N(e[2]);
|
|
62
|
+
var t = w(e[0], e[1]).slice();
|
|
63
|
+
return R.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
64
|
+
}
|
|
65
|
+
presentation_bootstrap() {
|
|
66
|
+
let e = R.pptxarchive_presentation_bootstrap(this.__wbg_ptr);
|
|
67
|
+
if (e[3]) throw N(e[2]);
|
|
68
|
+
var t = w(e[0], e[1]).slice();
|
|
69
|
+
return R.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
70
|
+
}
|
|
71
|
+
pull_slide(e, t, n, r) {
|
|
72
|
+
let i = R.pptxarchive_pull_slide(this.__wbg_ptr, e, t, n, r);
|
|
73
|
+
if (i[3]) throw N(i[2]);
|
|
74
|
+
var a = w(i[0], i[1]).slice();
|
|
75
|
+
return R.__wbindgen_free(i[0], i[1] * 1, 1), a;
|
|
76
|
+
}
|
|
77
|
+
resource_usage() {
|
|
78
|
+
let e = R.pptxarchive_resource_usage(this.__wbg_ptr);
|
|
79
|
+
if (e[3]) throw N(e[2]);
|
|
80
|
+
var t = w(e[0], e[1]).slice();
|
|
81
|
+
return R.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
82
|
+
}
|
|
83
|
+
slide_cursor_resource_usage() {
|
|
84
|
+
let e = R.pptxarchive_slide_cursor_resource_usage(this.__wbg_ptr);
|
|
85
|
+
if (e[3]) throw N(e[2]);
|
|
86
|
+
var t = w(e[0], e[1]).slice();
|
|
87
|
+
return R.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
88
|
+
}
|
|
89
|
+
to_markdown() {
|
|
90
|
+
let e, t;
|
|
91
|
+
try {
|
|
92
|
+
let i = R.pptxarchive_to_markdown(this.__wbg_ptr);
|
|
93
|
+
var n = i[0], r = i[1];
|
|
94
|
+
if (i[3]) throw n = 0, r = 0, N(i[2]);
|
|
95
|
+
return e = n, t = r, D(n, r);
|
|
96
|
+
} finally {
|
|
97
|
+
R.__wbindgen_free(e, t, 1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
Symbol.dispose && (_.prototype[Symbol.dispose] = _.prototype.free);
|
|
102
|
+
function v(e, t, n, r) {
|
|
103
|
+
let i = j(e, R.__wbindgen_malloc), a = L, o = M(t, R.__wbindgen_malloc, R.__wbindgen_realloc), s = L, c = R.extract_image(i, a, o, s, !A(n), A(n) ? BigInt(0) : n, !A(r), A(r) ? BigInt(0) : r);
|
|
104
|
+
if (c[3]) throw N(c[2]);
|
|
105
|
+
var l = w(c[0], c[1]).slice();
|
|
106
|
+
return R.__wbindgen_free(c[0], c[1] * 1, 1), l;
|
|
107
|
+
}
|
|
108
|
+
function y(e, t, n, r) {
|
|
109
|
+
let i = j(e, R.__wbindgen_malloc), a = L, o = M(t, R.__wbindgen_malloc, R.__wbindgen_realloc), s = L, c = R.extract_media(i, a, o, s, !A(n), A(n) ? BigInt(0) : n, !A(r), A(r) ? BigInt(0) : r);
|
|
110
|
+
if (c[3]) throw N(c[2]);
|
|
111
|
+
var l = w(c[0], c[1]).slice();
|
|
112
|
+
return R.__wbindgen_free(c[0], c[1] * 1, 1), l;
|
|
113
|
+
}
|
|
114
|
+
function b(e, t, n) {
|
|
115
|
+
let r = j(e, R.__wbindgen_malloc), i = L, a = R.parse_pptx(r, i, !A(t), A(t) ? BigInt(0) : t, !A(n), A(n) ? BigInt(0) : n);
|
|
116
|
+
if (a[3]) throw N(a[2]);
|
|
117
|
+
var o = w(a[0], a[1]).slice();
|
|
118
|
+
return R.__wbindgen_free(a[0], a[1] * 1, 1), o;
|
|
119
|
+
}
|
|
120
|
+
function x(e, t, n) {
|
|
121
|
+
let r, i;
|
|
122
|
+
try {
|
|
123
|
+
let s = j(e, R.__wbindgen_malloc), c = L, l = R.pptx_to_markdown(s, c, !A(t), A(t) ? BigInt(0) : t, !A(n), A(n) ? BigInt(0) : n);
|
|
124
|
+
var a = l[0], o = l[1];
|
|
125
|
+
if (l[3]) throw a = 0, o = 0, N(l[2]);
|
|
126
|
+
return r = a, i = o, D(a, o);
|
|
127
|
+
} finally {
|
|
128
|
+
R.__wbindgen_free(r, i, 1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function S() {
|
|
132
|
+
return {
|
|
133
|
+
__proto__: null,
|
|
134
|
+
"./pptx_parser_bg.js": {
|
|
135
|
+
__proto__: null,
|
|
136
|
+
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(e, t) {
|
|
137
|
+
throw Error(D(e, t));
|
|
138
|
+
},
|
|
139
|
+
__wbg_error_a6fa202b58aa1cd3: function(e, t) {
|
|
140
|
+
let n, r;
|
|
141
|
+
try {
|
|
142
|
+
n = e, r = t, console.error(D(e, t));
|
|
143
|
+
} finally {
|
|
144
|
+
R.__wbindgen_free(n, r, 1);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
148
|
+
return /* @__PURE__ */ Error();
|
|
149
|
+
},
|
|
150
|
+
__wbg_stack_3b0d974bbf31e44f: function(e, t) {
|
|
151
|
+
let n = t.stack, r = M(n, R.__wbindgen_malloc, R.__wbindgen_realloc), i = L;
|
|
152
|
+
E().setInt32(e + 4, i, !0), E().setInt32(e + 0, r, !0);
|
|
153
|
+
},
|
|
154
|
+
__wbindgen_cast_0000000000000001: function(e, t) {
|
|
155
|
+
return D(e, t);
|
|
156
|
+
},
|
|
157
|
+
__wbindgen_init_externref_table: function() {
|
|
158
|
+
let e = R.__wbindgen_externrefs, t = e.grow(4);
|
|
159
|
+
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);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
var C = typeof FinalizationRegistry > "u" ? {
|
|
165
|
+
register: () => {},
|
|
166
|
+
unregister: () => {}
|
|
167
|
+
} : new FinalizationRegistry((e) => R.__wbg_pptxarchive_free(e >>> 0, 1));
|
|
168
|
+
function w(e, t) {
|
|
169
|
+
return e >>>= 0, k().subarray(e / 1, e / 1 + t);
|
|
170
|
+
}
|
|
171
|
+
var T = null;
|
|
172
|
+
function E() {
|
|
173
|
+
return (T === null || T.buffer.detached === !0 || T.buffer.detached === void 0 && T.buffer !== R.memory.buffer) && (T = new DataView(R.memory.buffer)), T;
|
|
174
|
+
}
|
|
175
|
+
function D(e, t) {
|
|
176
|
+
return e >>>= 0, fe(e, t);
|
|
177
|
+
}
|
|
178
|
+
var O = null;
|
|
179
|
+
function k() {
|
|
180
|
+
return (O === null || O.byteLength === 0) && (O = new Uint8Array(R.memory.buffer)), O;
|
|
181
|
+
}
|
|
182
|
+
function A(e) {
|
|
183
|
+
return e == null;
|
|
184
|
+
}
|
|
185
|
+
function j(e, t) {
|
|
186
|
+
let n = t(e.length * 1, 1) >>> 0;
|
|
187
|
+
return k().set(e, n / 1), L = e.length, n;
|
|
188
|
+
}
|
|
189
|
+
function M(e, t, n) {
|
|
190
|
+
if (n === void 0) {
|
|
191
|
+
let n = I.encode(e), r = t(n.length, 1) >>> 0;
|
|
192
|
+
return k().subarray(r, r + n.length).set(n), L = n.length, r;
|
|
193
|
+
}
|
|
194
|
+
let r = e.length, i = t(r, 1) >>> 0, a = k(), o = 0;
|
|
195
|
+
for (; o < r; o++) {
|
|
196
|
+
let t = e.charCodeAt(o);
|
|
197
|
+
if (t > 127) break;
|
|
198
|
+
a[i + o] = t;
|
|
199
|
+
}
|
|
200
|
+
if (o !== r) {
|
|
201
|
+
o !== 0 && (e = e.slice(o)), i = n(i, r, r = o + e.length * 3, 1) >>> 0;
|
|
202
|
+
let t = k().subarray(i + o, i + r), a = I.encodeInto(e, t);
|
|
203
|
+
o += a.written, i = n(i, r, o, 1) >>> 0;
|
|
204
|
+
}
|
|
205
|
+
return L = o, i;
|
|
206
|
+
}
|
|
207
|
+
function N(e) {
|
|
208
|
+
let t = R.__wbindgen_externrefs.get(e);
|
|
209
|
+
return R.__externref_table_dealloc(e), t;
|
|
210
|
+
}
|
|
211
|
+
var P = new TextDecoder("utf-8", {
|
|
212
|
+
ignoreBOM: !0,
|
|
213
|
+
fatal: !0
|
|
214
|
+
});
|
|
215
|
+
P.decode();
|
|
216
|
+
var de = 2146435072, F = 0;
|
|
217
|
+
function fe(e, t) {
|
|
218
|
+
return F += t, F >= de && (P = new TextDecoder("utf-8", {
|
|
219
|
+
ignoreBOM: !0,
|
|
220
|
+
fatal: !0
|
|
221
|
+
}), P.decode(), F = t), P.decode(k().subarray(e, e + t));
|
|
222
|
+
}
|
|
223
|
+
var I = new TextEncoder();
|
|
224
|
+
"encodeInto" in I || (I.encodeInto = function(e, t) {
|
|
225
|
+
let n = I.encode(e);
|
|
226
|
+
return t.set(n), {
|
|
227
|
+
read: e.length,
|
|
228
|
+
written: n.length
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
var L = 0, R;
|
|
232
|
+
function z(e, t) {
|
|
233
|
+
return R = e.exports, T = null, O = null, R.__wbindgen_start(), R;
|
|
234
|
+
}
|
|
235
|
+
async function B(e, t) {
|
|
236
|
+
if (typeof Response == "function" && e instanceof Response) {
|
|
237
|
+
if (typeof WebAssembly.instantiateStreaming == "function") try {
|
|
238
|
+
return await WebAssembly.instantiateStreaming(e, t);
|
|
239
|
+
} catch (t) {
|
|
240
|
+
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);
|
|
241
|
+
else throw t;
|
|
242
|
+
}
|
|
243
|
+
let r = await e.arrayBuffer();
|
|
244
|
+
return await WebAssembly.instantiate(r, t);
|
|
245
|
+
} else {
|
|
246
|
+
let n = await WebAssembly.instantiate(e, t);
|
|
247
|
+
return n instanceof WebAssembly.Instance ? {
|
|
248
|
+
instance: n,
|
|
249
|
+
module: e
|
|
250
|
+
} : n;
|
|
251
|
+
}
|
|
252
|
+
function n(e) {
|
|
253
|
+
switch (e) {
|
|
254
|
+
case "basic":
|
|
255
|
+
case "cors":
|
|
256
|
+
case "default": return !0;
|
|
257
|
+
}
|
|
258
|
+
return !1;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function pe(e) {
|
|
262
|
+
if (R !== void 0) return R;
|
|
263
|
+
e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module: e} = e : console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));
|
|
264
|
+
let t = S();
|
|
265
|
+
return e instanceof WebAssembly.Module || (e = new WebAssembly.Module(e)), z(new WebAssembly.Instance(e, t), e);
|
|
266
|
+
}
|
|
267
|
+
async function V(e) {
|
|
268
|
+
if (R !== void 0) return R;
|
|
269
|
+
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"));
|
|
270
|
+
let t = S();
|
|
271
|
+
(typeof e == "string" || typeof Request == "function" && e instanceof Request || typeof URL == "function" && e instanceof URL) && (e = fetch(e));
|
|
272
|
+
let { instance: n, module: r } = await B(await e, t);
|
|
273
|
+
return z(n, r);
|
|
274
|
+
}
|
|
275
|
+
async function me(e) {
|
|
276
|
+
return R = void 0, T = null, O = null, V(e);
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region packages/pptx/src/slide-cursor-operation.ts
|
|
280
|
+
function H(e) {
|
|
281
|
+
try {
|
|
282
|
+
return a(e((e) => e.slide_cursor_resource_usage()));
|
|
283
|
+
} catch (e) {
|
|
284
|
+
if (String(e).includes("slide cursor usage is unavailable")) return;
|
|
285
|
+
throw e;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function he(e, t, n, r, i) {
|
|
289
|
+
let a, o;
|
|
290
|
+
try {
|
|
291
|
+
if (i) {
|
|
292
|
+
if (!r) throw Error("slide payload is missing before acknowledgement");
|
|
293
|
+
let t = i(n, r, H(e));
|
|
294
|
+
typeof t == "function" ? a = t : t && ({rollback: a, commit: o} = t);
|
|
295
|
+
}
|
|
296
|
+
e((e) => e.acknowledge_slide(t.operationId, t.generation)), o?.();
|
|
297
|
+
} catch (e) {
|
|
298
|
+
try {
|
|
299
|
+
a?.();
|
|
300
|
+
} catch {}
|
|
301
|
+
throw e;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region packages/pptx/src/slide-pull-worker.ts
|
|
306
|
+
var ge = "ooxml-pull-resetting", _e = "ooxml-pull-reset-failed", ve = class {
|
|
307
|
+
coordinatorGeneration = new f();
|
|
308
|
+
sessions = /* @__PURE__ */ new Map();
|
|
309
|
+
pendingOpens = /* @__PURE__ */ new Map();
|
|
310
|
+
operationTail = Promise.resolve();
|
|
311
|
+
resourceFailure;
|
|
312
|
+
lifecycleState = "ready";
|
|
313
|
+
resetBarrier;
|
|
314
|
+
resetIdentities = /* @__PURE__ */ new Map();
|
|
315
|
+
constructor(e, t, n = (e) => e(this.requireArchive())) {
|
|
316
|
+
this.archive = e, this.acceptSlide = t, this.executeArchive = n;
|
|
317
|
+
}
|
|
318
|
+
get coordinator() {
|
|
319
|
+
return this.coordinatorGeneration;
|
|
320
|
+
}
|
|
321
|
+
reserveOpen(e) {
|
|
322
|
+
if (this.assertReady(), ye(e), this.pendingOpens.has(e.sessionId) || this.sessions.has(e.sessionId)) throw Error("slide pull session id is already reserved");
|
|
323
|
+
this.pendingOpens.set(e.sessionId, {
|
|
324
|
+
identity: e,
|
|
325
|
+
canceled: !1
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
abandonOpen(e) {
|
|
329
|
+
this.pendingOpens.delete(e);
|
|
330
|
+
}
|
|
331
|
+
get pendingOpenCount() {
|
|
332
|
+
return this.pendingOpens.size;
|
|
333
|
+
}
|
|
334
|
+
async open(e, t) {
|
|
335
|
+
if (this.assertReady(), this.resourceFailure) throw this.resourceFailure;
|
|
336
|
+
if (!Number.isSafeInteger(e) || e < 0) throw RangeError("slide index must be a non-negative safe integer");
|
|
337
|
+
let n = this.pendingOpens.get(t.sessionId);
|
|
338
|
+
if (!n || !U(n.identity, t)) throw Error("slide pull session open reservation is stale or missing");
|
|
339
|
+
let r, i = new Promise((e) => {
|
|
340
|
+
r = e;
|
|
341
|
+
}), a = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
|
342
|
+
if (n.canceled) throw Error("slide pull session open was canceled");
|
|
343
|
+
let i, a = !1, o = new s({
|
|
344
|
+
...t,
|
|
345
|
+
maxByteCredit: u,
|
|
346
|
+
coordinator: this.coordinator,
|
|
347
|
+
driver: {
|
|
348
|
+
pull: (n) => {
|
|
349
|
+
let r;
|
|
350
|
+
try {
|
|
351
|
+
r = this.executeArchive((r) => r.pull_slide(e, t.operationId, t.generation, n));
|
|
352
|
+
} catch (e) {
|
|
353
|
+
throw ee(e, n, u) || (this.latchResourceFailure(e), e);
|
|
354
|
+
}
|
|
355
|
+
let o = m(r);
|
|
356
|
+
return this.acceptSlide && (i = JSON.parse(new TextDecoder().decode(new Uint8Array(o)))), a = !0, {
|
|
357
|
+
payload: o,
|
|
358
|
+
byteLength: o.byteLength,
|
|
359
|
+
done: !0,
|
|
360
|
+
transfer: [o]
|
|
361
|
+
};
|
|
362
|
+
},
|
|
363
|
+
measureChunk: ({ payload: e }) => e.byteLength,
|
|
364
|
+
acknowledge: () => {
|
|
365
|
+
if (!a) throw Error("slide unit is not awaiting acknowledgement");
|
|
366
|
+
try {
|
|
367
|
+
he(this.executeArchive, t, e, i, this.acceptSlide);
|
|
368
|
+
} catch (e) {
|
|
369
|
+
throw this.latchResourceFailure(e), e;
|
|
370
|
+
}
|
|
371
|
+
a = !1, i = void 0, this.sessions.delete(t.sessionId), r();
|
|
372
|
+
},
|
|
373
|
+
cancel: async () => {
|
|
374
|
+
try {
|
|
375
|
+
this.archive() && await this.executeArchive((e) => e.cancel_slide());
|
|
376
|
+
} finally {
|
|
377
|
+
i = void 0, a = !1, this.sessions.delete(t.sessionId), r();
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
close: async () => {
|
|
381
|
+
try {
|
|
382
|
+
this.archive() && await this.executeArchive((e) => e.cancel_slide());
|
|
383
|
+
} finally {
|
|
384
|
+
i = void 0, a = !1, this.sessions.delete(t.sessionId), r();
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
resourceUsage: () => {
|
|
388
|
+
try {
|
|
389
|
+
return this.readResourceUsage();
|
|
390
|
+
} catch (e) {
|
|
391
|
+
throw this.latchResourceFailure(e), e;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
this.sessions.set(t.sessionId, {
|
|
397
|
+
host: o,
|
|
398
|
+
identity: t
|
|
399
|
+
}), this.pendingOpens.delete(t.sessionId);
|
|
400
|
+
}));
|
|
401
|
+
this.operationTail = a.then(() => i, () => void 0);
|
|
402
|
+
try {
|
|
403
|
+
await a;
|
|
404
|
+
} catch (e) {
|
|
405
|
+
throw this.pendingOpens.delete(t.sessionId), r(), e;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
async postOpenedSafely(e, t, n) {
|
|
409
|
+
if (this.lifecycleState !== "ready") {
|
|
410
|
+
try {
|
|
411
|
+
n(this.lifecycleError());
|
|
412
|
+
} catch {}
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
try {
|
|
416
|
+
t();
|
|
417
|
+
} catch (t) {
|
|
418
|
+
await this.closeIdentity(e);
|
|
419
|
+
try {
|
|
420
|
+
n(t);
|
|
421
|
+
} catch {}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
dispatch(e, t) {
|
|
425
|
+
if (this.lifecycleState !== "ready") return t(this.responseDuringReset(e)), Promise.resolve();
|
|
426
|
+
let n = this.sessions.get(e.sessionId);
|
|
427
|
+
if (n) return n.host.dispatch(e, t);
|
|
428
|
+
let r = this.pendingOpens.get(e.sessionId);
|
|
429
|
+
if (r && (e.kind === "cancel" || e.kind === "close")) {
|
|
430
|
+
let n = U(r.identity, e);
|
|
431
|
+
return n && (r.canceled = !0), t(n ? {
|
|
432
|
+
protocol: d,
|
|
433
|
+
kind: "accepted",
|
|
434
|
+
sessionId: e.sessionId,
|
|
435
|
+
operationId: e.operationId,
|
|
436
|
+
generation: e.generation,
|
|
437
|
+
requestId: e.requestId,
|
|
438
|
+
command: e.kind
|
|
439
|
+
} : this.staleLifecycleResponse(e)), Promise.resolve();
|
|
440
|
+
}
|
|
441
|
+
return e.kind === "cancel" || e.kind === "close" ? (t({
|
|
442
|
+
protocol: d,
|
|
443
|
+
kind: "accepted",
|
|
444
|
+
sessionId: e.sessionId,
|
|
445
|
+
operationId: e.operationId,
|
|
446
|
+
generation: e.generation,
|
|
447
|
+
requestId: e.requestId,
|
|
448
|
+
command: e.kind
|
|
449
|
+
}), Promise.resolve()) : (t({
|
|
450
|
+
protocol: d,
|
|
451
|
+
kind: "error",
|
|
452
|
+
sessionId: e.sessionId,
|
|
453
|
+
operationId: e.operationId,
|
|
454
|
+
generation: e.generation,
|
|
455
|
+
requestId: e.requestId,
|
|
456
|
+
error: i(/* @__PURE__ */ Error("slide pull session is not open"))
|
|
457
|
+
}), Promise.resolve());
|
|
458
|
+
}
|
|
459
|
+
async dispatchSafely(e, t) {
|
|
460
|
+
try {
|
|
461
|
+
await this.dispatch(e, t);
|
|
462
|
+
} catch (n) {
|
|
463
|
+
try {
|
|
464
|
+
t({
|
|
465
|
+
protocol: d,
|
|
466
|
+
kind: "error",
|
|
467
|
+
sessionId: e.sessionId,
|
|
468
|
+
operationId: e.operationId,
|
|
469
|
+
generation: e.generation,
|
|
470
|
+
requestId: e.requestId,
|
|
471
|
+
error: i(n)
|
|
472
|
+
});
|
|
473
|
+
} catch {}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
run(e) {
|
|
477
|
+
if (this.lifecycleState !== "ready") return Promise.reject(this.lifecycleError());
|
|
478
|
+
let t = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
|
479
|
+
if (this.resourceFailure) throw this.resourceFailure;
|
|
480
|
+
return e();
|
|
481
|
+
})).catch((e) => {
|
|
482
|
+
throw this.latchResourceFailure(e), e;
|
|
483
|
+
});
|
|
484
|
+
return this.operationTail = t.then(() => void 0, () => void 0), t;
|
|
485
|
+
}
|
|
486
|
+
reset() {
|
|
487
|
+
if (this.resetBarrier) return this.resetBarrier;
|
|
488
|
+
this.lifecycleState = "resetting", this.captureResetIdentities();
|
|
489
|
+
let e = this.performReset().then(() => {
|
|
490
|
+
this.resetIdentities.clear(), this.lifecycleState = "ready";
|
|
491
|
+
}, (e) => {
|
|
492
|
+
throw this.lifecycleState = "reset-failed", e;
|
|
493
|
+
}).finally(() => {
|
|
494
|
+
this.resetBarrier === e && (this.resetBarrier = void 0);
|
|
495
|
+
});
|
|
496
|
+
return this.resetBarrier = e, e;
|
|
497
|
+
}
|
|
498
|
+
async performReset() {
|
|
499
|
+
for (let e of this.pendingOpens.values()) e.canceled = !0;
|
|
500
|
+
let e = 1;
|
|
501
|
+
for (let { host: t, identity: r } of [...this.sessions.values()]) {
|
|
502
|
+
let i;
|
|
503
|
+
if (await t.dispatch({
|
|
504
|
+
protocol: d,
|
|
505
|
+
kind: "close",
|
|
506
|
+
...r,
|
|
507
|
+
requestId: e++
|
|
508
|
+
}, (e) => {
|
|
509
|
+
e.kind === "error" && (i = n(e.error));
|
|
510
|
+
}), i) throw i;
|
|
511
|
+
}
|
|
512
|
+
this.sessions.clear(), await this.operationTail, this.pendingOpens.clear(), this.archive() && await this.executeArchive((e) => e.close_presentation_session()), this.coordinatorGeneration = new f(), this.resourceFailure = void 0;
|
|
513
|
+
}
|
|
514
|
+
assertReady() {
|
|
515
|
+
if (this.lifecycleState !== "ready") throw this.lifecycleError();
|
|
516
|
+
}
|
|
517
|
+
lifecycleError() {
|
|
518
|
+
let e = this.lifecycleState === "reset-failed", t = /* @__PURE__ */ Error(e ? "slide pull worker reset failed; retry reset before new work" : "slide pull worker reset is in progress");
|
|
519
|
+
return t.name = "PullSessionLifecycleError", Object.assign(t, { code: e ? _e : ge });
|
|
520
|
+
}
|
|
521
|
+
captureResetIdentities() {
|
|
522
|
+
for (let { identity: e } of this.sessions.values()) this.resetIdentities.set(e.sessionId, e);
|
|
523
|
+
for (let { identity: e } of this.pendingOpens.values()) this.resetIdentities.set(e.sessionId, e);
|
|
524
|
+
}
|
|
525
|
+
responseDuringReset(e) {
|
|
526
|
+
if (e.kind === "cancel" || e.kind === "close") {
|
|
527
|
+
let t = this.resetIdentities.get(e.sessionId);
|
|
528
|
+
return t && !U(t, e) ? this.staleLifecycleResponse(e) : {
|
|
529
|
+
protocol: d,
|
|
530
|
+
kind: "accepted",
|
|
531
|
+
sessionId: e.sessionId,
|
|
532
|
+
operationId: e.operationId,
|
|
533
|
+
generation: e.generation,
|
|
534
|
+
requestId: e.requestId,
|
|
535
|
+
command: e.kind
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
protocol: d,
|
|
540
|
+
kind: "error",
|
|
541
|
+
sessionId: e.sessionId,
|
|
542
|
+
operationId: e.operationId,
|
|
543
|
+
generation: e.generation,
|
|
544
|
+
requestId: e.requestId,
|
|
545
|
+
error: i(this.lifecycleError())
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
requireArchive() {
|
|
549
|
+
let e = this.archive();
|
|
550
|
+
if (!e) throw Error("Presentation not loaded");
|
|
551
|
+
return e;
|
|
552
|
+
}
|
|
553
|
+
async closeIdentity(e) {
|
|
554
|
+
if (this.lifecycleState !== "ready") return;
|
|
555
|
+
let t = this.sessions.get(e.sessionId);
|
|
556
|
+
if (t) {
|
|
557
|
+
await t.host.dispatch({
|
|
558
|
+
protocol: d,
|
|
559
|
+
kind: "close",
|
|
560
|
+
...e,
|
|
561
|
+
requestId: 1
|
|
562
|
+
}, () => void 0);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
let n = this.pendingOpens.get(e.sessionId);
|
|
566
|
+
n && U(n.identity, e) && (n.canceled = !0);
|
|
567
|
+
}
|
|
568
|
+
readResourceUsage() {
|
|
569
|
+
return H(this.executeArchive);
|
|
570
|
+
}
|
|
571
|
+
latchResourceFailure(e) {
|
|
572
|
+
let n = e instanceof r ? e : t(e);
|
|
573
|
+
n && (this.resourceFailure ??= n);
|
|
574
|
+
}
|
|
575
|
+
staleLifecycleResponse(e) {
|
|
576
|
+
return {
|
|
577
|
+
protocol: d,
|
|
578
|
+
kind: "error",
|
|
579
|
+
sessionId: e.sessionId,
|
|
580
|
+
operationId: e.operationId,
|
|
581
|
+
generation: e.generation,
|
|
582
|
+
requestId: e.requestId,
|
|
583
|
+
error: {
|
|
584
|
+
message: "stale lifecycle targets another slide operation",
|
|
585
|
+
errorName: "PullSessionProtocolError",
|
|
586
|
+
code: "ooxml-stale-lifecycle"
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
function ye(e) {
|
|
592
|
+
if (!Number.isSafeInteger(e.sessionId) || e.sessionId <= 0) throw RangeError("session id must be a positive safe integer");
|
|
593
|
+
if (!Number.isSafeInteger(e.operationId) || e.operationId <= 0) throw RangeError("operation id must be a positive safe integer");
|
|
594
|
+
if (!Number.isSafeInteger(e.generation) || e.generation <= 0) throw RangeError("generation must be a positive safe integer");
|
|
595
|
+
}
|
|
596
|
+
function U(e, t) {
|
|
597
|
+
return e.sessionId === t.sessionId && e.operationId === t.operationId && e.generation === t.generation;
|
|
598
|
+
}
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region packages/node/src/in-process-pull-transport.ts
|
|
601
|
+
var W = class {
|
|
602
|
+
nextRequestId = 1;
|
|
603
|
+
terminated = !1;
|
|
604
|
+
constructor(e, t) {
|
|
605
|
+
this.dispatch = e, this.terminateHost = t;
|
|
606
|
+
}
|
|
607
|
+
async request(e, t, n) {
|
|
608
|
+
if (this.terminated) throw Error("pull transport terminated");
|
|
609
|
+
if (n?.signal?.aborted) {
|
|
610
|
+
n.onCancel?.(this.nextRequestId, "abort");
|
|
611
|
+
let e = /* @__PURE__ */ Error("worker request aborted");
|
|
612
|
+
throw e.name = "AbortError", e;
|
|
613
|
+
}
|
|
614
|
+
let r = e(this.nextRequestId++), i;
|
|
615
|
+
if (await this.dispatch(r, (e) => {
|
|
616
|
+
i = e;
|
|
617
|
+
}), i === void 0) throw Error("in-process pull host did not respond");
|
|
618
|
+
return i;
|
|
619
|
+
}
|
|
620
|
+
forgetOrphaned(e) {}
|
|
621
|
+
terminate() {
|
|
622
|
+
this.terminated || (this.terminated = !0, this.terminateHost());
|
|
623
|
+
}
|
|
624
|
+
}, be = /* @__PURE__ */ new WeakMap();
|
|
625
|
+
function G(e, t) {
|
|
626
|
+
let n = h(t), r = new WebAssembly.Module(n);
|
|
627
|
+
return be.set(e, e.initSync({ module: r })), e;
|
|
628
|
+
}
|
|
629
|
+
function K(e, t) {
|
|
630
|
+
let n = le(se(e)), r = g(n, t);
|
|
631
|
+
return oe(r) ? r : g(n, ce(t));
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region packages/node/src/pptx.ts
|
|
635
|
+
var xe = /* @__PURE__ */ e({
|
|
636
|
+
extractImage: () => Z,
|
|
637
|
+
extractMedia: () => X,
|
|
638
|
+
openPptxPresentation: () => Y,
|
|
639
|
+
parsePptx: () => J
|
|
640
|
+
}), Se = !1;
|
|
641
|
+
function q() {
|
|
642
|
+
Se ||= (G(ue, K(import.meta.url, "../../pptx/src/wasm/pptx_parser_bg.wasm")), !0);
|
|
643
|
+
}
|
|
644
|
+
function J(e) {
|
|
645
|
+
q();
|
|
646
|
+
let t = b(e instanceof Uint8Array ? e : new Uint8Array(e));
|
|
647
|
+
return JSON.parse(new TextDecoder().decode(t));
|
|
648
|
+
}
|
|
649
|
+
async function Y(e, n = {}) {
|
|
650
|
+
let r = ne(n), i = new c({
|
|
651
|
+
enabled: r.debug || r.onResourceMetrics !== void 0,
|
|
652
|
+
format: "pptx",
|
|
653
|
+
mode: "node",
|
|
654
|
+
scope: "session",
|
|
655
|
+
policy: r.policy,
|
|
656
|
+
onMetrics: r.onResourceMetrics,
|
|
657
|
+
emitToConsole: r.debug
|
|
658
|
+
});
|
|
659
|
+
i.setSourceBytes(Q(e).byteLength);
|
|
660
|
+
let a = _, o;
|
|
661
|
+
try {
|
|
662
|
+
$(n.signal), q();
|
|
663
|
+
let [t, s] = l(r.policy);
|
|
664
|
+
o = new a(Q(e), t, s);
|
|
665
|
+
let c = ie(JSON.parse(new TextDecoder().decode(o.presentation_bootstrap())));
|
|
666
|
+
return i.checkpoint("presentation bootstrap ready"), new Ce(o, c, i, n.signal);
|
|
667
|
+
} catch (e) {
|
|
668
|
+
try {
|
|
669
|
+
o?.free();
|
|
670
|
+
} catch {}
|
|
671
|
+
let n = t(e) ?? e;
|
|
672
|
+
throw i.fail(n), n;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
var Ce = class {
|
|
676
|
+
slideCount;
|
|
677
|
+
slideWidth;
|
|
678
|
+
slideHeight;
|
|
679
|
+
slidePull;
|
|
680
|
+
slideClient;
|
|
681
|
+
transport;
|
|
682
|
+
started = !1;
|
|
683
|
+
closed = !1;
|
|
684
|
+
closePromise;
|
|
685
|
+
usage;
|
|
686
|
+
consumedSlides = 0;
|
|
687
|
+
resourceFailure;
|
|
688
|
+
renderTail = Promise.resolve();
|
|
689
|
+
fetchImage = (e, t) => this.getPartInternal(e, t, (t) => t.extract_image(e));
|
|
690
|
+
fetchMedia = (e) => this.getPartInternal(e, "application/octet-stream", (t) => t.extract_media(e));
|
|
691
|
+
rawParts = new te({
|
|
692
|
+
maxEntries: 64,
|
|
693
|
+
maxBytes: o
|
|
694
|
+
});
|
|
695
|
+
constructor(e, t, n, r) {
|
|
696
|
+
this.archive = e, this.bootstrap = t, this.metrics = n, this.signal = r, this.slideCount = t.slideCount, this.slideWidth = t.slideWidth, this.slideHeight = t.slideHeight, this.slidePull = new ve(() => this.archive), this.transport = new W((e, t) => this.slidePull.dispatchSafely(e, t), () => void 0), this.slideClient = new ae({
|
|
697
|
+
slideCount: this.slideCount,
|
|
698
|
+
transport: this.transport,
|
|
699
|
+
open: async (e, t) => {
|
|
700
|
+
this.slidePull.reserveOpen(t), await this.slidePull.open(e, t);
|
|
701
|
+
},
|
|
702
|
+
onUsage: (e) => {
|
|
703
|
+
this.usage = e, this.metrics.observeUsage(e);
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
get resourceUsage() {
|
|
708
|
+
return this.closed ? this.usage : this.refreshResourceUsage();
|
|
709
|
+
}
|
|
710
|
+
async getImage(e, t) {
|
|
711
|
+
return this.assertOpen(), this.getPartInternal(e, t, (t) => t.extract_image(e)).catch((e) => this.failOperation(e));
|
|
712
|
+
}
|
|
713
|
+
async getMedia(e, t = "application/octet-stream") {
|
|
714
|
+
return this.assertOpen(), this.getPartInternal(e, t, (t) => t.extract_media(e)).catch((e) => this.failOperation(e));
|
|
715
|
+
}
|
|
716
|
+
async renderSlide(e, t, n) {
|
|
717
|
+
return this.assertOpen(), this.enqueueRender(async () => {
|
|
718
|
+
$(this.signal);
|
|
719
|
+
let { renderSlideNode: r } = await import("./render-C0wMf5eT.js").then((e) => e.a);
|
|
720
|
+
await r(e, {
|
|
721
|
+
slideWidth: this.slideWidth,
|
|
722
|
+
slideHeight: this.slideHeight,
|
|
723
|
+
slides: [t],
|
|
724
|
+
defaultTextColor: this.bootstrap.defaultTextColor,
|
|
725
|
+
majorFont: this.bootstrap.majorFont,
|
|
726
|
+
minorFont: this.bootstrap.minorFont,
|
|
727
|
+
...this.bootstrap.hlinkColor ? { hlinkColor: this.bootstrap.hlinkColor } : {},
|
|
728
|
+
...this.bootstrap.folHlinkColor ? { folHlinkColor: this.bootstrap.folHlinkColor } : {}
|
|
729
|
+
}, 0, {
|
|
730
|
+
...n,
|
|
731
|
+
fetchImage: this.fetchImage,
|
|
732
|
+
fetchMedia: this.fetchMedia
|
|
733
|
+
}), $(this.signal);
|
|
734
|
+
}).catch((e) => this.failOperation(e));
|
|
735
|
+
}
|
|
736
|
+
[Symbol.asyncIterator]() {
|
|
737
|
+
return this.slides();
|
|
738
|
+
}
|
|
739
|
+
async *slides() {
|
|
740
|
+
if (this.closed) throw Error("PPTX presentation session is closed");
|
|
741
|
+
if (this.started) throw Error("PPTX presentation session is one-pass and was already consumed");
|
|
742
|
+
this.started = !0;
|
|
743
|
+
let e;
|
|
744
|
+
try {
|
|
745
|
+
for (let e = 0; e < this.slideCount; e += 1) {
|
|
746
|
+
$(this.signal);
|
|
747
|
+
let t = await this.slideClient.load(e);
|
|
748
|
+
if (!t) throw Error(`PPTX slide ${e} was not decoded`);
|
|
749
|
+
this.usage ??= await this.slidePull.run(() => H((e) => e(this.archive))), this.metrics.observeUsage(this.usage), this.consumedSlides = e + 1, yield t;
|
|
750
|
+
}
|
|
751
|
+
} catch (n) {
|
|
752
|
+
throw e = t(n) ?? n, this.metrics.fail(e), e;
|
|
753
|
+
} finally {
|
|
754
|
+
try {
|
|
755
|
+
await this.close();
|
|
756
|
+
} catch (t) {
|
|
757
|
+
if (e === void 0) throw t;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
close() {
|
|
762
|
+
return this.closePromise ? this.closePromise : (this.closed = !0, this.slideClient.cancelAll(), this.closePromise = this.release(), this.closePromise);
|
|
763
|
+
}
|
|
764
|
+
async release() {
|
|
765
|
+
let e;
|
|
766
|
+
await this.renderTail, p(this.fetchImage), re(this.fetchImage);
|
|
767
|
+
try {
|
|
768
|
+
await this.slidePull.reset();
|
|
769
|
+
} catch (n) {
|
|
770
|
+
e = t(n) ?? n;
|
|
771
|
+
}
|
|
772
|
+
this.transport.terminate(), this.rawParts.clear();
|
|
773
|
+
try {
|
|
774
|
+
this.archive.free();
|
|
775
|
+
} catch (n) {
|
|
776
|
+
e ??= t(n) ?? n;
|
|
777
|
+
}
|
|
778
|
+
if (e !== void 0) throw this.metrics.fail(e), e;
|
|
779
|
+
this.metrics.checkpoint("presentation session closed"), this.metrics.succeed({ slides: this.consumedSlides });
|
|
780
|
+
}
|
|
781
|
+
enqueueRender(e) {
|
|
782
|
+
let t = this.renderTail.then(e, e);
|
|
783
|
+
return this.renderTail = t.then(() => void 0, () => void 0), t;
|
|
784
|
+
}
|
|
785
|
+
getPartInternal(e, t, n) {
|
|
786
|
+
return this.rawParts.get(e, t, () => {
|
|
787
|
+
$(this.signal);
|
|
788
|
+
let e = n(this.archive);
|
|
789
|
+
return this.refreshResourceUsage(), new Blob([new Uint8Array(e).slice()], { type: t });
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
refreshResourceUsage() {
|
|
793
|
+
try {
|
|
794
|
+
this.usage = a(this.archive.resource_usage()), this.metrics.observeUsage(this.usage);
|
|
795
|
+
} catch {}
|
|
796
|
+
return this.usage;
|
|
797
|
+
}
|
|
798
|
+
assertOpen() {
|
|
799
|
+
if (this.closed) throw Error("PPTX presentation session is closed");
|
|
800
|
+
if (this.resourceFailure) throw this.resourceFailure;
|
|
801
|
+
}
|
|
802
|
+
failOperation(e) {
|
|
803
|
+
let n = t(e) ?? e;
|
|
804
|
+
throw n instanceof r && (this.resourceFailure ??= n), this.metrics.fail(n), n;
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
function X(e, t) {
|
|
808
|
+
return q(), y(e instanceof Uint8Array ? e : new Uint8Array(e), t);
|
|
809
|
+
}
|
|
810
|
+
function Z(e, t, n) {
|
|
811
|
+
return q(), v(e instanceof Uint8Array ? e : new Uint8Array(e), t, typeof n == "number" && n > 0 ? BigInt(n) : void 0);
|
|
812
|
+
}
|
|
813
|
+
function Q(e) {
|
|
814
|
+
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
815
|
+
}
|
|
816
|
+
function $(e) {
|
|
817
|
+
if (!e?.aborted) return;
|
|
818
|
+
let t = /* @__PURE__ */ Error("PPTX presentation session was aborted");
|
|
819
|
+
throw t.name = "AbortError", t;
|
|
820
|
+
}
|
|
821
|
+
//#endregion
|
|
822
|
+
export { xe as a, W as c, J as i, X as n, G as o, Y as r, K as s, Z as t };
|