@silurus/ooxml 0.75.5 → 0.76.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.
Files changed (52) hide show
  1. package/README.md +66 -28
  2. package/dist/bounded-raw-part-cache-C6ro6Ezf.js +254 -0
  3. package/dist/{find-cursor-Dc5iM6s7.js → canvas-viewer-mechanics-CwVSOYke.js} +192 -64
  4. package/dist/{document-pull-client-BcNYhoAG.js → document-pull-client-DQNen8c4.js} +3620 -3597
  5. package/dist/docx-DYRguRRi.js +1301 -0
  6. package/dist/docx.mjs +4 -6
  7. package/dist/docx_parser_bg.wasm +0 -0
  8. package/dist/index.mjs +3 -3
  9. package/dist/{line-distribute-B8sqT8kC.js → line-distribute-C1r2zvji.js} +141 -141
  10. package/dist/{line-metrics-D9gqQWHl.js → line-metrics-BdCACYlq.js} +4026 -1170
  11. package/dist/math.mjs +1 -1
  12. package/dist/node.mjs +779 -465
  13. package/dist/pptx-B-EJp83T.js +1735 -0
  14. package/dist/pptx.mjs +5 -7
  15. package/dist/pptx_parser_bg.wasm +0 -0
  16. package/dist/{render-CalC7GX4.js → render-CLcpSi0m.js} +11 -18
  17. package/dist/render-worker-host-Bkf1jUcW.js +27 -0
  18. package/dist/render-worker-host-CKOmXdyr.js +27 -0
  19. package/dist/render-worker-host-DWLyqwI3.js +27 -0
  20. package/dist/resource-measurement-E_S_iau4.js +119 -0
  21. package/dist/session-B4Y54cbT.js +730 -0
  22. package/dist/{renderer-B9R6F_QY.js → slide-pull-client-WCuYCjio.js} +973 -820
  23. package/dist/types/docx.d.ts +1181 -3994
  24. package/dist/types/index.d.ts +2733 -8171
  25. package/dist/types/math.d.ts +8 -33
  26. package/dist/types/node.d.ts +1852 -4433
  27. package/dist/types/pptx.d.ts +1030 -3678
  28. package/dist/types/xlsx.d.ts +1291 -3262
  29. package/dist/worksheet-pull-client-YzjJMOns.js +455 -0
  30. package/dist/xlsx-BBmmZNQn.js +6362 -0
  31. package/dist/xlsx.mjs +5 -7
  32. package/dist/xlsx_parser_bg.wasm +0 -0
  33. package/package.json +14 -7
  34. package/dist/bounded-raw-part-cache-BTfZD_Sz.js +0 -1248
  35. package/dist/docx-DjF8FgoP.js +0 -1274
  36. package/dist/duotone-bitmap-by-path-CWsSJkJu.js +0 -28
  37. package/dist/hyperlink-D85FexTa.js +0 -27
  38. package/dist/pptx-C17xP8AV.js +0 -1705
  39. package/dist/pptx-Dl8tOSmP.js +0 -822
  40. package/dist/preload-BEouWnlI.js +0 -132
  41. package/dist/render-worker-host-BG3a7brz.js +0 -27
  42. package/dist/render-worker-host-CsB-dPJv.js +0 -27
  43. package/dist/render-worker-host-Cyv5Hkbh.js +0 -27
  44. package/dist/resource-measurement-6aReN3K0.js +0 -93
  45. package/dist/slide-pull-client-D_T0AIoX.js +0 -175
  46. package/dist/svg-image-by-path-C1M3N2pT.js +0 -1623
  47. package/dist/worksheet-pull-worker-DCei8u-4.js +0 -347
  48. package/dist/xlsx-BaH9irS0.js +0 -5515
  49. /package/dist/{highlight-rect-cCvVU-MW.js → highlight-rect-CAkCWJ37.js} +0 -0
  50. /package/dist/{mathjax-Dqo857oC.js → mathjax-CMjda8Ip.js} +0 -0
  51. /package/dist/{transfer-3QEJrsJa.js → transfer-DCu4c2BL.js} +0 -0
  52. /package/dist/{visible-index-CKvgpUrf.js → visible-index-CgyJLAS_.js} +0 -0
