@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
@@ -1,46 +0,0 @@
1
- //#region packages/core/src/fonts/cjk-fallback.ts
2
- function e(e) {
3
- if (!e?.trim()) return null;
4
- let t;
5
- try {
6
- t = new Intl.Locale(e.trim());
7
- } catch {
8
- return null;
9
- }
10
- let { language: n, script: r, region: i } = t;
11
- return n === "ja" ? !r || [
12
- "Jpan",
13
- "Hani",
14
- "Hira",
15
- "Kana"
16
- ].includes(r) ? "jp" : null : n === "ko" ? !r || [
17
- "Kore",
18
- "Hang",
19
- "Hani"
20
- ].includes(r) ? "kr" : null : n === "zh" ? r === "Hans" ? "sc" : r === "Hant" ? "tc" : r ? null : i === "HK" || i === "MO" ? "hk" : i === "TW" ? "tc" : "sc" : null;
21
- }
22
- function t(t = "auto") {
23
- if (t !== "auto") {
24
- if ([
25
- "sc",
26
- "tc",
27
- "hk",
28
- "jp",
29
- "kr"
30
- ].includes(t)) return t;
31
- throw TypeError("cjkFallback must be auto, sc, tc, hk, jp, or kr");
32
- }
33
- let n = typeof document > "u" ? null : e(document.documentElement?.lang);
34
- if (n) return n;
35
- if (typeof navigator < "u") {
36
- for (let t of navigator.languages ?? []) {
37
- let n = e(t);
38
- if (n) return n;
39
- }
40
- let t = e(navigator.language);
41
- if (t) return t;
42
- }
43
- return "jp";
44
- }
45
- //#endregion
46
- export { t as n, e as t };
@@ -1,6 +0,0 @@
1
- //#region packages/pptx/src/comment-occurrence.ts
2
- function e(e, t, n) {
3
- return `slide:${n}:${e.id ?? `classic:${e.authorId ?? "unknown"}:${e.index ?? t}`}`;
4
- }
5
- //#endregion
6
- export { e as t };
@@ -1,2 +0,0 @@
1
- import { a as e } from "./read-only-comment-margin-DkgzASAl.js";
2
- export { e as paintReadOnlyCommentCard };
@@ -1,246 +0,0 @@
1
- import { o as e } from "./source-key-DIJG8BA0.js";
2
- //#region packages/docx/src/review-id.ts
3
- function t(e) {
4
- if (e === void 0) return;
5
- let t = e.replace(/^[\t\n\r ]+|[\t\n\r ]+$/g, "");
6
- if (/^[+-]?\d+$/.test(t)) try {
7
- return BigInt(t).toString();
8
- } catch {
9
- return;
10
- }
11
- }
12
- //#endregion
13
- //#region packages/docx/src/comments.ts
14
- function n(e) {
15
- return Object.freeze({
16
- ...e,
17
- path: Object.freeze([...e.path])
18
- });
19
- }
20
- function r(e) {
21
- return Object.freeze({
22
- source: n(e.source),
23
- runIndex: e.boundary,
24
- affinity: e.boundary < e.runCount ? "following" : "preceding"
25
- });
26
- }
27
- function i(e, t) {
28
- let n = e.runs, r = 0;
29
- for (let e = 0; e < Math.min(t, n.length); e += 1) n[e]?.type !== "unavailableDrawing" && (r += 1);
30
- return r;
31
- }
32
- function a(e, t, i, a, o = t.boundary) {
33
- return Object.freeze({
34
- commentId: e,
35
- source: n(t.source),
36
- startRunIndex: t.boundary,
37
- endRunIndex: o,
38
- reference: r(i),
39
- ...a === void 0 ? {} : { geometryFallback: Object.freeze({
40
- source: n(a.source),
41
- sourceRunIndex: a.boundary
42
- }) }
43
- });
44
- }
45
- function o(t, n) {
46
- let r = t.flatMap(({ paragraph: t, source: r }, a) => {
47
- let o = i(t, t.runs.length);
48
- return [...n.get(e(r)) ?? []].sort((e, t) => e - t).map((e) => ({
49
- paragraphIndex: a,
50
- source: r,
51
- boundary: e,
52
- runCount: o
53
- }));
54
- });
55
- return {
56
- locations: r,
57
- paragraphIndices: new Set(r.map(({ paragraphIndex: e }) => e))
58
- };
59
- }
60
- function s(e, t) {
61
- return e.paragraphIndex - t.paragraphIndex || e.boundary - t.boundary;
62
- }
63
- function c(e, t) {
64
- let n = 0, r = e.length;
65
- for (; n < r;) {
66
- let i = n + Math.floor((r - n) / 2);
67
- s(e[i], t) < 0 ? n = i + 1 : r = i;
68
- }
69
- return n;
70
- }
71
- function l(e, t) {
72
- if (t.paragraphIndices.has(e.paragraphIndex)) return;
73
- let n = c(t.locations, e), i = t.locations[n], a = n > 0 ? t.locations[n - 1] : void 0;
74
- return r(e).affinity === "following" ? i ?? a : a ?? i;
75
- }
76
- function u(e, n, r) {
77
- let s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
78
- for (let e of n) {
79
- let n = t(e);
80
- n === void 0 || c.has(n) || (s.has(n) ? (s.delete(n), c.add(n)) : s.set(n, e));
81
- }
82
- let u = /* @__PURE__ */ new Map();
83
- for (let [n, { paragraph: r, source: a }] of e.entries()) for (let e of r.commentMarks ?? []) {
84
- let o = t(e.id);
85
- if (o === void 0) continue;
86
- let s = u.get(o) ?? {
87
- starts: [],
88
- ends: [],
89
- references: []
90
- };
91
- u.set(o, s);
92
- let c = {
93
- paragraphIndex: n,
94
- source: a,
95
- boundary: i(r, e.runIndex),
96
- runCount: i(r, r.runs.length)
97
- };
98
- e.kind === "rangeStart" ? s.starts.push(c) : e.kind === "rangeEnd" ? s.ends.push(c) : e.kind === "reference" && s.references.push(c);
99
- }
100
- let d = [], f = o(e, r);
101
- for (let [t, n] of u) {
102
- let r = s.get(t);
103
- if (r === void 0 || n.references.length !== 1) continue;
104
- let o = n.references[0];
105
- if (n.starts.length > 1 || n.ends.length > 1) continue;
106
- let c = n.starts.length === 1 ? n.starts[0] : void 0, u = n.ends.length === 1 ? n.ends[0] : void 0;
107
- if (c && u && (c.paragraphIndex < u.paragraphIndex || c.paragraphIndex === u.paragraphIndex && c.boundary <= u.boundary)) {
108
- let t = l(c.paragraphIndex === u.paragraphIndex && c.boundary === u.boundary ? c : o, f);
109
- for (let n = c.paragraphIndex; n <= u.paragraphIndex; n += 1) {
110
- let s = e[n], l = n === c.paragraphIndex ? c.boundary : 0, f = n === u.paragraphIndex ? u.boundary : i(s.paragraph, s.paragraph.runs.length);
111
- d.push(a(r, {
112
- paragraphIndex: n,
113
- source: s.source,
114
- boundary: l,
115
- runCount: i(s.paragraph, s.paragraph.runs.length)
116
- }, o, t, Math.max(l, f)));
117
- }
118
- continue;
119
- }
120
- let p = c && n.ends.length === 0 ? c : u && n.starts.length === 0 ? u : void 0;
121
- if (c && u) continue;
122
- let m = p ?? o, h = l(m, f);
123
- d.push(a(r, m, o, h));
124
- }
125
- return d;
126
- }
127
- function d(e, t, n = /* @__PURE__ */ new Map()) {
128
- let r = new Set(e.map(({ id: e }) => e)), i = /* @__PURE__ */ new Map();
129
- for (let e of t.blocks.sources) {
130
- let n = t.blocks.resolve(e);
131
- if (n.type !== "paragraph") continue;
132
- let r = `${e.story}\u0000${e.storyInstance}`, a = i.get(r) ?? [];
133
- i.has(r) || i.set(r, a), a.push({
134
- paragraph: n,
135
- source: e
136
- });
137
- }
138
- return [...i.values()].flatMap((e) => u(e, r, n));
139
- }
140
- function f(t, n, r = /* @__PURE__ */ new Map(), i = {}) {
141
- if ((t?.length ?? 0) === 0) return [];
142
- let a = d(t ?? [], n, r), o = i.completedSourceKeys;
143
- return o === void 0 ? a : a.filter((t) => {
144
- let n = r.get(e(t.source)) ?? /* @__PURE__ */ new Set(), i = t.startRunIndex < t.endRunIndex ? [...n].some((e) => e >= t.startRunIndex && e < t.endRunIndex) : n.has(t.reference.affinity === "following" ? t.startRunIndex : t.startRunIndex - 1), a = r.get(e(t.reference.source))?.has(t.reference.affinity === "following" ? t.reference.runIndex : t.reference.runIndex - 1) === !0;
145
- return i || a || o.has(e(t.source)) || o.has(e(t.reference.source));
146
- });
147
- }
148
- function p(e, t) {
149
- return e !== void 0 && e.story === t.story && e.storyInstance === t.storyInstance && e.path.length === t.path.length && e.path.every((e, n) => e === t.path[n]);
150
- }
151
- function m(e, t) {
152
- let n = t.filter((t) => t.sourceRunIndex !== void 0 && p(t.source, e.source)), r = n.filter((t) => t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
153
- if (r.length > 0) return r;
154
- if (e.startRunIndex === e.endRunIndex && n.length > 0) {
155
- let t = n.reduce((t, n) => {
156
- let r = n.sourceRunIndex;
157
- return r < e.startRunIndex ? t : t === void 0 || r < t ? r : t;
158
- }, void 0), r = n.reduce((t, n) => {
159
- let r = n.sourceRunIndex;
160
- return r >= e.startRunIndex ? t : t === void 0 || r > t ? r : t;
161
- }, void 0), i = t ?? r;
162
- if (i !== void 0) return n.filter((e) => e.sourceRunIndex === i);
163
- }
164
- let i = t.filter((t) => t.sourceRunIndex !== void 0 && p(t.source, e.reference.source)), a = i.reduce((t, n) => {
165
- let r = n.sourceRunIndex;
166
- return r < e.reference.runIndex ? t : t === void 0 || r < t ? r : t;
167
- }, void 0), o = i.reduce((t, n) => {
168
- let r = n.sourceRunIndex;
169
- return r >= e.reference.runIndex ? t : t === void 0 || r > t ? r : t;
170
- }, void 0), s = e.reference.affinity === "following" ? a ?? o : o ?? a;
171
- if (s !== void 0) return i.filter((e) => e.sourceRunIndex === s);
172
- let c = e.geometryFallback;
173
- return c === void 0 ? [] : t.filter((e) => e.sourceRunIndex === c.sourceRunIndex && p(e.source, c.source));
174
- }
175
- function h(e, t) {
176
- return t.some((t) => t.sourceRunIndex !== void 0 && p(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex) ? "range" : t.some((t) => p(t.source, e.source) || p(t.source, e.reference.source)) ? "point" : "fallback";
177
- }
178
- function g(e) {
179
- let t = e.map((e) => {
180
- let t = e.highlightBounds;
181
- return {
182
- x: t?.x ?? e.x,
183
- y: t?.y ?? e.y,
184
- width: t?.width ?? e.w,
185
- height: t?.height ?? e.h,
186
- ...e.transform ? { transform: e.transform } : {}
187
- };
188
- }).filter(({ width: e, height: t }) => e > 0 && t > 0).sort((e, t) => e.y - t.y || e.x - t.x), n = [];
189
- for (let e of t) {
190
- let t = n.at(-1);
191
- if (t && t.y === e.y && t.height === e.height && t.transform === e.transform) {
192
- let r = Math.min(t.x, e.x), i = Math.max(t.x + t.width, e.x + e.width);
193
- n[n.length - 1] = Object.freeze({
194
- ...t,
195
- x: r,
196
- width: i - r
197
- });
198
- } else n.push(Object.freeze({ ...e }));
199
- }
200
- return Object.freeze(n);
201
- }
202
- function _(t, n, r, i = {}) {
203
- let a = new Map(t.map((e) => [e.id, e])), o = t.filter((e) => e.parentId === void 0), s = new Map(o.map((e) => [e.id, e])), c = /* @__PURE__ */ new Map(), l = new Map(o.map((e) => [e.id, e.id]));
204
- for (let e of t) {
205
- if (e.parentId === void 0) continue;
206
- let t = new Set([e.id]), n = e;
207
- for (; n.parentId !== void 0;) {
208
- let r = a.get(n.parentId);
209
- if (!r || t.has(r.id)) {
210
- n = e;
211
- break;
212
- }
213
- t.add(r.id), n = r;
214
- }
215
- if (!s.has(n.id) || n === e) continue;
216
- l.set(e.id, n.id);
217
- let r = c.get(n.id) ?? [];
218
- c.has(n.id) || c.set(n.id, r), r.push(e);
219
- }
220
- let u = /* @__PURE__ */ new Set();
221
- for (let t of r) t.source && u.add(e(t.source));
222
- let d = /* @__PURE__ */ new Map();
223
- for (let t of n) {
224
- let n = l.get(t.commentId);
225
- if (n === void 0 || !(u.has(e(t.source)) || u.has(e(t.reference.source)) || t.geometryFallback !== void 0 && u.has(e(t.geometryFallback.source)))) continue;
226
- let i = m(t, r);
227
- if (i.length === 0) continue;
228
- let a = d.get(n) ?? [];
229
- d.has(n) || d.set(n, a), a.push(Object.freeze({
230
- anchor: t,
231
- kind: h(t, i),
232
- rects: g(i)
233
- }));
234
- }
235
- return Object.freeze(o.flatMap((e) => {
236
- if (i.includeResolved === !1 && e.resolved === !0) return [];
237
- let t = d.get(e.id);
238
- return t?.length ? [Object.freeze({
239
- root: e,
240
- replies: Object.freeze([...c.get(e.id) ?? []]),
241
- anchors: Object.freeze([...t])
242
- })] : [];
243
- }));
244
- }
245
- //#endregion
246
- export { t as i, m as n, _ as r, f as t };
@@ -1,27 +0,0 @@
1
- //#region packages/xlsx/src/delimited-text-worker.ts?worker&inline
2
- var e = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t),t=class e extends Error{code;constructor(t,n){super(n),this.name=`OoxmlError`,this.code=t,Object.setPrototypeOf(this,e.prototype)}},n=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}};function r(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`}function i(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function a(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,a=t.metric,o=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!r(a)||!i(o)||!i(s)||s<=o?void 0:{metric:a,limit:o,observed:s}}catch{return}}var o,s,c,l=e((()=>{o=1<<25,s=1<<27,o*4,s*4,c=class e extends RangeError{code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function u(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var d=e((()=>{}));function f(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function p(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return f(t.requiredBytes)&&f(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var m=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function h(e){if(e instanceof m)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!p(r)))return new m(r)}l(),d();const g=`OOXML_RESOURCE_LIMIT:`;function _(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return _(t.archiveEntryCount)&&_(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||_(t.largestInflatedEntryBytes))&&_(t.distinctInflatedBytes)&&_(t.operationInflatedBytes)}function y(e){return e===`docx`||e===`xlsx`||e===`pptx`}function b(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function x(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function S(e){return x(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function C(e){return!x(e,4096)||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!==`..`)}const w=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}]]),T=new Set([...w.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),E=new Set([...w.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function D(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!y(t.format)||!x(t.operation,256)||!S(t.resource)||!S(t.metric)||!_(t.limit)||!_(t.observed)||typeof t.configurable!=`boolean`||!v(t.usage)?!1:!(`part`in t)||C(t.part)}function O(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!b(t.stage)||!D(t.violation))return!1;let n=t.violation,r=w.get(`${n.resource}:${n.metric}`);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:!(T.has(n.resource)&&E.has(n.metric))}function k(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function A(e){if(!O(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:k(t.usage)}};return O(n)?n:void 0}function j(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``}: ${t.metric} ${t.observed} > ${t.limit}`}function M(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(g))return;let r;try{r=JSON.parse(t.slice(21))}catch{return}if(!r||typeof r!=`object`)return;let i=r;if(!(i.code!==`ooxml-resource-limit`||!O(i.details)))return new n(j(i.details),i.details)}function N(e){let r=a(e);if(r){let e=new c(r.metric,r.limit,r.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:r}}let i=u(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let o=h(e);if(o)return{message:o.message,errorName:o.name,code:o.code,insufficientCredit:{requiredBytes:o.requiredBytes,offeredBytes:o.offeredBytes}};let s=e instanceof t||e instanceof n?e:M(e);if(s instanceof n){let e=A(s.details);return e?{message:typeof s.message==`string`?s.message:j(e),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:e}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(s instanceof t)return{message:typeof s.message==`string`?s.message:String(s.message),errorName:x(s.name,128)?s.name:`OoxmlError`,...S(s.code)?{code:s.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(g))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let d=e instanceof Error?e:Error(l),f=d;return{message:typeof d.message==`string`?d.message:String(d.message),errorName:x(d.name,128)?d.name:`Error`,...typeof f.code==`string`?{code:f.code}:{}}}function P(e){try{return N(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}function F(e,t){if(!Number.isSafeInteger(e)||e<0)throw Error(`${t} must be a non-negative safe integer`)}function I(e,t,n){return F(e,`resource measurement`),F(t,`resource measurement`),F(n,`resource measurement limit`),e>n||t>n||t>n-e?n===2**53-1?n:n+1:e+t}function L(e,t=2**53-1){F(t,`resource measurement limit`);let n=0;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=3}else a=3;if(n=I(n,a,t),n>t)return n}return n}function R(e,t=2**53-1){F(t,`resource measurement limit`);let n=I(0,2,t);if(n>t)return n;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i===34||i===92||i===8||i===9||i===10||i===12||i===13)a=2;else if(i<=31)a=6;else if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=6}else a=i>=55296&&i<=57343?6:3;if(n=I(n,a,t),n>t)return n}return n}function z(e,t){return I(0,e,t)}function B(e,t=2**53-1,n=!1){if(F(t,`resource measurement limit`),e===null)return{jsonBytes:z(4,t),stringValueUtf8Bytes:0};if(typeof e==`string`)return{jsonBytes:R(e,t),stringValueUtf8Bytes:L(e,t)};if(typeof e==`boolean`)return{jsonBytes:z(e?4:5,t),stringValueUtf8Bytes:0};if(typeof e==`number`)return{jsonBytes:z((Number.isFinite(e)?String(Object.is(e,-0)?0:e):`null`).length,t),stringValueUtf8Bytes:0};if(typeof e==`bigint`)throw TypeError(`BigInt values cannot be serialized to JSON`);if(Array.isArray(e)){let n=z(2,t),r=0;for(let i=0;i<e.length;i+=1){i!==0&&(n=I(n,1,t));let a=B(e[i],t,!0);n=I(n,a.jsonBytes,t),r=I(r,a.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}if(typeof e==`object`){let n=z(2,t),r=0,i=0;for(let[a,o]of Object.entries(e)){if(o===void 0||typeof o==`function`||typeof o==`symbol`)continue;i++!==0&&(n=I(n,1,t)),n=I(n,R(a,t),t),n=I(n,1,t);let e=B(o,t);n=I(n,e.jsonBytes,t),r=I(r,e.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}return{jsonBytes:n?z(4,t):0,stringValueUtf8Bytes:0}}const V=1e5,H=25e4,U=33554432,W=67108864,G=Object.freeze({archiveEntryCount:0,declaredInflatedBytes:0,distinctInflatedBytes:0,operationInflatedBytes:0});function K(e){let t=e.reduce((e,t)=>I(e,t.cells.length,H),0);return{rows:e.length,cells:t,ownedUtf8Bytes:e.reduce((e,t)=>t.cells.reduce((e,t)=>{let n=B(t.value,U).stringValueUtf8Bytes;return I(e,I(n,t.formula===void 0?0:L(t.formula,U),U),U)},e),0)}}function q(e){return J(e,K(e.rows))}function J(e,t){let n=B(e,67108864);return{...t,jsonBytes:n.jsonBytes}}function Y(e,t,r,i,a,o,s){let c=r===`worksheet-json`?`serialization`:`parsing`;return new n(`OOXML resource limit exceeded${t?` for ${t}`:``}: ${i} ${o} > ${a}`,{stage:c,violation:{format:`xlsx`,operation:e,resource:r,metric:i,...t===void 0?{}:{part:t},limit:a,observed:Math.min(o,a+1),configurable:!1,usage:s??G}})}function X(e,t,n,r){let i=[[`rows`,e.rows,V],[`cells`,e.cells,H],[`owned-utf8-bytes`,e.ownedUtf8Bytes,U]];for(let[e,a,o]of i)if(a>o)throw Y(t,n,e===`owned-utf8-bytes`?`worksheet-cell-content`:`worksheet-model`,e,o,a,r)}function Z(e,t,n,r){if(e>W)throw Y(t,n,`worksheet-json`,`bytes`,W,e,r)}const Q=`load-delimited-text`,$=W;function ee(e){if(e>$)throw Y(Q,void 0,`delimited-text-source`,`bytes`,$,e)}const te=Object.freeze({fonts:[Object.freeze({bold:!1,italic:!1,underline:!1,strike:!1,size:11,color:null,name:`Calibri`})],fills:[Object.freeze({patternType:`none`,fgColor:null,bgColor:null})],borders:[Object.freeze({left:null,right:null,top:null,bottom:null})],cellXfs:[Object.freeze({fontId:0,fillId:0,borderId:0,numFmtId:0,alignH:null,alignV:null,wrapText:!1})],numFmts:[],dxfs:[]});function ne(e,t){ee(e.byteLength);let n;try{n=new TextDecoder(t.encoding,{fatal:!0}).decode(e)}catch(e){throw TypeError(`Delimited text could not be decoded as ${t.encoding}`,{cause:e})}let r=[],i=[],a=``,o,s=1,c=1,l=0,u=0,d=!1,f=!1,p=e=>{a+=e,a.length>=4096&&((o??=[]).push(a),a=``)},m=()=>{if(l++,l>H)throw Y(Q,void 0,`worksheet-model`,`cells`,H,l);if(c>16384)throw RangeError(`Delimited text row ${s} has more than 16384 columns`);let e=o?o.join(``)+a:a;if(e!==``){if(u+=L(e,U+1),u>U)throw Y(Q,void 0,`worksheet-cell-content`,`owned-utf8-bytes`,U,u);i.push({row:s,col:c,value:{type:`text`,text:e}})}a=``,o=void 0,c++,f=!1},h=()=>{if(s>V)throw Y(Q,void 0,`worksheet-model`,`rows`,V,s);r.push({index:s,height:null,cells:i}),i=[],s++,c=1};for(let e=0;e<n.length;e++){let r=n[e];if(d){if(r!==`\"`){r===`\\r`?(p(`\n`),n[e+1]===`\n`&&e++):p(r);continue}n[e+1]===`\"`?(p(`\"`),e++):(d=!1,f=!0);continue}if(f){if(r!==t.delimiter&&r!==`\\r`&&r!==`\n`)throw SyntaxError(`Unexpected character after closing quote at row ${s}, column ${c}`)}else if(r===`\"`&&a===``&&o===void 0){d=!0;continue}if(r===t.delimiter){m();continue}if(r===`\\r`||r===`\n`){m(),h(),r===`\\r`&&n[e+1]===`\n`&&e++;continue}p(r)}if(d)throw SyntaxError(`Unterminated quoted field at row ${s}, column ${c}`);let g=n.endsWith(`\n`)||n.endsWith(`\\r`);n.length>0&&!g&&(m(),h());let _={name:t.sheetName,rows:r,colWidths:{},rowHeights:{},defaultColWidth:8.43,defaultRowHeight:15,mergeCells:[],freezeRows:0,freezeCols:0,conditionalFormats:[],images:[],charts:[],defaultFontFamily:`Calibri`,defaultFontSize:11},v=q(_);return X(v,Q,void 0),Z(v.jsonBytes,Q,void 0),{workbook:{workbook:{sheets:[{name:t.sheetName,sheetId:1,rId:`rId1`}]},styles:te,sharedStrings:[]},worksheet:_}}self.onmessage=e=>{let t=e.data;try{let{workbook:e,worksheet:n}=ne(t.data,t.options),r=new TextEncoder().encode(JSON.stringify(n)).buffer,i={type:`delimitedTextParsed`,id:t.id,workbook:e,worksheetJson:r};self.postMessage(i,[r])}catch(e){let n={type:`error`,id:t.id,...P(e)};self.postMessage(n)}};", t = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", e], { type: "text/javascript;charset=utf-8" });
3
- function n(n) {
4
- let r;
5
- try {
6
- if (r = t && (self.URL || self.webkitURL).createObjectURL(t), !r) throw "";
7
- let e = new Worker(r, {
8
- type: "module",
9
- name: n?.name
10
- });
11
- return e.addEventListener("error", () => {
12
- (self.URL || self.webkitURL).revokeObjectURL(r);
13
- }), e;
14
- } catch {
15
- return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(e), {
16
- type: "module",
17
- name: n?.name
18
- });
19
- }
20
- }
21
- //#endregion
22
- //#region packages/xlsx/src/delimited-text-worker-host.ts
23
- function r() {
24
- return new n();
25
- }
26
- //#endregion
27
- export { r as createDelimitedTextWorker };