@silurus/ooxml 0.85.3 → 0.86.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 +39 -7
- package/dist/assets/render-worker-D21h5TGR.js +10 -0
- package/dist/assets/render-worker-Dsfekaht.js +11 -0
- package/dist/assets/render-worker-DxU7IrKo.js +31 -0
- package/dist/bounded-raw-part-cache-BfbSxRIL.js +119 -0
- package/dist/{canvas-viewer-mechanics-CDNMJ-Yz.js → canvas-viewer-mechanics-DN5SqWGS.js} +329 -192
- package/dist/{comment-ui-runtime-DAKBCpsM.js → comment-ui-runtime-DEtgcmj7.js} +5 -5
- package/dist/comment-ui-runtime-TLHustXJ.js +2 -0
- package/dist/{comment-ui-runtime-CAbpuWi_.js → comment-ui-runtime-lXwVOgjW.js} +4 -4
- package/dist/{comments-Brfxa3hQ.js → comments-CAn2A_Xh.js} +1 -1
- package/dist/delimited-text-worker-host-DcHj_JZt.js +27 -0
- package/dist/{document-pull-client-F3ox_VXK.js → document-pull-client-uopDjRde.js} +4477 -4431
- package/dist/{docx-BYvm3TWw.js → docx-wPzeF76A.js} +519 -334
- package/dist/docx.mjs +7 -7
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{dom-interaction-boundary-CDGegIB5.js → dom-interaction-boundary-CswB9Tzi.js} +60 -57
- package/dist/{line-metrics-BGtFM-ec.js → hyperlink-BR1NCO7S.js} +954 -935
- package/dist/index.mjs +4 -4
- package/dist/{line-distribute-BsV4MVZ2.js → line-distribute-IsUGfHXm.js} +10 -10
- package/dist/line-metrics-CBbw80Ko.js +60 -0
- package/dist/node.mjs +266 -266
- package/dist/{pptx-BqpVTP8p.js → pptx-BxJ_RBSY.js} +173 -165
- package/dist/pptx.mjs +5 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{render-DeZpRCfx.js → render-DEiun_AH.js} +1 -1
- package/dist/{render-worker-host-BKtXmlEF.js → render-worker-host-BEfLZvSL.js} +1 -1
- package/dist/{render-worker-host-CNKQ76tu.js → render-worker-host-Ba6Fchqr.js} +1 -1
- package/dist/{render-worker-host-CBcQXsR5.js → render-worker-host-C3xwtHnv.js} +1 -1
- package/dist/{resource-measurement-D41R-0Bl.js → resource-measurement-CclArDRs.js} +10 -10
- package/dist/{session-n2p5_jxV.js → session-BuJL_xcp.js} +87 -87
- package/dist/{slide-pull-client-Dwek7xW8.js → slide-pull-client-Ck8wfRT_.js} +1239 -1165
- package/dist/types/chart-ex.d.ts +2 -2
- package/dist/types/docx.d.ts +10 -11
- package/dist/types/index.d.ts +38 -19
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +6 -5
- package/dist/types/pptx.d.ts +10 -10
- package/dist/types/region-map.d.ts +2 -2
- package/dist/types/three-d.d.ts +2 -2
- package/dist/types/tiff.d.ts +1 -1
- package/dist/types/xlsx.d.ts +34 -14
- package/dist/{worksheet-pull-client-C9sC36Vu.js → worksheet-pull-client-CAvuf22q.js} +72 -69
- package/dist/{xlsx-DSU6pV1O.js → xlsx-Bblm5r1h.js} +1752 -1592
- package/dist/xlsx.mjs +5 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +1 -1
- package/dist/assets/render-worker-D1O73gYW.js +0 -10
- package/dist/assets/render-worker-DHP0rgcW.js +0 -24
- package/dist/assets/render-worker-V2wWYA4O.js +0 -11
- package/dist/bounded-raw-part-cache-C6ro6Ezf.js +0 -254
- package/dist/comment-ui-runtime-DTaaZdXC.js +0 -2
- /package/dist/{comment-occurrence-tj54AXXB.js → comment-occurrence-CqejEuts.js} +0 -0
- /package/dist/{highlight-rect-DBcYVJDv.js → highlight-rect-FuUSmL3a.js} +0 -0
- /package/dist/{read-only-comment-decoration-Mv_SAiHy.js → read-only-comment-decoration-BTnWEeo5.js} +0 -0
- /package/dist/{read-only-comment-margin-Cqu-Ir0C.js → read-only-comment-margin-plStyGfE.js} +0 -0
- /package/dist/{source-key-BkBB3X82.js → source-key-Ktb1GRE5.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Et as e, sn as t } from "./hyperlink-BR1NCO7S.js";
|
|
2
2
|
import { i as n, r, s as i } from "./pixel-budget-Dgjw269h.js";
|
|
3
3
|
//#region packages/core/src/errors/cfb-sniff.ts
|
|
4
4
|
var a = [
|
|
@@ -87,20 +87,20 @@ var y = [
|
|
|
87
87
|
177,
|
|
88
88
|
26,
|
|
89
89
|
225
|
|
90
|
-
], ee = 4294967290, b = 4294967294, te = 512,
|
|
91
|
-
function
|
|
90
|
+
], ee = 4294967290, b = 4294967294, te = 512, ne = 128, x = 4e6, re = 8e6, ie = 65536, ae = 1e6;
|
|
91
|
+
function S(e, t) {
|
|
92
92
|
if (e.length < te) return null;
|
|
93
93
|
for (let t = 0; t < y.length; t++) if (e[t] !== y[t]) return null;
|
|
94
|
-
let n = new DataView(e.buffer, e.byteOffset, e.byteLength), r =
|
|
94
|
+
let n = new DataView(e.buffer, e.byteOffset, e.byteLength), r = oe(n);
|
|
95
95
|
if (r === null) return null;
|
|
96
|
-
let i =
|
|
96
|
+
let i = se(n, e.length, r);
|
|
97
97
|
if (i === null) return null;
|
|
98
|
-
let a =
|
|
98
|
+
let a = ce(n, e.length, r, i, t);
|
|
99
99
|
if (a === null || a.target === null) return null;
|
|
100
100
|
let { target: o, root: s } = a;
|
|
101
|
-
return o.size === 0 ? new Uint8Array() : o.size < r.miniStreamCutoff ? s === null ? null :
|
|
101
|
+
return o.size === 0 ? new Uint8Array() : o.size < r.miniStreamCutoff ? s === null ? null : ue(n, e.length, r, i, s, o) : E(n, e.length, r, i, o.startSector, o.size);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function oe(e) {
|
|
104
104
|
let t = e.getUint16(30, !0);
|
|
105
105
|
if (t !== 9 && t !== 12) return null;
|
|
106
106
|
let n = e.getUint16(32, !0);
|
|
@@ -114,57 +114,57 @@ function ae(e) {
|
|
|
114
114
|
numDifatSectors: e.getUint32(72, !0)
|
|
115
115
|
} : null;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function C(e, t) {
|
|
118
118
|
return (e + 1) * t;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function w(e) {
|
|
121
121
|
return e >= 0 && e <= ee;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function se(e, t, n) {
|
|
124
124
|
let { sectorSize: r } = n, i = [];
|
|
125
125
|
for (let t = 0; t < 109; t++) {
|
|
126
126
|
let n = e.getUint32(76 + t * 4, !0);
|
|
127
|
-
|
|
127
|
+
w(n) && i.push(n);
|
|
128
128
|
}
|
|
129
129
|
let a = r / 4 - 1, o = n.firstDifatSector, s = /* @__PURE__ */ new Set(), c = 0;
|
|
130
|
-
for (;
|
|
131
|
-
if (c++ >
|
|
130
|
+
for (; w(o);) {
|
|
131
|
+
if (c++ > ae) return null;
|
|
132
132
|
if (s.has(o)) break;
|
|
133
133
|
s.add(o);
|
|
134
|
-
let n =
|
|
134
|
+
let n = C(o, r);
|
|
135
135
|
if (n < 0 || n + r > t) return null;
|
|
136
136
|
for (let t = 0; t < a; t++) {
|
|
137
137
|
let r = e.getUint32(n + t * 4, !0);
|
|
138
|
-
|
|
138
|
+
w(r) && i.push(r);
|
|
139
139
|
}
|
|
140
140
|
o = e.getUint32(n + a * 4, !0);
|
|
141
141
|
}
|
|
142
142
|
return i;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function T(e, t, n, r, i) {
|
|
145
145
|
let a = n / 4, o = Math.floor(i / a), s = i % a;
|
|
146
146
|
if (o >= r.length) return null;
|
|
147
147
|
let c = r[o];
|
|
148
|
-
if (!
|
|
149
|
-
let l =
|
|
148
|
+
if (!w(c)) return null;
|
|
149
|
+
let l = C(c, n) + s * 4;
|
|
150
150
|
return l < 0 || l + 4 > t ? null : e.getUint32(l, !0);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
let { sectorSize: a } = n, o = Math.floor(a /
|
|
152
|
+
function ce(e, t, n, r, i) {
|
|
153
|
+
let { sectorSize: a } = n, o = Math.floor(a / ne);
|
|
154
154
|
if (o < 1) return null;
|
|
155
155
|
let s = null, c = null, l = /* @__PURE__ */ new Set(), u = n.firstDirSector, d = 0, f = 0;
|
|
156
|
-
for (;
|
|
157
|
-
if (d++ >
|
|
156
|
+
for (; w(u);) {
|
|
157
|
+
if (d++ > x) return null;
|
|
158
158
|
if (l.has(u)) break;
|
|
159
159
|
l.add(u);
|
|
160
|
-
let n =
|
|
160
|
+
let n = C(u, a);
|
|
161
161
|
if (n < 0 || n + a > t) return null;
|
|
162
162
|
for (let t = 0; t < o; t++) {
|
|
163
|
-
if (f++ >
|
|
163
|
+
if (f++ > ie) return {
|
|
164
164
|
target: s,
|
|
165
165
|
root: c
|
|
166
166
|
};
|
|
167
|
-
let r = n + t *
|
|
167
|
+
let r = n + t * ne, a = e.getUint8(r + 66);
|
|
168
168
|
if (a === 0) continue;
|
|
169
169
|
let o = e.getUint32(r + 116, !0), l = e.getUint32(r + 120, !0);
|
|
170
170
|
if (a === 5) {
|
|
@@ -174,12 +174,12 @@ function se(e, t, n, r, i) {
|
|
|
174
174
|
};
|
|
175
175
|
continue;
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
le(e, r) === i && (s = {
|
|
178
178
|
startSector: o,
|
|
179
179
|
size: l
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
let p =
|
|
182
|
+
let p = T(e, t, a, r, u);
|
|
183
183
|
if (p === null) break;
|
|
184
184
|
u = p;
|
|
185
185
|
}
|
|
@@ -188,7 +188,7 @@ function se(e, t, n, r, i) {
|
|
|
188
188
|
root: c
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function le(e, t) {
|
|
192
192
|
let n = e.getUint16(t + 64, !0);
|
|
193
193
|
if (n < 2 || n > 64) return "";
|
|
194
194
|
let r = n / 2 - 1, i = "";
|
|
@@ -199,56 +199,56 @@ function ce(e, t) {
|
|
|
199
199
|
}
|
|
200
200
|
return i;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function E(e, t, n, r, i, a) {
|
|
203
203
|
let { sectorSize: o } = n, s = new Uint8Array(a), c = 0, l = i, u = /* @__PURE__ */ new Set(), d = 0;
|
|
204
|
-
for (;
|
|
205
|
-
if (d++ >
|
|
204
|
+
for (; w(l) && c < a;) {
|
|
205
|
+
if (d++ > x || u.has(l)) return null;
|
|
206
206
|
u.add(l);
|
|
207
|
-
let n =
|
|
207
|
+
let n = C(l, o);
|
|
208
208
|
if (n < 0 || n + o > t) return null;
|
|
209
209
|
let i = Math.min(o, a - c);
|
|
210
210
|
s.set(new Uint8Array(e.buffer, e.byteOffset + n, i), c), c += i;
|
|
211
|
-
let f =
|
|
211
|
+
let f = T(e, t, o, r, l);
|
|
212
212
|
if (f === null) return null;
|
|
213
213
|
l = f;
|
|
214
214
|
}
|
|
215
215
|
return c === a ? s : null;
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
let { sectorSize: o, miniSectorSize: s } = n, c =
|
|
217
|
+
function ue(e, t, n, r, i, a) {
|
|
218
|
+
let { sectorSize: o, miniSectorSize: s } = n, c = E(e, t, n, r, i.startSector, i.size);
|
|
219
219
|
if (c === null) return null;
|
|
220
220
|
let l = new Uint8Array(a.size), u = 0, d = a.startSector, f = /* @__PURE__ */ new Set(), p = 0, m = o / 4;
|
|
221
|
-
for (;
|
|
222
|
-
if (p++ >
|
|
221
|
+
for (; w(d) && u < a.size;) {
|
|
222
|
+
if (p++ > re || f.has(d)) return null;
|
|
223
223
|
f.add(d);
|
|
224
224
|
let i = d * s;
|
|
225
225
|
if (i < 0 || i + s > c.length) return null;
|
|
226
226
|
let o = Math.min(s, a.size - u);
|
|
227
227
|
l.set(c.subarray(i, i + o), u), u += o;
|
|
228
|
-
let h =
|
|
228
|
+
let h = de(e, t, n, r, m, d);
|
|
229
229
|
if (h === null) return null;
|
|
230
230
|
d = h;
|
|
231
231
|
}
|
|
232
232
|
return u === a.size ? l : null;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function de(e, t, n, r, i, a) {
|
|
235
235
|
let { sectorSize: o } = n, s = Math.floor(a / i), c = a % i, l = n.firstMiniFatSector, u = /* @__PURE__ */ new Set();
|
|
236
236
|
for (let n = 0; n < s; n++) {
|
|
237
|
-
if (!
|
|
237
|
+
if (!w(l) || u.has(l)) return null;
|
|
238
238
|
u.add(l);
|
|
239
|
-
let n =
|
|
239
|
+
let n = T(e, t, o, r, l);
|
|
240
240
|
if (n === null) return null;
|
|
241
241
|
l = n;
|
|
242
242
|
}
|
|
243
|
-
if (!
|
|
244
|
-
let d =
|
|
243
|
+
if (!w(l)) return null;
|
|
244
|
+
let d = C(l, o) + c * 4;
|
|
245
245
|
if (d < 0 || d + 4 > t) return null;
|
|
246
246
|
let f = e.getUint32(d, !0);
|
|
247
247
|
return f === b ? b : f;
|
|
248
248
|
}
|
|
249
249
|
//#endregion
|
|
250
250
|
//#region packages/core/src/crypto/encryption-info.ts
|
|
251
|
-
function
|
|
251
|
+
function D(e) {
|
|
252
252
|
if (typeof atob == "function") {
|
|
253
253
|
let t = atob(e), n = new Uint8Array(t.length);
|
|
254
254
|
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
@@ -258,19 +258,19 @@ function O(e) {
|
|
|
258
258
|
if (t) return new Uint8Array(t.from(e, "base64"));
|
|
259
259
|
throw Error("no base64 decoder available");
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function O(e, t, n) {
|
|
262
262
|
let r = RegExp(`<(?:[\\w]+:)?${t}\\b[^>]*>`).exec(e);
|
|
263
263
|
if (!r) return null;
|
|
264
264
|
let i = r[0], a = RegExp(`\\b${n}\\s*=\\s*"([^"]*)"`).exec(i);
|
|
265
265
|
return a ? a[1] : null;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function k(e) {
|
|
268
268
|
if (e === null) return null;
|
|
269
269
|
let t = Number(e);
|
|
270
270
|
return Number.isFinite(t) ? t : null;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
let n =
|
|
272
|
+
function A(e, t) {
|
|
273
|
+
let n = k(O(e, t, "saltSize")), r = k(O(e, t, "blockSize")), i = k(O(e, t, "keyBits")), a = k(O(e, t, "hashSize")), o = O(e, t, "cipherAlgorithm"), s = O(e, t, "cipherChaining"), c = O(e, t, "hashAlgorithm"), l = O(e, t, "saltValue");
|
|
274
274
|
return n === null || r === null || i === null || a === null || !o || !s || !c || l === null ? null : {
|
|
275
275
|
saltSize: n,
|
|
276
276
|
blockSize: r,
|
|
@@ -279,14 +279,14 @@ function j(e, t) {
|
|
|
279
279
|
cipherAlgorithm: o,
|
|
280
280
|
cipherChaining: s,
|
|
281
281
|
hashAlgorithm: c,
|
|
282
|
-
saltValue:
|
|
282
|
+
saltValue: D(l)
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function fe(e) {
|
|
286
286
|
if (e.length < 8) return { kind: "unknown" };
|
|
287
287
|
let t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = t.getUint16(0, !0), r = t.getUint16(2, !0);
|
|
288
288
|
if (n === 4 && r === 4) {
|
|
289
|
-
let t =
|
|
289
|
+
let t = pe(e.subarray(8));
|
|
290
290
|
return t ? {
|
|
291
291
|
kind: "agile",
|
|
292
292
|
descriptor: t
|
|
@@ -294,21 +294,21 @@ function de(e) {
|
|
|
294
294
|
}
|
|
295
295
|
return r === 16 && (n === 3 || n === 4) ? { kind: "extensible" } : r === 2 && (n === 2 || n === 3 || n === 4) ? { kind: "standard" } : { kind: "unknown" };
|
|
296
296
|
}
|
|
297
|
-
function
|
|
298
|
-
let t = new TextDecoder("utf-8").decode(e), n =
|
|
297
|
+
function pe(e) {
|
|
298
|
+
let t = new TextDecoder("utf-8").decode(e), n = A(t, "keyData"), r = A(t, "encryptedKey");
|
|
299
299
|
if (!n || !r) return null;
|
|
300
|
-
let i =
|
|
300
|
+
let i = k(O(t, "encryptedKey", "spinCount")), a = O(t, "encryptedKey", "encryptedVerifierHashInput"), o = O(t, "encryptedKey", "encryptedVerifierHashValue"), s = O(t, "encryptedKey", "encryptedKeyValue");
|
|
301
301
|
if (i === null || a === null || o === null || s === null) return null;
|
|
302
302
|
let c = {
|
|
303
303
|
...r,
|
|
304
304
|
spinCount: i,
|
|
305
|
-
encryptedVerifierHashInput:
|
|
306
|
-
encryptedVerifierHashValue:
|
|
307
|
-
encryptedKeyValue:
|
|
308
|
-
}, l = null, u =
|
|
305
|
+
encryptedVerifierHashInput: D(a),
|
|
306
|
+
encryptedVerifierHashValue: D(o),
|
|
307
|
+
encryptedKeyValue: D(s)
|
|
308
|
+
}, l = null, u = O(t, "dataIntegrity", "encryptedHmacKey"), d = O(t, "dataIntegrity", "encryptedHmacValue");
|
|
309
309
|
return u !== null && d !== null && (l = {
|
|
310
|
-
encryptedHmacKey:
|
|
311
|
-
encryptedHmacValue:
|
|
310
|
+
encryptedHmacKey: D(u),
|
|
311
|
+
encryptedHmacValue: D(d)
|
|
312
312
|
}), {
|
|
313
313
|
keyData: n,
|
|
314
314
|
passwordKeyEncryptor: c,
|
|
@@ -317,7 +317,7 @@ function fe(e) {
|
|
|
317
317
|
}
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region packages/core/src/crypto/agile.ts
|
|
320
|
-
var
|
|
320
|
+
var j = {
|
|
321
321
|
verifierHashInput: new Uint8Array([
|
|
322
322
|
254,
|
|
323
323
|
167,
|
|
@@ -368,120 +368,120 @@ var M = {
|
|
|
368
368
|
132,
|
|
369
369
|
51
|
|
370
370
|
])
|
|
371
|
-
},
|
|
371
|
+
}, me = 54, M = 4096, N = class extends Error {
|
|
372
372
|
reason;
|
|
373
373
|
constructor(e, t) {
|
|
374
374
|
super(t), this.name = "AgileDecryptError", this.reason = e;
|
|
375
375
|
}
|
|
376
376
|
};
|
|
377
|
-
function
|
|
377
|
+
function P() {
|
|
378
378
|
let e = globalThis.crypto;
|
|
379
|
-
if (!e || !e.subtle) throw new
|
|
379
|
+
if (!e || !e.subtle) throw new N("unsupported-encryption", "WebCrypto (globalThis.crypto.subtle) is unavailable; cannot decrypt.");
|
|
380
380
|
return e.subtle;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function F(e) {
|
|
383
383
|
switch (e.toUpperCase().replace(/[-_]/g, "")) {
|
|
384
384
|
case "SHA512": return "SHA-512";
|
|
385
385
|
case "SHA384": return "SHA-384";
|
|
386
386
|
case "SHA256": return "SHA-256";
|
|
387
387
|
case "SHA1": return "SHA-1";
|
|
388
|
-
default: throw new
|
|
388
|
+
default: throw new N("unsupported-encryption", `Unsupported hashAlgorithm "${e}" (only SHA-1/256/384/512).`);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
if (e.cipherAlgorithm.toUpperCase() !== "AES") throw new
|
|
393
|
-
if (e.cipherChaining.toLowerCase() !== "chainingmodecbc") throw new
|
|
394
|
-
if (e.keyBits !== 128 && e.keyBits !== 192 && e.keyBits !== 256) throw new
|
|
391
|
+
function I(e) {
|
|
392
|
+
if (e.cipherAlgorithm.toUpperCase() !== "AES") throw new N("unsupported-encryption", `Unsupported cipherAlgorithm "${e.cipherAlgorithm}" (only AES).`);
|
|
393
|
+
if (e.cipherChaining.toLowerCase() !== "chainingmodecbc") throw new N("unsupported-encryption", `Unsupported cipherChaining "${e.cipherChaining}" (only ChainingModeCBC).`);
|
|
394
|
+
if (e.keyBits !== 128 && e.keyBits !== 192 && e.keyBits !== 256) throw new N("unsupported-encryption", `Unsupported keyBits ${e.keyBits} (only 128/192/256).`);
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function L(...e) {
|
|
397
397
|
let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
|
|
398
398
|
for (let t of e) n.set(t, r), r += t.length;
|
|
399
399
|
return n;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function R(e) {
|
|
402
402
|
let t = new Uint8Array(4);
|
|
403
403
|
return new DataView(t.buffer).setUint32(0, e >>> 0, !0), t;
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function he(e) {
|
|
406
406
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
407
407
|
for (let t = 0; t < e.length; t++) n.setUint16(t * 2, e.charCodeAt(t), !0);
|
|
408
408
|
return t;
|
|
409
409
|
}
|
|
410
|
-
async function
|
|
411
|
-
return new Uint8Array(await
|
|
410
|
+
async function z(e, t) {
|
|
411
|
+
return new Uint8Array(await P().digest(e, t));
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function ge(e, t) {
|
|
414
414
|
if (e.length > t) return e.slice(0, t);
|
|
415
415
|
let n = new Uint8Array(t);
|
|
416
|
-
return n.set(e), e.length < t && n.fill(
|
|
416
|
+
return n.set(e), e.length < t && n.fill(me, e.length), n;
|
|
417
417
|
}
|
|
418
|
-
async function
|
|
419
|
-
let i =
|
|
420
|
-
for (let e = 0; e < n; e++) a = await
|
|
421
|
-
return
|
|
418
|
+
async function B(e, t, n, r) {
|
|
419
|
+
let i = F(t.hashAlgorithm), a = await z(i, L(t.saltValue, he(e)));
|
|
420
|
+
for (let e = 0; e < n; e++) a = await z(i, L(R(e), a));
|
|
421
|
+
return ge(await z(i, L(a, r)), t.keyBits / 8);
|
|
422
422
|
}
|
|
423
|
-
async function
|
|
424
|
-
return
|
|
423
|
+
async function V(e, t, n) {
|
|
424
|
+
return ge(n ? await z(F(e.hashAlgorithm), L(t, n)) : t, e.blockSize);
|
|
425
425
|
}
|
|
426
|
-
async function
|
|
426
|
+
async function H(e, t, n) {
|
|
427
427
|
let r = t.length;
|
|
428
428
|
if (n.length === 0) return new Uint8Array();
|
|
429
|
-
if (n.length % r !== 0) throw new
|
|
430
|
-
let i = await
|
|
429
|
+
if (n.length % r !== 0) throw new N("corrupt", "ciphertext length is not a multiple of the block size");
|
|
430
|
+
let i = await P().importKey("raw", e, { name: "AES-CBC" }, !1, ["decrypt"]), a = await P().importKey("raw", e, { name: "AES-CBC" }, !1, ["encrypt"]), o = n.subarray(n.length - r), s = _e(new Uint8Array(r).fill(r), o), c = L(n, new Uint8Array(await P().encrypt({
|
|
431
431
|
name: "AES-CBC",
|
|
432
432
|
iv: new Uint8Array(r)
|
|
433
|
-
}, a, s)).subarray(0, r)), l = new Uint8Array(await
|
|
433
|
+
}, a, s)).subarray(0, r)), l = new Uint8Array(await P().decrypt({
|
|
434
434
|
name: "AES-CBC",
|
|
435
435
|
iv: t
|
|
436
436
|
}, i, c));
|
|
437
437
|
return l.length >= n.length ? l.subarray(0, n.length) : l;
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function _e(e, t) {
|
|
440
440
|
let n = new Uint8Array(e.length);
|
|
441
441
|
for (let r = 0; r < e.length; r++) n[r] = e[r] ^ t[r];
|
|
442
442
|
return n;
|
|
443
443
|
}
|
|
444
|
-
async function
|
|
445
|
-
|
|
446
|
-
let n =
|
|
447
|
-
return
|
|
444
|
+
async function ve(e, t) {
|
|
445
|
+
I(t);
|
|
446
|
+
let n = F(t.hashAlgorithm), r = await H(await B(e, t, t.spinCount, j.verifierHashInput), await V(t, t.saltValue, null), t.encryptedVerifierHashInput), i = await H(await B(e, t, t.spinCount, j.verifierHashValue), await V(t, t.saltValue, null), t.encryptedVerifierHashValue);
|
|
447
|
+
return ye((await z(n, r)).subarray(0, t.hashSize), i.subarray(0, t.hashSize));
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function ye(e, t) {
|
|
450
450
|
if (e.length !== t.length) return !1;
|
|
451
451
|
let n = 0;
|
|
452
452
|
for (let r = 0; r < e.length; r++) n |= e[r] ^ t[r];
|
|
453
453
|
return n === 0;
|
|
454
454
|
}
|
|
455
|
-
async function
|
|
456
|
-
return await
|
|
455
|
+
async function be(e, t) {
|
|
456
|
+
return await H(await B(e, t, t.spinCount, j.keyValue), await V(t, t.saltValue, null), t.encryptedKeyValue);
|
|
457
457
|
}
|
|
458
|
-
async function
|
|
459
|
-
if (
|
|
458
|
+
async function xe(e, t, n) {
|
|
459
|
+
if (I(t), e.length < 8) throw new N("corrupt", "EncryptedPackage is shorter than its size prefix");
|
|
460
460
|
let r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = Number(r.getBigUint64(0, !0)), a = e.subarray(8);
|
|
461
|
-
if (i > a.length) throw new
|
|
461
|
+
if (i > a.length) throw new N("corrupt", "EncryptedPackage size prefix exceeds the ciphertext");
|
|
462
462
|
let o = n.slice(0, t.keyBits / 8), s = new Uint8Array(i), c = 0, l = 0;
|
|
463
|
-
for (let e = 0; e < a.length; e +=
|
|
464
|
-
let n = a.subarray(e, e +
|
|
463
|
+
for (let e = 0; e < a.length; e += M) {
|
|
464
|
+
let n = a.subarray(e, e + M), r = await H(o, await V(t, t.saltValue, R(l)), n), u = Math.min(r.length, i - c);
|
|
465
465
|
if (s.set(r.subarray(0, u), c), c += u, l++, c >= i) break;
|
|
466
466
|
}
|
|
467
|
-
if (c !== i) throw new
|
|
467
|
+
if (c !== i) throw new N("corrupt", "decrypted output is shorter than the declared size");
|
|
468
468
|
return s;
|
|
469
469
|
}
|
|
470
|
-
async function
|
|
470
|
+
async function Se(e, t, n) {
|
|
471
471
|
let { keyData: r, passwordKeyEncryptor: i } = e;
|
|
472
|
-
if (
|
|
473
|
-
return
|
|
472
|
+
if (I(r), I(i), !await ve(n, i)) throw new N("invalid-password", "The supplied password is incorrect.");
|
|
473
|
+
return xe(t, r, await be(n, i));
|
|
474
474
|
}
|
|
475
475
|
//#endregion
|
|
476
476
|
//#region packages/core/src/crypto/decrypt-ooxml.ts
|
|
477
|
-
var
|
|
478
|
-
async function
|
|
479
|
-
let n =
|
|
477
|
+
var Ce = "EncryptionInfo", we = "EncryptedPackage";
|
|
478
|
+
async function Te(e, t) {
|
|
479
|
+
let n = S(e, Ce), r = S(e, we);
|
|
480
480
|
if (n === null || r === null) return {
|
|
481
481
|
ok: !1,
|
|
482
482
|
reason: "corrupt"
|
|
483
483
|
};
|
|
484
|
-
let i =
|
|
484
|
+
let i = fe(n);
|
|
485
485
|
if (i.kind !== "agile") return {
|
|
486
486
|
ok: !1,
|
|
487
487
|
reason: "unsupported-encryption"
|
|
@@ -489,10 +489,10 @@ async function Ce(e, t) {
|
|
|
489
489
|
try {
|
|
490
490
|
return {
|
|
491
491
|
ok: !0,
|
|
492
|
-
data: await
|
|
492
|
+
data: await Se(i.descriptor, r, t)
|
|
493
493
|
};
|
|
494
494
|
} catch (e) {
|
|
495
|
-
return e instanceof
|
|
495
|
+
return e instanceof N ? {
|
|
496
496
|
ok: !1,
|
|
497
497
|
reason: e.reason
|
|
498
498
|
} : {
|
|
@@ -503,7 +503,7 @@ async function Ce(e, t) {
|
|
|
503
503
|
}
|
|
504
504
|
//#endregion
|
|
505
505
|
//#region packages/core/src/errors/cfb-guard.ts
|
|
506
|
-
function
|
|
506
|
+
function Ee(e) {
|
|
507
507
|
let n = p(e instanceof Uint8Array ? e : new Uint8Array(e));
|
|
508
508
|
if (n !== null) switch (n) {
|
|
509
509
|
case "encrypted": throw new t("encrypted", "This file is password-protected (MS-OFFCRYPTO). Pass LoadOptions.password to decrypt it.");
|
|
@@ -512,12 +512,12 @@ function we(e) {
|
|
|
512
512
|
default: throw new t("not-ooxml", "This file is an OLE2/Compound File container of an unrecognised kind, not an OOXML (ZIP) document.");
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
async function
|
|
515
|
+
async function De(e, n) {
|
|
516
516
|
let r = e instanceof Uint8Array ? e : new Uint8Array(e), i = p(r);
|
|
517
517
|
if (i === null) return r;
|
|
518
518
|
if (i === "encrypted") {
|
|
519
519
|
if (n === void 0) throw new t("encrypted", "This file is password-protected (MS-OFFCRYPTO). Pass LoadOptions.password to decrypt it.");
|
|
520
|
-
let e = await
|
|
520
|
+
let e = await Te(r, n);
|
|
521
521
|
if (e.ok) return e.data;
|
|
522
522
|
switch (e.reason) {
|
|
523
523
|
case "invalid-password": throw new t("invalid-password", "The supplied password is incorrect.");
|
|
@@ -526,14 +526,151 @@ async function Te(e, n) {
|
|
|
526
526
|
default: throw e.reason, new t("not-ooxml", "This encrypted file could not be decrypted.");
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
return
|
|
529
|
+
return Ee(r), r;
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function Oe(e) {
|
|
532
532
|
return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength && e.buffer instanceof ArrayBuffer ? e.buffer : e.slice().buffer;
|
|
533
533
|
}
|
|
534
534
|
//#endregion
|
|
535
|
+
//#region packages/core/src/fonts/font-registry.ts
|
|
536
|
+
var U = /* @__PURE__ */ new Map();
|
|
537
|
+
function W(e, t, n) {
|
|
538
|
+
let r = U.get(e), i = r?.get(t);
|
|
539
|
+
if (i) return i.refs++, {
|
|
540
|
+
face: i.face,
|
|
541
|
+
isNew: !1
|
|
542
|
+
};
|
|
543
|
+
let a = n(), o = r ?? /* @__PURE__ */ new Map();
|
|
544
|
+
return o.set(t, {
|
|
545
|
+
face: a,
|
|
546
|
+
set: t,
|
|
547
|
+
refs: 1
|
|
548
|
+
}), U.set(e, o), {
|
|
549
|
+
face: a,
|
|
550
|
+
isNew: !0
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function G(e) {
|
|
554
|
+
let t = /* @__PURE__ */ new Set();
|
|
555
|
+
for (let n of e) if (!t.has(n)) {
|
|
556
|
+
t.add(n);
|
|
557
|
+
for (let [e, t] of U) {
|
|
558
|
+
let r = !1;
|
|
559
|
+
for (let [i, a] of t) if (a.face === n) {
|
|
560
|
+
if (r = !0, a.refs--, a.refs <= 0) {
|
|
561
|
+
try {
|
|
562
|
+
a.set.delete(n);
|
|
563
|
+
} catch {}
|
|
564
|
+
t.delete(i), t.size === 0 && U.delete(e);
|
|
565
|
+
}
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
if (r) break;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region packages/core/src/fonts/preload.ts
|
|
574
|
+
var ke = 15e3;
|
|
575
|
+
function K(e) {
|
|
576
|
+
return Promise.race([e, new Promise((e) => setTimeout(e, ke))]);
|
|
577
|
+
}
|
|
578
|
+
var q = /* @__PURE__ */ new Map();
|
|
579
|
+
function Ae(e) {
|
|
580
|
+
let t = [], n = /@font-face\s*\{([^}]*)\}/g, r;
|
|
581
|
+
for (; r = n.exec(e);) {
|
|
582
|
+
let e = r[1], n = (t) => e.match(RegExp(`(?:^|;|\\n)\\s*${t}\\s*:\\s*([^;]+)`, "i"))?.[1].trim(), i = n("font-family"), a = n("src");
|
|
583
|
+
if (!i || !a) continue;
|
|
584
|
+
let o = {}, s = n("font-style");
|
|
585
|
+
s && (o.style = s);
|
|
586
|
+
let c = n("font-weight");
|
|
587
|
+
c && (o.weight = c);
|
|
588
|
+
let l = n("font-stretch");
|
|
589
|
+
l && (o.stretch = l);
|
|
590
|
+
let u = n("unicode-range");
|
|
591
|
+
u && (o.unicodeRange = u), t.push({
|
|
592
|
+
family: i.replace(/^['"]|['"]$/g, ""),
|
|
593
|
+
src: a,
|
|
594
|
+
descriptors: o
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
return t;
|
|
598
|
+
}
|
|
599
|
+
function J() {
|
|
600
|
+
return typeof document < "u" && document && document.fonts ? document.fonts : typeof self < "u" && self && "fonts" in self ? self.fonts : null;
|
|
601
|
+
}
|
|
602
|
+
function je(e, t) {
|
|
603
|
+
let n = t.descriptors;
|
|
604
|
+
return [
|
|
605
|
+
"gfonts",
|
|
606
|
+
e,
|
|
607
|
+
t.family.toLowerCase(),
|
|
608
|
+
n.style ?? "",
|
|
609
|
+
n.weight ?? "",
|
|
610
|
+
n.stretch ?? "",
|
|
611
|
+
n.unicodeRange ?? "",
|
|
612
|
+
t.src
|
|
613
|
+
].join("|");
|
|
614
|
+
}
|
|
615
|
+
async function Me(e, t, n = J()) {
|
|
616
|
+
let r = n;
|
|
617
|
+
if (!r || typeof FontFace > "u" || typeof fetch > "u") return [];
|
|
618
|
+
let i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
|
|
619
|
+
for (let n of e) {
|
|
620
|
+
if (!n) continue;
|
|
621
|
+
let e = n.trim();
|
|
622
|
+
if (!e) continue;
|
|
623
|
+
let r = e.toLowerCase();
|
|
624
|
+
if (i.has(r)) continue;
|
|
625
|
+
i.add(r);
|
|
626
|
+
let c = t[r];
|
|
627
|
+
if (!c) continue;
|
|
628
|
+
o.add(c.url);
|
|
629
|
+
let l = (c.loadFamily ?? e).toLowerCase();
|
|
630
|
+
a.add(l);
|
|
631
|
+
let u = s.get(c.url);
|
|
632
|
+
u || (u = /* @__PURE__ */ new Set(), s.set(c.url, u)), u.add(l);
|
|
633
|
+
}
|
|
634
|
+
if (a.size === 0) return [];
|
|
635
|
+
let l = await K(Promise.all([...o].map(async (e) => {
|
|
636
|
+
let t = q.get(e);
|
|
637
|
+
if (t) return {
|
|
638
|
+
url: e,
|
|
639
|
+
rules: await t
|
|
640
|
+
};
|
|
641
|
+
let n = (async () => {
|
|
642
|
+
try {
|
|
643
|
+
let t = await fetch(e);
|
|
644
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
645
|
+
return Ae(await t.text());
|
|
646
|
+
} catch {
|
|
647
|
+
q.delete(e);
|
|
648
|
+
for (let t of s.get(e) ?? []) c.add(t);
|
|
649
|
+
return [];
|
|
650
|
+
}
|
|
651
|
+
})();
|
|
652
|
+
return q.set(e, n), {
|
|
653
|
+
url: e,
|
|
654
|
+
rules: await n
|
|
655
|
+
};
|
|
656
|
+
}))), u = [], d = [];
|
|
657
|
+
for (let e of Array.isArray(l) ? l : []) for (let t of e.rules) {
|
|
658
|
+
let { face: n, isNew: i } = W(je(e.url, t), r, () => {
|
|
659
|
+
let e = new FontFace(t.family, t.src, t.descriptors);
|
|
660
|
+
return r.add(e), e;
|
|
661
|
+
});
|
|
662
|
+
u.push(n), i && d.push(n);
|
|
663
|
+
}
|
|
664
|
+
return d.length > 0 && await K(Promise.allSettled(d.map((e) => e.load())).then((e) => (e.forEach((e, t) => {
|
|
665
|
+
e.status === "rejected" && c.add(d[t].family.replace(/['"]/g, "").toLowerCase());
|
|
666
|
+
}), r.ready))), c.size > 0 && console.warn(`[ooxml] failed to preload web font(s): ${[...c].join(", ")}; falling back to system fonts (text may shift or differ).`), u;
|
|
667
|
+
}
|
|
668
|
+
function Ne(e) {
|
|
669
|
+
G(e);
|
|
670
|
+
}
|
|
671
|
+
//#endregion
|
|
535
672
|
//#region packages/core/src/autoResize.ts
|
|
536
|
-
function
|
|
673
|
+
function Pe(e, t, n = {}) {
|
|
537
674
|
let r = n.pauseWhenHidden ?? !0, i = null, a = 0, o = 0, s = null, c = !1, l = !1, u = () => {
|
|
538
675
|
if (!l && !(r && typeof document < "u" && document.hidden)) {
|
|
539
676
|
if (s) {
|
|
@@ -570,11 +707,11 @@ function De(e, t, n = {}) {
|
|
|
570
707
|
}
|
|
571
708
|
//#endregion
|
|
572
709
|
//#region packages/core/src/worker/bridge.ts
|
|
573
|
-
function
|
|
710
|
+
function Y() {
|
|
574
711
|
let e = /* @__PURE__ */ Error("worker request aborted");
|
|
575
712
|
return e.name = "AbortError", e;
|
|
576
713
|
}
|
|
577
|
-
var
|
|
714
|
+
var Fe = class {
|
|
578
715
|
_worker;
|
|
579
716
|
_opts;
|
|
580
717
|
_pending = /* @__PURE__ */ new Map();
|
|
@@ -631,7 +768,7 @@ var Oe = class {
|
|
|
631
768
|
return;
|
|
632
769
|
}
|
|
633
770
|
if (a?.aborted) {
|
|
634
|
-
o("abort"), c(
|
|
771
|
+
o("abort"), c(Y());
|
|
635
772
|
return;
|
|
636
773
|
}
|
|
637
774
|
let l, u;
|
|
@@ -647,7 +784,7 @@ var Oe = class {
|
|
|
647
784
|
e && (this._pending.delete(r), e.onOrphanedResponse && this._orphaned.set(r, e.onOrphanedResponse), e.cleanup(), o("timeout"), e.reject(/* @__PURE__ */ Error(`worker request timed out after ${i}ms`)));
|
|
648
785
|
}, i)), a && (u = () => {
|
|
649
786
|
let e = this._pending.get(r);
|
|
650
|
-
e && (this._pending.delete(r), e.onOrphanedResponse && this._orphaned.set(r, e.onOrphanedResponse), e.cleanup(), o("abort"), e.reject(
|
|
787
|
+
e && (this._pending.delete(r), e.onOrphanedResponse && this._orphaned.set(r, e.onOrphanedResponse), e.cleanup(), o("abort"), e.reject(Y()));
|
|
651
788
|
}, a.addEventListener("abort", u));
|
|
652
789
|
try {
|
|
653
790
|
this._worker.postMessage(e(r), t);
|
|
@@ -688,7 +825,7 @@ var Oe = class {
|
|
|
688
825
|
};
|
|
689
826
|
//#endregion
|
|
690
827
|
//#region packages/core/src/worker/rejected-load.ts
|
|
691
|
-
function
|
|
828
|
+
function Ie(e, t) {
|
|
692
829
|
if (t) try {
|
|
693
830
|
t();
|
|
694
831
|
return;
|
|
@@ -699,10 +836,10 @@ function ke(e, t) {
|
|
|
699
836
|
}
|
|
700
837
|
//#endregion
|
|
701
838
|
//#region packages/core/src/worker/svg-decode-bridge.ts
|
|
702
|
-
function
|
|
839
|
+
function X(e) {
|
|
703
840
|
return typeof e == "number" && Number.isFinite(e) && e > 0 ? Math.ceil(e) : void 0;
|
|
704
841
|
}
|
|
705
|
-
function
|
|
842
|
+
function Z(e, t) {
|
|
706
843
|
if (!Number.isFinite(e) || !Number.isFinite(t) || !(e > 0) || !(t > 0)) throw Error(`invalid SVG raster size: ${e}x${t}`);
|
|
707
844
|
let i = Math.sqrt(n) / Math.sqrt(e) / Math.sqrt(t), a = Math.min(1, r / e, r / t, i);
|
|
708
845
|
return {
|
|
@@ -710,22 +847,22 @@ function q(e, t) {
|
|
|
710
847
|
height: Math.min(r, Math.max(1, Math.floor(t * a)))
|
|
711
848
|
};
|
|
712
849
|
}
|
|
713
|
-
function
|
|
850
|
+
function Le(e, t, i, a) {
|
|
714
851
|
let o = i === void 0 ? 0 : i / e, s = a === void 0 ? 0 : a / t, c = i === void 0 && a === void 0 ? 1 : Math.max(o, s), l = Math.min(r / e, r / t, Math.sqrt(n) / Math.sqrt(e) / Math.sqrt(t));
|
|
715
852
|
if (!Number.isFinite(c) || !(c > 0) || !Number.isFinite(l) || !(l > 0)) throw Error(`invalid SVG raster scale: ${Math.min(c, l)}`);
|
|
716
|
-
return l < c ?
|
|
853
|
+
return l < c ? Z(Math.max(1, Math.floor(e * l)), Math.max(1, Math.floor(t * l))) : i !== void 0 && o >= s ? Z(i, Math.max(1, Math.ceil(t * i / e))) : a === void 0 ? Z(Math.ceil(e), Math.ceil(t)) : Z(Math.max(1, Math.ceil(e * a / t)), a);
|
|
717
854
|
}
|
|
718
|
-
async function
|
|
855
|
+
async function Re(t, r = {}) {
|
|
719
856
|
if (typeof Image > "u") throw Error("SVG host decode requires HTMLImageElement");
|
|
720
857
|
let a = URL.createObjectURL(t);
|
|
721
858
|
try {
|
|
722
|
-
let t = new Image(), o =
|
|
859
|
+
let t = new Image(), o = X(r.targetWidthPx), s = X(r.targetHeightPx);
|
|
723
860
|
await new Promise((e, n) => {
|
|
724
861
|
t.onload = () => {
|
|
725
862
|
typeof t.decode == "function" ? t.decode().then(e).catch(e) : e();
|
|
726
863
|
}, t.onerror = () => n(/* @__PURE__ */ Error("SVG host decode failed")), t.src = a;
|
|
727
864
|
});
|
|
728
|
-
let c = Number.isFinite(t.naturalWidth) && t.naturalWidth > 0 && Number.isFinite(t.naturalHeight) && t.naturalHeight > 0, l =
|
|
865
|
+
let c = Number.isFinite(t.naturalWidth) && t.naturalWidth > 0 && Number.isFinite(t.naturalHeight) && t.naturalHeight > 0, l = Le(c ? t.naturalWidth : 300, c ? t.naturalHeight : 150, o, s);
|
|
729
866
|
t.width = l.width, t.height = l.height;
|
|
730
867
|
let u;
|
|
731
868
|
if (typeof OffscreenCanvas < "u") {
|
|
@@ -746,11 +883,11 @@ async function je(t, r = {}) {
|
|
|
746
883
|
URL.revokeObjectURL(a);
|
|
747
884
|
}
|
|
748
885
|
}
|
|
749
|
-
function
|
|
886
|
+
function ze(e) {
|
|
750
887
|
return !!e && typeof e == "object" && e.kind === "ooxmlDecodeSvg";
|
|
751
888
|
}
|
|
752
|
-
function
|
|
753
|
-
return
|
|
889
|
+
function Be(t, n) {
|
|
890
|
+
return ze(n) ? (Re(new Blob([n.bytes], { type: "image/svg+xml" }), n).then((r) => {
|
|
754
891
|
try {
|
|
755
892
|
t({
|
|
756
893
|
kind: "ooxmlSvgDecoded",
|
|
@@ -772,32 +909,32 @@ function Ne(t, n) {
|
|
|
772
909
|
}
|
|
773
910
|
//#endregion
|
|
774
911
|
//#region packages/core/src/interaction/zoom.ts
|
|
775
|
-
var
|
|
776
|
-
function
|
|
912
|
+
var Ve = 1.1, He = 10, Ue = 3, We = 1;
|
|
913
|
+
function Ge(e, t) {
|
|
777
914
|
let n;
|
|
778
915
|
switch (t) {
|
|
779
916
|
case 1:
|
|
780
|
-
n = e /
|
|
917
|
+
n = e / Ue;
|
|
781
918
|
break;
|
|
782
919
|
case 2:
|
|
783
|
-
n = e /
|
|
920
|
+
n = e / We;
|
|
784
921
|
break;
|
|
785
922
|
default:
|
|
786
|
-
n = e /
|
|
923
|
+
n = e / He;
|
|
787
924
|
break;
|
|
788
925
|
}
|
|
789
926
|
return Math.max(-1, Math.min(1, n));
|
|
790
927
|
}
|
|
791
|
-
function
|
|
792
|
-
return e *
|
|
928
|
+
function Ke(e, t, n = 0) {
|
|
929
|
+
return e * Ve ** +-Ge(t, n);
|
|
793
930
|
}
|
|
794
|
-
function
|
|
931
|
+
function qe(e, t, n, r, i) {
|
|
795
932
|
let a = n > 0 ? r / n : 1, o = (e + t) * a - t, s = i.maxScroll > 0 ? i.maxScroll : 0;
|
|
796
933
|
return o < 0 ? 0 : o > s ? s : o;
|
|
797
934
|
}
|
|
798
935
|
//#endregion
|
|
799
936
|
//#region packages/core/src/interaction/zoomable.ts
|
|
800
|
-
var
|
|
937
|
+
var Q = Object.freeze([
|
|
801
938
|
.25,
|
|
802
939
|
.33,
|
|
803
940
|
.5,
|
|
@@ -813,22 +950,22 @@ var J = Object.freeze([
|
|
|
813
950
|
2.5,
|
|
814
951
|
3,
|
|
815
952
|
4
|
|
816
|
-
]),
|
|
817
|
-
function
|
|
818
|
-
for (let t of
|
|
819
|
-
return
|
|
953
|
+
]), Je = .005;
|
|
954
|
+
function Ye(e) {
|
|
955
|
+
for (let t of Q) if (t > e + Je) return t;
|
|
956
|
+
return Q[Q.length - 1];
|
|
820
957
|
}
|
|
821
|
-
function
|
|
822
|
-
for (let t =
|
|
823
|
-
let n =
|
|
824
|
-
if (n < e -
|
|
958
|
+
function Xe(e, t = Q[0]) {
|
|
959
|
+
for (let t = Q.length - 1; t >= 0; t--) {
|
|
960
|
+
let n = Q[t];
|
|
961
|
+
if (n < e - Je) return n;
|
|
825
962
|
}
|
|
826
|
-
return Math.min(t,
|
|
963
|
+
return Math.min(t, Q[0]);
|
|
827
964
|
}
|
|
828
|
-
function
|
|
965
|
+
function Ze(e, t, n) {
|
|
829
966
|
return e < t ? t : e > n ? n : e;
|
|
830
967
|
}
|
|
831
|
-
function
|
|
968
|
+
function Qe(e, t) {
|
|
832
969
|
let { contentWidth: n, contentHeight: r, containerWidth: i, containerHeight: a } = e;
|
|
833
970
|
if (n <= 0 || i <= 0) return 0;
|
|
834
971
|
let o = i / n;
|
|
@@ -839,7 +976,7 @@ function We(e, t) {
|
|
|
839
976
|
}
|
|
840
977
|
//#endregion
|
|
841
978
|
//#region packages/core/src/search/text-index.ts
|
|
842
|
-
function
|
|
979
|
+
function $(e) {
|
|
843
980
|
let t = e.toLowerCase();
|
|
844
981
|
if (t.length === e.length) return t;
|
|
845
982
|
let n = "";
|
|
@@ -849,17 +986,17 @@ function X(e) {
|
|
|
849
986
|
}
|
|
850
987
|
return n;
|
|
851
988
|
}
|
|
852
|
-
function
|
|
989
|
+
function $e(e) {
|
|
853
990
|
let t = Array(e.length), n = 0, r = "";
|
|
854
991
|
for (let i = 0; i < e.length; i++) t[i] = n, r += e[i].text, n += e[i].text.length;
|
|
855
992
|
return {
|
|
856
993
|
text: r,
|
|
857
|
-
folded:
|
|
994
|
+
folded: $(r),
|
|
858
995
|
runStart: t,
|
|
859
996
|
runCount: e.length
|
|
860
997
|
};
|
|
861
998
|
}
|
|
862
|
-
function
|
|
999
|
+
function et(e, t) {
|
|
863
1000
|
let { runStart: n } = e, r = 0, i = n.length - 1;
|
|
864
1001
|
for (; r < i;) {
|
|
865
1002
|
let e = r + i + 1 >> 1;
|
|
@@ -867,8 +1004,8 @@ function Ke(e, t) {
|
|
|
867
1004
|
}
|
|
868
1005
|
return r;
|
|
869
1006
|
}
|
|
870
|
-
function
|
|
871
|
-
let { runStart: r, runCount: i, text: a } = e, o = [], s =
|
|
1007
|
+
function tt(e, t, n) {
|
|
1008
|
+
let { runStart: r, runCount: i, text: a } = e, o = [], s = et(e, t), c = t;
|
|
872
1009
|
for (; c < n && s < i;) {
|
|
873
1010
|
let e = s + 1 < i ? r[s + 1] : a.length, t = Math.min(n, e), l = c - r[s], u = t - r[s];
|
|
874
1011
|
u > l && o.push({
|
|
@@ -879,31 +1016,31 @@ function qe(e, t, n) {
|
|
|
879
1016
|
}
|
|
880
1017
|
return o;
|
|
881
1018
|
}
|
|
882
|
-
function
|
|
1019
|
+
function nt(e, t, n = {}) {
|
|
883
1020
|
if (t.length === 0) return [];
|
|
884
|
-
let r = n.caseSensitive ?? !1, i = r ? e.text : e.folded, a = r ? t :
|
|
1021
|
+
let r = n.caseSensitive ?? !1, i = r ? e.text : e.folded, a = r ? t : $(t), o = [], s = 0, c = 0;
|
|
885
1022
|
for (;;) {
|
|
886
1023
|
let t = i.indexOf(a, s);
|
|
887
1024
|
if (t === -1) break;
|
|
888
1025
|
o.push({
|
|
889
1026
|
matchIndex: c,
|
|
890
|
-
slices:
|
|
1027
|
+
slices: tt(e, t, t + a.length)
|
|
891
1028
|
}), c++, s = t + a.length;
|
|
892
1029
|
}
|
|
893
1030
|
return o;
|
|
894
1031
|
}
|
|
895
1032
|
//#endregion
|
|
896
1033
|
//#region packages/core/src/search/find-cursor.ts
|
|
897
|
-
function
|
|
1034
|
+
function rt(e, t) {
|
|
898
1035
|
return t <= 0 ? -1 : e < 0 ? 0 : (e + 1) % t;
|
|
899
1036
|
}
|
|
900
|
-
function
|
|
1037
|
+
function it(e, t) {
|
|
901
1038
|
return t <= 0 ? -1 : e < 0 ? t - 1 : (e - 1 + t) % t;
|
|
902
1039
|
}
|
|
903
1040
|
//#endregion
|
|
904
1041
|
//#region packages/core/src/internal/chart-context.ts
|
|
905
|
-
var
|
|
906
|
-
function
|
|
1042
|
+
var at = 65536;
|
|
1043
|
+
function ot(e, t) {
|
|
907
1044
|
let n = Math.min(e.length, t);
|
|
908
1045
|
if (n > 0 && n < e.length) {
|
|
909
1046
|
let t = e.charCodeAt(n - 1), r = e.charCodeAt(n);
|
|
@@ -911,19 +1048,19 @@ function Ze(e, t) {
|
|
|
911
1048
|
}
|
|
912
1049
|
return e.slice(0, n);
|
|
913
1050
|
}
|
|
914
|
-
function
|
|
1051
|
+
function st(e) {
|
|
915
1052
|
let t = e ?? 16384;
|
|
916
1053
|
if (!Number.isFinite(t) || t < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
917
|
-
return Math.min(
|
|
1054
|
+
return Math.min(at, Math.floor(t));
|
|
918
1055
|
}
|
|
919
|
-
function
|
|
920
|
-
let n =
|
|
1056
|
+
function ct(e, t) {
|
|
1057
|
+
let n = st(t), r = [], i = 0, a = !1, o = !1, s = (e, t) => {
|
|
921
1058
|
if (t && o) {
|
|
922
1059
|
if (i >= n) return a = !0, !1;
|
|
923
1060
|
r.push("\n"), i++;
|
|
924
1061
|
}
|
|
925
1062
|
o = !0;
|
|
926
|
-
let s =
|
|
1063
|
+
let s = ot(e, Math.max(0, n - i));
|
|
927
1064
|
return r.push(s), i += s.length, s.length < e.length ? (a = !0, !1) : !0;
|
|
928
1065
|
};
|
|
929
1066
|
if (!s(`Chart type: ${e.chartType}`, !0) || e.title !== null && !s(`Title: ${e.title}`, !0)) return {
|
|
@@ -965,13 +1102,13 @@ function $e(e, t) {
|
|
|
965
1102
|
}
|
|
966
1103
|
//#endregion
|
|
967
1104
|
//#region packages/core/src/internal/canvas-viewer-mechanics.ts
|
|
968
|
-
var
|
|
969
|
-
function
|
|
1105
|
+
var lt = 65536, ut = 1024;
|
|
1106
|
+
function dt(e, t, n) {
|
|
970
1107
|
let r = e ?? t;
|
|
971
1108
|
if (!Number.isFinite(r) || r < 0) throw RangeError(`${n} must be a finite non-negative number.`);
|
|
972
1109
|
return Math.min(t, Math.floor(r));
|
|
973
1110
|
}
|
|
974
|
-
function
|
|
1111
|
+
function ft(e, t) {
|
|
975
1112
|
let n = Math.min(e.length, t);
|
|
976
1113
|
if (n > 0 && n < e.length) {
|
|
977
1114
|
let t = e.charCodeAt(n - 1), r = e.charCodeAt(n);
|
|
@@ -979,7 +1116,7 @@ function nt(e, t) {
|
|
|
979
1116
|
}
|
|
980
1117
|
return e.slice(0, n);
|
|
981
1118
|
}
|
|
982
|
-
function*
|
|
1119
|
+
function* pt(e) {
|
|
983
1120
|
let t = e.firstChild ?? e.childNodes[0] ?? null;
|
|
984
1121
|
for (; t;) {
|
|
985
1122
|
if (t.nodeType === 3 && (yield t), t.firstChild) {
|
|
@@ -991,13 +1128,13 @@ function* rt(e) {
|
|
|
991
1128
|
t = t.nextSibling;
|
|
992
1129
|
}
|
|
993
1130
|
}
|
|
994
|
-
function
|
|
1131
|
+
function mt(e, t, n, r, i) {
|
|
995
1132
|
for (let a of r) {
|
|
996
1133
|
let r = !1;
|
|
997
1134
|
try {
|
|
998
1135
|
r = a.intersectsNode(n);
|
|
999
1136
|
} catch {}
|
|
1000
|
-
if (r) for (let r of
|
|
1137
|
+
if (r) for (let r of pt(n)) {
|
|
1001
1138
|
let n = r.data, o, s;
|
|
1002
1139
|
if (a.startContainer === r) o = a.startOffset;
|
|
1003
1140
|
else try {
|
|
@@ -1020,7 +1157,7 @@ function it(e, t, n, r, i) {
|
|
|
1020
1157
|
}
|
|
1021
1158
|
return t;
|
|
1022
1159
|
}
|
|
1023
|
-
function
|
|
1160
|
+
function ht(e, t, n, r = {}) {
|
|
1024
1161
|
if (!t || t.isCollapsed || t.rangeCount === 0) return null;
|
|
1025
1162
|
let i = [...e.matches?.("[data-ooxml-selection-surface]") ? [e] : [], ...e.querySelectorAll("[data-ooxml-selection-surface]")];
|
|
1026
1163
|
if (i.length === 0) return null;
|
|
@@ -1030,7 +1167,7 @@ function at(e, t, n, r = {}) {
|
|
|
1030
1167
|
if (!e.contains(r.startContainer) || !e.contains(r.endContainer) || !a(r.startContainer) || !a(r.endContainer)) return null;
|
|
1031
1168
|
o.push(r);
|
|
1032
1169
|
}
|
|
1033
|
-
let s =
|
|
1170
|
+
let s = dt(r.maxChars, lt, "maxTextCharacters"), c = dt(r.maxLocators, ut, "maxRunLocators"), l = [], u = !1, d = s + 2, f = [], p = 0;
|
|
1034
1171
|
for (let t of e.querySelectorAll("[data-ooxml-selection-run]")) {
|
|
1035
1172
|
if (!o.some((e) => {
|
|
1036
1173
|
try {
|
|
@@ -1040,12 +1177,12 @@ function at(e, t, n, r = {}) {
|
|
|
1040
1177
|
}
|
|
1041
1178
|
})) continue;
|
|
1042
1179
|
let e = n(t);
|
|
1043
|
-
if (e !== null && (l.length >= c ? u = !0 : l.push(structuredClone(e)), p < d && (p =
|
|
1180
|
+
if (e !== null && (l.length >= c ? u = !0 : l.push(structuredClone(e)), p < d && (p = mt(f, p, t, o, d)), u && p >= d)) break;
|
|
1044
1181
|
}
|
|
1045
1182
|
if (l.length === 0 && !u) return null;
|
|
1046
1183
|
let m = f.join("");
|
|
1047
1184
|
if (m.length === 0) return null;
|
|
1048
|
-
let h =
|
|
1185
|
+
let h = ft(m, s), g = m.length > s;
|
|
1049
1186
|
return {
|
|
1050
1187
|
text: h,
|
|
1051
1188
|
locators: l,
|
|
@@ -1056,7 +1193,7 @@ function at(e, t, n, r = {}) {
|
|
|
1056
1193
|
maxLocators: c
|
|
1057
1194
|
};
|
|
1058
1195
|
}
|
|
1059
|
-
var
|
|
1196
|
+
var gt = class {
|
|
1060
1197
|
wrapper;
|
|
1061
1198
|
originalParent;
|
|
1062
1199
|
originalNextSibling;
|
|
@@ -1077,31 +1214,31 @@ var ot = class {
|
|
|
1077
1214
|
(this.options.restoreMode ?? "display") === "style-and-bitmap" ? (this.originalStyle === null ? this.canvas.removeAttribute("style") : this.canvas.setAttribute("style", this.originalStyle), this.canvas.width = this.originalWidth, this.canvas.height = this.originalHeight) : this.canvas.style.display = this.originalDisplay, this.wrapper.remove();
|
|
1078
1215
|
}
|
|
1079
1216
|
}
|
|
1080
|
-
},
|
|
1081
|
-
function
|
|
1217
|
+
}, _t = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;user-select:text;-webkit-user-select:text;", vt = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;", yt = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;";
|
|
1218
|
+
function bt(e, t) {
|
|
1082
1219
|
if (!t) return null;
|
|
1083
1220
|
let n = (e.ownerDocument ?? document).createElement("div");
|
|
1084
|
-
return n.style.cssText =
|
|
1221
|
+
return n.style.cssText = yt, e.appendChild(n), n;
|
|
1085
1222
|
}
|
|
1086
|
-
function
|
|
1223
|
+
function xt(e, t) {
|
|
1087
1224
|
if (!e || (e.innerHTML = "", !t || !Number.isFinite(t.x) || !Number.isFinite(t.y) || !Number.isFinite(t.width) || !Number.isFinite(t.height) || t.width <= 0 || t.height <= 0)) return;
|
|
1088
1225
|
let n = (e.ownerDocument ?? document).createElement("div"), r = Number.isFinite(t.rotation) ? t.rotation ?? 0 : 0;
|
|
1089
1226
|
n.style.cssText = `position:absolute;left:${t.x * 100}%;top:${t.y * 100}%;width:${t.width * 100}%;height:${t.height * 100}%;box-sizing:border-box;border:2px solid #1a73e8;background:color-mix(in srgb, #1a73e8 6%, transparent);transform:rotate(${r}deg);transform-origin:center;pointer-events:none;`, e.appendChild(n);
|
|
1090
1227
|
}
|
|
1091
|
-
var
|
|
1228
|
+
var St = class {
|
|
1092
1229
|
textLayer;
|
|
1093
1230
|
highlightLayer;
|
|
1094
1231
|
elementLayer;
|
|
1095
1232
|
constructor(e, t, n = !1) {
|
|
1096
1233
|
let r = e.ownerDocument ?? document;
|
|
1097
|
-
this.textLayer = t ? r.createElement("div") : null, this.textLayer && (this.textLayer.style.cssText =
|
|
1234
|
+
this.textLayer = t ? r.createElement("div") : null, this.textLayer && (this.textLayer.style.cssText = _t, e.appendChild(this.textLayer)), this.highlightLayer = r.createElement("div"), this.highlightLayer.style.cssText = vt, e.appendChild(this.highlightLayer), this.elementLayer = bt(e, n);
|
|
1098
1235
|
}
|
|
1099
1236
|
};
|
|
1100
|
-
function
|
|
1237
|
+
function Ct(e, t, n) {
|
|
1101
1238
|
if (n && t !== void 0 && t !== n.mode) throw Error(`${e}: opts.mode='${t}' conflicts with the borrowed engine's mode='${n.mode}'. Omit opts.mode when borrowing an engine — the engine owns its render mode.`);
|
|
1102
1239
|
return n?.mode ?? t ?? "main";
|
|
1103
1240
|
}
|
|
1104
|
-
var
|
|
1241
|
+
var wt = class {
|
|
1105
1242
|
generation = 0;
|
|
1106
1243
|
resource;
|
|
1107
1244
|
ownsResource;
|
|
@@ -1153,7 +1290,7 @@ var pt = class {
|
|
|
1153
1290
|
e.destroy();
|
|
1154
1291
|
} catch {}
|
|
1155
1292
|
}
|
|
1156
|
-
},
|
|
1293
|
+
}, Tt = class {
|
|
1157
1294
|
generation = 0;
|
|
1158
1295
|
destroyed = !1;
|
|
1159
1296
|
bitmapContext;
|
|
@@ -1192,7 +1329,7 @@ var pt = class {
|
|
|
1192
1329
|
destroy() {
|
|
1193
1330
|
this.destroyed || (this.destroyed = !0, this.generation++);
|
|
1194
1331
|
}
|
|
1195
|
-
},
|
|
1332
|
+
}, Et = class {
|
|
1196
1333
|
closed = !1;
|
|
1197
1334
|
handled = /* @__PURE__ */ new WeakSet();
|
|
1198
1335
|
backgroundLifecycleOwners = 0;
|
|
@@ -1235,4 +1372,4 @@ var pt = class {
|
|
|
1235
1372
|
}
|
|
1236
1373
|
};
|
|
1237
1374
|
//#endregion
|
|
1238
|
-
export {
|
|
1375
|
+
export { G as A, Ie as C, Me as D, J as E, De as M, Oe as N, Ne as O, Be as S, Pe as T, Qe as _, wt as a, qe as b, xt as c, ct as d, rt as f, Ze as g, nt as h, Tt as i, W as j, K as k, Ct as l, $e as m, St as n, bt as o, it as p, Et as r, ht as s, gt as t, at as u, Ye as v, Fe as w, Ke as x, Xe as y };
|