@@ -1,93 +0,0 @@
1
- //#region packages/core/src/internal/resource-measurement.ts
2
- function e(e, t) {
3
- if (!Number.isSafeInteger(e) || e < 0) throw Error(`${t} must be a non-negative safe integer`);
4
- }
5
- function t(t, n, r) {
6
- return e(t, "resource measurement"), e(n, "resource measurement"), e(r, "resource measurement limit"), t > r || n > r || n > r - t ? r === 2 ** 53 - 1 ? r : r + 1 : t + n;
7
- }
8
- function n(n, r = 2 ** 53 - 1) {
9
- e(r, "resource measurement limit");
10
- let i = 0;
11
- for (let e = 0; e < n.length; e += 1) {
12
- let a = n.charCodeAt(e), o;
13
- if (a <= 127) o = 1;
14
- else if (a <= 2047) o = 2;
15
- else if (a >= 55296 && a <= 56319 && e + 1 < n.length) {
16
- let t = n.charCodeAt(e + 1);
17
- t >= 56320 && t <= 57343 ? (o = 4, e += 1) : o = 3;
18
- } else o = 3;
19
- if (i = t(i, o, r), i > r) return i;
20
- }
21
- return i;
22
- }
23
- function r(n, r = 2 ** 53 - 1) {
24
- e(r, "resource measurement limit");
25
- let i = t(0, 2, r);
26
- if (i > r) return i;
27
- for (let e = 0; e < n.length; e += 1) {
28
- let a = n.charCodeAt(e), o;
29
- if (a === 34 || a === 92 || a === 8 || a === 9 || a === 10 || a === 12 || a === 13) o = 2;
30
- else if (a <= 31) o = 6;
31
- else if (a <= 127) o = 1;
32
- else if (a <= 2047) o = 2;
33
- else if (a >= 55296 && a <= 56319 && e + 1 < n.length) {
34
- let t = n.charCodeAt(e + 1);
35
- t >= 56320 && t <= 57343 ? (o = 4, e += 1) : o = 6;
36
- } else o = a >= 55296 && a <= 57343 ? 6 : 3;
37
- if (i = t(i, o, r), i > r) return i;
38
- }
39
- return i;
40
- }
41
- function i(e, n) {
42
- return t(0, e, n);
43
- }
44
- function a(o, s = 2 ** 53 - 1, c = !1) {
45
- if (e(s, "resource measurement limit"), o === null) return {
46
- jsonBytes: i(4, s),
47
- stringValueUtf8Bytes: 0
48
- };
49
- if (typeof o == "string") return {
50
- jsonBytes: r(o, s),
51
- stringValueUtf8Bytes: n(o, s)
52
- };
53
- if (typeof o == "boolean") return {
54
- jsonBytes: i(o ? 4 : 5, s),
55
- stringValueUtf8Bytes: 0
56
- };
57
- if (typeof o == "number") return {
58
- jsonBytes: i((Number.isFinite(o) ? String(Object.is(o, -0) ? 0 : o) : "null").length, s),
59
- stringValueUtf8Bytes: 0
60
- };
61
- if (typeof o == "bigint") throw TypeError("BigInt values cannot be serialized to JSON");
62
- if (Array.isArray(o)) {
63
- let e = i(2, s), n = 0;
64
- for (let r = 0; r < o.length; r += 1) {
65
- r !== 0 && (e = t(e, 1, s));
66
- let i = a(o[r], s, !0);
67
- e = t(e, i.jsonBytes, s), n = t(n, i.stringValueUtf8Bytes, s);
68
- }
69
- return {
70
- jsonBytes: e,
71
- stringValueUtf8Bytes: n
72
- };
73
- }
74
- if (typeof o == "object") {
75
- let e = i(2, s), n = 0, c = 0;
76
- for (let [i, l] of Object.entries(o)) {
77
- if (l === void 0 || typeof l == "function" || typeof l == "symbol") continue;
78
- c++ !== 0 && (e = t(e, 1, s)), e = t(e, r(i, s), s), e = t(e, 1, s);
79
- let o = a(l, s);
80
- e = t(e, o.jsonBytes, s), n = t(n, o.stringValueUtf8Bytes, s);
81
- }
82
- return {
83
- jsonBytes: e,
84
- stringValueUtf8Bytes: n
85
- };
86
- }
87
- return {
88
- jsonBytes: c ? i(4, s) : 0,
89
- stringValueUtf8Bytes: 0
90
- };
91
- }
92
- //#endregion
93
- export { a as n, n as r, t };
@@ -1,175 +0,0 @@
1
- import { A as e, g as t, j as n, r } from "./bounded-raw-part-cache-BTfZD_Sz.js";
2
- import { _ as i } from "./svg-image-by-path-C1M3N2pT.js";
3
- //#region packages/pptx/src/google-fonts.ts
4
- var a = {
5
- ...n,
6
- ...i
7
- };
8
- Object.freeze({
9
- archiveEntryCount: 0,
10
- declaredInflatedBytes: 0,
11
- distinctInflatedBytes: 0,
12
- operationInflatedBytes: 0
13
- });
14
- function o(e, t) {
15
- if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation bootstrap ${t}`);
16
- }
17
- function s(e, t) {
18
- if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap slide at ${t}`);
19
- let n = e;
20
- if (n.index !== t) throw Error(`invalid PPTX presentation bootstrap slide index ${n.index}`);
21
- if (n.partName !== void 0 && typeof n.partName != "string") throw Error(`invalid PPTX presentation bootstrap slide partName at ${t}`);
22
- return Object.freeze({
23
- index: n.index,
24
- ...n.partName === void 0 ? {} : { partName: n.partName }
25
- });
26
- }
27
- function c(e) {
28
- if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation bootstrap payload");
29
- let t = e;
30
- if (!Number.isSafeInteger(t.slideCount) || (t.slideCount ?? -1) < 0 || !Number.isSafeInteger(t.slideWidth) || (t.slideWidth ?? 0) <= 0 || !Number.isSafeInteger(t.slideHeight) || (t.slideHeight ?? 0) <= 0 || !Array.isArray(t.slides) || t.slides.length !== t.slideCount) throw Error("invalid PPTX presentation bootstrap dimensions or slide count");
31
- return o(t.defaultTextColor, "defaultTextColor"), o(t.majorFont, "majorFont"), o(t.minorFont, "minorFont"), o(t.hlinkColor, "hlinkColor"), o(t.folHlinkColor, "folHlinkColor"), Object.freeze({
32
- slideCount: t.slideCount,
33
- slideWidth: t.slideWidth,
34
- slideHeight: t.slideHeight,
35
- defaultTextColor: t.defaultTextColor,
36
- majorFont: t.majorFont,
37
- minorFont: t.minorFont,
38
- hlinkColor: t.hlinkColor,
39
- folHlinkColor: t.folHlinkColor,
40
- slides: Object.freeze(t.slides.map(s))
41
- });
42
- }
43
- function l(e) {
44
- return Object.freeze({
45
- type: "media",
46
- x: e.x,
47
- y: e.y,
48
- width: e.width,
49
- height: e.height,
50
- rotation: e.rotation,
51
- flipH: e.flipH,
52
- flipV: e.flipV,
53
- mediaKind: e.mediaKind,
54
- posterPath: e.posterPath,
55
- posterMimeType: e.posterMimeType,
56
- mediaPath: e.mediaPath,
57
- mimeType: e.mimeType
58
- });
59
- }
60
- function u(e, t) {
61
- if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight media at slide ${t}`);
62
- let n = e;
63
- for (let e of [
64
- "x",
65
- "y",
66
- "width",
67
- "height",
68
- "rotation"
69
- ]) if (typeof n[e] != "number" || !Number.isFinite(n[e])) throw Error(`invalid PPTX presentation preflight media ${e} at slide ${t}`);
70
- if (n.type !== "media" || typeof n.flipH != "boolean" || typeof n.flipV != "boolean" || n.mediaKind !== "audio" && n.mediaKind !== "video" || typeof n.posterPath != "string" || typeof n.posterMimeType != "string" || typeof n.mediaPath != "string" || typeof n.mimeType != "string") throw Error(`invalid PPTX presentation preflight media fields at slide ${t}`);
71
- return l(n);
72
- }
73
- function d(e) {
74
- if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation preflight payload");
75
- let t = e;
76
- if (!Number.isSafeInteger(t.slideCount) || (t.slideCount ?? -1) < 0 || !Number.isSafeInteger(t.slideWidth) || (t.slideWidth ?? 0) <= 0 || !Number.isSafeInteger(t.slideHeight) || (t.slideHeight ?? 0) <= 0 || !Array.isArray(t.slides) || t.slides.length !== t.slideCount || !Array.isArray(t.fontPreloadNames)) throw Error("invalid PPTX presentation preflight dimensions or slide count");
77
- o(t.defaultTextColor, "defaultTextColor"), o(t.majorFont, "majorFont"), o(t.minorFont, "minorFont"), o(t.hlinkColor, "hlinkColor"), o(t.folHlinkColor, "folHlinkColor");
78
- let n = t.slides.map((e, t) => {
79
- if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight slide at ${t}`);
80
- let n = e;
81
- if (n.index !== t || n.partName !== void 0 && typeof n.partName != "string" || n.notes !== null && typeof n.notes != "string" || typeof n.hidden != "boolean" || !Array.isArray(n.mediaElements)) throw Error(`invalid PPTX presentation preflight slide fields at ${t}`);
82
- return Object.freeze({
83
- index: t,
84
- ...n.partName === void 0 ? {} : { partName: n.partName },
85
- notes: n.notes,
86
- hidden: n.hidden,
87
- mediaElements: Object.freeze(n.mediaElements.map((e) => u(e, t)))
88
- });
89
- }), r = t.fontPreloadNames.map((e, t) => {
90
- if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation preflight font at ${t}`);
91
- return e;
92
- });
93
- return Object.freeze({
94
- slideCount: t.slideCount,
95
- slideWidth: t.slideWidth,
96
- slideHeight: t.slideHeight,
97
- defaultTextColor: t.defaultTextColor,
98
- majorFont: t.majorFont,
99
- minorFont: t.minorFont,
100
- hlinkColor: t.hlinkColor,
101
- folHlinkColor: t.folHlinkColor,
102
- slides: Object.freeze(n),
103
- fontPreloadNames: Object.freeze(r)
104
- });
105
- }
106
- function f(e, t) {
107
- for (let n of e.slides) for (let e of n.mediaElements) {
108
- if (e.mediaPath === t) return e.mimeType;
109
- if (e.posterPath === t) return e.posterMimeType;
110
- }
111
- return "";
112
- }
113
- //#endregion
114
- //#region packages/pptx/src/slide-pull-client.ts
115
- var p = 1024 * 1024, m = class {
116
- active = /* @__PURE__ */ new Set();
117
- nextSessionId = 1;
118
- constructor(e) {
119
- if (this.options = e, !Number.isSafeInteger(e.slideCount) || e.slideCount < 0) throw TypeError("slideCount must be a non-negative safe integer");
120
- if (e.generation !== void 0 && (!Number.isSafeInteger(e.generation) || e.generation <= 0)) throw TypeError("generation must be a positive safe integer");
121
- }
122
- async load(e, n = !0, i) {
123
- this.assertSlideIndex(e);
124
- let a = this.nextSessionId++, o = {
125
- sessionId: a,
126
- operationId: a,
127
- generation: this.options.generation ?? 1
128
- }, s = new r(this.options.transport, {
129
- ...o,
130
- maxByteCredit: t,
131
- timeoutMs: i
132
- });
133
- this.active.add(s);
134
- try {
135
- await this.options.open(e, o, i);
136
- let t = await g(s);
137
- try {
138
- let e = t.usage ?? s.usageCheckpoint;
139
- e && this.options.onUsage?.(e);
140
- let r = n ? JSON.parse(new TextDecoder().decode(new Uint8Array(t.payload))) : void 0;
141
- return await t.ack(), r;
142
- } finally {
143
- t.disposeTransferred();
144
- }
145
- } catch (e) {
146
- throw await s.cancel("request-error").catch(() => void 0), e;
147
- } finally {
148
- this.active.delete(s);
149
- }
150
- }
151
- cancelAll() {
152
- for (let e of this.active) e.cancel("closed").catch(() => void 0);
153
- this.active.clear();
154
- }
155
- assertSlideIndex(e) {
156
- if (!Number.isSafeInteger(e) || e < 0 || e >= this.options.slideCount) throw RangeError(`Slide index ${e} out of range (count: ${this.options.slideCount})`);
157
- }
158
- };
159
- function h(e) {
160
- return !!e && typeof e == "object" && e.protocol === "ooxml-pull-v1";
161
- }
162
- async function g(e) {
163
- try {
164
- return await e.pull(p);
165
- } catch (t) {
166
- let n = _(t);
167
- if (n === void 0) throw t;
168
- return e.pull(n);
169
- }
170
- }
171
- function _(n) {
172
- return e(n, p, t);
173
- }
174
- //#endregion
175
- export { d as a, c as i, h as n, a as o, f as r, m as t };