@silurus/ooxml 0.88.0 → 0.89.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +118 -23
  2. package/THIRD_PARTY_NOTICES.md +8 -7
  3. package/dist/abort-VrnK7mdP.js +10 -0
  4. package/dist/assets/render-worker-C5G_Nr_A.js +35 -0
  5. package/dist/assets/render-worker-DQfWdNsm.js +16 -0
  6. package/dist/assets/render-worker-Ds7LjwU-.js +15 -0
  7. package/dist/{hyperlink-Cxzhet30.js → bounded-raw-part-cache-CsnNptAy.js} +4937 -7458
  8. package/dist/bundled-asset-url-E2nXURF9.js +15 -0
  9. package/dist/canvas-viewer-mechanics-BZ8QCrRi.js +675 -0
  10. package/dist/cfb-guard-dNeUiANF.js +528 -0
  11. package/dist/chart-ex.mjs +667 -663
  12. package/dist/comment-overlay-controller-CBvQx-En.js +994 -0
  13. package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
  14. package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-BKidRH36.js} +5 -5
  15. package/dist/{comment-ui-runtime-CWGqn5Vr.js → comment-ui-runtime-C47QoDUy.js} +5 -5
  16. package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
  17. package/dist/document-model-source-MzFPrxt0.js +249 -0
  18. package/dist/document-pull-client-BoJeuURD.js +35941 -0
  19. package/dist/document-pull-worker-CaP8XESP.js +104 -0
  20. package/dist/docx-BN70UhvX.js +495 -0
  21. package/dist/docx-BRRtSvk3.js +3563 -0
  22. package/dist/docx-model-source-CTO9iw_W.js +98 -0
  23. package/dist/docx-source-worker.mjs +455 -0
  24. package/dist/docx.mjs +7 -7
  25. package/dist/docx_parser_bg.wasm +0 -0
  26. package/dist/drawingml-shape-CHmq8kpM.js +310 -0
  27. package/dist/duotone-DN8P4aXe.js +126 -0
  28. package/dist/emf-CGFQIz6c.js +1790 -0
  29. package/dist/font-preload-demand-Dmy31xt-.js +2058 -0
  30. package/dist/grid-geometry-C3IG20ut.js +384 -0
  31. package/dist/host-layout-DVMw8hDY.js +56 -0
  32. package/dist/host-layout-measure-DsuQ2UJs.js +7 -0
  33. package/dist/in-process-pull-transport-DuXcPZng.js +29 -0
  34. package/dist/index.mjs +4 -4
  35. package/dist/internal-companion.mjs +12 -0
  36. package/dist/line-distribute-Bu8psjGd.js +2799 -0
  37. package/dist/math.mjs +2 -2
  38. package/dist/mathjax-stix2.js +10 -10
  39. package/dist/model-source-kz_NkZqT.js +179 -0
  40. package/dist/model-source-s5hRpk4w.js +61 -0
  41. package/dist/model-source-session-6fuaqbGs.js +71 -0
  42. package/dist/model-source-session-DqrR4XHR.js +85 -0
  43. package/dist/model-source-session-cPJSF_Ak.js +58 -0
  44. package/dist/node.mjs +7 -1327
  45. package/dist/{pixel-budget-9P63Bsk5.js → pixel-budget-BpTYrepD.js} +13 -10
  46. package/dist/plot-area-frame-Bs_j4uu7.js +41811 -0
  47. package/dist/pptx-CaJ6ILnw.js +183 -0
  48. package/dist/pptx-_BOGcBym.js +2936 -0
  49. package/dist/pptx-model-source-B_9afw9R.js +37 -0
  50. package/dist/pptx-source-worker.mjs +446 -0
  51. package/dist/pptx.mjs +8 -7
  52. package/dist/pptx_parser_bg.wasm +0 -0
  53. package/dist/presentation-model-source-CGHLyX32.js +77 -0
  54. package/dist/raster-target-YQ4G6rxo.js +42 -0
  55. package/dist/region-map.mjs +117 -153
  56. package/dist/{render-D3iqVKCo.js → render-CzbDzRKa.js} +3 -3
  57. package/dist/{render-worker-host-B5wQfB7U.js → render-worker-host-B1u6BOUd.js} +1 -1
  58. package/dist/{render-worker-host-D4123J27.js → render-worker-host-C-EECo68.js} +1 -1
  59. package/dist/{render-worker-host-Di3LxLc0.js → render-worker-host-DDqZTCVf.js} +1 -1
  60. package/dist/renderer-CD2cvVAF.js +5823 -0
  61. package/dist/renderer-DRoeb14O.js +5170 -0
  62. package/dist/resource-measurement-Dhhm7P_l.js +772 -0
  63. package/dist/session-XPmC0CUd.js +656 -0
  64. package/dist/slide-pull-client-tq7U_fYg.js +6485 -0
  65. package/dist/three-d-BKwNPAP4.js +878 -0
  66. package/dist/three-d.mjs +925 -910
  67. package/dist/{raster-target-ojDdQizC.js → tiff-contract-C6M3QcPp.js} +1 -42
  68. package/dist/tiff.mjs +401 -248
  69. package/dist/types/chart-ex.d.ts +149 -2
  70. package/dist/types/docx.d.ts +333 -96
  71. package/dist/types/index.d.ts +566 -301
  72. package/dist/types/internal-companion.d.ts +11 -0
  73. package/dist/types/math.d.ts +1 -1
  74. package/dist/types/node.d.ts +422 -9
  75. package/dist/types/pptx.d.ts +302 -95
  76. package/dist/types/region-map.d.ts +149 -2
  77. package/dist/types/three-d.d.ts +149 -2
  78. package/dist/types/tiff.d.ts +1 -1
  79. package/dist/types/xlsx.d.ts +343 -132
  80. package/dist/wasm-loader-rlgHmcSv.js +35 -0
  81. package/dist/wasm-runtime-generation-D6TKZdNb.js +97 -0
  82. package/dist/workbook-model-source-BIGrfZy6.js +94 -0
  83. package/dist/worker-source-DrwhR9fw.js +22 -0
  84. package/dist/worker-source-SbudzjYL.js +22 -0
  85. package/dist/worker-source-UAi3GNcM.js +22 -0
  86. package/dist/worksheet-pull-client-ClvPO_Jf.js +579 -0
  87. package/dist/xlsx-CsmREBaZ.js +5819 -0
  88. package/dist/xlsx-DmHfeNNp.js +534 -0
  89. package/dist/xlsx-model-source-D1flORqy.js +309 -0
  90. package/dist/xlsx-source-worker.mjs +525 -0
  91. package/dist/xlsx.mjs +8 -7
  92. package/dist/xlsx_parser_bg.wasm +0 -0
  93. package/package.json +42 -16
  94. package/dist/assets/render-worker-1uPAxMZr.js +0 -31
  95. package/dist/assets/render-worker-BlvJybji.js +0 -10
  96. package/dist/assets/render-worker-CzmiJfFL.js +0 -11
  97. package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
  98. package/dist/canvas-viewer-mechanics-DbLz0rYW.js +0 -1384
  99. package/dist/cjk-fallback-bLI3z70h.js +0 -46
  100. package/dist/comment-occurrence-C8Y2uoVr.js +0 -6
  101. package/dist/comment-ui-runtime-BsK8pmUT.js +0 -2
  102. package/dist/comments-Diid5ujN.js +0 -246
  103. package/dist/delimited-text-worker-host-BVY-Ecni.js +0 -27
  104. package/dist/document-pull-client-B9PTM-pL.js +0 -27280
  105. package/dist/docx-BF9WXrYH.js +0 -3103
  106. package/dist/dom-interaction-boundary-Cnm8DSBN.js +0 -223
  107. package/dist/highlight-rect-C5hkRqUr.js +0 -13
  108. package/dist/line-distribute-D1WNHKz_.js +0 -1023
  109. package/dist/line-metrics-B60C86uh.js +0 -60
  110. package/dist/plot-area-frame-DLTYKHNP.js +0 -4354
  111. package/dist/pptx-DkyYBYoL.js +0 -3065
  112. package/dist/renderer-B4GZb5We.js +0 -6492
  113. package/dist/resource-measurement-SHQCbkh2.js +0 -150
  114. package/dist/session-BGq81gRQ.js +0 -743
  115. package/dist/slide-pull-client-DiPnm240.js +0 -6253
  116. package/dist/source-key-DIJG8BA0.js +0 -42
  117. package/dist/three-d-DJBl8g8M.js +0 -1162
  118. package/dist/transfer-p6iCC2R7.js +0 -6
  119. package/dist/units-BzZ0gAxs.js +0 -4
  120. package/dist/worksheet-pull-client-BM8ywvbu.js +0 -458
  121. package/dist/xlsx-C9NVjgaV.js +0 -8484
  122. /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
  123. /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
  124. /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
  125. /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
  126. /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
  127. /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
