@sheetxl/sdk 0.8.0-beta.6 → 0.8.0-beta.9
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/browser/cjs/BAtZ8a7H7zsRvWqe.cjs +90 -0
- package/browser/cjs/CQPMWBxBUmkORmxV.cjs +1 -0
- package/browser/cjs/{CMrcyRRWS0gjwpr2.cjs → CvQ1tIq7wZ7HIGPq.cjs} +1 -1
- package/browser/cjs/CwvGOe42j8KpAF0v.cjs +1 -0
- package/browser/cjs/{KMBs7XyoINajcR-L.cjs → DCOqoH-T4Ux_1dQj.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/{7_M82_Otn5kHQ0qd.mjs → BdHD3v-u8irI1XhZ.mjs} +2 -2
- package/browser/esm/{DRsp6JAObqXYGvhz.mjs → C8btlUQcQwNyzHY3.mjs} +2 -2
- package/browser/esm/{CfoNUsKHL7SzfO8c.mjs → CF3VfWX7bJu8kO_Z.mjs} +2 -2
- package/browser/esm/{DBjWjEUK9qrHG5VD.mjs → D3ll0ybMQOP4uPyW.mjs} +1 -1
- package/browser/esm/{CEk-nufZXNFx5jDl.mjs → DXmFrSnh3xSBfoD7.mjs} +9233 -8740
- package/browser/esm/{iLZfKwfSx5bQgCOp.mjs → DzgIc4oyekwA-fkl.mjs} +96 -96
- package/browser/esm/{J1egfq2ajlXPw3Ki.mjs → Iw280tlGmTHKDqzd.mjs} +2 -2
- package/browser/esm/index.mjs +920 -593
- package/node/esm/{BMtLBfP7JzIsG9_G.mjs → B_FOXd5PSfVcg0ED.mjs} +1 -1
- package/node/esm/{CynxiHhVY9UGe_h6.mjs → BzgnLKSVfN-mrMSW.mjs} +1 -1
- package/node/esm/{DYRjFZ75QYgmgEWF.mjs → D4PsEIRHxAahp5kn.mjs} +1 -1
- package/node/esm/{DpyQm1VnGyCmRRKJ.mjs → dinqlP3jU8gDOjso.mjs} +1 -1
- package/node/esm/index.mjs +10520 -9698
- package/package.json +7 -6
- package/resources/locales/de/model.msg.json +19 -0
- package/resources/locales/en/model.msg.json +25 -0
- package/types/scripting-api.json +7337 -6890
- package/types/scripting-enums.json +101 -21
- package/types/scripting.d.ts +1961 -466
- package/types/src/calculation/Calculation.d.ts +37 -45
- package/types/src/calculation/grid/CalcGrid.d.ts +12 -4
- package/types/src/calculation/grid/CalcGridBackend.d.ts +0 -6
- package/types/src/calculation/grid/CalcGridProxy.d.ts +1 -6
- package/types/src/calculation/grid/ICalcGrid.d.ts +12 -4
- package/types/src/calculation/grid/_CalcRequest.d.ts +4 -9
- package/types/src/cell/ICell.d.ts +3 -3
- package/types/src/cell/ICellHeader.d.ts +24 -2
- package/types/src/cellRange/ICellRange.d.ts +67 -3
- package/types/src/cellRange/ICellRanges.d.ts +12 -12
- package/types/src/chart/Chart.d.ts +2 -13
- package/types/src/condition/AnchoredConditional.d.ts +2 -0
- package/types/src/condition/BuiltInOperators/ColorOperator.d.ts +4 -0
- package/types/src/condition/BuiltInOperators/IconOperator.d.ts +4 -0
- package/types/src/condition/ICondition.d.ts +36 -28
- package/types/src/condition/_ConditionUtils.d.ts +32 -8
- package/types/src/fill/IFill.d.ts +46 -11
- package/types/src/fill/IStroke.d.ts +34 -42
- package/types/src/filter/IFilter.d.ts +51 -6
- package/types/src/hyperlink/IHyperlink.d.ts +8 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/movable/AbstractMovableContent.d.ts +6 -0
- package/types/src/movable/FormControl.d.ts +206 -0
- package/types/src/movable/IFormControl.d.ts +424 -0
- package/types/src/movable/IMovable.d.ts +37 -8
- package/types/src/movable/IMovableCollection.d.ts +19 -1
- package/types/src/movable/Movable.d.ts +20 -0
- package/types/src/movable/MovableContentRegistry.d.ts +64 -0
- package/types/src/movable/_BuiltInContents.d.ts +2 -0
- package/types/src/movable/_DrawnBounds.d.ts +33 -0
- package/types/src/movable/_RotatedFrame.d.ts +20 -0
- package/types/src/movable/index.d.ts +6 -4
- package/types/src/numFmt/BuiltInFormats.d.ts +5 -0
- package/types/src/numFmt/_NumFmtUtils.d.ts +0 -1
- package/types/src/numFmt/vendor/numfmt/_sheetxl.d.ts +6 -0
- package/types/src/outline/IOutline.d.ts +186 -0
- package/types/src/outline/Outline.d.ts +157 -0
- package/types/src/outline/index.d.ts +2 -0
- package/types/src/shape/GeometryPreset.d.ts +197 -0
- package/types/src/shape/IGeometry.d.ts +398 -0
- package/types/src/shape/IShape.d.ts +177 -204
- package/types/src/shape/Shape.d.ts +39 -13
- package/types/src/shape/ShapeStyleUtils.d.ts +48 -0
- package/types/src/shape/_Geometry.d.ts +14 -0
- package/types/src/shape/_GeometryLoader.d.ts +21 -0
- package/types/src/shape/_builtIn/_BuiltInChunks.d.ts +10 -0
- package/types/src/shape/_builtIn/_BuiltInDef.d.ts +9 -0
- package/types/src/shape/_builtIn/arrows.d.ts +6 -0
- package/types/src/shape/_builtIn/basic.d.ts +6 -0
- package/types/src/shape/_builtIn/callouts.d.ts +6 -0
- package/types/src/shape/_builtIn/flowchart.d.ts +6 -0
- package/types/src/shape/_builtIn/lines.d.ts +6 -0
- package/types/src/shape/_builtIn/math.d.ts +6 -0
- package/types/src/shape/_builtIn/other.d.ts +6 -0
- package/types/src/shape/_builtIn/rectangles.d.ts +6 -0
- package/types/src/shape/_builtIn/starsBanners.d.ts +6 -0
- package/types/src/shape/geometry/_strokeEnds.d.ts +7 -0
- package/types/src/shape/geometry/format.d.ts +3 -0
- package/types/src/shape/geometry/geometry.d.ts +84 -0
- package/types/src/shape/geometry/guides.d.ts +54 -0
- package/types/src/shape/geometry/handles.d.ts +14 -0
- package/types/src/shape/geometry/index.d.ts +7 -0
- package/types/src/shape/geometry/lineEnds.d.ts +53 -0
- package/types/src/shape/geometry/paths.d.ts +35 -0
- package/types/src/shape/geometry/segments.d.ts +114 -0
- package/types/src/shape/index.d.ts +2 -0
- package/types/src/sheet/ISheet.d.ts +10 -45
- package/types/src/sheet/Sheet.d.ts +19 -5
- package/types/src/sheet/SheetRange.d.ts +16 -1
- package/types/src/sheet/_SheetUtils.d.ts +10 -2
- package/types/src/sheetHeader/ISheetHeader.d.ts +4 -0
- package/types/src/sheetHeader/SheetCellHeader.d.ts +4 -0
- package/types/src/sheetHeader/SheetHeader.d.ts +10 -0
- package/types/src/sheetHeader/_HeaderUtils.d.ts +3 -1
- package/types/src/sheetView/ISheetView.d.ts +17 -0
- package/types/src/sheetView/SheetView.d.ts +4 -0
- package/types/src/table/AnchoredTable.d.ts +7 -2
- package/types/src/text/IText.d.ts +182 -0
- package/types/src/text/ITextFrame.d.ts +85 -0
- package/types/src/text/TextRotation.d.ts +3 -3
- package/types/src/text/TextStacked.d.ts +2 -2
- package/types/src/theme/ITheme.d.ts +24 -0
- package/types/src/workbook/Workbook.d.ts +16 -5
- package/browser/cjs/-wfVn4ubg563jjqj.cjs +0 -93
- package/browser/cjs/B2GVAGA-CBeu_7U4.cjs +0 -1
- package/browser/cjs/DFKGFVvoELb8_p_B.cjs +0 -1
- package/types/src/movable/Control.d.ts +0 -55
- package/types/src/movable/IControl.d.ts +0 -86
- package/types/src/movable/IGroup.d.ts +0 -30
- package/types/src/shape/_ShapeXml.d.ts +0 -28
package/browser/esm/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.9
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { n as e } from "./
|
|
8
|
-
import { $t as t, A as n, An as r, At as i, Bt as a, C as o, Cn as s, Ct as c, D as l, Dn as u, Dt as d, E as f, En as p, Et as m, F as h, Fn as g, Ft as _, Gt as v, Ht as y, I as b, In as x, It as S, Jt as C, Kt as ee, L as te,
|
|
9
|
-
import { FormulaError as
|
|
10
|
-
import { BufferUtils as
|
|
7
|
+
import { n as e } from "./D3ll0ybMQOP4uPyW.mjs";
|
|
8
|
+
import { $t as t, A as n, An as r, At as i, Bt as a, C as o, Cn as s, Ct as c, D as l, Dn as u, Dt as d, E as f, En as p, Et as m, F as h, Fn as g, Ft as _, Gt as v, Ht as y, I as b, In as x, It as S, Jt as C, Kt as ee, L as te, Ln as ne, Lt as re, M as ie, Mn as w, Mt as ae, N as oe, Nn as se, Nt as ce, O as le, On as ue, Ot as de, P as fe, Pn as pe, Pt as me, Qt as he, R as ge, Rn as _e, Rt as ve, S as ye, Sn as be, St as xe, T as Se, Tn as Ce, Tt as we, Ut as Te, Vt as Ee, Wt as De, Xt as Oe, Yt as ke, Zt as T, _ as Ae, _n as je, _t as Me, a as E, an as Ne, at as Pe, b as Fe, bn as Ie, bt as Le, c as Re, cn as D, ct as ze, d as Be, dn as Ve, en as He, f as Ue, fn as O, g as We, gn as Ge, gt as Ke, h as qe, hn as Je, ht as Ye, i as Xe, in as Ze, it as Qe, j as $e, jn as k, jt as et, k as tt, kn as nt, kt as rt, l as it, ln as at, lt as ot, m as st, mn as ct, mt as lt, n as ut, nn as dt, o as A, on as ft, ot as pt, p as mt, pn as ht, qt as gt, r as _t, rn as vt, rt as yt, s as bt, sn as j, st as xt, t as St, tn as Ct, u as M, un as wt, v as Tt, vn as Et, vt as Dt, w as Ot, wn as kt, wt as At, x as jt, xn as Mt, xt as Nt, y as Pt, yn as Ft, z as It, zt as Lt } from "./DXmFrSnh3xSBfoD7.mjs";
|
|
9
|
+
import { FormulaError as Rt, ScalarType as N } from "@sheetxl/primitives";
|
|
10
|
+
import { BufferUtils as zt, CommonUtils as P, CoordUtils as F, DOMUtils as Bt, DefaultLanguagePackService as Vt, ExpectedError as I, InvalidPasswordError as Ht, MimeType as Ut, Notifier as Wt, NullNotAllowedError as Gt, OutOfBoundsError as L, PasswordRequiredError as Kt, ProtectedError as R, UndoManager as qt, messageKey as z, t as B } from "@sheetxl/utils";
|
|
11
11
|
export * from "@sheetxl/primitives";
|
|
12
12
|
export * from "@sheetxl/utils";
|
|
13
|
-
var
|
|
13
|
+
var Jt, Yt = class extends qt {
|
|
14
14
|
constructor(e, t = 50) {
|
|
15
15
|
super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
|
|
16
16
|
}
|
|
@@ -103,9 +103,9 @@ var Wt, Gt = class extends Ut {
|
|
|
103
103
|
close() {
|
|
104
104
|
this._removeListener?.();
|
|
105
105
|
}
|
|
106
|
-
},
|
|
106
|
+
}, Xt = class {
|
|
107
107
|
constructor(e, t) {
|
|
108
|
-
this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new
|
|
108
|
+
this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new x(this);
|
|
109
109
|
let n = this;
|
|
110
110
|
this._removeStoreListener = e.addListener({
|
|
111
111
|
onCommitEnd() {
|
|
@@ -141,10 +141,10 @@ var Wt, Gt = class extends Ut {
|
|
|
141
141
|
this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
|
|
145
|
-
var
|
|
144
|
+
Jt ||= {};
|
|
145
|
+
var V = class e {
|
|
146
146
|
constructor(t, n = {}) {
|
|
147
|
-
this._password = null, this._emitter = new
|
|
147
|
+
this._password = null, this._emitter = new x(this), this._path = t ?? null, this._name = n.name ?? null, this._format = n.format ?? null, this._size = n.size ?? null, this._lastModified = n.lastModified ?? null, this._canWrite = n.canWrite ?? e._defaultCanWrite(this._path), this._encryption = n.encryption ?? null;
|
|
148
148
|
}
|
|
149
149
|
static _defaultCanWrite(e) {
|
|
150
150
|
return !!e && !/^(https?:|data:|blob:)/i.test(e);
|
|
@@ -155,7 +155,7 @@ var U = class e {
|
|
|
155
155
|
getName() {
|
|
156
156
|
if (this._name !== null && this._name !== void 0) return this._name;
|
|
157
157
|
let e = this._cleanPath();
|
|
158
|
-
return e &&
|
|
158
|
+
return e && r(e) || null;
|
|
159
159
|
}
|
|
160
160
|
getPath() {
|
|
161
161
|
return this._path;
|
|
@@ -216,59 +216,59 @@ var U = class e {
|
|
|
216
216
|
];
|
|
217
217
|
return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
|
|
218
218
|
}
|
|
219
|
-
},
|
|
219
|
+
}, H = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new Set(), Qt = (e) => H.get(e) ?? null, $t = () => Array.from(Zt, (e) => e.getOrigin()), en = class e {
|
|
220
220
|
constructor(t) {
|
|
221
|
-
this._released = !1, e._assertFree(t), this._emitter = new
|
|
221
|
+
this._released = !1, e._assertFree(t), this._emitter = new x(this), this._origin = t, H.set(t, this), Zt.add(this);
|
|
222
222
|
}
|
|
223
223
|
getOrigin() {
|
|
224
224
|
return this._origin;
|
|
225
225
|
}
|
|
226
226
|
setOrigin(t) {
|
|
227
|
-
t !== this._origin && (e._assertFree(t), this._released || (
|
|
227
|
+
t !== this._origin && (e._assertFree(t), this._released || (H.delete(this._origin), H.set(t, this)), this._origin = t, this._emitter.notify("onOriginChange"));
|
|
228
228
|
}
|
|
229
229
|
release() {
|
|
230
|
-
this._released || (this._released = !0,
|
|
230
|
+
this._released || (this._released = !0, H.get(this._origin) === this && H.delete(this._origin), Zt.delete(this));
|
|
231
231
|
}
|
|
232
232
|
addListeners(e, t) {
|
|
233
233
|
return this._emitter.addListeners(e, t);
|
|
234
234
|
}
|
|
235
235
|
static _assertFree(e) {
|
|
236
|
-
if (
|
|
236
|
+
if (H.has(e)) throw Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
|
|
237
237
|
}
|
|
238
|
-
},
|
|
238
|
+
}, tn = class {
|
|
239
239
|
constructor() {
|
|
240
240
|
this._defaultStringSourceType = "filepath";
|
|
241
241
|
}
|
|
242
242
|
async read(e) {
|
|
243
243
|
let t = e.options ?? {}, n = e.source;
|
|
244
244
|
if (typeof n == "function" && (n = n()), n && typeof n == "object" && typeof n.then == "function" && (n = await Promise.resolve(n)), n == null && (n = await this.resolveSource(e), n == null)) return null;
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
let
|
|
248
|
-
if (!
|
|
249
|
-
let
|
|
250
|
-
if (
|
|
245
|
+
let i = n, a = await this.fileFromHandle(n);
|
|
246
|
+
a && (n = a);
|
|
247
|
+
let o = t.format, s = this._detectSourceType(n);
|
|
248
|
+
if (!s) throw Error("Unable to detect source type from provided input.");
|
|
249
|
+
let c, l, u = !1;
|
|
250
|
+
if (s === "filepath") {
|
|
251
251
|
let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
|
|
252
|
-
n = await this.filePathToFile(e),
|
|
252
|
+
n = await this.filePathToFile(e), s = "file", u = !0;
|
|
253
253
|
}
|
|
254
|
-
switch (
|
|
254
|
+
switch (s) {
|
|
255
255
|
case "file": {
|
|
256
|
-
let e = n,
|
|
257
|
-
|
|
258
|
-
format:
|
|
259
|
-
ext: k(
|
|
260
|
-
name:
|
|
261
|
-
absolutePath:
|
|
256
|
+
let e = n, i = e?.name, s = i ? `${r(i)}` : "";
|
|
257
|
+
c = await e.arrayBuffer(), l = {
|
|
258
|
+
format: o,
|
|
259
|
+
ext: k(i),
|
|
260
|
+
name: s,
|
|
261
|
+
absolutePath: i,
|
|
262
262
|
size: e.size,
|
|
263
263
|
lastModified: e.lastModified,
|
|
264
|
-
canWrite: !t.asCopy && (!!
|
|
264
|
+
canWrite: !t.asCopy && (!!a || u && this._canWriteLocalPath())
|
|
265
265
|
};
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
268
268
|
case "blob": {
|
|
269
269
|
let e = n;
|
|
270
|
-
|
|
271
|
-
format:
|
|
270
|
+
c = await e.arrayBuffer(), l = {
|
|
271
|
+
format: o,
|
|
272
272
|
size: e.size
|
|
273
273
|
};
|
|
274
274
|
break;
|
|
@@ -280,44 +280,44 @@ var U = class e {
|
|
|
280
280
|
let [, t] = n.split(",");
|
|
281
281
|
e = t;
|
|
282
282
|
} else e = n;
|
|
283
|
-
|
|
284
|
-
format:
|
|
283
|
+
c = zt.base64ToArrayBuffer(e), l = {
|
|
284
|
+
format: o,
|
|
285
285
|
size: e.length
|
|
286
286
|
};
|
|
287
287
|
break;
|
|
288
288
|
}
|
|
289
289
|
case "fetch": {
|
|
290
|
-
let e, t,
|
|
290
|
+
let e, t, i;
|
|
291
291
|
if (typeof n == "string") e = n;
|
|
292
292
|
else {
|
|
293
293
|
if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
|
|
294
294
|
{
|
|
295
|
-
let
|
|
296
|
-
e =
|
|
295
|
+
let r = n;
|
|
296
|
+
e = r.input, t = r.init, i = r.timeout;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
let
|
|
299
|
+
let a = i || 3e4, s = new AbortController(), u = setTimeout(() => s.abort(), a), d = typeof e == "string" ? e : e.toString(), f = k(d);
|
|
300
300
|
try {
|
|
301
301
|
let n = await fetch(e, {
|
|
302
302
|
...t,
|
|
303
|
-
signal:
|
|
303
|
+
signal: s.signal
|
|
304
304
|
});
|
|
305
|
-
if (clearTimeout(
|
|
306
|
-
let
|
|
307
|
-
if (!
|
|
308
|
-
|
|
309
|
-
format:
|
|
310
|
-
ext:
|
|
311
|
-
name:
|
|
312
|
-
absolutePath:
|
|
305
|
+
if (clearTimeout(u), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
|
|
306
|
+
let i = await n.arrayBuffer();
|
|
307
|
+
if (!i) throw Error(`Unable to fetched content: ${d}`);
|
|
308
|
+
c = i, l = {
|
|
309
|
+
format: o,
|
|
310
|
+
ext: f,
|
|
311
|
+
name: r(d, !0),
|
|
312
|
+
absolutePath: d
|
|
313
313
|
};
|
|
314
314
|
} catch (e) {
|
|
315
|
-
throw clearTimeout(
|
|
315
|
+
throw clearTimeout(u), e.name === "AbortError" ? Error(`Fetch timeout after ${a}ms: ${d}`) : e;
|
|
316
316
|
}
|
|
317
317
|
break;
|
|
318
318
|
}
|
|
319
319
|
case "buffer":
|
|
320
|
-
|
|
320
|
+
c = n, l = { format: o };
|
|
321
321
|
break;
|
|
322
322
|
case "stream": {
|
|
323
323
|
let e = n.getReader(), t = [], r = 0;
|
|
@@ -330,25 +330,25 @@ var U = class e {
|
|
|
330
330
|
} finally {
|
|
331
331
|
e.releaseLock();
|
|
332
332
|
}
|
|
333
|
-
let i = new ArrayBuffer(r),
|
|
334
|
-
for (let e of t)
|
|
335
|
-
|
|
333
|
+
let i = new ArrayBuffer(r), a = new Uint8Array(i), s = 0;
|
|
334
|
+
for (let e of t) a.set(e, s), s += e.length;
|
|
335
|
+
c = i, l = { format: o };
|
|
336
336
|
break;
|
|
337
337
|
}
|
|
338
|
-
default: throw Error(`Unsupported source type: ${
|
|
338
|
+
default: throw Error(`Unsupported source type: ${s}`);
|
|
339
339
|
}
|
|
340
|
-
|
|
341
|
-
let
|
|
342
|
-
sourceType:
|
|
343
|
-
...
|
|
340
|
+
l.canWrite && await this.findOpenOrigin(i, l) && (l.canWrite = !1);
|
|
341
|
+
let d = await e.decode(c, {
|
|
342
|
+
sourceType: s,
|
|
343
|
+
...l
|
|
344
344
|
});
|
|
345
|
-
return
|
|
345
|
+
return d ? (await this.onWorkbookRead(d, i), d) : null;
|
|
346
346
|
}
|
|
347
347
|
async findOpenOrigin(e, t) {
|
|
348
348
|
return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
|
|
349
349
|
}
|
|
350
350
|
findOpenPath(e, t) {
|
|
351
|
-
return
|
|
351
|
+
return $t().find((n) => {
|
|
352
352
|
if (n === t || !n.canWrite()) return !1;
|
|
353
353
|
let r = n.getPath();
|
|
354
354
|
return !!r && this.isSamePath(r, e);
|
|
@@ -379,21 +379,21 @@ var U = class e {
|
|
|
379
379
|
}
|
|
380
380
|
if (typeof File < "u" && e instanceof File) return "file";
|
|
381
381
|
if (typeof Blob < "u" && e instanceof Blob) return "blob";
|
|
382
|
-
let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r =
|
|
382
|
+
let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = zt.isNodeBuffer(e);
|
|
383
383
|
return t || n || r ? "buffer" : typeof ReadableStream < "u" && e instanceof ReadableStream || Object.prototype.toString.call(e) === "[object ReadableStream]" || e && typeof e.getReader == "function" && e.locked !== void 0 ? "stream" : null;
|
|
384
384
|
}
|
|
385
|
-
},
|
|
385
|
+
}, nn = class extends tn {
|
|
386
386
|
constructor(e, t) {
|
|
387
387
|
super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
|
|
388
388
|
}
|
|
389
389
|
async fileFromHandle(e) {
|
|
390
|
-
return
|
|
390
|
+
return an(e) ? e.getFile() : null;
|
|
391
391
|
}
|
|
392
392
|
async resolveSource() {
|
|
393
393
|
let e = await this._getReadFormats?.() ?? [];
|
|
394
394
|
if (typeof globalThis.showOpenFilePicker == "function") try {
|
|
395
395
|
let t = function(e) {
|
|
396
|
-
let t =
|
|
396
|
+
let t = rn(e);
|
|
397
397
|
if (t.length <= 1) return t;
|
|
398
398
|
let n = /* @__PURE__ */ new Set(), r = {};
|
|
399
399
|
for (let e of t) for (let [t, i] of Object.entries(e.accept)) for (let e of i) n.has(e) || (n.add(e), (r[t] ??= []).push(e));
|
|
@@ -408,13 +408,13 @@ var U = class e {
|
|
|
408
408
|
throw e;
|
|
409
409
|
}
|
|
410
410
|
let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
|
|
411
|
-
return
|
|
411
|
+
return Bt.openFileDialog(t);
|
|
412
412
|
}
|
|
413
413
|
async findOpenOrigin(e) {
|
|
414
|
-
return
|
|
414
|
+
return an(e) ? this._findOpenHandle(e) : null;
|
|
415
415
|
}
|
|
416
416
|
async _findOpenHandle(e, t) {
|
|
417
|
-
for (let n of
|
|
417
|
+
for (let n of $t()) {
|
|
418
418
|
if (n === t || !n.canWrite()) continue;
|
|
419
419
|
let r = this._handleCache.get(n);
|
|
420
420
|
if (r && typeof r.isSameEntry == "function" && await r.isSameEntry(e)) return n;
|
|
@@ -422,7 +422,7 @@ var U = class e {
|
|
|
422
422
|
return null;
|
|
423
423
|
}
|
|
424
424
|
async onWorkbookRead(e, t) {
|
|
425
|
-
if (!
|
|
425
|
+
if (!an(t)) return;
|
|
426
426
|
let n = e.getOrigin?.();
|
|
427
427
|
n?.canWrite() && this._handleCache.set(n, t);
|
|
428
428
|
}
|
|
@@ -449,18 +449,18 @@ var U = class e {
|
|
|
449
449
|
if (!a) {
|
|
450
450
|
c = await globalThis.showSaveFilePicker({
|
|
451
451
|
suggestedName: n,
|
|
452
|
-
types:
|
|
452
|
+
types: rn(o)
|
|
453
453
|
});
|
|
454
454
|
let t = await this._findOpenHandle(c, e.workbook?.getOrigin?.());
|
|
455
|
-
if (t) throw new
|
|
455
|
+
if (t) throw new I(B("error.io.openElsewhere", { name: t.getName() ?? c.name ?? "" }));
|
|
456
456
|
}
|
|
457
|
-
let s =
|
|
457
|
+
let s = sn(c.name ?? n), l = o.find((e) => e.exts.some((e) => e.toLowerCase() === s)) ?? r, u = a ? t : new V(c.name ?? n, {
|
|
458
458
|
format: l.key,
|
|
459
459
|
canWrite: !0
|
|
460
460
|
}), d = await i(l.key, u);
|
|
461
461
|
if (!d) return null;
|
|
462
|
-
let f = new Blob([
|
|
463
|
-
if (await p.write(f), await p.close(), this._handleCache.set(u, c), u instanceof
|
|
462
|
+
let f = new Blob([on(d)], { type: l.mimeType || "application/octet-stream" }), p = await c.createWritable();
|
|
463
|
+
if (await p.write(f), await p.close(), this._handleCache.set(u, c), u instanceof V) {
|
|
464
464
|
let e = await Promise.resolve(c.getFile?.()).then((e) => e?.lastModified ?? null, () => null);
|
|
465
465
|
u.update({
|
|
466
466
|
size: f.size,
|
|
@@ -470,21 +470,21 @@ var U = class e {
|
|
|
470
470
|
return u;
|
|
471
471
|
} catch (e) {
|
|
472
472
|
if (e?.name === "AbortError") return null;
|
|
473
|
-
if (e instanceof
|
|
473
|
+
if (e instanceof I) throw e;
|
|
474
474
|
}
|
|
475
|
-
let l = t.getPath(), u = l ? l.split(/[/\\]/).pop() : null, d = u && r.exts.some((e) => e.toLowerCase() ===
|
|
475
|
+
let l = t.getPath(), u = l ? l.split(/[/\\]/).pop() : null, d = u && r.exts.some((e) => e.toLowerCase() === sn(u)) ? u : n, f = l !== d || t.canWrite() ? new V(d, {
|
|
476
476
|
format: r.key,
|
|
477
477
|
canWrite: !1
|
|
478
478
|
}) : t, p = await i(r.key, f);
|
|
479
479
|
if (!p) return null;
|
|
480
|
-
let m = new Blob([
|
|
480
|
+
let m = new Blob([on(p)], { type: r.mimeType || "application/octet-stream" });
|
|
481
481
|
return function(e, t) {
|
|
482
482
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
483
483
|
r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
484
|
-
}(m, d), f instanceof
|
|
484
|
+
}(m, d), f instanceof V && f.update({ size: m.size }), f;
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
|
-
function
|
|
487
|
+
function rn(e) {
|
|
488
488
|
return e.map((e) => {
|
|
489
489
|
let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
|
|
490
490
|
return {
|
|
@@ -493,21 +493,21 @@ function Qt(e) {
|
|
|
493
493
|
};
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function an(e) {
|
|
497
497
|
return !!e && e.kind === "file" && typeof e.getFile == "function";
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function on(e) {
|
|
500
500
|
if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
|
|
501
501
|
let t = new ArrayBuffer(e.byteLength);
|
|
502
502
|
return new Uint8Array(t).set(new Uint8Array(e)), t;
|
|
503
503
|
}
|
|
504
504
|
return e;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function sn(e) {
|
|
507
507
|
let t = e.lastIndexOf(".");
|
|
508
508
|
return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
|
|
509
509
|
}
|
|
510
|
-
var
|
|
510
|
+
var cn = class {
|
|
511
511
|
constructor(e) {
|
|
512
512
|
this._private = { input: e }, typeof e == "string" ? this._private.name = e : Object.assign(this._private, e);
|
|
513
513
|
}
|
|
@@ -529,11 +529,11 @@ var tn = class {
|
|
|
529
529
|
get isIFont() {
|
|
530
530
|
return !0;
|
|
531
531
|
}
|
|
532
|
-
},
|
|
533
|
-
findBestMatch: () =>
|
|
534
|
-
getFontList: () =>
|
|
535
|
-
setFontList: () =>
|
|
536
|
-
}),
|
|
532
|
+
}, ln = e({
|
|
533
|
+
findBestMatch: () => _n,
|
|
534
|
+
getFontList: () => hn,
|
|
535
|
+
setFontList: () => mn
|
|
536
|
+
}), un = [
|
|
537
537
|
"Arial",
|
|
538
538
|
"Arial Black",
|
|
539
539
|
"Brush Script MT",
|
|
@@ -549,55 +549,55 @@ var tn = class {
|
|
|
549
549
|
"Times New Roman",
|
|
550
550
|
"Trebuchet MS",
|
|
551
551
|
"Verdana"
|
|
552
|
-
],
|
|
553
|
-
|
|
554
|
-
var
|
|
555
|
-
|
|
556
|
-
var
|
|
557
|
-
function
|
|
558
|
-
e ||
|
|
552
|
+
], U = /* @__PURE__ */ new Map();
|
|
553
|
+
U.set(O.GenericName.Serif, ["Tahoma"]), U.set(O.GenericName.SanSerif, ["Calibri"]), U.set(O.GenericName.MonoSpace, ["Courier New"]), U.set(O.GenericName.Cursive, ["Comic Sans MS"]), U.set(O.GenericName.Fantasy, ["Luminari"]), U.set(O.GenericName.UISystem, ["Arial"]), U.set(O.GenericName.UISerif, ["Tahoma"]), U.set(O.GenericName.UISanSerif, ["Arial"]), U.set(O.GenericName.UIMonoSpace, ["Courier New"]), U.set(O.GenericName.UIRounded, ["Arial"]), U.set(O.GenericName.Math, []), U.set(O.GenericName.Emoji, []), U.set(O.GenericName.Fangsong, []);
|
|
554
|
+
var dn = /* @__PURE__ */ new Map(), fn = [];
|
|
555
|
+
mn(un);
|
|
556
|
+
var pn = eval;
|
|
557
|
+
function mn(e) {
|
|
558
|
+
e || mn(un);
|
|
559
559
|
let t = [];
|
|
560
560
|
for (let n = 0; n < e.length; n++) {
|
|
561
561
|
let r = e[n];
|
|
562
|
-
typeof r == "string" && (r = new
|
|
562
|
+
typeof r == "string" && (r = new cn(r));
|
|
563
563
|
let i = !0;
|
|
564
564
|
try {
|
|
565
|
-
i =
|
|
565
|
+
i = pn(`document.fonts.check('12px ${r.getFamily()}')`);
|
|
566
566
|
} catch {}
|
|
567
567
|
let a = {
|
|
568
568
|
fontRef: r,
|
|
569
569
|
loaded: i
|
|
570
570
|
};
|
|
571
|
-
t.push(a),
|
|
571
|
+
t.push(a), dn.set(r.getFamily(), a);
|
|
572
572
|
}
|
|
573
|
-
|
|
573
|
+
fn = Object.freeze(t);
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
return
|
|
575
|
+
function hn() {
|
|
576
|
+
return fn;
|
|
577
577
|
}
|
|
578
|
-
var
|
|
579
|
-
function
|
|
580
|
-
let n =
|
|
578
|
+
var gn = /* @__PURE__ */ new Map();
|
|
579
|
+
function _n(e, t) {
|
|
580
|
+
let n = gn.get(e);
|
|
581
581
|
if (n) return n.fontRef === null ? null : n;
|
|
582
582
|
let r = [e];
|
|
583
583
|
t?.fallbacks && (r = r.concat(t.fallbacks));
|
|
584
584
|
let i = null;
|
|
585
585
|
for (let e = 0; !i && e < r.length; e++) {
|
|
586
586
|
let t = r[e];
|
|
587
|
-
if (i =
|
|
588
|
-
let e =
|
|
589
|
-
if (e) for (let t = 0; !i && t < e.length; t++) i =
|
|
587
|
+
if (i = dn.get(t), !i) {
|
|
588
|
+
let e = U.get(t);
|
|
589
|
+
if (e) for (let t = 0; !i && t < e.length; t++) i = dn.get(e[t]);
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
return i ?
|
|
592
|
+
return i ? gn.set(e, i) : gn.set(e, {
|
|
593
593
|
fontRef: null,
|
|
594
594
|
loaded: !1
|
|
595
595
|
}), i;
|
|
596
596
|
}
|
|
597
|
-
var
|
|
598
|
-
DefaultFontSizes: () =>
|
|
599
|
-
findNextFontSize: () =>
|
|
600
|
-
}),
|
|
597
|
+
var vn, yn, W, bn, xn = e({
|
|
598
|
+
DefaultFontSizes: () => Sn,
|
|
599
|
+
findNextFontSize: () => Cn
|
|
600
|
+
}), Sn = Object.freeze([
|
|
601
601
|
8,
|
|
602
602
|
9,
|
|
603
603
|
10,
|
|
@@ -616,42 +616,48 @@ var fn, pn, J, mn, hn = e({
|
|
|
616
616
|
48,
|
|
617
617
|
72
|
|
618
618
|
]);
|
|
619
|
-
function
|
|
619
|
+
function Cn(e, t = !0, n = Sn) {
|
|
620
620
|
if (!n || n.length === 0) return e;
|
|
621
621
|
if (e === void 0) return n[0];
|
|
622
622
|
if (t && e >= n[n.length - 1] || !t && e <= n[0]) return e;
|
|
623
|
-
let r =
|
|
623
|
+
let r = P.findEqualOrGreater(n, e);
|
|
624
624
|
return t ? (n[r] === e && (r += 1), n[r] || --r, n[r]) : (--r, n[r]);
|
|
625
625
|
}
|
|
626
|
-
(
|
|
626
|
+
(vn ||= {}).SortOn = {
|
|
627
627
|
Value: "value",
|
|
628
628
|
FillColor: "fillColor",
|
|
629
629
|
FontColor: "fontColor",
|
|
630
630
|
Icon: "icon"
|
|
631
|
-
}, (
|
|
631
|
+
}, (W = yn ||= {}).LineEndType = {
|
|
632
|
+
None: "none",
|
|
633
|
+
Triangle: "triangle",
|
|
634
|
+
Stealth: "stealth",
|
|
635
|
+
Diamond: "diamond",
|
|
636
|
+
Oval: "oval",
|
|
637
|
+
Arrow: "arrow"
|
|
638
|
+
}, W.LineEndSize = {
|
|
639
|
+
Small: "sm",
|
|
640
|
+
Medium: "med",
|
|
641
|
+
Large: "lg"
|
|
642
|
+
}, W.Compound = {
|
|
632
643
|
Single: "sng",
|
|
633
644
|
Double: "dbl",
|
|
634
645
|
ThickThin: "thickThin",
|
|
635
646
|
ThinThick: "thinThick",
|
|
636
647
|
Triple: "tri"
|
|
637
|
-
},
|
|
648
|
+
}, W.Align = {
|
|
638
649
|
Center: "ctr",
|
|
639
650
|
Inset: "in",
|
|
640
651
|
Outset: "outset"
|
|
641
|
-
},
|
|
652
|
+
}, W.LineCap = {
|
|
642
653
|
Butt: "butt",
|
|
643
654
|
Round: "round",
|
|
644
655
|
Square: "square"
|
|
645
|
-
},
|
|
656
|
+
}, W.LineJoin = {
|
|
646
657
|
Bevel: "bevel",
|
|
647
658
|
Miter: "miter",
|
|
648
659
|
Round: "round"
|
|
649
|
-
},
|
|
650
|
-
Single: "none",
|
|
651
|
-
Double: "double",
|
|
652
|
-
ThickThin: "thickThin",
|
|
653
|
-
ThinThick: "thinThick"
|
|
654
|
-
}, J.StrokeStyle = {
|
|
660
|
+
}, W.StrokeStyle = {
|
|
655
661
|
None: "none",
|
|
656
662
|
Dashed: "dashed",
|
|
657
663
|
Dotted: "dotted",
|
|
@@ -663,7 +669,7 @@ function _n(e, t = !0, n = gn) {
|
|
|
663
669
|
SysDashDot: "sysDashDot",
|
|
664
670
|
SysDashDotDot: "sysDashDotDot",
|
|
665
671
|
SysDot: "sysDot"
|
|
666
|
-
}, (
|
|
672
|
+
}, (bn ||= {}).Type = {
|
|
667
673
|
OuterShadow: "outerShadow",
|
|
668
674
|
InnerShadow: "innerShadow",
|
|
669
675
|
PresetShadow: "presetShadow",
|
|
@@ -671,53 +677,53 @@ function _n(e, t = !0, n = gn) {
|
|
|
671
677
|
SoftEdge: "softEdge",
|
|
672
678
|
Reflection: "reflection"
|
|
673
679
|
};
|
|
674
|
-
var
|
|
675
|
-
[
|
|
676
|
-
[
|
|
677
|
-
[
|
|
678
|
-
[
|
|
679
|
-
[
|
|
680
|
-
[
|
|
681
|
-
[
|
|
682
|
-
[
|
|
683
|
-
[
|
|
684
|
-
[
|
|
685
|
-
[
|
|
686
|
-
[
|
|
687
|
-
[
|
|
688
|
-
[
|
|
689
|
-
[
|
|
690
|
-
[
|
|
691
|
-
[
|
|
692
|
-
[
|
|
693
|
-
[
|
|
694
|
-
[
|
|
695
|
-
[
|
|
696
|
-
},
|
|
697
|
-
function
|
|
698
|
-
let t =
|
|
680
|
+
var G = Oe.BuiltInName, wn = {
|
|
681
|
+
[G.Normal]: z("style.builtin.normal"),
|
|
682
|
+
[G.Comma]: z("style.builtin.comma"),
|
|
683
|
+
[G.Currency]: z("style.builtin.currency"),
|
|
684
|
+
[G.Percent]: z("style.builtin.percent"),
|
|
685
|
+
[G.Comma0]: z("style.builtin.comma0"),
|
|
686
|
+
[G.Currency0]: z("style.builtin.currency0"),
|
|
687
|
+
[G.Hyperlink]: z("style.builtin.hyperlink"),
|
|
688
|
+
[G.FollowedHyperlink]: z("style.builtin.followedHyperlink"),
|
|
689
|
+
[G.Note]: z("style.builtin.note"),
|
|
690
|
+
[G.WarningText]: z("style.builtin.warningText"),
|
|
691
|
+
[G.Title]: z("style.builtin.title"),
|
|
692
|
+
[G.Input]: z("style.builtin.input"),
|
|
693
|
+
[G.Output]: z("style.builtin.output"),
|
|
694
|
+
[G.Calculation]: z("style.builtin.calculation"),
|
|
695
|
+
[G.CheckCell]: z("style.builtin.checkCell"),
|
|
696
|
+
[G.LinkedCell]: z("style.builtin.linkedCell"),
|
|
697
|
+
[G.Total]: z("style.builtin.total"),
|
|
698
|
+
[G.Good]: z("style.builtin.good"),
|
|
699
|
+
[G.Bad]: z("style.builtin.bad"),
|
|
700
|
+
[G.Neutral]: z("style.builtin.neutral"),
|
|
701
|
+
[G.ExplanatoryText]: z("style.builtin.explanatoryText")
|
|
702
|
+
}, Tn = z("style.builtin.heading"), En = z("style.builtin.accent"), Dn = z("style.builtin.accentTint"), On = /^Heading ([1-4])$/, kn = /^Accent([1-6])$/, An = /^(20|40|60)% - Accent([1-6])$/;
|
|
703
|
+
function jn(e) {
|
|
704
|
+
let t = wn[e];
|
|
699
705
|
if (t) return { key: t };
|
|
700
|
-
let n =
|
|
706
|
+
let n = On.exec(e);
|
|
701
707
|
return n ? {
|
|
702
|
-
key:
|
|
708
|
+
key: Tn,
|
|
703
709
|
params: { n: +n[1] }
|
|
704
|
-
} : (n =
|
|
705
|
-
key:
|
|
710
|
+
} : (n = kn.exec(e), n ? {
|
|
711
|
+
key: En,
|
|
706
712
|
params: { n: +n[1] }
|
|
707
|
-
} : (n =
|
|
708
|
-
key:
|
|
713
|
+
} : (n = An.exec(e), n ? {
|
|
714
|
+
key: Dn,
|
|
709
715
|
params: {
|
|
710
716
|
pct: +n[1],
|
|
711
717
|
n: +n[2]
|
|
712
718
|
}
|
|
713
719
|
} : null));
|
|
714
720
|
}
|
|
715
|
-
var
|
|
721
|
+
var Mn, Nn, Pn, Fn, In = (e, t, n, r, i) => {
|
|
716
722
|
let a = JSON.parse(JSON.stringify(e.definition));
|
|
717
723
|
a.adjs ||= [];
|
|
718
724
|
let o = "", s = 0, c = 0;
|
|
719
|
-
t > 0 ? (c = t, s = 100 - t, o =
|
|
720
|
-
let l = new
|
|
725
|
+
t > 0 ? (c = t, s = 100 - t, o = B("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = B("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [He.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [He.AdjustmentType.LumOff]: c });
|
|
726
|
+
let l = new he({
|
|
721
727
|
val: a.val,
|
|
722
728
|
adjs: a.adjs
|
|
723
729
|
}, n), u = l.toString();
|
|
@@ -728,14 +734,14 @@ var En, Dn, On, kn, An = (e, t, n, r, i) => {
|
|
|
728
734
|
definition: a
|
|
729
735
|
};
|
|
730
736
|
};
|
|
731
|
-
function
|
|
737
|
+
function Ln(e, t, n, r) {
|
|
732
738
|
let i = [];
|
|
733
739
|
for (let a = 0; a < e.length; a++) {
|
|
734
740
|
let o = [];
|
|
735
741
|
i.push(o);
|
|
736
742
|
let s = (i) => {
|
|
737
|
-
for (let s = 0; s < i.length; s++) o.push(
|
|
738
|
-
}, c = new
|
|
743
|
+
for (let s = 0; s < i.length; s++) o.push(In(e[a], i[s], t, n, r));
|
|
744
|
+
}, c = new he({
|
|
739
745
|
val: e[a].definition.val,
|
|
740
746
|
adjs: e[a].definition.adjs
|
|
741
747
|
}, t).toHSLA().lum;
|
|
@@ -773,26 +779,26 @@ function jn(e, t, n, r) {
|
|
|
773
779
|
}
|
|
774
780
|
return i;
|
|
775
781
|
}
|
|
776
|
-
(
|
|
777
|
-
var
|
|
778
|
-
function
|
|
779
|
-
if (!
|
|
780
|
-
let e = import("./
|
|
782
|
+
(Mn ||= {}).buildPalette = Ln, Nn ||= {}, Pn ||= {}, Fn ||= {};
|
|
783
|
+
var K, q = null;
|
|
784
|
+
function Rn() {
|
|
785
|
+
if (!q) {
|
|
786
|
+
let e = import("./CF3VfWX7bJu8kO_Z.mjs").then(({ initializeFunctions: e }) => {
|
|
781
787
|
let t = e(() => null);
|
|
782
788
|
return Object.freeze(Array.from(t.keys()));
|
|
783
789
|
});
|
|
784
790
|
e.catch(() => {
|
|
785
|
-
|
|
786
|
-
}),
|
|
791
|
+
q = null;
|
|
792
|
+
}), q = e;
|
|
787
793
|
}
|
|
788
|
-
return
|
|
794
|
+
return q;
|
|
789
795
|
}
|
|
790
|
-
function
|
|
796
|
+
function zn(e) {
|
|
791
797
|
let t = e.trim();
|
|
792
798
|
if (!t) return;
|
|
793
799
|
let n;
|
|
794
800
|
try {
|
|
795
|
-
let e =
|
|
801
|
+
let e = Dt.shared().tokenize(t, !1);
|
|
796
802
|
if (e.errors.length > 0) return;
|
|
797
803
|
n = e.tokens;
|
|
798
804
|
} catch {
|
|
@@ -810,33 +816,359 @@ function Nn(e) {
|
|
|
810
816
|
case "NumberToken":
|
|
811
817
|
case "ScientificDigit":
|
|
812
818
|
case "DigitToken": {
|
|
813
|
-
let e =
|
|
819
|
+
let e = Ke(o).value;
|
|
814
820
|
return r === 0 ? e : r * e;
|
|
815
821
|
}
|
|
816
|
-
case "StringToken": return r === 0 ?
|
|
817
|
-
case "BooleanToken": return r === 0 ?
|
|
822
|
+
case "StringToken": return r === 0 ? Me(o).value : void 0;
|
|
823
|
+
case "BooleanToken": return r === 0 ? lt(o).value : void 0;
|
|
818
824
|
case "LiteralError":
|
|
819
|
-
case "RefError": return r === 0 ?
|
|
825
|
+
case "RefError": return r === 0 ? Ye(o).value : void 0;
|
|
820
826
|
default: return;
|
|
821
827
|
}
|
|
822
828
|
} catch {
|
|
823
829
|
return;
|
|
824
830
|
}
|
|
825
831
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
832
|
+
(K ||= {}).Type = {
|
|
833
|
+
Shape: "shape",
|
|
834
|
+
Connector: "connector",
|
|
835
|
+
Group: "group",
|
|
836
|
+
Picture: "picture"
|
|
837
|
+
};
|
|
838
|
+
var Bn, J, Vn = Object.freeze({
|
|
839
|
+
AccentBorderCallout1: "accentBorderCallout1",
|
|
840
|
+
AccentBorderCallout2: "accentBorderCallout2",
|
|
841
|
+
AccentBorderCallout3: "accentBorderCallout3",
|
|
842
|
+
AccentCallout1: "accentCallout1",
|
|
843
|
+
AccentCallout2: "accentCallout2",
|
|
844
|
+
AccentCallout3: "accentCallout3",
|
|
845
|
+
ActionButtonBackPrevious: "actionButtonBackPrevious",
|
|
846
|
+
ActionButtonBeginning: "actionButtonBeginning",
|
|
847
|
+
ActionButtonBlank: "actionButtonBlank",
|
|
848
|
+
ActionButtonDocument: "actionButtonDocument",
|
|
849
|
+
ActionButtonEnd: "actionButtonEnd",
|
|
850
|
+
ActionButtonForwardNext: "actionButtonForwardNext",
|
|
851
|
+
ActionButtonHelp: "actionButtonHelp",
|
|
852
|
+
ActionButtonHome: "actionButtonHome",
|
|
853
|
+
ActionButtonInformation: "actionButtonInformation",
|
|
854
|
+
ActionButtonMovie: "actionButtonMovie",
|
|
855
|
+
ActionButtonReturn: "actionButtonReturn",
|
|
856
|
+
ActionButtonSound: "actionButtonSound",
|
|
857
|
+
Arc: "arc",
|
|
858
|
+
BentArrow: "bentArrow",
|
|
859
|
+
BentConnector2: "bentConnector2",
|
|
860
|
+
BentConnector3: "bentConnector3",
|
|
861
|
+
BentConnector4: "bentConnector4",
|
|
862
|
+
BentConnector5: "bentConnector5",
|
|
863
|
+
BentUpArrow: "bentUpArrow",
|
|
864
|
+
Bevel: "bevel",
|
|
865
|
+
BlockArc: "blockArc",
|
|
866
|
+
BorderCallout1: "borderCallout1",
|
|
867
|
+
BorderCallout2: "borderCallout2",
|
|
868
|
+
BorderCallout3: "borderCallout3",
|
|
869
|
+
BracePair: "bracePair",
|
|
870
|
+
BracketPair: "bracketPair",
|
|
871
|
+
Callout1: "callout1",
|
|
872
|
+
Callout2: "callout2",
|
|
873
|
+
Callout3: "callout3",
|
|
874
|
+
Can: "can",
|
|
875
|
+
ChartPlus: "chartPlus",
|
|
876
|
+
ChartStar: "chartStar",
|
|
877
|
+
ChartX: "chartX",
|
|
878
|
+
Chevron: "chevron",
|
|
879
|
+
Chord: "chord",
|
|
880
|
+
CircularArrow: "circularArrow",
|
|
881
|
+
Cloud: "cloud",
|
|
882
|
+
CloudCallout: "cloudCallout",
|
|
883
|
+
Corner: "corner",
|
|
884
|
+
CornerTabs: "cornerTabs",
|
|
885
|
+
Cube: "cube",
|
|
886
|
+
CurvedConnector2: "curvedConnector2",
|
|
887
|
+
CurvedConnector3: "curvedConnector3",
|
|
888
|
+
CurvedConnector4: "curvedConnector4",
|
|
889
|
+
CurvedConnector5: "curvedConnector5",
|
|
890
|
+
CurvedDownArrow: "curvedDownArrow",
|
|
891
|
+
CurvedLeftArrow: "curvedLeftArrow",
|
|
892
|
+
CurvedRightArrow: "curvedRightArrow",
|
|
893
|
+
CurvedUpArrow: "curvedUpArrow",
|
|
894
|
+
Decagon: "decagon",
|
|
895
|
+
DiagStripe: "diagStripe",
|
|
896
|
+
Diamond: "diamond",
|
|
897
|
+
Dodecagon: "dodecagon",
|
|
898
|
+
Donut: "donut",
|
|
899
|
+
DoubleWave: "doubleWave",
|
|
900
|
+
DownArrow: "downArrow",
|
|
901
|
+
DownArrowCallout: "downArrowCallout",
|
|
902
|
+
Ellipse: "ellipse",
|
|
903
|
+
EllipseRibbon: "ellipseRibbon",
|
|
904
|
+
EllipseRibbon2: "ellipseRibbon2",
|
|
905
|
+
FlowChartAlternateProcess: "flowChartAlternateProcess",
|
|
906
|
+
FlowChartCollate: "flowChartCollate",
|
|
907
|
+
FlowChartConnector: "flowChartConnector",
|
|
908
|
+
FlowChartDecision: "flowChartDecision",
|
|
909
|
+
FlowChartDelay: "flowChartDelay",
|
|
910
|
+
FlowChartDisplay: "flowChartDisplay",
|
|
911
|
+
FlowChartDocument: "flowChartDocument",
|
|
912
|
+
FlowChartExtract: "flowChartExtract",
|
|
913
|
+
FlowChartInputOutput: "flowChartInputOutput",
|
|
914
|
+
FlowChartInternalStorage: "flowChartInternalStorage",
|
|
915
|
+
FlowChartMagneticDisk: "flowChartMagneticDisk",
|
|
916
|
+
FlowChartMagneticDrum: "flowChartMagneticDrum",
|
|
917
|
+
FlowChartMagneticTape: "flowChartMagneticTape",
|
|
918
|
+
FlowChartManualInput: "flowChartManualInput",
|
|
919
|
+
FlowChartManualOperation: "flowChartManualOperation",
|
|
920
|
+
FlowChartMerge: "flowChartMerge",
|
|
921
|
+
FlowChartMultidocument: "flowChartMultidocument",
|
|
922
|
+
FlowChartOfflineStorage: "flowChartOfflineStorage",
|
|
923
|
+
FlowChartOffpageConnector: "flowChartOffpageConnector",
|
|
924
|
+
FlowChartOnlineStorage: "flowChartOnlineStorage",
|
|
925
|
+
FlowChartOr: "flowChartOr",
|
|
926
|
+
FlowChartPredefinedProcess: "flowChartPredefinedProcess",
|
|
927
|
+
FlowChartPreparation: "flowChartPreparation",
|
|
928
|
+
FlowChartProcess: "flowChartProcess",
|
|
929
|
+
FlowChartPunchedCard: "flowChartPunchedCard",
|
|
930
|
+
FlowChartPunchedTape: "flowChartPunchedTape",
|
|
931
|
+
FlowChartSort: "flowChartSort",
|
|
932
|
+
FlowChartSummingJunction: "flowChartSummingJunction",
|
|
933
|
+
FlowChartTerminator: "flowChartTerminator",
|
|
934
|
+
FoldedCorner: "foldedCorner",
|
|
935
|
+
Frame: "frame",
|
|
936
|
+
Funnel: "funnel",
|
|
937
|
+
Gear6: "gear6",
|
|
938
|
+
Gear9: "gear9",
|
|
939
|
+
HalfFrame: "halfFrame",
|
|
940
|
+
Heart: "heart",
|
|
941
|
+
Heptagon: "heptagon",
|
|
942
|
+
Hexagon: "hexagon",
|
|
943
|
+
HomePlate: "homePlate",
|
|
944
|
+
HorizontalScroll: "horizontalScroll",
|
|
945
|
+
IrregularSeal1: "irregularSeal1",
|
|
946
|
+
IrregularSeal2: "irregularSeal2",
|
|
947
|
+
LeftArrow: "leftArrow",
|
|
948
|
+
LeftArrowCallout: "leftArrowCallout",
|
|
949
|
+
LeftBrace: "leftBrace",
|
|
950
|
+
LeftBracket: "leftBracket",
|
|
951
|
+
LeftCircularArrow: "leftCircularArrow",
|
|
952
|
+
LeftRightArrow: "leftRightArrow",
|
|
953
|
+
LeftRightArrowCallout: "leftRightArrowCallout",
|
|
954
|
+
LeftRightCircularArrow: "leftRightCircularArrow",
|
|
955
|
+
LeftRightRibbon: "leftRightRibbon",
|
|
956
|
+
LeftRightUpArrow: "leftRightUpArrow",
|
|
957
|
+
LeftUpArrow: "leftUpArrow",
|
|
958
|
+
LightningBolt: "lightningBolt",
|
|
959
|
+
Line: "line",
|
|
960
|
+
LineInv: "lineInv",
|
|
961
|
+
MathDivide: "mathDivide",
|
|
962
|
+
MathEqual: "mathEqual",
|
|
963
|
+
MathMinus: "mathMinus",
|
|
964
|
+
MathMultiply: "mathMultiply",
|
|
965
|
+
MathNotEqual: "mathNotEqual",
|
|
966
|
+
MathPlus: "mathPlus",
|
|
967
|
+
Moon: "moon",
|
|
968
|
+
NoSmoking: "noSmoking",
|
|
969
|
+
NonIsoscelesTrapezoid: "nonIsoscelesTrapezoid",
|
|
970
|
+
NotchedRightArrow: "notchedRightArrow",
|
|
971
|
+
Octagon: "octagon",
|
|
972
|
+
Parallelogram: "parallelogram",
|
|
973
|
+
Pentagon: "pentagon",
|
|
974
|
+
Pie: "pie",
|
|
975
|
+
PieWedge: "pieWedge",
|
|
976
|
+
Plaque: "plaque",
|
|
977
|
+
PlaqueTabs: "plaqueTabs",
|
|
978
|
+
Plus: "plus",
|
|
979
|
+
QuadArrow: "quadArrow",
|
|
980
|
+
QuadArrowCallout: "quadArrowCallout",
|
|
981
|
+
Rect: "rect",
|
|
982
|
+
Ribbon: "ribbon",
|
|
983
|
+
Ribbon2: "ribbon2",
|
|
984
|
+
RightArrow: "rightArrow",
|
|
985
|
+
RightArrowCallout: "rightArrowCallout",
|
|
986
|
+
RightBrace: "rightBrace",
|
|
987
|
+
RightBracket: "rightBracket",
|
|
988
|
+
Round1Rect: "round1Rect",
|
|
989
|
+
Round2DiagRect: "round2DiagRect",
|
|
990
|
+
Round2SameRect: "round2SameRect",
|
|
991
|
+
RoundRect: "roundRect",
|
|
992
|
+
RtTriangle: "rtTriangle",
|
|
993
|
+
SmileyFace: "smileyFace",
|
|
994
|
+
Snip1Rect: "snip1Rect",
|
|
995
|
+
Snip2DiagRect: "snip2DiagRect",
|
|
996
|
+
Snip2SameRect: "snip2SameRect",
|
|
997
|
+
SnipRoundRect: "snipRoundRect",
|
|
998
|
+
SquareTabs: "squareTabs",
|
|
999
|
+
Star10: "star10",
|
|
1000
|
+
Star12: "star12",
|
|
1001
|
+
Star16: "star16",
|
|
1002
|
+
Star24: "star24",
|
|
1003
|
+
Star32: "star32",
|
|
1004
|
+
Star4: "star4",
|
|
1005
|
+
Star5: "star5",
|
|
1006
|
+
Star6: "star6",
|
|
1007
|
+
Star7: "star7",
|
|
1008
|
+
Star8: "star8",
|
|
1009
|
+
StraightConnector1: "straightConnector1",
|
|
1010
|
+
StripedRightArrow: "stripedRightArrow",
|
|
1011
|
+
Sun: "sun",
|
|
1012
|
+
SwooshArrow: "swooshArrow",
|
|
1013
|
+
Teardrop: "teardrop",
|
|
1014
|
+
Trapezoid: "trapezoid",
|
|
1015
|
+
Triangle: "triangle",
|
|
1016
|
+
UpArrow: "upArrow",
|
|
1017
|
+
UpArrowCallout: "upArrowCallout",
|
|
1018
|
+
UpDownArrow: "upDownArrow",
|
|
1019
|
+
UpDownArrowCallout: "upDownArrowCallout",
|
|
1020
|
+
UturnArrow: "uturnArrow",
|
|
1021
|
+
VerticalScroll: "verticalScroll",
|
|
1022
|
+
Wave: "wave",
|
|
1023
|
+
WedgeEllipseCallout: "wedgeEllipseCallout",
|
|
1024
|
+
WedgeRectCallout: "wedgeRectCallout",
|
|
1025
|
+
WedgeRoundRectCallout: "wedgeRoundRectCallout"
|
|
1026
|
+
});
|
|
1027
|
+
(J = Bn ||= {}).Preset = Vn, J.PathLayer = {
|
|
1028
|
+
Fill: "fill",
|
|
1029
|
+
Stroke: "stroke",
|
|
1030
|
+
Marker: "marker"
|
|
1031
|
+
}, J.FillTransfer = Object.freeze({
|
|
1032
|
+
norm: [1, 0],
|
|
1033
|
+
darken: [.6, 0],
|
|
1034
|
+
darkenLess: [.8, 0],
|
|
1035
|
+
lighten: [.6, .4],
|
|
1036
|
+
lightenLess: [.8, .2]
|
|
1037
|
+
}), J.HandleType = {
|
|
1038
|
+
XY: "xy",
|
|
1039
|
+
Polar: "polar"
|
|
1040
|
+
};
|
|
1041
|
+
var Hn = e({
|
|
1042
|
+
TEXT_DEFAULTS: () => Zn,
|
|
1043
|
+
defaultStyleRefs: () => Yn,
|
|
1044
|
+
inheritedTextSize: () => Qn,
|
|
1045
|
+
resolve: () => nr,
|
|
1046
|
+
withoutDefaultStyleRefs: () => Xn
|
|
1047
|
+
}), Un = .75, Y = {
|
|
1048
|
+
type: T.Type.Solid,
|
|
1049
|
+
color: "phClr"
|
|
1050
|
+
}, Wn = [
|
|
1051
|
+
Y,
|
|
1052
|
+
Y,
|
|
1053
|
+
Y
|
|
1054
|
+
], Gn = [
|
|
1055
|
+
.5,
|
|
1056
|
+
1,
|
|
1057
|
+
1.5
|
|
1058
|
+
].map((e) => ({
|
|
1059
|
+
width: e,
|
|
1060
|
+
fill: Y
|
|
1061
|
+
})), Kn = Object.freeze({
|
|
1062
|
+
fill: {
|
|
1063
|
+
index: 1,
|
|
1064
|
+
color: "accent1"
|
|
1065
|
+
},
|
|
1066
|
+
stroke: {
|
|
1067
|
+
index: 2,
|
|
1068
|
+
color: "accent1 shade 15"
|
|
1069
|
+
},
|
|
1070
|
+
effect: {
|
|
1071
|
+
index: 0,
|
|
1072
|
+
color: "accent1"
|
|
1073
|
+
},
|
|
1074
|
+
font: {
|
|
1075
|
+
index: O.Scheme.Minor,
|
|
1076
|
+
color: "lt1"
|
|
1077
|
+
}
|
|
1078
|
+
}), qn = Object.freeze({
|
|
1079
|
+
fill: {
|
|
1080
|
+
index: 0,
|
|
1081
|
+
color: "accent1"
|
|
1082
|
+
},
|
|
1083
|
+
stroke: {
|
|
1084
|
+
index: 1,
|
|
1085
|
+
color: "accent1"
|
|
1086
|
+
},
|
|
1087
|
+
effect: {
|
|
1088
|
+
index: 0,
|
|
1089
|
+
color: "accent1"
|
|
1090
|
+
},
|
|
1091
|
+
font: {
|
|
1092
|
+
index: O.Scheme.Minor,
|
|
1093
|
+
color: "tx1"
|
|
1094
|
+
}
|
|
1095
|
+
}), Jn = Object.freeze({});
|
|
1096
|
+
function Yn(e) {
|
|
1097
|
+
return e?.type === K.Type.Connector ? qn : e?.type === K.Type.Picture ? Jn : Kn;
|
|
1098
|
+
}
|
|
1099
|
+
function Xn(e) {
|
|
1100
|
+
let t = e.style;
|
|
1101
|
+
if (!t) return t;
|
|
1102
|
+
let n = Yn(e), r = {};
|
|
1103
|
+
for (let e of [
|
|
1104
|
+
"fill",
|
|
1105
|
+
"stroke",
|
|
1106
|
+
"effect",
|
|
1107
|
+
"font"
|
|
1108
|
+
]) {
|
|
1109
|
+
let i = t[e], a = n[e];
|
|
1110
|
+
!i || a && i.index === a.index && i.color === a.color || (r[e] = i);
|
|
1111
|
+
}
|
|
1112
|
+
return Object.keys(r).length > 0 ? r : void 0;
|
|
1113
|
+
}
|
|
1114
|
+
var Zn = Object.freeze({
|
|
1115
|
+
verticalOverflow: w.Overflow.Clip,
|
|
1116
|
+
horizontalOverflow: w.Overflow.Clip,
|
|
1117
|
+
size: 11
|
|
1118
|
+
});
|
|
1119
|
+
function Qn(e, t) {
|
|
1120
|
+
let n = e.listStyle;
|
|
1121
|
+
return t.defaultRun?.size ?? n?.levels?.[t.level ?? 0]?.defaultRun?.size ?? n?.default?.defaultRun?.size;
|
|
1122
|
+
}
|
|
1123
|
+
var X = (e, t) => typeof e == "string" && e.startsWith("phClr") ? (t ?? "tx1") + e.slice(5) : e, $n = (e, t) => {
|
|
1124
|
+
let n = { ...e };
|
|
1125
|
+
return "color" in n && (n.color = X(n.color, t)), "foreground" in n && (n.foreground = X(n.foreground, t)), "background" in n && (n.background = X(n.background, t)), Array.isArray(n.stops) && (n.stops = n.stops.map((e) => typeof e == "string" ? X(e, t) : {
|
|
1126
|
+
...e,
|
|
1127
|
+
color: X(e.color, t)
|
|
1128
|
+
})), n;
|
|
1129
|
+
}, er = (e, t) => {
|
|
1130
|
+
if (!e) return;
|
|
1131
|
+
if (e.index <= 0) return { type: T.Type.None };
|
|
1132
|
+
let n = t?.fillStyleLst?.length ? t.fillStyleLst : Wn, r = n[Math.min(e.index, n.length) - 1];
|
|
1133
|
+
return r ? $n(r, e.color) : void 0;
|
|
1134
|
+
}, tr = (e, t) => {
|
|
1135
|
+
if (!e) return;
|
|
1136
|
+
if (e.index <= 0) return { fill: { type: T.Type.None } };
|
|
1137
|
+
let n = t?.lnStyleLst?.length ? t.lnStyleLst : Gn, r = n[Math.min(e.index, n.length) - 1];
|
|
1138
|
+
if (!r) return;
|
|
1139
|
+
let i = { ...r };
|
|
1140
|
+
return i.fill &&= $n(i.fill, e.color), i;
|
|
1141
|
+
};
|
|
1142
|
+
function nr(e, t) {
|
|
1143
|
+
let n = e?.style === null ? {} : {
|
|
1144
|
+
...Yn(e),
|
|
1145
|
+
...e?.style
|
|
1146
|
+
}, r = e?.fill ?? er(n.fill, t), i = tr(n.stroke, t), a = e?.stroke, o = a || i ? {
|
|
1147
|
+
...i,
|
|
1148
|
+
...a,
|
|
1149
|
+
fill: a?.fill ?? i?.fill
|
|
1150
|
+
} : void 0;
|
|
1151
|
+
return {
|
|
1152
|
+
fill: r,
|
|
1153
|
+
stroke: o,
|
|
1154
|
+
strokeWidth: typeof o?.width == "number" ? o.width : Un,
|
|
1155
|
+
fontColor: n.font?.color ?? (r && r.type !== T.Type.None ? "lt1" : "tx1")
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
function rr(e, t) {
|
|
1159
|
+
let n = ir(e), r = ir(t);
|
|
1160
|
+
return n === r ? e === t ? 0 : typeof e == "number" && typeof t == "number" ? e < t ? -1 : 1 : typeof e == "string" && typeof t == "string" ? e < t ? -1 : +(e > t) : typeof e == "boolean" ? e ? 1 : -1 : Rt.isError(e) && Rt.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
|
|
829
1161
|
}
|
|
830
|
-
function
|
|
1162
|
+
function ir(e) {
|
|
831
1163
|
if (e === null) return 0;
|
|
832
1164
|
switch (typeof e) {
|
|
833
1165
|
case "number": return 1;
|
|
834
1166
|
case "string": return 2;
|
|
835
1167
|
case "boolean": return 3;
|
|
836
|
-
default: return
|
|
1168
|
+
default: return Rt.isError(e) ? 4 : 5;
|
|
837
1169
|
}
|
|
838
1170
|
}
|
|
839
|
-
var
|
|
1171
|
+
var ar = class {
|
|
840
1172
|
constructor(e) {
|
|
841
1173
|
this._children = e;
|
|
842
1174
|
}
|
|
@@ -881,19 +1213,19 @@ var In = class {
|
|
|
881
1213
|
let n = t[e].getSortedNumbers().getValues();
|
|
882
1214
|
n.length > 0 && r.push(n);
|
|
883
1215
|
}
|
|
884
|
-
e = new
|
|
1216
|
+
e = new St(function(e) {
|
|
885
1217
|
let t = e.length;
|
|
886
|
-
if (t === 0) return
|
|
1218
|
+
if (t === 0) return or;
|
|
887
1219
|
if (t === 1) return e[0];
|
|
888
1220
|
let n = e[0];
|
|
889
|
-
for (let r = 1; r < t; r++) n =
|
|
1221
|
+
for (let r = 1; r < t; r++) n = sr(n, e[r]);
|
|
890
1222
|
return Object.freeze(n);
|
|
891
1223
|
}(r)), this._sortedNumbers = e;
|
|
892
1224
|
}
|
|
893
1225
|
return e;
|
|
894
1226
|
}
|
|
895
1227
|
getRanked(e) {
|
|
896
|
-
return
|
|
1228
|
+
return ut(this._children, e, rr)[Symbol.iterator]();
|
|
897
1229
|
}
|
|
898
1230
|
getFrequencies(e) {
|
|
899
1231
|
if (e) return this._mergeFrequencies(e);
|
|
@@ -901,7 +1233,7 @@ var In = class {
|
|
|
901
1233
|
return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
|
|
902
1234
|
}
|
|
903
1235
|
_mergeFrequencies(e) {
|
|
904
|
-
let t = e?.keyFn ??
|
|
1236
|
+
let t = e?.keyFn ?? xe, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
|
|
905
1237
|
for (let l = 0; l < a; l++) {
|
|
906
1238
|
let a = i[l].getFrequencies(e);
|
|
907
1239
|
o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
|
|
@@ -914,22 +1246,22 @@ var In = class {
|
|
|
914
1246
|
}) : c = !0, d = u.next();
|
|
915
1247
|
}
|
|
916
1248
|
}
|
|
917
|
-
return Nt.fromGroups(r, t, e,
|
|
1249
|
+
return Nt.fromGroups(r, t, e, rr, o, s, c);
|
|
918
1250
|
}
|
|
919
1251
|
getTypedCounts(e) {
|
|
920
1252
|
let t = this._typedCounts;
|
|
921
1253
|
if (!t) {
|
|
922
1254
|
let e = {
|
|
923
|
-
[
|
|
924
|
-
[
|
|
925
|
-
[
|
|
926
|
-
[
|
|
927
|
-
[
|
|
928
|
-
[
|
|
1255
|
+
[N.Number]: 0,
|
|
1256
|
+
[N.String]: 0,
|
|
1257
|
+
[N.Boolean]: 0,
|
|
1258
|
+
[N.Error]: 0,
|
|
1259
|
+
[N.RichData]: 0,
|
|
1260
|
+
[N.Null]: 0
|
|
929
1261
|
}, n = this._children, r = n.length;
|
|
930
1262
|
for (let t = 0; t < r; t++) {
|
|
931
1263
|
let r = n[t].getTypedCounts();
|
|
932
|
-
e[
|
|
1264
|
+
e[N.Number] += r[N.Number] ?? 0, e[N.String] += r[N.String] ?? 0, e[N.Boolean] += r[N.Boolean] ?? 0, e[N.Error] += r[N.Error] ?? 0, e[N.RichData] += r[N.RichData] ?? 0, e[N.Null] += r[N.Null] ?? 0;
|
|
933
1265
|
}
|
|
934
1266
|
t = Object.freeze(e), this._typedCounts = t;
|
|
935
1267
|
}
|
|
@@ -950,12 +1282,12 @@ var In = class {
|
|
|
950
1282
|
sum: 0,
|
|
951
1283
|
sumSq: 0,
|
|
952
1284
|
typed: {
|
|
953
|
-
[
|
|
954
|
-
[
|
|
955
|
-
[
|
|
956
|
-
[
|
|
957
|
-
[
|
|
958
|
-
[
|
|
1285
|
+
[N.Number]: 0,
|
|
1286
|
+
[N.String]: 0,
|
|
1287
|
+
[N.Boolean]: 0,
|
|
1288
|
+
[N.Error]: 0,
|
|
1289
|
+
[N.RichData]: 0,
|
|
1290
|
+
[N.Null]: 0
|
|
959
1291
|
}
|
|
960
1292
|
};
|
|
961
1293
|
for (let i = 0; i < n; i++) {
|
|
@@ -964,17 +1296,17 @@ var In = class {
|
|
|
964
1296
|
let a = n.numericalCount;
|
|
965
1297
|
a <= 0 || (r.numericalCount += a, r.sum += n.sum, r.sumSq += n.varP * a + n.sum * n.sum / a, (r.min === void 0 || n.min < r.min) && (r.min = n.min), (r.max === void 0 || n.max > r.max) && (r.max = n.max));
|
|
966
1298
|
}
|
|
967
|
-
return
|
|
1299
|
+
return _t(r);
|
|
968
1300
|
}
|
|
969
|
-
},
|
|
970
|
-
function
|
|
1301
|
+
}, or = Object.freeze([]);
|
|
1302
|
+
function sr(e, t) {
|
|
971
1303
|
let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
|
|
972
1304
|
for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
|
|
973
1305
|
for (; a < n;) i[s++] = e[a++];
|
|
974
1306
|
for (; o < r;) i[s++] = t[o++];
|
|
975
1307
|
return i;
|
|
976
1308
|
}
|
|
977
|
-
var
|
|
1309
|
+
var cr = class {
|
|
978
1310
|
constructor(e, t) {
|
|
979
1311
|
this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
|
|
980
1312
|
}
|
|
@@ -1008,7 +1340,7 @@ var zn = class {
|
|
|
1008
1340
|
get isIPerson() {
|
|
1009
1341
|
return !0;
|
|
1010
1342
|
}
|
|
1011
|
-
},
|
|
1343
|
+
}, lr = class extends g {
|
|
1012
1344
|
constructor(e) {
|
|
1013
1345
|
super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
|
|
1014
1346
|
}
|
|
@@ -1029,10 +1361,10 @@ var zn = class {
|
|
|
1029
1361
|
let e = this._byDisplayName.get(r);
|
|
1030
1362
|
if (e) return e;
|
|
1031
1363
|
}
|
|
1032
|
-
let i = new
|
|
1364
|
+
let i = new cr({
|
|
1033
1365
|
...t,
|
|
1034
1366
|
displayName: r,
|
|
1035
|
-
id: n ??
|
|
1367
|
+
id: n ?? P.uuidV4().toUpperCase()
|
|
1036
1368
|
}, (e) => this._remove(e));
|
|
1037
1369
|
return this._byId.set(i.getId(), i), r && !this._byDisplayName.has(r) && this._byDisplayName.set(r, i), this._items = null, this._notifyCollectionChange(), i;
|
|
1038
1370
|
}
|
|
@@ -1072,7 +1404,7 @@ var zn = class {
|
|
|
1072
1404
|
get isIPersonCollection() {
|
|
1073
1405
|
return !0;
|
|
1074
1406
|
}
|
|
1075
|
-
},
|
|
1407
|
+
}, ur = (e, t) => {
|
|
1076
1408
|
let n = [0];
|
|
1077
1409
|
for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
|
|
1078
1410
|
let r = t.map((e) => ` ${((e) => {
|
|
@@ -1084,9 +1416,9 @@ var zn = class {
|
|
|
1084
1416
|
return `${t + 1}:${e - n[t] + 1}`;
|
|
1085
1417
|
})(e.start)} ${e.code}: ${e.message}`), i = t.length;
|
|
1086
1418
|
return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
|
|
1087
|
-
},
|
|
1419
|
+
}, dr = class {
|
|
1088
1420
|
constructor(e) {
|
|
1089
|
-
this._options = e, this._emitter = new
|
|
1421
|
+
this._options = e, this._emitter = new x(this), this._initState();
|
|
1090
1422
|
}
|
|
1091
1423
|
_initState() {}
|
|
1092
1424
|
getModules() {
|
|
@@ -1095,27 +1427,28 @@ var zn = class {
|
|
|
1095
1427
|
_builtInNames() {
|
|
1096
1428
|
try {
|
|
1097
1429
|
let e = this._options.getBuiltInFunctions?.();
|
|
1098
|
-
if (!e) return
|
|
1430
|
+
if (!e) return P.EmptyArray;
|
|
1099
1431
|
let t = [];
|
|
1100
1432
|
for (let n of e.getItems()) n.isBuiltIn() && t.push(n.getName());
|
|
1101
1433
|
return t;
|
|
1102
1434
|
} catch {
|
|
1103
|
-
return
|
|
1435
|
+
return P.EmptyArray;
|
|
1104
1436
|
}
|
|
1105
1437
|
}
|
|
1106
1438
|
async createModule(e) {
|
|
1107
1439
|
let t = await (await import("@sheetxl/scripting")).ScriptCompiler.compile({
|
|
1108
1440
|
builtInNames: this._builtInNames(),
|
|
1441
|
+
minify: !0,
|
|
1109
1442
|
...e
|
|
1110
1443
|
});
|
|
1111
|
-
return t.module ? await
|
|
1444
|
+
return t.module ? await n(ie.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
|
|
1112
1445
|
}
|
|
1113
1446
|
addModule(e, t, n) {
|
|
1114
1447
|
this._modules.add(e, t, n);
|
|
1115
1448
|
}
|
|
1116
|
-
async addModuleFromJSON(e, t,
|
|
1117
|
-
let
|
|
1118
|
-
return this.addModule(e,
|
|
1449
|
+
async addModuleFromJSON(e, t, r) {
|
|
1450
|
+
let i = await n(e, t);
|
|
1451
|
+
return this.addModule(e, i, r), i;
|
|
1119
1452
|
}
|
|
1120
1453
|
executeMacro(e, t, n) {
|
|
1121
1454
|
let r = this._modules.getItems({ name: t }), i = r.length;
|
|
@@ -1130,7 +1463,7 @@ var zn = class {
|
|
|
1130
1463
|
}
|
|
1131
1464
|
async run(e, t) {
|
|
1132
1465
|
try {
|
|
1133
|
-
let r = typeof e == "string" ? await this.createModule({ source: e }) : await
|
|
1466
|
+
let r = typeof e == "string" ? await this.createModule({ source: e }) : await n(ie.DEFAULT_MODULE, e), i = typeof e == "string" ? e : e?.source ?? "";
|
|
1134
1467
|
return await this._runModule(r, i, t);
|
|
1135
1468
|
} catch (e) {
|
|
1136
1469
|
return {
|
|
@@ -1147,7 +1480,7 @@ var zn = class {
|
|
|
1147
1480
|
};
|
|
1148
1481
|
let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
|
|
1149
1482
|
if (a.length > 0) {
|
|
1150
|
-
let e = Error(
|
|
1483
|
+
let e = Error(ur(t, a));
|
|
1151
1484
|
return e.diagnostics = a, {
|
|
1152
1485
|
ok: !1,
|
|
1153
1486
|
error: e,
|
|
@@ -1183,7 +1516,7 @@ var zn = class {
|
|
|
1183
1516
|
async searchFunctions(e) {
|
|
1184
1517
|
await this._emitter.notify("onBeforeSearch", { async: !0 });
|
|
1185
1518
|
let t = await this._searchable(e);
|
|
1186
|
-
if (t.length === 0) return
|
|
1519
|
+
if (t.length === 0) return P.EmptyArray;
|
|
1187
1520
|
let n = e?.limit, r = n === void 0 ? e : {
|
|
1188
1521
|
...e,
|
|
1189
1522
|
limit: void 0
|
|
@@ -1198,14 +1531,14 @@ var zn = class {
|
|
|
1198
1531
|
}
|
|
1199
1532
|
}
|
|
1200
1533
|
}
|
|
1201
|
-
if (!i || i.length === 0) return
|
|
1534
|
+
if (!i || i.length === 0) return P.EmptyArray;
|
|
1202
1535
|
let o = e?.text ? e.text.trim().toUpperCase() : null;
|
|
1203
|
-
return o && t.length > 1 &&
|
|
1536
|
+
return o && t.length > 1 && $e(i, o), n !== void 0 && i.length > n ? i.slice(0, n) : i;
|
|
1204
1537
|
}
|
|
1205
1538
|
async getFunctionCategories(e) {
|
|
1206
1539
|
await this._emitter.notify("onBeforeSearch", { async: !0 });
|
|
1207
1540
|
let t = await this._searchable(e);
|
|
1208
|
-
if (t.length === 0) return
|
|
1541
|
+
if (t.length === 0) return P.EmptyArray;
|
|
1209
1542
|
if (t.length === 1) return t[0].getCategories(e);
|
|
1210
1543
|
let n = e?.includeDeprecated ?? !1, r = /* @__PURE__ */ new Map(), i = (e) => {
|
|
1211
1544
|
let t = e.toUpperCase(), n = r.get(t);
|
|
@@ -1237,40 +1570,40 @@ var zn = class {
|
|
|
1237
1570
|
})), this._startPromise;
|
|
1238
1571
|
}
|
|
1239
1572
|
async _doStart() {
|
|
1240
|
-
let e = this._options?.workbook, t = this._options?.json,
|
|
1573
|
+
let e = this._options?.workbook, t = this._options?.json, r = {};
|
|
1241
1574
|
if (t) {
|
|
1242
|
-
let
|
|
1243
|
-
for (let
|
|
1244
|
-
let
|
|
1575
|
+
let i = Object.keys(t);
|
|
1576
|
+
for (let a = 0; a < i.length; a++) {
|
|
1577
|
+
let o = i[a], s = t[o];
|
|
1245
1578
|
try {
|
|
1246
|
-
|
|
1579
|
+
r[o] = await n(o, s, !1, [], s?.scope === "workbook" ? e : null);
|
|
1247
1580
|
} catch (e) {
|
|
1248
|
-
|
|
1581
|
+
Wt.error(`Could not load script '${o}'; it will be unavailable.`, e);
|
|
1249
1582
|
}
|
|
1250
1583
|
}
|
|
1251
1584
|
}
|
|
1252
|
-
let
|
|
1585
|
+
let i = this, a = new h({
|
|
1253
1586
|
transactions: this._options?.transactions,
|
|
1254
|
-
initial:
|
|
1255
|
-
isReadOnly: () =>
|
|
1587
|
+
initial: r,
|
|
1588
|
+
isReadOnly: () => i.isReadOnly(),
|
|
1256
1589
|
onRemove: (e, t) => {
|
|
1257
|
-
|
|
1590
|
+
i._options?.onRemove?.(e, t);
|
|
1258
1591
|
},
|
|
1259
1592
|
onAdd: (e, t) => {
|
|
1260
|
-
|
|
1593
|
+
i._emitter.notify("onChange"), i._options?.onAdd?.(e, t);
|
|
1261
1594
|
}
|
|
1262
1595
|
});
|
|
1263
|
-
this._modules =
|
|
1264
|
-
let
|
|
1265
|
-
if (
|
|
1266
|
-
let
|
|
1267
|
-
for (let t = 0; t <
|
|
1268
|
-
let n =
|
|
1596
|
+
this._modules = a;
|
|
1597
|
+
let o = a.getItems();
|
|
1598
|
+
if (o.length === 0) return Promise.resolve(P.EmptyArray);
|
|
1599
|
+
let s = o.length;
|
|
1600
|
+
for (let t = 0; t < s; t++) {
|
|
1601
|
+
let n = o[t];
|
|
1269
1602
|
try {
|
|
1270
1603
|
let t = await n.getFunctions().search({ type: "autoRun" }), r = t.length;
|
|
1271
1604
|
for (let n = 0; n < r; n++) await t[n].execute(e);
|
|
1272
1605
|
} catch (e) {
|
|
1273
|
-
|
|
1606
|
+
Wt.error("Error executing autoRun script:", e);
|
|
1274
1607
|
}
|
|
1275
1608
|
}
|
|
1276
1609
|
}
|
|
@@ -1289,9 +1622,9 @@ var zn = class {
|
|
|
1289
1622
|
get isIScript() {
|
|
1290
1623
|
return !0;
|
|
1291
1624
|
}
|
|
1292
|
-
},
|
|
1625
|
+
}, fr = class {
|
|
1293
1626
|
constructor(e, t, n, r) {
|
|
1294
|
-
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ??
|
|
1627
|
+
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? F.EmptyCell, this._sheet = new M({
|
|
1295
1628
|
runtime: e,
|
|
1296
1629
|
styles: this._styles,
|
|
1297
1630
|
calcOnLoad: "none",
|
|
@@ -1304,43 +1637,43 @@ var zn = class {
|
|
|
1304
1637
|
applyCSSStyle(e, t) {
|
|
1305
1638
|
let n = !1;
|
|
1306
1639
|
e.style || (e.style = {}, n = !0);
|
|
1307
|
-
let
|
|
1640
|
+
let r = e.style, i = { ...t };
|
|
1308
1641
|
if (t.msoIgnore) {
|
|
1309
|
-
let e = t.msoIgnore.split(","), n = Object.keys(
|
|
1642
|
+
let e = t.msoIgnore.split(","), n = Object.keys(i);
|
|
1310
1643
|
for (let t = 0; t < n.length; t++) {
|
|
1311
1644
|
let r = n[t];
|
|
1312
|
-
e.includes(r) && delete
|
|
1645
|
+
e.includes(r) && delete i[r];
|
|
1313
1646
|
}
|
|
1314
1647
|
}
|
|
1315
|
-
let
|
|
1316
|
-
|
|
1317
|
-
let
|
|
1318
|
-
|
|
1319
|
-
let
|
|
1320
|
-
if (
|
|
1321
|
-
let e =
|
|
1322
|
-
e && (e.patternType ===
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
let
|
|
1326
|
-
e && (
|
|
1648
|
+
let a = Lt(i.fontFamily);
|
|
1649
|
+
r.font = {}, a && (r.font.family = a.family, r.font.fallbacks = a.fallbacks, r.font.size = a.size), r.font.size = i.fontSize, r.font.weight = i.fontWeight, r.font.style = i.fontStyle, r.font.color = i.color;
|
|
1650
|
+
let o = S(i.textDecoration);
|
|
1651
|
+
r.font.underline = o.underline, r.font.strike = o.strike, i.textUnderlineStyle && (r.font.underline = re(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = _(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = w.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = w.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = w.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.verticalAlign = O.VerticalAlignment.Super : i.verticalAlign.toLowerCase() === "sup" ? r.font.verticalAlign = O.VerticalAlignment.Sub : r.alignment.vertical = ve(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = w.VerticalAlignment.Distributed : console.warn("unknown vertical-align", i.verticalAlign))), i.msoCharIndentCount && (r.alignment.indent = i.msoCharIndentCount), i.whiteSpace && (r.alignment.overflow = i.whiteSpace === "no-wrap" || i.whiteSpace === "nowrap" ? w.Overflow.Visible : w.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = w.Overflow.Shrink);
|
|
1652
|
+
let s = null;
|
|
1653
|
+
if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
|
|
1654
|
+
let e = Ee(i.msoPattern);
|
|
1655
|
+
e && (e.patternType === T.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== T.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
|
|
1656
|
+
}
|
|
1657
|
+
i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation = me(i.msoRotate));
|
|
1658
|
+
let c = (e, t) => {
|
|
1659
|
+
e && (r.borders ||= {}, r.borders[e] = t);
|
|
1327
1660
|
};
|
|
1328
|
-
|
|
1329
|
-
let
|
|
1330
|
-
|
|
1661
|
+
i.border && i.border !== "none" && (c("top", i.border), c("left", i.border), c("right", i.border), c("bottom", i.border)), i.borderTop && c("top", i.borderTop), i.borderLeft && c("left", i.borderLeft), i.borderRight && c("right", i.borderRight), i.borderBottom && c("bottom", i.borderBottom), i.msoDiagonalUp && c("diagonalUp", i.msoDiagonalUp), i.msoDiagonalDown && c("diagonalDown", i.msoDiagonalDown);
|
|
1662
|
+
let l = r.numberFormat;
|
|
1663
|
+
i.msoNumberFormat && (l = y(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = D.Styles.lookupStyle(r.numberFormat).formatType === D.Type.Number ? null : D.Type.Number : l === "Percent" && (l = D.Styles.lookupStyle(r.numberFormat).formatType === D.Type.Percentage ? null : D.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
|
|
1331
1664
|
}
|
|
1332
1665
|
onCell(e, t, n, r, i) {
|
|
1333
1666
|
let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
|
|
1334
1667
|
if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), i?.tagName.toUpperCase() === "TD") {
|
|
1335
1668
|
let e = o.style, t = e?.font ?? {};
|
|
1336
|
-
(i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign =
|
|
1669
|
+
(i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign = O.VerticalAlignment.Sub), i.querySelectorAll("sup").length > 0 && (t.verticalAlign = O.VerticalAlignment.Super), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = O.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = O.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font ||= t);
|
|
1337
1670
|
let n = i.querySelectorAll("a");
|
|
1338
1671
|
if (n.length > 0) {
|
|
1339
1672
|
let e = n[0].getAttribute("href");
|
|
1340
1673
|
e && (o.hyperlink = e);
|
|
1341
1674
|
}
|
|
1342
1675
|
}
|
|
1343
|
-
if (!
|
|
1676
|
+
if (!F.isSingleCell(e)) {
|
|
1344
1677
|
let t = {
|
|
1345
1678
|
rowStart: this._topLeft.rowIndex + e.rowStart,
|
|
1346
1679
|
colStart: this._topLeft.colIndex + e.colStart,
|
|
@@ -1351,7 +1684,7 @@ var zn = class {
|
|
|
1351
1684
|
}
|
|
1352
1685
|
if (o.value === void 0 && !o.style && Object.keys(o).length <= 1) return;
|
|
1353
1686
|
let s = this._builder, c = this._topLeft;
|
|
1354
|
-
if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !
|
|
1687
|
+
if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !F.isSingleCell(e) && a.msoIgnore) {
|
|
1355
1688
|
if (a.msoIgnore.includes("colspan")) {
|
|
1356
1689
|
let t = {};
|
|
1357
1690
|
a && this.applyCSSStyle(t, a);
|
|
@@ -1379,29 +1712,29 @@ var zn = class {
|
|
|
1379
1712
|
onRowStart(e, t, n, r) {
|
|
1380
1713
|
let i = n(r);
|
|
1381
1714
|
if (i.msoHeightSource !== "userset" || !r) return;
|
|
1382
|
-
let
|
|
1383
|
-
if (
|
|
1384
|
-
let t = r.cells[e], i =
|
|
1385
|
-
i !== null && (
|
|
1715
|
+
let o = r.getAttribute("height") ?? i.height, s = null;
|
|
1716
|
+
if (o && (s = a(o, this._styles.getNormal().getFont().getSize(), "px")), s === null) for (let e = 0; e < r.cells.length; e++) {
|
|
1717
|
+
let t = r.cells[e], i = a(t.getAttribute("height") ?? n(t).height, this._styles.getNormal().getFont().getSize(), "px");
|
|
1718
|
+
i !== null && (s = Math.max(i, s ?? 0));
|
|
1386
1719
|
}
|
|
1387
|
-
|
|
1720
|
+
s !== null && this._rowsReading.push({
|
|
1388
1721
|
address: {
|
|
1389
1722
|
min: this._topLeft.rowIndex + e,
|
|
1390
1723
|
max: this._topLeft.rowIndex + e + t - 1
|
|
1391
1724
|
},
|
|
1392
|
-
update: { size:
|
|
1725
|
+
update: { size: s * O.getDeviceScale() }
|
|
1393
1726
|
});
|
|
1394
1727
|
}
|
|
1395
1728
|
onColumn(e, t, n, r) {
|
|
1396
1729
|
let i = n(r);
|
|
1397
1730
|
if (i.msoWidthSource !== "userset" || !r) return;
|
|
1398
|
-
let
|
|
1399
|
-
|
|
1731
|
+
let o = r.getAttribute("width") ?? i.width, s = null;
|
|
1732
|
+
o && (s = a(o, this._styles.getNormal().getFont().getSize(), "px")), s !== null && this._colsReading.push({
|
|
1400
1733
|
address: {
|
|
1401
1734
|
min: this._topLeft.colIndex + e,
|
|
1402
1735
|
max: this._topLeft.colIndex + e + t - 1
|
|
1403
1736
|
},
|
|
1404
|
-
update: { size:
|
|
1737
|
+
update: { size: s * O.getDeviceScale() }
|
|
1405
1738
|
});
|
|
1406
1739
|
}
|
|
1407
1740
|
onDone() {
|
|
@@ -1412,9 +1745,9 @@ var zn = class {
|
|
|
1412
1745
|
sheet() {
|
|
1413
1746
|
return this._sheet;
|
|
1414
1747
|
}
|
|
1415
|
-
},
|
|
1748
|
+
}, pr = class {
|
|
1416
1749
|
constructor(e) {
|
|
1417
|
-
if (!e) throw new
|
|
1750
|
+
if (!e) throw new Gt("snapshot is required.");
|
|
1418
1751
|
this._snapshot = e;
|
|
1419
1752
|
}
|
|
1420
1753
|
getItemType() {
|
|
@@ -1444,10 +1777,10 @@ var zn = class {
|
|
|
1444
1777
|
get isClipboardItem() {
|
|
1445
1778
|
return !0;
|
|
1446
1779
|
}
|
|
1447
|
-
},
|
|
1780
|
+
}, mr = class {
|
|
1448
1781
|
constructor(e, t, n, r, i) {
|
|
1449
|
-
if (this._parsed = void 0, this._runtime = e, !t) throw new
|
|
1450
|
-
this._topLeft = n ??
|
|
1782
|
+
if (this._parsed = void 0, this._runtime = e, !t) throw new Gt("nativeItems are required.");
|
|
1783
|
+
this._topLeft = n ?? F.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
|
|
1451
1784
|
}
|
|
1452
1785
|
getItemType() {
|
|
1453
1786
|
return "range";
|
|
@@ -1488,15 +1821,15 @@ var zn = class {
|
|
|
1488
1821
|
async parse() {
|
|
1489
1822
|
let e, t = this._native?.text, n = this._native.html;
|
|
1490
1823
|
if (n === null && t && t.includes("<table")) try {
|
|
1491
|
-
let e = new DOMParser().parseFromString(t,
|
|
1492
|
-
if (r) throw new
|
|
1824
|
+
let e = new DOMParser().parseFromString(t, Ut.Html), r = e.querySelector("parsererror");
|
|
1825
|
+
if (r) throw new I("Unable to parse: " + r);
|
|
1493
1826
|
n = e, t = null;
|
|
1494
1827
|
} catch {
|
|
1495
1828
|
console.warn("Discovered text as html table but could could not parse.");
|
|
1496
1829
|
}
|
|
1497
1830
|
try {
|
|
1498
|
-
let r = new
|
|
1499
|
-
if (
|
|
1831
|
+
let r = new fr(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text"), i = await Promise.resolve(t ? qe(t) : [[]]), a;
|
|
1832
|
+
if (st(n, i, r) ? (e = r.sheet(), a = e.getUsedRange()) : n = null, a) return this._parsed = {
|
|
1500
1833
|
copyTo: async (e, t) => (await e.copyFrom(a, t))?.getCoords() ?? null,
|
|
1501
1834
|
getCoords: () => a.getCoords(),
|
|
1502
1835
|
getSource: () => e,
|
|
@@ -1511,7 +1844,7 @@ var zn = class {
|
|
|
1511
1844
|
async copyTo(t, n) {
|
|
1512
1845
|
let r = t.getSheet(), i = await e._native.image.arrayBuffer(), a = await r.getMovables().addPicture({ source: { buffer: i } }, {
|
|
1513
1846
|
type: "picture",
|
|
1514
|
-
description:
|
|
1847
|
+
description: z("op.copyImageFromClipboard")
|
|
1515
1848
|
});
|
|
1516
1849
|
return r.getView().selectMovables([a]), null;
|
|
1517
1850
|
},
|
|
@@ -1523,7 +1856,7 @@ var zn = class {
|
|
|
1523
1856
|
get isClipboardItem() {
|
|
1524
1857
|
return !0;
|
|
1525
1858
|
}
|
|
1526
|
-
},
|
|
1859
|
+
}, hr = {
|
|
1527
1860
|
showFormulaBar: !0,
|
|
1528
1861
|
showTabs: !0,
|
|
1529
1862
|
tabRatio: 600,
|
|
@@ -1531,9 +1864,9 @@ var zn = class {
|
|
|
1531
1864
|
showVerticalScrollbar: !0,
|
|
1532
1865
|
showStatusBar: !0,
|
|
1533
1866
|
activeSheetId: 0
|
|
1534
|
-
},
|
|
1867
|
+
}, gr = class {
|
|
1535
1868
|
constructor(e) {
|
|
1536
|
-
this._id =
|
|
1869
|
+
this._id = P.uuidV4(), this._emitter = new x(this), this._state = { ...hr }, e?.json && this._fromJSON(e?.json);
|
|
1537
1870
|
}
|
|
1538
1871
|
getId() {
|
|
1539
1872
|
return this._id;
|
|
@@ -1588,7 +1921,7 @@ var zn = class {
|
|
|
1588
1921
|
let e = {}, t = Object.keys(this._state), n = t.length;
|
|
1589
1922
|
for (let r = 0; r < n; r++) {
|
|
1590
1923
|
let n = t[r], i = this._state[n];
|
|
1591
|
-
i != null && i !==
|
|
1924
|
+
i != null && i !== hr[n] && (e[n] = i);
|
|
1592
1925
|
}
|
|
1593
1926
|
return Object.keys(e).length === 0 && (e = null), e;
|
|
1594
1927
|
}
|
|
@@ -1598,7 +1931,7 @@ var zn = class {
|
|
|
1598
1931
|
}
|
|
1599
1932
|
update(e, t = !0) {
|
|
1600
1933
|
this._state = {
|
|
1601
|
-
...
|
|
1934
|
+
...hr,
|
|
1602
1935
|
...this._state,
|
|
1603
1936
|
...e
|
|
1604
1937
|
}, t && this._emitter.notify("onViewChange");
|
|
@@ -1613,13 +1946,13 @@ var zn = class {
|
|
|
1613
1946
|
get isIWorkbookView() {
|
|
1614
1947
|
return !0;
|
|
1615
1948
|
}
|
|
1616
|
-
},
|
|
1949
|
+
}, _r = Object.freeze({
|
|
1617
1950
|
structure: !1,
|
|
1618
1951
|
windows: !1,
|
|
1619
1952
|
revision: !1,
|
|
1620
1953
|
password: null,
|
|
1621
1954
|
revisionsPassword: null
|
|
1622
|
-
}),
|
|
1955
|
+
}), vr = class extends ae {
|
|
1623
1956
|
isWindowsAllowed() {
|
|
1624
1957
|
return this._isPropertyAllowed("windows");
|
|
1625
1958
|
}
|
|
@@ -1641,7 +1974,7 @@ var zn = class {
|
|
|
1641
1974
|
let n = Object.keys(t), r = n.length;
|
|
1642
1975
|
for (let i = 0; i < r; i++) {
|
|
1643
1976
|
let r = n[i], a = t[r];
|
|
1644
|
-
a != null && a !==
|
|
1977
|
+
a != null && a !== _r[r] && (e[r] = a);
|
|
1645
1978
|
}
|
|
1646
1979
|
}
|
|
1647
1980
|
return super._toJSON(e);
|
|
@@ -1654,9 +1987,9 @@ var zn = class {
|
|
|
1654
1987
|
}
|
|
1655
1988
|
};
|
|
1656
1989
|
function Z(e) {
|
|
1657
|
-
return
|
|
1990
|
+
return B("error.workbook.invalidSheetKey", { key: e });
|
|
1658
1991
|
}
|
|
1659
|
-
var
|
|
1992
|
+
var yr = class extends g {
|
|
1660
1993
|
constructor(e, t, n) {
|
|
1661
1994
|
super(), this._add = e, this._get = t, this._addListeners = n;
|
|
1662
1995
|
}
|
|
@@ -1675,39 +2008,39 @@ var Xn = class extends w {
|
|
|
1675
2008
|
get isISheetCollection() {
|
|
1676
2009
|
return !0;
|
|
1677
2010
|
}
|
|
1678
|
-
},
|
|
1679
|
-
function
|
|
1680
|
-
let t =
|
|
2011
|
+
}, br = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), xr = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
|
|
2012
|
+
function Sr(e) {
|
|
2013
|
+
let t = B(z("workbook.defaultSheetName"), { n: e + 1 });
|
|
1681
2014
|
return t === "workbook.defaultSheetName" ? `Sheet${e + 1}` : t;
|
|
1682
2015
|
}
|
|
1683
|
-
function
|
|
2016
|
+
function Cr(e, t) {
|
|
1684
2017
|
return {
|
|
1685
|
-
...
|
|
2018
|
+
...bt,
|
|
1686
2019
|
getSheet: () => null,
|
|
1687
|
-
toString: () =>
|
|
2020
|
+
toString: () => vt(e, t)
|
|
1688
2021
|
};
|
|
1689
2022
|
}
|
|
1690
|
-
function
|
|
1691
|
-
if (!e) throw Error(
|
|
1692
|
-
if (
|
|
2023
|
+
function wr(e, t = !1) {
|
|
2024
|
+
if (!e) throw Error(B("error.workbook.sheetNameBlank"));
|
|
2025
|
+
if (br.test(e)) {
|
|
1693
2026
|
if (!t) throw Error(function(e) {
|
|
1694
|
-
return e ?
|
|
2027
|
+
return e ? B("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : B("error.workbook.sheetNameInvalidChars");
|
|
1695
2028
|
}(e));
|
|
1696
|
-
e = e.replace(
|
|
2029
|
+
e = e.replace(br, "");
|
|
1697
2030
|
}
|
|
1698
|
-
if (e.length === 0) throw Error(
|
|
2031
|
+
if (e.length === 0) throw Error(B("error.workbook.sheetNameBlank"));
|
|
1699
2032
|
let n = e.length;
|
|
1700
2033
|
if (n > 31) {
|
|
1701
|
-
if (!t) throw Error(
|
|
2034
|
+
if (!t) throw Error(B("error.workbook.sheetNameTooLong"));
|
|
1702
2035
|
e = e.substring(0, 31);
|
|
1703
2036
|
}
|
|
1704
2037
|
if (e.charAt(0) === "'" || e.charAt(n - 1) === "'") {
|
|
1705
|
-
if (!t) throw Error(
|
|
2038
|
+
if (!t) throw Error(B("error.workbook.sheetNameQuotes"));
|
|
1706
2039
|
e = e.replace(/^'|'$/g, "");
|
|
1707
2040
|
}
|
|
1708
2041
|
return e;
|
|
1709
2042
|
}
|
|
1710
|
-
var
|
|
2043
|
+
var Tr, Er, Dr = "workbook.activeSheet", Or = class e extends it {
|
|
1711
2044
|
constructor(e, t, n, r) {
|
|
1712
2045
|
super(e, t, r), this._workbook = n;
|
|
1713
2046
|
}
|
|
@@ -1721,20 +2054,20 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1721
2054
|
getOptions: A(this._options?.getOptions, n)
|
|
1722
2055
|
}), new e(t, this._internal, this._workbook, r);
|
|
1723
2056
|
}
|
|
1724
|
-
_createRange(e,
|
|
1725
|
-
let
|
|
1726
|
-
if (!
|
|
2057
|
+
_createRange(e, t) {
|
|
2058
|
+
let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, j.Visibility.VeryHidden) : null;
|
|
2059
|
+
if (!r) {
|
|
1727
2060
|
let e = this._workbook.getSelectedSheet();
|
|
1728
|
-
return delete
|
|
1729
|
-
scope:
|
|
2061
|
+
return delete n?.scope, Cr(n, n ? {
|
|
2062
|
+
scope: Ct,
|
|
1730
2063
|
...e.getEntireRange().getCoords()
|
|
1731
2064
|
} : null);
|
|
1732
2065
|
}
|
|
1733
|
-
let
|
|
1734
|
-
return
|
|
2066
|
+
let i = this._options;
|
|
2067
|
+
return t && (i = {
|
|
1735
2068
|
...this._options,
|
|
1736
|
-
getOptions: A(this._options.getOptions,
|
|
1737
|
-
}), new
|
|
2069
|
+
getOptions: A(this._options.getOptions, t)
|
|
2070
|
+
}), new kr(e, E(r.sheet), this._workbook, i);
|
|
1738
2071
|
}
|
|
1739
2072
|
async select(e) {
|
|
1740
2073
|
let t = [], n = null, r = this.getCoords();
|
|
@@ -1758,15 +2091,15 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1758
2091
|
}
|
|
1759
2092
|
getAddress(e) {
|
|
1760
2093
|
let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
|
|
1761
|
-
return
|
|
2094
|
+
return dt(this.getCoords(), {
|
|
1762
2095
|
...n,
|
|
1763
2096
|
scope: t.getName()
|
|
1764
|
-
},
|
|
2097
|
+
}, vt, Ne, e);
|
|
1765
2098
|
}
|
|
1766
2099
|
toString() {
|
|
1767
2100
|
return this.getAddress();
|
|
1768
2101
|
}
|
|
1769
|
-
},
|
|
2102
|
+
}, kr = class e extends Tt {
|
|
1770
2103
|
constructor(e, t, n, r) {
|
|
1771
2104
|
super(e, t, r), this._workbook = n;
|
|
1772
2105
|
}
|
|
@@ -1775,12 +2108,12 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1775
2108
|
return t && (n = {
|
|
1776
2109
|
...this._options,
|
|
1777
2110
|
getOptions: A(this._options?.getOptions, t)
|
|
1778
|
-
}), new
|
|
2111
|
+
}), new Or(e, this._internal, this._workbook, n);
|
|
1779
2112
|
}
|
|
1780
2113
|
_createRange(t, n) {
|
|
1781
2114
|
let r = this._internal;
|
|
1782
|
-
if (!t) return
|
|
1783
|
-
if (r.validateCoords(t), r.getSheet().isClosed()) return
|
|
2115
|
+
if (!t) return Xe(r.getSheet(), r.getSheet().getEntireCoords());
|
|
2116
|
+
if (r.validateCoords(t), r.getSheet().isClosed()) return Xe(null, r.getSheet().getEntireCoords(), t);
|
|
1784
2117
|
let i = this._options;
|
|
1785
2118
|
return n && (i = {
|
|
1786
2119
|
...this._options,
|
|
@@ -1797,7 +2130,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1797
2130
|
}
|
|
1798
2131
|
getAddress(e) {
|
|
1799
2132
|
let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
|
|
1800
|
-
return
|
|
2133
|
+
return vt(this.getCoords(), {
|
|
1801
2134
|
...n,
|
|
1802
2135
|
scope: t.getName()
|
|
1803
2136
|
});
|
|
@@ -1805,13 +2138,13 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1805
2138
|
toString() {
|
|
1806
2139
|
return this.getAddress();
|
|
1807
2140
|
}
|
|
1808
|
-
},
|
|
2141
|
+
}, Ar = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", jr = class {
|
|
1809
2142
|
constructor(e) {
|
|
1810
|
-
this._isLoadingSheets = !1, this._lastTransactionUUID = null, this._starting = null, this._closed = !1, this._listenerOriginProvider = null, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._pivotCaches = [], this._pivotTableCollection = new
|
|
2143
|
+
this._isLoadingSheets = !1, this._lastTransactionUUID = null, this._starting = null, this._closed = !1, this._listenerOriginProvider = null, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._pivotCaches = [], this._pivotTableCollection = new Se(() => {
|
|
1811
2144
|
let e = [];
|
|
1812
2145
|
for (let t of this.getSheets()) e.push(...t.getPivotTables());
|
|
1813
2146
|
return e;
|
|
1814
|
-
}), this._people = new
|
|
2147
|
+
}), this._people = new lr(), this._commentCollection = new Fe(null, (e, t, n) => {
|
|
1815
2148
|
let r = [];
|
|
1816
2149
|
for (let i of this.getSheets()) r.push(...i.getComments().getItems(e ? {
|
|
1817
2150
|
address: e,
|
|
@@ -1824,24 +2157,24 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1824
2157
|
return r;
|
|
1825
2158
|
}, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
|
|
1826
2159
|
e.onCollectionChange(this._commentCollection);
|
|
1827
|
-
} : void 0 }, t)), this.
|
|
2160
|
+
} : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._locale = null, this._localeOverrides = null;
|
|
1828
2161
|
let t = typeof e == "string" ? { origin: e } : { ...e }, n = t.origin;
|
|
1829
|
-
this._ownOriginProvider = !
|
|
2162
|
+
this._ownOriginProvider = !Ar(n), this._originProvider = Ar(n) ? n : new en(typeof n == "string" ? new V(null, { name: n }) : n ?? new V(null)), delete t.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
|
|
1830
2163
|
let r = t.json;
|
|
1831
|
-
delete t.json, this._transactions = t.transactions ?? new
|
|
2164
|
+
delete t.json, this._transactions = t.transactions ?? new _e(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new x(this, this._transactions), this._runtime = t.runtime ?? new Mt("Workbook Runtime", {
|
|
1832
2165
|
isDate1904: () => this._isDate1904,
|
|
1833
2166
|
getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
|
|
1834
|
-
getLocale: () => this._locale ??
|
|
2167
|
+
getLocale: () => this._locale ?? s() ?? be(),
|
|
1835
2168
|
getLocaleOverrides: () => this._localeOverrides
|
|
1836
|
-
}), this._listenerLanguage =
|
|
2169
|
+
}), this._listenerLanguage = Vt.addChangeListener(() => {
|
|
1837
2170
|
this._closed || this._notifyAllChange();
|
|
1838
2171
|
});
|
|
1839
|
-
let i = this, a = this._beginCommit({ description:
|
|
2172
|
+
let i = this, a = this._beginCommit({ description: z(r ? "op.openWorkbook" : "op.newWorkbook") });
|
|
1840
2173
|
try {
|
|
1841
|
-
this._strings = t.strings ?? new
|
|
2174
|
+
this._strings = t.strings ?? new d(), this._ownStrings = !t.strings, this._resources = t.resources ?? new de(), this._ownResources = !t.resources, this._createSheetName = t.createSheetNameCallback ?? Sr;
|
|
1842
2175
|
let e = t.createSheetCallback;
|
|
1843
|
-
e ||= (e) => new M(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, a, o, s) => {
|
|
1844
|
-
let
|
|
2176
|
+
e ||= (e) => new M(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, a, o, s, c) => {
|
|
2177
|
+
let l = null, u = {
|
|
1845
2178
|
runtime: i._runtime,
|
|
1846
2179
|
readonly: i._options.readonly ?? !1,
|
|
1847
2180
|
disableLoadAutoFit: i._options.disableLoadAutoFit ?? !1,
|
|
@@ -1856,64 +2189,64 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1856
2189
|
resolveRange: (e) => i._options.resolveRange?.(e) ?? i.getRange(e),
|
|
1857
2190
|
container: {
|
|
1858
2191
|
beforeFromJSON: (e) => {
|
|
1859
|
-
|
|
2192
|
+
l = e, i._addSheetRef({
|
|
1860
2193
|
name: n,
|
|
1861
2194
|
id: t,
|
|
1862
|
-
visibility: r ??
|
|
2195
|
+
visibility: r ?? j.Visibility.Visible,
|
|
1863
2196
|
sheetId: o,
|
|
1864
2197
|
sheet: e
|
|
1865
2198
|
}, a);
|
|
1866
2199
|
},
|
|
1867
2200
|
getName: () => {
|
|
1868
|
-
let e = i._getSheetRef(
|
|
2201
|
+
let e = i._getSheetRef(l);
|
|
1869
2202
|
return e ? e.name : n;
|
|
1870
2203
|
},
|
|
1871
2204
|
setName: (e, t) => {
|
|
1872
|
-
i._getSheetRef(
|
|
2205
|
+
i._getSheetRef(l) && i._setSheetName(l, e, t);
|
|
1873
2206
|
},
|
|
1874
2207
|
setNameChangeCallback: (e) => {
|
|
1875
2208
|
i._sheetOnNameChange.set(t, e);
|
|
1876
2209
|
},
|
|
1877
2210
|
getVisibility: () => {
|
|
1878
|
-
let e = i._getSheetRef(
|
|
1879
|
-
return e ? e.visibility :
|
|
2211
|
+
let e = i._getSheetRef(l);
|
|
2212
|
+
return e ? e.visibility : j.Visibility.Visible;
|
|
1880
2213
|
},
|
|
1881
2214
|
setVisibility: (e, t) => {
|
|
1882
|
-
i._setSheetVisibility(
|
|
2215
|
+
i._setSheetVisibility(l, e, t);
|
|
1883
2216
|
},
|
|
1884
2217
|
setVisibilityCallback: (e) => {
|
|
1885
2218
|
i._sheetOnVisibilityChange.set(t, e);
|
|
1886
2219
|
},
|
|
1887
|
-
duplicate: () => i._duplicateSheet(
|
|
2220
|
+
duplicate: () => i._duplicateSheet(l),
|
|
1888
2221
|
getIndex: () => {
|
|
1889
|
-
let e = i._getSheetRef(
|
|
1890
|
-
return e ? i._getOffsetForId(e.id, i._getSheetRefs(
|
|
2222
|
+
let e = i._getSheetRef(l);
|
|
2223
|
+
return e ? i._getOffsetForId(e.id, i._getSheetRefs(j.Visibility.VeryHidden)) : a;
|
|
1891
2224
|
},
|
|
1892
2225
|
setIndex: (e, t) => {
|
|
1893
|
-
let n = i._getSheetRef(
|
|
2226
|
+
let n = i._getSheetRef(l, j.Visibility.VeryHidden);
|
|
1894
2227
|
return !!n && (i._moveSheet(n, e, t), !0);
|
|
1895
2228
|
},
|
|
1896
2229
|
setIndexCallback: (e) => {
|
|
1897
2230
|
i._sheetOnIndexChange.set(t, e);
|
|
1898
2231
|
},
|
|
1899
|
-
requestSelect: async () => (i._setSelectedSheet(
|
|
2232
|
+
requestSelect: async () => (i._setSelectedSheet(l), await this._emitter.notify("onRequestSelect", {
|
|
1900
2233
|
source: i,
|
|
1901
|
-
params:
|
|
2234
|
+
params: l,
|
|
1902
2235
|
async: !0
|
|
1903
|
-
}), i.getSelectedSheet() ===
|
|
2236
|
+
}), i.getSelectedSheet() === l)
|
|
1904
2237
|
}
|
|
1905
2238
|
};
|
|
1906
|
-
return s && (
|
|
1907
|
-
}, this._namedTableSource = new
|
|
1908
|
-
getSheets: () => i._sheets ? i.getSheets().getItems() :
|
|
2239
|
+
return s && (u.json = s), c !== void 0 && (u.uid = () => c), l = e(u, n, a, r), l;
|
|
2240
|
+
}, this._namedTableSource = new we({
|
|
2241
|
+
getSheets: () => i._sheets ? i.getSheets().getItems() : P.EmptyArray,
|
|
1909
2242
|
addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: e }, t)
|
|
1910
|
-
}), this._names = t.names ?? new
|
|
2243
|
+
}), this._names = t.names ?? new tt({
|
|
1911
2244
|
addressToRanges: (e) => i.getRanges(e),
|
|
1912
2245
|
getCurrentScope: () => i.getSelectedSheet().getName(),
|
|
1913
2246
|
isReadOnly: () => (i._options.readonly ?? !1) || i._isStructureProtected(),
|
|
1914
2247
|
transactions: i._transactions,
|
|
1915
|
-
getSources: () => i._calculation ? [i._calculation.getNamedFormulas(), i._namedTableSource] :
|
|
1916
|
-
}), this._ownNames = !t.names, this._calculation = t.calculation ?? new
|
|
2248
|
+
getSources: () => i._calculation ? [i._calculation.getNamedFormulas(), i._namedTableSource] : P.EmptyArray
|
|
2249
|
+
}), this._ownNames = !t.names, this._calculation = t.calculation ?? new Ue({
|
|
1917
2250
|
runtime: i._runtime,
|
|
1918
2251
|
functions: t.functions,
|
|
1919
2252
|
json: r?.calc,
|
|
@@ -1932,19 +2265,19 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1932
2265
|
getSheetIndex: (e) => {
|
|
1933
2266
|
if (e === void 0) {
|
|
1934
2267
|
let e = i.getSelectedSheet();
|
|
1935
|
-
return e ? this._getSheetRefs(
|
|
2268
|
+
return e ? this._getSheetRefs(j.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
|
|
1936
2269
|
}
|
|
1937
|
-
let t = this._getSheetRefs(
|
|
2270
|
+
let t = this._getSheetRefs(j.Visibility.VeryHidden);
|
|
1938
2271
|
e = e.toLowerCase();
|
|
1939
2272
|
let n = t.length;
|
|
1940
2273
|
for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
|
|
1941
2274
|
try {
|
|
1942
|
-
|
|
1943
|
-
let t = this._names.getItems(
|
|
2275
|
+
Mr.address = e;
|
|
2276
|
+
let t = this._names.getItems(Mr);
|
|
1944
2277
|
if (!t || t.length === 0) return -1;
|
|
1945
2278
|
let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
|
|
1946
2279
|
if (!n) return -1;
|
|
1947
|
-
let r = this._getSheetRefs(
|
|
2280
|
+
let r = this._getSheetRefs(j.Visibility.VeryHidden);
|
|
1948
2281
|
n = n.toLowerCase();
|
|
1949
2282
|
let i = r.length;
|
|
1950
2283
|
for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
|
|
@@ -1953,16 +2286,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1953
2286
|
}
|
|
1954
2287
|
return -1;
|
|
1955
2288
|
},
|
|
1956
|
-
getSheetCount: () => i.getSheets().getItems({ visibility:
|
|
1957
|
-
getSheetIds: () => i._sheets?.getItems({ visibility: O.Visibility.VeryHidden }).map((e) => e.getId()) ?? [],
|
|
1958
|
-
addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: () => {
|
|
1959
|
-
i._restoringSheets || e();
|
|
1960
|
-
} }, t),
|
|
1961
|
-
getSheetById: (e) => {
|
|
1962
|
-
let t = i.getSheets().getItems({ visibility: O.Visibility.VeryHidden }), n = t.length;
|
|
1963
|
-
for (let r = 0; r < n; r++) if (t[r].getId() === e) return t[r];
|
|
1964
|
-
return null;
|
|
1965
|
-
},
|
|
2289
|
+
getSheetCount: () => i.getSheets().getItems({ visibility: j.Visibility.VeryHidden }).length,
|
|
1966
2290
|
externalBooks: r?.externalBooks,
|
|
1967
2291
|
externalBookResolver: t.externalBookResolver,
|
|
1968
2292
|
namedCollection: i._names,
|
|
@@ -1970,18 +2294,20 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
1970
2294
|
transactions: i._transactions,
|
|
1971
2295
|
names: r?.names
|
|
1972
2296
|
}), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(r?.modules), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
|
|
1973
|
-
let n =
|
|
2297
|
+
let n = r?.sheets?.length ? r.sheets.map((e) => e.name) : [this._createSheetName(0)], o = n.map((e) => e + "-" + P.uuidV4());
|
|
2298
|
+
this._calculation._setSheets(n.map((e, t) => [o[t], e]));
|
|
2299
|
+
let s = t.calcOnLoad ?? "auto", c = !1, l = (async () => {
|
|
1974
2300
|
try {
|
|
1975
|
-
if (this._ownCalculation &&
|
|
2301
|
+
if (this._ownCalculation && s !== "none" && (s === "full" || s === "auto" && !0 === r?.calc?.fullCalcOnLoad ? await this._calculation.calculate({ full: !0 }) : await this._calculation.start(), this._closed)) return;
|
|
1976
2302
|
await this._scripts.start();
|
|
1977
2303
|
} finally {
|
|
1978
|
-
|
|
2304
|
+
c = !0, this._starting = null;
|
|
1979
2305
|
}
|
|
1980
2306
|
})();
|
|
1981
|
-
|
|
2307
|
+
c || (this._starting = l), this._starting?.catch(() => {}), r ? this._fromJSON(r, o) : (this._initState(), this._addSheet(!1, n[0], null, o[0])), this._sheets = new yr((e) => i._addSheetOptions(e), (e, t) => {
|
|
1982
2308
|
if (e) {
|
|
1983
2309
|
let n = this._getSheetRef(e, t);
|
|
1984
|
-
return n ? [n.sheet] :
|
|
2310
|
+
return n ? [n.sheet] : P.EmptyArray;
|
|
1985
2311
|
}
|
|
1986
2312
|
return this._getSheets(t);
|
|
1987
2313
|
}, (e, t) => {
|
|
@@ -2004,22 +2330,14 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2004
2330
|
let e = this._getSheetRefs();
|
|
2005
2331
|
for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
|
|
2006
2332
|
let t = this._options;
|
|
2007
|
-
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new
|
|
2333
|
+
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new C().getDefaultTheme(), this._styles = t?.styles ?? new ce(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new gr()), this._listenerProtection?.(), this._protection = new vr(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
2008
2334
|
n._emitter.notify("onProtectionChange");
|
|
2009
2335
|
} });
|
|
2010
2336
|
let n = this;
|
|
2011
2337
|
this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
|
|
2012
2338
|
async onAfterStateChange(e, t, r, i, a) {
|
|
2013
|
-
let o = n._view, s = a?.[
|
|
2014
|
-
|
|
2015
|
-
n._restoringSheets = !0;
|
|
2016
|
-
try {
|
|
2017
|
-
n._emitter.notify("onSheetsChange");
|
|
2018
|
-
} finally {
|
|
2019
|
-
n._restoringSheets = !1;
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
|
|
2339
|
+
let o = n._view, s = a?.[Dr], c = r ? s?.before : s?.after, l = s?.viewId === o.getId() && c != null, u = l ? c : o.getActiveSheetId(), d = l && t.getId() === n._lastTransactionUUID ? n._getSheetRef({ id: u }) : null;
|
|
2340
|
+
d ? await d.sheet.select() : n._resyncActiveSheet(u, e), n._lastTransactionUUID = t.getId(), (r || i) && n._emitter.notify("onSheetsChange"), n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
|
|
2023
2341
|
},
|
|
2024
2342
|
onRestoreOrRevert() {
|
|
2025
2343
|
n._ownCalculation, n._emitter.notify("onInvalidated");
|
|
@@ -2073,8 +2391,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2073
2391
|
return this._view;
|
|
2074
2392
|
}
|
|
2075
2393
|
setView(e) {
|
|
2076
|
-
if (this._closed) throw Error(
|
|
2077
|
-
if (!e) throw new
|
|
2394
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2395
|
+
if (!e) throw new I(B("error.sheet.emptyView"));
|
|
2078
2396
|
this._listenerWorkbookView?.();
|
|
2079
2397
|
let t = this, n = -1;
|
|
2080
2398
|
return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
|
|
@@ -2086,7 +2404,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2086
2404
|
return this._runtime;
|
|
2087
2405
|
}
|
|
2088
2406
|
setDate1904(e) {
|
|
2089
|
-
if (this._closed) throw Error(
|
|
2407
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2090
2408
|
return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
|
|
2091
2409
|
}
|
|
2092
2410
|
getLocale() {
|
|
@@ -2096,11 +2414,11 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2096
2414
|
return this._locale;
|
|
2097
2415
|
}
|
|
2098
2416
|
setLocale(e) {
|
|
2099
|
-
if (this._closed) throw Error(
|
|
2417
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2100
2418
|
if (e) try {
|
|
2101
2419
|
new Intl.Locale(e);
|
|
2102
2420
|
} catch {
|
|
2103
|
-
throw Error(
|
|
2421
|
+
throw Error(B("error.workbook.invalidLocale", { locale: e }));
|
|
2104
2422
|
}
|
|
2105
2423
|
return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
|
|
2106
2424
|
}
|
|
@@ -2108,7 +2426,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2108
2426
|
return this._localeOverrides;
|
|
2109
2427
|
}
|
|
2110
2428
|
setLocaleOverrides(e) {
|
|
2111
|
-
if (this._closed) throw Error(
|
|
2429
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2112
2430
|
let t = e && Object.keys(e).length > 0 ? e : null;
|
|
2113
2431
|
return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
|
|
2114
2432
|
}
|
|
@@ -2131,7 +2449,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2131
2449
|
return this._updateLinks;
|
|
2132
2450
|
}
|
|
2133
2451
|
setUpdateLinks(e) {
|
|
2134
|
-
if (this._closed) throw Error(
|
|
2452
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2135
2453
|
return this._updateLinks = e, this;
|
|
2136
2454
|
}
|
|
2137
2455
|
getPivotTables() {
|
|
@@ -2147,8 +2465,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2147
2465
|
return this._theme;
|
|
2148
2466
|
}
|
|
2149
2467
|
setTheme(e) {
|
|
2150
|
-
if (this._closed) throw Error(
|
|
2151
|
-
if (!e) throw new
|
|
2468
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2469
|
+
if (!e) throw new I(B("error.workbook.notSetValue"));
|
|
2152
2470
|
let t = this._theme;
|
|
2153
2471
|
return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
|
|
2154
2472
|
}
|
|
@@ -2159,17 +2477,17 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2159
2477
|
let e = this._getSheetRef(this.getSelectedSheetIndex());
|
|
2160
2478
|
return e ? e?.sheet : null;
|
|
2161
2479
|
}
|
|
2162
|
-
getSheet(e, t =
|
|
2480
|
+
getSheet(e, t = j.Visibility.Visible) {
|
|
2163
2481
|
if (e === void 0) return this.getSelectedSheet();
|
|
2164
|
-
if (!e) throw Error(
|
|
2482
|
+
if (!e) throw Error(B("error.workbook.sheetNameNotProvided"));
|
|
2165
2483
|
let n = this._getSheetRef(e, t);
|
|
2166
|
-
if (!n) throw new
|
|
2484
|
+
if (!n) throw new L(B("error.workbook.sheetNameNotFound", { sheetName: e }));
|
|
2167
2485
|
return n.sheet;
|
|
2168
2486
|
}
|
|
2169
|
-
getSheetAt(e, t =
|
|
2487
|
+
getSheetAt(e, t = j.Visibility.Visible) {
|
|
2170
2488
|
let n = this._getSheetRef(e, t);
|
|
2171
|
-
if (!n) throw new
|
|
2172
|
-
return
|
|
2489
|
+
if (!n) throw new L(function(e) {
|
|
2490
|
+
return B("error.workbook.sheetIndexNotFound", { index: e });
|
|
2173
2491
|
}(e));
|
|
2174
2492
|
return n.sheet;
|
|
2175
2493
|
}
|
|
@@ -2179,32 +2497,32 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2179
2497
|
addSheet(e) {
|
|
2180
2498
|
return this.getSheets().add(e);
|
|
2181
2499
|
}
|
|
2182
|
-
_getSheets(e =
|
|
2500
|
+
_getSheets(e = j.Visibility.Visible) {
|
|
2183
2501
|
let t = this._getSheetRefs(e), n = [], r = t.length;
|
|
2184
2502
|
for (let e = 0; e < r; e++) n.push(t[e].sheet);
|
|
2185
2503
|
return n;
|
|
2186
2504
|
}
|
|
2187
|
-
_getSheetRefs(e =
|
|
2505
|
+
_getSheetRefs(e = j.Visibility.Visible) {
|
|
2188
2506
|
let t = this._getState();
|
|
2189
|
-
return t ? e ===
|
|
2507
|
+
return t ? e === j.Visibility.Visible ? t.sheetRefsVisible : e === j.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === j.Visibility.VeryHidden ? t.sheetRefsAll : P.EmptyArray : [];
|
|
2190
2508
|
}
|
|
2191
|
-
_getSheetRef(e, t =
|
|
2509
|
+
_getSheetRef(e, t = j.Visibility.Visible) {
|
|
2192
2510
|
let n = null;
|
|
2193
2511
|
return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof M ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
|
|
2194
2512
|
}
|
|
2195
2513
|
_validateNewSheetName(e, t = !0) {
|
|
2196
2514
|
if (e == null) return e;
|
|
2197
|
-
if (
|
|
2515
|
+
if (wr(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new I(B("error.workbook.nameTaken"));
|
|
2198
2516
|
return e.substring(0, 31);
|
|
2199
2517
|
}
|
|
2200
2518
|
findValidSheetName(e) {
|
|
2201
|
-
e &&=
|
|
2519
|
+
e &&= wr(e, !0);
|
|
2202
2520
|
try {
|
|
2203
2521
|
return function(e, t) {
|
|
2204
2522
|
try {
|
|
2205
2523
|
if (t(e)) return e;
|
|
2206
2524
|
} catch {}
|
|
2207
|
-
let n, r, i =
|
|
2525
|
+
let n, r, i = xr.exec(e);
|
|
2208
2526
|
for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
|
|
2209
2527
|
r++;
|
|
2210
2528
|
let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
|
|
@@ -2219,25 +2537,25 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2219
2537
|
}
|
|
2220
2538
|
}
|
|
2221
2539
|
isValidSheetNameCharacter(e) {
|
|
2222
|
-
return !
|
|
2540
|
+
return !br.test(e);
|
|
2223
2541
|
}
|
|
2224
2542
|
_isStructureProtected() {
|
|
2225
2543
|
return !this._initializing && !this.getProtection().isStructureAllowed();
|
|
2226
2544
|
}
|
|
2227
2545
|
_addSheetOptions(e) {
|
|
2228
|
-
if (this._closed) throw Error(
|
|
2229
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2546
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2547
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2230
2548
|
let t, n = null;
|
|
2231
2549
|
t = typeof e == "string" ? { name: e } : typeof e == "number" ? { index: e } : e, t = {
|
|
2232
2550
|
...t,
|
|
2233
|
-
description: t?.description ??
|
|
2551
|
+
description: t?.description ?? z("op.addSheet")
|
|
2234
2552
|
};
|
|
2235
2553
|
let r = this.beginCommit(t);
|
|
2236
2554
|
try {
|
|
2237
2555
|
let e = t?.autoSelect ?? !1;
|
|
2238
2556
|
n = this._addSheet(!0, t.name, t.index ?? null);
|
|
2239
2557
|
let i = this.getView().getActiveSheetId();
|
|
2240
|
-
if (e && this._recordActiveSheet(r, i, this._getSheetRef(n).id), r.commit({ description:
|
|
2558
|
+
if (e && this._recordActiveSheet(r, i, this._getSheetRef(n).id), r.commit({ description: B("op.addSheetNamed", { name: n.getName() }) }), !1 !== e) {
|
|
2241
2559
|
let t = typeof e == "boolean" ? void 0 : e;
|
|
2242
2560
|
n.select(t);
|
|
2243
2561
|
}
|
|
@@ -2248,8 +2566,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2248
2566
|
}
|
|
2249
2567
|
_nextSheetName(e = null) {
|
|
2250
2568
|
let t = e ? e.toLowerCase() : null, n = this._getState(), r = n.sheetsByLowerCaseName;
|
|
2251
|
-
if (e && r.has(t)) throw new
|
|
2252
|
-
return
|
|
2569
|
+
if (e && r.has(t)) throw new I(function(e) {
|
|
2570
|
+
return B("error.workbook.nameDuplicate", { sheetName: e });
|
|
2253
2571
|
}(e));
|
|
2254
2572
|
t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
|
|
2255
2573
|
let i = n.lastId + 1;
|
|
@@ -2259,23 +2577,28 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2259
2577
|
}
|
|
2260
2578
|
return this._updateState({ lastId: i }), e;
|
|
2261
2579
|
}
|
|
2262
|
-
_addSheet(e, t = null, n = null) {
|
|
2580
|
+
_addSheet(e, t = null, n = null, r) {
|
|
2263
2581
|
t = this._nextSheetName(t);
|
|
2264
|
-
let
|
|
2265
|
-
if (!
|
|
2266
|
-
return e && this._emitter.notify("onSheetsChange"),
|
|
2582
|
+
let i = this._getState(), a = this._createSheet(i.lastId, t, j.Visibility.Visible, n, void 0, null, r);
|
|
2583
|
+
if (!a) throw new I(B("error.workbook.sheetNameBlank"));
|
|
2584
|
+
return e && (this._tellSheets(), this._emitter.notify("onSheetsChange")), a;
|
|
2267
2585
|
}
|
|
2268
2586
|
_updateSheetRefStates(e) {
|
|
2269
|
-
if (this._closed) throw Error(
|
|
2270
|
-
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new B(
|
|
2587
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2588
|
+
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2271
2589
|
let t = e, n = [], r = [], i = t.length;
|
|
2272
|
-
for (let e = 0; e < i; e++) t[e].visibility ===
|
|
2590
|
+
for (let e = 0; e < i; e++) t[e].visibility === j.Visibility.Visible ? (n.push(t[e]), r.push(t[e])) : t[e].visibility === j.Visibility.Hidden && r.push(t[e]);
|
|
2273
2591
|
this._updateState({
|
|
2274
2592
|
sheetRefsAll: t,
|
|
2275
2593
|
sheetRefsVisible: n,
|
|
2276
2594
|
sheetRefsVisibleAndHidden: r
|
|
2277
2595
|
});
|
|
2278
2596
|
}
|
|
2597
|
+
_tellSheets() {
|
|
2598
|
+
if (this._isLoadingSheets) return;
|
|
2599
|
+
let e = this._getState().sheetRefsAll;
|
|
2600
|
+
this._calculation._setSheets(e.map((e) => [e.sheet.getId(), e.name]));
|
|
2601
|
+
}
|
|
2279
2602
|
_addSheetRef(e, t = null) {
|
|
2280
2603
|
let n = this._getState(), r = n.sheetRefsAll, i = Math.max(0, Math.min(r.length, t ?? r.length)), a = [
|
|
2281
2604
|
...r.slice(0, i),
|
|
@@ -2300,9 +2623,9 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2300
2623
|
p._validateDeleteSheet(e);
|
|
2301
2624
|
},
|
|
2302
2625
|
onDelete(e) {
|
|
2303
|
-
let t = p._getSheetRef(e,
|
|
2626
|
+
let t = p._getSheetRef(e, j.Visibility.VeryHidden);
|
|
2304
2627
|
if (!t) return;
|
|
2305
|
-
let n = p._beginCommit({ description:
|
|
2628
|
+
let n = p._beginCommit({ description: B("op.deleteSheet", { name: t.name }) });
|
|
2306
2629
|
try {
|
|
2307
2630
|
let r = p._getState(), i = r.sheetRefsAll, a = p._getOffsetForId(t.id, i), s = [...i];
|
|
2308
2631
|
s.splice(a, 1), p._updateSheetRefStates(s);
|
|
@@ -2317,7 +2640,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2317
2640
|
let m = new Map(r.refsByInstance);
|
|
2318
2641
|
m.delete(e), r.listenersSheets.get(t.id)();
|
|
2319
2642
|
let h = new Map(r.listenersSheets);
|
|
2320
|
-
h.delete(t.id), p._adjustRemoveSelectionIfRequired(a, t.id), p._adjustSheetNamesIfRequired(), p._sheetOnNameChange.delete(t.id), p._sheetOnVisibilityChange.delete(t.id), p._sheetOnIndexChange.delete(t.id), p._emitter.notify("onSheetsChange");
|
|
2643
|
+
h.delete(t.id), p._adjustRemoveSelectionIfRequired(a, t.id), p._adjustSheetNamesIfRequired(), p._sheetOnNameChange.delete(t.id), p._sheetOnVisibilityChange.delete(t.id), p._sheetOnIndexChange.delete(t.id), p._tellSheets(), p._emitter.notify("onSheetsChange");
|
|
2321
2644
|
let g = new Set(r.sheetsCreated);
|
|
2322
2645
|
g.has(o) && g.delete(o), p._updateState({
|
|
2323
2646
|
refsById: c,
|
|
@@ -2352,11 +2675,11 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2352
2675
|
listenersSheets: m
|
|
2353
2676
|
}), this._adjustSheetNamesIfRequired();
|
|
2354
2677
|
let g = new Set(this._getState().sheetsCreated);
|
|
2355
|
-
return g.add(e.sheet), this._updateState({ sheetsCreated: g }), e;
|
|
2678
|
+
return g.add(e.sheet), this._updateState({ sheetsCreated: g }), this._tellSheets(), e;
|
|
2356
2679
|
}
|
|
2357
2680
|
_recordActiveSheet(e, t, n) {
|
|
2358
2681
|
let r = this.getView().getId();
|
|
2359
|
-
e.setIntent(
|
|
2682
|
+
e.setIntent(Dr, (e) => ({
|
|
2360
2683
|
viewId: r,
|
|
2361
2684
|
before: e?.before ?? t,
|
|
2362
2685
|
after: n
|
|
@@ -2386,25 +2709,25 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2386
2709
|
let n = this._view.getActiveSheetId();
|
|
2387
2710
|
n ??= (this._view.setActiveSheetId(t), t);
|
|
2388
2711
|
let r = e.refsById.get(n);
|
|
2389
|
-
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility ===
|
|
2712
|
+
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === j.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
|
|
2390
2713
|
}
|
|
2391
2714
|
_validateDeleteSheet(e) {
|
|
2392
|
-
if (this._closed) throw Error(
|
|
2393
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2715
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2716
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2394
2717
|
let t = this._getSheetRef(e);
|
|
2395
|
-
if (!t) throw new
|
|
2396
|
-
return
|
|
2718
|
+
if (!t) throw new I(function(e) {
|
|
2719
|
+
return B("error.workbook.deleteKey", { key: e });
|
|
2397
2720
|
}(e));
|
|
2398
2721
|
let n = this._getState().sheetRefsVisible;
|
|
2399
|
-
if (n.length === 1 && n[0].id === t.id) throw new
|
|
2722
|
+
if (n.length === 1 && n[0].id === t.id) throw new I(B("error.workbook.sheetOne"));
|
|
2400
2723
|
}
|
|
2401
2724
|
_getOffsetForId(e, t) {
|
|
2402
2725
|
let n = t.length;
|
|
2403
2726
|
for (let r = 0; r < n; r++) if (t[r].id === e) return r;
|
|
2404
|
-
throw new
|
|
2727
|
+
throw new I(B("error.workbook.noVisibleRefs"));
|
|
2405
2728
|
}
|
|
2406
2729
|
find(e) {
|
|
2407
|
-
if (this._closed) throw Error(
|
|
2730
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2408
2731
|
let t = this._getSheets();
|
|
2409
2732
|
if (t.length === 1) return t[0].find(e);
|
|
2410
2733
|
typeof e == "string" && (e = { text: e });
|
|
@@ -2421,7 +2744,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2421
2744
|
rowIndex: t[0].rowStart
|
|
2422
2745
|
};
|
|
2423
2746
|
}
|
|
2424
|
-
let f =
|
|
2747
|
+
let f = F.createCellComparator(e?.axis, e?.reverse);
|
|
2425
2748
|
delete (e = { ...e }).from;
|
|
2426
2749
|
let p = () => {
|
|
2427
2750
|
if (!d && u.done && (s && a === i ? d = !0 : n ? (a++, a > t.length - 1 && (a = 0, s = !0)) : (a--, a < 0 && (a = t.length - 1, s = !0)), r && s && (d = !0), d || c || !s || a !== i || (d = !0), !d)) {
|
|
@@ -2431,7 +2754,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2431
2754
|
}
|
|
2432
2755
|
if (!d && s && a === i && (u.done || !c || !u.done && f(u.value.getCoords(), c) >= 0) && (d = !0), d) {
|
|
2433
2756
|
let e = u;
|
|
2434
|
-
return u =
|
|
2757
|
+
return u = Ie, e;
|
|
2435
2758
|
}
|
|
2436
2759
|
let p = u;
|
|
2437
2760
|
return u = l.next(), p;
|
|
@@ -2443,24 +2766,24 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2443
2766
|
} };
|
|
2444
2767
|
}
|
|
2445
2768
|
replace(e, t, n) {
|
|
2446
|
-
let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ?
|
|
2769
|
+
let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ? nt(t) : null, u = n?.description ?? z("op.replace"), d = this._transactions.beginCommit({ description: u });
|
|
2447
2770
|
try {
|
|
2448
|
-
let u = null,
|
|
2771
|
+
let u = null, f = null, p = e.next();
|
|
2449
2772
|
for (; !p.done && r < o;) {
|
|
2450
2773
|
let o = p.value, s = o.getSheet();
|
|
2451
|
-
s !== u && (u = s,
|
|
2774
|
+
s !== u && (u = s, f !== null && f.apply(), f = u.getEntireRange().createSparseBuilder({
|
|
2452
2775
|
axis: n?.axis,
|
|
2453
2776
|
allowUnorderedWrites: !0
|
|
2454
2777
|
}));
|
|
2455
2778
|
let c = a ? t(o) : t;
|
|
2456
|
-
c !== void 0 && c !== o && (
|
|
2779
|
+
c !== void 0 && c !== o && (f.push(o, c), r++, i = o), p = e.next();
|
|
2457
2780
|
}
|
|
2458
|
-
|
|
2781
|
+
f?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? d.rollback() : d.commit({ description: n?.description ?? (s ? l === null ? z("op.replaceAll") : B("op.replaceAllWith", { value: l }) : c ? l === null ? B("op.replaceAt", { address: c }) : B("op.replaceAtWith", {
|
|
2459
2782
|
address: c,
|
|
2460
2783
|
value: l
|
|
2461
|
-
}) : l === null ?
|
|
2784
|
+
}) : l === null ? z("op.replace") : B("op.replaceWith", { value: l })) });
|
|
2462
2785
|
} catch (e) {
|
|
2463
|
-
throw
|
|
2786
|
+
throw d.rollback(), e;
|
|
2464
2787
|
}
|
|
2465
2788
|
return {
|
|
2466
2789
|
count: r,
|
|
@@ -2476,27 +2799,27 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2476
2799
|
return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) <= 0 ? n - 1 : e - 1);
|
|
2477
2800
|
}
|
|
2478
2801
|
getNextSheet(e) {
|
|
2479
|
-
if (this._closed) throw Error(
|
|
2802
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2480
2803
|
let t = this._getSheetRefs();
|
|
2481
2804
|
return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
|
|
2482
2805
|
}
|
|
2483
2806
|
getPreviousSheet(e) {
|
|
2484
|
-
if (this._closed) throw Error(
|
|
2807
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2485
2808
|
let t = this._getSheetRefs();
|
|
2486
2809
|
return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
|
|
2487
2810
|
}
|
|
2488
2811
|
async _duplicateSheet(e) {
|
|
2489
|
-
if (this._closed) throw Error(
|
|
2490
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2812
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2813
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2491
2814
|
let t = this._getSheetRefs(), n = this.getSelectedSheetIndex(), r = null;
|
|
2492
2815
|
if (e) {
|
|
2493
|
-
if (r = this._getSheetRef(e), !r) throw new
|
|
2816
|
+
if (r = this._getSheetRef(e), !r) throw new I(Z(r));
|
|
2494
2817
|
} else r = t[n];
|
|
2495
2818
|
if (!r) return null;
|
|
2496
|
-
let i = r.sheet, a = this._strings.beginPersist(), o = this.getResources().beginPersist(), s = this.getStyles().beginPersist(), c = null, l = this.beginCommit(
|
|
2819
|
+
let i = r.sheet, a = this._strings.beginPersist(), o = this.getResources().beginPersist(), s = this.getStyles().beginPersist(), c = null, l = this.beginCommit(B("op.duplicateNamed", { name: i.getName() }));
|
|
2497
2820
|
try {
|
|
2498
2821
|
let e = this._getState().refsByInstance.get(i), r = await i.toJSON(), a = t.length + 1, o = this.findValidSheetName(e.name), s = this._createSheet(a, o, e.visibility, n, void 0, r);
|
|
2499
|
-
this._emitter.notify("onSheetsChange"), c = s, l.commit();
|
|
2822
|
+
this._tellSheets(), this._emitter.notify("onSheetsChange"), c = s, l.commit();
|
|
2500
2823
|
} catch (e) {
|
|
2501
2824
|
throw l.rollback(), e;
|
|
2502
2825
|
} finally {
|
|
@@ -2504,59 +2827,59 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2504
2827
|
}
|
|
2505
2828
|
return c;
|
|
2506
2829
|
}
|
|
2507
|
-
_createRange(e,
|
|
2508
|
-
let
|
|
2509
|
-
if (!
|
|
2830
|
+
_createRange(e, t) {
|
|
2831
|
+
let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, j.Visibility.VeryHidden) : null;
|
|
2832
|
+
if (!r) {
|
|
2510
2833
|
let e = this.getSelectedSheet();
|
|
2511
|
-
return e ? (delete
|
|
2512
|
-
scope:
|
|
2834
|
+
return e ? (delete n?.scope, Cr(n, n ? {
|
|
2835
|
+
scope: Ct,
|
|
2513
2836
|
...e.getEntireRange().getCoords()
|
|
2514
|
-
} : null)) : void console.warn(
|
|
2837
|
+
} : null)) : void console.warn(B("error.workbook.noVisibleRefs"));
|
|
2515
2838
|
}
|
|
2516
|
-
let
|
|
2517
|
-
return
|
|
2839
|
+
let i = r.sheet, a = null;
|
|
2840
|
+
return t && (a = { getOptions: t }), new kr(e, E(i), this, a);
|
|
2518
2841
|
}
|
|
2519
2842
|
_createRanges(e, t) {
|
|
2520
2843
|
let n = this.getSelectedSheet(), r = null;
|
|
2521
|
-
return t && (r = { getOptions: t }), new
|
|
2844
|
+
return t && (r = { getOptions: t }), new Or(e, E(n), this, r);
|
|
2522
2845
|
}
|
|
2523
2846
|
getRange(e, t) {
|
|
2524
2847
|
if (e === void 0) return this.getSelectedRange(t);
|
|
2525
2848
|
try {
|
|
2526
2849
|
let n = this._rangesAddressToCoords(e);
|
|
2527
|
-
if (n.length !== 1) throw new
|
|
2850
|
+
if (n.length !== 1) throw new I(B("error.address.singleRangeOnlyAlt"));
|
|
2528
2851
|
return this._createRange(n[0], t);
|
|
2529
2852
|
} catch (t) {
|
|
2530
|
-
throw t instanceof
|
|
2853
|
+
throw t instanceof L ? new L(t.message) : new I(t.message ?? et(e));
|
|
2531
2854
|
}
|
|
2532
2855
|
}
|
|
2533
2856
|
getCell(e) {
|
|
2534
2857
|
if (e === void 0) return this.getSelectedCell();
|
|
2535
2858
|
let t = this.getRange(e);
|
|
2536
|
-
if (t.size > 1) throw new
|
|
2859
|
+
if (t.size > 1) throw new I(B("error.address.singleCellOnly"));
|
|
2537
2860
|
return t.getCell();
|
|
2538
2861
|
}
|
|
2539
2862
|
getRanges(e, t) {
|
|
2540
2863
|
let n = this._rangesAddressToCoords(e);
|
|
2541
|
-
if (n.length === 0) throw new
|
|
2864
|
+
if (n.length === 0) throw new I(et(e));
|
|
2542
2865
|
return this._createRanges(n, t);
|
|
2543
2866
|
}
|
|
2544
2867
|
_createGraphRanges(e, t) {
|
|
2545
2868
|
let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
|
|
2546
2869
|
for (let e = 0; e < t.length; e++) {
|
|
2547
|
-
let i = t[e], a = (i.sheetName ? this._getSheetRef(i.sheetName,
|
|
2548
|
-
a && n.push(new
|
|
2870
|
+
let i = t[e], a = (i.sheetName ? this._getSheetRef(i.sheetName, j.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
|
|
2871
|
+
a && n.push(new Ae(i, r, E(a), null));
|
|
2549
2872
|
}
|
|
2550
2873
|
for (let t = 0; t < e.length; t++) n.push(e[t]);
|
|
2551
|
-
return n.length === 0 ? null : new
|
|
2874
|
+
return n.length === 0 ? null : new Or(n, E(this.getSelectedSheet()), this, null);
|
|
2552
2875
|
}
|
|
2553
2876
|
getStats(e) {
|
|
2554
|
-
if (this._closed) throw Error(
|
|
2555
|
-
let t = this._getSheets(
|
|
2877
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2878
|
+
let t = this._getSheets(j.Visibility.VeryHidden), n = t.length;
|
|
2556
2879
|
if (n === 1) return t[0].getStats(e);
|
|
2557
2880
|
let r = Array(n);
|
|
2558
2881
|
for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
|
|
2559
|
-
return new
|
|
2882
|
+
return new ar(r);
|
|
2560
2883
|
}
|
|
2561
2884
|
_activeRangeCoords() {
|
|
2562
2885
|
let e = this.getSelectedSheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
|
|
@@ -2581,8 +2904,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2581
2904
|
getSelectedCell() {
|
|
2582
2905
|
return this.getSelectedSheet().getSelectedCell();
|
|
2583
2906
|
}
|
|
2584
|
-
_rangesAddressToCoords(e, t = !0, n =
|
|
2585
|
-
if (!e) throw new
|
|
2907
|
+
_rangesAddressToCoords(e, t = !0, n = j.Visibility.Hidden) {
|
|
2908
|
+
if (!e) throw new I(B("error.address.noAddress"));
|
|
2586
2909
|
let r = this.getSelectedSheet(), i = { ...r?.getEntireRange().getCoords() }, a = r?.getName();
|
|
2587
2910
|
if (a && (i.scope = a), typeof e == "string") {
|
|
2588
2911
|
let t = e.trim().toLowerCase();
|
|
@@ -2591,22 +2914,22 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2591
2914
|
t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
|
|
2592
2915
|
}
|
|
2593
2916
|
}
|
|
2594
|
-
let o = this, s =
|
|
2917
|
+
let o = this, s = Ze(e, i, ft, (e) => {
|
|
2595
2918
|
if (!t) return null;
|
|
2596
2919
|
if (typeof e == "string") {
|
|
2597
2920
|
let t = o.getNames().getByName(e)?.getRanges?.();
|
|
2598
2921
|
if (t) return t.getCoords();
|
|
2599
2922
|
}
|
|
2600
|
-
throw new
|
|
2923
|
+
throw new I(`Invalid sheet reference '${e}'.`);
|
|
2601
2924
|
}), c = s.length;
|
|
2602
2925
|
for (let e = 0; e < c; e++) this._validateCoords(s[e], n);
|
|
2603
2926
|
return s;
|
|
2604
2927
|
}
|
|
2605
|
-
_validateCoords(e, t =
|
|
2928
|
+
_validateCoords(e, t = j.Visibility.Visible, n = B("error.sheet.oobRange")) {
|
|
2606
2929
|
if (e === null) return;
|
|
2607
2930
|
let r = this.getSheet(e.scope, t).getEntireRange().getCoords();
|
|
2608
|
-
if (!
|
|
2609
|
-
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new
|
|
2931
|
+
if (!F.isRangeWithinRange(e, r)) throw new L(n);
|
|
2932
|
+
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new I(B("error.address.invalidRangeInverted"));
|
|
2610
2933
|
}
|
|
2611
2934
|
_updateSheetRef(e, t) {
|
|
2612
2935
|
let n = this._getState(), r = [...n.sheetRefsAll];
|
|
@@ -2623,19 +2946,19 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2623
2946
|
refsByLowerCaseName: s,
|
|
2624
2947
|
sheetsByLowerCaseName: c,
|
|
2625
2948
|
refsByInstance: u
|
|
2626
|
-
}), t;
|
|
2949
|
+
}), this._tellSheets(), t;
|
|
2627
2950
|
}
|
|
2628
2951
|
_setSheetName(e, t, n) {
|
|
2629
|
-
if (this._closed) throw Error(
|
|
2630
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2952
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2953
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2631
2954
|
let r = this._getSheetRef(e);
|
|
2632
|
-
if (!r) throw new
|
|
2955
|
+
if (!r) throw new I(Z(e));
|
|
2633
2956
|
if (t === r.name) return r.sheet;
|
|
2634
|
-
if ((t = this._validateNewSheetName(t)) == null) throw new
|
|
2957
|
+
if ((t = this._validateNewSheetName(t)) == null) throw new I(B("error.workbook.sheetNameNotProvided"));
|
|
2635
2958
|
let i = Object.freeze({
|
|
2636
2959
|
...r,
|
|
2637
2960
|
name: t
|
|
2638
|
-
}), a = null, o = this.beginCommit(
|
|
2961
|
+
}), a = null, o = this.beginCommit(z("op.renameSheet"));
|
|
2639
2962
|
try {
|
|
2640
2963
|
let e = this._updateSheetRef(r, i);
|
|
2641
2964
|
this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
|
|
@@ -2646,23 +2969,23 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2646
2969
|
}
|
|
2647
2970
|
return a;
|
|
2648
2971
|
}
|
|
2649
|
-
_setSheetVisibility(e, t =
|
|
2650
|
-
if (this._closed) throw Error(
|
|
2651
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2652
|
-
let r = this._getSheetRef(e,
|
|
2972
|
+
_setSheetVisibility(e, t = j.Visibility.Visible, n) {
|
|
2973
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2974
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2975
|
+
let r = this._getSheetRef(e, j.Visibility.VeryHidden);
|
|
2653
2976
|
if (!r) return null;
|
|
2654
2977
|
if (t === r.visibility) return;
|
|
2655
2978
|
let i = null, a = "";
|
|
2656
|
-
t ===
|
|
2979
|
+
t === j.Visibility.Visible ? a = z("op.unhideSheet") : t === j.Visibility.Hidden ? a = z("op.hideSheet") : t === j.Visibility.VeryHidden && (a = z("op.veryHideSheet"));
|
|
2657
2980
|
let o = this.beginCommit(a);
|
|
2658
2981
|
try {
|
|
2659
2982
|
let e = this._getState().sheetRefsVisible;
|
|
2660
|
-
if (t !==
|
|
2983
|
+
if (t !== j.Visibility.Visible && e.length === 1 && e[0].id === r.id) throw new I(B("error.workbook.sheetOne"));
|
|
2661
2984
|
let a = {
|
|
2662
2985
|
...r,
|
|
2663
2986
|
visibility: t
|
|
2664
2987
|
}, s = -1;
|
|
2665
|
-
t !==
|
|
2988
|
+
t !== j.Visibility.Visible && (s = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, a).sheet, t !== j.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, r.id), this._adjustSheetNamesIfRequired(), o.commit(n);
|
|
2666
2989
|
} catch (e) {
|
|
2667
2990
|
throw o.rollback(), e;
|
|
2668
2991
|
}
|
|
@@ -2671,29 +2994,29 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2671
2994
|
}), this._emitter.notify("onSheetsChange"), i;
|
|
2672
2995
|
}
|
|
2673
2996
|
_moveSheet(e, t, n) {
|
|
2674
|
-
if (this._closed) throw Error(
|
|
2675
|
-
if (!this.getProtection().isStructureAllowed()) throw new B(
|
|
2676
|
-
let r = null, i = this.beginCommit(
|
|
2997
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2998
|
+
if (!this.getProtection().isStructureAllowed()) throw new R(B("error.workbook.protection"));
|
|
2999
|
+
let r = null, i = this.beginCommit(B("op.moveSheetNamed", { name: e.name }));
|
|
2677
3000
|
try {
|
|
2678
3001
|
let a = this._getState(), o = a.sheetRefsVisible;
|
|
2679
|
-
if (t < 0 || t > o.length - 1) throw new
|
|
3002
|
+
if (t < 0 || t > o.length - 1) throw new I(`Invalid to index: ${t}`);
|
|
2680
3003
|
let s = this.getView().getActiveSheetId(), c = a.sheetRefsAll, l = this._getOffsetForId(e.id, c), u = this._getOffsetForId(o[t].id, c);
|
|
2681
3004
|
if (l === u) return;
|
|
2682
3005
|
let d = c[l], f = [...c];
|
|
2683
3006
|
f.splice(l, 1), f.splice(u, 0, d), this._updateSheetRefStates(f), this._calculation._replaceSheetSpans?.(c.map((e) => e.sheet.getId()), f.map((e) => e.sheet.getId()), d.sheet.getId()), this._adjustSheetNamesIfRequired(), this._sheetOnIndexChange.forEach((e, t) => {
|
|
2684
3007
|
t >= l && t <= u && e();
|
|
2685
|
-
}), this._emitter.notify("onSheetsChange"), r = d.sheet, this._recordActiveSheet(i, s, this.getView().getActiveSheetId()), i.commit(n);
|
|
3008
|
+
}), this._tellSheets(), this._emitter.notify("onSheetsChange"), r = d.sheet, this._recordActiveSheet(i, s, this.getView().getActiveSheetId()), i.commit(n);
|
|
2686
3009
|
} catch (e) {
|
|
2687
3010
|
throw i.rollback(), e;
|
|
2688
3011
|
}
|
|
2689
3012
|
return r;
|
|
2690
3013
|
}
|
|
2691
3014
|
_setSelectedSheet(e) {
|
|
2692
|
-
if (this._closed) throw Error(
|
|
3015
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2693
3016
|
let t = this._getSheetRef(e);
|
|
2694
|
-
if (!t) throw new
|
|
3017
|
+
if (!t) throw new I(Z(e));
|
|
2695
3018
|
let n = null;
|
|
2696
|
-
return t.visibility !==
|
|
3019
|
+
return t.visibility !== j.Visibility.Visible && this._setSheetVisibility(t, j.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
|
|
2697
3020
|
}
|
|
2698
3021
|
getProtection() {
|
|
2699
3022
|
return this._protection;
|
|
@@ -2767,63 +3090,63 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2767
3090
|
});
|
|
2768
3091
|
};
|
|
2769
3092
|
}
|
|
2770
|
-
_fromJSON(e) {
|
|
2771
|
-
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new
|
|
2772
|
-
e.theme && (this._theme = new
|
|
2773
|
-
let
|
|
3093
|
+
_fromJSON(e, t) {
|
|
3094
|
+
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new I(B("error.workbook.sheetOne"));
|
|
3095
|
+
e.theme && (this._theme = new gt(e.theme), this._styles.setTheme(this._theme));
|
|
3096
|
+
let n = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist();
|
|
2774
3097
|
try {
|
|
2775
|
-
|
|
2776
|
-
let
|
|
2777
|
-
if (
|
|
2778
|
-
let e =
|
|
2779
|
-
for (let t = 0; t <
|
|
2780
|
-
let n =
|
|
2781
|
-
n && typeof n.cacheId == "number" &&
|
|
3098
|
+
n.fromJSON(e.strings), r.fromJSON(e.resources), i.fromJSON(e.styles), e.date1904 && (this._isDate1904 = !0), this._codeName = e.codeName ?? null, this._updateLinks = e.updateLinks ?? null, e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
|
|
3099
|
+
let a = [], o = e.pivotCaches;
|
|
3100
|
+
if (o) {
|
|
3101
|
+
let e = r.fromResourceId.bind(r);
|
|
3102
|
+
for (let t = 0; t < o.length; t++) {
|
|
3103
|
+
let n = o[t];
|
|
3104
|
+
n && typeof n.cacheId == "number" && a.push({
|
|
2782
3105
|
cacheId: n.cacheId,
|
|
2783
3106
|
part: f.fromJSON(n.part, e)
|
|
2784
3107
|
});
|
|
2785
3108
|
}
|
|
2786
3109
|
}
|
|
2787
|
-
this._pivotCaches =
|
|
2788
|
-
let
|
|
2789
|
-
|
|
2790
|
-
let
|
|
3110
|
+
this._pivotCaches = a, this._people.fromJSON(e.people);
|
|
3111
|
+
let s = e.sheets, c = s.length, l = e.view.activeSheetId ?? null;
|
|
3112
|
+
l !== null && (l = Math.min(Math.max(0, l), c - 1));
|
|
3113
|
+
let u = null, d = null;
|
|
2791
3114
|
this._isLoadingSheets = !0;
|
|
2792
|
-
for (let e = 0; e <
|
|
2793
|
-
let
|
|
2794
|
-
|
|
3115
|
+
for (let e = 0; e < c; e++) {
|
|
3116
|
+
let n = s[e], r = n.visibility || j.Visibility.Visible, i = e;
|
|
3117
|
+
d = i, r === j.Visibility.Visible ? u === null && (u = i) : l !== null && l === i && (l = null);
|
|
2795
3118
|
try {
|
|
2796
|
-
this._createSheet(
|
|
3119
|
+
this._createSheet(i, n.name, r, e, n.sheetId, n.sheet, t?.[e]);
|
|
2797
3120
|
} catch (e) {
|
|
2798
3121
|
throw this._isLoadingSheets = !1, e;
|
|
2799
3122
|
}
|
|
2800
3123
|
}
|
|
2801
|
-
this._isLoadingSheets = !1, this._updateState({ lastId:
|
|
2802
|
-
let
|
|
2803
|
-
this._protection = new
|
|
2804
|
-
|
|
3124
|
+
this._isLoadingSheets = !1, this._tellSheets(), this._updateState({ lastId: d }), e.view.activeSheetId = l ?? u, this.setView(new gr({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
|
|
3125
|
+
let p = this;
|
|
3126
|
+
this._protection = new vr(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
3127
|
+
p._emitter.notify("onProtectionChange", { source: e });
|
|
2805
3128
|
} }), this._emitter.notify("onLoad");
|
|
2806
3129
|
} finally {
|
|
2807
|
-
|
|
3130
|
+
i.endPersist(), r.endPersist(), n.endPersist();
|
|
2808
3131
|
}
|
|
2809
3132
|
}
|
|
2810
3133
|
_createScripts(e) {
|
|
2811
3134
|
let t = this;
|
|
2812
|
-
return new
|
|
3135
|
+
return new dr({
|
|
2813
3136
|
transactions: this._transactions,
|
|
2814
3137
|
json: e,
|
|
2815
3138
|
workbook: t,
|
|
2816
3139
|
getBuiltInFunctions: () => t._calculation?.getFunctions(),
|
|
2817
3140
|
onAdd: (e, n) => {
|
|
2818
3141
|
let r = t._calculation;
|
|
2819
|
-
r.getStatus() !==
|
|
3142
|
+
r.getStatus() !== Le.Status.Off && r.start().then(async () => {
|
|
2820
3143
|
let e = n.getFunctions().getItems({ type: "formula" }), t = e.length;
|
|
2821
3144
|
for (let n = 0; n < t; n++) {
|
|
2822
3145
|
let t = e[n];
|
|
2823
3146
|
try {
|
|
2824
3147
|
await this._calculation.getFunctions().add(t);
|
|
2825
3148
|
} catch (e) {
|
|
2826
|
-
|
|
3149
|
+
Wt.error(e?.message ?? String(e), e);
|
|
2827
3150
|
}
|
|
2828
3151
|
}
|
|
2829
3152
|
}).catch(() => {});
|
|
@@ -2832,10 +3155,10 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2832
3155
|
});
|
|
2833
3156
|
}
|
|
2834
3157
|
async toJSON(e) {
|
|
2835
|
-
if (this._closed) throw Error(
|
|
3158
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2836
3159
|
await Promise.resolve(this._starting);
|
|
2837
3160
|
let t = this.getCalculation();
|
|
2838
|
-
t.getStatus() !==
|
|
3161
|
+
t.getStatus() !== Le.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
|
|
2839
3162
|
let n = { sheets: [] }, r = e?.ignoreStyles ?? !1;
|
|
2840
3163
|
if (!r) {
|
|
2841
3164
|
let e = this._theme.toJSON();
|
|
@@ -2854,7 +3177,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2854
3177
|
name: i.name,
|
|
2855
3178
|
sheet: o
|
|
2856
3179
|
};
|
|
2857
|
-
i.sheetId !== void 0 && (s.sheetId = i.sheetId), i.visibility ===
|
|
3180
|
+
i.sheetId !== void 0 && (s.sheetId = i.sheetId), i.visibility === j.Visibility.Visible ? u === null && (u = a) : s.visibility = i.visibility, i.id === t && (l = a), n.sheets.push(s);
|
|
2858
3181
|
}
|
|
2859
3182
|
if (!r) {
|
|
2860
3183
|
let e = c.toJSON();
|
|
@@ -2907,16 +3230,16 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2907
3230
|
} catch (e) {
|
|
2908
3231
|
console.warn("error on close", e);
|
|
2909
3232
|
}
|
|
2910
|
-
this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._listenerOriginProvider?.(), this._ownOriginProvider && this._originProvider instanceof
|
|
3233
|
+
this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._listenerOriginProvider?.(), this._ownOriginProvider && this._originProvider instanceof en && this._originProvider.release(), this._closed = !0;
|
|
2911
3234
|
}
|
|
2912
3235
|
beginCommit(e) {
|
|
2913
|
-
if (this._closed) throw Error(
|
|
3236
|
+
if (this._closed) throw Error(B("error.workbook.modelClosed"));
|
|
2914
3237
|
return this._beginCommit(typeof e == "string" ? { description: e } : e);
|
|
2915
3238
|
}
|
|
2916
3239
|
doBatch(e, t) {
|
|
2917
3240
|
let n = this;
|
|
2918
3241
|
return t = typeof t == "string" ? { description: t } : {
|
|
2919
|
-
description:
|
|
3242
|
+
description: z("op.updateWorkbook"),
|
|
2920
3243
|
...t
|
|
2921
3244
|
}, this._transactions.doBatch(e, t, (e, t) => {
|
|
2922
3245
|
e.getDepth() === 0 && (n._lastTransactionUUID = e.getId());
|
|
@@ -2931,7 +3254,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2931
3254
|
_getState() {
|
|
2932
3255
|
return this._transactions.getState(this._id);
|
|
2933
3256
|
}
|
|
2934
|
-
_updateState(e, t =
|
|
3257
|
+
_updateState(e, t = z("op.updateWorkbook"), n) {
|
|
2935
3258
|
if (!e) return;
|
|
2936
3259
|
let r = this._beginCommit(t);
|
|
2937
3260
|
try {
|
|
@@ -2952,7 +3275,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
2952
3275
|
get isIWorkbook() {
|
|
2953
3276
|
return !0;
|
|
2954
3277
|
}
|
|
2955
|
-
},
|
|
3278
|
+
}, Mr = { address: null }, Nr = class {
|
|
2956
3279
|
constructor() {
|
|
2957
3280
|
this._readFormats = [], this._writeFormats = [], this._encryptions = [];
|
|
2958
3281
|
}
|
|
@@ -3028,9 +3351,9 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3028
3351
|
return !0;
|
|
3029
3352
|
});
|
|
3030
3353
|
}
|
|
3031
|
-
},
|
|
3354
|
+
}, Pr = /* @__PURE__ */ new WeakMap(), Fr = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Ir = class {
|
|
3032
3355
|
constructor() {
|
|
3033
|
-
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new
|
|
3356
|
+
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new x(this), this._registry = new Nr(), this._defaultStore = new nn(() => this.getWriteFormats(), () => this.getReadFormats());
|
|
3034
3357
|
}
|
|
3035
3358
|
getBackingStore() {
|
|
3036
3359
|
return this._backingStore ?? this._defaultStore;
|
|
@@ -3065,15 +3388,15 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3065
3388
|
return this._registry.getWriteFormats(e);
|
|
3066
3389
|
}
|
|
3067
3390
|
getOrigin(e) {
|
|
3068
|
-
return new
|
|
3391
|
+
return new V(e);
|
|
3069
3392
|
}
|
|
3070
3393
|
async read(e) {
|
|
3071
3394
|
let t = null;
|
|
3072
3395
|
if (typeof e == "string") e = { source: e };
|
|
3073
|
-
else if (
|
|
3396
|
+
else if (Fr(e)) {
|
|
3074
3397
|
let n = e.getPath();
|
|
3075
3398
|
if (!n) throw Error("Cannot read from an unbound origin (no path).");
|
|
3076
|
-
|
|
3399
|
+
Qt(e) ? e = {
|
|
3077
3400
|
source: n,
|
|
3078
3401
|
asCopy: !0
|
|
3079
3402
|
} : (t = e, e = { source: n });
|
|
@@ -3092,20 +3415,20 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3092
3415
|
search: i,
|
|
3093
3416
|
ext: a
|
|
3094
3417
|
}))[0];
|
|
3095
|
-
if (!o) throw new
|
|
3418
|
+
if (!o) throw new I(B("error.io.readFormatUnavailable", { format: i ?? a }));
|
|
3096
3419
|
let s = n?.typedCreateWorkbookOptions, c = s ? Object.keys(s).find((e) => e.toLowerCase() === o.key.toLowerCase()) : void 0, l = {
|
|
3097
3420
|
...n,
|
|
3098
3421
|
...c === void 0 ? void 0 : s[c]
|
|
3099
3422
|
};
|
|
3100
3423
|
delete l.typedCreateWorkbookOptions, delete l.source, delete l.asCopy;
|
|
3101
|
-
let u = r ?? new
|
|
3424
|
+
let u = r ?? new V(t.absolutePath ?? null, {
|
|
3102
3425
|
name: t.name ?? null,
|
|
3103
3426
|
format: o.key,
|
|
3104
3427
|
size: t.size ?? null,
|
|
3105
3428
|
lastModified: t.lastModified ?? null,
|
|
3106
3429
|
canWrite: t.canWrite ?? !1
|
|
3107
3430
|
});
|
|
3108
|
-
r instanceof
|
|
3431
|
+
r instanceof V && r.update({
|
|
3109
3432
|
format: o.key,
|
|
3110
3433
|
size: t.size ?? null,
|
|
3111
3434
|
lastModified: t.lastModified ?? null
|
|
@@ -3139,7 +3462,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3139
3462
|
}
|
|
3140
3463
|
async _decrypt(e, t, n) {
|
|
3141
3464
|
let r = await this._registry.detectEncryption(e);
|
|
3142
|
-
if (t instanceof
|
|
3465
|
+
if (t instanceof V && t.update({ encryption: r ? r.key : null }), !r) return {
|
|
3143
3466
|
bytes: e,
|
|
3144
3467
|
password: null
|
|
3145
3468
|
};
|
|
@@ -3147,7 +3470,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3147
3470
|
try {
|
|
3148
3471
|
return i = await r.decode(e, t), !0;
|
|
3149
3472
|
} catch (e) {
|
|
3150
|
-
if (!(e instanceof
|
|
3473
|
+
if (!(e instanceof Ht)) throw e;
|
|
3151
3474
|
return !1;
|
|
3152
3475
|
}
|
|
3153
3476
|
};
|
|
@@ -3157,7 +3480,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3157
3480
|
};
|
|
3158
3481
|
if (!n?.onPassword) {
|
|
3159
3482
|
let e = t.getName();
|
|
3160
|
-
throw new
|
|
3483
|
+
throw new Kt(e ? B("error.io.passwordRequired", { name: e }) : B("error.io.passwordRequiredUnnamed"));
|
|
3161
3484
|
}
|
|
3162
3485
|
let o = await Promise.resolve(n.onPassword({
|
|
3163
3486
|
origin: t,
|
|
@@ -3169,16 +3492,16 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3169
3492
|
bytes: i,
|
|
3170
3493
|
password: o
|
|
3171
3494
|
};
|
|
3172
|
-
throw new
|
|
3495
|
+
throw new Ht(B("error.io.passwordIncorrect"));
|
|
3173
3496
|
}
|
|
3174
3497
|
async writeArrayBuffer(e, t) {
|
|
3175
3498
|
if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
|
|
3176
3499
|
let n = (await this._registry.getWriteFormats({ search: t.format }))[0];
|
|
3177
|
-
if (!n) throw new
|
|
3500
|
+
if (!n) throw new I(B("error.io.writeFormatUnavailable", { format: t.format }));
|
|
3178
3501
|
return this._writeArrayBuffer(e, n, t);
|
|
3179
3502
|
}
|
|
3180
3503
|
async write(e, t, n) {
|
|
3181
|
-
return typeof t == "string" ||
|
|
3504
|
+
return typeof t == "string" || Fr(t) ? this._write(e, t, !1, n) : this._write(e, e?.getOrigin?.(), !0, t ?? n);
|
|
3182
3505
|
}
|
|
3183
3506
|
async writeAs(e, t, n) {
|
|
3184
3507
|
if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
|
|
@@ -3188,13 +3511,13 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3188
3511
|
if (!e) throw Error("Workbook must be provided.");
|
|
3189
3512
|
if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
|
|
3190
3513
|
let i = typeof t == "string" ? this.getOrigin(t) : t, a = i.getFormat(), o;
|
|
3191
|
-
if ((r?.format || a) && (o = (await this._registry.getWriteFormats({ search: r?.format ?? a ?? void 0 }))[0]), o || i.getPath() && i.canWrite() && i.getExtension() || (o = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !o) throw new
|
|
3514
|
+
if ((r?.format || a) && (o = (await this._registry.getWriteFormats({ search: r?.format ?? a ?? void 0 }))[0]), o || i.getPath() && i.canWrite() && i.getExtension() || (o = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !o) throw new I(B("error.io.writeFormatUnresolved"));
|
|
3192
3515
|
let s = i.getExtension();
|
|
3193
3516
|
if (r?.format && s && i.getPath() && i.canWrite() && !o.exts.includes(s)) {
|
|
3194
3517
|
let e = (await this._registry.getWriteFormats({ ext: s }))[0];
|
|
3195
3518
|
if (e && e.key !== o.key) {
|
|
3196
3519
|
let e = i.getPath().split(/[/\\]/).pop();
|
|
3197
|
-
throw new
|
|
3520
|
+
throw new I(B("error.io.writeFormatMismatch", {
|
|
3198
3521
|
format: r.format,
|
|
3199
3522
|
file: e
|
|
3200
3523
|
}));
|
|
@@ -3202,16 +3525,16 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3202
3525
|
}
|
|
3203
3526
|
if (typeof t == "string") {
|
|
3204
3527
|
let e = i.getPath();
|
|
3205
|
-
i = new
|
|
3528
|
+
i = new V(k(e) ? e : `${e}.${o.exts[0]}`, { format: o.key });
|
|
3206
3529
|
}
|
|
3207
|
-
let c = i.getEncryption(), l = e.getOrigin?.(), u = (i instanceof
|
|
3530
|
+
let c = i.getEncryption(), l = e.getOrigin?.(), u = (i instanceof V ? i.getPassword() : null) ?? (l instanceof V ? l.getPassword() : null), d = i.isEncrypted() || (l?.isEncrypted() ?? !1), f = r?.password === void 0 ? u ?? (d ? void 0 : null) : r.password, p = null;
|
|
3208
3531
|
if (f === void 0) {
|
|
3209
3532
|
if (d) {
|
|
3210
3533
|
let e = i.getName();
|
|
3211
|
-
throw new
|
|
3534
|
+
throw new Kt(e ? B("error.io.passwordRequiredSave", { name: e }) : B("error.io.passwordRequiredSaveUnnamed"));
|
|
3212
3535
|
}
|
|
3213
|
-
} else if (f !== null && (p = await this._registry.getEncryption(c), !p)) throw new
|
|
3214
|
-
let m = `${i.getName() ??
|
|
3536
|
+
} else if (f !== null && (p = await this._registry.getEncryption(c), !p)) throw new I(B("error.io.encryptionUnavailable"));
|
|
3537
|
+
let m = `${i.getName() ?? B("workbook.defaultName")}.${o.exts[0]}`, h = r?.progress, g = !i.getPath() || !i.canWrite() || !!r?.prompt, _ = !1, v = this, y = null, b = [], x = {
|
|
3215
3538
|
workbook: e,
|
|
3216
3539
|
format: o,
|
|
3217
3540
|
origin: i,
|
|
@@ -3236,7 +3559,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3236
3559
|
}))(h, l), d = await v._writeArrayBuffer(e, c, {
|
|
3237
3560
|
...r,
|
|
3238
3561
|
progress: u
|
|
3239
|
-
}), m =
|
|
3562
|
+
}), m = Pr.get(s);
|
|
3240
3563
|
if (l.some((e) => !m?.has(e.message)) && r?.onWarnings) {
|
|
3241
3564
|
let t = await Promise.resolve(r.onWarnings({
|
|
3242
3565
|
workbook: e,
|
|
@@ -3254,12 +3577,12 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3254
3577
|
let t = this.getBackingStore();
|
|
3255
3578
|
if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
|
|
3256
3579
|
if (S = await t.write(x), S) {
|
|
3257
|
-
if (f !== void 0 && S instanceof
|
|
3258
|
-
let e =
|
|
3580
|
+
if (f !== void 0 && S instanceof V && (S.setPassword(f), S.update({ encryption: p ? p.key : null })), b.length) {
|
|
3581
|
+
let e = Pr.get(S) ?? /* @__PURE__ */ new Set();
|
|
3259
3582
|
for (let t of b) e.add(t.message);
|
|
3260
|
-
|
|
3583
|
+
Pr.set(S, e);
|
|
3261
3584
|
}
|
|
3262
|
-
n && S !== e.getOrigin() &&
|
|
3585
|
+
n && S !== e.getOrigin() && Qt(e.getOrigin())?.setOrigin(S);
|
|
3263
3586
|
let t = y ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
|
|
3264
3587
|
this._emitter.notify("onWrite", {
|
|
3265
3588
|
params: {
|
|
@@ -3274,7 +3597,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3274
3597
|
h?.onComplete && await Promise.resolve(h.onComplete(S));
|
|
3275
3598
|
} catch (e) {
|
|
3276
3599
|
let t = e instanceof Error ? e : Error(String(e));
|
|
3277
|
-
throw h?.onError && await Promise.resolve(h.onError(t)), h?.onComplete && await Promise.resolve(h.onComplete(null)), t instanceof
|
|
3600
|
+
throw h?.onError && await Promise.resolve(h.onError(t)), h?.onComplete && await Promise.resolve(h.onComplete(null)), t instanceof I ? t : Error(B("error.io.writeFailed", { reason: t.message }), { cause: e });
|
|
3278
3601
|
}
|
|
3279
3602
|
return S;
|
|
3280
3603
|
}
|
|
@@ -3299,14 +3622,14 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3299
3622
|
async _readArrayBuffer(e, t, n) {
|
|
3300
3623
|
if (!e) throw Error("ArrayBuffer must be specified.");
|
|
3301
3624
|
if (!t) throw Error("format must be specified.");
|
|
3302
|
-
if (e.byteLength === 0) return new
|
|
3625
|
+
if (e.byteLength === 0) return new jr(n?.createWorkbookOptions);
|
|
3303
3626
|
let r = t.handler;
|
|
3304
3627
|
if (!r) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
|
|
3305
3628
|
let i;
|
|
3306
3629
|
try {
|
|
3307
3630
|
i = await r(e, n);
|
|
3308
3631
|
} catch (e) {
|
|
3309
|
-
throw e instanceof
|
|
3632
|
+
throw e instanceof I ? e : new I(B("error.io.readFailed", {
|
|
3310
3633
|
format: t.description ?? t.key,
|
|
3311
3634
|
reason: e?.message ?? String(e)
|
|
3312
3635
|
}), { cause: e });
|
|
@@ -3316,7 +3639,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3316
3639
|
get isIWorkbookIO() {
|
|
3317
3640
|
return !0;
|
|
3318
3641
|
}
|
|
3319
|
-
},
|
|
3642
|
+
}, Lr = new Ir(), Rr = class {
|
|
3320
3643
|
constructor() {
|
|
3321
3644
|
this._buffer = null, this._formatKey = null;
|
|
3322
3645
|
}
|
|
@@ -3330,8 +3653,8 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3330
3653
|
async read(e) {
|
|
3331
3654
|
return this._buffer ? e.decode(this._buffer, { format: this._formatKey ?? void 0 }) : null;
|
|
3332
3655
|
}
|
|
3333
|
-
},
|
|
3334
|
-
kind:
|
|
3656
|
+
}, zr = "locales", Br = "fonts", Vr = [{
|
|
3657
|
+
kind: zr,
|
|
3335
3658
|
files: [{
|
|
3336
3659
|
suffix: ".msg.json",
|
|
3337
3660
|
async extract(e) {
|
|
@@ -3344,7 +3667,7 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3344
3667
|
place: (e, t) => t ? `${t}/${e}` : null
|
|
3345
3668
|
}]
|
|
3346
3669
|
}, {
|
|
3347
|
-
kind:
|
|
3670
|
+
kind: Br,
|
|
3348
3671
|
files: [
|
|
3349
3672
|
".woff2",
|
|
3350
3673
|
".woff",
|
|
@@ -3356,42 +3679,46 @@ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
|
|
|
3356
3679
|
place: (e, t) => t ? `${t}/${e}` : e
|
|
3357
3680
|
}))
|
|
3358
3681
|
}];
|
|
3359
|
-
|
|
3360
|
-
Darken: "darken",
|
|
3361
|
-
DarkenLess: "darkenLess",
|
|
3362
|
-
Lighten: "lighten",
|
|
3363
|
-
LightenLess: "lightenLess",
|
|
3364
|
-
None: "none",
|
|
3365
|
-
Normal: "normal"
|
|
3366
|
-
}, ar.PresetGeometry = {
|
|
3367
|
-
Line: "line",
|
|
3368
|
-
LineInv: "lineInv",
|
|
3369
|
-
triangle: "triangle",
|
|
3370
|
-
rtTriangle: "rtTriangle",
|
|
3371
|
-
Rect: "rect"
|
|
3372
|
-
};
|
|
3682
|
+
Tr ||= {}, Er ||= {};
|
|
3373
3683
|
var Q = null;
|
|
3374
|
-
function
|
|
3684
|
+
function Hr() {
|
|
3375
3685
|
if (!Q) {
|
|
3376
|
-
let e = import("./
|
|
3686
|
+
let e = import("./C8btlUQcQwNyzHY3.mjs").then((e) => e.loadScriptingDeclarations());
|
|
3377
3687
|
e.catch(() => {
|
|
3378
3688
|
Q = null;
|
|
3379
3689
|
}), Q = e;
|
|
3380
3690
|
}
|
|
3381
3691
|
return Q;
|
|
3382
3692
|
}
|
|
3383
|
-
var
|
|
3384
|
-
function
|
|
3693
|
+
var Ur, Wr, Gr, $ = null;
|
|
3694
|
+
function Kr() {
|
|
3385
3695
|
if (!$) {
|
|
3386
|
-
let e = import("./
|
|
3696
|
+
let e = import("./C8btlUQcQwNyzHY3.mjs").then((e) => e.loadScriptingApi()).then((e) => JSON.parse(e));
|
|
3387
3697
|
e.catch(() => {
|
|
3388
3698
|
$ = null;
|
|
3389
3699
|
}), $ = e;
|
|
3390
3700
|
}
|
|
3391
3701
|
return $;
|
|
3392
3702
|
}
|
|
3393
|
-
|
|
3394
|
-
|
|
3703
|
+
Ur ||= {}, (Wr ||= {}).Type = {
|
|
3704
|
+
Button: "button",
|
|
3705
|
+
CheckBox: "checkBox",
|
|
3706
|
+
OptionButton: "optionButton",
|
|
3707
|
+
ListBox: "listBox",
|
|
3708
|
+
DropDown: "dropDown",
|
|
3709
|
+
ScrollBar: "scrollBar",
|
|
3710
|
+
Spinner: "spinner",
|
|
3711
|
+
GroupBox: "groupBox",
|
|
3712
|
+
Label: "label",
|
|
3713
|
+
EditBox: "editBox",
|
|
3714
|
+
Dialog: "dialog",
|
|
3715
|
+
Unknown: "formControl"
|
|
3716
|
+
}, (Gr ||= {}).DropStyle = {
|
|
3717
|
+
Combo: "combo",
|
|
3718
|
+
ComboEdit: "comboEdit",
|
|
3719
|
+
Simple: "simple"
|
|
3720
|
+
};
|
|
3721
|
+
var qr = class extends b {
|
|
3395
3722
|
constructor(e) {
|
|
3396
3723
|
super(e);
|
|
3397
3724
|
}
|
|
@@ -3404,8 +3731,8 @@ var wr = class extends ue {
|
|
|
3404
3731
|
colEnd: (e?.size?.width ?? 5) - 1,
|
|
3405
3732
|
rowEnd: (e?.size?.height ?? 5) - 1
|
|
3406
3733
|
},
|
|
3407
|
-
getRanges: (e) => new
|
|
3734
|
+
getRanges: (e) => new Re(null)
|
|
3408
3735
|
}, super._initializeOptions(e);
|
|
3409
3736
|
}
|
|
3410
|
-
},
|
|
3411
|
-
export {
|
|
3737
|
+
}, Jr = "0.8.0-beta.9", Yr = "2026-10-05T18:18:33.079Z";
|
|
3738
|
+
export { g as AbstractCollection, le as AbstractMovableContent, o as AddressUtils, Rr as ArrayBackingStore, mt as AutoFill, Yr as BUILD_DATE, he as Color, te as Condition, at as DateUtils, Ir as DefaultWorkbookIO, yt as EXTERNAL_LINK_PATH_REL_TYPE, mr as ExternalRangeClipboardItem, Br as FONTS_KIND, xn as FontUtils, ge as FormulaText, It as FunctionDeclarations, We as GeomUtils, m as IAnchored, Ve as IBorders, Le as ICalculation, Ot as ICell, Fn as ICellHeaderRange, At as ICellRange, Pn as ICellRanges, He as IColor, c as ICondition, ye as IConditionalFormat, jt as IDataValidation, Gr as IDropDown, bn as IEffect, T as IFill, O as IFont, ln as IFontCollection, Wr as IFormControl, Bn as IGeometry, Ur as IMovable, Er as IPicture, Tr as IPrint, Nn as IResource, ie as IScript, K as IShape, j as ISheet, Pt as ISheetView, vn as ISort, yn as IStroke, Oe as IStyle, ee as ITable, v as ITableStyle, se as IText, w as ITextFrame, Mn as ITheme, ke as IThemeCollection, Jt as IWorkbookIO, zr as LOCALES_KIND, i as LicenseManager, l as MovableContentRegistry, De as NamedStyleCollection, D as NumberFormat, lr as PersonCollection, pr as RangeClipboardItem, pe as Registry, rt as Resource, de as ResourceCollection, Vr as SHEETXL_RESOURCE_KINDS, t as SYSTEM_COLOR_CSS_PREFIX, Hn as ShapeStyleUtils, M as Sheet, cn as SimpleFontFace, wt as Sort, d as StringCollection, ce as StyleCollection, qr as Table, Te as TableStyleCollection, u as TextRotation, p as TextStacked, ue as TextUtils, gt as Theme, C as ThemeCollection, ne as TransactionConflictError, Xt as TransactionSaveStateManager, _e as TransactionStore, Yt as TransactionUndoManager, Ft as Tuple, Jr as VERSION, jr as Workbook, Lr as WorkbookIO, V as WorkbookOrigin, gr as WorkbookView, jn as builtInStyleNameDisplay, Be as createCellRangeCounts, Qe as externalBookClosedName, Pe as externalBookFileName, pt as externalBookLocation, xt as externalBookOpenName, Rn as getBuiltInFunctionNames, ct as getLanguagePack, kt as getLocaleProfile, oe as getScriptRuntime, Kr as getScriptingApi, Hr as getScriptingDeclarations, Je as localizeBoolean, Ge as localizeErrorLabel, Ce as makeLocaleProfile, je as parseBooleanLocal, Et as parseErrorLocal, ze as parseExternalScope, zn as parseFormulaLiteral, ht as registerSdkLocales, ot as sourceEntryFromPath, fe as withScriptRuntime };
|