@sheetxl/query 0.8.0-beta.17 → 0.8.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/esm/index.mjs +1035 -967
- package/node/esm/index.mjs +956 -885
- package/package.json +3 -3
- package/types/src/markdown/appendSections.d.ts +11 -0
- package/types/src/markdown/describeSparkline.d.ts +15 -0
package/browser/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/query - SheetXL - Workbook read surface and renderers (grep, reports) — capabilities declared once, adapted by any host surface - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/query - SheetXL - Workbook read surface and renderers (grep, reports) — capabilities declared once, adapted by any host surface - v0.8.0-beta.18
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: SheetXL EULA — https://www.sheetxl.com/eula
|
|
@@ -141,54 +141,56 @@ var te = (e) => typeof e == "object" && !!e && !n.isError(e) && typeof e.getKind
|
|
|
141
141
|
[A.LiteralMatchesInput, "typed number equals an unread input"],
|
|
142
142
|
[A.TwinBlockDivergence, "differs from its twin formulas"],
|
|
143
143
|
[A.ScaleOutlier, "off the scale of its format"],
|
|
144
|
+
[A.UnreferencedInput, "input nothing reads"],
|
|
145
|
+
[A.RowGap, "gap in a labeled row"],
|
|
144
146
|
[A.ConstantFrequency, "constant"]
|
|
145
147
|
]);
|
|
146
148
|
function ce(e, t) {
|
|
147
149
|
let n = t.getCoords(), r = e.evidence, i = (a = e.check, se.get(a) ?? a);
|
|
148
150
|
var a;
|
|
149
151
|
switch (e.check) {
|
|
150
|
-
case A.InconsistentFormula: return `${i} · the cells ${ue(r)} have ${
|
|
152
|
+
case A.InconsistentFormula: return `${i} · the cells ${ue(r)} have ${M(String(r.expected ?? ""), n)}${de(r)}`;
|
|
151
153
|
case A.HardcodeInRun: return `${i} · the cells ${ue(r)} are formulas${de(r)}`;
|
|
152
154
|
case A.StyleBreak: return `${r.layer} ${i} · ${r.actual} here, ${r.expected} ${ue(r)}${de(r)}`;
|
|
153
155
|
case A.StyleRole: return `${r.part} ${i} · ${r.actual} on a ${r.role}, ${r.majority} of the sheet's ${r.of} are ${r.expected}`;
|
|
154
|
-
case A.OmittedCells: return `${i} · ${
|
|
155
|
-
case A.EmptyCellReference: return `${i} · reads ${
|
|
156
|
+
case A.OmittedCells: return `${i} · ${M(String(r.reference ?? ""), n)} stops before the number in ${M(String(r.omitted ?? ""), n)}`;
|
|
157
|
+
case A.EmptyCellReference: return `${i} · reads ${M(String(r.reference ?? ""), n)}`;
|
|
156
158
|
case A.RepeatedReference: {
|
|
157
|
-
let e = r.overlaps ? ` · inside ${
|
|
158
|
-
return `${i} · ${
|
|
159
|
+
let e = r.overlaps ? ` · inside ${M(String(r.overlaps), n)}` : "";
|
|
160
|
+
return `${i} · ${M(String(r.reference ?? ""), n)}${e}`;
|
|
159
161
|
}
|
|
160
|
-
case A.DegenerateCall: return r.literals === void 0 ? `${i} · ${r.function} of one cell, ${
|
|
162
|
+
case A.DegenerateCall: return r.literals === void 0 ? `${i} · ${r.function} of one cell, ${M(String(r.reference ?? ""), n)}` : `${i} · ${r.function} of typed numbers ${r.literals}`;
|
|
161
163
|
case A.SumIncludesSubtotal: {
|
|
162
164
|
let e = r.ratio === void 0 ? "subtotal" : "ratio";
|
|
163
|
-
return `${i} · ${
|
|
165
|
+
return `${i} · ${M(String(r.reference ?? ""), n)} holds the ${e} in ${M(String(r[e] ?? ""), n)}`;
|
|
164
166
|
}
|
|
165
167
|
case A.MisalignedReference: {
|
|
166
|
-
let e = r.landsAt !== void 0 && r.landsAt !== r.term ? ` in ${
|
|
167
|
-
return `${i} · ${
|
|
168
|
+
let e = r.landsAt !== void 0 && r.landsAt !== r.term ? ` in ${M(String(r.landsAt), n)}` : "";
|
|
169
|
+
return `${i} · ${M(String(r.term ?? ""), n)}, ${le[String(r.targetRole)] ?? r.targetRole}${e}, beside the block ${M(String(r.block ?? ""), n)}`;
|
|
168
170
|
}
|
|
169
171
|
case A.ApproximateMatch: return `${i} · ${r.function} match type ${r.matchType}`;
|
|
170
|
-
case A.LookupShape: return `${i} · reads ${
|
|
171
|
-
case A.ExternalReference: return r.kind === "udf" ? `${i} · unknown function ${r.function}` : `${i} · ${r.kind === "deleted" ? "a deleted reference" : "another workbook"}, ${
|
|
172
|
+
case A.LookupShape: return `${i} · reads ${M(String(r.array ?? ""), n)} at a position found in ${M(String(r.vector ?? ""), n)}`;
|
|
173
|
+
case A.ExternalReference: return r.kind === "udf" ? `${i} · unknown function ${r.function}` : `${i} · ${r.kind === "deleted" ? "a deleted reference" : "another workbook"}, ${M(String(r.reference ?? ""), n)}`;
|
|
172
174
|
case A.ErrorConstant: {
|
|
173
175
|
if (r.dataTable === void 0) return `${i} · =${r.error}, a value with nothing computing it`;
|
|
174
|
-
let e =
|
|
176
|
+
let e = M(String(r.dataTable), n).replace(/\$/g, ""), t = M(String(r.extent ?? ""), n).replace(/\$/g, "");
|
|
175
177
|
return `${i} · =${r.error} inside ${t}, where the data table at ${e} spills less: the table's results were replaced by constants`;
|
|
176
178
|
}
|
|
177
|
-
case A.LinkLabelMismatch: return `${i} · row ${
|
|
179
|
+
case A.LinkLabelMismatch: return `${i} · row ${j(r.label, r.labelAt, n)} links to ${j(r.target, r.targetAt, n)}`;
|
|
178
180
|
case A.KeyLabelMismatch: {
|
|
179
|
-
let e = [r.rowLabel === void 0 ? null : `row ${
|
|
181
|
+
let e = [r.rowLabel === void 0 ? null : `row ${j(r.rowLabel, r.rowLabelAt, n)}`, r.columnLabel === void 0 ? null : `column ${j(r.columnLabel, r.columnLabelAt, n)}`].filter(Boolean).join(", ");
|
|
180
182
|
return `${i} · ${r.function} key ${JSON.stringify(String(r.key ?? ""))} in ${e}`;
|
|
181
183
|
}
|
|
182
184
|
case A.SignVsSiblings: {
|
|
183
185
|
let e = r.sign === "negative" ? "positive" : "negative";
|
|
184
|
-
return `${i} · ${r.sign} ${
|
|
186
|
+
return `${i} · ${r.sign} ${M(String(r.reference ?? ""), n)} where ${r.siblings} other links into that row are ${e}, as in ${M(String(r.siblingAt ?? ""), n)}`;
|
|
185
187
|
}
|
|
186
188
|
case A.LiteralMatchesInput: {
|
|
187
|
-
let e = r.label === void 0 ? "" : ` ${
|
|
188
|
-
return `${i} · ${r.literal} is the input in ${
|
|
189
|
+
let e = r.label === void 0 ? "" : ` ${j(r.label, r.labelAt, n)},`, t = Number(r.matches ?? 1) > 1 ? ` · typed in ${r.matches} places` : "";
|
|
190
|
+
return `${i} · ${r.literal} is the input in ${M(String(r.inputAt ?? ""), n)},${e} which no formula reads${t}`;
|
|
189
191
|
}
|
|
190
192
|
case A.TwinBlockDivergence: {
|
|
191
|
-
let e =
|
|
193
|
+
let e = M(String(r.twinAt ?? ""), n);
|
|
192
194
|
if (r.part === "sign") {
|
|
193
195
|
let t = r.sign === "negative" ? "add" : "take away";
|
|
194
196
|
return `${i} · term ${r.term} of ${r.terms} is ${r.sign === "negative" ? "taken away" : "added"} where ${r.twins} formulas of the same shape ${t} it, as in ${e}`;
|
|
@@ -197,9 +199,17 @@ function ce(e, t) {
|
|
|
197
199
|
}
|
|
198
200
|
case A.ConstantFrequency: {
|
|
199
201
|
let e = Number(r.uses ?? 1);
|
|
200
|
-
return `${i} ${
|
|
202
|
+
return `${i} ${fe(r)} · typed in ${e} place${e === 1 ? "" : "s"}, of ${r.of} constants`;
|
|
201
203
|
}
|
|
202
204
|
case A.ScaleOutlier: return `${i} · ${r.times}× the typical ${r.format} on the sheet, ${r.typical} over ${r.of}`;
|
|
205
|
+
case A.UnreferencedInput: {
|
|
206
|
+
let e = r.value === void 0 ? `${r.cells} cells` : `${r.value}`;
|
|
207
|
+
return `${i} · ${j(r.label, r.labelAt, n)} ${e}, read by no formula in the workbook`;
|
|
208
|
+
}
|
|
209
|
+
case A.RowGap: {
|
|
210
|
+
let e = [r.above === void 0 ? null : j(r.above, r.aboveAt, n), r.below === void 0 ? null : j(r.below, r.belowAt, n)].filter(Boolean), t = e.length === 2 ? `${e[0]} and ${e[1]} are filled` : e.length === 1 ? `${e[0]} is filled` : "its block is filled", a = r.header === void 0 ? "" : ` · the period ${j(r.header, r.headerAt, n)} no row of the block fills`, o = Number(r.of ?? 0), s = r.kind === "row" ? `nothing in its ${o} cell${o === 1 ? "" : "s"}` : `${r.missing} of ${o} cells empty`, c = r.labelFont === "own" ? " · label font differs from its neighbors: a heading?" : "";
|
|
211
|
+
return `${i} · row ${j(r.label, r.labelAt, n)}: ${s} where ${t}${a}${c}`;
|
|
212
|
+
}
|
|
203
213
|
default: return i;
|
|
204
214
|
}
|
|
205
215
|
}
|
|
@@ -215,18 +225,18 @@ function de(e) {
|
|
|
215
225
|
let r = e.corroborated;
|
|
216
226
|
return Array.isArray(r) && r.length > 0 && t.push(`also changes: ${r.join(", ")}`), t.map((e) => ` · ${e}`).join("");
|
|
217
227
|
}
|
|
218
|
-
var
|
|
219
|
-
function
|
|
220
|
-
return e.replace(
|
|
221
|
-
let i =
|
|
228
|
+
var j = (e, t, n) => `${JSON.stringify(String(e ?? ""))} (${M(String(t ?? ""), n)})`, fe = (e) => e.kind === "string" ? JSON.stringify(String(e.value ?? "")) : String(e.value ?? ""), pe = (e) => e.length > 0 && e.every((e) => e.check === A.ConstantFrequency);
|
|
229
|
+
function M(e, t) {
|
|
230
|
+
return e.replace(ge, (e, n, r) => {
|
|
231
|
+
let i = _e(n, t.rowIndex, me), a = _e(r, t.colIndex, he);
|
|
222
232
|
return i === null || a === null ? e : a + i;
|
|
223
233
|
});
|
|
224
234
|
}
|
|
225
|
-
var
|
|
235
|
+
var me = (e) => String(e + 1), he = (t) => (e.cellToString({
|
|
226
236
|
rowIndex: 0,
|
|
227
237
|
colIndex: t
|
|
228
|
-
}) ?? "").replace(/\d+$/, ""),
|
|
229
|
-
function
|
|
238
|
+
}) ?? "").replace(/\d+$/, ""), ge = /(?<![A-Za-z0-9_.$])R(\[-?\d+\]|\d+)?C(\[-?\d+\]|\d+)?(?![A-Za-z0-9_(])/g;
|
|
239
|
+
function _e(e, t, n) {
|
|
230
240
|
if (e === void 0 || e === "") return n(t);
|
|
231
241
|
if (e.startsWith("[")) {
|
|
232
242
|
let r = t + Number(e.slice(1, -1));
|
|
@@ -234,7 +244,7 @@ function ve(e, t, n) {
|
|
|
234
244
|
}
|
|
235
245
|
return `$${n(Number(e) - 1)}`;
|
|
236
246
|
}
|
|
237
|
-
var
|
|
247
|
+
var N = (e) => {
|
|
238
248
|
if (!e) return null;
|
|
239
249
|
let t = String(e.toHex?.() ?? "");
|
|
240
250
|
if (!t) return e.toString();
|
|
@@ -242,32 +252,32 @@ var M = (e) => {
|
|
|
242
252
|
if (!r) return n;
|
|
243
253
|
let i = r.toLowerCase().replace(/^#/, "");
|
|
244
254
|
return i === n.slice(1).toLowerCase() || i === t.slice(1).toLowerCase() ? n : `${n} (${r.replace(/\d+\.\d{4,}/g, (e) => String(parseFloat(Number(e).toFixed(2))))})`;
|
|
245
|
-
},
|
|
255
|
+
}, ve = (e) => {
|
|
246
256
|
let t = e.getFill(), n = t.getType();
|
|
247
257
|
if (n === u.Type.None) return null;
|
|
248
258
|
if (n === u.Type.Pattern) {
|
|
249
259
|
let e = t, n = e.getPatternType();
|
|
250
260
|
if (n === u.BuiltInSheetPattern.None) return null;
|
|
251
|
-
let r =
|
|
261
|
+
let r = N(e.getForeground());
|
|
252
262
|
if (n === u.BuiltInSheetPattern.Solid) return r ? `solid ${r}` : "solid";
|
|
253
|
-
let i =
|
|
263
|
+
let i = N(e.getBackground());
|
|
254
264
|
return [
|
|
255
265
|
`${n} pattern`,
|
|
256
266
|
r,
|
|
257
267
|
i ? `on ${i}` : null
|
|
258
268
|
].filter(Boolean).join(" ");
|
|
259
269
|
}
|
|
260
|
-
let r =
|
|
270
|
+
let r = N(t.getColor?.());
|
|
261
271
|
return r ? `${n} ${r}` : n;
|
|
262
|
-
},
|
|
263
|
-
let t =
|
|
272
|
+
}, ye = (e) => {
|
|
273
|
+
let t = xe(e);
|
|
264
274
|
return t.length > 0 ? t.join(" · ") : null;
|
|
265
|
-
},
|
|
275
|
+
}, be = /* @__PURE__ */ new Set([
|
|
266
276
|
"top",
|
|
267
277
|
"left",
|
|
268
278
|
"bottom",
|
|
269
279
|
"right"
|
|
270
|
-
]),
|
|
280
|
+
]), xe = (e) => {
|
|
271
281
|
let t = e.getBorders(), n = [
|
|
272
282
|
["top", t.getTop()],
|
|
273
283
|
["left", t.getLeft()],
|
|
@@ -281,43 +291,43 @@ var M = (e) => {
|
|
|
281
291
|
for (let [e, t] of n) {
|
|
282
292
|
let n = t?.getStyle?.();
|
|
283
293
|
if (!n || n === "none") continue;
|
|
284
|
-
let i =
|
|
294
|
+
let i = N(t?.getColor?.()), a = i ? `${n} ${i}` : n, o = r.get(a);
|
|
285
295
|
o ? o.push(e) : r.set(a, [e]);
|
|
286
296
|
}
|
|
287
297
|
let i = [];
|
|
288
298
|
for (let [e, t] of r) {
|
|
289
|
-
let n = t.length === 4 && t.every((e) =>
|
|
299
|
+
let n = t.length === 4 && t.every((e) => be.has(e));
|
|
290
300
|
i.push(`${n ? "outline" : t.join("+")} ${e}`);
|
|
291
301
|
}
|
|
292
302
|
return i;
|
|
293
|
-
},
|
|
303
|
+
}, Se = (e) => {
|
|
294
304
|
let t = e.getNumberFormat();
|
|
295
305
|
return t && t !== "General" ? t : null;
|
|
296
|
-
},
|
|
306
|
+
}, Ce = (e, t) => {
|
|
297
307
|
let n = e.getAlignment(), r = t.getAlignment(), i = [];
|
|
298
308
|
return n.getHorizontal() !== r.getHorizontal() && i.push(`h ${n.getHorizontal()}`), n.getVertical() !== r.getVertical() && i.push(`v ${n.getVertical()}`), n.getOverflow() !== r.getOverflow() && i.push(n.getOverflow()), n.getIndent() !== r.getIndent() && i.push(`indent ${n.getIndent()}`), n.getRotation() !== r.getRotation() && i.push(`rotation ${n.getRotation()}`), i.length > 0 ? i.join(" · ") : null;
|
|
299
|
-
},
|
|
309
|
+
}, we = (e, t) => {
|
|
300
310
|
let n = e.getFont(), r = t.getFont(), i = [];
|
|
301
311
|
n.getBold() !== r.getBold() && i.push(n.getBold() ? "bold" : "not bold"), n.getItalic() !== r.getItalic() && i.push(n.getItalic() ? "italic" : "not italic"), n.getUnderline() !== r.getUnderline() && i.push(`underline ${n.getUnderline()}`), n.getStrike() !== r.getStrike() && i.push(n.getStrike() ? "strike" : "not strike"), n.getSize() !== r.getSize() && i.push(`${n.getSize()}pt`), n.getFamily() !== r.getFamily() && i.push(n.getFamily());
|
|
302
|
-
let a =
|
|
303
|
-
return a !==
|
|
312
|
+
let a = N(n.getColor());
|
|
313
|
+
return a !== N(r.getColor()) && i.push(a ?? "no color"), i.length > 0 ? i.join(" · ") : null;
|
|
304
314
|
};
|
|
305
|
-
function
|
|
315
|
+
function P(e, t, n) {
|
|
306
316
|
let r = S(e, t, n);
|
|
307
317
|
return r ? {
|
|
308
318
|
text: r.text,
|
|
309
319
|
address: r.address
|
|
310
320
|
} : null;
|
|
311
321
|
}
|
|
312
|
-
var
|
|
313
|
-
function
|
|
322
|
+
var Te = (e) => e ? `${JSON.stringify(e.text)} (${e.address})` : null;
|
|
323
|
+
function F(e) {
|
|
314
324
|
let t = e, n = "";
|
|
315
325
|
do
|
|
316
326
|
n = String.fromCharCode(65 + t % 26) + n, t = Math.floor(t / 26) - 1;
|
|
317
327
|
while (t >= 0);
|
|
318
328
|
return n;
|
|
319
329
|
}
|
|
320
|
-
var
|
|
330
|
+
var I = class {
|
|
321
331
|
constructor() {
|
|
322
332
|
this._lines = [], this._headingOffset = 0;
|
|
323
333
|
}
|
|
@@ -358,7 +368,7 @@ var F = class {
|
|
|
358
368
|
return `\`\`\`${t}\n${e}\n\`\`\``;
|
|
359
369
|
}
|
|
360
370
|
beginFrame(e) {
|
|
361
|
-
return new
|
|
371
|
+
return new Ee(this, e);
|
|
362
372
|
}
|
|
363
373
|
_addLines(e) {
|
|
364
374
|
this._lines.push(...e);
|
|
@@ -366,7 +376,7 @@ var F = class {
|
|
|
366
376
|
toLines() {
|
|
367
377
|
return [...this._lines];
|
|
368
378
|
}
|
|
369
|
-
},
|
|
379
|
+
}, Ee = class {
|
|
370
380
|
constructor(e, t) {
|
|
371
381
|
this._parent = e, this._headers = t, this._indexWidth = 0, this._rows = [], this._colWidths = t.map((e) => e.length);
|
|
372
382
|
}
|
|
@@ -393,27 +403,27 @@ var F = class {
|
|
|
393
403
|
_renderLines() {
|
|
394
404
|
let e = this._indexWidth > 0 ? " ".repeat(this._indexWidth) : "", t = this._colWidths.map((e, t) => this._columnAlignment(t)), n = [];
|
|
395
405
|
if (this._headers.some((e) => e.length > 0)) {
|
|
396
|
-
let r = this._headers.map((e, n) =>
|
|
406
|
+
let r = this._headers.map((e, n) => De(e, this._colWidths[n], t[n])).join(" ");
|
|
397
407
|
n.push(`${e}${e ? " " : ""}${r}`.trimEnd());
|
|
398
408
|
}
|
|
399
409
|
for (let e of this._rows) {
|
|
400
|
-
let t = e.cells.map((e, t) =>
|
|
410
|
+
let t = e.cells.map((e, t) => De(e.text, this._colWidths[t], e.alignment)).join(" "), r = this._indexWidth > 0 ? (e.index ?? "").padStart(this._indexWidth) + " " : "";
|
|
401
411
|
n.push(`${r}${t}`.trimEnd());
|
|
402
412
|
}
|
|
403
413
|
return n;
|
|
404
414
|
}
|
|
405
|
-
},
|
|
415
|
+
}, De = (e, t, n) => {
|
|
406
416
|
if (e.length >= t) return e;
|
|
407
417
|
let r = t - e.length;
|
|
408
418
|
return n === "right" ? e.padStart(t) : n === "center" ? " ".repeat(Math.floor(r / 2)) + e + " ".repeat(Math.ceil(r / 2)) : e.padEnd(t);
|
|
409
|
-
},
|
|
410
|
-
function
|
|
419
|
+
}, Oe = (e) => e.getRange().getTables()[0] ?? null;
|
|
420
|
+
function ke(e, t = []) {
|
|
411
421
|
let n = [...t], r = e.getDescription();
|
|
412
422
|
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
423
|
let i = Math.max(10, ...n.map(([e]) => e.length + 2));
|
|
414
424
|
return n.map(([e, t]) => `${e.padEnd(i)}${t}`);
|
|
415
425
|
}
|
|
416
|
-
function
|
|
426
|
+
function Ae(e, t, n) {
|
|
417
427
|
if (t.length === 0) return;
|
|
418
428
|
let r = t.map((e) => {
|
|
419
429
|
let t = e.getRange();
|
|
@@ -426,16 +436,16 @@ function je(e, t, n) {
|
|
|
426
436
|
e.h2(`Tables (${n} cell${n === 1 ? "" : "s"} · ${t.length} table${t.length === 1 ? "" : "s"})`);
|
|
427
437
|
for (let t of r) {
|
|
428
438
|
e.text(` ${t.address.padEnd(i)} ${t.size.padEnd(a)} ${t.table.getName()}`);
|
|
429
|
-
for (let n of
|
|
439
|
+
for (let n of ke(t.table)) e.text(` ${n}`);
|
|
430
440
|
}
|
|
431
441
|
e.blank();
|
|
432
442
|
}
|
|
433
|
-
function
|
|
434
|
-
let t = new
|
|
435
|
-
return t.h1(`Table — ${e.getName()}`), t.fact(
|
|
443
|
+
function je(e) {
|
|
444
|
+
let t = new I();
|
|
445
|
+
return t.h1(`Table — ${e.getName()}`), t.fact(ke(e, [["range", Xt(e.getRange())]])), t.toLines().join("\n").trimEnd();
|
|
436
446
|
}
|
|
437
|
-
var
|
|
438
|
-
function
|
|
447
|
+
var Me = o.Feature;
|
|
448
|
+
function Ne(e, t) {
|
|
439
449
|
let n = t?.maxSeries ?? 24, r = t?.maxProfileCells ?? 2e4, i = t?.maxCategories ?? 3, a = e.getRowCount(), o = e.getColumnCount();
|
|
440
450
|
if (a === 1 && o === 1) return {
|
|
441
451
|
shape: "cell",
|
|
@@ -445,13 +455,13 @@ function Pe(e, t) {
|
|
|
445
455
|
let s = e.getRange(), c = s.getCoords(), l = a >= o;
|
|
446
456
|
if (a === 1 || o === 1) return {
|
|
447
457
|
shape: "list",
|
|
448
|
-
summary:
|
|
458
|
+
summary: We(s, i),
|
|
449
459
|
series: []
|
|
450
460
|
};
|
|
451
|
-
let u =
|
|
461
|
+
let u = Pe(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 = Le(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 = [];
|
|
452
462
|
for (let t = 0; t < E; t++) {
|
|
453
463
|
let n = l ? s.getRangeAt(m, c.colStart + t, ee, c.colStart + t) : s.getRangeAt(c.rowStart + t, h, c.rowStart + t, T);
|
|
454
|
-
O.push(
|
|
464
|
+
O.push(Ue(e, l, t, u.names)), te.push(We(n, i));
|
|
455
465
|
}
|
|
456
466
|
let ne = O.length ? Math.max(...O.map((e) => e.length)) : 0, re = O.map((e, t) => `${e.padEnd(ne)} ${te[t]}`);
|
|
457
467
|
d > E && re.push(`…${d - E} more ${l ? "columns" : "rows"} not profiled · read them with getStats()`);
|
|
@@ -466,8 +476,8 @@ function Pe(e, t) {
|
|
|
466
476
|
series: re
|
|
467
477
|
};
|
|
468
478
|
}
|
|
469
|
-
function
|
|
470
|
-
let n = e.getRange(), r = n.getCoords(), i =
|
|
479
|
+
function Pe(e, t) {
|
|
480
|
+
let n = e.getRange(), r = n.getCoords(), i = Oe(e.getCell());
|
|
471
481
|
if (i) {
|
|
472
482
|
let e = i.getColumns().map((e) => e.getName()), n = i.getRange().getCoords();
|
|
473
483
|
return {
|
|
@@ -477,21 +487,21 @@ function Fe(e, t) {
|
|
|
477
487
|
names: t ? e : null
|
|
478
488
|
};
|
|
479
489
|
}
|
|
480
|
-
let a = t ? r.rowStart + 1 : r.colStart + 1, o =
|
|
481
|
-
if (
|
|
490
|
+
let a = t ? r.rowStart + 1 : r.colStart + 1, o = Ve(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);
|
|
491
|
+
if (Ve(s) && !o) return {
|
|
482
492
|
present: !0,
|
|
483
493
|
inside: !0,
|
|
484
|
-
note: "header " + (t ? `row ${r.rowStart + 1}` : `column ${
|
|
485
|
-
names:
|
|
494
|
+
note: "header " + (t ? `row ${r.rowStart + 1}` : `column ${F(r.colStart)}`),
|
|
495
|
+
names: He(s, e, t)
|
|
486
496
|
};
|
|
487
497
|
let c = (t ? r.rowStart : r.colStart) - 1;
|
|
488
|
-
if (c >= 0 && !
|
|
498
|
+
if (c >= 0 && !Ve(n)) {
|
|
489
499
|
let i = t ? n.getRangeAt(c, r.colStart, c, r.colEnd) : n.getRangeAt(r.rowStart, c, r.rowEnd, c);
|
|
490
|
-
if (
|
|
500
|
+
if (Ve(i)) return {
|
|
491
501
|
present: !0,
|
|
492
502
|
inside: !1,
|
|
493
|
-
note: `header ${t ? `row ${c + 1}` : `column ${
|
|
494
|
-
names:
|
|
503
|
+
note: `header ${t ? `row ${c + 1}` : `column ${F(c)}`} (above this block)`,
|
|
504
|
+
names: He(i, e, t)
|
|
495
505
|
};
|
|
496
506
|
}
|
|
497
507
|
return {
|
|
@@ -501,33 +511,33 @@ function Fe(e, t) {
|
|
|
501
511
|
names: null
|
|
502
512
|
};
|
|
503
513
|
}
|
|
504
|
-
var
|
|
505
|
-
function
|
|
514
|
+
var Fe = 3;
|
|
515
|
+
function Ie(e, t = 2e4) {
|
|
506
516
|
let n = e.getRowCount(), r = e.getColumnCount();
|
|
507
517
|
if (n < 2 || r < 2) return null;
|
|
508
|
-
let i = n >= r, a = e.getCoords(), o =
|
|
518
|
+
let i = n >= r, a = e.getCoords(), o = Pe({
|
|
509
519
|
getRowCount: () => n,
|
|
510
520
|
getColumnCount: () => r,
|
|
511
521
|
getCell: () => e.getCell(),
|
|
512
522
|
getRange: () => e
|
|
513
523
|
}, i), s = o.present && o.inside;
|
|
514
|
-
return
|
|
524
|
+
return Le(e, i, (i ? a.rowStart : a.colStart) + +!!s, t);
|
|
515
525
|
}
|
|
516
|
-
function
|
|
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 =
|
|
526
|
+
function Le(e, t, n, r) {
|
|
527
|
+
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 = Oe(e.getCell()), d = t && !!u?.isShowTotals() && u.getRange().getCoords().rowEnd === i.rowEnd;
|
|
518
528
|
if (d) l = a;
|
|
519
529
|
else {
|
|
520
530
|
if (e.getRowCount() * e.getColumnCount() > Math.min(r, 1e4)) return null;
|
|
521
531
|
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);
|
|
522
532
|
for (let r = n; r <= a; r++) {
|
|
523
533
|
if (r - n >= 2) {
|
|
524
|
-
let n =
|
|
534
|
+
let n = Re(f, (e) => d(r, o + e), p, m, (e) => t ? `${F(o + e)}${r + 1}` : `${F(r)}${o + e + 1}`);
|
|
525
535
|
if (n.matches >= 2 && 2 * n.matches > n.candidates) {
|
|
526
536
|
let i = t ? e.getRangeAt(r, o, r, s) : e.getRangeAt(o, r, s, r);
|
|
527
537
|
l = r, c = {
|
|
528
538
|
...n,
|
|
529
539
|
byColumn: t,
|
|
530
|
-
typed: (i.getCounts([
|
|
540
|
+
typed: (i.getCounts([Me.Formula])[Me.Formula] ?? 0) === 0
|
|
531
541
|
};
|
|
532
542
|
break;
|
|
533
543
|
}
|
|
@@ -547,17 +557,17 @@ function Re(e, t, n, r) {
|
|
|
547
557
|
} : {
|
|
548
558
|
rowIndex: i.rowStart,
|
|
549
559
|
colIndex: n
|
|
550
|
-
}, a =
|
|
560
|
+
}, a = Be(e, r) ?? P(f, r, t ? "row" : "column");
|
|
551
561
|
p.push({
|
|
552
562
|
index: n,
|
|
553
563
|
label: a,
|
|
554
564
|
...n === l && c ? { sums: c } : {}
|
|
555
565
|
});
|
|
556
566
|
}
|
|
557
|
-
let m = (e) => t ? String(e + 1) :
|
|
567
|
+
let m = (e) => t ? String(e + 1) : F(e), h = l === a ? `${t ? "row" : "column"} ${m(l)}` : `${t ? "rows" : "columns"} ${m(l)}:${m(a)}`, g = p.slice(0, Fe).map((e) => [
|
|
558
568
|
m(e.index),
|
|
559
569
|
e.label ? JSON.stringify(e.label.text) : null,
|
|
560
|
-
e.sums ?
|
|
570
|
+
e.sums ? ze(e.sums) : e.index === l && d ? "table totals" : null
|
|
561
571
|
].filter(Boolean).join(" ")), _ = p.length - g.length;
|
|
562
572
|
return {
|
|
563
573
|
byColumn: t,
|
|
@@ -566,7 +576,7 @@ function Re(e, t, n, r) {
|
|
|
566
576
|
note: `${h} not profiled: ${g.join(" · ")}${_ > 0 ? ` · +${_} more` : ""}`
|
|
567
577
|
};
|
|
568
578
|
}
|
|
569
|
-
function
|
|
579
|
+
function Re(e, t, n, r, i) {
|
|
570
580
|
let a = 0, o = 0, s = [];
|
|
571
581
|
for (let c = 0; c < e; c++) {
|
|
572
582
|
if (!r[c]) continue;
|
|
@@ -580,11 +590,11 @@ function ze(e, t, n, r, i) {
|
|
|
580
590
|
misses: s
|
|
581
591
|
};
|
|
582
592
|
}
|
|
583
|
-
function
|
|
593
|
+
function ze(e) {
|
|
584
594
|
let t = e.misses.slice(0, 3), n = e.misses.length - t.length, r = t.length > 0 ? `; ${t.join(", ")}${n > 0 ? `, +${n} more` : ""}` : "";
|
|
585
595
|
return `${e.typed ? "typed, " : ""}= Σ ${e.byColumn ? "above" : "to the left"} (${e.matches} of ${e.candidates}${r})`;
|
|
586
596
|
}
|
|
587
|
-
function
|
|
597
|
+
function Be(e, t) {
|
|
588
598
|
let n = e.getRangeAt(t.rowIndex, t.colIndex).getCell();
|
|
589
599
|
if (n.getType() !== b.String) return null;
|
|
590
600
|
let r = D(n, w.Mode.Display)?.match;
|
|
@@ -593,11 +603,11 @@ function Ve(e, t) {
|
|
|
593
603
|
address: n.getAddress()
|
|
594
604
|
} : null;
|
|
595
605
|
}
|
|
596
|
-
function
|
|
606
|
+
function Ve(e) {
|
|
597
607
|
let t = e.getStats({ onError: "ignore" }), n = t.getCount();
|
|
598
608
|
return n > 0 && (t.getTypedCounts()[b.String] ?? 0) === n;
|
|
599
609
|
}
|
|
600
|
-
function
|
|
610
|
+
function He(e, t, n) {
|
|
601
611
|
let r = t.getRange().getCoords(), i = e.getCoords(), a = n ? r.colEnd - r.colStart + 1 : r.rowEnd - r.rowStart + 1, o = [];
|
|
602
612
|
for (let t = 0; t < a; t++) {
|
|
603
613
|
let a = n ? e.getRangeAt(i.rowStart, r.colStart + t).getCell() : e.getRangeAt(r.rowStart + t, i.colStart).getCell();
|
|
@@ -605,25 +615,25 @@ function Ue(e, t, n) {
|
|
|
605
615
|
}
|
|
606
616
|
return o;
|
|
607
617
|
}
|
|
608
|
-
function
|
|
609
|
-
let i = e.getRange().getCoords(), a = t ?
|
|
618
|
+
function Ue(e, t, n, r) {
|
|
619
|
+
let i = e.getRange().getCoords(), a = t ? F(i.colStart + n) : String(i.rowStart + n + 1), o = r?.[n];
|
|
610
620
|
return o ? `${a} ${o}` : a;
|
|
611
621
|
}
|
|
612
|
-
function
|
|
622
|
+
function We(e, t = 3) {
|
|
613
623
|
let n = e.getStats({ onError: "ignore" }), r = n.getTypedCounts(), i = n.getCount(), a = n.getSize(), o = a - i;
|
|
614
624
|
if (i === 0) return `${a} cells, all blank`;
|
|
615
|
-
let s = e.getCounts([
|
|
625
|
+
let s = e.getCounts([Me.Formula])[Me.Formula] ?? 0, c = Ke(e), l = r[b.Number] ?? 0, u = r[b.String] ?? 0, d = r[b.Error] ?? 0, f = [String(i)], p = !1;
|
|
616
626
|
if (s === i) {
|
|
617
|
-
let t = [...e.getRegions(
|
|
627
|
+
let t = [...e.getRegions(Me.Formula)];
|
|
618
628
|
if (t.length === 1) {
|
|
619
629
|
let e = t[0].getCell().getFormulaText();
|
|
620
630
|
f.push("formula", e || "(uniform)");
|
|
621
631
|
} else f.push("formula", `${t.length} distinct`);
|
|
622
|
-
} else if (c === i) f.push("date",
|
|
632
|
+
} else if (c === i) f.push("date", Je(n, qe(e).format));
|
|
623
633
|
else if (l === i) {
|
|
624
|
-
let t =
|
|
625
|
-
f.push("number",
|
|
626
|
-
} else if (u === i) f.push("text",
|
|
634
|
+
let t = qe(e);
|
|
635
|
+
f.push("number", Je(n, t.format), ...Ye(n, t));
|
|
636
|
+
} else if (u === i) f.push("text", Xe(n, t));
|
|
627
637
|
else {
|
|
628
638
|
let e = [
|
|
629
639
|
l ? `number ${l}` : null,
|
|
@@ -640,33 +650,33 @@ function Ge(e, t = 3) {
|
|
|
640
650
|
].filter(Boolean), h = f.filter(Boolean).join(" ");
|
|
641
651
|
return m.length ? `${h} · ${m.join(" · ")}` : h;
|
|
642
652
|
}
|
|
643
|
-
function
|
|
653
|
+
function Ge(e, t = 3) {
|
|
644
654
|
let n = e.getStats({ onError: "ignore" }), r = n.getTypedCounts(), i = [], a = r[b.Number] ?? 0;
|
|
645
655
|
if (a > 0) {
|
|
646
|
-
let t =
|
|
656
|
+
let t = qe(e), r = [Je(n, t.format), ...Ye(n, t)].filter(Boolean);
|
|
647
657
|
i.push(`Number: ${a} ${r.join(" ")}`.trimEnd());
|
|
648
658
|
}
|
|
649
659
|
let o = r[b.String] ?? 0;
|
|
650
660
|
if (o > 0) {
|
|
651
|
-
let e =
|
|
661
|
+
let e = Xe(n, t, (e) => typeof e == "string");
|
|
652
662
|
i.push(`String: ${o} ${e}`.trimEnd());
|
|
653
663
|
}
|
|
654
664
|
let s = r[b.Boolean] ?? 0;
|
|
655
665
|
if (s > 0) {
|
|
656
|
-
let e =
|
|
666
|
+
let e = Xe(n, t, (e) => typeof e == "boolean");
|
|
657
667
|
i.push(`Boolean: ${s} ${e}`.trimEnd());
|
|
658
668
|
}
|
|
659
669
|
return i;
|
|
660
670
|
}
|
|
661
|
-
function
|
|
671
|
+
function Ke(e) {
|
|
662
672
|
let t = 0;
|
|
663
673
|
return e.forEach((e, n) => {
|
|
664
674
|
n.getInteropType() === v.Date && t++;
|
|
665
675
|
}), t;
|
|
666
676
|
}
|
|
667
|
-
function
|
|
677
|
+
function qe(e) {
|
|
668
678
|
let t = (e) => e.getStats({ onError: "ignore" }).getTypedCounts()[b.Number] ?? 0, n = /* @__PURE__ */ new Map(), r = 0;
|
|
669
|
-
for (let i of e.getRegions(
|
|
679
|
+
for (let i of e.getRegions(Me.NumberFormat)) {
|
|
670
680
|
let e = i.getRange().getStyle().getNumberFormat(), a = t(i.getRange());
|
|
671
681
|
r += a, e && a > 0 && n.set(e, (n.get(e) ?? 0) + a);
|
|
672
682
|
}
|
|
@@ -690,51 +700,51 @@ function Je(e) {
|
|
|
690
700
|
mixed: a.map(([e, t]) => `${e} ${t}`).join(" · ")
|
|
691
701
|
};
|
|
692
702
|
}
|
|
693
|
-
function
|
|
703
|
+
function Je(e, t) {
|
|
694
704
|
let n = e.getAggregates({ onError: "ignore" });
|
|
695
705
|
if (n.min === null || n.max === null) return "";
|
|
696
706
|
let r = E(n.min, t), i = E(n.max, t);
|
|
697
707
|
return r === i ? r : `${r} … ${i}`;
|
|
698
708
|
}
|
|
699
|
-
function
|
|
709
|
+
function Ye(e, { format: t, mixed: n }) {
|
|
700
710
|
if (n) return [`mixed formats (${n})`];
|
|
701
711
|
let r = e.getAggregates({ onError: "ignore" }), i = [];
|
|
702
712
|
return r.sum !== null && i.push(`Σ ${E(r.sum, t)}`), r.average !== null && i.push(`x̄ ${E(r.average, t)}`), i;
|
|
703
713
|
}
|
|
704
|
-
function
|
|
714
|
+
function Xe(e, t, n) {
|
|
705
715
|
let r = e.getFrequencies(n ? { filterFn: n } : void 0), i = r.getUniqueCount();
|
|
706
716
|
if (i === 0) return "";
|
|
707
717
|
if (i === r.getTotalCount()) return `${i} distinct, no repeats`;
|
|
708
718
|
let a = Array.from(r.getValueCounts()).slice(0, t);
|
|
709
719
|
return `${i} unique (${a.map(([e, t]) => `${e} ${t}`).join(" · ")}${i > a.length ? " · …" : ""})`;
|
|
710
720
|
}
|
|
711
|
-
var
|
|
721
|
+
var L = o.Feature, Ze = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), Qe = (e, t) => {
|
|
712
722
|
let n = Math.min(e.rowEnd, t.rowEnd) - Math.max(e.rowStart, t.rowStart) + 1;
|
|
713
723
|
if (n <= 0) return 0;
|
|
714
724
|
let r = Math.min(e.colEnd, t.colEnd) - Math.max(e.colStart, t.colStart) + 1;
|
|
715
725
|
return r <= 0 ? 0 : n * r;
|
|
716
|
-
},
|
|
717
|
-
let n = `×${
|
|
718
|
-
return t === "times" || e.styled === e.content ? n : `${n} (+${
|
|
719
|
-
},
|
|
726
|
+
}, $e = (e) => e.toLocaleString("en-US"), et = (e, t) => {
|
|
727
|
+
let n = `×${$e(e.content)}`;
|
|
728
|
+
return t === "times" || e.styled === e.content ? n : `${n} (+${$e(e.styled - e.content)} blank)`;
|
|
729
|
+
}, tt = (t) => {
|
|
720
730
|
if (t.length === 0) return "";
|
|
721
731
|
let n = e.rangeToString(t[0]);
|
|
722
732
|
if (t.length === 1) return n;
|
|
723
733
|
let r = t.length - 1;
|
|
724
734
|
return `${n}, +${r} block${r === 1 ? "" : "s"}`;
|
|
725
735
|
};
|
|
726
|
-
function
|
|
727
|
-
let n = t?.manyDistinct ?? 20, { sorted: r, top: i, rare: a, more: o } =
|
|
736
|
+
function nt(e, t) {
|
|
737
|
+
let n = t?.manyDistinct ?? 20, { sorted: r, top: i, rare: a, more: o } = rt(e, t);
|
|
728
738
|
if (r.length === 0) return "";
|
|
729
739
|
let s = (e) => ((e, t) => {
|
|
730
|
-
let n =
|
|
731
|
-
return `${e.label === t?.hideLabel ? "" : `${e.label} `}${
|
|
740
|
+
let n = tt(e.blocks);
|
|
741
|
+
return `${e.label === t?.hideLabel ? "" : `${e.label} `}${et(e, t?.countStyle ?? "cells")}${n ? ` ${n}` : ""}`;
|
|
732
742
|
})(e, t);
|
|
733
743
|
if (o === 0) return r.map(s).join(" · ");
|
|
734
744
|
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 ` : "";
|
|
735
745
|
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(" · ");
|
|
736
746
|
}
|
|
737
|
-
function
|
|
747
|
+
function rt(e, t) {
|
|
738
748
|
let n = t?.maxValues ?? 8, r = [...e].sort((e, t) => t.content - e.content || t.styled - e.styled || (e.label < t.label ? -1 : 1));
|
|
739
749
|
if (r.length <= n) return {
|
|
740
750
|
sorted: r,
|
|
@@ -751,97 +761,97 @@ function it(e, t) {
|
|
|
751
761
|
more: r.length - a.length - o.length
|
|
752
762
|
};
|
|
753
763
|
}
|
|
754
|
-
var
|
|
764
|
+
var it = [
|
|
755
765
|
{
|
|
756
766
|
name: "family",
|
|
757
|
-
project: (e, t) =>
|
|
767
|
+
project: (e, t) => R(e.getFont().getFamily(), t?.getFont().getFamily())
|
|
758
768
|
},
|
|
759
769
|
{
|
|
760
770
|
name: "size",
|
|
761
|
-
project: (e, t) =>
|
|
771
|
+
project: (e, t) => R(e.getFont().getSize(), t?.getFont().getSize(), (e) => `${e}pt`)
|
|
762
772
|
},
|
|
763
773
|
{
|
|
764
774
|
name: "bold",
|
|
765
|
-
project: (e, t) =>
|
|
775
|
+
project: (e, t) => R(e.getFont().getBold(), t?.getFont().getBold() ?? !1, (e) => e ? "bold" : "not bold")
|
|
766
776
|
},
|
|
767
777
|
{
|
|
768
778
|
name: "italic",
|
|
769
|
-
project: (e, t) =>
|
|
779
|
+
project: (e, t) => R(e.getFont().getItalic(), t?.getFont().getItalic() ?? !1, (e) => e ? "italic" : "not italic")
|
|
770
780
|
},
|
|
771
781
|
{
|
|
772
782
|
name: "underline",
|
|
773
|
-
project: (e, t) =>
|
|
783
|
+
project: (e, t) => R(e.getFont().getUnderline(), t?.getFont().getUnderline(), (e) => String(e))
|
|
774
784
|
},
|
|
775
785
|
{
|
|
776
786
|
name: "strike",
|
|
777
|
-
project: (e, t) =>
|
|
787
|
+
project: (e, t) => R(e.getFont().getStrike(), t?.getFont().getStrike() ?? !1, (e) => e ? "strike" : "not strike")
|
|
778
788
|
},
|
|
779
789
|
{
|
|
780
790
|
name: "color",
|
|
781
|
-
project: (e, t) =>
|
|
791
|
+
project: (e, t) => R(N(e.getFont().getColor()), t ? N(t.getFont().getColor()) : null)
|
|
782
792
|
}
|
|
783
|
-
],
|
|
793
|
+
], at = (e) => ft(e) ?? "Custom", ot = {
|
|
784
794
|
name: "category",
|
|
785
795
|
project: (e) => {
|
|
786
|
-
let t =
|
|
787
|
-
return t === null ? null :
|
|
796
|
+
let t = Se(e);
|
|
797
|
+
return t === null ? null : at(t);
|
|
788
798
|
}
|
|
789
|
-
},
|
|
799
|
+
}, st = {
|
|
790
800
|
name: "format",
|
|
791
|
-
project: (e) =>
|
|
792
|
-
},
|
|
801
|
+
project: (e) => Se(e)
|
|
802
|
+
}, ct = [ot, st], lt = [{
|
|
793
803
|
name: "color",
|
|
794
|
-
project: (e) =>
|
|
795
|
-
}],
|
|
804
|
+
project: (e) => ve(e)
|
|
805
|
+
}], ut = [{
|
|
796
806
|
name: "edges",
|
|
797
|
-
project: (e) =>
|
|
798
|
-
}],
|
|
807
|
+
project: (e) => ye(e)
|
|
808
|
+
}], dt = [
|
|
799
809
|
{
|
|
800
810
|
name: "h",
|
|
801
811
|
ambiguous: !0,
|
|
802
|
-
project: (e, t) =>
|
|
812
|
+
project: (e, t) => R(e.getAlignment().getHorizontal(), t?.getAlignment().getHorizontal())
|
|
803
813
|
},
|
|
804
814
|
{
|
|
805
815
|
name: "v",
|
|
806
816
|
ambiguous: !0,
|
|
807
|
-
project: (e, t) =>
|
|
817
|
+
project: (e, t) => R(e.getAlignment().getVertical(), t?.getAlignment().getVertical())
|
|
808
818
|
},
|
|
809
819
|
{
|
|
810
820
|
name: "overflow",
|
|
811
|
-
project: (e, t) =>
|
|
821
|
+
project: (e, t) => R(e.getAlignment().getOverflow(), t?.getAlignment().getOverflow())
|
|
812
822
|
},
|
|
813
823
|
{
|
|
814
824
|
name: "indent",
|
|
815
|
-
project: (e, t) =>
|
|
825
|
+
project: (e, t) => R(e.getAlignment().getIndent(), t?.getAlignment().getIndent() ?? 0, (e) => `indent ${e}`)
|
|
816
826
|
},
|
|
817
827
|
{
|
|
818
828
|
name: "rotation",
|
|
819
|
-
project: (e, t) =>
|
|
829
|
+
project: (e, t) => R(e.getAlignment().getRotation(), t?.getAlignment().getRotation() ?? 0, (e) => `rotation ${e}`)
|
|
820
830
|
}
|
|
821
831
|
];
|
|
822
|
-
function
|
|
832
|
+
function R(e, t, n = String) {
|
|
823
833
|
return e == null || t !== void 0 && e === t ? null : n(e);
|
|
824
834
|
}
|
|
825
|
-
function
|
|
835
|
+
function ft(e) {
|
|
826
836
|
if (!e || e === "General") return null;
|
|
827
837
|
let t = y.Builder.parse(e);
|
|
828
838
|
if (t.category === "General") return null;
|
|
829
839
|
let n = t.decimalPlaces;
|
|
830
840
|
return n == null ? t.category : `${t.category} ${n}dp`;
|
|
831
841
|
}
|
|
832
|
-
var
|
|
833
|
-
[
|
|
834
|
-
[
|
|
835
|
-
[
|
|
836
|
-
[
|
|
837
|
-
[
|
|
838
|
-
},
|
|
839
|
-
function
|
|
840
|
-
let i =
|
|
842
|
+
var pt = {
|
|
843
|
+
[L.Font]: it,
|
|
844
|
+
[L.NumberFormat]: ct,
|
|
845
|
+
[L.Fill]: lt,
|
|
846
|
+
[L.Borders]: ut,
|
|
847
|
+
[L.Alignment]: dt
|
|
848
|
+
}, mt = (e) => e in pt;
|
|
849
|
+
function ht(e, t, n, r) {
|
|
850
|
+
let i = pt[t];
|
|
841
851
|
if (!i) return null;
|
|
842
852
|
let a = e.getEntireCoords(), o = e.getUsedRange()?.getCoords() ?? null, s = [...e.getEntireRange().getRegions(t)];
|
|
843
853
|
if (s.length === 0) return null;
|
|
844
|
-
let c = r?.content ?? (o ? [...e.getEntireRange().getRegions(
|
|
854
|
+
let c = r?.content ?? (o ? [...e.getEntireRange().getRegions(L.Contentful)].map((e) => e.getCoords()) : []), l = (e) => c.reduce((t, n) => t + Qe(e, n), 0), u = (e) => o ? Qe(e, o) : 0, d = (e) => {
|
|
845
855
|
let t = e.getRange().getStyle(), r = [];
|
|
846
856
|
for (let e of i) {
|
|
847
857
|
let i = e.project(t, n);
|
|
@@ -856,7 +866,7 @@ function gt(e, t, n, r) {
|
|
|
856
866
|
2 * (t.rowEnd - t.rowStart + 1) > m ? g.push(e) : 2 * (t.colEnd - t.colStart + 1) > h ? _.push(e) : v.push(e);
|
|
857
867
|
}
|
|
858
868
|
let y = [];
|
|
859
|
-
y.push(...
|
|
869
|
+
y.push(...St("columns", g, d, a, !0)), y.push(...St("rows", _, d, a, !1));
|
|
860
870
|
let b = v.reduce((e, t) => e + u(t.getCoords()), 0), x = (e) => {
|
|
861
871
|
let t = [];
|
|
862
872
|
for (let r of v) {
|
|
@@ -898,31 +908,31 @@ function gt(e, t, n, r) {
|
|
|
898
908
|
}
|
|
899
909
|
return [...r.values()].map((e) => ({
|
|
900
910
|
...e,
|
|
901
|
-
blocks: e.blocks.sort((e, t) =>
|
|
911
|
+
blocks: e.blocks.sort((e, t) => Ze(t) - Ze(e))
|
|
902
912
|
}));
|
|
903
913
|
}, S = [];
|
|
904
|
-
if (t ===
|
|
905
|
-
let { top: r, rare: i, more: a } =
|
|
914
|
+
if (t === L.NumberFormat) S.push(...function(e, t, n) {
|
|
915
|
+
let { top: r, rare: i, more: a } = rt(e, n), o = [], s = -1;
|
|
906
916
|
for (let e of [...r, ...i]) {
|
|
907
917
|
e === i[0] && (s = o.length);
|
|
908
|
-
let n =
|
|
918
|
+
let n = rt(t.filter((t) => at(t.label) === e.label), { maxValues: 1 / 0 }).sorted, r = n.length === 1;
|
|
909
919
|
if (o.push([
|
|
910
920
|
e.label,
|
|
911
|
-
|
|
912
|
-
|
|
921
|
+
et(e, "cells"),
|
|
922
|
+
tt(e.blocks),
|
|
913
923
|
r ? n[0].label : `${n.length} formats`
|
|
914
924
|
]), !r) {
|
|
915
|
-
for (let e of n.slice(0,
|
|
925
|
+
for (let e of n.slice(0, xt)) o.push([
|
|
916
926
|
"",
|
|
917
|
-
|
|
918
|
-
|
|
927
|
+
et(e, "cells"),
|
|
928
|
+
tt(e.blocks),
|
|
919
929
|
e.label
|
|
920
930
|
]);
|
|
921
|
-
n.length >
|
|
931
|
+
n.length > xt && o.push([
|
|
922
932
|
"",
|
|
923
933
|
"",
|
|
924
934
|
"",
|
|
925
|
-
`…and ${n.length -
|
|
935
|
+
`…and ${n.length - xt} more`
|
|
926
936
|
]);
|
|
927
937
|
}
|
|
928
938
|
}
|
|
@@ -932,25 +942,25 @@ function gt(e, t, n, r) {
|
|
|
932
942
|
2
|
|
933
943
|
].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());
|
|
934
944
|
return a > 0 && l.splice(s < 0 ? l.length : s, 0, `…and ${a} more${n?.recovery ? ` · ${n.recovery}` : ""}`), l;
|
|
935
|
-
}(x(
|
|
945
|
+
}(x(ot), x(st), r));
|
|
936
946
|
else for (let e of i) {
|
|
937
947
|
let t = x(e);
|
|
938
948
|
if (t.length === 0) continue;
|
|
939
|
-
let n =
|
|
949
|
+
let n = nt(t, {
|
|
940
950
|
...r,
|
|
941
951
|
hideLabel: e.name
|
|
942
952
|
});
|
|
943
|
-
n.length <=
|
|
953
|
+
n.length <= yt ? S.push(`${e.name.padEnd(10)}${n}`) : S.push(...bt(e.name, t, r));
|
|
944
954
|
}
|
|
945
955
|
return {
|
|
946
956
|
distinct: f.size,
|
|
947
957
|
cells: b,
|
|
948
|
-
normal: n ?
|
|
958
|
+
normal: n ? vt(t, n) : null,
|
|
949
959
|
tiers: y,
|
|
950
960
|
attributes: S
|
|
951
961
|
};
|
|
952
962
|
}
|
|
953
|
-
function
|
|
963
|
+
function gt(e, t) {
|
|
954
964
|
if (e.length === 0) return null;
|
|
955
965
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = 0;
|
|
956
966
|
for (let t of e) {
|
|
@@ -976,7 +986,7 @@ function _t(e, t) {
|
|
|
976
986
|
label: e.label,
|
|
977
987
|
content: e.cells,
|
|
978
988
|
styled: e.cells,
|
|
979
|
-
blocks: e.blocks.sort((e, t) =>
|
|
989
|
+
blocks: e.blocks.sort((e, t) => Ze(t) - Ze(e))
|
|
980
990
|
})), s = [...r.entries()].map(([e, t]) => ({
|
|
981
991
|
label: e,
|
|
982
992
|
content: t,
|
|
@@ -990,10 +1000,10 @@ function _t(e, t) {
|
|
|
990
1000
|
blocks: []
|
|
991
1001
|
}), {
|
|
992
1002
|
distinct: n.size,
|
|
993
|
-
lines: [`${"distinct".padEnd(10)}${
|
|
1003
|
+
lines: [`${"distinct".padEnd(10)}${nt(o, a)}`, `${"functions".padEnd(10)}${nt(s, a)}`]
|
|
994
1004
|
};
|
|
995
1005
|
}
|
|
996
|
-
function
|
|
1006
|
+
function _t(e, t) {
|
|
997
1007
|
let n = e.getStats({ onError: "ignore" }).getTypedCounts(), r = /* @__PURE__ */ new Map(), i = [
|
|
998
1008
|
["number", "number"],
|
|
999
1009
|
["string", "text"],
|
|
@@ -1005,7 +1015,7 @@ function vt(e, t) {
|
|
|
1005
1015
|
let i = n[e] ?? 0;
|
|
1006
1016
|
i > 0 && r.set(t, i);
|
|
1007
1017
|
}
|
|
1008
|
-
let a =
|
|
1018
|
+
let a = Ke(e), o = 0;
|
|
1009
1019
|
for (let e of t) {
|
|
1010
1020
|
let t = e.getRange().getStats({ onError: "ignore" }).getTypedCounts();
|
|
1011
1021
|
o += e.getRowCount() * e.getColumnCount();
|
|
@@ -1013,42 +1023,42 @@ function vt(e, t) {
|
|
|
1013
1023
|
let i = t[e] ?? 0;
|
|
1014
1024
|
i > 0 && r.set(n, (r.get(n) ?? 0) - i);
|
|
1015
1025
|
}
|
|
1016
|
-
a > 0 && (t.number ?? 0) > 0 && (a -=
|
|
1026
|
+
a > 0 && (t.number ?? 0) > 0 && (a -= Ke(e.getRange()));
|
|
1017
1027
|
}
|
|
1018
1028
|
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]);
|
|
1019
1029
|
}
|
|
1020
|
-
function
|
|
1030
|
+
function vt(e, t) {
|
|
1021
1031
|
switch (e) {
|
|
1022
|
-
case
|
|
1023
|
-
let t = e.getFont(), n = [t.getFamily(), `${t.getSize()}pt`], r =
|
|
1032
|
+
case L.Font: return function(e) {
|
|
1033
|
+
let t = e.getFont(), n = [t.getFamily(), `${t.getSize()}pt`], r = N(t.getColor());
|
|
1024
1034
|
return r && n.push(r), t.getBold() && n.push("bold"), t.getItalic() && n.push("italic"), n.join(" · ");
|
|
1025
1035
|
}(t);
|
|
1026
|
-
case
|
|
1027
|
-
let e =
|
|
1028
|
-
return e === null ? null : `${
|
|
1036
|
+
case L.NumberFormat: {
|
|
1037
|
+
let e = Se(t);
|
|
1038
|
+
return e === null ? null : `${at(e)} ${e}`;
|
|
1029
1039
|
}
|
|
1030
|
-
case
|
|
1031
|
-
case
|
|
1032
|
-
case
|
|
1040
|
+
case L.Fill: return ve(t);
|
|
1041
|
+
case L.Borders: return ye(t);
|
|
1042
|
+
case L.Alignment: {
|
|
1033
1043
|
let e = t.getAlignment(), n = [];
|
|
1034
1044
|
return e.getHorizontal() !== "general" && n.push(`h ${e.getHorizontal()}`), e.getVertical() !== "bottom" && n.push(`v ${e.getVertical()}`), e.getOverflow() !== "visible" && n.push(String(e.getOverflow())), e.getIndent() && n.push(`indent ${e.getIndent()}`), e.getRotation() && n.push(`rotation ${e.getRotation()}`), n.length > 0 ? n.join(" · ") : null;
|
|
1035
1045
|
}
|
|
1036
1046
|
default: return null;
|
|
1037
1047
|
}
|
|
1038
1048
|
}
|
|
1039
|
-
var
|
|
1040
|
-
function
|
|
1041
|
-
let { sorted: r, top: i, rare: a, more: o } =
|
|
1042
|
-
|
|
1043
|
-
|
|
1049
|
+
var yt = 110;
|
|
1050
|
+
function bt(e, t, n) {
|
|
1051
|
+
let { sorted: r, top: i, rare: a, more: o } = rt(t, n), s = [...i, ...a].map((e) => [
|
|
1052
|
+
et(e, "cells"),
|
|
1053
|
+
tt(e.blocks),
|
|
1044
1054
|
e.label
|
|
1045
1055
|
]), 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]}`);
|
|
1046
1056
|
o > 0 && l.splice(i.length, 0, ` …and ${o} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
|
|
1047
1057
|
let u = n?.manyDistinct ?? 20;
|
|
1048
1058
|
return [r.length > u ? `${e.padEnd(10)}${r.length} distinct` : e, ...l];
|
|
1049
1059
|
}
|
|
1050
|
-
var
|
|
1051
|
-
function
|
|
1060
|
+
var xt = 6;
|
|
1061
|
+
function St(t, n, r, i, a) {
|
|
1052
1062
|
if (n.length === 0) return [];
|
|
1053
1063
|
let o = /* @__PURE__ */ new Map();
|
|
1054
1064
|
for (let e of n) {
|
|
@@ -1067,20 +1077,20 @@ function Ct(t, n, r, i, a) {
|
|
|
1067
1077
|
}
|
|
1068
1078
|
return c;
|
|
1069
1079
|
}
|
|
1070
|
-
var
|
|
1080
|
+
var Ct = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, wt = (e) => {
|
|
1071
1081
|
if (!e) return null;
|
|
1072
|
-
if (typeof e != "string") return
|
|
1082
|
+
if (typeof e != "string") return N(e);
|
|
1073
1083
|
let t = e.replace(/^#/, "");
|
|
1074
1084
|
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;
|
|
1075
|
-
},
|
|
1085
|
+
}, Tt = (e) => {
|
|
1076
1086
|
if (!e) return null;
|
|
1077
1087
|
let t = [], n = ((e) => {
|
|
1078
1088
|
if (!e) return null;
|
|
1079
|
-
if (typeof e == "string") return
|
|
1089
|
+
if (typeof e == "string") return wt(e);
|
|
1080
1090
|
let t = e.type;
|
|
1081
1091
|
if (t === u.Type.None) return null;
|
|
1082
1092
|
if (t === u.Type.Gradient) return "gradient";
|
|
1083
|
-
let n = e, r =
|
|
1093
|
+
let n = e, r = wt(n.foreground ?? e.color ?? n.background), i = n.patternType;
|
|
1084
1094
|
return [i && i !== u.BuiltInSheetPattern.Solid ? `${i} pattern` : null, r].filter(Boolean).join(" ") || null;
|
|
1085
1095
|
})(e.fill);
|
|
1086
1096
|
n && t.push(`fill ${n}`);
|
|
@@ -1088,7 +1098,7 @@ var wt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Tt = (e) => {
|
|
|
1088
1098
|
if (r) {
|
|
1089
1099
|
let e = [];
|
|
1090
1100
|
(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}`);
|
|
1091
|
-
let n = r.color === "auto" ? null :
|
|
1101
|
+
let n = r.color === "auto" ? null : wt(r.color);
|
|
1092
1102
|
n && e.push(`text ${n}`), e.length > 0 && t.push(e.join(" "));
|
|
1093
1103
|
}
|
|
1094
1104
|
if (e.numberFormat !== void 0 && e.numberFormat !== null) {
|
|
@@ -1096,30 +1106,30 @@ var wt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Tt = (e) => {
|
|
|
1096
1106
|
n && t.push(n);
|
|
1097
1107
|
}
|
|
1098
1108
|
return e.borders && t.push("border"), e.alignment && t.push("alignment"), t.length > 0 ? t.join(" · ") : null;
|
|
1099
|
-
},
|
|
1100
|
-
let t = e.type ?? c.ColorStopType.Num, n = e.value, r = n == null || n === "" ? t : `${t} ${n}`, i =
|
|
1109
|
+
}, Et = (e) => {
|
|
1110
|
+
let t = e.type ?? c.ColorStopType.Num, n = e.value, r = n == null || n === "" ? t : `${t} ${n}`, i = wt(e.color);
|
|
1101
1111
|
return i ? `${r} ${i}` : r;
|
|
1102
|
-
},
|
|
1112
|
+
}, Dt = (e) => {
|
|
1103
1113
|
let t = e.type;
|
|
1104
1114
|
if (e.type === c.ScaleType.DataBar) {
|
|
1105
|
-
let n =
|
|
1115
|
+
let n = wt(e.color);
|
|
1106
1116
|
n && (t += ` ${n}`);
|
|
1107
1117
|
} else e.type === c.ScaleType.IconSet && (e.iconSet && (t += ` ${e.iconSet}`), e.reverse && (t += " reversed"), e.icon?.length && (t += " custom icons"));
|
|
1108
|
-
let n = (e.stops ?? []).map(
|
|
1118
|
+
let n = (e.stops ?? []).map(Et).join(" → ");
|
|
1109
1119
|
return n ? `${t} · ${n}` : t;
|
|
1110
|
-
},
|
|
1120
|
+
}, Ot = "(no rule)", kt = (e) => {
|
|
1111
1121
|
let t = e.getScale(), n = [];
|
|
1112
|
-
if (t) n.push(
|
|
1122
|
+
if (t) n.push(Dt(t));
|
|
1113
1123
|
else {
|
|
1114
|
-
n.push(e.getCondition()?.toString() ||
|
|
1115
|
-
let t =
|
|
1124
|
+
n.push(e.getCondition()?.toString() || Ot);
|
|
1125
|
+
let t = Tt(e.getStyle());
|
|
1116
1126
|
t && n.push(`→ ${t}`);
|
|
1117
1127
|
}
|
|
1118
|
-
return e.isStopIfTrue() && n.push("· stop if true"),
|
|
1128
|
+
return e.isStopIfTrue() && n.push("· stop if true"), Ct(n.join(" "), 90);
|
|
1129
|
+
}, At = (e) => {
|
|
1130
|
+
let t = [e.getCondition()?.toString() || Ot], n = e.getAlertStyle();
|
|
1131
|
+
return n && t.push(n), e.isIncludeBlanks() && t.push("blanks allowed"), e.isHideDropdown() && t.push("no dropdown"), Ct(t.join(" · "), 90);
|
|
1119
1132
|
}, 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) => {
|
|
1123
1133
|
if (e?.getOperator()?.getName() !== s.BuiltInOperatorNames.InSet) return null;
|
|
1124
1134
|
let t = e.getParam();
|
|
1125
1135
|
if (!t) return null;
|
|
@@ -1131,73 +1141,118 @@ var wt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Tt = (e) => {
|
|
|
1131
1141
|
n.push(t > 0 ? `${e.join(", ")}, +${t} more` : e.join(", "));
|
|
1132
1142
|
}
|
|
1133
1143
|
return n.length > 0 ? n.join(", ") : null;
|
|
1134
|
-
},
|
|
1144
|
+
}, Mt = (e, t) => {
|
|
1135
1145
|
if (e.length === 0) return null;
|
|
1136
1146
|
let n = e.slice(0, 3).map(t), r = e.length - n.length;
|
|
1137
1147
|
return r > 0 ? `${n.join(" | ")} | +${r} more` : n.join(" | ");
|
|
1138
|
-
},
|
|
1139
|
-
|
|
1148
|
+
}, Nt = (t, n) => {
|
|
1149
|
+
if (t.isInvalid()) return "#REF!";
|
|
1150
|
+
let r = t.getWorksheet(), i = e.rangeToString(t.getCoords(), r.getEntireCoords()) ?? "#REF!";
|
|
1151
|
+
return r === n ? i : `${V(r.getName())}!${i}`;
|
|
1152
|
+
}, Pt = (e) => {
|
|
1153
|
+
let t = [];
|
|
1154
|
+
for (let n of [
|
|
1155
|
+
"high",
|
|
1156
|
+
"low",
|
|
1157
|
+
"first",
|
|
1158
|
+
"last",
|
|
1159
|
+
"negative",
|
|
1160
|
+
"markers"
|
|
1161
|
+
]) e[n] && t.push(n);
|
|
1162
|
+
e.displayXAxis && t.push("axis");
|
|
1163
|
+
for (let [n, r, i] of [[
|
|
1164
|
+
e.minAxisType,
|
|
1165
|
+
e.manualMin,
|
|
1166
|
+
"min"
|
|
1167
|
+
], [
|
|
1168
|
+
e.maxAxisType,
|
|
1169
|
+
e.manualMax,
|
|
1170
|
+
"max"
|
|
1171
|
+
]]) n === "group" ? t.push(`same ${i}`) : n === "custom" && t.push(`${i} ${r ?? 0}`);
|
|
1172
|
+
let n = e.displayEmptyCellsAs ?? "zero";
|
|
1173
|
+
return n !== "gap" && t.push(`empty as ${n}`), e.displayHidden && t.push("hidden shown"), e.rightToLeft && t.push("right to left"), e.dateAxis && e.dateRange && t.push(`dates ${e.dateRange}`), t;
|
|
1174
|
+
}, z = o.Feature, Ft = (e) => e.getRange().getStyle(), It = (e) => D(e.getCell(), w.Mode.Display)?.display ?? null;
|
|
1175
|
+
function Lt(e, t) {
|
|
1140
1176
|
switch (e) {
|
|
1141
|
-
case
|
|
1142
|
-
case
|
|
1143
|
-
case
|
|
1144
|
-
let t =
|
|
1177
|
+
case z.Formula: return (e) => e.getCell().getFormulaText();
|
|
1178
|
+
case z.Error: return It;
|
|
1179
|
+
case z.CalcError: return (e) => {
|
|
1180
|
+
let t = It(e) ?? "", n = e.getCell().getFormulaText();
|
|
1145
1181
|
return (n ? `${t} ${n}` : t).trim() || null;
|
|
1146
1182
|
};
|
|
1147
|
-
case
|
|
1148
|
-
case
|
|
1183
|
+
case z.CalcStatus: return (e) => e.getCell().getCalculationStatus();
|
|
1184
|
+
case z.Anomalies: return (e) => {
|
|
1149
1185
|
let t = e.getCell(), n = function(e, t) {
|
|
1150
1186
|
let n = e.getAnomalies();
|
|
1151
1187
|
return !1 === t?.constants && (n = n.filter((e) => e.check !== A.ConstantFrequency)), n.length === 0 ? null : n.map((t) => ce(t, e)).join("; ");
|
|
1152
1188
|
}(t, { constants: !1 });
|
|
1153
1189
|
if (!n) return null;
|
|
1154
|
-
let r = t.getFormulaText() ??
|
|
1190
|
+
let r = t.getFormulaText() ?? It(e);
|
|
1155
1191
|
return r ? `${n} · here ${r}` : n;
|
|
1156
1192
|
};
|
|
1157
|
-
case
|
|
1158
|
-
case
|
|
1193
|
+
case z.Merge: return It;
|
|
1194
|
+
case z.Comments: return (e) => {
|
|
1159
1195
|
let t = e.getCell().getComments()?.getContent();
|
|
1160
1196
|
if (typeof t != "string") return null;
|
|
1161
1197
|
let n = t.replace(/\s+/g, " ").trim();
|
|
1162
1198
|
return n ? n.length > 60 ? `${n.slice(0, 59)}…` : n : null;
|
|
1163
1199
|
};
|
|
1164
|
-
case
|
|
1200
|
+
case z.Spills: return (e) => {
|
|
1165
1201
|
let t = e.getCell();
|
|
1166
1202
|
return t.getSpillKind() === "error" ? null : t.getSpill()?.getValuesRange().toString() ?? null;
|
|
1167
1203
|
};
|
|
1168
|
-
case
|
|
1169
|
-
case
|
|
1170
|
-
case
|
|
1171
|
-
case
|
|
1172
|
-
case
|
|
1173
|
-
case
|
|
1174
|
-
case
|
|
1175
|
-
case
|
|
1176
|
-
let t =
|
|
1204
|
+
case z.Hyperlink: return (e) => e.getCell().getHyperlink()?.getAddress() ?? null;
|
|
1205
|
+
case z.Table: return (e) => Oe(e.getCell())?.getName() ?? null;
|
|
1206
|
+
case z.Fill: return (e) => ve(Ft(e));
|
|
1207
|
+
case z.Borders: return (e) => ye(Ft(e));
|
|
1208
|
+
case z.NumberFormat: return (e) => Se(Ft(e));
|
|
1209
|
+
case z.Alignment: return t ? (e) => Ce(Ft(e), t) : void 0;
|
|
1210
|
+
case z.Font: return t ? (e) => we(Ft(e), t) : void 0;
|
|
1211
|
+
case z.Protection: return (e) => {
|
|
1212
|
+
let t = Ft(e).getProtection(), n = [];
|
|
1177
1213
|
return t.isAlwaysUnlocked() && n.push("always unlocked"), t.isShowFormulas() || n.push("formulas hidden"), n.join(", ") || null;
|
|
1178
1214
|
};
|
|
1179
|
-
case
|
|
1215
|
+
case z.Unlock: return (e) => {
|
|
1180
1216
|
let t = [];
|
|
1181
1217
|
e.getCell().getProtection().isAlwaysUnlocked() && t.push("always unlocked");
|
|
1182
1218
|
let n = e.getRange();
|
|
1183
1219
|
for (let e of n.getWorksheet().getProtectedRanges().getItems({ address: n })) t.push(`range ${e.getName()}${e.isUnlocked() ? "" : " · password"}`);
|
|
1184
1220
|
return t.join(", ") || null;
|
|
1185
1221
|
};
|
|
1186
|
-
case
|
|
1187
|
-
case
|
|
1188
|
-
case
|
|
1189
|
-
case
|
|
1222
|
+
case z.Conditionals: return (e) => Mt(e.getRange().getConditionalFormats(), kt);
|
|
1223
|
+
case z.DataValidations: return (e) => Mt(e.getRange().getDataValidations(), At);
|
|
1224
|
+
case z.Role: return (e) => e.getCell().getRole();
|
|
1225
|
+
case z.Sparkline: return (e) => ((e) => {
|
|
1226
|
+
let t = e.getCell().getSparkline();
|
|
1227
|
+
if (!t) return null;
|
|
1228
|
+
let n = t.getGroup(), r = e.getWorksheet(), i = e.getCoords(), a = n.getSparkline({
|
|
1229
|
+
rowIndex: i.rowEnd,
|
|
1230
|
+
colIndex: i.colEnd
|
|
1231
|
+
}) ?? t, o = t.getDataRange(), s = a.getDataRange();
|
|
1232
|
+
if (a !== t && !o.isInvalid() && !s.isInvalid() && o.getWorksheet() === s.getWorksheet()) {
|
|
1233
|
+
let e = o.getCoords(), t = s.getCoords();
|
|
1234
|
+
o = o.getWorksheet().getRange({
|
|
1235
|
+
rowStart: Math.min(e.rowStart, t.rowStart),
|
|
1236
|
+
rowEnd: Math.max(e.rowEnd, t.rowEnd),
|
|
1237
|
+
colStart: Math.min(e.colStart, t.colStart),
|
|
1238
|
+
colEnd: Math.max(e.colEnd, t.colEnd)
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
let c = [n.getType(), `reads ${Nt(o, r)}`], l = Pt(n.getProperties());
|
|
1242
|
+
return l.length > 0 && c.push(l.join(", ")), c.join(" · ");
|
|
1243
|
+
})(e.getRange());
|
|
1244
|
+
case z.Contentful: return (e) => Ge(e.getRange()).join(" ") || null;
|
|
1190
1245
|
default: return;
|
|
1191
1246
|
}
|
|
1192
1247
|
}
|
|
1193
|
-
function
|
|
1194
|
-
let n = e.map((e) =>
|
|
1248
|
+
function Rt(e, t) {
|
|
1249
|
+
let n = e.map((e) => Lt(e, t)).filter((e) => !!e);
|
|
1195
1250
|
if (n.length !== 0) return n.length === 1 ? n[0] : (e) => {
|
|
1196
1251
|
let t = n.map((t) => t(e)).filter(Boolean);
|
|
1197
1252
|
return t.length > 0 ? t.join(" ") : null;
|
|
1198
1253
|
};
|
|
1199
1254
|
}
|
|
1200
|
-
function
|
|
1255
|
+
function zt(e, t, n) {
|
|
1201
1256
|
let r = n?.collapse ? function(e, t) {
|
|
1202
1257
|
let n = [], r = /* @__PURE__ */ new Map();
|
|
1203
1258
|
for (let i of e) {
|
|
@@ -1211,12 +1266,12 @@ function Lt(e, t, n) {
|
|
|
1211
1266
|
for (let t = 0; t < o.length; t++) {
|
|
1212
1267
|
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)}`;
|
|
1213
1268
|
if (t < f) {
|
|
1214
|
-
let t =
|
|
1269
|
+
let t = Ne(i, n);
|
|
1215
1270
|
if (e.text(`${p} ${t.summary}${s}`), !1 === n?.series) continue;
|
|
1216
1271
|
for (let n of t.series) e.text(` ${n}`);
|
|
1217
1272
|
continue;
|
|
1218
1273
|
}
|
|
1219
|
-
let m = r ?
|
|
1274
|
+
let m = r ? Vt(r[t]) : "";
|
|
1220
1275
|
e.text(a ? `${p} ${a}${m}${s}` : `${p}${m}${s}`.trimEnd());
|
|
1221
1276
|
}
|
|
1222
1277
|
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) {
|
|
@@ -1224,28 +1279,28 @@ function Lt(e, t, n) {
|
|
|
1224
1279
|
e.text(` …truncated at ${a} of ${s} · ${o}`);
|
|
1225
1280
|
}
|
|
1226
1281
|
}
|
|
1227
|
-
var
|
|
1228
|
-
function
|
|
1282
|
+
var Bt = 6;
|
|
1283
|
+
function Vt(e) {
|
|
1229
1284
|
if (e.length < 2) return "";
|
|
1230
1285
|
let t = e.slice(1);
|
|
1231
|
-
return ` · also at ${t.slice(0,
|
|
1286
|
+
return ` · also at ${t.slice(0, Bt).map((e) => e.toString()).join(", ")}${t.length > Bt ? ` +${t.length - Bt} more` : ""}`;
|
|
1232
1287
|
}
|
|
1233
|
-
var
|
|
1288
|
+
var Ht = (e) => {
|
|
1234
1289
|
let t = e.getCell().getAnomalies();
|
|
1235
1290
|
return t.length > 0 ? JSON.stringify(t.map((e) => [e.check, e.evidence])) : null;
|
|
1236
1291
|
};
|
|
1237
|
-
function
|
|
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
|
|
1292
|
+
function Ut(e, t) {
|
|
1293
|
+
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 I();
|
|
1239
1294
|
c.h1(`Regions — ${i} (${n.length})`);
|
|
1240
1295
|
let l = r.length === 1 && r[0] === o.Feature.Anomalies;
|
|
1241
|
-
return
|
|
1296
|
+
return zt(c, n, {
|
|
1242
1297
|
...t,
|
|
1243
1298
|
profile: a,
|
|
1244
|
-
payload: a ? void 0 :
|
|
1245
|
-
collapse: l ?
|
|
1299
|
+
payload: a ? void 0 : Rt(r, s),
|
|
1300
|
+
collapse: l ? Ht : void 0
|
|
1246
1301
|
}), c.toLines().join("\n").trimEnd();
|
|
1247
1302
|
}
|
|
1248
|
-
var B = o.Feature,
|
|
1303
|
+
var B = o.Feature, Wt = [
|
|
1249
1304
|
B.Error,
|
|
1250
1305
|
B.CalcError,
|
|
1251
1306
|
B.Anomalies,
|
|
@@ -1256,6 +1311,7 @@ var B = o.Feature, Ht = [
|
|
|
1256
1311
|
B.AutoTable,
|
|
1257
1312
|
B.Hyperlink,
|
|
1258
1313
|
B.Comments,
|
|
1314
|
+
B.Sparkline,
|
|
1259
1315
|
B.NumberFormat,
|
|
1260
1316
|
B.Font,
|
|
1261
1317
|
B.Fill,
|
|
@@ -1263,8 +1319,12 @@ var B = o.Feature, Ht = [
|
|
|
1263
1319
|
B.Alignment,
|
|
1264
1320
|
B.Conditionals,
|
|
1265
1321
|
B.DataValidations
|
|
1266
|
-
],
|
|
1267
|
-
|
|
1322
|
+
], Gt = /* @__PURE__ */ new Set([
|
|
1323
|
+
B.Sparkline,
|
|
1324
|
+
B.Conditionals,
|
|
1325
|
+
B.DataValidations
|
|
1326
|
+
]), Kt = new Map(Object.entries(B).map(([e, t]) => [t, e])), qt = (e) => Kt.get(e) ?? e;
|
|
1327
|
+
function Jt(e) {
|
|
1268
1328
|
let t = new Map(Object.values(B).map((e) => [e.toLowerCase(), e])), n = [];
|
|
1269
1329
|
for (let r of e.split(",")) {
|
|
1270
1330
|
let e = r.trim();
|
|
@@ -1275,7 +1335,7 @@ function Gt(e) {
|
|
|
1275
1335
|
}
|
|
1276
1336
|
return n;
|
|
1277
1337
|
}
|
|
1278
|
-
var
|
|
1338
|
+
var Yt = (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
1339
|
if (!e.includes("$")) return e;
|
|
1280
1340
|
let t = "", n = !1;
|
|
1281
1341
|
for (let r of e) {
|
|
@@ -1287,17 +1347,17 @@ var Kt = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, V
|
|
|
1287
1347
|
})(e.getAddress()), W = (e) => {
|
|
1288
1348
|
let t = U(e);
|
|
1289
1349
|
return t.includes("!") ? t : `${V(e.getWorksheet().getName())}!${t}`;
|
|
1290
|
-
},
|
|
1350
|
+
}, Xt = (e) => {
|
|
1291
1351
|
let t = e.toString();
|
|
1292
1352
|
return `${t.includes("!") ? t : `${V(e.getWorksheet().getName())}!${t}`}, ${e.getRowCount()}×${e.getColumnCount()}`;
|
|
1293
1353
|
};
|
|
1294
|
-
function
|
|
1295
|
-
let n =
|
|
1354
|
+
function Zt(e, t) {
|
|
1355
|
+
let n = _t(t, [...t.getRegions(B.Formula)]), r = t.getStats({ onError: "ignore" }).getCount();
|
|
1296
1356
|
e.h2(`Kind (${r} cell${r === 1 ? "" : "s"} · ${n.length} kind${n.length === 1 ? "" : "s"})`);
|
|
1297
1357
|
for (let [t, r] of n) e.text(` ${t.padEnd(10)}${r}`);
|
|
1298
1358
|
n.length === 0 && e.fact("None"), e.blank();
|
|
1299
1359
|
}
|
|
1300
|
-
var
|
|
1360
|
+
var Qt = [
|
|
1301
1361
|
a.Role.Label,
|
|
1302
1362
|
a.Role.Input,
|
|
1303
1363
|
a.Role.Link,
|
|
@@ -1305,7 +1365,7 @@ var Yt = [
|
|
|
1305
1365
|
a.Role.Computed,
|
|
1306
1366
|
a.Role.Output
|
|
1307
1367
|
];
|
|
1308
|
-
function
|
|
1368
|
+
function $t(e, t) {
|
|
1309
1369
|
let n = [...t.getRegions([B.Role, B.Font])];
|
|
1310
1370
|
if (n.length === 0) return;
|
|
1311
1371
|
let r = t.getWorksheet().getWorkbook()?.getStyles() ?? null, i = (e) => {
|
|
@@ -1324,7 +1384,7 @@ function Xt(e, t) {
|
|
|
1324
1384
|
}
|
|
1325
1385
|
if (o.size !== 0) {
|
|
1326
1386
|
e.h2(`Roles (${s} cell${s === 1 ? "" : "s"} · ${o.size} role${o.size === 1 ? "" : "s"})`);
|
|
1327
|
-
for (let t of
|
|
1387
|
+
for (let t of Qt) {
|
|
1328
1388
|
let n = o.get(t);
|
|
1329
1389
|
if (!n) continue;
|
|
1330
1390
|
let r = [...n.values()].reduce((e, t) => e + t, 0), i = [...n].sort((e, t) => t[1] - e[1]).map(([e, t]) => `${e} ${t}`).join(" · ");
|
|
@@ -1333,49 +1393,49 @@ function Xt(e, t) {
|
|
|
1333
1393
|
e.blank();
|
|
1334
1394
|
}
|
|
1335
1395
|
}
|
|
1336
|
-
function
|
|
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 =
|
|
1396
|
+
function en(e, t, n) {
|
|
1397
|
+
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 = Wt.filter((e) => !i || i.has(e));
|
|
1338
1398
|
if (a.length === 0) return;
|
|
1339
1399
|
let o = t.getCounts(a), s, c = () => s ??= [...t.getWorksheet().getEntireRange().getRegions(B.Contentful)].map((e) => e.getCoords());
|
|
1340
1400
|
for (let i of a) {
|
|
1341
|
-
let a = i === B.Contentful ?
|
|
1342
|
-
if (i === B.Anomalies && (
|
|
1343
|
-
|
|
1344
|
-
let n = r && i !== B.Font ?
|
|
1345
|
-
n && (e.h2(`${
|
|
1401
|
+
let a = n?.layerScope && Gt.has(i) ? n.layerScope : t, s = i === B.Contentful ? an(t) : [...a.getRegions(i)], l = (a === t ? o : a.getCounts([i]))[i] ?? 0, u = null;
|
|
1402
|
+
if (i === B.Anomalies && (u = s, s = s.filter((e) => !pe(e.getCell().getAnomalies())), l = s.reduce((e, t) => e + t.getRowCount() * t.getColumnCount(), 0)), s.length === 0) {
|
|
1403
|
+
u && rn(e, t, u);
|
|
1404
|
+
let n = r && i !== B.Font ? vt(i, r) : null;
|
|
1405
|
+
n && (e.h2(`${qt(i)} (${on(0, 0)})`), e.text(` ${"normal".padEnd(10)}${n}`), e.blank());
|
|
1346
1406
|
continue;
|
|
1347
1407
|
}
|
|
1348
|
-
let
|
|
1349
|
-
recovery:
|
|
1408
|
+
let d = !!n?.profile && i === B.Contentful, f = `${H(t)}.getRegions(${JSON.stringify(i)})`, p = `${f} lists all ${s.length}`, m = mt(i) ? ht(t.getWorksheet(), i, r, {
|
|
1409
|
+
recovery: p,
|
|
1350
1410
|
content: c()
|
|
1351
|
-
}) : null,
|
|
1352
|
-
if (e.h2(`${
|
|
1353
|
-
|
|
1354
|
-
for (let t of
|
|
1355
|
-
for (let t of
|
|
1356
|
-
e.text(` ${"regions".padEnd(10)}${
|
|
1411
|
+
}) : null, h = i === B.Formula ? gt(s, { recovery: p }) : null, g = m ? `${on(s.length, m.cells)} · ${m.distinct} distinct` : h ? `${on(s.length, l)} · ${h.distinct} distinct` : on(s.length, l);
|
|
1412
|
+
if (e.h2(`${qt(i)} (${g})`), m) {
|
|
1413
|
+
m.normal && e.text(` ${"normal".padEnd(10)}${m.normal}`);
|
|
1414
|
+
for (let t of m.tiers) e.text(` ${t}`);
|
|
1415
|
+
for (let t of m.attributes) e.text(` ${t}`);
|
|
1416
|
+
e.text(` ${"regions".padEnd(10)}${f}`), e.blank();
|
|
1357
1417
|
} else {
|
|
1358
|
-
if (
|
|
1359
|
-
i === B.Contentful &&
|
|
1418
|
+
if (h) for (let t of h.lines) e.text(` ${t}`);
|
|
1419
|
+
i === B.Contentful && s.sort((e, t) => t.getRowCount() * t.getColumnCount() - e.getRowCount() * e.getColumnCount()), zt(e, s, {
|
|
1360
1420
|
maxRegions: n?.maxRegions,
|
|
1361
1421
|
maxProfiled: n?.maxProfiled,
|
|
1362
|
-
profile:
|
|
1422
|
+
profile: d,
|
|
1363
1423
|
series: !1,
|
|
1364
|
-
payload:
|
|
1365
|
-
collapse: i === B.Anomalies ?
|
|
1366
|
-
recovery:
|
|
1367
|
-
}), e.blank(),
|
|
1424
|
+
payload: d ? void 0 : Lt(i, r),
|
|
1425
|
+
collapse: i === B.Anomalies ? Ht : void 0,
|
|
1426
|
+
recovery: p
|
|
1427
|
+
}), e.blank(), u && rn(e, t, u);
|
|
1368
1428
|
}
|
|
1369
1429
|
}
|
|
1370
1430
|
}
|
|
1371
|
-
var
|
|
1372
|
-
function
|
|
1431
|
+
var tn = 30, nn = 4;
|
|
1432
|
+
function rn(e, t, n) {
|
|
1373
1433
|
let r = /* @__PURE__ */ new Map(), i = 0;
|
|
1374
1434
|
for (let e of n) for (let t of e.getCell().getAnomalies()) {
|
|
1375
1435
|
if (t.check !== a.ErrorCheck.ConstantFrequency) continue;
|
|
1376
1436
|
let n = `${t.evidence.kind}:${t.evidence.value}`, o = r.get(n);
|
|
1377
1437
|
o || r.set(n, o = {
|
|
1378
|
-
text:
|
|
1438
|
+
text: fe(t.evidence),
|
|
1379
1439
|
uses: Number(t.evidence.uses ?? 1),
|
|
1380
1440
|
places: []
|
|
1381
1441
|
}), o.places.push(e.toString()), i = Math.max(i, Number(t.evidence.of ?? 0));
|
|
@@ -1383,32 +1443,32 @@ function en(e, t, n) {
|
|
|
1383
1443
|
if (r.size === 0) return;
|
|
1384
1444
|
let o = [...r.values()].sort((e, t) => e.uses - t.uses || (e.text < t.text ? -1 : +(e.text > t.text)));
|
|
1385
1445
|
e.h2(`Constants (${r.size} distinct · ${i} use${i === 1 ? "" : "s"} in the workbook, rarest first)`);
|
|
1386
|
-
let s = Math.min(24, Math.max(10, ...o.slice(0,
|
|
1387
|
-
for (let t of o.slice(0,
|
|
1388
|
-
let n = t.places.slice(0,
|
|
1446
|
+
let s = Math.min(24, Math.max(10, ...o.slice(0, tn).map((e) => e.text.length + 2)));
|
|
1447
|
+
for (let t of o.slice(0, tn)) {
|
|
1448
|
+
let n = t.places.slice(0, nn).join(", "), r = t.places.length > nn ? ` +${t.places.length - nn} more` : "";
|
|
1389
1449
|
e.text(` ${t.text.padEnd(s)}${t.uses} use${t.uses === 1 ? "" : "s"} · ${n}${r}`);
|
|
1390
1450
|
}
|
|
1391
|
-
o.length >
|
|
1451
|
+
o.length > tn && e.text(` …and ${o.length - tn} more · ${H(t)}.getAnomalies({ checks: ['constantFrequency'] }) lists every region`), e.blank();
|
|
1392
1452
|
}
|
|
1393
|
-
var
|
|
1453
|
+
var an = (e) => [...e.getRegions([B.Contentful, B.Table])].filter((e) => e.getCell().isContentful()), on = (e, t) => `${t} cell${t === 1 ? "" : "s"} · ${e} region${e === 1 ? "" : "s"}`, sn = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, cn = (e) => e.isIFormula ? e : null, ln = (e) => {
|
|
1394
1454
|
let t = e.getScope();
|
|
1395
1455
|
return t ? `${V(t)}!${e.getName()}` : e.getName();
|
|
1396
|
-
},
|
|
1456
|
+
}, un = (e) => {
|
|
1397
1457
|
let t = e.getAddress();
|
|
1398
1458
|
return t.includes("!") ? t : `${V(e.getWorksheet().getName())}!${t}`;
|
|
1399
1459
|
};
|
|
1400
|
-
async function
|
|
1401
|
-
let t =
|
|
1460
|
+
async function dn(e) {
|
|
1461
|
+
let t = cn(e), n;
|
|
1402
1462
|
return n = t ? "=" + t.getExpression() : e.getRanges?.()?.getAddress() ?? "", t && await t.isVolatile() && (n += " (volatile)"), n.trim();
|
|
1403
1463
|
}
|
|
1404
|
-
var
|
|
1464
|
+
var fn = /* @__PURE__ */ new Set([n.Code.Ref, n.Code.Name]), pn = (e) => {
|
|
1405
1465
|
let t = e.value, r = typeof t == "string" ? t : t?.error, i = typeof r == "string" ? n.getBuiltInByLabel(r) : void 0;
|
|
1406
|
-
return i &&
|
|
1407
|
-
},
|
|
1466
|
+
return i && fn.has(i.getCode()) ? i.getCode() === n.Code.Name ? "#NAME?" : "#REF!" : null;
|
|
1467
|
+
}, mn = /* @__PURE__ */ new Set(), hn = (e) => {
|
|
1408
1468
|
let t = e.value;
|
|
1409
1469
|
return typeof t == "object" && t?.name ? t.name : e.text ?? "";
|
|
1410
1470
|
};
|
|
1411
|
-
function
|
|
1471
|
+
function gn(e) {
|
|
1412
1472
|
let t = null;
|
|
1413
1473
|
for (let n = 0; n < e.length; n++) {
|
|
1414
1474
|
let r = e[n];
|
|
@@ -1418,19 +1478,19 @@ function pn(e) {
|
|
|
1418
1478
|
let a = n + 1;
|
|
1419
1479
|
for (; a < e.length && e[a].type === "whitespace";) a++;
|
|
1420
1480
|
if (e[a]?.type !== "separator") continue;
|
|
1421
|
-
let o =
|
|
1481
|
+
let o = hn(r).toLowerCase();
|
|
1422
1482
|
o && (t ??= /* @__PURE__ */ new Set()).add(o);
|
|
1423
1483
|
}
|
|
1424
|
-
return t ??
|
|
1484
|
+
return t ?? mn;
|
|
1425
1485
|
}
|
|
1426
|
-
async function
|
|
1486
|
+
async function _n(e, t, n) {
|
|
1427
1487
|
if (t.length === 0) return;
|
|
1428
1488
|
let r = /* @__PURE__ */ new Set();
|
|
1429
1489
|
for (let e of n?.symbols ?? t) r.add(e.getName().toLowerCase());
|
|
1430
1490
|
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
1431
1491
|
for (let e of t) i.set(e.getId(), e), e.getScope() && a.add(e.getName().toLowerCase());
|
|
1432
1492
|
let o = await Promise.all(t.map((e) => {
|
|
1433
|
-
let t =
|
|
1493
|
+
let t = cn(e);
|
|
1434
1494
|
return t ? async function(e, t) {
|
|
1435
1495
|
let n = await e.getDirectDependents(), r = 0, i = [], a = /* @__PURE__ */ new Set(), o = [];
|
|
1436
1496
|
if (n) {
|
|
@@ -1442,10 +1502,10 @@ async function mn(e, t, n) {
|
|
|
1442
1502
|
if (a.has(e.getId())) continue;
|
|
1443
1503
|
a.add(e.getId());
|
|
1444
1504
|
let n = t.get(e.getId());
|
|
1445
|
-
i.push(n ?
|
|
1505
|
+
i.push(n ? ln(n) : e.getName());
|
|
1446
1506
|
} else {
|
|
1447
1507
|
let t = e[c];
|
|
1448
|
-
r += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), o.push(
|
|
1508
|
+
r += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), o.push(un(s));
|
|
1449
1509
|
}
|
|
1450
1510
|
}
|
|
1451
1511
|
}
|
|
@@ -1458,7 +1518,7 @@ async function mn(e, t, n) {
|
|
|
1458
1518
|
for (let e = 0; e < c.length; e++) {
|
|
1459
1519
|
let t = (l.length > 0 ? 2 : 0) + c[e].length;
|
|
1460
1520
|
if (l.length > 0 && u + t > 60) break;
|
|
1461
|
-
l.push(l.length === 0 ?
|
|
1521
|
+
l.push(l.length === 0 ? sn(c[e], 60) : c[e]), u += t;
|
|
1462
1522
|
}
|
|
1463
1523
|
let d = c.length - l.length, f = d > 0 ? `, +${d} more` : "";
|
|
1464
1524
|
return {
|
|
@@ -1468,17 +1528,17 @@ async function mn(e, t, n) {
|
|
|
1468
1528
|
}(t, i) : Promise.resolve(null);
|
|
1469
1529
|
})), s = n?.omitUnread ? t.filter((e, t) => o[t]?.weight !== 0) : t, c = s === t ? o : o.filter((e) => e?.weight !== 0), l = t.length - s.length, u = await Promise.all(s.map(async (e, t) => {
|
|
1470
1530
|
let n = function(e, t) {
|
|
1471
|
-
let n =
|
|
1531
|
+
let n = cn(e), r = [];
|
|
1472
1532
|
if (n) {
|
|
1473
1533
|
let e = n.getTokens(), i = null, a = null;
|
|
1474
1534
|
for (let n of e) {
|
|
1475
1535
|
if (n.type === "error") {
|
|
1476
|
-
a ??=
|
|
1536
|
+
a ??= pn(n);
|
|
1477
1537
|
continue;
|
|
1478
1538
|
}
|
|
1479
1539
|
if (n.type !== "named") continue;
|
|
1480
|
-
let o =
|
|
1481
|
-
o && !t.has(o.toLowerCase()) && (i ??=
|
|
1540
|
+
let o = hn(n);
|
|
1541
|
+
o && !t.has(o.toLowerCase()) && (i ??= gn(e), i.has(o.toLowerCase()) || r.includes(o) || r.push(o));
|
|
1482
1542
|
}
|
|
1483
1543
|
if (a || r.length > 0) return {
|
|
1484
1544
|
broken: !0,
|
|
@@ -1512,13 +1572,13 @@ async function mn(e, t, n) {
|
|
|
1512
1572
|
...i,
|
|
1513
1573
|
text: "unused · shadowed"
|
|
1514
1574
|
});
|
|
1515
|
-
let o = e.getComment() ?? "", s =
|
|
1575
|
+
let o = e.getComment() ?? "", s = ln(e);
|
|
1516
1576
|
return {
|
|
1517
1577
|
name: s,
|
|
1518
|
-
refersTo: await
|
|
1578
|
+
refersTo: await dn(e),
|
|
1519
1579
|
dependents: i,
|
|
1520
1580
|
hidden: e.isHidden(),
|
|
1521
|
-
comment:
|
|
1581
|
+
comment: sn(o, 60),
|
|
1522
1582
|
broken: n.broken,
|
|
1523
1583
|
error: n.error,
|
|
1524
1584
|
sortKey: s.toLowerCase().replace(/'/g, "")
|
|
@@ -1550,7 +1610,7 @@ async function mn(e, t, n) {
|
|
|
1550
1610
|
}
|
|
1551
1611
|
e.blank();
|
|
1552
1612
|
}
|
|
1553
|
-
function
|
|
1613
|
+
function vn(e, t, n) {
|
|
1554
1614
|
let r = n.getCoords().min, i = [], a = 0, o = 0;
|
|
1555
1615
|
if (n.forEachSpan((e, t) => {
|
|
1556
1616
|
let s = t.getCoords();
|
|
@@ -1569,7 +1629,7 @@ function hn(e, t, n) {
|
|
|
1569
1629
|
for (let t of i) e.text(` ${t.address.padEnd(s)} ${t.count}`);
|
|
1570
1630
|
o > i.length && e.text(` …and ${o - i.length} more`), e.blank();
|
|
1571
1631
|
}
|
|
1572
|
-
function
|
|
1632
|
+
function yn(e) {
|
|
1573
1633
|
let t = e.getOutline(), n = [];
|
|
1574
1634
|
for (let [e, r] of [[p.Axis.Row, "rows"], [p.Axis.Column, "columns"]]) {
|
|
1575
1635
|
let i = t.getLevelCount(e);
|
|
@@ -1580,10 +1640,10 @@ function gn(e) {
|
|
|
1580
1640
|
}
|
|
1581
1641
|
return n.length > 0 ? n.join(" · ") : null;
|
|
1582
1642
|
}
|
|
1583
|
-
function
|
|
1643
|
+
function bn(e, t, n, r) {
|
|
1584
1644
|
if (n.length === 0) return;
|
|
1585
1645
|
let i = n.length > 50 ? n.slice(0, 50) : n, a = i.map((e) => ({
|
|
1586
|
-
address:
|
|
1646
|
+
address: sn(U(e.getRanges()), 40),
|
|
1587
1647
|
rule: r(e)
|
|
1588
1648
|
}));
|
|
1589
1649
|
e.h2(`${t} (${n.length})`);
|
|
@@ -1591,7 +1651,7 @@ function _n(e, t, n, r) {
|
|
|
1591
1651
|
for (let t of a) e.text(` ${t.address.padEnd(o)} ${t.rule}`.trimEnd());
|
|
1592
1652
|
i.length < n.length && e.text(` …and ${n.length - i.length} more`), e.blank();
|
|
1593
1653
|
}
|
|
1594
|
-
function
|
|
1654
|
+
function xn(e, t = !1) {
|
|
1595
1655
|
let n = e.getWorksheet(), r = n.getName(), i = n.getNames(), a = [...i.getItems({
|
|
1596
1656
|
address: e,
|
|
1597
1657
|
allowExtrudes: !0,
|
|
@@ -1612,23 +1672,23 @@ function vn(e, t = !1) {
|
|
|
1612
1672
|
}
|
|
1613
1673
|
return a;
|
|
1614
1674
|
}
|
|
1615
|
-
async function
|
|
1675
|
+
async function Sn(e, t) {
|
|
1616
1676
|
let n = t.getWorksheet();
|
|
1617
|
-
await
|
|
1677
|
+
await _n(e, xn(t, !0), { symbols: n.getWorkbook()?.getNames().getItems({ includeHidden: !0 }) ?? n.getNames().getItems({ includeHidden: !0 }) ?? [] });
|
|
1618
1678
|
let r = t.getColumnHeaders(), i = t.getRowHeaders();
|
|
1619
|
-
|
|
1679
|
+
vn(e, "Hidden Columns", r), vn(e, "Hidden Rows", i);
|
|
1620
1680
|
let a = t.getTables();
|
|
1621
|
-
a.length > 0 &&
|
|
1681
|
+
a.length > 0 && Ae(e, a, t.getCounts([B.Table])[B.Table] ?? 0);
|
|
1622
1682
|
}
|
|
1623
|
-
var
|
|
1683
|
+
var Cn = "#REF!", wn = (e) => {
|
|
1624
1684
|
let t = e.getContent();
|
|
1625
1685
|
return t.getType() === "chart" && typeof t.getSeries == "function" ? t : null;
|
|
1626
|
-
},
|
|
1686
|
+
}, Tn = (t, n) => `${V(t.getName())}!${e.rangeToString(n) ?? ""}`, En = (e, t) => e ? Tn(e.getWorksheet(), e.getCoords()) : t, G = (e) => e.replace(/\s*[\r\n]+\s*/g, " ⏎ ").trim(), Dn = (e, t) => ({
|
|
1627
1687
|
colStart: Math.min(e.colStart, t.colStart),
|
|
1628
1688
|
rowStart: Math.min(e.rowStart, t.rowStart),
|
|
1629
1689
|
colEnd: Math.max(e.colEnd, t.colEnd),
|
|
1630
1690
|
rowEnd: Math.max(e.rowEnd, t.rowEnd)
|
|
1631
|
-
}),
|
|
1691
|
+
}), On = (e) => {
|
|
1632
1692
|
if (e.length === 0) return null;
|
|
1633
1693
|
let t = e[0], n = t.getValuesRange();
|
|
1634
1694
|
if (!n) return null;
|
|
@@ -1653,29 +1713,29 @@ var bn = "#REF!", xn = (e) => {
|
|
|
1653
1713
|
}
|
|
1654
1714
|
}
|
|
1655
1715
|
return {
|
|
1656
|
-
values:
|
|
1716
|
+
values: Tn(r, Dn(i, f)),
|
|
1657
1717
|
by: a ? null : c,
|
|
1658
|
-
names: u && p ?
|
|
1659
|
-
categories:
|
|
1718
|
+
names: u && p ? Tn(u.getWorksheet(), Dn(u.getCoords(), p)) : null,
|
|
1719
|
+
categories: En(t.getCategoriesRange(), l)
|
|
1660
1720
|
};
|
|
1661
|
-
},
|
|
1721
|
+
}, kn = (e) => {
|
|
1662
1722
|
let t = [], n = [
|
|
1663
1723
|
["name", e.getNameFormula()],
|
|
1664
1724
|
["values", e.getValuesFormula()],
|
|
1665
1725
|
["categories", e.getCategoriesFormula()]
|
|
1666
1726
|
];
|
|
1667
|
-
for (let [e, r] of n) r?.includes(
|
|
1727
|
+
for (let [e, r] of n) r?.includes(Cn) && t.push(`${e} ${r}`);
|
|
1668
1728
|
return t;
|
|
1669
|
-
},
|
|
1729
|
+
}, An = (e) => {
|
|
1670
1730
|
let t = 0;
|
|
1671
|
-
for (let n of e)
|
|
1731
|
+
for (let n of e) kn(n).length > 0 && t++;
|
|
1672
1732
|
return t;
|
|
1673
|
-
},
|
|
1733
|
+
}, jn = (e) => {
|
|
1674
1734
|
let t = e.getChartType();
|
|
1675
1735
|
return t && t !== "unknown" ? t : null;
|
|
1676
1736
|
};
|
|
1677
|
-
function
|
|
1678
|
-
let t = [], n =
|
|
1737
|
+
function Mn(e) {
|
|
1738
|
+
let t = [], n = jn(e);
|
|
1679
1739
|
n && t.push(n);
|
|
1680
1740
|
let r = e.getChartTitle();
|
|
1681
1741
|
var i, a;
|
|
@@ -1683,24 +1743,24 @@ function kn(e) {
|
|
|
1683
1743
|
let o = e.getSeries();
|
|
1684
1744
|
if (o.length > 0) {
|
|
1685
1745
|
t.push(`${o.length} series`);
|
|
1686
|
-
let n = e.getPivotSource(), r = n ? null :
|
|
1746
|
+
let n = e.getPivotSource(), r = n ? null : On(o);
|
|
1687
1747
|
n ? t.push(`pivot table ${n}`) : r && (t.push(`values ${r.values}`), r.categories && t.push(`categories ${r.categories}`));
|
|
1688
|
-
let i =
|
|
1689
|
-
i > 0 && t.push(`${
|
|
1748
|
+
let i = An(o);
|
|
1749
|
+
i > 0 && t.push(`${Cn} in ${i} series`);
|
|
1690
1750
|
}
|
|
1691
1751
|
return t.length > 0 ? t.join(" · ") : null;
|
|
1692
1752
|
}
|
|
1693
|
-
function
|
|
1753
|
+
function Nn(e) {
|
|
1694
1754
|
let t = [], n = e.getChartTitle();
|
|
1695
1755
|
n && t.push(["title", `"${G(n)}"`]);
|
|
1696
1756
|
let r = e.getSeries();
|
|
1697
1757
|
if (r.length === 0) return t;
|
|
1698
|
-
let i = e.getPivotSource(), a = i ? null :
|
|
1758
|
+
let i = e.getPivotSource(), a = i ? null : On(r);
|
|
1699
1759
|
i ? t.push(["series", `${r.length} · from pivot table ${i}`]) : a ? (t.push(["series", `${r.length} · ${a.values}${a.by ? ` by ${a.by}` : ""}`]), a.names && t.push([r.length === 1 ? "name" : "names", a.names]), a.categories && t.push(["categories", a.categories])) : t.push(["series", String(r.length)]);
|
|
1700
|
-
let o =
|
|
1701
|
-
return o > 0 && t.push(["broken", `${
|
|
1760
|
+
let o = An(r);
|
|
1761
|
+
return o > 0 && t.push(["broken", `${Cn} in ${o} series`]), t;
|
|
1702
1762
|
}
|
|
1703
|
-
var
|
|
1763
|
+
var Pn = (e) => jn(e) ?? "", Fn = {
|
|
1704
1764
|
hundreds: "hundreds",
|
|
1705
1765
|
thousands: "thousands",
|
|
1706
1766
|
tenThousands: "ten thousands",
|
|
@@ -1710,22 +1770,22 @@ var jn = (e) => On(e) ?? "", Mn = {
|
|
|
1710
1770
|
hundredMillions: "hundred millions",
|
|
1711
1771
|
billions: "billions",
|
|
1712
1772
|
trillions: "trillions"
|
|
1713
|
-
},
|
|
1773
|
+
}, In = (e) => {
|
|
1714
1774
|
let t = e.getTitle().getText(), n = [t ? `"${G(t)}"` : "no title"], r = e.getNumberFormat();
|
|
1715
1775
|
if (r && r !== "General" && n.push(`format ${r}`), e.getKind() === "value") {
|
|
1716
1776
|
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
1777
|
let t = e.getDisplayUnit();
|
|
1718
|
-
t === "custom" ? n.push(`in units of ${e.getCustomDisplayUnit()}`) : t !== "none" && n.push(`in ${
|
|
1778
|
+
t === "custom" ? n.push(`in units of ${e.getCustomDisplayUnit()}`) : t !== "none" && n.push(`in ${Fn[t] ?? t}`);
|
|
1719
1779
|
}
|
|
1720
1780
|
return e.getReversePlotOrder() && n.push("reversed"), `${e.getKind()} (${n.join(", ")})`;
|
|
1721
|
-
},
|
|
1781
|
+
}, Ln = (e) => {
|
|
1722
1782
|
let t = [], n = e.reduce((e, t) => e + t.getTrendlines().length, 0);
|
|
1723
1783
|
n > 0 && t.push(`${n} trendline${n === 1 ? "" : "s"}`);
|
|
1724
1784
|
let r = e.filter((e) => e.getYErrorBars().getVisible() || e.getXErrorBars().getVisible()).length;
|
|
1725
1785
|
return r > 0 && t.push(`${r} with error bars`), t;
|
|
1726
1786
|
};
|
|
1727
|
-
function
|
|
1728
|
-
let n =
|
|
1787
|
+
function Rn(e, t) {
|
|
1788
|
+
let n = jn(t);
|
|
1729
1789
|
e.fact("Type: chart" + (n ? ` — ${n}` : ""));
|
|
1730
1790
|
let r = t.getChartTitle(), i = !r && t.getTitle().getVisible() ? t.getTitle().getText() : null;
|
|
1731
1791
|
e.fact("Title: " + (r ? `"${G(r)}"` : i ? `"${G(i)}" (automatic)` : "(none)"));
|
|
@@ -1734,16 +1794,16 @@ function Fn(e, t) {
|
|
|
1734
1794
|
let o = t.getSeries(), s = t.getPivotSource();
|
|
1735
1795
|
if (s) e.fact(`Series (${o.length}): from pivot table ${s}`);
|
|
1736
1796
|
else if (o.length > 0) {
|
|
1737
|
-
let t =
|
|
1797
|
+
let t = On(o);
|
|
1738
1798
|
if (t) {
|
|
1739
1799
|
let n = [`values ${t.values}${t.by ? ` by ${t.by}` : ""}`];
|
|
1740
|
-
t.names && n.push(`${o.length === 1 ? "name" : "names"} ${t.names}`), t.categories && n.push(`categories ${t.categories}`), n.push(...
|
|
1800
|
+
t.names && n.push(`${o.length === 1 ? "name" : "names"} ${t.names}`), t.categories && n.push(`categories ${t.categories}`), n.push(...Ln(o)), e.fact(`Series (${o.length}): ${n.join(" · ")}`);
|
|
1741
1801
|
} else {
|
|
1742
1802
|
(function(e, t) {
|
|
1743
1803
|
let n = t.slice(0, k(t.length, 12)), r = n.map((e) => {
|
|
1744
|
-
let t =
|
|
1804
|
+
let t = En(e.getValuesRange(), e.getValuesFormula()) ?? "(no values)", n = En(e.getCategoriesRange(), e.getCategoriesFormula()), r = [`values ${t}`];
|
|
1745
1805
|
n && r.push(`categories ${n}`);
|
|
1746
|
-
let i =
|
|
1806
|
+
let i = En(e.getNameRange(), e.getNameFormula());
|
|
1747
1807
|
i && r.push(`name ${i}`);
|
|
1748
1808
|
let a = e.getName();
|
|
1749
1809
|
return {
|
|
@@ -1757,15 +1817,15 @@ function Fn(e, t) {
|
|
|
1757
1817
|
for (let t of r) e.text(` ${t.name.padEnd(i)} ${t.type.padEnd(a)} ${t.source}`);
|
|
1758
1818
|
n.length < t.length && e.text(` …and ${t.length - n.length} more · getContent().getSeries() on this movable lists every one`);
|
|
1759
1819
|
})(e, o);
|
|
1760
|
-
let t =
|
|
1820
|
+
let t = Ln(o);
|
|
1761
1821
|
t.length > 0 && e.fact(`Analysis: ${t.join(" · ")}`);
|
|
1762
1822
|
}
|
|
1763
1823
|
}
|
|
1764
1824
|
let c = t.getAxes().getItems();
|
|
1765
|
-
c.length > 0 && e.fact(`Axes: ${c.map(
|
|
1825
|
+
c.length > 0 && e.fact(`Axes: ${c.map(In).join(" · ")}`);
|
|
1766
1826
|
}
|
|
1767
|
-
var
|
|
1768
|
-
function
|
|
1827
|
+
var zn = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd;
|
|
1828
|
+
function Bn(e, t) {
|
|
1769
1829
|
let n = e.getWorksheet(), r = n.getWorkbook()?.getWorksheets().getItems({ visibility: h.Visibility.VeryHidden }) ?? [n], i = /* @__PURE__ */ new Map();
|
|
1770
1830
|
for (let e = 0; e < (t?.length ?? 0); e++) {
|
|
1771
1831
|
let n = t.at(e);
|
|
@@ -1775,7 +1835,7 @@ function Ln(e, t) {
|
|
|
1775
1835
|
}
|
|
1776
1836
|
let a = e.getCoords(), o = [];
|
|
1777
1837
|
for (let e of r) for (let t of e.getMovables().getItems({ type: "chart" })) {
|
|
1778
|
-
let e =
|
|
1838
|
+
let e = wn(t);
|
|
1779
1839
|
if (!e || e.getPivotSource()) continue;
|
|
1780
1840
|
let r = null;
|
|
1781
1841
|
for (let t of e.getSeries()) {
|
|
@@ -1786,11 +1846,11 @@ function Ln(e, t) {
|
|
|
1786
1846
|
]) {
|
|
1787
1847
|
if (!e) continue;
|
|
1788
1848
|
let t = e.getCoords();
|
|
1789
|
-
if (e.getWorksheet() === n &&
|
|
1849
|
+
if (e.getWorksheet() === n && zn(t, a)) {
|
|
1790
1850
|
r = !0;
|
|
1791
1851
|
break;
|
|
1792
1852
|
}
|
|
1793
|
-
r === null && i.get(e.getWorksheet())?.some((e) =>
|
|
1853
|
+
r === null && i.get(e.getWorksheet())?.some((e) => zn(e, t)) && (r = !1);
|
|
1794
1854
|
}
|
|
1795
1855
|
if (!0 === r) break;
|
|
1796
1856
|
}
|
|
@@ -1801,18 +1861,18 @@ function Ln(e, t) {
|
|
|
1801
1861
|
}
|
|
1802
1862
|
return o;
|
|
1803
1863
|
}
|
|
1804
|
-
var
|
|
1864
|
+
var Vn = (e) => {
|
|
1805
1865
|
let t = e.movable.getRange();
|
|
1806
|
-
return `${
|
|
1807
|
-
},
|
|
1866
|
+
return `${Tn(t.getWorksheet(), t.getCoords())} "${e.movable.getContent().getName?.() || "(unnamed)"}"${e.direct ? "" : " (through its dependents)"}`;
|
|
1867
|
+
}, Hn = (e, t, n) => {
|
|
1808
1868
|
let r = e.replace(/\r\n?|\n/g, " ⏎ ");
|
|
1809
1869
|
if (t === null || r.length <= t) return `"${r}"`;
|
|
1810
1870
|
let i = r.charCodeAt(t - 1), a = i >= 55296 && i <= 56319 ? t - 1 : t, o = `(+${r.length - a} chars)`;
|
|
1811
1871
|
return `"${r.slice(0, a)}…" ${n ? `${o} · full: ${n}` : o}`;
|
|
1812
|
-
},
|
|
1872
|
+
}, Un = (e) => {
|
|
1813
1873
|
let t = e.geometry;
|
|
1814
1874
|
return typeof t == "string" ? t : t ? "custom" : "rect";
|
|
1815
|
-
},
|
|
1875
|
+
}, Wn = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Gn = (e, t) => {
|
|
1816
1876
|
switch (e.type) {
|
|
1817
1877
|
case u.Type.None: return "none";
|
|
1818
1878
|
case u.Type.Solid: return String(e.color ?? "solid");
|
|
@@ -1830,30 +1890,30 @@ var Rn = (e) => {
|
|
|
1830
1890
|
}
|
|
1831
1891
|
default: return String(e.type);
|
|
1832
1892
|
}
|
|
1833
|
-
},
|
|
1893
|
+
}, Kn = (e, t) => {
|
|
1834
1894
|
if (e.style === null) return "none";
|
|
1835
1895
|
let n = e.style?.[t] ?? x.defaultStyleRefs(e)[t];
|
|
1836
1896
|
return !n || n.index <= 0 ? "none" : `theme style ${n.index}${n.color ? `, ${n.color}` : ""}`;
|
|
1837
|
-
},
|
|
1897
|
+
}, qn = (e, t, n) => {
|
|
1838
1898
|
if (!e || e === g.LineEndType.None) return null;
|
|
1839
1899
|
let r = [t && t !== g.LineEndSize.Medium ? `wide ${t}` : null, n && n !== g.LineEndSize.Medium ? `long ${n}` : null].filter(Boolean);
|
|
1840
1900
|
return r.length ? `${e} (${r.join(", ")})` : e;
|
|
1841
|
-
},
|
|
1901
|
+
}, Jn = {
|
|
1842
1902
|
top: "top",
|
|
1843
1903
|
center: "middle",
|
|
1844
1904
|
bottom: "bottom",
|
|
1845
1905
|
justify: "justified",
|
|
1846
1906
|
distributed: "distributed"
|
|
1847
|
-
},
|
|
1907
|
+
}, Yn = (e) => {
|
|
1848
1908
|
if (typeof e == "string") return e;
|
|
1849
1909
|
let t = e.address ?? e.action ?? "(no address)";
|
|
1850
1910
|
return e.screenTip ? `${t} — "${e.screenTip}"` : t;
|
|
1851
1911
|
};
|
|
1852
|
-
function
|
|
1912
|
+
function Xn(e, t) {
|
|
1853
1913
|
let n = t.toJSON() ?? {}, r = null;
|
|
1854
1914
|
e.fact(`Shape: ${((e) => {
|
|
1855
|
-
let t =
|
|
1856
|
-
return r && typeof r == "object" && (n.push(
|
|
1915
|
+
let t = Un(e), n = [], r = e.geometry;
|
|
1916
|
+
return r && typeof r == "object" && (n.push(Wn(r.paths.length, "path")), r.ah?.length && n.push(Wn(r.ah.length, "handle"))), e.type === m.Type.Connector && n.push("connector"), e.textBox && n.push("text box"), n.length > 0 ? `${t} — ${n.join(", ")}` : t;
|
|
1857
1917
|
})(n)}`);
|
|
1858
1918
|
let i = ((e) => {
|
|
1859
1919
|
let t = Object.entries(e);
|
|
@@ -1861,21 +1921,21 @@ function qn(e, t) {
|
|
|
1861
1921
|
})(t.getAdjustments());
|
|
1862
1922
|
i && e.fact(`Adjustments: ${i} — the rest at the preset's defaults`);
|
|
1863
1923
|
let a = t.getTextFrame();
|
|
1864
|
-
a && e.fact(`Text: ${
|
|
1924
|
+
a && e.fact(`Text: ${Hn(a.getText(), null, "")}`);
|
|
1865
1925
|
let o = ((e) => {
|
|
1866
1926
|
if (!e) return null;
|
|
1867
1927
|
let t = [];
|
|
1868
|
-
return e.anchor && t.push(
|
|
1928
|
+
return e.anchor && t.push(Jn[e.anchor] ?? e.anchor), e.anchorCenter && t.push("centered"), e.wrap === "none" && t.push("no wrap"), e.verticalOverflow !== _.Overflow.Visible && e.horizontalOverflow !== _.Overflow.Visible || t.push("text may overflow the shape"), e.autoFit === "shape" && t.push("shape grows to fit text"), e.autoFit === "normal" && t.push("text shrinks to fit" + (e.fontScale === void 0 ? "" : ` (${e.fontScale}%)`)), e.vertical && e.vertical !== _.WritingMode.Horizontal && t.push(`vertical (${e.vertical})`), e.columns && e.columns > 1 && t.push(`${e.columns} columns`), e.warp && t.push(`warped (${e.warp.preset})`), t.length ? t.join(" · ") : null;
|
|
1869
1929
|
})(n.text?.body);
|
|
1870
|
-
o && e.fact(`Text Layout: ${o}`), n.textLink && e.fact(`Text Link: ${n.textLink} — the text shows this cell's value`), e.fact(`Fill: ${n.fill ?
|
|
1871
|
-
let n = e.stroke, r =
|
|
1930
|
+
o && e.fact(`Text Layout: ${o}`), n.textLink && e.fact(`Text Link: ${n.textLink} — the text shows this cell's value`), e.fact(`Fill: ${n.fill ? Gn(n.fill, t) : Kn(n, "fill")}`), e.fact(`Line: ${((e, t) => {
|
|
1931
|
+
let n = e.stroke, r = Kn(e, "stroke");
|
|
1872
1932
|
if (!n) return r;
|
|
1873
1933
|
if (n.fill?.type === u.Type.None) return "none";
|
|
1874
1934
|
let i = [];
|
|
1875
|
-
typeof n.width == "number" && i.push(`${n.width} pt`), i.push(n.fill ?
|
|
1876
|
-
let a =
|
|
1935
|
+
typeof n.width == "number" && i.push(`${n.width} pt`), i.push(n.fill ? Gn(n.fill, t) : `color from ${r}`), n.dash !== void 0 && n.dash !== g.DashStyle.Solid && i.push(`dash ${Array.isArray(n.dash) ? n.dash.join(" ") : n.dash}`), n.compound && n.compound !== g.Compound.Single && i.push(`compound ${n.compound}`);
|
|
1936
|
+
let a = qn(n.headType, n.headWidth, n.headLength);
|
|
1877
1937
|
a && i.push(`head ${a}`);
|
|
1878
|
-
let o =
|
|
1938
|
+
let o = qn(n.tailType, n.tailWidth, n.tailLength);
|
|
1879
1939
|
return o && i.push(`tail ${o}`), i.join(" · ");
|
|
1880
1940
|
})(n, t)}`), n.effects && e.fact(`Effects: ${n.effects.length ? n.effects.map((e) => e.type).join(", ") : "none — the theme style's are turned off"}`), (n.scene3d || n.shape3d) && e.fact("3-D: yes");
|
|
1881
1941
|
let s = ((e, t) => {
|
|
@@ -1894,49 +1954,49 @@ function qn(e, t) {
|
|
|
1894
1954
|
deep: !0
|
|
1895
1955
|
})) {
|
|
1896
1956
|
let e = n.getContent(), r = e.toJSON?.();
|
|
1897
|
-
r?.sourceId !== void 0 && t.set(r.sourceId, e.getName() || `(unnamed ${
|
|
1957
|
+
r?.sourceId !== void 0 && t.set(r.sourceId, e.getName() || `(unnamed ${Un(r)})`);
|
|
1898
1958
|
}
|
|
1899
1959
|
return t;
|
|
1900
1960
|
})(t.getMovable()));
|
|
1901
|
-
s && e.fact(`Connected: ${s}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${
|
|
1961
|
+
s && e.fact(`Connected: ${s}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${Yn(n.hyperlink)}`), n.hoverHyperlink && e.fact(`Hover Hyperlink: ${Yn(n.hoverHyperlink)}`), n.macro && e.fact(`Macro: ${n.macro}`);
|
|
1902
1962
|
let c = Object.entries(n.locks ?? {}).filter(([, e]) => e).map(([e]) => e);
|
|
1903
1963
|
c.length && e.fact(`Locks: ${c.join(", ")}`);
|
|
1904
1964
|
}
|
|
1905
|
-
var
|
|
1965
|
+
var Zn = (e) => {
|
|
1906
1966
|
let t = e.getContent();
|
|
1907
1967
|
return !0 === t?.isIGroup ? t : null;
|
|
1908
|
-
},
|
|
1909
|
-
let t =
|
|
1910
|
-
return !0 === t?.isIShape ?
|
|
1911
|
-
},
|
|
1968
|
+
}, Qn = (e) => {
|
|
1969
|
+
let t = $n(e);
|
|
1970
|
+
return !0 === t?.isIShape ? Un(t.toJSON() ?? {}) : e.getContent().getType();
|
|
1971
|
+
}, $n = (e) => e.getContent(), er = (e, t, n) => {
|
|
1912
1972
|
for (let r of t.getItems()) {
|
|
1913
|
-
let t =
|
|
1973
|
+
let t = $n(r), i = [Qn(r), t.getName?.() || "(unnamed)"];
|
|
1914
1974
|
!0 === t.isIPicture && i.push(t.getResource()?.getName?.() || "(no image)");
|
|
1915
1975
|
let a = t.getTextFrame?.()?.getText();
|
|
1916
|
-
a && i.push(
|
|
1976
|
+
a && i.push(Hn(a, 120, "")), r.isHidden() && i.push("(hidden)"), e.text(`${" ".repeat(n + 2)}${i.join(" · ")}`);
|
|
1917
1977
|
let o = r.getMovables();
|
|
1918
|
-
o &&
|
|
1978
|
+
o && er(e, o, n + 1);
|
|
1919
1979
|
}
|
|
1920
1980
|
};
|
|
1921
|
-
function
|
|
1981
|
+
function tr(e, t) {
|
|
1922
1982
|
let n = t.toJSON(), r = t.getMovable()?.getMovables()?.getItems() ?? [], i = t.getFill();
|
|
1923
|
-
i && e.fact(`Fill: ${
|
|
1983
|
+
i && e.fact(`Fill: ${Gn(i, null)} — taken by members that use the group's fill`), n.effects && e.fact(`Effects: ${n.effects.length ? n.effects.map((e) => e.type).join(", ") : "none"}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${Yn(n.hyperlink)}`), n.hoverHyperlink && e.fact(`Hover Hyperlink: ${Yn(n.hoverHyperlink)}`);
|
|
1924
1984
|
let a = Object.entries(n.locks ?? {}).filter(([, e]) => e).map(([e]) => e);
|
|
1925
1985
|
a.length && e.fact(`Locks: ${a.join(", ")}`), e.fact(`Members: ${r.length}, in z-order`);
|
|
1926
1986
|
let o = t.getMovable()?.getMovables();
|
|
1927
|
-
o &&
|
|
1987
|
+
o && er(e, o, 0);
|
|
1928
1988
|
}
|
|
1929
|
-
var
|
|
1989
|
+
var nr = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, rr = (e) => e.replace(/[\r\n]+/g, " ").trim(), ir = (t) => {
|
|
1930
1990
|
let n = t.getRange();
|
|
1931
1991
|
return e.rangeToString(n.getCoords()) ?? n.toString();
|
|
1932
|
-
},
|
|
1992
|
+
}, ar = ({ movable: e, text: t }) => Hn(t, 300, ((e) => `${H(e.getRange())}.getRange(${JSON.stringify(ir(e))}).getMovables()`)(e)), or = (e) => {
|
|
1933
1993
|
let t = e.getContent();
|
|
1934
1994
|
return typeof t.getTextFrame == "function" ? t.getTextFrame()?.getText() ?? "" : null;
|
|
1935
1995
|
};
|
|
1936
|
-
function
|
|
1996
|
+
function sr(e) {
|
|
1937
1997
|
let t = [];
|
|
1938
1998
|
for (let n of e) {
|
|
1939
|
-
let e =
|
|
1999
|
+
let e = or(n) ?? "";
|
|
1940
2000
|
e.trim() !== "" && t.push({
|
|
1941
2001
|
movable: n,
|
|
1942
2002
|
text: e
|
|
@@ -1947,26 +2007,26 @@ function ir(e) {
|
|
|
1947
2007
|
return n.rowStart - r.rowStart || n.colStart - r.colStart;
|
|
1948
2008
|
});
|
|
1949
2009
|
}
|
|
1950
|
-
var
|
|
1951
|
-
let t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), r =
|
|
1952
|
-
if (r) return
|
|
1953
|
-
|
|
1954
|
-
n ?
|
|
2010
|
+
var cr = (e) => e.getType() === "picture" && e.getResource?.()?.getName() || null, lr = (e) => {
|
|
2011
|
+
let t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), r = wn(e);
|
|
2012
|
+
if (r) return nr([
|
|
2013
|
+
Mn(r),
|
|
2014
|
+
n ? rr(n) : null,
|
|
1955
2015
|
t
|
|
1956
2016
|
].filter(Boolean).join(" · "), 140);
|
|
1957
|
-
let i = e.getContent(), a = [], o =
|
|
1958
|
-
return o && a.push(o), n && a.push(
|
|
1959
|
-
},
|
|
2017
|
+
let i = e.getContent(), a = [], o = cr(i);
|
|
2018
|
+
return o && a.push(o), n && a.push(rr(n)), nr(a.length > 0 ? `${t} — ${a.join(" · ")}` : t, 90);
|
|
2019
|
+
}, ur = (e) => {
|
|
1960
2020
|
let t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription();
|
|
1961
|
-
return
|
|
1962
|
-
},
|
|
2021
|
+
return nr(n ? `${t} — ${rr(n)}` : t, 90);
|
|
2022
|
+
}, dr = /* @__PURE__ */ new Map([
|
|
1963
2023
|
["chart", "Charts"],
|
|
1964
2024
|
["shape", "Shapes"],
|
|
1965
2025
|
["group", "Groups"],
|
|
1966
2026
|
["picture", "Pictures"],
|
|
1967
2027
|
["slicer", "Slicers"]
|
|
1968
|
-
]),
|
|
1969
|
-
function
|
|
2028
|
+
]), fr = (e) => dr.get(e) ?? `${e.charAt(0).toUpperCase()}${e.slice(1)}s`;
|
|
2029
|
+
function pr(e) {
|
|
1970
2030
|
let t = /* @__PURE__ */ new Map();
|
|
1971
2031
|
for (let n of e) {
|
|
1972
2032
|
let e = n.getContent().getType();
|
|
@@ -1975,31 +2035,31 @@ function ur(e) {
|
|
|
1975
2035
|
r ? r.push(n) : t.set(e, [n]);
|
|
1976
2036
|
}
|
|
1977
2037
|
let n = /* @__PURE__ */ new Map();
|
|
1978
|
-
for (let e of
|
|
2038
|
+
for (let e of dr.keys()) {
|
|
1979
2039
|
let r = t.get(e);
|
|
1980
2040
|
r && n.set(e, r);
|
|
1981
2041
|
}
|
|
1982
2042
|
for (let [e, r] of t) n.set(e, r);
|
|
1983
2043
|
return n;
|
|
1984
2044
|
}
|
|
1985
|
-
function
|
|
1986
|
-
for (let [n, r] of
|
|
2045
|
+
function mr(e, t) {
|
|
2046
|
+
for (let [n, r] of pr(t)) hr(e, n, r);
|
|
1987
2047
|
}
|
|
1988
|
-
function
|
|
1989
|
-
let r =
|
|
1990
|
-
let t = i.get(e), n =
|
|
2048
|
+
function hr(e, t, n) {
|
|
2049
|
+
let r = sr(n), i = new Map(r.map((e) => [e.movable, e])), a = [...r.map((e) => e.movable), ...n.filter((e) => !i.has(e))], o = a.slice(0, k(a.length, 50)), s = o.map((e) => {
|
|
2050
|
+
let t = i.get(e), n = wn(e);
|
|
1991
2051
|
return {
|
|
1992
2052
|
movable: e,
|
|
1993
|
-
address:
|
|
1994
|
-
preset: n ?
|
|
1995
|
-
summary: n ?
|
|
1996
|
-
details: n ?
|
|
1997
|
-
text: t ?
|
|
2053
|
+
address: ir(e),
|
|
2054
|
+
preset: n ? Pn(n) : (r = e.getContent(), r.getShapeType?.() ?? ""),
|
|
2055
|
+
summary: n ? ur(e) : lr(e),
|
|
2056
|
+
details: n ? Nn(n) : [],
|
|
2057
|
+
text: t ? ar(t) : "",
|
|
1998
2058
|
hidden: e.isHidden() ? " (hidden)" : ""
|
|
1999
2059
|
};
|
|
2000
2060
|
var r;
|
|
2001
2061
|
});
|
|
2002
|
-
e.h2(`${
|
|
2062
|
+
e.h2(`${fr(t)} (${n.length}${r.length > 0 ? ` · ${r.length} with text` : ""})`);
|
|
2003
2063
|
let c = Math.max(...s.map((e) => e.address.length)), l = Math.max(...s.map((e) => e.preset.length)), u = Math.min(40, Math.max(0, ...s.filter((e) => e.text).map((e) => e.summary.length)));
|
|
2004
2064
|
for (let t of s) {
|
|
2005
2065
|
let n = l > 0 ? `${t.preset.padEnd(l)} ` : "", r = t.text ? `${t.summary.padEnd(u)} ${t.text}` : t.summary;
|
|
@@ -2007,7 +2067,7 @@ function fr(e, t, n) {
|
|
|
2007
2067
|
let i = Math.max(10, ...t.details.map(([e]) => e.length + 2));
|
|
2008
2068
|
for (let [n, r] of t.details) e.text(` ${n.padEnd(i)}${r}`);
|
|
2009
2069
|
let a = t.movable.getMovables();
|
|
2010
|
-
a &&
|
|
2070
|
+
a && er(e, a, 0);
|
|
2011
2071
|
}
|
|
2012
2072
|
if (o.length < a.length) {
|
|
2013
2073
|
let r = `${H(n[0].getRange())}.getMovables().getItems({ type: ${JSON.stringify(t)} })`;
|
|
@@ -2015,32 +2075,32 @@ function fr(e, t, n) {
|
|
|
2015
2075
|
}
|
|
2016
2076
|
e.blank();
|
|
2017
2077
|
}
|
|
2018
|
-
function
|
|
2019
|
-
return
|
|
2078
|
+
function gr(e) {
|
|
2079
|
+
return yr(e, "Movable");
|
|
2020
2080
|
}
|
|
2021
|
-
function
|
|
2081
|
+
function _r(e) {
|
|
2022
2082
|
let t = e.getMovable();
|
|
2023
|
-
if (t) return
|
|
2024
|
-
let n = new
|
|
2025
|
-
return n.h1(`Shape — ${e.getName() || "(unnamed)"}`), n.blank(),
|
|
2083
|
+
if (t) return yr(t, "Shape");
|
|
2084
|
+
let n = new I();
|
|
2085
|
+
return n.h1(`Shape — ${e.getName() || "(unnamed)"}`), n.blank(), Xn(n, e), n.toLines().join("\n").trimEnd();
|
|
2026
2086
|
}
|
|
2027
|
-
var
|
|
2087
|
+
var vr = (e) => {
|
|
2028
2088
|
let t = e.getContent();
|
|
2029
2089
|
return !0 === t?.isIShape ? t : null;
|
|
2030
2090
|
};
|
|
2031
|
-
function
|
|
2032
|
-
let n = new
|
|
2033
|
-
n.h1(`${t} — ${
|
|
2034
|
-
let c =
|
|
2035
|
-
c ?
|
|
2036
|
-
let l =
|
|
2037
|
-
l && n.fact(`Content: ${l}`), s &&
|
|
2038
|
-
let u =
|
|
2039
|
-
u &&
|
|
2091
|
+
function yr(e, t) {
|
|
2092
|
+
let n = new I(), i = e.getRange(), a = e.getContent(), o = a.getType(), s = vr(e);
|
|
2093
|
+
n.h1(`${t} — ${Xt(i)}`), n.blank(), n.fact(`Name: ${e.getContent().getName?.() || "(unnamed)"}`);
|
|
2094
|
+
let c = wn(e);
|
|
2095
|
+
c ? Rn(n, c) : n.fact(`Type: ${o}`);
|
|
2096
|
+
let l = cr(a);
|
|
2097
|
+
l && n.fact(`Content: ${l}`), s && Xn(n, s);
|
|
2098
|
+
let u = Zn(e);
|
|
2099
|
+
u && tr(n, u);
|
|
2040
2100
|
let d = e.getParent();
|
|
2041
2101
|
d && n.fact(`Group: ${d.getContent().getName?.() || "(unnamed)"}`);
|
|
2042
2102
|
let f = e.getContent().getDescription();
|
|
2043
|
-
f && n.fact(`Alt Text: ${
|
|
2103
|
+
f && n.fact(`Alt Text: ${rr(f)}`), n.fact(`Anchor: ${Yt(i)}, ${((e) => {
|
|
2044
2104
|
switch (e) {
|
|
2045
2105
|
case r.Type.Absolute: return "absolute — stays put when rows or columns move";
|
|
2046
2106
|
case r.Type.OneCell: return "oneCell — moves with the cells, keeps its size";
|
|
@@ -2056,9 +2116,9 @@ function gr(e, t) {
|
|
|
2056
2116
|
let m = e.getFlip(), h = [m.horizontal ? "horizontal" : null, m.vertical ? "vertical" : null].filter(Boolean);
|
|
2057
2117
|
return h.length && n.fact(`Flip: ${h.join(", ")}`), n.fact(`Z-Order: ${e.getZIndex()}`), n.blank(), n.text(`Sheet: ${V(i.getWorksheet().getName())}`), n.toLines().join("\n").trimEnd();
|
|
2058
2118
|
}
|
|
2059
|
-
var
|
|
2119
|
+
var br = (e) => e.getVisibility() === "visible", xr = (e, t, n) => {
|
|
2060
2120
|
let r = e.getWorksheets().getItems({ visibility: "veryHidden" }), i = t?.trim();
|
|
2061
|
-
if (!i) return r.filter((e) => n ||
|
|
2121
|
+
if (!i) return r.filter((e) => n || br(e)).map((e) => ({
|
|
2062
2122
|
sheet: e,
|
|
2063
2123
|
address: null
|
|
2064
2124
|
}));
|
|
@@ -2080,14 +2140,14 @@ var _r = (e) => e.getVisibility() === "visible", vr = (e, t, n) => {
|
|
|
2080
2140
|
let e = ((e) => {
|
|
2081
2141
|
let t = e.replace(/[.*+?^${}()|[\]\\]/g, (e) => e === "*" ? ".*" : e === "?" ? "." : `\\${e}`);
|
|
2082
2142
|
return RegExp(`^${t}$`);
|
|
2083
|
-
})(i), t = r.filter((t) => e.test(t.getName()) && (n ||
|
|
2143
|
+
})(i), t = r.filter((t) => e.test(t.getName()) && (n || br(t)));
|
|
2084
2144
|
if (t.length === 0) throw Error(`No sheets match ${JSON.stringify(i)}. Sheets: ${r.map((e) => e.getName()).join(", ")}`);
|
|
2085
2145
|
return t.map((e) => ({
|
|
2086
2146
|
sheet: e,
|
|
2087
2147
|
address: null
|
|
2088
2148
|
}));
|
|
2089
2149
|
}
|
|
2090
|
-
let s = r.filter((e) => n ||
|
|
2150
|
+
let s = r.filter((e) => n || br(e));
|
|
2091
2151
|
try {
|
|
2092
2152
|
s[0]?.getRange(i);
|
|
2093
2153
|
} catch {
|
|
@@ -2097,7 +2157,7 @@ var _r = (e) => e.getVisibility() === "visible", vr = (e, t, n) => {
|
|
|
2097
2157
|
sheet: e,
|
|
2098
2158
|
address: i
|
|
2099
2159
|
}));
|
|
2100
|
-
},
|
|
2160
|
+
}, Sr = (e, t) => {
|
|
2101
2161
|
switch (t) {
|
|
2102
2162
|
case "display": return D(e, w.Mode.Display);
|
|
2103
2163
|
case "value": return D(e, w.Mode.Value);
|
|
@@ -2124,23 +2184,23 @@ var _r = (e) => e.getVisibility() === "visible", vr = (e, t, n) => {
|
|
|
2124
2184
|
}
|
|
2125
2185
|
default: return null;
|
|
2126
2186
|
}
|
|
2127
|
-
},
|
|
2187
|
+
}, Cr = /* @__PURE__ */ new Map([["hyperlink", o.Feature.Hyperlink], ["numberFormat", o.Feature.NumberFormat]]), K = (e, t) => t && t.trim() !== "" ? [{
|
|
2128
2188
|
field: e,
|
|
2129
2189
|
text: {
|
|
2130
2190
|
match: t,
|
|
2131
2191
|
display: t
|
|
2132
2192
|
}
|
|
2133
|
-
}] : [],
|
|
2134
|
-
let n =
|
|
2193
|
+
}] : [], wr = (e) => [...K("comment", e.getContent()), ...e.getReplies().flatMap((e) => K("comment", e.getContent()))], Tr = (e, t) => {
|
|
2194
|
+
let n = wn(e);
|
|
2135
2195
|
if (n) return t.includes("chart") ? [
|
|
2136
2196
|
...K("chart", n.getChartTitle()),
|
|
2137
2197
|
...n.getAxes().getItems().flatMap((e) => K("chart", e.getTitle().getText())),
|
|
2138
2198
|
...n.getSeries().flatMap((e) => e.getNameFormula() === null ? K("chart", e.getName()) : []),
|
|
2139
2199
|
...K("chart", e.getContent().getDescription())
|
|
2140
2200
|
] : [];
|
|
2141
|
-
let r =
|
|
2201
|
+
let r = or(e);
|
|
2142
2202
|
return r !== null && t.includes("shape") ? [...K("shape", r), ...K("shape", e.getContent().getDescription())] : [];
|
|
2143
|
-
},
|
|
2203
|
+
}, Er = (e) => {
|
|
2144
2204
|
let t = e.isIFormula ? `=${e.getExpression()}` : null, n = t ?? e.getRanges?.()?.getAddress() ?? e.getName();
|
|
2145
2205
|
return [
|
|
2146
2206
|
{
|
|
@@ -2153,24 +2213,24 @@ var _r = (e) => e.getVisibility() === "visible", vr = (e, t, n) => {
|
|
|
2153
2213
|
...t ? K("name", t) : [],
|
|
2154
2214
|
...K("name", e.getComment())
|
|
2155
2215
|
];
|
|
2156
|
-
},
|
|
2216
|
+
}, Dr = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd, Or = (e, t) => {
|
|
2157
2217
|
let n = e.getRanges?.() ?? null;
|
|
2158
2218
|
return t.some(({ sheet: t, address: r }) => {
|
|
2159
2219
|
if (r === null && e.getScope() === t.getName()) return !0;
|
|
2160
2220
|
let i = r === null ? null : t.getRange(r).getCoords();
|
|
2161
2221
|
for (let e = 0; e < (n?.length ?? 0); e++) {
|
|
2162
2222
|
let r = n.at(e);
|
|
2163
|
-
if (r.getWorksheet() === t && (!i ||
|
|
2223
|
+
if (r.getWorksheet() === t && (!i || Dr(r.getCoords(), i))) return !0;
|
|
2164
2224
|
}
|
|
2165
2225
|
return !1;
|
|
2166
2226
|
});
|
|
2167
|
-
},
|
|
2227
|
+
}, kr = (e, t) => e.rowStart - t.rowStart || e.colStart - t.colStart, Ar = (e, t, n) => {
|
|
2168
2228
|
let r = null, i = (e) => ({
|
|
2169
2229
|
range: `${t}!${e.getRange().toString()}`,
|
|
2170
2230
|
table: e.getName()
|
|
2171
2231
|
});
|
|
2172
2232
|
return { resolve(a, o) {
|
|
2173
|
-
let s = ((e) =>
|
|
2233
|
+
let s = ((e) => Oe(e))(a);
|
|
2174
2234
|
if (e === "table") return s ? i(s) : void 0;
|
|
2175
2235
|
if (r === null) {
|
|
2176
2236
|
r = [];
|
|
@@ -2189,7 +2249,7 @@ var _r = (e) => e.getVisibility() === "visible", vr = (e, t, n) => {
|
|
|
2189
2249
|
} : s ? i(s) : void 0;
|
|
2190
2250
|
} };
|
|
2191
2251
|
};
|
|
2192
|
-
async function
|
|
2252
|
+
async function jr(t, n) {
|
|
2193
2253
|
if (!n.pattern) throw Error("grep requires a pattern");
|
|
2194
2254
|
let r = n.fields?.length ? n.fields : ae, i = n.output ?? "content", a = n.maxCount ?? 200, o = !0 === n.invert, s = !0 === n.hidden, c = ((e) => {
|
|
2195
2255
|
if (e === void 0 || !1 === e) return null;
|
|
@@ -2209,7 +2269,7 @@ async function Or(t, n) {
|
|
|
2209
2269
|
throw Error(`Invalid regex ${JSON.stringify(e.pattern)}: ${t instanceof Error ? t.message : String(t)}. Use fixedStrings (-F) to search for the literal text.`);
|
|
2210
2270
|
}
|
|
2211
2271
|
}
|
|
2212
|
-
})(n), u =
|
|
2272
|
+
})(n), u = xr(t, n.scope, s), d = r.filter((e) => !Cr.has(e)), f = r.filter((e) => Cr.has(e)), p = r.includes("display") && r.includes("value"), m = i === "content" || i === "addresses", h = [], g = [], _ = 0, v = 0, y = 0, b = 0, x = !1, S = (e) => {
|
|
2213
2273
|
let t = e.filter((t, n) => l.test(t.text.match) && e.findIndex((e) => e.field === t.field && e.text.display === t.text.display && l.test(e.text.match)) === n);
|
|
2214
2274
|
return o ? t.length === 0 && e.length > 0 ? [e[0]] : null : t.length === 0 ? null : i === "addresses" ? t.slice(0, 1) : t;
|
|
2215
2275
|
}, C = (e, t, n, r, i, o = 1) => {
|
|
@@ -2227,7 +2287,7 @@ async function Or(t, n) {
|
|
|
2227
2287
|
if (x) continue;
|
|
2228
2288
|
let a = t.getName();
|
|
2229
2289
|
b++, await t.getCalculation().ready();
|
|
2230
|
-
let o = n === null ? t.getUsedRange() : t.getRange(n), l = o && c && i === "content" ?
|
|
2290
|
+
let o = n === null ? t.getUsedRange() : t.getRange(n), l = o && c && i === "content" ? Ar(c, a, o) : null, u = {
|
|
2231
2291
|
...n === null ? {} : { address: n },
|
|
2232
2292
|
...s ? {} : { ignoreHidden: !0 }
|
|
2233
2293
|
}, m = /* @__PURE__ */ new Map();
|
|
@@ -2242,11 +2302,11 @@ async function Or(t, n) {
|
|
|
2242
2302
|
for (let e of d) {
|
|
2243
2303
|
if (e === "comment") {
|
|
2244
2304
|
let e = `${r.rowIndex}:${r.colIndex}`, t = m.get(e);
|
|
2245
|
-
t && (i.push(...
|
|
2305
|
+
t && (i.push(...wr(t)), m.delete(e));
|
|
2246
2306
|
continue;
|
|
2247
2307
|
}
|
|
2248
|
-
let t =
|
|
2249
|
-
e === "display" && (o = t?.match ?? null), t !== null && (e === "value" && p && (o === void 0 && (o =
|
|
2308
|
+
let t = Sr(n, e);
|
|
2309
|
+
e === "display" && (o = t?.match ?? null), t !== null && (e === "value" && p && (o === void 0 && (o = Sr(n, "display")?.match ?? null), t.match === o) || i.push({
|
|
2250
2310
|
field: e,
|
|
2251
2311
|
text: t
|
|
2252
2312
|
}));
|
|
@@ -2260,10 +2320,10 @@ async function Or(t, n) {
|
|
|
2260
2320
|
let _ = [...m.values()].map((e) => ({
|
|
2261
2321
|
comment: e,
|
|
2262
2322
|
at: e.getRange().getCoords()
|
|
2263
|
-
})).sort((e, t) =>
|
|
2323
|
+
})).sort((e, t) => kr(e.at, t.at));
|
|
2264
2324
|
for (let { comment: t, at: n } of _) {
|
|
2265
2325
|
if (x) break;
|
|
2266
|
-
let r = S(
|
|
2326
|
+
let r = S(wr(t));
|
|
2267
2327
|
if (!r) continue;
|
|
2268
2328
|
let i = l?.resolve(t.getRange().getCell(), {
|
|
2269
2329
|
rowIndex: n.rowStart,
|
|
@@ -2273,12 +2333,12 @@ async function Or(t, n) {
|
|
|
2273
2333
|
}
|
|
2274
2334
|
for (let e of f) {
|
|
2275
2335
|
if (x || !o) break;
|
|
2276
|
-
let t = [...o.getRegions(
|
|
2336
|
+
let t = [...o.getRegions(Cr.get(e), { ignoreHidden: !s })].map((e) => ({
|
|
2277
2337
|
region: e,
|
|
2278
2338
|
at: e.getCoords()
|
|
2279
|
-
})).sort((e, t) =>
|
|
2339
|
+
})).sort((e, t) => kr(e.at, t.at));
|
|
2280
2340
|
for (let { region: n, at: r } of t) {
|
|
2281
|
-
let t = n.getCell(), i =
|
|
2341
|
+
let t = n.getCell(), i = Sr(t, e), o = S(i ? [{
|
|
2282
2342
|
field: e,
|
|
2283
2343
|
text: i
|
|
2284
2344
|
}] : []);
|
|
@@ -2296,9 +2356,9 @@ async function Or(t, n) {
|
|
|
2296
2356
|
let n = t.getMovables().getItems(u).filter((e) => e.getContent().getType() !== "note").filter((e) => s || !e.isHidden()).map((e) => ({
|
|
2297
2357
|
movable: e,
|
|
2298
2358
|
at: e.getRange().getCoords()
|
|
2299
|
-
})).sort((e, t) =>
|
|
2359
|
+
})).sort((e, t) => kr(e.at, t.at));
|
|
2300
2360
|
for (let { movable: t, at: i } of n) {
|
|
2301
|
-
let n = S(
|
|
2361
|
+
let n = S(Tr(t, r));
|
|
2302
2362
|
if (n) {
|
|
2303
2363
|
if (!C("object", a, e.rangeToString(i) ?? t.getRange().toString(), n)) break;
|
|
2304
2364
|
v++;
|
|
@@ -2314,8 +2374,8 @@ async function Or(t, n) {
|
|
|
2314
2374
|
if (!x && r.includes("name")) {
|
|
2315
2375
|
let e = !!n.scope?.trim(), r = t.getNames().getItems(s ? { includeHidden: !0 } : void 0) ?? [];
|
|
2316
2376
|
for (let t of r) {
|
|
2317
|
-
if (e && !
|
|
2318
|
-
let n = S(
|
|
2377
|
+
if (e && !Or(t, u)) continue;
|
|
2378
|
+
let n = S(Er(t));
|
|
2319
2379
|
if (n && !C("object", t.getScope() ?? "", t.getName(), n)) break;
|
|
2320
2380
|
}
|
|
2321
2381
|
}
|
|
@@ -2333,27 +2393,27 @@ async function Or(t, n) {
|
|
|
2333
2393
|
output: i
|
|
2334
2394
|
};
|
|
2335
2395
|
}
|
|
2336
|
-
var
|
|
2396
|
+
var Mr = (e) => {
|
|
2337
2397
|
let t = e.replace(/\s+/g, " ").trim();
|
|
2338
2398
|
return t.length > 120 ? `${t.slice(0, 119)}…` : t;
|
|
2339
|
-
},
|
|
2340
|
-
let i = t.map((e) => r ?
|
|
2399
|
+
}, Nr = (e) => e.sheet ? `${e.sheet}!${e.address}` : e.address, Pr = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Fr = (e, t) => t > 0 ? `${Pr(e, "cell")} · ${Pr(t, "object")}` : Pr(e, "cell"), Ir = (e, t, n, r) => {
|
|
2400
|
+
let i = t.map((e) => r ? Nr(e) : e.address), a = Math.max(...i.map((e) => e.length)), o = Math.max(...t.map((e) => e.field.length));
|
|
2341
2401
|
for (let r = 0; r < t.length; r++) {
|
|
2342
2402
|
let s = t[r];
|
|
2343
|
-
e.push(`${n}${i[r].padEnd(a)} ${s.field.padEnd(o)} ${
|
|
2403
|
+
e.push(`${n}${i[r].padEnd(a)} ${s.field.padEnd(o)} ${Mr(s.text)}`);
|
|
2344
2404
|
}
|
|
2345
2405
|
};
|
|
2346
|
-
function
|
|
2347
|
-
let { pattern: t, fields: n, scope: r, matches: i, cellCount: a, objectCount: o, sheetsSearched: s, sheetsMatched: c } = e, l = [`grep "${t}" · ${r} · fields ${n.join(",")} · ${
|
|
2406
|
+
function Lr(e) {
|
|
2407
|
+
let { pattern: t, fields: n, scope: r, matches: i, cellCount: a, objectCount: o, sheetsSearched: s, sheetsMatched: c } = e, l = [`grep "${t}" · ${r} · fields ${n.join(",")} · ${Fr(a, o)} in ${c} of ${s} ${s === 1 ? "sheet" : "sheets"}`];
|
|
2348
2408
|
if (e.output === "count") {
|
|
2349
|
-
for (let t of e.sheets) l.push(` ${t.sheet}: ${t.objects > 0 ?
|
|
2409
|
+
for (let t of e.sheets) l.push(` ${t.sheet}: ${t.objects > 0 ? Fr(t.cells, t.objects) : t.cells}`);
|
|
2350
2410
|
let t = o - e.sheets.reduce((e, t) => e + t.objects, 0);
|
|
2351
2411
|
t > 0 && l.push(` names: ${t}`);
|
|
2352
2412
|
} else if (e.output === "sheets") {
|
|
2353
2413
|
for (let t of e.sheets) l.push(` ${t.sheet}`);
|
|
2354
2414
|
e.sheets.length === 0 && l.push(o > 0 ? " no sheets · names only" : " no matches");
|
|
2355
2415
|
} else if (i.length === 0) l.push(" no matches");
|
|
2356
|
-
else if (e.output === "addresses") for (let e of i) l.push(` ${
|
|
2416
|
+
else if (e.output === "addresses") for (let e of i) l.push(` ${Nr(e)}`);
|
|
2357
2417
|
else {
|
|
2358
2418
|
let e = [], t = /* @__PURE__ */ new Map();
|
|
2359
2419
|
for (let n of i) {
|
|
@@ -2364,11 +2424,11 @@ function Pr(e) {
|
|
|
2364
2424
|
rows: []
|
|
2365
2425
|
}, t.set(r, i), e.push(i)), i.rows.push(n);
|
|
2366
2426
|
}
|
|
2367
|
-
for (let t of e) t.heading ? (l.push(` ${t.heading}`),
|
|
2427
|
+
for (let t of e) t.heading ? (l.push(` ${t.heading}`), Ir(l, t.rows, " ", !1)) : Ir(l, t.rows, " ", !0);
|
|
2368
2428
|
}
|
|
2369
|
-
return e.truncated && l.push(` …truncated at ${
|
|
2429
|
+
return e.truncated && l.push(` …truncated at ${Fr(a, o)} · narrow the pattern, or scope the search to one sheet or range`), l.join("\n");
|
|
2370
2430
|
}
|
|
2371
|
-
var
|
|
2431
|
+
var Rr = {
|
|
2372
2432
|
name: "grep",
|
|
2373
2433
|
description: "Search a workbook's text by pattern: cell contents, and the text that is in no cell — comments, shapes, charts and defined names. Returns grid-anchored matches, each tagged with the layer it matched. Selection by attribute (fills, formats, features) is the regions read, not grep.",
|
|
2374
2434
|
params: [
|
|
@@ -2453,9 +2513,9 @@ var Fr = {
|
|
|
2453
2513
|
description: "What to return: content (address, layer and text), addresses (one per matched cell), count (per sheet), or sheets (names with a match)."
|
|
2454
2514
|
}
|
|
2455
2515
|
],
|
|
2456
|
-
run:
|
|
2457
|
-
render:
|
|
2458
|
-
},
|
|
2516
|
+
run: jr,
|
|
2517
|
+
render: Lr
|
|
2518
|
+
}, zr = (e) => !e.deprecated && !e.hidden, q = (e) => (e.members ?? []).filter(zr), Br = [
|
|
2459
2519
|
{
|
|
2460
2520
|
match: /^(get|set)?(number)?(format|numfmt)s?$/i,
|
|
2461
2521
|
relies: ["ICellStyle", "setNumberFormat"],
|
|
@@ -2476,7 +2536,7 @@ var Fr = {
|
|
|
2476
2536
|
relies: ["IWorkbook", "getWorksheet"],
|
|
2477
2537
|
hint: "Look a worksheet up by name with `wb.getWorksheet('Name')`."
|
|
2478
2538
|
}
|
|
2479
|
-
],
|
|
2539
|
+
], Vr = [
|
|
2480
2540
|
"IWorkbook",
|
|
2481
2541
|
"IWorksheet",
|
|
2482
2542
|
"ICellRange",
|
|
@@ -2485,16 +2545,16 @@ var Fr = {
|
|
|
2485
2545
|
"ITable",
|
|
2486
2546
|
"ICellStyle",
|
|
2487
2547
|
"IScript.ScriptContext"
|
|
2488
|
-
],
|
|
2489
|
-
function
|
|
2548
|
+
], Hr = (e) => e.slice(e.lastIndexOf(".") + 1);
|
|
2549
|
+
function Ur(e, t) {
|
|
2490
2550
|
if (e.types[t]) return t;
|
|
2491
2551
|
let n = Object.keys(e.types), r = t.toLowerCase(), i = n.filter((e) => e.toLowerCase() === r);
|
|
2492
2552
|
if (i.length === 1) return i[0];
|
|
2493
2553
|
if (t.includes(".")) return null;
|
|
2494
|
-
let a = n.filter((e) =>
|
|
2554
|
+
let a = n.filter((e) => Hr(e).toLowerCase() === r);
|
|
2495
2555
|
return a.length === 1 ? a[0] : null;
|
|
2496
2556
|
}
|
|
2497
|
-
function
|
|
2557
|
+
function Wr(e, t, n) {
|
|
2498
2558
|
let r = n.replace(/<[\s\S]*$/, "").trim(), i = t.split(".");
|
|
2499
2559
|
for (let t = i.length - 1; t >= 0; t--) {
|
|
2500
2560
|
let n = [...i.slice(0, t), r].join(".");
|
|
@@ -2502,7 +2562,7 @@ function Vr(e, t, n) {
|
|
|
2502
2562
|
}
|
|
2503
2563
|
return null;
|
|
2504
2564
|
}
|
|
2505
|
-
function
|
|
2565
|
+
function Gr(e, t, n, r = /* @__PURE__ */ new Set()) {
|
|
2506
2566
|
if (r.has(t)) return null;
|
|
2507
2567
|
r.add(t);
|
|
2508
2568
|
let i = e.types[t];
|
|
@@ -2513,14 +2573,14 @@ function Hr(e, t, n, r = /* @__PURE__ */ new Set()) {
|
|
|
2513
2573
|
members: a
|
|
2514
2574
|
};
|
|
2515
2575
|
for (let a of i.extends ?? []) {
|
|
2516
|
-
let i =
|
|
2576
|
+
let i = Wr(e, t, a), o = i ? Gr(e, i, n, r) : null;
|
|
2517
2577
|
if (o) return o;
|
|
2518
2578
|
}
|
|
2519
2579
|
return null;
|
|
2520
2580
|
}
|
|
2521
|
-
function
|
|
2581
|
+
function Kr(e, t, n) {
|
|
2522
2582
|
let r = e.types[t], i = (r.extends ?? []).map((n) => {
|
|
2523
|
-
let r =
|
|
2583
|
+
let r = Wr(e, t, n);
|
|
2524
2584
|
return {
|
|
2525
2585
|
text: n,
|
|
2526
2586
|
key: r,
|
|
@@ -2536,7 +2596,7 @@ function Ur(e, t, n) {
|
|
|
2536
2596
|
...n ? { filter: n } : {}
|
|
2537
2597
|
};
|
|
2538
2598
|
}
|
|
2539
|
-
function
|
|
2599
|
+
function qr(e, t, n) {
|
|
2540
2600
|
let r = (e) => {
|
|
2541
2601
|
let r = t(e).toLowerCase();
|
|
2542
2602
|
return r === n ? 0 : r.startsWith(n) ? 1 : 2;
|
|
@@ -2547,12 +2607,12 @@ function Wr(e, t, n) {
|
|
|
2547
2607
|
score: r(e)
|
|
2548
2608
|
})).sort((e, t) => e.score - t.score || e.order - t.order).map((e) => e.item);
|
|
2549
2609
|
}
|
|
2550
|
-
function
|
|
2610
|
+
function Jr(e, t) {
|
|
2551
2611
|
let n = function(e) {
|
|
2552
2612
|
return e.trim().replace(/^SheetXL\./, "").replace(/\(\)$/, "").replace(/#/g, ".");
|
|
2553
2613
|
}(t ?? "");
|
|
2554
2614
|
if (!n) {
|
|
2555
|
-
let t =
|
|
2615
|
+
let t = Vr.filter((t) => e.types[t]).map((t) => ({
|
|
2556
2616
|
key: t,
|
|
2557
2617
|
entry: e.types[t]
|
|
2558
2618
|
}));
|
|
@@ -2562,20 +2622,20 @@ function Gr(e, t) {
|
|
|
2562
2622
|
entryPoints: t
|
|
2563
2623
|
};
|
|
2564
2624
|
}
|
|
2565
|
-
let r =
|
|
2566
|
-
if (r) return
|
|
2625
|
+
let r = Ur(e, n);
|
|
2626
|
+
if (r) return Kr(e, r);
|
|
2567
2627
|
let i = n.lastIndexOf(".");
|
|
2568
2628
|
if (i > 0) {
|
|
2569
|
-
let t = n.slice(0, i), r =
|
|
2629
|
+
let t = n.slice(0, i), r = Ur(e, t), a = n.slice(i + 1);
|
|
2570
2630
|
if (r && a) {
|
|
2571
|
-
let t = a.toLowerCase(), n =
|
|
2631
|
+
let t = a.toLowerCase(), n = Gr(e, r, (e) => e.name === a) ?? Gr(e, r, (e) => e.name.toLowerCase() === t);
|
|
2572
2632
|
if (n) return {
|
|
2573
2633
|
kind: "member",
|
|
2574
2634
|
key: r,
|
|
2575
2635
|
declaredOn: n.key,
|
|
2576
2636
|
members: n.members
|
|
2577
2637
|
};
|
|
2578
|
-
let i =
|
|
2638
|
+
let i = Kr(e, r, a);
|
|
2579
2639
|
if (i.members.length > 0) return i;
|
|
2580
2640
|
}
|
|
2581
2641
|
if (a) {
|
|
@@ -2583,30 +2643,30 @@ function Gr(e, t) {
|
|
|
2583
2643
|
let i = r.toLowerCase(), a = Object.entries(e.types).flatMap(([e, t]) => q(t).filter((e) => e.name.toLowerCase() === i).map((t) => ({
|
|
2584
2644
|
key: e,
|
|
2585
2645
|
member: t
|
|
2586
|
-
}))), o =
|
|
2646
|
+
}))), o = Br.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) {
|
|
2587
2647
|
let r = t.toLowerCase().replace(/s$/, ""), i = n.toLowerCase();
|
|
2588
|
-
return Object.keys(e.types).filter((t) =>
|
|
2589
|
-
let n =
|
|
2648
|
+
return Object.keys(e.types).filter((t) => zr(e.types[t])).map((e) => {
|
|
2649
|
+
let n = Hr(e), i = ei(t, n), a = r.length >= 4 && n.toLowerCase().startsWith(r);
|
|
2590
2650
|
return {
|
|
2591
2651
|
key: e,
|
|
2592
2652
|
score: i ?? (a ? 10 : null)
|
|
2593
2653
|
};
|
|
2594
2654
|
}).filter((e) => e.score !== null).map((t) => ({
|
|
2595
2655
|
...t,
|
|
2596
|
-
hasMember:
|
|
2597
|
-
})).sort((e, t) => Number(t.hasMember) - Number(e.hasMember) || e.score - t.score).slice(0,
|
|
2656
|
+
hasMember: $r(e, t.key).some((e) => e.name.toLowerCase() === i)
|
|
2657
|
+
})).sort((e, t) => Number(t.hasMember) - Number(e.hasMember) || e.score - t.score).slice(0, Yr).map(({ key: e, hasMember: t }) => ({
|
|
2598
2658
|
key: e,
|
|
2599
2659
|
hasMember: t
|
|
2600
2660
|
}));
|
|
2601
2661
|
}(e, t, r), c = n ? function(e, t, n) {
|
|
2602
|
-
let r =
|
|
2603
|
-
return
|
|
2604
|
-
let t =
|
|
2662
|
+
let r = Xr(n)?.toLowerCase();
|
|
2663
|
+
return $r(e, t).map((e) => {
|
|
2664
|
+
let t = ei(n, e.name), i = r && r.length >= 3 && e.name.toLowerCase().includes(r);
|
|
2605
2665
|
return {
|
|
2606
2666
|
member: e,
|
|
2607
2667
|
score: t ?? (i ? 10 : null)
|
|
2608
2668
|
};
|
|
2609
|
-
}).filter((e) => e.score !== null).sort((e, t) => e.score - t.score).slice(0,
|
|
2669
|
+
}).filter((e) => e.score !== null).sort((e, t) => e.score - t.score).slice(0, Yr).map((e) => e.member);
|
|
2610
2670
|
}(e, n, r) : [];
|
|
2611
2671
|
return s.length + c.length + o.length + a.length === 0 ? null : {
|
|
2612
2672
|
kind: "miss",
|
|
@@ -2618,8 +2678,8 @@ function Gr(e, t) {
|
|
|
2618
2678
|
nearestTypes: s,
|
|
2619
2679
|
nearest: c,
|
|
2620
2680
|
hints: o,
|
|
2621
|
-
elsewhere: a.slice(0,
|
|
2622
|
-
elsewhereOmitted: Math.max(0, a.length -
|
|
2681
|
+
elsewhere: a.slice(0, Yr),
|
|
2682
|
+
elsewhereOmitted: Math.max(0, a.length - Yr)
|
|
2623
2683
|
};
|
|
2624
2684
|
}(e, t, r, a);
|
|
2625
2685
|
if (n) return n;
|
|
@@ -2627,14 +2687,14 @@ function Gr(e, t) {
|
|
|
2627
2687
|
}
|
|
2628
2688
|
return function(e, t) {
|
|
2629
2689
|
let n = t.toLowerCase(), r = [], i = [];
|
|
2630
|
-
for (let [t, a] of Object.entries(e.types)) if (
|
|
2631
|
-
|
|
2690
|
+
for (let [t, a] of Object.entries(e.types)) if (zr(a)) {
|
|
2691
|
+
Hr(t).toLowerCase().includes(n) && r.push(t);
|
|
2632
2692
|
for (let e of q(a)) e.name.toLowerCase().includes(n) && i.push({
|
|
2633
2693
|
key: t,
|
|
2634
2694
|
member: e
|
|
2635
2695
|
});
|
|
2636
2696
|
}
|
|
2637
|
-
let a =
|
|
2697
|
+
let a = qr(r, Hr, n), o = qr(i, (e) => e.member.name, n);
|
|
2638
2698
|
return {
|
|
2639
2699
|
kind: "search",
|
|
2640
2700
|
query: t,
|
|
@@ -2644,8 +2704,8 @@ function Gr(e, t) {
|
|
|
2644
2704
|
};
|
|
2645
2705
|
}(e, i > 0 ? n.slice(i + 1) : n);
|
|
2646
2706
|
}
|
|
2647
|
-
var
|
|
2648
|
-
function
|
|
2707
|
+
var Yr = 5, Xr = (e) => /([A-Z][a-z0-9]+|^[a-z0-9]+)$/.exec(e)?.[1] ?? null;
|
|
2708
|
+
function Zr(e, t) {
|
|
2649
2709
|
if (!t || typeof t != "object" && typeof t != "function") return null;
|
|
2650
2710
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
2651
2711
|
for (let i = t; i && i !== Object.prototype; i = Object.getPrototypeOf(i)) for (let a of Object.getOwnPropertyNames(i)) {
|
|
@@ -2655,13 +2715,13 @@ function Jr(e, t) {
|
|
|
2655
2715
|
try {
|
|
2656
2716
|
i = !0 === t[a];
|
|
2657
2717
|
} catch {}
|
|
2658
|
-
let o = i ?
|
|
2718
|
+
let o = i ? Ur(e, a.slice(2)) : null;
|
|
2659
2719
|
o && !n.includes(o) && n.push(o);
|
|
2660
2720
|
}
|
|
2661
2721
|
if (n.length <= 1) return n[0] ?? null;
|
|
2662
2722
|
let i = (t, n = /* @__PURE__ */ new Set()) => {
|
|
2663
2723
|
for (let r of e.types[t].extends ?? []) {
|
|
2664
|
-
let a =
|
|
2724
|
+
let a = Wr(e, t, r);
|
|
2665
2725
|
a && !n.has(a) && (n.add(a), i(a, n));
|
|
2666
2726
|
}
|
|
2667
2727
|
return n;
|
|
@@ -2669,11 +2729,11 @@ function Jr(e, t) {
|
|
|
2669
2729
|
for (let e of n) for (let t of i(e)) a.add(t);
|
|
2670
2730
|
return n.filter((e) => !a.has(e)).sort((t, n) => (e.types[n].members?.length ?? 0) - (e.types[t].members?.length ?? 0))[0] ?? n[0];
|
|
2671
2731
|
}
|
|
2672
|
-
function
|
|
2732
|
+
function Qr(e, t) {
|
|
2673
2733
|
let n = /\bon type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(e)?.[1];
|
|
2674
2734
|
return n ? `\`${t} ${n}\` lists its members.` : null;
|
|
2675
2735
|
}
|
|
2676
|
-
function
|
|
2736
|
+
function $r(e, t) {
|
|
2677
2737
|
let n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (t) => {
|
|
2678
2738
|
if (i.has(t)) return;
|
|
2679
2739
|
i.add(t);
|
|
@@ -2681,14 +2741,14 @@ function Xr(e, t) {
|
|
|
2681
2741
|
if (o) {
|
|
2682
2742
|
for (let e of q(o)) r.has(e.name) || (r.add(e.name), n.push(e));
|
|
2683
2743
|
for (let n of o.extends ?? []) {
|
|
2684
|
-
let r =
|
|
2744
|
+
let r = Wr(e, t, n);
|
|
2685
2745
|
r && a(r);
|
|
2686
2746
|
}
|
|
2687
2747
|
}
|
|
2688
2748
|
};
|
|
2689
2749
|
return a(t), n;
|
|
2690
2750
|
}
|
|
2691
|
-
function
|
|
2751
|
+
function ei(e, t) {
|
|
2692
2752
|
let n = e.toLowerCase(), r = t.toLowerCase();
|
|
2693
2753
|
if (n === r) return 0;
|
|
2694
2754
|
if (n.startsWith(r) || r.startsWith(n)) return 1;
|
|
@@ -2706,32 +2766,32 @@ function Zr(e, t) {
|
|
|
2706
2766
|
}(n, r);
|
|
2707
2767
|
return i <= Math.max(2, Math.floor(.3 * n.length)) ? 1 + i : null;
|
|
2708
2768
|
}
|
|
2709
|
-
function
|
|
2710
|
-
let n = /\s*Did you mean '([\w$]+)'\?/.exec(t), r = /on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(t)?.[1], i = n && r ?
|
|
2769
|
+
function ti(e, t) {
|
|
2770
|
+
let n = /\s*Did you mean '([\w$]+)'\?/.exec(t), r = /on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(t)?.[1], i = n && r ? Ur(e, r) : null;
|
|
2711
2771
|
if (!n || !i) return t;
|
|
2712
|
-
let a =
|
|
2713
|
-
return !a || a.members.some(
|
|
2772
|
+
let a = Gr(e, i, (e) => e.name === n[1]);
|
|
2773
|
+
return !a || a.members.some(zr) ? t : t.slice(0, n.index) + t.slice(n.index + n[0].length);
|
|
2714
2774
|
}
|
|
2715
|
-
var
|
|
2716
|
-
function
|
|
2775
|
+
var ni = (e, t) => `${t ? `${t}.` : ""}${e.signature.replace(/;$/, "")}${e.summary ? ` — ${e.summary}` : ""}`;
|
|
2776
|
+
function ri(e, t, n) {
|
|
2717
2777
|
let r = /Property '[\w$]+' does not exist on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)\[\]'/.exec(t);
|
|
2718
2778
|
if (r) return `\`${r[1]}[]\` is a plain array, not a collection: index it (\`[0]\`), or use \`.length\`, \`.find(…)\`.`;
|
|
2719
2779
|
let i = /Property '([\w$]+)' does not exist on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(t), a = i ? null : /(?:^|[.\s])([A-Za-z_$][\w$]*) is not a function/.exec(t), o = i?.[1] ?? a?.[1];
|
|
2720
2780
|
if (!o) return null;
|
|
2721
2781
|
let s = [];
|
|
2722
|
-
for (let t of
|
|
2782
|
+
for (let t of Br) {
|
|
2723
2783
|
let [n, r] = t.relies;
|
|
2724
2784
|
t.match.test(o) && e.types[n]?.members?.some((e) => e.name === r) && s.push(t.hint);
|
|
2725
2785
|
}
|
|
2726
|
-
let c = i ?
|
|
2786
|
+
let c = i ? Ur(e, i[2]) : null;
|
|
2727
2787
|
if (c) {
|
|
2728
|
-
let r =
|
|
2788
|
+
let r = $r(e, c), i = /Did you mean '([\w$]+)'/.exec(t)?.[1], a = r.map((e) => ({
|
|
2729
2789
|
member: e,
|
|
2730
|
-
score: e.name === i ? -1 :
|
|
2790
|
+
score: e.name === i ? -1 : ei(o, e.name)
|
|
2731
2791
|
})).filter((e) => e.score !== null).sort((e, t) => e.score - t.score).slice(0, 3);
|
|
2732
2792
|
if (a.length > 0) {
|
|
2733
2793
|
s.push(`Closest on ${c}:`);
|
|
2734
|
-
for (let { member: e } of a) s.push(` ${
|
|
2794
|
+
for (let { member: e } of a) s.push(` ${ni(e)}`);
|
|
2735
2795
|
}
|
|
2736
2796
|
s.push(`\`${n} ${c}\` lists all ${r.length} members.`);
|
|
2737
2797
|
} else if (a) {
|
|
@@ -2740,26 +2800,26 @@ function ei(e, t, n) {
|
|
|
2740
2800
|
let e = t.slice(0, 3).join(", "), n = t.length > 3 ? ` and ${t.length - 3} more` : "";
|
|
2741
2801
|
return s.push(`'${o}' is a member of ${e}${n}, not of the object it was called on.`), s.join("\n");
|
|
2742
2802
|
}
|
|
2743
|
-
let n =
|
|
2803
|
+
let n = Vr.map((t) => Ur(e, t)).filter((e) => e !== null).flatMap((t) => $r(e, t).map((e) => ({
|
|
2744
2804
|
owner: t,
|
|
2745
2805
|
member: e,
|
|
2746
|
-
score:
|
|
2806
|
+
score: ei(o, e.name)
|
|
2747
2807
|
}))).filter((e) => e.score !== null && e.score > 0 && e.score <= 2).sort((e, t) => e.score - t.score).slice(0, 3);
|
|
2748
2808
|
if (s.length === 0 && n.length === 0) return null;
|
|
2749
2809
|
if (s.unshift(`No SheetXL member is named '${o}'.`), n.length > 0) {
|
|
2750
2810
|
s.push("Closest:");
|
|
2751
|
-
for (let { owner: e, member: t } of n) s.push(` ${
|
|
2811
|
+
for (let { owner: e, member: t } of n) s.push(` ${ni(t, e)}`);
|
|
2752
2812
|
}
|
|
2753
2813
|
}
|
|
2754
2814
|
return s.length > 0 ? s.join("\n") : null;
|
|
2755
2815
|
}
|
|
2756
2816
|
var J = (e, t, n = `${t}s`) => `${e.toLocaleString("en-US")} ${e === 1 ? t : n}`;
|
|
2757
|
-
function
|
|
2817
|
+
function ii(e, t) {
|
|
2758
2818
|
let n = t ? `${t} · ` : "", r = e.summary ? ` — ${e.summary}` : "", i = e.deprecated ? " (deprecated)" : "";
|
|
2759
2819
|
return `- ${n}\`${a = e.signature, a.replace(/;$/, "")}\`${i}${r}`;
|
|
2760
2820
|
var a;
|
|
2761
2821
|
}
|
|
2762
|
-
function
|
|
2822
|
+
function ai(e, t) {
|
|
2763
2823
|
let n = t?.command ?? "api";
|
|
2764
2824
|
switch (e.kind) {
|
|
2765
2825
|
case "overview": return function(e, t) {
|
|
@@ -2784,7 +2844,7 @@ function ni(e, t) {
|
|
|
2784
2844
|
}
|
|
2785
2845
|
if (r.members) {
|
|
2786
2846
|
s.push(""), e.filter && s.push(`${J(i.length, "member")} of ${a} matching '${e.filter}':`);
|
|
2787
|
-
for (let e of i) s.push(
|
|
2847
|
+
for (let e of i) s.push(ii(e));
|
|
2788
2848
|
}
|
|
2789
2849
|
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");
|
|
2790
2850
|
}(e, n);
|
|
@@ -2804,7 +2864,7 @@ function ni(e, t) {
|
|
|
2804
2864
|
}
|
|
2805
2865
|
if (e.members.length > 0) {
|
|
2806
2866
|
n.push("", "Members:");
|
|
2807
|
-
for (let { key: t, member: r } of e.members) n.push(
|
|
2867
|
+
for (let { key: t, member: r } of e.members) n.push(ii(r, t));
|
|
2808
2868
|
}
|
|
2809
2869
|
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
2870
|
}(e, n);
|
|
@@ -2813,7 +2873,7 @@ function ni(e, t) {
|
|
|
2813
2873
|
if (n.key) {
|
|
2814
2874
|
if (i.push(`\`${n.key}\` has no member \`${r}\`.`), e.nearest.length > 0) {
|
|
2815
2875
|
i.push("", `Closest on \`${n.key}\`:`);
|
|
2816
|
-
for (let t of e.nearest) i.push(
|
|
2876
|
+
for (let t of e.nearest) i.push(ii(t));
|
|
2817
2877
|
}
|
|
2818
2878
|
} else if (i.push(`No type is named \`${n.text}\`.`), e.nearestTypes.length > 0) {
|
|
2819
2879
|
i.push("", "Nearest:");
|
|
@@ -2828,8 +2888,8 @@ function ni(e, t) {
|
|
|
2828
2888
|
}(e, n);
|
|
2829
2889
|
}
|
|
2830
2890
|
}
|
|
2831
|
-
async function
|
|
2832
|
-
let t =
|
|
2891
|
+
async function oi(e) {
|
|
2892
|
+
let t = Jr(await C(), e);
|
|
2833
2893
|
if (t.kind === "member") try {
|
|
2834
2894
|
let e = (await ee()).split(/\r?\n/);
|
|
2835
2895
|
t.sources = t.members.map((t) => function(e, t, n) {
|
|
@@ -2839,7 +2899,7 @@ async function ri(e) {
|
|
|
2839
2899
|
} catch {}
|
|
2840
2900
|
return t;
|
|
2841
2901
|
}
|
|
2842
|
-
var
|
|
2902
|
+
var si = {
|
|
2843
2903
|
name: "api",
|
|
2844
2904
|
description: "Look up the scripting API — what you can call on a type, without reading the type definitions. `ICellRange` lists its members, one line each (signature + summary); `ICellRange.setValues` prints that member's full documentation; any other word searches type and member names; no name lists where to start. Answers come from the same declarations `run` type-checks against, so a member listed here exists.",
|
|
2845
2905
|
params: [{
|
|
@@ -2848,17 +2908,17 @@ var ii = {
|
|
|
2848
2908
|
description: "A type (`ICellRange`), a member (`ICellRange.setValues`), or a word to search for. Omit for the overview. A leading `SheetXL.` is accepted.",
|
|
2849
2909
|
positional: 0
|
|
2850
2910
|
}],
|
|
2851
|
-
run: (e) =>
|
|
2852
|
-
render:
|
|
2853
|
-
},
|
|
2854
|
-
async function
|
|
2855
|
-
await
|
|
2856
|
-
}
|
|
2857
|
-
async function
|
|
2858
|
-
let a = n === "precedents" ? "Precedents" : "Dependents", o = await (n === "precedents" ? t.getPrecedents() : t.getDependents()), s = n === "dependents" && i?.subject ?
|
|
2911
|
+
run: (e) => oi(e?.name),
|
|
2912
|
+
render: ai
|
|
2913
|
+
}, ci = o.Feature;
|
|
2914
|
+
async function li(e, t, n, r) {
|
|
2915
|
+
await ui(e, t, "precedents", n, r), await ui(e, t, "dependents", n, r);
|
|
2916
|
+
}
|
|
2917
|
+
async function ui(e, t, n, r, i) {
|
|
2918
|
+
let a = n === "precedents" ? "Precedents" : "Dependents", o = await (n === "precedents" ? t.getPrecedents() : t.getDependents()), s = n === "dependents" && i?.subject ? Bn(i.subject, o) : [];
|
|
2859
2919
|
if (!o || o.length === 0) {
|
|
2860
2920
|
let t = n === "precedents" ? i?.zeroPrecedents : i?.zeroDependents;
|
|
2861
|
-
s.length > 0 ? (e.h2(`${a} (${
|
|
2921
|
+
s.length > 0 ? (e.h2(`${a} (${di(s.length)})`), e.text(` ${"charts".padEnd(pi)}${fi(s)}`), e.blank()) : t && (e.h2(`${a} (0)`), e.blank());
|
|
2862
2922
|
return;
|
|
2863
2923
|
}
|
|
2864
2924
|
let c = await async function(e, t, n) {
|
|
@@ -2870,8 +2930,8 @@ async function si(e, t, n, r, i) {
|
|
|
2870
2930
|
continue;
|
|
2871
2931
|
}
|
|
2872
2932
|
a++;
|
|
2873
|
-
let c = n.getCounts([
|
|
2874
|
-
r += l, i += c[
|
|
2933
|
+
let c = n.getCounts([ci.Contentful, ci.Formula]), l = c[ci.Contentful] ?? 0;
|
|
2934
|
+
r += l, i += c[ci.Formula] ?? 0;
|
|
2875
2935
|
let u = n.getWorksheet()?.getName() ?? "";
|
|
2876
2936
|
s.set(u, (s.get(u) ?? 0) + l);
|
|
2877
2937
|
}
|
|
@@ -2881,10 +2941,10 @@ async function si(e, t, n, r, i) {
|
|
|
2881
2941
|
if (!t) return 0;
|
|
2882
2942
|
let c = 0;
|
|
2883
2943
|
for (let e = 0; e < t.length; e++) {
|
|
2884
|
-
let o = t.at(e), l =
|
|
2944
|
+
let o = t.at(e), l = bi(o);
|
|
2885
2945
|
if (r.has(l)) continue;
|
|
2886
2946
|
let u = n.get(l);
|
|
2887
|
-
u === void 0 && (++i >
|
|
2947
|
+
u === void 0 && (++i > hi ? (a = !0, u = 0) : (r.add(l), u = await s(o), r.delete(l), n.set(l, u))), c = Math.max(c, u + 1);
|
|
2888
2948
|
}
|
|
2889
2949
|
return c;
|
|
2890
2950
|
};
|
|
@@ -2901,13 +2961,13 @@ async function si(e, t, n, r, i) {
|
|
|
2901
2961
|
depth: c,
|
|
2902
2962
|
depthCapped: l,
|
|
2903
2963
|
sheets: s,
|
|
2904
|
-
outputs: n === "dependents" ? await
|
|
2964
|
+
outputs: n === "dependents" ? await _i(t) : {
|
|
2905
2965
|
ranges: [],
|
|
2906
2966
|
cells: 0
|
|
2907
2967
|
}
|
|
2908
2968
|
};
|
|
2909
2969
|
}(t, o, n), l = [`${c.cells} ${c.cells === 1 ? "cell" : "cells"}`];
|
|
2910
|
-
n === "precedents" ? l.push(`${c.inputs} ${c.inputs === 1 ? "input" : "inputs"}`) : l.push(`${c.outputs.cells} ${c.outputs.cells === 1 ? "output" : "outputs"}`), l.push(`depth ${c.depthCapped ? "≥ " : ""}${c.depth}`), l.push(`${c.areas} ${c.areas === 1 ? "area" : "areas"}`), c.names > 0 && l.push(`${c.names} ${c.names === 1 ? "name" : "names"}`), s.length > 0 && l.push(
|
|
2970
|
+
n === "precedents" ? l.push(`${c.inputs} ${c.inputs === 1 ? "input" : "inputs"}`) : l.push(`${c.outputs.cells} ${c.outputs.cells === 1 ? "output" : "outputs"}`), l.push(`depth ${c.depthCapped ? "≥ " : ""}${c.depth}`), l.push(`${c.areas} ${c.areas === 1 ? "area" : "areas"}`), c.names > 0 && l.push(`${c.names} ${c.names === 1 ? "name" : "names"}`), s.length > 0 && l.push(di(s.length)), e.h2(`${a} (${l.join(" · ")})`);
|
|
2911
2971
|
let u = i?.home?.getName() ?? null, d = await async function(e, t, n, r) {
|
|
2912
2972
|
let i = Math.max(1, r?.maxTreeRows ?? 12), a = (e) => t === "precedents" ? e.getDirectPrecedents() : e.getDirectDependents(), o = [], s = /* @__PURE__ */ new Map(), c = 0, l = 0, u = !1, d = [], f = (e, t, n) => {
|
|
2913
2973
|
let r = e?.length ?? 0;
|
|
@@ -2919,7 +2979,7 @@ async function si(e, t, n, r, i) {
|
|
|
2919
2979
|
return r;
|
|
2920
2980
|
}, p = 0;
|
|
2921
2981
|
for (c = f(await a(e), null, 0); p < d.length && l < i;) {
|
|
2922
|
-
let { range: e, parent: t, depth: n } = d[p++], r =
|
|
2982
|
+
let { range: e, parent: t, depth: n } = d[p++], r = bi(e), i = {
|
|
2923
2983
|
range: e,
|
|
2924
2984
|
key: r,
|
|
2925
2985
|
depth: n,
|
|
@@ -2953,11 +3013,11 @@ async function si(e, t, n, r, i) {
|
|
|
2953
3013
|
};
|
|
2954
3014
|
g(o);
|
|
2955
3015
|
let _ = new Map(h.map((e, t) => [e, t])), v = c - o.length, y = h.map((e) => {
|
|
2956
|
-
let { address: t, sheet: n, isName: r } =
|
|
3016
|
+
let { address: t, sheet: n, isName: r } = xi(e.range), i;
|
|
2957
3017
|
if (e.mark === "circular") i = "↺ circular";
|
|
2958
3018
|
else if (e.mark === "repeat") i = _.get(e.first) < _.get(e) ? "↑ shown above" : "↓ shown below";
|
|
2959
3019
|
else {
|
|
2960
|
-
i = [
|
|
3020
|
+
i = [Si(e.range), yi(e.range, m)].filter(Boolean).join(" ");
|
|
2961
3021
|
let t = e.childCount - e.children.length;
|
|
2962
3022
|
t > 0 && (v += t, i = `${i} ▸ ${t} more`);
|
|
2963
3023
|
}
|
|
@@ -2982,13 +3042,13 @@ async function si(e, t, n, r, i) {
|
|
|
2982
3042
|
shown: new Set(h.map((e) => e.key))
|
|
2983
3043
|
};
|
|
2984
3044
|
}(t, n, c.areas, r), f = c.outputs.ranges;
|
|
2985
|
-
if (n === "dependents" && f.some((e) => !d.shown.has(
|
|
2986
|
-
let n = e.ranges.slice(0,
|
|
2987
|
-
let { address: n, sheet: r } =
|
|
3045
|
+
if (n === "dependents" && f.some((e) => !d.shown.has(bi(e))) && e.text(` ${"outputs".padEnd(pi)}${function(e, t) {
|
|
3046
|
+
let n = e.ranges.slice(0, gi).map((e) => {
|
|
3047
|
+
let { address: n, sheet: r } = xi(e);
|
|
2988
3048
|
return [
|
|
2989
3049
|
t !== null && r !== t ? `${V(r)}!${n}` : n,
|
|
2990
3050
|
e.isSingleCell() ? D(e.getCell(), w.Mode.Display)?.display ?? "" : `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
2991
|
-
|
|
3051
|
+
yi(e)
|
|
2992
3052
|
].filter(Boolean).join(" ");
|
|
2993
3053
|
}), r = e.ranges.length - n.length;
|
|
2994
3054
|
return r > 0 && n.push(`+${r} more (getDependents())`), n.join(" · ");
|
|
@@ -2996,20 +3056,20 @@ async function si(e, t, n, r, i) {
|
|
|
2996
3056
|
let t = [...c.sheets].filter(([e]) => e !== u);
|
|
2997
3057
|
if (t.length > 0) {
|
|
2998
3058
|
let n = t.map(([e, t]) => `${V(e)} ${t} ${t === 1 ? "cell" : "cells"}`);
|
|
2999
|
-
e.text(` ${"sheets".padEnd(
|
|
3059
|
+
e.text(` ${"sheets".padEnd(pi)}${n.join(" · ")}`);
|
|
3000
3060
|
}
|
|
3001
3061
|
}
|
|
3002
|
-
s.length > 0 && e.text(` ${"charts".padEnd(
|
|
3062
|
+
s.length > 0 && e.text(` ${"charts".padEnd(pi)}${fi(s)}`);
|
|
3003
3063
|
for (let t of d.lines) e.text(t);
|
|
3004
3064
|
e.blank();
|
|
3005
3065
|
}
|
|
3006
|
-
var
|
|
3007
|
-
function
|
|
3008
|
-
let t = e.slice(0,
|
|
3066
|
+
var di = (e) => `${e} ${e === 1 ? "chart" : "charts"}`;
|
|
3067
|
+
function fi(e) {
|
|
3068
|
+
let t = e.slice(0, mi).map(Vn), n = e.length - t.length;
|
|
3009
3069
|
return n > 0 && t.push(`+${n} more`), t.join(" · ");
|
|
3010
3070
|
}
|
|
3011
|
-
var
|
|
3012
|
-
async function
|
|
3071
|
+
var pi = 10, mi = 6, hi = 2e3, gi = 4;
|
|
3072
|
+
async function _i(e) {
|
|
3013
3073
|
let t = /* @__PURE__ */ new Map(), n = await e.getPrecedents(!1);
|
|
3014
3074
|
for (let e = 0; e < (n?.length ?? 0); e++) {
|
|
3015
3075
|
let r = n.at(e);
|
|
@@ -3022,7 +3082,7 @@ async function mi(e) {
|
|
|
3022
3082
|
let a = e.at(n);
|
|
3023
3083
|
if (a.isINamedRange) continue;
|
|
3024
3084
|
let o = [a.getCoords()];
|
|
3025
|
-
for (let e of t.get(a.getWorksheet()?.getName() ?? "") ?? []) if (o = o.flatMap((t) =>
|
|
3085
|
+
for (let e of t.get(a.getWorksheet()?.getName() ?? "") ?? []) if (o = o.flatMap((t) => vi(t, e)), o.length === 0) break;
|
|
3026
3086
|
for (let e of o) i += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), r.push(a.getWorksheet().getRange(e));
|
|
3027
3087
|
}
|
|
3028
3088
|
return {
|
|
@@ -3030,7 +3090,7 @@ async function mi(e) {
|
|
|
3030
3090
|
cells: i
|
|
3031
3091
|
};
|
|
3032
3092
|
}
|
|
3033
|
-
function
|
|
3093
|
+
function vi(e, t) {
|
|
3034
3094
|
let n = Math.max(e.rowStart, t.rowStart), r = Math.min(e.rowEnd, t.rowEnd), i = Math.max(e.colStart, t.colStart), a = Math.min(e.colEnd, t.colEnd);
|
|
3035
3095
|
if (n > r || i > a) return [e];
|
|
3036
3096
|
let o = [];
|
|
@@ -3052,28 +3112,28 @@ function hi(e, t) {
|
|
|
3052
3112
|
colEnd: e.colEnd
|
|
3053
3113
|
}), o;
|
|
3054
3114
|
}
|
|
3055
|
-
function
|
|
3115
|
+
function yi(e, t) {
|
|
3056
3116
|
if (e.isINamedRange || !e.isSingleCell()) return "";
|
|
3057
3117
|
let n = e.getCell();
|
|
3058
3118
|
if (n.getType() === b.String) return "";
|
|
3059
3119
|
let r = n.getCoords(), i = e.getWorksheet(), a = [];
|
|
3060
3120
|
if (!t || r.rowIndex < t.rowStart || r.rowIndex > t.rowEnd) {
|
|
3061
|
-
let e =
|
|
3121
|
+
let e = P(i, r, "row");
|
|
3062
3122
|
e && a.push(`row ${JSON.stringify(e.text)}`);
|
|
3063
3123
|
}
|
|
3064
3124
|
if (!t || r.colIndex < t.colStart || r.colIndex > t.colEnd) {
|
|
3065
|
-
let e =
|
|
3125
|
+
let e = P(i, r, "column");
|
|
3066
3126
|
e && a.push(`col ${JSON.stringify(e.text)}`);
|
|
3067
3127
|
}
|
|
3068
3128
|
return a.join(" ");
|
|
3069
3129
|
}
|
|
3070
|
-
function
|
|
3130
|
+
function bi(e) {
|
|
3071
3131
|
let t = e.isINamedRange ? e.getId() : null;
|
|
3072
3132
|
if (t) return `name:${t}`;
|
|
3073
3133
|
let n = e.getCoords();
|
|
3074
3134
|
return `${e.getWorksheet()?.getName() ?? ""}!${n.rowStart},${n.colStart},${n.rowEnd},${n.colEnd}`;
|
|
3075
3135
|
}
|
|
3076
|
-
function
|
|
3136
|
+
function xi(e) {
|
|
3077
3137
|
let t = e.getWorksheet()?.getName() ?? "";
|
|
3078
3138
|
if (e.isINamedRange) return {
|
|
3079
3139
|
address: e.getName(),
|
|
@@ -3087,7 +3147,7 @@ function vi(e) {
|
|
|
3087
3147
|
isName: !1
|
|
3088
3148
|
};
|
|
3089
3149
|
}
|
|
3090
|
-
function
|
|
3150
|
+
function Si(e) {
|
|
3091
3151
|
if (e.isINamedRange) {
|
|
3092
3152
|
let t = e.getRanges();
|
|
3093
3153
|
return t ? `name → ${t.getAddress()}` : "name";
|
|
@@ -3096,15 +3156,15 @@ function yi(e) {
|
|
|
3096
3156
|
let t = e.getCell(), n = D(t, w.Mode.Display), r = t.getFormulaText(), i = n ? n.display : "(empty)";
|
|
3097
3157
|
return r ? `${i} ${r}` : i;
|
|
3098
3158
|
}
|
|
3099
|
-
let t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(
|
|
3159
|
+
let t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(ci.Formula)];
|
|
3100
3160
|
if (n.length === 1 && n[0].getRange().isEqual(e)) {
|
|
3101
3161
|
let e = n[0].getCell().getFormulaText();
|
|
3102
3162
|
if (e) return `${t} ${e}`;
|
|
3103
3163
|
}
|
|
3104
3164
|
return t;
|
|
3105
3165
|
}
|
|
3106
|
-
var
|
|
3107
|
-
features: (e) =>
|
|
3166
|
+
var Ci = {
|
|
3167
|
+
features: (e) => Jt(e),
|
|
3108
3168
|
mode: (e, t) => function(e, t, n) {
|
|
3109
3169
|
let r = new Map(Object.values(n).map((e) => [e.toLowerCase(), e])).get(e.trim().toLowerCase());
|
|
3110
3170
|
if (!r) {
|
|
@@ -3113,31 +3173,31 @@ var bi = {
|
|
|
3113
3173
|
}
|
|
3114
3174
|
return r;
|
|
3115
3175
|
}(e, t, w.Mode)
|
|
3116
|
-
},
|
|
3117
|
-
function
|
|
3176
|
+
}, wi = Object.keys(Ci);
|
|
3177
|
+
function Ti(e) {
|
|
3118
3178
|
let t = {};
|
|
3119
3179
|
for (let [n, r] of Object.entries(e)) {
|
|
3120
|
-
let e =
|
|
3121
|
-
if (!e) throw Error(`Unknown report option '${n}'. Options: ${
|
|
3180
|
+
let e = Ci[n];
|
|
3181
|
+
if (!e) throw Error(`Unknown report option '${n}'. Options: ${wi.join(", ")}.`);
|
|
3122
3182
|
t[n] = e(r, n);
|
|
3123
3183
|
}
|
|
3124
3184
|
return t;
|
|
3125
3185
|
}
|
|
3126
|
-
var
|
|
3186
|
+
var Ei = /^'?\[(\d+)\]([^']*)'?$/, Di = /* @__PURE__ */ new Set([
|
|
3127
3187
|
"cell",
|
|
3128
3188
|
"named",
|
|
3129
3189
|
"error"
|
|
3130
|
-
]),
|
|
3190
|
+
]), Oi = (e) => {
|
|
3131
3191
|
let t = e.sources?.[0]?.target ?? "";
|
|
3132
3192
|
return t.split(/[\\/]/).pop() || t;
|
|
3133
3193
|
};
|
|
3134
|
-
function
|
|
3194
|
+
function ki(e, t) {
|
|
3135
3195
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i;
|
|
3136
3196
|
for (let a of e) {
|
|
3137
|
-
if (!
|
|
3197
|
+
if (!Di.has(a.type)) continue;
|
|
3138
3198
|
let e = a.value?.scope;
|
|
3139
3199
|
if (typeof e != "string") continue;
|
|
3140
|
-
let o =
|
|
3200
|
+
let o = Ei.exec(e);
|
|
3141
3201
|
if (!o) continue;
|
|
3142
3202
|
let s = e.toLowerCase();
|
|
3143
3203
|
if (r.has(s)) {
|
|
@@ -3163,16 +3223,16 @@ function Ei(e, t) {
|
|
|
3163
3223
|
let f = new Set(u.sheetNames.map((e) => e.toLowerCase())), p = d.split(":").find((e) => !f.has(e.toLowerCase()));
|
|
3164
3224
|
p !== void 0 && n.set(s, {
|
|
3165
3225
|
scope: l,
|
|
3166
|
-
reason: `external link [${c}] (${
|
|
3226
|
+
reason: `external link [${c}] (${Oi(u)}) has no sheet '${p}'`,
|
|
3167
3227
|
uses: 1
|
|
3168
3228
|
});
|
|
3169
3229
|
}
|
|
3170
3230
|
return [...n.values()];
|
|
3171
3231
|
}
|
|
3172
|
-
function
|
|
3232
|
+
function Ai(e) {
|
|
3173
3233
|
return e.map((e) => `cites ${e.scope}: ${e.reason}`).join("; ");
|
|
3174
3234
|
}
|
|
3175
|
-
var
|
|
3235
|
+
var ji = o.Feature, Mi = [
|
|
3176
3236
|
["formatCells", "format cells"],
|
|
3177
3237
|
["formatColumns", "format columns"],
|
|
3178
3238
|
["formatRows", "format rows"],
|
|
@@ -3186,32 +3246,32 @@ var Oi = o.Feature, ki = [
|
|
|
3186
3246
|
["pivotTables", "pivot tables"],
|
|
3187
3247
|
["objects", "edit objects"],
|
|
3188
3248
|
["scenarios", "edit scenarios"]
|
|
3189
|
-
],
|
|
3249
|
+
], Ni = [["structure", "structure"], ["windows", "windows"]], Pi = (e) => {
|
|
3190
3250
|
let t = e.hasPassword() ? " · password" : "";
|
|
3191
3251
|
return e.isLocked() ? `locked${t}` : e.isPaused() ? `paused${t} — nothing is refused until resume()` : null;
|
|
3192
|
-
},
|
|
3252
|
+
}, Fi = (e) => {
|
|
3193
3253
|
let t = e.getProperties();
|
|
3194
3254
|
if (!t) return null;
|
|
3195
|
-
let n =
|
|
3255
|
+
let n = Mi.filter(([e]) => !0 === t[e]).map(([, e]) => e);
|
|
3196
3256
|
return n.length > 0 ? n.join(", ") : null;
|
|
3197
|
-
},
|
|
3257
|
+
}, Ii = (e) => {
|
|
3198
3258
|
let t = e.getProperties();
|
|
3199
3259
|
if (!t) return null;
|
|
3200
|
-
let n =
|
|
3260
|
+
let n = Ni.filter(([e]) => !0 !== t[e]).map(([, e]) => e);
|
|
3201
3261
|
return n.length > 0 ? n.join(", ") : null;
|
|
3202
|
-
},
|
|
3203
|
-
let t =
|
|
3262
|
+
}, Li = (e) => {
|
|
3263
|
+
let t = Pi(e);
|
|
3204
3264
|
if (!t) return null;
|
|
3205
|
-
let n =
|
|
3265
|
+
let n = Ii(e);
|
|
3206
3266
|
return n ? `${n} ${t}` : t;
|
|
3207
|
-
},
|
|
3267
|
+
}, Ri = (e) => [...e.getEntireRange().getRegions(ji.Unlock)], zi = (e) => {
|
|
3208
3268
|
let t = 0;
|
|
3209
3269
|
for (let n of e) {
|
|
3210
3270
|
let e = n.getCoords();
|
|
3211
3271
|
t += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
|
|
3212
3272
|
}
|
|
3213
3273
|
return t;
|
|
3214
|
-
},
|
|
3274
|
+
}, Bi = (t) => {
|
|
3215
3275
|
let n = null;
|
|
3216
3276
|
for (let e of t) {
|
|
3217
3277
|
let t = e.getCoords();
|
|
@@ -3223,70 +3283,70 @@ var Oi = o.Feature, ki = [
|
|
|
3223
3283
|
} : { ...t };
|
|
3224
3284
|
}
|
|
3225
3285
|
return n ? e.rangeToString(n) ?? "" : "";
|
|
3226
|
-
},
|
|
3227
|
-
function
|
|
3228
|
-
let t = e.getProtection(), n =
|
|
3286
|
+
}, Vi = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`;
|
|
3287
|
+
function Hi(e) {
|
|
3288
|
+
let t = e.getProtection(), n = Pi(t);
|
|
3229
3289
|
if (!n) return null;
|
|
3230
|
-
let r =
|
|
3290
|
+
let r = Ri(e), i = [r.length > 0 ? `${Vi(zi(r), "editable cell")} · ${Vi(r.length, "region")}` : "no editable cells", n];
|
|
3231
3291
|
return !1 === t.getProperties()?.showFormulas && i.push("formulas hidden"), {
|
|
3232
|
-
extent:
|
|
3292
|
+
extent: Bi(r),
|
|
3233
3293
|
detail: i.join(" · ")
|
|
3234
3294
|
};
|
|
3235
3295
|
}
|
|
3236
|
-
function
|
|
3237
|
-
let n = t.getProtection(), r =
|
|
3296
|
+
function Ui(e, t) {
|
|
3297
|
+
let n = t.getProtection(), r = Pi(n);
|
|
3238
3298
|
if (!r) return;
|
|
3239
3299
|
e.h2(`Protection (${r})`);
|
|
3240
3300
|
let i = (e) => ` ${e.padEnd(10)}`;
|
|
3241
|
-
e.text(`${i("allowed")}${
|
|
3242
|
-
let a =
|
|
3301
|
+
e.text(`${i("allowed")}${Fi(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`);
|
|
3302
|
+
let a = Ri(t);
|
|
3243
3303
|
if (a.length === 0) return e.text(`${i("editable")}none — every cell refuses a write`), void e.blank();
|
|
3244
|
-
e.text(`${i("editable")}${
|
|
3304
|
+
e.text(`${i("editable")}${Vi(zi(a), "cell")} · ${Vi(a.length, "region")}`), zt(e, a, {
|
|
3245
3305
|
maxRegions: 12,
|
|
3246
|
-
payload:
|
|
3306
|
+
payload: Lt(ji.Unlock, null),
|
|
3247
3307
|
recovery: `${H(t.getEntireRange())}.getRegions("unlock") lists all ${a.length}`
|
|
3248
3308
|
}), e.blank();
|
|
3249
3309
|
}
|
|
3250
|
-
function
|
|
3310
|
+
function Wi(e) {
|
|
3251
3311
|
if (!e.getWorksheet().getProtection().isLocked()) return null;
|
|
3252
|
-
let t = [...e.getRegions(
|
|
3312
|
+
let t = [...e.getRegions(ji.Unlock)], n = e.getRowCount() * e.getColumnCount(), r = zi(t);
|
|
3253
3313
|
if (r === 0) return "sheet locked — no cell here takes a write";
|
|
3254
3314
|
if (r === n) return "sheet locked — every cell here is editable";
|
|
3255
3315
|
let i = e.getWorksheet().getProtectedRanges().getItems({ address: e }).some((e) => !e.isUnlocked());
|
|
3256
|
-
return `sheet locked — ${r} of ${
|
|
3316
|
+
return `sheet locked — ${r} of ${Vi(n, "cell")} editable (${Bi(t)})` + (i ? " · some behind a range password" : "");
|
|
3257
3317
|
}
|
|
3258
|
-
function
|
|
3318
|
+
function Gi(e) {
|
|
3259
3319
|
return e.getWorksheet().getProtection().isLocked() ? e.isEditAllowed() ? "true — unlocked on a protected sheet" : "false — the sheet is protected and this cell is locked" : null;
|
|
3260
3320
|
}
|
|
3261
|
-
function
|
|
3321
|
+
function Ki(e) {
|
|
3262
3322
|
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
3323
|
}
|
|
3264
|
-
function
|
|
3265
|
-
let t = new
|
|
3324
|
+
function qi(e) {
|
|
3325
|
+
let t = new I(), n = !0 === e.isIWorksheetProtection;
|
|
3266
3326
|
t.h1(n ? "Sheet Protection" : "Workbook Protection"), t.blank();
|
|
3267
|
-
let r =
|
|
3327
|
+
let r = Pi(e);
|
|
3268
3328
|
t.fact(`State: ${r ?? "not protected"}${e.isReadOnly() ? " · read-only" : ""}`);
|
|
3269
3329
|
let i = r ? "" : " (when next locked)";
|
|
3270
3330
|
if (n) {
|
|
3271
|
-
let n =
|
|
3331
|
+
let n = Fi(e);
|
|
3272
3332
|
(r || n) && t.fact(`Allowed${i}: ${n ?? "none — only the editable cells take a write"}`), !1 === e.getProperties()?.showFormulas && t.fact(`Formulas${i}: hidden`), r && t.fact("Editable: sheet.getRegions(\"unlock\") lists the cells that take a write");
|
|
3273
3333
|
} else {
|
|
3274
|
-
let n =
|
|
3334
|
+
let n = Ii(e);
|
|
3275
3335
|
(r || e.getProperties()) && t.fact(`Refused${i}: ${n ?? "nothing"}`);
|
|
3276
3336
|
}
|
|
3277
3337
|
return t.toLines().join("\n").trimEnd();
|
|
3278
3338
|
}
|
|
3279
|
-
function
|
|
3280
|
-
let t = new
|
|
3339
|
+
function Ji(e) {
|
|
3340
|
+
let t = new I(), n = e.getRanges();
|
|
3281
3341
|
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
3342
|
let r = n.getWorksheet().getProtection().isLocked();
|
|
3283
3343
|
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
3344
|
}
|
|
3285
|
-
var
|
|
3286
|
-
async function
|
|
3345
|
+
var Yi = o.Feature;
|
|
3346
|
+
async function Xi(e, t) {
|
|
3287
3347
|
let n = e.getWorksheet().getRange(e.getCoords());
|
|
3288
3348
|
e = n.getCell();
|
|
3289
|
-
let r = new
|
|
3349
|
+
let r = new I();
|
|
3290
3350
|
r.h1(`Cell — ${V(e.getWorksheet().getName())}!${e.getAddress()}`), r.blank();
|
|
3291
3351
|
let i = !!e.getFormulaText(), o = e.getType();
|
|
3292
3352
|
(function(e, t) {
|
|
@@ -3307,15 +3367,22 @@ async function qi(e, t) {
|
|
|
3307
3367
|
}
|
|
3308
3368
|
let o = t.getHyperlink();
|
|
3309
3369
|
o && e.fact(`Hyperlink: ${o.getAddress()}`);
|
|
3310
|
-
let s = t.
|
|
3311
|
-
|
|
3370
|
+
let s = t.getSparkline();
|
|
3371
|
+
s && e.fact(`Sparkline: ${((e) => {
|
|
3372
|
+
let t = e.getGroup(), n = e.getRange().getWorksheet(), r = [`${t.getType()} of ${Nt(e.getDataRange(), n)}`], i = t.getRanges();
|
|
3373
|
+
i && i.getCount() > 0 && r.push(`group ${U(i)}`);
|
|
3374
|
+
let a = Pt(t.getProperties());
|
|
3375
|
+
return a.length > 0 && r.push(a.join(", ")), r.join(" · ");
|
|
3376
|
+
})(s)}`);
|
|
3377
|
+
let c = t.getSpans(), l = !t.isTopLeft();
|
|
3378
|
+
if (l || c.height > 1 || c.width > 1) {
|
|
3312
3379
|
let n = t.getRange().toString();
|
|
3313
|
-
e.fact(`Merge: ${n} · ${
|
|
3380
|
+
e.fact(`Merge: ${n} · ${c.height}×${c.width}`), l && e.fact("Merge Anchor: false — this cell is covered; the value lives at the top-left");
|
|
3314
3381
|
}
|
|
3315
|
-
let
|
|
3316
|
-
|
|
3317
|
-
let
|
|
3318
|
-
|
|
3382
|
+
let u = t.getSpill();
|
|
3383
|
+
u && e.fact(`Spill: ${u.toString()}${t.getSpillKind() === "error" ? " (blocked)" : ""}`), t.isSpillOverflow() && e.fact("Spill Overflow: true — the anchor formula is elsewhere");
|
|
3384
|
+
let d = Oe(t);
|
|
3385
|
+
d && e.fact(`Table: ${function(e, t) {
|
|
3319
3386
|
let n = e.getRange().getCoords(), r = [`${e.getName()} (${e.getRange().getAddress()})`], i = e.getColumnAt(t.colIndex - n.colStart);
|
|
3320
3387
|
if (i && r.push(`column ${JSON.stringify(i.getName())}`), e.isShowHeaders() && t.rowIndex === n.rowStart) r.push("header row");
|
|
3321
3388
|
else if (e.isShowTotals() && t.rowIndex === n.rowEnd) r.push("totals row");
|
|
@@ -3324,20 +3391,20 @@ async function qi(e, t) {
|
|
|
3324
3391
|
r.push(`data row ${t.rowIndex - n.rowStart + 1} of ${n.rowEnd - n.rowStart + 1}`);
|
|
3325
3392
|
}
|
|
3326
3393
|
return r.join(" · ");
|
|
3327
|
-
}(
|
|
3328
|
-
let
|
|
3329
|
-
|
|
3330
|
-
let
|
|
3331
|
-
|
|
3332
|
-
let
|
|
3333
|
-
if (
|
|
3334
|
-
let n =
|
|
3335
|
-
e.fact(`Errors: ${
|
|
3394
|
+
}(d, t.getCoords())}`);
|
|
3395
|
+
let f = xn(t.getWorksheet().getRange(t.getCoords()));
|
|
3396
|
+
f.length > 0 && e.fact(`Names: ${f.map((e) => `${e.getName()} (${U(e.getRanges())})`).join(" · ")}`);
|
|
3397
|
+
let p = Gi(t);
|
|
3398
|
+
p && e.fact(`Editable: ${p}`);
|
|
3399
|
+
let m = t.getErrors();
|
|
3400
|
+
if (m.length > 0) {
|
|
3401
|
+
let n = Ai(ki(t.getFormula()?.getTokens() ?? [], t.getWorksheet().getWorkbook()));
|
|
3402
|
+
e.fact(`Errors: ${m.join("; ")}${n ? ` — ${n}` : ""}`);
|
|
3336
3403
|
}
|
|
3337
|
-
let
|
|
3338
|
-
|
|
3339
|
-
let
|
|
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 =
|
|
3404
|
+
let h = t.getWarnings();
|
|
3405
|
+
h.length > 0 && e.fact(`Warnings: ${h.join("; ")}`);
|
|
3406
|
+
let g = function(e, t) {
|
|
3407
|
+
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 = ft(o), c = s ? `${s} ${e.codespan(o)}` : null, l = r ? we(n, r) : null, u = ve(n), d = xe(n), f = r ? Ce(n, r) : null, p = [
|
|
3341
3408
|
a ? null : i,
|
|
3342
3409
|
c ? `format ${c}` : null,
|
|
3343
3410
|
l ? `font ${l}` : null,
|
|
@@ -3347,7 +3414,7 @@ async function qi(e, t) {
|
|
|
3347
3414
|
].filter(Boolean);
|
|
3348
3415
|
return p.length > 0 ? p.join(" · ") : null;
|
|
3349
3416
|
}(e, t);
|
|
3350
|
-
|
|
3417
|
+
g && e.fact(`Style (effective): ${g}`), e.toLines().length > a && e.blank();
|
|
3351
3418
|
})(r, e);
|
|
3352
3419
|
let s = function(e, t) {
|
|
3353
3420
|
if (!t.getFormulaText() && t.getType() === b.Null) return null;
|
|
@@ -3357,27 +3424,27 @@ async function qi(e, t) {
|
|
|
3357
3424
|
return s && function(e, t, n) {
|
|
3358
3425
|
let r = t.getCoords(), i = t.getWorksheet();
|
|
3359
3426
|
e.h2(`Current Region — ${n.getAddress()} · ${n.getRowCount()}×${n.getColumnCount()}`);
|
|
3360
|
-
let a =
|
|
3427
|
+
let a = Ie(n), o = (e) => {
|
|
3361
3428
|
if (!a || a.byColumn !== (e === "row")) return null;
|
|
3362
3429
|
let t = e === "row" ? r.rowIndex : r.colIndex;
|
|
3363
3430
|
if (t < a.start) return null;
|
|
3364
3431
|
let n = a.lines.find((e) => e.index === t);
|
|
3365
|
-
if (n?.sums) return `totals, ${
|
|
3366
|
-
let i = a.byColumn ? `row ${a.start + 1}` : `column ${
|
|
3432
|
+
if (n?.sums) return `totals, ${ze(n.sums)}`;
|
|
3433
|
+
let i = a.byColumn ? `row ${a.start + 1}` : `column ${F(a.start)}`;
|
|
3367
3434
|
return t === a.start ? "totals" : `below the totals ${i}`;
|
|
3368
3435
|
}, s = [["row", [
|
|
3369
3436
|
String(r.rowIndex + 1),
|
|
3370
|
-
|
|
3437
|
+
Te(P(i, r, "row")),
|
|
3371
3438
|
o("row")
|
|
3372
3439
|
].filter(Boolean).join(" · ")], ["column", [
|
|
3373
|
-
|
|
3374
|
-
|
|
3440
|
+
F(r.colIndex),
|
|
3441
|
+
Te(P(i, r, "column")),
|
|
3375
3442
|
o("column")
|
|
3376
3443
|
].filter(Boolean).join(" · ")]];
|
|
3377
3444
|
for (let [t, n] of s) e.text(` ${t.padEnd(7)}${n}`);
|
|
3378
3445
|
e.blank();
|
|
3379
3446
|
}(r, e, s), function(e, t, n) {
|
|
3380
|
-
let r = t.getCoords(), i = n?.getCoords() ??
|
|
3447
|
+
let r = t.getCoords(), i = n?.getCoords() ?? Qi(r), a = t.getWorksheet(), o = a.getRange({
|
|
3381
3448
|
rowStart: r.rowIndex,
|
|
3382
3449
|
rowEnd: r.rowIndex,
|
|
3383
3450
|
colStart: i.colStart,
|
|
@@ -3387,7 +3454,7 @@ async function qi(e, t) {
|
|
|
3387
3454
|
rowEnd: i.rowEnd,
|
|
3388
3455
|
colStart: r.colIndex,
|
|
3389
3456
|
colEnd: r.colIndex
|
|
3390
|
-
}), c = [
|
|
3457
|
+
}), c = [$i(o, "row", r.colIndex), $i(s, "column", r.rowIndex)].filter((e) => e !== null);
|
|
3391
3458
|
if (c.length === 0) return;
|
|
3392
3459
|
let l = c.reduce((e, t) => t.share > e.share ? t : e), u = l.axis === "row" ? r.colIndex : r.rowIndex, d = l.segments.filter((e) => e.end >= l.start && e.start <= l.end), f = l.end - l.start + 1, p = l.axis === "row" ? a.getRange({
|
|
3393
3460
|
rowStart: r.rowIndex,
|
|
@@ -3415,7 +3482,7 @@ async function qi(e, t) {
|
|
|
3415
3482
|
address: n,
|
|
3416
3483
|
detail: t ? `${r} ← this cell` : r
|
|
3417
3484
|
};
|
|
3418
|
-
}), n = Math.max(...t.map((e) => e.address.length)), r = t.slice(0,
|
|
3485
|
+
}), n = Math.max(...t.map((e) => e.address.length)), r = t.slice(0, Zi);
|
|
3419
3486
|
for (let t of r) e.text(` ${t.address.padEnd(n)} ${t.detail}`);
|
|
3420
3487
|
t.length > r.length && e.text(` …${t.length - r.length} more · getRegions("formula") on ${p.getAddress()} lists them`);
|
|
3421
3488
|
}
|
|
@@ -3427,23 +3494,23 @@ async function qi(e, t) {
|
|
|
3427
3494
|
for (let r of n) e.text(` ${ce(r, t)}`);
|
|
3428
3495
|
e.blank();
|
|
3429
3496
|
}
|
|
3430
|
-
}(r, e), await
|
|
3497
|
+
}(r, e), await li(r, e, t, {
|
|
3431
3498
|
home: e.getWorksheet(),
|
|
3432
3499
|
subject: n,
|
|
3433
3500
|
zeroPrecedents: i,
|
|
3434
3501
|
zeroDependents: i || o !== b.Null && o !== b.String
|
|
3435
3502
|
}), r.toLines().join("\n").trimEnd();
|
|
3436
3503
|
}
|
|
3437
|
-
var
|
|
3504
|
+
var Zi = 8, Qi = (e) => ({
|
|
3438
3505
|
rowStart: e.rowIndex,
|
|
3439
3506
|
rowEnd: e.rowIndex,
|
|
3440
3507
|
colStart: e.colIndex,
|
|
3441
3508
|
colEnd: e.colIndex
|
|
3442
3509
|
});
|
|
3443
|
-
function
|
|
3510
|
+
function $i(e, t, n) {
|
|
3444
3511
|
if (e.isSingleCell()) return null;
|
|
3445
3512
|
let r = [];
|
|
3446
|
-
for (let n of e.getRegions(
|
|
3513
|
+
for (let n of e.getRegions(Yi.Formula)) {
|
|
3447
3514
|
let e = n.getCoords();
|
|
3448
3515
|
r.push({
|
|
3449
3516
|
start: t === "row" ? e.colStart : e.rowStart,
|
|
@@ -3462,7 +3529,7 @@ function Xi(e, t, n) {
|
|
|
3462
3529
|
let a = r.filter((e) => e.r1c1 === i), s = a[0].start, c = a[a.length - 1].end;
|
|
3463
3530
|
if (n < s || n > c) continue;
|
|
3464
3531
|
let l = [], u = s;
|
|
3465
|
-
for (let n of r) n.end < s || n.start > c || (n.start > u && l.push(
|
|
3532
|
+
for (let n of r) n.end < s || n.start > c || (n.start > u && l.push(ea(e, t, u, n.start - 1)), l.push(n), u = n.end + 1);
|
|
3466
3533
|
return {
|
|
3467
3534
|
axis: t,
|
|
3468
3535
|
segments: l,
|
|
@@ -3474,7 +3541,7 @@ function Xi(e, t, n) {
|
|
|
3474
3541
|
}
|
|
3475
3542
|
return null;
|
|
3476
3543
|
}
|
|
3477
|
-
function
|
|
3544
|
+
function ea(e, t, n, r) {
|
|
3478
3545
|
let i = e.getCoords();
|
|
3479
3546
|
return {
|
|
3480
3547
|
start: n,
|
|
@@ -3493,13 +3560,13 @@ function Zi(e, t, n, r) {
|
|
|
3493
3560
|
})
|
|
3494
3561
|
};
|
|
3495
3562
|
}
|
|
3496
|
-
async function
|
|
3497
|
-
let n = new
|
|
3498
|
-
n.h1(`Cell Range — ${
|
|
3499
|
-
let r =
|
|
3500
|
-
r && n.text(`Protection: ${r}`), n.blank(),
|
|
3563
|
+
async function ta(e, t) {
|
|
3564
|
+
let n = new I();
|
|
3565
|
+
n.h1(`Cell Range — ${Xt(e)}`);
|
|
3566
|
+
let r = Wi(e);
|
|
3567
|
+
r && n.text(`Protection: ${r}`), n.blank(), Zt(n, e), function(e, t, n) {
|
|
3501
3568
|
if (!1 === n?.profile || t.isSingleCell() || !t.isContentful()) return;
|
|
3502
|
-
let r =
|
|
3569
|
+
let r = Ne({
|
|
3503
3570
|
getRowCount: () => t.getRowCount(),
|
|
3504
3571
|
getColumnCount: () => t.getColumnCount(),
|
|
3505
3572
|
getCell: () => t.getCell(),
|
|
@@ -3536,7 +3603,7 @@ async function Qi(e, t) {
|
|
|
3536
3603
|
colStart: _[0],
|
|
3537
3604
|
colEnd: _[_.length - 1]
|
|
3538
3605
|
}), y = `${p} cell${p === 1 ? "" : "s"}`, b = v.toString() !== t.toString();
|
|
3539
|
-
e.h2(`Values (${b ? `${
|
|
3606
|
+
e.h2(`Values (${b ? `${Yt(v)} · ` : ""}${y})`);
|
|
3540
3607
|
let x = e.beginFrame(_.map((e) => u.at(e - c).getText()));
|
|
3541
3608
|
for (let e of h) {
|
|
3542
3609
|
let t = d.get(e);
|
|
@@ -3552,7 +3619,7 @@ async function Qi(e, t) {
|
|
|
3552
3619
|
address: e.getAddress(),
|
|
3553
3620
|
size: `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
3554
3621
|
formula: i,
|
|
3555
|
-
labels:
|
|
3622
|
+
labels: ia(t)
|
|
3556
3623
|
}), r.length >= (n?.maxRegions ?? 100))) break;
|
|
3557
3624
|
}
|
|
3558
3625
|
if (r.length === 0) return;
|
|
@@ -3566,12 +3633,12 @@ async function Qi(e, t) {
|
|
|
3566
3633
|
let n = Math.max(...t.map((e) => e.address.length));
|
|
3567
3634
|
for (let { address: r, valuesRange: i } of t) e.text(` ${r.padEnd(n)} ${i}`);
|
|
3568
3635
|
e.blank();
|
|
3569
|
-
}(n, i.spills), await
|
|
3636
|
+
}(n, i.spills), await Sn(n, e), mr(n, e.getMovables()), bn(n, "Conditional Formats", e.getConditionalFormats(), kt), bn(n, "Data Validations", e.getDataValidations(), At), await li(n, e, t, {
|
|
3570
3637
|
home: e.getWorksheet(),
|
|
3571
3638
|
subject: e
|
|
3572
3639
|
}), n.toLines().join("\n").trimEnd();
|
|
3573
3640
|
}
|
|
3574
|
-
var
|
|
3641
|
+
var na = /* @__PURE__ */ new Set([
|
|
3575
3642
|
"INDEX",
|
|
3576
3643
|
"MATCH",
|
|
3577
3644
|
"XMATCH",
|
|
@@ -3579,14 +3646,14 @@ var $i = /* @__PURE__ */ new Set([
|
|
|
3579
3646
|
"HLOOKUP",
|
|
3580
3647
|
"XLOOKUP",
|
|
3581
3648
|
"LOOKUP"
|
|
3582
|
-
]),
|
|
3583
|
-
function
|
|
3649
|
+
]), ra = 4;
|
|
3650
|
+
function ia(e) {
|
|
3584
3651
|
let t = e.getFormula(), n = t?.getReferences();
|
|
3585
3652
|
if (!t || !n) return null;
|
|
3586
3653
|
let r = /* @__PURE__ */ new Set();
|
|
3587
|
-
for (let e of t.getTokens()) e.referenceIndex !== void 0 && e.context &&
|
|
3654
|
+
for (let e of t.getTokens()) e.referenceIndex !== void 0 && e.context && na.has(e.context.name.toUpperCase().replace(/^(_XLFN\.)?(_XLWS\.)?/, "")) && r.add(e.referenceIndex);
|
|
3588
3655
|
let i = e.getWorksheet(), a = e.getCoords(), o = [], s = /* @__PURE__ */ new Set();
|
|
3589
|
-
for (let e = 0; e < n.length && o.length <
|
|
3656
|
+
for (let e = 0; e < n.length && o.length < ra; e++) {
|
|
3590
3657
|
let t = n.at(e), c = t.getCoords();
|
|
3591
3658
|
if (!c) continue;
|
|
3592
3659
|
let l = t.getWorksheet(), u = l !== i;
|
|
@@ -3597,56 +3664,56 @@ function ta(e) {
|
|
|
3597
3664
|
let f = {
|
|
3598
3665
|
rowIndex: c.rowStart,
|
|
3599
3666
|
colIndex: c.colStart
|
|
3600
|
-
}, p = c.rowEnd > c.rowStart, m = c.colEnd > c.colStart, h = p ? null :
|
|
3667
|
+
}, p = c.rowEnd > c.rowStart, m = c.colEnd > c.colStart, h = p ? null : P(l, f, "row"), g = m && !p ? null : P(l, f, "column"), _ = [h ? `row ${Te(h)}` : null, g ? `col ${Te(g)}` : null].filter(Boolean);
|
|
3601
3668
|
_.length > 0 && o.push(`${d} ${_.join(" ")}`);
|
|
3602
3669
|
}
|
|
3603
3670
|
if (o.length === 0) return null;
|
|
3604
|
-
let c =
|
|
3605
|
-
return `${c ? `row ${
|
|
3671
|
+
let c = P(i, a, "row");
|
|
3672
|
+
return `${c ? `row ${Te(c)} → ` : "→ "}${o.join(" · ")}`;
|
|
3606
3673
|
}
|
|
3607
|
-
function
|
|
3608
|
-
let t = new
|
|
3674
|
+
function aa(e) {
|
|
3675
|
+
let t = new I(), n = e.getRanges();
|
|
3609
3676
|
t.h1(`Conditional Format — ${W(n)}`), t.blank(), t.fact(`Order: ${e.getIndex() + 1}`);
|
|
3610
3677
|
let r = e.getScale();
|
|
3611
|
-
if (r) t.fact(`Rule: ${
|
|
3678
|
+
if (r) t.fact(`Rule: ${Dt(r)}`);
|
|
3612
3679
|
else {
|
|
3613
3680
|
let n = e.getCondition();
|
|
3614
3681
|
t.fact(`Rule: ${n?.toString() || "none — this rule tests nothing"}`);
|
|
3615
|
-
let r =
|
|
3682
|
+
let r = Tt(e.getStyle());
|
|
3616
3683
|
r && t.fact(`Format: ${r}`);
|
|
3617
3684
|
}
|
|
3618
3685
|
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
3686
|
}
|
|
3620
|
-
function
|
|
3621
|
-
let t = new
|
|
3687
|
+
function oa(e) {
|
|
3688
|
+
let t = new I();
|
|
3622
3689
|
t.h1("Counts");
|
|
3623
3690
|
let n = !1;
|
|
3624
3691
|
for (let [r, i] of Object.entries(e)) i > 0 && (t.fact(`${r}: ${i}`), n = !0);
|
|
3625
3692
|
return n || t.fact("None"), t.toLines().join("\n").trimEnd();
|
|
3626
3693
|
}
|
|
3627
|
-
function
|
|
3628
|
-
let t = new
|
|
3694
|
+
function sa(e) {
|
|
3695
|
+
let t = new I(), n = e.getRanges();
|
|
3629
3696
|
t.h1(`Data Validation — ${W(n)}`), t.blank();
|
|
3630
3697
|
let r = e.getCondition();
|
|
3631
3698
|
t.fact(`Rule: ${r?.toString() || "none — anything is accepted here"}`);
|
|
3632
|
-
let i =
|
|
3699
|
+
let i = jt(r);
|
|
3633
3700
|
i && t.fact(`Allowed: ${i}`), t.fact("Blanks: " + (e.isIncludeBlanks() ? "allowed" : "rejected"));
|
|
3634
3701
|
let a = e.getAlertStyle();
|
|
3635
3702
|
if (t.fact(`Alert: ${a}${a === l.AlertStyle.Stop ? " — the entry is refused" : " — the entry is accepted anyway"}`), e.isShowAlertMessage()) {
|
|
3636
|
-
let n =
|
|
3703
|
+
let n = ca(e.getAlertTitle(), e.getAlertMessage());
|
|
3637
3704
|
n && t.fact(`Alert Message: ${n}`);
|
|
3638
3705
|
}
|
|
3639
3706
|
if (e.isShowPromptMessage()) {
|
|
3640
|
-
let n =
|
|
3707
|
+
let n = ca(e.getPromptTitle(), e.getPromptMessage());
|
|
3641
3708
|
n && t.fact(`Prompt: ${n}`);
|
|
3642
3709
|
}
|
|
3643
3710
|
return e.isHideDropdown() && t.fact("Dropdown: hidden"), t.fact(`Cells: ${n.size}`), t.toLines().join("\n").trimEnd();
|
|
3644
3711
|
}
|
|
3645
|
-
var
|
|
3712
|
+
var ca = (e, t) => {
|
|
3646
3713
|
let n = [e?.trim(), t?.trim()].filter(Boolean);
|
|
3647
3714
|
return n.length > 0 ? n.join(" — ") : null;
|
|
3648
|
-
},
|
|
3649
|
-
function
|
|
3715
|
+
}, la = "function", ua = "named", da = "tableReference", fa = "tableColumn", pa = "externalReference", ma = [["isReferenceOnly", "reference-only"], ["isVolatile", "volatile"]], ha = (e, t) => e ? ` (${V(e)}!${t})` : "";
|
|
3716
|
+
function ga(e, t, n, r) {
|
|
3650
3717
|
if (e === "external") return "another workbook — not resolvable from here";
|
|
3651
3718
|
if (!n) return "";
|
|
3652
3719
|
switch (e) {
|
|
@@ -3657,11 +3724,11 @@ function pa(e, t, n, r) {
|
|
|
3657
3724
|
case "named": return function(e, t) {
|
|
3658
3725
|
let n = t.getNames(), r = n.getByName(e) ?? n.getByName(e, !0);
|
|
3659
3726
|
if (r) {
|
|
3660
|
-
let e =
|
|
3727
|
+
let e = ha(r.getScope(), r.getName()), t = r.getRanges?.();
|
|
3661
3728
|
return !t || t.isInvalid() ? `defined name — reference does not resolve${e}` : `${t.toString()}${e}`;
|
|
3662
3729
|
}
|
|
3663
3730
|
let i = t.getCalculation().getNamedFormulas().getByName(e);
|
|
3664
|
-
return i ? `=${i.getExpression()}${
|
|
3731
|
+
return i ? `=${i.getExpression()}${ha(i.getScope(), i.getName())}` : "unknown — evaluates to #NAME?";
|
|
3665
3732
|
}(t, n);
|
|
3666
3733
|
case "table": {
|
|
3667
3734
|
let e = n.getTables().getByName(t) ?? n.getWorkbook()?.getWorksheets().getItems().map((e) => e.getTables().getByName(t)).find(Boolean) ?? null;
|
|
@@ -3680,9 +3747,9 @@ function pa(e, t, n, r) {
|
|
|
3680
3747
|
}
|
|
3681
3748
|
return "";
|
|
3682
3749
|
}
|
|
3683
|
-
async function
|
|
3684
|
-
let n = t?.maxTokens ?? 200, r = new
|
|
3685
|
-
if (r.h1(i ? `Name — ${
|
|
3750
|
+
async function _a(e, t) {
|
|
3751
|
+
let n = t?.maxTokens ?? 200, r = new I(), i = ((e) => e.isINamed ? e : null)(e);
|
|
3752
|
+
if (r.h1(i ? `Name — ${ln(i)}` : "Formula"), r.text(r.codespan("=" + e.getExpression())), r.blank(), i) {
|
|
3686
3753
|
i.isHidden() && r.fact("Hidden: true — not offered in the UI; formulas resolve it normally");
|
|
3687
3754
|
let e = i.getComment();
|
|
3688
3755
|
e && r.fact(`Comment: ${e}`);
|
|
@@ -3702,7 +3769,7 @@ async function ma(e, t) {
|
|
|
3702
3769
|
let i = O(n);
|
|
3703
3770
|
e.fact(`Value: ${i ? i.display : "(empty)"}`);
|
|
3704
3771
|
}(r, e), r.fact(`Status: ${e.getCalculationStatus()}`), e.isValid() || r.fact("Valid: false — the text did not parse as a complete expression");
|
|
3705
|
-
let a =
|
|
3772
|
+
let a = ma.filter(([t]) => e[t]()).map(([, e]) => e);
|
|
3706
3773
|
a.length > 0 && r.fact(`Flags: ${a.join(" · ")}`), r.blank();
|
|
3707
3774
|
let o = e.getReferences(), s = t?.context ?? o?.getWorksheet() ?? null, c = function(e, t) {
|
|
3708
3775
|
let n = /* @__PURE__ */ new Map(), r = null;
|
|
@@ -3711,19 +3778,19 @@ async function ma(e, t) {
|
|
|
3711
3778
|
if (!e) continue;
|
|
3712
3779
|
let a;
|
|
3713
3780
|
switch (i.type) {
|
|
3714
|
-
case
|
|
3781
|
+
case la:
|
|
3715
3782
|
a = "function";
|
|
3716
3783
|
break;
|
|
3717
|
-
case
|
|
3784
|
+
case ua:
|
|
3718
3785
|
a = "named";
|
|
3719
3786
|
break;
|
|
3720
|
-
case
|
|
3787
|
+
case da:
|
|
3721
3788
|
a = "table", r = e;
|
|
3722
3789
|
break;
|
|
3723
|
-
case
|
|
3790
|
+
case fa:
|
|
3724
3791
|
a = "column";
|
|
3725
3792
|
break;
|
|
3726
|
-
case
|
|
3793
|
+
case pa:
|
|
3727
3794
|
a = "external";
|
|
3728
3795
|
break;
|
|
3729
3796
|
default: continue;
|
|
@@ -3733,10 +3800,10 @@ async function ma(e, t) {
|
|
|
3733
3800
|
kind: a,
|
|
3734
3801
|
text: e,
|
|
3735
3802
|
uses: 1,
|
|
3736
|
-
resolution:
|
|
3803
|
+
resolution: ga(a, e, t, r)
|
|
3737
3804
|
});
|
|
3738
3805
|
}
|
|
3739
|
-
for (let r of
|
|
3806
|
+
for (let r of ki(e, t?.getWorkbook())) n.set(`external${r.scope.toLowerCase()}`, {
|
|
3740
3807
|
kind: "external",
|
|
3741
3808
|
text: r.scope,
|
|
3742
3809
|
uses: r.uses,
|
|
@@ -3763,7 +3830,7 @@ async function ma(e, t) {
|
|
|
3763
3830
|
if (r.h2("References"), o && o.length !== 0) for (let e = 0; e < o.length; e++) r.text(` ${String(e).padStart(2)} ${o.at(e).getAddress()}`);
|
|
3764
3831
|
else r.text("None");
|
|
3765
3832
|
r.blank(), i && await async function(e, t) {
|
|
3766
|
-
await t.getDirectDependents() || (e.h2("Dependents (0)"), e.text(" None — no formula references this name"), e.blank()), await
|
|
3833
|
+
await t.getDirectDependents() || (e.h2("Dependents (0)"), e.text(" None — no formula references this name"), e.blank()), await li(e, t);
|
|
3767
3834
|
}(r, i);
|
|
3768
3835
|
let l = e.getTokens();
|
|
3769
3836
|
if (r.h2("Tokens"), l.length === 0) r.text("None");
|
|
@@ -3792,7 +3859,7 @@ async function ma(e, t) {
|
|
|
3792
3859
|
}
|
|
3793
3860
|
return r.toLines().join("\n").trimEnd();
|
|
3794
3861
|
}
|
|
3795
|
-
var
|
|
3862
|
+
var va = [
|
|
3796
3863
|
"Workbook_Open",
|
|
3797
3864
|
"Auto_Open",
|
|
3798
3865
|
"Workbook_BeforeClose",
|
|
@@ -3805,11 +3872,11 @@ var ha = [
|
|
|
3805
3872
|
"Worksheet_Activate",
|
|
3806
3873
|
"Worksheet_BeforeDoubleClick",
|
|
3807
3874
|
"Worksheet_Calculate"
|
|
3808
|
-
],
|
|
3875
|
+
], ya = (e) => {
|
|
3809
3876
|
let t = [];
|
|
3810
|
-
for (let n of
|
|
3877
|
+
for (let n of va) RegExp(`(?:Sub|Function)\\s+${n}\\b`, "i").test(e) && t.push(n);
|
|
3811
3878
|
return t;
|
|
3812
|
-
},
|
|
3879
|
+
}, ba = (e) => {
|
|
3813
3880
|
try {
|
|
3814
3881
|
return e.getFunctions().getItems({
|
|
3815
3882
|
type: "autoRun",
|
|
@@ -3818,32 +3885,32 @@ var ha = [
|
|
|
3818
3885
|
} catch {
|
|
3819
3886
|
return [];
|
|
3820
3887
|
}
|
|
3821
|
-
},
|
|
3888
|
+
}, xa = (e) => {
|
|
3822
3889
|
let t = e.getScope();
|
|
3823
3890
|
return t ? !0 === t.isIWorksheet ? `sheet '${t.getName()}'` : "workbook" : "global";
|
|
3824
|
-
},
|
|
3891
|
+
}, Sa = (e) => {
|
|
3825
3892
|
let t = ((e) => e.getSource()?.trim() ?? "")(e);
|
|
3826
3893
|
return {
|
|
3827
3894
|
module: e,
|
|
3828
3895
|
name: e.getName(),
|
|
3829
3896
|
language: e.getLanguage(),
|
|
3830
|
-
scope:
|
|
3897
|
+
scope: xa(e),
|
|
3831
3898
|
body: t,
|
|
3832
3899
|
lines: t.length === 0 ? 0 : t.split("\n").length,
|
|
3833
|
-
runsInExcel:
|
|
3834
|
-
runsHere:
|
|
3900
|
+
runsInExcel: ya(t),
|
|
3901
|
+
runsHere: ba(e),
|
|
3835
3902
|
executable: !!e.toJSON().compiled
|
|
3836
3903
|
};
|
|
3837
3904
|
};
|
|
3838
|
-
function
|
|
3905
|
+
function Ca(e) {
|
|
3839
3906
|
let t = [], n = e.getModules?.();
|
|
3840
3907
|
n && t.push(...n.getItems({ language: null }));
|
|
3841
3908
|
for (let n of e.getWorksheets().getItems()) t.push(...n.getModules().getItems({ language: null }));
|
|
3842
3909
|
return t;
|
|
3843
3910
|
}
|
|
3844
|
-
function
|
|
3911
|
+
function wa(e, t, n) {
|
|
3845
3912
|
if (t.length === 0) return;
|
|
3846
|
-
let r = t.map(
|
|
3913
|
+
let r = t.map(Sa), i = r.filter((e) => e.lines > 0);
|
|
3847
3914
|
if (i.length === 0) return e.h2("Code (none)"), e.text(`${r.length} module${r.length === 1 ? "" : "s"}, none with any source.`), void e.blank();
|
|
3848
3915
|
e.h2(`Code (${i.length} module${i.length === 1 ? "" : "s"})`);
|
|
3849
3916
|
let a = i.filter((e) => !e.executable);
|
|
@@ -3879,7 +3946,7 @@ function xa(e, t, n) {
|
|
|
3879
3946
|
}
|
|
3880
3947
|
f.endFrame(), c.length < i.length && e.text(` …and ${i.length - c.length} more · wb.getModules() renders the full view`), e.blank();
|
|
3881
3948
|
}
|
|
3882
|
-
function
|
|
3949
|
+
function Ta(e, t, n, r) {
|
|
3883
3950
|
n(`Module — ${t.name}`), e.blank();
|
|
3884
3951
|
let i = [
|
|
3885
3952
|
`language: ${t.language}`,
|
|
@@ -3891,133 +3958,133 @@ function Sa(e, t, n, r) {
|
|
|
3891
3958
|
let a = r?.maxSourceLines ?? 200, o = t.body.split("\n"), s = o.length > a ? o.slice(0, a) : o;
|
|
3892
3959
|
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
3960
|
}
|
|
3894
|
-
function
|
|
3895
|
-
let n = new
|
|
3896
|
-
return
|
|
3961
|
+
function Ea(e, t) {
|
|
3962
|
+
let n = new I();
|
|
3963
|
+
return Ta(n, Sa(e), (e) => n.h1(e), t), n.toLines().join("\n").trimEnd();
|
|
3897
3964
|
}
|
|
3898
|
-
function
|
|
3899
|
-
let n = new
|
|
3965
|
+
function Da(e, t) {
|
|
3966
|
+
let n = new I(), r = e.getItems({ language: null }) ?? [];
|
|
3900
3967
|
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
|
-
let i = r.map(
|
|
3902
|
-
|
|
3903
|
-
for (let e of i) e.lines !== 0 && (
|
|
3968
|
+
let i = r.map(Sa);
|
|
3969
|
+
wa(n, r, t);
|
|
3970
|
+
for (let e of i) e.lines !== 0 && (Ta(n, e, (e) => n.h2(e), t), n.blank());
|
|
3904
3971
|
return n.toLines().join("\n").trimEnd();
|
|
3905
3972
|
}
|
|
3906
|
-
var
|
|
3907
|
-
async function
|
|
3908
|
-
let n = new
|
|
3973
|
+
var Oa = [["formula", "Names"], ["table", "Tables"]];
|
|
3974
|
+
async function ka(e, t) {
|
|
3975
|
+
let n = new I(), r = e.getItems({ includeHidden: !0 }) ?? [];
|
|
3909
3976
|
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
|
-
let i = new Set(
|
|
3911
|
-
for (let [e, i] of
|
|
3977
|
+
let i = new Set(Oa.map(([e]) => e));
|
|
3978
|
+
for (let [e, i] of Oa) await _n(n, r.filter((t) => t.getType() === e), {
|
|
3912
3979
|
...t,
|
|
3913
3980
|
heading: i,
|
|
3914
3981
|
symbols: r
|
|
3915
3982
|
});
|
|
3916
3983
|
let a = r.filter((e) => !i.has(e.getType())), o = [...new Set(a.map((e) => e.getType()))].sort();
|
|
3917
|
-
for (let e of o) await
|
|
3984
|
+
for (let e of o) await _n(n, a.filter((t) => t.getType() === e), {
|
|
3918
3985
|
...t,
|
|
3919
3986
|
heading: e,
|
|
3920
3987
|
symbols: r
|
|
3921
3988
|
});
|
|
3922
3989
|
return n.toLines().join("\n").trimEnd();
|
|
3923
3990
|
}
|
|
3924
|
-
var
|
|
3991
|
+
var Aa = [
|
|
3925
3992
|
.75,
|
|
3926
3993
|
.75,
|
|
3927
3994
|
.7,
|
|
3928
3995
|
.7,
|
|
3929
3996
|
.3,
|
|
3930
3997
|
.3
|
|
3931
|
-
],
|
|
3998
|
+
], ja = [
|
|
3932
3999
|
["top", (e) => e.getTopMargin()],
|
|
3933
4000
|
["bottom", (e) => e.getBottomMargin()],
|
|
3934
4001
|
["left", (e) => e.getLeftMargin()],
|
|
3935
4002
|
["right", (e) => e.getRightMargin()],
|
|
3936
4003
|
["header", (e) => e.getHeaderMargin()],
|
|
3937
4004
|
["footer", (e) => e.getFooterMargin()]
|
|
3938
|
-
],
|
|
4005
|
+
], Ma = [
|
|
3939
4006
|
["gridlines", (e) => e.getPrintGridlines()],
|
|
3940
4007
|
["headings", (e) => e.getPrintHeadings()],
|
|
3941
4008
|
["black and white", (e) => e.getBlackAndWhite()],
|
|
3942
4009
|
["draft quality", (e) => e.getDraftMode()]
|
|
3943
|
-
],
|
|
4010
|
+
], Na = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Pa = (e) => Math.round(e / 72 * 1e3) / 1e3, Fa = (e) => {
|
|
3944
4011
|
let t = e.getZoom();
|
|
3945
4012
|
if (t.scale !== void 0) return t.scale === 100 ? null : `${t.scale}%`;
|
|
3946
|
-
let n = (e, t) => e ? `${
|
|
4013
|
+
let n = (e, t) => e ? `${Na(e, "page")} ${t}` : `automatic ${t}`;
|
|
3947
4014
|
return `fit to ${n(t.horizontalFitToPages, "wide")} × ${n(t.verticalFitToPages, "tall")}`;
|
|
3948
|
-
},
|
|
4015
|
+
}, Ia = (e) => {
|
|
3949
4016
|
let t = e.getPaperSizeCode();
|
|
3950
4017
|
return t === 1 ? null : e.getPaperSize() ?? `code ${t}`;
|
|
3951
|
-
},
|
|
4018
|
+
}, La = (e) => ja.every(([, t], n) => Pa(t(e)) === Aa[n]), Ra = (t, n) => {
|
|
3952
4019
|
if (!t) return null;
|
|
3953
4020
|
let r = t.getCoords();
|
|
3954
4021
|
return n ? e.runToString(r.colStart, r.colEnd, !0) : e.runToString(r.rowStart, r.rowEnd, !1);
|
|
3955
|
-
},
|
|
4022
|
+
}, za = (t, n) => {
|
|
3956
4023
|
if (t.length === 0) return null;
|
|
3957
4024
|
let r = t.slice(0, 20).map((t) => {
|
|
3958
4025
|
let r = n ? t.getColumnIndex() : t.getRowIndex();
|
|
3959
4026
|
return e.runToString(r, r, n).split(":")[0];
|
|
3960
4027
|
}), i = t.length > 20 ? `, …and ${t.length - 20} more` : "";
|
|
3961
4028
|
return `before ${n ? "columns" : "rows"} ${r.join(", ")}${i}`;
|
|
3962
|
-
},
|
|
4029
|
+
}, Ba = (e) => {
|
|
3963
4030
|
let t = e.getHeadersFooters(), n = t.getState(), r = f.HeaderFooterState, i = n === r.FirstAndDefault || n === r.FirstOddAndEven, a = n === r.OddAndEven || n === r.FirstOddAndEven, o = [];
|
|
3964
4031
|
return i && o.push(["first page", t.getFirstPage()]), a ? (o.push(["odd pages", t.getOddPages()]), o.push(["even pages", t.getEvenPages()])) : o.push([i ? "other pages" : "every page", t.getDefaultForAllPages()]), o;
|
|
3965
|
-
},
|
|
4032
|
+
}, Va = (e, t, n) => {
|
|
3966
4033
|
let r = [];
|
|
3967
4034
|
return e && r.push(`left ${JSON.stringify(e)}`), t && r.push(`center ${JSON.stringify(t)}`), n && r.push(`right ${JSON.stringify(n)}`), r.length > 0 ? r.join(" · ") : null;
|
|
3968
4035
|
};
|
|
3969
|
-
function
|
|
4036
|
+
function Ha(e) {
|
|
3970
4037
|
let t = e.getPageLayout(), n = [];
|
|
3971
4038
|
t.getOrientation() !== f.Orientation.Portrait && n.push(t.getOrientation());
|
|
3972
|
-
let r =
|
|
4039
|
+
let r = Ia(t);
|
|
3973
4040
|
r && n.push(r);
|
|
3974
|
-
let i =
|
|
4041
|
+
let i = Fa(t);
|
|
3975
4042
|
i && n.push(i);
|
|
3976
4043
|
let a = t.getPrintArea();
|
|
3977
4044
|
a && n.push(`print area ${U(a)}`);
|
|
3978
|
-
let o =
|
|
4045
|
+
let o = Ra(t.getPrintTitleRows(), !1);
|
|
3979
4046
|
o && n.push(`title rows ${o}`);
|
|
3980
|
-
let s =
|
|
4047
|
+
let s = Ra(t.getPrintTitleColumns(), !0);
|
|
3981
4048
|
s && n.push(`title columns ${s}`);
|
|
3982
4049
|
let c = t.getHorizontalPageBreaks().length;
|
|
3983
|
-
c > 0 && n.push(
|
|
4050
|
+
c > 0 && n.push(Na(c, "row break"));
|
|
3984
4051
|
let l = t.getVerticalPageBreaks().length;
|
|
3985
|
-
l > 0 && n.push(
|
|
3986
|
-
let u =
|
|
4052
|
+
l > 0 && n.push(Na(l, "column break")), ((e) => Ba(e).some(([, e]) => e.getHeader() !== "" || e.getFooter() !== ""))(t) && n.push("headers/footers"), La(t) || n.push("custom margins");
|
|
4053
|
+
let u = Ma.filter(([, e]) => e(t)).map(([e]) => e);
|
|
3987
4054
|
return u.length > 0 && n.push(u.join(", ")), n.length === 0 ? null : `${n.join(" · ")} — wb.getWorksheet(${JSON.stringify(e.getName())}).getPageLayout()`;
|
|
3988
4055
|
}
|
|
3989
|
-
function
|
|
3990
|
-
let t = new
|
|
4056
|
+
function Ua(e) {
|
|
4057
|
+
let t = new I();
|
|
3991
4058
|
t.h1("Page Layout"), t.blank();
|
|
3992
4059
|
let n = e.getOrientation();
|
|
3993
|
-
t.fact(`Orientation: ${n}${n === f.Orientation.Portrait ? " (default)" : ""}`), t.fact(`Paper: ${
|
|
3994
|
-
let r =
|
|
3995
|
-
t.fact(`Margins (inches): ${r}${
|
|
4060
|
+
t.fact(`Orientation: ${n}${n === f.Orientation.Portrait ? " (default)" : ""}`), t.fact(`Paper: ${Ia(e) ?? "letter (default)"}`), t.fact(`Zoom: ${Fa(e) ?? "100% (default)"}`);
|
|
4061
|
+
let r = ja.map(([t, n]) => `${t} ${Pa(n(e))}`).join(" · ");
|
|
4062
|
+
t.fact(`Margins (inches): ${r}${La(e) ? " (default)" : ""}`);
|
|
3996
4063
|
let i = e.getPrintArea();
|
|
3997
|
-
t.fact(`Print area: ${i ? U(i) : "none — the used range prints"}`), t.fact(`Title rows: ${
|
|
4064
|
+
t.fact(`Print area: ${i ? U(i) : "none — the used range prints"}`), t.fact(`Title rows: ${Ra(e.getPrintTitleRows(), !1) ?? "none"}`), t.fact(`Title columns: ${Ra(e.getPrintTitleColumns(), !0) ?? "none"}`);
|
|
3998
4065
|
let a = e.getHorizontalPageBreaks(), o = e.getVerticalPageBreaks();
|
|
3999
|
-
t.fact("Row breaks: " + (a.length > 0 ? `${a.length} · ${
|
|
4066
|
+
t.fact("Row breaks: " + (a.length > 0 ? `${a.length} · ${za(a, !1)}` : "none")), t.fact("Column breaks: " + (o.length > 0 ? `${o.length} · ${za(o, !0)}` : "none"));
|
|
4000
4067
|
let s = [];
|
|
4001
4068
|
e.getCenterHorizontally() && s.push("horizontally"), e.getCenterVertically() && s.push("vertically"), s.length > 0 && t.fact(`Centered: ${s.join(", ")}`);
|
|
4002
|
-
let c =
|
|
4069
|
+
let c = Ma.filter(([, t]) => t(e)).map(([e]) => e);
|
|
4003
4070
|
c.length > 0 && t.fact(`Also prints: ${c.join(", ")}`);
|
|
4004
4071
|
let l = e.getFirstPageNumber();
|
|
4005
4072
|
l !== "" && t.fact(`First page number: ${l}`), e.getPrintOrder() !== f.PrintOrder.DownThenOver && t.fact(`Page order: ${e.getPrintOrder()}`), e.getPrintComments() !== f.PrintComments.NoComments && t.fact(`Notes: ${e.getPrintComments()}`), e.getPrintErrors() !== f.PrintErrorType.AsDisplayed && t.fact(`Errors print as: ${e.getPrintErrors()}`);
|
|
4006
|
-
let u =
|
|
4007
|
-
let n = [], r =
|
|
4073
|
+
let u = Ba(e).flatMap(([e, t]) => {
|
|
4074
|
+
let n = [], r = Va(t.getLeftHeader(), t.getCenterHeader(), t.getRightHeader());
|
|
4008
4075
|
r && n.push(`${e} header: ${r}`);
|
|
4009
|
-
let i =
|
|
4076
|
+
let i = Va(t.getLeftFooter(), t.getCenterFooter(), t.getRightFooter());
|
|
4010
4077
|
return i && n.push(`${e} footer: ${i}`), n;
|
|
4011
4078
|
});
|
|
4012
4079
|
return u.length > 0 && (t.blank(), t.h2("Headers and Footers"), t.fact(u)), t.toLines().join("\n").trimEnd();
|
|
4013
4080
|
}
|
|
4014
|
-
var
|
|
4081
|
+
var Wa = (e) => {
|
|
4015
4082
|
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
4016
4083
|
let t = Object.getPrototypeOf(e);
|
|
4017
4084
|
return t === Object.prototype || t === null;
|
|
4018
4085
|
};
|
|
4019
|
-
function
|
|
4020
|
-
let n = t?.maxCells ?? 1e3, r = Array.isArray(e) ? e : [e], i = new
|
|
4086
|
+
function Ga(e, t) {
|
|
4087
|
+
let n = t?.maxCells ?? 1e3, r = Array.isArray(e) ? e : [e], i = new I();
|
|
4021
4088
|
if (i.h1("Records"), i.text(`Count: ${r.length}`), i.blank(), r.length === 0) return i.text("None"), i.toLines().join("\n").trimEnd();
|
|
4022
4089
|
let a = (e) => {
|
|
4023
4090
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
@@ -4026,34 +4093,34 @@ function Ha(e, t) {
|
|
|
4026
4093
|
}, o = Math.max(1, a(r).length), s = k(r.length, Math.max(1, Math.floor(n / o))), c = r.length > s ? r.slice(0, s) : r, l = c.length === r.length ? a(r) : a(c);
|
|
4027
4094
|
if (l.length === 0) return i.text("No fields"), i.toLines().join("\n").trimEnd();
|
|
4028
4095
|
let u = i.beginFrame(l);
|
|
4029
|
-
for (let e of c) u.addRow(l.map((n) =>
|
|
4096
|
+
for (let e of c) u.addRow(l.map((n) => Ka(e?.[n], t?.nested)));
|
|
4030
4097
|
return u.endFrame(), c.length < r.length && i.text(`…truncated at ${c.length} of ${r.length} records · filter, sort or aggregate the array in the expression`), i.toLines().join("\n").trimEnd();
|
|
4031
4098
|
}
|
|
4032
|
-
var
|
|
4099
|
+
var Ka = (e, t) => {
|
|
4033
4100
|
if (e == null) return { text: "" };
|
|
4034
4101
|
if (typeof e == "function") return { text: "[Function]" };
|
|
4035
|
-
if (typeof e == "bigint" || typeof e == "symbol") return { text:
|
|
4102
|
+
if (typeof e == "bigint" || typeof e == "symbol") return { text: Ya(String(e)) };
|
|
4036
4103
|
if (typeof e == "object") {
|
|
4037
4104
|
if (e instanceof Date) return { text: e.toISOString() };
|
|
4038
4105
|
let n = e;
|
|
4039
|
-
if (!0 === n.isFormulaError || !0 === n.isIRichData) return { text:
|
|
4040
|
-
if (
|
|
4106
|
+
if (!0 === n.isFormulaError || !0 === n.isIRichData) return { text: Ya(Ja(e)) };
|
|
4107
|
+
if (Wa(e) || Array.isArray(e)) {
|
|
4041
4108
|
let t;
|
|
4042
4109
|
try {
|
|
4043
4110
|
t = JSON.stringify(e) ?? String(e);
|
|
4044
4111
|
} catch {
|
|
4045
4112
|
t = "[circular]";
|
|
4046
4113
|
}
|
|
4047
|
-
return { text:
|
|
4114
|
+
return { text: Ya(t) };
|
|
4048
4115
|
}
|
|
4049
|
-
return { text:
|
|
4116
|
+
return { text: Ya(t?.(e) ?? qa(e)) };
|
|
4050
4117
|
}
|
|
4051
|
-
let n =
|
|
4118
|
+
let n = Ya(Ja(e).replace(/[\r\n]+/g, " "));
|
|
4052
4119
|
return typeof e == "number" ? {
|
|
4053
4120
|
text: n,
|
|
4054
4121
|
alignment: "right"
|
|
4055
4122
|
} : { text: n };
|
|
4056
|
-
},
|
|
4123
|
+
}, qa = (e) => {
|
|
4057
4124
|
let t;
|
|
4058
4125
|
try {
|
|
4059
4126
|
t = String(e);
|
|
@@ -4062,40 +4129,40 @@ var Ua = (e, t) => {
|
|
|
4062
4129
|
}
|
|
4063
4130
|
let n = /^\[object (.+)\]$/.exec(t)?.[1];
|
|
4064
4131
|
return n && n !== "Object" ? n : t;
|
|
4065
|
-
},
|
|
4132
|
+
}, Ja = (e) => {
|
|
4066
4133
|
try {
|
|
4067
4134
|
return O(e)?.match ?? String(e);
|
|
4068
4135
|
} catch {
|
|
4069
4136
|
return String(e);
|
|
4070
4137
|
}
|
|
4071
|
-
},
|
|
4072
|
-
function
|
|
4138
|
+
}, Ya = (e) => e.length > 80 ? `${e.slice(0, 79)}…` : e;
|
|
4139
|
+
function Xa(e, t) {
|
|
4073
4140
|
let n = e.length, r = k(n, t?.maxRanges ?? 100), i = Math.min(n, r), a = [];
|
|
4074
4141
|
for (let t = 0; t < i; t++) {
|
|
4075
4142
|
let n = e.at(t);
|
|
4076
4143
|
a.push({
|
|
4077
|
-
...
|
|
4078
|
-
detail: [
|
|
4144
|
+
...xi(n),
|
|
4145
|
+
detail: [Si(n), yi(n)].filter(Boolean).join(" ")
|
|
4079
4146
|
});
|
|
4080
4147
|
}
|
|
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
|
|
4148
|
+
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 I(), u = a.length > 0 && !s && !!c;
|
|
4082
4149
|
if (l.h1(u ? `Ranges — ${V(c)} (${n})` : `Ranges (${n})`), a.length === 0) return l.text("none"), l.toLines().join("\n").trimEnd();
|
|
4083
4150
|
let d = a.map((e) => s && !e.isName ? `${V(e.sheet)}!${e.address}` : e.address), f = Math.max(...d.map((e) => e.length));
|
|
4084
4151
|
for (let e = 0; e < a.length; e++) l.text(` ${d[e].padEnd(f)} ${a[e].detail}`.trimEnd());
|
|
4085
4152
|
return i < n && l.text(` …and ${n - i} more · loop the collection in code to see them all`), l.toLines().join("\n").trimEnd();
|
|
4086
4153
|
}
|
|
4087
|
-
var
|
|
4154
|
+
var Za = (e) => {
|
|
4088
4155
|
let t = "", n = e + 1;
|
|
4089
4156
|
for (; n > 0;) {
|
|
4090
4157
|
let e = (n - 1) % 26;
|
|
4091
4158
|
t = String.fromCharCode(65 + e) + t, n = Math.floor((n - 1) / 26);
|
|
4092
4159
|
}
|
|
4093
4160
|
return t;
|
|
4094
|
-
},
|
|
4095
|
-
function
|
|
4161
|
+
}, Qa = /^\s*=\s*TABLE\s*\(([^()]*)\)\s*$/i;
|
|
4162
|
+
function $a(e) {
|
|
4096
4163
|
let t = [];
|
|
4097
4164
|
for (let r of e.getEntireRange().getRegions(o.Feature.Formula)) {
|
|
4098
|
-
if (!
|
|
4165
|
+
if (!Qa.test(r.getCell().getFormulaText() ?? "")) continue;
|
|
4099
4166
|
let i = r.getCoords();
|
|
4100
4167
|
for (let r = i.rowStart; r <= i.rowEnd; r++) for (let a = i.colStart; a <= i.colEnd; a++) {
|
|
4101
4168
|
let i = e.getRange({
|
|
@@ -4103,7 +4170,7 @@ function Xa(e) {
|
|
|
4103
4170
|
colStart: a,
|
|
4104
4171
|
rowEnd: r,
|
|
4105
4172
|
colEnd: a
|
|
4106
|
-
}).getCell(), o = i.getFormulaText() ?? "", s =
|
|
4173
|
+
}).getCell(), o = i.getFormulaText() ?? "", s = Qa.exec(o);
|
|
4107
4174
|
if (!s) continue;
|
|
4108
4175
|
let c = s[1].split(",").map((e) => e.trim()), l = parseInt(c[2] ?? "", 10), u = parseInt(c[3] ?? "", 10), d = n.isError(i.getValue(), n.Code.Spill), f = (d ? null : i.getSpill()) ?? (l > 0 && u > 0 ? e.getRange({
|
|
4109
4176
|
rowStart: r,
|
|
@@ -4127,45 +4194,46 @@ function Xa(e) {
|
|
|
4127
4194
|
}
|
|
4128
4195
|
return t;
|
|
4129
4196
|
}
|
|
4130
|
-
var
|
|
4197
|
+
var eo = (e) => {
|
|
4131
4198
|
let t = (e) => e.toUpperCase() === "#REF!" ? "#REF! (deleted)" : e, n = [];
|
|
4132
4199
|
return e.rowInput && n.push(`row input ${t(e.rowInput)}`), e.columnInput && n.push(`column input ${t(e.columnInput)}`), n.push(`formula ${((e) => {
|
|
4133
|
-
let t = e.extent.getCoords(), n =
|
|
4134
|
-
return e.rowInput && e.columnInput ? `${n}${r}` : e.columnInput ? `${
|
|
4200
|
+
let t = e.extent.getCoords(), n = Za(t.colStart - 1), r = t.rowStart;
|
|
4201
|
+
return e.rowInput && e.columnInput ? `${n}${r}` : e.columnInput ? `${Za(t.colStart)}${r}:${Za(t.colEnd)}${r}` : `${n}${t.rowStart + 1}:${n}${t.rowEnd + 1}`;
|
|
4135
4202
|
})(e)}`), e.blocked && n.push("blocked (#SPILL!)"), `${e.formula} ${n.join(", ")}`;
|
|
4136
|
-
},
|
|
4203
|
+
}, to = (e) => e.isDeleted() ? "" : e.getRange().toString(), no = (e) => {
|
|
4137
4204
|
if (e.getFields().length === 0) return "";
|
|
4138
4205
|
let t = (e) => e.map((e) => e.getName()), n = [], r = (e, t, r) => {
|
|
4139
4206
|
t.length > 0 && n.push(`${e}: ${t.join(r)}`);
|
|
4140
4207
|
};
|
|
4141
4208
|
return r("rows", t(e.getRowFields()), " > "), r("columns", t(e.getColumnFields()), " > "), r("filters", t(e.getPageFields()), ", "), r("values", t(e.getDataFields()), ", "), n.join(" · ");
|
|
4142
4209
|
};
|
|
4143
|
-
async function
|
|
4144
|
-
let n = new
|
|
4210
|
+
async function ro(e, t) {
|
|
4211
|
+
let n = new I(), r = e.getSelectedRange(), i = e.getUsedRange();
|
|
4145
4212
|
n.h1(`Sheet — ${V(e.getName())}${function(e) {
|
|
4146
4213
|
let t = e.getWorkbook(), n = "";
|
|
4147
4214
|
t && t.getSelectedWorksheet()?.getId() === e.getId() && (n += " (selected)");
|
|
4148
4215
|
let r = e.getVisibility();
|
|
4149
4216
|
return r === h.Visibility.Hidden ? n += " (hidden)" : r === h.Visibility.VeryHidden && (n += " (very hidden)"), e.getProtection().isLocked() && (n += " (protected)"), n;
|
|
4150
|
-
}(e)}`), n.text(`Used: ${i ?
|
|
4151
|
-
let a =
|
|
4217
|
+
}(e)}`), n.text(`Used: ${i ? Yt(i) : "empty"}`), n.text(`Selection: ${Yt(r)}`);
|
|
4218
|
+
let a = yn(e);
|
|
4152
4219
|
a && n.text(`Outline: ${a}`);
|
|
4153
|
-
let o =
|
|
4220
|
+
let o = Ha(e);
|
|
4154
4221
|
o && n.text(`Print: ${o}`), n.blank();
|
|
4155
4222
|
let s = i ?? r;
|
|
4156
|
-
|
|
4223
|
+
Zt(n, s), $t(n, s), en(n, s, {
|
|
4157
4224
|
profile: !0,
|
|
4225
|
+
layerScope: e.getEntireRange(),
|
|
4158
4226
|
...t
|
|
4159
4227
|
});
|
|
4160
4228
|
let c = t?.features === void 0 ? null : typeof t.features == "string" ? [t.features] : [...t.features];
|
|
4161
|
-
return c && !c.some((e) => e === "unlock" || e === "protection") ||
|
|
4229
|
+
return c && !c.some((e) => e === "unlock" || e === "protection") || Ui(n, e), await Sn(n, s), function(e, t) {
|
|
4162
4230
|
if (t.length === 0) return;
|
|
4163
4231
|
let n = t.map((e) => ({
|
|
4164
|
-
address:
|
|
4232
|
+
address: to(e),
|
|
4165
4233
|
name: e.getName(),
|
|
4166
4234
|
source: e.isDeleted() ? null : e.getSource(),
|
|
4167
4235
|
stale: e.isStale(),
|
|
4168
|
-
fields:
|
|
4236
|
+
fields: no(e)
|
|
4169
4237
|
})), r = Math.max(...n.map((e) => e.address.length));
|
|
4170
4238
|
e.h2(`Pivot Tables (${t.length})`);
|
|
4171
4239
|
for (let t of n) {
|
|
@@ -4177,14 +4245,14 @@ async function eo(e, t) {
|
|
|
4177
4245
|
if (t.length === 0) return;
|
|
4178
4246
|
let n = t.map((e) => ({
|
|
4179
4247
|
address: e.extent.getAddress(),
|
|
4180
|
-
detail:
|
|
4248
|
+
detail: eo(e)
|
|
4181
4249
|
})), r = Math.max(...n.map((e) => e.address.length));
|
|
4182
4250
|
e.h2(`Data Tables (${t.length})`);
|
|
4183
4251
|
for (let t of n) e.text(` ${t.address.padEnd(r)} ${t.detail}`);
|
|
4184
4252
|
e.text(" What-if results: the formula cells evaluated with each axis value put into the inputs."), e.blank();
|
|
4185
|
-
}(n,
|
|
4253
|
+
}(n, $a(e)), mr(n, e.getMovables().getItems()), n.toLines().join("\n").trimEnd();
|
|
4186
4254
|
}
|
|
4187
|
-
var
|
|
4255
|
+
var io = 1e4, ao = [
|
|
4188
4256
|
["numericalCount", "Numbers"],
|
|
4189
4257
|
["sum", "Sum"],
|
|
4190
4258
|
["min", "Min"],
|
|
@@ -4192,17 +4260,17 @@ var to = 1e4, no = [
|
|
|
4192
4260
|
["average", "Average"],
|
|
4193
4261
|
["stdDev", "StdDev"]
|
|
4194
4262
|
];
|
|
4195
|
-
function
|
|
4196
|
-
let n = new
|
|
4263
|
+
function oo(t) {
|
|
4264
|
+
let n = new I(), r = t.getCoords(), i = r ? e.rangeToString(r) : null;
|
|
4197
4265
|
n.h1(i ? `Stats — ${i}` : "Stats");
|
|
4198
4266
|
let a = t.getTypedCounts();
|
|
4199
4267
|
n.fact(`Cells: ${t.getSize()}`), n.fact(`Values: ${t.getCount()}`);
|
|
4200
4268
|
let o = a[b.Error] ?? 0;
|
|
4201
4269
|
o > 0 && n.fact(`Errors: ${o}`);
|
|
4202
4270
|
let s = function(e) {
|
|
4203
|
-
let t = e.getFrequencies({ limit:
|
|
4271
|
+
let t = e.getFrequencies({ limit: io }), n = t.getUniqueCount();
|
|
4204
4272
|
if (n === 0) return null;
|
|
4205
|
-
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${
|
|
4273
|
+
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${io.toLocaleString("en-US")})`;
|
|
4206
4274
|
if (n === t.getTotalCount()) return `${n.toLocaleString("en-US")}, no repeats`;
|
|
4207
4275
|
let r = [];
|
|
4208
4276
|
for (let [e, n] of t.getValueCounts()) {
|
|
@@ -4211,7 +4279,7 @@ function ro(t) {
|
|
|
4211
4279
|
label: O(e)?.display ?? "",
|
|
4212
4280
|
content: n,
|
|
4213
4281
|
styled: n,
|
|
4214
|
-
blocks: i &&
|
|
4282
|
+
blocks: i && so(i) === n ? [i] : []
|
|
4215
4283
|
});
|
|
4216
4284
|
}
|
|
4217
4285
|
let i = {
|
|
@@ -4219,13 +4287,13 @@ function ro(t) {
|
|
|
4219
4287
|
maxValues: 8,
|
|
4220
4288
|
recovery: "getStats().getFrequencies()"
|
|
4221
4289
|
};
|
|
4222
|
-
if (n <= 8) return `${n} · ${
|
|
4290
|
+
if (n <= 8) return `${n} · ${nt(r, i)}`;
|
|
4223
4291
|
let a = r.filter((e) => e.content > 1);
|
|
4224
|
-
return `${n.toLocaleString("en-US")} · repeats ${
|
|
4292
|
+
return `${n.toLocaleString("en-US")} · repeats ${nt(a, i)}`;
|
|
4225
4293
|
}(t);
|
|
4226
4294
|
s && n.fact(`Distinct: ${s}`);
|
|
4227
4295
|
let c = t.getAggregates({ onError: "ignore" });
|
|
4228
|
-
for (let [e, t] of
|
|
4296
|
+
for (let [e, t] of ao) {
|
|
4229
4297
|
let r = c[e];
|
|
4230
4298
|
r != null && n.fact(`${t}: ${T(r)}`);
|
|
4231
4299
|
}
|
|
@@ -4233,49 +4301,49 @@ function ro(t) {
|
|
|
4233
4301
|
for (let [e, t] of Object.entries(a)) e !== b.Null && t && l.push(`${e.charAt(0).toUpperCase()}${e.slice(1)}: ${t}`);
|
|
4234
4302
|
return l.length > 0 && (n.blank(), n.h2("Type"), n.fact(l)), n.toLines().join("\n").trimEnd();
|
|
4235
4303
|
}
|
|
4236
|
-
var
|
|
4237
|
-
function
|
|
4238
|
-
let t = new
|
|
4304
|
+
var so = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
|
|
4305
|
+
function co(e) {
|
|
4306
|
+
let t = new I();
|
|
4239
4307
|
t.h1("Style"), t.text(`Named: ${e.getNamed().getName()}`), t.blank();
|
|
4240
4308
|
let n = e.toJSON(), r = n ? Object.entries(n).filter(([, e]) => e !== void 0) : [];
|
|
4241
4309
|
if (r.length === 0) t.fact("No direct styling (inherits the named style)");
|
|
4242
4310
|
else for (let [e, n] of r) t.fact(`${e}: ${t.codespan(typeof n == "string" ? n : JSON.stringify(n))}`);
|
|
4243
4311
|
return t.toLines().join("\n").trimEnd();
|
|
4244
4312
|
}
|
|
4245
|
-
function
|
|
4246
|
-
let n = t?.maxCells ?? 1e3, r =
|
|
4313
|
+
function lo(e, t) {
|
|
4314
|
+
let n = t?.maxCells ?? 1e3, r = uo(e) ? e.getValues() : e, i = r.length, a = r.reduce((e, t) => Math.max(e, t?.length ?? 0), 0), o = new I();
|
|
4247
4315
|
if (o.h1("Values"), o.text(`Size: ${i}×${a}`), o.blank(), i === 0 || a === 0) return o.text("None"), o.toLines().join("\n").trimEnd();
|
|
4248
4316
|
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(""));
|
|
4249
|
-
for (let e of c) l.addRow(Array.from({ length: a }, (t, n) =>
|
|
4317
|
+
for (let e of c) l.addRow(Array.from({ length: a }, (t, n) => fo(e?.[n])));
|
|
4250
4318
|
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();
|
|
4251
4319
|
}
|
|
4252
|
-
var
|
|
4320
|
+
var uo = (e) => !!e && typeof e == "object" && !0 === e.isIRange, fo = (e) => {
|
|
4253
4321
|
if (e == null) return { text: "" };
|
|
4254
4322
|
let t = (O(e)?.display ?? "").replace(/[\r\n]+/g, " ");
|
|
4255
4323
|
return typeof e == "number" ? {
|
|
4256
4324
|
text: t,
|
|
4257
4325
|
alignment: "right"
|
|
4258
4326
|
} : { text: t };
|
|
4259
|
-
}, Y = o.Feature,
|
|
4327
|
+
}, Y = o.Feature, po = [
|
|
4260
4328
|
[Y.Font, "fonts"],
|
|
4261
4329
|
[Y.NumberFormat, "formats"],
|
|
4262
4330
|
[Y.Fill, "fills"],
|
|
4263
4331
|
[Y.Borders, "borders"],
|
|
4264
4332
|
[Y.Alignment, "alignments"]
|
|
4265
4333
|
];
|
|
4266
|
-
async function
|
|
4267
|
-
let n = new
|
|
4334
|
+
async function mo(e, t) {
|
|
4335
|
+
let n = new I();
|
|
4268
4336
|
n.h1(`Workbook — ${e.getName() ?? "Untitled"}`), n.text(`Locale: ${e.getRuntime().getLocale()}`);
|
|
4269
4337
|
let r = e.getCalculation();
|
|
4270
4338
|
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");
|
|
4271
|
-
let a =
|
|
4339
|
+
let a = Li(e.getProtection());
|
|
4272
4340
|
a && n.text(`Protection: ${a}`), n.blank();
|
|
4273
4341
|
let o = e.getWorksheets().getItems({ visibility: h.Visibility.VeryHidden }), s = e.getSelectedSheet(), c = e.getStyles().getNormal(), l = [];
|
|
4274
4342
|
for (let e of o) {
|
|
4275
|
-
let t =
|
|
4343
|
+
let t = ho(e, c);
|
|
4276
4344
|
l.push({
|
|
4277
4345
|
sheet: e,
|
|
4278
|
-
label:
|
|
4346
|
+
label: xo(e, e.getId() === s.getId()),
|
|
4279
4347
|
counts: t.counts,
|
|
4280
4348
|
lines: t.lines,
|
|
4281
4349
|
formulaSignature: t.formulaSignature
|
|
@@ -4315,15 +4383,15 @@ async function uo(e, t) {
|
|
|
4315
4383
|
let g = e.getSheets({ visibility: h.Visibility.VeryHidden }).filter((e) => e.getKind() !== h.Kind.Worksheet);
|
|
4316
4384
|
if (g.length > 0) {
|
|
4317
4385
|
n.h2(`Other sheets (${g.length})`), n.blank();
|
|
4318
|
-
for (let e of g) n.text(` ${
|
|
4386
|
+
for (let e of g) n.text(` ${So(e, e.getId() === s.getId())}`);
|
|
4319
4387
|
n.text(" Carried as read and saved unchanged; they have no cells · wb.getSheets() lists every tab"), n.blank();
|
|
4320
4388
|
}
|
|
4321
|
-
return
|
|
4322
|
-
describe: (e) =>
|
|
4389
|
+
return wo(n, "Errors", l, Y.Error), wo(n, "Calc Failures", l, Y.CalcError), wo(n, "Circular References", l, Y.Circular), wo(n, "Anomalies", l, Y.Anomalies, {
|
|
4390
|
+
describe: (e) => Lt(Y.Anomalies, null)(e) ?? "",
|
|
4323
4391
|
rank: (e) => -(e.getCell().getAnomalies()[0]?.rank ?? 0),
|
|
4324
|
-
include: (e) => !
|
|
4325
|
-
key:
|
|
4326
|
-
}), await
|
|
4392
|
+
include: (e) => !pe(e.getCell().getAnomalies()),
|
|
4393
|
+
key: Ht
|
|
4394
|
+
}), await _n(n, e.getNames().getItems({
|
|
4327
4395
|
type: "formula",
|
|
4328
4396
|
includeHidden: !0
|
|
4329
4397
|
}) ?? [], {
|
|
@@ -4331,16 +4399,16 @@ async function uo(e, t) {
|
|
|
4331
4399
|
recovery: "wb.getNames() renders the full view",
|
|
4332
4400
|
omitUnread: !0,
|
|
4333
4401
|
symbols: e.getNames().getItems({ includeHidden: !0 }) ?? []
|
|
4334
|
-
}),
|
|
4402
|
+
}), wa(n, Ca(e), t), n.toLines().join("\n").trimEnd();
|
|
4335
4403
|
}
|
|
4336
|
-
function
|
|
4404
|
+
function ho(e, t) {
|
|
4337
4405
|
let n = e.getUsedRange();
|
|
4338
4406
|
if (!n) return {
|
|
4339
4407
|
counts: null,
|
|
4340
4408
|
lines: [
|
|
4341
|
-
...
|
|
4342
|
-
...
|
|
4343
|
-
...
|
|
4409
|
+
..._o(e),
|
|
4410
|
+
...go(e),
|
|
4411
|
+
...vo(e)
|
|
4344
4412
|
],
|
|
4345
4413
|
formulaRegions: 0,
|
|
4346
4414
|
formulaSignature: ""
|
|
@@ -4353,15 +4421,15 @@ function fo(e, t) {
|
|
|
4353
4421
|
Y.Circular,
|
|
4354
4422
|
Y.Table,
|
|
4355
4423
|
Y.Anomalies
|
|
4356
|
-
]), i = [], o =
|
|
4424
|
+
]), i = [], o = an(n), s = [...n.getRegions(Y.Formula)];
|
|
4357
4425
|
if (o.length > 0) {
|
|
4358
4426
|
let e = function(e, t) {
|
|
4359
|
-
let n =
|
|
4360
|
-
return n.length === 0 ? null : n.map(([e, t]) => `${e} ×${
|
|
4427
|
+
let n = _t(e, t);
|
|
4428
|
+
return n.length === 0 ? null : n.map(([e, t]) => `${e} ×${$e(t)}`).join(" · ");
|
|
4361
4429
|
}(n, s);
|
|
4362
4430
|
i.push({
|
|
4363
4431
|
label: "content",
|
|
4364
|
-
extent:
|
|
4432
|
+
extent: bo(o),
|
|
4365
4433
|
detail: [
|
|
4366
4434
|
X(r[Y.Contentful] ?? 0, "cell"),
|
|
4367
4435
|
X(o.length, "block"),
|
|
@@ -4379,7 +4447,7 @@ function fo(e, t) {
|
|
|
4379
4447
|
}
|
|
4380
4448
|
c = t.sort().join("\n"), i.push({
|
|
4381
4449
|
label: "formula",
|
|
4382
|
-
extent:
|
|
4450
|
+
extent: bo(s),
|
|
4383
4451
|
detail: [
|
|
4384
4452
|
X(r[Y.Formula] ?? 0, "cell"),
|
|
4385
4453
|
X(s.length, "region"),
|
|
@@ -4397,11 +4465,11 @@ function fo(e, t) {
|
|
|
4397
4465
|
let o = [...n.getRegions(e)];
|
|
4398
4466
|
i.push({
|
|
4399
4467
|
label: t,
|
|
4400
|
-
extent:
|
|
4468
|
+
extent: bo(o),
|
|
4401
4469
|
detail: [X(a, "cell"), X(o.length, "region")].join(" · ")
|
|
4402
4470
|
});
|
|
4403
4471
|
}
|
|
4404
|
-
let l = (r[Y.Anomalies] ?? 0) > 0 ? [...n.getRegions(Y.Anomalies)].filter((e) => !
|
|
4472
|
+
let l = (r[Y.Anomalies] ?? 0) > 0 ? [...n.getRegions(Y.Anomalies)].filter((e) => !pe(e.getCell().getAnomalies())) : [];
|
|
4405
4473
|
if (l.length > 0) {
|
|
4406
4474
|
let e = new Map([...se.keys()].map((e) => [e, 0])), t = 0;
|
|
4407
4475
|
for (let n of l) {
|
|
@@ -4411,7 +4479,7 @@ function fo(e, t) {
|
|
|
4411
4479
|
}
|
|
4412
4480
|
i.push({
|
|
4413
4481
|
label: "anomalies",
|
|
4414
|
-
extent:
|
|
4482
|
+
extent: bo(l),
|
|
4415
4483
|
detail: [
|
|
4416
4484
|
X(t, "cell"),
|
|
4417
4485
|
X(l.length, "region"),
|
|
@@ -4422,63 +4490,63 @@ function fo(e, t) {
|
|
|
4422
4490
|
let u = n.getTables();
|
|
4423
4491
|
u.length > 0 && i.push({
|
|
4424
4492
|
label: "tables",
|
|
4425
|
-
extent:
|
|
4493
|
+
extent: bo(u.map((e) => e.getRange())),
|
|
4426
4494
|
detail: [
|
|
4427
4495
|
X(r[Y.Table] ?? 0, "cell"),
|
|
4428
4496
|
X(u.length, "table"),
|
|
4429
|
-
|
|
4497
|
+
yo(u.map((e) => e.getName()))
|
|
4430
4498
|
].join(" · ")
|
|
4431
4499
|
});
|
|
4432
4500
|
let d = e.getPivotTables().getItems();
|
|
4433
4501
|
d.length > 0 && i.push({
|
|
4434
4502
|
label: "pivots",
|
|
4435
4503
|
extent: String(d.length),
|
|
4436
|
-
detail:
|
|
4504
|
+
detail: yo(d.map((e) => e.getName()))
|
|
4437
4505
|
});
|
|
4438
|
-
let f =
|
|
4506
|
+
let f = $a(e);
|
|
4439
4507
|
f.length > 0 && i.push({
|
|
4440
4508
|
label: "data tables",
|
|
4441
|
-
extent:
|
|
4442
|
-
detail:
|
|
4443
|
-
}), i.push(...
|
|
4509
|
+
extent: bo(f.map((e) => e.extent)),
|
|
4510
|
+
detail: yo(f.map((e) => e.extent.getAddress()))
|
|
4511
|
+
}), i.push(..._o(e));
|
|
4444
4512
|
let p = o.map((e) => e.getCoords()), m = [];
|
|
4445
|
-
for (let [n, r] of
|
|
4446
|
-
let i =
|
|
4513
|
+
for (let [n, r] of po) {
|
|
4514
|
+
let i = ht(e, n, t, { content: p })?.distinct ?? 0;
|
|
4447
4515
|
i > 0 && m.push(`${r} ${i}`);
|
|
4448
4516
|
}
|
|
4449
4517
|
return m.length > 0 && i.push({
|
|
4450
4518
|
label: "style",
|
|
4451
4519
|
extent: n.toString(),
|
|
4452
4520
|
detail: m.join(" · ")
|
|
4453
|
-
}), i.push(...
|
|
4521
|
+
}), i.push(...go(e)), i.push(...vo(e)), {
|
|
4454
4522
|
counts: r,
|
|
4455
4523
|
lines: i,
|
|
4456
4524
|
formulaRegions: s.length,
|
|
4457
4525
|
formulaSignature: c
|
|
4458
4526
|
};
|
|
4459
4527
|
}
|
|
4460
|
-
function
|
|
4461
|
-
let t =
|
|
4528
|
+
function go(e) {
|
|
4529
|
+
let t = yn(e);
|
|
4462
4530
|
return t ? [{
|
|
4463
4531
|
label: "outline",
|
|
4464
4532
|
extent: "",
|
|
4465
4533
|
detail: t
|
|
4466
4534
|
}] : [];
|
|
4467
4535
|
}
|
|
4468
|
-
function
|
|
4536
|
+
function _o(e) {
|
|
4469
4537
|
let t = [];
|
|
4470
|
-
for (let [n, r] of
|
|
4471
|
-
let i =
|
|
4538
|
+
for (let [n, r] of pr(e.getMovables().getItems())) {
|
|
4539
|
+
let i = sr(r), a = n === "chart" ? yo(r.map(lr)) : i.length > 0 ? `${i.length} with text` : "";
|
|
4472
4540
|
t.push({
|
|
4473
|
-
label:
|
|
4541
|
+
label: fr(n).toLowerCase(),
|
|
4474
4542
|
extent: String(r.length),
|
|
4475
4543
|
detail: a
|
|
4476
4544
|
});
|
|
4477
4545
|
let o = i.slice(0, k(i.length, 5));
|
|
4478
4546
|
for (let e of o) t.push({
|
|
4479
4547
|
label: "",
|
|
4480
|
-
extent:
|
|
4481
|
-
detail:
|
|
4548
|
+
extent: ir(e.movable),
|
|
4549
|
+
detail: ar(e) + (e.movable.isHidden() ? " (hidden)" : "")
|
|
4482
4550
|
});
|
|
4483
4551
|
o.length < i.length && t.push({
|
|
4484
4552
|
label: "",
|
|
@@ -4488,15 +4556,15 @@ function mo(e) {
|
|
|
4488
4556
|
}
|
|
4489
4557
|
return t;
|
|
4490
4558
|
}
|
|
4491
|
-
function
|
|
4492
|
-
let t =
|
|
4559
|
+
function vo(e) {
|
|
4560
|
+
let t = Hi(e);
|
|
4493
4561
|
return t ? [{
|
|
4494
4562
|
label: "protected",
|
|
4495
4563
|
extent: t.extent,
|
|
4496
4564
|
detail: t.detail
|
|
4497
4565
|
}] : [];
|
|
4498
4566
|
}
|
|
4499
|
-
function
|
|
4567
|
+
function yo(e) {
|
|
4500
4568
|
let t = [], n = 0;
|
|
4501
4569
|
for (let r of e) {
|
|
4502
4570
|
let e = (t.length > 0 ? 2 : 0) + r.length;
|
|
@@ -4506,7 +4574,7 @@ function go(e) {
|
|
|
4506
4574
|
let r = e.length - t.length;
|
|
4507
4575
|
return r > 0 ? `${t.join(", ")}, +${r} more` : t.join(", ");
|
|
4508
4576
|
}
|
|
4509
|
-
function
|
|
4577
|
+
function bo(t) {
|
|
4510
4578
|
let n = null;
|
|
4511
4579
|
for (let e of t) {
|
|
4512
4580
|
let t = e.getCoords();
|
|
@@ -4520,22 +4588,22 @@ function _o(t) {
|
|
|
4520
4588
|
return n ? e.rangeToString(n) ?? "" : "";
|
|
4521
4589
|
}
|
|
4522
4590
|
var X = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`;
|
|
4523
|
-
function
|
|
4591
|
+
function xo(e, t) {
|
|
4524
4592
|
let n = e.getVisibility(), r = "";
|
|
4525
4593
|
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}`;
|
|
4526
4594
|
}
|
|
4527
|
-
function
|
|
4595
|
+
function So(e, t) {
|
|
4528
4596
|
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})`;
|
|
4529
4597
|
return t && (a += " (selected)"), i === h.Visibility.Hidden ? a += " (hidden)" : i === h.Visibility.VeryHidden && (a += " (very hidden)"), `${V(e.getName())}${a}`;
|
|
4530
4598
|
}
|
|
4531
|
-
var
|
|
4532
|
-
function
|
|
4599
|
+
var Co = 6;
|
|
4600
|
+
function wo(t, n, r, i, a) {
|
|
4533
4601
|
let o = a?.include, s = r.reduce((e, t) => e + (t.counts?.[i] ?? 0), 0), c = i === Y.Error ? r.flatMap((e) => function(e) {
|
|
4534
4602
|
let t = [];
|
|
4535
4603
|
for (let n of e.getMovables().getItems({ type: "chart" })) {
|
|
4536
|
-
let e =
|
|
4604
|
+
let e = wn(n);
|
|
4537
4605
|
if (e) for (let r of e.getSeries()) {
|
|
4538
|
-
let e =
|
|
4606
|
+
let e = kn(r);
|
|
4539
4607
|
if (e.length === 0) continue;
|
|
4540
4608
|
let i = r.getName();
|
|
4541
4609
|
t.push({
|
|
@@ -4548,7 +4616,7 @@ function xo(t, n, r, i, a) {
|
|
|
4548
4616
|
}(e.sheet)) : [];
|
|
4549
4617
|
if (s === 0 && c.length === 0) return;
|
|
4550
4618
|
o && (s = 0);
|
|
4551
|
-
let l = [], u = 0, d = a?.describe ??
|
|
4619
|
+
let l = [], u = 0, d = a?.describe ?? To, f = a?.rank, p = [];
|
|
4552
4620
|
for (let e of r) {
|
|
4553
4621
|
if (!e.counts?.[i]) continue;
|
|
4554
4622
|
let t = e.sheet.getUsedRange();
|
|
@@ -4581,7 +4649,7 @@ function xo(t, n, r, i, a) {
|
|
|
4581
4649
|
for (let t of e.slice(0, 20)) {
|
|
4582
4650
|
let { region: e, sheetName: n } = t[0], r = t.slice(1);
|
|
4583
4651
|
m += r.length;
|
|
4584
|
-
let i = r.length === 0 ? "" : ` · also at ${r.slice(0,
|
|
4652
|
+
let i = r.length === 0 ? "" : ` · also at ${r.slice(0, Co).map((e) => `${e.sheetName}!${e.region.toString()}`).join(", ")}${r.length > Co ? ` +${r.length - Co} more` : ""}`;
|
|
4585
4653
|
l.push({
|
|
4586
4654
|
address: `${n}!${e.toString()}`,
|
|
4587
4655
|
size: `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
@@ -4606,22 +4674,22 @@ function xo(t, n, r, i, a) {
|
|
|
4606
4674
|
let y = l.length - h.length + m;
|
|
4607
4675
|
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();
|
|
4608
4676
|
}
|
|
4609
|
-
function
|
|
4677
|
+
function To(e) {
|
|
4610
4678
|
let t = e.getCell(), n = D(t, w.Mode.Display)?.display ?? "", r = t.getFormulaText();
|
|
4611
4679
|
if (!r) return n;
|
|
4612
|
-
let i =
|
|
4680
|
+
let i = Ai(ki(t.getFormula()?.getTokens() ?? [], t.getWorksheet().getWorkbook()));
|
|
4613
4681
|
return [`${n} ${r}`.trim(), i].filter(Boolean).join(" · ");
|
|
4614
4682
|
}
|
|
4615
|
-
var Z = (e, t) => !!e && typeof e == "object" && !0 === e[t],
|
|
4683
|
+
var Z = (e, t) => !!e && typeof e == "object" && !0 === e[t], Eo = {
|
|
4616
4684
|
kind: "protectedRanges",
|
|
4617
4685
|
is: (e) => Z(e, "isIProtectedRangeCollection"),
|
|
4618
4686
|
render: (e) => {
|
|
4619
4687
|
let t = e.getItems();
|
|
4620
|
-
return t.length === 0 ? "# Unlocked Ranges (0)\nNone" : t.slice(0,
|
|
4688
|
+
return t.length === 0 ? "# Unlocked Ranges (0)\nNone" : t.slice(0, ko).map(Ji).concat(t.length > ko ? [`…and ${t.length - ko} more · render one at a time to see them`] : []).join("\n\n");
|
|
4621
4689
|
}
|
|
4622
|
-
},
|
|
4623
|
-
function
|
|
4624
|
-
let t =
|
|
4690
|
+
}, Do = 2;
|
|
4691
|
+
function Oo(e) {
|
|
4692
|
+
let t = No(e);
|
|
4625
4693
|
if (!t) return null;
|
|
4626
4694
|
let n;
|
|
4627
4695
|
try {
|
|
@@ -4633,174 +4701,174 @@ function To(e) {
|
|
|
4633
4701
|
let r = n.split("\n").map((e) => e.trim()).filter(Boolean);
|
|
4634
4702
|
if (r.length === 0) return null;
|
|
4635
4703
|
let i = r[0].replace(/^#+\s*/, ""), a = r.slice(1);
|
|
4636
|
-
return a.length <=
|
|
4704
|
+
return a.length <= Do ? [i, ...a].join(" · ") : `${i} · ${a.length} more lines — return it on its own`;
|
|
4637
4705
|
}
|
|
4638
|
-
var
|
|
4706
|
+
var ko = 20, Ao = [
|
|
4639
4707
|
{
|
|
4640
4708
|
kind: "workbook",
|
|
4641
4709
|
is: (e) => Z(e, "isIWorkbook"),
|
|
4642
|
-
render: (e, t) =>
|
|
4710
|
+
render: (e, t) => mo(e, t)
|
|
4643
4711
|
},
|
|
4644
4712
|
{
|
|
4645
4713
|
kind: "sheet",
|
|
4646
4714
|
is: (e) => Z(e, "isIWorksheet"),
|
|
4647
|
-
render: (e, t) =>
|
|
4715
|
+
render: (e, t) => ro(e, t)
|
|
4648
4716
|
},
|
|
4649
4717
|
{
|
|
4650
4718
|
kind: "cell",
|
|
4651
4719
|
is: (e) => Z(e, "isICell"),
|
|
4652
|
-
render: (e, t) =>
|
|
4720
|
+
render: (e, t) => Xi(e, t)
|
|
4653
4721
|
},
|
|
4654
4722
|
{
|
|
4655
4723
|
kind: "names",
|
|
4656
4724
|
is: (e) => Z(e, "isINamedCollection"),
|
|
4657
|
-
render: (e, t) =>
|
|
4725
|
+
render: (e, t) => ka(e, t)
|
|
4658
4726
|
},
|
|
4659
4727
|
{
|
|
4660
4728
|
kind: "modules",
|
|
4661
4729
|
is: (e) => Z(e, "isIModuleCollection"),
|
|
4662
|
-
render: (e, t) =>
|
|
4730
|
+
render: (e, t) => Da(e, t)
|
|
4663
4731
|
},
|
|
4664
4732
|
{
|
|
4665
4733
|
kind: "module",
|
|
4666
4734
|
is: (e) => Z(e, "isIModule"),
|
|
4667
|
-
render: (e, t) =>
|
|
4735
|
+
render: (e, t) => Ea(e, t)
|
|
4668
4736
|
},
|
|
4669
4737
|
{
|
|
4670
4738
|
kind: "formula",
|
|
4671
4739
|
is: (e) => Z(e, "isIFormula"),
|
|
4672
|
-
render: (e, t) =>
|
|
4740
|
+
render: (e, t) => _a(e, t)
|
|
4673
4741
|
},
|
|
4674
4742
|
{
|
|
4675
4743
|
kind: "table",
|
|
4676
4744
|
is: (e) => Z(e, "isITable"),
|
|
4677
|
-
render: (e) =>
|
|
4745
|
+
render: (e) => je(e)
|
|
4678
4746
|
},
|
|
4679
4747
|
{
|
|
4680
4748
|
kind: "movable",
|
|
4681
4749
|
is: (e) => Z(e, "isIMovable"),
|
|
4682
|
-
render: (e) =>
|
|
4750
|
+
render: (e) => gr(e)
|
|
4683
4751
|
},
|
|
4684
4752
|
{
|
|
4685
4753
|
kind: "shape",
|
|
4686
4754
|
is: (e) => Z(e, "isIShape"),
|
|
4687
|
-
render: (e) =>
|
|
4755
|
+
render: (e) => _r(e)
|
|
4688
4756
|
},
|
|
4689
4757
|
{
|
|
4690
4758
|
kind: "conditionalFormat",
|
|
4691
4759
|
is: (e) => Z(e, "isIConditionalFormat"),
|
|
4692
|
-
render: (e) =>
|
|
4760
|
+
render: (e) => aa(e)
|
|
4693
4761
|
},
|
|
4694
4762
|
{
|
|
4695
4763
|
kind: "dataValidation",
|
|
4696
4764
|
is: (e) => Z(e, "isIDataValidation"),
|
|
4697
|
-
render: (e) =>
|
|
4765
|
+
render: (e) => sa(e)
|
|
4698
4766
|
},
|
|
4699
4767
|
{
|
|
4700
4768
|
kind: "protection",
|
|
4701
4769
|
is: (e) => Z(e, "isIWorksheetProtection") || Z(e, "isIWorkbookProtection"),
|
|
4702
|
-
render: (e) =>
|
|
4770
|
+
render: (e) => qi(e)
|
|
4703
4771
|
},
|
|
4704
|
-
|
|
4772
|
+
Eo,
|
|
4705
4773
|
{
|
|
4706
4774
|
kind: "protectedRange",
|
|
4707
4775
|
is: (e) => Z(e, "isIProtectedRange"),
|
|
4708
|
-
render: (e) =>
|
|
4776
|
+
render: (e) => Ji(e)
|
|
4709
4777
|
},
|
|
4710
4778
|
{
|
|
4711
4779
|
kind: "pageLayout",
|
|
4712
4780
|
is: (e) => Z(e, "isIPageLayout"),
|
|
4713
|
-
render: (e) =>
|
|
4781
|
+
render: (e) => Ua(e)
|
|
4714
4782
|
},
|
|
4715
4783
|
{
|
|
4716
4784
|
kind: "stats",
|
|
4717
4785
|
is: (e) => Z(e, "isIRangeStats"),
|
|
4718
|
-
render: (e) =>
|
|
4786
|
+
render: (e) => oo(e)
|
|
4719
4787
|
},
|
|
4720
4788
|
{
|
|
4721
4789
|
kind: "counts",
|
|
4722
4790
|
is: (e) => Z(e, "isICellRangeCounts"),
|
|
4723
|
-
render: (e) =>
|
|
4791
|
+
render: (e) => oa(e)
|
|
4724
4792
|
},
|
|
4725
4793
|
{
|
|
4726
4794
|
kind: "style",
|
|
4727
4795
|
is: (e) => Z(e, "isICellStyle"),
|
|
4728
|
-
render: (e) =>
|
|
4796
|
+
render: (e) => co(e)
|
|
4729
4797
|
},
|
|
4730
4798
|
{
|
|
4731
4799
|
kind: "regions",
|
|
4732
4800
|
is: (e) => Z(e, "isICellRegions"),
|
|
4733
|
-
render: (e, t) =>
|
|
4801
|
+
render: (e, t) => Ut(e, t)
|
|
4734
4802
|
},
|
|
4735
4803
|
{
|
|
4736
4804
|
kind: "cellRange",
|
|
4737
4805
|
is: (e) => Z(e, "isICellRange"),
|
|
4738
|
-
render: (e, t) =>
|
|
4806
|
+
render: (e, t) => ta(e, t)
|
|
4739
4807
|
},
|
|
4740
4808
|
{
|
|
4741
4809
|
kind: "ranges",
|
|
4742
4810
|
is: (e) => Z(e, "isICellRanges"),
|
|
4743
|
-
render: (e, t) =>
|
|
4811
|
+
render: (e, t) => Xa(e, t)
|
|
4744
4812
|
},
|
|
4745
4813
|
{
|
|
4746
4814
|
kind: "range",
|
|
4747
4815
|
is: (e) => Z(e, "isIRange"),
|
|
4748
|
-
render: (e, t) =>
|
|
4816
|
+
render: (e, t) => lo(e, t)
|
|
4749
4817
|
},
|
|
4750
4818
|
{
|
|
4751
4819
|
kind: "values",
|
|
4752
4820
|
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Array.isArray(e)),
|
|
4753
|
-
render: (e, t) =>
|
|
4821
|
+
render: (e, t) => lo(e, t)
|
|
4754
4822
|
},
|
|
4755
4823
|
{
|
|
4756
4824
|
kind: "records",
|
|
4757
|
-
is: (e) => Array.isArray(e) && e.length > 0 && e.every(
|
|
4758
|
-
render: (e, t) =>
|
|
4825
|
+
is: (e) => Array.isArray(e) && e.length > 0 && e.every(Wa),
|
|
4826
|
+
render: (e, t) => Ga(e, {
|
|
4759
4827
|
...t,
|
|
4760
|
-
nested:
|
|
4828
|
+
nested: Oo
|
|
4761
4829
|
})
|
|
4762
4830
|
},
|
|
4763
4831
|
{
|
|
4764
4832
|
kind: "record",
|
|
4765
|
-
is: (e) =>
|
|
4766
|
-
render: (e, t) =>
|
|
4833
|
+
is: (e) => Wa(e),
|
|
4834
|
+
render: (e, t) => Ga(e, {
|
|
4767
4835
|
...t,
|
|
4768
|
-
nested:
|
|
4836
|
+
nested: Oo
|
|
4769
4837
|
})
|
|
4770
4838
|
},
|
|
4771
4839
|
{
|
|
4772
4840
|
kind: "items",
|
|
4773
|
-
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!
|
|
4841
|
+
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!No(e)),
|
|
4774
4842
|
render: async (e, t) => {
|
|
4775
|
-
let n = e.length >
|
|
4776
|
-
for (let e of n) r.push(await
|
|
4843
|
+
let n = e.length > ko ? e.slice(0, ko) : e, r = [];
|
|
4844
|
+
for (let e of n) r.push(await No(e).render(e, t));
|
|
4777
4845
|
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");
|
|
4778
4846
|
}
|
|
4779
4847
|
}
|
|
4780
|
-
],
|
|
4848
|
+
], jo = Ao.map((e) => e.kind), Mo = class extends Error {
|
|
4781
4849
|
constructor(e) {
|
|
4782
4850
|
super(e), this.name = "NoRendererError";
|
|
4783
4851
|
}
|
|
4784
4852
|
};
|
|
4785
|
-
function
|
|
4786
|
-
for (let t of
|
|
4853
|
+
function No(e) {
|
|
4854
|
+
for (let t of Ao) if (t.is(e)) return t;
|
|
4787
4855
|
return null;
|
|
4788
4856
|
}
|
|
4789
|
-
async function
|
|
4857
|
+
async function Po(e, t, n) {
|
|
4790
4858
|
await e?.getCalculation().ready();
|
|
4791
|
-
let r =
|
|
4859
|
+
let r = No(t), i = t;
|
|
4792
4860
|
if (!r && i && typeof i == "object" && !Array.isArray(i) && typeof i[Symbol.iterator] == "function") {
|
|
4793
4861
|
let e = [];
|
|
4794
4862
|
for (let t of i) if (e.push(t), e.length >= 1e3) break;
|
|
4795
|
-
i = e, r =
|
|
4863
|
+
i = e, r = No(i);
|
|
4796
4864
|
}
|
|
4797
|
-
if (!r) throw new
|
|
4865
|
+
if (!r) throw new Mo(`No markdown renderer for this value. Renderable kinds: ${jo.join(", ")}.`);
|
|
4798
4866
|
let a = e?.getCalculation() ?? null, o = await r.render(i, n);
|
|
4799
|
-
for (let e = 0; e <
|
|
4867
|
+
for (let e = 0; e < Fo && a?.getCalculationState() === "calculating"; e++) await a.ready(), o = await r.render(i, n);
|
|
4800
4868
|
return o;
|
|
4801
4869
|
}
|
|
4802
|
-
var
|
|
4803
|
-
async function
|
|
4870
|
+
var Fo = 2;
|
|
4871
|
+
async function Io(e, t, n) {
|
|
4804
4872
|
if (t === void 0) return {
|
|
4805
4873
|
text: void 0,
|
|
4806
4874
|
rendered: !0
|
|
@@ -4811,11 +4879,11 @@ async function No(e, t, n) {
|
|
|
4811
4879
|
};
|
|
4812
4880
|
if (typeof t == "object" && t) try {
|
|
4813
4881
|
return {
|
|
4814
|
-
text: await
|
|
4882
|
+
text: await Po(e, t, n),
|
|
4815
4883
|
rendered: !0
|
|
4816
4884
|
};
|
|
4817
4885
|
} catch (e) {
|
|
4818
|
-
if (!(e instanceof
|
|
4886
|
+
if (!(e instanceof Mo)) throw e;
|
|
4819
4887
|
}
|
|
4820
4888
|
return function(e) {
|
|
4821
4889
|
if (e === null) return {
|
|
@@ -4856,7 +4924,7 @@ async function No(e, t, n) {
|
|
|
4856
4924
|
}(t);
|
|
4857
4925
|
}
|
|
4858
4926
|
var Q = o.Feature;
|
|
4859
|
-
async function
|
|
4927
|
+
async function Lo(e, t, n) {
|
|
4860
4928
|
let r = e.getChanges(t);
|
|
4861
4929
|
if (r.length === 0) return null;
|
|
4862
4930
|
let i = n?.maxEntries ?? 20, a = n?.maxBlockValues ?? 8, o = /* @__PURE__ */ new Map();
|
|
@@ -4869,9 +4937,9 @@ async function Po(e, t, n) {
|
|
|
4869
4937
|
if (o.size === 0) return null;
|
|
4870
4938
|
let s = [], c = [], l = 0;
|
|
4871
4939
|
for (let [e, { data: t, style: n }] of o) {
|
|
4872
|
-
let r = t ?
|
|
4940
|
+
let r = t ? zo(t) : null;
|
|
4873
4941
|
r && c.push(r);
|
|
4874
|
-
let o =
|
|
4942
|
+
let o = Ro(e, t ?? null, r, n ?? null, i, a);
|
|
4875
4943
|
s.push(o.sheet), l += o.cleared;
|
|
4876
4944
|
}
|
|
4877
4945
|
let u = await async function(e) {
|
|
@@ -4883,11 +4951,11 @@ async function Po(e, t, n) {
|
|
|
4883
4951
|
if (t.length === 0) return null;
|
|
4884
4952
|
if (t.length === 1) return t[0];
|
|
4885
4953
|
let n = [];
|
|
4886
|
-
for (let e of t)
|
|
4954
|
+
for (let e of t) Ho(e, n, !0);
|
|
4887
4955
|
return t[0].getWorksheet().getRanges(n);
|
|
4888
4956
|
}(c), d = [];
|
|
4889
|
-
for (let e of c)
|
|
4890
|
-
u &&
|
|
4957
|
+
for (let e of c) Ho(e, d);
|
|
4958
|
+
u && Ho(u, d);
|
|
4891
4959
|
let f = function(e) {
|
|
4892
4960
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
4893
4961
|
for (let r of e) if ((r.getCounts([Q.Error])[Q.Error] ?? 0) !== 0) for (let e of r.getRegions(Q.Error)) {
|
|
@@ -4903,14 +4971,14 @@ async function Po(e, t, n) {
|
|
|
4903
4971
|
return {
|
|
4904
4972
|
commitId: r[0].getCommit().getId(),
|
|
4905
4973
|
sheets: s,
|
|
4906
|
-
dependents: u ?
|
|
4974
|
+
dependents: u ? Uo(u, i) : null,
|
|
4907
4975
|
errors: f.slice(0, p),
|
|
4908
4976
|
errorsMore: f.length - p,
|
|
4909
4977
|
errorsCleared: l,
|
|
4910
|
-
touches:
|
|
4978
|
+
touches: Wo(c, u)
|
|
4911
4979
|
};
|
|
4912
4980
|
}
|
|
4913
|
-
function
|
|
4981
|
+
function Ro(e, t, n, r, i, a) {
|
|
4914
4982
|
let o = r?.getRanges() ?? null, s = {
|
|
4915
4983
|
sheet: V(e.getName()),
|
|
4916
4984
|
written: n ? W(n) : null,
|
|
@@ -4962,17 +5030,17 @@ function Fo(e, t, n, r, i, a) {
|
|
|
4962
5030
|
}(d, e);
|
|
4963
5031
|
}
|
|
4964
5032
|
let f = [], p = 0;
|
|
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(
|
|
5033
|
+
for (let e = 0; e < n.length; e++) for (let t of n.at(e).getRegions(Q.Formula)) p++, f.length < i && f.push(Vo(t.getRange(), a));
|
|
4966
5034
|
if (p > f.length && p <= k(p, i)) {
|
|
4967
5035
|
f.length = 0;
|
|
4968
|
-
for (let e = 0; e < n.length; e++) for (let t of n.at(e).getRegions(Q.Formula)) f.push(
|
|
5036
|
+
for (let e = 0; e < n.length; e++) for (let t of n.at(e).getRegions(Q.Formula)) f.push(Vo(t.getRange(), a));
|
|
4969
5037
|
}
|
|
4970
5038
|
return s.blocks = f, s.blocksMore = p - f.length, {
|
|
4971
5039
|
sheet: s,
|
|
4972
5040
|
cleared: u
|
|
4973
5041
|
};
|
|
4974
5042
|
}
|
|
4975
|
-
function
|
|
5043
|
+
function zo(e) {
|
|
4976
5044
|
let t = e.getRanges(), n = e.getShifts();
|
|
4977
5045
|
if (!t || n.length === 0) return t;
|
|
4978
5046
|
let r = e.getSheet(), i = [], a = [];
|
|
@@ -4986,13 +5054,13 @@ function Io(e) {
|
|
|
4986
5054
|
let o = [];
|
|
4987
5055
|
for (let e = 0; e < t.length; e++) {
|
|
4988
5056
|
let n = t.at(e);
|
|
4989
|
-
i.some((e) =>
|
|
5057
|
+
i.some((e) => Bo(e, n.getCoords())) || o.push(n);
|
|
4990
5058
|
}
|
|
4991
5059
|
for (let e of a) for (let t of r.getRange(e).getRegions(Q.Contentful)) o.push(t.getRange());
|
|
4992
5060
|
return o.length > 0 ? r.getRanges(o) : null;
|
|
4993
5061
|
}
|
|
4994
|
-
var
|
|
4995
|
-
function
|
|
5062
|
+
var Bo = (e, t) => t.rowStart >= e.rowStart && t.rowEnd <= e.rowEnd && t.colStart >= e.colStart && t.colEnd <= e.colEnd;
|
|
5063
|
+
function Vo(e, t) {
|
|
4996
5064
|
let n = e.getRowCount() * e.getColumnCount(), r = n > t, i = [], a = null;
|
|
4997
5065
|
return e.forEach((e, t) => {
|
|
4998
5066
|
let n = D(t.getCell(), w.Mode.Display)?.display ?? "";
|
|
@@ -5005,15 +5073,15 @@ function Ro(e, t) {
|
|
|
5005
5073
|
sampled: r
|
|
5006
5074
|
};
|
|
5007
5075
|
}
|
|
5008
|
-
function
|
|
5076
|
+
function Ho(e, t, n = !1) {
|
|
5009
5077
|
for (let r = 0; r < e.length; r++) {
|
|
5010
5078
|
let i = e.at(r);
|
|
5011
5079
|
!n && i.isINamedRange || t.push(i);
|
|
5012
5080
|
}
|
|
5013
5081
|
}
|
|
5014
|
-
function
|
|
5082
|
+
function Uo(e, t) {
|
|
5015
5083
|
let n = /* @__PURE__ */ new Map(), r = [];
|
|
5016
|
-
|
|
5084
|
+
Ho(e, r);
|
|
5017
5085
|
let i = 0;
|
|
5018
5086
|
for (let e of r) {
|
|
5019
5087
|
let t = e.getCounts([Q.Contentful])[Q.Contentful] ?? 0;
|
|
@@ -5032,16 +5100,16 @@ function Bo(e, t) {
|
|
|
5032
5100
|
areasMore: r.length - a
|
|
5033
5101
|
};
|
|
5034
5102
|
}
|
|
5035
|
-
function
|
|
5103
|
+
function Wo(e, t) {
|
|
5036
5104
|
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = (e) => {
|
|
5037
|
-
for (let t of
|
|
5105
|
+
for (let t of xn(e)) n.add(ln(t));
|
|
5038
5106
|
for (let t of e.getConditionalFormats()) r.add(W(t.getRanges()));
|
|
5039
5107
|
for (let t of e.getDataValidations()) i.add(W(t.getRanges()));
|
|
5040
5108
|
};
|
|
5041
5109
|
for (let n of e) for (let e = 0; e < n.length; e++) {
|
|
5042
5110
|
let r = n.at(e);
|
|
5043
5111
|
o(r);
|
|
5044
|
-
for (let e of
|
|
5112
|
+
for (let e of Bn(r, t)) a.has(e.movable) || a.set(e.movable, e);
|
|
5045
5113
|
}
|
|
5046
5114
|
for (let e = 0; e < (t?.length ?? 0); e++) {
|
|
5047
5115
|
let r = t.at(e);
|
|
@@ -5051,28 +5119,28 @@ function Vo(e, t) {
|
|
|
5051
5119
|
names: [...n],
|
|
5052
5120
|
conditionalFormats: [...r],
|
|
5053
5121
|
dataValidations: [...i],
|
|
5054
|
-
charts: Array.from(a.values(),
|
|
5122
|
+
charts: Array.from(a.values(), Vn)
|
|
5055
5123
|
};
|
|
5056
5124
|
}
|
|
5057
|
-
var $ = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`,
|
|
5058
|
-
function
|
|
5125
|
+
var $ = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`, Go = (e, t) => `${`${e}:`.padEnd(14)}${t}`;
|
|
5126
|
+
function Ko(e) {
|
|
5059
5127
|
let t = [];
|
|
5060
5128
|
for (let n of e.sheets) {
|
|
5061
5129
|
if (n.written) {
|
|
5062
|
-
t.push(
|
|
5063
|
-
for (let e of n.blocks) t.push(` ${
|
|
5130
|
+
t.push(Go("Changed", `${n.written} — ${qo(n)}`));
|
|
5131
|
+
for (let e of n.blocks) t.push(` ${Yo(e)}`);
|
|
5064
5132
|
n.blocksMore > 0 && t.push(` +${$(n.blocksMore, "more formula block")}`);
|
|
5065
5133
|
}
|
|
5066
|
-
n.shifts.length > 0 && t.push(
|
|
5134
|
+
n.shifts.length > 0 && t.push(Go("Structure", n.shifts.map((e) => Jo(n.sheet, e)).join(" · "))), n.styles && t.push(Go("Formatting", n.styles));
|
|
5067
5135
|
}
|
|
5068
5136
|
let n = e.dependents;
|
|
5069
5137
|
if (n) {
|
|
5070
5138
|
let e = n.sheets.length > 1 ? ` on ${$(n.sheets.length, "sheet")}` : "";
|
|
5071
|
-
t.push(
|
|
5139
|
+
t.push(Go("Dependents", `${$(n.cells, "cell")}${e} — ${n.areas.join(", ")}${((e) => e > 0 ? ` · +${e} more` : "")(n.areasMore)}`));
|
|
5072
5140
|
}
|
|
5073
5141
|
if (e.errors.length > 0 || e.errorsCleared > 0) {
|
|
5074
5142
|
let n = e.errors.map((e) => `${e.address} ${e.error} (${e.cells})`);
|
|
5075
|
-
e.errorsMore > 0 && n.push(`+${e.errorsMore} more`), e.errorsCleared > 0 && n.push(`${$(e.errorsCleared, "error")} cleared`), t.push(
|
|
5143
|
+
e.errorsMore > 0 && n.push(`+${e.errorsMore} more`), e.errorsCleared > 0 && n.push(`${$(e.errorsCleared, "error")} cleared`), t.push(Go("Errors", n.join(" · ")));
|
|
5076
5144
|
}
|
|
5077
5145
|
let r = function(e) {
|
|
5078
5146
|
let t = [], n = (e, n, r) => {
|
|
@@ -5080,9 +5148,9 @@ function Uo(e) {
|
|
|
5080
5148
|
};
|
|
5081
5149
|
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;
|
|
5082
5150
|
}(e.touches);
|
|
5083
|
-
return r && t.push(
|
|
5151
|
+
return r && t.push(Go("Also touches", r)), t.join("\n");
|
|
5084
5152
|
}
|
|
5085
|
-
function
|
|
5153
|
+
function qo(e) {
|
|
5086
5154
|
let t = [];
|
|
5087
5155
|
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
5156
|
let n = e.replaced.formulas > 0 ? ` (${$(e.replaced.formulas, "formula")})` : "";
|
|
@@ -5090,27 +5158,27 @@ function Wo(e) {
|
|
|
5090
5158
|
} else t.push("replaced cells not known (cells moved, or the state before was not kept)");
|
|
5091
5159
|
return t.join(", ");
|
|
5092
5160
|
}
|
|
5093
|
-
function
|
|
5161
|
+
function Jo(e, t) {
|
|
5094
5162
|
let n = t.kind === "insert" ? "inserted" : "deleted", r = t.address ?? e;
|
|
5095
5163
|
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"}`;
|
|
5096
5164
|
}
|
|
5097
|
-
function
|
|
5165
|
+
function Yo(e) {
|
|
5098
5166
|
let t;
|
|
5099
5167
|
t = e.sampled && e.values.length > 1 ? `${e.values.slice(0, -1).join(", ")} … ${e.values[e.values.length - 1]}` : e.values.join(", ");
|
|
5100
5168
|
let n = e.cells > 1 ? ` (${$(e.cells, "cell")})` : "";
|
|
5101
5169
|
return `${e.address} ${e.formula} → ${t}${n}`;
|
|
5102
5170
|
}
|
|
5103
|
-
async function
|
|
5171
|
+
async function Xo(e, t, n) {
|
|
5104
5172
|
if (!t) return {};
|
|
5105
5173
|
try {
|
|
5106
|
-
let r = await
|
|
5174
|
+
let r = await Lo(e, t, n);
|
|
5107
5175
|
return r ? {
|
|
5108
5176
|
delta: r,
|
|
5109
|
-
markdown:
|
|
5177
|
+
markdown: Ko(r)
|
|
5110
5178
|
} : {};
|
|
5111
5179
|
} catch (e) {
|
|
5112
5180
|
return { markdown: `Changes could not be read: ${e?.message ?? String(e)}` };
|
|
5113
5181
|
}
|
|
5114
5182
|
}
|
|
5115
|
-
var
|
|
5116
|
-
export {
|
|
5183
|
+
var Zo = [Rr], Qo = [si];
|
|
5184
|
+
export { Vr as API_ENTRY_POINTS, w as CellEncoding, ie as GREP_FIELDS, ae as GREP_FIELDS_DEFAULT, re as GrepField, I as MarkdownBuilder, Ee as MarkdownFrameSection, Mo as NoRendererError, Qo as REFERENCES, jo as RENDERABLE_KINDS, Ao as RENDERERS, wi as RENDER_OPTION_KEYS, Wt as REPORTED_FEATURES, Zo as TOOLS, Ht as anomalyRegionKey, Qr as apiPointerFor, ri as apiSuggestionsFor, si as apiTool, Zr as apiTypeOf, li as appendDependencies, tr as appendGroupFacts, er as appendGroupMembers, Zt as appendKinds, wa as appendModules, mr as appendMovables, _n as appendNames, zt as appendRegionList, en as appendRegions, $t as appendRoles, bn as appendRules, Xn as appendShapeFacts, Sn as appendSheetObjects, Ui as appendSheetProtection, Ae as appendTables, Ca as collectModules, sr as collectShapeText, an as contentfulBlocks, Ke as countDates, Ce as describeAlignment, jt as describeAllowedValues, ir as describeAnchor, oi as describeApi, ye as describeBorder, xe as describeBorderParts, Gi as describeCellProtection, N as describeColor, kt as describeConditionalFormat, At as describeDataValidation, Lo as describeDelta, Yt as describeExtent, ve as describeFill, we as describeFont, Pi as describeLock, lr as describeMovableSummary, Si as describeNode, xi as describeNodeLabel, yi as describeNodeLabels, Se as describeNumberFormat, yn as describeOutline, Ha as describePageLayout, Xt as describeQualifiedExtent, ln as describeQualifiedName, W as describeQualifiedRanges, Wi as describeRangeProtection, U as describeRanges, Tt as describeRuleStyle, Mt as describeRules, Dt as describeScale, ar as describeShapeText, H as describeSheetCall, V as describeSheetName, ze as describeSums, fr as describeTypeHeading, Li as describeWorkbookProtection, Ie as detectTotals, D as encodeCell, E as encodeFormattedNumber, T as encodeNumber, O as encodeScalar, xn as findNames, jr as grep, Rr as grepTool, pr as groupMovables, Zn as groupOf, Wa as isPlainRecord, Jr as lookupApi, Jt as parseFeatures, Ti as parseRenderOptions, Ge as profileKinds, Ne as profileRegion, Ki as protectionPointerFor, Hn as quoteShapeText, Xo as readRunDelta, or as readShapeText, Lt as regionPayload, Rt as regionPayloads, ai as renderApi, Xi as renderCell, ta as renderCellRange, aa as renderConditionalFormat, oa as renderCounts, sa as renderDataValidation, Ko as renderDelta, _a as renderFormula, Lr as renderGrep, Po as renderMarkdown, Ea as renderModule, Da as renderModules, gr as renderMovable, ka as renderNames, Ua as renderPageLayout, Ji as renderProtectedRange, qi as renderProtection, Xa as renderRanges, Ga as renderRecords, Ut as renderRegions, Io as renderResult, _r as renderShape, oo as renderStats, co as renderStyle, je as renderTable, lo as renderValues, mo as renderWorkbook, ro as renderWorksheet, No as resolveRenderer, Hi as summarizeSheetProtection, Oe as tableOf, ti as withoutHiddenSuggestion };
|