@sheetxl/query 0.8.0-beta.14 → 0.8.0-beta.16
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/LICENSE.md +8 -7
- package/browser/esm/index.mjs +581 -569
- package/node/esm/index.mjs +1139 -1127
- package/package.json +4 -4
- package/types/src/markdown/appendPivotTables.d.ts +10 -9
- package/types/src/markdown/renderTable.d.ts +3 -1
package/node/esm/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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.16
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License:
|
|
5
|
+
* License: SheetXL EULA — https://www.sheetxl.com/eula
|
|
6
6
|
*/
|
|
7
7
|
import { AddressUtils as e, CellImage as t, FormulaError as n, IAnchored as o, ICalculation as r, ICell as s, ICellRange as l, ICondition as a, IConditionalFormat as i, IDataValidation as c, IFill as u, IFont as g, IPageLayout as d, IRange as h, IShape as f, ISheet as m, IStroke as p, ITextFrame as $, InteropScalarType as w, NumberFormat as y, ScalarType as b, ShapeStyleUtils as S, findLabel as x, getScriptingApi as k, getScriptingDeclarations as C } from "@sheetxl/sdk";
|
|
8
8
|
var v;
|
|
@@ -76,7 +76,7 @@ function j(e) {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
if (M(e)) {
|
|
79
|
-
const t =
|
|
79
|
+
const t = F(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, F = (e) => {
|
|
92
92
|
const t = e.getAltText();
|
|
93
93
|
return t ? `[image: ${e.getSource()} "${t}"]` : `[image: ${e.getSource()}]`;
|
|
94
|
-
},
|
|
94
|
+
}, I = {
|
|
95
95
|
Display: "display",
|
|
96
96
|
Value: "value",
|
|
97
97
|
Formula: "formula",
|
|
@@ -218,16 +218,16 @@ function B(e) {
|
|
|
218
218
|
var z = (e, t, n) => `${JSON.stringify(String(e ?? ""))} (${J(String(t ?? ""), n)})`;
|
|
219
219
|
var _ = (e) => "string" === e.kind ? JSON.stringify(String(e.value ?? "")) : String(e.value ?? ""), U = (e) => e.length > 0 && e.every((e) => e.check === O.ConstantFrequency);
|
|
220
220
|
function J(e, t) {
|
|
221
|
-
return e.replace(
|
|
222
|
-
const r =
|
|
221
|
+
return e.replace(G, (e, n, o) => {
|
|
222
|
+
const r = X(n, t.rowIndex, q), s = X(o, t.colIndex, K);
|
|
223
223
|
return null === r || null === s ? e : s + r;
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
var q = (e) => String(e + 1), K = (t) => (e.cellToString({
|
|
227
227
|
rowIndex: 0,
|
|
228
228
|
colIndex: t
|
|
229
|
-
}) ?? "").replace(/\d+$/, ""),
|
|
230
|
-
function
|
|
229
|
+
}) ?? "").replace(/\d+$/, ""), G = /(?<![A-Za-z0-9_.$])R(\[-?\d+\]|\d+)?C(\[-?\d+\]|\d+)?(?![A-Za-z0-9_(])/g;
|
|
230
|
+
function X(e, t, n) {
|
|
231
231
|
if (void 0 === e || "" === e) return n(t);
|
|
232
232
|
if (e.startsWith("[")) {
|
|
233
233
|
const o = t + Number(e.slice(1, -1));
|
|
@@ -318,8 +318,125 @@ function ae(e) {
|
|
|
318
318
|
while (t >= 0);
|
|
319
319
|
return n;
|
|
320
320
|
}
|
|
321
|
-
var ie =
|
|
322
|
-
|
|
321
|
+
var ie = class {
|
|
322
|
+
constructor() {
|
|
323
|
+
this._lines = [], this._headingOffset = 0;
|
|
324
|
+
}
|
|
325
|
+
setHeadingOffset(e) {
|
|
326
|
+
return this._headingOffset = e, this;
|
|
327
|
+
}
|
|
328
|
+
_heading(e, t) {
|
|
329
|
+
return this._lines.push(`${"#".repeat(Math.min(6, e + this._headingOffset))} ${t}`), this;
|
|
330
|
+
}
|
|
331
|
+
h1(e) {
|
|
332
|
+
return this._heading(1, e);
|
|
333
|
+
}
|
|
334
|
+
h2(e) {
|
|
335
|
+
return this._heading(2, e);
|
|
336
|
+
}
|
|
337
|
+
h3(e) {
|
|
338
|
+
return this._heading(3, e);
|
|
339
|
+
}
|
|
340
|
+
text(e) {
|
|
341
|
+
return this._lines.push(e), this;
|
|
342
|
+
}
|
|
343
|
+
blank() {
|
|
344
|
+
return this._lines.push(""), this;
|
|
345
|
+
}
|
|
346
|
+
bullet(e) {
|
|
347
|
+
return "string" == typeof e ? this._lines.push(`- ${e}`) : e.forEach((e) => this._lines.push(`- ${e}`)), this;
|
|
348
|
+
}
|
|
349
|
+
fact(e) {
|
|
350
|
+
return "string" == typeof e ? this._lines.push(` ${e}`) : e.forEach((e) => this._lines.push(` ${e}`)), this;
|
|
351
|
+
}
|
|
352
|
+
bold(e) {
|
|
353
|
+
return `**${e}**`;
|
|
354
|
+
}
|
|
355
|
+
codespan(e) {
|
|
356
|
+
return `\`${e}\``;
|
|
357
|
+
}
|
|
358
|
+
code(e, t = "") {
|
|
359
|
+
return `\`\`\`${t}\n${e}\n\`\`\``;
|
|
360
|
+
}
|
|
361
|
+
beginFrame(e) {
|
|
362
|
+
return new ce(this, e);
|
|
363
|
+
}
|
|
364
|
+
_addLines(e) {
|
|
365
|
+
this._lines.push(...e);
|
|
366
|
+
}
|
|
367
|
+
toLines() {
|
|
368
|
+
return [...this._lines];
|
|
369
|
+
}
|
|
370
|
+
}, ce = class {
|
|
371
|
+
constructor(e, t) {
|
|
372
|
+
this._parent = e, this._headers = t, this._indexWidth = 0, this._rows = [], this._colWidths = t.map((e) => e.length);
|
|
373
|
+
}
|
|
374
|
+
addRow(e, t) {
|
|
375
|
+
const n = e.map((e) => "string" == typeof e ? { text: e } : e);
|
|
376
|
+
return n.forEach((e, t) => {
|
|
377
|
+
this._colWidths[t] = Math.max(this._colWidths[t] ?? 0, e.text.length);
|
|
378
|
+
}), void 0 !== t && (this._indexWidth = Math.max(this._indexWidth, t.length)), this._rows.push({
|
|
379
|
+
index: t,
|
|
380
|
+
cells: n
|
|
381
|
+
}), this;
|
|
382
|
+
}
|
|
383
|
+
endFrame() {
|
|
384
|
+
return this._parent._addLines(this._renderLines()), this._parent;
|
|
385
|
+
}
|
|
386
|
+
_columnAlignment(e) {
|
|
387
|
+
let t = 0, n = 0;
|
|
388
|
+
for (const o of this._rows) {
|
|
389
|
+
const r = o.cells[e];
|
|
390
|
+
r && r.text && (n++, "right" === r.alignment && t++);
|
|
391
|
+
}
|
|
392
|
+
return n > 0 && 2 * t >= n ? "right" : void 0;
|
|
393
|
+
}
|
|
394
|
+
_renderLines() {
|
|
395
|
+
const e = " ", t = this._indexWidth > 0 ? " ".repeat(this._indexWidth) : "", n = this._colWidths.map((e, t) => this._columnAlignment(t)), o = [];
|
|
396
|
+
if (this._headers.some((e) => e.length > 0)) {
|
|
397
|
+
const r = this._headers.map((e, t) => ue(e, this._colWidths[t], n[t])).join(e);
|
|
398
|
+
o.push(`${t}${t ? e : ""}${r}`.trimEnd());
|
|
399
|
+
}
|
|
400
|
+
for (const t of this._rows) {
|
|
401
|
+
const n = t.cells.map((e, t) => ue(e.text, this._colWidths[t], e.alignment)).join(e), r = this._indexWidth > 0 ? (t.index ?? "").padStart(this._indexWidth) + e : "";
|
|
402
|
+
o.push(`${r}${n}`.trimEnd());
|
|
403
|
+
}
|
|
404
|
+
return o;
|
|
405
|
+
}
|
|
406
|
+
}, ue = (e, t, n) => {
|
|
407
|
+
if (e.length >= t) return e;
|
|
408
|
+
const o = t - e.length;
|
|
409
|
+
return "right" === n ? e.padStart(t) : "center" === n ? " ".repeat(Math.floor(o / 2)) + e + " ".repeat(Math.ceil(o / 2)) : e.padEnd(t);
|
|
410
|
+
}, ge = (e) => e.getRange().getTables()[0] ?? null;
|
|
411
|
+
function de(e, t = []) {
|
|
412
|
+
const n = [...t], o = e.getDescription();
|
|
413
|
+
o && n.push(["description", o]), n.push(["columns", e.getColumns().map((e) => e.getName()).join(", ")]), n.push(["headers", e.isShowHeaders() ? "shown" : "hidden"]), n.push(["totals", e.isShowTotals() ? "shown" : "hidden"]);
|
|
414
|
+
const r = Math.max(10, ...n.map(([e]) => e.length + 2));
|
|
415
|
+
return n.map(([e, t]) => `${e.padEnd(r)}${t}`);
|
|
416
|
+
}
|
|
417
|
+
function he(e, t, n) {
|
|
418
|
+
if (0 === t.length) return;
|
|
419
|
+
const o = t.map((e) => {
|
|
420
|
+
const t = e.getRange();
|
|
421
|
+
return {
|
|
422
|
+
table: e,
|
|
423
|
+
address: t.toString(),
|
|
424
|
+
size: `${t.getRowCount()}×${t.getColumnCount()}`
|
|
425
|
+
};
|
|
426
|
+
}), r = Math.max(...o.map((e) => e.address.length)), s = Math.max(...o.map((e) => e.size.length));
|
|
427
|
+
e.h2(`Tables (${n} cell${1 !== n ? "s" : ""} · ${t.length} table${1 !== t.length ? "s" : ""})`);
|
|
428
|
+
for (const t of o) {
|
|
429
|
+
e.text(` ${t.address.padEnd(r)} ${t.size.padEnd(s)} ${t.table.getName()}`);
|
|
430
|
+
for (const n of de(t.table)) e.text(` ${n}`);
|
|
431
|
+
}
|
|
432
|
+
e.blank();
|
|
433
|
+
}
|
|
434
|
+
function fe(e) {
|
|
435
|
+
const t = new ie();
|
|
436
|
+
return t.h1(`Table — ${e.getName()}`), t.fact(de(e, [["range", Pt(e.getRange())]])), t.toLines().join("\n").trimEnd();
|
|
437
|
+
}
|
|
438
|
+
var me = l.Feature;
|
|
439
|
+
function pe(e, t) {
|
|
323
440
|
const n = t?.maxSeries ?? 24, o = t?.maxProfileCells ?? 2e4, r = t?.maxCategories ?? 3, s = e.getRowCount(), l = e.getColumnCount();
|
|
324
441
|
if (1 === s && 1 === l) return {
|
|
325
442
|
shape: "cell",
|
|
@@ -329,16 +446,16 @@ function ce(e, t) {
|
|
|
329
446
|
const a = e.getRange(), i = a.getCoords(), c = s >= l;
|
|
330
447
|
if (1 === s || 1 === l) return {
|
|
331
448
|
shape: "list",
|
|
332
|
-
summary:
|
|
449
|
+
summary: Re(a, r),
|
|
333
450
|
series: []
|
|
334
451
|
};
|
|
335
|
-
const u =
|
|
452
|
+
const u = $e(e, c), g = c ? l : s, d = c ? null : "by row", h = u.present && u.inside, f = c && h ? i.rowStart + 1 : i.rowStart, m = !c && h ? i.colStart + 1 : i.colStart, p = be(a, c, c ? f : m, o), $ = c && p ? p.start - 1 : i.rowEnd, w = !c && p ? p.start - 1 : i.colEnd, y = $ - f + 1, b = w - m + 1, S = y * b > o, x = S && c ? Math.max(1, Math.floor(o / Math.max(1, b))) : y, k = S && !c ? Math.max(1, Math.floor(o / Math.max(1, y))) : b, C = Math.min($, f + x - 1), E = Math.min(w, m + k - 1), R = Math.min(g, n), j = [], M = [];
|
|
336
453
|
for (let t = 0; t < R; t++) {
|
|
337
454
|
const n = c ? a.getRangeAt(f, i.colStart + t, C, i.colStart + t) : a.getRangeAt(i.rowStart + t, m, i.rowStart + t, E);
|
|
338
|
-
j.push(
|
|
455
|
+
j.push(Ee(e, c, t, u.names)), M.push(Re(n, r));
|
|
339
456
|
}
|
|
340
|
-
const
|
|
341
|
-
g > R &&
|
|
457
|
+
const F = j.length ? Math.max(...j.map((e) => e.length)) : 0, I = j.map((e, t) => `${e.padEnd(F)} ${M[t]}`);
|
|
458
|
+
g > R && I.push(`…${g - R} more ${c ? "columns" : "rows"} not profiled · read them with getStats()`);
|
|
342
459
|
const T = [
|
|
343
460
|
d,
|
|
344
461
|
u.note,
|
|
@@ -347,11 +464,11 @@ function ce(e, t) {
|
|
|
347
464
|
return S && T.push(`profiled from the first ${c ? `${x} rows` : `${k} columns`} of ${c ? y : b}`), {
|
|
348
465
|
shape: u.present ? "table" : "block",
|
|
349
466
|
summary: T.filter(Boolean).join(" · "),
|
|
350
|
-
series:
|
|
467
|
+
series: I
|
|
351
468
|
};
|
|
352
469
|
}
|
|
353
|
-
function
|
|
354
|
-
const n = e.getRange(), o = n.getCoords(), r = e.getCell()
|
|
470
|
+
function $e(e, t) {
|
|
471
|
+
const n = e.getRange(), o = n.getCoords(), r = ge(e.getCell());
|
|
355
472
|
if (r) {
|
|
356
473
|
const e = r.getColumns().map((e) => e.getName()), n = r.getRange().getCoords();
|
|
357
474
|
return {
|
|
@@ -361,21 +478,21 @@ function ue(e, t) {
|
|
|
361
478
|
names: t ? e : null
|
|
362
479
|
};
|
|
363
480
|
}
|
|
364
|
-
const s = t ? o.rowStart + 1 : o.colStart + 1, a =
|
|
365
|
-
if (
|
|
481
|
+
const s = t ? o.rowStart + 1 : o.colStart + 1, a = Ce(t ? n.getRangeAt(s, o.colStart, o.rowEnd, o.colEnd) : n.getRangeAt(o.rowStart, s, o.rowEnd, o.colEnd)), i = t ? n.getRangeAt(o.rowStart, o.colStart, o.rowStart, o.colEnd) : n.getRangeAt(o.rowStart, o.colStart, o.rowEnd, o.colStart);
|
|
482
|
+
if (Ce(i) && !a) return {
|
|
366
483
|
present: !0,
|
|
367
484
|
inside: !0,
|
|
368
485
|
note: "header " + (t ? `row ${o.rowStart + 1}` : `column ${ae(o.colStart)}`),
|
|
369
|
-
names:
|
|
486
|
+
names: ve(i, e, t)
|
|
370
487
|
};
|
|
371
488
|
const c = (t ? o.rowStart : o.colStart) - 1;
|
|
372
|
-
if (c >= 0 &&
|
|
489
|
+
if (c >= 0 && !Ce(n)) {
|
|
373
490
|
const r = t ? n.getRangeAt(c, o.colStart, c, o.colEnd) : n.getRangeAt(o.rowStart, c, o.rowEnd, c);
|
|
374
|
-
if (
|
|
491
|
+
if (Ce(r)) return {
|
|
375
492
|
present: !0,
|
|
376
493
|
inside: !1,
|
|
377
494
|
note: `header ${t ? `row ${c + 1}` : `column ${ae(c)}`} (above this block)`,
|
|
378
|
-
names:
|
|
495
|
+
names: ve(r, e, t)
|
|
379
496
|
};
|
|
380
497
|
}
|
|
381
498
|
return {
|
|
@@ -385,35 +502,35 @@ function ue(e, t) {
|
|
|
385
502
|
names: null
|
|
386
503
|
};
|
|
387
504
|
}
|
|
388
|
-
var
|
|
389
|
-
function
|
|
505
|
+
var we = 3;
|
|
506
|
+
function ye(e, t = 2e4) {
|
|
390
507
|
const n = e.getRowCount(), o = e.getColumnCount();
|
|
391
508
|
if (n < 2 || o < 2) return null;
|
|
392
|
-
const r = n >= o, s = e.getCoords(), l =
|
|
509
|
+
const r = n >= o, s = e.getCoords(), l = $e({
|
|
393
510
|
getRowCount: () => n,
|
|
394
511
|
getColumnCount: () => o,
|
|
395
512
|
getCell: () => e.getCell(),
|
|
396
513
|
getRange: () => e
|
|
397
514
|
}, r), a = l.present && l.inside;
|
|
398
|
-
return
|
|
515
|
+
return be(e, r, (r ? s.rowStart : s.colStart) + (a ? 1 : 0), t);
|
|
399
516
|
}
|
|
400
|
-
function
|
|
517
|
+
function be(e, t, n, o) {
|
|
401
518
|
const r = e.getCoords(), s = t ? r.rowEnd : r.colEnd, l = t ? r.colStart : r.rowStart, a = t ? r.colEnd : r.rowEnd;
|
|
402
519
|
let i, c = -1;
|
|
403
|
-
const u = e.getCell()
|
|
520
|
+
const u = ge(e.getCell()), g = t && !!u?.isShowTotals() && u.getRange().getCoords().rowEnd === r.rowEnd;
|
|
404
521
|
if (g) c = s;
|
|
405
522
|
else {
|
|
406
523
|
if (e.getRowCount() * e.getColumnCount() > Math.min(o, 1e4)) return null;
|
|
407
524
|
const u = e.getValues(), g = (e, n) => t ? u[e - r.rowStart][n - r.colStart] : u[n - r.rowStart][e - r.colStart], d = a - l + 1, h = new Array(d).fill(0), f = new Array(d).fill(!1);
|
|
408
525
|
for (let o = n; o <= s; o++) {
|
|
409
526
|
if (o - n >= 2) {
|
|
410
|
-
const n =
|
|
527
|
+
const n = Se(d, (e) => g(o, l + e), h, f, (e) => t ? `${ae(l + e)}${o + 1}` : `${ae(o)}${l + e + 1}`);
|
|
411
528
|
if (n.matches >= 2 && 2 * n.matches > n.candidates) {
|
|
412
529
|
const r = t ? e.getRangeAt(o, l, o, a) : e.getRangeAt(l, o, a, o);
|
|
413
530
|
c = o, i = {
|
|
414
531
|
...n,
|
|
415
532
|
byColumn: t,
|
|
416
|
-
typed: 0 === (r.getCounts([
|
|
533
|
+
typed: 0 === (r.getCounts([me.Formula])[me.Formula] ?? 0)
|
|
417
534
|
};
|
|
418
535
|
break;
|
|
419
536
|
}
|
|
@@ -433,17 +550,17 @@ function he(e, t, n, o) {
|
|
|
433
550
|
} : {
|
|
434
551
|
rowIndex: r.rowStart,
|
|
435
552
|
colIndex: n
|
|
436
|
-
}, s =
|
|
553
|
+
}, s = ke(e, o) ?? se(d, o, t ? "row" : "column");
|
|
437
554
|
h.push({
|
|
438
555
|
index: n,
|
|
439
556
|
label: s,
|
|
440
557
|
...n === c && i ? { sums: i } : {}
|
|
441
558
|
});
|
|
442
559
|
}
|
|
443
|
-
const f = (e) => t ? String(e + 1) : ae(e), m = c === s ? `${t ? "row" : "column"} ${f(c)}` : `${t ? "rows" : "columns"} ${f(c)}:${f(s)}`, p = h.slice(0,
|
|
560
|
+
const f = (e) => t ? String(e + 1) : ae(e), m = c === s ? `${t ? "row" : "column"} ${f(c)}` : `${t ? "rows" : "columns"} ${f(c)}:${f(s)}`, p = h.slice(0, we).map((e) => [
|
|
444
561
|
f(e.index),
|
|
445
562
|
e.label ? JSON.stringify(e.label.text) : null,
|
|
446
|
-
e.sums ?
|
|
563
|
+
e.sums ? xe(e.sums) : e.index === c && g ? "table totals" : null
|
|
447
564
|
].filter(Boolean).join(" ")), $ = h.length - p.length;
|
|
448
565
|
return {
|
|
449
566
|
byColumn: t,
|
|
@@ -452,7 +569,7 @@ function he(e, t, n, o) {
|
|
|
452
569
|
note: `${m} not profiled: ${p.join(" · ")}${$ > 0 ? ` · +${$} more` : ""}`
|
|
453
570
|
};
|
|
454
571
|
}
|
|
455
|
-
function
|
|
572
|
+
function Se(e, t, n, o, r) {
|
|
456
573
|
let s = 0, l = 0;
|
|
457
574
|
const a = [];
|
|
458
575
|
for (let i = 0; i < e; i++) {
|
|
@@ -467,11 +584,11 @@ function fe(e, t, n, o, r) {
|
|
|
467
584
|
misses: a
|
|
468
585
|
};
|
|
469
586
|
}
|
|
470
|
-
function
|
|
587
|
+
function xe(e) {
|
|
471
588
|
const t = e.misses.slice(0, 3), n = e.misses.length - t.length, o = t.length > 0 ? `; ${t.join(", ")}${n > 0 ? `, +${n} more` : ""}` : "";
|
|
472
589
|
return `${e.typed ? "typed, " : ""}= Σ ${e.byColumn ? "above" : "to the left"} (${e.matches} of ${e.candidates}${o})`;
|
|
473
590
|
}
|
|
474
|
-
function
|
|
591
|
+
function ke(e, t) {
|
|
475
592
|
const n = e.getRangeAt(t.rowIndex, t.colIndex).getCell();
|
|
476
593
|
if (n.getType() !== b.String) return null;
|
|
477
594
|
const o = N(n, v.Mode.Display)?.match;
|
|
@@ -480,11 +597,11 @@ function pe(e, t) {
|
|
|
480
597
|
address: n.getAddress()
|
|
481
598
|
} : null;
|
|
482
599
|
}
|
|
483
|
-
function
|
|
600
|
+
function Ce(e) {
|
|
484
601
|
const t = e.getStats({ onError: "ignore" }), n = t.getCount();
|
|
485
602
|
return n > 0 && (t.getTypedCounts()[b.String] ?? 0) === n;
|
|
486
603
|
}
|
|
487
|
-
function
|
|
604
|
+
function ve(e, t, n) {
|
|
488
605
|
const o = t.getRange().getCoords(), r = e.getCoords(), s = n ? o.colEnd - o.colStart + 1 : o.rowEnd - o.rowStart + 1, l = [];
|
|
489
606
|
for (let t = 0; t < s; t++) {
|
|
490
607
|
const s = n ? e.getRangeAt(r.rowStart, o.colStart + t).getCell() : e.getRangeAt(o.rowStart + t, r.colStart).getCell();
|
|
@@ -492,26 +609,26 @@ function we(e, t, n) {
|
|
|
492
609
|
}
|
|
493
610
|
return l;
|
|
494
611
|
}
|
|
495
|
-
function
|
|
612
|
+
function Ee(e, t, n, o) {
|
|
496
613
|
const r = e.getRange().getCoords(), s = t ? ae(r.colStart + n) : String(r.rowStart + n + 1), l = o?.[n];
|
|
497
614
|
return l ? `${s} ${l}` : s;
|
|
498
615
|
}
|
|
499
|
-
function
|
|
616
|
+
function Re(e, t = 3) {
|
|
500
617
|
const n = e.getStats({ onError: "ignore" }), o = n.getTypedCounts(), r = n.getCount(), s = n.getSize(), l = s - r;
|
|
501
618
|
if (0 === r) return `${s} cells, all blank`;
|
|
502
|
-
const a = e.getCounts([
|
|
619
|
+
const a = e.getCounts([me.Formula])[me.Formula] ?? 0, i = je(e), c = o[b.Number] ?? 0, u = o[b.String] ?? 0, g = o[b.Error] ?? 0, d = [String(r)];
|
|
503
620
|
let h = !1;
|
|
504
621
|
if (a === r) {
|
|
505
|
-
const t = [...e.getRegions(
|
|
622
|
+
const t = [...e.getRegions(me.Formula)];
|
|
506
623
|
if (1 === t.length) {
|
|
507
624
|
const e = t[0].getCell().getFormulaText();
|
|
508
625
|
d.push("formula", e || "(uniform)");
|
|
509
626
|
} else d.push("formula", `${t.length} distinct`);
|
|
510
|
-
} else if (i === r) d.push("date",
|
|
627
|
+
} else if (i === r) d.push("date", Fe(n, Me(e).format));
|
|
511
628
|
else if (c === r) {
|
|
512
|
-
const t =
|
|
513
|
-
d.push("number",
|
|
514
|
-
} else if (u === r) d.push("text",
|
|
629
|
+
const t = Me(e);
|
|
630
|
+
d.push("number", Fe(n, t.format), ...Ie(n, t));
|
|
631
|
+
} else if (u === r) d.push("text", Te(n, t));
|
|
515
632
|
else {
|
|
516
633
|
const e = [
|
|
517
634
|
c ? `number ${c}` : null,
|
|
@@ -528,34 +645,34 @@ function be(e, t = 3) {
|
|
|
528
645
|
].filter(Boolean), m = d.filter(Boolean).join(" ");
|
|
529
646
|
return f.length ? `${m} · ${f.join(" · ")}` : m;
|
|
530
647
|
}
|
|
531
|
-
function
|
|
648
|
+
function Ne(e, t = 3) {
|
|
532
649
|
const n = e.getStats({ onError: "ignore" }), o = n.getTypedCounts(), r = [], s = o[b.Number] ?? 0;
|
|
533
650
|
if (s > 0) {
|
|
534
|
-
const t =
|
|
651
|
+
const t = Me(e), o = [Fe(n, t.format), ...Ie(n, t)].filter(Boolean);
|
|
535
652
|
r.push(`Number: ${s} ${o.join(" ")}`.trimEnd());
|
|
536
653
|
}
|
|
537
654
|
const l = o[b.String] ?? 0;
|
|
538
655
|
if (l > 0) {
|
|
539
|
-
const e =
|
|
656
|
+
const e = Te(n, t, (e) => "string" == typeof e);
|
|
540
657
|
r.push(`String: ${l} ${e}`.trimEnd());
|
|
541
658
|
}
|
|
542
659
|
const a = o[b.Boolean] ?? 0;
|
|
543
660
|
if (a > 0) {
|
|
544
|
-
const e =
|
|
661
|
+
const e = Te(n, t, (e) => "boolean" == typeof e);
|
|
545
662
|
r.push(`Boolean: ${a} ${e}`.trimEnd());
|
|
546
663
|
}
|
|
547
664
|
return r;
|
|
548
665
|
}
|
|
549
|
-
function
|
|
666
|
+
function je(e) {
|
|
550
667
|
let t = 0;
|
|
551
668
|
return e.forEach((e, n) => {
|
|
552
669
|
n.getInteropType() === w.Date && t++;
|
|
553
670
|
}), t;
|
|
554
671
|
}
|
|
555
|
-
function
|
|
672
|
+
function Me(e) {
|
|
556
673
|
const t = (e) => e.getStats({ onError: "ignore" }).getTypedCounts()[b.Number] ?? 0, n = /* @__PURE__ */ new Map();
|
|
557
674
|
let o = 0;
|
|
558
|
-
for (const r of e.getRegions(
|
|
675
|
+
for (const r of e.getRegions(me.NumberFormat)) {
|
|
559
676
|
const e = r.getRange().getStyle().getNumberFormat(), s = t(r.getRange());
|
|
560
677
|
o += s, e && s > 0 && n.set(e, (n.get(e) ?? 0) + s);
|
|
561
678
|
}
|
|
@@ -579,52 +696,52 @@ function ke(e) {
|
|
|
579
696
|
mixed: s.map(([e, t]) => `${e} ${t}`).join(" · ")
|
|
580
697
|
};
|
|
581
698
|
}
|
|
582
|
-
function
|
|
699
|
+
function Fe(e, t) {
|
|
583
700
|
const n = e.getAggregates({ onError: "ignore" });
|
|
584
701
|
if (null === n.min || null === n.max) return "";
|
|
585
702
|
const o = R(n.min, t), r = R(n.max, t);
|
|
586
703
|
return o === r ? o : `${o} … ${r}`;
|
|
587
704
|
}
|
|
588
|
-
function
|
|
705
|
+
function Ie(e, { format: t, mixed: n }) {
|
|
589
706
|
if (n) return [`mixed formats (${n})`];
|
|
590
707
|
const o = e.getAggregates({ onError: "ignore" }), r = [];
|
|
591
708
|
return null !== o.sum && r.push(`Σ ${R(o.sum, t)}`), null !== o.average && r.push(`x̄ ${R(o.average, t)}`), r;
|
|
592
709
|
}
|
|
593
|
-
function
|
|
710
|
+
function Te(e, t, n) {
|
|
594
711
|
const o = e.getFrequencies(n ? { filterFn: n } : void 0), r = o.getUniqueCount();
|
|
595
712
|
if (0 === r) return "";
|
|
596
713
|
if (r === o.getTotalCount()) return `${r} distinct, no repeats`;
|
|
597
714
|
const s = Array.from(o.getValueCounts()).slice(0, t);
|
|
598
715
|
return `${r} unique (${s.map(([e, t]) => `${e} ${t}`).join(" · ")}${r > s.length ? " · …" : ""})`;
|
|
599
716
|
}
|
|
600
|
-
var
|
|
717
|
+
var Ae = l.Feature, Le = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), We = (e, t) => {
|
|
601
718
|
const n = Math.min(e.rowEnd, t.rowEnd) - Math.max(e.rowStart, t.rowStart) + 1;
|
|
602
719
|
if (n <= 0) return 0;
|
|
603
720
|
const o = Math.min(e.colEnd, t.colEnd) - Math.max(e.colStart, t.colStart) + 1;
|
|
604
721
|
return o <= 0 ? 0 : n * o;
|
|
605
722
|
};
|
|
606
|
-
var
|
|
607
|
-
const n = `×${
|
|
608
|
-
return "times" === t || e.styled === e.content ? n : `${n} (+${
|
|
609
|
-
},
|
|
723
|
+
var Oe = (e) => e.toLocaleString("en-US"), Pe = (e, t) => {
|
|
724
|
+
const n = `×${Oe(e.content)}`;
|
|
725
|
+
return "times" === t || e.styled === e.content ? n : `${n} (+${Oe(e.styled - e.content)} blank)`;
|
|
726
|
+
}, De = (t) => {
|
|
610
727
|
if (0 === t.length) return "";
|
|
611
728
|
const n = e.rangeToString(t[0]);
|
|
612
729
|
if (1 === t.length) return n;
|
|
613
730
|
const o = t.length - 1;
|
|
614
731
|
return `${n}, +${o} block${1 === o ? "" : "s"}`;
|
|
615
732
|
};
|
|
616
|
-
function
|
|
617
|
-
const n = t?.manyDistinct ?? 20, { sorted: o, top: r, rare: s, more: l } =
|
|
733
|
+
function He(e, t) {
|
|
734
|
+
const n = t?.manyDistinct ?? 20, { sorted: o, top: r, rare: s, more: l } = Ve(e, t);
|
|
618
735
|
if (0 === o.length) return "";
|
|
619
736
|
const a = (e) => ((e, t) => {
|
|
620
|
-
const n =
|
|
621
|
-
return `${e.label === t?.hideLabel ? "" : `${e.label} `}${
|
|
737
|
+
const n = De(e.blocks);
|
|
738
|
+
return `${e.label === t?.hideLabel ? "" : `${e.label} `}${Pe(e, t?.countStyle ?? "cells")}${n ? ` ${n}` : ""}`;
|
|
622
739
|
})(e, t);
|
|
623
740
|
if (0 === l) return o.map(a).join(" · ");
|
|
624
741
|
const i = o.reduce((e, t) => e + t.content, 0), c = i > 0 ? o[0].content / i : 0, u = [], g = o.length > n ? `${o.length} distinct${c < .5 ? ", no convention" : ""}; largest ` : "";
|
|
625
742
|
return u.push(g + r.map(a).join(" · ")), s.length > 0 && u.push(`rarest ${s.map(a).join(" · ")}`), u.push(`+${l} more${t?.recovery ? ` (${t.recovery})` : ""}`), u.join(" · ");
|
|
626
743
|
}
|
|
627
|
-
function
|
|
744
|
+
function Ve(e, t) {
|
|
628
745
|
const n = t?.maxValues ?? 8, o = [...e].sort((e, t) => t.content - e.content || t.styled - e.styled || (e.label < t.label ? -1 : 1));
|
|
629
746
|
if (o.length <= n) return {
|
|
630
747
|
sorted: o,
|
|
@@ -641,97 +758,97 @@ function Ae(e, t) {
|
|
|
641
758
|
more: o.length - s.length - l.length
|
|
642
759
|
};
|
|
643
760
|
}
|
|
644
|
-
var
|
|
761
|
+
var Be = [
|
|
645
762
|
{
|
|
646
763
|
name: "family",
|
|
647
|
-
project: (e, t) =>
|
|
764
|
+
project: (e, t) => Xe(e.getFont().getFamily(), t?.getFont().getFamily())
|
|
648
765
|
},
|
|
649
766
|
{
|
|
650
767
|
name: "size",
|
|
651
|
-
project: (e, t) =>
|
|
768
|
+
project: (e, t) => Xe(e.getFont().getSize(), t?.getFont().getSize(), (e) => `${e}pt`)
|
|
652
769
|
},
|
|
653
770
|
{
|
|
654
771
|
name: "bold",
|
|
655
|
-
project: (e, t) =>
|
|
772
|
+
project: (e, t) => Xe(e.getFont().getBold(), t?.getFont().getBold() ?? !1, (e) => e ? "bold" : "not bold")
|
|
656
773
|
},
|
|
657
774
|
{
|
|
658
775
|
name: "italic",
|
|
659
|
-
project: (e, t) =>
|
|
776
|
+
project: (e, t) => Xe(e.getFont().getItalic(), t?.getFont().getItalic() ?? !1, (e) => e ? "italic" : "not italic")
|
|
660
777
|
},
|
|
661
778
|
{
|
|
662
779
|
name: "underline",
|
|
663
|
-
project: (e, t) =>
|
|
780
|
+
project: (e, t) => Xe(e.getFont().getUnderline(), t?.getFont().getUnderline(), (e) => String(e))
|
|
664
781
|
},
|
|
665
782
|
{
|
|
666
783
|
name: "strike",
|
|
667
|
-
project: (e, t) =>
|
|
784
|
+
project: (e, t) => Xe(e.getFont().getStrike(), t?.getFont().getStrike() ?? !1, (e) => e ? "strike" : "not strike")
|
|
668
785
|
},
|
|
669
786
|
{
|
|
670
787
|
name: "color",
|
|
671
|
-
project: (e, t) =>
|
|
788
|
+
project: (e, t) => Xe(Z(e.getFont().getColor()), t ? Z(t.getFont().getColor()) : null)
|
|
672
789
|
}
|
|
673
|
-
],
|
|
790
|
+
], ze = (e) => Ze(e) ?? "Custom", _e = {
|
|
674
791
|
name: "category",
|
|
675
792
|
project: (e) => {
|
|
676
793
|
const t = ne(e);
|
|
677
|
-
return null === t ? null :
|
|
794
|
+
return null === t ? null : ze(t);
|
|
678
795
|
}
|
|
679
|
-
},
|
|
796
|
+
}, Ue = {
|
|
680
797
|
name: "format",
|
|
681
798
|
project: (e) => ne(e)
|
|
682
|
-
},
|
|
799
|
+
}, Je = [_e, Ue], qe = [{
|
|
683
800
|
name: "color",
|
|
684
801
|
project: (e) => Y(e)
|
|
685
|
-
}],
|
|
802
|
+
}], Ke = [{
|
|
686
803
|
name: "edges",
|
|
687
804
|
project: (e) => Q(e)
|
|
688
|
-
}],
|
|
805
|
+
}], Ge = [
|
|
689
806
|
{
|
|
690
807
|
name: "h",
|
|
691
808
|
ambiguous: !0,
|
|
692
|
-
project: (e, t) =>
|
|
809
|
+
project: (e, t) => Xe(e.getAlignment().getHorizontal(), t?.getAlignment().getHorizontal())
|
|
693
810
|
},
|
|
694
811
|
{
|
|
695
812
|
name: "v",
|
|
696
813
|
ambiguous: !0,
|
|
697
|
-
project: (e, t) =>
|
|
814
|
+
project: (e, t) => Xe(e.getAlignment().getVertical(), t?.getAlignment().getVertical())
|
|
698
815
|
},
|
|
699
816
|
{
|
|
700
817
|
name: "overflow",
|
|
701
|
-
project: (e, t) =>
|
|
818
|
+
project: (e, t) => Xe(e.getAlignment().getOverflow(), t?.getAlignment().getOverflow())
|
|
702
819
|
},
|
|
703
820
|
{
|
|
704
821
|
name: "indent",
|
|
705
|
-
project: (e, t) =>
|
|
822
|
+
project: (e, t) => Xe(e.getAlignment().getIndent(), t?.getAlignment().getIndent() ?? 0, (e) => `indent ${e}`)
|
|
706
823
|
},
|
|
707
824
|
{
|
|
708
825
|
name: "rotation",
|
|
709
|
-
project: (e, t) =>
|
|
826
|
+
project: (e, t) => Xe(e.getAlignment().getRotation(), t?.getAlignment().getRotation() ?? 0, (e) => `rotation ${e}`)
|
|
710
827
|
}
|
|
711
828
|
];
|
|
712
|
-
function
|
|
829
|
+
function Xe(e, t, n = String) {
|
|
713
830
|
return null == e || void 0 !== t && e === t ? null : n(e);
|
|
714
831
|
}
|
|
715
|
-
function
|
|
832
|
+
function Ze(e) {
|
|
716
833
|
if (!e || "General" === e) return null;
|
|
717
834
|
const t = y.Builder.parse(e);
|
|
718
835
|
if ("General" === t.category) return null;
|
|
719
836
|
const n = t.decimalPlaces;
|
|
720
837
|
return null != n ? `${t.category} ${n}dp` : t.category;
|
|
721
838
|
}
|
|
722
|
-
var
|
|
723
|
-
[
|
|
724
|
-
[
|
|
725
|
-
[
|
|
726
|
-
[
|
|
727
|
-
[
|
|
728
|
-
},
|
|
729
|
-
function
|
|
730
|
-
const r =
|
|
839
|
+
var Ye = {
|
|
840
|
+
[Ae.Font]: Be,
|
|
841
|
+
[Ae.NumberFormat]: Je,
|
|
842
|
+
[Ae.Fill]: qe,
|
|
843
|
+
[Ae.Borders]: Ke,
|
|
844
|
+
[Ae.Alignment]: Ge
|
|
845
|
+
}, Qe = (e) => e in Ye;
|
|
846
|
+
function et(e, t, n, o) {
|
|
847
|
+
const r = Ye[t];
|
|
731
848
|
if (!r) return null;
|
|
732
849
|
const s = e.getEntireCoords(), l = e.getUsedRange()?.getCoords() ?? null, a = [...e.getEntireRange().getRegions(t)];
|
|
733
850
|
if (0 === a.length) return null;
|
|
734
|
-
const i = o?.content ?? (l ? [...e.getEntireRange().getRegions(
|
|
851
|
+
const i = o?.content ?? (l ? [...e.getEntireRange().getRegions(Ae.Contentful)].map((e) => e.getCoords()) : []), c = (e) => i.reduce((t, n) => t + We(e, n), 0), u = (e) => l ? We(e, l) : 0, g = (e) => {
|
|
735
852
|
const t = e.getRange().getStyle(), o = [];
|
|
736
853
|
for (const e of r) {
|
|
737
854
|
const r = e.project(t, n);
|
|
@@ -746,7 +863,7 @@ function qe(e, t, n, o) {
|
|
|
746
863
|
2 * (t.rowEnd - t.rowStart + 1) > f ? p.push(e) : 2 * (t.colEnd - t.colStart + 1) > m ? $.push(e) : w.push(e);
|
|
747
864
|
}
|
|
748
865
|
const y = [];
|
|
749
|
-
y.push(...
|
|
866
|
+
y.push(...at("columns", p, g, s, !0)), y.push(...at("rows", $, g, s, !1));
|
|
750
867
|
const b = w.reduce((e, t) => e + u(t.getCoords()), 0), S = (e) => {
|
|
751
868
|
const t = [];
|
|
752
869
|
for (const o of w) {
|
|
@@ -789,32 +906,32 @@ function qe(e, t, n, o) {
|
|
|
789
906
|
}
|
|
790
907
|
return [...o.values()].map((e) => ({
|
|
791
908
|
...e,
|
|
792
|
-
blocks: e.blocks.sort((e, t) =>
|
|
909
|
+
blocks: e.blocks.sort((e, t) => Le(t) - Le(e))
|
|
793
910
|
}));
|
|
794
911
|
}, x = [];
|
|
795
|
-
if (t ===
|
|
796
|
-
const { top: o, rare: r, more: s } =
|
|
912
|
+
if (t === Ae.NumberFormat) x.push(...function(e, t, n) {
|
|
913
|
+
const { top: o, rare: r, more: s } = Ve(e, n), l = [];
|
|
797
914
|
let a = -1;
|
|
798
915
|
for (const e of [...o, ...r]) {
|
|
799
916
|
e === r[0] && (a = l.length);
|
|
800
|
-
const n =
|
|
917
|
+
const n = Ve(t.filter((t) => ze(t.label) === e.label), { maxValues: 1 / 0 }).sorted, o = 1 === n.length;
|
|
801
918
|
if (l.push([
|
|
802
919
|
e.label,
|
|
803
|
-
|
|
804
|
-
|
|
920
|
+
Pe(e, "cells"),
|
|
921
|
+
De(e.blocks),
|
|
805
922
|
o ? n[0].label : `${n.length} formats`
|
|
806
923
|
]), !o) {
|
|
807
|
-
for (const e of n.slice(0,
|
|
924
|
+
for (const e of n.slice(0, lt)) l.push([
|
|
808
925
|
"",
|
|
809
|
-
|
|
810
|
-
|
|
926
|
+
Pe(e, "cells"),
|
|
927
|
+
De(e.blocks),
|
|
811
928
|
e.label
|
|
812
929
|
]);
|
|
813
|
-
n.length >
|
|
930
|
+
n.length > lt && l.push([
|
|
814
931
|
"",
|
|
815
932
|
"",
|
|
816
933
|
"",
|
|
817
|
-
`…and ${n.length -
|
|
934
|
+
`…and ${n.length - lt} more`
|
|
818
935
|
]);
|
|
819
936
|
}
|
|
820
937
|
}
|
|
@@ -825,25 +942,25 @@ function qe(e, t, n, o) {
|
|
|
825
942
|
].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());
|
|
826
943
|
s > 0 && c.splice(a < 0 ? c.length : a, 0, `…and ${s} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
|
|
827
944
|
return c;
|
|
828
|
-
}(S(
|
|
945
|
+
}(S(_e), S(Ue), o));
|
|
829
946
|
else for (const e of r) {
|
|
830
947
|
const t = S(e);
|
|
831
948
|
if (0 === t.length) continue;
|
|
832
|
-
const n =
|
|
949
|
+
const n = He(t, {
|
|
833
950
|
...o,
|
|
834
951
|
hideLabel: e.name
|
|
835
952
|
});
|
|
836
|
-
n.length <=
|
|
953
|
+
n.length <= rt ? x.push(`${e.name.padEnd(10)}${n}`) : x.push(...st(e.name, t, o));
|
|
837
954
|
}
|
|
838
955
|
return {
|
|
839
956
|
distinct: d.size,
|
|
840
957
|
cells: b,
|
|
841
|
-
normal: n ?
|
|
958
|
+
normal: n ? ot(t, n) : null,
|
|
842
959
|
tiers: y,
|
|
843
960
|
attributes: x
|
|
844
961
|
};
|
|
845
962
|
}
|
|
846
|
-
function
|
|
963
|
+
function tt(e, t) {
|
|
847
964
|
if (0 === e.length) return null;
|
|
848
965
|
const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
849
966
|
let r = 0;
|
|
@@ -870,7 +987,7 @@ function Ke(e, t) {
|
|
|
870
987
|
label: e.label,
|
|
871
988
|
content: e.cells,
|
|
872
989
|
styled: e.cells,
|
|
873
|
-
blocks: e.blocks.sort((e, t) =>
|
|
990
|
+
blocks: e.blocks.sort((e, t) => Le(t) - Le(e))
|
|
874
991
|
})), a = [...o.entries()].map(([e, t]) => ({
|
|
875
992
|
label: e,
|
|
876
993
|
content: t,
|
|
@@ -884,10 +1001,10 @@ function Ke(e, t) {
|
|
|
884
1001
|
blocks: []
|
|
885
1002
|
}), {
|
|
886
1003
|
distinct: n.size,
|
|
887
|
-
lines: [`${"distinct".padEnd(10)}${
|
|
1004
|
+
lines: [`${"distinct".padEnd(10)}${He(l, s)}`, `${"functions".padEnd(10)}${He(a, s)}`]
|
|
888
1005
|
};
|
|
889
1006
|
}
|
|
890
|
-
function
|
|
1007
|
+
function nt(e, t) {
|
|
891
1008
|
const n = e.getStats({ onError: "ignore" }).getTypedCounts(), o = /* @__PURE__ */ new Map(), r = [
|
|
892
1009
|
["number", "number"],
|
|
893
1010
|
["string", "text"],
|
|
@@ -899,7 +1016,7 @@ function Xe(e, t) {
|
|
|
899
1016
|
const r = n[e] ?? 0;
|
|
900
1017
|
r > 0 && o.set(t, r);
|
|
901
1018
|
}
|
|
902
|
-
let s =
|
|
1019
|
+
let s = je(e), l = 0;
|
|
903
1020
|
for (const e of t) {
|
|
904
1021
|
const t = e.getRange().getStats({ onError: "ignore" }).getTypedCounts();
|
|
905
1022
|
l += e.getRowCount() * e.getColumnCount();
|
|
@@ -907,45 +1024,45 @@ function Xe(e, t) {
|
|
|
907
1024
|
const r = t[e] ?? 0;
|
|
908
1025
|
r > 0 && o.set(n, (o.get(n) ?? 0) - r);
|
|
909
1026
|
}
|
|
910
|
-
s > 0 && (t.number ?? 0) > 0 && (s -=
|
|
1027
|
+
s > 0 && (t.number ?? 0) > 0 && (s -= je(e.getRange()));
|
|
911
1028
|
}
|
|
912
1029
|
return s > 0 && (o.set("date", s), o.set("number", (o.get("number") ?? 0) - s)), l > 0 && o.set("formula", l), [...o.entries()].filter(([, e]) => e > 0).sort((e, t) => t[1] - e[1]);
|
|
913
1030
|
}
|
|
914
|
-
function
|
|
1031
|
+
function ot(e, t) {
|
|
915
1032
|
switch (e) {
|
|
916
|
-
case
|
|
1033
|
+
case Ae.Font: return function(e) {
|
|
917
1034
|
const t = e.getFont(), n = [t.getFamily(), `${t.getSize()}pt`], o = Z(t.getColor());
|
|
918
1035
|
o && n.push(o);
|
|
919
1036
|
t.getBold() && n.push("bold");
|
|
920
1037
|
t.getItalic() && n.push("italic");
|
|
921
1038
|
return n.join(" · ");
|
|
922
1039
|
}(t);
|
|
923
|
-
case
|
|
1040
|
+
case Ae.NumberFormat: {
|
|
924
1041
|
const e = ne(t);
|
|
925
|
-
return null === e ? null : `${
|
|
1042
|
+
return null === e ? null : `${ze(e)} ${e}`;
|
|
926
1043
|
}
|
|
927
|
-
case
|
|
928
|
-
case
|
|
929
|
-
case
|
|
1044
|
+
case Ae.Fill: return Y(t);
|
|
1045
|
+
case Ae.Borders: return Q(t);
|
|
1046
|
+
case Ae.Alignment: {
|
|
930
1047
|
const e = t.getAlignment(), n = [];
|
|
931
1048
|
return "general" !== e.getHorizontal() && n.push(`h ${e.getHorizontal()}`), "bottom" !== e.getVertical() && n.push(`v ${e.getVertical()}`), "visible" !== e.getOverflow() && n.push(String(e.getOverflow())), e.getIndent() && n.push(`indent ${e.getIndent()}`), e.getRotation() && n.push(`rotation ${e.getRotation()}`), n.length > 0 ? n.join(" · ") : null;
|
|
932
1049
|
}
|
|
933
1050
|
default: return null;
|
|
934
1051
|
}
|
|
935
1052
|
}
|
|
936
|
-
var
|
|
937
|
-
function
|
|
938
|
-
const { sorted: o, top: r, rare: s, more: l } =
|
|
939
|
-
|
|
940
|
-
|
|
1053
|
+
var rt = 110;
|
|
1054
|
+
function st(e, t, n) {
|
|
1055
|
+
const { sorted: o, top: r, rare: s, more: l } = Ve(t, n), a = [...r, ...s].map((e) => [
|
|
1056
|
+
Pe(e, "cells"),
|
|
1057
|
+
De(e.blocks),
|
|
941
1058
|
e.label
|
|
942
1059
|
]), i = [0, 1].map((e) => Math.max(...a.map((t) => t[e].length))), c = a.map((e) => ` ${e[0].padEnd(i[0])} ${e[1].padEnd(i[1])} ${e[2]}`);
|
|
943
1060
|
l > 0 && c.splice(r.length, 0, ` …and ${l} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
|
|
944
1061
|
const u = n?.manyDistinct ?? 20;
|
|
945
1062
|
return [o.length > u ? `${e.padEnd(10)}${o.length} distinct` : e, ...c];
|
|
946
1063
|
}
|
|
947
|
-
var
|
|
948
|
-
function
|
|
1064
|
+
var lt = 6;
|
|
1065
|
+
function at(t, n, o, r, s) {
|
|
949
1066
|
if (0 === n.length) return [];
|
|
950
1067
|
const l = /* @__PURE__ */ new Map();
|
|
951
1068
|
for (const e of n) {
|
|
@@ -965,20 +1082,20 @@ function et(t, n, o, r, s) {
|
|
|
965
1082
|
}
|
|
966
1083
|
return i;
|
|
967
1084
|
}
|
|
968
|
-
var
|
|
1085
|
+
var it = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, ct = (e) => {
|
|
969
1086
|
if (!e) return null;
|
|
970
1087
|
if ("string" != typeof e) return Z(e);
|
|
971
1088
|
const t = e.replace(/^#/, "");
|
|
972
1089
|
return /^[0-9a-f]{6}$/i.test(t) || /^[0-9a-f]{8}$/i.test(t) ? `#${(8 === t.length && /^ff/i.test(t) ? t.slice(2) : t).toUpperCase()}` : e;
|
|
973
|
-
},
|
|
1090
|
+
}, ut = (e) => {
|
|
974
1091
|
if (!e) return null;
|
|
975
1092
|
const t = [], n = ((e) => {
|
|
976
1093
|
if (!e) return null;
|
|
977
|
-
if ("string" == typeof e) return
|
|
1094
|
+
if ("string" == typeof e) return ct(e);
|
|
978
1095
|
const t = e.type;
|
|
979
1096
|
if (t === u.Type.None) return null;
|
|
980
1097
|
if (t === u.Type.Gradient) return "gradient";
|
|
981
|
-
const n = e, o =
|
|
1098
|
+
const n = e, o = ct(n.foreground ?? e.color ?? n.background), r = n.patternType;
|
|
982
1099
|
return [r && r !== u.BuiltInSheetPattern.Solid ? `${r} pattern` : null, o].filter(Boolean).join(" ") || null;
|
|
983
1100
|
})(e.fill);
|
|
984
1101
|
n && t.push(`fill ${n}`);
|
|
@@ -986,7 +1103,7 @@ var tt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, nt = (e) => {
|
|
|
986
1103
|
if (o) {
|
|
987
1104
|
const e = [];
|
|
988
1105
|
(void 0 !== o.weight ? o.weight >= 600 : !0 === o.bold) && e.push("bold"), (void 0 !== o.style ? o.style === g.Style.Italic : !0 === o.italic) && e.push("italic"), o.strike && e.push("strike"), o.underline && o.underline !== g.UnderlineStyle.None && e.push(`underline ${o.underline}`);
|
|
989
|
-
const n = "auto" === o.color ? null :
|
|
1106
|
+
const n = "auto" === o.color ? null : ct(o.color);
|
|
990
1107
|
n && e.push(`text ${n}`), e.length > 0 && t.push(e.join(" "));
|
|
991
1108
|
}
|
|
992
1109
|
if (void 0 !== e.numberFormat && null !== e.numberFormat) {
|
|
@@ -994,30 +1111,30 @@ var tt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, nt = (e) => {
|
|
|
994
1111
|
n && t.push(n);
|
|
995
1112
|
}
|
|
996
1113
|
return e.borders && t.push("border"), e.alignment && t.push("alignment"), t.length > 0 ? t.join(" · ") : null;
|
|
997
|
-
},
|
|
998
|
-
const t = e.type ?? i.ColorStopType.Num, n = e.value, o = null == n || "" === n ? t : `${t} ${n}`, r =
|
|
1114
|
+
}, gt = (e) => {
|
|
1115
|
+
const t = e.type ?? i.ColorStopType.Num, n = e.value, o = null == n || "" === n ? t : `${t} ${n}`, r = ct(e.color);
|
|
999
1116
|
return r ? `${o} ${r}` : o;
|
|
1000
|
-
},
|
|
1117
|
+
}, dt = (e) => {
|
|
1001
1118
|
let t = e.type;
|
|
1002
1119
|
if (e.type === i.ScaleType.DataBar) {
|
|
1003
|
-
const n =
|
|
1120
|
+
const n = ct(e.color);
|
|
1004
1121
|
n && (t += ` ${n}`);
|
|
1005
1122
|
} else e.type === i.ScaleType.IconSet && (e.iconSet && (t += ` ${e.iconSet}`), e.reverse && (t += " reversed"), e.icon?.length && (t += " custom icons"));
|
|
1006
|
-
const n = (e.stops ?? []).map(
|
|
1123
|
+
const n = (e.stops ?? []).map(gt).join(" → ");
|
|
1007
1124
|
return n ? `${t} · ${n}` : t;
|
|
1008
|
-
},
|
|
1125
|
+
}, ht = "(no rule)", ft = (e) => {
|
|
1009
1126
|
const t = e.getScale(), n = [];
|
|
1010
|
-
if (t) n.push(
|
|
1127
|
+
if (t) n.push(dt(t));
|
|
1011
1128
|
else {
|
|
1012
|
-
n.push(e.getCondition()?.toString() ||
|
|
1013
|
-
const t =
|
|
1129
|
+
n.push(e.getCondition()?.toString() || ht);
|
|
1130
|
+
const t = ut(e.getStyle());
|
|
1014
1131
|
t && n.push(`→ ${t}`);
|
|
1015
1132
|
}
|
|
1016
|
-
return e.isStopIfTrue() && n.push("· stop if true"),
|
|
1017
|
-
},
|
|
1018
|
-
const t = [e.getCondition()?.toString() ||
|
|
1019
|
-
return n && t.push(n), e.isIncludeBlanks() && t.push("blanks allowed"), e.isHideDropdown() && t.push("no dropdown"),
|
|
1020
|
-
},
|
|
1133
|
+
return e.isStopIfTrue() && n.push("· stop if true"), it(n.join(" "), 90);
|
|
1134
|
+
}, mt = (e) => {
|
|
1135
|
+
const t = [e.getCondition()?.toString() || ht], n = e.getAlertStyle();
|
|
1136
|
+
return n && t.push(n), e.isIncludeBlanks() && t.push("blanks allowed"), e.isHideDropdown() && t.push("no dropdown"), it(t.join(" · "), 90);
|
|
1137
|
+
}, pt = (e) => {
|
|
1021
1138
|
if (e?.getOperator()?.getName() !== a.BuiltInOperatorNames.InSet) return null;
|
|
1022
1139
|
const t = e.getParam();
|
|
1023
1140
|
if (!t) return null;
|
|
@@ -1029,163 +1146,73 @@ var tt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, nt = (e) => {
|
|
|
1029
1146
|
n.push(t > 0 ? `${e.join(", ")}, +${t} more` : e.join(", "));
|
|
1030
1147
|
}
|
|
1031
1148
|
return n.length > 0 ? n.join(", ") : null;
|
|
1032
|
-
},
|
|
1149
|
+
}, $t = (e, t) => {
|
|
1033
1150
|
if (0 === e.length) return null;
|
|
1034
1151
|
const n = e.slice(0, 3).map(t), o = e.length - n.length;
|
|
1035
1152
|
return o > 0 ? `${n.join(" | ")} | +${o} more` : n.join(" | ");
|
|
1036
|
-
},
|
|
1037
|
-
function
|
|
1153
|
+
}, wt = l.Feature, yt = (e) => e.getRange().getStyle(), bt = (e) => N(e.getCell(), v.Mode.Display)?.display ?? null;
|
|
1154
|
+
function St(e, t) {
|
|
1038
1155
|
switch (e) {
|
|
1039
|
-
case
|
|
1040
|
-
case
|
|
1041
|
-
case
|
|
1042
|
-
const t =
|
|
1156
|
+
case wt.Formula: return (e) => e.getCell().getFormulaText();
|
|
1157
|
+
case wt.Error: return bt;
|
|
1158
|
+
case wt.CalcError: return (e) => {
|
|
1159
|
+
const t = bt(e) ?? "", n = e.getCell().getFormulaText();
|
|
1043
1160
|
return (n ? `${t} ${n}` : t).trim() || null;
|
|
1044
1161
|
};
|
|
1045
|
-
case
|
|
1046
|
-
case
|
|
1162
|
+
case wt.CalcStatus: return (e) => e.getCell().getCalculationStatus();
|
|
1163
|
+
case wt.Anomalies: return (e) => {
|
|
1047
1164
|
const t = e.getCell(), n = function(e, t) {
|
|
1048
1165
|
let n = e.getAnomalies();
|
|
1049
1166
|
return !1 === t?.constants && (n = n.filter((e) => e.check !== O.ConstantFrequency)), 0 === n.length ? null : n.map((t) => D(t, e)).join("; ");
|
|
1050
1167
|
}(t, { constants: !1 });
|
|
1051
1168
|
if (!n) return null;
|
|
1052
|
-
const o = t.getFormulaText() ??
|
|
1169
|
+
const o = t.getFormulaText() ?? bt(e);
|
|
1053
1170
|
return o ? `${n} · here ${o}` : n;
|
|
1054
1171
|
};
|
|
1055
|
-
case
|
|
1056
|
-
case
|
|
1172
|
+
case wt.Merge: return bt;
|
|
1173
|
+
case wt.Comments: return (e) => {
|
|
1057
1174
|
const t = e.getCell().getComments()?.getContent();
|
|
1058
1175
|
if ("string" != typeof t) return null;
|
|
1059
1176
|
const n = t.replace(/\s+/g, " ").trim();
|
|
1060
1177
|
return n ? n.length > 60 ? `${n.slice(0, 59)}…` : n : null;
|
|
1061
1178
|
};
|
|
1062
|
-
case
|
|
1179
|
+
case wt.Spills: return (e) => {
|
|
1063
1180
|
const t = e.getCell();
|
|
1064
1181
|
return "error" === t.getSpillKind() ? null : t.getSpill()?.getValuesRange().toString() ?? null;
|
|
1065
1182
|
};
|
|
1066
|
-
case
|
|
1067
|
-
case
|
|
1068
|
-
case
|
|
1069
|
-
case
|
|
1070
|
-
case
|
|
1071
|
-
case
|
|
1072
|
-
case
|
|
1073
|
-
case
|
|
1074
|
-
const t =
|
|
1183
|
+
case wt.Hyperlink: return (e) => e.getCell().getHyperlink()?.getAddress() ?? null;
|
|
1184
|
+
case wt.Table: return (e) => ge(e.getCell())?.getName() ?? null;
|
|
1185
|
+
case wt.Fill: return (e) => Y(yt(e));
|
|
1186
|
+
case wt.Borders: return (e) => Q(yt(e));
|
|
1187
|
+
case wt.NumberFormat: return (e) => ne(yt(e));
|
|
1188
|
+
case wt.Alignment: return t ? (e) => oe(yt(e), t) : void 0;
|
|
1189
|
+
case wt.Font: return t ? (e) => re(yt(e), t) : void 0;
|
|
1190
|
+
case wt.Protection: return (e) => {
|
|
1191
|
+
const t = yt(e).getProtection(), n = [];
|
|
1075
1192
|
return t.isAlwaysUnlocked() && n.push("always unlocked"), t.isShowFormulas() || n.push("formulas hidden"), n.join(", ") || null;
|
|
1076
1193
|
};
|
|
1077
|
-
case
|
|
1194
|
+
case wt.Unlock: return (e) => {
|
|
1078
1195
|
const t = [];
|
|
1079
1196
|
e.getCell().getProtection().isAlwaysUnlocked() && t.push("always unlocked");
|
|
1080
1197
|
const n = e.getRange();
|
|
1081
1198
|
for (const e of n.getWorksheet().getProtectedRanges().getItems({ address: n })) t.push(`range ${e.getName()}${e.isUnlocked() ? "" : " · password"}`);
|
|
1082
1199
|
return t.join(", ") || null;
|
|
1083
1200
|
};
|
|
1084
|
-
case
|
|
1085
|
-
case
|
|
1086
|
-
case
|
|
1087
|
-
case
|
|
1201
|
+
case wt.Conditionals: return (e) => $t(e.getRange().getConditionalFormats(), ft);
|
|
1202
|
+
case wt.DataValidations: return (e) => $t(e.getRange().getDataValidations(), mt);
|
|
1203
|
+
case wt.Role: return (e) => e.getCell().getRole();
|
|
1204
|
+
case wt.Contentful: return (e) => Ne(e.getRange()).join(" ") || null;
|
|
1088
1205
|
default: return;
|
|
1089
1206
|
}
|
|
1090
1207
|
}
|
|
1091
|
-
function
|
|
1092
|
-
const n = e.map((e) =>
|
|
1208
|
+
function xt(e, t) {
|
|
1209
|
+
const n = e.map((e) => St(e, t)).filter((e) => !!e);
|
|
1093
1210
|
if (0 !== n.length) return 1 === n.length ? n[0] : (e) => {
|
|
1094
1211
|
const t = n.map((t) => t(e)).filter(Boolean);
|
|
1095
1212
|
return t.length > 0 ? t.join(" ") : null;
|
|
1096
1213
|
};
|
|
1097
1214
|
}
|
|
1098
|
-
|
|
1099
|
-
constructor() {
|
|
1100
|
-
this._lines = [], this._headingOffset = 0;
|
|
1101
|
-
}
|
|
1102
|
-
setHeadingOffset(e) {
|
|
1103
|
-
return this._headingOffset = e, this;
|
|
1104
|
-
}
|
|
1105
|
-
_heading(e, t) {
|
|
1106
|
-
return this._lines.push(`${"#".repeat(Math.min(6, e + this._headingOffset))} ${t}`), this;
|
|
1107
|
-
}
|
|
1108
|
-
h1(e) {
|
|
1109
|
-
return this._heading(1, e);
|
|
1110
|
-
}
|
|
1111
|
-
h2(e) {
|
|
1112
|
-
return this._heading(2, e);
|
|
1113
|
-
}
|
|
1114
|
-
h3(e) {
|
|
1115
|
-
return this._heading(3, e);
|
|
1116
|
-
}
|
|
1117
|
-
text(e) {
|
|
1118
|
-
return this._lines.push(e), this;
|
|
1119
|
-
}
|
|
1120
|
-
blank() {
|
|
1121
|
-
return this._lines.push(""), this;
|
|
1122
|
-
}
|
|
1123
|
-
bullet(e) {
|
|
1124
|
-
return "string" == typeof e ? this._lines.push(`- ${e}`) : e.forEach((e) => this._lines.push(`- ${e}`)), this;
|
|
1125
|
-
}
|
|
1126
|
-
fact(e) {
|
|
1127
|
-
return "string" == typeof e ? this._lines.push(` ${e}`) : e.forEach((e) => this._lines.push(` ${e}`)), this;
|
|
1128
|
-
}
|
|
1129
|
-
bold(e) {
|
|
1130
|
-
return `**${e}**`;
|
|
1131
|
-
}
|
|
1132
|
-
codespan(e) {
|
|
1133
|
-
return `\`${e}\``;
|
|
1134
|
-
}
|
|
1135
|
-
code(e, t = "") {
|
|
1136
|
-
return `\`\`\`${t}\n${e}\n\`\`\``;
|
|
1137
|
-
}
|
|
1138
|
-
beginFrame(e) {
|
|
1139
|
-
return new $t(this, e);
|
|
1140
|
-
}
|
|
1141
|
-
_addLines(e) {
|
|
1142
|
-
this._lines.push(...e);
|
|
1143
|
-
}
|
|
1144
|
-
toLines() {
|
|
1145
|
-
return [...this._lines];
|
|
1146
|
-
}
|
|
1147
|
-
}, $t = class {
|
|
1148
|
-
constructor(e, t) {
|
|
1149
|
-
this._parent = e, this._headers = t, this._indexWidth = 0, this._rows = [], this._colWidths = t.map((e) => e.length);
|
|
1150
|
-
}
|
|
1151
|
-
addRow(e, t) {
|
|
1152
|
-
const n = e.map((e) => "string" == typeof e ? { text: e } : e);
|
|
1153
|
-
return n.forEach((e, t) => {
|
|
1154
|
-
this._colWidths[t] = Math.max(this._colWidths[t] ?? 0, e.text.length);
|
|
1155
|
-
}), void 0 !== t && (this._indexWidth = Math.max(this._indexWidth, t.length)), this._rows.push({
|
|
1156
|
-
index: t,
|
|
1157
|
-
cells: n
|
|
1158
|
-
}), this;
|
|
1159
|
-
}
|
|
1160
|
-
endFrame() {
|
|
1161
|
-
return this._parent._addLines(this._renderLines()), this._parent;
|
|
1162
|
-
}
|
|
1163
|
-
_columnAlignment(e) {
|
|
1164
|
-
let t = 0, n = 0;
|
|
1165
|
-
for (const o of this._rows) {
|
|
1166
|
-
const r = o.cells[e];
|
|
1167
|
-
r && r.text && (n++, "right" === r.alignment && t++);
|
|
1168
|
-
}
|
|
1169
|
-
return n > 0 && 2 * t >= n ? "right" : void 0;
|
|
1170
|
-
}
|
|
1171
|
-
_renderLines() {
|
|
1172
|
-
const e = " ", t = this._indexWidth > 0 ? " ".repeat(this._indexWidth) : "", n = this._colWidths.map((e, t) => this._columnAlignment(t)), o = [];
|
|
1173
|
-
if (this._headers.some((e) => e.length > 0)) {
|
|
1174
|
-
const r = this._headers.map((e, t) => wt(e, this._colWidths[t], n[t])).join(e);
|
|
1175
|
-
o.push(`${t}${t ? e : ""}${r}`.trimEnd());
|
|
1176
|
-
}
|
|
1177
|
-
for (const t of this._rows) {
|
|
1178
|
-
const n = t.cells.map((e, t) => wt(e.text, this._colWidths[t], e.alignment)).join(e), r = this._indexWidth > 0 ? (t.index ?? "").padStart(this._indexWidth) + e : "";
|
|
1179
|
-
o.push(`${r}${n}`.trimEnd());
|
|
1180
|
-
}
|
|
1181
|
-
return o;
|
|
1182
|
-
}
|
|
1183
|
-
}, wt = (e, t, n) => {
|
|
1184
|
-
if (e.length >= t) return e;
|
|
1185
|
-
const o = t - e.length;
|
|
1186
|
-
return "right" === n ? e.padStart(t) : "center" === n ? " ".repeat(Math.floor(o / 2)) + e + " ".repeat(Math.ceil(o / 2)) : e.padEnd(t);
|
|
1187
|
-
};
|
|
1188
|
-
function yt(e, t, n) {
|
|
1215
|
+
function kt(e, t, n) {
|
|
1189
1216
|
const o = n?.collapse ? function(e, t) {
|
|
1190
1217
|
const n = [], o = /* @__PURE__ */ new Map();
|
|
1191
1218
|
for (const r of e) {
|
|
@@ -1200,12 +1227,12 @@ function yt(e, t, n) {
|
|
|
1200
1227
|
for (let t = 0; t < l.length; t++) {
|
|
1201
1228
|
const r = l[t], s = n?.payload?.(r), a = r.isClipped() ? " ✂ clipped at the query edge — the block continues" : "", h = ` ${i[t].padEnd(c)} ${u[t].padEnd(g)}`;
|
|
1202
1229
|
if (t < d) {
|
|
1203
|
-
const t =
|
|
1230
|
+
const t = pe(r, n);
|
|
1204
1231
|
if (e.text(`${h} ${t.summary}${a}`), !1 === n?.series) continue;
|
|
1205
1232
|
for (const n of t.series) e.text(` ${n}`);
|
|
1206
1233
|
continue;
|
|
1207
1234
|
}
|
|
1208
|
-
const f = o ?
|
|
1235
|
+
const f = o ? vt(o[t]) : "";
|
|
1209
1236
|
e.text(s ? `${h} ${s}${f}${a}` : `${h}${f}${a}`.trimEnd());
|
|
1210
1237
|
}
|
|
1211
1238
|
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) {
|
|
@@ -1213,85 +1240,58 @@ function yt(e, t, n) {
|
|
|
1213
1240
|
e.text(` …truncated at ${s} of ${a} · ${l}`);
|
|
1214
1241
|
}
|
|
1215
1242
|
}
|
|
1216
|
-
var
|
|
1217
|
-
function
|
|
1243
|
+
var Ct = 6;
|
|
1244
|
+
function vt(e) {
|
|
1218
1245
|
if (e.length < 2) return "";
|
|
1219
1246
|
const t = e.slice(1);
|
|
1220
|
-
return ` · also at ${t.slice(0,
|
|
1247
|
+
return ` · also at ${t.slice(0, Ct).map((e) => e.toString()).join(", ")}${t.length > Ct ? ` +${t.length - Ct} more` : ""}`;
|
|
1221
1248
|
}
|
|
1222
|
-
var
|
|
1249
|
+
var Et = (e) => {
|
|
1223
1250
|
const t = e.getCell().getAnomalies();
|
|
1224
1251
|
return t.length > 0 ? JSON.stringify(t.map((e) => [e.check, e.evidence])) : null;
|
|
1225
1252
|
};
|
|
1226
|
-
function
|
|
1227
|
-
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
|
|
1253
|
+
function Rt(e, t) {
|
|
1254
|
+
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();
|
|
1228
1255
|
i.h1(`Regions — ${r} (${n.length})`);
|
|
1229
1256
|
const c = 1 === o.length && o[0] === l.Feature.Anomalies;
|
|
1230
|
-
return
|
|
1257
|
+
return kt(i, n, {
|
|
1231
1258
|
...t,
|
|
1232
1259
|
profile: s,
|
|
1233
|
-
payload: s ? void 0 :
|
|
1234
|
-
collapse: c ?
|
|
1260
|
+
payload: s ? void 0 : xt(o, a),
|
|
1261
|
+
collapse: c ? Et : void 0
|
|
1235
1262
|
}), i.toLines().join("\n").trimEnd();
|
|
1236
1263
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
for (const n of Ct(t.table)) e.text(` ${n}`);
|
|
1257
|
-
}
|
|
1258
|
-
e.blank();
|
|
1259
|
-
}
|
|
1260
|
-
function Et(e) {
|
|
1261
|
-
const t = new pt();
|
|
1262
|
-
return t.h1(`Table — ${e.getName()}`), t.fact(Ct(e, [["range", Ot(e.getRange())]])), t.toLines().join("\n").trimEnd();
|
|
1263
|
-
}
|
|
1264
|
-
var Rt = l.Feature, Nt = [
|
|
1265
|
-
Rt.Error,
|
|
1266
|
-
Rt.CalcError,
|
|
1267
|
-
Rt.Anomalies,
|
|
1268
|
-
Rt.Contentful,
|
|
1269
|
-
Rt.Formula,
|
|
1270
|
-
Rt.Spills,
|
|
1271
|
-
Rt.Merge,
|
|
1272
|
-
Rt.AutoTable,
|
|
1273
|
-
Rt.Hyperlink,
|
|
1274
|
-
Rt.Comments,
|
|
1275
|
-
Rt.NumberFormat,
|
|
1276
|
-
Rt.Font,
|
|
1277
|
-
Rt.Fill,
|
|
1278
|
-
Rt.Borders,
|
|
1279
|
-
Rt.Alignment,
|
|
1280
|
-
Rt.Conditionals,
|
|
1281
|
-
Rt.DataValidations
|
|
1282
|
-
], jt = new Map(Object.entries(Rt).map(([e, t]) => [t, e])), Mt = (e) => jt.get(e) ?? e;
|
|
1264
|
+
var Nt = l.Feature, jt = [
|
|
1265
|
+
Nt.Error,
|
|
1266
|
+
Nt.CalcError,
|
|
1267
|
+
Nt.Anomalies,
|
|
1268
|
+
Nt.Contentful,
|
|
1269
|
+
Nt.Formula,
|
|
1270
|
+
Nt.Spills,
|
|
1271
|
+
Nt.Merge,
|
|
1272
|
+
Nt.AutoTable,
|
|
1273
|
+
Nt.Hyperlink,
|
|
1274
|
+
Nt.Comments,
|
|
1275
|
+
Nt.NumberFormat,
|
|
1276
|
+
Nt.Font,
|
|
1277
|
+
Nt.Fill,
|
|
1278
|
+
Nt.Borders,
|
|
1279
|
+
Nt.Alignment,
|
|
1280
|
+
Nt.Conditionals,
|
|
1281
|
+
Nt.DataValidations
|
|
1282
|
+
], Mt = new Map(Object.entries(Nt).map(([e, t]) => [t, e])), Ft = (e) => Mt.get(e) ?? e;
|
|
1283
1283
|
function It(e) {
|
|
1284
|
-
const t = new Map(Object.values(
|
|
1284
|
+
const t = new Map(Object.values(Nt).map((e) => [e.toLowerCase(), e])), n = [];
|
|
1285
1285
|
for (const o of e.split(",")) {
|
|
1286
1286
|
const e = o.trim();
|
|
1287
1287
|
if (!e) continue;
|
|
1288
1288
|
const r = t.get(e.toLowerCase());
|
|
1289
|
-
if (!r) throw new Error(`Unknown feature '${e}'. Features: ${Object.values(
|
|
1289
|
+
if (!r) throw new Error(`Unknown feature '${e}'. Features: ${Object.values(Nt).join(", ")}.`);
|
|
1290
1290
|
n.push(r);
|
|
1291
1291
|
}
|
|
1292
1292
|
return n;
|
|
1293
1293
|
}
|
|
1294
|
-
var
|
|
1294
|
+
var Tt = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, At = (t) => e.sheetNameToString(t) ?? "Untitled", Lt = (e) => `wb.getWorksheet(${JSON.stringify(e.getWorksheet().getName())})`, Wt = (e) => ((e) => {
|
|
1295
1295
|
if (!e.includes("$")) return e;
|
|
1296
1296
|
let t = "", n = !1;
|
|
1297
1297
|
for (const o of e) {
|
|
@@ -1300,20 +1300,20 @@ var Ft = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, Tt
|
|
|
1300
1300
|
t += o;
|
|
1301
1301
|
}
|
|
1302
1302
|
return t;
|
|
1303
|
-
})(e.getAddress()),
|
|
1304
|
-
const t =
|
|
1305
|
-
return t.includes("!") ? t : `${
|
|
1306
|
-
},
|
|
1303
|
+
})(e.getAddress()), Ot = (e) => {
|
|
1304
|
+
const t = Wt(e);
|
|
1305
|
+
return t.includes("!") ? t : `${At(e.getWorksheet().getName())}!${t}`;
|
|
1306
|
+
}, Pt = (e) => {
|
|
1307
1307
|
const t = e.toString();
|
|
1308
|
-
return `${t.includes("!") ? t : `${
|
|
1308
|
+
return `${t.includes("!") ? t : `${At(e.getWorksheet().getName())}!${t}`}, ${e.getRowCount()}×${e.getColumnCount()}`;
|
|
1309
1309
|
};
|
|
1310
|
-
function
|
|
1311
|
-
const n =
|
|
1310
|
+
function Dt(e, t) {
|
|
1311
|
+
const n = nt(t, [...t.getRegions(Nt.Formula)]), o = t.getStats({ onError: "ignore" }).getCount();
|
|
1312
1312
|
e.h2(`Kind (${o} cell${1 !== o ? "s" : ""} · ${n.length} kind${1 !== n.length ? "s" : ""})`);
|
|
1313
1313
|
for (const [t, o] of n) e.text(` ${t.padEnd(10)}${o}`);
|
|
1314
1314
|
0 === n.length && e.fact("None"), e.blank();
|
|
1315
1315
|
}
|
|
1316
|
-
var
|
|
1316
|
+
var Ht = [
|
|
1317
1317
|
s.Role.Label,
|
|
1318
1318
|
s.Role.Input,
|
|
1319
1319
|
s.Role.Link,
|
|
@@ -1321,8 +1321,8 @@ var Dt = [
|
|
|
1321
1321
|
s.Role.Computed,
|
|
1322
1322
|
s.Role.Output
|
|
1323
1323
|
];
|
|
1324
|
-
function
|
|
1325
|
-
const n = [...t.getRegions([
|
|
1324
|
+
function Vt(e, t) {
|
|
1325
|
+
const n = [...t.getRegions([Nt.Role, Nt.Font])];
|
|
1326
1326
|
if (0 === n.length) return;
|
|
1327
1327
|
const o = t.getWorksheet().getWorkbook()?.getStyles() ?? null, r = (e) => {
|
|
1328
1328
|
if (!e) return null;
|
|
@@ -1342,7 +1342,7 @@ function Ht(e, t) {
|
|
|
1342
1342
|
}
|
|
1343
1343
|
if (0 !== l.size) {
|
|
1344
1344
|
e.h2(`Roles (${a} cell${1 !== a ? "s" : ""} · ${l.size} role${1 !== l.size ? "s" : ""})`);
|
|
1345
|
-
for (const t of
|
|
1345
|
+
for (const t of Ht) {
|
|
1346
1346
|
const n = l.get(t);
|
|
1347
1347
|
if (!n) continue;
|
|
1348
1348
|
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 +1351,45 @@ function Ht(e, t) {
|
|
|
1351
1351
|
e.blank();
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
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 =
|
|
1354
|
+
function Bt(e, t, n) {
|
|
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 = jt.filter((e) => !r || r.has(e));
|
|
1356
1356
|
if (0 === s.length) return;
|
|
1357
1357
|
const l = t.getCounts(s);
|
|
1358
1358
|
let a;
|
|
1359
|
-
const i = () => a ??= [...t.getWorksheet().getEntireRange().getRegions(
|
|
1359
|
+
const i = () => a ??= [...t.getWorksheet().getEntireRange().getRegions(Nt.Contentful)].map((e) => e.getCoords());
|
|
1360
1360
|
for (const r of s) {
|
|
1361
|
-
let s = r ===
|
|
1362
|
-
if (r ===
|
|
1363
|
-
c &&
|
|
1364
|
-
const n = o && r !==
|
|
1365
|
-
n && (e.h2(`${
|
|
1361
|
+
let s = r === Nt.Contentful ? Jt(t) : [...t.getRegions(r)], a = l[r] ?? 0, c = null;
|
|
1362
|
+
if (r === Nt.Anomalies && (c = s, s = s.filter((e) => !U(e.getCell().getAnomalies())), a = s.reduce((e, t) => e + t.getRowCount() * t.getColumnCount(), 0)), 0 === s.length) {
|
|
1363
|
+
c && Ut(e, t, c);
|
|
1364
|
+
const n = o && r !== Nt.Font ? ot(r, o) : null;
|
|
1365
|
+
n && (e.h2(`${Ft(r)} (${qt(0, 0)})`), e.text(` ${"normal".padEnd(10)}${n}`), e.blank());
|
|
1366
1366
|
continue;
|
|
1367
1367
|
}
|
|
1368
|
-
const u = !!n?.profile && r ===
|
|
1368
|
+
const u = !!n?.profile && r === Nt.Contentful, g = `${Lt(t)}.getRegions(${JSON.stringify(r)})`, d = `${g} lists all ${s.length}`, h = Qe(r) ? et(t.getWorksheet(), r, o, {
|
|
1369
1369
|
recovery: d,
|
|
1370
1370
|
content: i()
|
|
1371
|
-
}) : null, f = r ===
|
|
1372
|
-
if (e.h2(`${
|
|
1371
|
+
}) : null, f = r === Nt.Formula ? tt(s, { recovery: d }) : null, m = h ? `${qt(s.length, h.cells)} · ${h.distinct} distinct` : f ? `${qt(s.length, a)} · ${f.distinct} distinct` : qt(s.length, a);
|
|
1372
|
+
if (e.h2(`${Ft(r)} (${m})`), h) {
|
|
1373
1373
|
h.normal && e.text(` ${"normal".padEnd(10)}${h.normal}`);
|
|
1374
1374
|
for (const t of h.tiers) e.text(` ${t}`);
|
|
1375
1375
|
for (const t of h.attributes) e.text(` ${t}`);
|
|
1376
1376
|
e.text(` ${"regions".padEnd(10)}${g}`), e.blank();
|
|
1377
1377
|
} else {
|
|
1378
1378
|
if (f) for (const t of f.lines) e.text(` ${t}`);
|
|
1379
|
-
r ===
|
|
1379
|
+
r === Nt.Contentful && s.sort((e, t) => t.getRowCount() * t.getColumnCount() - e.getRowCount() * e.getColumnCount()), kt(e, s, {
|
|
1380
1380
|
maxRegions: n?.maxRegions,
|
|
1381
1381
|
maxProfiled: n?.maxProfiled,
|
|
1382
1382
|
profile: u,
|
|
1383
1383
|
series: !1,
|
|
1384
|
-
payload: u ? void 0 :
|
|
1385
|
-
collapse: r ===
|
|
1384
|
+
payload: u ? void 0 : St(r, o),
|
|
1385
|
+
collapse: r === Nt.Anomalies ? Et : void 0,
|
|
1386
1386
|
recovery: d
|
|
1387
|
-
}), e.blank(), c &&
|
|
1387
|
+
}), e.blank(), c && Ut(e, t, c);
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
1390
|
}
|
|
1391
|
-
var
|
|
1392
|
-
function
|
|
1391
|
+
var zt = 30, _t = 4;
|
|
1392
|
+
function Ut(e, t, n) {
|
|
1393
1393
|
const o = /* @__PURE__ */ new Map();
|
|
1394
1394
|
let r = 0;
|
|
1395
1395
|
for (const e of n) for (const t of e.getCell().getAnomalies()) {
|
|
@@ -1405,33 +1405,33 @@ function _t(e, t, n) {
|
|
|
1405
1405
|
if (0 === o.size) return;
|
|
1406
1406
|
const l = [...o.values()].sort((e, t) => e.uses - t.uses || (e.text < t.text ? -1 : e.text > t.text ? 1 : 0));
|
|
1407
1407
|
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,
|
|
1408
|
+
const a = Math.min(24, Math.max(10, ...l.slice(0, zt).map((e) => e.text.length + 2)));
|
|
1409
|
+
for (const t of l.slice(0, zt)) {
|
|
1410
|
+
const n = t.places.slice(0, _t).join(", "), o = t.places.length > _t ? ` +${t.places.length - _t} more` : "";
|
|
1411
1411
|
e.text(` ${t.text.padEnd(a)}${t.uses} use${1 === t.uses ? "" : "s"} · ${n}${o}`);
|
|
1412
1412
|
}
|
|
1413
|
-
l.length >
|
|
1413
|
+
l.length > zt && e.text(` …and ${l.length - zt} more · ${Lt(t)}.getAnomalies({ checks: ['constantFrequency'] }) lists every region`), e.blank();
|
|
1414
1414
|
}
|
|
1415
|
-
var
|
|
1415
|
+
var Jt = (e) => [...e.getRegions([Nt.Contentful, Nt.Table])].filter((e) => e.getCell().isContentful()), qt = (e, t) => `${t} cell${1 !== t ? "s" : ""} · ${e} region${1 !== e ? "s" : ""}`, Kt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Gt = (e) => e.isIFormula ? e : null, Xt = (e) => {
|
|
1416
1416
|
const t = e.getScope();
|
|
1417
|
-
return t ? `${
|
|
1418
|
-
},
|
|
1417
|
+
return t ? `${At(t)}!${e.getName()}` : e.getName();
|
|
1418
|
+
}, Zt = (e) => {
|
|
1419
1419
|
const t = e.getAddress();
|
|
1420
|
-
return t.includes("!") ? t : `${
|
|
1420
|
+
return t.includes("!") ? t : `${At(e.getWorksheet().getName())}!${t}`;
|
|
1421
1421
|
};
|
|
1422
|
-
async function
|
|
1423
|
-
const t =
|
|
1422
|
+
async function Yt(e) {
|
|
1423
|
+
const t = Gt(e);
|
|
1424
1424
|
let n;
|
|
1425
1425
|
return n = t ? "=" + t.getExpression() : e.getRanges?.()?.getAddress() ?? "", t && await t.isVolatile() && (n += " (volatile)"), n.trim();
|
|
1426
1426
|
}
|
|
1427
|
-
var
|
|
1427
|
+
var Qt = /* @__PURE__ */ new Set([n.Code.Ref, n.Code.Name]), en = (e) => {
|
|
1428
1428
|
const t = e.value, o = "string" == typeof t ? t : t?.error, r = "string" == typeof o ? n.getBuiltInByLabel(o) : void 0;
|
|
1429
|
-
return r &&
|
|
1430
|
-
},
|
|
1429
|
+
return r && Qt.has(r.getCode()) ? r.getCode() === n.Code.Name ? "#NAME?" : "#REF!" : null;
|
|
1430
|
+
}, tn = /* @__PURE__ */ new Set(), nn = (e) => {
|
|
1431
1431
|
const t = e.value;
|
|
1432
1432
|
return "object" == typeof t && t?.name ? t.name : e.text ?? "";
|
|
1433
1433
|
};
|
|
1434
|
-
function
|
|
1434
|
+
function on(e) {
|
|
1435
1435
|
let t = null;
|
|
1436
1436
|
for (let n = 0; n < e.length; n++) {
|
|
1437
1437
|
const o = e[n];
|
|
@@ -1441,19 +1441,19 @@ function nn(e) {
|
|
|
1441
1441
|
let s = n + 1;
|
|
1442
1442
|
for (; s < e.length && "whitespace" === e[s].type;) s++;
|
|
1443
1443
|
if ("separator" !== e[s]?.type) continue;
|
|
1444
|
-
const l =
|
|
1444
|
+
const l = nn(o).toLowerCase();
|
|
1445
1445
|
l && (t ??= /* @__PURE__ */ new Set()).add(l);
|
|
1446
1446
|
}
|
|
1447
|
-
return t ??
|
|
1447
|
+
return t ?? tn;
|
|
1448
1448
|
}
|
|
1449
|
-
async function
|
|
1449
|
+
async function rn(e, t, n) {
|
|
1450
1450
|
if (0 === t.length) return;
|
|
1451
1451
|
const o = /* @__PURE__ */ new Set();
|
|
1452
1452
|
for (const e of n?.symbols ?? t) o.add(e.getName().toLowerCase());
|
|
1453
1453
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
|
|
1454
1454
|
for (const e of t) r.set(e.getId(), e), e.getScope() && s.add(e.getName().toLowerCase());
|
|
1455
1455
|
const l = await Promise.all(t.map((e) => {
|
|
1456
|
-
const t =
|
|
1456
|
+
const t = Gt(e);
|
|
1457
1457
|
return t ? async function(e, t) {
|
|
1458
1458
|
const n = await e.getDirectDependents();
|
|
1459
1459
|
let o = 0;
|
|
@@ -1470,7 +1470,7 @@ async function on(e, t, n) {
|
|
|
1470
1470
|
r.push(n ? Xt(n) : e.getName());
|
|
1471
1471
|
} else {
|
|
1472
1472
|
const t = e[i];
|
|
1473
|
-
o += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), l.push(
|
|
1473
|
+
o += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), l.push(Zt(a));
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
1476
|
}
|
|
@@ -1484,7 +1484,7 @@ async function on(e, t, n) {
|
|
|
1484
1484
|
for (let e = 0; e < i.length; e++) {
|
|
1485
1485
|
const t = (c.length > 0 ? 2 : 0) + i[e].length;
|
|
1486
1486
|
if (c.length > 0 && u + t > 60) break;
|
|
1487
|
-
c.push(0 === c.length ?
|
|
1487
|
+
c.push(0 === c.length ? Kt(i[e], 60) : i[e]), u += t;
|
|
1488
1488
|
}
|
|
1489
1489
|
const g = i.length - c.length, d = g > 0 ? `, +${g} more` : "";
|
|
1490
1490
|
return {
|
|
@@ -1494,18 +1494,18 @@ async function on(e, t, n) {
|
|
|
1494
1494
|
}(t, r) : Promise.resolve(null);
|
|
1495
1495
|
})), 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
1496
|
const n = function(e, t) {
|
|
1497
|
-
const n =
|
|
1497
|
+
const n = Gt(e), o = [];
|
|
1498
1498
|
if (n) {
|
|
1499
1499
|
const e = n.getTokens();
|
|
1500
1500
|
let r = null, s = null;
|
|
1501
1501
|
for (const n of e) {
|
|
1502
1502
|
if ("error" === n.type) {
|
|
1503
|
-
s ??=
|
|
1503
|
+
s ??= en(n);
|
|
1504
1504
|
continue;
|
|
1505
1505
|
}
|
|
1506
1506
|
if ("named" !== n.type) continue;
|
|
1507
|
-
const l =
|
|
1508
|
-
l && !t.has(l.toLowerCase()) && (r ??=
|
|
1507
|
+
const l = nn(n);
|
|
1508
|
+
l && !t.has(l.toLowerCase()) && (r ??= on(e), r.has(l.toLowerCase()) || o.includes(l) || o.push(l));
|
|
1509
1509
|
}
|
|
1510
1510
|
if (s || o.length > 0) return {
|
|
1511
1511
|
broken: !0,
|
|
@@ -1543,10 +1543,10 @@ async function on(e, t, n) {
|
|
|
1543
1543
|
const l = e.getComment() ?? "", a = Xt(e);
|
|
1544
1544
|
return {
|
|
1545
1545
|
name: a,
|
|
1546
|
-
refersTo: await
|
|
1546
|
+
refersTo: await Yt(e),
|
|
1547
1547
|
dependents: r,
|
|
1548
1548
|
hidden: e.isHidden(),
|
|
1549
|
-
comment:
|
|
1549
|
+
comment: Kt(l, 60),
|
|
1550
1550
|
broken: n.broken,
|
|
1551
1551
|
error: n.error,
|
|
1552
1552
|
sortKey: a.toLowerCase().replace(/'/g, "")
|
|
@@ -1578,7 +1578,7 @@ async function on(e, t, n) {
|
|
|
1578
1578
|
}
|
|
1579
1579
|
e.blank();
|
|
1580
1580
|
}
|
|
1581
|
-
function
|
|
1581
|
+
function sn(e, t, n) {
|
|
1582
1582
|
const o = n.getCoords().min, r = [];
|
|
1583
1583
|
let s = 0, l = 0;
|
|
1584
1584
|
if (n.forEachSpan((e, t) => {
|
|
@@ -1598,7 +1598,7 @@ function rn(e, t, n) {
|
|
|
1598
1598
|
for (const t of r) e.text(` ${t.address.padEnd(a)} ${t.count}`);
|
|
1599
1599
|
l > r.length && e.text(` …and ${l - r.length} more`), e.blank();
|
|
1600
1600
|
}
|
|
1601
|
-
function
|
|
1601
|
+
function ln(e) {
|
|
1602
1602
|
const t = e.getOutline(), n = [];
|
|
1603
1603
|
for (const [e, o] of [[h.Axis.Row, "rows"], [h.Axis.Column, "columns"]]) {
|
|
1604
1604
|
const r = t.getLevelCount(e);
|
|
@@ -1610,10 +1610,10 @@ function sn(e) {
|
|
|
1610
1610
|
}
|
|
1611
1611
|
return n.length > 0 ? n.join(" · ") : null;
|
|
1612
1612
|
}
|
|
1613
|
-
function
|
|
1613
|
+
function an(e, t, n, o) {
|
|
1614
1614
|
if (0 === n.length) return;
|
|
1615
1615
|
const r = n.length > 50 ? n.slice(0, 50) : n, s = r.map((e) => ({
|
|
1616
|
-
address:
|
|
1616
|
+
address: Kt(Wt(e.getRanges()), 40),
|
|
1617
1617
|
rule: o(e)
|
|
1618
1618
|
}));
|
|
1619
1619
|
e.h2(`${t} (${n.length})`);
|
|
@@ -1621,7 +1621,7 @@ function ln(e, t, n, o) {
|
|
|
1621
1621
|
for (const t of s) e.text(` ${t.address.padEnd(l)} ${t.rule}`.trimEnd());
|
|
1622
1622
|
r.length < n.length && e.text(` …and ${n.length - r.length} more`), e.blank();
|
|
1623
1623
|
}
|
|
1624
|
-
function
|
|
1624
|
+
function cn(e, t = !1) {
|
|
1625
1625
|
const n = e.getWorksheet(), o = n.getName(), r = n.getNames(), s = [...r.getItems({
|
|
1626
1626
|
address: e,
|
|
1627
1627
|
allowExtrudes: !0,
|
|
@@ -1642,23 +1642,23 @@ function an(e, t = !1) {
|
|
|
1642
1642
|
}
|
|
1643
1643
|
return s;
|
|
1644
1644
|
}
|
|
1645
|
-
async function
|
|
1645
|
+
async function un(e, t) {
|
|
1646
1646
|
const n = t.getWorksheet();
|
|
1647
|
-
await
|
|
1647
|
+
await rn(e, cn(t, !0), { symbols: n.getWorkbook()?.getNames().getItems({ includeHidden: !0 }) ?? n.getNames().getItems({ includeHidden: !0 }) ?? [] });
|
|
1648
1648
|
const o = t.getColumnHeaders(), r = t.getRowHeaders();
|
|
1649
|
-
|
|
1649
|
+
sn(e, "Hidden Columns", o), sn(e, "Hidden Rows", r);
|
|
1650
1650
|
const s = t.getTables();
|
|
1651
|
-
s.length > 0 &&
|
|
1651
|
+
s.length > 0 && he(e, s, t.getCounts([Nt.Table])[Nt.Table] ?? 0);
|
|
1652
1652
|
}
|
|
1653
|
-
var
|
|
1653
|
+
var gn = "#REF!", dn = (e) => {
|
|
1654
1654
|
const t = e.getContent();
|
|
1655
1655
|
return "chart" === t.getType() && "function" == typeof t.getSeries ? t : null;
|
|
1656
|
-
},
|
|
1656
|
+
}, hn = (t, n) => `${At(t.getName())}!${e.rangeToString(n) ?? ""}`, fn = (e, t) => e ? hn(e.getWorksheet(), e.getCoords()) : t, mn = (e) => e.replace(/\s*[\r\n]+\s*/g, " ⏎ ").trim(), pn = (e, t) => ({
|
|
1657
1657
|
colStart: Math.min(e.colStart, t.colStart),
|
|
1658
1658
|
rowStart: Math.min(e.rowStart, t.rowStart),
|
|
1659
1659
|
colEnd: Math.max(e.colEnd, t.colEnd),
|
|
1660
1660
|
rowEnd: Math.max(e.rowEnd, t.rowEnd)
|
|
1661
|
-
}),
|
|
1661
|
+
}), $n = (e) => {
|
|
1662
1662
|
if (0 === e.length) return null;
|
|
1663
1663
|
const t = e[0], n = t.getValuesRange();
|
|
1664
1664
|
if (!n) return null;
|
|
@@ -1686,54 +1686,54 @@ var un = "#REF!", gn = (e) => {
|
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
1688
|
return {
|
|
1689
|
-
values:
|
|
1689
|
+
values: hn(o, pn(r, d)),
|
|
1690
1690
|
by: s ? null : i,
|
|
1691
|
-
names: u && h ?
|
|
1692
|
-
categories:
|
|
1691
|
+
names: u && h ? hn(u.getWorksheet(), pn(u.getCoords(), h)) : null,
|
|
1692
|
+
categories: fn(t.getCategoriesRange(), c)
|
|
1693
1693
|
};
|
|
1694
|
-
},
|
|
1694
|
+
}, wn = (e) => {
|
|
1695
1695
|
const t = [], n = [
|
|
1696
1696
|
["name", e.getNameFormula()],
|
|
1697
1697
|
["values", e.getValuesFormula()],
|
|
1698
1698
|
["categories", e.getCategoriesFormula()]
|
|
1699
1699
|
];
|
|
1700
|
-
for (const [e, o] of n) o?.includes(
|
|
1700
|
+
for (const [e, o] of n) o?.includes(gn) && t.push(`${e} ${o}`);
|
|
1701
1701
|
return t;
|
|
1702
|
-
},
|
|
1702
|
+
}, yn = (e) => {
|
|
1703
1703
|
let t = 0;
|
|
1704
|
-
for (const n of e)
|
|
1704
|
+
for (const n of e) wn(n).length > 0 && t++;
|
|
1705
1705
|
return t;
|
|
1706
|
-
},
|
|
1706
|
+
}, bn = (e) => {
|
|
1707
1707
|
const t = e.getChartType();
|
|
1708
1708
|
return t && "unknown" !== t ? t : null;
|
|
1709
1709
|
};
|
|
1710
|
-
function
|
|
1711
|
-
const t = [], n =
|
|
1710
|
+
function Sn(e) {
|
|
1711
|
+
const t = [], n = bn(e);
|
|
1712
1712
|
n && t.push(n);
|
|
1713
1713
|
const o = e.getChartTitle();
|
|
1714
1714
|
var r, s;
|
|
1715
|
-
o && t.push(`"${r =
|
|
1715
|
+
o && t.push(`"${r = mn(o), s = 40, r.length > s ? `${r.slice(0, s - 1)}…` : r}"`);
|
|
1716
1716
|
const l = e.getSeries();
|
|
1717
1717
|
if (l.length > 0) {
|
|
1718
1718
|
t.push(`${l.length} series`);
|
|
1719
|
-
const n = e.getPivotSource(), o = n ? null :
|
|
1719
|
+
const n = e.getPivotSource(), o = n ? null : $n(l);
|
|
1720
1720
|
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(`${
|
|
1721
|
+
const r = yn(l);
|
|
1722
|
+
r > 0 && t.push(`${gn} in ${r} series`);
|
|
1723
1723
|
}
|
|
1724
1724
|
return t.length > 0 ? t.join(" · ") : null;
|
|
1725
1725
|
}
|
|
1726
|
-
function
|
|
1726
|
+
function xn(e) {
|
|
1727
1727
|
const t = [], n = e.getChartTitle();
|
|
1728
|
-
n && t.push(["title", `"${
|
|
1728
|
+
n && t.push(["title", `"${mn(n)}"`]);
|
|
1729
1729
|
const o = e.getSeries();
|
|
1730
1730
|
if (0 === o.length) return t;
|
|
1731
|
-
const r = e.getPivotSource(), s = r ? null :
|
|
1731
|
+
const r = e.getPivotSource(), s = r ? null : $n(o);
|
|
1732
1732
|
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", `${
|
|
1733
|
+
const l = yn(o);
|
|
1734
|
+
return l > 0 && t.push(["broken", `${gn} in ${l} series`]), t;
|
|
1735
1735
|
}
|
|
1736
|
-
var
|
|
1736
|
+
var kn = (e) => bn(e) ?? "", Cn = {
|
|
1737
1737
|
hundreds: "hundreds",
|
|
1738
1738
|
thousands: "thousands",
|
|
1739
1739
|
tenThousands: "ten thousands",
|
|
@@ -1743,44 +1743,44 @@ var xn = (e) => yn(e) ?? "", kn = {
|
|
|
1743
1743
|
hundredMillions: "hundred millions",
|
|
1744
1744
|
billions: "billions",
|
|
1745
1745
|
trillions: "trillions"
|
|
1746
|
-
},
|
|
1747
|
-
const t = e.getTitle().getText(), n = [t ? `"${
|
|
1746
|
+
}, vn = (e) => {
|
|
1747
|
+
const t = e.getTitle().getText(), n = [t ? `"${mn(t)}"` : "no title"], o = e.getNumberFormat();
|
|
1748
1748
|
if (o && "General" !== o && n.push(`format ${o}`), "value" === e.getKind()) {
|
|
1749
1749
|
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
1750
|
const t = e.getDisplayUnit();
|
|
1751
|
-
"custom" === t ? n.push(`in units of ${e.getCustomDisplayUnit()}`) : "none" !== t && n.push(`in ${
|
|
1751
|
+
"custom" === t ? n.push(`in units of ${e.getCustomDisplayUnit()}`) : "none" !== t && n.push(`in ${Cn[t] ?? t}`);
|
|
1752
1752
|
}
|
|
1753
1753
|
return e.getReversePlotOrder() && n.push("reversed"), `${e.getKind()} (${n.join(", ")})`;
|
|
1754
|
-
},
|
|
1754
|
+
}, En = (e) => {
|
|
1755
1755
|
const t = [], n = e.reduce((e, t) => e + t.getTrendlines().length, 0);
|
|
1756
1756
|
n > 0 && t.push(`${n} trendline${1 === n ? "" : "s"}`);
|
|
1757
1757
|
const o = e.filter((e) => e.getYErrorBars().getVisible() || e.getXErrorBars().getVisible()).length;
|
|
1758
1758
|
return o > 0 && t.push(`${o} with error bars`), t;
|
|
1759
1759
|
};
|
|
1760
|
-
function
|
|
1761
|
-
const n =
|
|
1760
|
+
function Rn(e, t) {
|
|
1761
|
+
const n = bn(t);
|
|
1762
1762
|
e.fact("Type: chart" + (n ? ` — ${n}` : ""));
|
|
1763
1763
|
const o = t.getChartTitle(), r = !o && t.getTitle().getVisible() ? t.getTitle().getText() : null;
|
|
1764
|
-
e.fact("Title: " + (o ? `"${
|
|
1764
|
+
e.fact("Title: " + (o ? `"${mn(o)}"` : r ? `"${mn(r)}" (automatic)` : "(none)"));
|
|
1765
1765
|
const s = t.getLegend();
|
|
1766
1766
|
e.fact(`Legend: ${s.getVisible() ? s.getPosition() : "(none)"}`);
|
|
1767
1767
|
const l = t.getSeries(), a = t.getPivotSource();
|
|
1768
1768
|
if (a) e.fact(`Series (${l.length}): from pivot table ${a}`);
|
|
1769
1769
|
else if (l.length > 0) {
|
|
1770
|
-
const t =
|
|
1770
|
+
const t = $n(l);
|
|
1771
1771
|
if (t) {
|
|
1772
1772
|
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(...
|
|
1773
|
+
t.names && n.push(`${1 === l.length ? "name" : "names"} ${t.names}`), t.categories && n.push(`categories ${t.categories}`), n.push(...En(l)), e.fact(`Series (${l.length}): ${n.join(" · ")}`);
|
|
1774
1774
|
} else {
|
|
1775
1775
|
(function(e, t) {
|
|
1776
1776
|
const n = t.slice(0, L(t.length, 12)), o = n.map((e) => {
|
|
1777
|
-
const t =
|
|
1777
|
+
const t = fn(e.getValuesRange(), e.getValuesFormula()) ?? "(no values)", n = fn(e.getCategoriesRange(), e.getCategoriesFormula()), o = [`values ${t}`];
|
|
1778
1778
|
n && o.push(`categories ${n}`);
|
|
1779
|
-
const r =
|
|
1779
|
+
const r = fn(e.getNameRange(), e.getNameFormula());
|
|
1780
1780
|
r && o.push(`name ${r}`);
|
|
1781
1781
|
const s = e.getName();
|
|
1782
1782
|
return {
|
|
1783
|
-
name: s ?
|
|
1783
|
+
name: s ? mn(s) : "(unnamed)",
|
|
1784
1784
|
type: e.isSecondaryAxis() ? `${e.getChartType()} · secondary axis` : e.getChartType(),
|
|
1785
1785
|
source: o.join(" · ")
|
|
1786
1786
|
};
|
|
@@ -1790,15 +1790,15 @@ function En(e, t) {
|
|
|
1790
1790
|
for (const t of o) e.text(` ${t.name.padEnd(r)} ${t.type.padEnd(s)} ${t.source}`);
|
|
1791
1791
|
n.length < t.length && e.text(` …and ${t.length - n.length} more · getContent().getSeries() on this movable lists every one`);
|
|
1792
1792
|
})(e, l);
|
|
1793
|
-
const t =
|
|
1793
|
+
const t = En(l);
|
|
1794
1794
|
t.length > 0 && e.fact(`Analysis: ${t.join(" · ")}`);
|
|
1795
1795
|
}
|
|
1796
1796
|
}
|
|
1797
1797
|
const i = t.getAxes().getItems();
|
|
1798
|
-
i.length > 0 && e.fact(`Axes: ${i.map(
|
|
1798
|
+
i.length > 0 && e.fact(`Axes: ${i.map(vn).join(" · ")}`);
|
|
1799
1799
|
}
|
|
1800
|
-
var
|
|
1801
|
-
function
|
|
1800
|
+
var Nn = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd;
|
|
1801
|
+
function jn(e, t) {
|
|
1802
1802
|
const n = e.getWorksheet(), o = n.getWorkbook()?.getWorksheets().getItems({ visibility: m.Visibility.VeryHidden }) ?? [n], r = /* @__PURE__ */ new Map();
|
|
1803
1803
|
for (let e = 0; e < (t?.length ?? 0); e++) {
|
|
1804
1804
|
const n = t.at(e);
|
|
@@ -1808,7 +1808,7 @@ function Nn(e, t) {
|
|
|
1808
1808
|
}
|
|
1809
1809
|
const s = e.getCoords(), l = [];
|
|
1810
1810
|
for (const e of o) for (const t of e.getMovables().getItems({ type: "chart" })) {
|
|
1811
|
-
const e =
|
|
1811
|
+
const e = dn(t);
|
|
1812
1812
|
if (!e || e.getPivotSource()) continue;
|
|
1813
1813
|
let o = null;
|
|
1814
1814
|
for (const t of e.getSeries()) {
|
|
@@ -1819,11 +1819,11 @@ function Nn(e, t) {
|
|
|
1819
1819
|
]) {
|
|
1820
1820
|
if (!e) continue;
|
|
1821
1821
|
const t = e.getCoords();
|
|
1822
|
-
if (e.getWorksheet() === n &&
|
|
1822
|
+
if (e.getWorksheet() === n && Nn(t, s)) {
|
|
1823
1823
|
o = !0;
|
|
1824
1824
|
break;
|
|
1825
1825
|
}
|
|
1826
|
-
null === o && r.get(e.getWorksheet())?.some((e) =>
|
|
1826
|
+
null === o && r.get(e.getWorksheet())?.some((e) => Nn(e, t)) && (o = !1);
|
|
1827
1827
|
}
|
|
1828
1828
|
if (!0 === o) break;
|
|
1829
1829
|
}
|
|
@@ -1834,10 +1834,10 @@ function Nn(e, t) {
|
|
|
1834
1834
|
}
|
|
1835
1835
|
return l;
|
|
1836
1836
|
}
|
|
1837
|
-
var
|
|
1837
|
+
var Mn = (e) => {
|
|
1838
1838
|
const t = e.movable.getRange();
|
|
1839
|
-
return `${
|
|
1840
|
-
},
|
|
1839
|
+
return `${hn(t.getWorksheet(), t.getCoords())} "${e.movable.getContent().getName?.() || "(unnamed)"}"${e.direct ? "" : " (through its dependents)"}`;
|
|
1840
|
+
}, Fn = (e, t, n) => {
|
|
1841
1841
|
const o = e.replace(/\r\n?|\n/g, " ⏎ ");
|
|
1842
1842
|
if (null === t || o.length <= t) return `"${o}"`;
|
|
1843
1843
|
const r = o.charCodeAt(t - 1), s = r >= 55296 && r <= 56319 ? t - 1 : t, l = `(+${o.length - s} chars)`;
|
|
@@ -1845,7 +1845,7 @@ var jn = (e) => {
|
|
|
1845
1845
|
}, In = (e) => {
|
|
1846
1846
|
const t = e.geometry;
|
|
1847
1847
|
return "string" == typeof t ? t : t ? "custom" : "rect";
|
|
1848
|
-
},
|
|
1848
|
+
}, Tn = (e, t) => `${e} ${t}${1 === e ? "" : "s"}`, An = (e, t) => {
|
|
1849
1849
|
switch (e.type) {
|
|
1850
1850
|
case u.Type.None: return "none";
|
|
1851
1851
|
case u.Type.Solid: return String(e.color ?? "solid");
|
|
@@ -1863,31 +1863,31 @@ var jn = (e) => {
|
|
|
1863
1863
|
}
|
|
1864
1864
|
default: return String(e.type);
|
|
1865
1865
|
}
|
|
1866
|
-
},
|
|
1866
|
+
}, Ln = (e, t) => {
|
|
1867
1867
|
if (null === e.style) return "none";
|
|
1868
1868
|
const n = e.style?.[t] ?? S.defaultStyleRefs(e)[t];
|
|
1869
1869
|
return !n || n.index <= 0 ? "none" : `theme style ${n.index}${n.color ? `, ${n.color}` : ""}`;
|
|
1870
|
-
},
|
|
1870
|
+
}, Wn = (e, t, n) => {
|
|
1871
1871
|
if (!e || e === p.LineEndType.None) return null;
|
|
1872
1872
|
const o = [t && t !== p.LineEndSize.Medium ? `wide ${t}` : null, n && n !== p.LineEndSize.Medium ? `long ${n}` : null].filter(Boolean);
|
|
1873
1873
|
return o.length ? `${e} (${o.join(", ")})` : e;
|
|
1874
|
-
},
|
|
1874
|
+
}, On = {
|
|
1875
1875
|
top: "top",
|
|
1876
1876
|
center: "middle",
|
|
1877
1877
|
bottom: "bottom",
|
|
1878
1878
|
justify: "justified",
|
|
1879
1879
|
distributed: "distributed"
|
|
1880
|
-
},
|
|
1880
|
+
}, Pn = (e) => {
|
|
1881
1881
|
if ("string" == typeof e) return e;
|
|
1882
1882
|
const t = e.address ?? e.action ?? "(no address)";
|
|
1883
1883
|
return e.screenTip ? `${t} — "${e.screenTip}"` : t;
|
|
1884
1884
|
};
|
|
1885
|
-
function
|
|
1885
|
+
function Dn(e, t) {
|
|
1886
1886
|
const n = t.toJSON() ?? {};
|
|
1887
1887
|
let o = null;
|
|
1888
1888
|
e.fact(`Shape: ${((e) => {
|
|
1889
1889
|
const t = In(e), n = [], o = e.geometry;
|
|
1890
|
-
return o && "object" == typeof o && (n.push(
|
|
1890
|
+
return o && "object" == typeof o && (n.push(Tn(o.paths.length, "path")), o.ah?.length && n.push(Tn(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
1891
|
})(n)}`);
|
|
1892
1892
|
const r = ((e) => {
|
|
1893
1893
|
const t = Object.entries(e);
|
|
@@ -1895,21 +1895,21 @@ function Pn(e, t) {
|
|
|
1895
1895
|
})(t.getAdjustments());
|
|
1896
1896
|
r && e.fact(`Adjustments: ${r} — the rest at the preset's defaults`);
|
|
1897
1897
|
const s = t.getTextFrame();
|
|
1898
|
-
s && e.fact(`Text: ${
|
|
1898
|
+
s && e.fact(`Text: ${Fn(s.getText(), null, "")}`);
|
|
1899
1899
|
const l = ((e) => {
|
|
1900
1900
|
if (!e) return null;
|
|
1901
1901
|
const t = [];
|
|
1902
|
-
return e.anchor && t.push(
|
|
1902
|
+
return e.anchor && t.push(On[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
1903
|
})(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 =
|
|
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 ? An(n.fill, t) : Ln(n, "fill")}`), e.fact(`Line: ${((e, t) => {
|
|
1905
|
+
const n = e.stroke, o = Ln(e, "stroke");
|
|
1906
1906
|
if (!n) return o;
|
|
1907
1907
|
if (n.fill?.type === u.Type.None) return "none";
|
|
1908
1908
|
const r = [];
|
|
1909
|
-
"number" == typeof n.width && r.push(`${n.width} pt`), r.push(n.fill ?
|
|
1910
|
-
const s =
|
|
1909
|
+
"number" == typeof n.width && r.push(`${n.width} pt`), r.push(n.fill ? An(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}`);
|
|
1910
|
+
const s = Wn(n.headType, n.headWidth, n.headLength);
|
|
1911
1911
|
s && r.push(`head ${s}`);
|
|
1912
|
-
const l =
|
|
1912
|
+
const l = Wn(n.tailType, n.tailWidth, n.tailLength);
|
|
1913
1913
|
return l && r.push(`tail ${l}`), r.join(" · ");
|
|
1914
1914
|
})(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
1915
|
const a = ((e, t) => {
|
|
@@ -1932,45 +1932,45 @@ function Pn(e, t) {
|
|
|
1932
1932
|
}
|
|
1933
1933
|
return t;
|
|
1934
1934
|
})(t.getMovable()));
|
|
1935
|
-
a && e.fact(`Connected: ${a}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${
|
|
1935
|
+
a && e.fact(`Connected: ${a}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${Pn(n.hyperlink)}`), n.hoverHyperlink && e.fact(`Hover Hyperlink: ${Pn(n.hoverHyperlink)}`), n.macro && e.fact(`Macro: ${n.macro}`);
|
|
1936
1936
|
const i = Object.entries(n.locks ?? {}).filter(([, e]) => e).map(([e]) => e);
|
|
1937
1937
|
i.length && e.fact(`Locks: ${i.join(", ")}`);
|
|
1938
1938
|
}
|
|
1939
|
-
var
|
|
1939
|
+
var Hn = (e) => {
|
|
1940
1940
|
const t = e.getContent();
|
|
1941
1941
|
return !0 === t?.isIGroup ? t : null;
|
|
1942
|
-
},
|
|
1943
|
-
const t =
|
|
1942
|
+
}, Vn = (e) => {
|
|
1943
|
+
const t = Bn(e);
|
|
1944
1944
|
return !0 === t?.isIShape ? In(t.toJSON() ?? {}) : e.getContent().getType();
|
|
1945
|
-
},
|
|
1945
|
+
}, Bn = (e) => e.getContent(), zn = (e, t, n) => {
|
|
1946
1946
|
for (const o of t.getItems()) {
|
|
1947
|
-
const t =
|
|
1947
|
+
const t = Bn(o), r = [Vn(o), t.getName?.() || "(unnamed)"];
|
|
1948
1948
|
!0 === t.isIPicture && r.push(t.getResource()?.getName?.() || "(no image)");
|
|
1949
1949
|
const s = t.getTextFrame?.()?.getText();
|
|
1950
|
-
s && r.push(
|
|
1950
|
+
s && r.push(Fn(s, 120, "")), o.isHidden() && r.push("(hidden)"), e.text(`${" ".repeat(n + 2)}${r.join(" · ")}`);
|
|
1951
1951
|
const l = o.getMovables();
|
|
1952
|
-
l &&
|
|
1952
|
+
l && zn(e, l, n + 1);
|
|
1953
1953
|
}
|
|
1954
1954
|
};
|
|
1955
|
-
function
|
|
1955
|
+
function _n(e, t) {
|
|
1956
1956
|
const n = t.toJSON(), o = t.getMovable()?.getMovables()?.getItems() ?? [], r = t.getFill();
|
|
1957
|
-
r && e.fact(`Fill: ${
|
|
1957
|
+
r && e.fact(`Fill: ${An(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: ${Pn(n.hyperlink)}`), n.hoverHyperlink && e.fact(`Hover Hyperlink: ${Pn(n.hoverHyperlink)}`);
|
|
1958
1958
|
const s = Object.entries(n.locks ?? {}).filter(([, e]) => e).map(([e]) => e);
|
|
1959
1959
|
s.length && e.fact(`Locks: ${s.join(", ")}`), e.fact(`Members: ${o.length}, in z-order`);
|
|
1960
1960
|
const l = t.getMovable()?.getMovables();
|
|
1961
|
-
l &&
|
|
1961
|
+
l && zn(e, l, 0);
|
|
1962
1962
|
}
|
|
1963
|
-
var
|
|
1963
|
+
var Un = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Jn = (e) => e.replace(/[\r\n]+/g, " ").trim(), qn = (t) => {
|
|
1964
1964
|
const n = t.getRange();
|
|
1965
1965
|
return e.rangeToString(n.getCoords()) ?? n.toString();
|
|
1966
|
-
},
|
|
1966
|
+
}, Kn = ({ movable: e, text: t }) => Fn(t, 300, ((e) => `${Lt(e.getRange())}.getRange(${JSON.stringify(qn(e))}).getMovables()`)(e)), Gn = (e) => {
|
|
1967
1967
|
const t = e.getContent();
|
|
1968
1968
|
return "function" == typeof t.getTextFrame ? t.getTextFrame()?.getText() ?? "" : null;
|
|
1969
1969
|
};
|
|
1970
1970
|
function Xn(e) {
|
|
1971
1971
|
const t = [];
|
|
1972
1972
|
for (const n of e) {
|
|
1973
|
-
const e =
|
|
1973
|
+
const e = Gn(n) ?? "";
|
|
1974
1974
|
"" !== e.trim() && t.push({
|
|
1975
1975
|
movable: n,
|
|
1976
1976
|
text: e
|
|
@@ -1981,27 +1981,27 @@ function Xn(e) {
|
|
|
1981
1981
|
return n.rowStart - o.rowStart || n.colStart - o.colStart;
|
|
1982
1982
|
});
|
|
1983
1983
|
}
|
|
1984
|
-
var
|
|
1985
|
-
const t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), o =
|
|
1986
|
-
if (o) return
|
|
1987
|
-
|
|
1988
|
-
n ?
|
|
1984
|
+
var Zn = (e) => "picture" === e.getType() && e.getResource?.()?.getName() || null, Yn = (e) => {
|
|
1985
|
+
const t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), o = dn(e);
|
|
1986
|
+
if (o) return Un([
|
|
1987
|
+
Sn(o),
|
|
1988
|
+
n ? Jn(n) : null,
|
|
1989
1989
|
t
|
|
1990
1990
|
].filter(Boolean).join(" · "), 140);
|
|
1991
|
-
const r = e.getContent(), s = [], l =
|
|
1992
|
-
l && s.push(l), n && s.push(
|
|
1993
|
-
return
|
|
1994
|
-
},
|
|
1991
|
+
const r = e.getContent(), s = [], l = Zn(r);
|
|
1992
|
+
l && s.push(l), n && s.push(Jn(n));
|
|
1993
|
+
return Un(s.length > 0 ? `${t} — ${s.join(" · ")}` : t, 90);
|
|
1994
|
+
}, Qn = (e) => {
|
|
1995
1995
|
const t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription();
|
|
1996
|
-
return
|
|
1997
|
-
},
|
|
1996
|
+
return Un(n ? `${t} — ${Jn(n)}` : t, 90);
|
|
1997
|
+
}, eo = /* @__PURE__ */ new Map([
|
|
1998
1998
|
["chart", "Charts"],
|
|
1999
1999
|
["shape", "Shapes"],
|
|
2000
2000
|
["group", "Groups"],
|
|
2001
2001
|
["picture", "Pictures"],
|
|
2002
2002
|
["slicer", "Slicers"]
|
|
2003
|
-
]),
|
|
2004
|
-
function
|
|
2003
|
+
]), to = (e) => eo.get(e) ?? `${e.charAt(0).toUpperCase()}${e.slice(1)}s`;
|
|
2004
|
+
function no(e) {
|
|
2005
2005
|
const t = /* @__PURE__ */ new Map();
|
|
2006
2006
|
for (const n of e) {
|
|
2007
2007
|
const e = n.getContent().getType();
|
|
@@ -2010,31 +2010,31 @@ function to(e) {
|
|
|
2010
2010
|
o ? o.push(n) : t.set(e, [n]);
|
|
2011
2011
|
}
|
|
2012
2012
|
const n = /* @__PURE__ */ new Map();
|
|
2013
|
-
for (const e of
|
|
2013
|
+
for (const e of eo.keys()) {
|
|
2014
2014
|
const o = t.get(e);
|
|
2015
2015
|
o && n.set(e, o);
|
|
2016
2016
|
}
|
|
2017
2017
|
for (const [e, o] of t) n.set(e, o);
|
|
2018
2018
|
return n;
|
|
2019
2019
|
}
|
|
2020
|
-
function
|
|
2021
|
-
for (const [n, o] of
|
|
2020
|
+
function oo(e, t) {
|
|
2021
|
+
for (const [n, o] of no(t)) ro(e, n, o);
|
|
2022
2022
|
}
|
|
2023
|
-
function
|
|
2023
|
+
function ro(e, t, n) {
|
|
2024
2024
|
const o = Xn(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) => {
|
|
2025
|
-
const t = r.get(e), n =
|
|
2025
|
+
const t = r.get(e), n = dn(e);
|
|
2026
2026
|
return {
|
|
2027
2027
|
movable: e,
|
|
2028
|
-
address:
|
|
2029
|
-
preset: n ?
|
|
2030
|
-
summary: n ?
|
|
2031
|
-
details: n ?
|
|
2032
|
-
text: t ?
|
|
2028
|
+
address: qn(e),
|
|
2029
|
+
preset: n ? kn(n) : (o = e.getContent(), o.getShapeType?.() ?? ""),
|
|
2030
|
+
summary: n ? Qn(e) : Yn(e),
|
|
2031
|
+
details: n ? xn(n) : [],
|
|
2032
|
+
text: t ? Kn(t) : "",
|
|
2033
2033
|
hidden: e.isHidden() ? " (hidden)" : ""
|
|
2034
2034
|
};
|
|
2035
2035
|
var o;
|
|
2036
2036
|
});
|
|
2037
|
-
e.h2(`${
|
|
2037
|
+
e.h2(`${to(t)} (${n.length}${o.length > 0 ? ` · ${o.length} with text` : ""})`);
|
|
2038
2038
|
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
2039
|
for (const t of a) {
|
|
2040
2040
|
const n = c > 0 ? `${t.preset.padEnd(c)} ` : "", o = t.text ? `${t.summary.padEnd(u)} ${t.text}` : t.summary;
|
|
@@ -2042,40 +2042,40 @@ function oo(e, t, n) {
|
|
|
2042
2042
|
const r = Math.max(10, ...t.details.map(([e]) => e.length + 2));
|
|
2043
2043
|
for (const [n, o] of t.details) e.text(` ${n.padEnd(r)}${o}`);
|
|
2044
2044
|
const s = t.movable.getMovables();
|
|
2045
|
-
s &&
|
|
2045
|
+
s && zn(e, s, 0);
|
|
2046
2046
|
}
|
|
2047
2047
|
if (l.length < s.length) {
|
|
2048
|
-
const o = `${
|
|
2048
|
+
const o = `${Lt(n[0].getRange())}.getMovables().getItems({ type: ${JSON.stringify(t)} })`;
|
|
2049
2049
|
e.text(` …and ${s.length - l.length} more · ${o} reports every one in full`);
|
|
2050
2050
|
}
|
|
2051
2051
|
e.blank();
|
|
2052
2052
|
}
|
|
2053
|
-
function ro(e) {
|
|
2054
|
-
return ao(e, "Movable");
|
|
2055
|
-
}
|
|
2056
2053
|
function so(e) {
|
|
2054
|
+
return io(e, "Movable");
|
|
2055
|
+
}
|
|
2056
|
+
function lo(e) {
|
|
2057
2057
|
const t = e.getMovable();
|
|
2058
|
-
if (t) return
|
|
2059
|
-
const n = new
|
|
2060
|
-
return n.h1(`Shape — ${e.getName() || "(unnamed)"}`), n.blank(),
|
|
2058
|
+
if (t) return io(t, "Shape");
|
|
2059
|
+
const n = new ie();
|
|
2060
|
+
return n.h1(`Shape — ${e.getName() || "(unnamed)"}`), n.blank(), Dn(n, e), n.toLines().join("\n").trimEnd();
|
|
2061
2061
|
}
|
|
2062
|
-
var
|
|
2062
|
+
var ao = (e) => {
|
|
2063
2063
|
const t = e.getContent();
|
|
2064
2064
|
return !0 === t?.isIShape ? t : null;
|
|
2065
2065
|
};
|
|
2066
|
-
function
|
|
2067
|
-
const n = new
|
|
2068
|
-
n.h1(`${t} — ${
|
|
2069
|
-
const i =
|
|
2070
|
-
i ?
|
|
2071
|
-
const c =
|
|
2072
|
-
c && n.fact(`Content: ${c}`), a &&
|
|
2073
|
-
const u =
|
|
2074
|
-
u &&
|
|
2066
|
+
function io(e, t) {
|
|
2067
|
+
const n = new ie(), r = e.getRange(), s = e.getContent(), l = s.getType(), a = ao(e);
|
|
2068
|
+
n.h1(`${t} — ${Pt(r)}`), n.blank(), n.fact(`Name: ${e.getContent().getName?.() || "(unnamed)"}`);
|
|
2069
|
+
const i = dn(e);
|
|
2070
|
+
i ? Rn(n, i) : n.fact(`Type: ${l}`);
|
|
2071
|
+
const c = Zn(s);
|
|
2072
|
+
c && n.fact(`Content: ${c}`), a && Dn(n, a);
|
|
2073
|
+
const u = Hn(e);
|
|
2074
|
+
u && _n(n, u);
|
|
2075
2075
|
const g = e.getParent();
|
|
2076
2076
|
g && n.fact(`Group: ${g.getContent().getName?.() || "(unnamed)"}`);
|
|
2077
2077
|
const d = e.getContent().getDescription();
|
|
2078
|
-
d && n.fact(`Alt Text: ${
|
|
2078
|
+
d && n.fact(`Alt Text: ${Jn(d)}`), n.fact(`Anchor: ${Tt(r)}, ${((e) => {
|
|
2079
2079
|
switch (e) {
|
|
2080
2080
|
case o.Type.Absolute: return "absolute — stays put when rows or columns move";
|
|
2081
2081
|
case o.Type.OneCell: return "oneCell — moves with the cells, keeps its size";
|
|
@@ -2089,11 +2089,11 @@ function ao(e, t) {
|
|
|
2089
2089
|
const h = e.getRotation();
|
|
2090
2090
|
0 !== h && n.fact(`Rotation: ${h}°`);
|
|
2091
2091
|
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: ${
|
|
2092
|
+
return m.length && n.fact(`Flip: ${m.join(", ")}`), n.fact(`Z-Order: ${e.getZIndex()}`), n.blank(), n.text(`Sheet: ${At(r.getWorksheet().getName())}`), n.toLines().join("\n").trimEnd();
|
|
2093
2093
|
}
|
|
2094
|
-
var
|
|
2094
|
+
var co = (e) => "visible" === e.getVisibility(), uo = (e, t, n) => {
|
|
2095
2095
|
const o = e.getWorksheets().getItems({ visibility: "veryHidden" }), r = t?.trim();
|
|
2096
|
-
if (!r) return o.filter((e) => n ||
|
|
2096
|
+
if (!r) return o.filter((e) => n || co(e)).map((e) => ({
|
|
2097
2097
|
sheet: e,
|
|
2098
2098
|
address: null
|
|
2099
2099
|
}));
|
|
@@ -2115,14 +2115,14 @@ var io = (e) => "visible" === e.getVisibility(), co = (e, t, n) => {
|
|
|
2115
2115
|
const e = ((e) => {
|
|
2116
2116
|
const t = e.replace(/[.*+?^${}()|[\]\\]/g, (e) => "*" === e ? ".*" : "?" === e ? "." : `\\${e}`);
|
|
2117
2117
|
return new RegExp(`^${t}$`);
|
|
2118
|
-
})(r), t = o.filter((t) => e.test(t.getName()) && (n ||
|
|
2118
|
+
})(r), t = o.filter((t) => e.test(t.getName()) && (n || co(t)));
|
|
2119
2119
|
if (0 === t.length) throw new Error(`No sheets match ${JSON.stringify(r)}. Sheets: ${o.map((e) => e.getName()).join(", ")}`);
|
|
2120
2120
|
return t.map((e) => ({
|
|
2121
2121
|
sheet: e,
|
|
2122
2122
|
address: null
|
|
2123
2123
|
}));
|
|
2124
2124
|
}
|
|
2125
|
-
const a = o.filter((e) => n ||
|
|
2125
|
+
const a = o.filter((e) => n || co(e));
|
|
2126
2126
|
try {
|
|
2127
2127
|
a[0]?.getRange(r);
|
|
2128
2128
|
} catch {
|
|
@@ -2132,7 +2132,7 @@ var io = (e) => "visible" === e.getVisibility(), co = (e, t, n) => {
|
|
|
2132
2132
|
sheet: e,
|
|
2133
2133
|
address: r
|
|
2134
2134
|
}));
|
|
2135
|
-
},
|
|
2135
|
+
}, go = (e, t) => {
|
|
2136
2136
|
switch (t) {
|
|
2137
2137
|
case "display": return N(e, v.Mode.Display);
|
|
2138
2138
|
case "value": return N(e, v.Mode.Value);
|
|
@@ -2159,23 +2159,23 @@ var io = (e) => "visible" === e.getVisibility(), co = (e, t, n) => {
|
|
|
2159
2159
|
}
|
|
2160
2160
|
default: return null;
|
|
2161
2161
|
}
|
|
2162
|
-
},
|
|
2162
|
+
}, ho = /* @__PURE__ */ new Map([["hyperlink", l.Feature.Hyperlink], ["numberFormat", l.Feature.NumberFormat]]), fo = (e, t) => t && "" !== t.trim() ? [{
|
|
2163
2163
|
field: e,
|
|
2164
2164
|
text: {
|
|
2165
2165
|
match: t,
|
|
2166
2166
|
display: t
|
|
2167
2167
|
}
|
|
2168
|
-
}] : [],
|
|
2169
|
-
const n =
|
|
2168
|
+
}] : [], mo = (e) => [...fo("comment", e.getContent()), ...e.getReplies().flatMap((e) => fo("comment", e.getContent()))], po = (e, t) => {
|
|
2169
|
+
const n = dn(e);
|
|
2170
2170
|
if (n) return t.includes("chart") ? [
|
|
2171
|
-
...
|
|
2172
|
-
...n.getAxes().getItems().flatMap((e) =>
|
|
2173
|
-
...n.getSeries().flatMap((e) => null === e.getNameFormula() ?
|
|
2174
|
-
...
|
|
2171
|
+
...fo("chart", n.getChartTitle()),
|
|
2172
|
+
...n.getAxes().getItems().flatMap((e) => fo("chart", e.getTitle().getText())),
|
|
2173
|
+
...n.getSeries().flatMap((e) => null === e.getNameFormula() ? fo("chart", e.getName()) : []),
|
|
2174
|
+
...fo("chart", e.getContent().getDescription())
|
|
2175
2175
|
] : [];
|
|
2176
|
-
const o =
|
|
2177
|
-
return null !== o && t.includes("shape") ? [...
|
|
2178
|
-
},
|
|
2176
|
+
const o = Gn(e);
|
|
2177
|
+
return null !== o && t.includes("shape") ? [...fo("shape", o), ...fo("shape", e.getContent().getDescription())] : [];
|
|
2178
|
+
}, $o = (e) => {
|
|
2179
2179
|
const t = e.isIFormula ? `=${e.getExpression()}` : null, n = t ?? e.getRanges?.()?.getAddress() ?? e.getName();
|
|
2180
2180
|
return [
|
|
2181
2181
|
{
|
|
@@ -2185,28 +2185,28 @@ var io = (e) => "visible" === e.getVisibility(), co = (e, t, n) => {
|
|
|
2185
2185
|
display: n
|
|
2186
2186
|
}
|
|
2187
2187
|
},
|
|
2188
|
-
...t ?
|
|
2189
|
-
...
|
|
2188
|
+
...t ? fo("name", t) : [],
|
|
2189
|
+
...fo("name", e.getComment())
|
|
2190
2190
|
];
|
|
2191
|
-
},
|
|
2191
|
+
}, wo = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd, yo = (e, t) => {
|
|
2192
2192
|
const n = e.getRanges?.() ?? null;
|
|
2193
2193
|
return t.some(({ sheet: t, address: o }) => {
|
|
2194
2194
|
if (null === o && e.getScope() === t.getName()) return !0;
|
|
2195
2195
|
const r = null !== o ? t.getRange(o).getCoords() : null;
|
|
2196
2196
|
for (let e = 0; e < (n?.length ?? 0); e++) {
|
|
2197
2197
|
const o = n.at(e);
|
|
2198
|
-
if (o.getWorksheet() === t && (!r ||
|
|
2198
|
+
if (o.getWorksheet() === t && (!r || wo(o.getCoords(), r))) return !0;
|
|
2199
2199
|
}
|
|
2200
2200
|
return !1;
|
|
2201
2201
|
});
|
|
2202
|
-
},
|
|
2202
|
+
}, bo = (e, t) => e.rowStart - t.rowStart || e.colStart - t.colStart, So = (e, t, n) => {
|
|
2203
2203
|
let o = null;
|
|
2204
2204
|
const r = (e) => ({
|
|
2205
2205
|
range: `${t}!${e.getRange().toString()}`,
|
|
2206
2206
|
table: e.getName()
|
|
2207
2207
|
});
|
|
2208
2208
|
return { resolve(s, l) {
|
|
2209
|
-
const a = ((e) => e
|
|
2209
|
+
const a = ((e) => ge(e))(s);
|
|
2210
2210
|
if ("table" === e) return a ? r(a) : void 0;
|
|
2211
2211
|
if (null === o) {
|
|
2212
2212
|
o = [];
|
|
@@ -2225,7 +2225,7 @@ var io = (e) => "visible" === e.getVisibility(), co = (e, t, n) => {
|
|
|
2225
2225
|
} : a ? r(a) : void 0;
|
|
2226
2226
|
} };
|
|
2227
2227
|
};
|
|
2228
|
-
async function
|
|
2228
|
+
async function xo(t, n) {
|
|
2229
2229
|
if (!n.pattern) throw new Error("grep requires a pattern");
|
|
2230
2230
|
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
2231
|
if (void 0 === e || !1 === e) return null;
|
|
@@ -2245,7 +2245,7 @@ async function So(t, n) {
|
|
|
2245
2245
|
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
2246
|
}
|
|
2247
2247
|
}
|
|
2248
|
-
})(n), u =
|
|
2248
|
+
})(n), u = uo(t, n.scope, a), g = o.filter((e) => !ho.has(e)), d = o.filter((e) => ho.has(e)), h = o.includes("display") && o.includes("value"), f = "content" === r || "addresses" === r, m = [], p = [];
|
|
2249
2249
|
let $ = 0, w = 0, y = 0, b = 0, S = !1;
|
|
2250
2250
|
const x = (e) => {
|
|
2251
2251
|
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 +2265,7 @@ async function So(t, n) {
|
|
|
2265
2265
|
if (S) continue;
|
|
2266
2266
|
const s = t.getName();
|
|
2267
2267
|
b++, await t.getCalculation().ready();
|
|
2268
|
-
const l = null !== n ? t.getRange(n) : t.getUsedRange(), c = l && i && "content" === r ?
|
|
2268
|
+
const l = null !== n ? t.getRange(n) : t.getUsedRange(), c = l && i && "content" === r ? So(i, s, l) : null, u = {
|
|
2269
2269
|
...null !== n ? { address: n } : {},
|
|
2270
2270
|
...a ? {} : { ignoreHidden: !0 }
|
|
2271
2271
|
}, f = /* @__PURE__ */ new Map();
|
|
@@ -2281,11 +2281,11 @@ async function So(t, n) {
|
|
|
2281
2281
|
for (const e of g) {
|
|
2282
2282
|
if ("comment" === e) {
|
|
2283
2283
|
const e = `${o.rowIndex}:${o.colIndex}`, t = f.get(e);
|
|
2284
|
-
t && (r.push(...
|
|
2284
|
+
t && (r.push(...mo(t)), f.delete(e));
|
|
2285
2285
|
continue;
|
|
2286
2286
|
}
|
|
2287
|
-
const t =
|
|
2288
|
-
"display" === e && (l = t?.match ?? null), null !== t && ("value" === e && h && (void 0 === l && (l =
|
|
2287
|
+
const t = go(n, e);
|
|
2288
|
+
"display" === e && (l = t?.match ?? null), null !== t && ("value" === e && h && (void 0 === l && (l = go(n, "display")?.match ?? null), t.match === l) || r.push({
|
|
2289
2289
|
field: e,
|
|
2290
2290
|
text: t
|
|
2291
2291
|
}));
|
|
@@ -2299,10 +2299,10 @@ async function So(t, n) {
|
|
|
2299
2299
|
const $ = [...f.values()].map((e) => ({
|
|
2300
2300
|
comment: e,
|
|
2301
2301
|
at: e.getRange().getCoords()
|
|
2302
|
-
})).sort((e, t) =>
|
|
2302
|
+
})).sort((e, t) => bo(e.at, t.at));
|
|
2303
2303
|
for (const { comment: t, at: n } of $) {
|
|
2304
2304
|
if (S) break;
|
|
2305
|
-
const o = x(
|
|
2305
|
+
const o = x(mo(t));
|
|
2306
2306
|
if (!o) continue;
|
|
2307
2307
|
const r = c?.resolve(t.getRange().getCell(), {
|
|
2308
2308
|
rowIndex: n.rowStart,
|
|
@@ -2312,12 +2312,12 @@ async function So(t, n) {
|
|
|
2312
2312
|
}
|
|
2313
2313
|
for (const e of d) {
|
|
2314
2314
|
if (S || !l) break;
|
|
2315
|
-
const t = [...l.getRegions(
|
|
2315
|
+
const t = [...l.getRegions(ho.get(e), { ignoreHidden: !a })].map((e) => ({
|
|
2316
2316
|
region: e,
|
|
2317
2317
|
at: e.getCoords()
|
|
2318
|
-
})).sort((e, t) =>
|
|
2318
|
+
})).sort((e, t) => bo(e.at, t.at));
|
|
2319
2319
|
for (const { region: n, at: o } of t) {
|
|
2320
|
-
const t = n.getCell(), r =
|
|
2320
|
+
const t = n.getCell(), r = go(t, e), l = x(r ? [{
|
|
2321
2321
|
field: e,
|
|
2322
2322
|
text: r
|
|
2323
2323
|
}] : []);
|
|
@@ -2335,9 +2335,9 @@ async function So(t, n) {
|
|
|
2335
2335
|
const n = t.getMovables().getItems(u).filter((e) => "note" !== e.getContent().getType()).filter((e) => a || !e.isHidden()).map((e) => ({
|
|
2336
2336
|
movable: e,
|
|
2337
2337
|
at: e.getRange().getCoords()
|
|
2338
|
-
})).sort((e, t) =>
|
|
2338
|
+
})).sort((e, t) => bo(e.at, t.at));
|
|
2339
2339
|
for (const { movable: t, at: r } of n) {
|
|
2340
|
-
const n = x(
|
|
2340
|
+
const n = x(po(t, o));
|
|
2341
2341
|
if (n) {
|
|
2342
2342
|
if (!k("object", s, e.rangeToString(r) ?? t.getRange().toString(), n)) break;
|
|
2343
2343
|
w++;
|
|
@@ -2353,8 +2353,8 @@ async function So(t, n) {
|
|
|
2353
2353
|
if (!S && o.includes("name")) {
|
|
2354
2354
|
const e = Boolean(n.scope?.trim()), o = t.getNames().getItems(a ? { includeHidden: !0 } : void 0) ?? [];
|
|
2355
2355
|
for (const t of o) {
|
|
2356
|
-
if (e && !
|
|
2357
|
-
const n = x(
|
|
2356
|
+
if (e && !yo(t, u)) continue;
|
|
2357
|
+
const n = x($o(t));
|
|
2358
2358
|
if (n && !k("object", t.getScope() ?? "", t.getName(), n)) break;
|
|
2359
2359
|
}
|
|
2360
2360
|
}
|
|
@@ -2372,27 +2372,27 @@ async function So(t, n) {
|
|
|
2372
2372
|
output: r
|
|
2373
2373
|
};
|
|
2374
2374
|
}
|
|
2375
|
-
var
|
|
2375
|
+
var ko = (e) => {
|
|
2376
2376
|
const t = e.replace(/\s+/g, " ").trim();
|
|
2377
2377
|
return t.length > 120 ? `${t.slice(0, 119)}…` : t;
|
|
2378
|
-
},
|
|
2379
|
-
const r = t.map((e) => o ?
|
|
2378
|
+
}, Co = (e) => e.sheet ? `${e.sheet}!${e.address}` : e.address, vo = (e, t) => `${e} ${t}${1 === e ? "" : "s"}`, Eo = (e, t) => t > 0 ? `${vo(e, "cell")} · ${vo(t, "object")}` : vo(e, "cell"), Ro = (e, t, n, o) => {
|
|
2379
|
+
const r = t.map((e) => o ? Co(e) : e.address), s = Math.max(...r.map((e) => e.length)), l = Math.max(...t.map((e) => e.field.length));
|
|
2380
2380
|
for (let o = 0; o < t.length; o++) {
|
|
2381
2381
|
const a = t[o];
|
|
2382
|
-
e.push(`${n}${r[o].padEnd(s)} ${a.field.padEnd(l)} ${
|
|
2382
|
+
e.push(`${n}${r[o].padEnd(s)} ${a.field.padEnd(l)} ${ko(a.text)}`);
|
|
2383
2383
|
}
|
|
2384
2384
|
};
|
|
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(",")} · ${
|
|
2385
|
+
function No(e) {
|
|
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(",")} · ${Eo(s, l)} in ${i} of ${a} ${1 === a ? "sheet" : "sheets"}`];
|
|
2387
2387
|
if ("count" === e.output) {
|
|
2388
|
-
for (const t of e.sheets) c.push(` ${t.sheet}: ${t.objects > 0 ?
|
|
2388
|
+
for (const t of e.sheets) c.push(` ${t.sheet}: ${t.objects > 0 ? Eo(t.cells, t.objects) : t.cells}`);
|
|
2389
2389
|
const t = l - e.sheets.reduce((e, t) => e + t.objects, 0);
|
|
2390
2390
|
t > 0 && c.push(` names: ${t}`);
|
|
2391
2391
|
} else if ("sheets" === e.output) {
|
|
2392
2392
|
for (const t of e.sheets) c.push(` ${t.sheet}`);
|
|
2393
2393
|
0 === e.sheets.length && c.push(l > 0 ? " no sheets · names only" : " no matches");
|
|
2394
2394
|
} else if (0 === r.length) c.push(" no matches");
|
|
2395
|
-
else if ("addresses" === e.output) for (const e of r) c.push(` ${
|
|
2395
|
+
else if ("addresses" === e.output) for (const e of r) c.push(` ${Co(e)}`);
|
|
2396
2396
|
else {
|
|
2397
2397
|
const e = [], t = /* @__PURE__ */ new Map();
|
|
2398
2398
|
for (const n of r) {
|
|
@@ -2404,11 +2404,11 @@ function Ro(e) {
|
|
|
2404
2404
|
rows: []
|
|
2405
2405
|
}, t.set(o, r), e.push(r)), r.rows.push(n);
|
|
2406
2406
|
}
|
|
2407
|
-
for (const t of e) t.heading ? (c.push(` ${t.heading}`),
|
|
2407
|
+
for (const t of e) t.heading ? (c.push(` ${t.heading}`), Ro(c, t.rows, " ", !1)) : Ro(c, t.rows, " ", !0);
|
|
2408
2408
|
}
|
|
2409
|
-
return e.truncated && c.push(` …truncated at ${
|
|
2409
|
+
return e.truncated && c.push(` …truncated at ${Eo(s, l)} · narrow the pattern, or scope the search to one sheet or range`), c.join("\n");
|
|
2410
2410
|
}
|
|
2411
|
-
var
|
|
2411
|
+
var jo = {
|
|
2412
2412
|
name: "grep",
|
|
2413
2413
|
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
2414
|
params: [
|
|
@@ -2493,9 +2493,9 @@ var No = {
|
|
|
2493
2493
|
description: "What to return: content (address, layer and text), addresses (one per matched cell), count (per sheet), or sheets (names with a match)."
|
|
2494
2494
|
}
|
|
2495
2495
|
],
|
|
2496
|
-
run:
|
|
2497
|
-
render:
|
|
2498
|
-
},
|
|
2496
|
+
run: xo,
|
|
2497
|
+
render: No
|
|
2498
|
+
}, Mo = (e) => !e.deprecated && !e.hidden, Fo = (e) => (e.members ?? []).filter(Mo), Io = [
|
|
2499
2499
|
{
|
|
2500
2500
|
match: /^(get|set)?(number)?(format|numfmt)s?$/i,
|
|
2501
2501
|
relies: ["ICellStyle", "setNumberFormat"],
|
|
@@ -2516,7 +2516,7 @@ var No = {
|
|
|
2516
2516
|
relies: ["IWorkbook", "getWorksheet"],
|
|
2517
2517
|
hint: "Look a worksheet up by name with `wb.getWorksheet('Name')`."
|
|
2518
2518
|
}
|
|
2519
|
-
],
|
|
2519
|
+
], To = [
|
|
2520
2520
|
"IWorkbook",
|
|
2521
2521
|
"IWorksheet",
|
|
2522
2522
|
"ICellRange",
|
|
@@ -2526,16 +2526,16 @@ var No = {
|
|
|
2526
2526
|
"ICellStyle",
|
|
2527
2527
|
"IScript.ScriptContext"
|
|
2528
2528
|
];
|
|
2529
|
-
var
|
|
2530
|
-
function
|
|
2529
|
+
var Ao = (e) => e.slice(e.lastIndexOf(".") + 1);
|
|
2530
|
+
function Lo(e, t) {
|
|
2531
2531
|
if (e.types[t]) return t;
|
|
2532
2532
|
const n = Object.keys(e.types), o = t.toLowerCase(), r = n.filter((e) => e.toLowerCase() === o);
|
|
2533
2533
|
if (1 === r.length) return r[0];
|
|
2534
2534
|
if (t.includes(".")) return null;
|
|
2535
|
-
const s = n.filter((e) =>
|
|
2535
|
+
const s = n.filter((e) => Ao(e).toLowerCase() === o);
|
|
2536
2536
|
return 1 === s.length ? s[0] : null;
|
|
2537
2537
|
}
|
|
2538
|
-
function
|
|
2538
|
+
function Wo(e, t, n) {
|
|
2539
2539
|
const o = n.replace(/<[\s\S]*$/, "").trim(), r = t.split(".");
|
|
2540
2540
|
for (let t = r.length - 1; t >= 0; t--) {
|
|
2541
2541
|
const n = [...r.slice(0, t), o].join(".");
|
|
@@ -2543,7 +2543,7 @@ function Lo(e, t, n) {
|
|
|
2543
2543
|
}
|
|
2544
2544
|
return null;
|
|
2545
2545
|
}
|
|
2546
|
-
function
|
|
2546
|
+
function Oo(e, t, n, o = /* @__PURE__ */ new Set()) {
|
|
2547
2547
|
if (o.has(t)) return null;
|
|
2548
2548
|
o.add(t);
|
|
2549
2549
|
const r = e.types[t];
|
|
@@ -2554,20 +2554,20 @@ function Wo(e, t, n, o = /* @__PURE__ */ new Set()) {
|
|
|
2554
2554
|
members: s
|
|
2555
2555
|
};
|
|
2556
2556
|
for (const s of r.extends ?? []) {
|
|
2557
|
-
const r =
|
|
2557
|
+
const r = Wo(e, t, s), l = r ? Oo(e, r, n, o) : null;
|
|
2558
2558
|
if (l) return l;
|
|
2559
2559
|
}
|
|
2560
2560
|
return null;
|
|
2561
2561
|
}
|
|
2562
|
-
function
|
|
2562
|
+
function Po(e, t, n) {
|
|
2563
2563
|
const o = e.types[t], r = (o.extends ?? []).map((n) => {
|
|
2564
|
-
const o =
|
|
2564
|
+
const o = Wo(e, t, n);
|
|
2565
2565
|
return {
|
|
2566
2566
|
text: n,
|
|
2567
2567
|
key: o,
|
|
2568
|
-
memberCount: o ?
|
|
2568
|
+
memberCount: o ? Fo(e.types[o]).length : 0
|
|
2569
2569
|
};
|
|
2570
|
-
}), s =
|
|
2570
|
+
}), s = Fo(o), l = n?.toLowerCase();
|
|
2571
2571
|
return {
|
|
2572
2572
|
kind: "type",
|
|
2573
2573
|
key: t,
|
|
@@ -2577,7 +2577,7 @@ function Oo(e, t, n) {
|
|
|
2577
2577
|
...n ? { filter: n } : {}
|
|
2578
2578
|
};
|
|
2579
2579
|
}
|
|
2580
|
-
function
|
|
2580
|
+
function Do(e, t, n) {
|
|
2581
2581
|
const o = (e) => {
|
|
2582
2582
|
const o = t(e).toLowerCase();
|
|
2583
2583
|
return o === n ? 0 : o.startsWith(n) ? 1 : 2;
|
|
@@ -2588,12 +2588,12 @@ function Po(e, t, n) {
|
|
|
2588
2588
|
score: o(e)
|
|
2589
2589
|
})).sort((e, t) => e.score - t.score || e.order - t.order).map((e) => e.item);
|
|
2590
2590
|
}
|
|
2591
|
-
function
|
|
2591
|
+
function Ho(e, t) {
|
|
2592
2592
|
const n = function(e) {
|
|
2593
2593
|
return e.trim().replace(/^SheetXL\./, "").replace(/\(\)$/, "").replace(/#/g, ".");
|
|
2594
2594
|
}(t ?? "");
|
|
2595
2595
|
if (!n) {
|
|
2596
|
-
const t =
|
|
2596
|
+
const t = To.filter((t) => e.types[t]).map((t) => ({
|
|
2597
2597
|
key: t,
|
|
2598
2598
|
entry: e.types[t]
|
|
2599
2599
|
}));
|
|
@@ -2603,51 +2603,51 @@ function Do(e, t) {
|
|
|
2603
2603
|
entryPoints: t
|
|
2604
2604
|
};
|
|
2605
2605
|
}
|
|
2606
|
-
const o =
|
|
2607
|
-
if (o) return
|
|
2606
|
+
const o = Lo(e, n);
|
|
2607
|
+
if (o) return Po(e, o);
|
|
2608
2608
|
const r = n.lastIndexOf(".");
|
|
2609
2609
|
if (r > 0) {
|
|
2610
|
-
const t = n.slice(0, r), o =
|
|
2610
|
+
const t = n.slice(0, r), o = Lo(e, t), s = n.slice(r + 1);
|
|
2611
2611
|
if (o && s) {
|
|
2612
|
-
const t = s.toLowerCase(), n =
|
|
2612
|
+
const t = s.toLowerCase(), n = Oo(e, o, (e) => e.name === s) ?? Oo(e, o, (e) => e.name.toLowerCase() === t);
|
|
2613
2613
|
if (n) return {
|
|
2614
2614
|
kind: "member",
|
|
2615
2615
|
key: o,
|
|
2616
2616
|
declaredOn: n.key,
|
|
2617
2617
|
members: n.members
|
|
2618
2618
|
};
|
|
2619
|
-
const r =
|
|
2619
|
+
const r = Po(e, o, s);
|
|
2620
2620
|
if (r.members.length > 0) return r;
|
|
2621
2621
|
}
|
|
2622
2622
|
if (s) {
|
|
2623
2623
|
const n = function(e, t, n, o) {
|
|
2624
|
-
const r = o.toLowerCase(), s = Object.entries(e.types).flatMap(([e, t]) =>
|
|
2624
|
+
const r = o.toLowerCase(), s = Object.entries(e.types).flatMap(([e, t]) => Fo(t).filter((e) => e.name.toLowerCase() === r).map((t) => ({
|
|
2625
2625
|
key: e,
|
|
2626
2626
|
member: t
|
|
2627
2627
|
}))), l = Io.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
2628
|
const o = t.toLowerCase().replace(/s$/, ""), r = n.toLowerCase();
|
|
2629
|
-
return Object.keys(e.types).filter((t) =>
|
|
2630
|
-
const n =
|
|
2629
|
+
return Object.keys(e.types).filter((t) => Mo(e.types[t])).map((e) => {
|
|
2630
|
+
const n = Ao(e), r = Jo(t, n), s = o.length >= 4 && n.toLowerCase().startsWith(o);
|
|
2631
2631
|
return {
|
|
2632
2632
|
key: e,
|
|
2633
2633
|
score: r ?? (s ? 10 : null)
|
|
2634
2634
|
};
|
|
2635
2635
|
}).filter((e) => null !== e.score).map((t) => ({
|
|
2636
2636
|
...t,
|
|
2637
|
-
hasMember:
|
|
2638
|
-
})).sort((e, t) => Number(t.hasMember) - Number(e.hasMember) || e.score - t.score).slice(0,
|
|
2637
|
+
hasMember: Uo(e, t.key).some((e) => e.name.toLowerCase() === r)
|
|
2638
|
+
})).sort((e, t) => Number(t.hasMember) - Number(e.hasMember) || e.score - t.score).slice(0, Vo).map(({ key: e, hasMember: t }) => ({
|
|
2639
2639
|
key: e,
|
|
2640
2640
|
hasMember: t
|
|
2641
2641
|
}));
|
|
2642
2642
|
}(e, t, o), i = n ? function(e, t, n) {
|
|
2643
|
-
const o =
|
|
2644
|
-
return
|
|
2645
|
-
const t =
|
|
2643
|
+
const o = Bo(n)?.toLowerCase();
|
|
2644
|
+
return Uo(e, t).map((e) => {
|
|
2645
|
+
const t = Jo(n, e.name), r = o && o.length >= 3 && e.name.toLowerCase().includes(o);
|
|
2646
2646
|
return {
|
|
2647
2647
|
member: e,
|
|
2648
2648
|
score: t ?? (r ? 10 : null)
|
|
2649
2649
|
};
|
|
2650
|
-
}).filter((e) => null !== e.score).sort((e, t) => e.score - t.score).slice(0,
|
|
2650
|
+
}).filter((e) => null !== e.score).sort((e, t) => e.score - t.score).slice(0, Vo).map((e) => e.member);
|
|
2651
2651
|
}(e, n, o) : [];
|
|
2652
2652
|
return a.length + i.length + l.length + s.length === 0 ? null : {
|
|
2653
2653
|
kind: "miss",
|
|
@@ -2659,8 +2659,8 @@ function Do(e, t) {
|
|
|
2659
2659
|
nearestTypes: a,
|
|
2660
2660
|
nearest: i,
|
|
2661
2661
|
hints: l,
|
|
2662
|
-
elsewhere: s.slice(0,
|
|
2663
|
-
elsewhereOmitted: Math.max(0, s.length -
|
|
2662
|
+
elsewhere: s.slice(0, Vo),
|
|
2663
|
+
elsewhereOmitted: Math.max(0, s.length - Vo)
|
|
2664
2664
|
};
|
|
2665
2665
|
}(e, t, o, s);
|
|
2666
2666
|
if (n) return n;
|
|
@@ -2668,14 +2668,14 @@ function Do(e, t) {
|
|
|
2668
2668
|
}
|
|
2669
2669
|
return function(e, t) {
|
|
2670
2670
|
const n = t.toLowerCase(), o = [], r = [];
|
|
2671
|
-
for (const [t, s] of Object.entries(e.types)) if (
|
|
2672
|
-
|
|
2673
|
-
for (const e of
|
|
2671
|
+
for (const [t, s] of Object.entries(e.types)) if (Mo(s)) {
|
|
2672
|
+
Ao(t).toLowerCase().includes(n) && o.push(t);
|
|
2673
|
+
for (const e of Fo(s)) e.name.toLowerCase().includes(n) && r.push({
|
|
2674
2674
|
key: t,
|
|
2675
2675
|
member: e
|
|
2676
2676
|
});
|
|
2677
2677
|
}
|
|
2678
|
-
const s =
|
|
2678
|
+
const s = Do(o, Ao, n), l = Do(r, (e) => e.member.name, n);
|
|
2679
2679
|
return {
|
|
2680
2680
|
kind: "search",
|
|
2681
2681
|
query: t,
|
|
@@ -2685,8 +2685,8 @@ function Do(e, t) {
|
|
|
2685
2685
|
};
|
|
2686
2686
|
}(e, r > 0 ? n.slice(r + 1) : n);
|
|
2687
2687
|
}
|
|
2688
|
-
var
|
|
2689
|
-
function
|
|
2688
|
+
var Vo = 5, Bo = (e) => /([A-Z][a-z0-9]+|^[a-z0-9]+)$/.exec(e)?.[1] ?? null;
|
|
2689
|
+
function zo(e, t) {
|
|
2690
2690
|
if (!t || "object" != typeof t && "function" != typeof t) return null;
|
|
2691
2691
|
const n = [], o = /* @__PURE__ */ new Set();
|
|
2692
2692
|
for (let r = t; r && r !== Object.prototype; r = Object.getPrototypeOf(r)) for (const s of Object.getOwnPropertyNames(r)) {
|
|
@@ -2696,13 +2696,13 @@ function Bo(e, t) {
|
|
|
2696
2696
|
try {
|
|
2697
2697
|
r = !0 === t[s];
|
|
2698
2698
|
} catch {}
|
|
2699
|
-
const l = r ?
|
|
2699
|
+
const l = r ? Lo(e, s.slice(2)) : null;
|
|
2700
2700
|
l && !n.includes(l) && n.push(l);
|
|
2701
2701
|
}
|
|
2702
2702
|
if (n.length <= 1) return n[0] ?? null;
|
|
2703
2703
|
const r = (t, n = /* @__PURE__ */ new Set()) => {
|
|
2704
2704
|
for (const o of e.types[t].extends ?? []) {
|
|
2705
|
-
const s =
|
|
2705
|
+
const s = Wo(e, t, o);
|
|
2706
2706
|
s && !n.has(s) && (n.add(s), r(s, n));
|
|
2707
2707
|
}
|
|
2708
2708
|
return n;
|
|
@@ -2710,26 +2710,26 @@ function Bo(e, t) {
|
|
|
2710
2710
|
for (const e of n) for (const t of r(e)) s.add(t);
|
|
2711
2711
|
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
2712
|
}
|
|
2713
|
-
function
|
|
2713
|
+
function _o(e, t) {
|
|
2714
2714
|
const n = /\bon type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(e)?.[1];
|
|
2715
2715
|
return n ? `\`${t} ${n}\` lists its members.` : null;
|
|
2716
2716
|
}
|
|
2717
|
-
function
|
|
2717
|
+
function Uo(e, t) {
|
|
2718
2718
|
const n = [], o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = (t) => {
|
|
2719
2719
|
if (r.has(t)) return;
|
|
2720
2720
|
r.add(t);
|
|
2721
2721
|
const l = e.types[t];
|
|
2722
2722
|
if (l) {
|
|
2723
|
-
for (const e of
|
|
2723
|
+
for (const e of Fo(l)) o.has(e.name) || (o.add(e.name), n.push(e));
|
|
2724
2724
|
for (const n of l.extends ?? []) {
|
|
2725
|
-
const o =
|
|
2725
|
+
const o = Wo(e, t, n);
|
|
2726
2726
|
o && s(o);
|
|
2727
2727
|
}
|
|
2728
2728
|
}
|
|
2729
2729
|
};
|
|
2730
2730
|
return s(t), n;
|
|
2731
2731
|
}
|
|
2732
|
-
function
|
|
2732
|
+
function Jo(e, t) {
|
|
2733
2733
|
const n = e.toLowerCase(), o = t.toLowerCase();
|
|
2734
2734
|
if (n === o) return 0;
|
|
2735
2735
|
if (n.startsWith(o) || o.startsWith(n)) return 1;
|
|
@@ -2747,14 +2747,14 @@ function Uo(e, t) {
|
|
|
2747
2747
|
}(n, o);
|
|
2748
2748
|
return r <= Math.max(2, Math.floor(.3 * n.length)) ? 1 + r : null;
|
|
2749
2749
|
}
|
|
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 ?
|
|
2750
|
+
function qo(e, t) {
|
|
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 ? Lo(e, o) : null;
|
|
2752
2752
|
if (!n || !r) return t;
|
|
2753
|
-
const s =
|
|
2754
|
-
return !s || s.members.some(
|
|
2753
|
+
const s = Oo(e, r, (e) => e.name === n[1]);
|
|
2754
|
+
return !s || s.members.some(Mo) ? t : t.slice(0, n.index) + t.slice(n.index + n[0].length);
|
|
2755
2755
|
}
|
|
2756
|
-
var
|
|
2757
|
-
function
|
|
2756
|
+
var Ko = (e, t) => `${t ? `${t}.` : ""}${e.signature.replace(/;$/, "")}${e.summary ? ` — ${e.summary}` : ""}`;
|
|
2757
|
+
function Go(e, t, n) {
|
|
2758
2758
|
const o = /Property '[\w$]+' does not exist on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)\[\]'/.exec(t);
|
|
2759
2759
|
if (o) return `\`${o[1]}[]\` is a plain array, not a collection: index it (\`[0]\`), or use \`.length\`, \`.find(…)\`.`;
|
|
2760
2760
|
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];
|
|
@@ -2764,43 +2764,43 @@ function Ko(e, t, n) {
|
|
|
2764
2764
|
const [n, o] = t.relies;
|
|
2765
2765
|
t.match.test(l) && e.types[n]?.members?.some((e) => e.name === o) && a.push(t.hint);
|
|
2766
2766
|
}
|
|
2767
|
-
const i = r ?
|
|
2767
|
+
const i = r ? Lo(e, r[2]) : null;
|
|
2768
2768
|
if (i) {
|
|
2769
|
-
const o =
|
|
2769
|
+
const o = Uo(e, i), r = /Did you mean '([\w$]+)'/.exec(t)?.[1], s = o.map((e) => ({
|
|
2770
2770
|
member: e,
|
|
2771
|
-
score: e.name === r ? -1 :
|
|
2771
|
+
score: e.name === r ? -1 : Jo(l, e.name)
|
|
2772
2772
|
})).filter((e) => null !== e.score).sort((e, t) => e.score - t.score).slice(0, 3);
|
|
2773
2773
|
if (s.length > 0) {
|
|
2774
2774
|
a.push(`Closest on ${i}:`);
|
|
2775
|
-
for (const { member: e } of s) a.push(` ${
|
|
2775
|
+
for (const { member: e } of s) a.push(` ${Ko(e)}`);
|
|
2776
2776
|
}
|
|
2777
2777
|
a.push(`\`${n} ${i}\` lists all ${o.length} members.`);
|
|
2778
2778
|
} else if (s) {
|
|
2779
|
-
const t = Object.entries(e.types).filter(([, e]) =>
|
|
2779
|
+
const t = Object.entries(e.types).filter(([, e]) => Fo(e).some((e) => e.name === l)).map(([e]) => e);
|
|
2780
2780
|
if (t.length > 0) {
|
|
2781
2781
|
const e = t.slice(0, 3).join(", "), n = t.length > 3 ? ` and ${t.length - 3} more` : "";
|
|
2782
2782
|
return a.push(`'${l}' is a member of ${e}${n}, not of the object it was called on.`), a.join("\n");
|
|
2783
2783
|
}
|
|
2784
|
-
const n =
|
|
2784
|
+
const n = To.map((t) => Lo(e, t)).filter((e) => null !== e).flatMap((t) => Uo(e, t).map((e) => ({
|
|
2785
2785
|
owner: t,
|
|
2786
2786
|
member: e,
|
|
2787
|
-
score:
|
|
2787
|
+
score: Jo(l, e.name)
|
|
2788
2788
|
}))).filter((e) => null !== e.score && e.score > 0 && e.score <= 2).sort((e, t) => e.score - t.score).slice(0, 3);
|
|
2789
2789
|
if (0 === a.length && 0 === n.length) return null;
|
|
2790
2790
|
if (a.unshift(`No SheetXL member is named '${l}'.`), n.length > 0) {
|
|
2791
2791
|
a.push("Closest:");
|
|
2792
|
-
for (const { owner: e, member: t } of n) a.push(` ${
|
|
2792
|
+
for (const { owner: e, member: t } of n) a.push(` ${Ko(t, e)}`);
|
|
2793
2793
|
}
|
|
2794
2794
|
}
|
|
2795
2795
|
return a.length > 0 ? a.join("\n") : null;
|
|
2796
2796
|
}
|
|
2797
2797
|
var Xo = (e, t, n = `${t}s`) => `${e.toLocaleString("en-US")} ${1 === e ? t : n}`;
|
|
2798
|
-
function
|
|
2798
|
+
function Zo(e, t) {
|
|
2799
2799
|
const n = t ? `${t} · ` : "", o = e.summary ? ` — ${e.summary}` : "", r = e.deprecated ? " (deprecated)" : "";
|
|
2800
2800
|
return `- ${n}\`${s = e.signature, s.replace(/;$/, "")}\`${r}${o}`;
|
|
2801
2801
|
var s;
|
|
2802
2802
|
}
|
|
2803
|
-
function
|
|
2803
|
+
function Yo(e, t) {
|
|
2804
2804
|
const n = t?.command ?? "api";
|
|
2805
2805
|
switch (e.kind) {
|
|
2806
2806
|
case "overview": return function(e, t) {
|
|
@@ -2810,13 +2810,13 @@ function Zo(e, t) {
|
|
|
2810
2810
|
"Where a script starts:"
|
|
2811
2811
|
];
|
|
2812
2812
|
for (const { key: t, entry: o } of e.entryPoints) {
|
|
2813
|
-
const e = o.members ? ` (${Xo(
|
|
2813
|
+
const e = o.members ? ` (${Xo(Fo(o).length, "member")})` : "";
|
|
2814
2814
|
n.push(`- \`${t}\`${e}${o.summary ? ` — ${o.summary}` : ""}`);
|
|
2815
2815
|
}
|
|
2816
2816
|
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
2817
|
}(e, n);
|
|
2818
2818
|
case "type": return function(e, t) {
|
|
2819
|
-
const { key: n, entry: o, members: r } = e, s =
|
|
2819
|
+
const { key: n, entry: o, members: r } = e, s = Fo(o).length, l = [o.kind + (o.typeParams ?? "")];
|
|
2820
2820
|
o.members && l.push(Xo(s, "member")), o.deprecated && l.push("deprecated");
|
|
2821
2821
|
const a = [`# ${n} — ${l.join(" · ")}`];
|
|
2822
2822
|
if (o.summary && a.push(o.summary), o.signature && a.push("", "```ts", o.signature, "```"), e.bases.length > 0) {
|
|
@@ -2825,7 +2825,7 @@ function Zo(e, t) {
|
|
|
2825
2825
|
}
|
|
2826
2826
|
if (o.members) {
|
|
2827
2827
|
a.push(""), e.filter && a.push(`${Xo(r.length, "member")} of ${s} matching '${e.filter}':`);
|
|
2828
|
-
for (const e of r) a.push(
|
|
2828
|
+
for (const e of r) a.push(Zo(e));
|
|
2829
2829
|
}
|
|
2830
2830
|
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
2831
|
}(e, n);
|
|
@@ -2845,7 +2845,7 @@ function Zo(e, t) {
|
|
|
2845
2845
|
}
|
|
2846
2846
|
if (e.members.length > 0) {
|
|
2847
2847
|
n.push("", "Members:");
|
|
2848
|
-
for (const { key: t, member: o } of e.members) n.push(
|
|
2848
|
+
for (const { key: t, member: o } of e.members) n.push(Zo(o, t));
|
|
2849
2849
|
}
|
|
2850
2850
|
return e.omitted > 0 && n.push("", `…and ${Xo(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
2851
|
}(e, n);
|
|
@@ -2854,7 +2854,7 @@ function Zo(e, t) {
|
|
|
2854
2854
|
if (n.key) {
|
|
2855
2855
|
if (r.push(`\`${n.key}\` has no member \`${o}\`.`), e.nearest.length > 0) {
|
|
2856
2856
|
r.push("", `Closest on \`${n.key}\`:`);
|
|
2857
|
-
for (const t of e.nearest) r.push(
|
|
2857
|
+
for (const t of e.nearest) r.push(Zo(t));
|
|
2858
2858
|
}
|
|
2859
2859
|
} else if (r.push(`No type is named \`${n.text}\`.`), e.nearestTypes.length > 0) {
|
|
2860
2860
|
r.push("", "Nearest:");
|
|
@@ -2869,8 +2869,8 @@ function Zo(e, t) {
|
|
|
2869
2869
|
}(e, n);
|
|
2870
2870
|
}
|
|
2871
2871
|
}
|
|
2872
|
-
async function
|
|
2873
|
-
const t =
|
|
2872
|
+
async function Qo(e) {
|
|
2873
|
+
const t = Ho(await k(), e);
|
|
2874
2874
|
if ("member" === t.kind) try {
|
|
2875
2875
|
const e = (await C()).split(/\r?\n/);
|
|
2876
2876
|
t.sources = t.members.map((t) => function(e, t, n) {
|
|
@@ -2880,7 +2880,7 @@ async function Yo(e) {
|
|
|
2880
2880
|
} catch {}
|
|
2881
2881
|
return t;
|
|
2882
2882
|
}
|
|
2883
|
-
var
|
|
2883
|
+
var er = {
|
|
2884
2884
|
name: "api",
|
|
2885
2885
|
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
2886
|
params: [{
|
|
@@ -2889,17 +2889,17 @@ var Qo = {
|
|
|
2889
2889
|
description: "A type (`ICellRange`), a member (`ICellRange.setValues`), or a word to search for. Omit for the overview. A leading `SheetXL.` is accepted.",
|
|
2890
2890
|
positional: 0
|
|
2891
2891
|
}],
|
|
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 ?
|
|
2892
|
+
run: (e) => Qo(e?.name),
|
|
2893
|
+
render: Yo
|
|
2894
|
+
}, tr = l.Feature;
|
|
2895
|
+
async function nr(e, t, n, o) {
|
|
2896
|
+
await or(e, t, "precedents", n, o), await or(e, t, "dependents", n, o);
|
|
2897
|
+
}
|
|
2898
|
+
async function or(e, t, n, o, r) {
|
|
2899
|
+
const s = "precedents" === n ? "Precedents" : "Dependents", l = await ("precedents" === n ? t.getPrecedents() : t.getDependents()), a = "dependents" === n && r?.subject ? jn(r.subject, l) : [];
|
|
2900
2900
|
if (!l || 0 === l.length) {
|
|
2901
2901
|
const t = "precedents" === n ? r?.zeroPrecedents : r?.zeroDependents;
|
|
2902
|
-
a.length > 0 ? (e.h2(`${s} (${
|
|
2902
|
+
a.length > 0 ? (e.h2(`${s} (${rr(a.length)})`), e.text(` ${"charts".padEnd(lr)}${sr(a)}`), e.blank()) : t && (e.h2(`${s} (0)`), e.blank());
|
|
2903
2903
|
return;
|
|
2904
2904
|
}
|
|
2905
2905
|
const i = await async function(e, t, n) {
|
|
@@ -2912,8 +2912,8 @@ async function nr(e, t, n, o, r) {
|
|
|
2912
2912
|
continue;
|
|
2913
2913
|
}
|
|
2914
2914
|
s++;
|
|
2915
|
-
const i = n.getCounts([
|
|
2916
|
-
o += c, r += i[
|
|
2915
|
+
const i = n.getCounts([tr.Contentful, tr.Formula]), c = i[tr.Contentful] ?? 0;
|
|
2916
|
+
o += c, r += i[tr.Formula] ?? 0;
|
|
2917
2917
|
const u = n.getWorksheet()?.getName() ?? "";
|
|
2918
2918
|
a.set(u, (a.get(u) ?? 0) + c);
|
|
2919
2919
|
}
|
|
@@ -2925,10 +2925,10 @@ async function nr(e, t, n, o, r) {
|
|
|
2925
2925
|
if (!t) return 0;
|
|
2926
2926
|
let i = 0;
|
|
2927
2927
|
for (let e = 0; e < t.length; e++) {
|
|
2928
|
-
const l = t.at(e), c =
|
|
2928
|
+
const l = t.at(e), c = hr(l);
|
|
2929
2929
|
if (o.has(c)) continue;
|
|
2930
2930
|
let u = n.get(c);
|
|
2931
|
-
void 0 === u && (++r >
|
|
2931
|
+
void 0 === u && (++r > ir ? (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
2932
|
}
|
|
2933
2933
|
return i;
|
|
2934
2934
|
};
|
|
@@ -2945,13 +2945,13 @@ async function nr(e, t, n, o, r) {
|
|
|
2945
2945
|
depth: i,
|
|
2946
2946
|
depthCapped: c,
|
|
2947
2947
|
sheets: a,
|
|
2948
|
-
outputs: "dependents" === n ? await
|
|
2948
|
+
outputs: "dependents" === n ? await ur(t) : {
|
|
2949
2949
|
ranges: [],
|
|
2950
2950
|
cells: 0
|
|
2951
2951
|
}
|
|
2952
2952
|
};
|
|
2953
2953
|
}(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(
|
|
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(rr(a.length)), e.h2(`${s} (${c.join(" · ")})`);
|
|
2955
2955
|
const u = r?.home?.getName() ?? null, g = await async function(e, t, n, o) {
|
|
2956
2956
|
const r = Math.max(1, o?.maxTreeRows ?? 12), s = (e) => "precedents" === t ? e.getDirectPrecedents() : e.getDirectDependents(), l = [], a = /* @__PURE__ */ new Map();
|
|
2957
2957
|
let i = 0, c = 0, u = !1;
|
|
@@ -2967,7 +2967,7 @@ async function nr(e, t, n, o, r) {
|
|
|
2967
2967
|
let h = 0;
|
|
2968
2968
|
i = d(await s(e), null, 0);
|
|
2969
2969
|
for (; h < g.length && c < r;) {
|
|
2970
|
-
const { range: e, parent: t, depth: n } = g[h++], o =
|
|
2970
|
+
const { range: e, parent: t, depth: n } = g[h++], o = hr(e), r = {
|
|
2971
2971
|
range: e,
|
|
2972
2972
|
key: o,
|
|
2973
2973
|
depth: n,
|
|
@@ -3003,12 +3003,12 @@ async function nr(e, t, n, o, r) {
|
|
|
3003
3003
|
const $ = new Map(m.map((e, t) => [e, t]));
|
|
3004
3004
|
let w = i - l.length;
|
|
3005
3005
|
const y = m.map((e) => {
|
|
3006
|
-
const { address: t, sheet: n, isName: o } =
|
|
3006
|
+
const { address: t, sheet: n, isName: o } = fr(e.range);
|
|
3007
3007
|
let r;
|
|
3008
3008
|
if ("circular" === e.mark) r = "↺ circular";
|
|
3009
3009
|
else if ("repeat" === e.mark) r = $.get(e.first) < $.get(e) ? "↑ shown above" : "↓ shown below";
|
|
3010
3010
|
else {
|
|
3011
|
-
r = [
|
|
3011
|
+
r = [mr(e.range), dr(e.range, f)].filter(Boolean).join(" ");
|
|
3012
3012
|
const t = e.childCount - e.children.length;
|
|
3013
3013
|
t > 0 && (w += t, r = `${r} ▸ ${t} more`);
|
|
3014
3014
|
}
|
|
@@ -3021,7 +3021,7 @@ async function nr(e, t, n, o, r) {
|
|
|
3021
3021
|
detail: r
|
|
3022
3022
|
};
|
|
3023
3023
|
}), 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}${
|
|
3024
|
+
if (b.length > 0 && b.some((e) => e.sheet !== b[0].sheet)) for (const e of y) e.isName || (e.label = `${e.indent}${At(e.sheet)}!${e.label.slice(e.indent.length)}`);
|
|
3025
3025
|
const S = [], x = Math.max(...y.map((e) => e.label.length));
|
|
3026
3026
|
for (const e of y) S.push(` ${e.label.padEnd(x)} ${e.detail}`.trimEnd());
|
|
3027
3027
|
u && S.push(" ↺ circular reference — the chain returns to a cell already on this branch");
|
|
@@ -3034,13 +3034,13 @@ async function nr(e, t, n, o, r) {
|
|
|
3034
3034
|
shown: new Set(m.map((e) => e.key))
|
|
3035
3035
|
};
|
|
3036
3036
|
}(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 } =
|
|
3037
|
+
if ("dependents" === n && d.some((e) => !g.shown.has(hr(e))) && e.text(` ${"outputs".padEnd(lr)}${function(e, t) {
|
|
3038
|
+
const n = e.ranges.slice(0, cr).map((e) => {
|
|
3039
|
+
const { address: n, sheet: o } = fr(e);
|
|
3040
3040
|
return [
|
|
3041
|
-
null !== t && o !== t ? `${
|
|
3041
|
+
null !== t && o !== t ? `${At(o)}!${n}` : n,
|
|
3042
3042
|
e.isSingleCell() ? N(e.getCell(), v.Mode.Display)?.display ?? "" : `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
3043
|
-
|
|
3043
|
+
dr(e)
|
|
3044
3044
|
].filter(Boolean).join(" ");
|
|
3045
3045
|
}), o = e.ranges.length - n.length;
|
|
3046
3046
|
o > 0 && n.push(`+${o} more (getDependents())`);
|
|
@@ -3048,21 +3048,21 @@ async function nr(e, t, n, o, r) {
|
|
|
3048
3048
|
}(i.outputs, u)}`), null !== u) {
|
|
3049
3049
|
const t = [...i.sheets].filter(([e]) => e !== u);
|
|
3050
3050
|
if (t.length > 0) {
|
|
3051
|
-
const n = t.map(([e, t]) => `${
|
|
3052
|
-
e.text(` ${"sheets".padEnd(
|
|
3051
|
+
const n = t.map(([e, t]) => `${At(e)} ${t} ${1 === t ? "cell" : "cells"}`);
|
|
3052
|
+
e.text(` ${"sheets".padEnd(lr)}${n.join(" · ")}`);
|
|
3053
3053
|
}
|
|
3054
3054
|
}
|
|
3055
|
-
a.length > 0 && e.text(` ${"charts".padEnd(
|
|
3055
|
+
a.length > 0 && e.text(` ${"charts".padEnd(lr)}${sr(a)}`);
|
|
3056
3056
|
for (const t of g.lines) e.text(t);
|
|
3057
3057
|
e.blank();
|
|
3058
3058
|
}
|
|
3059
|
-
var
|
|
3060
|
-
function
|
|
3061
|
-
const t = e.slice(0,
|
|
3059
|
+
var rr = (e) => `${e} ${1 === e ? "chart" : "charts"}`;
|
|
3060
|
+
function sr(e) {
|
|
3061
|
+
const t = e.slice(0, ar).map(Mn), n = e.length - t.length;
|
|
3062
3062
|
return n > 0 && t.push(`+${n} more`), t.join(" · ");
|
|
3063
3063
|
}
|
|
3064
|
-
var
|
|
3065
|
-
async function
|
|
3064
|
+
var lr = 10, ar = 6, ir = 2e3, cr = 4;
|
|
3065
|
+
async function ur(e) {
|
|
3066
3066
|
const t = /* @__PURE__ */ new Map(), n = await e.getPrecedents(!1);
|
|
3067
3067
|
for (let e = 0; e < (n?.length ?? 0); e++) {
|
|
3068
3068
|
const o = n.at(e);
|
|
@@ -3076,7 +3076,7 @@ async function cr(e) {
|
|
|
3076
3076
|
const s = e.at(n);
|
|
3077
3077
|
if (s.isINamedRange) continue;
|
|
3078
3078
|
let l = [s.getCoords()];
|
|
3079
|
-
for (const e of t.get(s.getWorksheet()?.getName() ?? "") ?? []) if (l = l.flatMap((t) =>
|
|
3079
|
+
for (const e of t.get(s.getWorksheet()?.getName() ?? "") ?? []) if (l = l.flatMap((t) => gr(t, e)), 0 === l.length) break;
|
|
3080
3080
|
for (const e of l) r += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), o.push(s.getWorksheet().getRange(e));
|
|
3081
3081
|
}
|
|
3082
3082
|
return {
|
|
@@ -3084,7 +3084,7 @@ async function cr(e) {
|
|
|
3084
3084
|
cells: r
|
|
3085
3085
|
};
|
|
3086
3086
|
}
|
|
3087
|
-
function
|
|
3087
|
+
function gr(e, t) {
|
|
3088
3088
|
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
3089
|
if (n > o || r > s) return [e];
|
|
3090
3090
|
const l = [];
|
|
@@ -3106,7 +3106,7 @@ function ur(e, t) {
|
|
|
3106
3106
|
colEnd: e.colEnd
|
|
3107
3107
|
}), l;
|
|
3108
3108
|
}
|
|
3109
|
-
function
|
|
3109
|
+
function dr(e, t) {
|
|
3110
3110
|
if (e.isINamedRange || !e.isSingleCell()) return "";
|
|
3111
3111
|
const n = e.getCell();
|
|
3112
3112
|
if (n.getType() === b.String) return "";
|
|
@@ -3121,13 +3121,13 @@ function gr(e, t) {
|
|
|
3121
3121
|
}
|
|
3122
3122
|
return s.join(" ");
|
|
3123
3123
|
}
|
|
3124
|
-
function
|
|
3124
|
+
function hr(e) {
|
|
3125
3125
|
const t = e.isINamedRange ? e.getId() : null;
|
|
3126
3126
|
if (t) return `name:${t}`;
|
|
3127
3127
|
const n = e.getCoords();
|
|
3128
3128
|
return `${e.getWorksheet()?.getName() ?? ""}!${n.rowStart},${n.colStart},${n.rowEnd},${n.colEnd}`;
|
|
3129
3129
|
}
|
|
3130
|
-
function
|
|
3130
|
+
function fr(e) {
|
|
3131
3131
|
const t = e.getWorksheet()?.getName() ?? "";
|
|
3132
3132
|
if (e.isINamedRange) return {
|
|
3133
3133
|
address: e.getName(),
|
|
@@ -3141,7 +3141,7 @@ function hr(e) {
|
|
|
3141
3141
|
isName: !1
|
|
3142
3142
|
};
|
|
3143
3143
|
}
|
|
3144
|
-
function
|
|
3144
|
+
function mr(e) {
|
|
3145
3145
|
if (e.isINamedRange) {
|
|
3146
3146
|
const t = e.getRanges();
|
|
3147
3147
|
return t ? `name → ${t.getAddress()}` : "name";
|
|
@@ -3150,14 +3150,14 @@ function fr(e) {
|
|
|
3150
3150
|
const t = e.getCell(), n = N(t, v.Mode.Display), o = t.getFormulaText(), r = n ? n.display : "(empty)";
|
|
3151
3151
|
return o ? `${r} ${o}` : r;
|
|
3152
3152
|
}
|
|
3153
|
-
const t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(
|
|
3153
|
+
const t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(tr.Formula)];
|
|
3154
3154
|
if (1 === n.length && n[0].getRange().isEqual(e)) {
|
|
3155
3155
|
const e = n[0].getCell().getFormulaText();
|
|
3156
3156
|
if (e) return `${t} ${e}`;
|
|
3157
3157
|
}
|
|
3158
3158
|
return t;
|
|
3159
3159
|
}
|
|
3160
|
-
var
|
|
3160
|
+
var pr = {
|
|
3161
3161
|
features: (e) => It(e),
|
|
3162
3162
|
mode: (e, t) => function(e, t, n) {
|
|
3163
3163
|
const o = new Map(Object.values(n).map((e) => [e.toLowerCase(), e])).get(e.trim().toLowerCase());
|
|
@@ -3167,32 +3167,32 @@ var mr = {
|
|
|
3167
3167
|
}
|
|
3168
3168
|
return o;
|
|
3169
3169
|
}(e, t, v.Mode)
|
|
3170
|
-
},
|
|
3171
|
-
function
|
|
3170
|
+
}, $r = Object.keys(pr);
|
|
3171
|
+
function wr(e) {
|
|
3172
3172
|
const t = {};
|
|
3173
3173
|
for (const [n, o] of Object.entries(e)) {
|
|
3174
|
-
const e =
|
|
3175
|
-
if (!e) throw new Error(`Unknown report option '${n}'. Options: ${
|
|
3174
|
+
const e = pr[n];
|
|
3175
|
+
if (!e) throw new Error(`Unknown report option '${n}'. Options: ${$r.join(", ")}.`);
|
|
3176
3176
|
t[n] = e(o, n);
|
|
3177
3177
|
}
|
|
3178
3178
|
return t;
|
|
3179
3179
|
}
|
|
3180
|
-
var
|
|
3180
|
+
var yr = /^'?\[(\d+)\]([^']*)'?$/, br = /* @__PURE__ */ new Set([
|
|
3181
3181
|
"cell",
|
|
3182
3182
|
"named",
|
|
3183
3183
|
"error"
|
|
3184
|
-
]),
|
|
3184
|
+
]), Sr = (e) => {
|
|
3185
3185
|
const t = e.sources?.[0]?.target ?? "";
|
|
3186
3186
|
return t.split(/[\\/]/).pop() || t;
|
|
3187
3187
|
};
|
|
3188
|
-
function
|
|
3188
|
+
function xr(e, t) {
|
|
3189
3189
|
const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set();
|
|
3190
3190
|
let r;
|
|
3191
3191
|
for (const s of e) {
|
|
3192
|
-
if (!
|
|
3192
|
+
if (!br.has(s.type)) continue;
|
|
3193
3193
|
const e = s.value?.scope;
|
|
3194
3194
|
if ("string" != typeof e) continue;
|
|
3195
|
-
const l =
|
|
3195
|
+
const l = yr.exec(e);
|
|
3196
3196
|
if (!l) continue;
|
|
3197
3197
|
const a = e.toLowerCase();
|
|
3198
3198
|
if (o.has(a)) {
|
|
@@ -3218,16 +3218,16 @@ function Sr(e, t) {
|
|
|
3218
3218
|
const d = new Set(u.sheetNames.map((e) => e.toLowerCase())), h = g.split(":").find((e) => !d.has(e.toLowerCase()));
|
|
3219
3219
|
void 0 !== h && n.set(a, {
|
|
3220
3220
|
scope: c,
|
|
3221
|
-
reason: `external link [${i}] (${
|
|
3221
|
+
reason: `external link [${i}] (${Sr(u)}) has no sheet '${h}'`,
|
|
3222
3222
|
uses: 1
|
|
3223
3223
|
});
|
|
3224
3224
|
}
|
|
3225
3225
|
return [...n.values()];
|
|
3226
3226
|
}
|
|
3227
|
-
function
|
|
3227
|
+
function kr(e) {
|
|
3228
3228
|
return e.map((e) => `cites ${e.scope}: ${e.reason}`).join("; ");
|
|
3229
3229
|
}
|
|
3230
|
-
var
|
|
3230
|
+
var Cr = l.Feature, vr = [
|
|
3231
3231
|
["formatCells", "format cells"],
|
|
3232
3232
|
["formatColumns", "format columns"],
|
|
3233
3233
|
["formatRows", "format rows"],
|
|
@@ -3241,32 +3241,32 @@ var kr = l.Feature, Cr = [
|
|
|
3241
3241
|
["pivotTables", "pivot tables"],
|
|
3242
3242
|
["objects", "edit objects"],
|
|
3243
3243
|
["scenarios", "edit scenarios"]
|
|
3244
|
-
],
|
|
3244
|
+
], Er = [["structure", "structure"], ["windows", "windows"]], Rr = (e) => {
|
|
3245
3245
|
const t = e.hasPassword() ? " · password" : "";
|
|
3246
3246
|
return e.isLocked() ? `locked${t}` : e.isPaused() ? `paused${t} — nothing is refused until resume()` : null;
|
|
3247
|
-
},
|
|
3247
|
+
}, Nr = (e) => {
|
|
3248
3248
|
const t = e.getProperties();
|
|
3249
3249
|
if (!t) return null;
|
|
3250
|
-
const n =
|
|
3250
|
+
const n = vr.filter(([e]) => !0 === t[e]).map(([, e]) => e);
|
|
3251
3251
|
return n.length > 0 ? n.join(", ") : null;
|
|
3252
|
-
},
|
|
3252
|
+
}, jr = (e) => {
|
|
3253
3253
|
const t = e.getProperties();
|
|
3254
3254
|
if (!t) return null;
|
|
3255
|
-
const n =
|
|
3255
|
+
const n = Er.filter(([e]) => !0 !== t[e]).map(([, e]) => e);
|
|
3256
3256
|
return n.length > 0 ? n.join(", ") : null;
|
|
3257
|
-
},
|
|
3258
|
-
const t =
|
|
3257
|
+
}, Mr = (e) => {
|
|
3258
|
+
const t = Rr(e);
|
|
3259
3259
|
if (!t) return null;
|
|
3260
|
-
const n =
|
|
3260
|
+
const n = jr(e);
|
|
3261
3261
|
return n ? `${n} ${t}` : t;
|
|
3262
|
-
},
|
|
3262
|
+
}, Fr = (e) => [...e.getEntireRange().getRegions(Cr.Unlock)], Ir = (e) => {
|
|
3263
3263
|
let t = 0;
|
|
3264
3264
|
for (const n of e) {
|
|
3265
3265
|
const e = n.getCoords();
|
|
3266
3266
|
t += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
|
|
3267
3267
|
}
|
|
3268
3268
|
return t;
|
|
3269
|
-
},
|
|
3269
|
+
}, Tr = (t) => {
|
|
3270
3270
|
let n = null;
|
|
3271
3271
|
for (const e of t) {
|
|
3272
3272
|
const t = e.getCoords();
|
|
@@ -3278,71 +3278,71 @@ var kr = l.Feature, Cr = [
|
|
|
3278
3278
|
} : { ...t };
|
|
3279
3279
|
}
|
|
3280
3280
|
return n ? e.rangeToString(n) ?? "" : "";
|
|
3281
|
-
},
|
|
3282
|
-
function
|
|
3283
|
-
const t = e.getProtection(), n =
|
|
3281
|
+
}, Ar = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`;
|
|
3282
|
+
function Lr(e) {
|
|
3283
|
+
const t = e.getProtection(), n = Rr(t);
|
|
3284
3284
|
if (!n) return null;
|
|
3285
|
-
const o =
|
|
3285
|
+
const o = Fr(e), r = [o.length > 0 ? `${Ar(Ir(o), "editable cell")} · ${Ar(o.length, "region")}` : "no editable cells", n];
|
|
3286
3286
|
return !1 === t.getProperties()?.showFormulas && r.push("formulas hidden"), {
|
|
3287
|
-
extent:
|
|
3287
|
+
extent: Tr(o),
|
|
3288
3288
|
detail: r.join(" · ")
|
|
3289
3289
|
};
|
|
3290
3290
|
}
|
|
3291
|
-
function
|
|
3292
|
-
const n = t.getProtection(), o =
|
|
3291
|
+
function Wr(e, t) {
|
|
3292
|
+
const n = t.getProtection(), o = Rr(n);
|
|
3293
3293
|
if (!o) return;
|
|
3294
3294
|
e.h2(`Protection (${o})`);
|
|
3295
3295
|
const r = (e) => ` ${e.padEnd(10)}`;
|
|
3296
|
-
e.text(`${r("allowed")}${
|
|
3297
|
-
const s =
|
|
3296
|
+
e.text(`${r("allowed")}${Nr(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`);
|
|
3297
|
+
const s = Fr(t);
|
|
3298
3298
|
if (0 === s.length) return e.text(`${r("editable")}none — every cell refuses a write`), void e.blank();
|
|
3299
|
-
e.text(`${r("editable")}${
|
|
3299
|
+
e.text(`${r("editable")}${Ar(Ir(s), "cell")} · ${Ar(s.length, "region")}`), kt(e, s, {
|
|
3300
3300
|
maxRegions: 12,
|
|
3301
|
-
payload:
|
|
3302
|
-
recovery: `${
|
|
3301
|
+
payload: St(Cr.Unlock, null),
|
|
3302
|
+
recovery: `${Lt(t.getEntireRange())}.getRegions("unlock") lists all ${s.length}`
|
|
3303
3303
|
}), e.blank();
|
|
3304
3304
|
}
|
|
3305
|
-
function
|
|
3305
|
+
function Or(e) {
|
|
3306
3306
|
if (!e.getWorksheet().getProtection().isLocked()) return null;
|
|
3307
|
-
const t = [...e.getRegions(
|
|
3307
|
+
const t = [...e.getRegions(Cr.Unlock)], n = e.getRowCount() * e.getColumnCount(), o = Ir(t);
|
|
3308
3308
|
if (0 === o) return "sheet locked — no cell here takes a write";
|
|
3309
3309
|
if (o === n) return "sheet locked — every cell here is editable";
|
|
3310
3310
|
const r = e.getWorksheet().getProtectedRanges().getItems({ address: e }).some((e) => !e.isUnlocked());
|
|
3311
|
-
return `sheet locked — ${o} of ${
|
|
3311
|
+
return `sheet locked — ${o} of ${Ar(n, "cell")} editable (${Tr(t)})` + (r ? " · some behind a range password" : "");
|
|
3312
3312
|
}
|
|
3313
|
-
function
|
|
3313
|
+
function Pr(e) {
|
|
3314
3314
|
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
3315
|
}
|
|
3316
|
-
function
|
|
3316
|
+
function Dr(e) {
|
|
3317
3317
|
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
3318
|
}
|
|
3319
|
-
function
|
|
3320
|
-
const t = new
|
|
3319
|
+
function Hr(e) {
|
|
3320
|
+
const t = new ie(), n = !0 === e.isIWorksheetProtection;
|
|
3321
3321
|
t.h1(n ? "Sheet Protection" : "Workbook Protection"), t.blank();
|
|
3322
|
-
const o =
|
|
3322
|
+
const o = Rr(e);
|
|
3323
3323
|
t.fact(`State: ${o ?? "not protected"}${e.isReadOnly() ? " · read-only" : ""}`);
|
|
3324
3324
|
const r = o ? "" : " (when next locked)";
|
|
3325
3325
|
if (n) {
|
|
3326
|
-
const n =
|
|
3326
|
+
const n = Nr(e);
|
|
3327
3327
|
(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
3328
|
} else {
|
|
3329
|
-
const n =
|
|
3329
|
+
const n = jr(e);
|
|
3330
3330
|
(o || e.getProperties()) && t.fact(`Refused${r}: ${n ?? "nothing"}`);
|
|
3331
3331
|
}
|
|
3332
3332
|
return t.toLines().join("\n").trimEnd();
|
|
3333
3333
|
}
|
|
3334
|
-
function
|
|
3335
|
-
const t = new
|
|
3336
|
-
t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${
|
|
3334
|
+
function Vr(e) {
|
|
3335
|
+
const t = new ie(), n = e.getRanges();
|
|
3336
|
+
t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${Ot(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
3337
|
const o = n.getWorksheet().getProtection().isLocked();
|
|
3338
3338
|
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
3339
|
}
|
|
3340
|
-
var
|
|
3341
|
-
async function
|
|
3340
|
+
var Br = l.Feature;
|
|
3341
|
+
async function zr(e, t) {
|
|
3342
3342
|
const n = e.getWorksheet().getRange(e.getCoords());
|
|
3343
3343
|
e = n.getCell();
|
|
3344
|
-
const o = new
|
|
3345
|
-
o.h1(`Cell — ${
|
|
3344
|
+
const o = new ie();
|
|
3345
|
+
o.h1(`Cell — ${At(e.getWorksheet().getName())}!${e.getAddress()}`), o.blank();
|
|
3346
3346
|
const r = !!e.getFormulaText(), l = e.getType();
|
|
3347
3347
|
(function(e, t) {
|
|
3348
3348
|
const n = N(t, v.Mode.Display), o = N(t, v.Mode.Value), r = t.getFormulaText(), s = e.toLines().length;
|
|
@@ -3370,7 +3370,7 @@ async function Br(e, t) {
|
|
|
3370
3370
|
const c = t.getSpill();
|
|
3371
3371
|
c && e.fact(`Spill: ${c.toString()}${"error" === t.getSpillKind() ? " (blocked)" : ""}`);
|
|
3372
3372
|
t.isSpillOverflow() && e.fact("Spill Overflow: true — the anchor formula is elsewhere");
|
|
3373
|
-
const u = t
|
|
3373
|
+
const u = ge(t);
|
|
3374
3374
|
u && e.fact(`Table: ${function(e, t) {
|
|
3375
3375
|
const n = e.getRange().getCoords(), o = [`${e.getName()} (${e.getRange().getAddress()})`], r = e.getColumnAt(t.colIndex - n.colStart);
|
|
3376
3376
|
r && o.push(`column ${JSON.stringify(r.getName())}`);
|
|
@@ -3382,19 +3382,19 @@ async function Br(e, t) {
|
|
|
3382
3382
|
}
|
|
3383
3383
|
return o.join(" · ");
|
|
3384
3384
|
}(u, t.getCoords())}`);
|
|
3385
|
-
const g =
|
|
3386
|
-
g.length > 0 && e.fact(`Names: ${g.map((e) => `${e.getName()} (${
|
|
3387
|
-
const d =
|
|
3385
|
+
const g = cn(t.getWorksheet().getRange(t.getCoords()));
|
|
3386
|
+
g.length > 0 && e.fact(`Names: ${g.map((e) => `${e.getName()} (${Wt(e.getRanges())})`).join(" · ")}`);
|
|
3387
|
+
const d = Pr(t);
|
|
3388
3388
|
d && e.fact(`Editable: ${d}`);
|
|
3389
3389
|
const h = t.getErrors();
|
|
3390
3390
|
if (h.length > 0) {
|
|
3391
|
-
const n = xr(
|
|
3391
|
+
const n = kr(xr(t.getFormula()?.getTokens() ?? [], t.getWorksheet().getWorkbook()));
|
|
3392
3392
|
e.fact(`Errors: ${h.join("; ")}${n ? ` — ${n}` : ""}`);
|
|
3393
3393
|
}
|
|
3394
3394
|
const f = t.getWarnings();
|
|
3395
3395
|
f.length > 0 && e.fact(`Warnings: ${f.join("; ")}`);
|
|
3396
3396
|
const m = function(e, t) {
|
|
3397
|
-
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 =
|
|
3397
|
+
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
3398
|
s ? null : r,
|
|
3399
3399
|
i ? `format ${i}` : null,
|
|
3400
3400
|
c ? `font ${c}` : null,
|
|
@@ -3415,12 +3415,12 @@ async function Br(e, t) {
|
|
|
3415
3415
|
return a && function(e, t, n) {
|
|
3416
3416
|
const o = t.getCoords(), r = t.getWorksheet();
|
|
3417
3417
|
e.h2(`Current Region — ${n.getAddress()} · ${n.getRowCount()}×${n.getColumnCount()}`);
|
|
3418
|
-
const s =
|
|
3418
|
+
const s = ye(n), l = (e) => {
|
|
3419
3419
|
if (!s || s.byColumn !== ("row" === e)) return null;
|
|
3420
3420
|
const t = "row" === e ? o.rowIndex : o.colIndex;
|
|
3421
3421
|
if (t < s.start) return null;
|
|
3422
3422
|
const n = s.lines.find((e) => e.index === t);
|
|
3423
|
-
if (n?.sums) return `totals, ${
|
|
3423
|
+
if (n?.sums) return `totals, ${xe(n.sums)}`;
|
|
3424
3424
|
const r = s.byColumn ? `row ${s.start + 1}` : `column ${ae(s.start)}`;
|
|
3425
3425
|
return t === s.start ? "totals" : `below the totals ${r}`;
|
|
3426
3426
|
}, a = [["row", [
|
|
@@ -3435,7 +3435,7 @@ async function Br(e, t) {
|
|
|
3435
3435
|
for (const [t, n] of a) e.text(` ${t.padEnd(7)}${n}`);
|
|
3436
3436
|
e.blank();
|
|
3437
3437
|
}(o, e, a), function(e, t, n) {
|
|
3438
|
-
const o = t.getCoords(), r = n?.getCoords() ??
|
|
3438
|
+
const o = t.getCoords(), r = n?.getCoords() ?? Ur(o), s = t.getWorksheet(), l = s.getRange({
|
|
3439
3439
|
rowStart: o.rowIndex,
|
|
3440
3440
|
rowEnd: o.rowIndex,
|
|
3441
3441
|
colStart: r.colStart,
|
|
@@ -3445,7 +3445,7 @@ async function Br(e, t) {
|
|
|
3445
3445
|
rowEnd: r.rowEnd,
|
|
3446
3446
|
colStart: o.colIndex,
|
|
3447
3447
|
colEnd: o.colIndex
|
|
3448
|
-
}), i = [
|
|
3448
|
+
}), i = [Jr(l, "row", o.colIndex), Jr(a, "column", o.rowIndex)].filter((e) => null !== e);
|
|
3449
3449
|
if (0 === i.length) return;
|
|
3450
3450
|
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
3451
|
rowStart: o.rowIndex,
|
|
@@ -3474,7 +3474,7 @@ async function Br(e, t) {
|
|
|
3474
3474
|
address: n,
|
|
3475
3475
|
detail: t ? `${o} ← this cell` : o
|
|
3476
3476
|
};
|
|
3477
|
-
}), n = Math.max(...t.map((e) => e.address.length)), o = t.slice(0,
|
|
3477
|
+
}), n = Math.max(...t.map((e) => e.address.length)), o = t.slice(0, _r);
|
|
3478
3478
|
for (const t of o) e.text(` ${t.address.padEnd(n)} ${t.detail}`);
|
|
3479
3479
|
t.length > o.length && e.text(` …${t.length - o.length} more · getRegions("formula") on ${h.getAddress()} lists them`);
|
|
3480
3480
|
}
|
|
@@ -3485,23 +3485,23 @@ async function Br(e, t) {
|
|
|
3485
3485
|
e.h2(`Anomalies (${n.length})`);
|
|
3486
3486
|
for (const o of n) e.text(` ${D(o, t)}`);
|
|
3487
3487
|
e.blank();
|
|
3488
|
-
}(o, e), await
|
|
3488
|
+
}(o, e), await nr(o, e, t, {
|
|
3489
3489
|
home: e.getWorksheet(),
|
|
3490
3490
|
subject: n,
|
|
3491
3491
|
zeroPrecedents: r,
|
|
3492
3492
|
zeroDependents: r || l !== b.Null && l !== b.String
|
|
3493
3493
|
}), o.toLines().join("\n").trimEnd();
|
|
3494
3494
|
}
|
|
3495
|
-
var
|
|
3495
|
+
var _r = 8, Ur = (e) => ({
|
|
3496
3496
|
rowStart: e.rowIndex,
|
|
3497
3497
|
rowEnd: e.rowIndex,
|
|
3498
3498
|
colStart: e.colIndex,
|
|
3499
3499
|
colEnd: e.colIndex
|
|
3500
3500
|
});
|
|
3501
|
-
function
|
|
3501
|
+
function Jr(e, t, n) {
|
|
3502
3502
|
if (e.isSingleCell()) return null;
|
|
3503
3503
|
const o = [];
|
|
3504
|
-
for (const n of e.getRegions(
|
|
3504
|
+
for (const n of e.getRegions(Br.Formula)) {
|
|
3505
3505
|
const e = n.getCoords();
|
|
3506
3506
|
o.push({
|
|
3507
3507
|
start: "row" === t ? e.colStart : e.rowStart,
|
|
@@ -3521,7 +3521,7 @@ function Ur(e, t, n) {
|
|
|
3521
3521
|
if (n < a || n > i) continue;
|
|
3522
3522
|
const c = [];
|
|
3523
3523
|
let u = a;
|
|
3524
|
-
for (const n of o) n.end < a || n.start > i || (n.start > u && c.push(
|
|
3524
|
+
for (const n of o) n.end < a || n.start > i || (n.start > u && c.push(qr(e, t, u, n.start - 1)), c.push(n), u = n.end + 1);
|
|
3525
3525
|
return {
|
|
3526
3526
|
axis: t,
|
|
3527
3527
|
segments: c,
|
|
@@ -3533,7 +3533,7 @@ function Ur(e, t, n) {
|
|
|
3533
3533
|
}
|
|
3534
3534
|
return null;
|
|
3535
3535
|
}
|
|
3536
|
-
function
|
|
3536
|
+
function qr(e, t, n, o) {
|
|
3537
3537
|
const r = e.getCoords();
|
|
3538
3538
|
return {
|
|
3539
3539
|
start: n,
|
|
@@ -3552,14 +3552,14 @@ function Jr(e, t, n, o) {
|
|
|
3552
3552
|
})
|
|
3553
3553
|
};
|
|
3554
3554
|
}
|
|
3555
|
-
async function
|
|
3556
|
-
const n = new
|
|
3557
|
-
n.h1(`Cell Range — ${
|
|
3558
|
-
const o =
|
|
3559
|
-
o && n.text(`Protection: ${o}`), n.blank(),
|
|
3555
|
+
async function Kr(e, t) {
|
|
3556
|
+
const n = new ie();
|
|
3557
|
+
n.h1(`Cell Range — ${Pt(e)}`);
|
|
3558
|
+
const o = Or(e);
|
|
3559
|
+
o && n.text(`Protection: ${o}`), n.blank(), Dt(n, e), function(e, t, n) {
|
|
3560
3560
|
if (!1 === n?.profile) return;
|
|
3561
3561
|
if (t.isSingleCell() || !t.isContentful()) return;
|
|
3562
|
-
const o =
|
|
3562
|
+
const o = pe({
|
|
3563
3563
|
getRowCount: () => t.getRowCount(),
|
|
3564
3564
|
getColumnCount: () => t.getColumnCount(),
|
|
3565
3565
|
getCell: () => t.getCell(),
|
|
@@ -3598,7 +3598,7 @@ async function qr(e, t) {
|
|
|
3598
3598
|
colStart: $[0],
|
|
3599
3599
|
colEnd: $[$.length - 1]
|
|
3600
3600
|
}), y = `${h} cell${1 !== h ? "s" : ""}`, b = w.toString() !== t.toString();
|
|
3601
|
-
e.h2(`Values (${b ? `${
|
|
3601
|
+
e.h2(`Values (${b ? `${Tt(w)} · ` : ""}${y})`);
|
|
3602
3602
|
const S = e.beginFrame($.map((e) => u.at(e - i).getText()));
|
|
3603
3603
|
for (const e of m) {
|
|
3604
3604
|
const t = g.get(e);
|
|
@@ -3615,7 +3615,7 @@ async function qr(e, t) {
|
|
|
3615
3615
|
address: e.getAddress(),
|
|
3616
3616
|
size: `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
3617
3617
|
formula: r,
|
|
3618
|
-
labels:
|
|
3618
|
+
labels: Zr(t)
|
|
3619
3619
|
}), o.length >= (n?.maxRegions ?? 100))) break;
|
|
3620
3620
|
}
|
|
3621
3621
|
if (0 === o.length) return;
|
|
@@ -3629,12 +3629,12 @@ async function qr(e, t) {
|
|
|
3629
3629
|
const n = Math.max(...t.map((e) => e.address.length));
|
|
3630
3630
|
for (const { address: o, valuesRange: r } of t) e.text(` ${o.padEnd(n)} ${r}`);
|
|
3631
3631
|
e.blank();
|
|
3632
|
-
}(n, r.spills), await
|
|
3632
|
+
}(n, r.spills), await un(n, e), oo(n, e.getMovables()), an(n, "Conditional Formats", e.getConditionalFormats(), ft), an(n, "Data Validations", e.getDataValidations(), mt), await nr(n, e, t, {
|
|
3633
3633
|
home: e.getWorksheet(),
|
|
3634
3634
|
subject: e
|
|
3635
3635
|
}), n.toLines().join("\n").trimEnd();
|
|
3636
3636
|
}
|
|
3637
|
-
var
|
|
3637
|
+
var Gr = /* @__PURE__ */ new Set([
|
|
3638
3638
|
"INDEX",
|
|
3639
3639
|
"MATCH",
|
|
3640
3640
|
"XMATCH",
|
|
@@ -3643,11 +3643,11 @@ var Kr = /* @__PURE__ */ new Set([
|
|
|
3643
3643
|
"XLOOKUP",
|
|
3644
3644
|
"LOOKUP"
|
|
3645
3645
|
]), Xr = 4;
|
|
3646
|
-
function
|
|
3646
|
+
function Zr(e) {
|
|
3647
3647
|
const t = e.getFormula(), n = t?.getReferences();
|
|
3648
3648
|
if (!t || !n) return null;
|
|
3649
3649
|
const o = /* @__PURE__ */ new Set();
|
|
3650
|
-
for (const e of t.getTokens()) void 0 !== e.referenceIndex && e.context &&
|
|
3650
|
+
for (const e of t.getTokens()) void 0 !== e.referenceIndex && e.context && Gr.has(e.context.name.toUpperCase().replace(/^(_XLFN\.)?(_XLWS\.)?/, "")) && o.add(e.referenceIndex);
|
|
3651
3651
|
const r = e.getWorksheet(), s = e.getCoords(), l = [], a = /* @__PURE__ */ new Set();
|
|
3652
3652
|
for (let e = 0; e < n.length && l.length < Xr; e++) {
|
|
3653
3653
|
const t = n.at(e), i = t.getCoords();
|
|
@@ -3668,50 +3668,50 @@ function Gr(e) {
|
|
|
3668
3668
|
const i = se(r, s, "row");
|
|
3669
3669
|
return `${i ? `row ${le(i)} → ` : "→ "}${l.join(" · ")}`;
|
|
3670
3670
|
}
|
|
3671
|
-
function
|
|
3672
|
-
const t = new
|
|
3673
|
-
t.h1(`Conditional Format — ${
|
|
3671
|
+
function Yr(e) {
|
|
3672
|
+
const t = new ie(), n = e.getRanges();
|
|
3673
|
+
t.h1(`Conditional Format — ${Ot(n)}`), t.blank(), t.fact(`Order: ${e.getIndex() + 1}`);
|
|
3674
3674
|
const o = e.getScale();
|
|
3675
|
-
if (o) t.fact(`Rule: ${
|
|
3675
|
+
if (o) t.fact(`Rule: ${dt(o)}`);
|
|
3676
3676
|
else {
|
|
3677
3677
|
const n = e.getCondition();
|
|
3678
3678
|
t.fact(`Rule: ${n?.toString() || "none — this rule tests nothing"}`);
|
|
3679
|
-
const o =
|
|
3679
|
+
const o = ut(e.getStyle());
|
|
3680
3680
|
o && t.fact(`Format: ${o}`);
|
|
3681
3681
|
}
|
|
3682
3682
|
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
3683
|
}
|
|
3684
|
-
function
|
|
3685
|
-
const t = new
|
|
3684
|
+
function Qr(e) {
|
|
3685
|
+
const t = new ie();
|
|
3686
3686
|
t.h1("Counts");
|
|
3687
3687
|
let n = !1;
|
|
3688
3688
|
for (const [o, r] of Object.entries(e)) r > 0 && (t.fact(`${o}: ${r}`), n = !0);
|
|
3689
3689
|
return n || t.fact("None"), t.toLines().join("\n").trimEnd();
|
|
3690
3690
|
}
|
|
3691
|
-
function
|
|
3692
|
-
const t = new
|
|
3693
|
-
t.h1(`Data Validation — ${
|
|
3691
|
+
function es(e) {
|
|
3692
|
+
const t = new ie(), n = e.getRanges();
|
|
3693
|
+
t.h1(`Data Validation — ${Ot(n)}`), t.blank();
|
|
3694
3694
|
const o = e.getCondition();
|
|
3695
3695
|
t.fact(`Rule: ${o?.toString() || "none — anything is accepted here"}`);
|
|
3696
|
-
const r =
|
|
3696
|
+
const r = pt(o);
|
|
3697
3697
|
r && t.fact(`Allowed: ${r}`), t.fact("Blanks: " + (e.isIncludeBlanks() ? "allowed" : "rejected"));
|
|
3698
3698
|
const s = e.getAlertStyle();
|
|
3699
3699
|
if (t.fact(`Alert: ${s}${s === c.AlertStyle.Stop ? " — the entry is refused" : " — the entry is accepted anyway"}`), e.isShowAlertMessage()) {
|
|
3700
|
-
const n =
|
|
3700
|
+
const n = ts(e.getAlertTitle(), e.getAlertMessage());
|
|
3701
3701
|
n && t.fact(`Alert Message: ${n}`);
|
|
3702
3702
|
}
|
|
3703
3703
|
if (e.isShowPromptMessage()) {
|
|
3704
|
-
const n =
|
|
3704
|
+
const n = ts(e.getPromptTitle(), e.getPromptMessage());
|
|
3705
3705
|
n && t.fact(`Prompt: ${n}`);
|
|
3706
3706
|
}
|
|
3707
3707
|
return e.isHideDropdown() && t.fact("Dropdown: hidden"), t.fact(`Cells: ${n.size}`), t.toLines().join("\n").trimEnd();
|
|
3708
3708
|
}
|
|
3709
|
-
var
|
|
3709
|
+
var ts = (e, t) => {
|
|
3710
3710
|
const n = [e?.trim(), t?.trim()].filter(Boolean);
|
|
3711
3711
|
return n.length > 0 ? n.join(" — ") : null;
|
|
3712
|
-
},
|
|
3713
|
-
var
|
|
3714
|
-
function
|
|
3712
|
+
}, ns = "function", os = "named", rs = "tableReference", ss = "tableColumn", ls = "externalReference", as = [["isReferenceOnly", "reference-only"], ["isVolatile", "volatile"]];
|
|
3713
|
+
var is = (e, t) => e ? ` (${At(e)}!${t})` : "";
|
|
3714
|
+
function cs(e, t, n, o) {
|
|
3715
3715
|
if ("external" === e) return "another workbook — not resolvable from here";
|
|
3716
3716
|
if (!n) return "";
|
|
3717
3717
|
switch (e) {
|
|
@@ -3722,17 +3722,17 @@ function is(e, t, n, o) {
|
|
|
3722
3722
|
case "named": return function(e, t) {
|
|
3723
3723
|
const n = t.getNames(), o = n.getByName(e) ?? n.getByName(e, !0);
|
|
3724
3724
|
if (o) {
|
|
3725
|
-
const e =
|
|
3725
|
+
const e = is(o.getScope(), o.getName()), t = o.getRanges?.();
|
|
3726
3726
|
return !t || t.isInvalid() ? `defined name — reference does not resolve${e}` : `${t.toString()}${e}`;
|
|
3727
3727
|
}
|
|
3728
3728
|
const r = t.getCalculation().getNamedFormulas().getByName(e);
|
|
3729
|
-
return r ? `=${r.getExpression()}${
|
|
3729
|
+
return r ? `=${r.getExpression()}${is(r.getScope(), r.getName())}` : "unknown — evaluates to #NAME?";
|
|
3730
3730
|
}(t, n);
|
|
3731
3731
|
case "table": {
|
|
3732
3732
|
const e = n.getTables().getByName(t) ?? n.getWorkbook()?.getWorksheets().getItems().map((e) => e.getTables().getByName(t)).find(Boolean) ?? null;
|
|
3733
3733
|
return e ? ((e, t) => {
|
|
3734
3734
|
const n = e.getWorksheet(), o = e.toString();
|
|
3735
|
-
return !n || t && n.getName() === t.getName() || o.includes("!") ? o : `${
|
|
3735
|
+
return !n || t && n.getName() === t.getName() || o.includes("!") ? o : `${At(n.getName())}!${o}`;
|
|
3736
3736
|
})(e.getRange(), n) : "unknown — evaluates to #NAME?";
|
|
3737
3737
|
}
|
|
3738
3738
|
case "column": {
|
|
@@ -3745,8 +3745,8 @@ function is(e, t, n, o) {
|
|
|
3745
3745
|
}
|
|
3746
3746
|
return "";
|
|
3747
3747
|
}
|
|
3748
|
-
async function
|
|
3749
|
-
const n = t?.maxTokens ?? 200, o = new
|
|
3748
|
+
async function us(e, t) {
|
|
3749
|
+
const n = t?.maxTokens ?? 200, o = new ie(), r = ((e) => e.isINamed ? e : null)(e);
|
|
3750
3750
|
if (o.h1(r ? `Name — ${Xt(r)}` : "Formula"), o.text(o.codespan("=" + e.getExpression())), o.blank(), r) {
|
|
3751
3751
|
r.isHidden() && o.fact("Hidden: true — not offered in the UI; formulas resolve it normally");
|
|
3752
3752
|
const e = r.getComment();
|
|
@@ -3767,7 +3767,7 @@ async function cs(e, t) {
|
|
|
3767
3767
|
const r = j(n);
|
|
3768
3768
|
e.fact(`Value: ${r ? r.display : "(empty)"}`);
|
|
3769
3769
|
}(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 =
|
|
3770
|
+
const s = as.filter(([t]) => e[t]()).map(([, e]) => e);
|
|
3771
3771
|
s.length > 0 && o.fact(`Flags: ${s.join(" · ")}`), o.blank();
|
|
3772
3772
|
const l = e.getReferences(), a = t?.context ?? l?.getWorksheet() ?? null, i = function(e, t) {
|
|
3773
3773
|
const n = /* @__PURE__ */ new Map();
|
|
@@ -3777,19 +3777,19 @@ async function cs(e, t) {
|
|
|
3777
3777
|
if (!e) continue;
|
|
3778
3778
|
let s;
|
|
3779
3779
|
switch (r.type) {
|
|
3780
|
-
case
|
|
3780
|
+
case ns:
|
|
3781
3781
|
s = "function";
|
|
3782
3782
|
break;
|
|
3783
|
-
case
|
|
3783
|
+
case os:
|
|
3784
3784
|
s = "named";
|
|
3785
3785
|
break;
|
|
3786
|
-
case
|
|
3786
|
+
case rs:
|
|
3787
3787
|
s = "table", o = e;
|
|
3788
3788
|
break;
|
|
3789
|
-
case
|
|
3789
|
+
case ss:
|
|
3790
3790
|
s = "column";
|
|
3791
3791
|
break;
|
|
3792
|
-
case
|
|
3792
|
+
case ls:
|
|
3793
3793
|
s = "external";
|
|
3794
3794
|
break;
|
|
3795
3795
|
default: continue;
|
|
@@ -3799,10 +3799,10 @@ async function cs(e, t) {
|
|
|
3799
3799
|
kind: s,
|
|
3800
3800
|
text: e,
|
|
3801
3801
|
uses: 1,
|
|
3802
|
-
resolution:
|
|
3802
|
+
resolution: cs(s, e, t, o)
|
|
3803
3803
|
});
|
|
3804
3804
|
}
|
|
3805
|
-
for (const o of
|
|
3805
|
+
for (const o of xr(e, t?.getWorkbook())) n.set(`external${o.scope.toLowerCase()}`, {
|
|
3806
3806
|
kind: "external",
|
|
3807
3807
|
text: o.scope,
|
|
3808
3808
|
uses: o.uses,
|
|
@@ -3829,7 +3829,7 @@ async function cs(e, t) {
|
|
|
3829
3829
|
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
3830
|
else o.text("None");
|
|
3831
3831
|
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
|
|
3832
|
+
await t.getDirectDependents() || (e.h2("Dependents (0)"), e.text(" None — no formula references this name"), e.blank()), await nr(e, t);
|
|
3833
3833
|
}(o, r);
|
|
3834
3834
|
const c = e.getTokens();
|
|
3835
3835
|
if (o.h2("Tokens"), 0 === c.length) o.text("None");
|
|
@@ -3858,7 +3858,7 @@ async function cs(e, t) {
|
|
|
3858
3858
|
}
|
|
3859
3859
|
return o.toLines().join("\n").trimEnd();
|
|
3860
3860
|
}
|
|
3861
|
-
var
|
|
3861
|
+
var gs = [
|
|
3862
3862
|
"Workbook_Open",
|
|
3863
3863
|
"Auto_Open",
|
|
3864
3864
|
"Workbook_BeforeClose",
|
|
@@ -3871,11 +3871,11 @@ var us = [
|
|
|
3871
3871
|
"Worksheet_Activate",
|
|
3872
3872
|
"Worksheet_BeforeDoubleClick",
|
|
3873
3873
|
"Worksheet_Calculate"
|
|
3874
|
-
],
|
|
3874
|
+
], ds = (e) => {
|
|
3875
3875
|
const t = [];
|
|
3876
|
-
for (const n of
|
|
3876
|
+
for (const n of gs) new RegExp(`(?:Sub|Function)\\s+${n}\\b`, "i").test(e) && t.push(n);
|
|
3877
3877
|
return t;
|
|
3878
|
-
},
|
|
3878
|
+
}, hs = (e) => {
|
|
3879
3879
|
try {
|
|
3880
3880
|
return e.getFunctions().getItems({
|
|
3881
3881
|
type: "autoRun",
|
|
@@ -3884,32 +3884,32 @@ var us = [
|
|
|
3884
3884
|
} catch {
|
|
3885
3885
|
return [];
|
|
3886
3886
|
}
|
|
3887
|
-
},
|
|
3887
|
+
}, fs = (e) => {
|
|
3888
3888
|
const t = e.getScope();
|
|
3889
3889
|
return t ? !0 === t.isIWorksheet ? `sheet '${t.getName()}'` : "workbook" : "global";
|
|
3890
|
-
},
|
|
3890
|
+
}, ms = (e) => {
|
|
3891
3891
|
const t = ((e) => e.getSource()?.trim() ?? "")(e);
|
|
3892
3892
|
return {
|
|
3893
3893
|
module: e,
|
|
3894
3894
|
name: e.getName(),
|
|
3895
3895
|
language: e.getLanguage(),
|
|
3896
|
-
scope:
|
|
3896
|
+
scope: fs(e),
|
|
3897
3897
|
body: t,
|
|
3898
3898
|
lines: 0 === t.length ? 0 : t.split("\n").length,
|
|
3899
|
-
runsInExcel:
|
|
3900
|
-
runsHere:
|
|
3899
|
+
runsInExcel: ds(t),
|
|
3900
|
+
runsHere: hs(e),
|
|
3901
3901
|
executable: !!e.toJSON().compiled
|
|
3902
3902
|
};
|
|
3903
3903
|
};
|
|
3904
|
-
function
|
|
3904
|
+
function ps(e) {
|
|
3905
3905
|
const t = [], n = e.getModules?.();
|
|
3906
3906
|
n && t.push(...n.getItems({ language: null }));
|
|
3907
3907
|
for (const n of e.getWorksheets().getItems()) t.push(...n.getModules().getItems({ language: null }));
|
|
3908
3908
|
return t;
|
|
3909
3909
|
}
|
|
3910
|
-
function
|
|
3910
|
+
function $s(e, t, n) {
|
|
3911
3911
|
if (0 === t.length) return;
|
|
3912
|
-
const o = t.map(
|
|
3912
|
+
const o = t.map(ms), r = o.filter((e) => e.lines > 0);
|
|
3913
3913
|
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
3914
|
e.h2(`Code (${r.length} module${1 !== r.length ? "s" : ""})`);
|
|
3915
3915
|
const s = r.filter((e) => !e.executable);
|
|
@@ -3945,7 +3945,7 @@ function ps(e, t, n) {
|
|
|
3945
3945
|
}
|
|
3946
3946
|
d.endFrame(), i.length < r.length && e.text(` …and ${r.length - i.length} more · wb.getModules() renders the full view`), e.blank();
|
|
3947
3947
|
}
|
|
3948
|
-
function
|
|
3948
|
+
function ws(e, t, n, o) {
|
|
3949
3949
|
n(`Module — ${t.name}`), e.blank();
|
|
3950
3950
|
const r = [
|
|
3951
3951
|
`language: ${t.language}`,
|
|
@@ -3957,64 +3957,64 @@ function $s(e, t, n, o) {
|
|
|
3957
3957
|
const s = o?.maxSourceLines ?? 200, l = t.body.split("\n"), a = l.length > s ? l.slice(0, s) : l;
|
|
3958
3958
|
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
3959
|
}
|
|
3960
|
-
function ws(e, t) {
|
|
3961
|
-
const n = new pt();
|
|
3962
|
-
return $s(n, fs(e), (e) => n.h1(e), t), n.toLines().join("\n").trimEnd();
|
|
3963
|
-
}
|
|
3964
3960
|
function ys(e, t) {
|
|
3965
|
-
const n = new
|
|
3961
|
+
const n = new ie();
|
|
3962
|
+
return ws(n, ms(e), (e) => n.h1(e), t), n.toLines().join("\n").trimEnd();
|
|
3963
|
+
}
|
|
3964
|
+
function bs(e, t) {
|
|
3965
|
+
const n = new ie(), o = e.getItems({ language: null }) ?? [];
|
|
3966
3966
|
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 && (
|
|
3967
|
+
const r = o.map(ms);
|
|
3968
|
+
$s(n, o, t);
|
|
3969
|
+
for (const e of r) 0 !== e.lines && (ws(n, e, (e) => n.h2(e), t), n.blank());
|
|
3970
3970
|
return n.toLines().join("\n").trimEnd();
|
|
3971
3971
|
}
|
|
3972
|
-
var
|
|
3973
|
-
async function
|
|
3974
|
-
const n = new
|
|
3972
|
+
var Ss = [["formula", "Names"], ["table", "Tables"]];
|
|
3973
|
+
async function xs(e, t) {
|
|
3974
|
+
const n = new ie(), o = e.getItems({ includeHidden: !0 }) ?? [];
|
|
3975
3975
|
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
|
|
3976
|
+
const r = new Set(Ss.map(([e]) => e));
|
|
3977
|
+
for (const [e, r] of Ss) await rn(n, o.filter((t) => t.getType() === e), {
|
|
3978
3978
|
...t,
|
|
3979
3979
|
heading: r,
|
|
3980
3980
|
symbols: o
|
|
3981
3981
|
});
|
|
3982
3982
|
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
|
|
3983
|
+
for (const e of l) await rn(n, s.filter((t) => t.getType() === e), {
|
|
3984
3984
|
...t,
|
|
3985
3985
|
heading: e,
|
|
3986
3986
|
symbols: o
|
|
3987
3987
|
});
|
|
3988
3988
|
return n.toLines().join("\n").trimEnd();
|
|
3989
3989
|
}
|
|
3990
|
-
var
|
|
3990
|
+
var ks = [
|
|
3991
3991
|
.75,
|
|
3992
3992
|
.75,
|
|
3993
3993
|
.7,
|
|
3994
3994
|
.7,
|
|
3995
3995
|
.3,
|
|
3996
3996
|
.3
|
|
3997
|
-
],
|
|
3997
|
+
], Cs = [
|
|
3998
3998
|
["top", (e) => e.getTopMargin()],
|
|
3999
3999
|
["bottom", (e) => e.getBottomMargin()],
|
|
4000
4000
|
["left", (e) => e.getLeftMargin()],
|
|
4001
4001
|
["right", (e) => e.getRightMargin()],
|
|
4002
4002
|
["header", (e) => e.getHeaderMargin()],
|
|
4003
4003
|
["footer", (e) => e.getFooterMargin()]
|
|
4004
|
-
],
|
|
4004
|
+
], vs = [
|
|
4005
4005
|
["gridlines", (e) => e.getPrintGridlines()],
|
|
4006
4006
|
["headings", (e) => e.getPrintHeadings()],
|
|
4007
4007
|
["black and white", (e) => e.getBlackAndWhite()],
|
|
4008
4008
|
["draft quality", (e) => e.getDraftMode()]
|
|
4009
|
-
],
|
|
4009
|
+
], Es = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`, Rs = (e) => Math.round(e / 72 * 1e3) / 1e3, Ns = (e) => {
|
|
4010
4010
|
const t = e.getZoom();
|
|
4011
4011
|
if (void 0 !== t.scale) return 100 === t.scale ? null : `${t.scale}%`;
|
|
4012
|
-
const n = (e, t) => e ? `${
|
|
4012
|
+
const n = (e, t) => e ? `${Es(e, "page")} ${t}` : `automatic ${t}`;
|
|
4013
4013
|
return `fit to ${n(t.horizontalFitToPages, "wide")} × ${n(t.verticalFitToPages, "tall")}`;
|
|
4014
|
-
},
|
|
4014
|
+
}, js = (e) => {
|
|
4015
4015
|
const t = e.getPaperSizeCode();
|
|
4016
4016
|
return 1 === t ? null : e.getPaperSize() ?? `code ${t}`;
|
|
4017
|
-
},
|
|
4017
|
+
}, Ms = (e) => Cs.every(([, t], n) => Rs(t(e)) === ks[n]), Fs = (t, n) => {
|
|
4018
4018
|
if (!t) return null;
|
|
4019
4019
|
const o = t.getCoords();
|
|
4020
4020
|
return n ? e.runToString(o.colStart, o.colEnd, !0) : e.runToString(o.rowStart, o.rowEnd, !1);
|
|
@@ -4025,65 +4025,65 @@ var xs = [
|
|
|
4025
4025
|
return e.runToString(o, o, n).split(":")[0];
|
|
4026
4026
|
}), r = t.length > 20 ? `, …and ${t.length - 20} more` : "";
|
|
4027
4027
|
return `before ${n ? "columns" : "rows"} ${o.join(", ")}${r}`;
|
|
4028
|
-
},
|
|
4028
|
+
}, Ts = (e) => {
|
|
4029
4029
|
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
4030
|
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
|
-
},
|
|
4031
|
+
}, As = (e, t, n) => {
|
|
4032
4032
|
const o = [];
|
|
4033
4033
|
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
4034
|
};
|
|
4035
|
-
function
|
|
4035
|
+
function Ls(e) {
|
|
4036
4036
|
const t = e.getPageLayout(), n = [];
|
|
4037
4037
|
t.getOrientation() !== d.Orientation.Portrait && n.push(t.getOrientation());
|
|
4038
|
-
const o =
|
|
4038
|
+
const o = js(t);
|
|
4039
4039
|
o && n.push(o);
|
|
4040
|
-
const r =
|
|
4040
|
+
const r = Ns(t);
|
|
4041
4041
|
r && n.push(r);
|
|
4042
4042
|
const s = t.getPrintArea();
|
|
4043
|
-
s && n.push(`print area ${
|
|
4044
|
-
const l =
|
|
4043
|
+
s && n.push(`print area ${Wt(s)}`);
|
|
4044
|
+
const l = Fs(t.getPrintTitleRows(), !1);
|
|
4045
4045
|
l && n.push(`title rows ${l}`);
|
|
4046
|
-
const a =
|
|
4046
|
+
const a = Fs(t.getPrintTitleColumns(), !0);
|
|
4047
4047
|
a && n.push(`title columns ${a}`);
|
|
4048
4048
|
const i = t.getHorizontalPageBreaks().length;
|
|
4049
|
-
i > 0 && n.push(
|
|
4049
|
+
i > 0 && n.push(Es(i, "row break"));
|
|
4050
4050
|
const c = t.getVerticalPageBreaks().length;
|
|
4051
|
-
c > 0 && n.push(
|
|
4052
|
-
const u =
|
|
4051
|
+
c > 0 && n.push(Es(c, "column break")), ((e) => Ts(e).some(([, e]) => "" !== e.getHeader() || "" !== e.getFooter()))(t) && n.push("headers/footers"), Ms(t) || n.push("custom margins");
|
|
4052
|
+
const u = vs.filter(([, e]) => e(t)).map(([e]) => e);
|
|
4053
4053
|
return u.length > 0 && n.push(u.join(", ")), 0 === n.length ? null : `${n.join(" · ")} — wb.getWorksheet(${JSON.stringify(e.getName())}).getPageLayout()`;
|
|
4054
4054
|
}
|
|
4055
|
-
function
|
|
4056
|
-
const t = new
|
|
4055
|
+
function Ws(e) {
|
|
4056
|
+
const t = new ie();
|
|
4057
4057
|
t.h1("Page Layout"), t.blank();
|
|
4058
4058
|
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}${
|
|
4059
|
+
t.fact(`Orientation: ${n}${n === d.Orientation.Portrait ? " (default)" : ""}`), t.fact(`Paper: ${js(e) ?? "letter (default)"}`), t.fact(`Zoom: ${Ns(e) ?? "100% (default)"}`);
|
|
4060
|
+
const o = Cs.map(([t, n]) => `${t} ${Rs(n(e))}`).join(" · ");
|
|
4061
|
+
t.fact(`Margins (inches): ${o}${Ms(e) ? " (default)" : ""}`);
|
|
4062
4062
|
const r = e.getPrintArea();
|
|
4063
|
-
t.fact(`Print area: ${r ?
|
|
4063
|
+
t.fact(`Print area: ${r ? Wt(r) : "none — the used range prints"}`), t.fact(`Title rows: ${Fs(e.getPrintTitleRows(), !1) ?? "none"}`), t.fact(`Title columns: ${Fs(e.getPrintTitleColumns(), !0) ?? "none"}`);
|
|
4064
4064
|
const s = e.getHorizontalPageBreaks(), l = e.getVerticalPageBreaks();
|
|
4065
4065
|
t.fact("Row breaks: " + (s.length > 0 ? `${s.length} · ${Is(s, !1)}` : "none")), t.fact("Column breaks: " + (l.length > 0 ? `${l.length} · ${Is(l, !0)}` : "none"));
|
|
4066
4066
|
const a = [];
|
|
4067
4067
|
e.getCenterHorizontally() && a.push("horizontally"), e.getCenterVertically() && a.push("vertically"), a.length > 0 && t.fact(`Centered: ${a.join(", ")}`);
|
|
4068
|
-
const i =
|
|
4068
|
+
const i = vs.filter(([, t]) => t(e)).map(([e]) => e);
|
|
4069
4069
|
i.length > 0 && t.fact(`Also prints: ${i.join(", ")}`);
|
|
4070
4070
|
const c = e.getFirstPageNumber();
|
|
4071
4071
|
"" !== 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 =
|
|
4072
|
+
const u = Ts(e).flatMap(([e, t]) => {
|
|
4073
|
+
const n = [], o = As(t.getLeftHeader(), t.getCenterHeader(), t.getRightHeader());
|
|
4074
4074
|
o && n.push(`${e} header: ${o}`);
|
|
4075
|
-
const r =
|
|
4075
|
+
const r = As(t.getLeftFooter(), t.getCenterFooter(), t.getRightFooter());
|
|
4076
4076
|
return r && n.push(`${e} footer: ${r}`), n;
|
|
4077
4077
|
});
|
|
4078
4078
|
return u.length > 0 && (t.blank(), t.h2("Headers and Footers"), t.fact(u)), t.toLines().join("\n").trimEnd();
|
|
4079
4079
|
}
|
|
4080
|
-
var
|
|
4080
|
+
var Os = (e) => {
|
|
4081
4081
|
if (!e || "object" != typeof e || Array.isArray(e)) return !1;
|
|
4082
4082
|
const t = Object.getPrototypeOf(e);
|
|
4083
4083
|
return t === Object.prototype || null === t;
|
|
4084
4084
|
};
|
|
4085
|
-
function
|
|
4086
|
-
const n = t?.maxCells ?? 1e3, o = Array.isArray(e) ? e : [e], r = new
|
|
4085
|
+
function Ps(e, t) {
|
|
4086
|
+
const n = t?.maxCells ?? 1e3, o = Array.isArray(e) ? e : [e], r = new ie();
|
|
4087
4087
|
if (r.h1("Records"), r.text(`Count: ${o.length}`), r.blank(), 0 === o.length) return r.text("None"), r.toLines().join("\n").trimEnd();
|
|
4088
4088
|
const s = (e) => {
|
|
4089
4089
|
const t = [], n = /* @__PURE__ */ new Set();
|
|
@@ -4092,34 +4092,34 @@ function Os(e, t) {
|
|
|
4092
4092
|
}, 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
4093
|
if (0 === c.length) return r.text("No fields"), r.toLines().join("\n").trimEnd();
|
|
4094
4094
|
const u = r.beginFrame(c);
|
|
4095
|
-
for (const e of i) u.addRow(c.map((n) =>
|
|
4095
|
+
for (const e of i) u.addRow(c.map((n) => Ds(e?.[n], t?.nested)));
|
|
4096
4096
|
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
4097
|
}
|
|
4098
|
-
var
|
|
4098
|
+
var Ds = (e, t) => {
|
|
4099
4099
|
if (null == e) return { text: "" };
|
|
4100
4100
|
if ("function" == typeof e) return { text: "[Function]" };
|
|
4101
|
-
if ("bigint" == typeof e || "symbol" == typeof e) return { text:
|
|
4101
|
+
if ("bigint" == typeof e || "symbol" == typeof e) return { text: Bs(String(e)) };
|
|
4102
4102
|
if ("object" == typeof e) {
|
|
4103
4103
|
if (e instanceof Date) return { text: e.toISOString() };
|
|
4104
4104
|
const n = e;
|
|
4105
|
-
if (!0 === n.isFormulaError || !0 === n.isIRichData) return { text: Vs(
|
|
4106
|
-
if (
|
|
4105
|
+
if (!0 === n.isFormulaError || !0 === n.isIRichData) return { text: Bs(Vs(e)) };
|
|
4106
|
+
if (Os(e) || Array.isArray(e)) {
|
|
4107
4107
|
let t;
|
|
4108
4108
|
try {
|
|
4109
4109
|
t = JSON.stringify(e) ?? String(e);
|
|
4110
4110
|
} catch {
|
|
4111
4111
|
t = "[circular]";
|
|
4112
4112
|
}
|
|
4113
|
-
return { text:
|
|
4113
|
+
return { text: Bs(t) };
|
|
4114
4114
|
}
|
|
4115
|
-
return { text:
|
|
4115
|
+
return { text: Bs(t?.(e) ?? Hs(e)) };
|
|
4116
4116
|
}
|
|
4117
|
-
const n = Vs(
|
|
4117
|
+
const n = Bs(Vs(e).replace(/[\r\n]+/g, " "));
|
|
4118
4118
|
return "number" == typeof e ? {
|
|
4119
4119
|
text: n,
|
|
4120
4120
|
alignment: "right"
|
|
4121
4121
|
} : { text: n };
|
|
4122
|
-
},
|
|
4122
|
+
}, Hs = (e) => {
|
|
4123
4123
|
let t;
|
|
4124
4124
|
try {
|
|
4125
4125
|
t = String(e);
|
|
@@ -4128,40 +4128,40 @@ var Ps = (e, t) => {
|
|
|
4128
4128
|
}
|
|
4129
4129
|
const n = /^\[object (.+)\]$/.exec(t)?.[1];
|
|
4130
4130
|
return n && "Object" !== n ? n : t;
|
|
4131
|
-
},
|
|
4131
|
+
}, Vs = (e) => {
|
|
4132
4132
|
try {
|
|
4133
4133
|
return j(e)?.match ?? String(e);
|
|
4134
4134
|
} catch {
|
|
4135
4135
|
return String(e);
|
|
4136
4136
|
}
|
|
4137
|
-
},
|
|
4138
|
-
function
|
|
4137
|
+
}, Bs = (e) => e.length > 80 ? `${e.slice(0, 79)}…` : e;
|
|
4138
|
+
function zs(e, t) {
|
|
4139
4139
|
const n = e.length, o = L(n, t?.maxRanges ?? 100), r = Math.min(n, o), s = [];
|
|
4140
4140
|
for (let t = 0; t < r; t++) {
|
|
4141
4141
|
const n = e.at(t);
|
|
4142
4142
|
s.push({
|
|
4143
|
-
...
|
|
4144
|
-
detail: [
|
|
4143
|
+
...fr(n),
|
|
4144
|
+
detail: [mr(n), dr(n)].filter(Boolean).join(" ")
|
|
4145
4145
|
});
|
|
4146
4146
|
}
|
|
4147
|
-
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
|
|
4148
|
-
if (c.h1(u ? `Ranges — ${
|
|
4149
|
-
const g = s.map((e) => a && !e.isName ? `${
|
|
4147
|
+
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 — ${At(i)} (${n})` : `Ranges (${n})`), 0 === s.length) return c.text("none"), c.toLines().join("\n").trimEnd();
|
|
4149
|
+
const g = s.map((e) => a && !e.isName ? `${At(e.sheet)}!${e.address}` : e.address), d = Math.max(...g.map((e) => e.length));
|
|
4150
4150
|
for (let e = 0; e < s.length; e++) c.text(` ${g[e].padEnd(d)} ${s[e].detail}`.trimEnd());
|
|
4151
4151
|
return r < n && c.text(` …and ${n - r} more · loop the collection in code to see them all`), c.toLines().join("\n").trimEnd();
|
|
4152
4152
|
}
|
|
4153
|
-
var
|
|
4153
|
+
var _s = (e) => {
|
|
4154
4154
|
let t = "", n = e + 1;
|
|
4155
4155
|
for (; n > 0;) {
|
|
4156
4156
|
const e = (n - 1) % 26;
|
|
4157
4157
|
t = String.fromCharCode(65 + e) + t, n = Math.floor((n - 1) / 26);
|
|
4158
4158
|
}
|
|
4159
4159
|
return t;
|
|
4160
|
-
},
|
|
4161
|
-
function
|
|
4160
|
+
}, Us = /^\s*=\s*TABLE\s*\(([^()]*)\)\s*$/i;
|
|
4161
|
+
function Js(e) {
|
|
4162
4162
|
const t = [];
|
|
4163
4163
|
for (const o of e.getEntireRange().getRegions(l.Feature.Formula)) {
|
|
4164
|
-
if (!
|
|
4164
|
+
if (!Us.test(o.getCell().getFormulaText() ?? "")) continue;
|
|
4165
4165
|
const r = o.getCoords();
|
|
4166
4166
|
for (let o = r.rowStart; o <= r.rowEnd; o++) for (let s = r.colStart; s <= r.colEnd; s++) {
|
|
4167
4167
|
const r = e.getRange({
|
|
@@ -4169,7 +4169,7 @@ function Us(e) {
|
|
|
4169
4169
|
colStart: s,
|
|
4170
4170
|
rowEnd: o,
|
|
4171
4171
|
colEnd: s
|
|
4172
|
-
}).getCell(), l = r.getFormulaText() ?? "", a =
|
|
4172
|
+
}).getCell(), l = r.getFormulaText() ?? "", a = Us.exec(l);
|
|
4173
4173
|
if (!a) continue;
|
|
4174
4174
|
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
4175
|
rowStart: o,
|
|
@@ -4193,17 +4193,23 @@ function Us(e) {
|
|
|
4193
4193
|
}
|
|
4194
4194
|
return t;
|
|
4195
4195
|
}
|
|
4196
|
-
var
|
|
4196
|
+
var qs = (e) => {
|
|
4197
4197
|
const t = (e) => "#REF!" === e.toUpperCase() ? "#REF! (deleted)" : e, n = [];
|
|
4198
4198
|
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 ? `${
|
|
4199
|
+
const t = e.extent.getCoords(), n = _s(t.colStart - 1), o = t.rowStart;
|
|
4200
|
+
return e.rowInput && e.columnInput ? `${n}${o}` : e.columnInput ? `${_s(t.colStart)}${o}:${_s(t.colEnd)}${o}` : `${n}${t.rowStart + 1}:${n}${t.rowEnd + 1}`;
|
|
4201
4201
|
})(e)}`), e.blocked && n.push("blocked (#SPILL!)"), `${e.formula} ${n.join(", ")}`;
|
|
4202
4202
|
};
|
|
4203
|
-
var
|
|
4204
|
-
|
|
4205
|
-
const
|
|
4206
|
-
|
|
4203
|
+
var Ks = (e) => e.isDeleted() ? "" : e.getRange().toString(), Gs = (e) => {
|
|
4204
|
+
if (0 === e.getFields().length) return "";
|
|
4205
|
+
const t = (e) => e.map((e) => e.getName()), n = [], o = (e, t, o) => {
|
|
4206
|
+
t.length > 0 && n.push(`${e}: ${t.join(o)}`);
|
|
4207
|
+
};
|
|
4208
|
+
return o("rows", t(e.getRowFields()), " > "), o("columns", t(e.getColumnFields()), " > "), o("filters", t(e.getPageFields()), ", "), o("values", t(e.getDataFields()), ", "), n.join(" · ");
|
|
4209
|
+
};
|
|
4210
|
+
async function Xs(e, t) {
|
|
4211
|
+
const n = new ie(), o = e.getSelectedRange(), r = e.getUsedRange();
|
|
4212
|
+
n.h1(`Sheet — ${At(e.getName())}${function(e) {
|
|
4207
4213
|
const t = e.getWorkbook();
|
|
4208
4214
|
let n = "";
|
|
4209
4215
|
t && t.getSelectedWorksheet()?.getId() === e.getId() && (n += " (selected)");
|
|
@@ -4211,38 +4217,44 @@ async function Ks(e, t) {
|
|
|
4211
4217
|
o === m.Visibility.Hidden ? n += " (hidden)" : o === m.Visibility.VeryHidden && (n += " (very hidden)");
|
|
4212
4218
|
e.getProtection().isLocked() && (n += " (protected)");
|
|
4213
4219
|
return n;
|
|
4214
|
-
}(e)}`), n.text(`Used: ${r ?
|
|
4215
|
-
const s =
|
|
4220
|
+
}(e)}`), n.text(`Used: ${r ? Tt(r) : "empty"}`), n.text(`Selection: ${Tt(o)}`);
|
|
4221
|
+
const s = ln(e);
|
|
4216
4222
|
s && n.text(`Outline: ${s}`);
|
|
4217
|
-
const l =
|
|
4223
|
+
const l = Ls(e);
|
|
4218
4224
|
l && n.text(`Print: ${l}`), n.blank();
|
|
4219
4225
|
const a = r ?? o;
|
|
4220
|
-
|
|
4226
|
+
Dt(n, a), Vt(n, a), Bt(n, a, {
|
|
4221
4227
|
profile: !0,
|
|
4222
4228
|
...t
|
|
4223
4229
|
});
|
|
4224
4230
|
const i = void 0 === t?.features ? null : "string" == typeof t.features ? [t.features] : [...t.features];
|
|
4225
|
-
return i && !i.some((e) => "unlock" === e || "protection" === e) ||
|
|
4231
|
+
return i && !i.some((e) => "unlock" === e || "protection" === e) || Wr(n, e), await un(n, a), function(e, t) {
|
|
4226
4232
|
if (0 === t.length) return;
|
|
4227
4233
|
const n = t.map((e) => ({
|
|
4228
|
-
address:
|
|
4229
|
-
name: e.getName()
|
|
4234
|
+
address: Ks(e),
|
|
4235
|
+
name: e.getName(),
|
|
4236
|
+
source: e.isDeleted() ? null : e.getSource(),
|
|
4237
|
+
stale: e.isStale(),
|
|
4238
|
+
fields: Gs(e)
|
|
4230
4239
|
})), o = Math.max(...n.map((e) => e.address.length));
|
|
4231
4240
|
e.h2(`Pivot Tables (${t.length})`);
|
|
4232
|
-
for (const t of n)
|
|
4233
|
-
|
|
4241
|
+
for (const t of n) {
|
|
4242
|
+
const n = t.source ? `${t.name} from ${t.source}` : t.name, r = t.stale ? " (stale: the source changed since the last refresh)" : "";
|
|
4243
|
+
e.text(o > 0 ? ` ${t.address.padEnd(o)} ${n}${r}` : ` ${n}${r}`), t.fields && e.text(` ${t.fields}`);
|
|
4244
|
+
}
|
|
4245
|
+
e.text(" Read-only — the cells hold the last refresh, not the source as it is now."), e.blank();
|
|
4234
4246
|
}(n, e.getPivotTables().getItems()), function(e, t) {
|
|
4235
4247
|
if (0 === t.length) return;
|
|
4236
4248
|
const n = t.map((e) => ({
|
|
4237
4249
|
address: e.extent.getAddress(),
|
|
4238
|
-
detail:
|
|
4250
|
+
detail: qs(e)
|
|
4239
4251
|
})), o = Math.max(...n.map((e) => e.address.length));
|
|
4240
4252
|
e.h2(`Data Tables (${t.length})`);
|
|
4241
4253
|
for (const t of n) e.text(` ${t.address.padEnd(o)} ${t.detail}`);
|
|
4242
4254
|
e.text(" What-if results: the formula cells evaluated with each axis value put into the inputs."), e.blank();
|
|
4243
|
-
}(n,
|
|
4255
|
+
}(n, Js(e)), oo(n, e.getMovables().getItems()), n.toLines().join("\n").trimEnd();
|
|
4244
4256
|
}
|
|
4245
|
-
var
|
|
4257
|
+
var Zs = 1e4, Ys = [
|
|
4246
4258
|
["numericalCount", "Numbers"],
|
|
4247
4259
|
["sum", "Sum"],
|
|
4248
4260
|
["min", "Min"],
|
|
@@ -4250,17 +4262,17 @@ var Xs = 1e4, Gs = [
|
|
|
4250
4262
|
["average", "Average"],
|
|
4251
4263
|
["stdDev", "StdDev"]
|
|
4252
4264
|
];
|
|
4253
|
-
function
|
|
4254
|
-
const n = new
|
|
4265
|
+
function Qs(t) {
|
|
4266
|
+
const n = new ie(), o = t.getCoords(), r = o ? e.rangeToString(o) : null;
|
|
4255
4267
|
n.h1(r ? `Stats — ${r}` : "Stats");
|
|
4256
4268
|
const s = t.getTypedCounts();
|
|
4257
4269
|
n.fact(`Cells: ${t.getSize()}`), n.fact(`Values: ${t.getCount()}`);
|
|
4258
4270
|
const l = s[b.Error] ?? 0;
|
|
4259
4271
|
l > 0 && n.fact(`Errors: ${l}`);
|
|
4260
4272
|
const a = function(e) {
|
|
4261
|
-
const t = e.getFrequencies({ limit:
|
|
4273
|
+
const t = e.getFrequencies({ limit: Zs }), n = t.getUniqueCount();
|
|
4262
4274
|
if (0 === n) return null;
|
|
4263
|
-
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${
|
|
4275
|
+
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${Zs.toLocaleString("en-US")})`;
|
|
4264
4276
|
if (n === t.getTotalCount()) return `${n.toLocaleString("en-US")}, no repeats`;
|
|
4265
4277
|
const o = [];
|
|
4266
4278
|
for (const [e, n] of t.getValueCounts()) {
|
|
@@ -4269,7 +4281,7 @@ function Zs(t) {
|
|
|
4269
4281
|
label: j(e)?.display ?? "",
|
|
4270
4282
|
content: n,
|
|
4271
4283
|
styled: n,
|
|
4272
|
-
blocks: r &&
|
|
4284
|
+
blocks: r && el(r) === n ? [r] : []
|
|
4273
4285
|
});
|
|
4274
4286
|
}
|
|
4275
4287
|
const r = {
|
|
@@ -4277,13 +4289,13 @@ function Zs(t) {
|
|
|
4277
4289
|
maxValues: 8,
|
|
4278
4290
|
recovery: "getStats().getFrequencies()"
|
|
4279
4291
|
};
|
|
4280
|
-
if (n <= 8) return `${n} · ${
|
|
4292
|
+
if (n <= 8) return `${n} · ${He(o, r)}`;
|
|
4281
4293
|
const s = o.filter((e) => e.content > 1);
|
|
4282
|
-
return `${n.toLocaleString("en-US")} · repeats ${
|
|
4294
|
+
return `${n.toLocaleString("en-US")} · repeats ${He(s, r)}`;
|
|
4283
4295
|
}(t);
|
|
4284
4296
|
a && n.fact(`Distinct: ${a}`);
|
|
4285
4297
|
const i = t.getAggregates({ onError: "ignore" });
|
|
4286
|
-
for (const [e, t] of
|
|
4298
|
+
for (const [e, t] of Ys) {
|
|
4287
4299
|
const o = i[e];
|
|
4288
4300
|
null != o && n.fact(`${t}: ${E(o)}`);
|
|
4289
4301
|
}
|
|
@@ -4291,49 +4303,49 @@ function Zs(t) {
|
|
|
4291
4303
|
for (const [e, t] of Object.entries(s)) e !== b.Null && t && c.push(`${e.charAt(0).toUpperCase()}${e.slice(1)}: ${t}`);
|
|
4292
4304
|
return c.length > 0 && (n.blank(), n.h2("Type"), n.fact(c)), n.toLines().join("\n").trimEnd();
|
|
4293
4305
|
}
|
|
4294
|
-
var
|
|
4295
|
-
function
|
|
4296
|
-
const t = new
|
|
4306
|
+
var el = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
|
|
4307
|
+
function tl(e) {
|
|
4308
|
+
const t = new ie();
|
|
4297
4309
|
t.h1("Style"), t.text(`Named: ${e.getNamed().getName()}`), t.blank();
|
|
4298
4310
|
const n = e.toJSON(), o = n ? Object.entries(n).filter(([, e]) => void 0 !== e) : [];
|
|
4299
4311
|
if (0 === o.length) t.fact("No direct styling (inherits the named style)");
|
|
4300
4312
|
else for (const [e, n] of o) t.fact(`${e}: ${t.codespan("string" == typeof n ? n : JSON.stringify(n))}`);
|
|
4301
4313
|
return t.toLines().join("\n").trimEnd();
|
|
4302
4314
|
}
|
|
4303
|
-
function
|
|
4304
|
-
const n = t?.maxCells ?? 1e3, o =
|
|
4315
|
+
function nl(e, t) {
|
|
4316
|
+
const n = t?.maxCells ?? 1e3, o = ol(e) ? e.getValues() : e, r = o.length, s = o.reduce((e, t) => Math.max(e, t?.length ?? 0), 0), l = new ie();
|
|
4305
4317
|
if (l.h1("Values"), l.text(`Size: ${r}×${s}`), l.blank(), 0 === r || 0 === s) return l.text("None"), l.toLines().join("\n").trimEnd();
|
|
4306
4318
|
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(""));
|
|
4307
|
-
for (const e of i) c.addRow(Array.from({ length: s }, (t, n) =>
|
|
4319
|
+
for (const e of i) c.addRow(Array.from({ length: s }, (t, n) => rl(e?.[n])));
|
|
4308
4320
|
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();
|
|
4309
4321
|
}
|
|
4310
|
-
var
|
|
4322
|
+
var ol = (e) => !!e && "object" == typeof e && !0 === e.isIRange, rl = (e) => {
|
|
4311
4323
|
if (null == e) return { text: "" };
|
|
4312
4324
|
const t = (j(e)?.display ?? "").replace(/[\r\n]+/g, " ");
|
|
4313
4325
|
return "number" == typeof e ? {
|
|
4314
4326
|
text: t,
|
|
4315
4327
|
alignment: "right"
|
|
4316
4328
|
} : { text: t };
|
|
4317
|
-
},
|
|
4318
|
-
[
|
|
4319
|
-
[
|
|
4320
|
-
[
|
|
4321
|
-
[
|
|
4322
|
-
[
|
|
4329
|
+
}, sl = l.Feature, ll = [
|
|
4330
|
+
[sl.Font, "fonts"],
|
|
4331
|
+
[sl.NumberFormat, "formats"],
|
|
4332
|
+
[sl.Fill, "fills"],
|
|
4333
|
+
[sl.Borders, "borders"],
|
|
4334
|
+
[sl.Alignment, "alignments"]
|
|
4323
4335
|
];
|
|
4324
|
-
async function
|
|
4325
|
-
const n = new
|
|
4336
|
+
async function al(e, t) {
|
|
4337
|
+
const n = new ie();
|
|
4326
4338
|
n.h1(`Workbook — ${e.getName() ?? "Untitled"}`), n.text(`Locale: ${e.getRuntime().getLocale()}`);
|
|
4327
4339
|
const o = e.getCalculation();
|
|
4328
4340
|
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");
|
|
4329
|
-
const s =
|
|
4341
|
+
const s = Mr(e.getProtection());
|
|
4330
4342
|
s && n.text(`Protection: ${s}`), n.blank();
|
|
4331
4343
|
const l = e.getWorksheets().getItems({ visibility: m.Visibility.VeryHidden }), a = e.getSelectedSheet(), i = e.getStyles().getNormal(), c = [];
|
|
4332
4344
|
for (const e of l) {
|
|
4333
|
-
const t =
|
|
4345
|
+
const t = il(e, i);
|
|
4334
4346
|
c.push({
|
|
4335
4347
|
sheet: e,
|
|
4336
|
-
label:
|
|
4348
|
+
label: ml(e, e.getId() === a.getId()),
|
|
4337
4349
|
counts: t.counts,
|
|
4338
4350
|
lines: t.lines,
|
|
4339
4351
|
formulaSignature: t.formulaSignature
|
|
@@ -4346,7 +4358,7 @@ async function sl(e, t) {
|
|
|
4346
4358
|
t ? t.push(e) : u.set(e.formulaSignature, [e]);
|
|
4347
4359
|
}
|
|
4348
4360
|
for (const e of u.values()) if (!(e.length < 2)) for (const t of e) {
|
|
4349
|
-
const n = e.filter((e) => e !== t).map((e) =>
|
|
4361
|
+
const n = e.filter((e) => e !== t).map((e) => At(e.sheet.getName()));
|
|
4350
4362
|
t.lines.push({
|
|
4351
4363
|
label: "twin of",
|
|
4352
4364
|
extent: n.join(", "),
|
|
@@ -4373,15 +4385,15 @@ async function sl(e, t) {
|
|
|
4373
4385
|
const p = e.getSheets({ visibility: m.Visibility.VeryHidden }).filter((e) => e.getKind() !== m.Kind.Worksheet);
|
|
4374
4386
|
if (p.length > 0) {
|
|
4375
4387
|
n.h2(`Other sheets (${p.length})`), n.blank();
|
|
4376
|
-
for (const e of p) n.text(` ${
|
|
4388
|
+
for (const e of p) n.text(` ${pl(e, e.getId() === a.getId())}`);
|
|
4377
4389
|
n.text(" Carried as read and saved unchanged; they have no cells · wb.getSheets() lists every tab"), n.blank();
|
|
4378
4390
|
}
|
|
4379
|
-
return
|
|
4380
|
-
describe: (e) =>
|
|
4391
|
+
return wl(n, "Errors", c, sl.Error), wl(n, "Calc Failures", c, sl.CalcError), wl(n, "Circular References", c, sl.Circular), wl(n, "Anomalies", c, sl.Anomalies, {
|
|
4392
|
+
describe: (e) => St(sl.Anomalies, null)(e) ?? "",
|
|
4381
4393
|
rank: (e) => -(e.getCell().getAnomalies()[0]?.rank ?? 0),
|
|
4382
4394
|
include: (e) => !U(e.getCell().getAnomalies()),
|
|
4383
|
-
key:
|
|
4384
|
-
}), await
|
|
4395
|
+
key: Et
|
|
4396
|
+
}), await rn(n, e.getNames().getItems({
|
|
4385
4397
|
type: "formula",
|
|
4386
4398
|
includeHidden: !0
|
|
4387
4399
|
}) ?? [], {
|
|
@@ -4389,42 +4401,42 @@ async function sl(e, t) {
|
|
|
4389
4401
|
recovery: "wb.getNames() renders the full view",
|
|
4390
4402
|
omitUnread: !0,
|
|
4391
4403
|
symbols: e.getNames().getItems({ includeHidden: !0 }) ?? []
|
|
4392
|
-
}),
|
|
4404
|
+
}), $s(n, ps(e), t), n.toLines().join("\n").trimEnd();
|
|
4393
4405
|
}
|
|
4394
|
-
function
|
|
4406
|
+
function il(e, t) {
|
|
4395
4407
|
const n = e.getUsedRange();
|
|
4396
4408
|
if (!n) return {
|
|
4397
4409
|
counts: null,
|
|
4398
4410
|
lines: [
|
|
4399
|
-
...
|
|
4400
|
-
...
|
|
4401
|
-
...
|
|
4411
|
+
...ul(e),
|
|
4412
|
+
...cl(e),
|
|
4413
|
+
...gl(e)
|
|
4402
4414
|
],
|
|
4403
4415
|
formulaRegions: 0,
|
|
4404
4416
|
formulaSignature: ""
|
|
4405
4417
|
};
|
|
4406
4418
|
const o = n.getCounts([
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
]), r = [], l =
|
|
4419
|
+
sl.Contentful,
|
|
4420
|
+
sl.Formula,
|
|
4421
|
+
sl.Error,
|
|
4422
|
+
sl.CalcError,
|
|
4423
|
+
sl.Circular,
|
|
4424
|
+
sl.Table,
|
|
4425
|
+
sl.Anomalies
|
|
4426
|
+
]), r = [], l = Jt(n), a = [...n.getRegions(sl.Formula)];
|
|
4415
4427
|
if (l.length > 0) {
|
|
4416
4428
|
const e = function(e, t) {
|
|
4417
|
-
const n =
|
|
4418
|
-
return 0 === n.length ? null : n.map(([e, t]) => `${e} ×${
|
|
4429
|
+
const n = nt(e, t);
|
|
4430
|
+
return 0 === n.length ? null : n.map(([e, t]) => `${e} ×${Oe(t)}`).join(" · ");
|
|
4419
4431
|
}(n, a);
|
|
4420
4432
|
r.push({
|
|
4421
4433
|
label: "content",
|
|
4422
|
-
extent:
|
|
4434
|
+
extent: hl(l),
|
|
4423
4435
|
detail: [
|
|
4424
|
-
|
|
4425
|
-
|
|
4436
|
+
fl(o[sl.Contentful] ?? 0, "cell"),
|
|
4437
|
+
fl(l.length, "block"),
|
|
4426
4438
|
e,
|
|
4427
|
-
`${
|
|
4439
|
+
`${Lt(n)} lists the blocks`
|
|
4428
4440
|
].filter(Boolean).join(" · ")
|
|
4429
4441
|
});
|
|
4430
4442
|
}
|
|
@@ -4437,29 +4449,29 @@ function ll(e, t) {
|
|
|
4437
4449
|
}
|
|
4438
4450
|
i = t.sort().join("\n"), r.push({
|
|
4439
4451
|
label: "formula",
|
|
4440
|
-
extent:
|
|
4452
|
+
extent: hl(a),
|
|
4441
4453
|
detail: [
|
|
4442
|
-
|
|
4443
|
-
|
|
4454
|
+
fl(o[sl.Formula] ?? 0, "cell"),
|
|
4455
|
+
fl(a.length, "region"),
|
|
4444
4456
|
`${e.size} distinct`
|
|
4445
4457
|
].join(" · ")
|
|
4446
4458
|
});
|
|
4447
4459
|
}
|
|
4448
4460
|
for (const [e, t] of [
|
|
4449
|
-
[
|
|
4450
|
-
[
|
|
4451
|
-
[
|
|
4461
|
+
[sl.Error, "errors"],
|
|
4462
|
+
[sl.CalcError, "calc failures"],
|
|
4463
|
+
[sl.Circular, "circular"]
|
|
4452
4464
|
]) {
|
|
4453
4465
|
const s = o[e] ?? 0;
|
|
4454
4466
|
if (0 === s) continue;
|
|
4455
4467
|
const l = [...n.getRegions(e)];
|
|
4456
4468
|
r.push({
|
|
4457
4469
|
label: t,
|
|
4458
|
-
extent:
|
|
4459
|
-
detail: [
|
|
4470
|
+
extent: hl(l),
|
|
4471
|
+
detail: [fl(s, "cell"), fl(l.length, "region")].join(" · ")
|
|
4460
4472
|
});
|
|
4461
4473
|
}
|
|
4462
|
-
const c = (o[
|
|
4474
|
+
const c = (o[sl.Anomalies] ?? 0) > 0 ? [...n.getRegions(sl.Anomalies)].filter((e) => !U(e.getCell().getAnomalies())) : [];
|
|
4463
4475
|
if (c.length > 0) {
|
|
4464
4476
|
const e = new Map([...P.keys()].map((e) => [e, 0]));
|
|
4465
4477
|
let t = 0;
|
|
@@ -4470,10 +4482,10 @@ function ll(e, t) {
|
|
|
4470
4482
|
}
|
|
4471
4483
|
r.push({
|
|
4472
4484
|
label: "anomalies",
|
|
4473
|
-
extent:
|
|
4485
|
+
extent: hl(c),
|
|
4474
4486
|
detail: [
|
|
4475
|
-
|
|
4476
|
-
|
|
4487
|
+
fl(t, "cell"),
|
|
4488
|
+
fl(c.length, "region"),
|
|
4477
4489
|
...[...e].filter(([, e]) => e > 0).map(([e, t]) => `${e} ${t}`)
|
|
4478
4490
|
].join(" · ")
|
|
4479
4491
|
});
|
|
@@ -4481,63 +4493,63 @@ function ll(e, t) {
|
|
|
4481
4493
|
const u = n.getTables();
|
|
4482
4494
|
u.length > 0 && r.push({
|
|
4483
4495
|
label: "tables",
|
|
4484
|
-
extent:
|
|
4496
|
+
extent: hl(u.map((e) => e.getRange())),
|
|
4485
4497
|
detail: [
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4498
|
+
fl(o[sl.Table] ?? 0, "cell"),
|
|
4499
|
+
fl(u.length, "table"),
|
|
4500
|
+
dl(u.map((e) => e.getName()))
|
|
4489
4501
|
].join(" · ")
|
|
4490
4502
|
});
|
|
4491
4503
|
const g = e.getPivotTables().getItems();
|
|
4492
4504
|
g.length > 0 && r.push({
|
|
4493
4505
|
label: "pivots",
|
|
4494
4506
|
extent: String(g.length),
|
|
4495
|
-
detail:
|
|
4507
|
+
detail: dl(g.map((e) => e.getName()))
|
|
4496
4508
|
});
|
|
4497
|
-
const d =
|
|
4509
|
+
const d = Js(e);
|
|
4498
4510
|
d.length > 0 && r.push({
|
|
4499
4511
|
label: "data tables",
|
|
4500
|
-
extent:
|
|
4501
|
-
detail:
|
|
4502
|
-
}), r.push(...
|
|
4512
|
+
extent: hl(d.map((e) => e.extent)),
|
|
4513
|
+
detail: dl(d.map((e) => e.extent.getAddress()))
|
|
4514
|
+
}), r.push(...ul(e));
|
|
4503
4515
|
const h = l.map((e) => e.getCoords()), f = [];
|
|
4504
|
-
for (const [n, o] of
|
|
4505
|
-
const r =
|
|
4516
|
+
for (const [n, o] of ll) {
|
|
4517
|
+
const r = et(e, n, t, { content: h })?.distinct ?? 0;
|
|
4506
4518
|
r > 0 && f.push(`${o} ${r}`);
|
|
4507
4519
|
}
|
|
4508
4520
|
return f.length > 0 && r.push({
|
|
4509
4521
|
label: "style",
|
|
4510
4522
|
extent: n.toString(),
|
|
4511
4523
|
detail: f.join(" · ")
|
|
4512
|
-
}), r.push(...
|
|
4524
|
+
}), r.push(...cl(e)), r.push(...gl(e)), {
|
|
4513
4525
|
counts: o,
|
|
4514
4526
|
lines: r,
|
|
4515
4527
|
formulaRegions: a.length,
|
|
4516
4528
|
formulaSignature: i
|
|
4517
4529
|
};
|
|
4518
4530
|
}
|
|
4519
|
-
function
|
|
4520
|
-
const t =
|
|
4531
|
+
function cl(e) {
|
|
4532
|
+
const t = ln(e);
|
|
4521
4533
|
return t ? [{
|
|
4522
4534
|
label: "outline",
|
|
4523
4535
|
extent: "",
|
|
4524
4536
|
detail: t
|
|
4525
4537
|
}] : [];
|
|
4526
4538
|
}
|
|
4527
|
-
function
|
|
4539
|
+
function ul(e) {
|
|
4528
4540
|
const t = [];
|
|
4529
|
-
for (const [n, o] of
|
|
4530
|
-
const r = Xn(o), s = "chart" === n ?
|
|
4541
|
+
for (const [n, o] of no(e.getMovables().getItems())) {
|
|
4542
|
+
const r = Xn(o), s = "chart" === n ? dl(o.map(Yn)) : r.length > 0 ? `${r.length} with text` : "";
|
|
4531
4543
|
t.push({
|
|
4532
|
-
label:
|
|
4544
|
+
label: to(n).toLowerCase(),
|
|
4533
4545
|
extent: String(o.length),
|
|
4534
4546
|
detail: s
|
|
4535
4547
|
});
|
|
4536
4548
|
const l = r.slice(0, L(r.length, 5));
|
|
4537
4549
|
for (const e of l) t.push({
|
|
4538
4550
|
label: "",
|
|
4539
|
-
extent:
|
|
4540
|
-
detail:
|
|
4551
|
+
extent: qn(e.movable),
|
|
4552
|
+
detail: Kn(e) + (e.movable.isHidden() ? " (hidden)" : "")
|
|
4541
4553
|
});
|
|
4542
4554
|
l.length < r.length && t.push({
|
|
4543
4555
|
label: "",
|
|
@@ -4547,15 +4559,15 @@ function il(e) {
|
|
|
4547
4559
|
}
|
|
4548
4560
|
return t;
|
|
4549
4561
|
}
|
|
4550
|
-
function
|
|
4551
|
-
const t =
|
|
4562
|
+
function gl(e) {
|
|
4563
|
+
const t = Lr(e);
|
|
4552
4564
|
return t ? [{
|
|
4553
4565
|
label: "protected",
|
|
4554
4566
|
extent: t.extent,
|
|
4555
4567
|
detail: t.detail
|
|
4556
4568
|
}] : [];
|
|
4557
4569
|
}
|
|
4558
|
-
function
|
|
4570
|
+
function dl(e) {
|
|
4559
4571
|
const t = [];
|
|
4560
4572
|
let n = 0;
|
|
4561
4573
|
for (const o of e) {
|
|
@@ -4566,7 +4578,7 @@ function ul(e) {
|
|
|
4566
4578
|
const o = e.length - t.length;
|
|
4567
4579
|
return o > 0 ? `${t.join(", ")}, +${o} more` : t.join(", ");
|
|
4568
4580
|
}
|
|
4569
|
-
function
|
|
4581
|
+
function hl(t) {
|
|
4570
4582
|
let n = null;
|
|
4571
4583
|
for (const e of t) {
|
|
4572
4584
|
const t = e.getCoords();
|
|
@@ -4579,32 +4591,32 @@ function gl(t) {
|
|
|
4579
4591
|
}
|
|
4580
4592
|
return n ? e.rangeToString(n) ?? "" : "";
|
|
4581
4593
|
}
|
|
4582
|
-
var
|
|
4583
|
-
function
|
|
4594
|
+
var fl = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`;
|
|
4595
|
+
function ml(e, t) {
|
|
4584
4596
|
const n = e.getVisibility();
|
|
4585
4597
|
let o = "";
|
|
4586
|
-
return t && (o += " (selected)"), n === m.Visibility.Hidden ? o += " (hidden)" : n === m.Visibility.VeryHidden && (o += " (very hidden)"), e.getProtection().isLocked() && (o += " (protected)"), `${
|
|
4598
|
+
return t && (o += " (selected)"), n === m.Visibility.Hidden ? o += " (hidden)" : n === m.Visibility.VeryHidden && (o += " (very hidden)"), e.getProtection().isLocked() && (o += " (protected)"), `${At(e.getName())}${o}`;
|
|
4587
4599
|
}
|
|
4588
|
-
function
|
|
4600
|
+
function pl(e, t) {
|
|
4589
4601
|
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();
|
|
4590
4602
|
let s = ` (${o})`;
|
|
4591
|
-
return t && (s += " (selected)"), r === m.Visibility.Hidden ? s += " (hidden)" : r === m.Visibility.VeryHidden && (s += " (very hidden)"), `${
|
|
4603
|
+
return t && (s += " (selected)"), r === m.Visibility.Hidden ? s += " (hidden)" : r === m.Visibility.VeryHidden && (s += " (very hidden)"), `${At(e.getName())}${s}`;
|
|
4592
4604
|
}
|
|
4593
|
-
var
|
|
4594
|
-
function
|
|
4605
|
+
var $l = 6;
|
|
4606
|
+
function wl(t, n, o, r, s) {
|
|
4595
4607
|
const l = s?.include;
|
|
4596
4608
|
let a = o.reduce((e, t) => e + (t.counts?.[r] ?? 0), 0);
|
|
4597
|
-
const i = r ===
|
|
4609
|
+
const i = r === sl.Error ? o.flatMap((e) => function(e) {
|
|
4598
4610
|
const t = [];
|
|
4599
4611
|
for (const n of e.getMovables().getItems({ type: "chart" })) {
|
|
4600
|
-
const e =
|
|
4612
|
+
const e = dn(n);
|
|
4601
4613
|
if (e) for (const o of e.getSeries()) {
|
|
4602
|
-
const e =
|
|
4614
|
+
const e = wn(o);
|
|
4603
4615
|
if (0 === e.length) continue;
|
|
4604
4616
|
const r = o.getName();
|
|
4605
4617
|
t.push({
|
|
4606
4618
|
movable: n,
|
|
4607
|
-
detail: `series ${r ? `"${
|
|
4619
|
+
detail: `series ${r ? `"${mn(r)}"` : "(unnamed)"} ${e.join(" · ")}`
|
|
4608
4620
|
});
|
|
4609
4621
|
}
|
|
4610
4622
|
}
|
|
@@ -4614,12 +4626,12 @@ function pl(t, n, o, r, s) {
|
|
|
4614
4626
|
l && (a = 0);
|
|
4615
4627
|
const c = [];
|
|
4616
4628
|
let u = 0;
|
|
4617
|
-
const g = s?.describe ??
|
|
4629
|
+
const g = s?.describe ?? yl, d = s?.rank, h = [];
|
|
4618
4630
|
for (const e of o) {
|
|
4619
4631
|
if (!e.counts?.[r]) continue;
|
|
4620
4632
|
const t = e.sheet.getUsedRange();
|
|
4621
4633
|
if (!t) continue;
|
|
4622
|
-
const n =
|
|
4634
|
+
const n = At(e.sheet.getName());
|
|
4623
4635
|
for (const e of t.getRegions(r)) {
|
|
4624
4636
|
if (l) {
|
|
4625
4637
|
if (!l(e)) continue;
|
|
@@ -4648,7 +4660,7 @@ function pl(t, n, o, r, s) {
|
|
|
4648
4660
|
for (const t of e.slice(0, 20)) {
|
|
4649
4661
|
const { region: e, sheetName: n } = t[0], o = t.slice(1);
|
|
4650
4662
|
f += o.length;
|
|
4651
|
-
const r = 0 === o.length ? "" : ` · also at ${o.slice(0,
|
|
4663
|
+
const r = 0 === o.length ? "" : ` · also at ${o.slice(0, $l).map((e) => `${e.sheetName}!${e.region.toString()}`).join(", ")}${o.length > $l ? ` +${o.length - $l} more` : ""}`;
|
|
4652
4664
|
c.push({
|
|
4653
4665
|
address: `${n}!${e.toString()}`,
|
|
4654
4666
|
size: `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
@@ -4660,7 +4672,7 @@ function pl(t, n, o, r, s) {
|
|
|
4660
4672
|
for (const { movable: t, detail: n } of m) {
|
|
4661
4673
|
const o = t.getRange();
|
|
4662
4674
|
c.push({
|
|
4663
|
-
address: `${
|
|
4675
|
+
address: `${At(o.getWorksheet().getName())}!${e.rangeToString(o.getCoords()) ?? ""}`,
|
|
4664
4676
|
size: "chart",
|
|
4665
4677
|
payload: `${t.getContent().getName?.() || "(unnamed)"} · ${n}`
|
|
4666
4678
|
});
|
|
@@ -4673,22 +4685,22 @@ function pl(t, n, o, r, s) {
|
|
|
4673
4685
|
const y = c.length - m.length + f;
|
|
4674
4686
|
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();
|
|
4675
4687
|
}
|
|
4676
|
-
function
|
|
4688
|
+
function yl(e) {
|
|
4677
4689
|
const t = e.getCell(), n = N(t, v.Mode.Display)?.display ?? "", o = t.getFormulaText();
|
|
4678
4690
|
if (!o) return n;
|
|
4679
|
-
const r = xr(
|
|
4691
|
+
const r = kr(xr(t.getFormula()?.getTokens() ?? [], t.getWorksheet().getWorkbook()));
|
|
4680
4692
|
return [`${n} ${o}`.trim(), r].filter(Boolean).join(" · ");
|
|
4681
4693
|
}
|
|
4682
|
-
var
|
|
4694
|
+
var bl = (e, t) => !!e && "object" == typeof e && !0 === e[t], Sl = {
|
|
4683
4695
|
kind: "protectedRanges",
|
|
4684
|
-
is: (e) =>
|
|
4696
|
+
is: (e) => bl(e, "isIProtectedRangeCollection"),
|
|
4685
4697
|
render: (e) => {
|
|
4686
4698
|
const t = e.getItems();
|
|
4687
|
-
return 0 === t.length ? "# Unlocked Ranges (0)\nNone" : t.slice(0,
|
|
4699
|
+
return 0 === t.length ? "# Unlocked Ranges (0)\nNone" : t.slice(0, Cl).map(Vr).concat(t.length > Cl ? [`…and ${t.length - Cl} more · render one at a time to see them`] : []).join("\n\n");
|
|
4688
4700
|
}
|
|
4689
|
-
},
|
|
4690
|
-
function
|
|
4691
|
-
const t =
|
|
4701
|
+
}, xl = 2;
|
|
4702
|
+
function kl(e) {
|
|
4703
|
+
const t = Nl(e);
|
|
4692
4704
|
if (!t) return null;
|
|
4693
4705
|
let n;
|
|
4694
4706
|
try {
|
|
@@ -4700,175 +4712,175 @@ function Sl(e) {
|
|
|
4700
4712
|
const o = n.split("\n").map((e) => e.trim()).filter(Boolean);
|
|
4701
4713
|
if (0 === o.length) return null;
|
|
4702
4714
|
const r = o[0].replace(/^#+\s*/, ""), s = o.slice(1);
|
|
4703
|
-
return s.length <=
|
|
4715
|
+
return s.length <= xl ? [r, ...s].join(" · ") : `${r} · ${s.length} more lines — return it on its own`;
|
|
4704
4716
|
}
|
|
4705
|
-
var
|
|
4717
|
+
var Cl = 20, vl = [
|
|
4706
4718
|
{
|
|
4707
4719
|
kind: "workbook",
|
|
4708
|
-
is: (e) =>
|
|
4709
|
-
render: (e, t) =>
|
|
4720
|
+
is: (e) => bl(e, "isIWorkbook"),
|
|
4721
|
+
render: (e, t) => al(e, t)
|
|
4710
4722
|
},
|
|
4711
4723
|
{
|
|
4712
4724
|
kind: "sheet",
|
|
4713
|
-
is: (e) =>
|
|
4714
|
-
render: (e, t) =>
|
|
4725
|
+
is: (e) => bl(e, "isIWorksheet"),
|
|
4726
|
+
render: (e, t) => Xs(e, t)
|
|
4715
4727
|
},
|
|
4716
4728
|
{
|
|
4717
4729
|
kind: "cell",
|
|
4718
|
-
is: (e) =>
|
|
4719
|
-
render: (e, t) =>
|
|
4730
|
+
is: (e) => bl(e, "isICell"),
|
|
4731
|
+
render: (e, t) => zr(e, t)
|
|
4720
4732
|
},
|
|
4721
4733
|
{
|
|
4722
4734
|
kind: "names",
|
|
4723
|
-
is: (e) =>
|
|
4724
|
-
render: (e, t) =>
|
|
4735
|
+
is: (e) => bl(e, "isINamedCollection"),
|
|
4736
|
+
render: (e, t) => xs(e, t)
|
|
4725
4737
|
},
|
|
4726
4738
|
{
|
|
4727
4739
|
kind: "modules",
|
|
4728
|
-
is: (e) =>
|
|
4729
|
-
render: (e, t) =>
|
|
4740
|
+
is: (e) => bl(e, "isIModuleCollection"),
|
|
4741
|
+
render: (e, t) => bs(e, t)
|
|
4730
4742
|
},
|
|
4731
4743
|
{
|
|
4732
4744
|
kind: "module",
|
|
4733
|
-
is: (e) =>
|
|
4734
|
-
render: (e, t) =>
|
|
4745
|
+
is: (e) => bl(e, "isIModule"),
|
|
4746
|
+
render: (e, t) => ys(e, t)
|
|
4735
4747
|
},
|
|
4736
4748
|
{
|
|
4737
4749
|
kind: "formula",
|
|
4738
|
-
is: (e) =>
|
|
4739
|
-
render: (e, t) =>
|
|
4750
|
+
is: (e) => bl(e, "isIFormula"),
|
|
4751
|
+
render: (e, t) => us(e, t)
|
|
4740
4752
|
},
|
|
4741
4753
|
{
|
|
4742
4754
|
kind: "table",
|
|
4743
|
-
is: (e) =>
|
|
4744
|
-
render: (e) =>
|
|
4755
|
+
is: (e) => bl(e, "isITable"),
|
|
4756
|
+
render: (e) => fe(e)
|
|
4745
4757
|
},
|
|
4746
4758
|
{
|
|
4747
4759
|
kind: "movable",
|
|
4748
|
-
is: (e) =>
|
|
4749
|
-
render: (e) =>
|
|
4760
|
+
is: (e) => bl(e, "isIMovable"),
|
|
4761
|
+
render: (e) => so(e)
|
|
4750
4762
|
},
|
|
4751
4763
|
{
|
|
4752
4764
|
kind: "shape",
|
|
4753
|
-
is: (e) =>
|
|
4754
|
-
render: (e) =>
|
|
4765
|
+
is: (e) => bl(e, "isIShape"),
|
|
4766
|
+
render: (e) => lo(e)
|
|
4755
4767
|
},
|
|
4756
4768
|
{
|
|
4757
4769
|
kind: "conditionalFormat",
|
|
4758
|
-
is: (e) =>
|
|
4759
|
-
render: (e) =>
|
|
4770
|
+
is: (e) => bl(e, "isIConditionalFormat"),
|
|
4771
|
+
render: (e) => Yr(e)
|
|
4760
4772
|
},
|
|
4761
4773
|
{
|
|
4762
4774
|
kind: "dataValidation",
|
|
4763
|
-
is: (e) =>
|
|
4764
|
-
render: (e) =>
|
|
4775
|
+
is: (e) => bl(e, "isIDataValidation"),
|
|
4776
|
+
render: (e) => es(e)
|
|
4765
4777
|
},
|
|
4766
4778
|
{
|
|
4767
4779
|
kind: "protection",
|
|
4768
|
-
is: (e) =>
|
|
4769
|
-
render: (e) =>
|
|
4780
|
+
is: (e) => bl(e, "isIWorksheetProtection") || bl(e, "isIWorkbookProtection"),
|
|
4781
|
+
render: (e) => Hr(e)
|
|
4770
4782
|
},
|
|
4771
|
-
|
|
4783
|
+
Sl,
|
|
4772
4784
|
{
|
|
4773
4785
|
kind: "protectedRange",
|
|
4774
|
-
is: (e) =>
|
|
4775
|
-
render: (e) =>
|
|
4786
|
+
is: (e) => bl(e, "isIProtectedRange"),
|
|
4787
|
+
render: (e) => Vr(e)
|
|
4776
4788
|
},
|
|
4777
4789
|
{
|
|
4778
4790
|
kind: "pageLayout",
|
|
4779
|
-
is: (e) =>
|
|
4780
|
-
render: (e) =>
|
|
4791
|
+
is: (e) => bl(e, "isIPageLayout"),
|
|
4792
|
+
render: (e) => Ws(e)
|
|
4781
4793
|
},
|
|
4782
4794
|
{
|
|
4783
4795
|
kind: "stats",
|
|
4784
|
-
is: (e) =>
|
|
4785
|
-
render: (e) =>
|
|
4796
|
+
is: (e) => bl(e, "isIRangeStats"),
|
|
4797
|
+
render: (e) => Qs(e)
|
|
4786
4798
|
},
|
|
4787
4799
|
{
|
|
4788
4800
|
kind: "counts",
|
|
4789
|
-
is: (e) =>
|
|
4790
|
-
render: (e) =>
|
|
4801
|
+
is: (e) => bl(e, "isICellRangeCounts"),
|
|
4802
|
+
render: (e) => Qr(e)
|
|
4791
4803
|
},
|
|
4792
4804
|
{
|
|
4793
4805
|
kind: "style",
|
|
4794
|
-
is: (e) =>
|
|
4795
|
-
render: (e) =>
|
|
4806
|
+
is: (e) => bl(e, "isICellStyle"),
|
|
4807
|
+
render: (e) => tl(e)
|
|
4796
4808
|
},
|
|
4797
4809
|
{
|
|
4798
4810
|
kind: "regions",
|
|
4799
|
-
is: (e) =>
|
|
4800
|
-
render: (e, t) =>
|
|
4811
|
+
is: (e) => bl(e, "isICellRegions"),
|
|
4812
|
+
render: (e, t) => Rt(e, t)
|
|
4801
4813
|
},
|
|
4802
4814
|
{
|
|
4803
4815
|
kind: "cellRange",
|
|
4804
|
-
is: (e) =>
|
|
4805
|
-
render: (e, t) =>
|
|
4816
|
+
is: (e) => bl(e, "isICellRange"),
|
|
4817
|
+
render: (e, t) => Kr(e, t)
|
|
4806
4818
|
},
|
|
4807
4819
|
{
|
|
4808
4820
|
kind: "ranges",
|
|
4809
|
-
is: (e) =>
|
|
4810
|
-
render: (e, t) =>
|
|
4821
|
+
is: (e) => bl(e, "isICellRanges"),
|
|
4822
|
+
render: (e, t) => zs(e, t)
|
|
4811
4823
|
},
|
|
4812
4824
|
{
|
|
4813
4825
|
kind: "range",
|
|
4814
|
-
is: (e) =>
|
|
4815
|
-
render: (e, t) =>
|
|
4826
|
+
is: (e) => bl(e, "isIRange"),
|
|
4827
|
+
render: (e, t) => nl(e, t)
|
|
4816
4828
|
},
|
|
4817
4829
|
{
|
|
4818
4830
|
kind: "values",
|
|
4819
4831
|
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Array.isArray(e)),
|
|
4820
|
-
render: (e, t) =>
|
|
4832
|
+
render: (e, t) => nl(e, t)
|
|
4821
4833
|
},
|
|
4822
4834
|
{
|
|
4823
4835
|
kind: "records",
|
|
4824
|
-
is: (e) => Array.isArray(e) && e.length > 0 && e.every(
|
|
4825
|
-
render: (e, t) =>
|
|
4836
|
+
is: (e) => Array.isArray(e) && e.length > 0 && e.every(Os),
|
|
4837
|
+
render: (e, t) => Ps(e, {
|
|
4826
4838
|
...t,
|
|
4827
|
-
nested:
|
|
4839
|
+
nested: kl
|
|
4828
4840
|
})
|
|
4829
4841
|
},
|
|
4830
4842
|
{
|
|
4831
4843
|
kind: "record",
|
|
4832
|
-
is: (e) =>
|
|
4833
|
-
render: (e, t) =>
|
|
4844
|
+
is: (e) => Os(e),
|
|
4845
|
+
render: (e, t) => Ps(e, {
|
|
4834
4846
|
...t,
|
|
4835
|
-
nested:
|
|
4847
|
+
nested: kl
|
|
4836
4848
|
})
|
|
4837
4849
|
},
|
|
4838
4850
|
{
|
|
4839
4851
|
kind: "items",
|
|
4840
|
-
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!
|
|
4852
|
+
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!Nl(e)),
|
|
4841
4853
|
render: async (e, t) => {
|
|
4842
|
-
const n = e.length >
|
|
4843
|
-
for (const e of n) o.push(await
|
|
4854
|
+
const n = e.length > Cl ? e.slice(0, Cl) : e, o = [];
|
|
4855
|
+
for (const e of n) o.push(await Nl(e).render(e, t));
|
|
4844
4856
|
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");
|
|
4845
4857
|
}
|
|
4846
4858
|
}
|
|
4847
|
-
],
|
|
4859
|
+
], El = vl.map((e) => e.kind), Rl = class extends Error {
|
|
4848
4860
|
constructor(e) {
|
|
4849
4861
|
super(e), this.name = "NoRendererError";
|
|
4850
4862
|
}
|
|
4851
4863
|
};
|
|
4852
|
-
function
|
|
4853
|
-
for (const t of
|
|
4864
|
+
function Nl(e) {
|
|
4865
|
+
for (const t of vl) if (t.is(e)) return t;
|
|
4854
4866
|
return null;
|
|
4855
4867
|
}
|
|
4856
|
-
async function
|
|
4868
|
+
async function jl(e, t, n) {
|
|
4857
4869
|
await e?.getCalculation().ready();
|
|
4858
|
-
let o =
|
|
4870
|
+
let o = Nl(t), r = t;
|
|
4859
4871
|
if (!o && r && "object" == typeof r && !Array.isArray(r) && "function" == typeof r[Symbol.iterator]) {
|
|
4860
4872
|
const e = [];
|
|
4861
4873
|
for (const t of r) if (e.push(t), e.length >= 1e3) break;
|
|
4862
|
-
r = e, o =
|
|
4874
|
+
r = e, o = Nl(r);
|
|
4863
4875
|
}
|
|
4864
|
-
if (!o) throw new
|
|
4876
|
+
if (!o) throw new Rl(`No markdown renderer for this value. Renderable kinds: ${El.join(", ")}.`);
|
|
4865
4877
|
const s = e?.getCalculation() ?? null;
|
|
4866
4878
|
let l = await o.render(r, n);
|
|
4867
|
-
for (let e = 0; e <
|
|
4879
|
+
for (let e = 0; e < Ml && "calculating" === s?.getCalculationState(); e++) await s.ready(), l = await o.render(r, n);
|
|
4868
4880
|
return l;
|
|
4869
4881
|
}
|
|
4870
|
-
var
|
|
4871
|
-
async function
|
|
4882
|
+
var Ml = 2;
|
|
4883
|
+
async function Fl(e, t, n) {
|
|
4872
4884
|
if (void 0 === t) return {
|
|
4873
4885
|
text: void 0,
|
|
4874
4886
|
rendered: !0
|
|
@@ -4879,11 +4891,11 @@ async function jl(e, t, n) {
|
|
|
4879
4891
|
};
|
|
4880
4892
|
if (null !== t && "object" == typeof t) try {
|
|
4881
4893
|
return {
|
|
4882
|
-
text: await
|
|
4894
|
+
text: await jl(e, t, n),
|
|
4883
4895
|
rendered: !0
|
|
4884
4896
|
};
|
|
4885
4897
|
} catch (e) {
|
|
4886
|
-
if (!(e instanceof
|
|
4898
|
+
if (!(e instanceof Rl)) throw e;
|
|
4887
4899
|
}
|
|
4888
4900
|
return function(e) {
|
|
4889
4901
|
if (null === e) return {
|
|
@@ -4923,8 +4935,8 @@ async function jl(e, t, n) {
|
|
|
4923
4935
|
};
|
|
4924
4936
|
}(t);
|
|
4925
4937
|
}
|
|
4926
|
-
var
|
|
4927
|
-
async function
|
|
4938
|
+
var Il = l.Feature;
|
|
4939
|
+
async function Tl(e, t, n) {
|
|
4928
4940
|
const o = e.getChanges(t);
|
|
4929
4941
|
if (0 === o.length) return null;
|
|
4930
4942
|
const r = n?.maxEntries ?? 20, s = n?.maxBlockValues ?? 8, l = /* @__PURE__ */ new Map();
|
|
@@ -4938,9 +4950,9 @@ async function Il(e, t, n) {
|
|
|
4938
4950
|
const a = [], i = [];
|
|
4939
4951
|
let c = 0;
|
|
4940
4952
|
for (const [e, { data: t, style: n }] of l) {
|
|
4941
|
-
const o = t ?
|
|
4953
|
+
const o = t ? Ll(t) : null;
|
|
4942
4954
|
o && i.push(o);
|
|
4943
|
-
const l =
|
|
4955
|
+
const l = Al(e, t ?? null, o, n ?? null, r, s);
|
|
4944
4956
|
a.push(l.sheet), c += l.cleared;
|
|
4945
4957
|
}
|
|
4946
4958
|
const u = await async function(e) {
|
|
@@ -4952,15 +4964,15 @@ async function Il(e, t, n) {
|
|
|
4952
4964
|
if (0 === t.length) return null;
|
|
4953
4965
|
if (1 === t.length) return t[0];
|
|
4954
4966
|
const n = [];
|
|
4955
|
-
for (const e of t)
|
|
4967
|
+
for (const e of t) Pl(e, n, !0);
|
|
4956
4968
|
return t[0].getWorksheet().getRanges(n);
|
|
4957
4969
|
}(i), g = [];
|
|
4958
|
-
for (const e of i)
|
|
4959
|
-
u &&
|
|
4970
|
+
for (const e of i) Pl(e, g);
|
|
4971
|
+
u && Pl(u, g);
|
|
4960
4972
|
const d = function(e) {
|
|
4961
4973
|
const t = /* @__PURE__ */ new Set(), n = [];
|
|
4962
|
-
for (const o of e) if (0 !== (o.getCounts([
|
|
4963
|
-
const r =
|
|
4974
|
+
for (const o of e) if (0 !== (o.getCounts([Il.Error])[Il.Error] ?? 0)) for (const e of o.getRegions(Il.Error)) {
|
|
4975
|
+
const r = Ot(o.getWorksheet().getRanges(e.getAddress()));
|
|
4964
4976
|
t.has(r) || (t.add(r), n.push({
|
|
4965
4977
|
address: r,
|
|
4966
4978
|
error: N(e.getCell(), v.Mode.Display)?.display ?? "",
|
|
@@ -4972,17 +4984,17 @@ async function Il(e, t, n) {
|
|
|
4972
4984
|
return {
|
|
4973
4985
|
commitId: o[0].getCommit().getId(),
|
|
4974
4986
|
sheets: a,
|
|
4975
|
-
dependents: u ?
|
|
4987
|
+
dependents: u ? Dl(u, r) : null,
|
|
4976
4988
|
errors: d.slice(0, h),
|
|
4977
4989
|
errorsMore: d.length - h,
|
|
4978
4990
|
errorsCleared: c,
|
|
4979
|
-
touches:
|
|
4991
|
+
touches: Hl(i, u)
|
|
4980
4992
|
};
|
|
4981
4993
|
}
|
|
4982
|
-
function
|
|
4994
|
+
function Al(e, t, n, o, r, s) {
|
|
4983
4995
|
const l = o?.getRanges() ?? null, a = {
|
|
4984
|
-
sheet:
|
|
4985
|
-
written: n ?
|
|
4996
|
+
sheet: At(e.getName()),
|
|
4997
|
+
written: n ? Ot(n) : null,
|
|
4986
4998
|
cells: 0,
|
|
4987
4999
|
formulas: 0,
|
|
4988
5000
|
values: 0,
|
|
@@ -4999,11 +5011,11 @@ function Fl(e, t, n, o, r, s) {
|
|
|
4999
5011
|
return {
|
|
5000
5012
|
kind: t.getKind(),
|
|
5001
5013
|
axis: r,
|
|
5002
|
-
address: l.length > 0 ?
|
|
5014
|
+
address: l.length > 0 ? Ot(e.getRanges(l)) : null,
|
|
5003
5015
|
whole: s
|
|
5004
5016
|
};
|
|
5005
5017
|
}(e, t)) : [],
|
|
5006
|
-
styles: l ?
|
|
5018
|
+
styles: l ? Ot(l) : null,
|
|
5007
5019
|
blocks: [],
|
|
5008
5020
|
blocksMore: 0
|
|
5009
5021
|
};
|
|
@@ -5011,42 +5023,42 @@ function Fl(e, t, n, o, r, s) {
|
|
|
5011
5023
|
sheet: a,
|
|
5012
5024
|
cleared: 0
|
|
5013
5025
|
};
|
|
5014
|
-
const i = n.getCounts([
|
|
5026
|
+
const i = n.getCounts([Il.Contentful, Il.Formula]);
|
|
5015
5027
|
let c = 0;
|
|
5016
5028
|
for (let e = 0; e < n.length; e++) {
|
|
5017
5029
|
const t = n.at(e);
|
|
5018
5030
|
c += t.getRowCount() * t.getColumnCount();
|
|
5019
5031
|
}
|
|
5020
|
-
a.cells = c, a.formulas = i[
|
|
5032
|
+
a.cells = c, a.formulas = i[Il.Formula] ?? 0, a.values = (i[Il.Contentful] ?? 0) - a.formulas, a.cleared = c - (i[Il.Contentful] ?? 0);
|
|
5021
5033
|
let u = 0;
|
|
5022
5034
|
const g = t.getPreviousRanges();
|
|
5023
5035
|
if (g) {
|
|
5024
|
-
const t = g.getCounts([
|
|
5036
|
+
const t = g.getCounts([Il.Contentful, Il.Formula]);
|
|
5025
5037
|
a.replaced = {
|
|
5026
|
-
populated: t[
|
|
5027
|
-
formulas: t[
|
|
5038
|
+
populated: t[Il.Contentful] ?? 0,
|
|
5039
|
+
formulas: t[Il.Formula] ?? 0
|
|
5028
5040
|
}, u = function(e, t) {
|
|
5029
5041
|
let n = 0;
|
|
5030
|
-
for (let o = 0; o < e.length; o++) for (const r of e.at(o).getRegions(
|
|
5042
|
+
for (let o = 0; o < e.length; o++) for (const r of e.at(o).getRegions(Il.Error)) {
|
|
5031
5043
|
const e = t.getRange(r.getCoords());
|
|
5032
|
-
n += r.getRowCount() * r.getColumnCount() - (e.getCounts([
|
|
5044
|
+
n += r.getRowCount() * r.getColumnCount() - (e.getCounts([Il.Error])[Il.Error] ?? 0);
|
|
5033
5045
|
}
|
|
5034
5046
|
return n;
|
|
5035
5047
|
}(g, e);
|
|
5036
5048
|
}
|
|
5037
5049
|
const d = [];
|
|
5038
5050
|
let h = 0;
|
|
5039
|
-
for (let e = 0; e < n.length; e++) for (const t of n.at(e).getRegions(
|
|
5051
|
+
for (let e = 0; e < n.length; e++) for (const t of n.at(e).getRegions(Il.Formula)) h++, d.length < r && d.push(Ol(t.getRange(), s));
|
|
5040
5052
|
if (h > d.length && h <= L(h, r)) {
|
|
5041
5053
|
d.length = 0;
|
|
5042
|
-
for (let e = 0; e < n.length; e++) for (const t of n.at(e).getRegions(
|
|
5054
|
+
for (let e = 0; e < n.length; e++) for (const t of n.at(e).getRegions(Il.Formula)) d.push(Ol(t.getRange(), s));
|
|
5043
5055
|
}
|
|
5044
5056
|
return a.blocks = d, a.blocksMore = h - d.length, {
|
|
5045
5057
|
sheet: a,
|
|
5046
5058
|
cleared: u
|
|
5047
5059
|
};
|
|
5048
5060
|
}
|
|
5049
|
-
function
|
|
5061
|
+
function Ll(e) {
|
|
5050
5062
|
const t = e.getRanges(), n = e.getShifts();
|
|
5051
5063
|
if (!t || 0 === n.length) return t;
|
|
5052
5064
|
const o = e.getSheet(), r = [], s = [];
|
|
@@ -5060,40 +5072,40 @@ function Tl(e) {
|
|
|
5060
5072
|
const l = [];
|
|
5061
5073
|
for (let e = 0; e < t.length; e++) {
|
|
5062
5074
|
const n = t.at(e);
|
|
5063
|
-
r.some((e) =>
|
|
5075
|
+
r.some((e) => Wl(e, n.getCoords())) || l.push(n);
|
|
5064
5076
|
}
|
|
5065
|
-
for (const e of s) for (const t of o.getRange(e).getRegions(
|
|
5077
|
+
for (const e of s) for (const t of o.getRange(e).getRegions(Il.Contentful)) l.push(t.getRange());
|
|
5066
5078
|
return l.length > 0 ? o.getRanges(l) : null;
|
|
5067
5079
|
}
|
|
5068
|
-
var
|
|
5069
|
-
function
|
|
5080
|
+
var Wl = (e, t) => t.rowStart >= e.rowStart && t.rowEnd <= e.rowEnd && t.colStart >= e.colStart && t.colEnd <= e.colEnd;
|
|
5081
|
+
function Ol(e, t) {
|
|
5070
5082
|
const n = e.getRowCount() * e.getColumnCount(), o = n > t, r = [];
|
|
5071
5083
|
let s = null;
|
|
5072
5084
|
return e.forEach((e, t) => {
|
|
5073
5085
|
const n = N(t.getCell(), v.Mode.Display)?.display ?? "";
|
|
5074
5086
|
!o || r.length < 3 ? r.push(n) : s = n;
|
|
5075
5087
|
}), o && null !== s && r.push(s), {
|
|
5076
|
-
address:
|
|
5088
|
+
address: Ot(e.getWorksheet().getRanges(e.getAddress())),
|
|
5077
5089
|
formula: e.getCell().getFormulaText() ?? "",
|
|
5078
5090
|
cells: n,
|
|
5079
5091
|
values: r,
|
|
5080
5092
|
sampled: o
|
|
5081
5093
|
};
|
|
5082
5094
|
}
|
|
5083
|
-
function
|
|
5095
|
+
function Pl(e, t, n = !1) {
|
|
5084
5096
|
for (let o = 0; o < e.length; o++) {
|
|
5085
5097
|
const r = e.at(o);
|
|
5086
5098
|
!n && r.isINamedRange || t.push(r);
|
|
5087
5099
|
}
|
|
5088
5100
|
}
|
|
5089
|
-
function
|
|
5101
|
+
function Dl(e, t) {
|
|
5090
5102
|
const n = /* @__PURE__ */ new Map(), o = [];
|
|
5091
|
-
|
|
5103
|
+
Pl(e, o);
|
|
5092
5104
|
let r = 0;
|
|
5093
5105
|
for (const e of o) {
|
|
5094
|
-
const t = e.getCounts([
|
|
5106
|
+
const t = e.getCounts([Il.Contentful])[Il.Contentful] ?? 0;
|
|
5095
5107
|
r += t;
|
|
5096
|
-
const o =
|
|
5108
|
+
const o = At(e.getWorksheet().getName());
|
|
5097
5109
|
n.set(o, (n.get(o) ?? 0) + t);
|
|
5098
5110
|
}
|
|
5099
5111
|
const s = L(o.length, t);
|
|
@@ -5103,20 +5115,20 @@ function Ol(e, t) {
|
|
|
5103
5115
|
sheet: e,
|
|
5104
5116
|
cells: t
|
|
5105
5117
|
})),
|
|
5106
|
-
areas: o.slice(0, s).map((e) =>
|
|
5118
|
+
areas: o.slice(0, s).map((e) => Ot(e.getWorksheet().getRanges(e.getAddress()))),
|
|
5107
5119
|
areasMore: o.length - s
|
|
5108
5120
|
};
|
|
5109
5121
|
}
|
|
5110
|
-
function
|
|
5122
|
+
function Hl(e, t) {
|
|
5111
5123
|
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map(), l = (e) => {
|
|
5112
|
-
for (const t of
|
|
5113
|
-
for (const t of e.getConditionalFormats()) o.add(
|
|
5114
|
-
for (const t of e.getDataValidations()) r.add(
|
|
5124
|
+
for (const t of cn(e)) n.add(Xt(t));
|
|
5125
|
+
for (const t of e.getConditionalFormats()) o.add(Ot(t.getRanges()));
|
|
5126
|
+
for (const t of e.getDataValidations()) r.add(Ot(t.getRanges()));
|
|
5115
5127
|
};
|
|
5116
5128
|
for (const n of e) for (let e = 0; e < n.length; e++) {
|
|
5117
5129
|
const o = n.at(e);
|
|
5118
5130
|
l(o);
|
|
5119
|
-
for (const e of
|
|
5131
|
+
for (const e of jn(o, t)) s.has(e.movable) || s.set(e.movable, e);
|
|
5120
5132
|
}
|
|
5121
5133
|
for (let e = 0; e < (t?.length ?? 0); e++) {
|
|
5122
5134
|
const o = t.at(e);
|
|
@@ -5126,66 +5138,66 @@ function Pl(e, t) {
|
|
|
5126
5138
|
names: [...n],
|
|
5127
5139
|
conditionalFormats: [...o],
|
|
5128
5140
|
dataValidations: [...r],
|
|
5129
|
-
charts: Array.from(s.values(),
|
|
5141
|
+
charts: Array.from(s.values(), Mn)
|
|
5130
5142
|
};
|
|
5131
5143
|
}
|
|
5132
|
-
var
|
|
5133
|
-
function
|
|
5144
|
+
var Vl = (e, t, n = `${t}s`) => `${e} ${1 === e ? t : n}`, Bl = (e, t) => `${`${e}:`.padEnd(14)}${t}`;
|
|
5145
|
+
function zl(e) {
|
|
5134
5146
|
const t = [];
|
|
5135
5147
|
for (const n of e.sheets) {
|
|
5136
5148
|
if (n.written) {
|
|
5137
|
-
t.push(
|
|
5138
|
-
for (const e of n.blocks) t.push(` ${
|
|
5139
|
-
n.blocksMore > 0 && t.push(` +${
|
|
5149
|
+
t.push(Bl("Changed", `${n.written} — ${_l(n)}`));
|
|
5150
|
+
for (const e of n.blocks) t.push(` ${Jl(e)}`);
|
|
5151
|
+
n.blocksMore > 0 && t.push(` +${Vl(n.blocksMore, "more formula block")}`);
|
|
5140
5152
|
}
|
|
5141
|
-
n.shifts.length > 0 && t.push(
|
|
5153
|
+
n.shifts.length > 0 && t.push(Bl("Structure", n.shifts.map((e) => Ul(n.sheet, e)).join(" · "))), n.styles && t.push(Bl("Formatting", n.styles));
|
|
5142
5154
|
}
|
|
5143
5155
|
const n = e.dependents;
|
|
5144
5156
|
if (n) {
|
|
5145
|
-
const e = n.sheets.length > 1 ? ` on ${
|
|
5146
|
-
t.push(
|
|
5157
|
+
const e = n.sheets.length > 1 ? ` on ${Vl(n.sheets.length, "sheet")}` : "";
|
|
5158
|
+
t.push(Bl("Dependents", `${Vl(n.cells, "cell")}${e} — ${n.areas.join(", ")}${((e) => e > 0 ? ` · +${e} more` : "")(n.areasMore)}`));
|
|
5147
5159
|
}
|
|
5148
5160
|
if (e.errors.length > 0 || e.errorsCleared > 0) {
|
|
5149
5161
|
const n = e.errors.map((e) => `${e.address} ${e.error} (${e.cells})`);
|
|
5150
|
-
e.errorsMore > 0 && n.push(`+${e.errorsMore} more`), e.errorsCleared > 0 && n.push(`${
|
|
5162
|
+
e.errorsMore > 0 && n.push(`+${e.errorsMore} more`), e.errorsCleared > 0 && n.push(`${Vl(e.errorsCleared, "error")} cleared`), t.push(Bl("Errors", n.join(" · ")));
|
|
5151
5163
|
}
|
|
5152
5164
|
const o = function(e) {
|
|
5153
5165
|
const t = [], n = (e, n, o) => {
|
|
5154
|
-
e.length > 0 && t.push(`${
|
|
5166
|
+
e.length > 0 && t.push(`${Vl(e.length, n, o)} (${e.join(", ")})`);
|
|
5155
5167
|
};
|
|
5156
5168
|
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;
|
|
5157
5169
|
}(e.touches);
|
|
5158
|
-
return o && t.push(
|
|
5170
|
+
return o && t.push(Bl("Also touches", o)), t.join("\n");
|
|
5159
5171
|
}
|
|
5160
|
-
function
|
|
5172
|
+
function _l(e) {
|
|
5161
5173
|
const t = [];
|
|
5162
|
-
if (e.formulas > 0 && t.push(
|
|
5163
|
-
const n = e.replaced.formulas > 0 ? ` (${
|
|
5164
|
-
t.push(`${
|
|
5174
|
+
if (e.formulas > 0 && t.push(Vl(e.formulas, "formula")), e.values > 0 && t.push(Vl(e.values, "value")), e.cleared > 0 && t.push(`${Vl(e.cleared, "cell")} cleared`), e.replaced) {
|
|
5175
|
+
const n = e.replaced.formulas > 0 ? ` (${Vl(e.replaced.formulas, "formula")})` : "";
|
|
5176
|
+
t.push(`${Vl(e.replaced.populated, "populated cell")} replaced${n}`);
|
|
5165
5177
|
} else t.push("replaced cells not known (cells moved, or the state before was not kept)");
|
|
5166
5178
|
return t.join(", ");
|
|
5167
5179
|
}
|
|
5168
|
-
function
|
|
5180
|
+
function Ul(e, t) {
|
|
5169
5181
|
const n = "insert" === t.kind ? "inserted" : "deleted", o = t.address ?? e;
|
|
5170
5182
|
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"}`;
|
|
5171
5183
|
}
|
|
5172
|
-
function
|
|
5184
|
+
function Jl(e) {
|
|
5173
5185
|
let t;
|
|
5174
5186
|
t = e.sampled && e.values.length > 1 ? `${e.values.slice(0, -1).join(", ")} … ${e.values[e.values.length - 1]}` : e.values.join(", ");
|
|
5175
|
-
const n = e.cells > 1 ? ` (${
|
|
5187
|
+
const n = e.cells > 1 ? ` (${Vl(e.cells, "cell")})` : "";
|
|
5176
5188
|
return `${e.address} ${e.formula} → ${t}${n}`;
|
|
5177
5189
|
}
|
|
5178
|
-
async function
|
|
5190
|
+
async function ql(e, t, n) {
|
|
5179
5191
|
if (!t) return {};
|
|
5180
5192
|
try {
|
|
5181
|
-
const o = await
|
|
5193
|
+
const o = await Tl(e, t, n);
|
|
5182
5194
|
return o ? {
|
|
5183
5195
|
delta: o,
|
|
5184
|
-
markdown:
|
|
5196
|
+
markdown: zl(o)
|
|
5185
5197
|
} : {};
|
|
5186
5198
|
} catch (e) {
|
|
5187
5199
|
return { markdown: `Changes could not be read: ${e?.message ?? String(e)}` };
|
|
5188
5200
|
}
|
|
5189
5201
|
}
|
|
5190
|
-
var
|
|
5191
|
-
export {
|
|
5202
|
+
var Kl = [jo], Gl = [er];
|
|
5203
|
+
export { To as API_ENTRY_POINTS, v as CellEncoding, T as GREP_FIELDS, A as GREP_FIELDS_DEFAULT, I as GrepField, ie as MarkdownBuilder, ce as MarkdownFrameSection, Rl as NoRendererError, Gl as REFERENCES, El as RENDERABLE_KINDS, vl as RENDERERS, $r as RENDER_OPTION_KEYS, jt as REPORTED_FEATURES, Kl as TOOLS, Et as anomalyRegionKey, _o as apiPointerFor, Go as apiSuggestionsFor, er as apiTool, zo as apiTypeOf, nr as appendDependencies, _n as appendGroupFacts, zn as appendGroupMembers, Dt as appendKinds, $s as appendModules, oo as appendMovables, rn as appendNames, kt as appendRegionList, Bt as appendRegions, Vt as appendRoles, an as appendRules, Dn as appendShapeFacts, un as appendSheetObjects, Wr as appendSheetProtection, he as appendTables, ps as collectModules, Xn as collectShapeText, Jt as contentfulBlocks, je as countDates, oe as describeAlignment, pt as describeAllowedValues, qn as describeAnchor, Qo as describeApi, Q as describeBorder, te as describeBorderParts, Pr as describeCellProtection, Z as describeColor, ft as describeConditionalFormat, mt as describeDataValidation, Tl as describeDelta, Tt as describeExtent, Y as describeFill, re as describeFont, Rr as describeLock, Yn as describeMovableSummary, mr as describeNode, fr as describeNodeLabel, dr as describeNodeLabels, ne as describeNumberFormat, ln as describeOutline, Ls as describePageLayout, Pt as describeQualifiedExtent, Xt as describeQualifiedName, Ot as describeQualifiedRanges, Or as describeRangeProtection, Wt as describeRanges, ut as describeRuleStyle, $t as describeRules, dt as describeScale, Kn as describeShapeText, Lt as describeSheetCall, At as describeSheetName, xe as describeSums, to as describeTypeHeading, Mr as describeWorkbookProtection, ye as detectTotals, N as encodeCell, R as encodeFormattedNumber, E as encodeNumber, j as encodeScalar, cn as findNames, xo as grep, jo as grepTool, no as groupMovables, Hn as groupOf, Os as isPlainRecord, Ho as lookupApi, It as parseFeatures, wr as parseRenderOptions, Ne as profileKinds, pe as profileRegion, Dr as protectionPointerFor, Fn as quoteShapeText, ql as readRunDelta, Gn as readShapeText, St as regionPayload, xt as regionPayloads, Yo as renderApi, zr as renderCell, Kr as renderCellRange, Yr as renderConditionalFormat, Qr as renderCounts, es as renderDataValidation, zl as renderDelta, us as renderFormula, No as renderGrep, jl as renderMarkdown, ys as renderModule, bs as renderModules, so as renderMovable, xs as renderNames, Ws as renderPageLayout, Vr as renderProtectedRange, Hr as renderProtection, zs as renderRanges, Ps as renderRecords, Rt as renderRegions, Fl as renderResult, lo as renderShape, Qs as renderStats, tl as renderStyle, fe as renderTable, nl as renderValues, al as renderWorkbook, Xs as renderWorksheet, Nl as resolveRenderer, Lr as summarizeSheetProtection, ge as tableOf, qo as withoutHiddenSuggestion };
|