@@ -0,0 +1,179 @@
1
+ import { n as e } from "./abort-VrnK7mdP.js";
2
+ //#region packages/core/src/source/model-source.ts
3
+ var t = "model source load was aborted", n = "ooxml-model-source-module/v2", r = new Set([
4
+ "docx",
5
+ "xlsx",
6
+ "pptx"
7
+ ]), i = new Set([
8
+ "http:",
9
+ "https:",
10
+ "file:",
11
+ "blob:"
12
+ ]), a = [
13
+ "protocol",
14
+ "target",
15
+ "moduleUrl",
16
+ "config"
17
+ ], o = 16, s = 8192, c = 32, l = 8192, u = 16, d = 32, f = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
18
+ function p(e, t, n) {
19
+ if (e !== void 0) {
20
+ if (!Array.isArray(e)) throw TypeError("model sources must be an array");
21
+ if (e.length > o) throw RangeError(`model source selection accepts at most ${o} sources`);
22
+ for (let r of e) {
23
+ if (typeof r != "object" || !r) throw TypeError("each model source must be an object");
24
+ let e = r;
25
+ if (e.target !== t) throw TypeError(`a ${String(e.target)} model source cannot load ${t} input`);
26
+ if (typeof e.claim != "function" || typeof e.beginLoad != "function") throw TypeError("a model source must implement claim() and beginLoad()");
27
+ let i = e.claim(n);
28
+ if (typeof i != "boolean") throw TypeError("model source claim() must return a boolean");
29
+ if (i) return e;
30
+ }
31
+ }
32
+ }
33
+ function m(e, t) {
34
+ let n = e.beginLoad();
35
+ if (typeof n != "object" || !n) throw TypeError("model source beginLoad() must return an object");
36
+ let r = n, i = r.release;
37
+ if (typeof i != "function") throw TypeError("model source load must provide release()");
38
+ let a = !1, o = () => {
39
+ a || (a = !0, i.call(n));
40
+ };
41
+ try {
42
+ let e = g(r.module, t), n = r.transfer === void 0 ? [] : r.transfer;
43
+ if (!Array.isArray(n)) throw TypeError("model source load transfer must be an array");
44
+ if (n.length > d) throw RangeError(`model source load transfer accepts at most ${d} items`);
45
+ let i = /* @__PURE__ */ new Set();
46
+ for (let e of n) {
47
+ if (!(e instanceof ArrayBuffer) && !(typeof MessagePort < "u" && e instanceof MessagePort) && !(typeof ImageBitmap < "u" && e instanceof ImageBitmap) && !(typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas)) throw TypeError("model source load transfer contains an unsupported item");
48
+ if (i.has(e)) throw TypeError("model source load transfer contains a duplicate item");
49
+ i.add(e);
50
+ }
51
+ return Object.freeze({
52
+ module: e,
53
+ transfer: Object.freeze([...n]),
54
+ release: o
55
+ });
56
+ } catch (e) {
57
+ try {
58
+ o();
59
+ } catch {}
60
+ throw e;
61
+ }
62
+ }
63
+ function h(e, t) {
64
+ return new Proxy(e, { get(e, n) {
65
+ if (n === "postMessage") return (n, r) => {
66
+ if (typeof n == "object" && n) {
67
+ let i = n, a = i[t.discriminator];
68
+ if (a === "init") return;
69
+ if (a === "parse") {
70
+ e.postMessage(t.parseMessage(i), [...r ?? [], ...t.load.transfer]);
71
+ return;
72
+ }
73
+ }
74
+ e.postMessage(n, r ?? []);
75
+ };
76
+ let r = t.member?.(e, n);
77
+ if (r !== void 0) return r;
78
+ let i = Reflect.get(e, n, e);
79
+ return typeof i == "function" ? i.bind(e) : i;
80
+ } });
81
+ }
82
+ function g(e, t) {
83
+ if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("model source module descriptor must be an object");
84
+ let o = Reflect.ownKeys(e);
85
+ if (o.length !== a.length || a.some((e) => !o.includes(e))) throw TypeError("model source module descriptor has unknown or missing fields");
86
+ let c = Object.getOwnPropertyDescriptors(e);
87
+ if (a.some((e) => !c[e]?.enumerable || !("value" in c[e]))) throw TypeError("model source module descriptor fields must be data properties");
88
+ let l = c.protocol.value, u = c.target.value, d = c.moduleUrl.value;
89
+ if (l !== "ooxml-model-source-module/v2") throw TypeError("unsupported model source module protocol");
90
+ if (typeof u != "string" || !r.has(u)) throw TypeError("unsupported model source target");
91
+ if (t !== void 0 && u !== t) throw TypeError(`a ${u} model source module cannot load ${t} input`);
92
+ if (typeof d != "string" || d.length === 0 || d.length > s || d.trim() !== d) throw TypeError("model source moduleUrl must be a nonempty absolute URL");
93
+ let f;
94
+ try {
95
+ f = new URL(d);
96
+ } catch {
97
+ throw TypeError("model source moduleUrl must be a nonempty absolute URL");
98
+ }
99
+ if (!i.has(f.protocol)) throw TypeError("model source moduleUrl protocol is unsupported");
100
+ return Object.freeze({
101
+ protocol: n,
102
+ target: u,
103
+ moduleUrl: d,
104
+ config: _(c.config.value)
105
+ });
106
+ }
107
+ function _(e) {
108
+ if (!x(e)) throw TypeError("model source config must be a plain object");
109
+ let t = Reflect.ownKeys(e);
110
+ if (t.length > c) throw RangeError(`model source config accepts at most ${c} entries`);
111
+ let n = {};
112
+ for (let r of t) {
113
+ if (typeof r != "string" || !f.test(r)) throw TypeError("model source config keys must be short identifiers");
114
+ let t = Object.getOwnPropertyDescriptor(e, r);
115
+ if (!t?.enumerable || !("value" in t)) throw TypeError("model source config entries must be data properties");
116
+ let i = t.value;
117
+ if (typeof i == "string") {
118
+ if (i.length > l) throw RangeError("model source config string is too long");
119
+ } else if (typeof i == "number") {
120
+ if (!Number.isFinite(i)) throw TypeError("model source config numbers must be finite");
121
+ } else if (typeof i != "boolean" && i !== null) throw TypeError("model source config values must be strings, numbers, booleans or null");
122
+ n[r] = i;
123
+ }
124
+ return Object.freeze(n);
125
+ }
126
+ async function v(n, r, i, a, o = []) {
127
+ let s = g(n);
128
+ e(a, t);
129
+ let c = await import(
130
+ /* @vite-ignore */
131
+ s.moduleUrl
132
+ ), l = typeof c == "object" && c ? c.openModelSource : void 0;
133
+ if (typeof l != "function") throw TypeError("model source module must export openModelSource()");
134
+ e(a, t);
135
+ let u = await l(r, s.config, a, o);
136
+ if (typeof u != "object" || !u) throw TypeError("openModelSource() must return an object");
137
+ let d = u, f = d.close;
138
+ if (typeof f != "function") throw TypeError("an opened model source must provide close()");
139
+ let p = !1, m = () => {
140
+ p || (p = !0, f.call(u));
141
+ };
142
+ try {
143
+ let n = i(d.archive), r = y(d.viewDefaults);
144
+ return e(a, t), Object.freeze({
145
+ archive: n,
146
+ viewDefaults: r,
147
+ close: m
148
+ });
149
+ } catch (e) {
150
+ try {
151
+ m();
152
+ } catch {}
153
+ throw e;
154
+ }
155
+ }
156
+ function y(e) {
157
+ if (e === void 0) return Object.freeze({});
158
+ if (!x(e)) throw TypeError("model source viewDefaults must be a plain object");
159
+ let t = Reflect.ownKeys(e);
160
+ if (t.length > u) throw RangeError("model source viewDefaults has too many entries");
161
+ let n = {};
162
+ for (let r of t) {
163
+ let t = typeof r == "string" ? Object.getOwnPropertyDescriptor(e, r) : void 0;
164
+ if (typeof r != "string" || !f.test(r) || !t?.enumerable || !("value" in t) || typeof t.value != "boolean") throw TypeError("model source viewDefaults entries must be boolean data properties");
165
+ n[r] = t.value;
166
+ }
167
+ return Object.freeze(n);
168
+ }
169
+ function b(e, t, n) {
170
+ if (typeof e != "object" && typeof e != "function" || e === null) throw TypeError(`${t} model source archive must be an object`);
171
+ for (let r of n) if (typeof e[r] != "function") throw TypeError(`${t} model source archive must implement ${r}()`);
172
+ }
173
+ function x(e) {
174
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
175
+ let t = Object.getPrototypeOf(e);
176
+ return t === Object.prototype || t === null;
177
+ }
178
+ //#endregion
179
+ export { b as a, v as i, m as n, p as o, h as r, n as t };
@@ -0,0 +1,61 @@
1
+ import { t as e } from "./cfb-guard-dNeUiANF.js";
2
+ import { U as t } from "./bounded-raw-part-cache-CsnNptAy.js";
3
+ import { i as n, n as r, o as i } from "./model-source-kz_NkZqT.js";
4
+ //#region packages/node/src/model-source.ts
5
+ async function a(a, s, c, l, u = (e) => t(e) ?? e) {
6
+ let d = a instanceof Uint8Array ? a : new Uint8Array(a), f = c.source === void 0 ? void 0 : i([c.source], s, d);
7
+ if (!f) return {
8
+ kind: "ooxml",
9
+ bytes: await e(d, c.password)
10
+ };
11
+ let p = r(f, s);
12
+ try {
13
+ let e = await n(p.module, d, l, c.signal, p.transfer);
14
+ try {
15
+ p.release();
16
+ } catch (t) {
17
+ try {
18
+ e.close();
19
+ } catch {}
20
+ throw t;
21
+ }
22
+ return {
23
+ kind: "model-source",
24
+ opened: {
25
+ ...e,
26
+ archive: o(e.archive, u),
27
+ close() {
28
+ try {
29
+ e.close();
30
+ } catch (e) {
31
+ throw u(e);
32
+ }
33
+ }
34
+ },
35
+ sourceByteLength: d.byteLength
36
+ };
37
+ } catch (e) {
38
+ throw u(e);
39
+ } finally {
40
+ p.release();
41
+ }
42
+ }
43
+ function o(e, t) {
44
+ let n = e;
45
+ return new Proxy(Object.create(n), { get(e, r) {
46
+ try {
47
+ let e = Reflect.get(n, r, n);
48
+ return typeof e == "function" ? (...r) => {
49
+ try {
50
+ return Reflect.apply(e, n, r);
51
+ } catch (e) {
52
+ throw t(e);
53
+ }
54
+ } : e;
55
+ } catch (e) {
56
+ throw t(e);
57
+ }
58
+ } });
59
+ }
60
+ //#endregion
61
+ export { a as t };
@@ -0,0 +1,71 @@
1
+ import { B as e, N as t, U as n, j as r } from "./bounded-raw-part-cache-CsnNptAy.js";
2
+ import { n as i } from "./abort-VrnK7mdP.js";
3
+ import { b as a } from "./worksheet-pull-client-ClvPO_Jf.js";
4
+ import { a as o } from "./model-source-kz_NkZqT.js";
5
+ import { t as s } from "./host-layout-DVMw8hDY.js";
6
+ //#region packages/xlsx/src/internal/worker-worksheet-source.ts
7
+ var c = [
8
+ "open_sheet_cursor",
9
+ "pull_sheet_cursor",
10
+ "sheet_cursor_pull_finished",
11
+ "acknowledge_sheet_cursor_terminal",
12
+ "cancel_sheet_cursor",
13
+ "close_sheet_cursor",
14
+ "assert_healthy",
15
+ "parse",
16
+ "extract_image"
17
+ ];
18
+ function l(e) {
19
+ return o(e, "XLSX", c), e;
20
+ }
21
+ function u(e) {
22
+ let [t] = Object.keys(e);
23
+ if (t !== void 0) throw TypeError(`unsupported XLSX model source view default: ${t}`);
24
+ }
25
+ //#endregion
26
+ //#region packages/xlsx/src/internal/archive-bootstrap-source.ts
27
+ function d(t, n) {
28
+ let r = t(), i = n();
29
+ return {
30
+ workbook: r,
31
+ usage: i === void 0 ? void 0 : e(i)
32
+ };
33
+ }
34
+ //#endregion
35
+ //#region packages/xlsx/src/internal/node-model-source-acquisition.ts
36
+ var f = "XLSX workbook session was aborted";
37
+ function p(e, o = {}) {
38
+ let s;
39
+ try {
40
+ let n = a(o);
41
+ if (!Number.isSafeInteger(e.sourceByteLength) || e.sourceByteLength < 0) throw RangeError("XLSX sourceByteLength must be a non-negative safe integer");
42
+ let c = t(o);
43
+ s = new r({
44
+ enabled: c.debug || c.onResourceMetrics !== void 0,
45
+ format: "xlsx",
46
+ mode: "node",
47
+ scope: "session",
48
+ policy: c.policy,
49
+ formatLimits: { xlsxWorksheetLimits: { ...n.worksheet } },
50
+ onMetrics: c.onResourceMetrics,
51
+ emitToConsole: c.debug
52
+ }), s.setSourceBytes(e.sourceByteLength), i(o.signal, f);
53
+ let l = e.archive, { workbook: u, usage: p } = d(() => JSON.parse(new TextDecoder().decode(l.parse())), () => l.resource_usage?.());
54
+ return e.layoutMetrics && (u.layoutMetrics = { maximumDigitWidth: e.layoutMetrics.maximumDigitWidth }), s.observeUsage(p), s.checkpoint("workbook index ready"), {
55
+ archive: l,
56
+ workbookIndex: u,
57
+ usage: p,
58
+ metrics: s,
59
+ worksheetPolicy: n,
60
+ closeArchive: () => e.closeArchive()
61
+ };
62
+ } catch (t) {
63
+ try {
64
+ e.closeArchive();
65
+ } catch {}
66
+ let r = n(t) ?? t;
67
+ throw s?.fail(r), r;
68
+ }
69
+ }
70
+ //#endregion
71
+ export { p as acquireXlsxSessionFromArchive, s as configureHostLayout, l as validateXlsxModelSourceArchive, u as validateXlsxModelSourceViewDefaults };
@@ -0,0 +1,85 @@
1
+ import { N as e, U as t, j as n } from "./bounded-raw-part-cache-CsnNptAy.js";
2
+ import { n as r } from "./abort-VrnK7mdP.js";
3
+ import { a as i } from "./model-source-kz_NkZqT.js";
4
+ import { t as a } from "./in-process-pull-transport-DuXcPZng.js";
5
+ import { n as o, r as s, t as c } from "./document-pull-worker-CaP8XESP.js";
6
+ //#region packages/docx/src/internal/worker-document-source.ts
7
+ var l = [
8
+ "open_document_cursor",
9
+ "pull_document_chunk",
10
+ "document_chunk_done",
11
+ "acknowledge_document_chunk",
12
+ "cancel_document_cursor",
13
+ "close_document_session",
14
+ "assert_healthy",
15
+ "extract_image"
16
+ ];
17
+ function u(e) {
18
+ return i(e, "DOCX", l), e;
19
+ }
20
+ function d(e) {
21
+ for (let t of Object.keys(e)) if (t !== "showTrackedChanges") throw TypeError(`unsupported DOCX model source view default: ${t}`);
22
+ return e.showTrackedChanges === void 0 ? {} : { showTrackedChanges: e.showTrackedChanges };
23
+ }
24
+ //#endregion
25
+ //#region packages/docx/src/internal/node-model-source-acquisition.ts
26
+ var f = "DOCX document session was aborted";
27
+ async function p(i, a, o) {
28
+ let c = !1, l = () => {
29
+ c || (c = !0, i.closeArchive());
30
+ }, u;
31
+ try {
32
+ if (!Number.isSafeInteger(i.sourceByteLength) || i.sourceByteLength < 0) throw RangeError("DOCX sourceByteLength must be a non-negative safe integer");
33
+ let t = e(a);
34
+ u = new n({
35
+ enabled: t.debug || t.onResourceMetrics !== void 0,
36
+ format: "docx",
37
+ mode: "node",
38
+ scope: "session",
39
+ policy: t.policy,
40
+ onMetrics: t.onResourceMetrics,
41
+ emitToConsole: t.debug
42
+ }), u.setSourceBytes(i.sourceByteLength), r(a.signal, f), u.checkpoint("container ready");
43
+ } catch (e) {
44
+ try {
45
+ l();
46
+ } catch {}
47
+ let n = t(e) ?? s(e);
48
+ throw u?.fail(n), n;
49
+ }
50
+ return m(i.archive, l, u, a, o);
51
+ }
52
+ async function m(e, n, r, i, l) {
53
+ let u, d;
54
+ try {
55
+ u = new c(() => e);
56
+ let t = {
57
+ sessionId: 1,
58
+ operationId: 1,
59
+ generation: 1
60
+ };
61
+ u.open(t), d = new a((e, t) => u?.dispatch(e, t), () => void 0);
62
+ let s, f = await l(d, t, {
63
+ signal: i.signal,
64
+ onUsage: (e) => {
65
+ s = e, r.observeUsage(e);
66
+ }
67
+ });
68
+ return s ??= o((t) => t(e)), r.observeUsage(s), r.checkpoint("model streamed"), await u.reset(), d.terminate(), {
69
+ archive: e,
70
+ result: f,
71
+ usage: s,
72
+ metrics: r,
73
+ closeArchive: n
74
+ };
75
+ } catch (e) {
76
+ await u?.reset().catch(() => void 0), d?.terminate();
77
+ try {
78
+ n();
79
+ } catch {}
80
+ let i = t(e) ?? s(e);
81
+ throw r.fail(i), i;
82
+ }
83
+ }
84
+ //#endregion
85
+ export { p as acquireDocxSessionFromArchive, u as validateDocxModelSourceArchive, d as validateDocxModelSourceViewDefaults };
@@ -0,0 +1,58 @@
1
+ import { a as e } from "./slide-pull-client-tq7U_fYg.js";
2
+ import { H as t, N as n, j as r } from "./bounded-raw-part-cache-CsnNptAy.js";
3
+ import { n as i } from "./abort-VrnK7mdP.js";
4
+ import { a } from "./model-source-kz_NkZqT.js";
5
+ //#region packages/pptx/src/internal/worker-presentation-source.ts
6
+ var o = [
7
+ "pull_slide",
8
+ "slide_cursor_resource_usage",
9
+ "acknowledge_slide",
10
+ "cancel_slide",
11
+ "close_presentation_session",
12
+ "assert_healthy",
13
+ "presentation_bootstrap",
14
+ "extract_image"
15
+ ];
16
+ function s(e) {
17
+ return a(e, "PPTX", o), e;
18
+ }
19
+ function c(e) {
20
+ let [t] = Object.keys(e);
21
+ if (t !== void 0) throw TypeError(`unsupported PPTX model source view default: ${t}`);
22
+ }
23
+ //#endregion
24
+ //#region packages/pptx/src/internal/node-session-acquisition.ts
25
+ var l = "PPTX presentation session was aborted";
26
+ function u(a, o = {}, s) {
27
+ let c = !1, u = () => {
28
+ c || (c = !0, a.closeArchive());
29
+ }, d = s;
30
+ try {
31
+ if (!Number.isSafeInteger(a.sourceByteLength) || a.sourceByteLength < 0) throw RangeError("PPTX sourceByteLength must be a non-negative safe integer");
32
+ let t = n(o);
33
+ d ??= new r({
34
+ enabled: t.debug || t.onResourceMetrics !== void 0,
35
+ format: "pptx",
36
+ mode: "node",
37
+ scope: "session",
38
+ policy: t.policy,
39
+ onMetrics: t.onResourceMetrics,
40
+ emitToConsole: t.debug
41
+ }), s || d.setSourceBytes(a.sourceByteLength), i(o.signal, l);
42
+ let c = e(JSON.parse(new TextDecoder().decode(a.archive.presentation_bootstrap())));
43
+ return i(o.signal, l), d.checkpoint("presentation bootstrap ready"), {
44
+ archive: a.archive,
45
+ bootstrap: c,
46
+ metrics: d,
47
+ closeArchive: u
48
+ };
49
+ } catch (e) {
50
+ try {
51
+ u();
52
+ } catch {}
53
+ let n = t(e) ?? e;
54
+ throw d?.fail(n), n;
55
+ }
56
+ }
57
+ //#endregion
58
+ export { u as acquirePptxSessionFromArchive, s as validatePptxModelSourceArchive, c as validatePptxModelSourceViewDefaults };