@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/browser/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 r, ICalculation as i, ICell as a, ICellRange as o, ICondition as s, IConditionalFormat as c, IDataValidation as l, IFill as u, IFont as d, IPageLayout as f, IRange as p, IShape as m, ISheet as h, IStroke as g, ITextFrame as _, InteropScalarType as v, NumberFormat as y, ScalarType as b, ShapeStyleUtils as x, findLabel as S, getScriptingApi as C, getScriptingDeclarations as ee } from "@sheetxl/sdk";
|
|
8
8
|
var w;
|
|
@@ -317,8 +317,125 @@ function P(e) {
|
|
|
317
317
|
while (t >= 0);
|
|
318
318
|
return n;
|
|
319
319
|
}
|
|
320
|
-
var F =
|
|
321
|
-
|
|
320
|
+
var F = class {
|
|
321
|
+
constructor() {
|
|
322
|
+
this._lines = [], this._headingOffset = 0;
|
|
323
|
+
}
|
|
324
|
+
setHeadingOffset(e) {
|
|
325
|
+
return this._headingOffset = e, this;
|
|
326
|
+
}
|
|
327
|
+
_heading(e, t) {
|
|
328
|
+
return this._lines.push(`${"#".repeat(Math.min(6, e + this._headingOffset))} ${t}`), this;
|
|
329
|
+
}
|
|
330
|
+
h1(e) {
|
|
331
|
+
return this._heading(1, e);
|
|
332
|
+
}
|
|
333
|
+
h2(e) {
|
|
334
|
+
return this._heading(2, e);
|
|
335
|
+
}
|
|
336
|
+
h3(e) {
|
|
337
|
+
return this._heading(3, e);
|
|
338
|
+
}
|
|
339
|
+
text(e) {
|
|
340
|
+
return this._lines.push(e), this;
|
|
341
|
+
}
|
|
342
|
+
blank() {
|
|
343
|
+
return this._lines.push(""), this;
|
|
344
|
+
}
|
|
345
|
+
bullet(e) {
|
|
346
|
+
return typeof e == "string" ? this._lines.push(`- ${e}`) : e.forEach((e) => this._lines.push(`- ${e}`)), this;
|
|
347
|
+
}
|
|
348
|
+
fact(e) {
|
|
349
|
+
return typeof e == "string" ? this._lines.push(` ${e}`) : e.forEach((e) => this._lines.push(` ${e}`)), this;
|
|
350
|
+
}
|
|
351
|
+
bold(e) {
|
|
352
|
+
return `**${e}**`;
|
|
353
|
+
}
|
|
354
|
+
codespan(e) {
|
|
355
|
+
return `\`${e}\``;
|
|
356
|
+
}
|
|
357
|
+
code(e, t = "") {
|
|
358
|
+
return `\`\`\`${t}\n${e}\n\`\`\``;
|
|
359
|
+
}
|
|
360
|
+
beginFrame(e) {
|
|
361
|
+
return new De(this, e);
|
|
362
|
+
}
|
|
363
|
+
_addLines(e) {
|
|
364
|
+
this._lines.push(...e);
|
|
365
|
+
}
|
|
366
|
+
toLines() {
|
|
367
|
+
return [...this._lines];
|
|
368
|
+
}
|
|
369
|
+
}, De = class {
|
|
370
|
+
constructor(e, t) {
|
|
371
|
+
this._parent = e, this._headers = t, this._indexWidth = 0, this._rows = [], this._colWidths = t.map((e) => e.length);
|
|
372
|
+
}
|
|
373
|
+
addRow(e, t) {
|
|
374
|
+
let n = e.map((e) => typeof e == "string" ? { text: e } : e);
|
|
375
|
+
return n.forEach((e, t) => {
|
|
376
|
+
this._colWidths[t] = Math.max(this._colWidths[t] ?? 0, e.text.length);
|
|
377
|
+
}), t !== void 0 && (this._indexWidth = Math.max(this._indexWidth, t.length)), this._rows.push({
|
|
378
|
+
index: t,
|
|
379
|
+
cells: n
|
|
380
|
+
}), this;
|
|
381
|
+
}
|
|
382
|
+
endFrame() {
|
|
383
|
+
return this._parent._addLines(this._renderLines()), this._parent;
|
|
384
|
+
}
|
|
385
|
+
_columnAlignment(e) {
|
|
386
|
+
let t = 0, n = 0;
|
|
387
|
+
for (let r of this._rows) {
|
|
388
|
+
let i = r.cells[e];
|
|
389
|
+
i && i.text && (n++, i.alignment === "right" && t++);
|
|
390
|
+
}
|
|
391
|
+
return n > 0 && 2 * t >= n ? "right" : void 0;
|
|
392
|
+
}
|
|
393
|
+
_renderLines() {
|
|
394
|
+
let e = this._indexWidth > 0 ? " ".repeat(this._indexWidth) : "", t = this._colWidths.map((e, t) => this._columnAlignment(t)), n = [];
|
|
395
|
+
if (this._headers.some((e) => e.length > 0)) {
|
|
396
|
+
let r = this._headers.map((e, n) => Oe(e, this._colWidths[n], t[n])).join(" ");
|
|
397
|
+
n.push(`${e}${e ? " " : ""}${r}`.trimEnd());
|
|
398
|
+
}
|
|
399
|
+
for (let e of this._rows) {
|
|
400
|
+
let t = e.cells.map((e, t) => Oe(e.text, this._colWidths[t], e.alignment)).join(" "), r = this._indexWidth > 0 ? (e.index ?? "").padStart(this._indexWidth) + " " : "";
|
|
401
|
+
n.push(`${r}${t}`.trimEnd());
|
|
402
|
+
}
|
|
403
|
+
return n;
|
|
404
|
+
}
|
|
405
|
+
}, Oe = (e, t, n) => {
|
|
406
|
+
if (e.length >= t) return e;
|
|
407
|
+
let r = t - e.length;
|
|
408
|
+
return n === "right" ? e.padStart(t) : n === "center" ? " ".repeat(Math.floor(r / 2)) + e + " ".repeat(Math.ceil(r / 2)) : e.padEnd(t);
|
|
409
|
+
}, ke = (e) => e.getRange().getTables()[0] ?? null;
|
|
410
|
+
function Ae(e, t = []) {
|
|
411
|
+
let n = [...t], r = e.getDescription();
|
|
412
|
+
r && n.push(["description", r]), n.push(["columns", e.getColumns().map((e) => e.getName()).join(", ")]), n.push(["headers", e.isShowHeaders() ? "shown" : "hidden"]), n.push(["totals", e.isShowTotals() ? "shown" : "hidden"]);
|
|
413
|
+
let i = Math.max(10, ...n.map(([e]) => e.length + 2));
|
|
414
|
+
return n.map(([e, t]) => `${e.padEnd(i)}${t}`);
|
|
415
|
+
}
|
|
416
|
+
function je(e, t, n) {
|
|
417
|
+
if (t.length === 0) return;
|
|
418
|
+
let r = t.map((e) => {
|
|
419
|
+
let t = e.getRange();
|
|
420
|
+
return {
|
|
421
|
+
table: e,
|
|
422
|
+
address: t.toString(),
|
|
423
|
+
size: `${t.getRowCount()}×${t.getColumnCount()}`
|
|
424
|
+
};
|
|
425
|
+
}), i = Math.max(...r.map((e) => e.address.length)), a = Math.max(...r.map((e) => e.size.length));
|
|
426
|
+
e.h2(`Tables (${n} cell${n === 1 ? "" : "s"} · ${t.length} table${t.length === 1 ? "" : "s"})`);
|
|
427
|
+
for (let t of r) {
|
|
428
|
+
e.text(` ${t.address.padEnd(i)} ${t.size.padEnd(a)} ${t.table.getName()}`);
|
|
429
|
+
for (let n of Ae(t.table)) e.text(` ${n}`);
|
|
430
|
+
}
|
|
431
|
+
e.blank();
|
|
432
|
+
}
|
|
433
|
+
function Me(e) {
|
|
434
|
+
let t = new F();
|
|
435
|
+
return t.h1(`Table — ${e.getName()}`), t.fact(Ae(e, [["range", qt(e.getRange())]])), t.toLines().join("\n").trimEnd();
|
|
436
|
+
}
|
|
437
|
+
var Ne = o.Feature;
|
|
438
|
+
function Pe(e, t) {
|
|
322
439
|
let n = t?.maxSeries ?? 24, r = t?.maxProfileCells ?? 2e4, i = t?.maxCategories ?? 3, a = e.getRowCount(), o = e.getColumnCount();
|
|
323
440
|
if (a === 1 && o === 1) return {
|
|
324
441
|
shape: "cell",
|
|
@@ -328,13 +445,13 @@ function De(e, t) {
|
|
|
328
445
|
let s = e.getRange(), c = s.getCoords(), l = a >= o;
|
|
329
446
|
if (a === 1 || o === 1) return {
|
|
330
447
|
shape: "list",
|
|
331
|
-
summary:
|
|
448
|
+
summary: Ge(s, i),
|
|
332
449
|
series: []
|
|
333
450
|
};
|
|
334
|
-
let u =
|
|
451
|
+
let u = Fe(e, l), d = l ? o : a, f = l ? null : "by row", p = u.present && u.inside, m = l && p ? c.rowStart + 1 : c.rowStart, h = !l && p ? c.colStart + 1 : c.colStart, g = Re(s, l, l ? m : h, r), _ = l && g ? g.start - 1 : c.rowEnd, v = !l && g ? g.start - 1 : c.colEnd, y = _ - m + 1, b = v - h + 1, x = y * b > r, S = x && l ? Math.max(1, Math.floor(r / Math.max(1, b))) : y, C = x && !l ? Math.max(1, Math.floor(r / Math.max(1, y))) : b, ee = Math.min(_, m + S - 1), T = Math.min(v, h + C - 1), E = Math.min(d, n), O = [], te = [];
|
|
335
452
|
for (let t = 0; t < E; t++) {
|
|
336
453
|
let n = l ? s.getRangeAt(m, c.colStart + t, ee, c.colStart + t) : s.getRangeAt(c.rowStart + t, h, c.rowStart + t, T);
|
|
337
|
-
O.push(
|
|
454
|
+
O.push(We(e, l, t, u.names)), te.push(Ge(n, i));
|
|
338
455
|
}
|
|
339
456
|
let ne = O.length ? Math.max(...O.map((e) => e.length)) : 0, re = O.map((e, t) => `${e.padEnd(ne)} ${te[t]}`);
|
|
340
457
|
d > E && re.push(`…${d - E} more ${l ? "columns" : "rows"} not profiled · read them with getStats()`);
|
|
@@ -349,8 +466,8 @@ function De(e, t) {
|
|
|
349
466
|
series: re
|
|
350
467
|
};
|
|
351
468
|
}
|
|
352
|
-
function
|
|
353
|
-
let n = e.getRange(), r = n.getCoords(), i = e.getCell()
|
|
469
|
+
function Fe(e, t) {
|
|
470
|
+
let n = e.getRange(), r = n.getCoords(), i = ke(e.getCell());
|
|
354
471
|
if (i) {
|
|
355
472
|
let e = i.getColumns().map((e) => e.getName()), n = i.getRange().getCoords();
|
|
356
473
|
return {
|
|
@@ -360,21 +477,21 @@ function Oe(e, t) {
|
|
|
360
477
|
names: t ? e : null
|
|
361
478
|
};
|
|
362
479
|
}
|
|
363
|
-
let a = t ? r.rowStart + 1 : r.colStart + 1, o =
|
|
364
|
-
if (
|
|
480
|
+
let a = t ? r.rowStart + 1 : r.colStart + 1, o = He(t ? n.getRangeAt(a, r.colStart, r.rowEnd, r.colEnd) : n.getRangeAt(r.rowStart, a, r.rowEnd, r.colEnd)), s = t ? n.getRangeAt(r.rowStart, r.colStart, r.rowStart, r.colEnd) : n.getRangeAt(r.rowStart, r.colStart, r.rowEnd, r.colStart);
|
|
481
|
+
if (He(s) && !o) return {
|
|
365
482
|
present: !0,
|
|
366
483
|
inside: !0,
|
|
367
484
|
note: "header " + (t ? `row ${r.rowStart + 1}` : `column ${P(r.colStart)}`),
|
|
368
|
-
names:
|
|
485
|
+
names: Ue(s, e, t)
|
|
369
486
|
};
|
|
370
487
|
let c = (t ? r.rowStart : r.colStart) - 1;
|
|
371
|
-
if (c >= 0 && !
|
|
488
|
+
if (c >= 0 && !He(n)) {
|
|
372
489
|
let i = t ? n.getRangeAt(c, r.colStart, c, r.colEnd) : n.getRangeAt(r.rowStart, c, r.rowEnd, c);
|
|
373
|
-
if (
|
|
490
|
+
if (He(i)) return {
|
|
374
491
|
present: !0,
|
|
375
492
|
inside: !1,
|
|
376
493
|
note: `header ${t ? `row ${c + 1}` : `column ${P(c)}`} (above this block)`,
|
|
377
|
-
names:
|
|
494
|
+
names: Ue(i, e, t)
|
|
378
495
|
};
|
|
379
496
|
}
|
|
380
497
|
return {
|
|
@@ -384,33 +501,33 @@ function Oe(e, t) {
|
|
|
384
501
|
names: null
|
|
385
502
|
};
|
|
386
503
|
}
|
|
387
|
-
var
|
|
388
|
-
function
|
|
504
|
+
var Ie = 3;
|
|
505
|
+
function Le(e, t = 2e4) {
|
|
389
506
|
let n = e.getRowCount(), r = e.getColumnCount();
|
|
390
507
|
if (n < 2 || r < 2) return null;
|
|
391
|
-
let i = n >= r, a = e.getCoords(), o =
|
|
508
|
+
let i = n >= r, a = e.getCoords(), o = Fe({
|
|
392
509
|
getRowCount: () => n,
|
|
393
510
|
getColumnCount: () => r,
|
|
394
511
|
getCell: () => e.getCell(),
|
|
395
512
|
getRange: () => e
|
|
396
513
|
}, i), s = o.present && o.inside;
|
|
397
|
-
return
|
|
514
|
+
return Re(e, i, (i ? a.rowStart : a.colStart) + +!!s, t);
|
|
398
515
|
}
|
|
399
|
-
function
|
|
400
|
-
let i = e.getCoords(), a = t ? i.rowEnd : i.colEnd, o = t ? i.colStart : i.rowStart, s = t ? i.colEnd : i.rowEnd, c, l = -1, u = e.getCell()
|
|
516
|
+
function Re(e, t, n, r) {
|
|
517
|
+
let i = e.getCoords(), a = t ? i.rowEnd : i.colEnd, o = t ? i.colStart : i.rowStart, s = t ? i.colEnd : i.rowEnd, c, l = -1, u = ke(e.getCell()), d = t && !!u?.isShowTotals() && u.getRange().getCoords().rowEnd === i.rowEnd;
|
|
401
518
|
if (d) l = a;
|
|
402
519
|
else {
|
|
403
520
|
if (e.getRowCount() * e.getColumnCount() > Math.min(r, 1e4)) return null;
|
|
404
521
|
let u = e.getValues(), d = (e, n) => t ? u[e - i.rowStart][n - i.colStart] : u[n - i.rowStart][e - i.colStart], f = s - o + 1, p = Array(f).fill(0), m = Array(f).fill(!1);
|
|
405
522
|
for (let r = n; r <= a; r++) {
|
|
406
523
|
if (r - n >= 2) {
|
|
407
|
-
let n =
|
|
524
|
+
let n = ze(f, (e) => d(r, o + e), p, m, (e) => t ? `${P(o + e)}${r + 1}` : `${P(r)}${o + e + 1}`);
|
|
408
525
|
if (n.matches >= 2 && 2 * n.matches > n.candidates) {
|
|
409
526
|
let i = t ? e.getRangeAt(r, o, r, s) : e.getRangeAt(o, r, s, r);
|
|
410
527
|
l = r, c = {
|
|
411
528
|
...n,
|
|
412
529
|
byColumn: t,
|
|
413
|
-
typed: (i.getCounts([
|
|
530
|
+
typed: (i.getCounts([Ne.Formula])[Ne.Formula] ?? 0) === 0
|
|
414
531
|
};
|
|
415
532
|
break;
|
|
416
533
|
}
|
|
@@ -430,17 +547,17 @@ function je(e, t, n, r) {
|
|
|
430
547
|
} : {
|
|
431
548
|
rowIndex: i.rowStart,
|
|
432
549
|
colIndex: n
|
|
433
|
-
}, a =
|
|
550
|
+
}, a = Ve(e, r) ?? N(f, r, t ? "row" : "column");
|
|
434
551
|
p.push({
|
|
435
552
|
index: n,
|
|
436
553
|
label: a,
|
|
437
554
|
...n === l && c ? { sums: c } : {}
|
|
438
555
|
});
|
|
439
556
|
}
|
|
440
|
-
let m = (e) => t ? String(e + 1) : P(e), h = l === a ? `${t ? "row" : "column"} ${m(l)}` : `${t ? "rows" : "columns"} ${m(l)}:${m(a)}`, g = p.slice(0,
|
|
557
|
+
let m = (e) => t ? String(e + 1) : P(e), h = l === a ? `${t ? "row" : "column"} ${m(l)}` : `${t ? "rows" : "columns"} ${m(l)}:${m(a)}`, g = p.slice(0, Ie).map((e) => [
|
|
441
558
|
m(e.index),
|
|
442
559
|
e.label ? JSON.stringify(e.label.text) : null,
|
|
443
|
-
e.sums ?
|
|
560
|
+
e.sums ? Be(e.sums) : e.index === l && d ? "table totals" : null
|
|
444
561
|
].filter(Boolean).join(" ")), _ = p.length - g.length;
|
|
445
562
|
return {
|
|
446
563
|
byColumn: t,
|
|
@@ -449,7 +566,7 @@ function je(e, t, n, r) {
|
|
|
449
566
|
note: `${h} not profiled: ${g.join(" · ")}${_ > 0 ? ` · +${_} more` : ""}`
|
|
450
567
|
};
|
|
451
568
|
}
|
|
452
|
-
function
|
|
569
|
+
function ze(e, t, n, r, i) {
|
|
453
570
|
let a = 0, o = 0, s = [];
|
|
454
571
|
for (let c = 0; c < e; c++) {
|
|
455
572
|
if (!r[c]) continue;
|
|
@@ -463,11 +580,11 @@ function Me(e, t, n, r, i) {
|
|
|
463
580
|
misses: s
|
|
464
581
|
};
|
|
465
582
|
}
|
|
466
|
-
function
|
|
583
|
+
function Be(e) {
|
|
467
584
|
let t = e.misses.slice(0, 3), n = e.misses.length - t.length, r = t.length > 0 ? `; ${t.join(", ")}${n > 0 ? `, +${n} more` : ""}` : "";
|
|
468
585
|
return `${e.typed ? "typed, " : ""}= Σ ${e.byColumn ? "above" : "to the left"} (${e.matches} of ${e.candidates}${r})`;
|
|
469
586
|
}
|
|
470
|
-
function
|
|
587
|
+
function Ve(e, t) {
|
|
471
588
|
let n = e.getRangeAt(t.rowIndex, t.colIndex).getCell();
|
|
472
589
|
if (n.getType() !== b.String) return null;
|
|
473
590
|
let r = D(n, w.Mode.Display)?.match;
|
|
@@ -476,11 +593,11 @@ function Pe(e, t) {
|
|
|
476
593
|
address: n.getAddress()
|
|
477
594
|
} : null;
|
|
478
595
|
}
|
|
479
|
-
function
|
|
596
|
+
function He(e) {
|
|
480
597
|
let t = e.getStats({ onError: "ignore" }), n = t.getCount();
|
|
481
598
|
return n > 0 && (t.getTypedCounts()[b.String] ?? 0) === n;
|
|
482
599
|
}
|
|
483
|
-
function
|
|
600
|
+
function Ue(e, t, n) {
|
|
484
601
|
let r = t.getRange().getCoords(), i = e.getCoords(), a = n ? r.colEnd - r.colStart + 1 : r.rowEnd - r.rowStart + 1, o = [];
|
|
485
602
|
for (let t = 0; t < a; t++) {
|
|
486
603
|
let a = n ? e.getRangeAt(i.rowStart, r.colStart + t).getCell() : e.getRangeAt(r.rowStart + t, i.colStart).getCell();
|
|
@@ -488,25 +605,25 @@ function Ie(e, t, n) {
|
|
|
488
605
|
}
|
|
489
606
|
return o;
|
|
490
607
|
}
|
|
491
|
-
function
|
|
608
|
+
function We(e, t, n, r) {
|
|
492
609
|
let i = e.getRange().getCoords(), a = t ? P(i.colStart + n) : String(i.rowStart + n + 1), o = r?.[n];
|
|
493
610
|
return o ? `${a} ${o}` : a;
|
|
494
611
|
}
|
|
495
|
-
function
|
|
612
|
+
function Ge(e, t = 3) {
|
|
496
613
|
let n = e.getStats({ onError: "ignore" }), r = n.getTypedCounts(), i = n.getCount(), a = n.getSize(), o = a - i;
|
|
497
614
|
if (i === 0) return `${a} cells, all blank`;
|
|
498
|
-
let s = e.getCounts([
|
|
615
|
+
let s = e.getCounts([Ne.Formula])[Ne.Formula] ?? 0, c = qe(e), l = r[b.Number] ?? 0, u = r[b.String] ?? 0, d = r[b.Error] ?? 0, f = [String(i)], p = !1;
|
|
499
616
|
if (s === i) {
|
|
500
|
-
let t = [...e.getRegions(
|
|
617
|
+
let t = [...e.getRegions(Ne.Formula)];
|
|
501
618
|
if (t.length === 1) {
|
|
502
619
|
let e = t[0].getCell().getFormulaText();
|
|
503
620
|
f.push("formula", e || "(uniform)");
|
|
504
621
|
} else f.push("formula", `${t.length} distinct`);
|
|
505
|
-
} else if (c === i) f.push("date",
|
|
622
|
+
} else if (c === i) f.push("date", Ye(n, Je(e).format));
|
|
506
623
|
else if (l === i) {
|
|
507
|
-
let t =
|
|
508
|
-
f.push("number",
|
|
509
|
-
} else if (u === i) f.push("text",
|
|
624
|
+
let t = Je(e);
|
|
625
|
+
f.push("number", Ye(n, t.format), ...Xe(n, t));
|
|
626
|
+
} else if (u === i) f.push("text", Ze(n, t));
|
|
510
627
|
else {
|
|
511
628
|
let e = [
|
|
512
629
|
l ? `number ${l}` : null,
|
|
@@ -523,33 +640,33 @@ function Re(e, t = 3) {
|
|
|
523
640
|
].filter(Boolean), h = f.filter(Boolean).join(" ");
|
|
524
641
|
return m.length ? `${h} · ${m.join(" · ")}` : h;
|
|
525
642
|
}
|
|
526
|
-
function
|
|
643
|
+
function Ke(e, t = 3) {
|
|
527
644
|
let n = e.getStats({ onError: "ignore" }), r = n.getTypedCounts(), i = [], a = r[b.Number] ?? 0;
|
|
528
645
|
if (a > 0) {
|
|
529
|
-
let t =
|
|
646
|
+
let t = Je(e), r = [Ye(n, t.format), ...Xe(n, t)].filter(Boolean);
|
|
530
647
|
i.push(`Number: ${a} ${r.join(" ")}`.trimEnd());
|
|
531
648
|
}
|
|
532
649
|
let o = r[b.String] ?? 0;
|
|
533
650
|
if (o > 0) {
|
|
534
|
-
let e =
|
|
651
|
+
let e = Ze(n, t, (e) => typeof e == "string");
|
|
535
652
|
i.push(`String: ${o} ${e}`.trimEnd());
|
|
536
653
|
}
|
|
537
654
|
let s = r[b.Boolean] ?? 0;
|
|
538
655
|
if (s > 0) {
|
|
539
|
-
let e =
|
|
656
|
+
let e = Ze(n, t, (e) => typeof e == "boolean");
|
|
540
657
|
i.push(`Boolean: ${s} ${e}`.trimEnd());
|
|
541
658
|
}
|
|
542
659
|
return i;
|
|
543
660
|
}
|
|
544
|
-
function
|
|
661
|
+
function qe(e) {
|
|
545
662
|
let t = 0;
|
|
546
663
|
return e.forEach((e, n) => {
|
|
547
664
|
n.getInteropType() === v.Date && t++;
|
|
548
665
|
}), t;
|
|
549
666
|
}
|
|
550
|
-
function
|
|
667
|
+
function Je(e) {
|
|
551
668
|
let t = (e) => e.getStats({ onError: "ignore" }).getTypedCounts()[b.Number] ?? 0, n = /* @__PURE__ */ new Map(), r = 0;
|
|
552
|
-
for (let i of e.getRegions(
|
|
669
|
+
for (let i of e.getRegions(Ne.NumberFormat)) {
|
|
553
670
|
let e = i.getRange().getStyle().getNumberFormat(), a = t(i.getRange());
|
|
554
671
|
r += a, e && a > 0 && n.set(e, (n.get(e) ?? 0) + a);
|
|
555
672
|
}
|
|
@@ -573,51 +690,51 @@ function Ve(e) {
|
|
|
573
690
|
mixed: a.map(([e, t]) => `${e} ${t}`).join(" · ")
|
|
574
691
|
};
|
|
575
692
|
}
|
|
576
|
-
function
|
|
693
|
+
function Ye(e, t) {
|
|
577
694
|
let n = e.getAggregates({ onError: "ignore" });
|
|
578
695
|
if (n.min === null || n.max === null) return "";
|
|
579
696
|
let r = E(n.min, t), i = E(n.max, t);
|
|
580
697
|
return r === i ? r : `${r} … ${i}`;
|
|
581
698
|
}
|
|
582
|
-
function
|
|
699
|
+
function Xe(e, { format: t, mixed: n }) {
|
|
583
700
|
if (n) return [`mixed formats (${n})`];
|
|
584
701
|
let r = e.getAggregates({ onError: "ignore" }), i = [];
|
|
585
702
|
return r.sum !== null && i.push(`Σ ${E(r.sum, t)}`), r.average !== null && i.push(`x̄ ${E(r.average, t)}`), i;
|
|
586
703
|
}
|
|
587
|
-
function
|
|
704
|
+
function Ze(e, t, n) {
|
|
588
705
|
let r = e.getFrequencies(n ? { filterFn: n } : void 0), i = r.getUniqueCount();
|
|
589
706
|
if (i === 0) return "";
|
|
590
707
|
if (i === r.getTotalCount()) return `${i} distinct, no repeats`;
|
|
591
708
|
let a = Array.from(r.getValueCounts()).slice(0, t);
|
|
592
709
|
return `${i} unique (${a.map(([e, t]) => `${e} ${t}`).join(" · ")}${i > a.length ? " · …" : ""})`;
|
|
593
710
|
}
|
|
594
|
-
var I = o.Feature,
|
|
711
|
+
var I = o.Feature, Qe = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), $e = (e, t) => {
|
|
595
712
|
let n = Math.min(e.rowEnd, t.rowEnd) - Math.max(e.rowStart, t.rowStart) + 1;
|
|
596
713
|
if (n <= 0) return 0;
|
|
597
714
|
let r = Math.min(e.colEnd, t.colEnd) - Math.max(e.colStart, t.colStart) + 1;
|
|
598
715
|
return r <= 0 ? 0 : n * r;
|
|
599
|
-
},
|
|
600
|
-
let n = `×${
|
|
601
|
-
return t === "times" || e.styled === e.content ? n : `${n} (+${
|
|
602
|
-
},
|
|
716
|
+
}, et = (e) => e.toLocaleString("en-US"), tt = (e, t) => {
|
|
717
|
+
let n = `×${et(e.content)}`;
|
|
718
|
+
return t === "times" || e.styled === e.content ? n : `${n} (+${et(e.styled - e.content)} blank)`;
|
|
719
|
+
}, nt = (t) => {
|
|
603
720
|
if (t.length === 0) return "";
|
|
604
721
|
let n = e.rangeToString(t[0]);
|
|
605
722
|
if (t.length === 1) return n;
|
|
606
723
|
let r = t.length - 1;
|
|
607
724
|
return `${n}, +${r} block${r === 1 ? "" : "s"}`;
|
|
608
725
|
};
|
|
609
|
-
function
|
|
610
|
-
let n = t?.manyDistinct ?? 20, { sorted: r, top: i, rare: a, more: o } =
|
|
726
|
+
function rt(e, t) {
|
|
727
|
+
let n = t?.manyDistinct ?? 20, { sorted: r, top: i, rare: a, more: o } = it(e, t);
|
|
611
728
|
if (r.length === 0) return "";
|
|
612
729
|
let s = (e) => ((e, t) => {
|
|
613
|
-
let n =
|
|
614
|
-
return `${e.label === t?.hideLabel ? "" : `${e.label} `}${
|
|
730
|
+
let n = nt(e.blocks);
|
|
731
|
+
return `${e.label === t?.hideLabel ? "" : `${e.label} `}${tt(e, t?.countStyle ?? "cells")}${n ? ` ${n}` : ""}`;
|
|
615
732
|
})(e, t);
|
|
616
733
|
if (o === 0) return r.map(s).join(" · ");
|
|
617
734
|
let c = r.reduce((e, t) => e + t.content, 0), l = c > 0 ? r[0].content / c : 0, u = [], d = r.length > n ? `${r.length} distinct${l < .5 ? ", no convention" : ""}; largest ` : "";
|
|
618
735
|
return u.push(d + i.map(s).join(" · ")), a.length > 0 && u.push(`rarest ${a.map(s).join(" · ")}`), u.push(`+${o} more${t?.recovery ? ` (${t.recovery})` : ""}`), u.join(" · ");
|
|
619
736
|
}
|
|
620
|
-
function
|
|
737
|
+
function it(e, t) {
|
|
621
738
|
let n = t?.maxValues ?? 8, r = [...e].sort((e, t) => t.content - e.content || t.styled - e.styled || (e.label < t.label ? -1 : 1));
|
|
622
739
|
if (r.length <= n) return {
|
|
623
740
|
sorted: r,
|
|
@@ -634,7 +751,7 @@ function Ze(e, t) {
|
|
|
634
751
|
more: r.length - a.length - o.length
|
|
635
752
|
};
|
|
636
753
|
}
|
|
637
|
-
var
|
|
754
|
+
var at = [
|
|
638
755
|
{
|
|
639
756
|
name: "family",
|
|
640
757
|
project: (e, t) => L(e.getFont().getFamily(), t?.getFont().getFamily())
|
|
@@ -663,22 +780,22 @@ var Qe = [
|
|
|
663
780
|
name: "color",
|
|
664
781
|
project: (e, t) => L(M(e.getFont().getColor()), t ? M(t.getFont().getColor()) : null)
|
|
665
782
|
}
|
|
666
|
-
],
|
|
783
|
+
], ot = (e) => pt(e) ?? "Custom", st = {
|
|
667
784
|
name: "category",
|
|
668
785
|
project: (e) => {
|
|
669
786
|
let t = Ce(e);
|
|
670
|
-
return t === null ? null :
|
|
787
|
+
return t === null ? null : ot(t);
|
|
671
788
|
}
|
|
672
|
-
},
|
|
789
|
+
}, ct = {
|
|
673
790
|
name: "format",
|
|
674
791
|
project: (e) => Ce(e)
|
|
675
|
-
},
|
|
792
|
+
}, lt = [st, ct], ut = [{
|
|
676
793
|
name: "color",
|
|
677
794
|
project: (e) => ye(e)
|
|
678
|
-
}],
|
|
795
|
+
}], dt = [{
|
|
679
796
|
name: "edges",
|
|
680
797
|
project: (e) => be(e)
|
|
681
|
-
}],
|
|
798
|
+
}], ft = [
|
|
682
799
|
{
|
|
683
800
|
name: "h",
|
|
684
801
|
ambiguous: !0,
|
|
@@ -705,26 +822,26 @@ var Qe = [
|
|
|
705
822
|
function L(e, t, n = String) {
|
|
706
823
|
return e == null || t !== void 0 && e === t ? null : n(e);
|
|
707
824
|
}
|
|
708
|
-
function
|
|
825
|
+
function pt(e) {
|
|
709
826
|
if (!e || e === "General") return null;
|
|
710
827
|
let t = y.Builder.parse(e);
|
|
711
828
|
if (t.category === "General") return null;
|
|
712
829
|
let n = t.decimalPlaces;
|
|
713
830
|
return n == null ? t.category : `${t.category} ${n}dp`;
|
|
714
831
|
}
|
|
715
|
-
var
|
|
716
|
-
[I.Font]:
|
|
717
|
-
[I.NumberFormat]:
|
|
718
|
-
[I.Fill]:
|
|
719
|
-
[I.Borders]:
|
|
720
|
-
[I.Alignment]:
|
|
721
|
-
},
|
|
722
|
-
function
|
|
723
|
-
let i =
|
|
832
|
+
var mt = {
|
|
833
|
+
[I.Font]: at,
|
|
834
|
+
[I.NumberFormat]: lt,
|
|
835
|
+
[I.Fill]: ut,
|
|
836
|
+
[I.Borders]: dt,
|
|
837
|
+
[I.Alignment]: ft
|
|
838
|
+
}, ht = (e) => e in mt;
|
|
839
|
+
function gt(e, t, n, r) {
|
|
840
|
+
let i = mt[t];
|
|
724
841
|
if (!i) return null;
|
|
725
842
|
let a = e.getEntireCoords(), o = e.getUsedRange()?.getCoords() ?? null, s = [...e.getEntireRange().getRegions(t)];
|
|
726
843
|
if (s.length === 0) return null;
|
|
727
|
-
let c = r?.content ?? (o ? [...e.getEntireRange().getRegions(I.Contentful)].map((e) => e.getCoords()) : []), l = (e) => c.reduce((t, n) => t +
|
|
844
|
+
let c = r?.content ?? (o ? [...e.getEntireRange().getRegions(I.Contentful)].map((e) => e.getCoords()) : []), l = (e) => c.reduce((t, n) => t + $e(e, n), 0), u = (e) => o ? $e(e, o) : 0, d = (e) => {
|
|
728
845
|
let t = e.getRange().getStyle(), r = [];
|
|
729
846
|
for (let e of i) {
|
|
730
847
|
let i = e.project(t, n);
|
|
@@ -739,7 +856,7 @@ function lt(e, t, n, r) {
|
|
|
739
856
|
2 * (t.rowEnd - t.rowStart + 1) > m ? g.push(e) : 2 * (t.colEnd - t.colStart + 1) > h ? _.push(e) : v.push(e);
|
|
740
857
|
}
|
|
741
858
|
let y = [];
|
|
742
|
-
y.push(...
|
|
859
|
+
y.push(...Ct("columns", g, d, a, !0)), y.push(...Ct("rows", _, d, a, !1));
|
|
743
860
|
let b = v.reduce((e, t) => e + u(t.getCoords()), 0), x = (e) => {
|
|
744
861
|
let t = [];
|
|
745
862
|
for (let r of v) {
|
|
@@ -781,31 +898,31 @@ function lt(e, t, n, r) {
|
|
|
781
898
|
}
|
|
782
899
|
return [...r.values()].map((e) => ({
|
|
783
900
|
...e,
|
|
784
|
-
blocks: e.blocks.sort((e, t) =>
|
|
901
|
+
blocks: e.blocks.sort((e, t) => Qe(t) - Qe(e))
|
|
785
902
|
}));
|
|
786
903
|
}, S = [];
|
|
787
904
|
if (t === I.NumberFormat) S.push(...function(e, t, n) {
|
|
788
|
-
let { top: r, rare: i, more: a } =
|
|
905
|
+
let { top: r, rare: i, more: a } = it(e, n), o = [], s = -1;
|
|
789
906
|
for (let e of [...r, ...i]) {
|
|
790
907
|
e === i[0] && (s = o.length);
|
|
791
|
-
let n =
|
|
908
|
+
let n = it(t.filter((t) => ot(t.label) === e.label), { maxValues: 1 / 0 }).sorted, r = n.length === 1;
|
|
792
909
|
if (o.push([
|
|
793
910
|
e.label,
|
|
794
|
-
|
|
795
|
-
|
|
911
|
+
tt(e, "cells"),
|
|
912
|
+
nt(e.blocks),
|
|
796
913
|
r ? n[0].label : `${n.length} formats`
|
|
797
914
|
]), !r) {
|
|
798
|
-
for (let e of n.slice(0,
|
|
915
|
+
for (let e of n.slice(0, St)) o.push([
|
|
799
916
|
"",
|
|
800
|
-
|
|
801
|
-
|
|
917
|
+
tt(e, "cells"),
|
|
918
|
+
nt(e.blocks),
|
|
802
919
|
e.label
|
|
803
920
|
]);
|
|
804
|
-
n.length >
|
|
921
|
+
n.length > St && o.push([
|
|
805
922
|
"",
|
|
806
923
|
"",
|
|
807
924
|
"",
|
|
808
|
-
`…and ${n.length -
|
|
925
|
+
`…and ${n.length - St} more`
|
|
809
926
|
]);
|
|
810
927
|
}
|
|
811
928
|
}
|
|
@@ -815,25 +932,25 @@ function lt(e, t, n, r) {
|
|
|
815
932
|
2
|
|
816
933
|
].map((e) => Math.max(...o.map((t) => t[e].length))), l = o.map((e) => `${e[0].padEnd(c[0])} ${e[1].padEnd(c[1])} ${e[2].padEnd(c[2])} ${e[3]}`.trimEnd());
|
|
817
934
|
return a > 0 && l.splice(s < 0 ? l.length : s, 0, `…and ${a} more${n?.recovery ? ` · ${n.recovery}` : ""}`), l;
|
|
818
|
-
}(x(
|
|
935
|
+
}(x(st), x(ct), r));
|
|
819
936
|
else for (let e of i) {
|
|
820
937
|
let t = x(e);
|
|
821
938
|
if (t.length === 0) continue;
|
|
822
|
-
let n =
|
|
939
|
+
let n = rt(t, {
|
|
823
940
|
...r,
|
|
824
941
|
hideLabel: e.name
|
|
825
942
|
});
|
|
826
|
-
n.length <=
|
|
943
|
+
n.length <= bt ? S.push(`${e.name.padEnd(10)}${n}`) : S.push(...xt(e.name, t, r));
|
|
827
944
|
}
|
|
828
945
|
return {
|
|
829
946
|
distinct: f.size,
|
|
830
947
|
cells: b,
|
|
831
|
-
normal: n ?
|
|
948
|
+
normal: n ? yt(t, n) : null,
|
|
832
949
|
tiers: y,
|
|
833
950
|
attributes: S
|
|
834
951
|
};
|
|
835
952
|
}
|
|
836
|
-
function
|
|
953
|
+
function _t(e, t) {
|
|
837
954
|
if (e.length === 0) return null;
|
|
838
955
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = 0;
|
|
839
956
|
for (let t of e) {
|
|
@@ -859,7 +976,7 @@ function ut(e, t) {
|
|
|
859
976
|
label: e.label,
|
|
860
977
|
content: e.cells,
|
|
861
978
|
styled: e.cells,
|
|
862
|
-
blocks: e.blocks.sort((e, t) =>
|
|
979
|
+
blocks: e.blocks.sort((e, t) => Qe(t) - Qe(e))
|
|
863
980
|
})), s = [...r.entries()].map(([e, t]) => ({
|
|
864
981
|
label: e,
|
|
865
982
|
content: t,
|
|
@@ -873,10 +990,10 @@ function ut(e, t) {
|
|
|
873
990
|
blocks: []
|
|
874
991
|
}), {
|
|
875
992
|
distinct: n.size,
|
|
876
|
-
lines: [`${"distinct".padEnd(10)}${
|
|
993
|
+
lines: [`${"distinct".padEnd(10)}${rt(o, a)}`, `${"functions".padEnd(10)}${rt(s, a)}`]
|
|
877
994
|
};
|
|
878
995
|
}
|
|
879
|
-
function
|
|
996
|
+
function vt(e, t) {
|
|
880
997
|
let n = e.getStats({ onError: "ignore" }).getTypedCounts(), r = /* @__PURE__ */ new Map(), i = [
|
|
881
998
|
["number", "number"],
|
|
882
999
|
["string", "text"],
|
|
@@ -888,7 +1005,7 @@ function dt(e, t) {
|
|
|
888
1005
|
let i = n[e] ?? 0;
|
|
889
1006
|
i > 0 && r.set(t, i);
|
|
890
1007
|
}
|
|
891
|
-
let a =
|
|
1008
|
+
let a = qe(e), o = 0;
|
|
892
1009
|
for (let e of t) {
|
|
893
1010
|
let t = e.getRange().getStats({ onError: "ignore" }).getTypedCounts();
|
|
894
1011
|
o += e.getRowCount() * e.getColumnCount();
|
|
@@ -896,11 +1013,11 @@ function dt(e, t) {
|
|
|
896
1013
|
let i = t[e] ?? 0;
|
|
897
1014
|
i > 0 && r.set(n, (r.get(n) ?? 0) - i);
|
|
898
1015
|
}
|
|
899
|
-
a > 0 && (t.number ?? 0) > 0 && (a -=
|
|
1016
|
+
a > 0 && (t.number ?? 0) > 0 && (a -= qe(e.getRange()));
|
|
900
1017
|
}
|
|
901
1018
|
return a > 0 && (r.set("date", a), r.set("number", (r.get("number") ?? 0) - a)), o > 0 && r.set("formula", o), [...r.entries()].filter(([, e]) => e > 0).sort((e, t) => t[1] - e[1]);
|
|
902
1019
|
}
|
|
903
|
-
function
|
|
1020
|
+
function yt(e, t) {
|
|
904
1021
|
switch (e) {
|
|
905
1022
|
case I.Font: return function(e) {
|
|
906
1023
|
let t = e.getFont(), n = [t.getFamily(), `${t.getSize()}pt`], r = M(t.getColor());
|
|
@@ -908,7 +1025,7 @@ function ft(e, t) {
|
|
|
908
1025
|
}(t);
|
|
909
1026
|
case I.NumberFormat: {
|
|
910
1027
|
let e = Ce(t);
|
|
911
|
-
return e === null ? null : `${
|
|
1028
|
+
return e === null ? null : `${ot(e)} ${e}`;
|
|
912
1029
|
}
|
|
913
1030
|
case I.Fill: return ye(t);
|
|
914
1031
|
case I.Borders: return be(t);
|
|
@@ -919,19 +1036,19 @@ function ft(e, t) {
|
|
|
919
1036
|
default: return null;
|
|
920
1037
|
}
|
|
921
1038
|
}
|
|
922
|
-
var
|
|
923
|
-
function
|
|
924
|
-
let { sorted: r, top: i, rare: a, more: o } =
|
|
925
|
-
|
|
926
|
-
|
|
1039
|
+
var bt = 110;
|
|
1040
|
+
function xt(e, t, n) {
|
|
1041
|
+
let { sorted: r, top: i, rare: a, more: o } = it(t, n), s = [...i, ...a].map((e) => [
|
|
1042
|
+
tt(e, "cells"),
|
|
1043
|
+
nt(e.blocks),
|
|
927
1044
|
e.label
|
|
928
1045
|
]), c = [0, 1].map((e) => Math.max(...s.map((t) => t[e].length))), l = s.map((e) => ` ${e[0].padEnd(c[0])} ${e[1].padEnd(c[1])} ${e[2]}`);
|
|
929
1046
|
o > 0 && l.splice(i.length, 0, ` …and ${o} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
|
|
930
1047
|
let u = n?.manyDistinct ?? 20;
|
|
931
1048
|
return [r.length > u ? `${e.padEnd(10)}${r.length} distinct` : e, ...l];
|
|
932
1049
|
}
|
|
933
|
-
var
|
|
934
|
-
function
|
|
1050
|
+
var St = 6;
|
|
1051
|
+
function Ct(t, n, r, i, a) {
|
|
935
1052
|
if (n.length === 0) return [];
|
|
936
1053
|
let o = /* @__PURE__ */ new Map();
|
|
937
1054
|
for (let e of n) {
|
|
@@ -950,20 +1067,20 @@ function gt(t, n, r, i, a) {
|
|
|
950
1067
|
}
|
|
951
1068
|
return c;
|
|
952
1069
|
}
|
|
953
|
-
var
|
|
1070
|
+
var wt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Tt = (e) => {
|
|
954
1071
|
if (!e) return null;
|
|
955
1072
|
if (typeof e != "string") return M(e);
|
|
956
1073
|
let t = e.replace(/^#/, "");
|
|
957
1074
|
return /^[0-9a-f]{6}$/i.test(t) || /^[0-9a-f]{8}$/i.test(t) ? `#${(t.length === 8 && /^ff/i.test(t) ? t.slice(2) : t).toUpperCase()}` : e;
|
|
958
|
-
},
|
|
1075
|
+
}, Et = (e) => {
|
|
959
1076
|
if (!e) return null;
|
|
960
1077
|
let t = [], n = ((e) => {
|
|
961
1078
|
if (!e) return null;
|
|
962
|
-
if (typeof e == "string") return
|
|
1079
|
+
if (typeof e == "string") return Tt(e);
|
|
963
1080
|
let t = e.type;
|
|
964
1081
|
if (t === u.Type.None) return null;
|
|
965
1082
|
if (t === u.Type.Gradient) return "gradient";
|
|
966
|
-
let n = e, r =
|
|
1083
|
+
let n = e, r = Tt(n.foreground ?? e.color ?? n.background), i = n.patternType;
|
|
967
1084
|
return [i && i !== u.BuiltInSheetPattern.Solid ? `${i} pattern` : null, r].filter(Boolean).join(" ") || null;
|
|
968
1085
|
})(e.fill);
|
|
969
1086
|
n && t.push(`fill ${n}`);
|
|
@@ -971,7 +1088,7 @@ var _t = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, vt = (e) => {
|
|
|
971
1088
|
if (r) {
|
|
972
1089
|
let e = [];
|
|
973
1090
|
(r.weight === void 0 ? !0 === r.bold : r.weight >= 600) && e.push("bold"), (r.style === void 0 ? !0 === r.italic : r.style === d.Style.Italic) && e.push("italic"), r.strike && e.push("strike"), r.underline && r.underline !== d.UnderlineStyle.None && e.push(`underline ${r.underline}`);
|
|
974
|
-
let n = r.color === "auto" ? null :
|
|
1091
|
+
let n = r.color === "auto" ? null : Tt(r.color);
|
|
975
1092
|
n && e.push(`text ${n}`), e.length > 0 && t.push(e.join(" "));
|
|
976
1093
|
}
|
|
977
1094
|
if (e.numberFormat !== void 0 && e.numberFormat !== null) {
|
|
@@ -979,30 +1096,30 @@ var _t = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, vt = (e) => {
|
|
|
979
1096
|
n && t.push(n);
|
|
980
1097
|
}
|
|
981
1098
|
return e.borders && t.push("border"), e.alignment && t.push("alignment"), t.length > 0 ? t.join(" · ") : null;
|
|
982
|
-
},
|
|
983
|
-
let t = e.type ?? c.ColorStopType.Num, n = e.value, r = n == null || n === "" ? t : `${t} ${n}`, i =
|
|
1099
|
+
}, Dt = (e) => {
|
|
1100
|
+
let t = e.type ?? c.ColorStopType.Num, n = e.value, r = n == null || n === "" ? t : `${t} ${n}`, i = Tt(e.color);
|
|
984
1101
|
return i ? `${r} ${i}` : r;
|
|
985
|
-
},
|
|
1102
|
+
}, Ot = (e) => {
|
|
986
1103
|
let t = e.type;
|
|
987
1104
|
if (e.type === c.ScaleType.DataBar) {
|
|
988
|
-
let n =
|
|
1105
|
+
let n = Tt(e.color);
|
|
989
1106
|
n && (t += ` ${n}`);
|
|
990
1107
|
} else e.type === c.ScaleType.IconSet && (e.iconSet && (t += ` ${e.iconSet}`), e.reverse && (t += " reversed"), e.icon?.length && (t += " custom icons"));
|
|
991
|
-
let n = (e.stops ?? []).map(
|
|
1108
|
+
let n = (e.stops ?? []).map(Dt).join(" → ");
|
|
992
1109
|
return n ? `${t} · ${n}` : t;
|
|
993
|
-
},
|
|
1110
|
+
}, kt = "(no rule)", At = (e) => {
|
|
994
1111
|
let t = e.getScale(), n = [];
|
|
995
|
-
if (t) n.push(
|
|
1112
|
+
if (t) n.push(Ot(t));
|
|
996
1113
|
else {
|
|
997
|
-
n.push(e.getCondition()?.toString() ||
|
|
998
|
-
let t =
|
|
1114
|
+
n.push(e.getCondition()?.toString() || kt);
|
|
1115
|
+
let t = Et(e.getStyle());
|
|
999
1116
|
t && n.push(`→ ${t}`);
|
|
1000
1117
|
}
|
|
1001
|
-
return e.isStopIfTrue() && n.push("· stop if true"),
|
|
1002
|
-
},
|
|
1003
|
-
let t = [e.getCondition()?.toString() ||
|
|
1004
|
-
return n && t.push(n), e.isIncludeBlanks() && t.push("blanks allowed"), e.isHideDropdown() && t.push("no dropdown"),
|
|
1005
|
-
},
|
|
1118
|
+
return e.isStopIfTrue() && n.push("· stop if true"), wt(n.join(" "), 90);
|
|
1119
|
+
}, jt = (e) => {
|
|
1120
|
+
let t = [e.getCondition()?.toString() || kt], n = e.getAlertStyle();
|
|
1121
|
+
return n && t.push(n), e.isIncludeBlanks() && t.push("blanks allowed"), e.isHideDropdown() && t.push("no dropdown"), wt(t.join(" · "), 90);
|
|
1122
|
+
}, Mt = (e) => {
|
|
1006
1123
|
if (e?.getOperator()?.getName() !== s.BuiltInOperatorNames.InSet) return null;
|
|
1007
1124
|
let t = e.getParam();
|
|
1008
1125
|
if (!t) return null;
|
|
@@ -1014,17 +1131,17 @@ var _t = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, vt = (e) => {
|
|
|
1014
1131
|
n.push(t > 0 ? `${e.join(", ")}, +${t} more` : e.join(", "));
|
|
1015
1132
|
}
|
|
1016
1133
|
return n.length > 0 ? n.join(", ") : null;
|
|
1017
|
-
},
|
|
1134
|
+
}, Nt = (e, t) => {
|
|
1018
1135
|
if (e.length === 0) return null;
|
|
1019
1136
|
let n = e.slice(0, 3).map(t), r = e.length - n.length;
|
|
1020
1137
|
return r > 0 ? `${n.join(" | ")} | +${r} more` : n.join(" | ");
|
|
1021
|
-
}, R = o.Feature,
|
|
1022
|
-
function
|
|
1138
|
+
}, R = o.Feature, z = (e) => e.getRange().getStyle(), Pt = (e) => D(e.getCell(), w.Mode.Display)?.display ?? null;
|
|
1139
|
+
function Ft(e, t) {
|
|
1023
1140
|
switch (e) {
|
|
1024
1141
|
case R.Formula: return (e) => e.getCell().getFormulaText();
|
|
1025
|
-
case R.Error: return
|
|
1142
|
+
case R.Error: return Pt;
|
|
1026
1143
|
case R.CalcError: return (e) => {
|
|
1027
|
-
let t =
|
|
1144
|
+
let t = Pt(e) ?? "", n = e.getCell().getFormulaText();
|
|
1028
1145
|
return (n ? `${t} ${n}` : t).trim() || null;
|
|
1029
1146
|
};
|
|
1030
1147
|
case R.CalcStatus: return (e) => e.getCell().getCalculationStatus();
|
|
@@ -1034,10 +1151,10 @@ function kt(e, t) {
|
|
|
1034
1151
|
return !1 === t?.constants && (n = n.filter((e) => e.check !== A.ConstantFrequency)), n.length === 0 ? null : n.map((t) => ce(t, e)).join("; ");
|
|
1035
1152
|
}(t, { constants: !1 });
|
|
1036
1153
|
if (!n) return null;
|
|
1037
|
-
let r = t.getFormulaText() ??
|
|
1154
|
+
let r = t.getFormulaText() ?? Pt(e);
|
|
1038
1155
|
return r ? `${n} · here ${r}` : n;
|
|
1039
1156
|
};
|
|
1040
|
-
case R.Merge: return
|
|
1157
|
+
case R.Merge: return Pt;
|
|
1041
1158
|
case R.Comments: return (e) => {
|
|
1042
1159
|
let t = e.getCell().getComments()?.getContent();
|
|
1043
1160
|
if (typeof t != "string") return null;
|
|
@@ -1049,14 +1166,14 @@ function kt(e, t) {
|
|
|
1049
1166
|
return t.getSpillKind() === "error" ? null : t.getSpill()?.getValuesRange().toString() ?? null;
|
|
1050
1167
|
};
|
|
1051
1168
|
case R.Hyperlink: return (e) => e.getCell().getHyperlink()?.getAddress() ?? null;
|
|
1052
|
-
case R.Table: return (e) => e.getCell()
|
|
1053
|
-
case R.Fill: return (e) => ye(
|
|
1054
|
-
case R.Borders: return (e) => be(
|
|
1055
|
-
case R.NumberFormat: return (e) => Ce(
|
|
1056
|
-
case R.Alignment: return t ? (e) => we(
|
|
1057
|
-
case R.Font: return t ? (e) => Te(
|
|
1169
|
+
case R.Table: return (e) => ke(e.getCell())?.getName() ?? null;
|
|
1170
|
+
case R.Fill: return (e) => ye(z(e));
|
|
1171
|
+
case R.Borders: return (e) => be(z(e));
|
|
1172
|
+
case R.NumberFormat: return (e) => Ce(z(e));
|
|
1173
|
+
case R.Alignment: return t ? (e) => we(z(e), t) : void 0;
|
|
1174
|
+
case R.Font: return t ? (e) => Te(z(e), t) : void 0;
|
|
1058
1175
|
case R.Protection: return (e) => {
|
|
1059
|
-
let t =
|
|
1176
|
+
let t = z(e).getProtection(), n = [];
|
|
1060
1177
|
return t.isAlwaysUnlocked() && n.push("always unlocked"), t.isShowFormulas() || n.push("formulas hidden"), n.join(", ") || null;
|
|
1061
1178
|
};
|
|
1062
1179
|
case R.Unlock: return (e) => {
|
|
@@ -1066,111 +1183,21 @@ function kt(e, t) {
|
|
|
1066
1183
|
for (let e of n.getWorksheet().getProtectedRanges().getItems({ address: n })) t.push(`range ${e.getName()}${e.isUnlocked() ? "" : " · password"}`);
|
|
1067
1184
|
return t.join(", ") || null;
|
|
1068
1185
|
};
|
|
1069
|
-
case R.Conditionals: return (e) =>
|
|
1070
|
-
case R.DataValidations: return (e) =>
|
|
1186
|
+
case R.Conditionals: return (e) => Nt(e.getRange().getConditionalFormats(), At);
|
|
1187
|
+
case R.DataValidations: return (e) => Nt(e.getRange().getDataValidations(), jt);
|
|
1071
1188
|
case R.Role: return (e) => e.getCell().getRole();
|
|
1072
|
-
case R.Contentful: return (e) =>
|
|
1189
|
+
case R.Contentful: return (e) => Ke(e.getRange()).join(" ") || null;
|
|
1073
1190
|
default: return;
|
|
1074
1191
|
}
|
|
1075
1192
|
}
|
|
1076
|
-
function
|
|
1077
|
-
let n = e.map((e) =>
|
|
1193
|
+
function It(e, t) {
|
|
1194
|
+
let n = e.map((e) => Ft(e, t)).filter((e) => !!e);
|
|
1078
1195
|
if (n.length !== 0) return n.length === 1 ? n[0] : (e) => {
|
|
1079
1196
|
let t = n.map((t) => t(e)).filter(Boolean);
|
|
1080
1197
|
return t.length > 0 ? t.join(" ") : null;
|
|
1081
1198
|
};
|
|
1082
1199
|
}
|
|
1083
|
-
|
|
1084
|
-
constructor() {
|
|
1085
|
-
this._lines = [], this._headingOffset = 0;
|
|
1086
|
-
}
|
|
1087
|
-
setHeadingOffset(e) {
|
|
1088
|
-
return this._headingOffset = e, this;
|
|
1089
|
-
}
|
|
1090
|
-
_heading(e, t) {
|
|
1091
|
-
return this._lines.push(`${"#".repeat(Math.min(6, e + this._headingOffset))} ${t}`), this;
|
|
1092
|
-
}
|
|
1093
|
-
h1(e) {
|
|
1094
|
-
return this._heading(1, e);
|
|
1095
|
-
}
|
|
1096
|
-
h2(e) {
|
|
1097
|
-
return this._heading(2, e);
|
|
1098
|
-
}
|
|
1099
|
-
h3(e) {
|
|
1100
|
-
return this._heading(3, e);
|
|
1101
|
-
}
|
|
1102
|
-
text(e) {
|
|
1103
|
-
return this._lines.push(e), this;
|
|
1104
|
-
}
|
|
1105
|
-
blank() {
|
|
1106
|
-
return this._lines.push(""), this;
|
|
1107
|
-
}
|
|
1108
|
-
bullet(e) {
|
|
1109
|
-
return typeof e == "string" ? this._lines.push(`- ${e}`) : e.forEach((e) => this._lines.push(`- ${e}`)), this;
|
|
1110
|
-
}
|
|
1111
|
-
fact(e) {
|
|
1112
|
-
return typeof e == "string" ? this._lines.push(` ${e}`) : e.forEach((e) => this._lines.push(` ${e}`)), this;
|
|
1113
|
-
}
|
|
1114
|
-
bold(e) {
|
|
1115
|
-
return `**${e}**`;
|
|
1116
|
-
}
|
|
1117
|
-
codespan(e) {
|
|
1118
|
-
return `\`${e}\``;
|
|
1119
|
-
}
|
|
1120
|
-
code(e, t = "") {
|
|
1121
|
-
return `\`\`\`${t}\n${e}\n\`\`\``;
|
|
1122
|
-
}
|
|
1123
|
-
beginFrame(e) {
|
|
1124
|
-
return new jt(this, e);
|
|
1125
|
-
}
|
|
1126
|
-
_addLines(e) {
|
|
1127
|
-
this._lines.push(...e);
|
|
1128
|
-
}
|
|
1129
|
-
toLines() {
|
|
1130
|
-
return [...this._lines];
|
|
1131
|
-
}
|
|
1132
|
-
}, jt = class {
|
|
1133
|
-
constructor(e, t) {
|
|
1134
|
-
this._parent = e, this._headers = t, this._indexWidth = 0, this._rows = [], this._colWidths = t.map((e) => e.length);
|
|
1135
|
-
}
|
|
1136
|
-
addRow(e, t) {
|
|
1137
|
-
let n = e.map((e) => typeof e == "string" ? { text: e } : e);
|
|
1138
|
-
return n.forEach((e, t) => {
|
|
1139
|
-
this._colWidths[t] = Math.max(this._colWidths[t] ?? 0, e.text.length);
|
|
1140
|
-
}), t !== void 0 && (this._indexWidth = Math.max(this._indexWidth, t.length)), this._rows.push({
|
|
1141
|
-
index: t,
|
|
1142
|
-
cells: n
|
|
1143
|
-
}), this;
|
|
1144
|
-
}
|
|
1145
|
-
endFrame() {
|
|
1146
|
-
return this._parent._addLines(this._renderLines()), this._parent;
|
|
1147
|
-
}
|
|
1148
|
-
_columnAlignment(e) {
|
|
1149
|
-
let t = 0, n = 0;
|
|
1150
|
-
for (let r of this._rows) {
|
|
1151
|
-
let i = r.cells[e];
|
|
1152
|
-
i && i.text && (n++, i.alignment === "right" && t++);
|
|
1153
|
-
}
|
|
1154
|
-
return n > 0 && 2 * t >= n ? "right" : void 0;
|
|
1155
|
-
}
|
|
1156
|
-
_renderLines() {
|
|
1157
|
-
let e = this._indexWidth > 0 ? " ".repeat(this._indexWidth) : "", t = this._colWidths.map((e, t) => this._columnAlignment(t)), n = [];
|
|
1158
|
-
if (this._headers.some((e) => e.length > 0)) {
|
|
1159
|
-
let r = this._headers.map((e, n) => Mt(e, this._colWidths[n], t[n])).join(" ");
|
|
1160
|
-
n.push(`${e}${e ? " " : ""}${r}`.trimEnd());
|
|
1161
|
-
}
|
|
1162
|
-
for (let e of this._rows) {
|
|
1163
|
-
let t = e.cells.map((e, t) => Mt(e.text, this._colWidths[t], e.alignment)).join(" "), r = this._indexWidth > 0 ? (e.index ?? "").padStart(this._indexWidth) + " " : "";
|
|
1164
|
-
n.push(`${r}${t}`.trimEnd());
|
|
1165
|
-
}
|
|
1166
|
-
return n;
|
|
1167
|
-
}
|
|
1168
|
-
}, Mt = (e, t, n) => {
|
|
1169
|
-
if (e.length >= t) return e;
|
|
1170
|
-
let r = t - e.length;
|
|
1171
|
-
return n === "right" ? e.padStart(t) : n === "center" ? " ".repeat(Math.floor(r / 2)) + e + " ".repeat(Math.ceil(r / 2)) : e.padEnd(t);
|
|
1172
|
-
};
|
|
1173
|
-
function Nt(e, t, n) {
|
|
1200
|
+
function Lt(e, t, n) {
|
|
1174
1201
|
let r = n?.collapse ? function(e, t) {
|
|
1175
1202
|
let n = [], r = /* @__PURE__ */ new Map();
|
|
1176
1203
|
for (let i of e) {
|
|
@@ -1184,12 +1211,12 @@ function Nt(e, t, n) {
|
|
|
1184
1211
|
for (let t = 0; t < o.length; t++) {
|
|
1185
1212
|
let i = o[t], a = n?.payload?.(i), s = i.isClipped() ? " ✂ clipped at the query edge — the block continues" : "", p = ` ${c[t].padEnd(l)} ${u[t].padEnd(d)}`;
|
|
1186
1213
|
if (t < f) {
|
|
1187
|
-
let t =
|
|
1214
|
+
let t = Pe(i, n);
|
|
1188
1215
|
if (e.text(`${p} ${t.summary}${s}`), !1 === n?.series) continue;
|
|
1189
1216
|
for (let n of t.series) e.text(` ${n}`);
|
|
1190
1217
|
continue;
|
|
1191
1218
|
}
|
|
1192
|
-
let m = r ?
|
|
1219
|
+
let m = r ? zt(r[t]) : "";
|
|
1193
1220
|
e.text(a ? `${p} ${a}${m}${s}` : `${p}${m}${s}`.trimEnd());
|
|
1194
1221
|
}
|
|
1195
1222
|
if (f > 0 && o.length > f && e.text(` …${o.length - f} more regions listed but not profiled · profile one with getRange().getStats(), or loop them in code`), s) {
|
|
@@ -1197,55 +1224,28 @@ function Nt(e, t, n) {
|
|
|
1197
1224
|
e.text(` …truncated at ${a} of ${s} · ${o}`);
|
|
1198
1225
|
}
|
|
1199
1226
|
}
|
|
1200
|
-
var
|
|
1201
|
-
function
|
|
1227
|
+
var Rt = 6;
|
|
1228
|
+
function zt(e) {
|
|
1202
1229
|
if (e.length < 2) return "";
|
|
1203
1230
|
let t = e.slice(1);
|
|
1204
|
-
return ` · also at ${t.slice(0,
|
|
1231
|
+
return ` · also at ${t.slice(0, Rt).map((e) => e.toString()).join(", ")}${t.length > Rt ? ` +${t.length - Rt} more` : ""}`;
|
|
1205
1232
|
}
|
|
1206
|
-
var
|
|
1233
|
+
var Bt = (e) => {
|
|
1207
1234
|
let t = e.getCell().getAnomalies();
|
|
1208
1235
|
return t.length > 0 ? JSON.stringify(t.map((e) => [e.check, e.evidence])) : null;
|
|
1209
1236
|
};
|
|
1210
|
-
function
|
|
1211
|
-
let n = [...e], r = e.getFeatures(), i = r.join(", "), a = r.length === 1 && r[0] === o.Feature.Contentful, s = e.getRange().getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, c = new
|
|
1237
|
+
function Vt(e, t) {
|
|
1238
|
+
let n = [...e], r = e.getFeatures(), i = r.join(", "), a = r.length === 1 && r[0] === o.Feature.Contentful, s = e.getRange().getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, c = new F();
|
|
1212
1239
|
c.h1(`Regions — ${i} (${n.length})`);
|
|
1213
1240
|
let l = r.length === 1 && r[0] === o.Feature.Anomalies;
|
|
1214
|
-
return
|
|
1241
|
+
return Lt(c, n, {
|
|
1215
1242
|
...t,
|
|
1216
1243
|
profile: a,
|
|
1217
|
-
payload: a ? void 0 :
|
|
1218
|
-
collapse: l ?
|
|
1244
|
+
payload: a ? void 0 : It(r, s),
|
|
1245
|
+
collapse: l ? Bt : void 0
|
|
1219
1246
|
}), c.toLines().join("\n").trimEnd();
|
|
1220
1247
|
}
|
|
1221
|
-
|
|
1222
|
-
let n = [...t], r = e.getDescription();
|
|
1223
|
-
r && n.push(["description", r]), n.push(["columns", e.getColumns().map((e) => e.getName()).join(", ")]), n.push(["headers", e.isShowHeaders() ? "shown" : "hidden"]), n.push(["totals", e.isShowTotals() ? "shown" : "hidden"]);
|
|
1224
|
-
let i = Math.max(10, ...n.map(([e]) => e.length + 2));
|
|
1225
|
-
return n.map(([e, t]) => `${e.padEnd(i)}${t}`);
|
|
1226
|
-
}
|
|
1227
|
-
function zt(e, t, n) {
|
|
1228
|
-
if (t.length === 0) return;
|
|
1229
|
-
let r = t.map((e) => {
|
|
1230
|
-
let t = e.getRange();
|
|
1231
|
-
return {
|
|
1232
|
-
table: e,
|
|
1233
|
-
address: t.toString(),
|
|
1234
|
-
size: `${t.getRowCount()}×${t.getColumnCount()}`
|
|
1235
|
-
};
|
|
1236
|
-
}), i = Math.max(...r.map((e) => e.address.length)), a = Math.max(...r.map((e) => e.size.length));
|
|
1237
|
-
e.h2(`Tables (${n} cell${n === 1 ? "" : "s"} · ${t.length} table${t.length === 1 ? "" : "s"})`);
|
|
1238
|
-
for (let t of r) {
|
|
1239
|
-
e.text(` ${t.address.padEnd(i)} ${t.size.padEnd(a)} ${t.table.getName()}`);
|
|
1240
|
-
for (let n of Rt(t.table)) e.text(` ${n}`);
|
|
1241
|
-
}
|
|
1242
|
-
e.blank();
|
|
1243
|
-
}
|
|
1244
|
-
function Bt(e) {
|
|
1245
|
-
let t = new z();
|
|
1246
|
-
return t.h1(`Table — ${e.getName()}`), t.fact(Rt(e, [["range", qt(e.getRange())]])), t.toLines().join("\n").trimEnd();
|
|
1247
|
-
}
|
|
1248
|
-
var B = o.Feature, Vt = [
|
|
1248
|
+
var B = o.Feature, Ht = [
|
|
1249
1249
|
B.Error,
|
|
1250
1250
|
B.CalcError,
|
|
1251
1251
|
B.Anomalies,
|
|
@@ -1263,8 +1263,8 @@ var B = o.Feature, Vt = [
|
|
|
1263
1263
|
B.Alignment,
|
|
1264
1264
|
B.Conditionals,
|
|
1265
1265
|
B.DataValidations
|
|
1266
|
-
],
|
|
1267
|
-
function
|
|
1266
|
+
], Ut = new Map(Object.entries(B).map(([e, t]) => [t, e])), Wt = (e) => Ut.get(e) ?? e;
|
|
1267
|
+
function Gt(e) {
|
|
1268
1268
|
let t = new Map(Object.values(B).map((e) => [e.toLowerCase(), e])), n = [];
|
|
1269
1269
|
for (let r of e.split(",")) {
|
|
1270
1270
|
let e = r.trim();
|
|
@@ -1275,7 +1275,7 @@ function Wt(e) {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
return n;
|
|
1277
1277
|
}
|
|
1278
|
-
var
|
|
1278
|
+
var Kt = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, V = (t) => e.sheetNameToString(t) ?? "Untitled", H = (e) => `wb.getWorksheet(${JSON.stringify(e.getWorksheet().getName())})`, U = (e) => ((e) => {
|
|
1279
1279
|
if (!e.includes("$")) return e;
|
|
1280
1280
|
let t = "", n = !1;
|
|
1281
1281
|
for (let r of e) {
|
|
@@ -1284,15 +1284,15 @@ var Gt = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, V
|
|
|
1284
1284
|
t += r;
|
|
1285
1285
|
}
|
|
1286
1286
|
return t;
|
|
1287
|
-
})(e.getAddress()),
|
|
1288
|
-
let t =
|
|
1287
|
+
})(e.getAddress()), W = (e) => {
|
|
1288
|
+
let t = U(e);
|
|
1289
1289
|
return t.includes("!") ? t : `${V(e.getWorksheet().getName())}!${t}`;
|
|
1290
1290
|
}, qt = (e) => {
|
|
1291
1291
|
let t = e.toString();
|
|
1292
1292
|
return `${t.includes("!") ? t : `${V(e.getWorksheet().getName())}!${t}`}, ${e.getRowCount()}×${e.getColumnCount()}`;
|
|
1293
1293
|
};
|
|
1294
1294
|
function Jt(e, t) {
|
|
1295
|
-
let n =
|
|
1295
|
+
let n = vt(t, [...t.getRegions(B.Formula)]), r = t.getStats({ onError: "ignore" }).getCount();
|
|
1296
1296
|
e.h2(`Kind (${r} cell${r === 1 ? "" : "s"} · ${n.length} kind${n.length === 1 ? "" : "s"})`);
|
|
1297
1297
|
for (let [t, r] of n) e.text(` ${t.padEnd(10)}${r}`);
|
|
1298
1298
|
n.length === 0 && e.fact("None"), e.blank();
|
|
@@ -1334,35 +1334,35 @@ function Xt(e, t) {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
}
|
|
1336
1336
|
function Zt(e, t, n) {
|
|
1337
|
-
let r = t.getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, i = n?.features === void 0 ? null : new Set(typeof n.features == "string" ? [n.features] : n.features), a =
|
|
1337
|
+
let r = t.getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, i = n?.features === void 0 ? null : new Set(typeof n.features == "string" ? [n.features] : n.features), a = Ht.filter((e) => !i || i.has(e));
|
|
1338
1338
|
if (a.length === 0) return;
|
|
1339
1339
|
let o = t.getCounts(a), s, c = () => s ??= [...t.getWorksheet().getEntireRange().getRegions(B.Contentful)].map((e) => e.getCoords());
|
|
1340
1340
|
for (let i of a) {
|
|
1341
1341
|
let a = i === B.Contentful ? tn(t) : [...t.getRegions(i)], s = o[i] ?? 0, l = null;
|
|
1342
1342
|
if (i === B.Anomalies && (l = a, a = a.filter((e) => !me(e.getCell().getAnomalies())), s = a.reduce((e, t) => e + t.getRowCount() * t.getColumnCount(), 0)), a.length === 0) {
|
|
1343
1343
|
l && en(e, t, l);
|
|
1344
|
-
let n = r && i !== B.Font ?
|
|
1345
|
-
n && (e.h2(`${
|
|
1344
|
+
let n = r && i !== B.Font ? yt(i, r) : null;
|
|
1345
|
+
n && (e.h2(`${Wt(i)} (${nn(0, 0)})`), e.text(` ${"normal".padEnd(10)}${n}`), e.blank());
|
|
1346
1346
|
continue;
|
|
1347
1347
|
}
|
|
1348
|
-
let u = !!n?.profile && i === B.Contentful, d = `${H(t)}.getRegions(${JSON.stringify(i)})`, f = `${d} lists all ${a.length}`, p =
|
|
1348
|
+
let u = !!n?.profile && i === B.Contentful, d = `${H(t)}.getRegions(${JSON.stringify(i)})`, f = `${d} lists all ${a.length}`, p = ht(i) ? gt(t.getWorksheet(), i, r, {
|
|
1349
1349
|
recovery: f,
|
|
1350
1350
|
content: c()
|
|
1351
|
-
}) : null, m = i === B.Formula ?
|
|
1352
|
-
if (e.h2(`${
|
|
1351
|
+
}) : null, m = i === B.Formula ? _t(a, { recovery: f }) : null, h = p ? `${nn(a.length, p.cells)} · ${p.distinct} distinct` : m ? `${nn(a.length, s)} · ${m.distinct} distinct` : nn(a.length, s);
|
|
1352
|
+
if (e.h2(`${Wt(i)} (${h})`), p) {
|
|
1353
1353
|
p.normal && e.text(` ${"normal".padEnd(10)}${p.normal}`);
|
|
1354
1354
|
for (let t of p.tiers) e.text(` ${t}`);
|
|
1355
1355
|
for (let t of p.attributes) e.text(` ${t}`);
|
|
1356
1356
|
e.text(` ${"regions".padEnd(10)}${d}`), e.blank();
|
|
1357
1357
|
} else {
|
|
1358
1358
|
if (m) for (let t of m.lines) e.text(` ${t}`);
|
|
1359
|
-
i === B.Contentful && a.sort((e, t) => t.getRowCount() * t.getColumnCount() - e.getRowCount() * e.getColumnCount()),
|
|
1359
|
+
i === B.Contentful && a.sort((e, t) => t.getRowCount() * t.getColumnCount() - e.getRowCount() * e.getColumnCount()), Lt(e, a, {
|
|
1360
1360
|
maxRegions: n?.maxRegions,
|
|
1361
1361
|
maxProfiled: n?.maxProfiled,
|
|
1362
1362
|
profile: u,
|
|
1363
1363
|
series: !1,
|
|
1364
|
-
payload: u ? void 0 :
|
|
1365
|
-
collapse: i === B.Anomalies ?
|
|
1364
|
+
payload: u ? void 0 : Ft(i, r),
|
|
1365
|
+
collapse: i === B.Anomalies ? Bt : void 0,
|
|
1366
1366
|
recovery: f
|
|
1367
1367
|
}), e.blank(), l && en(e, t, l);
|
|
1368
1368
|
}
|
|
@@ -1583,7 +1583,7 @@ function gn(e) {
|
|
|
1583
1583
|
function _n(e, t, n, r) {
|
|
1584
1584
|
if (n.length === 0) return;
|
|
1585
1585
|
let i = n.length > 50 ? n.slice(0, 50) : n, a = i.map((e) => ({
|
|
1586
|
-
address: rn(
|
|
1586
|
+
address: rn(U(e.getRanges()), 40),
|
|
1587
1587
|
rule: r(e)
|
|
1588
1588
|
}));
|
|
1589
1589
|
e.h2(`${t} (${n.length})`);
|
|
@@ -1618,12 +1618,12 @@ async function yn(e, t) {
|
|
|
1618
1618
|
let r = t.getColumnHeaders(), i = t.getRowHeaders();
|
|
1619
1619
|
hn(e, "Hidden Columns", r), hn(e, "Hidden Rows", i);
|
|
1620
1620
|
let a = t.getTables();
|
|
1621
|
-
a.length > 0 &&
|
|
1621
|
+
a.length > 0 && je(e, a, t.getCounts([B.Table])[B.Table] ?? 0);
|
|
1622
1622
|
}
|
|
1623
1623
|
var bn = "#REF!", xn = (e) => {
|
|
1624
1624
|
let t = e.getContent();
|
|
1625
1625
|
return t.getType() === "chart" && typeof t.getSeries == "function" ? t : null;
|
|
1626
|
-
}, Sn = (t, n) => `${V(t.getName())}!${e.rangeToString(n) ?? ""}`, Cn = (e, t) => e ? Sn(e.getWorksheet(), e.getCoords()) : t,
|
|
1626
|
+
}, Sn = (t, n) => `${V(t.getName())}!${e.rangeToString(n) ?? ""}`, Cn = (e, t) => e ? Sn(e.getWorksheet(), e.getCoords()) : t, G = (e) => e.replace(/\s*[\r\n]+\s*/g, " ⏎ ").trim(), wn = (e, t) => ({
|
|
1627
1627
|
colStart: Math.min(e.colStart, t.colStart),
|
|
1628
1628
|
rowStart: Math.min(e.rowStart, t.rowStart),
|
|
1629
1629
|
colEnd: Math.max(e.colEnd, t.colEnd),
|
|
@@ -1679,7 +1679,7 @@ function kn(e) {
|
|
|
1679
1679
|
n && t.push(n);
|
|
1680
1680
|
let r = e.getChartTitle();
|
|
1681
1681
|
var i, a;
|
|
1682
|
-
r && t.push(`"${i =
|
|
1682
|
+
r && t.push(`"${i = G(r), a = 40, i.length > a ? `${i.slice(0, a - 1)}…` : i}"`);
|
|
1683
1683
|
let o = e.getSeries();
|
|
1684
1684
|
if (o.length > 0) {
|
|
1685
1685
|
t.push(`${o.length} series`);
|
|
@@ -1692,7 +1692,7 @@ function kn(e) {
|
|
|
1692
1692
|
}
|
|
1693
1693
|
function An(e) {
|
|
1694
1694
|
let t = [], n = e.getChartTitle();
|
|
1695
|
-
n && t.push(["title", `"${
|
|
1695
|
+
n && t.push(["title", `"${G(n)}"`]);
|
|
1696
1696
|
let r = e.getSeries();
|
|
1697
1697
|
if (r.length === 0) return t;
|
|
1698
1698
|
let i = e.getPivotSource(), a = i ? null : Tn(r);
|
|
@@ -1711,7 +1711,7 @@ var jn = (e) => On(e) ?? "", Mn = {
|
|
|
1711
1711
|
billions: "billions",
|
|
1712
1712
|
trillions: "trillions"
|
|
1713
1713
|
}, Nn = (e) => {
|
|
1714
|
-
let t = e.getTitle().getText(), n = [t ? `"${
|
|
1714
|
+
let t = e.getTitle().getText(), n = [t ? `"${G(t)}"` : "no title"], r = e.getNumberFormat();
|
|
1715
1715
|
if (r && r !== "General" && n.push(`format ${r}`), e.getKind() === "value") {
|
|
1716
1716
|
e.getMinimum() === null || e.isMinimumAuto() || n.push(`min ${e.getMinimum()}`), e.getMaximum() === null || e.isMaximumAuto() || n.push(`max ${e.getMaximum()}`), e.getMajorUnit() === null || e.isMajorUnitAuto() || n.push(`unit ${e.getMajorUnit()}`), e.getScaleType() === "logarithmic" && n.push(`log base ${e.getLogBase()}`);
|
|
1717
1717
|
let t = e.getDisplayUnit();
|
|
@@ -1728,7 +1728,7 @@ function Fn(e, t) {
|
|
|
1728
1728
|
let n = On(t);
|
|
1729
1729
|
e.fact("Type: chart" + (n ? ` — ${n}` : ""));
|
|
1730
1730
|
let r = t.getChartTitle(), i = !r && t.getTitle().getVisible() ? t.getTitle().getText() : null;
|
|
1731
|
-
e.fact("Title: " + (r ? `"${
|
|
1731
|
+
e.fact("Title: " + (r ? `"${G(r)}"` : i ? `"${G(i)}" (automatic)` : "(none)"));
|
|
1732
1732
|
let a = t.getLegend();
|
|
1733
1733
|
e.fact(`Legend: ${a.getVisible() ? a.getPosition() : "(none)"}`);
|
|
1734
1734
|
let o = t.getSeries(), s = t.getPivotSource();
|
|
@@ -1747,7 +1747,7 @@ function Fn(e, t) {
|
|
|
1747
1747
|
i && r.push(`name ${i}`);
|
|
1748
1748
|
let a = e.getName();
|
|
1749
1749
|
return {
|
|
1750
|
-
name: a ?
|
|
1750
|
+
name: a ? G(a) : "(unnamed)",
|
|
1751
1751
|
type: e.isSecondaryAxis() ? `${e.getChartType()} · secondary axis` : e.getChartType(),
|
|
1752
1752
|
source: r.join(" · ")
|
|
1753
1753
|
};
|
|
@@ -2021,7 +2021,7 @@ function pr(e) {
|
|
|
2021
2021
|
function mr(e) {
|
|
2022
2022
|
let t = e.getMovable();
|
|
2023
2023
|
if (t) return gr(t, "Shape");
|
|
2024
|
-
let n = new
|
|
2024
|
+
let n = new F();
|
|
2025
2025
|
return n.h1(`Shape — ${e.getName() || "(unnamed)"}`), n.blank(), qn(n, e), n.toLines().join("\n").trimEnd();
|
|
2026
2026
|
}
|
|
2027
2027
|
var hr = (e) => {
|
|
@@ -2029,7 +2029,7 @@ var hr = (e) => {
|
|
|
2029
2029
|
return !0 === t?.isIShape ? t : null;
|
|
2030
2030
|
};
|
|
2031
2031
|
function gr(e, t) {
|
|
2032
|
-
let n = new
|
|
2032
|
+
let n = new F(), i = e.getRange(), a = e.getContent(), o = a.getType(), s = hr(e);
|
|
2033
2033
|
n.h1(`${t} — ${qt(i)}`), n.blank(), n.fact(`Name: ${e.getContent().getName?.() || "(unnamed)"}`);
|
|
2034
2034
|
let c = xn(e);
|
|
2035
2035
|
c ? Fn(n, c) : n.fact(`Type: ${o}`);
|
|
@@ -2040,7 +2040,7 @@ function gr(e, t) {
|
|
|
2040
2040
|
let d = e.getParent();
|
|
2041
2041
|
d && n.fact(`Group: ${d.getContent().getName?.() || "(unnamed)"}`);
|
|
2042
2042
|
let f = e.getContent().getDescription();
|
|
2043
|
-
f && n.fact(`Alt Text: ${er(f)}`), n.fact(`Anchor: ${
|
|
2043
|
+
f && n.fact(`Alt Text: ${er(f)}`), n.fact(`Anchor: ${Kt(i)}, ${((e) => {
|
|
2044
2044
|
switch (e) {
|
|
2045
2045
|
case r.Type.Absolute: return "absolute — stays put when rows or columns move";
|
|
2046
2046
|
case r.Type.OneCell: return "oneCell — moves with the cells, keeps its size";
|
|
@@ -2124,22 +2124,22 @@ var _r = (e) => e.getVisibility() === "visible", vr = (e, t, n) => {
|
|
|
2124
2124
|
}
|
|
2125
2125
|
default: return null;
|
|
2126
2126
|
}
|
|
2127
|
-
}, br = /* @__PURE__ */ new Map([["hyperlink", o.Feature.Hyperlink], ["numberFormat", o.Feature.NumberFormat]]),
|
|
2127
|
+
}, br = /* @__PURE__ */ new Map([["hyperlink", o.Feature.Hyperlink], ["numberFormat", o.Feature.NumberFormat]]), K = (e, t) => t && t.trim() !== "" ? [{
|
|
2128
2128
|
field: e,
|
|
2129
2129
|
text: {
|
|
2130
2130
|
match: t,
|
|
2131
2131
|
display: t
|
|
2132
2132
|
}
|
|
2133
|
-
}] : [], xr = (e) => [...
|
|
2133
|
+
}] : [], xr = (e) => [...K("comment", e.getContent()), ...e.getReplies().flatMap((e) => K("comment", e.getContent()))], Sr = (e, t) => {
|
|
2134
2134
|
let n = xn(e);
|
|
2135
2135
|
if (n) return t.includes("chart") ? [
|
|
2136
|
-
...
|
|
2137
|
-
...n.getAxes().getItems().flatMap((e) =>
|
|
2138
|
-
...n.getSeries().flatMap((e) => e.getNameFormula() === null ?
|
|
2139
|
-
...
|
|
2136
|
+
...K("chart", n.getChartTitle()),
|
|
2137
|
+
...n.getAxes().getItems().flatMap((e) => K("chart", e.getTitle().getText())),
|
|
2138
|
+
...n.getSeries().flatMap((e) => e.getNameFormula() === null ? K("chart", e.getName()) : []),
|
|
2139
|
+
...K("chart", e.getContent().getDescription())
|
|
2140
2140
|
] : [];
|
|
2141
2141
|
let r = rr(e);
|
|
2142
|
-
return r !== null && t.includes("shape") ? [...
|
|
2142
|
+
return r !== null && t.includes("shape") ? [...K("shape", r), ...K("shape", e.getContent().getDescription())] : [];
|
|
2143
2143
|
}, Cr = (e) => {
|
|
2144
2144
|
let t = e.isIFormula ? `=${e.getExpression()}` : null, n = t ?? e.getRanges?.()?.getAddress() ?? e.getName();
|
|
2145
2145
|
return [
|
|
@@ -2150,8 +2150,8 @@ var _r = (e) => e.getVisibility() === "visible", vr = (e, t, n) => {
|
|
|
2150
2150
|
display: n
|
|
2151
2151
|
}
|
|
2152
2152
|
},
|
|
2153
|
-
...t ?
|
|
2154
|
-
...
|
|
2153
|
+
...t ? K("name", t) : [],
|
|
2154
|
+
...K("name", e.getComment())
|
|
2155
2155
|
];
|
|
2156
2156
|
}, wr = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd, Tr = (e, t) => {
|
|
2157
2157
|
let n = e.getRanges?.() ?? null;
|
|
@@ -2170,7 +2170,7 @@ var _r = (e) => e.getVisibility() === "visible", vr = (e, t, n) => {
|
|
|
2170
2170
|
table: e.getName()
|
|
2171
2171
|
});
|
|
2172
2172
|
return { resolve(a, o) {
|
|
2173
|
-
let s = ((e) => e
|
|
2173
|
+
let s = ((e) => ke(e))(a);
|
|
2174
2174
|
if (e === "table") return s ? i(s) : void 0;
|
|
2175
2175
|
if (r === null) {
|
|
2176
2176
|
r = [];
|
|
@@ -2455,7 +2455,7 @@ var Fr = {
|
|
|
2455
2455
|
],
|
|
2456
2456
|
run: Or,
|
|
2457
2457
|
render: Pr
|
|
2458
|
-
}, Ir = (e) => !e.deprecated && !e.hidden,
|
|
2458
|
+
}, Ir = (e) => !e.deprecated && !e.hidden, q = (e) => (e.members ?? []).filter(Ir), Lr = [
|
|
2459
2459
|
{
|
|
2460
2460
|
match: /^(get|set)?(number)?(format|numfmt)s?$/i,
|
|
2461
2461
|
relies: ["ICellStyle", "setNumberFormat"],
|
|
@@ -2524,9 +2524,9 @@ function Ur(e, t, n) {
|
|
|
2524
2524
|
return {
|
|
2525
2525
|
text: n,
|
|
2526
2526
|
key: r,
|
|
2527
|
-
memberCount: r ?
|
|
2527
|
+
memberCount: r ? q(e.types[r]).length : 0
|
|
2528
2528
|
};
|
|
2529
|
-
}), a =
|
|
2529
|
+
}), a = q(r), o = n?.toLowerCase();
|
|
2530
2530
|
return {
|
|
2531
2531
|
kind: "type",
|
|
2532
2532
|
key: t,
|
|
@@ -2580,7 +2580,7 @@ function Gr(e, t) {
|
|
|
2580
2580
|
}
|
|
2581
2581
|
if (a) {
|
|
2582
2582
|
let n = function(e, t, n, r) {
|
|
2583
|
-
let i = r.toLowerCase(), a = Object.entries(e.types).flatMap(([e, t]) =>
|
|
2583
|
+
let i = r.toLowerCase(), a = Object.entries(e.types).flatMap(([e, t]) => q(t).filter((e) => e.name.toLowerCase() === i).map((t) => ({
|
|
2584
2584
|
key: e,
|
|
2585
2585
|
member: t
|
|
2586
2586
|
}))), o = Lr.filter((t) => t.match.test(r) && e.types[t.relies[0]]?.members?.some((e) => e.name === t.relies[1])).map((e) => e.hint), s = n ? [] : function(e, t, n) {
|
|
@@ -2629,7 +2629,7 @@ function Gr(e, t) {
|
|
|
2629
2629
|
let n = t.toLowerCase(), r = [], i = [];
|
|
2630
2630
|
for (let [t, a] of Object.entries(e.types)) if (Ir(a)) {
|
|
2631
2631
|
zr(t).toLowerCase().includes(n) && r.push(t);
|
|
2632
|
-
for (let e of
|
|
2632
|
+
for (let e of q(a)) e.name.toLowerCase().includes(n) && i.push({
|
|
2633
2633
|
key: t,
|
|
2634
2634
|
member: e
|
|
2635
2635
|
});
|
|
@@ -2679,7 +2679,7 @@ function Xr(e, t) {
|
|
|
2679
2679
|
i.add(t);
|
|
2680
2680
|
let o = e.types[t];
|
|
2681
2681
|
if (o) {
|
|
2682
|
-
for (let e of
|
|
2682
|
+
for (let e of q(o)) r.has(e.name) || (r.add(e.name), n.push(e));
|
|
2683
2683
|
for (let n of o.extends ?? []) {
|
|
2684
2684
|
let r = Vr(e, t, n);
|
|
2685
2685
|
r && a(r);
|
|
@@ -2735,7 +2735,7 @@ function ei(e, t, n) {
|
|
|
2735
2735
|
}
|
|
2736
2736
|
s.push(`\`${n} ${c}\` lists all ${r.length} members.`);
|
|
2737
2737
|
} else if (a) {
|
|
2738
|
-
let t = Object.entries(e.types).filter(([, e]) =>
|
|
2738
|
+
let t = Object.entries(e.types).filter(([, e]) => q(e).some((e) => e.name === o)).map(([e]) => e);
|
|
2739
2739
|
if (t.length > 0) {
|
|
2740
2740
|
let e = t.slice(0, 3).join(", "), n = t.length > 3 ? ` and ${t.length - 3} more` : "";
|
|
2741
2741
|
return s.push(`'${o}' is a member of ${e}${n}, not of the object it was called on.`), s.join("\n");
|
|
@@ -2753,7 +2753,7 @@ function ei(e, t, n) {
|
|
|
2753
2753
|
}
|
|
2754
2754
|
return s.length > 0 ? s.join("\n") : null;
|
|
2755
2755
|
}
|
|
2756
|
-
var
|
|
2756
|
+
var J = (e, t, n = `${t}s`) => `${e.toLocaleString("en-US")} ${e === 1 ? t : n}`;
|
|
2757
2757
|
function ti(e, t) {
|
|
2758
2758
|
let n = t ? `${t} · ` : "", r = e.summary ? ` — ${e.summary}` : "", i = e.deprecated ? " (deprecated)" : "";
|
|
2759
2759
|
return `- ${n}\`${a = e.signature, a.replace(/;$/, "")}\`${i}${r}`;
|
|
@@ -2764,26 +2764,26 @@ function ni(e, t) {
|
|
|
2764
2764
|
switch (e.kind) {
|
|
2765
2765
|
case "overview": return function(e, t) {
|
|
2766
2766
|
let n = [
|
|
2767
|
-
`# SheetXL scripting API — ${
|
|
2767
|
+
`# SheetXL scripting API — ${J(e.total, "name")}`,
|
|
2768
2768
|
"",
|
|
2769
2769
|
"Where a script starts:"
|
|
2770
2770
|
];
|
|
2771
2771
|
for (let { key: t, entry: r } of e.entryPoints) {
|
|
2772
|
-
let e = r.members ? ` (${q(
|
|
2772
|
+
let e = r.members ? ` (${J(q(r).length, "member")})` : "";
|
|
2773
2773
|
n.push(`- \`${t}\`${e}${r.summary ? ` — ${r.summary}` : ""}`);
|
|
2774
2774
|
}
|
|
2775
2775
|
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");
|
|
2776
2776
|
}(e, n);
|
|
2777
2777
|
case "type": return function(e, t) {
|
|
2778
|
-
let { key: n, entry: r, members: i } = e, a =
|
|
2779
|
-
r.members && o.push(
|
|
2778
|
+
let { key: n, entry: r, members: i } = e, a = q(r).length, o = [r.kind + (r.typeParams ?? "")];
|
|
2779
|
+
r.members && o.push(J(a, "member")), r.deprecated && o.push("deprecated");
|
|
2780
2780
|
let s = [`# ${n} — ${o.join(" · ")}`];
|
|
2781
2781
|
if (r.summary && s.push(r.summary), r.signature && s.push("", "```ts", r.signature, "```"), e.bases.length > 0) {
|
|
2782
2782
|
s.push("");
|
|
2783
|
-
for (let n of e.bases) s.push(n.key ? `Also has everything on \`${n.text}\` (${
|
|
2783
|
+
for (let n of e.bases) s.push(n.key ? `Also has everything on \`${n.text}\` (${J(n.memberCount, "member")}): \`${t} ${n.key}\`` : `Extends \`${n.text}\`.`);
|
|
2784
2784
|
}
|
|
2785
2785
|
if (r.members) {
|
|
2786
|
-
s.push(""), e.filter && s.push(`${
|
|
2786
|
+
s.push(""), e.filter && s.push(`${J(i.length, "member")} of ${a} matching '${e.filter}':`);
|
|
2787
2787
|
for (let e of i) s.push(ti(e));
|
|
2788
2788
|
}
|
|
2789
2789
|
return r.nested && r.nested.length > 0 && !e.filter && s.push("", `Nested types — \`${t} ${n}.<name>\`: ${r.nested.join(", ")}`), s.push("", r.members ? `Full documentation for one member: \`${t} ${n}.<member>\` · scripting.d.ts:${r.lines[0]}-${r.lines[1]}` : `scripting.d.ts:${r.lines[0]}-${r.lines[1]}`), s.join("\n");
|
|
@@ -2806,7 +2806,7 @@ function ni(e, t) {
|
|
|
2806
2806
|
n.push("", "Members:");
|
|
2807
2807
|
for (let { key: t, member: r } of e.members) n.push(ti(r, t));
|
|
2808
2808
|
}
|
|
2809
|
-
return e.omitted > 0 && n.push("", `…and ${
|
|
2809
|
+
return e.omitted > 0 && n.push("", `…and ${J(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");
|
|
2810
2810
|
}(e, n);
|
|
2811
2811
|
case "miss": return function(e, t) {
|
|
2812
2812
|
let { owner: n, text: r } = e, i = [`# ${n.text}.${r} — not in the API`];
|
|
@@ -2821,7 +2821,7 @@ function ni(e, t) {
|
|
|
2821
2821
|
}
|
|
2822
2822
|
for (let t of e.hints) i.push("", t);
|
|
2823
2823
|
if (e.elsewhere.length > 0 && !e.nearestTypes.some((e) => e.hasMember)) {
|
|
2824
|
-
let n = e.elsewhere.map((e) => `\`${e.key}\``).join(", "), a = e.elsewhereOmitted > 0 ? ` and ${
|
|
2824
|
+
let n = e.elsewhere.map((e) => `\`${e.key}\``).join(", "), a = e.elsewhereOmitted > 0 ? ` and ${J(e.elsewhereOmitted, "more")}` : "";
|
|
2825
2825
|
i.push("", `\`${r}\` is a member of ${n}${a}: \`${t} ${e.elsewhere[0].key}.${r}\` prints it.`);
|
|
2826
2826
|
}
|
|
2827
2827
|
return i.push("", n.key ? `\`${t} ${n.key}\` lists everything on the type.` : `\`${t} <Type>\` lists a type's members; \`${t}\` with no name lists where to start.`), i.join("\n");
|
|
@@ -3104,7 +3104,7 @@ function yi(e) {
|
|
|
3104
3104
|
return t;
|
|
3105
3105
|
}
|
|
3106
3106
|
var bi = {
|
|
3107
|
-
features: (e) =>
|
|
3107
|
+
features: (e) => Gt(e),
|
|
3108
3108
|
mode: (e, t) => function(e, t, n) {
|
|
3109
3109
|
let r = new Map(Object.values(n).map((e) => [e.toLowerCase(), e])).get(e.trim().toLowerCase());
|
|
3110
3110
|
if (!r) {
|
|
@@ -3241,9 +3241,9 @@ function Bi(e, t) {
|
|
|
3241
3241
|
e.text(`${i("allowed")}${Mi(n) ?? "none — only the editable cells take a write"}`), !1 === n.getProperties()?.showFormulas && e.text(`${i("formulas")}hidden — a cell reads as a value unless its style shows its formula`);
|
|
3242
3242
|
let a = Fi(t);
|
|
3243
3243
|
if (a.length === 0) return e.text(`${i("editable")}none — every cell refuses a write`), void e.blank();
|
|
3244
|
-
e.text(`${i("editable")}${Ri(Ii(a), "cell")} · ${Ri(a.length, "region")}`),
|
|
3244
|
+
e.text(`${i("editable")}${Ri(Ii(a), "cell")} · ${Ri(a.length, "region")}`), Lt(e, a, {
|
|
3245
3245
|
maxRegions: 12,
|
|
3246
|
-
payload:
|
|
3246
|
+
payload: Ft(Oi.Unlock, null),
|
|
3247
3247
|
recovery: `${H(t.getEntireRange())}.getRegions("unlock") lists all ${a.length}`
|
|
3248
3248
|
}), e.blank();
|
|
3249
3249
|
}
|
|
@@ -3262,7 +3262,7 @@ function Ui(e) {
|
|
|
3262
3262
|
return e?.name === "ProtectedError" ? "`sheet.getProtection()` (`wb.getProtection()` for the workbook) lists what is still allowed; `sheet.getRegions(\"unlock\")` lists the cells that take a write." : null;
|
|
3263
3263
|
}
|
|
3264
3264
|
function Wi(e) {
|
|
3265
|
-
let t = new
|
|
3265
|
+
let t = new F(), n = !0 === e.isIWorksheetProtection;
|
|
3266
3266
|
t.h1(n ? "Sheet Protection" : "Workbook Protection"), t.blank();
|
|
3267
3267
|
let r = ji(e);
|
|
3268
3268
|
t.fact(`State: ${r ?? "not protected"}${e.isReadOnly() ? " · read-only" : ""}`);
|
|
@@ -3277,8 +3277,8 @@ function Wi(e) {
|
|
|
3277
3277
|
return t.toLines().join("\n").trimEnd();
|
|
3278
3278
|
}
|
|
3279
3279
|
function Gi(e) {
|
|
3280
|
-
let t = new
|
|
3281
|
-
t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${
|
|
3280
|
+
let t = new F(), n = e.getRanges();
|
|
3281
|
+
t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${W(n)}`), t.fact(`Cells: ${n.size}`), t.fact("Password: " + (e.hasPassword() ? e.isUnlocked() ? "set · unlocked for this session" : "set · unlock(password) grants access" : "none"));
|
|
3282
3282
|
let r = n.getWorksheet().getProtection().isLocked();
|
|
3283
3283
|
return t.fact("In force: " + (r ? "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();
|
|
3284
3284
|
}
|
|
@@ -3286,7 +3286,7 @@ var Ki = o.Feature;
|
|
|
3286
3286
|
async function qi(e, t) {
|
|
3287
3287
|
let n = e.getWorksheet().getRange(e.getCoords());
|
|
3288
3288
|
e = n.getCell();
|
|
3289
|
-
let r = new
|
|
3289
|
+
let r = new F();
|
|
3290
3290
|
r.h1(`Cell — ${V(e.getWorksheet().getName())}!${e.getAddress()}`), r.blank();
|
|
3291
3291
|
let i = !!e.getFormulaText(), o = e.getType();
|
|
3292
3292
|
(function(e, t) {
|
|
@@ -3314,7 +3314,7 @@ async function qi(e, t) {
|
|
|
3314
3314
|
}
|
|
3315
3315
|
let l = t.getSpill();
|
|
3316
3316
|
l && e.fact(`Spill: ${l.toString()}${t.getSpillKind() === "error" ? " (blocked)" : ""}`), t.isSpillOverflow() && e.fact("Spill Overflow: true — the anchor formula is elsewhere");
|
|
3317
|
-
let u = t
|
|
3317
|
+
let u = ke(t);
|
|
3318
3318
|
u && e.fact(`Table: ${function(e, t) {
|
|
3319
3319
|
let n = e.getRange().getCoords(), r = [`${e.getName()} (${e.getRange().getAddress()})`], i = e.getColumnAt(t.colIndex - n.colStart);
|
|
3320
3320
|
if (i && r.push(`column ${JSON.stringify(i.getName())}`), e.isShowHeaders() && t.rowIndex === n.rowStart) r.push("header row");
|
|
@@ -3326,7 +3326,7 @@ async function qi(e, t) {
|
|
|
3326
3326
|
return r.join(" · ");
|
|
3327
3327
|
}(u, t.getCoords())}`);
|
|
3328
3328
|
let d = vn(t.getWorksheet().getRange(t.getCoords()));
|
|
3329
|
-
d.length > 0 && e.fact(`Names: ${d.map((e) => `${e.getName()} (${
|
|
3329
|
+
d.length > 0 && e.fact(`Names: ${d.map((e) => `${e.getName()} (${U(e.getRanges())})`).join(" · ")}`);
|
|
3330
3330
|
let f = Hi(t);
|
|
3331
3331
|
f && e.fact(`Editable: ${f}`);
|
|
3332
3332
|
let p = t.getErrors();
|
|
@@ -3337,7 +3337,7 @@ async function qi(e, t) {
|
|
|
3337
3337
|
let m = t.getWarnings();
|
|
3338
3338
|
m.length > 0 && e.fact(`Warnings: ${m.join("; ")}`);
|
|
3339
3339
|
let h = function(e, t) {
|
|
3340
|
-
let n = t.getStyle(), r = t.getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, i = n.getNamed().getName(), a = i === (r?.getNamed().getName() ?? "Normal"), o = n.getNumberFormat(), s =
|
|
3340
|
+
let n = t.getStyle(), r = t.getWorksheet().getWorkbook()?.getStyles().getNormal() ?? null, i = n.getNamed().getName(), a = i === (r?.getNamed().getName() ?? "Normal"), o = n.getNumberFormat(), s = pt(o), c = s ? `${s} ${e.codespan(o)}` : null, l = r ? Te(n, r) : null, u = ye(n), d = Se(n), f = r ? we(n, r) : null, p = [
|
|
3341
3341
|
a ? null : i,
|
|
3342
3342
|
c ? `format ${c}` : null,
|
|
3343
3343
|
l ? `font ${l}` : null,
|
|
@@ -3357,12 +3357,12 @@ async function qi(e, t) {
|
|
|
3357
3357
|
return s && function(e, t, n) {
|
|
3358
3358
|
let r = t.getCoords(), i = t.getWorksheet();
|
|
3359
3359
|
e.h2(`Current Region — ${n.getAddress()} · ${n.getRowCount()}×${n.getColumnCount()}`);
|
|
3360
|
-
let a =
|
|
3360
|
+
let a = Le(n), o = (e) => {
|
|
3361
3361
|
if (!a || a.byColumn !== (e === "row")) return null;
|
|
3362
3362
|
let t = e === "row" ? r.rowIndex : r.colIndex;
|
|
3363
3363
|
if (t < a.start) return null;
|
|
3364
3364
|
let n = a.lines.find((e) => e.index === t);
|
|
3365
|
-
if (n?.sums) return `totals, ${
|
|
3365
|
+
if (n?.sums) return `totals, ${Be(n.sums)}`;
|
|
3366
3366
|
let i = a.byColumn ? `row ${a.start + 1}` : `column ${P(a.start)}`;
|
|
3367
3367
|
return t === a.start ? "totals" : `below the totals ${i}`;
|
|
3368
3368
|
}, s = [["row", [
|
|
@@ -3494,12 +3494,12 @@ function Zi(e, t, n, r) {
|
|
|
3494
3494
|
};
|
|
3495
3495
|
}
|
|
3496
3496
|
async function Qi(e, t) {
|
|
3497
|
-
let n = new
|
|
3497
|
+
let n = new F();
|
|
3498
3498
|
n.h1(`Cell Range — ${qt(e)}`);
|
|
3499
3499
|
let r = Vi(e);
|
|
3500
3500
|
r && n.text(`Protection: ${r}`), n.blank(), Jt(n, e), function(e, t, n) {
|
|
3501
3501
|
if (!1 === n?.profile || t.isSingleCell() || !t.isContentful()) return;
|
|
3502
|
-
let r =
|
|
3502
|
+
let r = Pe({
|
|
3503
3503
|
getRowCount: () => t.getRowCount(),
|
|
3504
3504
|
getColumnCount: () => t.getColumnCount(),
|
|
3505
3505
|
getCell: () => t.getCell(),
|
|
@@ -3536,7 +3536,7 @@ async function Qi(e, t) {
|
|
|
3536
3536
|
colStart: _[0],
|
|
3537
3537
|
colEnd: _[_.length - 1]
|
|
3538
3538
|
}), y = `${p} cell${p === 1 ? "" : "s"}`, b = v.toString() !== t.toString();
|
|
3539
|
-
e.h2(`Values (${b ? `${
|
|
3539
|
+
e.h2(`Values (${b ? `${Kt(v)} · ` : ""}${y})`);
|
|
3540
3540
|
let x = e.beginFrame(_.map((e) => u.at(e - c).getText()));
|
|
3541
3541
|
for (let e of h) {
|
|
3542
3542
|
let t = d.get(e);
|
|
@@ -3566,7 +3566,7 @@ async function Qi(e, t) {
|
|
|
3566
3566
|
let n = Math.max(...t.map((e) => e.address.length));
|
|
3567
3567
|
for (let { address: r, valuesRange: i } of t) e.text(` ${r.padEnd(n)} ${i}`);
|
|
3568
3568
|
e.blank();
|
|
3569
|
-
}(n, i.spills), await yn(n, e), dr(n, e.getMovables()), _n(n, "Conditional Formats", e.getConditionalFormats(),
|
|
3569
|
+
}(n, i.spills), await yn(n, e), dr(n, e.getMovables()), _n(n, "Conditional Formats", e.getConditionalFormats(), At), _n(n, "Data Validations", e.getDataValidations(), jt), await oi(n, e, t, {
|
|
3570
3570
|
home: e.getWorksheet(),
|
|
3571
3571
|
subject: e
|
|
3572
3572
|
}), n.toLines().join("\n").trimEnd();
|
|
@@ -3605,31 +3605,31 @@ function ta(e) {
|
|
|
3605
3605
|
return `${c ? `row ${Ee(c)} → ` : "→ "}${o.join(" · ")}`;
|
|
3606
3606
|
}
|
|
3607
3607
|
function na(e) {
|
|
3608
|
-
let t = new
|
|
3609
|
-
t.h1(`Conditional Format — ${
|
|
3608
|
+
let t = new F(), n = e.getRanges();
|
|
3609
|
+
t.h1(`Conditional Format — ${W(n)}`), t.blank(), t.fact(`Order: ${e.getIndex() + 1}`);
|
|
3610
3610
|
let r = e.getScale();
|
|
3611
|
-
if (r) t.fact(`Rule: ${
|
|
3611
|
+
if (r) t.fact(`Rule: ${Ot(r)}`);
|
|
3612
3612
|
else {
|
|
3613
3613
|
let n = e.getCondition();
|
|
3614
3614
|
t.fact(`Rule: ${n?.toString() || "none — this rule tests nothing"}`);
|
|
3615
|
-
let r =
|
|
3615
|
+
let r = Et(e.getStyle());
|
|
3616
3616
|
r && t.fact(`Format: ${r}`);
|
|
3617
3617
|
}
|
|
3618
3618
|
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();
|
|
3619
3619
|
}
|
|
3620
3620
|
function ra(e) {
|
|
3621
|
-
let t = new
|
|
3621
|
+
let t = new F();
|
|
3622
3622
|
t.h1("Counts");
|
|
3623
3623
|
let n = !1;
|
|
3624
3624
|
for (let [r, i] of Object.entries(e)) i > 0 && (t.fact(`${r}: ${i}`), n = !0);
|
|
3625
3625
|
return n || t.fact("None"), t.toLines().join("\n").trimEnd();
|
|
3626
3626
|
}
|
|
3627
3627
|
function ia(e) {
|
|
3628
|
-
let t = new
|
|
3629
|
-
t.h1(`Data Validation — ${
|
|
3628
|
+
let t = new F(), n = e.getRanges();
|
|
3629
|
+
t.h1(`Data Validation — ${W(n)}`), t.blank();
|
|
3630
3630
|
let r = e.getCondition();
|
|
3631
3631
|
t.fact(`Rule: ${r?.toString() || "none — anything is accepted here"}`);
|
|
3632
|
-
let i =
|
|
3632
|
+
let i = Mt(r);
|
|
3633
3633
|
i && t.fact(`Allowed: ${i}`), t.fact("Blanks: " + (e.isIncludeBlanks() ? "allowed" : "rejected"));
|
|
3634
3634
|
let a = e.getAlertStyle();
|
|
3635
3635
|
if (t.fact(`Alert: ${a}${a === l.AlertStyle.Stop ? " — the entry is refused" : " — the entry is accepted anyway"}`), e.isShowAlertMessage()) {
|
|
@@ -3681,7 +3681,7 @@ function pa(e, t, n, r) {
|
|
|
3681
3681
|
return "";
|
|
3682
3682
|
}
|
|
3683
3683
|
async function ma(e, t) {
|
|
3684
|
-
let n = t?.maxTokens ?? 200, r = new
|
|
3684
|
+
let n = t?.maxTokens ?? 200, r = new F(), i = ((e) => e.isINamed ? e : null)(e);
|
|
3685
3685
|
if (r.h1(i ? `Name — ${on(i)}` : "Formula"), r.text(r.codespan("=" + e.getExpression())), r.blank(), i) {
|
|
3686
3686
|
i.isHidden() && r.fact("Hidden: true — not offered in the UI; formulas resolve it normally");
|
|
3687
3687
|
let e = i.getComment();
|
|
@@ -3892,11 +3892,11 @@ function Sa(e, t, n, r) {
|
|
|
3892
3892
|
e.text(e.code(s.join("\n"), t.language)), s.length < o.length && e.text(`…and ${o.length - s.length} more lines · getSource() returns the whole module`);
|
|
3893
3893
|
}
|
|
3894
3894
|
function Ca(e, t) {
|
|
3895
|
-
let n = new
|
|
3895
|
+
let n = new F();
|
|
3896
3896
|
return Sa(n, ya(e), (e) => n.h1(e), t), n.toLines().join("\n").trimEnd();
|
|
3897
3897
|
}
|
|
3898
3898
|
function wa(e, t) {
|
|
3899
|
-
let n = new
|
|
3899
|
+
let n = new F(), r = e.getItems({ language: null }) ?? [];
|
|
3900
3900
|
if (n.h1(`Modules — ${r.length} module${r.length === 1 ? "" : "s"}`), n.blank(), r.length === 0) return n.text("None"), n.toLines().join("\n").trimEnd();
|
|
3901
3901
|
let i = r.map(ya);
|
|
3902
3902
|
xa(n, r, t);
|
|
@@ -3905,7 +3905,7 @@ function wa(e, t) {
|
|
|
3905
3905
|
}
|
|
3906
3906
|
var Ta = [["formula", "Names"], ["table", "Tables"]];
|
|
3907
3907
|
async function Ea(e, t) {
|
|
3908
|
-
let n = new
|
|
3908
|
+
let n = new F(), r = e.getItems({ includeHidden: !0 }) ?? [];
|
|
3909
3909
|
if (n.h1(`Names — ${r.length} item${r.length === 1 ? "" : "s"}`), n.blank(), r.length === 0) return n.text("None"), n.toLines().join("\n").trimEnd();
|
|
3910
3910
|
let i = new Set(Ta.map(([e]) => e));
|
|
3911
3911
|
for (let [e, i] of Ta) await mn(n, r.filter((t) => t.getType() === e), {
|
|
@@ -3974,7 +3974,7 @@ function za(e) {
|
|
|
3974
3974
|
let i = Ma(t);
|
|
3975
3975
|
i && n.push(i);
|
|
3976
3976
|
let a = t.getPrintArea();
|
|
3977
|
-
a && n.push(`print area ${
|
|
3977
|
+
a && n.push(`print area ${U(a)}`);
|
|
3978
3978
|
let o = Fa(t.getPrintTitleRows(), !1);
|
|
3979
3979
|
o && n.push(`title rows ${o}`);
|
|
3980
3980
|
let s = Fa(t.getPrintTitleColumns(), !0);
|
|
@@ -3987,14 +3987,14 @@ function za(e) {
|
|
|
3987
3987
|
return u.length > 0 && n.push(u.join(", ")), n.length === 0 ? null : `${n.join(" · ")} — wb.getWorksheet(${JSON.stringify(e.getName())}).getPageLayout()`;
|
|
3988
3988
|
}
|
|
3989
3989
|
function Ba(e) {
|
|
3990
|
-
let t = new
|
|
3990
|
+
let t = new F();
|
|
3991
3991
|
t.h1("Page Layout"), t.blank();
|
|
3992
3992
|
let n = e.getOrientation();
|
|
3993
3993
|
t.fact(`Orientation: ${n}${n === f.Orientation.Portrait ? " (default)" : ""}`), t.fact(`Paper: ${Na(e) ?? "letter (default)"}`), t.fact(`Zoom: ${Ma(e) ?? "100% (default)"}`);
|
|
3994
3994
|
let r = Oa.map(([t, n]) => `${t} ${ja(n(e))}`).join(" · ");
|
|
3995
3995
|
t.fact(`Margins (inches): ${r}${Pa(e) ? " (default)" : ""}`);
|
|
3996
3996
|
let i = e.getPrintArea();
|
|
3997
|
-
t.fact(`Print area: ${i ?
|
|
3997
|
+
t.fact(`Print area: ${i ? U(i) : "none — the used range prints"}`), t.fact(`Title rows: ${Fa(e.getPrintTitleRows(), !1) ?? "none"}`), t.fact(`Title columns: ${Fa(e.getPrintTitleColumns(), !0) ?? "none"}`);
|
|
3998
3998
|
let a = e.getHorizontalPageBreaks(), o = e.getVerticalPageBreaks();
|
|
3999
3999
|
t.fact("Row breaks: " + (a.length > 0 ? `${a.length} · ${Ia(a, !1)}` : "none")), t.fact("Column breaks: " + (o.length > 0 ? `${o.length} · ${Ia(o, !0)}` : "none"));
|
|
4000
4000
|
let s = [];
|
|
@@ -4017,7 +4017,7 @@ var Va = (e) => {
|
|
|
4017
4017
|
return t === Object.prototype || t === null;
|
|
4018
4018
|
};
|
|
4019
4019
|
function Ha(e, t) {
|
|
4020
|
-
let n = t?.maxCells ?? 1e3, r = Array.isArray(e) ? e : [e], i = new
|
|
4020
|
+
let n = t?.maxCells ?? 1e3, r = Array.isArray(e) ? e : [e], i = new F();
|
|
4021
4021
|
if (i.h1("Records"), i.text(`Count: ${r.length}`), i.blank(), r.length === 0) return i.text("None"), i.toLines().join("\n").trimEnd();
|
|
4022
4022
|
let a = (e) => {
|
|
4023
4023
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
@@ -4078,7 +4078,7 @@ function qa(e, t) {
|
|
|
4078
4078
|
detail: [yi(n), gi(n)].filter(Boolean).join(" ")
|
|
4079
4079
|
});
|
|
4080
4080
|
}
|
|
4081
|
-
let o = a.filter((e) => !e.isName), s = o.length > 0 && o.some((e) => e.sheet !== o[0].sheet), c = o.length > 0 ? o[0].sheet : e.getWorksheet()?.getName(), l = new
|
|
4081
|
+
let o = a.filter((e) => !e.isName), s = o.length > 0 && o.some((e) => e.sheet !== o[0].sheet), c = o.length > 0 ? o[0].sheet : e.getWorksheet()?.getName(), l = new F(), u = a.length > 0 && !s && !!c;
|
|
4082
4082
|
if (l.h1(u ? `Ranges — ${V(c)} (${n})` : `Ranges (${n})`), a.length === 0) return l.text("none"), l.toLines().join("\n").trimEnd();
|
|
4083
4083
|
let d = a.map((e) => s && !e.isName ? `${V(e.sheet)}!${e.address}` : e.address), f = Math.max(...d.map((e) => e.length));
|
|
4084
4084
|
for (let e = 0; e < a.length; e++) l.text(` ${d[e].padEnd(f)} ${a[e].detail}`.trimEnd());
|
|
@@ -4133,15 +4133,21 @@ var Za = (e) => {
|
|
|
4133
4133
|
let t = e.extent.getCoords(), n = Ja(t.colStart - 1), r = t.rowStart;
|
|
4134
4134
|
return e.rowInput && e.columnInput ? `${n}${r}` : e.columnInput ? `${Ja(t.colStart)}${r}:${Ja(t.colEnd)}${r}` : `${n}${t.rowStart + 1}:${n}${t.rowEnd + 1}`;
|
|
4135
4135
|
})(e)}`), e.blocked && n.push("blocked (#SPILL!)"), `${e.formula} ${n.join(", ")}`;
|
|
4136
|
-
}, Qa = (e) =>
|
|
4137
|
-
|
|
4138
|
-
let
|
|
4136
|
+
}, Qa = (e) => e.isDeleted() ? "" : e.getRange().toString(), $a = (e) => {
|
|
4137
|
+
if (e.getFields().length === 0) return "";
|
|
4138
|
+
let t = (e) => e.map((e) => e.getName()), n = [], r = (e, t, r) => {
|
|
4139
|
+
t.length > 0 && n.push(`${e}: ${t.join(r)}`);
|
|
4140
|
+
};
|
|
4141
|
+
return r("rows", t(e.getRowFields()), " > "), r("columns", t(e.getColumnFields()), " > "), r("filters", t(e.getPageFields()), ", "), r("values", t(e.getDataFields()), ", "), n.join(" · ");
|
|
4142
|
+
};
|
|
4143
|
+
async function eo(e, t) {
|
|
4144
|
+
let n = new F(), r = e.getSelectedRange(), i = e.getUsedRange();
|
|
4139
4145
|
n.h1(`Sheet — ${V(e.getName())}${function(e) {
|
|
4140
4146
|
let t = e.getWorkbook(), n = "";
|
|
4141
4147
|
t && t.getSelectedWorksheet()?.getId() === e.getId() && (n += " (selected)");
|
|
4142
4148
|
let r = e.getVisibility();
|
|
4143
4149
|
return r === h.Visibility.Hidden ? n += " (hidden)" : r === h.Visibility.VeryHidden && (n += " (very hidden)"), e.getProtection().isLocked() && (n += " (protected)"), n;
|
|
4144
|
-
}(e)}`), n.text(`Used: ${i ?
|
|
4150
|
+
}(e)}`), n.text(`Used: ${i ? Kt(i) : "empty"}`), n.text(`Selection: ${Kt(r)}`);
|
|
4145
4151
|
let a = gn(e);
|
|
4146
4152
|
a && n.text(`Outline: ${a}`);
|
|
4147
4153
|
let o = za(e);
|
|
@@ -4156,11 +4162,17 @@ async function $a(e, t) {
|
|
|
4156
4162
|
if (t.length === 0) return;
|
|
4157
4163
|
let n = t.map((e) => ({
|
|
4158
4164
|
address: Qa(e),
|
|
4159
|
-
name: e.getName()
|
|
4165
|
+
name: e.getName(),
|
|
4166
|
+
source: e.isDeleted() ? null : e.getSource(),
|
|
4167
|
+
stale: e.isStale(),
|
|
4168
|
+
fields: $a(e)
|
|
4160
4169
|
})), r = Math.max(...n.map((e) => e.address.length));
|
|
4161
4170
|
e.h2(`Pivot Tables (${t.length})`);
|
|
4162
|
-
for (let t of n)
|
|
4163
|
-
|
|
4171
|
+
for (let t of n) {
|
|
4172
|
+
let n = t.source ? `${t.name} from ${t.source}` : t.name, i = t.stale ? " (stale: the source changed since the last refresh)" : "";
|
|
4173
|
+
e.text(r > 0 ? ` ${t.address.padEnd(r)} ${n}${i}` : ` ${n}${i}`), t.fields && e.text(` ${t.fields}`);
|
|
4174
|
+
}
|
|
4175
|
+
e.text(" Read-only — the cells hold the last refresh, not the source as it is now."), e.blank();
|
|
4164
4176
|
}(n, e.getPivotTables().getItems()), function(e, t) {
|
|
4165
4177
|
if (t.length === 0) return;
|
|
4166
4178
|
let n = t.map((e) => ({
|
|
@@ -4172,7 +4184,7 @@ async function $a(e, t) {
|
|
|
4172
4184
|
e.text(" What-if results: the formula cells evaluated with each axis value put into the inputs."), e.blank();
|
|
4173
4185
|
}(n, Xa(e)), dr(n, e.getMovables().getItems()), n.toLines().join("\n").trimEnd();
|
|
4174
4186
|
}
|
|
4175
|
-
var
|
|
4187
|
+
var to = 1e4, no = [
|
|
4176
4188
|
["numericalCount", "Numbers"],
|
|
4177
4189
|
["sum", "Sum"],
|
|
4178
4190
|
["min", "Min"],
|
|
@@ -4180,17 +4192,17 @@ var eo = 1e4, to = [
|
|
|
4180
4192
|
["average", "Average"],
|
|
4181
4193
|
["stdDev", "StdDev"]
|
|
4182
4194
|
];
|
|
4183
|
-
function
|
|
4184
|
-
let n = new
|
|
4195
|
+
function ro(t) {
|
|
4196
|
+
let n = new F(), r = t.getCoords(), i = r ? e.rangeToString(r) : null;
|
|
4185
4197
|
n.h1(i ? `Stats — ${i}` : "Stats");
|
|
4186
4198
|
let a = t.getTypedCounts();
|
|
4187
4199
|
n.fact(`Cells: ${t.getSize()}`), n.fact(`Values: ${t.getCount()}`);
|
|
4188
4200
|
let o = a[b.Error] ?? 0;
|
|
4189
4201
|
o > 0 && n.fact(`Errors: ${o}`);
|
|
4190
4202
|
let s = function(e) {
|
|
4191
|
-
let t = e.getFrequencies({ limit:
|
|
4203
|
+
let t = e.getFrequencies({ limit: to }), n = t.getUniqueCount();
|
|
4192
4204
|
if (n === 0) return null;
|
|
4193
|
-
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${
|
|
4205
|
+
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${to.toLocaleString("en-US")})`;
|
|
4194
4206
|
if (n === t.getTotalCount()) return `${n.toLocaleString("en-US")}, no repeats`;
|
|
4195
4207
|
let r = [];
|
|
4196
4208
|
for (let [e, n] of t.getValueCounts()) {
|
|
@@ -4199,7 +4211,7 @@ function no(t) {
|
|
|
4199
4211
|
label: O(e)?.display ?? "",
|
|
4200
4212
|
content: n,
|
|
4201
4213
|
styled: n,
|
|
4202
|
-
blocks: i &&
|
|
4214
|
+
blocks: i && io(i) === n ? [i] : []
|
|
4203
4215
|
});
|
|
4204
4216
|
}
|
|
4205
4217
|
let i = {
|
|
@@ -4207,13 +4219,13 @@ function no(t) {
|
|
|
4207
4219
|
maxValues: 8,
|
|
4208
4220
|
recovery: "getStats().getFrequencies()"
|
|
4209
4221
|
};
|
|
4210
|
-
if (n <= 8) return `${n} · ${
|
|
4222
|
+
if (n <= 8) return `${n} · ${rt(r, i)}`;
|
|
4211
4223
|
let a = r.filter((e) => e.content > 1);
|
|
4212
|
-
return `${n.toLocaleString("en-US")} · repeats ${
|
|
4224
|
+
return `${n.toLocaleString("en-US")} · repeats ${rt(a, i)}`;
|
|
4213
4225
|
}(t);
|
|
4214
4226
|
s && n.fact(`Distinct: ${s}`);
|
|
4215
4227
|
let c = t.getAggregates({ onError: "ignore" });
|
|
4216
|
-
for (let [e, t] of
|
|
4228
|
+
for (let [e, t] of no) {
|
|
4217
4229
|
let r = c[e];
|
|
4218
4230
|
r != null && n.fact(`${t}: ${T(r)}`);
|
|
4219
4231
|
}
|
|
@@ -4221,38 +4233,38 @@ function no(t) {
|
|
|
4221
4233
|
for (let [e, t] of Object.entries(a)) e !== b.Null && t && l.push(`${e.charAt(0).toUpperCase()}${e.slice(1)}: ${t}`);
|
|
4222
4234
|
return l.length > 0 && (n.blank(), n.h2("Type"), n.fact(l)), n.toLines().join("\n").trimEnd();
|
|
4223
4235
|
}
|
|
4224
|
-
var
|
|
4225
|
-
function
|
|
4226
|
-
let t = new
|
|
4236
|
+
var io = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
|
|
4237
|
+
function ao(e) {
|
|
4238
|
+
let t = new F();
|
|
4227
4239
|
t.h1("Style"), t.text(`Named: ${e.getNamed().getName()}`), t.blank();
|
|
4228
4240
|
let n = e.toJSON(), r = n ? Object.entries(n).filter(([, e]) => e !== void 0) : [];
|
|
4229
4241
|
if (r.length === 0) t.fact("No direct styling (inherits the named style)");
|
|
4230
4242
|
else for (let [e, n] of r) t.fact(`${e}: ${t.codespan(typeof n == "string" ? n : JSON.stringify(n))}`);
|
|
4231
4243
|
return t.toLines().join("\n").trimEnd();
|
|
4232
4244
|
}
|
|
4233
|
-
function
|
|
4234
|
-
let n = t?.maxCells ?? 1e3, r =
|
|
4245
|
+
function oo(e, t) {
|
|
4246
|
+
let n = t?.maxCells ?? 1e3, r = so(e) ? e.getValues() : e, i = r.length, a = r.reduce((e, t) => Math.max(e, t?.length ?? 0), 0), o = new F();
|
|
4235
4247
|
if (o.h1("Values"), o.text(`Size: ${i}×${a}`), o.blank(), i === 0 || a === 0) return o.text("None"), o.toLines().join("\n").trimEnd();
|
|
4236
4248
|
let s = k(i, Math.max(1, Math.floor(n / a))), c = i > s ? r.slice(0, s) : r, l = o.beginFrame(Array(a).fill(""));
|
|
4237
|
-
for (let e of c) l.addRow(Array.from({ length: a }, (t, n) =>
|
|
4249
|
+
for (let e of c) l.addRow(Array.from({ length: a }, (t, n) => co(e?.[n])));
|
|
4238
4250
|
return l.endFrame(), c.length < i && o.text(`…truncated at ${c.length} of ${i} rows · slice or aggregate in the expression before returning it`), o.toLines().join("\n").trimEnd();
|
|
4239
4251
|
}
|
|
4240
|
-
var
|
|
4252
|
+
var so = (e) => !!e && typeof e == "object" && !0 === e.isIRange, co = (e) => {
|
|
4241
4253
|
if (e == null) return { text: "" };
|
|
4242
4254
|
let t = (O(e)?.display ?? "").replace(/[\r\n]+/g, " ");
|
|
4243
4255
|
return typeof e == "number" ? {
|
|
4244
4256
|
text: t,
|
|
4245
4257
|
alignment: "right"
|
|
4246
4258
|
} : { text: t };
|
|
4247
|
-
},
|
|
4248
|
-
[
|
|
4249
|
-
[
|
|
4250
|
-
[
|
|
4251
|
-
[
|
|
4252
|
-
[
|
|
4259
|
+
}, Y = o.Feature, lo = [
|
|
4260
|
+
[Y.Font, "fonts"],
|
|
4261
|
+
[Y.NumberFormat, "formats"],
|
|
4262
|
+
[Y.Fill, "fills"],
|
|
4263
|
+
[Y.Borders, "borders"],
|
|
4264
|
+
[Y.Alignment, "alignments"]
|
|
4253
4265
|
];
|
|
4254
|
-
async function
|
|
4255
|
-
let n = new
|
|
4266
|
+
async function uo(e, t) {
|
|
4267
|
+
let n = new F();
|
|
4256
4268
|
n.h1(`Workbook — ${e.getName() ?? "Untitled"}`), n.text(`Locale: ${e.getRuntime().getLocale()}`);
|
|
4257
4269
|
let r = e.getCalculation();
|
|
4258
4270
|
r.getStatus() === i.Status.Off ? n.text("Calculation: off — formulas have not been evaluated; values are as loaded. wb.getCalculation().calculate() evaluates them") : r.getStatus() === i.Status.Error ? n.text("Calculation: error — the engine failed to start; values are as loaded. wb.getCalculation().start() tries again") : r.getCalculationMode() === i.CalculationMode.Manual && n.text("Calculation: manual — values are as of the last calculation. wb.getCalculation().calculate() refreshes them");
|
|
@@ -4260,10 +4272,10 @@ async function lo(e, t) {
|
|
|
4260
4272
|
a && n.text(`Protection: ${a}`), n.blank();
|
|
4261
4273
|
let o = e.getWorksheets().getItems({ visibility: h.Visibility.VeryHidden }), s = e.getSelectedSheet(), c = e.getStyles().getNormal(), l = [];
|
|
4262
4274
|
for (let e of o) {
|
|
4263
|
-
let t =
|
|
4275
|
+
let t = fo(e, c);
|
|
4264
4276
|
l.push({
|
|
4265
4277
|
sheet: e,
|
|
4266
|
-
label:
|
|
4278
|
+
label: vo(e, e.getId() === s.getId()),
|
|
4267
4279
|
counts: t.counts,
|
|
4268
4280
|
lines: t.lines,
|
|
4269
4281
|
formulaSignature: t.formulaSignature
|
|
@@ -4303,14 +4315,14 @@ async function lo(e, t) {
|
|
|
4303
4315
|
let g = e.getSheets({ visibility: h.Visibility.VeryHidden }).filter((e) => e.getKind() !== h.Kind.Worksheet);
|
|
4304
4316
|
if (g.length > 0) {
|
|
4305
4317
|
n.h2(`Other sheets (${g.length})`), n.blank();
|
|
4306
|
-
for (let e of g) n.text(` ${
|
|
4318
|
+
for (let e of g) n.text(` ${yo(e, e.getId() === s.getId())}`);
|
|
4307
4319
|
n.text(" Carried as read and saved unchanged; they have no cells · wb.getSheets() lists every tab"), n.blank();
|
|
4308
4320
|
}
|
|
4309
|
-
return
|
|
4310
|
-
describe: (e) =>
|
|
4321
|
+
return xo(n, "Errors", l, Y.Error), xo(n, "Calc Failures", l, Y.CalcError), xo(n, "Circular References", l, Y.Circular), xo(n, "Anomalies", l, Y.Anomalies, {
|
|
4322
|
+
describe: (e) => Ft(Y.Anomalies, null)(e) ?? "",
|
|
4311
4323
|
rank: (e) => -(e.getCell().getAnomalies()[0]?.rank ?? 0),
|
|
4312
4324
|
include: (e) => !me(e.getCell().getAnomalies()),
|
|
4313
|
-
key:
|
|
4325
|
+
key: Bt
|
|
4314
4326
|
}), await mn(n, e.getNames().getItems({
|
|
4315
4327
|
type: "formula",
|
|
4316
4328
|
includeHidden: !0
|
|
@@ -4321,38 +4333,38 @@ async function lo(e, t) {
|
|
|
4321
4333
|
symbols: e.getNames().getItems({ includeHidden: !0 }) ?? []
|
|
4322
4334
|
}), xa(n, ba(e), t), n.toLines().join("\n").trimEnd();
|
|
4323
4335
|
}
|
|
4324
|
-
function
|
|
4336
|
+
function fo(e, t) {
|
|
4325
4337
|
let n = e.getUsedRange();
|
|
4326
4338
|
if (!n) return {
|
|
4327
4339
|
counts: null,
|
|
4328
4340
|
lines: [
|
|
4341
|
+
...mo(e),
|
|
4329
4342
|
...po(e),
|
|
4330
|
-
...
|
|
4331
|
-
...mo(e)
|
|
4343
|
+
...ho(e)
|
|
4332
4344
|
],
|
|
4333
4345
|
formulaRegions: 0,
|
|
4334
4346
|
formulaSignature: ""
|
|
4335
4347
|
};
|
|
4336
4348
|
let r = n.getCounts([
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
]), i = [], o = tn(n), s = [...n.getRegions(
|
|
4349
|
+
Y.Contentful,
|
|
4350
|
+
Y.Formula,
|
|
4351
|
+
Y.Error,
|
|
4352
|
+
Y.CalcError,
|
|
4353
|
+
Y.Circular,
|
|
4354
|
+
Y.Table,
|
|
4355
|
+
Y.Anomalies
|
|
4356
|
+
]), i = [], o = tn(n), s = [...n.getRegions(Y.Formula)];
|
|
4345
4357
|
if (o.length > 0) {
|
|
4346
4358
|
let e = function(e, t) {
|
|
4347
|
-
let n =
|
|
4348
|
-
return n.length === 0 ? null : n.map(([e, t]) => `${e} ×${
|
|
4359
|
+
let n = vt(e, t);
|
|
4360
|
+
return n.length === 0 ? null : n.map(([e, t]) => `${e} ×${et(t)}`).join(" · ");
|
|
4349
4361
|
}(n, s);
|
|
4350
4362
|
i.push({
|
|
4351
4363
|
label: "content",
|
|
4352
|
-
extent:
|
|
4364
|
+
extent: _o(o),
|
|
4353
4365
|
detail: [
|
|
4354
|
-
|
|
4355
|
-
|
|
4366
|
+
X(r[Y.Contentful] ?? 0, "cell"),
|
|
4367
|
+
X(o.length, "block"),
|
|
4356
4368
|
e,
|
|
4357
4369
|
`${H(n)} lists the blocks`
|
|
4358
4370
|
].filter(Boolean).join(" · ")
|
|
@@ -4367,29 +4379,29 @@ function uo(e, t) {
|
|
|
4367
4379
|
}
|
|
4368
4380
|
c = t.sort().join("\n"), i.push({
|
|
4369
4381
|
label: "formula",
|
|
4370
|
-
extent:
|
|
4382
|
+
extent: _o(s),
|
|
4371
4383
|
detail: [
|
|
4372
|
-
|
|
4373
|
-
|
|
4384
|
+
X(r[Y.Formula] ?? 0, "cell"),
|
|
4385
|
+
X(s.length, "region"),
|
|
4374
4386
|
`${e.size} distinct`
|
|
4375
4387
|
].join(" · ")
|
|
4376
4388
|
});
|
|
4377
4389
|
}
|
|
4378
4390
|
for (let [e, t] of [
|
|
4379
|
-
[
|
|
4380
|
-
[
|
|
4381
|
-
[
|
|
4391
|
+
[Y.Error, "errors"],
|
|
4392
|
+
[Y.CalcError, "calc failures"],
|
|
4393
|
+
[Y.Circular, "circular"]
|
|
4382
4394
|
]) {
|
|
4383
4395
|
let a = r[e] ?? 0;
|
|
4384
4396
|
if (a === 0) continue;
|
|
4385
4397
|
let o = [...n.getRegions(e)];
|
|
4386
4398
|
i.push({
|
|
4387
4399
|
label: t,
|
|
4388
|
-
extent:
|
|
4389
|
-
detail: [
|
|
4400
|
+
extent: _o(o),
|
|
4401
|
+
detail: [X(a, "cell"), X(o.length, "region")].join(" · ")
|
|
4390
4402
|
});
|
|
4391
4403
|
}
|
|
4392
|
-
let l = (r[
|
|
4404
|
+
let l = (r[Y.Anomalies] ?? 0) > 0 ? [...n.getRegions(Y.Anomalies)].filter((e) => !me(e.getCell().getAnomalies())) : [];
|
|
4393
4405
|
if (l.length > 0) {
|
|
4394
4406
|
let e = new Map([...se.keys()].map((e) => [e, 0])), t = 0;
|
|
4395
4407
|
for (let n of l) {
|
|
@@ -4399,10 +4411,10 @@ function uo(e, t) {
|
|
|
4399
4411
|
}
|
|
4400
4412
|
i.push({
|
|
4401
4413
|
label: "anomalies",
|
|
4402
|
-
extent:
|
|
4414
|
+
extent: _o(l),
|
|
4403
4415
|
detail: [
|
|
4404
|
-
|
|
4405
|
-
|
|
4416
|
+
X(t, "cell"),
|
|
4417
|
+
X(l.length, "region"),
|
|
4406
4418
|
...[...e].filter(([, e]) => e > 0).map(([e, t]) => `${e} ${t}`)
|
|
4407
4419
|
].join(" · ")
|
|
4408
4420
|
});
|
|
@@ -4410,42 +4422,42 @@ function uo(e, t) {
|
|
|
4410
4422
|
let u = n.getTables();
|
|
4411
4423
|
u.length > 0 && i.push({
|
|
4412
4424
|
label: "tables",
|
|
4413
|
-
extent:
|
|
4425
|
+
extent: _o(u.map((e) => e.getRange())),
|
|
4414
4426
|
detail: [
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4427
|
+
X(r[Y.Table] ?? 0, "cell"),
|
|
4428
|
+
X(u.length, "table"),
|
|
4429
|
+
go(u.map((e) => e.getName()))
|
|
4418
4430
|
].join(" · ")
|
|
4419
4431
|
});
|
|
4420
4432
|
let d = e.getPivotTables().getItems();
|
|
4421
4433
|
d.length > 0 && i.push({
|
|
4422
4434
|
label: "pivots",
|
|
4423
4435
|
extent: String(d.length),
|
|
4424
|
-
detail:
|
|
4436
|
+
detail: go(d.map((e) => e.getName()))
|
|
4425
4437
|
});
|
|
4426
4438
|
let f = Xa(e);
|
|
4427
4439
|
f.length > 0 && i.push({
|
|
4428
4440
|
label: "data tables",
|
|
4429
|
-
extent:
|
|
4430
|
-
detail:
|
|
4431
|
-
}), i.push(...
|
|
4441
|
+
extent: _o(f.map((e) => e.extent)),
|
|
4442
|
+
detail: go(f.map((e) => e.extent.getAddress()))
|
|
4443
|
+
}), i.push(...mo(e));
|
|
4432
4444
|
let p = o.map((e) => e.getCoords()), m = [];
|
|
4433
|
-
for (let [n, r] of
|
|
4434
|
-
let i =
|
|
4445
|
+
for (let [n, r] of lo) {
|
|
4446
|
+
let i = gt(e, n, t, { content: p })?.distinct ?? 0;
|
|
4435
4447
|
i > 0 && m.push(`${r} ${i}`);
|
|
4436
4448
|
}
|
|
4437
4449
|
return m.length > 0 && i.push({
|
|
4438
4450
|
label: "style",
|
|
4439
4451
|
extent: n.toString(),
|
|
4440
4452
|
detail: m.join(" · ")
|
|
4441
|
-
}), i.push(...
|
|
4453
|
+
}), i.push(...po(e)), i.push(...ho(e)), {
|
|
4442
4454
|
counts: r,
|
|
4443
4455
|
lines: i,
|
|
4444
4456
|
formulaRegions: s.length,
|
|
4445
4457
|
formulaSignature: c
|
|
4446
4458
|
};
|
|
4447
4459
|
}
|
|
4448
|
-
function
|
|
4460
|
+
function po(e) {
|
|
4449
4461
|
let t = gn(e);
|
|
4450
4462
|
return t ? [{
|
|
4451
4463
|
label: "outline",
|
|
@@ -4453,10 +4465,10 @@ function fo(e) {
|
|
|
4453
4465
|
detail: t
|
|
4454
4466
|
}] : [];
|
|
4455
4467
|
}
|
|
4456
|
-
function
|
|
4468
|
+
function mo(e) {
|
|
4457
4469
|
let t = [];
|
|
4458
4470
|
for (let [n, r] of ur(e.getMovables().getItems())) {
|
|
4459
|
-
let i = ir(r), a = n === "chart" ?
|
|
4471
|
+
let i = ir(r), a = n === "chart" ? go(r.map(or)) : i.length > 0 ? `${i.length} with text` : "";
|
|
4460
4472
|
t.push({
|
|
4461
4473
|
label: lr(n).toLowerCase(),
|
|
4462
4474
|
extent: String(r.length),
|
|
@@ -4476,7 +4488,7 @@ function po(e) {
|
|
|
4476
4488
|
}
|
|
4477
4489
|
return t;
|
|
4478
4490
|
}
|
|
4479
|
-
function
|
|
4491
|
+
function ho(e) {
|
|
4480
4492
|
let t = zi(e);
|
|
4481
4493
|
return t ? [{
|
|
4482
4494
|
label: "protected",
|
|
@@ -4484,7 +4496,7 @@ function mo(e) {
|
|
|
4484
4496
|
detail: t.detail
|
|
4485
4497
|
}] : [];
|
|
4486
4498
|
}
|
|
4487
|
-
function
|
|
4499
|
+
function go(e) {
|
|
4488
4500
|
let t = [], n = 0;
|
|
4489
4501
|
for (let r of e) {
|
|
4490
4502
|
let e = (t.length > 0 ? 2 : 0) + r.length;
|
|
@@ -4494,7 +4506,7 @@ function ho(e) {
|
|
|
4494
4506
|
let r = e.length - t.length;
|
|
4495
4507
|
return r > 0 ? `${t.join(", ")}, +${r} more` : t.join(", ");
|
|
4496
4508
|
}
|
|
4497
|
-
function
|
|
4509
|
+
function _o(t) {
|
|
4498
4510
|
let n = null;
|
|
4499
4511
|
for (let e of t) {
|
|
4500
4512
|
let t = e.getCoords();
|
|
@@ -4507,18 +4519,18 @@ function go(t) {
|
|
|
4507
4519
|
}
|
|
4508
4520
|
return n ? e.rangeToString(n) ?? "" : "";
|
|
4509
4521
|
}
|
|
4510
|
-
var
|
|
4511
|
-
function
|
|
4522
|
+
var X = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`;
|
|
4523
|
+
function vo(e, t) {
|
|
4512
4524
|
let n = e.getVisibility(), r = "";
|
|
4513
4525
|
return t && (r += " (selected)"), n === h.Visibility.Hidden ? r += " (hidden)" : n === h.Visibility.VeryHidden && (r += " (very hidden)"), e.getProtection().isLocked() && (r += " (protected)"), `${V(e.getName())}${r}`;
|
|
4514
4526
|
}
|
|
4515
|
-
function
|
|
4527
|
+
function yo(e, t) {
|
|
4516
4528
|
let n = e.getKind(), r = n === h.Kind.Chart ? "chart sheet" : n === h.Kind.Macro ? "Excel 4.0 macro sheet" : "dialog sheet", i = e.getVisibility(), a = ` (${r})`;
|
|
4517
4529
|
return t && (a += " (selected)"), i === h.Visibility.Hidden ? a += " (hidden)" : i === h.Visibility.VeryHidden && (a += " (very hidden)"), `${V(e.getName())}${a}`;
|
|
4518
4530
|
}
|
|
4519
|
-
var
|
|
4520
|
-
function
|
|
4521
|
-
let o = a?.include, s = r.reduce((e, t) => e + (t.counts?.[i] ?? 0), 0), c = i ===
|
|
4531
|
+
var bo = 6;
|
|
4532
|
+
function xo(t, n, r, i, a) {
|
|
4533
|
+
let o = a?.include, s = r.reduce((e, t) => e + (t.counts?.[i] ?? 0), 0), c = i === Y.Error ? r.flatMap((e) => function(e) {
|
|
4522
4534
|
let t = [];
|
|
4523
4535
|
for (let n of e.getMovables().getItems({ type: "chart" })) {
|
|
4524
4536
|
let e = xn(n);
|
|
@@ -4528,7 +4540,7 @@ function bo(t, n, r, i, a) {
|
|
|
4528
4540
|
let i = r.getName();
|
|
4529
4541
|
t.push({
|
|
4530
4542
|
movable: n,
|
|
4531
|
-
detail: `series ${i ? `"${
|
|
4543
|
+
detail: `series ${i ? `"${G(i)}"` : "(unnamed)"} ${e.join(" · ")}`
|
|
4532
4544
|
});
|
|
4533
4545
|
}
|
|
4534
4546
|
}
|
|
@@ -4536,7 +4548,7 @@ function bo(t, n, r, i, a) {
|
|
|
4536
4548
|
}(e.sheet)) : [];
|
|
4537
4549
|
if (s === 0 && c.length === 0) return;
|
|
4538
4550
|
o && (s = 0);
|
|
4539
|
-
let l = [], u = 0, d = a?.describe ??
|
|
4551
|
+
let l = [], u = 0, d = a?.describe ?? So, f = a?.rank, p = [];
|
|
4540
4552
|
for (let e of r) {
|
|
4541
4553
|
if (!e.counts?.[i]) continue;
|
|
4542
4554
|
let t = e.sheet.getUsedRange();
|
|
@@ -4569,7 +4581,7 @@ function bo(t, n, r, i, a) {
|
|
|
4569
4581
|
for (let t of e.slice(0, 20)) {
|
|
4570
4582
|
let { region: e, sheetName: n } = t[0], r = t.slice(1);
|
|
4571
4583
|
m += r.length;
|
|
4572
|
-
let i = r.length === 0 ? "" : ` · also at ${r.slice(0,
|
|
4584
|
+
let i = r.length === 0 ? "" : ` · also at ${r.slice(0, bo).map((e) => `${e.sheetName}!${e.region.toString()}`).join(", ")}${r.length > bo ? ` +${r.length - bo} more` : ""}`;
|
|
4573
4585
|
l.push({
|
|
4574
4586
|
address: `${n}!${e.toString()}`,
|
|
4575
4587
|
size: `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
@@ -4594,22 +4606,22 @@ function bo(t, n, r, i, a) {
|
|
|
4594
4606
|
let y = l.length - h.length + m;
|
|
4595
4607
|
u > y && t.text(` …and ${u - y} more · getRegions('${i}') on a sheet's used range lists the rest`), c.length > h.length && t.text(` …and ${c.length - h.length} more in charts · a sheet's report lists its charts under Charts`), t.blank();
|
|
4596
4608
|
}
|
|
4597
|
-
function
|
|
4609
|
+
function So(e) {
|
|
4598
4610
|
let t = e.getCell(), n = D(t, w.Mode.Display)?.display ?? "", r = t.getFormulaText();
|
|
4599
4611
|
if (!r) return n;
|
|
4600
4612
|
let i = Di(Ei(t.getFormula()?.getTokens() ?? [], t.getWorksheet().getWorkbook()));
|
|
4601
4613
|
return [`${n} ${r}`.trim(), i].filter(Boolean).join(" · ");
|
|
4602
4614
|
}
|
|
4603
|
-
var
|
|
4615
|
+
var Z = (e, t) => !!e && typeof e == "object" && !0 === e[t], Co = {
|
|
4604
4616
|
kind: "protectedRanges",
|
|
4605
|
-
is: (e) =>
|
|
4617
|
+
is: (e) => Z(e, "isIProtectedRangeCollection"),
|
|
4606
4618
|
render: (e) => {
|
|
4607
4619
|
let t = e.getItems();
|
|
4608
|
-
return t.length === 0 ? "# Unlocked Ranges (0)\nNone" : t.slice(0,
|
|
4620
|
+
return t.length === 0 ? "# Unlocked Ranges (0)\nNone" : t.slice(0, Eo).map(Gi).concat(t.length > Eo ? [`…and ${t.length - Eo} more · render one at a time to see them`] : []).join("\n\n");
|
|
4609
4621
|
}
|
|
4610
|
-
},
|
|
4611
|
-
function
|
|
4612
|
-
let t =
|
|
4622
|
+
}, wo = 2;
|
|
4623
|
+
function To(e) {
|
|
4624
|
+
let t = Ao(e);
|
|
4613
4625
|
if (!t) return null;
|
|
4614
4626
|
let n;
|
|
4615
4627
|
try {
|
|
@@ -4621,131 +4633,131 @@ function wo(e) {
|
|
|
4621
4633
|
let r = n.split("\n").map((e) => e.trim()).filter(Boolean);
|
|
4622
4634
|
if (r.length === 0) return null;
|
|
4623
4635
|
let i = r[0].replace(/^#+\s*/, ""), a = r.slice(1);
|
|
4624
|
-
return a.length <=
|
|
4636
|
+
return a.length <= wo ? [i, ...a].join(" · ") : `${i} · ${a.length} more lines — return it on its own`;
|
|
4625
4637
|
}
|
|
4626
|
-
var
|
|
4638
|
+
var Eo = 20, Do = [
|
|
4627
4639
|
{
|
|
4628
4640
|
kind: "workbook",
|
|
4629
|
-
is: (e) =>
|
|
4630
|
-
render: (e, t) =>
|
|
4641
|
+
is: (e) => Z(e, "isIWorkbook"),
|
|
4642
|
+
render: (e, t) => uo(e, t)
|
|
4631
4643
|
},
|
|
4632
4644
|
{
|
|
4633
4645
|
kind: "sheet",
|
|
4634
|
-
is: (e) =>
|
|
4635
|
-
render: (e, t) =>
|
|
4646
|
+
is: (e) => Z(e, "isIWorksheet"),
|
|
4647
|
+
render: (e, t) => eo(e, t)
|
|
4636
4648
|
},
|
|
4637
4649
|
{
|
|
4638
4650
|
kind: "cell",
|
|
4639
|
-
is: (e) =>
|
|
4651
|
+
is: (e) => Z(e, "isICell"),
|
|
4640
4652
|
render: (e, t) => qi(e, t)
|
|
4641
4653
|
},
|
|
4642
4654
|
{
|
|
4643
4655
|
kind: "names",
|
|
4644
|
-
is: (e) =>
|
|
4656
|
+
is: (e) => Z(e, "isINamedCollection"),
|
|
4645
4657
|
render: (e, t) => Ea(e, t)
|
|
4646
4658
|
},
|
|
4647
4659
|
{
|
|
4648
4660
|
kind: "modules",
|
|
4649
|
-
is: (e) =>
|
|
4661
|
+
is: (e) => Z(e, "isIModuleCollection"),
|
|
4650
4662
|
render: (e, t) => wa(e, t)
|
|
4651
4663
|
},
|
|
4652
4664
|
{
|
|
4653
4665
|
kind: "module",
|
|
4654
|
-
is: (e) =>
|
|
4666
|
+
is: (e) => Z(e, "isIModule"),
|
|
4655
4667
|
render: (e, t) => Ca(e, t)
|
|
4656
4668
|
},
|
|
4657
4669
|
{
|
|
4658
4670
|
kind: "formula",
|
|
4659
|
-
is: (e) =>
|
|
4671
|
+
is: (e) => Z(e, "isIFormula"),
|
|
4660
4672
|
render: (e, t) => ma(e, t)
|
|
4661
4673
|
},
|
|
4662
4674
|
{
|
|
4663
4675
|
kind: "table",
|
|
4664
|
-
is: (e) =>
|
|
4665
|
-
render: (e) =>
|
|
4676
|
+
is: (e) => Z(e, "isITable"),
|
|
4677
|
+
render: (e) => Me(e)
|
|
4666
4678
|
},
|
|
4667
4679
|
{
|
|
4668
4680
|
kind: "movable",
|
|
4669
|
-
is: (e) =>
|
|
4681
|
+
is: (e) => Z(e, "isIMovable"),
|
|
4670
4682
|
render: (e) => pr(e)
|
|
4671
4683
|
},
|
|
4672
4684
|
{
|
|
4673
4685
|
kind: "shape",
|
|
4674
|
-
is: (e) =>
|
|
4686
|
+
is: (e) => Z(e, "isIShape"),
|
|
4675
4687
|
render: (e) => mr(e)
|
|
4676
4688
|
},
|
|
4677
4689
|
{
|
|
4678
4690
|
kind: "conditionalFormat",
|
|
4679
|
-
is: (e) =>
|
|
4691
|
+
is: (e) => Z(e, "isIConditionalFormat"),
|
|
4680
4692
|
render: (e) => na(e)
|
|
4681
4693
|
},
|
|
4682
4694
|
{
|
|
4683
4695
|
kind: "dataValidation",
|
|
4684
|
-
is: (e) =>
|
|
4696
|
+
is: (e) => Z(e, "isIDataValidation"),
|
|
4685
4697
|
render: (e) => ia(e)
|
|
4686
4698
|
},
|
|
4687
4699
|
{
|
|
4688
4700
|
kind: "protection",
|
|
4689
|
-
is: (e) =>
|
|
4701
|
+
is: (e) => Z(e, "isIWorksheetProtection") || Z(e, "isIWorkbookProtection"),
|
|
4690
4702
|
render: (e) => Wi(e)
|
|
4691
4703
|
},
|
|
4692
|
-
|
|
4704
|
+
Co,
|
|
4693
4705
|
{
|
|
4694
4706
|
kind: "protectedRange",
|
|
4695
|
-
is: (e) =>
|
|
4707
|
+
is: (e) => Z(e, "isIProtectedRange"),
|
|
4696
4708
|
render: (e) => Gi(e)
|
|
4697
4709
|
},
|
|
4698
4710
|
{
|
|
4699
4711
|
kind: "pageLayout",
|
|
4700
|
-
is: (e) =>
|
|
4712
|
+
is: (e) => Z(e, "isIPageLayout"),
|
|
4701
4713
|
render: (e) => Ba(e)
|
|
4702
4714
|
},
|
|
4703
4715
|
{
|
|
4704
4716
|
kind: "stats",
|
|
4705
|
-
is: (e) =>
|
|
4706
|
-
render: (e) =>
|
|
4717
|
+
is: (e) => Z(e, "isIRangeStats"),
|
|
4718
|
+
render: (e) => ro(e)
|
|
4707
4719
|
},
|
|
4708
4720
|
{
|
|
4709
4721
|
kind: "counts",
|
|
4710
|
-
is: (e) =>
|
|
4722
|
+
is: (e) => Z(e, "isICellRangeCounts"),
|
|
4711
4723
|
render: (e) => ra(e)
|
|
4712
4724
|
},
|
|
4713
4725
|
{
|
|
4714
4726
|
kind: "style",
|
|
4715
|
-
is: (e) =>
|
|
4716
|
-
render: (e) =>
|
|
4727
|
+
is: (e) => Z(e, "isICellStyle"),
|
|
4728
|
+
render: (e) => ao(e)
|
|
4717
4729
|
},
|
|
4718
4730
|
{
|
|
4719
4731
|
kind: "regions",
|
|
4720
|
-
is: (e) =>
|
|
4721
|
-
render: (e, t) =>
|
|
4732
|
+
is: (e) => Z(e, "isICellRegions"),
|
|
4733
|
+
render: (e, t) => Vt(e, t)
|
|
4722
4734
|
},
|
|
4723
4735
|
{
|
|
4724
4736
|
kind: "cellRange",
|
|
4725
|
-
is: (e) =>
|
|
4737
|
+
is: (e) => Z(e, "isICellRange"),
|
|
4726
4738
|
render: (e, t) => Qi(e, t)
|
|
4727
4739
|
},
|
|
4728
4740
|
{
|
|
4729
4741
|
kind: "ranges",
|
|
4730
|
-
is: (e) =>
|
|
4742
|
+
is: (e) => Z(e, "isICellRanges"),
|
|
4731
4743
|
render: (e, t) => qa(e, t)
|
|
4732
4744
|
},
|
|
4733
4745
|
{
|
|
4734
4746
|
kind: "range",
|
|
4735
|
-
is: (e) =>
|
|
4736
|
-
render: (e, t) =>
|
|
4747
|
+
is: (e) => Z(e, "isIRange"),
|
|
4748
|
+
render: (e, t) => oo(e, t)
|
|
4737
4749
|
},
|
|
4738
4750
|
{
|
|
4739
4751
|
kind: "values",
|
|
4740
4752
|
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Array.isArray(e)),
|
|
4741
|
-
render: (e, t) =>
|
|
4753
|
+
render: (e, t) => oo(e, t)
|
|
4742
4754
|
},
|
|
4743
4755
|
{
|
|
4744
4756
|
kind: "records",
|
|
4745
4757
|
is: (e) => Array.isArray(e) && e.length > 0 && e.every(Va),
|
|
4746
4758
|
render: (e, t) => Ha(e, {
|
|
4747
4759
|
...t,
|
|
4748
|
-
nested:
|
|
4760
|
+
nested: To
|
|
4749
4761
|
})
|
|
4750
4762
|
},
|
|
4751
4763
|
{
|
|
@@ -4753,42 +4765,42 @@ var To = 20, Eo = [
|
|
|
4753
4765
|
is: (e) => Va(e),
|
|
4754
4766
|
render: (e, t) => Ha(e, {
|
|
4755
4767
|
...t,
|
|
4756
|
-
nested:
|
|
4768
|
+
nested: To
|
|
4757
4769
|
})
|
|
4758
4770
|
},
|
|
4759
4771
|
{
|
|
4760
4772
|
kind: "items",
|
|
4761
|
-
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!
|
|
4773
|
+
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!Ao(e)),
|
|
4762
4774
|
render: async (e, t) => {
|
|
4763
|
-
let n = e.length >
|
|
4764
|
-
for (let e of n) r.push(await
|
|
4775
|
+
let n = e.length > Eo ? e.slice(0, Eo) : e, r = [];
|
|
4776
|
+
for (let e of n) r.push(await Ao(e).render(e, t));
|
|
4765
4777
|
return n.length < e.length && r.push(`…and ${e.length - n.length} more · render one at a time to see them`), r.join("\n\n");
|
|
4766
4778
|
}
|
|
4767
4779
|
}
|
|
4768
|
-
],
|
|
4780
|
+
], Oo = Do.map((e) => e.kind), ko = class extends Error {
|
|
4769
4781
|
constructor(e) {
|
|
4770
4782
|
super(e), this.name = "NoRendererError";
|
|
4771
4783
|
}
|
|
4772
4784
|
};
|
|
4773
|
-
function
|
|
4774
|
-
for (let t of
|
|
4785
|
+
function Ao(e) {
|
|
4786
|
+
for (let t of Do) if (t.is(e)) return t;
|
|
4775
4787
|
return null;
|
|
4776
4788
|
}
|
|
4777
|
-
async function
|
|
4789
|
+
async function jo(e, t, n) {
|
|
4778
4790
|
await e?.getCalculation().ready();
|
|
4779
|
-
let r =
|
|
4791
|
+
let r = Ao(t), i = t;
|
|
4780
4792
|
if (!r && i && typeof i == "object" && !Array.isArray(i) && typeof i[Symbol.iterator] == "function") {
|
|
4781
4793
|
let e = [];
|
|
4782
4794
|
for (let t of i) if (e.push(t), e.length >= 1e3) break;
|
|
4783
|
-
i = e, r =
|
|
4795
|
+
i = e, r = Ao(i);
|
|
4784
4796
|
}
|
|
4785
|
-
if (!r) throw new
|
|
4797
|
+
if (!r) throw new ko(`No markdown renderer for this value. Renderable kinds: ${Oo.join(", ")}.`);
|
|
4786
4798
|
let a = e?.getCalculation() ?? null, o = await r.render(i, n);
|
|
4787
|
-
for (let e = 0; e <
|
|
4799
|
+
for (let e = 0; e < Mo && a?.getCalculationState() === "calculating"; e++) await a.ready(), o = await r.render(i, n);
|
|
4788
4800
|
return o;
|
|
4789
4801
|
}
|
|
4790
|
-
var
|
|
4791
|
-
async function
|
|
4802
|
+
var Mo = 2;
|
|
4803
|
+
async function No(e, t, n) {
|
|
4792
4804
|
if (t === void 0) return {
|
|
4793
4805
|
text: void 0,
|
|
4794
4806
|
rendered: !0
|
|
@@ -4799,11 +4811,11 @@ async function Mo(e, t, n) {
|
|
|
4799
4811
|
};
|
|
4800
4812
|
if (typeof t == "object" && t) try {
|
|
4801
4813
|
return {
|
|
4802
|
-
text: await
|
|
4814
|
+
text: await jo(e, t, n),
|
|
4803
4815
|
rendered: !0
|
|
4804
4816
|
};
|
|
4805
4817
|
} catch (e) {
|
|
4806
|
-
if (!(e instanceof
|
|
4818
|
+
if (!(e instanceof ko)) throw e;
|
|
4807
4819
|
}
|
|
4808
4820
|
return function(e) {
|
|
4809
4821
|
if (e === null) return {
|
|
@@ -4843,8 +4855,8 @@ async function Mo(e, t, n) {
|
|
|
4843
4855
|
};
|
|
4844
4856
|
}(t);
|
|
4845
4857
|
}
|
|
4846
|
-
var
|
|
4847
|
-
async function
|
|
4858
|
+
var Q = o.Feature;
|
|
4859
|
+
async function Po(e, t, n) {
|
|
4848
4860
|
let r = e.getChanges(t);
|
|
4849
4861
|
if (r.length === 0) return null;
|
|
4850
4862
|
let i = n?.maxEntries ?? 20, a = n?.maxBlockValues ?? 8, o = /* @__PURE__ */ new Map();
|
|
@@ -4857,9 +4869,9 @@ async function No(e, t, n) {
|
|
|
4857
4869
|
if (o.size === 0) return null;
|
|
4858
4870
|
let s = [], c = [], l = 0;
|
|
4859
4871
|
for (let [e, { data: t, style: n }] of o) {
|
|
4860
|
-
let r = t ?
|
|
4872
|
+
let r = t ? Io(t) : null;
|
|
4861
4873
|
r && c.push(r);
|
|
4862
|
-
let o =
|
|
4874
|
+
let o = Fo(e, t ?? null, r, n ?? null, i, a);
|
|
4863
4875
|
s.push(o.sheet), l += o.cleared;
|
|
4864
4876
|
}
|
|
4865
4877
|
let u = await async function(e) {
|
|
@@ -4871,15 +4883,15 @@ async function No(e, t, n) {
|
|
|
4871
4883
|
if (t.length === 0) return null;
|
|
4872
4884
|
if (t.length === 1) return t[0];
|
|
4873
4885
|
let n = [];
|
|
4874
|
-
for (let e of t)
|
|
4886
|
+
for (let e of t) zo(e, n, !0);
|
|
4875
4887
|
return t[0].getWorksheet().getRanges(n);
|
|
4876
4888
|
}(c), d = [];
|
|
4877
|
-
for (let e of c)
|
|
4878
|
-
u &&
|
|
4889
|
+
for (let e of c) zo(e, d);
|
|
4890
|
+
u && zo(u, d);
|
|
4879
4891
|
let f = function(e) {
|
|
4880
4892
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
4881
|
-
for (let r of e) if ((r.getCounts([
|
|
4882
|
-
let i =
|
|
4893
|
+
for (let r of e) if ((r.getCounts([Q.Error])[Q.Error] ?? 0) !== 0) for (let e of r.getRegions(Q.Error)) {
|
|
4894
|
+
let i = W(r.getWorksheet().getRanges(e.getAddress()));
|
|
4883
4895
|
t.has(i) || (t.add(i), n.push({
|
|
4884
4896
|
address: i,
|
|
4885
4897
|
error: D(e.getCell(), w.Mode.Display)?.display ?? "",
|
|
@@ -4891,17 +4903,17 @@ async function No(e, t, n) {
|
|
|
4891
4903
|
return {
|
|
4892
4904
|
commitId: r[0].getCommit().getId(),
|
|
4893
4905
|
sheets: s,
|
|
4894
|
-
dependents: u ?
|
|
4906
|
+
dependents: u ? Bo(u, i) : null,
|
|
4895
4907
|
errors: f.slice(0, p),
|
|
4896
4908
|
errorsMore: f.length - p,
|
|
4897
4909
|
errorsCleared: l,
|
|
4898
|
-
touches:
|
|
4910
|
+
touches: Vo(c, u)
|
|
4899
4911
|
};
|
|
4900
4912
|
}
|
|
4901
|
-
function
|
|
4913
|
+
function Fo(e, t, n, r, i, a) {
|
|
4902
4914
|
let o = r?.getRanges() ?? null, s = {
|
|
4903
4915
|
sheet: V(e.getName()),
|
|
4904
|
-
written: n ?
|
|
4916
|
+
written: n ? W(n) : null,
|
|
4905
4917
|
cells: 0,
|
|
4906
4918
|
formulas: 0,
|
|
4907
4919
|
values: 0,
|
|
@@ -4916,11 +4928,11 @@ function Po(e, t, n, r, i, a) {
|
|
|
4916
4928
|
return {
|
|
4917
4929
|
kind: t.getKind(),
|
|
4918
4930
|
axis: i,
|
|
4919
|
-
address: o.length > 0 ?
|
|
4931
|
+
address: o.length > 0 ? W(e.getRanges(o)) : null,
|
|
4920
4932
|
whole: a
|
|
4921
4933
|
};
|
|
4922
4934
|
}(e, t)) : [],
|
|
4923
|
-
styles: o ?
|
|
4935
|
+
styles: o ? W(o) : null,
|
|
4924
4936
|
blocks: [],
|
|
4925
4937
|
blocksMore: 0
|
|
4926
4938
|
};
|
|
@@ -4928,39 +4940,39 @@ function Po(e, t, n, r, i, a) {
|
|
|
4928
4940
|
sheet: s,
|
|
4929
4941
|
cleared: 0
|
|
4930
4942
|
};
|
|
4931
|
-
let c = n.getCounts([
|
|
4943
|
+
let c = n.getCounts([Q.Contentful, Q.Formula]), l = 0;
|
|
4932
4944
|
for (let e = 0; e < n.length; e++) {
|
|
4933
4945
|
let t = n.at(e);
|
|
4934
4946
|
l += t.getRowCount() * t.getColumnCount();
|
|
4935
4947
|
}
|
|
4936
|
-
s.cells = l, s.formulas = c[
|
|
4948
|
+
s.cells = l, s.formulas = c[Q.Formula] ?? 0, s.values = (c[Q.Contentful] ?? 0) - s.formulas, s.cleared = l - (c[Q.Contentful] ?? 0);
|
|
4937
4949
|
let u = 0, d = t.getPreviousRanges();
|
|
4938
4950
|
if (d) {
|
|
4939
|
-
let t = d.getCounts([
|
|
4951
|
+
let t = d.getCounts([Q.Contentful, Q.Formula]);
|
|
4940
4952
|
s.replaced = {
|
|
4941
|
-
populated: t[
|
|
4942
|
-
formulas: t[
|
|
4953
|
+
populated: t[Q.Contentful] ?? 0,
|
|
4954
|
+
formulas: t[Q.Formula] ?? 0
|
|
4943
4955
|
}, u = function(e, t) {
|
|
4944
4956
|
let n = 0;
|
|
4945
|
-
for (let r = 0; r < e.length; r++) for (let i of e.at(r).getRegions(
|
|
4957
|
+
for (let r = 0; r < e.length; r++) for (let i of e.at(r).getRegions(Q.Error)) {
|
|
4946
4958
|
let e = t.getRange(i.getCoords());
|
|
4947
|
-
n += i.getRowCount() * i.getColumnCount() - (e.getCounts([
|
|
4959
|
+
n += i.getRowCount() * i.getColumnCount() - (e.getCounts([Q.Error])[Q.Error] ?? 0);
|
|
4948
4960
|
}
|
|
4949
4961
|
return n;
|
|
4950
4962
|
}(d, e);
|
|
4951
4963
|
}
|
|
4952
4964
|
let f = [], p = 0;
|
|
4953
|
-
for (let e = 0; e < n.length; e++) for (let t of n.at(e).getRegions(
|
|
4965
|
+
for (let e = 0; e < n.length; e++) for (let t of n.at(e).getRegions(Q.Formula)) p++, f.length < i && f.push(Ro(t.getRange(), a));
|
|
4954
4966
|
if (p > f.length && p <= k(p, i)) {
|
|
4955
4967
|
f.length = 0;
|
|
4956
|
-
for (let e = 0; e < n.length; e++) for (let t of n.at(e).getRegions(
|
|
4968
|
+
for (let e = 0; e < n.length; e++) for (let t of n.at(e).getRegions(Q.Formula)) f.push(Ro(t.getRange(), a));
|
|
4957
4969
|
}
|
|
4958
4970
|
return s.blocks = f, s.blocksMore = p - f.length, {
|
|
4959
4971
|
sheet: s,
|
|
4960
4972
|
cleared: u
|
|
4961
4973
|
};
|
|
4962
4974
|
}
|
|
4963
|
-
function
|
|
4975
|
+
function Io(e) {
|
|
4964
4976
|
let t = e.getRanges(), n = e.getShifts();
|
|
4965
4977
|
if (!t || n.length === 0) return t;
|
|
4966
4978
|
let r = e.getSheet(), i = [], a = [];
|
|
@@ -4974,37 +4986,37 @@ function Fo(e) {
|
|
|
4974
4986
|
let o = [];
|
|
4975
4987
|
for (let e = 0; e < t.length; e++) {
|
|
4976
4988
|
let n = t.at(e);
|
|
4977
|
-
i.some((e) =>
|
|
4989
|
+
i.some((e) => Lo(e, n.getCoords())) || o.push(n);
|
|
4978
4990
|
}
|
|
4979
|
-
for (let e of a) for (let t of r.getRange(e).getRegions(
|
|
4991
|
+
for (let e of a) for (let t of r.getRange(e).getRegions(Q.Contentful)) o.push(t.getRange());
|
|
4980
4992
|
return o.length > 0 ? r.getRanges(o) : null;
|
|
4981
4993
|
}
|
|
4982
|
-
var
|
|
4983
|
-
function
|
|
4994
|
+
var Lo = (e, t) => t.rowStart >= e.rowStart && t.rowEnd <= e.rowEnd && t.colStart >= e.colStart && t.colEnd <= e.colEnd;
|
|
4995
|
+
function Ro(e, t) {
|
|
4984
4996
|
let n = e.getRowCount() * e.getColumnCount(), r = n > t, i = [], a = null;
|
|
4985
4997
|
return e.forEach((e, t) => {
|
|
4986
4998
|
let n = D(t.getCell(), w.Mode.Display)?.display ?? "";
|
|
4987
4999
|
!r || i.length < 3 ? i.push(n) : a = n;
|
|
4988
5000
|
}), r && a !== null && i.push(a), {
|
|
4989
|
-
address:
|
|
5001
|
+
address: W(e.getWorksheet().getRanges(e.getAddress())),
|
|
4990
5002
|
formula: e.getCell().getFormulaText() ?? "",
|
|
4991
5003
|
cells: n,
|
|
4992
5004
|
values: i,
|
|
4993
5005
|
sampled: r
|
|
4994
5006
|
};
|
|
4995
5007
|
}
|
|
4996
|
-
function
|
|
5008
|
+
function zo(e, t, n = !1) {
|
|
4997
5009
|
for (let r = 0; r < e.length; r++) {
|
|
4998
5010
|
let i = e.at(r);
|
|
4999
5011
|
!n && i.isINamedRange || t.push(i);
|
|
5000
5012
|
}
|
|
5001
5013
|
}
|
|
5002
|
-
function
|
|
5014
|
+
function Bo(e, t) {
|
|
5003
5015
|
let n = /* @__PURE__ */ new Map(), r = [];
|
|
5004
|
-
|
|
5016
|
+
zo(e, r);
|
|
5005
5017
|
let i = 0;
|
|
5006
5018
|
for (let e of r) {
|
|
5007
|
-
let t = e.getCounts([
|
|
5019
|
+
let t = e.getCounts([Q.Contentful])[Q.Contentful] ?? 0;
|
|
5008
5020
|
i += t;
|
|
5009
5021
|
let r = V(e.getWorksheet().getName());
|
|
5010
5022
|
n.set(r, (n.get(r) ?? 0) + t);
|
|
@@ -5016,15 +5028,15 @@ function zo(e, t) {
|
|
|
5016
5028
|
sheet: e,
|
|
5017
5029
|
cells: t
|
|
5018
5030
|
})),
|
|
5019
|
-
areas: r.slice(0, a).map((e) =>
|
|
5031
|
+
areas: r.slice(0, a).map((e) => W(e.getWorksheet().getRanges(e.getAddress()))),
|
|
5020
5032
|
areasMore: r.length - a
|
|
5021
5033
|
};
|
|
5022
5034
|
}
|
|
5023
|
-
function
|
|
5035
|
+
function Vo(e, t) {
|
|
5024
5036
|
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = (e) => {
|
|
5025
5037
|
for (let t of vn(e)) n.add(on(t));
|
|
5026
|
-
for (let t of e.getConditionalFormats()) r.add(
|
|
5027
|
-
for (let t of e.getDataValidations()) i.add(
|
|
5038
|
+
for (let t of e.getConditionalFormats()) r.add(W(t.getRanges()));
|
|
5039
|
+
for (let t of e.getDataValidations()) i.add(W(t.getRanges()));
|
|
5028
5040
|
};
|
|
5029
5041
|
for (let n of e) for (let e = 0; e < n.length; e++) {
|
|
5030
5042
|
let r = n.at(e);
|
|
@@ -5042,63 +5054,63 @@ function Bo(e, t) {
|
|
|
5042
5054
|
charts: Array.from(a.values(), Rn)
|
|
5043
5055
|
};
|
|
5044
5056
|
}
|
|
5045
|
-
var
|
|
5046
|
-
function
|
|
5057
|
+
var $ = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`, Ho = (e, t) => `${`${e}:`.padEnd(14)}${t}`;
|
|
5058
|
+
function Uo(e) {
|
|
5047
5059
|
let t = [];
|
|
5048
5060
|
for (let n of e.sheets) {
|
|
5049
5061
|
if (n.written) {
|
|
5050
|
-
t.push(
|
|
5051
|
-
for (let e of n.blocks) t.push(` ${
|
|
5052
|
-
n.blocksMore > 0 && t.push(` +${
|
|
5062
|
+
t.push(Ho("Changed", `${n.written} — ${Wo(n)}`));
|
|
5063
|
+
for (let e of n.blocks) t.push(` ${Ko(e)}`);
|
|
5064
|
+
n.blocksMore > 0 && t.push(` +${$(n.blocksMore, "more formula block")}`);
|
|
5053
5065
|
}
|
|
5054
|
-
n.shifts.length > 0 && t.push(
|
|
5066
|
+
n.shifts.length > 0 && t.push(Ho("Structure", n.shifts.map((e) => Go(n.sheet, e)).join(" · "))), n.styles && t.push(Ho("Formatting", n.styles));
|
|
5055
5067
|
}
|
|
5056
5068
|
let n = e.dependents;
|
|
5057
5069
|
if (n) {
|
|
5058
|
-
let e = n.sheets.length > 1 ? ` on ${
|
|
5059
|
-
t.push(
|
|
5070
|
+
let e = n.sheets.length > 1 ? ` on ${$(n.sheets.length, "sheet")}` : "";
|
|
5071
|
+
t.push(Ho("Dependents", `${$(n.cells, "cell")}${e} — ${n.areas.join(", ")}${((e) => e > 0 ? ` · +${e} more` : "")(n.areasMore)}`));
|
|
5060
5072
|
}
|
|
5061
5073
|
if (e.errors.length > 0 || e.errorsCleared > 0) {
|
|
5062
5074
|
let n = e.errors.map((e) => `${e.address} ${e.error} (${e.cells})`);
|
|
5063
|
-
e.errorsMore > 0 && n.push(`+${e.errorsMore} more`), e.errorsCleared > 0 && n.push(`${
|
|
5075
|
+
e.errorsMore > 0 && n.push(`+${e.errorsMore} more`), e.errorsCleared > 0 && n.push(`${$(e.errorsCleared, "error")} cleared`), t.push(Ho("Errors", n.join(" · ")));
|
|
5064
5076
|
}
|
|
5065
5077
|
let r = function(e) {
|
|
5066
5078
|
let t = [], n = (e, n, r) => {
|
|
5067
|
-
e.length > 0 && t.push(`${
|
|
5079
|
+
e.length > 0 && t.push(`${$(e.length, n, r)} (${e.join(", ")})`);
|
|
5068
5080
|
};
|
|
5069
5081
|
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;
|
|
5070
5082
|
}(e.touches);
|
|
5071
|
-
return r && t.push(
|
|
5083
|
+
return r && t.push(Ho("Also touches", r)), t.join("\n");
|
|
5072
5084
|
}
|
|
5073
|
-
function
|
|
5085
|
+
function Wo(e) {
|
|
5074
5086
|
let t = [];
|
|
5075
|
-
if (e.formulas > 0 && t.push(
|
|
5076
|
-
let n = e.replaced.formulas > 0 ? ` (${
|
|
5077
|
-
t.push(`${
|
|
5087
|
+
if (e.formulas > 0 && t.push($(e.formulas, "formula")), e.values > 0 && t.push($(e.values, "value")), e.cleared > 0 && t.push(`${$(e.cleared, "cell")} cleared`), e.replaced) {
|
|
5088
|
+
let n = e.replaced.formulas > 0 ? ` (${$(e.replaced.formulas, "formula")})` : "";
|
|
5089
|
+
t.push(`${$(e.replaced.populated, "populated cell")} replaced${n}`);
|
|
5078
5090
|
} else t.push("replaced cells not known (cells moved, or the state before was not kept)");
|
|
5079
5091
|
return t.join(", ");
|
|
5080
5092
|
}
|
|
5081
|
-
function
|
|
5093
|
+
function Go(e, t) {
|
|
5082
5094
|
let n = t.kind === "insert" ? "inserted" : "deleted", r = t.address ?? e;
|
|
5083
5095
|
return t.whole ? `${r} ${t.axis === "row" ? "rows" : "columns"} ${n}` : `${r} cells ${n}, shifted ${t.axis === "row" ? t.kind === "insert" ? "down" : "up" : t.kind === "insert" ? "right" : "left"}`;
|
|
5084
5096
|
}
|
|
5085
|
-
function
|
|
5097
|
+
function Ko(e) {
|
|
5086
5098
|
let t;
|
|
5087
5099
|
t = e.sampled && e.values.length > 1 ? `${e.values.slice(0, -1).join(", ")} … ${e.values[e.values.length - 1]}` : e.values.join(", ");
|
|
5088
|
-
let n = e.cells > 1 ? ` (${
|
|
5100
|
+
let n = e.cells > 1 ? ` (${$(e.cells, "cell")})` : "";
|
|
5089
5101
|
return `${e.address} ${e.formula} → ${t}${n}`;
|
|
5090
5102
|
}
|
|
5091
|
-
async function
|
|
5103
|
+
async function qo(e, t, n) {
|
|
5092
5104
|
if (!t) return {};
|
|
5093
5105
|
try {
|
|
5094
|
-
let r = await
|
|
5106
|
+
let r = await Po(e, t, n);
|
|
5095
5107
|
return r ? {
|
|
5096
5108
|
delta: r,
|
|
5097
|
-
markdown:
|
|
5109
|
+
markdown: Uo(r)
|
|
5098
5110
|
} : {};
|
|
5099
5111
|
} catch (e) {
|
|
5100
5112
|
return { markdown: `Changes could not be read: ${e?.message ?? String(e)}` };
|
|
5101
5113
|
}
|
|
5102
5114
|
}
|
|
5103
|
-
var
|
|
5104
|
-
export { Rr as API_ENTRY_POINTS, w as CellEncoding, ie as GREP_FIELDS, ae as GREP_FIELDS_DEFAULT, re as GrepField,
|
|
5115
|
+
var Jo = [Fr], Yo = [ii];
|
|
5116
|
+
export { Rr as API_ENTRY_POINTS, w as CellEncoding, ie as GREP_FIELDS, ae as GREP_FIELDS_DEFAULT, re as GrepField, F as MarkdownBuilder, De as MarkdownFrameSection, ko as NoRendererError, Yo as REFERENCES, Oo as RENDERABLE_KINDS, Do as RENDERERS, xi as RENDER_OPTION_KEYS, Ht as REPORTED_FEATURES, Jo as TOOLS, Bt as anomalyRegionKey, Yr as apiPointerFor, ei as apiSuggestionsFor, ii as apiTool, Jr as apiTypeOf, oi as appendDependencies, Qn as appendGroupFacts, Zn as appendGroupMembers, Jt as appendKinds, xa as appendModules, dr as appendMovables, mn as appendNames, Lt as appendRegionList, Zt as appendRegions, Xt as appendRoles, _n as appendRules, qn as appendShapeFacts, yn as appendSheetObjects, Bi as appendSheetProtection, je as appendTables, ba as collectModules, ir as collectShapeText, tn as contentfulBlocks, qe as countDates, we as describeAlignment, Mt as describeAllowedValues, tr as describeAnchor, ri as describeApi, be as describeBorder, Se as describeBorderParts, Hi as describeCellProtection, M as describeColor, At as describeConditionalFormat, jt as describeDataValidation, Po as describeDelta, Kt as describeExtent, ye as describeFill, Te as describeFont, ji as describeLock, or as describeMovableSummary, yi as describeNode, vi as describeNodeLabel, gi as describeNodeLabels, Ce as describeNumberFormat, gn as describeOutline, za as describePageLayout, qt as describeQualifiedExtent, on as describeQualifiedName, W as describeQualifiedRanges, Vi as describeRangeProtection, U as describeRanges, Et as describeRuleStyle, Nt as describeRules, Ot as describeScale, nr as describeShapeText, H as describeSheetCall, V as describeSheetName, Be as describeSums, lr as describeTypeHeading, Pi as describeWorkbookProtection, Le as detectTotals, D as encodeCell, E as encodeFormattedNumber, T as encodeNumber, O as encodeScalar, vn as findNames, Or as grep, Fr as grepTool, ur as groupMovables, Jn as groupOf, Va as isPlainRecord, Gr as lookupApi, Gt as parseFeatures, Si as parseRenderOptions, Ke as profileKinds, Pe as profileRegion, Ui as protectionPointerFor, zn as quoteShapeText, qo as readRunDelta, rr as readShapeText, Ft as regionPayload, It as regionPayloads, ni as renderApi, qi as renderCell, Qi as renderCellRange, na as renderConditionalFormat, ra as renderCounts, ia as renderDataValidation, Uo as renderDelta, ma as renderFormula, Pr as renderGrep, jo as renderMarkdown, Ca as renderModule, wa as renderModules, pr as renderMovable, Ea as renderNames, Ba as renderPageLayout, Gi as renderProtectedRange, Wi as renderProtection, qa as renderRanges, Ha as renderRecords, Vt as renderRegions, No as renderResult, mr as renderShape, ro as renderStats, ao as renderStyle, Me as renderTable, oo as renderValues, uo as renderWorkbook, eo as renderWorksheet, Ao as resolveRenderer, zi as summarizeSheetProtection, ke as tableOf, Qr as withoutHiddenSuggestion };
|