@sheetxl/query 0.8.0-beta.17 → 0.8.0-beta.18
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/esm/index.mjs +1035 -967
- package/node/esm/index.mjs +956 -885
- package/package.json +3 -3
- package/types/src/markdown/appendSections.d.ts +11 -0
- package/types/src/markdown/describeSparkline.d.ts +15 -0
package/node/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/query - SheetXL - Workbook read surface and renderers (grep, reports) — capabilities declared once, adapted by any host surface - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/query - SheetXL - Workbook read surface and renderers (grep, reports) — capabilities declared once, adapted by any host surface - v0.8.0-beta.18
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: SheetXL EULA — https://www.sheetxl.com/eula
|
|
@@ -76,7 +76,7 @@ function j(e) {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
if (M(e)) {
|
|
79
|
-
const t =
|
|
79
|
+
const t = I(e);
|
|
80
80
|
return {
|
|
81
81
|
match: t,
|
|
82
82
|
display: t
|
|
@@ -88,10 +88,10 @@ function j(e) {
|
|
|
88
88
|
display: t
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
var M = (e) => "object" == typeof e && null !== e && !n.isError(e) && "function" == typeof e.getKind && e.getKind().getName() === t.Type,
|
|
91
|
+
var M = (e) => "object" == typeof e && null !== e && !n.isError(e) && "function" == typeof e.getKind && e.getKind().getName() === t.Type, I = (e) => {
|
|
92
92
|
const t = e.getAltText();
|
|
93
93
|
return t ? `[image: ${e.getSource()} "${t}"]` : `[image: ${e.getSource()}]`;
|
|
94
|
-
},
|
|
94
|
+
}, F = {
|
|
95
95
|
Display: "display",
|
|
96
96
|
Value: "value",
|
|
97
97
|
Formula: "formula",
|
|
@@ -141,6 +141,8 @@ var M = (e) => "object" == typeof e && null !== e && !n.isError(e) && "function"
|
|
|
141
141
|
[O.LiteralMatchesInput, "typed number equals an unread input"],
|
|
142
142
|
[O.TwinBlockDivergence, "differs from its twin formulas"],
|
|
143
143
|
[O.ScaleOutlier, "off the scale of its format"],
|
|
144
|
+
[O.UnreferencedInput, "input nothing reads"],
|
|
145
|
+
[O.RowGap, "gap in a labeled row"],
|
|
144
146
|
[O.ConstantFrequency, "constant"]
|
|
145
147
|
]);
|
|
146
148
|
function D(e, t) {
|
|
@@ -197,9 +199,17 @@ function D(e, t) {
|
|
|
197
199
|
}
|
|
198
200
|
case O.ConstantFrequency: {
|
|
199
201
|
const e = Number(o.uses ?? 1);
|
|
200
|
-
return `${r} ${
|
|
202
|
+
return `${r} ${U(o)} · typed in ${e} place${1 === e ? "" : "s"}, of ${o.of} constants`;
|
|
201
203
|
}
|
|
202
204
|
case O.ScaleOutlier: return `${r} · ${o.times}× the typical ${o.format} on the sheet, ${o.typical} over ${o.of}`;
|
|
205
|
+
case O.UnreferencedInput: {
|
|
206
|
+
const e = void 0 !== o.value ? `${o.value}` : `${o.cells} cells`;
|
|
207
|
+
return `${r} · ${z(o.label, o.labelAt, n)} ${e}, read by no formula in the workbook`;
|
|
208
|
+
}
|
|
209
|
+
case O.RowGap: {
|
|
210
|
+
const e = [void 0 !== o.above ? z(o.above, o.aboveAt, n) : null, void 0 !== o.below ? z(o.below, o.belowAt, n) : null].filter(Boolean), t = 2 === e.length ? `${e[0]} and ${e[1]} are filled` : 1 === e.length ? `${e[0]} is filled` : "its block is filled", s = void 0 !== o.header ? ` · the period ${z(o.header, o.headerAt, n)} no row of the block fills` : "", l = Number(o.of ?? 0), a = "row" === o.kind ? `nothing in its ${l} cell${1 === l ? "" : "s"}` : `${o.missing} of ${l} cells empty`, i = "own" === o.labelFont ? " · label font differs from its neighbors: a heading?" : "";
|
|
211
|
+
return `${r} · row ${z(o.label, o.labelAt, n)}: ${a} where ${t}${s}${i}`;
|
|
212
|
+
}
|
|
203
213
|
default: return r;
|
|
204
214
|
}
|
|
205
215
|
}
|
|
@@ -216,7 +226,7 @@ function B(e) {
|
|
|
216
226
|
return Array.isArray(o) && o.length > 0 && t.push(`also changes: ${o.join(", ")}`), t.map((e) => ` · ${e}`).join("");
|
|
217
227
|
}
|
|
218
228
|
var z = (e, t, n) => `${JSON.stringify(String(e ?? ""))} (${J(String(t ?? ""), n)})`;
|
|
219
|
-
var
|
|
229
|
+
var U = (e) => "string" === e.kind ? JSON.stringify(String(e.value ?? "")) : String(e.value ?? ""), _ = (e) => e.length > 0 && e.every((e) => e.check === O.ConstantFrequency);
|
|
220
230
|
function J(e, t) {
|
|
221
231
|
return e.replace(G, (e, n, o) => {
|
|
222
232
|
const r = X(n, t.rowIndex, q), s = X(o, t.colIndex, K);
|
|
@@ -433,7 +443,7 @@ function he(e, t, n) {
|
|
|
433
443
|
}
|
|
434
444
|
function fe(e) {
|
|
435
445
|
const t = new ie();
|
|
436
|
-
return t.h1(`Table — ${e.getName()}`), t.fact(de(e, [["range",
|
|
446
|
+
return t.h1(`Table — ${e.getName()}`), t.fact(de(e, [["range", Vt(e.getRange())]])), t.toLines().join("\n").trimEnd();
|
|
437
447
|
}
|
|
438
448
|
var me = l.Feature;
|
|
439
449
|
function pe(e, t) {
|
|
@@ -454,8 +464,8 @@ function pe(e, t) {
|
|
|
454
464
|
const n = c ? a.getRangeAt(f, i.colStart + t, C, i.colStart + t) : a.getRangeAt(i.rowStart + t, m, i.rowStart + t, E);
|
|
455
465
|
j.push(Ee(e, c, t, u.names)), M.push(Re(n, r));
|
|
456
466
|
}
|
|
457
|
-
const
|
|
458
|
-
g > R &&
|
|
467
|
+
const I = j.length ? Math.max(...j.map((e) => e.length)) : 0, F = j.map((e, t) => `${e.padEnd(I)} ${M[t]}`);
|
|
468
|
+
g > R && F.push(`…${g - R} more ${c ? "columns" : "rows"} not profiled · read them with getStats()`);
|
|
459
469
|
const T = [
|
|
460
470
|
d,
|
|
461
471
|
u.note,
|
|
@@ -464,7 +474,7 @@ function pe(e, t) {
|
|
|
464
474
|
return S && T.push(`profiled from the first ${c ? `${x} rows` : `${k} columns`} of ${c ? y : b}`), {
|
|
465
475
|
shape: u.present ? "table" : "block",
|
|
466
476
|
summary: T.filter(Boolean).join(" · "),
|
|
467
|
-
series:
|
|
477
|
+
series: F
|
|
468
478
|
};
|
|
469
479
|
}
|
|
470
480
|
function $e(e, t) {
|
|
@@ -624,10 +634,10 @@ function Re(e, t = 3) {
|
|
|
624
634
|
const e = t[0].getCell().getFormulaText();
|
|
625
635
|
d.push("formula", e || "(uniform)");
|
|
626
636
|
} else d.push("formula", `${t.length} distinct`);
|
|
627
|
-
} else if (i === r) d.push("date",
|
|
637
|
+
} else if (i === r) d.push("date", Ie(n, Me(e).format));
|
|
628
638
|
else if (c === r) {
|
|
629
639
|
const t = Me(e);
|
|
630
|
-
d.push("number",
|
|
640
|
+
d.push("number", Ie(n, t.format), ...Fe(n, t));
|
|
631
641
|
} else if (u === r) d.push("text", Te(n, t));
|
|
632
642
|
else {
|
|
633
643
|
const e = [
|
|
@@ -648,7 +658,7 @@ function Re(e, t = 3) {
|
|
|
648
658
|
function Ne(e, t = 3) {
|
|
649
659
|
const n = e.getStats({ onError: "ignore" }), o = n.getTypedCounts(), r = [], s = o[b.Number] ?? 0;
|
|
650
660
|
if (s > 0) {
|
|
651
|
-
const t = Me(e), o = [
|
|
661
|
+
const t = Me(e), o = [Ie(n, t.format), ...Fe(n, t)].filter(Boolean);
|
|
652
662
|
r.push(`Number: ${s} ${o.join(" ")}`.trimEnd());
|
|
653
663
|
}
|
|
654
664
|
const l = o[b.String] ?? 0;
|
|
@@ -696,13 +706,13 @@ function Me(e) {
|
|
|
696
706
|
mixed: s.map(([e, t]) => `${e} ${t}`).join(" · ")
|
|
697
707
|
};
|
|
698
708
|
}
|
|
699
|
-
function
|
|
709
|
+
function Ie(e, t) {
|
|
700
710
|
const n = e.getAggregates({ onError: "ignore" });
|
|
701
711
|
if (null === n.min || null === n.max) return "";
|
|
702
712
|
const o = R(n.min, t), r = R(n.max, t);
|
|
703
713
|
return o === r ? o : `${o} … ${r}`;
|
|
704
714
|
}
|
|
705
|
-
function
|
|
715
|
+
function Fe(e, { format: t, mixed: n }) {
|
|
706
716
|
if (n) return [`mixed formats (${n})`];
|
|
707
717
|
const o = e.getAggregates({ onError: "ignore" }), r = [];
|
|
708
718
|
return null !== o.sum && r.push(`Σ ${R(o.sum, t)}`), null !== o.average && r.push(`x̄ ${R(o.average, t)}`), r;
|
|
@@ -787,16 +797,16 @@ var Be = [
|
|
|
787
797
|
name: "color",
|
|
788
798
|
project: (e, t) => Xe(Z(e.getFont().getColor()), t ? Z(t.getFont().getColor()) : null)
|
|
789
799
|
}
|
|
790
|
-
], ze = (e) => Ze(e) ?? "Custom",
|
|
800
|
+
], ze = (e) => Ze(e) ?? "Custom", Ue = {
|
|
791
801
|
name: "category",
|
|
792
802
|
project: (e) => {
|
|
793
803
|
const t = ne(e);
|
|
794
804
|
return null === t ? null : ze(t);
|
|
795
805
|
}
|
|
796
|
-
},
|
|
806
|
+
}, _e = {
|
|
797
807
|
name: "format",
|
|
798
808
|
project: (e) => ne(e)
|
|
799
|
-
}, Je = [
|
|
809
|
+
}, Je = [Ue, _e], qe = [{
|
|
800
810
|
name: "color",
|
|
801
811
|
project: (e) => Y(e)
|
|
802
812
|
}], Ke = [{
|
|
@@ -942,7 +952,7 @@ function et(e, t, n, o) {
|
|
|
942
952
|
].map((e) => Math.max(...l.map((t) => t[e].length))), c = l.map((e) => `${e[0].padEnd(i[0])} ${e[1].padEnd(i[1])} ${e[2].padEnd(i[2])} ${e[3]}`.trimEnd());
|
|
943
953
|
s > 0 && c.splice(a < 0 ? c.length : a, 0, `…and ${s} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
|
|
944
954
|
return c;
|
|
945
|
-
}(S(
|
|
955
|
+
}(S(Ue), S(_e), o));
|
|
946
956
|
else for (const e of r) {
|
|
947
957
|
const t = S(e);
|
|
948
958
|
if (0 === t.length) continue;
|
|
@@ -1150,69 +1160,116 @@ var it = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, ct = (e) => {
|
|
|
1150
1160
|
if (0 === e.length) return null;
|
|
1151
1161
|
const n = e.slice(0, 3).map(t), o = e.length - n.length;
|
|
1152
1162
|
return o > 0 ? `${n.join(" | ")} | +${o} more` : n.join(" | ");
|
|
1153
|
-
}, wt =
|
|
1154
|
-
|
|
1163
|
+
}, wt = (t, n) => {
|
|
1164
|
+
if (t.isInvalid()) return "#REF!";
|
|
1165
|
+
const o = t.getWorksheet(), r = e.rangeToString(t.getCoords(), o.getEntireCoords()) ?? "#REF!";
|
|
1166
|
+
return o === n ? r : `${Ot(o.getName())}!${r}`;
|
|
1167
|
+
}, yt = (e) => {
|
|
1168
|
+
const t = [];
|
|
1169
|
+
for (const n of [
|
|
1170
|
+
"high",
|
|
1171
|
+
"low",
|
|
1172
|
+
"first",
|
|
1173
|
+
"last",
|
|
1174
|
+
"negative",
|
|
1175
|
+
"markers"
|
|
1176
|
+
]) e[n] && t.push(n);
|
|
1177
|
+
e.displayXAxis && t.push("axis");
|
|
1178
|
+
for (const [n, o, r] of [[
|
|
1179
|
+
e.minAxisType,
|
|
1180
|
+
e.manualMin,
|
|
1181
|
+
"min"
|
|
1182
|
+
], [
|
|
1183
|
+
e.maxAxisType,
|
|
1184
|
+
e.manualMax,
|
|
1185
|
+
"max"
|
|
1186
|
+
]]) "group" === n ? t.push(`same ${r}`) : "custom" === n && t.push(`${r} ${o ?? 0}`);
|
|
1187
|
+
const n = e.displayEmptyCellsAs ?? "zero";
|
|
1188
|
+
return "gap" !== n && t.push(`empty as ${n}`), e.displayHidden && t.push("hidden shown"), e.rightToLeft && t.push("right to left"), e.dateAxis && e.dateRange && t.push(`dates ${e.dateRange}`), t;
|
|
1189
|
+
}, bt = l.Feature, St = (e) => e.getRange().getStyle(), xt = (e) => N(e.getCell(), v.Mode.Display)?.display ?? null;
|
|
1190
|
+
function kt(e, t) {
|
|
1155
1191
|
switch (e) {
|
|
1156
|
-
case
|
|
1157
|
-
case
|
|
1158
|
-
case
|
|
1159
|
-
const t =
|
|
1192
|
+
case bt.Formula: return (e) => e.getCell().getFormulaText();
|
|
1193
|
+
case bt.Error: return xt;
|
|
1194
|
+
case bt.CalcError: return (e) => {
|
|
1195
|
+
const t = xt(e) ?? "", n = e.getCell().getFormulaText();
|
|
1160
1196
|
return (n ? `${t} ${n}` : t).trim() || null;
|
|
1161
1197
|
};
|
|
1162
|
-
case
|
|
1163
|
-
case
|
|
1198
|
+
case bt.CalcStatus: return (e) => e.getCell().getCalculationStatus();
|
|
1199
|
+
case bt.Anomalies: return (e) => {
|
|
1164
1200
|
const t = e.getCell(), n = function(e, t) {
|
|
1165
1201
|
let n = e.getAnomalies();
|
|
1166
1202
|
return !1 === t?.constants && (n = n.filter((e) => e.check !== O.ConstantFrequency)), 0 === n.length ? null : n.map((t) => D(t, e)).join("; ");
|
|
1167
1203
|
}(t, { constants: !1 });
|
|
1168
1204
|
if (!n) return null;
|
|
1169
|
-
const o = t.getFormulaText() ??
|
|
1205
|
+
const o = t.getFormulaText() ?? xt(e);
|
|
1170
1206
|
return o ? `${n} · here ${o}` : n;
|
|
1171
1207
|
};
|
|
1172
|
-
case
|
|
1173
|
-
case
|
|
1208
|
+
case bt.Merge: return xt;
|
|
1209
|
+
case bt.Comments: return (e) => {
|
|
1174
1210
|
const t = e.getCell().getComments()?.getContent();
|
|
1175
1211
|
if ("string" != typeof t) return null;
|
|
1176
1212
|
const n = t.replace(/\s+/g, " ").trim();
|
|
1177
1213
|
return n ? n.length > 60 ? `${n.slice(0, 59)}…` : n : null;
|
|
1178
1214
|
};
|
|
1179
|
-
case
|
|
1215
|
+
case bt.Spills: return (e) => {
|
|
1180
1216
|
const t = e.getCell();
|
|
1181
1217
|
return "error" === t.getSpillKind() ? null : t.getSpill()?.getValuesRange().toString() ?? null;
|
|
1182
1218
|
};
|
|
1183
|
-
case
|
|
1184
|
-
case
|
|
1185
|
-
case
|
|
1186
|
-
case
|
|
1187
|
-
case
|
|
1188
|
-
case
|
|
1189
|
-
case
|
|
1190
|
-
case
|
|
1191
|
-
const t =
|
|
1219
|
+
case bt.Hyperlink: return (e) => e.getCell().getHyperlink()?.getAddress() ?? null;
|
|
1220
|
+
case bt.Table: return (e) => ge(e.getCell())?.getName() ?? null;
|
|
1221
|
+
case bt.Fill: return (e) => Y(St(e));
|
|
1222
|
+
case bt.Borders: return (e) => Q(St(e));
|
|
1223
|
+
case bt.NumberFormat: return (e) => ne(St(e));
|
|
1224
|
+
case bt.Alignment: return t ? (e) => oe(St(e), t) : void 0;
|
|
1225
|
+
case bt.Font: return t ? (e) => re(St(e), t) : void 0;
|
|
1226
|
+
case bt.Protection: return (e) => {
|
|
1227
|
+
const t = St(e).getProtection(), n = [];
|
|
1192
1228
|
return t.isAlwaysUnlocked() && n.push("always unlocked"), t.isShowFormulas() || n.push("formulas hidden"), n.join(", ") || null;
|
|
1193
1229
|
};
|
|
1194
|
-
case
|
|
1230
|
+
case bt.Unlock: return (e) => {
|
|
1195
1231
|
const t = [];
|
|
1196
1232
|
e.getCell().getProtection().isAlwaysUnlocked() && t.push("always unlocked");
|
|
1197
1233
|
const n = e.getRange();
|
|
1198
1234
|
for (const e of n.getWorksheet().getProtectedRanges().getItems({ address: n })) t.push(`range ${e.getName()}${e.isUnlocked() ? "" : " · password"}`);
|
|
1199
1235
|
return t.join(", ") || null;
|
|
1200
1236
|
};
|
|
1201
|
-
case
|
|
1202
|
-
case
|
|
1203
|
-
case
|
|
1204
|
-
case
|
|
1237
|
+
case bt.Conditionals: return (e) => $t(e.getRange().getConditionalFormats(), ft);
|
|
1238
|
+
case bt.DataValidations: return (e) => $t(e.getRange().getDataValidations(), mt);
|
|
1239
|
+
case bt.Role: return (e) => e.getCell().getRole();
|
|
1240
|
+
case bt.Sparkline: return (e) => ((e) => {
|
|
1241
|
+
const t = e.getCell().getSparkline();
|
|
1242
|
+
if (!t) return null;
|
|
1243
|
+
const n = t.getGroup(), o = e.getWorksheet(), r = e.getCoords(), s = n.getSparkline({
|
|
1244
|
+
rowIndex: r.rowEnd,
|
|
1245
|
+
colIndex: r.colEnd
|
|
1246
|
+
}) ?? t;
|
|
1247
|
+
let l = t.getDataRange();
|
|
1248
|
+
const a = s.getDataRange();
|
|
1249
|
+
if (s !== t && !l.isInvalid() && !a.isInvalid() && l.getWorksheet() === a.getWorksheet()) {
|
|
1250
|
+
const e = l.getCoords(), t = a.getCoords();
|
|
1251
|
+
l = l.getWorksheet().getRange({
|
|
1252
|
+
rowStart: Math.min(e.rowStart, t.rowStart),
|
|
1253
|
+
rowEnd: Math.max(e.rowEnd, t.rowEnd),
|
|
1254
|
+
colStart: Math.min(e.colStart, t.colStart),
|
|
1255
|
+
colEnd: Math.max(e.colEnd, t.colEnd)
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
const i = [n.getType(), `reads ${wt(l, o)}`], c = yt(n.getProperties());
|
|
1259
|
+
return c.length > 0 && i.push(c.join(", ")), i.join(" · ");
|
|
1260
|
+
})(e.getRange());
|
|
1261
|
+
case bt.Contentful: return (e) => Ne(e.getRange()).join(" ") || null;
|
|
1205
1262
|
default: return;
|
|
1206
1263
|
}
|
|
1207
1264
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const n = e.map((e) =>
|
|
1265
|
+
function Ct(e, t) {
|
|
1266
|
+
const n = e.map((e) => kt(e, t)).filter((e) => !!e);
|
|
1210
1267
|
if (0 !== n.length) return 1 === n.length ? n[0] : (e) => {
|
|
1211
1268
|
const t = n.map((t) => t(e)).filter(Boolean);
|
|
1212
1269
|
return t.length > 0 ? t.join(" ") : null;
|
|
1213
1270
|
};
|
|
1214
1271
|
}
|
|
1215
|
-
function
|
|
1272
|
+
function vt(e, t, n) {
|
|
1216
1273
|
const o = n?.collapse ? function(e, t) {
|
|
1217
1274
|
const n = [], o = /* @__PURE__ */ new Map();
|
|
1218
1275
|
for (const r of e) {
|
|
@@ -1232,7 +1289,7 @@ function kt(e, t, n) {
|
|
|
1232
1289
|
for (const n of t.series) e.text(` ${n}`);
|
|
1233
1290
|
continue;
|
|
1234
1291
|
}
|
|
1235
|
-
const f = o ?
|
|
1292
|
+
const f = o ? Rt(o[t]) : "";
|
|
1236
1293
|
e.text(s ? `${h} ${s}${f}${a}` : `${h}${f}${a}`.trimEnd());
|
|
1237
1294
|
}
|
|
1238
1295
|
if (d > 0 && l.length > d && e.text(` …${l.length - d} more regions listed but not profiled · profile one with getRange().getStats(), or loop them in code`), a) {
|
|
@@ -1240,58 +1297,63 @@ function kt(e, t, n) {
|
|
|
1240
1297
|
e.text(` …truncated at ${s} of ${a} · ${l}`);
|
|
1241
1298
|
}
|
|
1242
1299
|
}
|
|
1243
|
-
var
|
|
1244
|
-
function
|
|
1300
|
+
var Et = 6;
|
|
1301
|
+
function Rt(e) {
|
|
1245
1302
|
if (e.length < 2) return "";
|
|
1246
1303
|
const t = e.slice(1);
|
|
1247
|
-
return ` · also at ${t.slice(0,
|
|
1304
|
+
return ` · also at ${t.slice(0, Et).map((e) => e.toString()).join(", ")}${t.length > Et ? ` +${t.length - Et} more` : ""}`;
|
|
1248
1305
|
}
|
|
1249
|
-
var
|
|
1306
|
+
var Nt = (e) => {
|
|
1250
1307
|
const t = e.getCell().getAnomalies();
|
|
1251
1308
|
return t.length > 0 ? JSON.stringify(t.map((e) => [e.check, e.evidence])) : null;
|
|
1252
1309
|
};
|
|
1253
|
-
function
|
|
1310
|
+
function jt(e, t) {
|
|
1254
1311
|
const n = [...e], o = e.getFeatures(), r = o.join(", "), s = 1 === o.length && o[0] === l.Feature.Contentful, a = e.getRange().getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, i = new ie();
|
|
1255
1312
|
i.h1(`Regions — ${r} (${n.length})`);
|
|
1256
1313
|
const c = 1 === o.length && o[0] === l.Feature.Anomalies;
|
|
1257
|
-
return
|
|
1314
|
+
return vt(i, n, {
|
|
1258
1315
|
...t,
|
|
1259
1316
|
profile: s,
|
|
1260
|
-
payload: s ? void 0 :
|
|
1261
|
-
collapse: c ?
|
|
1317
|
+
payload: s ? void 0 : Ct(o, a),
|
|
1318
|
+
collapse: c ? Nt : void 0
|
|
1262
1319
|
}), i.toLines().join("\n").trimEnd();
|
|
1263
1320
|
}
|
|
1264
|
-
var
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1321
|
+
var Mt = l.Feature, It = [
|
|
1322
|
+
Mt.Error,
|
|
1323
|
+
Mt.CalcError,
|
|
1324
|
+
Mt.Anomalies,
|
|
1325
|
+
Mt.Contentful,
|
|
1326
|
+
Mt.Formula,
|
|
1327
|
+
Mt.Spills,
|
|
1328
|
+
Mt.Merge,
|
|
1329
|
+
Mt.AutoTable,
|
|
1330
|
+
Mt.Hyperlink,
|
|
1331
|
+
Mt.Comments,
|
|
1332
|
+
Mt.Sparkline,
|
|
1333
|
+
Mt.NumberFormat,
|
|
1334
|
+
Mt.Font,
|
|
1335
|
+
Mt.Fill,
|
|
1336
|
+
Mt.Borders,
|
|
1337
|
+
Mt.Alignment,
|
|
1338
|
+
Mt.Conditionals,
|
|
1339
|
+
Mt.DataValidations
|
|
1340
|
+
], Ft = /* @__PURE__ */ new Set([
|
|
1341
|
+
Mt.Sparkline,
|
|
1342
|
+
Mt.Conditionals,
|
|
1343
|
+
Mt.DataValidations
|
|
1344
|
+
]), Tt = new Map(Object.entries(Mt).map(([e, t]) => [t, e])), At = (e) => Tt.get(e) ?? e;
|
|
1345
|
+
function Lt(e) {
|
|
1346
|
+
const t = new Map(Object.values(Mt).map((e) => [e.toLowerCase(), e])), n = [];
|
|
1285
1347
|
for (const o of e.split(",")) {
|
|
1286
1348
|
const e = o.trim();
|
|
1287
1349
|
if (!e) continue;
|
|
1288
1350
|
const r = t.get(e.toLowerCase());
|
|
1289
|
-
if (!r) throw new Error(`Unknown feature '${e}'. Features: ${Object.values(
|
|
1351
|
+
if (!r) throw new Error(`Unknown feature '${e}'. Features: ${Object.values(Mt).join(", ")}.`);
|
|
1290
1352
|
n.push(r);
|
|
1291
1353
|
}
|
|
1292
1354
|
return n;
|
|
1293
1355
|
}
|
|
1294
|
-
var
|
|
1356
|
+
var Wt = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, Ot = (t) => e.sheetNameToString(t) ?? "Untitled", Pt = (e) => `wb.getWorksheet(${JSON.stringify(e.getWorksheet().getName())})`, Dt = (e) => ((e) => {
|
|
1295
1357
|
if (!e.includes("$")) return e;
|
|
1296
1358
|
let t = "", n = !1;
|
|
1297
1359
|
for (const o of e) {
|
|
@@ -1300,20 +1362,20 @@ var Tt = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, At
|
|
|
1300
1362
|
t += o;
|
|
1301
1363
|
}
|
|
1302
1364
|
return t;
|
|
1303
|
-
})(e.getAddress()),
|
|
1304
|
-
const t =
|
|
1305
|
-
return t.includes("!") ? t : `${
|
|
1306
|
-
},
|
|
1365
|
+
})(e.getAddress()), Ht = (e) => {
|
|
1366
|
+
const t = Dt(e);
|
|
1367
|
+
return t.includes("!") ? t : `${Ot(e.getWorksheet().getName())}!${t}`;
|
|
1368
|
+
}, Vt = (e) => {
|
|
1307
1369
|
const t = e.toString();
|
|
1308
|
-
return `${t.includes("!") ? t : `${
|
|
1370
|
+
return `${t.includes("!") ? t : `${Ot(e.getWorksheet().getName())}!${t}`}, ${e.getRowCount()}×${e.getColumnCount()}`;
|
|
1309
1371
|
};
|
|
1310
|
-
function
|
|
1311
|
-
const n = nt(t, [...t.getRegions(
|
|
1372
|
+
function Bt(e, t) {
|
|
1373
|
+
const n = nt(t, [...t.getRegions(Mt.Formula)]), o = t.getStats({ onError: "ignore" }).getCount();
|
|
1312
1374
|
e.h2(`Kind (${o} cell${1 !== o ? "s" : ""} · ${n.length} kind${1 !== n.length ? "s" : ""})`);
|
|
1313
1375
|
for (const [t, o] of n) e.text(` ${t.padEnd(10)}${o}`);
|
|
1314
1376
|
0 === n.length && e.fact("None"), e.blank();
|
|
1315
1377
|
}
|
|
1316
|
-
var
|
|
1378
|
+
var zt = [
|
|
1317
1379
|
s.Role.Label,
|
|
1318
1380
|
s.Role.Input,
|
|
1319
1381
|
s.Role.Link,
|
|
@@ -1321,8 +1383,8 @@ var Ht = [
|
|
|
1321
1383
|
s.Role.Computed,
|
|
1322
1384
|
s.Role.Output
|
|
1323
1385
|
];
|
|
1324
|
-
function
|
|
1325
|
-
const n = [...t.getRegions([
|
|
1386
|
+
function Ut(e, t) {
|
|
1387
|
+
const n = [...t.getRegions([Mt.Role, Mt.Font])];
|
|
1326
1388
|
if (0 === n.length) return;
|
|
1327
1389
|
const o = t.getWorksheet().getWorkbook()?.getStyles() ?? null, r = (e) => {
|
|
1328
1390
|
if (!e) return null;
|
|
@@ -1342,7 +1404,7 @@ function Vt(e, t) {
|
|
|
1342
1404
|
}
|
|
1343
1405
|
if (0 !== l.size) {
|
|
1344
1406
|
e.h2(`Roles (${a} cell${1 !== a ? "s" : ""} · ${l.size} role${1 !== l.size ? "s" : ""})`);
|
|
1345
|
-
for (const t of
|
|
1407
|
+
for (const t of zt) {
|
|
1346
1408
|
const n = l.get(t);
|
|
1347
1409
|
if (!n) continue;
|
|
1348
1410
|
const o = [...n.values()].reduce((e, t) => e + t, 0), r = [...n].sort((e, t) => t[1] - e[1]).map(([e, t]) => `${e} ${t}`).join(" · ");
|
|
@@ -1351,45 +1413,46 @@ function Vt(e, t) {
|
|
|
1351
1413
|
e.blank();
|
|
1352
1414
|
}
|
|
1353
1415
|
}
|
|
1354
|
-
function
|
|
1355
|
-
const o = t.getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, r = void 0 === n?.features ? null : new Set("string" == typeof n.features ? [n.features] : n.features), s =
|
|
1416
|
+
function _t(e, t, n) {
|
|
1417
|
+
const o = t.getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, r = void 0 === n?.features ? null : new Set("string" == typeof n.features ? [n.features] : n.features), s = It.filter((e) => !r || r.has(e));
|
|
1356
1418
|
if (0 === s.length) return;
|
|
1357
1419
|
const l = t.getCounts(s);
|
|
1358
1420
|
let a;
|
|
1359
|
-
const i = () => a ??= [...t.getWorksheet().getEntireRange().getRegions(
|
|
1421
|
+
const i = () => a ??= [...t.getWorksheet().getEntireRange().getRegions(Mt.Contentful)].map((e) => e.getCoords());
|
|
1360
1422
|
for (const r of s) {
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
n &&
|
|
1423
|
+
const s = n?.layerScope && Ft.has(r) ? n.layerScope : t;
|
|
1424
|
+
let a = r === Mt.Contentful ? Gt(t) : [...s.getRegions(r)], c = (s === t ? l : s.getCounts([r]))[r] ?? 0, u = null;
|
|
1425
|
+
if (r === Mt.Anomalies && (u = a, a = a.filter((e) => !_(e.getCell().getAnomalies())), c = a.reduce((e, t) => e + t.getRowCount() * t.getColumnCount(), 0)), 0 === a.length) {
|
|
1426
|
+
u && Kt(e, t, u);
|
|
1427
|
+
const n = o && r !== Mt.Font ? ot(r, o) : null;
|
|
1428
|
+
n && (e.h2(`${At(r)} (${Xt(0, 0)})`), e.text(` ${"normal".padEnd(10)}${n}`), e.blank());
|
|
1366
1429
|
continue;
|
|
1367
1430
|
}
|
|
1368
|
-
const
|
|
1369
|
-
recovery:
|
|
1431
|
+
const g = !!n?.profile && r === Mt.Contentful, d = `${Pt(t)}.getRegions(${JSON.stringify(r)})`, h = `${d} lists all ${a.length}`, f = Qe(r) ? et(t.getWorksheet(), r, o, {
|
|
1432
|
+
recovery: h,
|
|
1370
1433
|
content: i()
|
|
1371
|
-
}) : null,
|
|
1372
|
-
if (e.h2(`${
|
|
1373
|
-
|
|
1374
|
-
for (const t of
|
|
1375
|
-
for (const t of
|
|
1376
|
-
e.text(` ${"regions".padEnd(10)}${
|
|
1434
|
+
}) : null, m = r === Mt.Formula ? tt(a, { recovery: h }) : null, p = f ? `${Xt(a.length, f.cells)} · ${f.distinct} distinct` : m ? `${Xt(a.length, c)} · ${m.distinct} distinct` : Xt(a.length, c);
|
|
1435
|
+
if (e.h2(`${At(r)} (${p})`), f) {
|
|
1436
|
+
f.normal && e.text(` ${"normal".padEnd(10)}${f.normal}`);
|
|
1437
|
+
for (const t of f.tiers) e.text(` ${t}`);
|
|
1438
|
+
for (const t of f.attributes) e.text(` ${t}`);
|
|
1439
|
+
e.text(` ${"regions".padEnd(10)}${d}`), e.blank();
|
|
1377
1440
|
} else {
|
|
1378
|
-
if (
|
|
1379
|
-
r ===
|
|
1441
|
+
if (m) for (const t of m.lines) e.text(` ${t}`);
|
|
1442
|
+
r === Mt.Contentful && a.sort((e, t) => t.getRowCount() * t.getColumnCount() - e.getRowCount() * e.getColumnCount()), vt(e, a, {
|
|
1380
1443
|
maxRegions: n?.maxRegions,
|
|
1381
1444
|
maxProfiled: n?.maxProfiled,
|
|
1382
|
-
profile:
|
|
1445
|
+
profile: g,
|
|
1383
1446
|
series: !1,
|
|
1384
|
-
payload:
|
|
1385
|
-
collapse: r ===
|
|
1386
|
-
recovery:
|
|
1387
|
-
}), e.blank(),
|
|
1447
|
+
payload: g ? void 0 : kt(r, o),
|
|
1448
|
+
collapse: r === Mt.Anomalies ? Nt : void 0,
|
|
1449
|
+
recovery: h
|
|
1450
|
+
}), e.blank(), u && Kt(e, t, u);
|
|
1388
1451
|
}
|
|
1389
1452
|
}
|
|
1390
1453
|
}
|
|
1391
|
-
var
|
|
1392
|
-
function
|
|
1454
|
+
var Jt = 30, qt = 4;
|
|
1455
|
+
function Kt(e, t, n) {
|
|
1393
1456
|
const o = /* @__PURE__ */ new Map();
|
|
1394
1457
|
let r = 0;
|
|
1395
1458
|
for (const e of n) for (const t of e.getCell().getAnomalies()) {
|
|
@@ -1397,7 +1460,7 @@ function Ut(e, t, n) {
|
|
|
1397
1460
|
const n = `${t.evidence.kind}:${t.evidence.value}`;
|
|
1398
1461
|
let l = o.get(n);
|
|
1399
1462
|
l || o.set(n, l = {
|
|
1400
|
-
text:
|
|
1463
|
+
text: U(t.evidence),
|
|
1401
1464
|
uses: Number(t.evidence.uses ?? 1),
|
|
1402
1465
|
places: []
|
|
1403
1466
|
}), l.places.push(e.toString()), r = Math.max(r, Number(t.evidence.of ?? 0));
|
|
@@ -1405,33 +1468,33 @@ function Ut(e, t, n) {
|
|
|
1405
1468
|
if (0 === o.size) return;
|
|
1406
1469
|
const l = [...o.values()].sort((e, t) => e.uses - t.uses || (e.text < t.text ? -1 : e.text > t.text ? 1 : 0));
|
|
1407
1470
|
e.h2(`Constants (${o.size} distinct · ${r} use${1 === r ? "" : "s"} in the workbook, rarest first)`);
|
|
1408
|
-
const a = Math.min(24, Math.max(10, ...l.slice(0,
|
|
1409
|
-
for (const t of l.slice(0,
|
|
1410
|
-
const n = t.places.slice(0,
|
|
1471
|
+
const a = Math.min(24, Math.max(10, ...l.slice(0, Jt).map((e) => e.text.length + 2)));
|
|
1472
|
+
for (const t of l.slice(0, Jt)) {
|
|
1473
|
+
const n = t.places.slice(0, qt).join(", "), o = t.places.length > qt ? ` +${t.places.length - qt} more` : "";
|
|
1411
1474
|
e.text(` ${t.text.padEnd(a)}${t.uses} use${1 === t.uses ? "" : "s"} · ${n}${o}`);
|
|
1412
1475
|
}
|
|
1413
|
-
l.length >
|
|
1476
|
+
l.length > Jt && e.text(` …and ${l.length - Jt} more · ${Pt(t)}.getAnomalies({ checks: ['constantFrequency'] }) lists every region`), e.blank();
|
|
1414
1477
|
}
|
|
1415
|
-
var
|
|
1478
|
+
var Gt = (e) => [...e.getRegions([Mt.Contentful, Mt.Table])].filter((e) => e.getCell().isContentful()), Xt = (e, t) => `${t} cell${1 !== t ? "s" : ""} · ${e} region${1 !== e ? "s" : ""}`, Zt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Yt = (e) => e.isIFormula ? e : null, Qt = (e) => {
|
|
1416
1479
|
const t = e.getScope();
|
|
1417
|
-
return t ? `${
|
|
1418
|
-
},
|
|
1480
|
+
return t ? `${Ot(t)}!${e.getName()}` : e.getName();
|
|
1481
|
+
}, en = (e) => {
|
|
1419
1482
|
const t = e.getAddress();
|
|
1420
|
-
return t.includes("!") ? t : `${
|
|
1483
|
+
return t.includes("!") ? t : `${Ot(e.getWorksheet().getName())}!${t}`;
|
|
1421
1484
|
};
|
|
1422
|
-
async function
|
|
1423
|
-
const t =
|
|
1485
|
+
async function tn(e) {
|
|
1486
|
+
const t = Yt(e);
|
|
1424
1487
|
let n;
|
|
1425
1488
|
return n = t ? "=" + t.getExpression() : e.getRanges?.()?.getAddress() ?? "", t && await t.isVolatile() && (n += " (volatile)"), n.trim();
|
|
1426
1489
|
}
|
|
1427
|
-
var
|
|
1490
|
+
var nn = /* @__PURE__ */ new Set([n.Code.Ref, n.Code.Name]), on = (e) => {
|
|
1428
1491
|
const t = e.value, o = "string" == typeof t ? t : t?.error, r = "string" == typeof o ? n.getBuiltInByLabel(o) : void 0;
|
|
1429
|
-
return r &&
|
|
1430
|
-
},
|
|
1492
|
+
return r && nn.has(r.getCode()) ? r.getCode() === n.Code.Name ? "#NAME?" : "#REF!" : null;
|
|
1493
|
+
}, rn = /* @__PURE__ */ new Set(), sn = (e) => {
|
|
1431
1494
|
const t = e.value;
|
|
1432
1495
|
return "object" == typeof t && t?.name ? t.name : e.text ?? "";
|
|
1433
1496
|
};
|
|
1434
|
-
function
|
|
1497
|
+
function ln(e) {
|
|
1435
1498
|
let t = null;
|
|
1436
1499
|
for (let n = 0; n < e.length; n++) {
|
|
1437
1500
|
const o = e[n];
|
|
@@ -1441,19 +1504,19 @@ function on(e) {
|
|
|
1441
1504
|
let s = n + 1;
|
|
1442
1505
|
for (; s < e.length && "whitespace" === e[s].type;) s++;
|
|
1443
1506
|
if ("separator" !== e[s]?.type) continue;
|
|
1444
|
-
const l =
|
|
1507
|
+
const l = sn(o).toLowerCase();
|
|
1445
1508
|
l && (t ??= /* @__PURE__ */ new Set()).add(l);
|
|
1446
1509
|
}
|
|
1447
|
-
return t ??
|
|
1510
|
+
return t ?? rn;
|
|
1448
1511
|
}
|
|
1449
|
-
async function
|
|
1512
|
+
async function an(e, t, n) {
|
|
1450
1513
|
if (0 === t.length) return;
|
|
1451
1514
|
const o = /* @__PURE__ */ new Set();
|
|
1452
1515
|
for (const e of n?.symbols ?? t) o.add(e.getName().toLowerCase());
|
|
1453
1516
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
|
|
1454
1517
|
for (const e of t) r.set(e.getId(), e), e.getScope() && s.add(e.getName().toLowerCase());
|
|
1455
1518
|
const l = await Promise.all(t.map((e) => {
|
|
1456
|
-
const t =
|
|
1519
|
+
const t = Yt(e);
|
|
1457
1520
|
return t ? async function(e, t) {
|
|
1458
1521
|
const n = await e.getDirectDependents();
|
|
1459
1522
|
let o = 0;
|
|
@@ -1467,10 +1530,10 @@ async function rn(e, t, n) {
|
|
|
1467
1530
|
if (s.has(e.getId())) continue;
|
|
1468
1531
|
s.add(e.getId());
|
|
1469
1532
|
const n = t.get(e.getId());
|
|
1470
|
-
r.push(n ?
|
|
1533
|
+
r.push(n ? Qt(n) : e.getName());
|
|
1471
1534
|
} else {
|
|
1472
1535
|
const t = e[i];
|
|
1473
|
-
o += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), l.push(
|
|
1536
|
+
o += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), l.push(en(a));
|
|
1474
1537
|
}
|
|
1475
1538
|
}
|
|
1476
1539
|
}
|
|
@@ -1484,7 +1547,7 @@ async function rn(e, t, n) {
|
|
|
1484
1547
|
for (let e = 0; e < i.length; e++) {
|
|
1485
1548
|
const t = (c.length > 0 ? 2 : 0) + i[e].length;
|
|
1486
1549
|
if (c.length > 0 && u + t > 60) break;
|
|
1487
|
-
c.push(0 === c.length ?
|
|
1550
|
+
c.push(0 === c.length ? Zt(i[e], 60) : i[e]), u += t;
|
|
1488
1551
|
}
|
|
1489
1552
|
const g = i.length - c.length, d = g > 0 ? `, +${g} more` : "";
|
|
1490
1553
|
return {
|
|
@@ -1494,18 +1557,18 @@ async function rn(e, t, n) {
|
|
|
1494
1557
|
}(t, r) : Promise.resolve(null);
|
|
1495
1558
|
})), a = n?.omitUnread ? t.filter((e, t) => 0 !== l[t]?.weight) : t, i = a === t ? l : l.filter((e) => 0 !== e?.weight), c = t.length - a.length, u = await Promise.all(a.map(async (e, t) => {
|
|
1496
1559
|
const n = function(e, t) {
|
|
1497
|
-
const n =
|
|
1560
|
+
const n = Yt(e), o = [];
|
|
1498
1561
|
if (n) {
|
|
1499
1562
|
const e = n.getTokens();
|
|
1500
1563
|
let r = null, s = null;
|
|
1501
1564
|
for (const n of e) {
|
|
1502
1565
|
if ("error" === n.type) {
|
|
1503
|
-
s ??=
|
|
1566
|
+
s ??= on(n);
|
|
1504
1567
|
continue;
|
|
1505
1568
|
}
|
|
1506
1569
|
if ("named" !== n.type) continue;
|
|
1507
|
-
const l =
|
|
1508
|
-
l && !t.has(l.toLowerCase()) && (r ??=
|
|
1570
|
+
const l = sn(n);
|
|
1571
|
+
l && !t.has(l.toLowerCase()) && (r ??= ln(e), r.has(l.toLowerCase()) || o.includes(l) || o.push(l));
|
|
1509
1572
|
}
|
|
1510
1573
|
if (s || o.length > 0) return {
|
|
1511
1574
|
broken: !0,
|
|
@@ -1540,13 +1603,13 @@ async function rn(e, t, n) {
|
|
|
1540
1603
|
...r,
|
|
1541
1604
|
text: "unused · shadowed"
|
|
1542
1605
|
});
|
|
1543
|
-
const l = e.getComment() ?? "", a =
|
|
1606
|
+
const l = e.getComment() ?? "", a = Qt(e);
|
|
1544
1607
|
return {
|
|
1545
1608
|
name: a,
|
|
1546
|
-
refersTo: await
|
|
1609
|
+
refersTo: await tn(e),
|
|
1547
1610
|
dependents: r,
|
|
1548
1611
|
hidden: e.isHidden(),
|
|
1549
|
-
comment:
|
|
1612
|
+
comment: Zt(l, 60),
|
|
1550
1613
|
broken: n.broken,
|
|
1551
1614
|
error: n.error,
|
|
1552
1615
|
sortKey: a.toLowerCase().replace(/'/g, "")
|
|
@@ -1578,7 +1641,7 @@ async function rn(e, t, n) {
|
|
|
1578
1641
|
}
|
|
1579
1642
|
e.blank();
|
|
1580
1643
|
}
|
|
1581
|
-
function
|
|
1644
|
+
function cn(e, t, n) {
|
|
1582
1645
|
const o = n.getCoords().min, r = [];
|
|
1583
1646
|
let s = 0, l = 0;
|
|
1584
1647
|
if (n.forEachSpan((e, t) => {
|
|
@@ -1598,7 +1661,7 @@ function sn(e, t, n) {
|
|
|
1598
1661
|
for (const t of r) e.text(` ${t.address.padEnd(a)} ${t.count}`);
|
|
1599
1662
|
l > r.length && e.text(` …and ${l - r.length} more`), e.blank();
|
|
1600
1663
|
}
|
|
1601
|
-
function
|
|
1664
|
+
function un(e) {
|
|
1602
1665
|
const t = e.getOutline(), n = [];
|
|
1603
1666
|
for (const [e, o] of [[h.Axis.Row, "rows"], [h.Axis.Column, "columns"]]) {
|
|
1604
1667
|
const r = t.getLevelCount(e);
|
|
@@ -1610,10 +1673,10 @@ function ln(e) {
|
|
|
1610
1673
|
}
|
|
1611
1674
|
return n.length > 0 ? n.join(" · ") : null;
|
|
1612
1675
|
}
|
|
1613
|
-
function
|
|
1676
|
+
function gn(e, t, n, o) {
|
|
1614
1677
|
if (0 === n.length) return;
|
|
1615
1678
|
const r = n.length > 50 ? n.slice(0, 50) : n, s = r.map((e) => ({
|
|
1616
|
-
address:
|
|
1679
|
+
address: Zt(Dt(e.getRanges()), 40),
|
|
1617
1680
|
rule: o(e)
|
|
1618
1681
|
}));
|
|
1619
1682
|
e.h2(`${t} (${n.length})`);
|
|
@@ -1621,7 +1684,7 @@ function an(e, t, n, o) {
|
|
|
1621
1684
|
for (const t of s) e.text(` ${t.address.padEnd(l)} ${t.rule}`.trimEnd());
|
|
1622
1685
|
r.length < n.length && e.text(` …and ${n.length - r.length} more`), e.blank();
|
|
1623
1686
|
}
|
|
1624
|
-
function
|
|
1687
|
+
function dn(e, t = !1) {
|
|
1625
1688
|
const n = e.getWorksheet(), o = n.getName(), r = n.getNames(), s = [...r.getItems({
|
|
1626
1689
|
address: e,
|
|
1627
1690
|
allowExtrudes: !0,
|
|
@@ -1642,23 +1705,23 @@ function cn(e, t = !1) {
|
|
|
1642
1705
|
}
|
|
1643
1706
|
return s;
|
|
1644
1707
|
}
|
|
1645
|
-
async function
|
|
1708
|
+
async function hn(e, t) {
|
|
1646
1709
|
const n = t.getWorksheet();
|
|
1647
|
-
await
|
|
1710
|
+
await an(e, dn(t, !0), { symbols: n.getWorkbook()?.getNames().getItems({ includeHidden: !0 }) ?? n.getNames().getItems({ includeHidden: !0 }) ?? [] });
|
|
1648
1711
|
const o = t.getColumnHeaders(), r = t.getRowHeaders();
|
|
1649
|
-
|
|
1712
|
+
cn(e, "Hidden Columns", o), cn(e, "Hidden Rows", r);
|
|
1650
1713
|
const s = t.getTables();
|
|
1651
|
-
s.length > 0 && he(e, s, t.getCounts([
|
|
1714
|
+
s.length > 0 && he(e, s, t.getCounts([Mt.Table])[Mt.Table] ?? 0);
|
|
1652
1715
|
}
|
|
1653
|
-
var
|
|
1716
|
+
var fn = "#REF!", mn = (e) => {
|
|
1654
1717
|
const t = e.getContent();
|
|
1655
1718
|
return "chart" === t.getType() && "function" == typeof t.getSeries ? t : null;
|
|
1656
|
-
},
|
|
1719
|
+
}, pn = (t, n) => `${Ot(t.getName())}!${e.rangeToString(n) ?? ""}`, $n = (e, t) => e ? pn(e.getWorksheet(), e.getCoords()) : t, wn = (e) => e.replace(/\s*[\r\n]+\s*/g, " ⏎ ").trim(), yn = (e, t) => ({
|
|
1657
1720
|
colStart: Math.min(e.colStart, t.colStart),
|
|
1658
1721
|
rowStart: Math.min(e.rowStart, t.rowStart),
|
|
1659
1722
|
colEnd: Math.max(e.colEnd, t.colEnd),
|
|
1660
1723
|
rowEnd: Math.max(e.rowEnd, t.rowEnd)
|
|
1661
|
-
}),
|
|
1724
|
+
}), bn = (e) => {
|
|
1662
1725
|
if (0 === e.length) return null;
|
|
1663
1726
|
const t = e[0], n = t.getValuesRange();
|
|
1664
1727
|
if (!n) return null;
|
|
@@ -1686,54 +1749,54 @@ var gn = "#REF!", dn = (e) => {
|
|
|
1686
1749
|
}
|
|
1687
1750
|
}
|
|
1688
1751
|
return {
|
|
1689
|
-
values:
|
|
1752
|
+
values: pn(o, yn(r, d)),
|
|
1690
1753
|
by: s ? null : i,
|
|
1691
|
-
names: u && h ?
|
|
1692
|
-
categories:
|
|
1754
|
+
names: u && h ? pn(u.getWorksheet(), yn(u.getCoords(), h)) : null,
|
|
1755
|
+
categories: $n(t.getCategoriesRange(), c)
|
|
1693
1756
|
};
|
|
1694
|
-
},
|
|
1757
|
+
}, Sn = (e) => {
|
|
1695
1758
|
const t = [], n = [
|
|
1696
1759
|
["name", e.getNameFormula()],
|
|
1697
1760
|
["values", e.getValuesFormula()],
|
|
1698
1761
|
["categories", e.getCategoriesFormula()]
|
|
1699
1762
|
];
|
|
1700
|
-
for (const [e, o] of n) o?.includes(
|
|
1763
|
+
for (const [e, o] of n) o?.includes(fn) && t.push(`${e} ${o}`);
|
|
1701
1764
|
return t;
|
|
1702
|
-
},
|
|
1765
|
+
}, xn = (e) => {
|
|
1703
1766
|
let t = 0;
|
|
1704
|
-
for (const n of e)
|
|
1767
|
+
for (const n of e) Sn(n).length > 0 && t++;
|
|
1705
1768
|
return t;
|
|
1706
|
-
},
|
|
1769
|
+
}, kn = (e) => {
|
|
1707
1770
|
const t = e.getChartType();
|
|
1708
1771
|
return t && "unknown" !== t ? t : null;
|
|
1709
1772
|
};
|
|
1710
|
-
function
|
|
1711
|
-
const t = [], n =
|
|
1773
|
+
function Cn(e) {
|
|
1774
|
+
const t = [], n = kn(e);
|
|
1712
1775
|
n && t.push(n);
|
|
1713
1776
|
const o = e.getChartTitle();
|
|
1714
1777
|
var r, s;
|
|
1715
|
-
o && t.push(`"${r =
|
|
1778
|
+
o && t.push(`"${r = wn(o), s = 40, r.length > s ? `${r.slice(0, s - 1)}…` : r}"`);
|
|
1716
1779
|
const l = e.getSeries();
|
|
1717
1780
|
if (l.length > 0) {
|
|
1718
1781
|
t.push(`${l.length} series`);
|
|
1719
|
-
const n = e.getPivotSource(), o = n ? null :
|
|
1782
|
+
const n = e.getPivotSource(), o = n ? null : bn(l);
|
|
1720
1783
|
n ? t.push(`pivot table ${n}`) : o && (t.push(`values ${o.values}`), o.categories && t.push(`categories ${o.categories}`));
|
|
1721
|
-
const r =
|
|
1722
|
-
r > 0 && t.push(`${
|
|
1784
|
+
const r = xn(l);
|
|
1785
|
+
r > 0 && t.push(`${fn} in ${r} series`);
|
|
1723
1786
|
}
|
|
1724
1787
|
return t.length > 0 ? t.join(" · ") : null;
|
|
1725
1788
|
}
|
|
1726
|
-
function
|
|
1789
|
+
function vn(e) {
|
|
1727
1790
|
const t = [], n = e.getChartTitle();
|
|
1728
|
-
n && t.push(["title", `"${
|
|
1791
|
+
n && t.push(["title", `"${wn(n)}"`]);
|
|
1729
1792
|
const o = e.getSeries();
|
|
1730
1793
|
if (0 === o.length) return t;
|
|
1731
|
-
const r = e.getPivotSource(), s = r ? null :
|
|
1794
|
+
const r = e.getPivotSource(), s = r ? null : bn(o);
|
|
1732
1795
|
r ? t.push(["series", `${o.length} · from pivot table ${r}`]) : s ? (t.push(["series", `${o.length} · ${s.values}${s.by ? ` by ${s.by}` : ""}`]), s.names && t.push([1 === o.length ? "name" : "names", s.names]), s.categories && t.push(["categories", s.categories])) : t.push(["series", String(o.length)]);
|
|
1733
|
-
const l =
|
|
1734
|
-
return l > 0 && t.push(["broken", `${
|
|
1796
|
+
const l = xn(o);
|
|
1797
|
+
return l > 0 && t.push(["broken", `${fn} in ${l} series`]), t;
|
|
1735
1798
|
}
|
|
1736
|
-
var
|
|
1799
|
+
var En = (e) => kn(e) ?? "", Rn = {
|
|
1737
1800
|
hundreds: "hundreds",
|
|
1738
1801
|
thousands: "thousands",
|
|
1739
1802
|
tenThousands: "ten thousands",
|
|
@@ -1743,44 +1806,44 @@ var kn = (e) => bn(e) ?? "", Cn = {
|
|
|
1743
1806
|
hundredMillions: "hundred millions",
|
|
1744
1807
|
billions: "billions",
|
|
1745
1808
|
trillions: "trillions"
|
|
1746
|
-
},
|
|
1747
|
-
const t = e.getTitle().getText(), n = [t ? `"${
|
|
1809
|
+
}, Nn = (e) => {
|
|
1810
|
+
const t = e.getTitle().getText(), n = [t ? `"${wn(t)}"` : "no title"], o = e.getNumberFormat();
|
|
1748
1811
|
if (o && "General" !== o && n.push(`format ${o}`), "value" === e.getKind()) {
|
|
1749
1812
|
null === e.getMinimum() || e.isMinimumAuto() || n.push(`min ${e.getMinimum()}`), null === e.getMaximum() || e.isMaximumAuto() || n.push(`max ${e.getMaximum()}`), null === e.getMajorUnit() || e.isMajorUnitAuto() || n.push(`unit ${e.getMajorUnit()}`), "logarithmic" === e.getScaleType() && n.push(`log base ${e.getLogBase()}`);
|
|
1750
1813
|
const t = e.getDisplayUnit();
|
|
1751
|
-
"custom" === t ? n.push(`in units of ${e.getCustomDisplayUnit()}`) : "none" !== t && n.push(`in ${
|
|
1814
|
+
"custom" === t ? n.push(`in units of ${e.getCustomDisplayUnit()}`) : "none" !== t && n.push(`in ${Rn[t] ?? t}`);
|
|
1752
1815
|
}
|
|
1753
1816
|
return e.getReversePlotOrder() && n.push("reversed"), `${e.getKind()} (${n.join(", ")})`;
|
|
1754
|
-
},
|
|
1817
|
+
}, jn = (e) => {
|
|
1755
1818
|
const t = [], n = e.reduce((e, t) => e + t.getTrendlines().length, 0);
|
|
1756
1819
|
n > 0 && t.push(`${n} trendline${1 === n ? "" : "s"}`);
|
|
1757
1820
|
const o = e.filter((e) => e.getYErrorBars().getVisible() || e.getXErrorBars().getVisible()).length;
|
|
1758
1821
|
return o > 0 && t.push(`${o} with error bars`), t;
|
|
1759
1822
|
};
|
|
1760
|
-
function
|
|
1761
|
-
const n =
|
|
1823
|
+
function Mn(e, t) {
|
|
1824
|
+
const n = kn(t);
|
|
1762
1825
|
e.fact("Type: chart" + (n ? ` — ${n}` : ""));
|
|
1763
1826
|
const o = t.getChartTitle(), r = !o && t.getTitle().getVisible() ? t.getTitle().getText() : null;
|
|
1764
|
-
e.fact("Title: " + (o ? `"${
|
|
1827
|
+
e.fact("Title: " + (o ? `"${wn(o)}"` : r ? `"${wn(r)}" (automatic)` : "(none)"));
|
|
1765
1828
|
const s = t.getLegend();
|
|
1766
1829
|
e.fact(`Legend: ${s.getVisible() ? s.getPosition() : "(none)"}`);
|
|
1767
1830
|
const l = t.getSeries(), a = t.getPivotSource();
|
|
1768
1831
|
if (a) e.fact(`Series (${l.length}): from pivot table ${a}`);
|
|
1769
1832
|
else if (l.length > 0) {
|
|
1770
|
-
const t =
|
|
1833
|
+
const t = bn(l);
|
|
1771
1834
|
if (t) {
|
|
1772
1835
|
const n = [`values ${t.values}${t.by ? ` by ${t.by}` : ""}`];
|
|
1773
|
-
t.names && n.push(`${1 === l.length ? "name" : "names"} ${t.names}`), t.categories && n.push(`categories ${t.categories}`), n.push(...
|
|
1836
|
+
t.names && n.push(`${1 === l.length ? "name" : "names"} ${t.names}`), t.categories && n.push(`categories ${t.categories}`), n.push(...jn(l)), e.fact(`Series (${l.length}): ${n.join(" · ")}`);
|
|
1774
1837
|
} else {
|
|
1775
1838
|
(function(e, t) {
|
|
1776
1839
|
const n = t.slice(0, L(t.length, 12)), o = n.map((e) => {
|
|
1777
|
-
const t =
|
|
1840
|
+
const t = $n(e.getValuesRange(), e.getValuesFormula()) ?? "(no values)", n = $n(e.getCategoriesRange(), e.getCategoriesFormula()), o = [`values ${t}`];
|
|
1778
1841
|
n && o.push(`categories ${n}`);
|
|
1779
|
-
const r =
|
|
1842
|
+
const r = $n(e.getNameRange(), e.getNameFormula());
|
|
1780
1843
|
r && o.push(`name ${r}`);
|
|
1781
1844
|
const s = e.getName();
|
|
1782
1845
|
return {
|
|
1783
|
-
name: s ?
|
|
1846
|
+
name: s ? wn(s) : "(unnamed)",
|
|
1784
1847
|
type: e.isSecondaryAxis() ? `${e.getChartType()} · secondary axis` : e.getChartType(),
|
|
1785
1848
|
source: o.join(" · ")
|
|
1786
1849
|
};
|
|
@@ -1790,15 +1853,15 @@ function Rn(e, t) {
|
|
|
1790
1853
|
for (const t of o) e.text(` ${t.name.padEnd(r)} ${t.type.padEnd(s)} ${t.source}`);
|
|
1791
1854
|
n.length < t.length && e.text(` …and ${t.length - n.length} more · getContent().getSeries() on this movable lists every one`);
|
|
1792
1855
|
})(e, l);
|
|
1793
|
-
const t =
|
|
1856
|
+
const t = jn(l);
|
|
1794
1857
|
t.length > 0 && e.fact(`Analysis: ${t.join(" · ")}`);
|
|
1795
1858
|
}
|
|
1796
1859
|
}
|
|
1797
1860
|
const i = t.getAxes().getItems();
|
|
1798
|
-
i.length > 0 && e.fact(`Axes: ${i.map(
|
|
1861
|
+
i.length > 0 && e.fact(`Axes: ${i.map(Nn).join(" · ")}`);
|
|
1799
1862
|
}
|
|
1800
|
-
var
|
|
1801
|
-
function
|
|
1863
|
+
var In = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd;
|
|
1864
|
+
function Fn(e, t) {
|
|
1802
1865
|
const n = e.getWorksheet(), o = n.getWorkbook()?.getWorksheets().getItems({ visibility: m.Visibility.VeryHidden }) ?? [n], r = /* @__PURE__ */ new Map();
|
|
1803
1866
|
for (let e = 0; e < (t?.length ?? 0); e++) {
|
|
1804
1867
|
const n = t.at(e);
|
|
@@ -1808,7 +1871,7 @@ function jn(e, t) {
|
|
|
1808
1871
|
}
|
|
1809
1872
|
const s = e.getCoords(), l = [];
|
|
1810
1873
|
for (const e of o) for (const t of e.getMovables().getItems({ type: "chart" })) {
|
|
1811
|
-
const e =
|
|
1874
|
+
const e = mn(t);
|
|
1812
1875
|
if (!e || e.getPivotSource()) continue;
|
|
1813
1876
|
let o = null;
|
|
1814
1877
|
for (const t of e.getSeries()) {
|
|
@@ -1819,11 +1882,11 @@ function jn(e, t) {
|
|
|
1819
1882
|
]) {
|
|
1820
1883
|
if (!e) continue;
|
|
1821
1884
|
const t = e.getCoords();
|
|
1822
|
-
if (e.getWorksheet() === n &&
|
|
1885
|
+
if (e.getWorksheet() === n && In(t, s)) {
|
|
1823
1886
|
o = !0;
|
|
1824
1887
|
break;
|
|
1825
1888
|
}
|
|
1826
|
-
null === o && r.get(e.getWorksheet())?.some((e) =>
|
|
1889
|
+
null === o && r.get(e.getWorksheet())?.some((e) => In(e, t)) && (o = !1);
|
|
1827
1890
|
}
|
|
1828
1891
|
if (!0 === o) break;
|
|
1829
1892
|
}
|
|
@@ -1834,18 +1897,18 @@ function jn(e, t) {
|
|
|
1834
1897
|
}
|
|
1835
1898
|
return l;
|
|
1836
1899
|
}
|
|
1837
|
-
var
|
|
1900
|
+
var Tn = (e) => {
|
|
1838
1901
|
const t = e.movable.getRange();
|
|
1839
|
-
return `${
|
|
1840
|
-
},
|
|
1902
|
+
return `${pn(t.getWorksheet(), t.getCoords())} "${e.movable.getContent().getName?.() || "(unnamed)"}"${e.direct ? "" : " (through its dependents)"}`;
|
|
1903
|
+
}, An = (e, t, n) => {
|
|
1841
1904
|
const o = e.replace(/\r\n?|\n/g, " ⏎ ");
|
|
1842
1905
|
if (null === t || o.length <= t) return `"${o}"`;
|
|
1843
1906
|
const r = o.charCodeAt(t - 1), s = r >= 55296 && r <= 56319 ? t - 1 : t, l = `(+${o.length - s} chars)`;
|
|
1844
1907
|
return `"${o.slice(0, s)}…" ${n ? `${l} · full: ${n}` : l}`;
|
|
1845
|
-
},
|
|
1908
|
+
}, Ln = (e) => {
|
|
1846
1909
|
const t = e.geometry;
|
|
1847
1910
|
return "string" == typeof t ? t : t ? "custom" : "rect";
|
|
1848
|
-
},
|
|
1911
|
+
}, Wn = (e, t) => `${e} ${t}${1 === e ? "" : "s"}`, On = (e, t) => {
|
|
1849
1912
|
switch (e.type) {
|
|
1850
1913
|
case u.Type.None: return "none";
|
|
1851
1914
|
case u.Type.Solid: return String(e.color ?? "solid");
|
|
@@ -1863,31 +1926,31 @@ var Mn = (e) => {
|
|
|
1863
1926
|
}
|
|
1864
1927
|
default: return String(e.type);
|
|
1865
1928
|
}
|
|
1866
|
-
},
|
|
1929
|
+
}, Pn = (e, t) => {
|
|
1867
1930
|
if (null === e.style) return "none";
|
|
1868
1931
|
const n = e.style?.[t] ?? S.defaultStyleRefs(e)[t];
|
|
1869
1932
|
return !n || n.index <= 0 ? "none" : `theme style ${n.index}${n.color ? `, ${n.color}` : ""}`;
|
|
1870
|
-
},
|
|
1933
|
+
}, Dn = (e, t, n) => {
|
|
1871
1934
|
if (!e || e === p.LineEndType.None) return null;
|
|
1872
1935
|
const o = [t && t !== p.LineEndSize.Medium ? `wide ${t}` : null, n && n !== p.LineEndSize.Medium ? `long ${n}` : null].filter(Boolean);
|
|
1873
1936
|
return o.length ? `${e} (${o.join(", ")})` : e;
|
|
1874
|
-
},
|
|
1937
|
+
}, Hn = {
|
|
1875
1938
|
top: "top",
|
|
1876
1939
|
center: "middle",
|
|
1877
1940
|
bottom: "bottom",
|
|
1878
1941
|
justify: "justified",
|
|
1879
1942
|
distributed: "distributed"
|
|
1880
|
-
},
|
|
1943
|
+
}, Vn = (e) => {
|
|
1881
1944
|
if ("string" == typeof e) return e;
|
|
1882
1945
|
const t = e.address ?? e.action ?? "(no address)";
|
|
1883
1946
|
return e.screenTip ? `${t} — "${e.screenTip}"` : t;
|
|
1884
1947
|
};
|
|
1885
|
-
function
|
|
1948
|
+
function Bn(e, t) {
|
|
1886
1949
|
const n = t.toJSON() ?? {};
|
|
1887
1950
|
let o = null;
|
|
1888
1951
|
e.fact(`Shape: ${((e) => {
|
|
1889
|
-
const t =
|
|
1890
|
-
return o && "object" == typeof o && (n.push(
|
|
1952
|
+
const t = Ln(e), n = [], o = e.geometry;
|
|
1953
|
+
return o && "object" == typeof o && (n.push(Wn(o.paths.length, "path")), o.ah?.length && n.push(Wn(o.ah.length, "handle"))), e.type === f.Type.Connector && n.push("connector"), e.textBox && n.push("text box"), n.length > 0 ? `${t} — ${n.join(", ")}` : t;
|
|
1891
1954
|
})(n)}`);
|
|
1892
1955
|
const r = ((e) => {
|
|
1893
1956
|
const t = Object.entries(e);
|
|
@@ -1895,21 +1958,21 @@ function Dn(e, t) {
|
|
|
1895
1958
|
})(t.getAdjustments());
|
|
1896
1959
|
r && e.fact(`Adjustments: ${r} — the rest at the preset's defaults`);
|
|
1897
1960
|
const s = t.getTextFrame();
|
|
1898
|
-
s && e.fact(`Text: ${
|
|
1961
|
+
s && e.fact(`Text: ${An(s.getText(), null, "")}`);
|
|
1899
1962
|
const l = ((e) => {
|
|
1900
1963
|
if (!e) return null;
|
|
1901
1964
|
const t = [];
|
|
1902
|
-
return e.anchor && t.push(
|
|
1965
|
+
return e.anchor && t.push(Hn[e.anchor] ?? e.anchor), e.anchorCenter && t.push("centered"), "none" === e.wrap && t.push("no wrap"), e.verticalOverflow !== $.Overflow.Visible && e.horizontalOverflow !== $.Overflow.Visible || t.push("text may overflow the shape"), "shape" === e.autoFit && t.push("shape grows to fit text"), "normal" === e.autoFit && t.push("text shrinks to fit" + (void 0 !== e.fontScale ? ` (${e.fontScale}%)` : "")), e.vertical && e.vertical !== $.WritingMode.Horizontal && t.push(`vertical (${e.vertical})`), e.columns && e.columns > 1 && t.push(`${e.columns} columns`), e.warp && t.push(`warped (${e.warp.preset})`), t.length ? t.join(" · ") : null;
|
|
1903
1966
|
})(n.text?.body);
|
|
1904
|
-
l && e.fact(`Text Layout: ${l}`), n.textLink && e.fact(`Text Link: ${n.textLink} — the text shows this cell's value`), e.fact(`Fill: ${n.fill ?
|
|
1905
|
-
const n = e.stroke, o =
|
|
1967
|
+
l && e.fact(`Text Layout: ${l}`), n.textLink && e.fact(`Text Link: ${n.textLink} — the text shows this cell's value`), e.fact(`Fill: ${n.fill ? On(n.fill, t) : Pn(n, "fill")}`), e.fact(`Line: ${((e, t) => {
|
|
1968
|
+
const n = e.stroke, o = Pn(e, "stroke");
|
|
1906
1969
|
if (!n) return o;
|
|
1907
1970
|
if (n.fill?.type === u.Type.None) return "none";
|
|
1908
1971
|
const r = [];
|
|
1909
|
-
"number" == typeof n.width && r.push(`${n.width} pt`), r.push(n.fill ?
|
|
1910
|
-
const s =
|
|
1972
|
+
"number" == typeof n.width && r.push(`${n.width} pt`), r.push(n.fill ? On(n.fill, t) : `color from ${o}`), void 0 !== n.dash && n.dash !== p.DashStyle.Solid && r.push(`dash ${Array.isArray(n.dash) ? n.dash.join(" ") : n.dash}`), n.compound && n.compound !== p.Compound.Single && r.push(`compound ${n.compound}`);
|
|
1973
|
+
const s = Dn(n.headType, n.headWidth, n.headLength);
|
|
1911
1974
|
s && r.push(`head ${s}`);
|
|
1912
|
-
const l =
|
|
1975
|
+
const l = Dn(n.tailType, n.tailWidth, n.tailLength);
|
|
1913
1976
|
return l && r.push(`tail ${l}`), r.join(" · ");
|
|
1914
1977
|
})(n, t)}`), n.effects && e.fact(`Effects: ${n.effects.length ? n.effects.map((e) => e.type).join(", ") : "none — the theme style's are turned off"}`), (n.scene3d || n.shape3d) && e.fact("3-D: yes");
|
|
1915
1978
|
const a = ((e, t) => {
|
|
@@ -1928,49 +1991,49 @@ function Dn(e, t) {
|
|
|
1928
1991
|
deep: !0
|
|
1929
1992
|
})) {
|
|
1930
1993
|
const e = n.getContent(), o = e.toJSON?.();
|
|
1931
|
-
void 0 !== o?.sourceId && t.set(o.sourceId, e.getName() || `(unnamed ${
|
|
1994
|
+
void 0 !== o?.sourceId && t.set(o.sourceId, e.getName() || `(unnamed ${Ln(o)})`);
|
|
1932
1995
|
}
|
|
1933
1996
|
return t;
|
|
1934
1997
|
})(t.getMovable()));
|
|
1935
|
-
a && e.fact(`Connected: ${a}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${
|
|
1998
|
+
a && e.fact(`Connected: ${a}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${Vn(n.hyperlink)}`), n.hoverHyperlink && e.fact(`Hover Hyperlink: ${Vn(n.hoverHyperlink)}`), n.macro && e.fact(`Macro: ${n.macro}`);
|
|
1936
1999
|
const i = Object.entries(n.locks ?? {}).filter(([, e]) => e).map(([e]) => e);
|
|
1937
2000
|
i.length && e.fact(`Locks: ${i.join(", ")}`);
|
|
1938
2001
|
}
|
|
1939
|
-
var
|
|
2002
|
+
var zn = (e) => {
|
|
1940
2003
|
const t = e.getContent();
|
|
1941
2004
|
return !0 === t?.isIGroup ? t : null;
|
|
1942
|
-
},
|
|
1943
|
-
const t =
|
|
1944
|
-
return !0 === t?.isIShape ?
|
|
1945
|
-
},
|
|
2005
|
+
}, Un = (e) => {
|
|
2006
|
+
const t = _n(e);
|
|
2007
|
+
return !0 === t?.isIShape ? Ln(t.toJSON() ?? {}) : e.getContent().getType();
|
|
2008
|
+
}, _n = (e) => e.getContent(), Jn = (e, t, n) => {
|
|
1946
2009
|
for (const o of t.getItems()) {
|
|
1947
|
-
const t =
|
|
2010
|
+
const t = _n(o), r = [Un(o), t.getName?.() || "(unnamed)"];
|
|
1948
2011
|
!0 === t.isIPicture && r.push(t.getResource()?.getName?.() || "(no image)");
|
|
1949
2012
|
const s = t.getTextFrame?.()?.getText();
|
|
1950
|
-
s && r.push(
|
|
2013
|
+
s && r.push(An(s, 120, "")), o.isHidden() && r.push("(hidden)"), e.text(`${" ".repeat(n + 2)}${r.join(" · ")}`);
|
|
1951
2014
|
const l = o.getMovables();
|
|
1952
|
-
l &&
|
|
2015
|
+
l && Jn(e, l, n + 1);
|
|
1953
2016
|
}
|
|
1954
2017
|
};
|
|
1955
|
-
function
|
|
2018
|
+
function qn(e, t) {
|
|
1956
2019
|
const n = t.toJSON(), o = t.getMovable()?.getMovables()?.getItems() ?? [], r = t.getFill();
|
|
1957
|
-
r && e.fact(`Fill: ${
|
|
2020
|
+
r && e.fact(`Fill: ${On(r, null)} — taken by members that use the group's fill`), n.effects && e.fact(`Effects: ${n.effects.length ? n.effects.map((e) => e.type).join(", ") : "none"}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${Vn(n.hyperlink)}`), n.hoverHyperlink && e.fact(`Hover Hyperlink: ${Vn(n.hoverHyperlink)}`);
|
|
1958
2021
|
const s = Object.entries(n.locks ?? {}).filter(([, e]) => e).map(([e]) => e);
|
|
1959
2022
|
s.length && e.fact(`Locks: ${s.join(", ")}`), e.fact(`Members: ${o.length}, in z-order`);
|
|
1960
2023
|
const l = t.getMovable()?.getMovables();
|
|
1961
|
-
l &&
|
|
2024
|
+
l && Jn(e, l, 0);
|
|
1962
2025
|
}
|
|
1963
|
-
var
|
|
2026
|
+
var Kn = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Gn = (e) => e.replace(/[\r\n]+/g, " ").trim(), Xn = (t) => {
|
|
1964
2027
|
const n = t.getRange();
|
|
1965
2028
|
return e.rangeToString(n.getCoords()) ?? n.toString();
|
|
1966
|
-
},
|
|
2029
|
+
}, Zn = ({ movable: e, text: t }) => An(t, 300, ((e) => `${Pt(e.getRange())}.getRange(${JSON.stringify(Xn(e))}).getMovables()`)(e)), Yn = (e) => {
|
|
1967
2030
|
const t = e.getContent();
|
|
1968
2031
|
return "function" == typeof t.getTextFrame ? t.getTextFrame()?.getText() ?? "" : null;
|
|
1969
2032
|
};
|
|
1970
|
-
function
|
|
2033
|
+
function Qn(e) {
|
|
1971
2034
|
const t = [];
|
|
1972
2035
|
for (const n of e) {
|
|
1973
|
-
const e =
|
|
2036
|
+
const e = Yn(n) ?? "";
|
|
1974
2037
|
"" !== e.trim() && t.push({
|
|
1975
2038
|
movable: n,
|
|
1976
2039
|
text: e
|
|
@@ -1981,27 +2044,27 @@ function Xn(e) {
|
|
|
1981
2044
|
return n.rowStart - o.rowStart || n.colStart - o.colStart;
|
|
1982
2045
|
});
|
|
1983
2046
|
}
|
|
1984
|
-
var
|
|
1985
|
-
const t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), o =
|
|
1986
|
-
if (o) return
|
|
1987
|
-
|
|
1988
|
-
n ?
|
|
2047
|
+
var eo = (e) => "picture" === e.getType() && e.getResource?.()?.getName() || null, to = (e) => {
|
|
2048
|
+
const t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), o = mn(e);
|
|
2049
|
+
if (o) return Kn([
|
|
2050
|
+
Cn(o),
|
|
2051
|
+
n ? Gn(n) : null,
|
|
1989
2052
|
t
|
|
1990
2053
|
].filter(Boolean).join(" · "), 140);
|
|
1991
|
-
const r = e.getContent(), s = [], l =
|
|
1992
|
-
l && s.push(l), n && s.push(
|
|
1993
|
-
return
|
|
1994
|
-
},
|
|
2054
|
+
const r = e.getContent(), s = [], l = eo(r);
|
|
2055
|
+
l && s.push(l), n && s.push(Gn(n));
|
|
2056
|
+
return Kn(s.length > 0 ? `${t} — ${s.join(" · ")}` : t, 90);
|
|
2057
|
+
}, no = (e) => {
|
|
1995
2058
|
const t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription();
|
|
1996
|
-
return
|
|
1997
|
-
},
|
|
2059
|
+
return Kn(n ? `${t} — ${Gn(n)}` : t, 90);
|
|
2060
|
+
}, oo = /* @__PURE__ */ new Map([
|
|
1998
2061
|
["chart", "Charts"],
|
|
1999
2062
|
["shape", "Shapes"],
|
|
2000
2063
|
["group", "Groups"],
|
|
2001
2064
|
["picture", "Pictures"],
|
|
2002
2065
|
["slicer", "Slicers"]
|
|
2003
|
-
]),
|
|
2004
|
-
function
|
|
2066
|
+
]), ro = (e) => oo.get(e) ?? `${e.charAt(0).toUpperCase()}${e.slice(1)}s`;
|
|
2067
|
+
function so(e) {
|
|
2005
2068
|
const t = /* @__PURE__ */ new Map();
|
|
2006
2069
|
for (const n of e) {
|
|
2007
2070
|
const e = n.getContent().getType();
|
|
@@ -2010,31 +2073,31 @@ function no(e) {
|
|
|
2010
2073
|
o ? o.push(n) : t.set(e, [n]);
|
|
2011
2074
|
}
|
|
2012
2075
|
const n = /* @__PURE__ */ new Map();
|
|
2013
|
-
for (const e of
|
|
2076
|
+
for (const e of oo.keys()) {
|
|
2014
2077
|
const o = t.get(e);
|
|
2015
2078
|
o && n.set(e, o);
|
|
2016
2079
|
}
|
|
2017
2080
|
for (const [e, o] of t) n.set(e, o);
|
|
2018
2081
|
return n;
|
|
2019
2082
|
}
|
|
2020
|
-
function
|
|
2021
|
-
for (const [n, o] of
|
|
2083
|
+
function lo(e, t) {
|
|
2084
|
+
for (const [n, o] of so(t)) ao(e, n, o);
|
|
2022
2085
|
}
|
|
2023
|
-
function
|
|
2024
|
-
const o =
|
|
2025
|
-
const t = r.get(e), n =
|
|
2086
|
+
function ao(e, t, n) {
|
|
2087
|
+
const o = Qn(n), r = new Map(o.map((e) => [e.movable, e])), s = [...o.map((e) => e.movable), ...n.filter((e) => !r.has(e))], l = s.slice(0, L(s.length, 50)), a = l.map((e) => {
|
|
2088
|
+
const t = r.get(e), n = mn(e);
|
|
2026
2089
|
return {
|
|
2027
2090
|
movable: e,
|
|
2028
|
-
address:
|
|
2029
|
-
preset: n ?
|
|
2030
|
-
summary: n ?
|
|
2031
|
-
details: n ?
|
|
2032
|
-
text: t ?
|
|
2091
|
+
address: Xn(e),
|
|
2092
|
+
preset: n ? En(n) : (o = e.getContent(), o.getShapeType?.() ?? ""),
|
|
2093
|
+
summary: n ? no(e) : to(e),
|
|
2094
|
+
details: n ? vn(n) : [],
|
|
2095
|
+
text: t ? Zn(t) : "",
|
|
2033
2096
|
hidden: e.isHidden() ? " (hidden)" : ""
|
|
2034
2097
|
};
|
|
2035
2098
|
var o;
|
|
2036
2099
|
});
|
|
2037
|
-
e.h2(`${
|
|
2100
|
+
e.h2(`${ro(t)} (${n.length}${o.length > 0 ? ` · ${o.length} with text` : ""})`);
|
|
2038
2101
|
const i = Math.max(...a.map((e) => e.address.length)), c = Math.max(...a.map((e) => e.preset.length)), u = Math.min(40, Math.max(0, ...a.filter((e) => e.text).map((e) => e.summary.length)));
|
|
2039
2102
|
for (const t of a) {
|
|
2040
2103
|
const n = c > 0 ? `${t.preset.padEnd(c)} ` : "", o = t.text ? `${t.summary.padEnd(u)} ${t.text}` : t.summary;
|
|
@@ -2042,40 +2105,40 @@ function ro(e, t, n) {
|
|
|
2042
2105
|
const r = Math.max(10, ...t.details.map(([e]) => e.length + 2));
|
|
2043
2106
|
for (const [n, o] of t.details) e.text(` ${n.padEnd(r)}${o}`);
|
|
2044
2107
|
const s = t.movable.getMovables();
|
|
2045
|
-
s &&
|
|
2108
|
+
s && Jn(e, s, 0);
|
|
2046
2109
|
}
|
|
2047
2110
|
if (l.length < s.length) {
|
|
2048
|
-
const o = `${
|
|
2111
|
+
const o = `${Pt(n[0].getRange())}.getMovables().getItems({ type: ${JSON.stringify(t)} })`;
|
|
2049
2112
|
e.text(` …and ${s.length - l.length} more · ${o} reports every one in full`);
|
|
2050
2113
|
}
|
|
2051
2114
|
e.blank();
|
|
2052
2115
|
}
|
|
2053
|
-
function
|
|
2054
|
-
return
|
|
2116
|
+
function io(e) {
|
|
2117
|
+
return go(e, "Movable");
|
|
2055
2118
|
}
|
|
2056
|
-
function
|
|
2119
|
+
function co(e) {
|
|
2057
2120
|
const t = e.getMovable();
|
|
2058
|
-
if (t) return
|
|
2121
|
+
if (t) return go(t, "Shape");
|
|
2059
2122
|
const n = new ie();
|
|
2060
|
-
return n.h1(`Shape — ${e.getName() || "(unnamed)"}`), n.blank(),
|
|
2123
|
+
return n.h1(`Shape — ${e.getName() || "(unnamed)"}`), n.blank(), Bn(n, e), n.toLines().join("\n").trimEnd();
|
|
2061
2124
|
}
|
|
2062
|
-
var
|
|
2125
|
+
var uo = (e) => {
|
|
2063
2126
|
const t = e.getContent();
|
|
2064
2127
|
return !0 === t?.isIShape ? t : null;
|
|
2065
2128
|
};
|
|
2066
|
-
function
|
|
2067
|
-
const n = new ie(), r = e.getRange(), s = e.getContent(), l = s.getType(), a =
|
|
2068
|
-
n.h1(`${t} — ${
|
|
2069
|
-
const i =
|
|
2070
|
-
i ?
|
|
2071
|
-
const c =
|
|
2072
|
-
c && n.fact(`Content: ${c}`), a &&
|
|
2073
|
-
const u =
|
|
2074
|
-
u &&
|
|
2129
|
+
function go(e, t) {
|
|
2130
|
+
const n = new ie(), r = e.getRange(), s = e.getContent(), l = s.getType(), a = uo(e);
|
|
2131
|
+
n.h1(`${t} — ${Vt(r)}`), n.blank(), n.fact(`Name: ${e.getContent().getName?.() || "(unnamed)"}`);
|
|
2132
|
+
const i = mn(e);
|
|
2133
|
+
i ? Mn(n, i) : n.fact(`Type: ${l}`);
|
|
2134
|
+
const c = eo(s);
|
|
2135
|
+
c && n.fact(`Content: ${c}`), a && Bn(n, a);
|
|
2136
|
+
const u = zn(e);
|
|
2137
|
+
u && qn(n, u);
|
|
2075
2138
|
const g = e.getParent();
|
|
2076
2139
|
g && n.fact(`Group: ${g.getContent().getName?.() || "(unnamed)"}`);
|
|
2077
2140
|
const d = e.getContent().getDescription();
|
|
2078
|
-
d && n.fact(`Alt Text: ${
|
|
2141
|
+
d && n.fact(`Alt Text: ${Gn(d)}`), n.fact(`Anchor: ${Wt(r)}, ${((e) => {
|
|
2079
2142
|
switch (e) {
|
|
2080
2143
|
case o.Type.Absolute: return "absolute — stays put when rows or columns move";
|
|
2081
2144
|
case o.Type.OneCell: return "oneCell — moves with the cells, keeps its size";
|
|
@@ -2089,11 +2152,11 @@ function io(e, t) {
|
|
|
2089
2152
|
const h = e.getRotation();
|
|
2090
2153
|
0 !== h && n.fact(`Rotation: ${h}°`);
|
|
2091
2154
|
const f = e.getFlip(), m = [f.horizontal ? "horizontal" : null, f.vertical ? "vertical" : null].filter(Boolean);
|
|
2092
|
-
return m.length && n.fact(`Flip: ${m.join(", ")}`), n.fact(`Z-Order: ${e.getZIndex()}`), n.blank(), n.text(`Sheet: ${
|
|
2155
|
+
return m.length && n.fact(`Flip: ${m.join(", ")}`), n.fact(`Z-Order: ${e.getZIndex()}`), n.blank(), n.text(`Sheet: ${Ot(r.getWorksheet().getName())}`), n.toLines().join("\n").trimEnd();
|
|
2093
2156
|
}
|
|
2094
|
-
var
|
|
2157
|
+
var ho = (e) => "visible" === e.getVisibility(), fo = (e, t, n) => {
|
|
2095
2158
|
const o = e.getWorksheets().getItems({ visibility: "veryHidden" }), r = t?.trim();
|
|
2096
|
-
if (!r) return o.filter((e) => n ||
|
|
2159
|
+
if (!r) return o.filter((e) => n || ho(e)).map((e) => ({
|
|
2097
2160
|
sheet: e,
|
|
2098
2161
|
address: null
|
|
2099
2162
|
}));
|
|
@@ -2115,14 +2178,14 @@ var co = (e) => "visible" === e.getVisibility(), uo = (e, t, n) => {
|
|
|
2115
2178
|
const e = ((e) => {
|
|
2116
2179
|
const t = e.replace(/[.*+?^${}()|[\]\\]/g, (e) => "*" === e ? ".*" : "?" === e ? "." : `\\${e}`);
|
|
2117
2180
|
return new RegExp(`^${t}$`);
|
|
2118
|
-
})(r), t = o.filter((t) => e.test(t.getName()) && (n ||
|
|
2181
|
+
})(r), t = o.filter((t) => e.test(t.getName()) && (n || ho(t)));
|
|
2119
2182
|
if (0 === t.length) throw new Error(`No sheets match ${JSON.stringify(r)}. Sheets: ${o.map((e) => e.getName()).join(", ")}`);
|
|
2120
2183
|
return t.map((e) => ({
|
|
2121
2184
|
sheet: e,
|
|
2122
2185
|
address: null
|
|
2123
2186
|
}));
|
|
2124
2187
|
}
|
|
2125
|
-
const a = o.filter((e) => n ||
|
|
2188
|
+
const a = o.filter((e) => n || ho(e));
|
|
2126
2189
|
try {
|
|
2127
2190
|
a[0]?.getRange(r);
|
|
2128
2191
|
} catch {
|
|
@@ -2132,7 +2195,7 @@ var co = (e) => "visible" === e.getVisibility(), uo = (e, t, n) => {
|
|
|
2132
2195
|
sheet: e,
|
|
2133
2196
|
address: r
|
|
2134
2197
|
}));
|
|
2135
|
-
},
|
|
2198
|
+
}, mo = (e, t) => {
|
|
2136
2199
|
switch (t) {
|
|
2137
2200
|
case "display": return N(e, v.Mode.Display);
|
|
2138
2201
|
case "value": return N(e, v.Mode.Value);
|
|
@@ -2159,23 +2222,23 @@ var co = (e) => "visible" === e.getVisibility(), uo = (e, t, n) => {
|
|
|
2159
2222
|
}
|
|
2160
2223
|
default: return null;
|
|
2161
2224
|
}
|
|
2162
|
-
},
|
|
2225
|
+
}, po = /* @__PURE__ */ new Map([["hyperlink", l.Feature.Hyperlink], ["numberFormat", l.Feature.NumberFormat]]), $o = (e, t) => t && "" !== t.trim() ? [{
|
|
2163
2226
|
field: e,
|
|
2164
2227
|
text: {
|
|
2165
2228
|
match: t,
|
|
2166
2229
|
display: t
|
|
2167
2230
|
}
|
|
2168
|
-
}] : [],
|
|
2169
|
-
const n =
|
|
2231
|
+
}] : [], wo = (e) => [...$o("comment", e.getContent()), ...e.getReplies().flatMap((e) => $o("comment", e.getContent()))], yo = (e, t) => {
|
|
2232
|
+
const n = mn(e);
|
|
2170
2233
|
if (n) return t.includes("chart") ? [
|
|
2171
|
-
|
|
2172
|
-
...n.getAxes().getItems().flatMap((e) =>
|
|
2173
|
-
...n.getSeries().flatMap((e) => null === e.getNameFormula() ?
|
|
2174
|
-
|
|
2234
|
+
...$o("chart", n.getChartTitle()),
|
|
2235
|
+
...n.getAxes().getItems().flatMap((e) => $o("chart", e.getTitle().getText())),
|
|
2236
|
+
...n.getSeries().flatMap((e) => null === e.getNameFormula() ? $o("chart", e.getName()) : []),
|
|
2237
|
+
...$o("chart", e.getContent().getDescription())
|
|
2175
2238
|
] : [];
|
|
2176
|
-
const o =
|
|
2177
|
-
return null !== o && t.includes("shape") ? [
|
|
2178
|
-
},
|
|
2239
|
+
const o = Yn(e);
|
|
2240
|
+
return null !== o && t.includes("shape") ? [...$o("shape", o), ...$o("shape", e.getContent().getDescription())] : [];
|
|
2241
|
+
}, bo = (e) => {
|
|
2179
2242
|
const t = e.isIFormula ? `=${e.getExpression()}` : null, n = t ?? e.getRanges?.()?.getAddress() ?? e.getName();
|
|
2180
2243
|
return [
|
|
2181
2244
|
{
|
|
@@ -2185,21 +2248,21 @@ var co = (e) => "visible" === e.getVisibility(), uo = (e, t, n) => {
|
|
|
2185
2248
|
display: n
|
|
2186
2249
|
}
|
|
2187
2250
|
},
|
|
2188
|
-
...t ?
|
|
2189
|
-
|
|
2251
|
+
...t ? $o("name", t) : [],
|
|
2252
|
+
...$o("name", e.getComment())
|
|
2190
2253
|
];
|
|
2191
|
-
},
|
|
2254
|
+
}, So = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd, xo = (e, t) => {
|
|
2192
2255
|
const n = e.getRanges?.() ?? null;
|
|
2193
2256
|
return t.some(({ sheet: t, address: o }) => {
|
|
2194
2257
|
if (null === o && e.getScope() === t.getName()) return !0;
|
|
2195
2258
|
const r = null !== o ? t.getRange(o).getCoords() : null;
|
|
2196
2259
|
for (let e = 0; e < (n?.length ?? 0); e++) {
|
|
2197
2260
|
const o = n.at(e);
|
|
2198
|
-
if (o.getWorksheet() === t && (!r ||
|
|
2261
|
+
if (o.getWorksheet() === t && (!r || So(o.getCoords(), r))) return !0;
|
|
2199
2262
|
}
|
|
2200
2263
|
return !1;
|
|
2201
2264
|
});
|
|
2202
|
-
},
|
|
2265
|
+
}, ko = (e, t) => e.rowStart - t.rowStart || e.colStart - t.colStart, Co = (e, t, n) => {
|
|
2203
2266
|
let o = null;
|
|
2204
2267
|
const r = (e) => ({
|
|
2205
2268
|
range: `${t}!${e.getRange().toString()}`,
|
|
@@ -2225,7 +2288,7 @@ var co = (e) => "visible" === e.getVisibility(), uo = (e, t, n) => {
|
|
|
2225
2288
|
} : a ? r(a) : void 0;
|
|
2226
2289
|
} };
|
|
2227
2290
|
};
|
|
2228
|
-
async function
|
|
2291
|
+
async function vo(t, n) {
|
|
2229
2292
|
if (!n.pattern) throw new Error("grep requires a pattern");
|
|
2230
2293
|
const o = n.fields?.length ? n.fields : A, r = n.output ?? "content", s = n.maxCount ?? 200, l = !0 === n.invert, a = !0 === n.hidden, i = ((e) => {
|
|
2231
2294
|
if (void 0 === e || !1 === e) return null;
|
|
@@ -2245,7 +2308,7 @@ async function xo(t, n) {
|
|
|
2245
2308
|
throw new Error(`Invalid regex ${JSON.stringify(e.pattern)}: ${t instanceof Error ? t.message : String(t)}. Use fixedStrings (-F) to search for the literal text.`);
|
|
2246
2309
|
}
|
|
2247
2310
|
}
|
|
2248
|
-
})(n), u =
|
|
2311
|
+
})(n), u = fo(t, n.scope, a), g = o.filter((e) => !po.has(e)), d = o.filter((e) => po.has(e)), h = o.includes("display") && o.includes("value"), f = "content" === r || "addresses" === r, m = [], p = [];
|
|
2249
2312
|
let $ = 0, w = 0, y = 0, b = 0, S = !1;
|
|
2250
2313
|
const x = (e) => {
|
|
2251
2314
|
const t = e.filter((t, n) => c.test(t.text.match) && e.findIndex((e) => e.field === t.field && e.text.display === t.text.display && c.test(e.text.match)) === n);
|
|
@@ -2265,7 +2328,7 @@ async function xo(t, n) {
|
|
|
2265
2328
|
if (S) continue;
|
|
2266
2329
|
const s = t.getName();
|
|
2267
2330
|
b++, await t.getCalculation().ready();
|
|
2268
|
-
const l = null !== n ? t.getRange(n) : t.getUsedRange(), c = l && i && "content" === r ?
|
|
2331
|
+
const l = null !== n ? t.getRange(n) : t.getUsedRange(), c = l && i && "content" === r ? Co(i, s, l) : null, u = {
|
|
2269
2332
|
...null !== n ? { address: n } : {},
|
|
2270
2333
|
...a ? {} : { ignoreHidden: !0 }
|
|
2271
2334
|
}, f = /* @__PURE__ */ new Map();
|
|
@@ -2281,11 +2344,11 @@ async function xo(t, n) {
|
|
|
2281
2344
|
for (const e of g) {
|
|
2282
2345
|
if ("comment" === e) {
|
|
2283
2346
|
const e = `${o.rowIndex}:${o.colIndex}`, t = f.get(e);
|
|
2284
|
-
t && (r.push(...
|
|
2347
|
+
t && (r.push(...wo(t)), f.delete(e));
|
|
2285
2348
|
continue;
|
|
2286
2349
|
}
|
|
2287
|
-
const t =
|
|
2288
|
-
"display" === e && (l = t?.match ?? null), null !== t && ("value" === e && h && (void 0 === l && (l =
|
|
2350
|
+
const t = mo(n, e);
|
|
2351
|
+
"display" === e && (l = t?.match ?? null), null !== t && ("value" === e && h && (void 0 === l && (l = mo(n, "display")?.match ?? null), t.match === l) || r.push({
|
|
2289
2352
|
field: e,
|
|
2290
2353
|
text: t
|
|
2291
2354
|
}));
|
|
@@ -2299,10 +2362,10 @@ async function xo(t, n) {
|
|
|
2299
2362
|
const $ = [...f.values()].map((e) => ({
|
|
2300
2363
|
comment: e,
|
|
2301
2364
|
at: e.getRange().getCoords()
|
|
2302
|
-
})).sort((e, t) =>
|
|
2365
|
+
})).sort((e, t) => ko(e.at, t.at));
|
|
2303
2366
|
for (const { comment: t, at: n } of $) {
|
|
2304
2367
|
if (S) break;
|
|
2305
|
-
const o = x(
|
|
2368
|
+
const o = x(wo(t));
|
|
2306
2369
|
if (!o) continue;
|
|
2307
2370
|
const r = c?.resolve(t.getRange().getCell(), {
|
|
2308
2371
|
rowIndex: n.rowStart,
|
|
@@ -2312,12 +2375,12 @@ async function xo(t, n) {
|
|
|
2312
2375
|
}
|
|
2313
2376
|
for (const e of d) {
|
|
2314
2377
|
if (S || !l) break;
|
|
2315
|
-
const t = [...l.getRegions(
|
|
2378
|
+
const t = [...l.getRegions(po.get(e), { ignoreHidden: !a })].map((e) => ({
|
|
2316
2379
|
region: e,
|
|
2317
2380
|
at: e.getCoords()
|
|
2318
|
-
})).sort((e, t) =>
|
|
2381
|
+
})).sort((e, t) => ko(e.at, t.at));
|
|
2319
2382
|
for (const { region: n, at: o } of t) {
|
|
2320
|
-
const t = n.getCell(), r =
|
|
2383
|
+
const t = n.getCell(), r = mo(t, e), l = x(r ? [{
|
|
2321
2384
|
field: e,
|
|
2322
2385
|
text: r
|
|
2323
2386
|
}] : []);
|
|
@@ -2335,9 +2398,9 @@ async function xo(t, n) {
|
|
|
2335
2398
|
const n = t.getMovables().getItems(u).filter((e) => "note" !== e.getContent().getType()).filter((e) => a || !e.isHidden()).map((e) => ({
|
|
2336
2399
|
movable: e,
|
|
2337
2400
|
at: e.getRange().getCoords()
|
|
2338
|
-
})).sort((e, t) =>
|
|
2401
|
+
})).sort((e, t) => ko(e.at, t.at));
|
|
2339
2402
|
for (const { movable: t, at: r } of n) {
|
|
2340
|
-
const n = x(
|
|
2403
|
+
const n = x(yo(t, o));
|
|
2341
2404
|
if (n) {
|
|
2342
2405
|
if (!k("object", s, e.rangeToString(r) ?? t.getRange().toString(), n)) break;
|
|
2343
2406
|
w++;
|
|
@@ -2353,8 +2416,8 @@ async function xo(t, n) {
|
|
|
2353
2416
|
if (!S && o.includes("name")) {
|
|
2354
2417
|
const e = Boolean(n.scope?.trim()), o = t.getNames().getItems(a ? { includeHidden: !0 } : void 0) ?? [];
|
|
2355
2418
|
for (const t of o) {
|
|
2356
|
-
if (e && !
|
|
2357
|
-
const n = x(
|
|
2419
|
+
if (e && !xo(t, u)) continue;
|
|
2420
|
+
const n = x(bo(t));
|
|
2358
2421
|
if (n && !k("object", t.getScope() ?? "", t.getName(), n)) break;
|
|
2359
2422
|
}
|
|
2360
2423
|
}
|
|
@@ -2372,27 +2435,27 @@ async function xo(t, n) {
|
|
|
2372
2435
|
output: r
|
|
2373
2436
|
};
|
|
2374
2437
|
}
|
|
2375
|
-
var
|
|
2438
|
+
var Eo = (e) => {
|
|
2376
2439
|
const t = e.replace(/\s+/g, " ").trim();
|
|
2377
2440
|
return t.length > 120 ? `${t.slice(0, 119)}…` : t;
|
|
2378
|
-
},
|
|
2379
|
-
const r = t.map((e) => o ?
|
|
2441
|
+
}, Ro = (e) => e.sheet ? `${e.sheet}!${e.address}` : e.address, No = (e, t) => `${e} ${t}${1 === e ? "" : "s"}`, jo = (e, t) => t > 0 ? `${No(e, "cell")} · ${No(t, "object")}` : No(e, "cell"), Mo = (e, t, n, o) => {
|
|
2442
|
+
const r = t.map((e) => o ? Ro(e) : e.address), s = Math.max(...r.map((e) => e.length)), l = Math.max(...t.map((e) => e.field.length));
|
|
2380
2443
|
for (let o = 0; o < t.length; o++) {
|
|
2381
2444
|
const a = t[o];
|
|
2382
|
-
e.push(`${n}${r[o].padEnd(s)} ${a.field.padEnd(l)} ${
|
|
2445
|
+
e.push(`${n}${r[o].padEnd(s)} ${a.field.padEnd(l)} ${Eo(a.text)}`);
|
|
2383
2446
|
}
|
|
2384
2447
|
};
|
|
2385
|
-
function
|
|
2386
|
-
const { pattern: t, fields: n, scope: o, matches: r, cellCount: s, objectCount: l, sheetsSearched: a, sheetsMatched: i } = e, c = [`grep "${t}" · ${o} · fields ${n.join(",")} · ${
|
|
2448
|
+
function Io(e) {
|
|
2449
|
+
const { pattern: t, fields: n, scope: o, matches: r, cellCount: s, objectCount: l, sheetsSearched: a, sheetsMatched: i } = e, c = [`grep "${t}" · ${o} · fields ${n.join(",")} · ${jo(s, l)} in ${i} of ${a} ${1 === a ? "sheet" : "sheets"}`];
|
|
2387
2450
|
if ("count" === e.output) {
|
|
2388
|
-
for (const t of e.sheets) c.push(` ${t.sheet}: ${t.objects > 0 ?
|
|
2451
|
+
for (const t of e.sheets) c.push(` ${t.sheet}: ${t.objects > 0 ? jo(t.cells, t.objects) : t.cells}`);
|
|
2389
2452
|
const t = l - e.sheets.reduce((e, t) => e + t.objects, 0);
|
|
2390
2453
|
t > 0 && c.push(` names: ${t}`);
|
|
2391
2454
|
} else if ("sheets" === e.output) {
|
|
2392
2455
|
for (const t of e.sheets) c.push(` ${t.sheet}`);
|
|
2393
2456
|
0 === e.sheets.length && c.push(l > 0 ? " no sheets · names only" : " no matches");
|
|
2394
2457
|
} else if (0 === r.length) c.push(" no matches");
|
|
2395
|
-
else if ("addresses" === e.output) for (const e of r) c.push(` ${
|
|
2458
|
+
else if ("addresses" === e.output) for (const e of r) c.push(` ${Ro(e)}`);
|
|
2396
2459
|
else {
|
|
2397
2460
|
const e = [], t = /* @__PURE__ */ new Map();
|
|
2398
2461
|
for (const n of r) {
|
|
@@ -2404,11 +2467,11 @@ function No(e) {
|
|
|
2404
2467
|
rows: []
|
|
2405
2468
|
}, t.set(o, r), e.push(r)), r.rows.push(n);
|
|
2406
2469
|
}
|
|
2407
|
-
for (const t of e) t.heading ? (c.push(` ${t.heading}`),
|
|
2470
|
+
for (const t of e) t.heading ? (c.push(` ${t.heading}`), Mo(c, t.rows, " ", !1)) : Mo(c, t.rows, " ", !0);
|
|
2408
2471
|
}
|
|
2409
|
-
return e.truncated && c.push(` …truncated at ${
|
|
2472
|
+
return e.truncated && c.push(` …truncated at ${jo(s, l)} · narrow the pattern, or scope the search to one sheet or range`), c.join("\n");
|
|
2410
2473
|
}
|
|
2411
|
-
var
|
|
2474
|
+
var Fo = {
|
|
2412
2475
|
name: "grep",
|
|
2413
2476
|
description: "Search a workbook's text by pattern: cell contents, and the text that is in no cell — comments, shapes, charts and defined names. Returns grid-anchored matches, each tagged with the layer it matched. Selection by attribute (fills, formats, features) is the regions read, not grep.",
|
|
2414
2477
|
params: [
|
|
@@ -2493,9 +2556,9 @@ var jo = {
|
|
|
2493
2556
|
description: "What to return: content (address, layer and text), addresses (one per matched cell), count (per sheet), or sheets (names with a match)."
|
|
2494
2557
|
}
|
|
2495
2558
|
],
|
|
2496
|
-
run:
|
|
2497
|
-
render:
|
|
2498
|
-
},
|
|
2559
|
+
run: vo,
|
|
2560
|
+
render: Io
|
|
2561
|
+
}, To = (e) => !e.deprecated && !e.hidden, Ao = (e) => (e.members ?? []).filter(To), Lo = [
|
|
2499
2562
|
{
|
|
2500
2563
|
match: /^(get|set)?(number)?(format|numfmt)s?$/i,
|
|
2501
2564
|
relies: ["ICellStyle", "setNumberFormat"],
|
|
@@ -2516,7 +2579,7 @@ var jo = {
|
|
|
2516
2579
|
relies: ["IWorkbook", "getWorksheet"],
|
|
2517
2580
|
hint: "Look a worksheet up by name with `wb.getWorksheet('Name')`."
|
|
2518
2581
|
}
|
|
2519
|
-
],
|
|
2582
|
+
], Wo = [
|
|
2520
2583
|
"IWorkbook",
|
|
2521
2584
|
"IWorksheet",
|
|
2522
2585
|
"ICellRange",
|
|
@@ -2526,16 +2589,16 @@ var jo = {
|
|
|
2526
2589
|
"ICellStyle",
|
|
2527
2590
|
"IScript.ScriptContext"
|
|
2528
2591
|
];
|
|
2529
|
-
var
|
|
2530
|
-
function
|
|
2592
|
+
var Oo = (e) => e.slice(e.lastIndexOf(".") + 1);
|
|
2593
|
+
function Po(e, t) {
|
|
2531
2594
|
if (e.types[t]) return t;
|
|
2532
2595
|
const n = Object.keys(e.types), o = t.toLowerCase(), r = n.filter((e) => e.toLowerCase() === o);
|
|
2533
2596
|
if (1 === r.length) return r[0];
|
|
2534
2597
|
if (t.includes(".")) return null;
|
|
2535
|
-
const s = n.filter((e) =>
|
|
2598
|
+
const s = n.filter((e) => Oo(e).toLowerCase() === o);
|
|
2536
2599
|
return 1 === s.length ? s[0] : null;
|
|
2537
2600
|
}
|
|
2538
|
-
function
|
|
2601
|
+
function Do(e, t, n) {
|
|
2539
2602
|
const o = n.replace(/<[\s\S]*$/, "").trim(), r = t.split(".");
|
|
2540
2603
|
for (let t = r.length - 1; t >= 0; t--) {
|
|
2541
2604
|
const n = [...r.slice(0, t), o].join(".");
|
|
@@ -2543,7 +2606,7 @@ function Wo(e, t, n) {
|
|
|
2543
2606
|
}
|
|
2544
2607
|
return null;
|
|
2545
2608
|
}
|
|
2546
|
-
function
|
|
2609
|
+
function Ho(e, t, n, o = /* @__PURE__ */ new Set()) {
|
|
2547
2610
|
if (o.has(t)) return null;
|
|
2548
2611
|
o.add(t);
|
|
2549
2612
|
const r = e.types[t];
|
|
@@ -2554,20 +2617,20 @@ function Oo(e, t, n, o = /* @__PURE__ */ new Set()) {
|
|
|
2554
2617
|
members: s
|
|
2555
2618
|
};
|
|
2556
2619
|
for (const s of r.extends ?? []) {
|
|
2557
|
-
const r =
|
|
2620
|
+
const r = Do(e, t, s), l = r ? Ho(e, r, n, o) : null;
|
|
2558
2621
|
if (l) return l;
|
|
2559
2622
|
}
|
|
2560
2623
|
return null;
|
|
2561
2624
|
}
|
|
2562
|
-
function
|
|
2625
|
+
function Vo(e, t, n) {
|
|
2563
2626
|
const o = e.types[t], r = (o.extends ?? []).map((n) => {
|
|
2564
|
-
const o =
|
|
2627
|
+
const o = Do(e, t, n);
|
|
2565
2628
|
return {
|
|
2566
2629
|
text: n,
|
|
2567
2630
|
key: o,
|
|
2568
|
-
memberCount: o ?
|
|
2631
|
+
memberCount: o ? Ao(e.types[o]).length : 0
|
|
2569
2632
|
};
|
|
2570
|
-
}), s =
|
|
2633
|
+
}), s = Ao(o), l = n?.toLowerCase();
|
|
2571
2634
|
return {
|
|
2572
2635
|
kind: "type",
|
|
2573
2636
|
key: t,
|
|
@@ -2577,7 +2640,7 @@ function Po(e, t, n) {
|
|
|
2577
2640
|
...n ? { filter: n } : {}
|
|
2578
2641
|
};
|
|
2579
2642
|
}
|
|
2580
|
-
function
|
|
2643
|
+
function Bo(e, t, n) {
|
|
2581
2644
|
const o = (e) => {
|
|
2582
2645
|
const o = t(e).toLowerCase();
|
|
2583
2646
|
return o === n ? 0 : o.startsWith(n) ? 1 : 2;
|
|
@@ -2588,12 +2651,12 @@ function Do(e, t, n) {
|
|
|
2588
2651
|
score: o(e)
|
|
2589
2652
|
})).sort((e, t) => e.score - t.score || e.order - t.order).map((e) => e.item);
|
|
2590
2653
|
}
|
|
2591
|
-
function
|
|
2654
|
+
function zo(e, t) {
|
|
2592
2655
|
const n = function(e) {
|
|
2593
2656
|
return e.trim().replace(/^SheetXL\./, "").replace(/\(\)$/, "").replace(/#/g, ".");
|
|
2594
2657
|
}(t ?? "");
|
|
2595
2658
|
if (!n) {
|
|
2596
|
-
const t =
|
|
2659
|
+
const t = Wo.filter((t) => e.types[t]).map((t) => ({
|
|
2597
2660
|
key: t,
|
|
2598
2661
|
entry: e.types[t]
|
|
2599
2662
|
}));
|
|
@@ -2603,51 +2666,51 @@ function Ho(e, t) {
|
|
|
2603
2666
|
entryPoints: t
|
|
2604
2667
|
};
|
|
2605
2668
|
}
|
|
2606
|
-
const o =
|
|
2607
|
-
if (o) return
|
|
2669
|
+
const o = Po(e, n);
|
|
2670
|
+
if (o) return Vo(e, o);
|
|
2608
2671
|
const r = n.lastIndexOf(".");
|
|
2609
2672
|
if (r > 0) {
|
|
2610
|
-
const t = n.slice(0, r), o =
|
|
2673
|
+
const t = n.slice(0, r), o = Po(e, t), s = n.slice(r + 1);
|
|
2611
2674
|
if (o && s) {
|
|
2612
|
-
const t = s.toLowerCase(), n =
|
|
2675
|
+
const t = s.toLowerCase(), n = Ho(e, o, (e) => e.name === s) ?? Ho(e, o, (e) => e.name.toLowerCase() === t);
|
|
2613
2676
|
if (n) return {
|
|
2614
2677
|
kind: "member",
|
|
2615
2678
|
key: o,
|
|
2616
2679
|
declaredOn: n.key,
|
|
2617
2680
|
members: n.members
|
|
2618
2681
|
};
|
|
2619
|
-
const r =
|
|
2682
|
+
const r = Vo(e, o, s);
|
|
2620
2683
|
if (r.members.length > 0) return r;
|
|
2621
2684
|
}
|
|
2622
2685
|
if (s) {
|
|
2623
2686
|
const n = function(e, t, n, o) {
|
|
2624
|
-
const r = o.toLowerCase(), s = Object.entries(e.types).flatMap(([e, t]) =>
|
|
2687
|
+
const r = o.toLowerCase(), s = Object.entries(e.types).flatMap(([e, t]) => Ao(t).filter((e) => e.name.toLowerCase() === r).map((t) => ({
|
|
2625
2688
|
key: e,
|
|
2626
2689
|
member: t
|
|
2627
|
-
}))), l =
|
|
2690
|
+
}))), l = Lo.filter((t) => t.match.test(o) && e.types[t.relies[0]]?.members?.some((e) => e.name === t.relies[1])).map((e) => e.hint), a = n ? [] : function(e, t, n) {
|
|
2628
2691
|
const o = t.toLowerCase().replace(/s$/, ""), r = n.toLowerCase();
|
|
2629
|
-
return Object.keys(e.types).filter((t) =>
|
|
2630
|
-
const n =
|
|
2692
|
+
return Object.keys(e.types).filter((t) => To(e.types[t])).map((e) => {
|
|
2693
|
+
const n = Oo(e), r = Go(t, n), s = o.length >= 4 && n.toLowerCase().startsWith(o);
|
|
2631
2694
|
return {
|
|
2632
2695
|
key: e,
|
|
2633
2696
|
score: r ?? (s ? 10 : null)
|
|
2634
2697
|
};
|
|
2635
2698
|
}).filter((e) => null !== e.score).map((t) => ({
|
|
2636
2699
|
...t,
|
|
2637
|
-
hasMember:
|
|
2638
|
-
})).sort((e, t) => Number(t.hasMember) - Number(e.hasMember) || e.score - t.score).slice(0,
|
|
2700
|
+
hasMember: Ko(e, t.key).some((e) => e.name.toLowerCase() === r)
|
|
2701
|
+
})).sort((e, t) => Number(t.hasMember) - Number(e.hasMember) || e.score - t.score).slice(0, Uo).map(({ key: e, hasMember: t }) => ({
|
|
2639
2702
|
key: e,
|
|
2640
2703
|
hasMember: t
|
|
2641
2704
|
}));
|
|
2642
2705
|
}(e, t, o), i = n ? function(e, t, n) {
|
|
2643
|
-
const o =
|
|
2644
|
-
return
|
|
2645
|
-
const t =
|
|
2706
|
+
const o = _o(n)?.toLowerCase();
|
|
2707
|
+
return Ko(e, t).map((e) => {
|
|
2708
|
+
const t = Go(n, e.name), r = o && o.length >= 3 && e.name.toLowerCase().includes(o);
|
|
2646
2709
|
return {
|
|
2647
2710
|
member: e,
|
|
2648
2711
|
score: t ?? (r ? 10 : null)
|
|
2649
2712
|
};
|
|
2650
|
-
}).filter((e) => null !== e.score).sort((e, t) => e.score - t.score).slice(0,
|
|
2713
|
+
}).filter((e) => null !== e.score).sort((e, t) => e.score - t.score).slice(0, Uo).map((e) => e.member);
|
|
2651
2714
|
}(e, n, o) : [];
|
|
2652
2715
|
return a.length + i.length + l.length + s.length === 0 ? null : {
|
|
2653
2716
|
kind: "miss",
|
|
@@ -2659,8 +2722,8 @@ function Ho(e, t) {
|
|
|
2659
2722
|
nearestTypes: a,
|
|
2660
2723
|
nearest: i,
|
|
2661
2724
|
hints: l,
|
|
2662
|
-
elsewhere: s.slice(0,
|
|
2663
|
-
elsewhereOmitted: Math.max(0, s.length -
|
|
2725
|
+
elsewhere: s.slice(0, Uo),
|
|
2726
|
+
elsewhereOmitted: Math.max(0, s.length - Uo)
|
|
2664
2727
|
};
|
|
2665
2728
|
}(e, t, o, s);
|
|
2666
2729
|
if (n) return n;
|
|
@@ -2668,14 +2731,14 @@ function Ho(e, t) {
|
|
|
2668
2731
|
}
|
|
2669
2732
|
return function(e, t) {
|
|
2670
2733
|
const n = t.toLowerCase(), o = [], r = [];
|
|
2671
|
-
for (const [t, s] of Object.entries(e.types)) if (
|
|
2672
|
-
|
|
2673
|
-
for (const e of
|
|
2734
|
+
for (const [t, s] of Object.entries(e.types)) if (To(s)) {
|
|
2735
|
+
Oo(t).toLowerCase().includes(n) && o.push(t);
|
|
2736
|
+
for (const e of Ao(s)) e.name.toLowerCase().includes(n) && r.push({
|
|
2674
2737
|
key: t,
|
|
2675
2738
|
member: e
|
|
2676
2739
|
});
|
|
2677
2740
|
}
|
|
2678
|
-
const s =
|
|
2741
|
+
const s = Bo(o, Oo, n), l = Bo(r, (e) => e.member.name, n);
|
|
2679
2742
|
return {
|
|
2680
2743
|
kind: "search",
|
|
2681
2744
|
query: t,
|
|
@@ -2685,8 +2748,8 @@ function Ho(e, t) {
|
|
|
2685
2748
|
};
|
|
2686
2749
|
}(e, r > 0 ? n.slice(r + 1) : n);
|
|
2687
2750
|
}
|
|
2688
|
-
var
|
|
2689
|
-
function
|
|
2751
|
+
var Uo = 5, _o = (e) => /([A-Z][a-z0-9]+|^[a-z0-9]+)$/.exec(e)?.[1] ?? null;
|
|
2752
|
+
function Jo(e, t) {
|
|
2690
2753
|
if (!t || "object" != typeof t && "function" != typeof t) return null;
|
|
2691
2754
|
const n = [], o = /* @__PURE__ */ new Set();
|
|
2692
2755
|
for (let r = t; r && r !== Object.prototype; r = Object.getPrototypeOf(r)) for (const s of Object.getOwnPropertyNames(r)) {
|
|
@@ -2696,13 +2759,13 @@ function zo(e, t) {
|
|
|
2696
2759
|
try {
|
|
2697
2760
|
r = !0 === t[s];
|
|
2698
2761
|
} catch {}
|
|
2699
|
-
const l = r ?
|
|
2762
|
+
const l = r ? Po(e, s.slice(2)) : null;
|
|
2700
2763
|
l && !n.includes(l) && n.push(l);
|
|
2701
2764
|
}
|
|
2702
2765
|
if (n.length <= 1) return n[0] ?? null;
|
|
2703
2766
|
const r = (t, n = /* @__PURE__ */ new Set()) => {
|
|
2704
2767
|
for (const o of e.types[t].extends ?? []) {
|
|
2705
|
-
const s =
|
|
2768
|
+
const s = Do(e, t, o);
|
|
2706
2769
|
s && !n.has(s) && (n.add(s), r(s, n));
|
|
2707
2770
|
}
|
|
2708
2771
|
return n;
|
|
@@ -2710,26 +2773,26 @@ function zo(e, t) {
|
|
|
2710
2773
|
for (const e of n) for (const t of r(e)) s.add(t);
|
|
2711
2774
|
return n.filter((e) => !s.has(e)).sort((t, n) => (e.types[n].members?.length ?? 0) - (e.types[t].members?.length ?? 0))[0] ?? n[0];
|
|
2712
2775
|
}
|
|
2713
|
-
function
|
|
2776
|
+
function qo(e, t) {
|
|
2714
2777
|
const n = /\bon type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(e)?.[1];
|
|
2715
2778
|
return n ? `\`${t} ${n}\` lists its members.` : null;
|
|
2716
2779
|
}
|
|
2717
|
-
function
|
|
2780
|
+
function Ko(e, t) {
|
|
2718
2781
|
const n = [], o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = (t) => {
|
|
2719
2782
|
if (r.has(t)) return;
|
|
2720
2783
|
r.add(t);
|
|
2721
2784
|
const l = e.types[t];
|
|
2722
2785
|
if (l) {
|
|
2723
|
-
for (const e of
|
|
2786
|
+
for (const e of Ao(l)) o.has(e.name) || (o.add(e.name), n.push(e));
|
|
2724
2787
|
for (const n of l.extends ?? []) {
|
|
2725
|
-
const o =
|
|
2788
|
+
const o = Do(e, t, n);
|
|
2726
2789
|
o && s(o);
|
|
2727
2790
|
}
|
|
2728
2791
|
}
|
|
2729
2792
|
};
|
|
2730
2793
|
return s(t), n;
|
|
2731
2794
|
}
|
|
2732
|
-
function
|
|
2795
|
+
function Go(e, t) {
|
|
2733
2796
|
const n = e.toLowerCase(), o = t.toLowerCase();
|
|
2734
2797
|
if (n === o) return 0;
|
|
2735
2798
|
if (n.startsWith(o) || o.startsWith(n)) return 1;
|
|
@@ -2747,85 +2810,85 @@ function Jo(e, t) {
|
|
|
2747
2810
|
}(n, o);
|
|
2748
2811
|
return r <= Math.max(2, Math.floor(.3 * n.length)) ? 1 + r : null;
|
|
2749
2812
|
}
|
|
2750
|
-
function
|
|
2751
|
-
const n = /\s*Did you mean '([\w$]+)'\?/.exec(t), o = /on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(t)?.[1], r = n && o ?
|
|
2813
|
+
function Xo(e, t) {
|
|
2814
|
+
const n = /\s*Did you mean '([\w$]+)'\?/.exec(t), o = /on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(t)?.[1], r = n && o ? Po(e, o) : null;
|
|
2752
2815
|
if (!n || !r) return t;
|
|
2753
|
-
const s =
|
|
2754
|
-
return !s || s.members.some(
|
|
2816
|
+
const s = Ho(e, r, (e) => e.name === n[1]);
|
|
2817
|
+
return !s || s.members.some(To) ? t : t.slice(0, n.index) + t.slice(n.index + n[0].length);
|
|
2755
2818
|
}
|
|
2756
|
-
var
|
|
2757
|
-
function
|
|
2819
|
+
var Zo = (e, t) => `${t ? `${t}.` : ""}${e.signature.replace(/;$/, "")}${e.summary ? ` — ${e.summary}` : ""}`;
|
|
2820
|
+
function Yo(e, t, n) {
|
|
2758
2821
|
const o = /Property '[\w$]+' does not exist on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)\[\]'/.exec(t);
|
|
2759
2822
|
if (o) return `\`${o[1]}[]\` is a plain array, not a collection: index it (\`[0]\`), or use \`.length\`, \`.find(…)\`.`;
|
|
2760
2823
|
const r = /Property '([\w$]+)' does not exist on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(t), s = r ? null : /(?:^|[.\s])([A-Za-z_$][\w$]*) is not a function/.exec(t), l = r?.[1] ?? s?.[1];
|
|
2761
2824
|
if (!l) return null;
|
|
2762
2825
|
const a = [];
|
|
2763
|
-
for (const t of
|
|
2826
|
+
for (const t of Lo) {
|
|
2764
2827
|
const [n, o] = t.relies;
|
|
2765
2828
|
t.match.test(l) && e.types[n]?.members?.some((e) => e.name === o) && a.push(t.hint);
|
|
2766
2829
|
}
|
|
2767
|
-
const i = r ?
|
|
2830
|
+
const i = r ? Po(e, r[2]) : null;
|
|
2768
2831
|
if (i) {
|
|
2769
|
-
const o =
|
|
2832
|
+
const o = Ko(e, i), r = /Did you mean '([\w$]+)'/.exec(t)?.[1], s = o.map((e) => ({
|
|
2770
2833
|
member: e,
|
|
2771
|
-
score: e.name === r ? -1 :
|
|
2834
|
+
score: e.name === r ? -1 : Go(l, e.name)
|
|
2772
2835
|
})).filter((e) => null !== e.score).sort((e, t) => e.score - t.score).slice(0, 3);
|
|
2773
2836
|
if (s.length > 0) {
|
|
2774
2837
|
a.push(`Closest on ${i}:`);
|
|
2775
|
-
for (const { member: e } of s) a.push(` ${
|
|
2838
|
+
for (const { member: e } of s) a.push(` ${Zo(e)}`);
|
|
2776
2839
|
}
|
|
2777
2840
|
a.push(`\`${n} ${i}\` lists all ${o.length} members.`);
|
|
2778
2841
|
} else if (s) {
|
|
2779
|
-
const t = Object.entries(e.types).filter(([, e]) =>
|
|
2842
|
+
const t = Object.entries(e.types).filter(([, e]) => Ao(e).some((e) => e.name === l)).map(([e]) => e);
|
|
2780
2843
|
if (t.length > 0) {
|
|
2781
2844
|
const e = t.slice(0, 3).join(", "), n = t.length > 3 ? ` and ${t.length - 3} more` : "";
|
|
2782
2845
|
return a.push(`'${l}' is a member of ${e}${n}, not of the object it was called on.`), a.join("\n");
|
|
2783
2846
|
}
|
|
2784
|
-
const n =
|
|
2847
|
+
const n = Wo.map((t) => Po(e, t)).filter((e) => null !== e).flatMap((t) => Ko(e, t).map((e) => ({
|
|
2785
2848
|
owner: t,
|
|
2786
2849
|
member: e,
|
|
2787
|
-
score:
|
|
2850
|
+
score: Go(l, e.name)
|
|
2788
2851
|
}))).filter((e) => null !== e.score && e.score > 0 && e.score <= 2).sort((e, t) => e.score - t.score).slice(0, 3);
|
|
2789
2852
|
if (0 === a.length && 0 === n.length) return null;
|
|
2790
2853
|
if (a.unshift(`No SheetXL member is named '${l}'.`), n.length > 0) {
|
|
2791
2854
|
a.push("Closest:");
|
|
2792
|
-
for (const { owner: e, member: t } of n) a.push(` ${
|
|
2855
|
+
for (const { owner: e, member: t } of n) a.push(` ${Zo(t, e)}`);
|
|
2793
2856
|
}
|
|
2794
2857
|
}
|
|
2795
2858
|
return a.length > 0 ? a.join("\n") : null;
|
|
2796
2859
|
}
|
|
2797
|
-
var
|
|
2798
|
-
function
|
|
2860
|
+
var Qo = (e, t, n = `${t}s`) => `${e.toLocaleString("en-US")} ${1 === e ? t : n}`;
|
|
2861
|
+
function er(e, t) {
|
|
2799
2862
|
const n = t ? `${t} · ` : "", o = e.summary ? ` — ${e.summary}` : "", r = e.deprecated ? " (deprecated)" : "";
|
|
2800
2863
|
return `- ${n}\`${s = e.signature, s.replace(/;$/, "")}\`${r}${o}`;
|
|
2801
2864
|
var s;
|
|
2802
2865
|
}
|
|
2803
|
-
function
|
|
2866
|
+
function tr(e, t) {
|
|
2804
2867
|
const n = t?.command ?? "api";
|
|
2805
2868
|
switch (e.kind) {
|
|
2806
2869
|
case "overview": return function(e, t) {
|
|
2807
2870
|
const n = [
|
|
2808
|
-
`# SheetXL scripting API — ${
|
|
2871
|
+
`# SheetXL scripting API — ${Qo(e.total, "name")}`,
|
|
2809
2872
|
"",
|
|
2810
2873
|
"Where a script starts:"
|
|
2811
2874
|
];
|
|
2812
2875
|
for (const { key: t, entry: o } of e.entryPoints) {
|
|
2813
|
-
const e = o.members ? ` (${
|
|
2876
|
+
const e = o.members ? ` (${Qo(Ao(o).length, "member")})` : "";
|
|
2814
2877
|
n.push(`- \`${t}\`${e}${o.summary ? ` — ${o.summary}` : ""}`);
|
|
2815
2878
|
}
|
|
2816
2879
|
return n.push("", `\`${t} <Type>\` lists what you can call on a type, one line per member.`, `\`${t} <Type>.<member>\` prints that member's full documentation.`, `\`${t} <word>\` searches type and member names.`, "", "Every type answers, not only the ones above. In a script each name is written `SheetXL.<Type>`."), n.join("\n");
|
|
2817
2880
|
}(e, n);
|
|
2818
2881
|
case "type": return function(e, t) {
|
|
2819
|
-
const { key: n, entry: o, members: r } = e, s =
|
|
2820
|
-
o.members && l.push(
|
|
2882
|
+
const { key: n, entry: o, members: r } = e, s = Ao(o).length, l = [o.kind + (o.typeParams ?? "")];
|
|
2883
|
+
o.members && l.push(Qo(s, "member")), o.deprecated && l.push("deprecated");
|
|
2821
2884
|
const a = [`# ${n} — ${l.join(" · ")}`];
|
|
2822
2885
|
if (o.summary && a.push(o.summary), o.signature && a.push("", "```ts", o.signature, "```"), e.bases.length > 0) {
|
|
2823
2886
|
a.push("");
|
|
2824
|
-
for (const n of e.bases) a.push(n.key ? `Also has everything on \`${n.text}\` (${
|
|
2887
|
+
for (const n of e.bases) a.push(n.key ? `Also has everything on \`${n.text}\` (${Qo(n.memberCount, "member")}): \`${t} ${n.key}\`` : `Extends \`${n.text}\`.`);
|
|
2825
2888
|
}
|
|
2826
2889
|
if (o.members) {
|
|
2827
|
-
a.push(""), e.filter && a.push(`${
|
|
2828
|
-
for (const e of r) a.push(
|
|
2890
|
+
a.push(""), e.filter && a.push(`${Qo(r.length, "member")} of ${s} matching '${e.filter}':`);
|
|
2891
|
+
for (const e of r) a.push(er(e));
|
|
2829
2892
|
}
|
|
2830
2893
|
return o.nested && o.nested.length > 0 && !e.filter && a.push("", `Nested types — \`${t} ${n}.<name>\`: ${o.nested.join(", ")}`), a.push("", o.members ? `Full documentation for one member: \`${t} ${n}.<member>\` · scripting.d.ts:${o.lines[0]}-${o.lines[1]}` : `scripting.d.ts:${o.lines[0]}-${o.lines[1]}`), a.join("\n");
|
|
2831
2894
|
}(e, n);
|
|
@@ -2845,16 +2908,16 @@ function Yo(e, t) {
|
|
|
2845
2908
|
}
|
|
2846
2909
|
if (e.members.length > 0) {
|
|
2847
2910
|
n.push("", "Members:");
|
|
2848
|
-
for (const { key: t, member: o } of e.members) n.push(
|
|
2911
|
+
for (const { key: t, member: o } of e.members) n.push(er(o, t));
|
|
2849
2912
|
}
|
|
2850
|
-
return e.omitted > 0 && n.push("", `…and ${
|
|
2913
|
+
return e.omitted > 0 && n.push("", `…and ${Qo(e.omitted, "more match", "more matches")}; a longer word narrows it.`), n.push("", `\`${t} <Type>\` lists a type's members; \`${t} <Type>.<member>\` prints one in full.`), n.join("\n");
|
|
2851
2914
|
}(e, n);
|
|
2852
2915
|
case "miss": return function(e, t) {
|
|
2853
2916
|
const { owner: n, text: o } = e, r = [`# ${n.text}.${o} — not in the API`];
|
|
2854
2917
|
if (n.key) {
|
|
2855
2918
|
if (r.push(`\`${n.key}\` has no member \`${o}\`.`), e.nearest.length > 0) {
|
|
2856
2919
|
r.push("", `Closest on \`${n.key}\`:`);
|
|
2857
|
-
for (const t of e.nearest) r.push(
|
|
2920
|
+
for (const t of e.nearest) r.push(er(t));
|
|
2858
2921
|
}
|
|
2859
2922
|
} else if (r.push(`No type is named \`${n.text}\`.`), e.nearestTypes.length > 0) {
|
|
2860
2923
|
r.push("", "Nearest:");
|
|
@@ -2862,15 +2925,15 @@ function Yo(e, t) {
|
|
|
2862
2925
|
}
|
|
2863
2926
|
for (const t of e.hints) r.push("", t);
|
|
2864
2927
|
if (e.elsewhere.length > 0 && !e.nearestTypes.some((e) => e.hasMember)) {
|
|
2865
|
-
const n = e.elsewhere.map((e) => `\`${e.key}\``).join(", "), s = e.elsewhereOmitted > 0 ? ` and ${
|
|
2928
|
+
const n = e.elsewhere.map((e) => `\`${e.key}\``).join(", "), s = e.elsewhereOmitted > 0 ? ` and ${Qo(e.elsewhereOmitted, "more")}` : "";
|
|
2866
2929
|
r.push("", `\`${o}\` is a member of ${n}${s}: \`${t} ${e.elsewhere[0].key}.${o}\` prints it.`);
|
|
2867
2930
|
}
|
|
2868
2931
|
return r.push("", n.key ? `\`${t} ${n.key}\` lists everything on the type.` : `\`${t} <Type>\` lists a type's members; \`${t}\` with no name lists where to start.`), r.join("\n");
|
|
2869
2932
|
}(e, n);
|
|
2870
2933
|
}
|
|
2871
2934
|
}
|
|
2872
|
-
async function
|
|
2873
|
-
const t =
|
|
2935
|
+
async function nr(e) {
|
|
2936
|
+
const t = zo(await k(), e);
|
|
2874
2937
|
if ("member" === t.kind) try {
|
|
2875
2938
|
const e = (await C()).split(/\r?\n/);
|
|
2876
2939
|
t.sources = t.members.map((t) => function(e, t, n) {
|
|
@@ -2880,7 +2943,7 @@ async function Qo(e) {
|
|
|
2880
2943
|
} catch {}
|
|
2881
2944
|
return t;
|
|
2882
2945
|
}
|
|
2883
|
-
var
|
|
2946
|
+
var or = {
|
|
2884
2947
|
name: "api",
|
|
2885
2948
|
description: "Look up the scripting API — what you can call on a type, without reading the type definitions. `ICellRange` lists its members, one line each (signature + summary); `ICellRange.setValues` prints that member's full documentation; any other word searches type and member names; no name lists where to start. Answers come from the same declarations `run` type-checks against, so a member listed here exists.",
|
|
2886
2949
|
params: [{
|
|
@@ -2889,17 +2952,17 @@ var er = {
|
|
|
2889
2952
|
description: "A type (`ICellRange`), a member (`ICellRange.setValues`), or a word to search for. Omit for the overview. A leading `SheetXL.` is accepted.",
|
|
2890
2953
|
positional: 0
|
|
2891
2954
|
}],
|
|
2892
|
-
run: (e) =>
|
|
2893
|
-
render:
|
|
2894
|
-
},
|
|
2895
|
-
async function
|
|
2896
|
-
await
|
|
2897
|
-
}
|
|
2898
|
-
async function
|
|
2899
|
-
const s = "precedents" === n ? "Precedents" : "Dependents", l = await ("precedents" === n ? t.getPrecedents() : t.getDependents()), a = "dependents" === n && r?.subject ?
|
|
2955
|
+
run: (e) => nr(e?.name),
|
|
2956
|
+
render: tr
|
|
2957
|
+
}, rr = l.Feature;
|
|
2958
|
+
async function sr(e, t, n, o) {
|
|
2959
|
+
await lr(e, t, "precedents", n, o), await lr(e, t, "dependents", n, o);
|
|
2960
|
+
}
|
|
2961
|
+
async function lr(e, t, n, o, r) {
|
|
2962
|
+
const s = "precedents" === n ? "Precedents" : "Dependents", l = await ("precedents" === n ? t.getPrecedents() : t.getDependents()), a = "dependents" === n && r?.subject ? Fn(r.subject, l) : [];
|
|
2900
2963
|
if (!l || 0 === l.length) {
|
|
2901
2964
|
const t = "precedents" === n ? r?.zeroPrecedents : r?.zeroDependents;
|
|
2902
|
-
a.length > 0 ? (e.h2(`${s} (${
|
|
2965
|
+
a.length > 0 ? (e.h2(`${s} (${ar(a.length)})`), e.text(` ${"charts".padEnd(cr)}${ir(a)}`), e.blank()) : t && (e.h2(`${s} (0)`), e.blank());
|
|
2903
2966
|
return;
|
|
2904
2967
|
}
|
|
2905
2968
|
const i = await async function(e, t, n) {
|
|
@@ -2912,8 +2975,8 @@ async function or(e, t, n, o, r) {
|
|
|
2912
2975
|
continue;
|
|
2913
2976
|
}
|
|
2914
2977
|
s++;
|
|
2915
|
-
const i = n.getCounts([
|
|
2916
|
-
o += c, r += i[
|
|
2978
|
+
const i = n.getCounts([rr.Contentful, rr.Formula]), c = i[rr.Contentful] ?? 0;
|
|
2979
|
+
o += c, r += i[rr.Formula] ?? 0;
|
|
2917
2980
|
const u = n.getWorksheet()?.getName() ?? "";
|
|
2918
2981
|
a.set(u, (a.get(u) ?? 0) + c);
|
|
2919
2982
|
}
|
|
@@ -2925,10 +2988,10 @@ async function or(e, t, n, o, r) {
|
|
|
2925
2988
|
if (!t) return 0;
|
|
2926
2989
|
let i = 0;
|
|
2927
2990
|
for (let e = 0; e < t.length; e++) {
|
|
2928
|
-
const l = t.at(e), c =
|
|
2991
|
+
const l = t.at(e), c = pr(l);
|
|
2929
2992
|
if (o.has(c)) continue;
|
|
2930
2993
|
let u = n.get(c);
|
|
2931
|
-
void 0 === u && (++r >
|
|
2994
|
+
void 0 === u && (++r > gr ? (s = !0, u = 0) : (o.add(c), u = await a(l), o.delete(c), n.set(c, u))), i = Math.max(i, u + 1);
|
|
2932
2995
|
}
|
|
2933
2996
|
return i;
|
|
2934
2997
|
};
|
|
@@ -2945,13 +3008,13 @@ async function or(e, t, n, o, r) {
|
|
|
2945
3008
|
depth: i,
|
|
2946
3009
|
depthCapped: c,
|
|
2947
3010
|
sheets: a,
|
|
2948
|
-
outputs: "dependents" === n ? await
|
|
3011
|
+
outputs: "dependents" === n ? await hr(t) : {
|
|
2949
3012
|
ranges: [],
|
|
2950
3013
|
cells: 0
|
|
2951
3014
|
}
|
|
2952
3015
|
};
|
|
2953
3016
|
}(t, l, n), c = [`${i.cells} ${1 === i.cells ? "cell" : "cells"}`];
|
|
2954
|
-
"precedents" === n ? c.push(`${i.inputs} ${1 === i.inputs ? "input" : "inputs"}`) : c.push(`${i.outputs.cells} ${1 === i.outputs.cells ? "output" : "outputs"}`), c.push(`depth ${i.depthCapped ? "≥ " : ""}${i.depth}`), c.push(`${i.areas} ${1 === i.areas ? "area" : "areas"}`), i.names > 0 && c.push(`${i.names} ${1 === i.names ? "name" : "names"}`), a.length > 0 && c.push(
|
|
3017
|
+
"precedents" === n ? c.push(`${i.inputs} ${1 === i.inputs ? "input" : "inputs"}`) : c.push(`${i.outputs.cells} ${1 === i.outputs.cells ? "output" : "outputs"}`), c.push(`depth ${i.depthCapped ? "≥ " : ""}${i.depth}`), c.push(`${i.areas} ${1 === i.areas ? "area" : "areas"}`), i.names > 0 && c.push(`${i.names} ${1 === i.names ? "name" : "names"}`), a.length > 0 && c.push(ar(a.length)), e.h2(`${s} (${c.join(" · ")})`);
|
|
2955
3018
|
const u = r?.home?.getName() ?? null, g = await async function(e, t, n, o) {
|
|
2956
3019
|
const r = Math.max(1, o?.maxTreeRows ?? 12), s = (e) => "precedents" === t ? e.getDirectPrecedents() : e.getDirectDependents(), l = [], a = /* @__PURE__ */ new Map();
|
|
2957
3020
|
let i = 0, c = 0, u = !1;
|
|
@@ -2967,7 +3030,7 @@ async function or(e, t, n, o, r) {
|
|
|
2967
3030
|
let h = 0;
|
|
2968
3031
|
i = d(await s(e), null, 0);
|
|
2969
3032
|
for (; h < g.length && c < r;) {
|
|
2970
|
-
const { range: e, parent: t, depth: n } = g[h++], o =
|
|
3033
|
+
const { range: e, parent: t, depth: n } = g[h++], o = pr(e), r = {
|
|
2971
3034
|
range: e,
|
|
2972
3035
|
key: o,
|
|
2973
3036
|
depth: n,
|
|
@@ -3003,12 +3066,12 @@ async function or(e, t, n, o, r) {
|
|
|
3003
3066
|
const $ = new Map(m.map((e, t) => [e, t]));
|
|
3004
3067
|
let w = i - l.length;
|
|
3005
3068
|
const y = m.map((e) => {
|
|
3006
|
-
const { address: t, sheet: n, isName: o } =
|
|
3069
|
+
const { address: t, sheet: n, isName: o } = $r(e.range);
|
|
3007
3070
|
let r;
|
|
3008
3071
|
if ("circular" === e.mark) r = "↺ circular";
|
|
3009
3072
|
else if ("repeat" === e.mark) r = $.get(e.first) < $.get(e) ? "↑ shown above" : "↓ shown below";
|
|
3010
3073
|
else {
|
|
3011
|
-
r = [
|
|
3074
|
+
r = [wr(e.range), mr(e.range, f)].filter(Boolean).join(" ");
|
|
3012
3075
|
const t = e.childCount - e.children.length;
|
|
3013
3076
|
t > 0 && (w += t, r = `${r} ▸ ${t} more`);
|
|
3014
3077
|
}
|
|
@@ -3021,7 +3084,7 @@ async function or(e, t, n, o, r) {
|
|
|
3021
3084
|
detail: r
|
|
3022
3085
|
};
|
|
3023
3086
|
}), b = y.filter((e) => !e.isName);
|
|
3024
|
-
if (b.length > 0 && b.some((e) => e.sheet !== b[0].sheet)) for (const e of y) e.isName || (e.label = `${e.indent}${
|
|
3087
|
+
if (b.length > 0 && b.some((e) => e.sheet !== b[0].sheet)) for (const e of y) e.isName || (e.label = `${e.indent}${Ot(e.sheet)}!${e.label.slice(e.indent.length)}`);
|
|
3025
3088
|
const S = [], x = Math.max(...y.map((e) => e.label.length));
|
|
3026
3089
|
for (const e of y) S.push(` ${e.label.padEnd(x)} ${e.detail}`.trimEnd());
|
|
3027
3090
|
u && S.push(" ↺ circular reference — the chain returns to a cell already on this branch");
|
|
@@ -3034,13 +3097,13 @@ async function or(e, t, n, o, r) {
|
|
|
3034
3097
|
shown: new Set(m.map((e) => e.key))
|
|
3035
3098
|
};
|
|
3036
3099
|
}(t, n, i.areas, o), d = i.outputs.ranges;
|
|
3037
|
-
if ("dependents" === n && d.some((e) => !g.shown.has(
|
|
3038
|
-
const n = e.ranges.slice(0,
|
|
3039
|
-
const { address: n, sheet: o } =
|
|
3100
|
+
if ("dependents" === n && d.some((e) => !g.shown.has(pr(e))) && e.text(` ${"outputs".padEnd(cr)}${function(e, t) {
|
|
3101
|
+
const n = e.ranges.slice(0, dr).map((e) => {
|
|
3102
|
+
const { address: n, sheet: o } = $r(e);
|
|
3040
3103
|
return [
|
|
3041
|
-
null !== t && o !== t ? `${
|
|
3104
|
+
null !== t && o !== t ? `${Ot(o)}!${n}` : n,
|
|
3042
3105
|
e.isSingleCell() ? N(e.getCell(), v.Mode.Display)?.display ?? "" : `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
3043
|
-
|
|
3106
|
+
mr(e)
|
|
3044
3107
|
].filter(Boolean).join(" ");
|
|
3045
3108
|
}), o = e.ranges.length - n.length;
|
|
3046
3109
|
o > 0 && n.push(`+${o} more (getDependents())`);
|
|
@@ -3048,21 +3111,21 @@ async function or(e, t, n, o, r) {
|
|
|
3048
3111
|
}(i.outputs, u)}`), null !== u) {
|
|
3049
3112
|
const t = [...i.sheets].filter(([e]) => e !== u);
|
|
3050
3113
|
if (t.length > 0) {
|
|
3051
|
-
const n = t.map(([e, t]) => `${
|
|
3052
|
-
e.text(` ${"sheets".padEnd(
|
|
3114
|
+
const n = t.map(([e, t]) => `${Ot(e)} ${t} ${1 === t ? "cell" : "cells"}`);
|
|
3115
|
+
e.text(` ${"sheets".padEnd(cr)}${n.join(" · ")}`);
|
|
3053
3116
|
}
|
|
3054
3117
|
}
|
|
3055
|
-
a.length > 0 && e.text(` ${"charts".padEnd(
|
|
3118
|
+
a.length > 0 && e.text(` ${"charts".padEnd(cr)}${ir(a)}`);
|
|
3056
3119
|
for (const t of g.lines) e.text(t);
|
|
3057
3120
|
e.blank();
|
|
3058
3121
|
}
|
|
3059
|
-
var
|
|
3060
|
-
function
|
|
3061
|
-
const t = e.slice(0,
|
|
3122
|
+
var ar = (e) => `${e} ${1 === e ? "chart" : "charts"}`;
|
|
3123
|
+
function ir(e) {
|
|
3124
|
+
const t = e.slice(0, ur).map(Tn), n = e.length - t.length;
|
|
3062
3125
|
return n > 0 && t.push(`+${n} more`), t.join(" · ");
|
|
3063
3126
|
}
|
|
3064
|
-
var
|
|
3065
|
-
async function
|
|
3127
|
+
var cr = 10, ur = 6, gr = 2e3, dr = 4;
|
|
3128
|
+
async function hr(e) {
|
|
3066
3129
|
const t = /* @__PURE__ */ new Map(), n = await e.getPrecedents(!1);
|
|
3067
3130
|
for (let e = 0; e < (n?.length ?? 0); e++) {
|
|
3068
3131
|
const o = n.at(e);
|
|
@@ -3076,7 +3139,7 @@ async function ur(e) {
|
|
|
3076
3139
|
const s = e.at(n);
|
|
3077
3140
|
if (s.isINamedRange) continue;
|
|
3078
3141
|
let l = [s.getCoords()];
|
|
3079
|
-
for (const e of t.get(s.getWorksheet()?.getName() ?? "") ?? []) if (l = l.flatMap((t) =>
|
|
3142
|
+
for (const e of t.get(s.getWorksheet()?.getName() ?? "") ?? []) if (l = l.flatMap((t) => fr(t, e)), 0 === l.length) break;
|
|
3080
3143
|
for (const e of l) r += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), o.push(s.getWorksheet().getRange(e));
|
|
3081
3144
|
}
|
|
3082
3145
|
return {
|
|
@@ -3084,7 +3147,7 @@ async function ur(e) {
|
|
|
3084
3147
|
cells: r
|
|
3085
3148
|
};
|
|
3086
3149
|
}
|
|
3087
|
-
function
|
|
3150
|
+
function fr(e, t) {
|
|
3088
3151
|
const n = Math.max(e.rowStart, t.rowStart), o = Math.min(e.rowEnd, t.rowEnd), r = Math.max(e.colStart, t.colStart), s = Math.min(e.colEnd, t.colEnd);
|
|
3089
3152
|
if (n > o || r > s) return [e];
|
|
3090
3153
|
const l = [];
|
|
@@ -3106,7 +3169,7 @@ function gr(e, t) {
|
|
|
3106
3169
|
colEnd: e.colEnd
|
|
3107
3170
|
}), l;
|
|
3108
3171
|
}
|
|
3109
|
-
function
|
|
3172
|
+
function mr(e, t) {
|
|
3110
3173
|
if (e.isINamedRange || !e.isSingleCell()) return "";
|
|
3111
3174
|
const n = e.getCell();
|
|
3112
3175
|
if (n.getType() === b.String) return "";
|
|
@@ -3121,13 +3184,13 @@ function dr(e, t) {
|
|
|
3121
3184
|
}
|
|
3122
3185
|
return s.join(" ");
|
|
3123
3186
|
}
|
|
3124
|
-
function
|
|
3187
|
+
function pr(e) {
|
|
3125
3188
|
const t = e.isINamedRange ? e.getId() : null;
|
|
3126
3189
|
if (t) return `name:${t}`;
|
|
3127
3190
|
const n = e.getCoords();
|
|
3128
3191
|
return `${e.getWorksheet()?.getName() ?? ""}!${n.rowStart},${n.colStart},${n.rowEnd},${n.colEnd}`;
|
|
3129
3192
|
}
|
|
3130
|
-
function
|
|
3193
|
+
function $r(e) {
|
|
3131
3194
|
const t = e.getWorksheet()?.getName() ?? "";
|
|
3132
3195
|
if (e.isINamedRange) return {
|
|
3133
3196
|
address: e.getName(),
|
|
@@ -3141,7 +3204,7 @@ function fr(e) {
|
|
|
3141
3204
|
isName: !1
|
|
3142
3205
|
};
|
|
3143
3206
|
}
|
|
3144
|
-
function
|
|
3207
|
+
function wr(e) {
|
|
3145
3208
|
if (e.isINamedRange) {
|
|
3146
3209
|
const t = e.getRanges();
|
|
3147
3210
|
return t ? `name → ${t.getAddress()}` : "name";
|
|
@@ -3150,15 +3213,15 @@ function mr(e) {
|
|
|
3150
3213
|
const t = e.getCell(), n = N(t, v.Mode.Display), o = t.getFormulaText(), r = n ? n.display : "(empty)";
|
|
3151
3214
|
return o ? `${r} ${o}` : r;
|
|
3152
3215
|
}
|
|
3153
|
-
const t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(
|
|
3216
|
+
const t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(rr.Formula)];
|
|
3154
3217
|
if (1 === n.length && n[0].getRange().isEqual(e)) {
|
|
3155
3218
|
const e = n[0].getCell().getFormulaText();
|
|
3156
3219
|
if (e) return `${t} ${e}`;
|
|
3157
3220
|
}
|
|
3158
3221
|
return t;
|
|
3159
3222
|
}
|
|
3160
|
-
var
|
|
3161
|
-
features: (e) =>
|
|
3223
|
+
var yr = {
|
|
3224
|
+
features: (e) => Lt(e),
|
|
3162
3225
|
mode: (e, t) => function(e, t, n) {
|
|
3163
3226
|
const o = new Map(Object.values(n).map((e) => [e.toLowerCase(), e])).get(e.trim().toLowerCase());
|
|
3164
3227
|
if (!o) {
|
|
@@ -3167,32 +3230,32 @@ var pr = {
|
|
|
3167
3230
|
}
|
|
3168
3231
|
return o;
|
|
3169
3232
|
}(e, t, v.Mode)
|
|
3170
|
-
},
|
|
3171
|
-
function
|
|
3233
|
+
}, br = Object.keys(yr);
|
|
3234
|
+
function Sr(e) {
|
|
3172
3235
|
const t = {};
|
|
3173
3236
|
for (const [n, o] of Object.entries(e)) {
|
|
3174
|
-
const e =
|
|
3175
|
-
if (!e) throw new Error(`Unknown report option '${n}'. Options: ${
|
|
3237
|
+
const e = yr[n];
|
|
3238
|
+
if (!e) throw new Error(`Unknown report option '${n}'. Options: ${br.join(", ")}.`);
|
|
3176
3239
|
t[n] = e(o, n);
|
|
3177
3240
|
}
|
|
3178
3241
|
return t;
|
|
3179
3242
|
}
|
|
3180
|
-
var
|
|
3243
|
+
var xr = /^'?\[(\d+)\]([^']*)'?$/, kr = /* @__PURE__ */ new Set([
|
|
3181
3244
|
"cell",
|
|
3182
3245
|
"named",
|
|
3183
3246
|
"error"
|
|
3184
|
-
]),
|
|
3247
|
+
]), Cr = (e) => {
|
|
3185
3248
|
const t = e.sources?.[0]?.target ?? "";
|
|
3186
3249
|
return t.split(/[\\/]/).pop() || t;
|
|
3187
3250
|
};
|
|
3188
|
-
function
|
|
3251
|
+
function vr(e, t) {
|
|
3189
3252
|
const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set();
|
|
3190
3253
|
let r;
|
|
3191
3254
|
for (const s of e) {
|
|
3192
|
-
if (!
|
|
3255
|
+
if (!kr.has(s.type)) continue;
|
|
3193
3256
|
const e = s.value?.scope;
|
|
3194
3257
|
if ("string" != typeof e) continue;
|
|
3195
|
-
const l =
|
|
3258
|
+
const l = xr.exec(e);
|
|
3196
3259
|
if (!l) continue;
|
|
3197
3260
|
const a = e.toLowerCase();
|
|
3198
3261
|
if (o.has(a)) {
|
|
@@ -3218,16 +3281,16 @@ function xr(e, t) {
|
|
|
3218
3281
|
const d = new Set(u.sheetNames.map((e) => e.toLowerCase())), h = g.split(":").find((e) => !d.has(e.toLowerCase()));
|
|
3219
3282
|
void 0 !== h && n.set(a, {
|
|
3220
3283
|
scope: c,
|
|
3221
|
-
reason: `external link [${i}] (${
|
|
3284
|
+
reason: `external link [${i}] (${Cr(u)}) has no sheet '${h}'`,
|
|
3222
3285
|
uses: 1
|
|
3223
3286
|
});
|
|
3224
3287
|
}
|
|
3225
3288
|
return [...n.values()];
|
|
3226
3289
|
}
|
|
3227
|
-
function
|
|
3290
|
+
function Er(e) {
|
|
3228
3291
|
return e.map((e) => `cites ${e.scope}: ${e.reason}`).join("; ");
|
|
3229
3292
|
}
|
|
3230
|
-
var
|
|
3293
|
+
var Rr = l.Feature, Nr = [
|
|
3231
3294
|
["formatCells", "format cells"],
|
|
3232
3295
|
["formatColumns", "format columns"],
|
|
3233
3296
|
["formatRows", "format rows"],
|
|
@@ -3241,32 +3304,32 @@ var Cr = l.Feature, vr = [
|
|
|
3241
3304
|
["pivotTables", "pivot tables"],
|
|
3242
3305
|
["objects", "edit objects"],
|
|
3243
3306
|
["scenarios", "edit scenarios"]
|
|
3244
|
-
],
|
|
3307
|
+
], jr = [["structure", "structure"], ["windows", "windows"]], Mr = (e) => {
|
|
3245
3308
|
const t = e.hasPassword() ? " · password" : "";
|
|
3246
3309
|
return e.isLocked() ? `locked${t}` : e.isPaused() ? `paused${t} — nothing is refused until resume()` : null;
|
|
3247
|
-
},
|
|
3310
|
+
}, Ir = (e) => {
|
|
3248
3311
|
const t = e.getProperties();
|
|
3249
3312
|
if (!t) return null;
|
|
3250
|
-
const n =
|
|
3313
|
+
const n = Nr.filter(([e]) => !0 === t[e]).map(([, e]) => e);
|
|
3251
3314
|
return n.length > 0 ? n.join(", ") : null;
|
|
3252
|
-
},
|
|
3315
|
+
}, Fr = (e) => {
|
|
3253
3316
|
const t = e.getProperties();
|
|
3254
3317
|
if (!t) return null;
|
|
3255
|
-
const n =
|
|
3318
|
+
const n = jr.filter(([e]) => !0 !== t[e]).map(([, e]) => e);
|
|
3256
3319
|
return n.length > 0 ? n.join(", ") : null;
|
|
3257
|
-
},
|
|
3258
|
-
const t =
|
|
3320
|
+
}, Tr = (e) => {
|
|
3321
|
+
const t = Mr(e);
|
|
3259
3322
|
if (!t) return null;
|
|
3260
|
-
const n =
|
|
3323
|
+
const n = Fr(e);
|
|
3261
3324
|
return n ? `${n} ${t}` : t;
|
|
3262
|
-
},
|
|
3325
|
+
}, Ar = (e) => [...e.getEntireRange().getRegions(Rr.Unlock)], Lr = (e) => {
|
|
3263
3326
|
let t = 0;
|
|
3264
3327
|
for (const n of e) {
|
|
3265
3328
|
const e = n.getCoords();
|
|
3266
3329
|
t += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
|
|
3267
3330
|
}
|
|
3268
3331
|
return t;
|
|
3269
|
-
},
|
|
3332
|
+
}, Wr = (t) => {
|
|
3270
3333
|
let n = null;
|
|
3271
3334
|
for (const e of t) {
|
|
3272
3335
|
const t = e.getCoords();
|
|
@@ -3278,71 +3341,71 @@ var Cr = l.Feature, vr = [
|
|
|
3278
3341
|
} : { ...t };
|
|
3279
3342
|
}
|
|
3280
3343
|
return n ? e.rangeToString(n) ?? "" : "";
|
|
3281
|
-
},
|
|
3282
|
-
function
|
|
3283
|
-
const t = e.getProtection(), n =
|
|
3344
|
+
}, Or = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`;
|
|
3345
|
+
function Pr(e) {
|
|
3346
|
+
const t = e.getProtection(), n = Mr(t);
|
|
3284
3347
|
if (!n) return null;
|
|
3285
|
-
const o =
|
|
3348
|
+
const o = Ar(e), r = [o.length > 0 ? `${Or(Lr(o), "editable cell")} · ${Or(o.length, "region")}` : "no editable cells", n];
|
|
3286
3349
|
return !1 === t.getProperties()?.showFormulas && r.push("formulas hidden"), {
|
|
3287
|
-
extent:
|
|
3350
|
+
extent: Wr(o),
|
|
3288
3351
|
detail: r.join(" · ")
|
|
3289
3352
|
};
|
|
3290
3353
|
}
|
|
3291
|
-
function
|
|
3292
|
-
const n = t.getProtection(), o =
|
|
3354
|
+
function Dr(e, t) {
|
|
3355
|
+
const n = t.getProtection(), o = Mr(n);
|
|
3293
3356
|
if (!o) return;
|
|
3294
3357
|
e.h2(`Protection (${o})`);
|
|
3295
3358
|
const r = (e) => ` ${e.padEnd(10)}`;
|
|
3296
|
-
e.text(`${r("allowed")}${
|
|
3297
|
-
const s =
|
|
3359
|
+
e.text(`${r("allowed")}${Ir(n) ?? "none — only the editable cells take a write"}`), !1 === n.getProperties()?.showFormulas && e.text(`${r("formulas")}hidden — a cell reads as a value unless its style shows its formula`);
|
|
3360
|
+
const s = Ar(t);
|
|
3298
3361
|
if (0 === s.length) return e.text(`${r("editable")}none — every cell refuses a write`), void e.blank();
|
|
3299
|
-
e.text(`${r("editable")}${
|
|
3362
|
+
e.text(`${r("editable")}${Or(Lr(s), "cell")} · ${Or(s.length, "region")}`), vt(e, s, {
|
|
3300
3363
|
maxRegions: 12,
|
|
3301
|
-
payload:
|
|
3302
|
-
recovery: `${
|
|
3364
|
+
payload: kt(Rr.Unlock, null),
|
|
3365
|
+
recovery: `${Pt(t.getEntireRange())}.getRegions("unlock") lists all ${s.length}`
|
|
3303
3366
|
}), e.blank();
|
|
3304
3367
|
}
|
|
3305
|
-
function
|
|
3368
|
+
function Hr(e) {
|
|
3306
3369
|
if (!e.getWorksheet().getProtection().isLocked()) return null;
|
|
3307
|
-
const t = [...e.getRegions(
|
|
3370
|
+
const t = [...e.getRegions(Rr.Unlock)], n = e.getRowCount() * e.getColumnCount(), o = Lr(t);
|
|
3308
3371
|
if (0 === o) return "sheet locked — no cell here takes a write";
|
|
3309
3372
|
if (o === n) return "sheet locked — every cell here is editable";
|
|
3310
3373
|
const r = e.getWorksheet().getProtectedRanges().getItems({ address: e }).some((e) => !e.isUnlocked());
|
|
3311
|
-
return `sheet locked — ${o} of ${
|
|
3374
|
+
return `sheet locked — ${o} of ${Or(n, "cell")} editable (${Wr(t)})` + (r ? " · some behind a range password" : "");
|
|
3312
3375
|
}
|
|
3313
|
-
function
|
|
3376
|
+
function Vr(e) {
|
|
3314
3377
|
return e.getWorksheet().getProtection().isLocked() ? e.isEditAllowed() ? "true — unlocked on a protected sheet" : "false — the sheet is protected and this cell is locked" : null;
|
|
3315
3378
|
}
|
|
3316
|
-
function
|
|
3379
|
+
function Br(e) {
|
|
3317
3380
|
return "ProtectedError" !== e?.name ? null : "`sheet.getProtection()` (`wb.getProtection()` for the workbook) lists what is still allowed; `sheet.getRegions(\"unlock\")` lists the cells that take a write.";
|
|
3318
3381
|
}
|
|
3319
|
-
function
|
|
3382
|
+
function zr(e) {
|
|
3320
3383
|
const t = new ie(), n = !0 === e.isIWorksheetProtection;
|
|
3321
3384
|
t.h1(n ? "Sheet Protection" : "Workbook Protection"), t.blank();
|
|
3322
|
-
const o =
|
|
3385
|
+
const o = Mr(e);
|
|
3323
3386
|
t.fact(`State: ${o ?? "not protected"}${e.isReadOnly() ? " · read-only" : ""}`);
|
|
3324
3387
|
const r = o ? "" : " (when next locked)";
|
|
3325
3388
|
if (n) {
|
|
3326
|
-
const n =
|
|
3389
|
+
const n = Ir(e);
|
|
3327
3390
|
(o || n) && t.fact(`Allowed${r}: ${n ?? "none — only the editable cells take a write"}`), !1 === e.getProperties()?.showFormulas && t.fact(`Formulas${r}: hidden`), o && t.fact("Editable: sheet.getRegions(\"unlock\") lists the cells that take a write");
|
|
3328
3391
|
} else {
|
|
3329
|
-
const n =
|
|
3392
|
+
const n = Fr(e);
|
|
3330
3393
|
(o || e.getProperties()) && t.fact(`Refused${r}: ${n ?? "nothing"}`);
|
|
3331
3394
|
}
|
|
3332
3395
|
return t.toLines().join("\n").trimEnd();
|
|
3333
3396
|
}
|
|
3334
|
-
function
|
|
3397
|
+
function Ur(e) {
|
|
3335
3398
|
const t = new ie(), n = e.getRanges();
|
|
3336
|
-
t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${
|
|
3399
|
+
t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${Ht(n)}`), t.fact(`Cells: ${n.size}`), t.fact("Password: " + (e.hasPassword() ? e.isUnlocked() ? "set · unlocked for this session" : "set · unlock(password) grants access" : "none"));
|
|
3337
3400
|
const o = n.getWorksheet().getProtection().isLocked();
|
|
3338
3401
|
return t.fact("In force: " + (o ? "true — the sheet is protected" : "false — the sheet is not protected, so every cell is editable")), e.getSecurityDescriptor() && t.fact("Security Descriptor: present · not evaluated"), t.toLines().join("\n").trimEnd();
|
|
3339
3402
|
}
|
|
3340
|
-
var
|
|
3341
|
-
async function
|
|
3403
|
+
var _r = l.Feature;
|
|
3404
|
+
async function Jr(e, t) {
|
|
3342
3405
|
const n = e.getWorksheet().getRange(e.getCoords());
|
|
3343
3406
|
e = n.getCell();
|
|
3344
3407
|
const o = new ie();
|
|
3345
|
-
o.h1(`Cell — ${
|
|
3408
|
+
o.h1(`Cell — ${Ot(e.getWorksheet().getName())}!${e.getAddress()}`), o.blank();
|
|
3346
3409
|
const r = !!e.getFormulaText(), l = e.getType();
|
|
3347
3410
|
(function(e, t) {
|
|
3348
3411
|
const n = N(t, v.Mode.Display), o = N(t, v.Mode.Value), r = t.getFormulaText(), s = e.toLines().length;
|
|
@@ -3362,16 +3425,23 @@ async function zr(e, t) {
|
|
|
3362
3425
|
}
|
|
3363
3426
|
const l = t.getHyperlink();
|
|
3364
3427
|
l && e.fact(`Hyperlink: ${l.getAddress()}`);
|
|
3365
|
-
const a = t.
|
|
3366
|
-
|
|
3428
|
+
const a = t.getSparkline();
|
|
3429
|
+
a && e.fact(`Sparkline: ${((e) => {
|
|
3430
|
+
const t = e.getGroup(), n = e.getRange().getWorksheet(), o = [`${t.getType()} of ${wt(e.getDataRange(), n)}`], r = t.getRanges();
|
|
3431
|
+
r && r.getCount() > 0 && o.push(`group ${Dt(r)}`);
|
|
3432
|
+
const s = yt(t.getProperties());
|
|
3433
|
+
return s.length > 0 && o.push(s.join(", ")), o.join(" · ");
|
|
3434
|
+
})(a)}`);
|
|
3435
|
+
const i = t.getSpans(), c = !t.isTopLeft();
|
|
3436
|
+
if (c || i.height > 1 || i.width > 1) {
|
|
3367
3437
|
const n = t.getRange().toString();
|
|
3368
|
-
e.fact(`Merge: ${n} · ${
|
|
3438
|
+
e.fact(`Merge: ${n} · ${i.height}×${i.width}`), c && e.fact("Merge Anchor: false — this cell is covered; the value lives at the top-left");
|
|
3369
3439
|
}
|
|
3370
|
-
const
|
|
3371
|
-
|
|
3440
|
+
const u = t.getSpill();
|
|
3441
|
+
u && e.fact(`Spill: ${u.toString()}${"error" === t.getSpillKind() ? " (blocked)" : ""}`);
|
|
3372
3442
|
t.isSpillOverflow() && e.fact("Spill Overflow: true — the anchor formula is elsewhere");
|
|
3373
|
-
const
|
|
3374
|
-
|
|
3443
|
+
const g = ge(t);
|
|
3444
|
+
g && e.fact(`Table: ${function(e, t) {
|
|
3375
3445
|
const n = e.getRange().getCoords(), o = [`${e.getName()} (${e.getRange().getAddress()})`], r = e.getColumnAt(t.colIndex - n.colStart);
|
|
3376
3446
|
r && o.push(`column ${JSON.stringify(r.getName())}`);
|
|
3377
3447
|
if (e.isShowHeaders() && t.rowIndex === n.rowStart) o.push("header row");
|
|
@@ -3381,19 +3451,19 @@ async function zr(e, t) {
|
|
|
3381
3451
|
o.push(`data row ${t.rowIndex - n.rowStart + 1} of ${n.rowEnd - n.rowStart + 1}`);
|
|
3382
3452
|
}
|
|
3383
3453
|
return o.join(" · ");
|
|
3384
|
-
}(
|
|
3385
|
-
const
|
|
3386
|
-
|
|
3387
|
-
const
|
|
3388
|
-
|
|
3389
|
-
const
|
|
3390
|
-
if (
|
|
3391
|
-
const n =
|
|
3392
|
-
e.fact(`Errors: ${
|
|
3454
|
+
}(g, t.getCoords())}`);
|
|
3455
|
+
const d = dn(t.getWorksheet().getRange(t.getCoords()));
|
|
3456
|
+
d.length > 0 && e.fact(`Names: ${d.map((e) => `${e.getName()} (${Dt(e.getRanges())})`).join(" · ")}`);
|
|
3457
|
+
const h = Vr(t);
|
|
3458
|
+
h && e.fact(`Editable: ${h}`);
|
|
3459
|
+
const f = t.getErrors();
|
|
3460
|
+
if (f.length > 0) {
|
|
3461
|
+
const n = Er(vr(t.getFormula()?.getTokens() ?? [], t.getWorksheet().getWorkbook()));
|
|
3462
|
+
e.fact(`Errors: ${f.join("; ")}${n ? ` — ${n}` : ""}`);
|
|
3393
3463
|
}
|
|
3394
|
-
const
|
|
3395
|
-
|
|
3396
|
-
const
|
|
3464
|
+
const m = t.getWarnings();
|
|
3465
|
+
m.length > 0 && e.fact(`Warnings: ${m.join("; ")}`);
|
|
3466
|
+
const p = function(e, t) {
|
|
3397
3467
|
const n = t.getStyle(), o = t.getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, r = n.getNamed().getName(), s = r === (o?.getNamed().getName() ?? "Normal"), l = n.getNumberFormat(), a = Ze(l), i = a ? `${a} ${e.codespan(l)}` : null, c = o ? re(n, o) : null, u = Y(n), g = te(n), d = o ? oe(n, o) : null, h = [
|
|
3398
3468
|
s ? null : r,
|
|
3399
3469
|
i ? `format ${i}` : null,
|
|
@@ -3404,7 +3474,7 @@ async function zr(e, t) {
|
|
|
3404
3474
|
].filter(Boolean);
|
|
3405
3475
|
return h.length > 0 ? h.join(" · ") : null;
|
|
3406
3476
|
}(e, t);
|
|
3407
|
-
|
|
3477
|
+
p && e.fact(`Style (effective): ${p}`);
|
|
3408
3478
|
e.toLines().length > s && e.blank();
|
|
3409
3479
|
})(o, e);
|
|
3410
3480
|
const a = function(e, t) {
|
|
@@ -3435,7 +3505,7 @@ async function zr(e, t) {
|
|
|
3435
3505
|
for (const [t, n] of a) e.text(` ${t.padEnd(7)}${n}`);
|
|
3436
3506
|
e.blank();
|
|
3437
3507
|
}(o, e, a), function(e, t, n) {
|
|
3438
|
-
const o = t.getCoords(), r = n?.getCoords() ??
|
|
3508
|
+
const o = t.getCoords(), r = n?.getCoords() ?? Kr(o), s = t.getWorksheet(), l = s.getRange({
|
|
3439
3509
|
rowStart: o.rowIndex,
|
|
3440
3510
|
rowEnd: o.rowIndex,
|
|
3441
3511
|
colStart: r.colStart,
|
|
@@ -3445,7 +3515,7 @@ async function zr(e, t) {
|
|
|
3445
3515
|
rowEnd: r.rowEnd,
|
|
3446
3516
|
colStart: o.colIndex,
|
|
3447
3517
|
colEnd: o.colIndex
|
|
3448
|
-
}), i = [
|
|
3518
|
+
}), i = [Gr(l, "row", o.colIndex), Gr(a, "column", o.rowIndex)].filter((e) => null !== e);
|
|
3449
3519
|
if (0 === i.length) return;
|
|
3450
3520
|
const c = i.reduce((e, t) => t.share > e.share ? t : e), u = "row" === c.axis ? o.colIndex : o.rowIndex, g = c.segments.filter((e) => e.end >= c.start && e.start <= c.end), d = c.end - c.start + 1, h = "row" === c.axis ? s.getRange({
|
|
3451
3521
|
rowStart: o.rowIndex,
|
|
@@ -3474,7 +3544,7 @@ async function zr(e, t) {
|
|
|
3474
3544
|
address: n,
|
|
3475
3545
|
detail: t ? `${o} ← this cell` : o
|
|
3476
3546
|
};
|
|
3477
|
-
}), n = Math.max(...t.map((e) => e.address.length)), o = t.slice(0,
|
|
3547
|
+
}), n = Math.max(...t.map((e) => e.address.length)), o = t.slice(0, qr);
|
|
3478
3548
|
for (const t of o) e.text(` ${t.address.padEnd(n)} ${t.detail}`);
|
|
3479
3549
|
t.length > o.length && e.text(` …${t.length - o.length} more · getRegions("formula") on ${h.getAddress()} lists them`);
|
|
3480
3550
|
}
|
|
@@ -3485,23 +3555,23 @@ async function zr(e, t) {
|
|
|
3485
3555
|
e.h2(`Anomalies (${n.length})`);
|
|
3486
3556
|
for (const o of n) e.text(` ${D(o, t)}`);
|
|
3487
3557
|
e.blank();
|
|
3488
|
-
}(o, e), await
|
|
3558
|
+
}(o, e), await sr(o, e, t, {
|
|
3489
3559
|
home: e.getWorksheet(),
|
|
3490
3560
|
subject: n,
|
|
3491
3561
|
zeroPrecedents: r,
|
|
3492
3562
|
zeroDependents: r || l !== b.Null && l !== b.String
|
|
3493
3563
|
}), o.toLines().join("\n").trimEnd();
|
|
3494
3564
|
}
|
|
3495
|
-
var
|
|
3565
|
+
var qr = 8, Kr = (e) => ({
|
|
3496
3566
|
rowStart: e.rowIndex,
|
|
3497
3567
|
rowEnd: e.rowIndex,
|
|
3498
3568
|
colStart: e.colIndex,
|
|
3499
3569
|
colEnd: e.colIndex
|
|
3500
3570
|
});
|
|
3501
|
-
function
|
|
3571
|
+
function Gr(e, t, n) {
|
|
3502
3572
|
if (e.isSingleCell()) return null;
|
|
3503
3573
|
const o = [];
|
|
3504
|
-
for (const n of e.getRegions(
|
|
3574
|
+
for (const n of e.getRegions(_r.Formula)) {
|
|
3505
3575
|
const e = n.getCoords();
|
|
3506
3576
|
o.push({
|
|
3507
3577
|
start: "row" === t ? e.colStart : e.rowStart,
|
|
@@ -3521,7 +3591,7 @@ function Jr(e, t, n) {
|
|
|
3521
3591
|
if (n < a || n > i) continue;
|
|
3522
3592
|
const c = [];
|
|
3523
3593
|
let u = a;
|
|
3524
|
-
for (const n of o) n.end < a || n.start > i || (n.start > u && c.push(
|
|
3594
|
+
for (const n of o) n.end < a || n.start > i || (n.start > u && c.push(Xr(e, t, u, n.start - 1)), c.push(n), u = n.end + 1);
|
|
3525
3595
|
return {
|
|
3526
3596
|
axis: t,
|
|
3527
3597
|
segments: c,
|
|
@@ -3533,7 +3603,7 @@ function Jr(e, t, n) {
|
|
|
3533
3603
|
}
|
|
3534
3604
|
return null;
|
|
3535
3605
|
}
|
|
3536
|
-
function
|
|
3606
|
+
function Xr(e, t, n, o) {
|
|
3537
3607
|
const r = e.getCoords();
|
|
3538
3608
|
return {
|
|
3539
3609
|
start: n,
|
|
@@ -3552,11 +3622,11 @@ function qr(e, t, n, o) {
|
|
|
3552
3622
|
})
|
|
3553
3623
|
};
|
|
3554
3624
|
}
|
|
3555
|
-
async function
|
|
3625
|
+
async function Zr(e, t) {
|
|
3556
3626
|
const n = new ie();
|
|
3557
|
-
n.h1(`Cell Range — ${
|
|
3558
|
-
const o =
|
|
3559
|
-
o && n.text(`Protection: ${o}`), n.blank(),
|
|
3627
|
+
n.h1(`Cell Range — ${Vt(e)}`);
|
|
3628
|
+
const o = Hr(e);
|
|
3629
|
+
o && n.text(`Protection: ${o}`), n.blank(), Bt(n, e), function(e, t, n) {
|
|
3560
3630
|
if (!1 === n?.profile) return;
|
|
3561
3631
|
if (t.isSingleCell() || !t.isContentful()) return;
|
|
3562
3632
|
const o = pe({
|
|
@@ -3598,7 +3668,7 @@ async function Kr(e, t) {
|
|
|
3598
3668
|
colStart: $[0],
|
|
3599
3669
|
colEnd: $[$.length - 1]
|
|
3600
3670
|
}), y = `${h} cell${1 !== h ? "s" : ""}`, b = w.toString() !== t.toString();
|
|
3601
|
-
e.h2(`Values (${b ? `${
|
|
3671
|
+
e.h2(`Values (${b ? `${Wt(w)} · ` : ""}${y})`);
|
|
3602
3672
|
const S = e.beginFrame($.map((e) => u.at(e - i).getText()));
|
|
3603
3673
|
for (const e of m) {
|
|
3604
3674
|
const t = g.get(e);
|
|
@@ -3615,7 +3685,7 @@ async function Kr(e, t) {
|
|
|
3615
3685
|
address: e.getAddress(),
|
|
3616
3686
|
size: `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
3617
3687
|
formula: r,
|
|
3618
|
-
labels:
|
|
3688
|
+
labels: es(t)
|
|
3619
3689
|
}), o.length >= (n?.maxRegions ?? 100))) break;
|
|
3620
3690
|
}
|
|
3621
3691
|
if (0 === o.length) return;
|
|
@@ -3629,12 +3699,12 @@ async function Kr(e, t) {
|
|
|
3629
3699
|
const n = Math.max(...t.map((e) => e.address.length));
|
|
3630
3700
|
for (const { address: o, valuesRange: r } of t) e.text(` ${o.padEnd(n)} ${r}`);
|
|
3631
3701
|
e.blank();
|
|
3632
|
-
}(n, r.spills), await
|
|
3702
|
+
}(n, r.spills), await hn(n, e), lo(n, e.getMovables()), gn(n, "Conditional Formats", e.getConditionalFormats(), ft), gn(n, "Data Validations", e.getDataValidations(), mt), await sr(n, e, t, {
|
|
3633
3703
|
home: e.getWorksheet(),
|
|
3634
3704
|
subject: e
|
|
3635
3705
|
}), n.toLines().join("\n").trimEnd();
|
|
3636
3706
|
}
|
|
3637
|
-
var
|
|
3707
|
+
var Yr = /* @__PURE__ */ new Set([
|
|
3638
3708
|
"INDEX",
|
|
3639
3709
|
"MATCH",
|
|
3640
3710
|
"XMATCH",
|
|
@@ -3642,14 +3712,14 @@ var Gr = /* @__PURE__ */ new Set([
|
|
|
3642
3712
|
"HLOOKUP",
|
|
3643
3713
|
"XLOOKUP",
|
|
3644
3714
|
"LOOKUP"
|
|
3645
|
-
]),
|
|
3646
|
-
function
|
|
3715
|
+
]), Qr = 4;
|
|
3716
|
+
function es(e) {
|
|
3647
3717
|
const t = e.getFormula(), n = t?.getReferences();
|
|
3648
3718
|
if (!t || !n) return null;
|
|
3649
3719
|
const o = /* @__PURE__ */ new Set();
|
|
3650
|
-
for (const e of t.getTokens()) void 0 !== e.referenceIndex && e.context &&
|
|
3720
|
+
for (const e of t.getTokens()) void 0 !== e.referenceIndex && e.context && Yr.has(e.context.name.toUpperCase().replace(/^(_XLFN\.)?(_XLWS\.)?/, "")) && o.add(e.referenceIndex);
|
|
3651
3721
|
const r = e.getWorksheet(), s = e.getCoords(), l = [], a = /* @__PURE__ */ new Set();
|
|
3652
|
-
for (let e = 0; e < n.length && l.length <
|
|
3722
|
+
for (let e = 0; e < n.length && l.length < Qr; e++) {
|
|
3653
3723
|
const t = n.at(e), i = t.getCoords();
|
|
3654
3724
|
if (!i) continue;
|
|
3655
3725
|
const c = t.getWorksheet(), u = c !== r;
|
|
@@ -3668,9 +3738,9 @@ function Zr(e) {
|
|
|
3668
3738
|
const i = se(r, s, "row");
|
|
3669
3739
|
return `${i ? `row ${le(i)} → ` : "→ "}${l.join(" · ")}`;
|
|
3670
3740
|
}
|
|
3671
|
-
function
|
|
3741
|
+
function ts(e) {
|
|
3672
3742
|
const t = new ie(), n = e.getRanges();
|
|
3673
|
-
t.h1(`Conditional Format — ${
|
|
3743
|
+
t.h1(`Conditional Format — ${Ht(n)}`), t.blank(), t.fact(`Order: ${e.getIndex() + 1}`);
|
|
3674
3744
|
const o = e.getScale();
|
|
3675
3745
|
if (o) t.fact(`Rule: ${dt(o)}`);
|
|
3676
3746
|
else {
|
|
@@ -3681,37 +3751,37 @@ function Yr(e) {
|
|
|
3681
3751
|
}
|
|
3682
3752
|
return e.isStopIfTrue() && t.fact("Stop If True: true — later rules are not evaluated where this one matches"), t.fact(`Cells: ${n.size}`), t.toLines().join("\n").trimEnd();
|
|
3683
3753
|
}
|
|
3684
|
-
function
|
|
3754
|
+
function ns(e) {
|
|
3685
3755
|
const t = new ie();
|
|
3686
3756
|
t.h1("Counts");
|
|
3687
3757
|
let n = !1;
|
|
3688
3758
|
for (const [o, r] of Object.entries(e)) r > 0 && (t.fact(`${o}: ${r}`), n = !0);
|
|
3689
3759
|
return n || t.fact("None"), t.toLines().join("\n").trimEnd();
|
|
3690
3760
|
}
|
|
3691
|
-
function
|
|
3761
|
+
function os(e) {
|
|
3692
3762
|
const t = new ie(), n = e.getRanges();
|
|
3693
|
-
t.h1(`Data Validation — ${
|
|
3763
|
+
t.h1(`Data Validation — ${Ht(n)}`), t.blank();
|
|
3694
3764
|
const o = e.getCondition();
|
|
3695
3765
|
t.fact(`Rule: ${o?.toString() || "none — anything is accepted here"}`);
|
|
3696
3766
|
const r = pt(o);
|
|
3697
3767
|
r && t.fact(`Allowed: ${r}`), t.fact("Blanks: " + (e.isIncludeBlanks() ? "allowed" : "rejected"));
|
|
3698
3768
|
const s = e.getAlertStyle();
|
|
3699
3769
|
if (t.fact(`Alert: ${s}${s === c.AlertStyle.Stop ? " — the entry is refused" : " — the entry is accepted anyway"}`), e.isShowAlertMessage()) {
|
|
3700
|
-
const n =
|
|
3770
|
+
const n = rs(e.getAlertTitle(), e.getAlertMessage());
|
|
3701
3771
|
n && t.fact(`Alert Message: ${n}`);
|
|
3702
3772
|
}
|
|
3703
3773
|
if (e.isShowPromptMessage()) {
|
|
3704
|
-
const n =
|
|
3774
|
+
const n = rs(e.getPromptTitle(), e.getPromptMessage());
|
|
3705
3775
|
n && t.fact(`Prompt: ${n}`);
|
|
3706
3776
|
}
|
|
3707
3777
|
return e.isHideDropdown() && t.fact("Dropdown: hidden"), t.fact(`Cells: ${n.size}`), t.toLines().join("\n").trimEnd();
|
|
3708
3778
|
}
|
|
3709
|
-
var
|
|
3779
|
+
var rs = (e, t) => {
|
|
3710
3780
|
const n = [e?.trim(), t?.trim()].filter(Boolean);
|
|
3711
3781
|
return n.length > 0 ? n.join(" — ") : null;
|
|
3712
|
-
},
|
|
3713
|
-
var
|
|
3714
|
-
function
|
|
3782
|
+
}, ss = "function", ls = "named", as = "tableReference", is = "tableColumn", cs = "externalReference", us = [["isReferenceOnly", "reference-only"], ["isVolatile", "volatile"]];
|
|
3783
|
+
var gs = (e, t) => e ? ` (${Ot(e)}!${t})` : "";
|
|
3784
|
+
function ds(e, t, n, o) {
|
|
3715
3785
|
if ("external" === e) return "another workbook — not resolvable from here";
|
|
3716
3786
|
if (!n) return "";
|
|
3717
3787
|
switch (e) {
|
|
@@ -3722,17 +3792,17 @@ function cs(e, t, n, o) {
|
|
|
3722
3792
|
case "named": return function(e, t) {
|
|
3723
3793
|
const n = t.getNames(), o = n.getByName(e) ?? n.getByName(e, !0);
|
|
3724
3794
|
if (o) {
|
|
3725
|
-
const e =
|
|
3795
|
+
const e = gs(o.getScope(), o.getName()), t = o.getRanges?.();
|
|
3726
3796
|
return !t || t.isInvalid() ? `defined name — reference does not resolve${e}` : `${t.toString()}${e}`;
|
|
3727
3797
|
}
|
|
3728
3798
|
const r = t.getCalculation().getNamedFormulas().getByName(e);
|
|
3729
|
-
return r ? `=${r.getExpression()}${
|
|
3799
|
+
return r ? `=${r.getExpression()}${gs(r.getScope(), r.getName())}` : "unknown — evaluates to #NAME?";
|
|
3730
3800
|
}(t, n);
|
|
3731
3801
|
case "table": {
|
|
3732
3802
|
const e = n.getTables().getByName(t) ?? n.getWorkbook()?.getWorksheets().getItems().map((e) => e.getTables().getByName(t)).find(Boolean) ?? null;
|
|
3733
3803
|
return e ? ((e, t) => {
|
|
3734
3804
|
const n = e.getWorksheet(), o = e.toString();
|
|
3735
|
-
return !n || t && n.getName() === t.getName() || o.includes("!") ? o : `${
|
|
3805
|
+
return !n || t && n.getName() === t.getName() || o.includes("!") ? o : `${Ot(n.getName())}!${o}`;
|
|
3736
3806
|
})(e.getRange(), n) : "unknown — evaluates to #NAME?";
|
|
3737
3807
|
}
|
|
3738
3808
|
case "column": {
|
|
@@ -3745,9 +3815,9 @@ function cs(e, t, n, o) {
|
|
|
3745
3815
|
}
|
|
3746
3816
|
return "";
|
|
3747
3817
|
}
|
|
3748
|
-
async function
|
|
3818
|
+
async function hs(e, t) {
|
|
3749
3819
|
const n = t?.maxTokens ?? 200, o = new ie(), r = ((e) => e.isINamed ? e : null)(e);
|
|
3750
|
-
if (o.h1(r ? `Name — ${
|
|
3820
|
+
if (o.h1(r ? `Name — ${Qt(r)}` : "Formula"), o.text(o.codespan("=" + e.getExpression())), o.blank(), r) {
|
|
3751
3821
|
r.isHidden() && o.fact("Hidden: true — not offered in the UI; formulas resolve it normally");
|
|
3752
3822
|
const e = r.getComment();
|
|
3753
3823
|
e && o.fact(`Comment: ${e}`);
|
|
@@ -3767,7 +3837,7 @@ async function us(e, t) {
|
|
|
3767
3837
|
const r = j(n);
|
|
3768
3838
|
e.fact(`Value: ${r ? r.display : "(empty)"}`);
|
|
3769
3839
|
}(o, e), o.fact(`Status: ${e.getCalculationStatus()}`), e.isValid() || o.fact("Valid: false — the text did not parse as a complete expression");
|
|
3770
|
-
const s =
|
|
3840
|
+
const s = us.filter(([t]) => e[t]()).map(([, e]) => e);
|
|
3771
3841
|
s.length > 0 && o.fact(`Flags: ${s.join(" · ")}`), o.blank();
|
|
3772
3842
|
const l = e.getReferences(), a = t?.context ?? l?.getWorksheet() ?? null, i = function(e, t) {
|
|
3773
3843
|
const n = /* @__PURE__ */ new Map();
|
|
@@ -3777,19 +3847,19 @@ async function us(e, t) {
|
|
|
3777
3847
|
if (!e) continue;
|
|
3778
3848
|
let s;
|
|
3779
3849
|
switch (r.type) {
|
|
3780
|
-
case
|
|
3850
|
+
case ss:
|
|
3781
3851
|
s = "function";
|
|
3782
3852
|
break;
|
|
3783
|
-
case
|
|
3853
|
+
case ls:
|
|
3784
3854
|
s = "named";
|
|
3785
3855
|
break;
|
|
3786
|
-
case
|
|
3856
|
+
case as:
|
|
3787
3857
|
s = "table", o = e;
|
|
3788
3858
|
break;
|
|
3789
|
-
case
|
|
3859
|
+
case is:
|
|
3790
3860
|
s = "column";
|
|
3791
3861
|
break;
|
|
3792
|
-
case
|
|
3862
|
+
case cs:
|
|
3793
3863
|
s = "external";
|
|
3794
3864
|
break;
|
|
3795
3865
|
default: continue;
|
|
@@ -3799,10 +3869,10 @@ async function us(e, t) {
|
|
|
3799
3869
|
kind: s,
|
|
3800
3870
|
text: e,
|
|
3801
3871
|
uses: 1,
|
|
3802
|
-
resolution:
|
|
3872
|
+
resolution: ds(s, e, t, o)
|
|
3803
3873
|
});
|
|
3804
3874
|
}
|
|
3805
|
-
for (const o of
|
|
3875
|
+
for (const o of vr(e, t?.getWorkbook())) n.set(`external${o.scope.toLowerCase()}`, {
|
|
3806
3876
|
kind: "external",
|
|
3807
3877
|
text: o.scope,
|
|
3808
3878
|
uses: o.uses,
|
|
@@ -3829,7 +3899,7 @@ async function us(e, t) {
|
|
|
3829
3899
|
if (o.h2("References"), l && 0 !== l.length) for (let e = 0; e < l.length; e++) o.text(` ${String(e).padStart(2)} ${l.at(e).getAddress()}`);
|
|
3830
3900
|
else o.text("None");
|
|
3831
3901
|
o.blank(), r && await async function(e, t) {
|
|
3832
|
-
await t.getDirectDependents() || (e.h2("Dependents (0)"), e.text(" None — no formula references this name"), e.blank()), await
|
|
3902
|
+
await t.getDirectDependents() || (e.h2("Dependents (0)"), e.text(" None — no formula references this name"), e.blank()), await sr(e, t);
|
|
3833
3903
|
}(o, r);
|
|
3834
3904
|
const c = e.getTokens();
|
|
3835
3905
|
if (o.h2("Tokens"), 0 === c.length) o.text("None");
|
|
@@ -3858,7 +3928,7 @@ async function us(e, t) {
|
|
|
3858
3928
|
}
|
|
3859
3929
|
return o.toLines().join("\n").trimEnd();
|
|
3860
3930
|
}
|
|
3861
|
-
var
|
|
3931
|
+
var fs = [
|
|
3862
3932
|
"Workbook_Open",
|
|
3863
3933
|
"Auto_Open",
|
|
3864
3934
|
"Workbook_BeforeClose",
|
|
@@ -3871,11 +3941,11 @@ var gs = [
|
|
|
3871
3941
|
"Worksheet_Activate",
|
|
3872
3942
|
"Worksheet_BeforeDoubleClick",
|
|
3873
3943
|
"Worksheet_Calculate"
|
|
3874
|
-
],
|
|
3944
|
+
], ms = (e) => {
|
|
3875
3945
|
const t = [];
|
|
3876
|
-
for (const n of
|
|
3946
|
+
for (const n of fs) new RegExp(`(?:Sub|Function)\\s+${n}\\b`, "i").test(e) && t.push(n);
|
|
3877
3947
|
return t;
|
|
3878
|
-
},
|
|
3948
|
+
}, ps = (e) => {
|
|
3879
3949
|
try {
|
|
3880
3950
|
return e.getFunctions().getItems({
|
|
3881
3951
|
type: "autoRun",
|
|
@@ -3884,32 +3954,32 @@ var gs = [
|
|
|
3884
3954
|
} catch {
|
|
3885
3955
|
return [];
|
|
3886
3956
|
}
|
|
3887
|
-
},
|
|
3957
|
+
}, $s = (e) => {
|
|
3888
3958
|
const t = e.getScope();
|
|
3889
3959
|
return t ? !0 === t.isIWorksheet ? `sheet '${t.getName()}'` : "workbook" : "global";
|
|
3890
|
-
},
|
|
3960
|
+
}, ws = (e) => {
|
|
3891
3961
|
const t = ((e) => e.getSource()?.trim() ?? "")(e);
|
|
3892
3962
|
return {
|
|
3893
3963
|
module: e,
|
|
3894
3964
|
name: e.getName(),
|
|
3895
3965
|
language: e.getLanguage(),
|
|
3896
|
-
scope:
|
|
3966
|
+
scope: $s(e),
|
|
3897
3967
|
body: t,
|
|
3898
3968
|
lines: 0 === t.length ? 0 : t.split("\n").length,
|
|
3899
|
-
runsInExcel:
|
|
3900
|
-
runsHere:
|
|
3969
|
+
runsInExcel: ms(t),
|
|
3970
|
+
runsHere: ps(e),
|
|
3901
3971
|
executable: !!e.toJSON().compiled
|
|
3902
3972
|
};
|
|
3903
3973
|
};
|
|
3904
|
-
function
|
|
3974
|
+
function ys(e) {
|
|
3905
3975
|
const t = [], n = e.getModules?.();
|
|
3906
3976
|
n && t.push(...n.getItems({ language: null }));
|
|
3907
3977
|
for (const n of e.getWorksheets().getItems()) t.push(...n.getModules().getItems({ language: null }));
|
|
3908
3978
|
return t;
|
|
3909
3979
|
}
|
|
3910
|
-
function
|
|
3980
|
+
function bs(e, t, n) {
|
|
3911
3981
|
if (0 === t.length) return;
|
|
3912
|
-
const o = t.map(
|
|
3982
|
+
const o = t.map(ws), r = o.filter((e) => e.lines > 0);
|
|
3913
3983
|
if (0 === r.length) return e.h2("Code (none)"), e.text(`${o.length} module${1 !== o.length ? "s" : ""}, none with any source.`), void e.blank();
|
|
3914
3984
|
e.h2(`Code (${r.length} module${1 !== r.length ? "s" : ""})`);
|
|
3915
3985
|
const s = r.filter((e) => !e.executable);
|
|
@@ -3945,7 +4015,7 @@ function $s(e, t, n) {
|
|
|
3945
4015
|
}
|
|
3946
4016
|
d.endFrame(), i.length < r.length && e.text(` …and ${r.length - i.length} more · wb.getModules() renders the full view`), e.blank();
|
|
3947
4017
|
}
|
|
3948
|
-
function
|
|
4018
|
+
function Ss(e, t, n, o) {
|
|
3949
4019
|
n(`Module — ${t.name}`), e.blank();
|
|
3950
4020
|
const r = [
|
|
3951
4021
|
`language: ${t.language}`,
|
|
@@ -3957,132 +4027,132 @@ function ws(e, t, n, o) {
|
|
|
3957
4027
|
const s = o?.maxSourceLines ?? 200, l = t.body.split("\n"), a = l.length > s ? l.slice(0, s) : l;
|
|
3958
4028
|
e.text(e.code(a.join("\n"), t.language)), a.length < l.length && e.text(`…and ${l.length - a.length} more lines · getSource() returns the whole module`);
|
|
3959
4029
|
}
|
|
3960
|
-
function
|
|
4030
|
+
function xs(e, t) {
|
|
3961
4031
|
const n = new ie();
|
|
3962
|
-
return
|
|
4032
|
+
return Ss(n, ws(e), (e) => n.h1(e), t), n.toLines().join("\n").trimEnd();
|
|
3963
4033
|
}
|
|
3964
|
-
function
|
|
4034
|
+
function ks(e, t) {
|
|
3965
4035
|
const n = new ie(), o = e.getItems({ language: null }) ?? [];
|
|
3966
4036
|
if (n.h1(`Modules — ${o.length} module${1 !== o.length ? "s" : ""}`), n.blank(), 0 === o.length) return n.text("None"), n.toLines().join("\n").trimEnd();
|
|
3967
|
-
const r = o.map(
|
|
3968
|
-
|
|
3969
|
-
for (const e of r) 0 !== e.lines && (
|
|
4037
|
+
const r = o.map(ws);
|
|
4038
|
+
bs(n, o, t);
|
|
4039
|
+
for (const e of r) 0 !== e.lines && (Ss(n, e, (e) => n.h2(e), t), n.blank());
|
|
3970
4040
|
return n.toLines().join("\n").trimEnd();
|
|
3971
4041
|
}
|
|
3972
|
-
var
|
|
3973
|
-
async function
|
|
4042
|
+
var Cs = [["formula", "Names"], ["table", "Tables"]];
|
|
4043
|
+
async function vs(e, t) {
|
|
3974
4044
|
const n = new ie(), o = e.getItems({ includeHidden: !0 }) ?? [];
|
|
3975
4045
|
if (n.h1(`Names — ${o.length} item${1 !== o.length ? "s" : ""}`), n.blank(), 0 === o.length) return n.text("None"), n.toLines().join("\n").trimEnd();
|
|
3976
|
-
const r = new Set(
|
|
3977
|
-
for (const [e, r] of
|
|
4046
|
+
const r = new Set(Cs.map(([e]) => e));
|
|
4047
|
+
for (const [e, r] of Cs) await an(n, o.filter((t) => t.getType() === e), {
|
|
3978
4048
|
...t,
|
|
3979
4049
|
heading: r,
|
|
3980
4050
|
symbols: o
|
|
3981
4051
|
});
|
|
3982
4052
|
const s = o.filter((e) => !r.has(e.getType())), l = [...new Set(s.map((e) => e.getType()))].sort();
|
|
3983
|
-
for (const e of l) await
|
|
4053
|
+
for (const e of l) await an(n, s.filter((t) => t.getType() === e), {
|
|
3984
4054
|
...t,
|
|
3985
4055
|
heading: e,
|
|
3986
4056
|
symbols: o
|
|
3987
4057
|
});
|
|
3988
4058
|
return n.toLines().join("\n").trimEnd();
|
|
3989
4059
|
}
|
|
3990
|
-
var
|
|
4060
|
+
var Es = [
|
|
3991
4061
|
.75,
|
|
3992
4062
|
.75,
|
|
3993
4063
|
.7,
|
|
3994
4064
|
.7,
|
|
3995
4065
|
.3,
|
|
3996
4066
|
.3
|
|
3997
|
-
],
|
|
4067
|
+
], Rs = [
|
|
3998
4068
|
["top", (e) => e.getTopMargin()],
|
|
3999
4069
|
["bottom", (e) => e.getBottomMargin()],
|
|
4000
4070
|
["left", (e) => e.getLeftMargin()],
|
|
4001
4071
|
["right", (e) => e.getRightMargin()],
|
|
4002
4072
|
["header", (e) => e.getHeaderMargin()],
|
|
4003
4073
|
["footer", (e) => e.getFooterMargin()]
|
|
4004
|
-
],
|
|
4074
|
+
], Ns = [
|
|
4005
4075
|
["gridlines", (e) => e.getPrintGridlines()],
|
|
4006
4076
|
["headings", (e) => e.getPrintHeadings()],
|
|
4007
4077
|
["black and white", (e) => e.getBlackAndWhite()],
|
|
4008
4078
|
["draft quality", (e) => e.getDraftMode()]
|
|
4009
|
-
],
|
|
4079
|
+
], js = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`, Ms = (e) => Math.round(e / 72 * 1e3) / 1e3, Is = (e) => {
|
|
4010
4080
|
const t = e.getZoom();
|
|
4011
4081
|
if (void 0 !== t.scale) return 100 === t.scale ? null : `${t.scale}%`;
|
|
4012
|
-
const n = (e, t) => e ? `${
|
|
4082
|
+
const n = (e, t) => e ? `${js(e, "page")} ${t}` : `automatic ${t}`;
|
|
4013
4083
|
return `fit to ${n(t.horizontalFitToPages, "wide")} × ${n(t.verticalFitToPages, "tall")}`;
|
|
4014
|
-
},
|
|
4084
|
+
}, Fs = (e) => {
|
|
4015
4085
|
const t = e.getPaperSizeCode();
|
|
4016
4086
|
return 1 === t ? null : e.getPaperSize() ?? `code ${t}`;
|
|
4017
|
-
},
|
|
4087
|
+
}, Ts = (e) => Rs.every(([, t], n) => Ms(t(e)) === Es[n]), As = (t, n) => {
|
|
4018
4088
|
if (!t) return null;
|
|
4019
4089
|
const o = t.getCoords();
|
|
4020
4090
|
return n ? e.runToString(o.colStart, o.colEnd, !0) : e.runToString(o.rowStart, o.rowEnd, !1);
|
|
4021
|
-
},
|
|
4091
|
+
}, Ls = (t, n) => {
|
|
4022
4092
|
if (0 === t.length) return null;
|
|
4023
4093
|
const o = t.slice(0, 20).map((t) => {
|
|
4024
4094
|
const o = n ? t.getColumnIndex() : t.getRowIndex();
|
|
4025
4095
|
return e.runToString(o, o, n).split(":")[0];
|
|
4026
4096
|
}), r = t.length > 20 ? `, …and ${t.length - 20} more` : "";
|
|
4027
4097
|
return `before ${n ? "columns" : "rows"} ${o.join(", ")}${r}`;
|
|
4028
|
-
},
|
|
4098
|
+
}, Ws = (e) => {
|
|
4029
4099
|
const t = e.getHeadersFooters(), n = t.getState(), o = d.HeaderFooterState, r = n === o.FirstAndDefault || n === o.FirstOddAndEven, s = n === o.OddAndEven || n === o.FirstOddAndEven, l = [];
|
|
4030
4100
|
return r && l.push(["first page", t.getFirstPage()]), s ? (l.push(["odd pages", t.getOddPages()]), l.push(["even pages", t.getEvenPages()])) : l.push([r ? "other pages" : "every page", t.getDefaultForAllPages()]), l;
|
|
4031
|
-
},
|
|
4101
|
+
}, Os = (e, t, n) => {
|
|
4032
4102
|
const o = [];
|
|
4033
4103
|
return e && o.push(`left ${JSON.stringify(e)}`), t && o.push(`center ${JSON.stringify(t)}`), n && o.push(`right ${JSON.stringify(n)}`), o.length > 0 ? o.join(" · ") : null;
|
|
4034
4104
|
};
|
|
4035
|
-
function
|
|
4105
|
+
function Ps(e) {
|
|
4036
4106
|
const t = e.getPageLayout(), n = [];
|
|
4037
4107
|
t.getOrientation() !== d.Orientation.Portrait && n.push(t.getOrientation());
|
|
4038
|
-
const o =
|
|
4108
|
+
const o = Fs(t);
|
|
4039
4109
|
o && n.push(o);
|
|
4040
|
-
const r =
|
|
4110
|
+
const r = Is(t);
|
|
4041
4111
|
r && n.push(r);
|
|
4042
4112
|
const s = t.getPrintArea();
|
|
4043
|
-
s && n.push(`print area ${
|
|
4044
|
-
const l =
|
|
4113
|
+
s && n.push(`print area ${Dt(s)}`);
|
|
4114
|
+
const l = As(t.getPrintTitleRows(), !1);
|
|
4045
4115
|
l && n.push(`title rows ${l}`);
|
|
4046
|
-
const a =
|
|
4116
|
+
const a = As(t.getPrintTitleColumns(), !0);
|
|
4047
4117
|
a && n.push(`title columns ${a}`);
|
|
4048
4118
|
const i = t.getHorizontalPageBreaks().length;
|
|
4049
|
-
i > 0 && n.push(
|
|
4119
|
+
i > 0 && n.push(js(i, "row break"));
|
|
4050
4120
|
const c = t.getVerticalPageBreaks().length;
|
|
4051
|
-
c > 0 && n.push(
|
|
4052
|
-
const u =
|
|
4121
|
+
c > 0 && n.push(js(c, "column break")), ((e) => Ws(e).some(([, e]) => "" !== e.getHeader() || "" !== e.getFooter()))(t) && n.push("headers/footers"), Ts(t) || n.push("custom margins");
|
|
4122
|
+
const u = Ns.filter(([, e]) => e(t)).map(([e]) => e);
|
|
4053
4123
|
return u.length > 0 && n.push(u.join(", ")), 0 === n.length ? null : `${n.join(" · ")} — wb.getWorksheet(${JSON.stringify(e.getName())}).getPageLayout()`;
|
|
4054
4124
|
}
|
|
4055
|
-
function
|
|
4125
|
+
function Ds(e) {
|
|
4056
4126
|
const t = new ie();
|
|
4057
4127
|
t.h1("Page Layout"), t.blank();
|
|
4058
4128
|
const n = e.getOrientation();
|
|
4059
|
-
t.fact(`Orientation: ${n}${n === d.Orientation.Portrait ? " (default)" : ""}`), t.fact(`Paper: ${
|
|
4060
|
-
const o =
|
|
4061
|
-
t.fact(`Margins (inches): ${o}${
|
|
4129
|
+
t.fact(`Orientation: ${n}${n === d.Orientation.Portrait ? " (default)" : ""}`), t.fact(`Paper: ${Fs(e) ?? "letter (default)"}`), t.fact(`Zoom: ${Is(e) ?? "100% (default)"}`);
|
|
4130
|
+
const o = Rs.map(([t, n]) => `${t} ${Ms(n(e))}`).join(" · ");
|
|
4131
|
+
t.fact(`Margins (inches): ${o}${Ts(e) ? " (default)" : ""}`);
|
|
4062
4132
|
const r = e.getPrintArea();
|
|
4063
|
-
t.fact(`Print area: ${r ?
|
|
4133
|
+
t.fact(`Print area: ${r ? Dt(r) : "none — the used range prints"}`), t.fact(`Title rows: ${As(e.getPrintTitleRows(), !1) ?? "none"}`), t.fact(`Title columns: ${As(e.getPrintTitleColumns(), !0) ?? "none"}`);
|
|
4064
4134
|
const s = e.getHorizontalPageBreaks(), l = e.getVerticalPageBreaks();
|
|
4065
|
-
t.fact("Row breaks: " + (s.length > 0 ? `${s.length} · ${
|
|
4135
|
+
t.fact("Row breaks: " + (s.length > 0 ? `${s.length} · ${Ls(s, !1)}` : "none")), t.fact("Column breaks: " + (l.length > 0 ? `${l.length} · ${Ls(l, !0)}` : "none"));
|
|
4066
4136
|
const a = [];
|
|
4067
4137
|
e.getCenterHorizontally() && a.push("horizontally"), e.getCenterVertically() && a.push("vertically"), a.length > 0 && t.fact(`Centered: ${a.join(", ")}`);
|
|
4068
|
-
const i =
|
|
4138
|
+
const i = Ns.filter(([, t]) => t(e)).map(([e]) => e);
|
|
4069
4139
|
i.length > 0 && t.fact(`Also prints: ${i.join(", ")}`);
|
|
4070
4140
|
const c = e.getFirstPageNumber();
|
|
4071
4141
|
"" !== c && t.fact(`First page number: ${c}`), e.getPrintOrder() !== d.PrintOrder.DownThenOver && t.fact(`Page order: ${e.getPrintOrder()}`), e.getPrintComments() !== d.PrintComments.NoComments && t.fact(`Notes: ${e.getPrintComments()}`), e.getPrintErrors() !== d.PrintErrorType.AsDisplayed && t.fact(`Errors print as: ${e.getPrintErrors()}`);
|
|
4072
|
-
const u =
|
|
4073
|
-
const n = [], o =
|
|
4142
|
+
const u = Ws(e).flatMap(([e, t]) => {
|
|
4143
|
+
const n = [], o = Os(t.getLeftHeader(), t.getCenterHeader(), t.getRightHeader());
|
|
4074
4144
|
o && n.push(`${e} header: ${o}`);
|
|
4075
|
-
const r =
|
|
4145
|
+
const r = Os(t.getLeftFooter(), t.getCenterFooter(), t.getRightFooter());
|
|
4076
4146
|
return r && n.push(`${e} footer: ${r}`), n;
|
|
4077
4147
|
});
|
|
4078
4148
|
return u.length > 0 && (t.blank(), t.h2("Headers and Footers"), t.fact(u)), t.toLines().join("\n").trimEnd();
|
|
4079
4149
|
}
|
|
4080
|
-
var
|
|
4150
|
+
var Hs = (e) => {
|
|
4081
4151
|
if (!e || "object" != typeof e || Array.isArray(e)) return !1;
|
|
4082
4152
|
const t = Object.getPrototypeOf(e);
|
|
4083
4153
|
return t === Object.prototype || null === t;
|
|
4084
4154
|
};
|
|
4085
|
-
function
|
|
4155
|
+
function Vs(e, t) {
|
|
4086
4156
|
const n = t?.maxCells ?? 1e3, o = Array.isArray(e) ? e : [e], r = new ie();
|
|
4087
4157
|
if (r.h1("Records"), r.text(`Count: ${o.length}`), r.blank(), 0 === o.length) return r.text("None"), r.toLines().join("\n").trimEnd();
|
|
4088
4158
|
const s = (e) => {
|
|
@@ -4092,34 +4162,34 @@ function Ps(e, t) {
|
|
|
4092
4162
|
}, l = Math.max(1, s(o).length), a = L(o.length, Math.max(1, Math.floor(n / l))), i = o.length > a ? o.slice(0, a) : o, c = i.length === o.length ? s(o) : s(i);
|
|
4093
4163
|
if (0 === c.length) return r.text("No fields"), r.toLines().join("\n").trimEnd();
|
|
4094
4164
|
const u = r.beginFrame(c);
|
|
4095
|
-
for (const e of i) u.addRow(c.map((n) =>
|
|
4165
|
+
for (const e of i) u.addRow(c.map((n) => Bs(e?.[n], t?.nested)));
|
|
4096
4166
|
return u.endFrame(), i.length < o.length && r.text(`…truncated at ${i.length} of ${o.length} records · filter, sort or aggregate the array in the expression`), r.toLines().join("\n").trimEnd();
|
|
4097
4167
|
}
|
|
4098
|
-
var
|
|
4168
|
+
var Bs = (e, t) => {
|
|
4099
4169
|
if (null == e) return { text: "" };
|
|
4100
4170
|
if ("function" == typeof e) return { text: "[Function]" };
|
|
4101
|
-
if ("bigint" == typeof e || "symbol" == typeof e) return { text:
|
|
4171
|
+
if ("bigint" == typeof e || "symbol" == typeof e) return { text: _s(String(e)) };
|
|
4102
4172
|
if ("object" == typeof e) {
|
|
4103
4173
|
if (e instanceof Date) return { text: e.toISOString() };
|
|
4104
4174
|
const n = e;
|
|
4105
|
-
if (!0 === n.isFormulaError || !0 === n.isIRichData) return { text:
|
|
4106
|
-
if (
|
|
4175
|
+
if (!0 === n.isFormulaError || !0 === n.isIRichData) return { text: _s(Us(e)) };
|
|
4176
|
+
if (Hs(e) || Array.isArray(e)) {
|
|
4107
4177
|
let t;
|
|
4108
4178
|
try {
|
|
4109
4179
|
t = JSON.stringify(e) ?? String(e);
|
|
4110
4180
|
} catch {
|
|
4111
4181
|
t = "[circular]";
|
|
4112
4182
|
}
|
|
4113
|
-
return { text:
|
|
4183
|
+
return { text: _s(t) };
|
|
4114
4184
|
}
|
|
4115
|
-
return { text:
|
|
4185
|
+
return { text: _s(t?.(e) ?? zs(e)) };
|
|
4116
4186
|
}
|
|
4117
|
-
const n =
|
|
4187
|
+
const n = _s(Us(e).replace(/[\r\n]+/g, " "));
|
|
4118
4188
|
return "number" == typeof e ? {
|
|
4119
4189
|
text: n,
|
|
4120
4190
|
alignment: "right"
|
|
4121
4191
|
} : { text: n };
|
|
4122
|
-
},
|
|
4192
|
+
}, zs = (e) => {
|
|
4123
4193
|
let t;
|
|
4124
4194
|
try {
|
|
4125
4195
|
t = String(e);
|
|
@@ -4128,40 +4198,40 @@ var Ds = (e, t) => {
|
|
|
4128
4198
|
}
|
|
4129
4199
|
const n = /^\[object (.+)\]$/.exec(t)?.[1];
|
|
4130
4200
|
return n && "Object" !== n ? n : t;
|
|
4131
|
-
},
|
|
4201
|
+
}, Us = (e) => {
|
|
4132
4202
|
try {
|
|
4133
4203
|
return j(e)?.match ?? String(e);
|
|
4134
4204
|
} catch {
|
|
4135
4205
|
return String(e);
|
|
4136
4206
|
}
|
|
4137
|
-
},
|
|
4138
|
-
function
|
|
4207
|
+
}, _s = (e) => e.length > 80 ? `${e.slice(0, 79)}…` : e;
|
|
4208
|
+
function Js(e, t) {
|
|
4139
4209
|
const n = e.length, o = L(n, t?.maxRanges ?? 100), r = Math.min(n, o), s = [];
|
|
4140
4210
|
for (let t = 0; t < r; t++) {
|
|
4141
4211
|
const n = e.at(t);
|
|
4142
4212
|
s.push({
|
|
4143
|
-
|
|
4144
|
-
detail: [
|
|
4213
|
+
...$r(n),
|
|
4214
|
+
detail: [wr(n), mr(n)].filter(Boolean).join(" ")
|
|
4145
4215
|
});
|
|
4146
4216
|
}
|
|
4147
4217
|
const l = s.filter((e) => !e.isName), a = l.length > 0 && l.some((e) => e.sheet !== l[0].sheet), i = l.length > 0 ? l[0].sheet : e.getWorksheet()?.getName(), c = new ie(), u = s.length > 0 && !a && !!i;
|
|
4148
|
-
if (c.h1(u ? `Ranges — ${
|
|
4149
|
-
const g = s.map((e) => a && !e.isName ? `${
|
|
4218
|
+
if (c.h1(u ? `Ranges — ${Ot(i)} (${n})` : `Ranges (${n})`), 0 === s.length) return c.text("none"), c.toLines().join("\n").trimEnd();
|
|
4219
|
+
const g = s.map((e) => a && !e.isName ? `${Ot(e.sheet)}!${e.address}` : e.address), d = Math.max(...g.map((e) => e.length));
|
|
4150
4220
|
for (let e = 0; e < s.length; e++) c.text(` ${g[e].padEnd(d)} ${s[e].detail}`.trimEnd());
|
|
4151
4221
|
return r < n && c.text(` …and ${n - r} more · loop the collection in code to see them all`), c.toLines().join("\n").trimEnd();
|
|
4152
4222
|
}
|
|
4153
|
-
var
|
|
4223
|
+
var qs = (e) => {
|
|
4154
4224
|
let t = "", n = e + 1;
|
|
4155
4225
|
for (; n > 0;) {
|
|
4156
4226
|
const e = (n - 1) % 26;
|
|
4157
4227
|
t = String.fromCharCode(65 + e) + t, n = Math.floor((n - 1) / 26);
|
|
4158
4228
|
}
|
|
4159
4229
|
return t;
|
|
4160
|
-
},
|
|
4161
|
-
function
|
|
4230
|
+
}, Ks = /^\s*=\s*TABLE\s*\(([^()]*)\)\s*$/i;
|
|
4231
|
+
function Gs(e) {
|
|
4162
4232
|
const t = [];
|
|
4163
4233
|
for (const o of e.getEntireRange().getRegions(l.Feature.Formula)) {
|
|
4164
|
-
if (!
|
|
4234
|
+
if (!Ks.test(o.getCell().getFormulaText() ?? "")) continue;
|
|
4165
4235
|
const r = o.getCoords();
|
|
4166
4236
|
for (let o = r.rowStart; o <= r.rowEnd; o++) for (let s = r.colStart; s <= r.colEnd; s++) {
|
|
4167
4237
|
const r = e.getRange({
|
|
@@ -4169,7 +4239,7 @@ function Js(e) {
|
|
|
4169
4239
|
colStart: s,
|
|
4170
4240
|
rowEnd: o,
|
|
4171
4241
|
colEnd: s
|
|
4172
|
-
}).getCell(), l = r.getFormulaText() ?? "", a =
|
|
4242
|
+
}).getCell(), l = r.getFormulaText() ?? "", a = Ks.exec(l);
|
|
4173
4243
|
if (!a) continue;
|
|
4174
4244
|
const i = a[1].split(",").map((e) => e.trim()), c = parseInt(i[2] ?? "", 10), u = parseInt(i[3] ?? "", 10), g = n.isError(r.getValue(), n.Code.Spill), d = (g ? null : r.getSpill()) ?? (c > 0 && u > 0 ? e.getRange({
|
|
4175
4245
|
rowStart: o,
|
|
@@ -4193,23 +4263,23 @@ function Js(e) {
|
|
|
4193
4263
|
}
|
|
4194
4264
|
return t;
|
|
4195
4265
|
}
|
|
4196
|
-
var
|
|
4266
|
+
var Xs = (e) => {
|
|
4197
4267
|
const t = (e) => "#REF!" === e.toUpperCase() ? "#REF! (deleted)" : e, n = [];
|
|
4198
4268
|
return e.rowInput && n.push(`row input ${t(e.rowInput)}`), e.columnInput && n.push(`column input ${t(e.columnInput)}`), n.push(`formula ${((e) => {
|
|
4199
|
-
const t = e.extent.getCoords(), n =
|
|
4200
|
-
return e.rowInput && e.columnInput ? `${n}${o}` : e.columnInput ? `${
|
|
4269
|
+
const t = e.extent.getCoords(), n = qs(t.colStart - 1), o = t.rowStart;
|
|
4270
|
+
return e.rowInput && e.columnInput ? `${n}${o}` : e.columnInput ? `${qs(t.colStart)}${o}:${qs(t.colEnd)}${o}` : `${n}${t.rowStart + 1}:${n}${t.rowEnd + 1}`;
|
|
4201
4271
|
})(e)}`), e.blocked && n.push("blocked (#SPILL!)"), `${e.formula} ${n.join(", ")}`;
|
|
4202
4272
|
};
|
|
4203
|
-
var
|
|
4273
|
+
var Zs = (e) => e.isDeleted() ? "" : e.getRange().toString(), Ys = (e) => {
|
|
4204
4274
|
if (0 === e.getFields().length) return "";
|
|
4205
4275
|
const t = (e) => e.map((e) => e.getName()), n = [], o = (e, t, o) => {
|
|
4206
4276
|
t.length > 0 && n.push(`${e}: ${t.join(o)}`);
|
|
4207
4277
|
};
|
|
4208
4278
|
return o("rows", t(e.getRowFields()), " > "), o("columns", t(e.getColumnFields()), " > "), o("filters", t(e.getPageFields()), ", "), o("values", t(e.getDataFields()), ", "), n.join(" · ");
|
|
4209
4279
|
};
|
|
4210
|
-
async function
|
|
4280
|
+
async function Qs(e, t) {
|
|
4211
4281
|
const n = new ie(), o = e.getSelectedRange(), r = e.getUsedRange();
|
|
4212
|
-
n.h1(`Sheet — ${
|
|
4282
|
+
n.h1(`Sheet — ${Ot(e.getName())}${function(e) {
|
|
4213
4283
|
const t = e.getWorkbook();
|
|
4214
4284
|
let n = "";
|
|
4215
4285
|
t && t.getSelectedWorksheet()?.getId() === e.getId() && (n += " (selected)");
|
|
@@ -4217,25 +4287,26 @@ async function Xs(e, t) {
|
|
|
4217
4287
|
o === m.Visibility.Hidden ? n += " (hidden)" : o === m.Visibility.VeryHidden && (n += " (very hidden)");
|
|
4218
4288
|
e.getProtection().isLocked() && (n += " (protected)");
|
|
4219
4289
|
return n;
|
|
4220
|
-
}(e)}`), n.text(`Used: ${r ?
|
|
4221
|
-
const s =
|
|
4290
|
+
}(e)}`), n.text(`Used: ${r ? Wt(r) : "empty"}`), n.text(`Selection: ${Wt(o)}`);
|
|
4291
|
+
const s = un(e);
|
|
4222
4292
|
s && n.text(`Outline: ${s}`);
|
|
4223
|
-
const l =
|
|
4293
|
+
const l = Ps(e);
|
|
4224
4294
|
l && n.text(`Print: ${l}`), n.blank();
|
|
4225
4295
|
const a = r ?? o;
|
|
4226
|
-
|
|
4296
|
+
Bt(n, a), Ut(n, a), _t(n, a, {
|
|
4227
4297
|
profile: !0,
|
|
4298
|
+
layerScope: e.getEntireRange(),
|
|
4228
4299
|
...t
|
|
4229
4300
|
});
|
|
4230
4301
|
const i = void 0 === t?.features ? null : "string" == typeof t.features ? [t.features] : [...t.features];
|
|
4231
|
-
return i && !i.some((e) => "unlock" === e || "protection" === e) ||
|
|
4302
|
+
return i && !i.some((e) => "unlock" === e || "protection" === e) || Dr(n, e), await hn(n, a), function(e, t) {
|
|
4232
4303
|
if (0 === t.length) return;
|
|
4233
4304
|
const n = t.map((e) => ({
|
|
4234
|
-
address:
|
|
4305
|
+
address: Zs(e),
|
|
4235
4306
|
name: e.getName(),
|
|
4236
4307
|
source: e.isDeleted() ? null : e.getSource(),
|
|
4237
4308
|
stale: e.isStale(),
|
|
4238
|
-
fields:
|
|
4309
|
+
fields: Ys(e)
|
|
4239
4310
|
})), o = Math.max(...n.map((e) => e.address.length));
|
|
4240
4311
|
e.h2(`Pivot Tables (${t.length})`);
|
|
4241
4312
|
for (const t of n) {
|
|
@@ -4247,14 +4318,14 @@ async function Xs(e, t) {
|
|
|
4247
4318
|
if (0 === t.length) return;
|
|
4248
4319
|
const n = t.map((e) => ({
|
|
4249
4320
|
address: e.extent.getAddress(),
|
|
4250
|
-
detail:
|
|
4321
|
+
detail: Xs(e)
|
|
4251
4322
|
})), o = Math.max(...n.map((e) => e.address.length));
|
|
4252
4323
|
e.h2(`Data Tables (${t.length})`);
|
|
4253
4324
|
for (const t of n) e.text(` ${t.address.padEnd(o)} ${t.detail}`);
|
|
4254
4325
|
e.text(" What-if results: the formula cells evaluated with each axis value put into the inputs."), e.blank();
|
|
4255
|
-
}(n,
|
|
4326
|
+
}(n, Gs(e)), lo(n, e.getMovables().getItems()), n.toLines().join("\n").trimEnd();
|
|
4256
4327
|
}
|
|
4257
|
-
var
|
|
4328
|
+
var el = 1e4, tl = [
|
|
4258
4329
|
["numericalCount", "Numbers"],
|
|
4259
4330
|
["sum", "Sum"],
|
|
4260
4331
|
["min", "Min"],
|
|
@@ -4262,7 +4333,7 @@ var Zs = 1e4, Ys = [
|
|
|
4262
4333
|
["average", "Average"],
|
|
4263
4334
|
["stdDev", "StdDev"]
|
|
4264
4335
|
];
|
|
4265
|
-
function
|
|
4336
|
+
function nl(t) {
|
|
4266
4337
|
const n = new ie(), o = t.getCoords(), r = o ? e.rangeToString(o) : null;
|
|
4267
4338
|
n.h1(r ? `Stats — ${r}` : "Stats");
|
|
4268
4339
|
const s = t.getTypedCounts();
|
|
@@ -4270,9 +4341,9 @@ function Qs(t) {
|
|
|
4270
4341
|
const l = s[b.Error] ?? 0;
|
|
4271
4342
|
l > 0 && n.fact(`Errors: ${l}`);
|
|
4272
4343
|
const a = function(e) {
|
|
4273
|
-
const t = e.getFrequencies({ limit:
|
|
4344
|
+
const t = e.getFrequencies({ limit: el }), n = t.getUniqueCount();
|
|
4274
4345
|
if (0 === n) return null;
|
|
4275
|
-
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${
|
|
4346
|
+
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${el.toLocaleString("en-US")})`;
|
|
4276
4347
|
if (n === t.getTotalCount()) return `${n.toLocaleString("en-US")}, no repeats`;
|
|
4277
4348
|
const o = [];
|
|
4278
4349
|
for (const [e, n] of t.getValueCounts()) {
|
|
@@ -4281,7 +4352,7 @@ function Qs(t) {
|
|
|
4281
4352
|
label: j(e)?.display ?? "",
|
|
4282
4353
|
content: n,
|
|
4283
4354
|
styled: n,
|
|
4284
|
-
blocks: r &&
|
|
4355
|
+
blocks: r && ol(r) === n ? [r] : []
|
|
4285
4356
|
});
|
|
4286
4357
|
}
|
|
4287
4358
|
const r = {
|
|
@@ -4295,7 +4366,7 @@ function Qs(t) {
|
|
|
4295
4366
|
}(t);
|
|
4296
4367
|
a && n.fact(`Distinct: ${a}`);
|
|
4297
4368
|
const i = t.getAggregates({ onError: "ignore" });
|
|
4298
|
-
for (const [e, t] of
|
|
4369
|
+
for (const [e, t] of tl) {
|
|
4299
4370
|
const o = i[e];
|
|
4300
4371
|
null != o && n.fact(`${t}: ${E(o)}`);
|
|
4301
4372
|
}
|
|
@@ -4303,8 +4374,8 @@ function Qs(t) {
|
|
|
4303
4374
|
for (const [e, t] of Object.entries(s)) e !== b.Null && t && c.push(`${e.charAt(0).toUpperCase()}${e.slice(1)}: ${t}`);
|
|
4304
4375
|
return c.length > 0 && (n.blank(), n.h2("Type"), n.fact(c)), n.toLines().join("\n").trimEnd();
|
|
4305
4376
|
}
|
|
4306
|
-
var
|
|
4307
|
-
function
|
|
4377
|
+
var ol = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
|
|
4378
|
+
function rl(e) {
|
|
4308
4379
|
const t = new ie();
|
|
4309
4380
|
t.h1("Style"), t.text(`Named: ${e.getNamed().getName()}`), t.blank();
|
|
4310
4381
|
const n = e.toJSON(), o = n ? Object.entries(n).filter(([, e]) => void 0 !== e) : [];
|
|
@@ -4312,40 +4383,40 @@ function tl(e) {
|
|
|
4312
4383
|
else for (const [e, n] of o) t.fact(`${e}: ${t.codespan("string" == typeof n ? n : JSON.stringify(n))}`);
|
|
4313
4384
|
return t.toLines().join("\n").trimEnd();
|
|
4314
4385
|
}
|
|
4315
|
-
function
|
|
4316
|
-
const n = t?.maxCells ?? 1e3, o =
|
|
4386
|
+
function sl(e, t) {
|
|
4387
|
+
const n = t?.maxCells ?? 1e3, o = ll(e) ? e.getValues() : e, r = o.length, s = o.reduce((e, t) => Math.max(e, t?.length ?? 0), 0), l = new ie();
|
|
4317
4388
|
if (l.h1("Values"), l.text(`Size: ${r}×${s}`), l.blank(), 0 === r || 0 === s) return l.text("None"), l.toLines().join("\n").trimEnd();
|
|
4318
4389
|
const a = L(r, Math.max(1, Math.floor(n / s))), i = r > a ? o.slice(0, a) : o, c = l.beginFrame(new Array(s).fill(""));
|
|
4319
|
-
for (const e of i) c.addRow(Array.from({ length: s }, (t, n) =>
|
|
4390
|
+
for (const e of i) c.addRow(Array.from({ length: s }, (t, n) => al(e?.[n])));
|
|
4320
4391
|
return c.endFrame(), i.length < r && l.text(`…truncated at ${i.length} of ${r} rows · slice or aggregate in the expression before returning it`), l.toLines().join("\n").trimEnd();
|
|
4321
4392
|
}
|
|
4322
|
-
var
|
|
4393
|
+
var ll = (e) => !!e && "object" == typeof e && !0 === e.isIRange, al = (e) => {
|
|
4323
4394
|
if (null == e) return { text: "" };
|
|
4324
4395
|
const t = (j(e)?.display ?? "").replace(/[\r\n]+/g, " ");
|
|
4325
4396
|
return "number" == typeof e ? {
|
|
4326
4397
|
text: t,
|
|
4327
4398
|
alignment: "right"
|
|
4328
4399
|
} : { text: t };
|
|
4329
|
-
},
|
|
4330
|
-
[
|
|
4331
|
-
[
|
|
4332
|
-
[
|
|
4333
|
-
[
|
|
4334
|
-
[
|
|
4400
|
+
}, il = l.Feature, cl = [
|
|
4401
|
+
[il.Font, "fonts"],
|
|
4402
|
+
[il.NumberFormat, "formats"],
|
|
4403
|
+
[il.Fill, "fills"],
|
|
4404
|
+
[il.Borders, "borders"],
|
|
4405
|
+
[il.Alignment, "alignments"]
|
|
4335
4406
|
];
|
|
4336
|
-
async function
|
|
4407
|
+
async function ul(e, t) {
|
|
4337
4408
|
const n = new ie();
|
|
4338
4409
|
n.h1(`Workbook — ${e.getName() ?? "Untitled"}`), n.text(`Locale: ${e.getRuntime().getLocale()}`);
|
|
4339
4410
|
const o = e.getCalculation();
|
|
4340
4411
|
o.getStatus() === r.Status.Off ? n.text("Calculation: off — formulas have not been evaluated; values are as loaded. wb.getCalculation().calculate() evaluates them") : o.getStatus() === r.Status.Error ? n.text("Calculation: error — the engine failed to start; values are as loaded. wb.getCalculation().start() tries again") : o.getCalculationMode() === r.CalculationMode.Manual && n.text("Calculation: manual — values are as of the last calculation. wb.getCalculation().calculate() refreshes them");
|
|
4341
|
-
const s =
|
|
4412
|
+
const s = Tr(e.getProtection());
|
|
4342
4413
|
s && n.text(`Protection: ${s}`), n.blank();
|
|
4343
4414
|
const l = e.getWorksheets().getItems({ visibility: m.Visibility.VeryHidden }), a = e.getSelectedSheet(), i = e.getStyles().getNormal(), c = [];
|
|
4344
4415
|
for (const e of l) {
|
|
4345
|
-
const t =
|
|
4416
|
+
const t = gl(e, i);
|
|
4346
4417
|
c.push({
|
|
4347
4418
|
sheet: e,
|
|
4348
|
-
label:
|
|
4419
|
+
label: wl(e, e.getId() === a.getId()),
|
|
4349
4420
|
counts: t.counts,
|
|
4350
4421
|
lines: t.lines,
|
|
4351
4422
|
formulaSignature: t.formulaSignature
|
|
@@ -4358,7 +4429,7 @@ async function al(e, t) {
|
|
|
4358
4429
|
t ? t.push(e) : u.set(e.formulaSignature, [e]);
|
|
4359
4430
|
}
|
|
4360
4431
|
for (const e of u.values()) if (!(e.length < 2)) for (const t of e) {
|
|
4361
|
-
const n = e.filter((e) => e !== t).map((e) =>
|
|
4432
|
+
const n = e.filter((e) => e !== t).map((e) => Ot(e.sheet.getName()));
|
|
4362
4433
|
t.lines.push({
|
|
4363
4434
|
label: "twin of",
|
|
4364
4435
|
extent: n.join(", "),
|
|
@@ -4385,15 +4456,15 @@ async function al(e, t) {
|
|
|
4385
4456
|
const p = e.getSheets({ visibility: m.Visibility.VeryHidden }).filter((e) => e.getKind() !== m.Kind.Worksheet);
|
|
4386
4457
|
if (p.length > 0) {
|
|
4387
4458
|
n.h2(`Other sheets (${p.length})`), n.blank();
|
|
4388
|
-
for (const e of p) n.text(` ${
|
|
4459
|
+
for (const e of p) n.text(` ${yl(e, e.getId() === a.getId())}`);
|
|
4389
4460
|
n.text(" Carried as read and saved unchanged; they have no cells · wb.getSheets() lists every tab"), n.blank();
|
|
4390
4461
|
}
|
|
4391
|
-
return
|
|
4392
|
-
describe: (e) =>
|
|
4462
|
+
return Sl(n, "Errors", c, il.Error), Sl(n, "Calc Failures", c, il.CalcError), Sl(n, "Circular References", c, il.Circular), Sl(n, "Anomalies", c, il.Anomalies, {
|
|
4463
|
+
describe: (e) => kt(il.Anomalies, null)(e) ?? "",
|
|
4393
4464
|
rank: (e) => -(e.getCell().getAnomalies()[0]?.rank ?? 0),
|
|
4394
|
-
include: (e) => !
|
|
4395
|
-
key:
|
|
4396
|
-
}), await
|
|
4465
|
+
include: (e) => !_(e.getCell().getAnomalies()),
|
|
4466
|
+
key: Nt
|
|
4467
|
+
}), await an(n, e.getNames().getItems({
|
|
4397
4468
|
type: "formula",
|
|
4398
4469
|
includeHidden: !0
|
|
4399
4470
|
}) ?? [], {
|
|
@@ -4401,29 +4472,29 @@ async function al(e, t) {
|
|
|
4401
4472
|
recovery: "wb.getNames() renders the full view",
|
|
4402
4473
|
omitUnread: !0,
|
|
4403
4474
|
symbols: e.getNames().getItems({ includeHidden: !0 }) ?? []
|
|
4404
|
-
}),
|
|
4475
|
+
}), bs(n, ys(e), t), n.toLines().join("\n").trimEnd();
|
|
4405
4476
|
}
|
|
4406
|
-
function
|
|
4477
|
+
function gl(e, t) {
|
|
4407
4478
|
const n = e.getUsedRange();
|
|
4408
4479
|
if (!n) return {
|
|
4409
4480
|
counts: null,
|
|
4410
4481
|
lines: [
|
|
4411
|
-
...
|
|
4412
|
-
...
|
|
4413
|
-
...
|
|
4482
|
+
...hl(e),
|
|
4483
|
+
...dl(e),
|
|
4484
|
+
...fl(e)
|
|
4414
4485
|
],
|
|
4415
4486
|
formulaRegions: 0,
|
|
4416
4487
|
formulaSignature: ""
|
|
4417
4488
|
};
|
|
4418
4489
|
const o = n.getCounts([
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
]), r = [], l =
|
|
4490
|
+
il.Contentful,
|
|
4491
|
+
il.Formula,
|
|
4492
|
+
il.Error,
|
|
4493
|
+
il.CalcError,
|
|
4494
|
+
il.Circular,
|
|
4495
|
+
il.Table,
|
|
4496
|
+
il.Anomalies
|
|
4497
|
+
]), r = [], l = Gt(n), a = [...n.getRegions(il.Formula)];
|
|
4427
4498
|
if (l.length > 0) {
|
|
4428
4499
|
const e = function(e, t) {
|
|
4429
4500
|
const n = nt(e, t);
|
|
@@ -4431,12 +4502,12 @@ function il(e, t) {
|
|
|
4431
4502
|
}(n, a);
|
|
4432
4503
|
r.push({
|
|
4433
4504
|
label: "content",
|
|
4434
|
-
extent:
|
|
4505
|
+
extent: pl(l),
|
|
4435
4506
|
detail: [
|
|
4436
|
-
|
|
4437
|
-
|
|
4507
|
+
$l(o[il.Contentful] ?? 0, "cell"),
|
|
4508
|
+
$l(l.length, "block"),
|
|
4438
4509
|
e,
|
|
4439
|
-
`${
|
|
4510
|
+
`${Pt(n)} lists the blocks`
|
|
4440
4511
|
].filter(Boolean).join(" · ")
|
|
4441
4512
|
});
|
|
4442
4513
|
}
|
|
@@ -4449,29 +4520,29 @@ function il(e, t) {
|
|
|
4449
4520
|
}
|
|
4450
4521
|
i = t.sort().join("\n"), r.push({
|
|
4451
4522
|
label: "formula",
|
|
4452
|
-
extent:
|
|
4523
|
+
extent: pl(a),
|
|
4453
4524
|
detail: [
|
|
4454
|
-
|
|
4455
|
-
|
|
4525
|
+
$l(o[il.Formula] ?? 0, "cell"),
|
|
4526
|
+
$l(a.length, "region"),
|
|
4456
4527
|
`${e.size} distinct`
|
|
4457
4528
|
].join(" · ")
|
|
4458
4529
|
});
|
|
4459
4530
|
}
|
|
4460
4531
|
for (const [e, t] of [
|
|
4461
|
-
[
|
|
4462
|
-
[
|
|
4463
|
-
[
|
|
4532
|
+
[il.Error, "errors"],
|
|
4533
|
+
[il.CalcError, "calc failures"],
|
|
4534
|
+
[il.Circular, "circular"]
|
|
4464
4535
|
]) {
|
|
4465
4536
|
const s = o[e] ?? 0;
|
|
4466
4537
|
if (0 === s) continue;
|
|
4467
4538
|
const l = [...n.getRegions(e)];
|
|
4468
4539
|
r.push({
|
|
4469
4540
|
label: t,
|
|
4470
|
-
extent:
|
|
4471
|
-
detail: [
|
|
4541
|
+
extent: pl(l),
|
|
4542
|
+
detail: [$l(s, "cell"), $l(l.length, "region")].join(" · ")
|
|
4472
4543
|
});
|
|
4473
4544
|
}
|
|
4474
|
-
const c = (o[
|
|
4545
|
+
const c = (o[il.Anomalies] ?? 0) > 0 ? [...n.getRegions(il.Anomalies)].filter((e) => !_(e.getCell().getAnomalies())) : [];
|
|
4475
4546
|
if (c.length > 0) {
|
|
4476
4547
|
const e = new Map([...P.keys()].map((e) => [e, 0]));
|
|
4477
4548
|
let t = 0;
|
|
@@ -4482,10 +4553,10 @@ function il(e, t) {
|
|
|
4482
4553
|
}
|
|
4483
4554
|
r.push({
|
|
4484
4555
|
label: "anomalies",
|
|
4485
|
-
extent:
|
|
4556
|
+
extent: pl(c),
|
|
4486
4557
|
detail: [
|
|
4487
|
-
|
|
4488
|
-
|
|
4558
|
+
$l(t, "cell"),
|
|
4559
|
+
$l(c.length, "region"),
|
|
4489
4560
|
...[...e].filter(([, e]) => e > 0).map(([e, t]) => `${e} ${t}`)
|
|
4490
4561
|
].join(" · ")
|
|
4491
4562
|
});
|
|
@@ -4493,27 +4564,27 @@ function il(e, t) {
|
|
|
4493
4564
|
const u = n.getTables();
|
|
4494
4565
|
u.length > 0 && r.push({
|
|
4495
4566
|
label: "tables",
|
|
4496
|
-
extent:
|
|
4567
|
+
extent: pl(u.map((e) => e.getRange())),
|
|
4497
4568
|
detail: [
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4569
|
+
$l(o[il.Table] ?? 0, "cell"),
|
|
4570
|
+
$l(u.length, "table"),
|
|
4571
|
+
ml(u.map((e) => e.getName()))
|
|
4501
4572
|
].join(" · ")
|
|
4502
4573
|
});
|
|
4503
4574
|
const g = e.getPivotTables().getItems();
|
|
4504
4575
|
g.length > 0 && r.push({
|
|
4505
4576
|
label: "pivots",
|
|
4506
4577
|
extent: String(g.length),
|
|
4507
|
-
detail:
|
|
4578
|
+
detail: ml(g.map((e) => e.getName()))
|
|
4508
4579
|
});
|
|
4509
|
-
const d =
|
|
4580
|
+
const d = Gs(e);
|
|
4510
4581
|
d.length > 0 && r.push({
|
|
4511
4582
|
label: "data tables",
|
|
4512
|
-
extent:
|
|
4513
|
-
detail:
|
|
4514
|
-
}), r.push(...
|
|
4583
|
+
extent: pl(d.map((e) => e.extent)),
|
|
4584
|
+
detail: ml(d.map((e) => e.extent.getAddress()))
|
|
4585
|
+
}), r.push(...hl(e));
|
|
4515
4586
|
const h = l.map((e) => e.getCoords()), f = [];
|
|
4516
|
-
for (const [n, o] of
|
|
4587
|
+
for (const [n, o] of cl) {
|
|
4517
4588
|
const r = et(e, n, t, { content: h })?.distinct ?? 0;
|
|
4518
4589
|
r > 0 && f.push(`${o} ${r}`);
|
|
4519
4590
|
}
|
|
@@ -4521,35 +4592,35 @@ function il(e, t) {
|
|
|
4521
4592
|
label: "style",
|
|
4522
4593
|
extent: n.toString(),
|
|
4523
4594
|
detail: f.join(" · ")
|
|
4524
|
-
}), r.push(...
|
|
4595
|
+
}), r.push(...dl(e)), r.push(...fl(e)), {
|
|
4525
4596
|
counts: o,
|
|
4526
4597
|
lines: r,
|
|
4527
4598
|
formulaRegions: a.length,
|
|
4528
4599
|
formulaSignature: i
|
|
4529
4600
|
};
|
|
4530
4601
|
}
|
|
4531
|
-
function
|
|
4532
|
-
const t =
|
|
4602
|
+
function dl(e) {
|
|
4603
|
+
const t = un(e);
|
|
4533
4604
|
return t ? [{
|
|
4534
4605
|
label: "outline",
|
|
4535
4606
|
extent: "",
|
|
4536
4607
|
detail: t
|
|
4537
4608
|
}] : [];
|
|
4538
4609
|
}
|
|
4539
|
-
function
|
|
4610
|
+
function hl(e) {
|
|
4540
4611
|
const t = [];
|
|
4541
|
-
for (const [n, o] of
|
|
4542
|
-
const r =
|
|
4612
|
+
for (const [n, o] of so(e.getMovables().getItems())) {
|
|
4613
|
+
const r = Qn(o), s = "chart" === n ? ml(o.map(to)) : r.length > 0 ? `${r.length} with text` : "";
|
|
4543
4614
|
t.push({
|
|
4544
|
-
label:
|
|
4615
|
+
label: ro(n).toLowerCase(),
|
|
4545
4616
|
extent: String(o.length),
|
|
4546
4617
|
detail: s
|
|
4547
4618
|
});
|
|
4548
4619
|
const l = r.slice(0, L(r.length, 5));
|
|
4549
4620
|
for (const e of l) t.push({
|
|
4550
4621
|
label: "",
|
|
4551
|
-
extent:
|
|
4552
|
-
detail:
|
|
4622
|
+
extent: Xn(e.movable),
|
|
4623
|
+
detail: Zn(e) + (e.movable.isHidden() ? " (hidden)" : "")
|
|
4553
4624
|
});
|
|
4554
4625
|
l.length < r.length && t.push({
|
|
4555
4626
|
label: "",
|
|
@@ -4559,15 +4630,15 @@ function ul(e) {
|
|
|
4559
4630
|
}
|
|
4560
4631
|
return t;
|
|
4561
4632
|
}
|
|
4562
|
-
function
|
|
4563
|
-
const t =
|
|
4633
|
+
function fl(e) {
|
|
4634
|
+
const t = Pr(e);
|
|
4564
4635
|
return t ? [{
|
|
4565
4636
|
label: "protected",
|
|
4566
4637
|
extent: t.extent,
|
|
4567
4638
|
detail: t.detail
|
|
4568
4639
|
}] : [];
|
|
4569
4640
|
}
|
|
4570
|
-
function
|
|
4641
|
+
function ml(e) {
|
|
4571
4642
|
const t = [];
|
|
4572
4643
|
let n = 0;
|
|
4573
4644
|
for (const o of e) {
|
|
@@ -4578,7 +4649,7 @@ function dl(e) {
|
|
|
4578
4649
|
const o = e.length - t.length;
|
|
4579
4650
|
return o > 0 ? `${t.join(", ")}, +${o} more` : t.join(", ");
|
|
4580
4651
|
}
|
|
4581
|
-
function
|
|
4652
|
+
function pl(t) {
|
|
4582
4653
|
let n = null;
|
|
4583
4654
|
for (const e of t) {
|
|
4584
4655
|
const t = e.getCoords();
|
|
@@ -4591,32 +4662,32 @@ function hl(t) {
|
|
|
4591
4662
|
}
|
|
4592
4663
|
return n ? e.rangeToString(n) ?? "" : "";
|
|
4593
4664
|
}
|
|
4594
|
-
var
|
|
4595
|
-
function
|
|
4665
|
+
var $l = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`;
|
|
4666
|
+
function wl(e, t) {
|
|
4596
4667
|
const n = e.getVisibility();
|
|
4597
4668
|
let o = "";
|
|
4598
|
-
return t && (o += " (selected)"), n === m.Visibility.Hidden ? o += " (hidden)" : n === m.Visibility.VeryHidden && (o += " (very hidden)"), e.getProtection().isLocked() && (o += " (protected)"), `${
|
|
4669
|
+
return t && (o += " (selected)"), n === m.Visibility.Hidden ? o += " (hidden)" : n === m.Visibility.VeryHidden && (o += " (very hidden)"), e.getProtection().isLocked() && (o += " (protected)"), `${Ot(e.getName())}${o}`;
|
|
4599
4670
|
}
|
|
4600
|
-
function
|
|
4671
|
+
function yl(e, t) {
|
|
4601
4672
|
const n = e.getKind(), o = n === m.Kind.Chart ? "chart sheet" : n === m.Kind.Macro ? "Excel 4.0 macro sheet" : "dialog sheet", r = e.getVisibility();
|
|
4602
4673
|
let s = ` (${o})`;
|
|
4603
|
-
return t && (s += " (selected)"), r === m.Visibility.Hidden ? s += " (hidden)" : r === m.Visibility.VeryHidden && (s += " (very hidden)"), `${
|
|
4674
|
+
return t && (s += " (selected)"), r === m.Visibility.Hidden ? s += " (hidden)" : r === m.Visibility.VeryHidden && (s += " (very hidden)"), `${Ot(e.getName())}${s}`;
|
|
4604
4675
|
}
|
|
4605
|
-
var
|
|
4606
|
-
function
|
|
4676
|
+
var bl = 6;
|
|
4677
|
+
function Sl(t, n, o, r, s) {
|
|
4607
4678
|
const l = s?.include;
|
|
4608
4679
|
let a = o.reduce((e, t) => e + (t.counts?.[r] ?? 0), 0);
|
|
4609
|
-
const i = r ===
|
|
4680
|
+
const i = r === il.Error ? o.flatMap((e) => function(e) {
|
|
4610
4681
|
const t = [];
|
|
4611
4682
|
for (const n of e.getMovables().getItems({ type: "chart" })) {
|
|
4612
|
-
const e =
|
|
4683
|
+
const e = mn(n);
|
|
4613
4684
|
if (e) for (const o of e.getSeries()) {
|
|
4614
|
-
const e =
|
|
4685
|
+
const e = Sn(o);
|
|
4615
4686
|
if (0 === e.length) continue;
|
|
4616
4687
|
const r = o.getName();
|
|
4617
4688
|
t.push({
|
|
4618
4689
|
movable: n,
|
|
4619
|
-
detail: `series ${r ? `"${
|
|
4690
|
+
detail: `series ${r ? `"${wn(r)}"` : "(unnamed)"} ${e.join(" · ")}`
|
|
4620
4691
|
});
|
|
4621
4692
|
}
|
|
4622
4693
|
}
|
|
@@ -4626,12 +4697,12 @@ function wl(t, n, o, r, s) {
|
|
|
4626
4697
|
l && (a = 0);
|
|
4627
4698
|
const c = [];
|
|
4628
4699
|
let u = 0;
|
|
4629
|
-
const g = s?.describe ??
|
|
4700
|
+
const g = s?.describe ?? xl, d = s?.rank, h = [];
|
|
4630
4701
|
for (const e of o) {
|
|
4631
4702
|
if (!e.counts?.[r]) continue;
|
|
4632
4703
|
const t = e.sheet.getUsedRange();
|
|
4633
4704
|
if (!t) continue;
|
|
4634
|
-
const n =
|
|
4705
|
+
const n = Ot(e.sheet.getName());
|
|
4635
4706
|
for (const e of t.getRegions(r)) {
|
|
4636
4707
|
if (l) {
|
|
4637
4708
|
if (!l(e)) continue;
|
|
@@ -4660,7 +4731,7 @@ function wl(t, n, o, r, s) {
|
|
|
4660
4731
|
for (const t of e.slice(0, 20)) {
|
|
4661
4732
|
const { region: e, sheetName: n } = t[0], o = t.slice(1);
|
|
4662
4733
|
f += o.length;
|
|
4663
|
-
const r = 0 === o.length ? "" : ` · also at ${o.slice(0,
|
|
4734
|
+
const r = 0 === o.length ? "" : ` · also at ${o.slice(0, bl).map((e) => `${e.sheetName}!${e.region.toString()}`).join(", ")}${o.length > bl ? ` +${o.length - bl} more` : ""}`;
|
|
4664
4735
|
c.push({
|
|
4665
4736
|
address: `${n}!${e.toString()}`,
|
|
4666
4737
|
size: `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
@@ -4672,7 +4743,7 @@ function wl(t, n, o, r, s) {
|
|
|
4672
4743
|
for (const { movable: t, detail: n } of m) {
|
|
4673
4744
|
const o = t.getRange();
|
|
4674
4745
|
c.push({
|
|
4675
|
-
address: `${
|
|
4746
|
+
address: `${Ot(o.getWorksheet().getName())}!${e.rangeToString(o.getCoords()) ?? ""}`,
|
|
4676
4747
|
size: "chart",
|
|
4677
4748
|
payload: `${t.getContent().getName?.() || "(unnamed)"} · ${n}`
|
|
4678
4749
|
});
|
|
@@ -4685,22 +4756,22 @@ function wl(t, n, o, r, s) {
|
|
|
4685
4756
|
const y = c.length - m.length + f;
|
|
4686
4757
|
u > y && t.text(` …and ${u - y} more · getRegions('${r}') on a sheet's used range lists the rest`), i.length > m.length && t.text(` …and ${i.length - m.length} more in charts · a sheet's report lists its charts under Charts`), t.blank();
|
|
4687
4758
|
}
|
|
4688
|
-
function
|
|
4759
|
+
function xl(e) {
|
|
4689
4760
|
const t = e.getCell(), n = N(t, v.Mode.Display)?.display ?? "", o = t.getFormulaText();
|
|
4690
4761
|
if (!o) return n;
|
|
4691
|
-
const r =
|
|
4762
|
+
const r = Er(vr(t.getFormula()?.getTokens() ?? [], t.getWorksheet().getWorkbook()));
|
|
4692
4763
|
return [`${n} ${o}`.trim(), r].filter(Boolean).join(" · ");
|
|
4693
4764
|
}
|
|
4694
|
-
var
|
|
4765
|
+
var kl = (e, t) => !!e && "object" == typeof e && !0 === e[t], Cl = {
|
|
4695
4766
|
kind: "protectedRanges",
|
|
4696
|
-
is: (e) =>
|
|
4767
|
+
is: (e) => kl(e, "isIProtectedRangeCollection"),
|
|
4697
4768
|
render: (e) => {
|
|
4698
4769
|
const t = e.getItems();
|
|
4699
|
-
return 0 === t.length ? "# Unlocked Ranges (0)\nNone" : t.slice(0,
|
|
4770
|
+
return 0 === t.length ? "# Unlocked Ranges (0)\nNone" : t.slice(0, Rl).map(Ur).concat(t.length > Rl ? [`…and ${t.length - Rl} more · render one at a time to see them`] : []).join("\n\n");
|
|
4700
4771
|
}
|
|
4701
|
-
},
|
|
4702
|
-
function
|
|
4703
|
-
const t =
|
|
4772
|
+
}, vl = 2;
|
|
4773
|
+
function El(e) {
|
|
4774
|
+
const t = Il(e);
|
|
4704
4775
|
if (!t) return null;
|
|
4705
4776
|
let n;
|
|
4706
4777
|
try {
|
|
@@ -4712,175 +4783,175 @@ function kl(e) {
|
|
|
4712
4783
|
const o = n.split("\n").map((e) => e.trim()).filter(Boolean);
|
|
4713
4784
|
if (0 === o.length) return null;
|
|
4714
4785
|
const r = o[0].replace(/^#+\s*/, ""), s = o.slice(1);
|
|
4715
|
-
return s.length <=
|
|
4786
|
+
return s.length <= vl ? [r, ...s].join(" · ") : `${r} · ${s.length} more lines — return it on its own`;
|
|
4716
4787
|
}
|
|
4717
|
-
var
|
|
4788
|
+
var Rl = 20, Nl = [
|
|
4718
4789
|
{
|
|
4719
4790
|
kind: "workbook",
|
|
4720
|
-
is: (e) =>
|
|
4721
|
-
render: (e, t) =>
|
|
4791
|
+
is: (e) => kl(e, "isIWorkbook"),
|
|
4792
|
+
render: (e, t) => ul(e, t)
|
|
4722
4793
|
},
|
|
4723
4794
|
{
|
|
4724
4795
|
kind: "sheet",
|
|
4725
|
-
is: (e) =>
|
|
4726
|
-
render: (e, t) =>
|
|
4796
|
+
is: (e) => kl(e, "isIWorksheet"),
|
|
4797
|
+
render: (e, t) => Qs(e, t)
|
|
4727
4798
|
},
|
|
4728
4799
|
{
|
|
4729
4800
|
kind: "cell",
|
|
4730
|
-
is: (e) =>
|
|
4731
|
-
render: (e, t) =>
|
|
4801
|
+
is: (e) => kl(e, "isICell"),
|
|
4802
|
+
render: (e, t) => Jr(e, t)
|
|
4732
4803
|
},
|
|
4733
4804
|
{
|
|
4734
4805
|
kind: "names",
|
|
4735
|
-
is: (e) =>
|
|
4736
|
-
render: (e, t) =>
|
|
4806
|
+
is: (e) => kl(e, "isINamedCollection"),
|
|
4807
|
+
render: (e, t) => vs(e, t)
|
|
4737
4808
|
},
|
|
4738
4809
|
{
|
|
4739
4810
|
kind: "modules",
|
|
4740
|
-
is: (e) =>
|
|
4741
|
-
render: (e, t) =>
|
|
4811
|
+
is: (e) => kl(e, "isIModuleCollection"),
|
|
4812
|
+
render: (e, t) => ks(e, t)
|
|
4742
4813
|
},
|
|
4743
4814
|
{
|
|
4744
4815
|
kind: "module",
|
|
4745
|
-
is: (e) =>
|
|
4746
|
-
render: (e, t) =>
|
|
4816
|
+
is: (e) => kl(e, "isIModule"),
|
|
4817
|
+
render: (e, t) => xs(e, t)
|
|
4747
4818
|
},
|
|
4748
4819
|
{
|
|
4749
4820
|
kind: "formula",
|
|
4750
|
-
is: (e) =>
|
|
4751
|
-
render: (e, t) =>
|
|
4821
|
+
is: (e) => kl(e, "isIFormula"),
|
|
4822
|
+
render: (e, t) => hs(e, t)
|
|
4752
4823
|
},
|
|
4753
4824
|
{
|
|
4754
4825
|
kind: "table",
|
|
4755
|
-
is: (e) =>
|
|
4826
|
+
is: (e) => kl(e, "isITable"),
|
|
4756
4827
|
render: (e) => fe(e)
|
|
4757
4828
|
},
|
|
4758
4829
|
{
|
|
4759
4830
|
kind: "movable",
|
|
4760
|
-
is: (e) =>
|
|
4761
|
-
render: (e) =>
|
|
4831
|
+
is: (e) => kl(e, "isIMovable"),
|
|
4832
|
+
render: (e) => io(e)
|
|
4762
4833
|
},
|
|
4763
4834
|
{
|
|
4764
4835
|
kind: "shape",
|
|
4765
|
-
is: (e) =>
|
|
4766
|
-
render: (e) =>
|
|
4836
|
+
is: (e) => kl(e, "isIShape"),
|
|
4837
|
+
render: (e) => co(e)
|
|
4767
4838
|
},
|
|
4768
4839
|
{
|
|
4769
4840
|
kind: "conditionalFormat",
|
|
4770
|
-
is: (e) =>
|
|
4771
|
-
render: (e) =>
|
|
4841
|
+
is: (e) => kl(e, "isIConditionalFormat"),
|
|
4842
|
+
render: (e) => ts(e)
|
|
4772
4843
|
},
|
|
4773
4844
|
{
|
|
4774
4845
|
kind: "dataValidation",
|
|
4775
|
-
is: (e) =>
|
|
4776
|
-
render: (e) =>
|
|
4846
|
+
is: (e) => kl(e, "isIDataValidation"),
|
|
4847
|
+
render: (e) => os(e)
|
|
4777
4848
|
},
|
|
4778
4849
|
{
|
|
4779
4850
|
kind: "protection",
|
|
4780
|
-
is: (e) =>
|
|
4781
|
-
render: (e) =>
|
|
4851
|
+
is: (e) => kl(e, "isIWorksheetProtection") || kl(e, "isIWorkbookProtection"),
|
|
4852
|
+
render: (e) => zr(e)
|
|
4782
4853
|
},
|
|
4783
|
-
|
|
4854
|
+
Cl,
|
|
4784
4855
|
{
|
|
4785
4856
|
kind: "protectedRange",
|
|
4786
|
-
is: (e) =>
|
|
4787
|
-
render: (e) =>
|
|
4857
|
+
is: (e) => kl(e, "isIProtectedRange"),
|
|
4858
|
+
render: (e) => Ur(e)
|
|
4788
4859
|
},
|
|
4789
4860
|
{
|
|
4790
4861
|
kind: "pageLayout",
|
|
4791
|
-
is: (e) =>
|
|
4792
|
-
render: (e) =>
|
|
4862
|
+
is: (e) => kl(e, "isIPageLayout"),
|
|
4863
|
+
render: (e) => Ds(e)
|
|
4793
4864
|
},
|
|
4794
4865
|
{
|
|
4795
4866
|
kind: "stats",
|
|
4796
|
-
is: (e) =>
|
|
4797
|
-
render: (e) =>
|
|
4867
|
+
is: (e) => kl(e, "isIRangeStats"),
|
|
4868
|
+
render: (e) => nl(e)
|
|
4798
4869
|
},
|
|
4799
4870
|
{
|
|
4800
4871
|
kind: "counts",
|
|
4801
|
-
is: (e) =>
|
|
4802
|
-
render: (e) =>
|
|
4872
|
+
is: (e) => kl(e, "isICellRangeCounts"),
|
|
4873
|
+
render: (e) => ns(e)
|
|
4803
4874
|
},
|
|
4804
4875
|
{
|
|
4805
4876
|
kind: "style",
|
|
4806
|
-
is: (e) =>
|
|
4807
|
-
render: (e) =>
|
|
4877
|
+
is: (e) => kl(e, "isICellStyle"),
|
|
4878
|
+
render: (e) => rl(e)
|
|
4808
4879
|
},
|
|
4809
4880
|
{
|
|
4810
4881
|
kind: "regions",
|
|
4811
|
-
is: (e) =>
|
|
4812
|
-
render: (e, t) =>
|
|
4882
|
+
is: (e) => kl(e, "isICellRegions"),
|
|
4883
|
+
render: (e, t) => jt(e, t)
|
|
4813
4884
|
},
|
|
4814
4885
|
{
|
|
4815
4886
|
kind: "cellRange",
|
|
4816
|
-
is: (e) =>
|
|
4817
|
-
render: (e, t) =>
|
|
4887
|
+
is: (e) => kl(e, "isICellRange"),
|
|
4888
|
+
render: (e, t) => Zr(e, t)
|
|
4818
4889
|
},
|
|
4819
4890
|
{
|
|
4820
4891
|
kind: "ranges",
|
|
4821
|
-
is: (e) =>
|
|
4822
|
-
render: (e, t) =>
|
|
4892
|
+
is: (e) => kl(e, "isICellRanges"),
|
|
4893
|
+
render: (e, t) => Js(e, t)
|
|
4823
4894
|
},
|
|
4824
4895
|
{
|
|
4825
4896
|
kind: "range",
|
|
4826
|
-
is: (e) =>
|
|
4827
|
-
render: (e, t) =>
|
|
4897
|
+
is: (e) => kl(e, "isIRange"),
|
|
4898
|
+
render: (e, t) => sl(e, t)
|
|
4828
4899
|
},
|
|
4829
4900
|
{
|
|
4830
4901
|
kind: "values",
|
|
4831
4902
|
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Array.isArray(e)),
|
|
4832
|
-
render: (e, t) =>
|
|
4903
|
+
render: (e, t) => sl(e, t)
|
|
4833
4904
|
},
|
|
4834
4905
|
{
|
|
4835
4906
|
kind: "records",
|
|
4836
|
-
is: (e) => Array.isArray(e) && e.length > 0 && e.every(
|
|
4837
|
-
render: (e, t) =>
|
|
4907
|
+
is: (e) => Array.isArray(e) && e.length > 0 && e.every(Hs),
|
|
4908
|
+
render: (e, t) => Vs(e, {
|
|
4838
4909
|
...t,
|
|
4839
|
-
nested:
|
|
4910
|
+
nested: El
|
|
4840
4911
|
})
|
|
4841
4912
|
},
|
|
4842
4913
|
{
|
|
4843
4914
|
kind: "record",
|
|
4844
|
-
is: (e) =>
|
|
4845
|
-
render: (e, t) =>
|
|
4915
|
+
is: (e) => Hs(e),
|
|
4916
|
+
render: (e, t) => Vs(e, {
|
|
4846
4917
|
...t,
|
|
4847
|
-
nested:
|
|
4918
|
+
nested: El
|
|
4848
4919
|
})
|
|
4849
4920
|
},
|
|
4850
4921
|
{
|
|
4851
4922
|
kind: "items",
|
|
4852
|
-
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!
|
|
4923
|
+
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!Il(e)),
|
|
4853
4924
|
render: async (e, t) => {
|
|
4854
|
-
const n = e.length >
|
|
4855
|
-
for (const e of n) o.push(await
|
|
4925
|
+
const n = e.length > Rl ? e.slice(0, Rl) : e, o = [];
|
|
4926
|
+
for (const e of n) o.push(await Il(e).render(e, t));
|
|
4856
4927
|
return n.length < e.length && o.push(`…and ${e.length - n.length} more · render one at a time to see them`), o.join("\n\n");
|
|
4857
4928
|
}
|
|
4858
4929
|
}
|
|
4859
|
-
],
|
|
4930
|
+
], jl = Nl.map((e) => e.kind), Ml = class extends Error {
|
|
4860
4931
|
constructor(e) {
|
|
4861
4932
|
super(e), this.name = "NoRendererError";
|
|
4862
4933
|
}
|
|
4863
4934
|
};
|
|
4864
|
-
function
|
|
4865
|
-
for (const t of
|
|
4935
|
+
function Il(e) {
|
|
4936
|
+
for (const t of Nl) if (t.is(e)) return t;
|
|
4866
4937
|
return null;
|
|
4867
4938
|
}
|
|
4868
|
-
async function
|
|
4939
|
+
async function Fl(e, t, n) {
|
|
4869
4940
|
await e?.getCalculation().ready();
|
|
4870
|
-
let o =
|
|
4941
|
+
let o = Il(t), r = t;
|
|
4871
4942
|
if (!o && r && "object" == typeof r && !Array.isArray(r) && "function" == typeof r[Symbol.iterator]) {
|
|
4872
4943
|
const e = [];
|
|
4873
4944
|
for (const t of r) if (e.push(t), e.length >= 1e3) break;
|
|
4874
|
-
r = e, o =
|
|
4945
|
+
r = e, o = Il(r);
|
|
4875
4946
|
}
|
|
4876
|
-
if (!o) throw new
|
|
4947
|
+
if (!o) throw new Ml(`No markdown renderer for this value. Renderable kinds: ${jl.join(", ")}.`);
|
|
4877
4948
|
const s = e?.getCalculation() ?? null;
|
|
4878
4949
|
let l = await o.render(r, n);
|
|
4879
|
-
for (let e = 0; e <
|
|
4950
|
+
for (let e = 0; e < Tl && "calculating" === s?.getCalculationState(); e++) await s.ready(), l = await o.render(r, n);
|
|
4880
4951
|
return l;
|
|
4881
4952
|
}
|
|
4882
|
-
var
|
|
4883
|
-
async function
|
|
4953
|
+
var Tl = 2;
|
|
4954
|
+
async function Al(e, t, n) {
|
|
4884
4955
|
if (void 0 === t) return {
|
|
4885
4956
|
text: void 0,
|
|
4886
4957
|
rendered: !0
|
|
@@ -4891,11 +4962,11 @@ async function Fl(e, t, n) {
|
|
|
4891
4962
|
};
|
|
4892
4963
|
if (null !== t && "object" == typeof t) try {
|
|
4893
4964
|
return {
|
|
4894
|
-
text: await
|
|
4965
|
+
text: await Fl(e, t, n),
|
|
4895
4966
|
rendered: !0
|
|
4896
4967
|
};
|
|
4897
4968
|
} catch (e) {
|
|
4898
|
-
if (!(e instanceof
|
|
4969
|
+
if (!(e instanceof Ml)) throw e;
|
|
4899
4970
|
}
|
|
4900
4971
|
return function(e) {
|
|
4901
4972
|
if (null === e) return {
|
|
@@ -4935,8 +5006,8 @@ async function Fl(e, t, n) {
|
|
|
4935
5006
|
};
|
|
4936
5007
|
}(t);
|
|
4937
5008
|
}
|
|
4938
|
-
var
|
|
4939
|
-
async function
|
|
5009
|
+
var Ll = l.Feature;
|
|
5010
|
+
async function Wl(e, t, n) {
|
|
4940
5011
|
const o = e.getChanges(t);
|
|
4941
5012
|
if (0 === o.length) return null;
|
|
4942
5013
|
const r = n?.maxEntries ?? 20, s = n?.maxBlockValues ?? 8, l = /* @__PURE__ */ new Map();
|
|
@@ -4950,9 +5021,9 @@ async function Tl(e, t, n) {
|
|
|
4950
5021
|
const a = [], i = [];
|
|
4951
5022
|
let c = 0;
|
|
4952
5023
|
for (const [e, { data: t, style: n }] of l) {
|
|
4953
|
-
const o = t ?
|
|
5024
|
+
const o = t ? Pl(t) : null;
|
|
4954
5025
|
o && i.push(o);
|
|
4955
|
-
const l =
|
|
5026
|
+
const l = Ol(e, t ?? null, o, n ?? null, r, s);
|
|
4956
5027
|
a.push(l.sheet), c += l.cleared;
|
|
4957
5028
|
}
|
|
4958
5029
|
const u = await async function(e) {
|
|
@@ -4964,15 +5035,15 @@ async function Tl(e, t, n) {
|
|
|
4964
5035
|
if (0 === t.length) return null;
|
|
4965
5036
|
if (1 === t.length) return t[0];
|
|
4966
5037
|
const n = [];
|
|
4967
|
-
for (const e of t)
|
|
5038
|
+
for (const e of t) Vl(e, n, !0);
|
|
4968
5039
|
return t[0].getWorksheet().getRanges(n);
|
|
4969
5040
|
}(i), g = [];
|
|
4970
|
-
for (const e of i)
|
|
4971
|
-
u &&
|
|
5041
|
+
for (const e of i) Vl(e, g);
|
|
5042
|
+
u && Vl(u, g);
|
|
4972
5043
|
const d = function(e) {
|
|
4973
5044
|
const t = /* @__PURE__ */ new Set(), n = [];
|
|
4974
|
-
for (const o of e) if (0 !== (o.getCounts([
|
|
4975
|
-
const r =
|
|
5045
|
+
for (const o of e) if (0 !== (o.getCounts([Ll.Error])[Ll.Error] ?? 0)) for (const e of o.getRegions(Ll.Error)) {
|
|
5046
|
+
const r = Ht(o.getWorksheet().getRanges(e.getAddress()));
|
|
4976
5047
|
t.has(r) || (t.add(r), n.push({
|
|
4977
5048
|
address: r,
|
|
4978
5049
|
error: N(e.getCell(), v.Mode.Display)?.display ?? "",
|
|
@@ -4984,17 +5055,17 @@ async function Tl(e, t, n) {
|
|
|
4984
5055
|
return {
|
|
4985
5056
|
commitId: o[0].getCommit().getId(),
|
|
4986
5057
|
sheets: a,
|
|
4987
|
-
dependents: u ?
|
|
5058
|
+
dependents: u ? Bl(u, r) : null,
|
|
4988
5059
|
errors: d.slice(0, h),
|
|
4989
5060
|
errorsMore: d.length - h,
|
|
4990
5061
|
errorsCleared: c,
|
|
4991
|
-
touches:
|
|
5062
|
+
touches: zl(i, u)
|
|
4992
5063
|
};
|
|
4993
5064
|
}
|
|
4994
|
-
function
|
|
5065
|
+
function Ol(e, t, n, o, r, s) {
|
|
4995
5066
|
const l = o?.getRanges() ?? null, a = {
|
|
4996
|
-
sheet:
|
|
4997
|
-
written: n ?
|
|
5067
|
+
sheet: Ot(e.getName()),
|
|
5068
|
+
written: n ? Ht(n) : null,
|
|
4998
5069
|
cells: 0,
|
|
4999
5070
|
formulas: 0,
|
|
5000
5071
|
values: 0,
|
|
@@ -5011,11 +5082,11 @@ function Al(e, t, n, o, r, s) {
|
|
|
5011
5082
|
return {
|
|
5012
5083
|
kind: t.getKind(),
|
|
5013
5084
|
axis: r,
|
|
5014
|
-
address: l.length > 0 ?
|
|
5085
|
+
address: l.length > 0 ? Ht(e.getRanges(l)) : null,
|
|
5015
5086
|
whole: s
|
|
5016
5087
|
};
|
|
5017
5088
|
}(e, t)) : [],
|
|
5018
|
-
styles: l ?
|
|
5089
|
+
styles: l ? Ht(l) : null,
|
|
5019
5090
|
blocks: [],
|
|
5020
5091
|
blocksMore: 0
|
|
5021
5092
|
};
|
|
@@ -5023,42 +5094,42 @@ function Al(e, t, n, o, r, s) {
|
|
|
5023
5094
|
sheet: a,
|
|
5024
5095
|
cleared: 0
|
|
5025
5096
|
};
|
|
5026
|
-
const i = n.getCounts([
|
|
5097
|
+
const i = n.getCounts([Ll.Contentful, Ll.Formula]);
|
|
5027
5098
|
let c = 0;
|
|
5028
5099
|
for (let e = 0; e < n.length; e++) {
|
|
5029
5100
|
const t = n.at(e);
|
|
5030
5101
|
c += t.getRowCount() * t.getColumnCount();
|
|
5031
5102
|
}
|
|
5032
|
-
a.cells = c, a.formulas = i[
|
|
5103
|
+
a.cells = c, a.formulas = i[Ll.Formula] ?? 0, a.values = (i[Ll.Contentful] ?? 0) - a.formulas, a.cleared = c - (i[Ll.Contentful] ?? 0);
|
|
5033
5104
|
let u = 0;
|
|
5034
5105
|
const g = t.getPreviousRanges();
|
|
5035
5106
|
if (g) {
|
|
5036
|
-
const t = g.getCounts([
|
|
5107
|
+
const t = g.getCounts([Ll.Contentful, Ll.Formula]);
|
|
5037
5108
|
a.replaced = {
|
|
5038
|
-
populated: t[
|
|
5039
|
-
formulas: t[
|
|
5109
|
+
populated: t[Ll.Contentful] ?? 0,
|
|
5110
|
+
formulas: t[Ll.Formula] ?? 0
|
|
5040
5111
|
}, u = function(e, t) {
|
|
5041
5112
|
let n = 0;
|
|
5042
|
-
for (let o = 0; o < e.length; o++) for (const r of e.at(o).getRegions(
|
|
5113
|
+
for (let o = 0; o < e.length; o++) for (const r of e.at(o).getRegions(Ll.Error)) {
|
|
5043
5114
|
const e = t.getRange(r.getCoords());
|
|
5044
|
-
n += r.getRowCount() * r.getColumnCount() - (e.getCounts([
|
|
5115
|
+
n += r.getRowCount() * r.getColumnCount() - (e.getCounts([Ll.Error])[Ll.Error] ?? 0);
|
|
5045
5116
|
}
|
|
5046
5117
|
return n;
|
|
5047
5118
|
}(g, e);
|
|
5048
5119
|
}
|
|
5049
5120
|
const d = [];
|
|
5050
5121
|
let h = 0;
|
|
5051
|
-
for (let e = 0; e < n.length; e++) for (const t of n.at(e).getRegions(
|
|
5122
|
+
for (let e = 0; e < n.length; e++) for (const t of n.at(e).getRegions(Ll.Formula)) h++, d.length < r && d.push(Hl(t.getRange(), s));
|
|
5052
5123
|
if (h > d.length && h <= L(h, r)) {
|
|
5053
5124
|
d.length = 0;
|
|
5054
|
-
for (let e = 0; e < n.length; e++) for (const t of n.at(e).getRegions(
|
|
5125
|
+
for (let e = 0; e < n.length; e++) for (const t of n.at(e).getRegions(Ll.Formula)) d.push(Hl(t.getRange(), s));
|
|
5055
5126
|
}
|
|
5056
5127
|
return a.blocks = d, a.blocksMore = h - d.length, {
|
|
5057
5128
|
sheet: a,
|
|
5058
5129
|
cleared: u
|
|
5059
5130
|
};
|
|
5060
5131
|
}
|
|
5061
|
-
function
|
|
5132
|
+
function Pl(e) {
|
|
5062
5133
|
const t = e.getRanges(), n = e.getShifts();
|
|
5063
5134
|
if (!t || 0 === n.length) return t;
|
|
5064
5135
|
const o = e.getSheet(), r = [], s = [];
|
|
@@ -5072,40 +5143,40 @@ function Ll(e) {
|
|
|
5072
5143
|
const l = [];
|
|
5073
5144
|
for (let e = 0; e < t.length; e++) {
|
|
5074
5145
|
const n = t.at(e);
|
|
5075
|
-
r.some((e) =>
|
|
5146
|
+
r.some((e) => Dl(e, n.getCoords())) || l.push(n);
|
|
5076
5147
|
}
|
|
5077
|
-
for (const e of s) for (const t of o.getRange(e).getRegions(
|
|
5148
|
+
for (const e of s) for (const t of o.getRange(e).getRegions(Ll.Contentful)) l.push(t.getRange());
|
|
5078
5149
|
return l.length > 0 ? o.getRanges(l) : null;
|
|
5079
5150
|
}
|
|
5080
|
-
var
|
|
5081
|
-
function
|
|
5151
|
+
var Dl = (e, t) => t.rowStart >= e.rowStart && t.rowEnd <= e.rowEnd && t.colStart >= e.colStart && t.colEnd <= e.colEnd;
|
|
5152
|
+
function Hl(e, t) {
|
|
5082
5153
|
const n = e.getRowCount() * e.getColumnCount(), o = n > t, r = [];
|
|
5083
5154
|
let s = null;
|
|
5084
5155
|
return e.forEach((e, t) => {
|
|
5085
5156
|
const n = N(t.getCell(), v.Mode.Display)?.display ?? "";
|
|
5086
5157
|
!o || r.length < 3 ? r.push(n) : s = n;
|
|
5087
5158
|
}), o && null !== s && r.push(s), {
|
|
5088
|
-
address:
|
|
5159
|
+
address: Ht(e.getWorksheet().getRanges(e.getAddress())),
|
|
5089
5160
|
formula: e.getCell().getFormulaText() ?? "",
|
|
5090
5161
|
cells: n,
|
|
5091
5162
|
values: r,
|
|
5092
5163
|
sampled: o
|
|
5093
5164
|
};
|
|
5094
5165
|
}
|
|
5095
|
-
function
|
|
5166
|
+
function Vl(e, t, n = !1) {
|
|
5096
5167
|
for (let o = 0; o < e.length; o++) {
|
|
5097
5168
|
const r = e.at(o);
|
|
5098
5169
|
!n && r.isINamedRange || t.push(r);
|
|
5099
5170
|
}
|
|
5100
5171
|
}
|
|
5101
|
-
function
|
|
5172
|
+
function Bl(e, t) {
|
|
5102
5173
|
const n = /* @__PURE__ */ new Map(), o = [];
|
|
5103
|
-
|
|
5174
|
+
Vl(e, o);
|
|
5104
5175
|
let r = 0;
|
|
5105
5176
|
for (const e of o) {
|
|
5106
|
-
const t = e.getCounts([
|
|
5177
|
+
const t = e.getCounts([Ll.Contentful])[Ll.Contentful] ?? 0;
|
|
5107
5178
|
r += t;
|
|
5108
|
-
const o =
|
|
5179
|
+
const o = Ot(e.getWorksheet().getName());
|
|
5109
5180
|
n.set(o, (n.get(o) ?? 0) + t);
|
|
5110
5181
|
}
|
|
5111
5182
|
const s = L(o.length, t);
|
|
@@ -5115,20 +5186,20 @@ function Dl(e, t) {
|
|
|
5115
5186
|
sheet: e,
|
|
5116
5187
|
cells: t
|
|
5117
5188
|
})),
|
|
5118
|
-
areas: o.slice(0, s).map((e) =>
|
|
5189
|
+
areas: o.slice(0, s).map((e) => Ht(e.getWorksheet().getRanges(e.getAddress()))),
|
|
5119
5190
|
areasMore: o.length - s
|
|
5120
5191
|
};
|
|
5121
5192
|
}
|
|
5122
|
-
function
|
|
5193
|
+
function zl(e, t) {
|
|
5123
5194
|
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map(), l = (e) => {
|
|
5124
|
-
for (const t of
|
|
5125
|
-
for (const t of e.getConditionalFormats()) o.add(
|
|
5126
|
-
for (const t of e.getDataValidations()) r.add(
|
|
5195
|
+
for (const t of dn(e)) n.add(Qt(t));
|
|
5196
|
+
for (const t of e.getConditionalFormats()) o.add(Ht(t.getRanges()));
|
|
5197
|
+
for (const t of e.getDataValidations()) r.add(Ht(t.getRanges()));
|
|
5127
5198
|
};
|
|
5128
5199
|
for (const n of e) for (let e = 0; e < n.length; e++) {
|
|
5129
5200
|
const o = n.at(e);
|
|
5130
5201
|
l(o);
|
|
5131
|
-
for (const e of
|
|
5202
|
+
for (const e of Fn(o, t)) s.has(e.movable) || s.set(e.movable, e);
|
|
5132
5203
|
}
|
|
5133
5204
|
for (let e = 0; e < (t?.length ?? 0); e++) {
|
|
5134
5205
|
const o = t.at(e);
|
|
@@ -5138,66 +5209,66 @@ function Hl(e, t) {
|
|
|
5138
5209
|
names: [...n],
|
|
5139
5210
|
conditionalFormats: [...o],
|
|
5140
5211
|
dataValidations: [...r],
|
|
5141
|
-
charts: Array.from(s.values(),
|
|
5212
|
+
charts: Array.from(s.values(), Tn)
|
|
5142
5213
|
};
|
|
5143
5214
|
}
|
|
5144
|
-
var
|
|
5145
|
-
function
|
|
5215
|
+
var Ul = (e, t, n = `${t}s`) => `${e} ${1 === e ? t : n}`, _l = (e, t) => `${`${e}:`.padEnd(14)}${t}`;
|
|
5216
|
+
function Jl(e) {
|
|
5146
5217
|
const t = [];
|
|
5147
5218
|
for (const n of e.sheets) {
|
|
5148
5219
|
if (n.written) {
|
|
5149
|
-
t.push(
|
|
5150
|
-
for (const e of n.blocks) t.push(` ${
|
|
5151
|
-
n.blocksMore > 0 && t.push(` +${
|
|
5220
|
+
t.push(_l("Changed", `${n.written} — ${ql(n)}`));
|
|
5221
|
+
for (const e of n.blocks) t.push(` ${Gl(e)}`);
|
|
5222
|
+
n.blocksMore > 0 && t.push(` +${Ul(n.blocksMore, "more formula block")}`);
|
|
5152
5223
|
}
|
|
5153
|
-
n.shifts.length > 0 && t.push(
|
|
5224
|
+
n.shifts.length > 0 && t.push(_l("Structure", n.shifts.map((e) => Kl(n.sheet, e)).join(" · "))), n.styles && t.push(_l("Formatting", n.styles));
|
|
5154
5225
|
}
|
|
5155
5226
|
const n = e.dependents;
|
|
5156
5227
|
if (n) {
|
|
5157
|
-
const e = n.sheets.length > 1 ? ` on ${
|
|
5158
|
-
t.push(
|
|
5228
|
+
const e = n.sheets.length > 1 ? ` on ${Ul(n.sheets.length, "sheet")}` : "";
|
|
5229
|
+
t.push(_l("Dependents", `${Ul(n.cells, "cell")}${e} — ${n.areas.join(", ")}${((e) => e > 0 ? ` · +${e} more` : "")(n.areasMore)}`));
|
|
5159
5230
|
}
|
|
5160
5231
|
if (e.errors.length > 0 || e.errorsCleared > 0) {
|
|
5161
5232
|
const n = e.errors.map((e) => `${e.address} ${e.error} (${e.cells})`);
|
|
5162
|
-
e.errorsMore > 0 && n.push(`+${e.errorsMore} more`), e.errorsCleared > 0 && n.push(`${
|
|
5233
|
+
e.errorsMore > 0 && n.push(`+${e.errorsMore} more`), e.errorsCleared > 0 && n.push(`${Ul(e.errorsCleared, "error")} cleared`), t.push(_l("Errors", n.join(" · ")));
|
|
5163
5234
|
}
|
|
5164
5235
|
const o = function(e) {
|
|
5165
5236
|
const t = [], n = (e, n, o) => {
|
|
5166
|
-
e.length > 0 && t.push(`${
|
|
5237
|
+
e.length > 0 && t.push(`${Ul(e.length, n, o)} (${e.join(", ")})`);
|
|
5167
5238
|
};
|
|
5168
5239
|
return n(e.names, "name"), n(e.conditionalFormats, "conditional format"), n(e.dataValidations, "data validation"), n(e.charts, "chart"), t.length > 0 ? t.join(" · ") : null;
|
|
5169
5240
|
}(e.touches);
|
|
5170
|
-
return o && t.push(
|
|
5241
|
+
return o && t.push(_l("Also touches", o)), t.join("\n");
|
|
5171
5242
|
}
|
|
5172
|
-
function
|
|
5243
|
+
function ql(e) {
|
|
5173
5244
|
const t = [];
|
|
5174
|
-
if (e.formulas > 0 && t.push(
|
|
5175
|
-
const n = e.replaced.formulas > 0 ? ` (${
|
|
5176
|
-
t.push(`${
|
|
5245
|
+
if (e.formulas > 0 && t.push(Ul(e.formulas, "formula")), e.values > 0 && t.push(Ul(e.values, "value")), e.cleared > 0 && t.push(`${Ul(e.cleared, "cell")} cleared`), e.replaced) {
|
|
5246
|
+
const n = e.replaced.formulas > 0 ? ` (${Ul(e.replaced.formulas, "formula")})` : "";
|
|
5247
|
+
t.push(`${Ul(e.replaced.populated, "populated cell")} replaced${n}`);
|
|
5177
5248
|
} else t.push("replaced cells not known (cells moved, or the state before was not kept)");
|
|
5178
5249
|
return t.join(", ");
|
|
5179
5250
|
}
|
|
5180
|
-
function
|
|
5251
|
+
function Kl(e, t) {
|
|
5181
5252
|
const n = "insert" === t.kind ? "inserted" : "deleted", o = t.address ?? e;
|
|
5182
5253
|
return t.whole ? `${o} ${"row" === t.axis ? "rows" : "columns"} ${n}` : `${o} cells ${n}, shifted ${"row" === t.axis ? "insert" === t.kind ? "down" : "up" : "insert" === t.kind ? "right" : "left"}`;
|
|
5183
5254
|
}
|
|
5184
|
-
function
|
|
5255
|
+
function Gl(e) {
|
|
5185
5256
|
let t;
|
|
5186
5257
|
t = e.sampled && e.values.length > 1 ? `${e.values.slice(0, -1).join(", ")} … ${e.values[e.values.length - 1]}` : e.values.join(", ");
|
|
5187
|
-
const n = e.cells > 1 ? ` (${
|
|
5258
|
+
const n = e.cells > 1 ? ` (${Ul(e.cells, "cell")})` : "";
|
|
5188
5259
|
return `${e.address} ${e.formula} → ${t}${n}`;
|
|
5189
5260
|
}
|
|
5190
|
-
async function
|
|
5261
|
+
async function Xl(e, t, n) {
|
|
5191
5262
|
if (!t) return {};
|
|
5192
5263
|
try {
|
|
5193
|
-
const o = await
|
|
5264
|
+
const o = await Wl(e, t, n);
|
|
5194
5265
|
return o ? {
|
|
5195
5266
|
delta: o,
|
|
5196
|
-
markdown:
|
|
5267
|
+
markdown: Jl(o)
|
|
5197
5268
|
} : {};
|
|
5198
5269
|
} catch (e) {
|
|
5199
5270
|
return { markdown: `Changes could not be read: ${e?.message ?? String(e)}` };
|
|
5200
5271
|
}
|
|
5201
5272
|
}
|
|
5202
|
-
var
|
|
5203
|
-
export {
|
|
5273
|
+
var Zl = [Fo], Yl = [or];
|
|
5274
|
+
export { Wo as API_ENTRY_POINTS, v as CellEncoding, T as GREP_FIELDS, A as GREP_FIELDS_DEFAULT, F as GrepField, ie as MarkdownBuilder, ce as MarkdownFrameSection, Ml as NoRendererError, Yl as REFERENCES, jl as RENDERABLE_KINDS, Nl as RENDERERS, br as RENDER_OPTION_KEYS, It as REPORTED_FEATURES, Zl as TOOLS, Nt as anomalyRegionKey, qo as apiPointerFor, Yo as apiSuggestionsFor, or as apiTool, Jo as apiTypeOf, sr as appendDependencies, qn as appendGroupFacts, Jn as appendGroupMembers, Bt as appendKinds, bs as appendModules, lo as appendMovables, an as appendNames, vt as appendRegionList, _t as appendRegions, Ut as appendRoles, gn as appendRules, Bn as appendShapeFacts, hn as appendSheetObjects, Dr as appendSheetProtection, he as appendTables, ys as collectModules, Qn as collectShapeText, Gt as contentfulBlocks, je as countDates, oe as describeAlignment, pt as describeAllowedValues, Xn as describeAnchor, nr as describeApi, Q as describeBorder, te as describeBorderParts, Vr as describeCellProtection, Z as describeColor, ft as describeConditionalFormat, mt as describeDataValidation, Wl as describeDelta, Wt as describeExtent, Y as describeFill, re as describeFont, Mr as describeLock, to as describeMovableSummary, wr as describeNode, $r as describeNodeLabel, mr as describeNodeLabels, ne as describeNumberFormat, un as describeOutline, Ps as describePageLayout, Vt as describeQualifiedExtent, Qt as describeQualifiedName, Ht as describeQualifiedRanges, Hr as describeRangeProtection, Dt as describeRanges, ut as describeRuleStyle, $t as describeRules, dt as describeScale, Zn as describeShapeText, Pt as describeSheetCall, Ot as describeSheetName, xe as describeSums, ro as describeTypeHeading, Tr as describeWorkbookProtection, ye as detectTotals, N as encodeCell, R as encodeFormattedNumber, E as encodeNumber, j as encodeScalar, dn as findNames, vo as grep, Fo as grepTool, so as groupMovables, zn as groupOf, Hs as isPlainRecord, zo as lookupApi, Lt as parseFeatures, Sr as parseRenderOptions, Ne as profileKinds, pe as profileRegion, Br as protectionPointerFor, An as quoteShapeText, Xl as readRunDelta, Yn as readShapeText, kt as regionPayload, Ct as regionPayloads, tr as renderApi, Jr as renderCell, Zr as renderCellRange, ts as renderConditionalFormat, ns as renderCounts, os as renderDataValidation, Jl as renderDelta, hs as renderFormula, Io as renderGrep, Fl as renderMarkdown, xs as renderModule, ks as renderModules, io as renderMovable, vs as renderNames, Ds as renderPageLayout, Ur as renderProtectedRange, zr as renderProtection, Js as renderRanges, Vs as renderRecords, jt as renderRegions, Al as renderResult, co as renderShape, nl as renderStats, rl as renderStyle, fe as renderTable, sl as renderValues, ul as renderWorkbook, Qs as renderWorksheet, Il as resolveRenderer, Pr as summarizeSheetProtection, ge as tableOf, Xo as withoutHiddenSuggestion };
|