@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.
- package/README.md +118 -23
- package/THIRD_PARTY_NOTICES.md +8 -7
- package/dist/abort-VrnK7mdP.js +10 -0
- package/dist/assets/render-worker-C5G_Nr_A.js +35 -0
- package/dist/assets/render-worker-DQfWdNsm.js +16 -0
- package/dist/assets/render-worker-Ds7LjwU-.js +15 -0
- package/dist/{hyperlink-Cxzhet30.js → bounded-raw-part-cache-CsnNptAy.js} +4937 -7458
- package/dist/bundled-asset-url-E2nXURF9.js +15 -0
- package/dist/canvas-viewer-mechanics-BZ8QCrRi.js +675 -0
- package/dist/cfb-guard-dNeUiANF.js +528 -0
- package/dist/chart-ex.mjs +667 -663
- package/dist/comment-overlay-controller-CBvQx-En.js +994 -0
- package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
- package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-BKidRH36.js} +5 -5
- package/dist/{comment-ui-runtime-CWGqn5Vr.js → comment-ui-runtime-C47QoDUy.js} +5 -5
- package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
- package/dist/document-model-source-MzFPrxt0.js +249 -0
- package/dist/document-pull-client-BoJeuURD.js +35941 -0
- package/dist/document-pull-worker-CaP8XESP.js +104 -0
- package/dist/docx-BN70UhvX.js +495 -0
- package/dist/docx-BRRtSvk3.js +3563 -0
- package/dist/docx-model-source-CTO9iw_W.js +98 -0
- package/dist/docx-source-worker.mjs +455 -0
- package/dist/docx.mjs +7 -7
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/drawingml-shape-CHmq8kpM.js +310 -0
- package/dist/duotone-DN8P4aXe.js +126 -0
- package/dist/emf-CGFQIz6c.js +1790 -0
- package/dist/font-preload-demand-Dmy31xt-.js +2058 -0
- package/dist/grid-geometry-C3IG20ut.js +384 -0
- package/dist/host-layout-DVMw8hDY.js +56 -0
- package/dist/host-layout-measure-DsuQ2UJs.js +7 -0
- package/dist/in-process-pull-transport-DuXcPZng.js +29 -0
- package/dist/index.mjs +4 -4
- package/dist/internal-companion.mjs +12 -0
- package/dist/line-distribute-Bu8psjGd.js +2799 -0
- package/dist/math.mjs +2 -2
- package/dist/mathjax-stix2.js +10 -10
- package/dist/model-source-kz_NkZqT.js +179 -0
- package/dist/model-source-s5hRpk4w.js +61 -0
- package/dist/model-source-session-6fuaqbGs.js +71 -0
- package/dist/model-source-session-DqrR4XHR.js +85 -0
- package/dist/model-source-session-cPJSF_Ak.js +58 -0
- package/dist/node.mjs +7 -1327
- package/dist/{pixel-budget-9P63Bsk5.js → pixel-budget-BpTYrepD.js} +13 -10
- package/dist/plot-area-frame-Bs_j4uu7.js +41811 -0
- package/dist/pptx-CaJ6ILnw.js +183 -0
- package/dist/pptx-_BOGcBym.js +2936 -0
- package/dist/pptx-model-source-B_9afw9R.js +37 -0
- package/dist/pptx-source-worker.mjs +446 -0
- package/dist/pptx.mjs +8 -7
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/presentation-model-source-CGHLyX32.js +77 -0
- package/dist/raster-target-YQ4G6rxo.js +42 -0
- package/dist/region-map.mjs +117 -153
- package/dist/{render-D3iqVKCo.js → render-CzbDzRKa.js} +3 -3
- package/dist/{render-worker-host-B5wQfB7U.js → render-worker-host-B1u6BOUd.js} +1 -1
- package/dist/{render-worker-host-D4123J27.js → render-worker-host-C-EECo68.js} +1 -1
- package/dist/{render-worker-host-Di3LxLc0.js → render-worker-host-DDqZTCVf.js} +1 -1
- package/dist/renderer-CD2cvVAF.js +5823 -0
- package/dist/renderer-DRoeb14O.js +5170 -0
- package/dist/resource-measurement-Dhhm7P_l.js +772 -0
- package/dist/session-XPmC0CUd.js +656 -0
- package/dist/slide-pull-client-tq7U_fYg.js +6485 -0
- package/dist/three-d-BKwNPAP4.js +878 -0
- package/dist/three-d.mjs +925 -910
- package/dist/{raster-target-ojDdQizC.js → tiff-contract-C6M3QcPp.js} +1 -42
- package/dist/tiff.mjs +401 -248
- package/dist/types/chart-ex.d.ts +149 -2
- package/dist/types/docx.d.ts +333 -96
- package/dist/types/index.d.ts +566 -301
- package/dist/types/internal-companion.d.ts +11 -0
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +422 -9
- package/dist/types/pptx.d.ts +302 -95
- package/dist/types/region-map.d.ts +149 -2
- package/dist/types/three-d.d.ts +149 -2
- package/dist/types/tiff.d.ts +1 -1
- package/dist/types/xlsx.d.ts +343 -132
- package/dist/wasm-loader-rlgHmcSv.js +35 -0
- package/dist/wasm-runtime-generation-D6TKZdNb.js +97 -0
- package/dist/workbook-model-source-BIGrfZy6.js +94 -0
- package/dist/worker-source-DrwhR9fw.js +22 -0
- package/dist/worker-source-SbudzjYL.js +22 -0
- package/dist/worker-source-UAi3GNcM.js +22 -0
- package/dist/worksheet-pull-client-ClvPO_Jf.js +579 -0
- package/dist/xlsx-CsmREBaZ.js +5819 -0
- package/dist/xlsx-DmHfeNNp.js +534 -0
- package/dist/xlsx-model-source-D1flORqy.js +309 -0
- package/dist/xlsx-source-worker.mjs +525 -0
- package/dist/xlsx.mjs +8 -7
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +42 -16
- package/dist/assets/render-worker-1uPAxMZr.js +0 -31
- package/dist/assets/render-worker-BlvJybji.js +0 -10
- package/dist/assets/render-worker-CzmiJfFL.js +0 -11
- package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
- package/dist/canvas-viewer-mechanics-DbLz0rYW.js +0 -1384
- package/dist/cjk-fallback-bLI3z70h.js +0 -46
- package/dist/comment-occurrence-C8Y2uoVr.js +0 -6
- package/dist/comment-ui-runtime-BsK8pmUT.js +0 -2
- package/dist/comments-Diid5ujN.js +0 -246
- package/dist/delimited-text-worker-host-BVY-Ecni.js +0 -27
- package/dist/document-pull-client-B9PTM-pL.js +0 -27280
- package/dist/docx-BF9WXrYH.js +0 -3103
- package/dist/dom-interaction-boundary-Cnm8DSBN.js +0 -223
- package/dist/highlight-rect-C5hkRqUr.js +0 -13
- package/dist/line-distribute-D1WNHKz_.js +0 -1023
- package/dist/line-metrics-B60C86uh.js +0 -60
- package/dist/plot-area-frame-DLTYKHNP.js +0 -4354
- package/dist/pptx-DkyYBYoL.js +0 -3065
- package/dist/renderer-B4GZb5We.js +0 -6492
- package/dist/resource-measurement-SHQCbkh2.js +0 -150
- package/dist/session-BGq81gRQ.js +0 -743
- package/dist/slide-pull-client-DiPnm240.js +0 -6253
- package/dist/source-key-DIJG8BA0.js +0 -42
- package/dist/three-d-DJBl8g8M.js +0 -1162
- package/dist/transfer-p6iCC2R7.js +0 -6
- package/dist/units-BzZ0gAxs.js +0 -4
- package/dist/worksheet-pull-client-BM8ywvbu.js +0 -458
- package/dist/xlsx-C9NVjgaV.js +0 -8484
- /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
- /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
- /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
- /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
- /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
- /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { qt as e } from "./bounded-raw-part-cache-CsnNptAy.js";
|
|
2
|
+
import { n as t } from "./session-XPmC0CUd.js";
|
|
3
|
+
import { t as n } from "./pptx-CaJ6ILnw.js";
|
|
4
|
+
import { t as r } from "./model-source-s5hRpk4w.js";
|
|
5
|
+
//#region packages/node/src/pptx-model-source.ts
|
|
6
|
+
async function i(t, r, i) {
|
|
7
|
+
let o = await a(t, r, i), s = new Proxy(o.archive, { get(e, t) {
|
|
8
|
+
if (t === "extract_media" && !e.extract_media) return () => {
|
|
9
|
+
throw Error("media extraction is unsupported for this source");
|
|
10
|
+
};
|
|
11
|
+
let n = Reflect.get(e, t);
|
|
12
|
+
return typeof n == "function" ? n.bind(e) : n;
|
|
13
|
+
} });
|
|
14
|
+
return new n(o.closeArchive, s, o.bootstrap, o.metrics, r.signal, e(r.cjkFallback));
|
|
15
|
+
}
|
|
16
|
+
async function a(e, n, i) {
|
|
17
|
+
let { acquirePptxSessionFromArchive: a, validatePptxModelSourceArchive: o, validatePptxModelSourceViewDefaults: s } = await import("./model-source-session-cPJSF_Ak.js"), c = await r(e, "pptx", {
|
|
18
|
+
...n,
|
|
19
|
+
source: n.legacyPpt
|
|
20
|
+
}, o);
|
|
21
|
+
if (c.kind === "ooxml") return t(c.bytes, i(), n);
|
|
22
|
+
try {
|
|
23
|
+
s(c.opened.viewDefaults);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
try {
|
|
26
|
+
c.opened.close();
|
|
27
|
+
} catch {}
|
|
28
|
+
throw e;
|
|
29
|
+
}
|
|
30
|
+
return a({
|
|
31
|
+
archive: c.opened.archive,
|
|
32
|
+
sourceByteLength: c.sourceByteLength,
|
|
33
|
+
closeArchive: c.opened.close
|
|
34
|
+
}, n);
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { i as openPptxSource };
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
//#region packages/core/src/internal/abort.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = Error(e);
|
|
4
|
+
return t.name = "AbortError", t;
|
|
5
|
+
}
|
|
6
|
+
function t(t, n) {
|
|
7
|
+
if (t?.aborted) throw e(n);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region packages/core/src/source/model-source.ts
|
|
11
|
+
var n = "model source load was aborted", r = "ooxml-model-source-module/v2", i = new Set([
|
|
12
|
+
"docx",
|
|
13
|
+
"xlsx",
|
|
14
|
+
"pptx"
|
|
15
|
+
]), a = new Set([
|
|
16
|
+
"http:",
|
|
17
|
+
"https:",
|
|
18
|
+
"file:",
|
|
19
|
+
"blob:"
|
|
20
|
+
]), o = [
|
|
21
|
+
"protocol",
|
|
22
|
+
"target",
|
|
23
|
+
"moduleUrl",
|
|
24
|
+
"config"
|
|
25
|
+
], s = 8192, c = 32, l = 8192, u = 16, d = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
26
|
+
function f(e) {
|
|
27
|
+
if (!(e instanceof Uint8Array)) throw TypeError("model source archive must return Uint8Array bytes");
|
|
28
|
+
let t = new Uint8Array(e.byteLength);
|
|
29
|
+
return t.set(e), t.buffer;
|
|
30
|
+
}
|
|
31
|
+
function p(e, t) {
|
|
32
|
+
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("model source module descriptor must be an object");
|
|
33
|
+
let n = Reflect.ownKeys(e);
|
|
34
|
+
if (n.length !== o.length || o.some((e) => !n.includes(e))) throw TypeError("model source module descriptor has unknown or missing fields");
|
|
35
|
+
let c = Object.getOwnPropertyDescriptors(e);
|
|
36
|
+
if (o.some((e) => !c[e]?.enumerable || !("value" in c[e]))) throw TypeError("model source module descriptor fields must be data properties");
|
|
37
|
+
let l = c.protocol.value, u = c.target.value, d = c.moduleUrl.value;
|
|
38
|
+
if (l !== "ooxml-model-source-module/v2") throw TypeError("unsupported model source module protocol");
|
|
39
|
+
if (typeof u != "string" || !i.has(u)) throw TypeError("unsupported model source target");
|
|
40
|
+
if (t !== void 0 && u !== t) throw TypeError(`a ${u} model source module cannot load ${t} input`);
|
|
41
|
+
if (typeof d != "string" || d.length === 0 || d.length > s || d.trim() !== d) throw TypeError("model source moduleUrl must be a nonempty absolute URL");
|
|
42
|
+
let f;
|
|
43
|
+
try {
|
|
44
|
+
f = new URL(d);
|
|
45
|
+
} catch {
|
|
46
|
+
throw TypeError("model source moduleUrl must be a nonempty absolute URL");
|
|
47
|
+
}
|
|
48
|
+
if (!a.has(f.protocol)) throw TypeError("model source moduleUrl protocol is unsupported");
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
protocol: r,
|
|
51
|
+
target: u,
|
|
52
|
+
moduleUrl: d,
|
|
53
|
+
config: m(c.config.value)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function m(e) {
|
|
57
|
+
if (!b(e)) throw TypeError("model source config must be a plain object");
|
|
58
|
+
let t = Reflect.ownKeys(e);
|
|
59
|
+
if (t.length > c) throw RangeError(`model source config accepts at most ${c} entries`);
|
|
60
|
+
let n = {};
|
|
61
|
+
for (let r of t) {
|
|
62
|
+
if (typeof r != "string" || !d.test(r)) throw TypeError("model source config keys must be short identifiers");
|
|
63
|
+
let t = Object.getOwnPropertyDescriptor(e, r);
|
|
64
|
+
if (!t?.enumerable || !("value" in t)) throw TypeError("model source config entries must be data properties");
|
|
65
|
+
let i = t.value;
|
|
66
|
+
if (typeof i == "string") {
|
|
67
|
+
if (i.length > l) throw RangeError("model source config string is too long");
|
|
68
|
+
} else if (typeof i == "number") {
|
|
69
|
+
if (!Number.isFinite(i)) throw TypeError("model source config numbers must be finite");
|
|
70
|
+
} else if (typeof i != "boolean" && i !== null) throw TypeError("model source config values must be strings, numbers, booleans or null");
|
|
71
|
+
n[r] = i;
|
|
72
|
+
}
|
|
73
|
+
return Object.freeze(n);
|
|
74
|
+
}
|
|
75
|
+
async function h(e, r, i, a, o = []) {
|
|
76
|
+
let s = p(e);
|
|
77
|
+
t(a, n);
|
|
78
|
+
let c = await import(
|
|
79
|
+
/* @vite-ignore */
|
|
80
|
+
s.moduleUrl
|
|
81
|
+
), l = typeof c == "object" && c ? c.openModelSource : void 0;
|
|
82
|
+
if (typeof l != "function") throw TypeError("model source module must export openModelSource()");
|
|
83
|
+
t(a, n);
|
|
84
|
+
let u = await l(r, s.config, a, o);
|
|
85
|
+
if (typeof u != "object" || !u) throw TypeError("openModelSource() must return an object");
|
|
86
|
+
let d = u, f = d.close;
|
|
87
|
+
if (typeof f != "function") throw TypeError("an opened model source must provide close()");
|
|
88
|
+
let m = !1, h = () => {
|
|
89
|
+
m || (m = !0, f.call(u));
|
|
90
|
+
};
|
|
91
|
+
try {
|
|
92
|
+
let e = i(d.archive), r = g(d.viewDefaults);
|
|
93
|
+
return t(a, n), Object.freeze({
|
|
94
|
+
archive: e,
|
|
95
|
+
viewDefaults: r,
|
|
96
|
+
close: h
|
|
97
|
+
});
|
|
98
|
+
} catch (e) {
|
|
99
|
+
try {
|
|
100
|
+
h();
|
|
101
|
+
} catch {}
|
|
102
|
+
throw e;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function g(e) {
|
|
106
|
+
if (e === void 0) return Object.freeze({});
|
|
107
|
+
if (!b(e)) throw TypeError("model source viewDefaults must be a plain object");
|
|
108
|
+
let t = Reflect.ownKeys(e);
|
|
109
|
+
if (t.length > u) throw RangeError("model source viewDefaults has too many entries");
|
|
110
|
+
let n = {};
|
|
111
|
+
for (let r of t) {
|
|
112
|
+
let t = typeof r == "string" ? Object.getOwnPropertyDescriptor(e, r) : void 0;
|
|
113
|
+
if (typeof r != "string" || !d.test(r) || !t?.enumerable || !("value" in t) || typeof t.value != "boolean") throw TypeError("model source viewDefaults entries must be boolean data properties");
|
|
114
|
+
n[r] = t.value;
|
|
115
|
+
}
|
|
116
|
+
return Object.freeze(n);
|
|
117
|
+
}
|
|
118
|
+
function _(e, t, n) {
|
|
119
|
+
if (typeof e != "object" && typeof e != "function" || e === null) throw TypeError(`${t} model source archive must be an object`);
|
|
120
|
+
for (let r of n) if (typeof e[r] != "function") throw TypeError(`${t} model source archive must implement ${r}()`);
|
|
121
|
+
}
|
|
122
|
+
function v(e, t) {
|
|
123
|
+
return (typeof e == "object" || typeof e == "function") && e !== null && typeof e[t] == "function";
|
|
124
|
+
}
|
|
125
|
+
function y(e) {
|
|
126
|
+
return /* @__PURE__ */ Error(`${e} is unsupported for this source`);
|
|
127
|
+
}
|
|
128
|
+
function b(e) {
|
|
129
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
130
|
+
let t = Object.getPrototypeOf(e);
|
|
131
|
+
return t === Object.prototype || t === null;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region packages/core/src/errors/ooxml-error.ts
|
|
135
|
+
var x = class e extends Error {
|
|
136
|
+
code = "ooxml-resource-limit";
|
|
137
|
+
details;
|
|
138
|
+
constructor(t, n) {
|
|
139
|
+
super(t), this.name = "OoxmlResourceLimitError";
|
|
140
|
+
let r = n.violation, i = Object.freeze({
|
|
141
|
+
format: r.format,
|
|
142
|
+
operation: r.operation,
|
|
143
|
+
resource: r.resource,
|
|
144
|
+
metric: r.metric,
|
|
145
|
+
...r.part === void 0 ? {} : { part: r.part },
|
|
146
|
+
limit: r.limit,
|
|
147
|
+
observed: r.observed,
|
|
148
|
+
configurable: r.configurable,
|
|
149
|
+
usage: Object.freeze({
|
|
150
|
+
archiveEntryCount: r.usage.archiveEntryCount,
|
|
151
|
+
declaredInflatedBytes: r.usage.declaredInflatedBytes,
|
|
152
|
+
...r.usage.largestInflatedEntryBytes === void 0 ? {} : { largestInflatedEntryBytes: r.usage.largestInflatedEntryBytes },
|
|
153
|
+
distinctInflatedBytes: r.usage.distinctInflatedBytes,
|
|
154
|
+
operationInflatedBytes: r.usage.operationInflatedBytes
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
this.details = Object.freeze({
|
|
158
|
+
stage: n.stage,
|
|
159
|
+
violation: i
|
|
160
|
+
}), Object.setPrototypeOf(this, e.prototype);
|
|
161
|
+
}
|
|
162
|
+
}, S = "OOXML_RESOURCE_LIMIT:", C = 128, w = 256, T = 4096;
|
|
163
|
+
function E(e) {
|
|
164
|
+
return typeof e == "number" && Number.isSafeInteger(e) && e >= 0;
|
|
165
|
+
}
|
|
166
|
+
function D(e) {
|
|
167
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
168
|
+
let t = e;
|
|
169
|
+
return E(t.archiveEntryCount) && E(t.declaredInflatedBytes) && (t.largestInflatedEntryBytes === void 0 || E(t.largestInflatedEntryBytes)) && E(t.distinctInflatedBytes) && E(t.operationInflatedBytes);
|
|
170
|
+
}
|
|
171
|
+
function O(e) {
|
|
172
|
+
return e === "docx" || e === "xlsx" || e === "pptx";
|
|
173
|
+
}
|
|
174
|
+
function k(e) {
|
|
175
|
+
return e === "container" || e === "decompression" || e === "parsing" || e === "serialization" || e === "layout" || e === "rendering" || e === "worker";
|
|
176
|
+
}
|
|
177
|
+
function A(e, t) {
|
|
178
|
+
return typeof e == "string" && e.length > 0 && e.length <= t && !/[\u0000-\u001f\u007f]/u.test(e);
|
|
179
|
+
}
|
|
180
|
+
function j(e) {
|
|
181
|
+
return A(e, C) && /^[a-z0-9][a-z0-9-]*$/u.test(e);
|
|
182
|
+
}
|
|
183
|
+
function M(e) {
|
|
184
|
+
return !A(e, T) || e.startsWith("/") || e.startsWith("\\") || e.includes("\\") || e.includes("?") || e.includes("#") || e.includes("://") || /^[a-z]:/iu.test(e) ? !1 : e.split("/").every((e) => e !== "" && e !== "." && e !== "..");
|
|
185
|
+
}
|
|
186
|
+
var N = new Map([
|
|
187
|
+
["archive-entry:declared-inflated-bytes", {
|
|
188
|
+
stage: "container",
|
|
189
|
+
part: "required"
|
|
190
|
+
}],
|
|
191
|
+
["archive-entry:actual-inflated-bytes", {
|
|
192
|
+
stage: "decompression",
|
|
193
|
+
part: "required"
|
|
194
|
+
}],
|
|
195
|
+
["archive:entry-count", {
|
|
196
|
+
stage: "container",
|
|
197
|
+
part: "forbidden"
|
|
198
|
+
}],
|
|
199
|
+
["archive:central-directory-bytes", {
|
|
200
|
+
stage: "container",
|
|
201
|
+
part: "forbidden",
|
|
202
|
+
configurable: !1
|
|
203
|
+
}],
|
|
204
|
+
["archive:distinct-inflated-bytes", {
|
|
205
|
+
stage: "decompression",
|
|
206
|
+
part: "required"
|
|
207
|
+
}],
|
|
208
|
+
["xml-event:bytes", {
|
|
209
|
+
stage: "parsing",
|
|
210
|
+
part: "optional",
|
|
211
|
+
configurable: !1
|
|
212
|
+
}],
|
|
213
|
+
["xml-context:bytes", {
|
|
214
|
+
stage: "parsing",
|
|
215
|
+
part: "optional",
|
|
216
|
+
configurable: !1
|
|
217
|
+
}],
|
|
218
|
+
["image-effect:work", {
|
|
219
|
+
stage: "parsing",
|
|
220
|
+
part: "forbidden",
|
|
221
|
+
configurable: !1
|
|
222
|
+
}],
|
|
223
|
+
["chartex-allocation:elements", {
|
|
224
|
+
stage: "parsing",
|
|
225
|
+
part: "forbidden",
|
|
226
|
+
configurable: !1
|
|
227
|
+
}],
|
|
228
|
+
["chartex-allocation:bytes", {
|
|
229
|
+
stage: "parsing",
|
|
230
|
+
part: "forbidden",
|
|
231
|
+
configurable: !1
|
|
232
|
+
}],
|
|
233
|
+
["chart-cache:points", {
|
|
234
|
+
stage: "parsing",
|
|
235
|
+
part: "forbidden",
|
|
236
|
+
configurable: !1
|
|
237
|
+
}],
|
|
238
|
+
["numbering-marker:bytes", {
|
|
239
|
+
stage: "parsing",
|
|
240
|
+
part: "forbidden",
|
|
241
|
+
configurable: !1
|
|
242
|
+
}],
|
|
243
|
+
["chart-style-formats:entries", {
|
|
244
|
+
stage: "parsing",
|
|
245
|
+
part: "required",
|
|
246
|
+
configurable: !1
|
|
247
|
+
}],
|
|
248
|
+
["chart-custom-number-formats:entries", {
|
|
249
|
+
stage: "parsing",
|
|
250
|
+
part: "required",
|
|
251
|
+
configurable: !1
|
|
252
|
+
}],
|
|
253
|
+
["chart-number-format-bytes:bytes", {
|
|
254
|
+
stage: "parsing",
|
|
255
|
+
part: "required",
|
|
256
|
+
configurable: !1
|
|
257
|
+
}],
|
|
258
|
+
["xml-tree:depth", {
|
|
259
|
+
stage: "parsing",
|
|
260
|
+
part: "optional",
|
|
261
|
+
configurable: !1
|
|
262
|
+
}],
|
|
263
|
+
["worksheet-row:projected-bytes", {
|
|
264
|
+
stage: "parsing",
|
|
265
|
+
part: "optional",
|
|
266
|
+
configurable: !1
|
|
267
|
+
}],
|
|
268
|
+
["worksheet-shell:projected-bytes", {
|
|
269
|
+
stage: "parsing",
|
|
270
|
+
part: "optional",
|
|
271
|
+
configurable: !1
|
|
272
|
+
}],
|
|
273
|
+
["theme-style-reparse:bytes", {
|
|
274
|
+
stage: "parsing",
|
|
275
|
+
part: "forbidden",
|
|
276
|
+
configurable: !1
|
|
277
|
+
}],
|
|
278
|
+
["style-inheritance:depth", {
|
|
279
|
+
stage: "parsing",
|
|
280
|
+
part: "required",
|
|
281
|
+
configurable: !1
|
|
282
|
+
}],
|
|
283
|
+
["complex-field:depth", {
|
|
284
|
+
stage: "parsing",
|
|
285
|
+
part: "forbidden",
|
|
286
|
+
configurable: !1
|
|
287
|
+
}]
|
|
288
|
+
]), P = new Set([...N.keys()].map((e) => e.slice(0, e.indexOf(":")))), F = new Set([...N.keys()].map((e) => e.slice(e.indexOf(":") + 1)));
|
|
289
|
+
function I(e) {
|
|
290
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
291
|
+
let t = e;
|
|
292
|
+
return !O(t.format) || !A(t.operation, w) || !j(t.resource) || !j(t.metric) || !E(t.limit) || !E(t.observed) || typeof t.configurable != "boolean" || !D(t.usage) ? !1 : !("part" in t) || M(t.part);
|
|
293
|
+
}
|
|
294
|
+
function L(e) {
|
|
295
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
296
|
+
let t = e;
|
|
297
|
+
if (!k(t.stage) || !I(t.violation)) return !1;
|
|
298
|
+
let n = t.violation, r = N.get(`${n.resource}:${n.metric}`);
|
|
299
|
+
return r ? t.stage !== r.stage || r.configurable === !1 && n.configurable !== !1 ? !1 : r.part === "required" ? n.part !== void 0 : r.part === "forbidden" ? n.part === void 0 : !0 : !(P.has(n.resource) && F.has(n.metric));
|
|
300
|
+
}
|
|
301
|
+
function R(e) {
|
|
302
|
+
let t = e.violation;
|
|
303
|
+
return `OOXML resource limit exceeded${t.part ? ` for ${t.part}` : ""} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`;
|
|
304
|
+
}
|
|
305
|
+
function z(e) {
|
|
306
|
+
let t = e instanceof Error ? e.message : String(e);
|
|
307
|
+
if (!t.startsWith(S)) return;
|
|
308
|
+
let n;
|
|
309
|
+
try {
|
|
310
|
+
n = JSON.parse(t.slice(21));
|
|
311
|
+
} catch {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (!n || typeof n != "object") return;
|
|
315
|
+
let r = n;
|
|
316
|
+
if (!(r.code !== "ooxml-resource-limit" || !L(r.details))) return new x(R(r.details), r.details);
|
|
317
|
+
}
|
|
318
|
+
function B(e) {
|
|
319
|
+
try {
|
|
320
|
+
return e();
|
|
321
|
+
} catch (e) {
|
|
322
|
+
throw e instanceof x || typeof e != "string" && !(e instanceof Error) ? e : z(e) ?? e;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region packages/core/src/worker/wasm-guard.ts
|
|
327
|
+
function V(e) {
|
|
328
|
+
let t = globalThis.WebAssembly?.RuntimeError;
|
|
329
|
+
return t && e instanceof t || e instanceof RangeError ? !0 : e instanceof Error ? e.name === "RuntimeError" || e.name === "CompileError" || e.name === "LinkError" || e.name === "InternalError" || e.name === "OOMError" : !1;
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region packages/core/src/source/worker-model-source.ts
|
|
333
|
+
function H(e, t) {
|
|
334
|
+
return new Proxy(e, { get(e, n) {
|
|
335
|
+
if (n === t) return (...n) => new Uint8Array(f(Reflect.apply(e[t], e, n)));
|
|
336
|
+
let r = Reflect.get(e, n);
|
|
337
|
+
return typeof r == "function" ? r.bind(e) : r;
|
|
338
|
+
} });
|
|
339
|
+
}
|
|
340
|
+
function U(e, t) {
|
|
341
|
+
try {
|
|
342
|
+
return B(e);
|
|
343
|
+
} catch (e) {
|
|
344
|
+
if (V(e)) try {
|
|
345
|
+
t();
|
|
346
|
+
} catch {}
|
|
347
|
+
throw e;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region packages/pptx/src/internal/worker-presentation-source.ts
|
|
352
|
+
var W = [
|
|
353
|
+
"pull_slide",
|
|
354
|
+
"slide_cursor_resource_usage",
|
|
355
|
+
"acknowledge_slide",
|
|
356
|
+
"cancel_slide",
|
|
357
|
+
"close_presentation_session",
|
|
358
|
+
"assert_healthy",
|
|
359
|
+
"presentation_bootstrap",
|
|
360
|
+
"extract_image"
|
|
361
|
+
];
|
|
362
|
+
function G(e) {
|
|
363
|
+
return _(e, "PPTX", W), e;
|
|
364
|
+
}
|
|
365
|
+
function K(e) {
|
|
366
|
+
let [t] = Object.keys(e);
|
|
367
|
+
if (t !== void 0) throw TypeError(`unsupported PPTX model source view default: ${t}`);
|
|
368
|
+
}
|
|
369
|
+
var q = (e, t, n) => h(e, t, G, void 0, n), J = class {
|
|
370
|
+
ooxmlHost;
|
|
371
|
+
openSource;
|
|
372
|
+
modelSource;
|
|
373
|
+
copyBytes(e) {
|
|
374
|
+
return f(e);
|
|
375
|
+
}
|
|
376
|
+
extractImage(e) {
|
|
377
|
+
return this.execute((t) => this.copyBytes(t.extract_image(e)));
|
|
378
|
+
}
|
|
379
|
+
constructor(e, t = q) {
|
|
380
|
+
this.ooxmlHost = e, this.openSource = t;
|
|
381
|
+
}
|
|
382
|
+
get kind() {
|
|
383
|
+
return this.modelSource ? "model-source" : "ooxml";
|
|
384
|
+
}
|
|
385
|
+
async openModelSource(e, t, n = []) {
|
|
386
|
+
if (this.modelSource || this.ooxmlHost.archive) throw Error("Presentation source already loaded");
|
|
387
|
+
let r = await this.openSource(t, e, n);
|
|
388
|
+
try {
|
|
389
|
+
if (K(r.viewDefaults), this.modelSource || this.ooxmlHost.archive) throw Error("Presentation source open was superseded");
|
|
390
|
+
} catch (e) {
|
|
391
|
+
try {
|
|
392
|
+
r.close();
|
|
393
|
+
} catch {}
|
|
394
|
+
throw e;
|
|
395
|
+
}
|
|
396
|
+
let i = H(r.archive, "pull_slide");
|
|
397
|
+
return this.modelSource = {
|
|
398
|
+
archive: r.archive,
|
|
399
|
+
transferArchive: i,
|
|
400
|
+
close: r.close
|
|
401
|
+
}, r.archive;
|
|
402
|
+
}
|
|
403
|
+
cursor() {
|
|
404
|
+
return this.modelSource?.archive ?? this.ooxmlHost.archive;
|
|
405
|
+
}
|
|
406
|
+
execute(e) {
|
|
407
|
+
let t = this.modelSource;
|
|
408
|
+
if (!t) {
|
|
409
|
+
let t = this.ooxmlHost.archive;
|
|
410
|
+
if (!t) throw Error("Presentation not loaded");
|
|
411
|
+
return this.ooxmlHost.run(() => e(t));
|
|
412
|
+
}
|
|
413
|
+
return U(() => e(t.transferArchive), () => {
|
|
414
|
+
this.modelSource === t && this.closeModelSource();
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
extractMedia(e) {
|
|
418
|
+
return this.optional("extract_media", "media extraction", (t) => t.extract_media(e));
|
|
419
|
+
}
|
|
420
|
+
extractFont(e) {
|
|
421
|
+
return this.optional("extract_font", "font extraction", (t) => t.extract_font(e));
|
|
422
|
+
}
|
|
423
|
+
resourceUsage() {
|
|
424
|
+
let e = this.modelSource;
|
|
425
|
+
if (!(e && !v(e.archive, "resource_usage"))) return this.optional("resource_usage", "resource usage", (e) => e.resource_usage());
|
|
426
|
+
}
|
|
427
|
+
toMarkdown() {
|
|
428
|
+
return this.optional("to_markdown", "Markdown conversion", (e) => e.to_markdown());
|
|
429
|
+
}
|
|
430
|
+
closeModelSource() {
|
|
431
|
+
let e = this.modelSource;
|
|
432
|
+
this.modelSource = void 0, e?.close();
|
|
433
|
+
}
|
|
434
|
+
optional(e, t, n) {
|
|
435
|
+
let r = this.modelSource;
|
|
436
|
+
if (r) {
|
|
437
|
+
if (!v(r.archive, e)) throw y(t);
|
|
438
|
+
return this.execute(() => n(r.archive));
|
|
439
|
+
}
|
|
440
|
+
let i = this.ooxmlHost.archive;
|
|
441
|
+
if (!i) throw Error("Presentation not loaded");
|
|
442
|
+
return this.ooxmlHost.run(() => n(i));
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
//#endregion
|
|
446
|
+
export { J as WorkerPresentationSourceOwner };
|
package/dist/pptx.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { l as e } from "./slide-pull-client-tq7U_fYg.js";
|
|
2
|
+
import { vo as t, yo as n } from "./plot-area-frame-Bs_j4uu7.js";
|
|
3
|
+
import { u as r } from "./bounded-raw-part-cache-CsnNptAy.js";
|
|
4
|
+
import { f as i, u as a } from "./pixel-budget-BpTYrepD.js";
|
|
5
|
+
import { i as o, t as s } from "./tiff-contract-C6M3QcPp.js";
|
|
6
|
+
import { D as c } from "./canvas-viewer-mechanics-BZ8QCrRi.js";
|
|
7
|
+
import { a as l, c as u, i as d, l as f, n as p, o as m } from "./pptx-_BOGcBym.js";
|
|
8
|
+
export { a as OoxmlDecodedImageLimitError, t as OoxmlError, n as OoxmlResourceLimitError, m as PptxPresentation, p as PptxScrollViewer, d as PptxViewer, s as TiffDecodeError, c as autoResize, u as buildPptxHighlightLayer, f as buildPptxTextLayer, i as isOoxmlDecodedImageLimitError, o as isTiffDecodeError, r as openExternalHyperlink, l as readPptxTextSelectionContext, e as renderSlide };
|
package/dist/pptx_parser_bg.wasm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { N as e, j as t, qt as n } from "./bounded-raw-part-cache-CsnNptAy.js";
|
|
2
|
+
import { b as r } from "./comment-overlay-controller-CBvQx-En.js";
|
|
3
|
+
import { T as i } from "./canvas-viewer-mechanics-BZ8QCrRi.js";
|
|
4
|
+
import { n as a } from "./renderer-module-contract-CWM7jv6d.js";
|
|
5
|
+
import { o, s } from "./pptx-_BOGcBym.js";
|
|
6
|
+
import { n as c, o as l, r as u } from "./model-source-kz_NkZqT.js";
|
|
7
|
+
import { t as d } from "./bundled-asset-url-E2nXURF9.js";
|
|
8
|
+
//#region packages/pptx/src/internal/presentation-model-source.ts
|
|
9
|
+
async function f(u, d) {
|
|
10
|
+
let f = d.mode ?? "main", h = e(d), g = new t({
|
|
11
|
+
enabled: !0,
|
|
12
|
+
format: "pptx",
|
|
13
|
+
mode: f,
|
|
14
|
+
policy: h.policy,
|
|
15
|
+
onMetrics: h.onResourceMetrics,
|
|
16
|
+
emitToConsole: h.debug
|
|
17
|
+
});
|
|
18
|
+
try {
|
|
19
|
+
if (f === "worker" && (typeof Worker > "u" || typeof OffscreenCanvas > "u")) throw Error("mode: 'worker' requires Worker and OffscreenCanvas support");
|
|
20
|
+
let e;
|
|
21
|
+
if (typeof u == "string") {
|
|
22
|
+
let t = await fetch(u);
|
|
23
|
+
if (!t.ok) throw Error(`Failed to fetch: ${t.status} ${t.statusText}`);
|
|
24
|
+
e = await t.arrayBuffer();
|
|
25
|
+
} else e = u;
|
|
26
|
+
let t = l(d.legacyPpt === void 0 ? void 0 : [d.legacyPpt], "pptx", new Uint8Array(e));
|
|
27
|
+
if (!t) return o.load(e, {
|
|
28
|
+
...d,
|
|
29
|
+
legacyPpt: void 0
|
|
30
|
+
});
|
|
31
|
+
let _ = c(t, "pptx");
|
|
32
|
+
try {
|
|
33
|
+
g.setSourceBytes(e.byteLength), g.checkpoint("container ready");
|
|
34
|
+
let t = f === "worker" ? (await import("./render-worker-host-C-EECo68.js")).createRenderWorker() : new (await (import("./worker-source-DrwhR9fw.js"))).default(), c = p(t, _), l = f === "worker" ? a(d) : void 0, u;
|
|
35
|
+
try {
|
|
36
|
+
u = new o(c, f, d.wasmUrl);
|
|
37
|
+
let t = u;
|
|
38
|
+
t._metrics = g, t._cjkFallback = n(d.cjkFallback), t._math = f === "worker" ? void 0 : d.math, t._threeD = f === "worker" ? void 0 : d.threeD, t._regionMap = f === "worker" ? void 0 : d.regionMap, t._chartEx = f === "worker" ? void 0 : d.chartEx, t._tiff = f === "worker" ? void 0 : d.tiff, t._googleSubstitutes = !!d.useGoogleFonts, m(d, f, l);
|
|
39
|
+
let i = d.progressiveLayout ? {
|
|
40
|
+
onProgress: d.onLayoutProgress,
|
|
41
|
+
onPartial: d.onLayoutPartial,
|
|
42
|
+
onComplete: d.onLayoutComplete,
|
|
43
|
+
firstPublication: r(),
|
|
44
|
+
published: !1,
|
|
45
|
+
deferred: !1,
|
|
46
|
+
settled: !1
|
|
47
|
+
} : void 0;
|
|
48
|
+
return await t._parse(e, h.policy, !!d.useGoogleFonts, d.workerTimeoutMs, (e) => g.observeUsage(e), l, i), g.checkpoint("presentation preflight ready"), f === "main" && d.useGoogleFonts && t._preflight && !i && await t._ensureGoogleFonts(s(t._preflight.fontPreloadNames, t._embeddedFontAliases), t._preflight.fontPreloadDemand), g.succeed({ slides: u.slideCount }), _.release(), u;
|
|
49
|
+
} catch (e) {
|
|
50
|
+
let n = u;
|
|
51
|
+
throw i(t, n ? () => n.destroy() : void 0), e;
|
|
52
|
+
}
|
|
53
|
+
} finally {
|
|
54
|
+
_.release();
|
|
55
|
+
}
|
|
56
|
+
} catch (e) {
|
|
57
|
+
throw g.fail(e), e;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function p(e, t) {
|
|
61
|
+
let n = d(new URL("./pptx-source-worker.mjs", import.meta.url).href, import.meta.url);
|
|
62
|
+
return u(e, {
|
|
63
|
+
discriminator: "kind",
|
|
64
|
+
load: t,
|
|
65
|
+
parseMessage: (e) => ({
|
|
66
|
+
...e,
|
|
67
|
+
source: t.module,
|
|
68
|
+
sourceOwnerUrl: n,
|
|
69
|
+
...t.transfer.length ? { sourceTransfer: t.transfer } : {}
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function m(e, t, n) {
|
|
74
|
+
t === "worker" && (e.math && !n?.math && console.warn("[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math."), e.threeD && !n?.threeD && console.warn("[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d."), e.regionMap && !n?.regionMap && console.warn("[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map."), e.chartEx && !n?.chartEx && console.warn("[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex."), e.tiff && !n?.tiff && console.warn("[ooxml] a custom TIFF codec cannot cross the worker boundary; recognized TIFF images will use an unavailable-image placeholder in mode: 'worker'. Use the codec from @silurus/ooxml/tiff to display them."));
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { f as loadPptxModelSource };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region packages/core/src/image/raster-target.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return typeof e == "number" && Number.isFinite(e) && e > 0 ? e : void 0;
|
|
4
|
+
}
|
|
5
|
+
function t(t, n, r, i = !1) {
|
|
6
|
+
if (!Number.isFinite(t.width) || !Number.isFinite(t.height) || !(t.width > 0) || !(t.height > 0)) return null;
|
|
7
|
+
let a = e(n), o = e(r);
|
|
8
|
+
if ((i ? a === void 0 && o === void 0 : a === void 0 || o === void 0) || a !== void 0 && !(a < t.width) || o !== void 0 && !(o < t.height)) return null;
|
|
9
|
+
let s = a === void 0 ? 0 : a / t.width, c = o === void 0 ? 0 : o / t.height, l, u;
|
|
10
|
+
if (a !== void 0 && s >= c) l = Math.max(1, Math.ceil(a)), u = Math.max(1, Math.ceil(t.height * l / t.width));
|
|
11
|
+
else if (o !== void 0) u = Math.max(1, Math.ceil(o)), l = Math.max(1, Math.ceil(t.width * u / t.height));
|
|
12
|
+
else return null;
|
|
13
|
+
return l < t.width && u < t.height ? {
|
|
14
|
+
width: l,
|
|
15
|
+
height: u
|
|
16
|
+
} : null;
|
|
17
|
+
}
|
|
18
|
+
function n(n, r, i, a = !1) {
|
|
19
|
+
if (!Number.isFinite(n.width) || !Number.isFinite(n.height) || !(n.width > 0) || !(n.height > 0)) return null;
|
|
20
|
+
let o = e(r), s = e(i);
|
|
21
|
+
if (o !== void 0 && s !== void 0) {
|
|
22
|
+
let e = Math.min(n.width, Math.max(1, Math.ceil(o))), t = Math.min(n.height, Math.max(1, Math.ceil(s)));
|
|
23
|
+
return e < n.width || t < n.height ? {
|
|
24
|
+
width: e,
|
|
25
|
+
height: t
|
|
26
|
+
} : null;
|
|
27
|
+
}
|
|
28
|
+
return t(n, o, s, a);
|
|
29
|
+
}
|
|
30
|
+
function r(e, t, r, i) {
|
|
31
|
+
let a = n({
|
|
32
|
+
width: e,
|
|
33
|
+
height: t
|
|
34
|
+
}, r, i, !0);
|
|
35
|
+
return a ? {
|
|
36
|
+
resizeWidth: a.width,
|
|
37
|
+
resizeHeight: a.height,
|
|
38
|
+
resizeQuality: "high"
|
|
39
|
+
} : void 0;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { n, r, t };
|