@sheetxl/sdk 0.7.28-beta.2 → 0.7.28-beta.3
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/1mH2uhx_Dmceu88H.cjs +33 -0
- package/browser/cjs/B4PKKgaDTG9aSO-f.cjs +1 -0
- package/browser/cjs/{CQf4zxkBmheTVbjX.cjs → BX6A6xGDOr_td9mw.cjs} +2 -2
- package/browser/cjs/{BG7YDVxiC4ErxvF1.cjs → CWCKcp58KidyndaL.cjs} +1 -1
- package/browser/cjs/{BREMLtxkQhtNSVra.cjs → D6cjnwWR_iUSe1f6.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/{CZO1RubmqnJV96rq.mjs → B1gpnr-7kLU7jTy-.mjs} +2 -2
- package/browser/esm/{CB_4gdPPPruwremH.mjs → C78IaCXqwCcraBPe.mjs} +5055 -4959
- package/browser/esm/{DRWu3TmcE9JFf78V.mjs → CPgz9_iM7xyAcytg.mjs} +2 -2
- package/browser/esm/{DN4d5bDBkti28wuc.mjs → CX1NO_a1QPjXDvTU.mjs} +213 -207
- package/browser/esm/{vHWuKF-ftK7LM1uw.mjs → DZfds6s3ayTZrozO.mjs} +1 -1
- package/browser/esm/{DPOelA1J3WHbMXyh.mjs → Dv8FyXyeygJPXoHo.mjs} +2 -2
- package/browser/esm/{BxIOX1TojvA-1ZZP.mjs → Rj8e7SashcMlcdZJ.mjs} +2 -2
- package/browser/esm/index.mjs +419 -414
- package/node/esm/{C8tfYGL3wHy9IDDc.mjs → 8VtzCFSmLPKxJjOa.mjs} +2 -2
- package/node/esm/{XQhP3dYwF_tEuswB.mjs → BkY99r-c3BhlT_Kv.mjs} +303 -297
- package/node/esm/{B-tgcZihStNV9CbZ.mjs → DE3eIaqkk5xzmV1c.mjs} +1 -1
- package/node/esm/index.mjs +5312 -5213
- package/package.json +6 -6
- package/resources/locales/de/model.msg.json +12 -0
- package/resources/locales/en/model.msg.json +12 -0
- package/types/scripting.d.ts +76 -7
- package/types/src/calculation/ICalculation.d.ts +5 -0
- package/types/src/calculation/compiler/CompilerUtils.d.ts +20 -0
- package/types/src/calculation/compiler/FormulaParser.d.ts +32 -6
- package/types/src/calculation/functions/Operators.d.ts +1 -1
- package/types/src/calculation/grid/CalcGrid.d.ts +2 -0
- package/types/src/calculation/grid/ICalcGrid.d.ts +11 -0
- package/types/src/cellRange/ICellRange.d.ts +60 -3
- package/types/src/sheet/SheetRange.d.ts +12 -1
- package/browser/cjs/DoemwsUQoGCk0vBK.cjs +0 -33
- package/browser/cjs/_c2uwwpr03Y7lzIj.cjs +0 -1
package/browser/esm/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.7.28-beta.
|
|
2
|
+
* @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.7.28-beta.3
|
|
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, At as n,
|
|
9
|
-
import { t as dt } from "./
|
|
7
|
+
import { n as e } from "./DZfds6s3ayTZrozO.mjs";
|
|
8
|
+
import { $t as t, At as n, B as r, Bt as i, Cn as a, Ct as o, Dn as s, Dt as c, En as l, Et as u, Ft as d, Gt as f, Ht as p, It as m, Jt as h, Lt as g, M as _, Mt as v, Nt as y, On as ee, Ot as b, Pt as te, Qt as ne, Rt as re, Sn as x, St as ie, Tn as S, Tt as ae, U as oe, Ut as C, Vt as w, Wt as T, Xt as E, Y as se, Yt as ce, Zt as le, _n as ue, _t as de, a as D, an as fe, at as pe, bn as me, bt as he, c as ge, cn as _e, ct as ve, d as ye, dn as be, dt as xe, en as O, f as Se, fn as Ce, ft as we, gn as Te, gt as Ee, h as De, hn as Oe, ht as ke, i as Ae, in as k, it as je, jt as Me, kt as Ne, l as A, ln as Pe, lt as Fe, m as Ie, mn as Le, mt as Re, n as ze, nn as Be, o as j, on as Ve, ot as He, p as Ue, pn as We, pt as Ge, qt as Ke, r as qe, rn as Je, rt as Ye, s as Xe, sn as Ze, st as Qe, t as $e, tn as M, u as et, un as tt, ut as nt, vn as rt, vt as it, wn as at, wt as ot, xn as N, xt as st, yn as ct, yt as lt, zt as ut } from "./C78IaCXqwCcraBPe.mjs";
|
|
9
|
+
import { t as dt } from "./CPgz9_iM7xyAcytg.mjs";
|
|
10
10
|
import { FormulaError as P, ScalarType as F } from "@sheetxl/primitives";
|
|
11
11
|
import { BufferUtils as ft, CommonUtils as I, CoordUtils as L, DOMUtils as pt, DefaultLanguagePackService as mt, ExpectedError as R, InvalidPasswordError as ht, MimeType as gt, Notifier as z, NullNotAllowedError as _t, OutOfBoundsError as B, PasswordRequiredError as vt, UndoManager as yt, messageKey as V, t as H } from "@sheetxl/utils";
|
|
12
12
|
export * from "@sheetxl/primitives";
|
|
@@ -108,7 +108,7 @@ var xt = class extends yt {
|
|
|
108
108
|
}
|
|
109
109
|
}, St = class {
|
|
110
110
|
constructor(e, t) {
|
|
111
|
-
this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new
|
|
111
|
+
this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new S(this);
|
|
112
112
|
let n = this;
|
|
113
113
|
this._removeStoreListener = e.addListener({
|
|
114
114
|
onCommitEnd() {
|
|
@@ -145,7 +145,7 @@ var xt = class extends yt {
|
|
|
145
145
|
}
|
|
146
146
|
}, U = class e {
|
|
147
147
|
constructor(t, n = {}) {
|
|
148
|
-
this._password = null, this._emitter = new
|
|
148
|
+
this._password = null, this._emitter = new S(this), this._path = t ?? null, this._name = n.name ?? null, this._format = n.format ?? null, this._size = n.size ?? null, this._canWrite = n.canWrite ?? e._defaultCanWrite(this._path), this._encryption = n.encryption ?? null;
|
|
149
149
|
}
|
|
150
150
|
static _defaultCanWrite(e) {
|
|
151
151
|
return !!e && !/^(https?:|data:|blob:)/i.test(e);
|
|
@@ -156,7 +156,7 @@ var xt = class extends yt {
|
|
|
156
156
|
getName() {
|
|
157
157
|
if (this._name !== null && this._name !== void 0) return this._name;
|
|
158
158
|
let e = this._cleanPath();
|
|
159
|
-
return e &&
|
|
159
|
+
return e && N(e) || null;
|
|
160
160
|
}
|
|
161
161
|
getPath() {
|
|
162
162
|
return this._path;
|
|
@@ -167,7 +167,7 @@ var xt = class extends yt {
|
|
|
167
167
|
getExtension() {
|
|
168
168
|
let e = this._cleanPath();
|
|
169
169
|
if (!e) return null;
|
|
170
|
-
let t =
|
|
170
|
+
let t = x(e);
|
|
171
171
|
return t ? t.toLowerCase() : null;
|
|
172
172
|
}
|
|
173
173
|
getEncryption() {
|
|
@@ -230,10 +230,10 @@ var xt = class extends yt {
|
|
|
230
230
|
}
|
|
231
231
|
switch (i) {
|
|
232
232
|
case "file": {
|
|
233
|
-
let e = n, t = e?.name, i = t ? `${
|
|
233
|
+
let e = n, t = e?.name, i = t ? `${N(t)}` : "";
|
|
234
234
|
a = await e.arrayBuffer(), o = {
|
|
235
235
|
format: r,
|
|
236
|
-
ext:
|
|
236
|
+
ext: x(t),
|
|
237
237
|
name: i,
|
|
238
238
|
absolutePath: t,
|
|
239
239
|
size: e.size,
|
|
@@ -272,7 +272,7 @@ var xt = class extends yt {
|
|
|
272
272
|
e = r.input, t = r.init, i = r.timeout;
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
let s = i || 3e4, c = new AbortController(), l = setTimeout(() => c.abort(), s), u = typeof e == "string" ? e : e.toString(), d =
|
|
275
|
+
let s = i || 3e4, c = new AbortController(), l = setTimeout(() => c.abort(), s), u = typeof e == "string" ? e : e.toString(), d = x(u);
|
|
276
276
|
try {
|
|
277
277
|
let n = await fetch(e, {
|
|
278
278
|
...t,
|
|
@@ -284,7 +284,7 @@ var xt = class extends yt {
|
|
|
284
284
|
a = i, o = {
|
|
285
285
|
format: r,
|
|
286
286
|
ext: d,
|
|
287
|
-
name:
|
|
287
|
+
name: N(u, !0),
|
|
288
288
|
absolutePath: u
|
|
289
289
|
};
|
|
290
290
|
} catch (e) {
|
|
@@ -498,7 +498,7 @@ var Ot = class {
|
|
|
498
498
|
"Trebuchet MS",
|
|
499
499
|
"Verdana"
|
|
500
500
|
], W = /* @__PURE__ */ new Map();
|
|
501
|
-
W.set(
|
|
501
|
+
W.set(k.GenericName.Serif, ["Tahoma"]), W.set(k.GenericName.SanSerif, ["Calibri"]), W.set(k.GenericName.MonoSpace, ["Courier New"]), W.set(k.GenericName.Cursive, ["Comic Sans MS"]), W.set(k.GenericName.Fantasy, ["Luminari"]), W.set(k.GenericName.UISystem, ["Arial"]), W.set(k.GenericName.UISerif, ["Tahoma"]), W.set(k.GenericName.UISanSerif, ["Arial"]), W.set(k.GenericName.UIMonoSpace, ["Courier New"]), W.set(k.GenericName.UIRounded, ["Arial"]), W.set(k.GenericName.Math, []), W.set(k.GenericName.Emoji, []), W.set(k.GenericName.Fangsong, []);
|
|
502
502
|
var G = /* @__PURE__ */ new Map(), jt = [];
|
|
503
503
|
K(At);
|
|
504
504
|
var Mt = eval;
|
|
@@ -619,7 +619,7 @@ function Bt(e, t = !0, n = zt) {
|
|
|
619
619
|
SoftEdge: "softEdge",
|
|
620
620
|
Reflection: "reflection"
|
|
621
621
|
};
|
|
622
|
-
var Y =
|
|
622
|
+
var Y = ut.BuiltInName, Vt = {
|
|
623
623
|
[Y.Normal]: V("style.builtin.normal"),
|
|
624
624
|
[Y.Comma]: V("style.builtin.comma"),
|
|
625
625
|
[Y.Currency]: V("style.builtin.currency"),
|
|
@@ -660,52 +660,52 @@ function Jt(e) {
|
|
|
660
660
|
}
|
|
661
661
|
} : null));
|
|
662
662
|
}
|
|
663
|
-
var Yt, Xt, Zt, Qt, $t = (e, t, n,
|
|
664
|
-
let
|
|
665
|
-
|
|
666
|
-
let
|
|
667
|
-
t > 0 ? (
|
|
668
|
-
let
|
|
669
|
-
val:
|
|
670
|
-
adjs:
|
|
671
|
-
}, n),
|
|
672
|
-
|
|
673
|
-
let
|
|
674
|
-
return
|
|
675
|
-
description: e.description + ", " +
|
|
676
|
-
definition:
|
|
663
|
+
var Yt, Xt, Zt, Qt, $t = (e, t, n, r, i) => {
|
|
664
|
+
let a = JSON.parse(JSON.stringify(e.definition));
|
|
665
|
+
a.adjs ||= [];
|
|
666
|
+
let o = "", s = 0, c = 0;
|
|
667
|
+
t > 0 ? (c = t, s = 100 - t, o = H("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = H("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [C.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [C.AdjustmentType.LumOff]: c });
|
|
668
|
+
let l = new w({
|
|
669
|
+
val: a.val,
|
|
670
|
+
adjs: a.adjs
|
|
671
|
+
}, n), u = l.toString();
|
|
672
|
+
r?.set(u, l);
|
|
673
|
+
let d = l.toRGBA().toString();
|
|
674
|
+
return i?.set(d, l), {
|
|
675
|
+
description: e.description + ", " + o,
|
|
676
|
+
definition: a
|
|
677
677
|
};
|
|
678
678
|
};
|
|
679
|
-
function en(e, t, n,
|
|
680
|
-
let
|
|
681
|
-
for (let
|
|
682
|
-
let
|
|
683
|
-
|
|
684
|
-
let
|
|
685
|
-
for (let
|
|
686
|
-
},
|
|
687
|
-
val: e[
|
|
688
|
-
adjs: e[
|
|
679
|
+
function en(e, t, n, r) {
|
|
680
|
+
let i = [];
|
|
681
|
+
for (let a = 0; a < e.length; a++) {
|
|
682
|
+
let o = [];
|
|
683
|
+
i.push(o);
|
|
684
|
+
let s = (i) => {
|
|
685
|
+
for (let s = 0; s < i.length; s++) o.push($t(e[a], i[s], t, n, r));
|
|
686
|
+
}, c = new w({
|
|
687
|
+
val: e[a].definition.val,
|
|
688
|
+
adjs: e[a].definition.adjs
|
|
689
689
|
}, t).toHSLA().lum;
|
|
690
|
-
c
|
|
690
|
+
s(c === 0 ? [
|
|
691
691
|
50,
|
|
692
692
|
35,
|
|
693
693
|
25,
|
|
694
694
|
15,
|
|
695
695
|
5
|
|
696
|
-
] :
|
|
696
|
+
] : c === 100 ? [
|
|
697
697
|
-5,
|
|
698
698
|
-15,
|
|
699
699
|
-25,
|
|
700
700
|
-35,
|
|
701
701
|
-50
|
|
702
|
-
] :
|
|
702
|
+
] : c <= 20 ? [
|
|
703
703
|
90,
|
|
704
704
|
75,
|
|
705
705
|
50,
|
|
706
706
|
25,
|
|
707
707
|
10
|
|
708
|
-
] :
|
|
708
|
+
] : c >= 80 ? [
|
|
709
709
|
-10,
|
|
710
710
|
-25,
|
|
711
711
|
-50,
|
|
@@ -719,13 +719,13 @@ function en(e, t, n, i) {
|
|
|
719
719
|
-50
|
|
720
720
|
]);
|
|
721
721
|
}
|
|
722
|
-
return
|
|
722
|
+
return i;
|
|
723
723
|
}
|
|
724
724
|
(Yt ||= {}).buildPalette = en, Xt ||= {}, Zt ||= {}, Qt ||= {};
|
|
725
725
|
var X = null;
|
|
726
726
|
function tn() {
|
|
727
727
|
if (!X) {
|
|
728
|
-
let e = import("./
|
|
728
|
+
let e = import("./Dv8FyXyeygJPXoHo.mjs").then(({ initializeFunctions: e }) => {
|
|
729
729
|
let t = e(() => null);
|
|
730
730
|
return Object.freeze(Array.from(t.keys()));
|
|
731
731
|
});
|
|
@@ -746,25 +746,25 @@ function nn(e) {
|
|
|
746
746
|
} catch {
|
|
747
747
|
return;
|
|
748
748
|
}
|
|
749
|
-
let
|
|
749
|
+
let i = 0, a = 0;
|
|
750
750
|
if (n.length === 2) {
|
|
751
751
|
let e = n[0].tokenType?.name;
|
|
752
|
-
e === "MinOp" ? (
|
|
752
|
+
e === "MinOp" ? (i = -1, a = 1) : e === "PlusOp" && (i = 1, a = 1);
|
|
753
753
|
}
|
|
754
|
-
if (n.length -
|
|
755
|
-
let
|
|
754
|
+
if (n.length - a !== 1) return;
|
|
755
|
+
let o = n[a], s = o.image;
|
|
756
756
|
try {
|
|
757
|
-
switch (
|
|
757
|
+
switch (o.tokenType?.name) {
|
|
758
758
|
case "NumberToken":
|
|
759
759
|
case "ScientificDigit":
|
|
760
760
|
case "DigitToken": {
|
|
761
|
-
let e =
|
|
762
|
-
return
|
|
761
|
+
let e = oe(s).value;
|
|
762
|
+
return i === 0 ? e : i * e;
|
|
763
763
|
}
|
|
764
|
-
case "StringToken": return
|
|
765
|
-
case "BooleanToken": return
|
|
764
|
+
case "StringToken": return i === 0 ? se(s).value : void 0;
|
|
765
|
+
case "BooleanToken": return i === 0 ? _(s).value : void 0;
|
|
766
766
|
case "LiteralError":
|
|
767
|
-
case "RefError": return
|
|
767
|
+
case "RefError": return i === 0 ? r(s).value : void 0;
|
|
768
768
|
default: return;
|
|
769
769
|
}
|
|
770
770
|
} catch {
|
|
@@ -836,7 +836,7 @@ var on = class {
|
|
|
836
836
|
return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
|
|
837
837
|
}
|
|
838
838
|
_mergeFrequencies(e) {
|
|
839
|
-
let t = e?.keyFn ??
|
|
839
|
+
let t = e?.keyFn ?? Ee, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
|
|
840
840
|
for (let l = 0; l < a; l++) {
|
|
841
841
|
let a = i[l].getFrequencies(e);
|
|
842
842
|
o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
|
|
@@ -849,7 +849,7 @@ var on = class {
|
|
|
849
849
|
}) : c = !0, d = u.next();
|
|
850
850
|
}
|
|
851
851
|
}
|
|
852
|
-
return
|
|
852
|
+
return ke.fromGroups(r, t, e, rn, o, s, c);
|
|
853
853
|
}
|
|
854
854
|
getTypedCounts(e) {
|
|
855
855
|
let t = this._typedCounts;
|
|
@@ -899,7 +899,7 @@ var on = class {
|
|
|
899
899
|
let a = n.numericalCount;
|
|
900
900
|
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));
|
|
901
901
|
}
|
|
902
|
-
return
|
|
902
|
+
return qe(r);
|
|
903
903
|
}
|
|
904
904
|
}, sn = Object.freeze([]);
|
|
905
905
|
function cn(e, t) {
|
|
@@ -956,9 +956,9 @@ var ln = class {
|
|
|
956
956
|
constructor(e) {
|
|
957
957
|
this._closed = !1, this._options = { ...e };
|
|
958
958
|
let t = this;
|
|
959
|
-
this._transactions = this._options.transactions ?? new
|
|
959
|
+
this._transactions = this._options.transactions ?? new s({ transient: !0 }), this._stateId = this._transactions.create(), this._transactionsRemoveListener = this._transactions.addStateListener(this._stateId, { onAfterStateChange(e, n, r) {
|
|
960
960
|
t._emitter.notify("onCollectionChange");
|
|
961
|
-
} }), this._emitter = new
|
|
961
|
+
} }), this._emitter = new S(this, this._transactions), this._initState(e?.initial);
|
|
962
962
|
}
|
|
963
963
|
add(e, t, n) {
|
|
964
964
|
let r = this;
|
|
@@ -1075,7 +1075,7 @@ var ln = class {
|
|
|
1075
1075
|
return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
|
|
1076
1076
|
}, pn = class {
|
|
1077
1077
|
constructor(e) {
|
|
1078
|
-
this._options = e, this._emitter = new
|
|
1078
|
+
this._options = e, this._emitter = new S(this), this._initState();
|
|
1079
1079
|
}
|
|
1080
1080
|
_initState() {}
|
|
1081
1081
|
getModules() {
|
|
@@ -1097,13 +1097,13 @@ var ln = class {
|
|
|
1097
1097
|
builtInNames: this._builtInNames(),
|
|
1098
1098
|
...e
|
|
1099
1099
|
});
|
|
1100
|
-
return t.module ? await
|
|
1100
|
+
return t.module ? await T("scripts", t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
|
|
1101
1101
|
}
|
|
1102
1102
|
addModule(e, t, n) {
|
|
1103
1103
|
this._modules.add(e, t, n);
|
|
1104
1104
|
}
|
|
1105
1105
|
async addModuleFromJSON(e, t, n) {
|
|
1106
|
-
let r = await
|
|
1106
|
+
let r = await T(e, t);
|
|
1107
1107
|
return this.addModule(e, r, n), r;
|
|
1108
1108
|
}
|
|
1109
1109
|
executeMacro(e, t, n) {
|
|
@@ -1119,7 +1119,7 @@ var ln = class {
|
|
|
1119
1119
|
}
|
|
1120
1120
|
async run(e, t) {
|
|
1121
1121
|
try {
|
|
1122
|
-
let n = typeof e == "string" ? await this.createModule({ source: e }) : await
|
|
1122
|
+
let n = typeof e == "string" ? await this.createModule({ source: e }) : await T("scripts", e), r = typeof e == "string" ? e : e?.source ?? "";
|
|
1123
1123
|
return await this._runModule(n, r, t);
|
|
1124
1124
|
} catch (e) {
|
|
1125
1125
|
return {
|
|
@@ -1189,7 +1189,7 @@ var ln = class {
|
|
|
1189
1189
|
}
|
|
1190
1190
|
if (!i || i.length === 0) return I.EmptyArray;
|
|
1191
1191
|
let o = e?.text ? e.text.trim().toUpperCase() : null;
|
|
1192
|
-
return o && t.length > 1 &&
|
|
1192
|
+
return o && t.length > 1 && f(i, o), n !== void 0 && i.length > n ? i.slice(0, n) : i;
|
|
1193
1193
|
}
|
|
1194
1194
|
async getFunctionCategories(e) {
|
|
1195
1195
|
await this._emitter.notify("onBeforeSearch", { async: !0 });
|
|
@@ -1232,7 +1232,7 @@ var ln = class {
|
|
|
1232
1232
|
for (let r = 0; r < e.length; r++) {
|
|
1233
1233
|
let i = e[r], a = t[i];
|
|
1234
1234
|
try {
|
|
1235
|
-
n[i] = await
|
|
1235
|
+
n[i] = await T(i, a);
|
|
1236
1236
|
} catch (e) {
|
|
1237
1237
|
z.error(`Could not load script '${i}'; it will be unavailable.`, e);
|
|
1238
1238
|
}
|
|
@@ -1276,7 +1276,7 @@ var ln = class {
|
|
|
1276
1276
|
}
|
|
1277
1277
|
}, mn = class {
|
|
1278
1278
|
constructor(e, t, n, r) {
|
|
1279
|
-
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? L.EmptyCell, this._sheet = new
|
|
1279
|
+
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? L.EmptyCell, this._sheet = new A({
|
|
1280
1280
|
runtime: e,
|
|
1281
1281
|
styles: this._styles,
|
|
1282
1282
|
container: {
|
|
@@ -1288,36 +1288,36 @@ var ln = class {
|
|
|
1288
1288
|
applyCSSStyle(e, t) {
|
|
1289
1289
|
let r = !1;
|
|
1290
1290
|
e.style || (e.style = {}, r = !0);
|
|
1291
|
-
let
|
|
1291
|
+
let o = e.style, s = { ...t };
|
|
1292
1292
|
if (t.msoIgnore) {
|
|
1293
|
-
let e = t.msoIgnore.split(","), n = Object.keys(
|
|
1293
|
+
let e = t.msoIgnore.split(","), n = Object.keys(s);
|
|
1294
1294
|
for (let t = 0; t < n.length; t++) {
|
|
1295
1295
|
let r = n[t];
|
|
1296
|
-
e.includes(r) && delete
|
|
1296
|
+
e.includes(r) && delete s[r];
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
|
-
let
|
|
1300
|
-
|
|
1301
|
-
let
|
|
1302
|
-
|
|
1303
|
-
let
|
|
1304
|
-
if (
|
|
1305
|
-
let e =
|
|
1306
|
-
e && (e.patternType ===
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
let
|
|
1310
|
-
e && (
|
|
1299
|
+
let l = Me(s.fontFamily);
|
|
1300
|
+
o.font = {}, l && (o.font.family = l.family, o.font.fallbacks = l.fallbacks, o.font.size = l.size), o.font.size = s.fontSize, o.font.weight = s.fontWeight, o.font.style = s.fontStyle, o.font.color = s.color;
|
|
1301
|
+
let d = b(s.textDecoration);
|
|
1302
|
+
o.font.underline = d.underline, o.font.strike = d.strike, s.textUnderlineStyle && (o.font.underline = Ne(s.textUnderlineStyle)), o.alignment = {}, s?.textAlign && (o.alignment.horizontal = c(s.textAlign)), s?.textAlign && !o.alignment.horizontal && s?.textAlign !== "general" && (s.textAlign === "center-across" ? o.alignment.horizontal = a.HorizontalAlignment.CenterContinuous : s.textAlign === "fill" ? o.alignment.horizontal = a.HorizontalAlignment.Fill : s.textAlign === "121" || s.textAlign === "010" ? (o.alignment.horizontal = a.HorizontalAlignment.Distributed, o.alignment.justifyLastLine = s.textAlign === "121") : console.warn("unknown text-align", s.textAlign)), s.verticalAlign && (s.verticalAlign.toLowerCase() === "super" ? o.font.verticalAlign = k.VerticalAlignment.Super : s.verticalAlign.toLowerCase() === "sup" ? o.font.verticalAlign = k.VerticalAlignment.Sub : o.alignment.vertical = n(s.verticalAlign), o.alignment.vertical || (s.verticalAlign === "121" ? o.alignment.vertical = a.VerticalAlignment.Distributed : console.warn("unknown vertical-align", s.verticalAlign))), s.msoCharIndentCount && (o.alignment.indent = s.msoCharIndentCount), s.whiteSpace && (o.alignment.overflow = s.whiteSpace === "no-wrap" || s.whiteSpace === "nowrap" ? a.Overflow.Visible : a.Overflow.Wrap), s.msoTextControl === "shrinktofit" && (o.alignment.overflow = a.Overflow.Shrink);
|
|
1303
|
+
let f = null;
|
|
1304
|
+
if (s.background ? f = s.background : s.backgroundColor && (f = s.backgroundColor), f && (o.fill = { color: f }), s.msoPattern) {
|
|
1305
|
+
let e = y(s.msoPattern);
|
|
1306
|
+
e && (e.patternType === i.BuiltInSheetPattern.Solid ? o.fill = { color: e.foreground } : e.patternType !== i.BuiltInSheetPattern.None && (f && (e.background = f), o.fill = e));
|
|
1307
|
+
}
|
|
1308
|
+
s.msoRotate !== void 0 && (o.alignment.rotation = u(s.msoRotate));
|
|
1309
|
+
let p = (e, t) => {
|
|
1310
|
+
e && (o.border ||= {}, o.border[e] = t);
|
|
1311
1311
|
};
|
|
1312
|
-
|
|
1313
|
-
let
|
|
1314
|
-
|
|
1312
|
+
s.border && s.border !== "none" && (p("top", s.border), p("left", s.border), p("right", s.border), p("bottom", s.border)), s.borderTop && p("top", s.borderTop), s.borderLeft && p("left", s.borderLeft), s.borderRight && p("right", s.borderRight), s.borderBottom && p("bottom", s.borderBottom), s.msoDiagonalUp && p("diagonalUp", s.msoDiagonalUp), s.msoDiagonalDown && p("diagonalDown", s.msoDiagonalDown);
|
|
1313
|
+
let m = o.numberFormat;
|
|
1314
|
+
s.msoNumberFormat && (m = te(s.msoNumberFormat), m.includes("\\") ? m = null : m === "Fixed" ? m = M.Styles.lookupStyle(o.numberFormat).formatType === M.Type.Number ? null : M.Type.Number : m === "Percent" && (m = M.Styles.lookupStyle(o.numberFormat).formatType === M.Type.Percentage ? null : M.Type.Percentage)), m && (o.numberFormat = m), e.style = this._styles.normalize(o), r && Object.keys(e.style).length === 0 && delete e.style;
|
|
1315
1315
|
}
|
|
1316
1316
|
onCell(e, t, n, r, i) {
|
|
1317
1317
|
let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
|
|
1318
1318
|
if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), i?.tagName.toUpperCase() === "TD") {
|
|
1319
1319
|
let e = o.style, t = e?.font ?? {};
|
|
1320
|
-
(i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign =
|
|
1320
|
+
(i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign = k.VerticalAlignment.Sub), i.querySelectorAll("sup").length > 0 && (t.verticalAlign = k.VerticalAlignment.Super), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = k.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = k.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font ||= t);
|
|
1321
1321
|
let n = i.querySelectorAll("a");
|
|
1322
1322
|
if (n.length > 0) {
|
|
1323
1323
|
let e = n[0].getAttribute("href");
|
|
@@ -1364,8 +1364,8 @@ var ln = class {
|
|
|
1364
1364
|
let i = n(r);
|
|
1365
1365
|
if (i.msoHeightSource !== "userset" || !r) return;
|
|
1366
1366
|
let a = r.getAttribute("height") ?? i.height, o = null;
|
|
1367
|
-
if (a && (o =
|
|
1368
|
-
let t = r.cells[e], i =
|
|
1367
|
+
if (a && (o = v(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
|
|
1368
|
+
let t = r.cells[e], i = v(t.getAttribute("height") ?? n(t).height, this._styles.getNormal().getFont().getSize(), "px");
|
|
1369
1369
|
i !== null && (o = Math.max(i, o ?? 0));
|
|
1370
1370
|
}
|
|
1371
1371
|
o !== null && this._rowsReading.push({
|
|
@@ -1373,19 +1373,19 @@ var ln = class {
|
|
|
1373
1373
|
min: this._topLeft.rowIndex + e,
|
|
1374
1374
|
max: this._topLeft.rowIndex + e + t - 1
|
|
1375
1375
|
},
|
|
1376
|
-
update: { size: o *
|
|
1376
|
+
update: { size: o * k.getDeviceScale() }
|
|
1377
1377
|
});
|
|
1378
1378
|
}
|
|
1379
1379
|
onColumn(e, t, n, r) {
|
|
1380
1380
|
let i = n(r);
|
|
1381
1381
|
if (i.msoWidthSource !== "userset" || !r) return;
|
|
1382
1382
|
let a = r.getAttribute("width") ?? i.width, o = null;
|
|
1383
|
-
a && (o =
|
|
1383
|
+
a && (o = v(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
|
|
1384
1384
|
address: {
|
|
1385
1385
|
min: this._topLeft.colIndex + e,
|
|
1386
1386
|
max: this._topLeft.colIndex + e + t - 1
|
|
1387
1387
|
},
|
|
1388
|
-
update: { size: o *
|
|
1388
|
+
update: { size: o * k.getDeviceScale() }
|
|
1389
1389
|
});
|
|
1390
1390
|
}
|
|
1391
1391
|
onDone() {
|
|
@@ -1482,7 +1482,7 @@ var ln = class {
|
|
|
1482
1482
|
let r = new mn(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text");
|
|
1483
1483
|
await r.sheet().getCalculation().ready(), await r.sheet().getCalculation().stop();
|
|
1484
1484
|
let i = await Promise.resolve(t ? Ie(t) : [[]]), a;
|
|
1485
|
-
if (
|
|
1485
|
+
if (Ue(n, i, r) ? (e = r.sheet(), a = e.getUsedRange()) : n = null, a) return this._parsed = {
|
|
1486
1486
|
copyTo: async (e, t) => (await e.copyFrom(a, t))?.getCoords() ?? null,
|
|
1487
1487
|
getCoords: () => a.getCoords(),
|
|
1488
1488
|
getSource: () => e,
|
|
@@ -1519,7 +1519,7 @@ var ln = class {
|
|
|
1519
1519
|
activeSheetId: 0
|
|
1520
1520
|
}, Q = class {
|
|
1521
1521
|
constructor(e) {
|
|
1522
|
-
this._emitter = new
|
|
1522
|
+
this._emitter = new S(this), this._state = { ...Z }, e?.json && this._fromJSON(e?.json);
|
|
1523
1523
|
}
|
|
1524
1524
|
isShowFormulaBar() {
|
|
1525
1525
|
return this._state.showFormulaBar;
|
|
@@ -1599,7 +1599,7 @@ var ln = class {
|
|
|
1599
1599
|
revision: !1,
|
|
1600
1600
|
password: null,
|
|
1601
1601
|
revisionsPassword: null
|
|
1602
|
-
}), vn = class extends
|
|
1602
|
+
}), vn = class extends ot {
|
|
1603
1603
|
isWindowsAllowed() {
|
|
1604
1604
|
return this._isPropertyAllowed("windows");
|
|
1605
1605
|
}
|
|
@@ -1662,7 +1662,7 @@ function wn(e, t) {
|
|
|
1662
1662
|
return {
|
|
1663
1663
|
...Xe,
|
|
1664
1664
|
getSheet: () => null,
|
|
1665
|
-
toString: () =>
|
|
1665
|
+
toString: () => E(e, t)
|
|
1666
1666
|
};
|
|
1667
1667
|
}
|
|
1668
1668
|
function Tn(e, t = !1) {
|
|
@@ -1685,7 +1685,7 @@ function Tn(e, t = !1) {
|
|
|
1685
1685
|
}
|
|
1686
1686
|
return e;
|
|
1687
1687
|
}
|
|
1688
|
-
var En, Dn, $ = class e extends
|
|
1688
|
+
var En, Dn, $ = class e extends ge {
|
|
1689
1689
|
constructor(e, t, n, r) {
|
|
1690
1690
|
super(e, t, r), this._workbook = n;
|
|
1691
1691
|
}
|
|
@@ -1696,23 +1696,23 @@ var En, Dn, $ = class e extends he {
|
|
|
1696
1696
|
let r = this._options;
|
|
1697
1697
|
return n && (r = {
|
|
1698
1698
|
...this._options,
|
|
1699
|
-
getOptions:
|
|
1699
|
+
getOptions: j(this._options?.getOptions, n)
|
|
1700
1700
|
}), new e(t, this._internal, this._workbook, r);
|
|
1701
1701
|
}
|
|
1702
|
-
_createRange(e,
|
|
1703
|
-
let
|
|
1704
|
-
if (!
|
|
1702
|
+
_createRange(e, t) {
|
|
1703
|
+
let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, O.Visibility.VeryHidden) : null;
|
|
1704
|
+
if (!r) {
|
|
1705
1705
|
let e = this._workbook.getSelectedSheet();
|
|
1706
|
-
return delete
|
|
1707
|
-
scope:
|
|
1706
|
+
return delete n?.scope, wn(n, n ? {
|
|
1707
|
+
scope: h,
|
|
1708
1708
|
...e.getEntireRange().getCoords()
|
|
1709
1709
|
} : null);
|
|
1710
1710
|
}
|
|
1711
|
-
let
|
|
1712
|
-
return
|
|
1711
|
+
let i = this._options;
|
|
1712
|
+
return t && (i = {
|
|
1713
1713
|
...this._options,
|
|
1714
|
-
getOptions:
|
|
1715
|
-
}), new On(e,
|
|
1714
|
+
getOptions: j(this._options.getOptions, t)
|
|
1715
|
+
}), new On(e, D(r.sheet), this._workbook, i);
|
|
1716
1716
|
}
|
|
1717
1717
|
async select(e) {
|
|
1718
1718
|
let t = [], n = null, r = this.getCoords();
|
|
@@ -1736,15 +1736,15 @@ var En, Dn, $ = class e extends he {
|
|
|
1736
1736
|
}
|
|
1737
1737
|
getAddress(e) {
|
|
1738
1738
|
let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
|
|
1739
|
-
return
|
|
1739
|
+
return ce(this.getCoords(), {
|
|
1740
1740
|
...n,
|
|
1741
1741
|
scope: t.getName()
|
|
1742
|
-
},
|
|
1742
|
+
}, E, ne, e);
|
|
1743
1743
|
}
|
|
1744
1744
|
toString() {
|
|
1745
1745
|
return this.getAddress();
|
|
1746
1746
|
}
|
|
1747
|
-
}, On = class e extends
|
|
1747
|
+
}, On = class e extends pe {
|
|
1748
1748
|
constructor(e, t, n, r) {
|
|
1749
1749
|
super(e, t, r), this._workbook = n;
|
|
1750
1750
|
}
|
|
@@ -1752,17 +1752,17 @@ var En, Dn, $ = class e extends he {
|
|
|
1752
1752
|
let n = this._options;
|
|
1753
1753
|
return t && (n = {
|
|
1754
1754
|
...this._options,
|
|
1755
|
-
getOptions:
|
|
1755
|
+
getOptions: j(this._options?.getOptions, t)
|
|
1756
1756
|
}), new $(e, this._internal, this._workbook, n);
|
|
1757
1757
|
}
|
|
1758
1758
|
_createRange(t, n) {
|
|
1759
1759
|
let r = this._internal;
|
|
1760
|
-
if (!t) return
|
|
1761
|
-
if (r.validateCoords(t), r.getSheet().isClosed()) return
|
|
1760
|
+
if (!t) return Ae(r.getSheet(), r.getSheet().getEntireCoords());
|
|
1761
|
+
if (r.validateCoords(t), r.getSheet().isClosed()) return Ae(null, r.getSheet().getEntireCoords(), t);
|
|
1762
1762
|
let i = this._options;
|
|
1763
1763
|
return n && (i = {
|
|
1764
1764
|
...this._options,
|
|
1765
|
-
getOptions:
|
|
1765
|
+
getOptions: j(this._options?.getOptions, n)
|
|
1766
1766
|
}), new e(t, this._internal, this._workbook, i);
|
|
1767
1767
|
}
|
|
1768
1768
|
addListener(e, t) {
|
|
@@ -1775,7 +1775,7 @@ var En, Dn, $ = class e extends he {
|
|
|
1775
1775
|
}
|
|
1776
1776
|
getAddress(e) {
|
|
1777
1777
|
let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
|
|
1778
|
-
return
|
|
1778
|
+
return E(this.getCoords(), {
|
|
1779
1779
|
...n,
|
|
1780
1780
|
scope: t.getName()
|
|
1781
1781
|
});
|
|
@@ -1786,166 +1786,166 @@ var En, Dn, $ = class e extends he {
|
|
|
1786
1786
|
}, kn = class {
|
|
1787
1787
|
constructor(e) {
|
|
1788
1788
|
this._lastTransactionUUID = null, this._closed = !1, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._isDate1904 = !1, this._locale = null, this._localeOverrides = null;
|
|
1789
|
-
let
|
|
1790
|
-
this._origin = typeof
|
|
1789
|
+
let t = typeof e == "string" ? { origin: e } : { ...e }, n = t.origin;
|
|
1790
|
+
this._origin = typeof n == "string" ? new U(null, { name: n }) : n ?? new U(null), delete t.origin, this._lastOriginName = this._origin.getName(), this._listenerOrigin = this._origin.addListeners({ onChange: () => {
|
|
1791
1791
|
if (this._closed) return;
|
|
1792
1792
|
let e = this._origin.getName();
|
|
1793
1793
|
e !== this._lastOriginName && (this._lastOriginName = e, this._emitter.notify("onNameChange"));
|
|
1794
1794
|
} });
|
|
1795
|
-
let
|
|
1796
|
-
delete
|
|
1795
|
+
let r = t.json;
|
|
1796
|
+
delete t.json, this._transactions = t.transactions ?? new s(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new S(this, this._transactions), this._runtime = t.runtime ?? new We("Workbook Runtime", {
|
|
1797
1797
|
isDate1904: () => this._isDate1904,
|
|
1798
|
-
getLocale: () => this._locale ??
|
|
1798
|
+
getLocale: () => this._locale ?? Oe() ?? Le(),
|
|
1799
1799
|
getLocaleOverrides: () => this._localeOverrides
|
|
1800
1800
|
}), this._listenerLanguage = mt.addChangeListener(() => {
|
|
1801
1801
|
this._locale !== null || this._closed || this._notifyAllChange();
|
|
1802
1802
|
});
|
|
1803
|
-
let
|
|
1803
|
+
let i = this, a = this._beginCommit({ description: V(r ? "op.openWorkbook" : "op.newWorkbook") });
|
|
1804
1804
|
try {
|
|
1805
|
-
this._strings =
|
|
1806
|
-
let e =
|
|
1807
|
-
e ||= (e) => new
|
|
1808
|
-
let
|
|
1809
|
-
runtime:
|
|
1810
|
-
readonly:
|
|
1811
|
-
disableLoadAutoFit:
|
|
1812
|
-
formulaTransform:
|
|
1813
|
-
opener:
|
|
1814
|
-
transactions:
|
|
1815
|
-
styles:
|
|
1816
|
-
strings:
|
|
1817
|
-
resources:
|
|
1818
|
-
names:
|
|
1819
|
-
workbook:
|
|
1820
|
-
calculation:
|
|
1821
|
-
resolveRange: (e) =>
|
|
1805
|
+
this._strings = t.strings ?? new he(), this._ownStrings = !t.strings, this._externalBooks = new un({ json: r?.externalBooks }), this._resources = t.resources ?? new st(), this._ownResources = !t.resources, this._createSheetName = t.createSheetNameCallback ?? Cn;
|
|
1806
|
+
let e = t.createSheetCallback;
|
|
1807
|
+
e ||= (e) => new A(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, a, o) => {
|
|
1808
|
+
let s = null, c = {
|
|
1809
|
+
runtime: i._runtime,
|
|
1810
|
+
readonly: i._options.readonly ?? !1,
|
|
1811
|
+
disableLoadAutoFit: i._options.disableLoadAutoFit ?? !1,
|
|
1812
|
+
formulaTransform: i._options.formulaTransform,
|
|
1813
|
+
opener: i._options.opener,
|
|
1814
|
+
transactions: i._transactions,
|
|
1815
|
+
styles: i._styles,
|
|
1816
|
+
strings: i._strings,
|
|
1817
|
+
resources: i._resources,
|
|
1818
|
+
names: i._names,
|
|
1819
|
+
workbook: i,
|
|
1820
|
+
calculation: i._calculation,
|
|
1821
|
+
resolveRange: (e) => i._options.resolveRange?.(e) ?? i.getRange(e),
|
|
1822
1822
|
container: {
|
|
1823
1823
|
beforeFromJSON: (e) => {
|
|
1824
|
-
|
|
1825
|
-
name:
|
|
1826
|
-
id:
|
|
1827
|
-
visibility:
|
|
1824
|
+
s = e, i._addSheetRef({
|
|
1825
|
+
name: n,
|
|
1826
|
+
id: t,
|
|
1827
|
+
visibility: r ?? O.Visibility.Visible,
|
|
1828
1828
|
sheet: e
|
|
1829
|
-
},
|
|
1829
|
+
}, a);
|
|
1830
1830
|
},
|
|
1831
1831
|
getName: () => {
|
|
1832
|
-
let e =
|
|
1833
|
-
return e ? e.name :
|
|
1832
|
+
let e = i._getSheetRef(s);
|
|
1833
|
+
return e ? e.name : n;
|
|
1834
1834
|
},
|
|
1835
1835
|
setName: (e, t) => {
|
|
1836
|
-
|
|
1836
|
+
i._getSheetRef(s) && i._setSheetName(s, e, t);
|
|
1837
1837
|
},
|
|
1838
1838
|
setNameChangeCallback: (e) => {
|
|
1839
|
-
|
|
1839
|
+
i._sheetOnNameChange.set(t, e);
|
|
1840
1840
|
},
|
|
1841
1841
|
getVisibility: () => {
|
|
1842
|
-
let e =
|
|
1843
|
-
return e ? e.visibility :
|
|
1842
|
+
let e = i._getSheetRef(s);
|
|
1843
|
+
return e ? e.visibility : O.Visibility.Visible;
|
|
1844
1844
|
},
|
|
1845
1845
|
setVisibility: (e, t) => {
|
|
1846
|
-
|
|
1846
|
+
i._setSheetVisibility(s, e, t);
|
|
1847
1847
|
},
|
|
1848
1848
|
setVisibilityCallback: (e) => {
|
|
1849
|
-
|
|
1849
|
+
i._sheetOnVisibilityChange.set(t, e);
|
|
1850
1850
|
},
|
|
1851
|
-
duplicate: () =>
|
|
1851
|
+
duplicate: () => i._duplicateSheet(s),
|
|
1852
1852
|
getIndex: () => {
|
|
1853
|
-
let e =
|
|
1854
|
-
return e ?
|
|
1853
|
+
let e = i._getSheetRef(s);
|
|
1854
|
+
return e ? i._getOffsetForId(e.id, i._getSheetRefs(O.Visibility.VeryHidden)) : a;
|
|
1855
1855
|
},
|
|
1856
|
-
setIndex: (e,
|
|
1857
|
-
let
|
|
1858
|
-
return !!
|
|
1856
|
+
setIndex: (e, t) => {
|
|
1857
|
+
let n = i._getSheetRef(s, O.Visibility.VeryHidden);
|
|
1858
|
+
return !!n && (i._moveSheet(n, e, t), !0);
|
|
1859
1859
|
},
|
|
1860
1860
|
setIndexCallback: (e) => {
|
|
1861
|
-
|
|
1861
|
+
i._sheetOnIndexChange.set(t, e);
|
|
1862
1862
|
},
|
|
1863
|
-
requestSelect: async () => (
|
|
1864
|
-
source:
|
|
1865
|
-
params:
|
|
1863
|
+
requestSelect: async () => (i._setSelectedSheet(s), await this._emitter.notify("onRequestSelect", {
|
|
1864
|
+
source: i,
|
|
1865
|
+
params: s,
|
|
1866
1866
|
async: !0
|
|
1867
|
-
}),
|
|
1867
|
+
}), i.getSelectedSheet() === s)
|
|
1868
1868
|
}
|
|
1869
1869
|
};
|
|
1870
|
-
return
|
|
1871
|
-
}, this._namedTableSource = new
|
|
1872
|
-
getSheets: () =>
|
|
1873
|
-
addSheetsListener: (e, t) =>
|
|
1874
|
-
}), this._names =
|
|
1875
|
-
addressToRanges: (e) =>
|
|
1876
|
-
getCurrentScope: () =>
|
|
1877
|
-
isReadOnly: () =>
|
|
1878
|
-
transactions:
|
|
1879
|
-
getSources: () =>
|
|
1880
|
-
}), this._ownNames = !
|
|
1881
|
-
runtime:
|
|
1882
|
-
functions:
|
|
1870
|
+
return o && (c.json = o), s = e(c, n, a, r), s;
|
|
1871
|
+
}, this._namedTableSource = new it({
|
|
1872
|
+
getSheets: () => i._sheets ? i.getSheets().getItems() : I.EmptyArray,
|
|
1873
|
+
addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: e }, t)
|
|
1874
|
+
}), this._names = t.names ?? new we({
|
|
1875
|
+
addressToRanges: (e) => i.getRanges(e),
|
|
1876
|
+
getCurrentScope: () => i.getSelectedSheet().getName(),
|
|
1877
|
+
isReadOnly: () => i._options.readonly ?? !1,
|
|
1878
|
+
transactions: i._transactions,
|
|
1879
|
+
getSources: () => i._calculation ? [i._calculation.getNamedFormulas(), i._namedTableSource] : I.EmptyArray
|
|
1880
|
+
}), this._ownNames = !t.names, this._calculation = t.calculation ?? new ye({
|
|
1881
|
+
runtime: i._runtime,
|
|
1882
|
+
functions: t.functions,
|
|
1883
1883
|
getActiveCell: () => {
|
|
1884
|
-
let e =
|
|
1884
|
+
let e = i.getSelectedSheet(), t = e?.getSelectedRange()?.getCoords();
|
|
1885
1885
|
return t ? {
|
|
1886
1886
|
rowIndex: t.rowStart,
|
|
1887
1887
|
colIndex: t.colStart,
|
|
1888
1888
|
scope: e.getId()
|
|
1889
1889
|
} : null;
|
|
1890
1890
|
},
|
|
1891
|
-
getRange:
|
|
1892
|
-
getRanges:
|
|
1893
|
-
createGraphRanges: (e, t) =>
|
|
1891
|
+
getRange: i.getRange.bind(i),
|
|
1892
|
+
getRanges: i.getRanges.bind(i),
|
|
1893
|
+
createGraphRanges: (e, t) => i._createGraphRanges(e, t),
|
|
1894
1894
|
getSheetIndex: (e) => {
|
|
1895
1895
|
if (e === void 0) {
|
|
1896
|
-
let e =
|
|
1897
|
-
return e ? this._getSheetRefs(
|
|
1896
|
+
let e = i.getSelectedSheet();
|
|
1897
|
+
return e ? this._getSheetRefs(O.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
|
|
1898
1898
|
}
|
|
1899
|
-
let
|
|
1899
|
+
let t = this._getSheetRefs(O.Visibility.VeryHidden);
|
|
1900
1900
|
e = e.toLowerCase();
|
|
1901
|
-
let
|
|
1902
|
-
for (let
|
|
1901
|
+
let n = t.length;
|
|
1902
|
+
for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
|
|
1903
1903
|
try {
|
|
1904
1904
|
An.address = e;
|
|
1905
|
-
let
|
|
1906
|
-
if (!
|
|
1907
|
-
let
|
|
1908
|
-
if (!
|
|
1909
|
-
let
|
|
1910
|
-
|
|
1911
|
-
let
|
|
1912
|
-
for (let e = 0; e <
|
|
1905
|
+
let t = this._names.getItems(An);
|
|
1906
|
+
if (!t || t.length === 0) return -1;
|
|
1907
|
+
let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
|
|
1908
|
+
if (!n) return -1;
|
|
1909
|
+
let r = this._getSheetRefs(O.Visibility.VeryHidden);
|
|
1910
|
+
n = n.toLowerCase();
|
|
1911
|
+
let i = r.length;
|
|
1912
|
+
for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
|
|
1913
1913
|
} catch {
|
|
1914
1914
|
return -1;
|
|
1915
1915
|
}
|
|
1916
1916
|
return -1;
|
|
1917
1917
|
},
|
|
1918
|
-
getSheetCount: () =>
|
|
1918
|
+
getSheetCount: () => i.getSheets().getItems({ visibility: O.Visibility.VeryHidden }).length,
|
|
1919
1919
|
getSheetById: (e) => {
|
|
1920
|
-
let
|
|
1921
|
-
for (let
|
|
1920
|
+
let t = i.getSheets().getItems({ visibility: O.Visibility.VeryHidden }), n = t.length;
|
|
1921
|
+
for (let r = 0; r < n; r++) if (t[r].getId() === e) return t[r];
|
|
1922
1922
|
return null;
|
|
1923
1923
|
},
|
|
1924
1924
|
getSheetByName: (e) => {
|
|
1925
1925
|
try {
|
|
1926
|
-
return
|
|
1926
|
+
return i.getSheets().getByName(e) ?? null;
|
|
1927
1927
|
} catch {
|
|
1928
1928
|
return null;
|
|
1929
1929
|
}
|
|
1930
1930
|
},
|
|
1931
|
-
namedCollection:
|
|
1932
|
-
strings:
|
|
1933
|
-
transactions:
|
|
1934
|
-
names:
|
|
1935
|
-
formulaTransform:
|
|
1936
|
-
}), this._ownCalculation = !
|
|
1937
|
-
let
|
|
1931
|
+
namedCollection: i._names,
|
|
1932
|
+
strings: i._strings,
|
|
1933
|
+
transactions: i._transactions,
|
|
1934
|
+
names: r?.names,
|
|
1935
|
+
formulaTransform: t.formulaTransform
|
|
1936
|
+
}), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
|
|
1937
|
+
let n = async () => {
|
|
1938
1938
|
this._ownCalculation && await this._calculation.start(), await this._scripts.start(), this._starting = null;
|
|
1939
1939
|
};
|
|
1940
|
-
this._starting =
|
|
1940
|
+
this._starting = n(), this._starting?.catch(() => {}), r ? this._fromJSON(r) : (this._initState(), this._addSheet(!1)), this._sheets = new bn((e) => i._addSheetOptions(e), (e, t) => {
|
|
1941
1941
|
if (e) {
|
|
1942
1942
|
let n = this._getSheetRef(e, t);
|
|
1943
1943
|
return n ? [n.sheet] : I.EmptyArray;
|
|
1944
1944
|
}
|
|
1945
1945
|
return this._getSheets(t);
|
|
1946
|
-
}), this._ownCalculation && this._calculation.hydrateNames(), this._emitter.notify("onLoad"),
|
|
1946
|
+
}), this._ownCalculation && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), a.commit({ forceAmend: this._ownTransactions });
|
|
1947
1947
|
} catch (e) {
|
|
1948
|
-
throw
|
|
1948
|
+
throw a.rollback(), e;
|
|
1949
1949
|
}
|
|
1950
1950
|
this._initializing = !1;
|
|
1951
1951
|
}
|
|
@@ -1953,7 +1953,7 @@ var En, Dn, $ = class e extends he {
|
|
|
1953
1953
|
let e = this._getSheetRefs();
|
|
1954
1954
|
for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
|
|
1955
1955
|
let t = this._options;
|
|
1956
|
-
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new
|
|
1956
|
+
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new g().getDefaultTheme(), this._styles = t?.styles ?? new ae(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Q()), this._listenerProtection?.(), this._protection = new vn(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
1957
1957
|
n._emitter.notify("onProtectionChange");
|
|
1958
1958
|
} });
|
|
1959
1959
|
let n = this;
|
|
@@ -2077,19 +2077,19 @@ var En, Dn, $ = class e extends he {
|
|
|
2077
2077
|
let e = this._getSheetRef(this.getSelectedSheetIndex());
|
|
2078
2078
|
return e ? e?.sheet : null;
|
|
2079
2079
|
}
|
|
2080
|
-
getSheet(e,
|
|
2080
|
+
getSheet(e, t = O.Visibility.Visible) {
|
|
2081
2081
|
if (e === void 0) return this.getSelectedSheet();
|
|
2082
2082
|
if (!e) throw Error(H("error.workbook.sheetNameNotProvided"));
|
|
2083
|
-
let
|
|
2084
|
-
if (!
|
|
2085
|
-
return
|
|
2083
|
+
let n = this._getSheetRef(e, t);
|
|
2084
|
+
if (!n) throw new B(H("error.workbook.sheetNameNotFound", { sheetName: e }));
|
|
2085
|
+
return n.sheet;
|
|
2086
2086
|
}
|
|
2087
|
-
getSheetAt(e,
|
|
2088
|
-
let
|
|
2089
|
-
if (!
|
|
2087
|
+
getSheetAt(e, t = O.Visibility.Visible) {
|
|
2088
|
+
let n = this._getSheetRef(e, t);
|
|
2089
|
+
if (!n) throw new B(function(e) {
|
|
2090
2090
|
return H("error.workbook.sheetIndexNotFound", { index: e });
|
|
2091
2091
|
}(e));
|
|
2092
|
-
return
|
|
2092
|
+
return n.sheet;
|
|
2093
2093
|
}
|
|
2094
2094
|
getSheets() {
|
|
2095
2095
|
return this._sheets;
|
|
@@ -2097,18 +2097,18 @@ var En, Dn, $ = class e extends he {
|
|
|
2097
2097
|
addSheet(e) {
|
|
2098
2098
|
return this.getSheets().add(e);
|
|
2099
2099
|
}
|
|
2100
|
-
_getSheets(e =
|
|
2101
|
-
let
|
|
2102
|
-
for (let e = 0; e <
|
|
2103
|
-
return
|
|
2100
|
+
_getSheets(e = O.Visibility.Visible) {
|
|
2101
|
+
let t = this._getSheetRefs(e), n = [], r = t.length;
|
|
2102
|
+
for (let e = 0; e < r; e++) n.push(t[e].sheet);
|
|
2103
|
+
return n;
|
|
2104
2104
|
}
|
|
2105
|
-
_getSheetRefs(e =
|
|
2106
|
-
let
|
|
2107
|
-
return
|
|
2105
|
+
_getSheetRefs(e = O.Visibility.Visible) {
|
|
2106
|
+
let t = this._getState();
|
|
2107
|
+
return t ? e === O.Visibility.Visible ? t.sheetRefsVisible : e === O.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === O.Visibility.VeryHidden ? t.sheetRefsAll : I.EmptyArray : [];
|
|
2108
2108
|
}
|
|
2109
|
-
_getSheetRef(e,
|
|
2110
|
-
let
|
|
2111
|
-
return typeof e == "number" ? this._getSheetRefs(
|
|
2109
|
+
_getSheetRef(e, t = O.Visibility.Visible) {
|
|
2110
|
+
let n = null;
|
|
2111
|
+
return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof A ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
|
|
2112
2112
|
}
|
|
2113
2113
|
_validateNewSheetName(e, t = !0) {
|
|
2114
2114
|
if (e == null) return e;
|
|
@@ -2188,100 +2188,100 @@ var En, Dn, $ = class e extends he {
|
|
|
2188
2188
|
}
|
|
2189
2189
|
return this._updateState({ lastId: i }), e;
|
|
2190
2190
|
}
|
|
2191
|
-
_addSheet(e,
|
|
2192
|
-
|
|
2193
|
-
let
|
|
2194
|
-
if (!
|
|
2195
|
-
return e && this._emitter.notify("onSheetsChange"),
|
|
2191
|
+
_addSheet(e, t = null, n = null) {
|
|
2192
|
+
t = this._nextSheetName(t);
|
|
2193
|
+
let r = this._getState(), i = this._createSheet(r.lastId, t, O.Visibility.Visible, n, null);
|
|
2194
|
+
if (!i) throw new R(H("error.workbook.sheetNameBlank"));
|
|
2195
|
+
return e && this._emitter.notify("onSheetsChange"), i;
|
|
2196
2196
|
}
|
|
2197
2197
|
_updateSheetRefStates(e) {
|
|
2198
2198
|
if (this._closed) throw Error(H("error.workbook.modelClosed"));
|
|
2199
2199
|
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
|
|
2200
|
-
let
|
|
2201
|
-
for (let e = 0; e <
|
|
2200
|
+
let t = e, n = [], r = [], i = t.length;
|
|
2201
|
+
for (let e = 0; e < i; e++) t[e].visibility === O.Visibility.Visible ? (n.push(t[e]), r.push(t[e])) : t[e].visibility === O.Visibility.Hidden && r.push(t[e]);
|
|
2202
2202
|
this._updateState({
|
|
2203
|
-
sheetRefsAll:
|
|
2204
|
-
sheetRefsVisible:
|
|
2205
|
-
sheetRefsVisibleAndHidden:
|
|
2203
|
+
sheetRefsAll: t,
|
|
2204
|
+
sheetRefsVisible: n,
|
|
2205
|
+
sheetRefsVisibleAndHidden: r
|
|
2206
2206
|
});
|
|
2207
2207
|
}
|
|
2208
|
-
_addSheetRef(e,
|
|
2209
|
-
let
|
|
2210
|
-
...
|
|
2208
|
+
_addSheetRef(e, t = null) {
|
|
2209
|
+
let n = this._getState(), r = n.sheetRefsAll, i = Math.max(0, Math.min(r.length, t ?? r.length)), a = [
|
|
2210
|
+
...r.slice(0, i),
|
|
2211
2211
|
e,
|
|
2212
|
-
...
|
|
2212
|
+
...r.slice(i)
|
|
2213
2213
|
];
|
|
2214
|
-
this._updateSheetRefStates(
|
|
2215
|
-
let
|
|
2216
|
-
|
|
2217
|
-
let
|
|
2218
|
-
|
|
2219
|
-
let
|
|
2220
|
-
|
|
2221
|
-
let
|
|
2222
|
-
|
|
2223
|
-
let
|
|
2224
|
-
|
|
2225
|
-
let
|
|
2226
|
-
if (
|
|
2227
|
-
let
|
|
2214
|
+
this._updateSheetRefStates(a);
|
|
2215
|
+
let o = e.sheet, s = e.name.toLowerCase(), c = new Map(n.refsById);
|
|
2216
|
+
c.set(e.id, e);
|
|
2217
|
+
let l = new Map(n.refsByLowerCaseName);
|
|
2218
|
+
l.set(s, e);
|
|
2219
|
+
let u = new Map(n.refsByInstance);
|
|
2220
|
+
u.set(o, e);
|
|
2221
|
+
let d = new Map(n.sheetsById);
|
|
2222
|
+
d.set(e.id, o);
|
|
2223
|
+
let f = new Map(n.sheetsByLowerCaseName);
|
|
2224
|
+
f.set(s, o);
|
|
2225
|
+
let p = this, m = n.listenersSheets;
|
|
2226
|
+
if (o !== void 0) {
|
|
2227
|
+
let t = o.addListeners({
|
|
2228
2228
|
onBeforeDelete: (e) => {
|
|
2229
|
-
|
|
2229
|
+
p._validateDeleteSheet(e);
|
|
2230
2230
|
},
|
|
2231
2231
|
onDelete(e) {
|
|
2232
|
-
let
|
|
2233
|
-
if (!
|
|
2234
|
-
let
|
|
2232
|
+
let t = p._getSheetRef(e, O.Visibility.VeryHidden);
|
|
2233
|
+
if (!t) return;
|
|
2234
|
+
let n = p._beginCommit({ description: H("op.deleteSheet", { name: t.name }) });
|
|
2235
2235
|
try {
|
|
2236
|
-
let
|
|
2237
|
-
|
|
2238
|
-
let c = new Map(
|
|
2239
|
-
c.delete(
|
|
2240
|
-
let l = new Map(
|
|
2241
|
-
l.delete(
|
|
2242
|
-
let u =
|
|
2236
|
+
let r = p._getState(), i = r.sheetRefsAll, a = p._getOffsetForId(t.id, i), s = [...i];
|
|
2237
|
+
s.splice(a, 1), p._updateSheetRefStates(s);
|
|
2238
|
+
let c = new Map(r.refsById);
|
|
2239
|
+
c.delete(t.id);
|
|
2240
|
+
let l = new Map(r.sheetsById);
|
|
2241
|
+
l.delete(t.id);
|
|
2242
|
+
let u = t.name.toLowerCase(), d = new Map(r.refsByLowerCaseName);
|
|
2243
2243
|
d.delete(u);
|
|
2244
|
-
let f = new Map(
|
|
2244
|
+
let f = new Map(r.sheetsByLowerCaseName);
|
|
2245
2245
|
f.delete(u);
|
|
2246
|
-
let
|
|
2247
|
-
|
|
2248
|
-
let h = new Map(
|
|
2249
|
-
h.delete(
|
|
2250
|
-
let g = new Set(
|
|
2251
|
-
g.has(
|
|
2246
|
+
let m = new Map(r.refsByInstance);
|
|
2247
|
+
m.delete(e), r.listenersSheets.get(t.id)();
|
|
2248
|
+
let h = new Map(r.listenersSheets);
|
|
2249
|
+
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");
|
|
2250
|
+
let g = new Set(r.sheetsCreated);
|
|
2251
|
+
g.has(o) && g.delete(o), p._updateState({
|
|
2252
2252
|
refsById: c,
|
|
2253
2253
|
sheetsById: l,
|
|
2254
2254
|
refsByLowerCaseName: d,
|
|
2255
2255
|
sheetsByLowerCaseName: f,
|
|
2256
|
-
refsByInstance:
|
|
2256
|
+
refsByInstance: m,
|
|
2257
2257
|
sheetsCreated: g,
|
|
2258
2258
|
listenersSheets: h
|
|
2259
|
-
}),
|
|
2259
|
+
}), n.commit();
|
|
2260
2260
|
} catch (e) {
|
|
2261
|
-
throw
|
|
2261
|
+
throw n.rollback(), e;
|
|
2262
2262
|
}
|
|
2263
2263
|
}
|
|
2264
|
-
}),
|
|
2265
|
-
|
|
2266
|
-
source:
|
|
2264
|
+
}), r = o.addListeners({ onSelectionChange: (e) => {
|
|
2265
|
+
p.getView().getActiveSheetId() === p._getSheetRef(e)?.id && p._emitter.notify("onSelectionChange", {
|
|
2266
|
+
source: p,
|
|
2267
2267
|
params: e
|
|
2268
2268
|
});
|
|
2269
2269
|
} }, { transactional: !1 });
|
|
2270
|
-
|
|
2271
|
-
|
|
2270
|
+
m = new Map(n.listenersSheets), m.set(e.id, () => {
|
|
2271
|
+
t(), r();
|
|
2272
2272
|
});
|
|
2273
2273
|
}
|
|
2274
|
-
let
|
|
2275
|
-
|
|
2276
|
-
refsById:
|
|
2277
|
-
refsByLowerCaseName:
|
|
2278
|
-
refsByInstance:
|
|
2279
|
-
sheetsById:
|
|
2280
|
-
sheetsByLowerCaseName:
|
|
2281
|
-
listenersSheets:
|
|
2274
|
+
let h = n.lastId;
|
|
2275
|
+
h !== -1 && (h = Math.max(h, e.id)), this._updateState({ lastId: h }), this._updateState({
|
|
2276
|
+
refsById: c,
|
|
2277
|
+
refsByLowerCaseName: l,
|
|
2278
|
+
refsByInstance: u,
|
|
2279
|
+
sheetsById: d,
|
|
2280
|
+
sheetsByLowerCaseName: f,
|
|
2281
|
+
listenersSheets: m
|
|
2282
2282
|
}), this._adjustSheetNamesIfRequired();
|
|
2283
|
-
let
|
|
2284
|
-
return
|
|
2283
|
+
let g = new Set(this._getState().sheetsCreated);
|
|
2284
|
+
return g.add(e.sheet), this._updateState({ sheetsCreated: g }), e;
|
|
2285
2285
|
}
|
|
2286
2286
|
_adjustRemoveSelectionIfRequired(e, t) {
|
|
2287
2287
|
if (this._view.getActiveSheetId() === t) {
|
|
@@ -2290,12 +2290,12 @@ var En, Dn, $ = class e extends he {
|
|
|
2290
2290
|
}
|
|
2291
2291
|
}
|
|
2292
2292
|
_adjustSheetNamesIfRequired() {
|
|
2293
|
-
let e = this._getState(),
|
|
2294
|
-
if (
|
|
2295
|
-
let
|
|
2296
|
-
|
|
2297
|
-
let
|
|
2298
|
-
|
|
2293
|
+
let e = this._getState(), t = e.lastId;
|
|
2294
|
+
if (t === -1) return;
|
|
2295
|
+
let n = this._view.getActiveSheetId();
|
|
2296
|
+
n ??= (this._view.setActiveSheetId(t), t);
|
|
2297
|
+
let r = e.refsById.get(n);
|
|
2298
|
+
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === O.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
|
|
2299
2299
|
}
|
|
2300
2300
|
_validateDeleteSheet(e) {
|
|
2301
2301
|
if (this._closed) throw Error(H("error.workbook.modelClosed"));
|
|
@@ -2340,7 +2340,7 @@ var En, Dn, $ = class e extends he {
|
|
|
2340
2340
|
}
|
|
2341
2341
|
if (!d && s && a === i && (u.done || !c || !u.done && f(u.value.getCoords(), c) >= 0) && (d = !0), d) {
|
|
2342
2342
|
let e = u;
|
|
2343
|
-
return u =
|
|
2343
|
+
return u = Ce, e;
|
|
2344
2344
|
}
|
|
2345
2345
|
let p = u;
|
|
2346
2346
|
return u = l.next(), p;
|
|
@@ -2352,7 +2352,7 @@ var En, Dn, $ = class e extends he {
|
|
|
2352
2352
|
} };
|
|
2353
2353
|
}
|
|
2354
2354
|
replace(e, t, n) {
|
|
2355
|
-
let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ?
|
|
2355
|
+
let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ? me(t) : null, u = n?.description ?? V("op.replace"), d = this._transactions.beginCommit({ description: u });
|
|
2356
2356
|
try {
|
|
2357
2357
|
let u = null, f = null, p = e.next();
|
|
2358
2358
|
for (; !p.done && r < o;) {
|
|
@@ -2416,21 +2416,21 @@ var En, Dn, $ = class e extends he {
|
|
|
2416
2416
|
}
|
|
2417
2417
|
return c;
|
|
2418
2418
|
}
|
|
2419
|
-
_createRange(e,
|
|
2420
|
-
let
|
|
2421
|
-
if (!
|
|
2419
|
+
_createRange(e, t) {
|
|
2420
|
+
let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, O.Visibility.VeryHidden) : null;
|
|
2421
|
+
if (!r) {
|
|
2422
2422
|
let e = this.getSelectedSheet();
|
|
2423
|
-
return e ? (delete
|
|
2424
|
-
scope:
|
|
2423
|
+
return e ? (delete n?.scope, wn(n, n ? {
|
|
2424
|
+
scope: h,
|
|
2425
2425
|
...e.getEntireRange().getCoords()
|
|
2426
2426
|
} : null)) : void console.warn(H("error.workbook.noVisibleRefs"));
|
|
2427
2427
|
}
|
|
2428
|
-
let
|
|
2429
|
-
return
|
|
2428
|
+
let i = r.sheet, a = null;
|
|
2429
|
+
return t && (a = { getOptions: t }), new On(e, D(i), this, a);
|
|
2430
2430
|
}
|
|
2431
2431
|
_createRanges(e, t) {
|
|
2432
2432
|
let n = this.getSelectedSheet(), r = null;
|
|
2433
|
-
return t && (r = { getOptions: t }), new $(e,
|
|
2433
|
+
return t && (r = { getOptions: t }), new $(e, D(n), this, r);
|
|
2434
2434
|
}
|
|
2435
2435
|
getRange(e, t) {
|
|
2436
2436
|
if (e === void 0) return this.getSelectedRange(t);
|
|
@@ -2439,7 +2439,7 @@ var En, Dn, $ = class e extends he {
|
|
|
2439
2439
|
if (n.length !== 1) throw new R(H("error.address.singleRangeOnlyAlt"));
|
|
2440
2440
|
return this._createRange(n[0], t);
|
|
2441
2441
|
} catch (t) {
|
|
2442
|
-
throw t instanceof B ? new B(t.message) : new R(t.message ??
|
|
2442
|
+
throw t instanceof B ? new B(t.message) : new R(t.message ?? o(e));
|
|
2443
2443
|
}
|
|
2444
2444
|
}
|
|
2445
2445
|
getCell(e) {
|
|
@@ -2450,25 +2450,25 @@ var En, Dn, $ = class e extends he {
|
|
|
2450
2450
|
}
|
|
2451
2451
|
getRanges(e, t) {
|
|
2452
2452
|
let n = this._rangesAddressToCoords(e);
|
|
2453
|
-
if (n.length === 0) throw new R(
|
|
2453
|
+
if (n.length === 0) throw new R(o(e));
|
|
2454
2454
|
return this._createRanges(n, t);
|
|
2455
2455
|
}
|
|
2456
|
-
_createGraphRanges(e,
|
|
2457
|
-
let
|
|
2458
|
-
for (let e = 0; e <
|
|
2459
|
-
let
|
|
2460
|
-
|
|
2456
|
+
_createGraphRanges(e, t) {
|
|
2457
|
+
let n = [];
|
|
2458
|
+
for (let e = 0; e < t.length; e++) {
|
|
2459
|
+
let r = t[e], i = (r.sheetName ? this._getSheetRef(r.sheetName, O.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
|
|
2460
|
+
i && n.push(new je(r, D(i), null));
|
|
2461
2461
|
}
|
|
2462
|
-
for (let t = 0; t < e.length; t++)
|
|
2463
|
-
return
|
|
2462
|
+
for (let t = 0; t < e.length; t++) n.push(e[t]);
|
|
2463
|
+
return n.length === 0 ? null : new $(n, D(this.getSelectedSheet()), this, null);
|
|
2464
2464
|
}
|
|
2465
2465
|
getStats(e) {
|
|
2466
2466
|
if (this._closed) throw Error(H("error.workbook.modelClosed"));
|
|
2467
|
-
let
|
|
2468
|
-
if (
|
|
2469
|
-
let
|
|
2470
|
-
for (let
|
|
2471
|
-
return new on(
|
|
2467
|
+
let t = this._getSheets(O.Visibility.VeryHidden), n = t.length;
|
|
2468
|
+
if (n === 1) return t[0].getStats(e);
|
|
2469
|
+
let r = Array(n);
|
|
2470
|
+
for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
|
|
2471
|
+
return new on(r);
|
|
2472
2472
|
}
|
|
2473
2473
|
_activeRangeCoords() {
|
|
2474
2474
|
let e = this.getSelectedSheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
|
|
@@ -2493,7 +2493,7 @@ var En, Dn, $ = class e extends he {
|
|
|
2493
2493
|
getSelectedCell() {
|
|
2494
2494
|
return this.getSelectedSheet().getSelectedCell();
|
|
2495
2495
|
}
|
|
2496
|
-
_rangesAddressToCoords(e, n = !0, r =
|
|
2496
|
+
_rangesAddressToCoords(e, n = !0, r = O.Visibility.Hidden) {
|
|
2497
2497
|
if (!e) throw new R(H("error.address.noAddress"));
|
|
2498
2498
|
let i = this.getSelectedSheet(), a = { ...i?.getEntireRange().getCoords() }, o = i?.getName();
|
|
2499
2499
|
if (o && (a.scope = o), typeof e == "string") {
|
|
@@ -2503,7 +2503,7 @@ var En, Dn, $ = class e extends he {
|
|
|
2503
2503
|
t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
|
|
2504
2504
|
}
|
|
2505
2505
|
}
|
|
2506
|
-
let s = this, c =
|
|
2506
|
+
let s = this, c = le(e, a, t, (e) => {
|
|
2507
2507
|
if (!n) return null;
|
|
2508
2508
|
if (typeof e == "string") {
|
|
2509
2509
|
let t = s.getNames().getByName(e)?.getRanges?.();
|
|
@@ -2514,10 +2514,10 @@ var En, Dn, $ = class e extends he {
|
|
|
2514
2514
|
for (let e = 0; e < l; e++) this._validateCoords(c[e], r);
|
|
2515
2515
|
return c;
|
|
2516
2516
|
}
|
|
2517
|
-
_validateCoords(e,
|
|
2517
|
+
_validateCoords(e, t = O.Visibility.Visible, n = H("error.sheet.oobRange")) {
|
|
2518
2518
|
if (e === null) return;
|
|
2519
|
-
let
|
|
2520
|
-
if (!L.isRangeWithinRange(e,
|
|
2519
|
+
let r = this.getSheet(e.scope, t).getEntireRange().getCoords();
|
|
2520
|
+
if (!L.isRangeWithinRange(e, r)) throw new B(n);
|
|
2521
2521
|
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new R(H("error.address.invalidRangeInverted"));
|
|
2522
2522
|
}
|
|
2523
2523
|
_updateSheetRef(e, t) {
|
|
@@ -2558,29 +2558,29 @@ var En, Dn, $ = class e extends he {
|
|
|
2558
2558
|
}
|
|
2559
2559
|
return a;
|
|
2560
2560
|
}
|
|
2561
|
-
_setSheetVisibility(e,
|
|
2561
|
+
_setSheetVisibility(e, t = O.Visibility.Visible, n) {
|
|
2562
2562
|
if (this._closed) throw Error(H("error.workbook.modelClosed"));
|
|
2563
2563
|
if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
|
|
2564
|
-
let
|
|
2565
|
-
if (!
|
|
2566
|
-
if (
|
|
2567
|
-
let
|
|
2568
|
-
|
|
2569
|
-
let
|
|
2564
|
+
let r = this._getSheetRef(e, O.Visibility.VeryHidden);
|
|
2565
|
+
if (!r) return null;
|
|
2566
|
+
if (t === r.visibility) return;
|
|
2567
|
+
let i = null, a = "";
|
|
2568
|
+
t === O.Visibility.Visible ? a = V("op.unhideSheet") : t === O.Visibility.Hidden ? a = V("op.hideSheet") : t === O.Visibility.VeryHidden && (a = V("op.veryHideSheet"));
|
|
2569
|
+
let o = this.beginCommit(a);
|
|
2570
2570
|
try {
|
|
2571
2571
|
let e = this._getState().sheetRefsVisible;
|
|
2572
|
-
if (
|
|
2573
|
-
let
|
|
2574
|
-
...
|
|
2575
|
-
visibility:
|
|
2576
|
-
},
|
|
2577
|
-
|
|
2572
|
+
if (t !== O.Visibility.Visible && e.length === 1 && e[0].id === r.id) throw new R(H("error.workbook.sheetOne"));
|
|
2573
|
+
let a = {
|
|
2574
|
+
...r,
|
|
2575
|
+
visibility: t
|
|
2576
|
+
}, s = -1;
|
|
2577
|
+
t !== O.Visibility.Visible && (s = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, a).sheet, t !== O.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, r.id), this._adjustSheetNamesIfRequired(), o.commit(n);
|
|
2578
2578
|
} catch (e) {
|
|
2579
|
-
throw
|
|
2579
|
+
throw o.rollback(), e;
|
|
2580
2580
|
}
|
|
2581
2581
|
return this._sheetOnVisibilityChange.forEach((e, t) => {
|
|
2582
|
-
|
|
2583
|
-
}), this._emitter.notify("onSheetsChange"),
|
|
2582
|
+
r.id === t && e();
|
|
2583
|
+
}), this._emitter.notify("onSheetsChange"), i;
|
|
2584
2584
|
}
|
|
2585
2585
|
_moveSheet(e, t, n) {
|
|
2586
2586
|
if (this._closed) throw Error(H("error.workbook.modelClosed"));
|
|
@@ -2612,10 +2612,10 @@ var En, Dn, $ = class e extends he {
|
|
|
2612
2612
|
}
|
|
2613
2613
|
_setSelectedSheet(e) {
|
|
2614
2614
|
if (this._closed) throw Error(H("error.workbook.modelClosed"));
|
|
2615
|
-
let
|
|
2616
|
-
if (!
|
|
2617
|
-
let
|
|
2618
|
-
return
|
|
2615
|
+
let t = this._getSheetRef(e);
|
|
2616
|
+
if (!t) throw new R(yn(e));
|
|
2617
|
+
let n = null;
|
|
2618
|
+
return t.visibility !== O.Visibility.Visible && this._setSheetVisibility(t, O.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
|
|
2619
2619
|
}
|
|
2620
2620
|
getProtection() {
|
|
2621
2621
|
return this._protection;
|
|
@@ -2683,24 +2683,24 @@ var En, Dn, $ = class e extends he {
|
|
|
2683
2683
|
}
|
|
2684
2684
|
_fromJSON(e) {
|
|
2685
2685
|
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new R(H("error.workbook.sheetOne"));
|
|
2686
|
-
e.theme && (this._theme = new
|
|
2687
|
-
let
|
|
2686
|
+
e.theme && (this._theme = new m(e.theme), this._styles.setTheme(this._theme));
|
|
2687
|
+
let t = this._strings.beginPersist(), n = this._resources.beginPersist(), r = this._styles.beginPersist();
|
|
2688
2688
|
try {
|
|
2689
|
-
|
|
2690
|
-
let
|
|
2691
|
-
|
|
2692
|
-
let
|
|
2693
|
-
for (let e = 0; e <
|
|
2694
|
-
let
|
|
2695
|
-
|
|
2689
|
+
t.fromJSON(e.strings), n.fromJSON(e.resources), r.fromJSON(e.styles), e.date1904 && (this._isDate1904 = !0), e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
|
|
2690
|
+
let i = e.sheets, a = i.length, o = e.view.activeSheetId ?? null;
|
|
2691
|
+
o !== null && (o = Math.min(Math.max(0, o), a - 1));
|
|
2692
|
+
let s = null, c = null, l = -1;
|
|
2693
|
+
for (let e = 0; e < a; e++) {
|
|
2694
|
+
let t = i[e], n = t.visibility || O.Visibility.Visible, r = e;
|
|
2695
|
+
c = r, n === O.Visibility.Visible ? (l++, s === null && (s = r)) : o !== null && o === r && (o = null), this._createSheet(r, t.name, n, l, t.sheet);
|
|
2696
2696
|
}
|
|
2697
|
-
this._updateState({ lastId:
|
|
2698
|
-
let
|
|
2697
|
+
this._updateState({ lastId: c }), e.view.activeSheetId = o ?? s, this.setView(new Q({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
|
|
2698
|
+
let u = this;
|
|
2699
2699
|
this._protection = new vn(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
2700
|
-
|
|
2700
|
+
u._emitter.notify("onProtectionChange", { source: e });
|
|
2701
2701
|
} }), e.scripts && (this._scripts = this._createScripts(e.scripts)), this._emitter.notify("onLoad");
|
|
2702
2702
|
} finally {
|
|
2703
|
-
|
|
2703
|
+
r.endPersist(), n.endPersist(), t.endPersist();
|
|
2704
2704
|
}
|
|
2705
2705
|
}
|
|
2706
2706
|
_createScripts(e) {
|
|
@@ -2712,7 +2712,7 @@ var En, Dn, $ = class e extends he {
|
|
|
2712
2712
|
getBuiltInFunctions: () => t._calculation?.getFunctions(),
|
|
2713
2713
|
onAdd: (e, n) => {
|
|
2714
2714
|
let r = t._calculation;
|
|
2715
|
-
r.getStatus() !==
|
|
2715
|
+
r.getStatus() !== Ye.Status.Off && r.start().then(async () => {
|
|
2716
2716
|
let e = n.getFunctions().getItems({ type: "formula" }), t = e.length;
|
|
2717
2717
|
for (let n = 0; n < t; n++) {
|
|
2718
2718
|
let t = e[n];
|
|
@@ -2730,47 +2730,47 @@ var En, Dn, $ = class e extends he {
|
|
|
2730
2730
|
async toJSON(e) {
|
|
2731
2731
|
if (this._closed) throw Error(H("error.workbook.modelClosed"));
|
|
2732
2732
|
await Promise.resolve(this._starting), await this._emitter.notify("onBeforeSave", { async: !0 });
|
|
2733
|
-
let
|
|
2734
|
-
if (!
|
|
2733
|
+
let t = { sheets: [] }, n = e?.ignoreStyles ?? !1;
|
|
2734
|
+
if (!n) {
|
|
2735
2735
|
let e = this._theme.toJSON();
|
|
2736
|
-
(e ? Object.keys(e).length : 0) > 0 && (
|
|
2736
|
+
(e ? Object.keys(e).length : 0) > 0 && (t.theme = e);
|
|
2737
2737
|
}
|
|
2738
2738
|
if (this._scripts) {
|
|
2739
2739
|
let e = this._scripts.toJSON();
|
|
2740
|
-
e && Object.keys(e).length > 0 && (
|
|
2740
|
+
e && Object.keys(e).length > 0 && (t.scripts = e);
|
|
2741
2741
|
}
|
|
2742
|
-
this._isDate1904 && (
|
|
2743
|
-
let
|
|
2742
|
+
this._isDate1904 && (t.date1904 = !0), this._locale && (t.locale = this._locale), this._localeOverrides && (t.localeOverrides = this._localeOverrides);
|
|
2743
|
+
let r = e?.ignoreResources ?? !1, i = this._strings.beginPersist(), a = r ? null : this._resources.beginPersist(), o = this._styles.beginPersist();
|
|
2744
2744
|
try {
|
|
2745
|
-
let
|
|
2746
|
-
for (let
|
|
2747
|
-
let
|
|
2748
|
-
name:
|
|
2749
|
-
sheet:
|
|
2745
|
+
let s = this._getSheetRef(this.getSelectedSheetIndex()).id, c = s, l = null, u = this._getState(), d = u.sheetRefsAll, f = u.sheetsById, p = d.length;
|
|
2746
|
+
for (let n = 0; n < p; n++) {
|
|
2747
|
+
let r = d[n], i = n + 1, a = await f.get(r.id).toJSON(e), o = {
|
|
2748
|
+
name: r.name,
|
|
2749
|
+
sheet: a
|
|
2750
2750
|
};
|
|
2751
|
-
|
|
2751
|
+
r.visibility === O.Visibility.Visible ? l === null && (l = i) : o.visibility = r.visibility, r.id === s && (c = i), t.sheets.push(o);
|
|
2752
2752
|
}
|
|
2753
|
-
if (!
|
|
2754
|
-
let e =
|
|
2755
|
-
e && Object.keys(e).length > 0 && (
|
|
2753
|
+
if (!n) {
|
|
2754
|
+
let e = o.toJSON();
|
|
2755
|
+
e && Object.keys(e).length > 0 && (t.styles = e);
|
|
2756
2756
|
}
|
|
2757
|
-
let
|
|
2758
|
-
|
|
2759
|
-
let
|
|
2760
|
-
|
|
2761
|
-
let
|
|
2762
|
-
if (
|
|
2763
|
-
let e = await
|
|
2764
|
-
e && e.length > 0 && (
|
|
2757
|
+
let m = this.getProtection().toJSON();
|
|
2758
|
+
m && (t.protection = m);
|
|
2759
|
+
let h = await i.toJSONAsync();
|
|
2760
|
+
h && h.length > 0 && (t.strings = h);
|
|
2761
|
+
let g = this._externalBooks.toJSON();
|
|
2762
|
+
if (g && (t.externalBooks = g), !r) {
|
|
2763
|
+
let e = await a.toJSONAsync();
|
|
2764
|
+
e && e.length > 0 && (t.resources = e);
|
|
2765
2765
|
}
|
|
2766
|
-
let
|
|
2767
|
-
|
|
2768
|
-
let
|
|
2769
|
-
|
|
2766
|
+
let _ = this._calculation.getNamedFormulas().toJSON();
|
|
2767
|
+
_ && _.length > 0 && (t.names = _);
|
|
2768
|
+
let v = this._view.toJSON();
|
|
2769
|
+
v && (c === l ? delete v.activeSheetId : v.activeSheetId = c, Object.keys(v).length > 0 && (t.view = v));
|
|
2770
2770
|
} finally {
|
|
2771
|
-
|
|
2771
|
+
o.endPersist(), r || a.endPersist(), i.endPersist();
|
|
2772
2772
|
}
|
|
2773
|
-
return this._emitter.notify("onSave", { params:
|
|
2773
|
+
return this._emitter.notify("onSave", { params: t }), t;
|
|
2774
2774
|
}
|
|
2775
2775
|
isClosed() {
|
|
2776
2776
|
return this._closed;
|
|
@@ -2911,7 +2911,7 @@ var En, Dn, $ = class e extends he {
|
|
|
2911
2911
|
}
|
|
2912
2912
|
}, Mn = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Nn = class {
|
|
2913
2913
|
constructor() {
|
|
2914
|
-
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new
|
|
2914
|
+
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new S(this), this._registry = new jn(), this._defaultStore = new wt(() => this.getWriteFormats(), () => this.getReadFormats());
|
|
2915
2915
|
}
|
|
2916
2916
|
getBackingStore() {
|
|
2917
2917
|
return this._backingStore ?? this._defaultStore;
|
|
@@ -2970,7 +2970,7 @@ var En, Dn, $ = class e extends he {
|
|
|
2970
2970
|
search: i,
|
|
2971
2971
|
ext: a
|
|
2972
2972
|
}))[0];
|
|
2973
|
-
if (!o) throw
|
|
2973
|
+
if (!o) throw new R(H("error.io.readFormatUnavailable", { format: i ?? a }));
|
|
2974
2974
|
let s = n?.typedCreateWorkbookOptions, c = s ? Object.keys(s).find((e) => e.toLowerCase() === o.key.toLowerCase()) : void 0, l = {
|
|
2975
2975
|
...n,
|
|
2976
2976
|
...c === void 0 ? void 0 : s[c]
|
|
@@ -3031,7 +3031,10 @@ var En, Dn, $ = class e extends he {
|
|
|
3031
3031
|
bytes: i,
|
|
3032
3032
|
password: n.password
|
|
3033
3033
|
};
|
|
3034
|
-
if (!n?.onPassword)
|
|
3034
|
+
if (!n?.onPassword) {
|
|
3035
|
+
let e = t.getName();
|
|
3036
|
+
throw new vt(e ? H("error.io.passwordRequired", { name: e }) : H("error.io.passwordRequiredUnnamed"));
|
|
3037
|
+
}
|
|
3035
3038
|
let o = await Promise.resolve(n.onPassword({
|
|
3036
3039
|
origin: t,
|
|
3037
3040
|
encryption: r.key,
|
|
@@ -3042,12 +3045,12 @@ var En, Dn, $ = class e extends he {
|
|
|
3042
3045
|
bytes: i,
|
|
3043
3046
|
password: o
|
|
3044
3047
|
};
|
|
3045
|
-
throw new ht();
|
|
3048
|
+
throw new ht(H("error.io.passwordIncorrect"));
|
|
3046
3049
|
}
|
|
3047
3050
|
async writeArrayBuffer(e, t) {
|
|
3048
3051
|
if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
|
|
3049
3052
|
let n = (await this._registry.getWriteFormats({ search: t.format }))[0];
|
|
3050
|
-
if (!n) throw
|
|
3053
|
+
if (!n) throw new R(H("error.io.writeFormatUnavailable", { format: t.format }));
|
|
3051
3054
|
return this._writeArrayBuffer(e, n, t);
|
|
3052
3055
|
}
|
|
3053
3056
|
async write(e, t, n) {
|
|
@@ -3056,16 +3059,19 @@ var En, Dn, $ = class e extends he {
|
|
|
3056
3059
|
let r = n, i = null;
|
|
3057
3060
|
typeof t == "string" ? i = this.getOrigin(t) : Mn(t) ? i = t : t && (r = t);
|
|
3058
3061
|
let a = !i, o = i ?? e.getOrigin(), s = o.getFormat(), c;
|
|
3059
|
-
if ((r?.format || s) && (c = (await this._registry.getWriteFormats({ search: r?.format ?? s ?? void 0 }))[0]), c || o.getPath() && o.canWrite() && o.getExtension() || (c = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !c) throw
|
|
3062
|
+
if ((r?.format || s) && (c = (await this._registry.getWriteFormats({ search: r?.format ?? s ?? void 0 }))[0]), c || o.getPath() && o.canWrite() && o.getExtension() || (c = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !c) throw new R(H("error.io.writeFormatUnresolved"));
|
|
3060
3063
|
if (i && typeof t == "string") {
|
|
3061
3064
|
let e = i.getPath();
|
|
3062
|
-
e && !
|
|
3065
|
+
e && !x(e) && i.update?.({ path: `${e}.${c.exts[0]}` });
|
|
3063
3066
|
}
|
|
3064
3067
|
let l = o.getEncryption(), u = e.getOrigin?.(), d = (o instanceof U ? o.getPassword() : null) ?? (u instanceof U ? u.getPassword() : null), f = o.isEncrypted() || (u?.isEncrypted() ?? !1), p = r?.password === void 0 ? d ?? (f ? void 0 : null) : r.password, m = null;
|
|
3065
3068
|
if (p === void 0) {
|
|
3066
|
-
if (f)
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
+
if (f) {
|
|
3070
|
+
let e = o.getName();
|
|
3071
|
+
throw new vt(e ? H("error.io.passwordRequiredSave", { name: e }) : H("error.io.passwordRequiredSaveUnnamed"));
|
|
3072
|
+
}
|
|
3073
|
+
} else if (p !== null && (m = await this._registry.getEncryption(l), !m)) throw new R(H("error.io.encryptionUnavailable"));
|
|
3074
|
+
let h = `${o.getName() ?? H("workbook.defaultName")}.${c.exts[0]}`, g = r?.progress, _ = !1, v = this, y = null, ee = {
|
|
3069
3075
|
workbook: e,
|
|
3070
3076
|
format: c,
|
|
3071
3077
|
origin: o,
|
|
@@ -3098,7 +3104,7 @@ var En, Dn, $ = class e extends he {
|
|
|
3098
3104
|
g?.onComplete && await Promise.resolve(g.onComplete(b));
|
|
3099
3105
|
} catch (e) {
|
|
3100
3106
|
let t = e instanceof Error ? e : Error(String(e));
|
|
3101
|
-
throw g?.onError && await Promise.resolve(g.onError(t)), g?.onComplete && await Promise.resolve(g.onComplete(null)), Error("
|
|
3107
|
+
throw g?.onError && await Promise.resolve(g.onError(t)), g?.onComplete && await Promise.resolve(g.onComplete(null)), t instanceof R ? t : Error(H("error.io.writeFailed", { reason: t.message }), { cause: e });
|
|
3102
3108
|
}
|
|
3103
3109
|
return b;
|
|
3104
3110
|
}
|
|
@@ -3106,7 +3112,7 @@ var En, Dn, $ = class e extends he {
|
|
|
3106
3112
|
if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
|
|
3107
3113
|
let r = e?.getOrigin?.();
|
|
3108
3114
|
if (!(r instanceof U)) return this.write(e, t, n);
|
|
3109
|
-
let i = typeof t == "string" ? t : t.getPath(), a = i &&
|
|
3115
|
+
let i = typeof t == "string" ? t : t.getPath(), a = i && x(i)?.toLowerCase() || null, o = a ? (await this._registry.getWriteFormats({ search: a }))[0]?.key ?? a : null, s = {
|
|
3110
3116
|
path: r.getPath(),
|
|
3111
3117
|
name: r.getName(),
|
|
3112
3118
|
format: r.getFormat(),
|
|
@@ -3127,7 +3133,7 @@ var En, Dn, $ = class e extends he {
|
|
|
3127
3133
|
return c;
|
|
3128
3134
|
}
|
|
3129
3135
|
_stripExtension(e) {
|
|
3130
|
-
let t =
|
|
3136
|
+
let t = x(e);
|
|
3131
3137
|
return t ? e.slice(0, e.length - t.length - 1) : e;
|
|
3132
3138
|
}
|
|
3133
3139
|
_baseName(e) {
|
|
@@ -3136,29 +3142,28 @@ var En, Dn, $ = class e extends he {
|
|
|
3136
3142
|
return this._stripExtension(n) || null;
|
|
3137
3143
|
}
|
|
3138
3144
|
async _writeArrayBuffer(e, t, n) {
|
|
3139
|
-
if (!t) throw Error(
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
});
|
|
3147
|
-
} catch (e) {
|
|
3148
|
-
throw Error(`Unable to load handler for '${t}.'`, { cause: e });
|
|
3149
|
-
}
|
|
3145
|
+
if (!t) throw Error("A write format must be provided.");
|
|
3146
|
+
let r = t.handler;
|
|
3147
|
+
if (!r) throw Error(`Unable to resolve a write handler for '${t.key}'.`);
|
|
3148
|
+
return r(e, {
|
|
3149
|
+
...n,
|
|
3150
|
+
format: t.key
|
|
3151
|
+
});
|
|
3150
3152
|
}
|
|
3151
3153
|
async _readArrayBuffer(e, t, n) {
|
|
3152
3154
|
if (!e) throw Error("ArrayBuffer must be specified.");
|
|
3153
3155
|
if (!t) throw Error("format must be specified.");
|
|
3154
3156
|
if (e.byteLength === 0) return new kn(n?.createWorkbookOptions);
|
|
3155
3157
|
let r = t.handler;
|
|
3156
|
-
if (!r) throw Error(`Unable to resolve handler for
|
|
3158
|
+
if (!r) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
|
|
3157
3159
|
let i;
|
|
3158
3160
|
try {
|
|
3159
3161
|
i = await r(e, n);
|
|
3160
3162
|
} catch (e) {
|
|
3161
|
-
throw
|
|
3163
|
+
throw e instanceof R ? e : new R(H("error.io.readFailed", {
|
|
3164
|
+
format: t.description ?? t.key,
|
|
3165
|
+
reason: e?.message ?? String(e)
|
|
3166
|
+
}), { cause: e });
|
|
3162
3167
|
}
|
|
3163
3168
|
return i;
|
|
3164
3169
|
}
|
|
@@ -3208,7 +3213,7 @@ function Vn(e = 6e4) {
|
|
|
3208
3213
|
return new Date(Math.floor(Date.now() / e) * e);
|
|
3209
3214
|
}
|
|
3210
3215
|
zn ||= {};
|
|
3211
|
-
var Hn = class extends
|
|
3216
|
+
var Hn = class extends Ge {
|
|
3212
3217
|
constructor(e) {
|
|
3213
3218
|
super(e);
|
|
3214
3219
|
}
|
|
@@ -3224,5 +3229,5 @@ var Hn = class extends Ce {
|
|
|
3224
3229
|
getRanges: (e) => null
|
|
3225
3230
|
}, super._initializeOptions(e);
|
|
3226
3231
|
}
|
|
3227
|
-
}, Un = "0.7.28-beta.
|
|
3228
|
-
export {
|
|
3232
|
+
}, Un = "0.7.28-beta.3", Wn = "Mon Aug 24 2026";
|
|
3233
|
+
export { Fe as AddressUtils, Fn as ArrayBackingStore, Se as AutoFill, Wn as BUILD_DATE, w as Color, Re as Condition, Bn as DateUtils, Nn as DefaultWorkbookIO, gn as ExternalRangeClipboardItem, Ln as FONTS_KIND, Rt as FontUtils, De as GeomUtils, lt as IAnchored, Je as IBorder, Ye as ICalculation, xe as ICell, Qt as ICellHeaderRange, nt as ICellRange, Zt as ICellRanges, C as IColor, de as ICondition, ve as IConditionalFormat, Qe as IDataValidation, Lt as IEffect, i as IFill, k as IFont, kt as IFontCollection, zn as IMovable, Dn as IPicture, En as IPrint, Xt as IResource, O as ISheet, He as ISheetView, Ft as ISort, It as IStroke, ut as IStyle, d as ITableStyle, at as IText, a as ITextFrame, Yt as ITheme, re as IThemeCollection, bt as IWorkbookIO, In as LOCALES_KIND, Ke as LicenseManager, M as NumberFormat, hn as RangeClipboardItem, ee as Registry, ie as Resource, st as ResourceCollection, Rn as SHEETXL_RESOURCE_KINDS, p as SYSTEM_COLOR_CSS_PREFIX, A as Sheet, Ot as SimpleFontFace, Be as Sort, he as StringCollection, ae as StyleCollection, Hn as Table, rt as TextRotation, ct as TextUtils, m as Theme, g as ThemeCollection, l as TransactionConflictError, St as TransactionSaveStateManager, s as TransactionStore, xt as TransactionUndoManager, be as Tuple, Un as VERSION, kn as Workbook, Pn as WorkbookIO, U as WorkbookOrigin, Q as WorkbookView, Jt as builtInStyleNameDisplay, et as createCellRangeCounts, tn as getBuiltInFunctionNames, Ve as getLanguagePack, Te as getLocaleProfile, Ze as localizeBoolean, _e as localizeErrorLabel, ue as makeLocaleProfile, Pe as parseBooleanLocal, tt as parseErrorLocal, nn as parseFormulaLiteral, fe as registerSdkLocales };
|