@sheetxl/query 0.8.0-beta.7 → 0.8.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/index.cjs +42 -40
- package/browser/esm/index.mjs +1054 -888
- package/node/esm/index.mjs +1394 -1225
- package/package.json +3 -3
- package/types/src/encode/encodeCell.d.ts +9 -7
- package/types/src/grep/GrepTypes.d.ts +17 -29
- package/types/src/markdown/appendSections.d.ts +10 -1
- package/types/src/markdown/describeShape.d.ts +30 -0
- package/types/src/markdown/index.d.ts +1 -0
- package/types/src/markdown/renderCell.d.ts +2 -1
- package/types/src/markdown/renderMovable.d.ts +12 -1
package/browser/esm/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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.9
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { AddressUtils as e, FormulaError as t, IAnchored as n, ICalculation as r, ICellRange as i, ICondition as a, IConditionalFormat as o, IDataValidation as s, IFill as c, IFont as l, IRange as u,
|
|
8
|
-
var
|
|
9
|
-
(
|
|
7
|
+
import { AddressUtils as e, FormulaError as t, IAnchored as n, ICalculation as r, ICellRange as i, ICondition as a, IConditionalFormat as o, IDataValidation as s, IFill as c, IFont as l, IRange as u, IShape as d, ISheet as f, IStroke as p, ITextFrame as m, InteropScalarType as h, NumberFormat as g, ScalarType as _, ShapeStyleUtils as v, getScriptingApi as y, getScriptingDeclarations as b } from "@sheetxl/sdk";
|
|
8
|
+
var x;
|
|
9
|
+
(x ||= {}).Mode = {
|
|
10
10
|
Display: "display",
|
|
11
11
|
Value: "value"
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
function S(e) {
|
|
14
14
|
return Number.isFinite(e) ? function(e) {
|
|
15
15
|
let t = e.indexOf("e");
|
|
16
16
|
if (t === -1) return e;
|
|
@@ -18,27 +18,28 @@ function v(e) {
|
|
|
18
18
|
return `${e.substring(0, t)}E${e[t + 1]}${n.length < 2 ? "0" + n : n}`;
|
|
19
19
|
}(String(Number(e.toPrecision(15)))) : String(e);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function C(e, t) {
|
|
22
22
|
if (!Number.isFinite(e)) return String(e);
|
|
23
|
-
if (!t || t === "General") return
|
|
23
|
+
if (!t || t === "General") return S(e);
|
|
24
24
|
try {
|
|
25
|
-
let n =
|
|
26
|
-
return n ? n.trim() :
|
|
25
|
+
let n = g.getEngine().format(t, e)?.text;
|
|
26
|
+
return n ? n.trim() : S(e);
|
|
27
27
|
} catch {
|
|
28
|
-
return
|
|
28
|
+
return S(e);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
function w(e, t) {
|
|
32
|
+
if (t === x.Mode.Value) {
|
|
33
|
+
let t = T(e.getValue());
|
|
34
|
+
return t?.match ? t : null;
|
|
35
|
+
}
|
|
36
|
+
let n = e.getText({ hideStringPrefix: !0 });
|
|
37
|
+
return n ? {
|
|
38
|
+
match: n,
|
|
39
|
+
display: e.getText()
|
|
39
40
|
} : null;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function T(e) {
|
|
42
43
|
if (e == null) return null;
|
|
43
44
|
if (typeof e == "string") return {
|
|
44
45
|
match: e,
|
|
@@ -52,7 +53,7 @@ function x(e) {
|
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
if (typeof e == "number") {
|
|
55
|
-
let t =
|
|
56
|
+
let t = S(e);
|
|
56
57
|
return {
|
|
57
58
|
match: t,
|
|
58
59
|
display: t
|
|
@@ -71,10 +72,9 @@ function x(e) {
|
|
|
71
72
|
display: n
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
|
-
var
|
|
75
|
+
var ee = {
|
|
75
76
|
Display: "display",
|
|
76
77
|
Value: "value",
|
|
77
|
-
Raw: "raw",
|
|
78
78
|
Formula: "formula",
|
|
79
79
|
Hyperlink: "hyperlink",
|
|
80
80
|
NumberFormat: "numberFormat",
|
|
@@ -82,10 +82,9 @@ var S = {
|
|
|
82
82
|
Shape: "shape",
|
|
83
83
|
Chart: "chart",
|
|
84
84
|
Name: "name"
|
|
85
|
-
},
|
|
85
|
+
}, te = [
|
|
86
86
|
"display",
|
|
87
87
|
"value",
|
|
88
|
-
"raw",
|
|
89
88
|
"formula",
|
|
90
89
|
"hyperlink",
|
|
91
90
|
"numberFormat",
|
|
@@ -93,15 +92,14 @@ var S = {
|
|
|
93
92
|
"shape",
|
|
94
93
|
"chart",
|
|
95
94
|
"name"
|
|
96
|
-
],
|
|
95
|
+
], E = [
|
|
97
96
|
"display",
|
|
98
|
-
"value",
|
|
99
97
|
"formula",
|
|
100
98
|
"comment",
|
|
101
99
|
"shape",
|
|
102
100
|
"chart",
|
|
103
101
|
"name"
|
|
104
|
-
],
|
|
102
|
+
], D = (e, t) => e <= t + 3 ? e : t, O = (e) => {
|
|
105
103
|
if (!e) return null;
|
|
106
104
|
let t = String(e.toHex?.() ?? "");
|
|
107
105
|
if (!t) return e.toString();
|
|
@@ -109,32 +107,32 @@ var S = {
|
|
|
109
107
|
if (!r) return n;
|
|
110
108
|
let i = r.toLowerCase().replace(/^#/, "");
|
|
111
109
|
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))))})`;
|
|
112
|
-
},
|
|
110
|
+
}, k = (e) => {
|
|
113
111
|
let t = e.getFill(), n = t.getType();
|
|
114
112
|
if (n === c.Type.None) return null;
|
|
115
113
|
if (n === c.Type.Pattern) {
|
|
116
114
|
let e = t, n = e.getPatternType();
|
|
117
115
|
if (n === c.BuiltInSheetPattern.None) return null;
|
|
118
|
-
let r =
|
|
116
|
+
let r = O(e.getForeground());
|
|
119
117
|
if (n === c.BuiltInSheetPattern.Solid) return r ? `solid ${r}` : "solid";
|
|
120
|
-
let i =
|
|
118
|
+
let i = O(e.getBackground());
|
|
121
119
|
return [
|
|
122
120
|
`${n} pattern`,
|
|
123
121
|
r,
|
|
124
122
|
i ? `on ${i}` : null
|
|
125
123
|
].filter(Boolean).join(" ");
|
|
126
124
|
}
|
|
127
|
-
let r =
|
|
125
|
+
let r = O(t.getColor?.());
|
|
128
126
|
return r ? `${n} ${r}` : n;
|
|
129
|
-
},
|
|
130
|
-
let t =
|
|
127
|
+
}, A = (e) => {
|
|
128
|
+
let t = re(e);
|
|
131
129
|
return t.length > 0 ? t.join(" · ") : null;
|
|
132
|
-
},
|
|
130
|
+
}, ne = /* @__PURE__ */ new Set([
|
|
133
131
|
"top",
|
|
134
132
|
"left",
|
|
135
133
|
"bottom",
|
|
136
134
|
"right"
|
|
137
|
-
]),
|
|
135
|
+
]), re = (e) => {
|
|
138
136
|
let t = e.getBorders(), n = [
|
|
139
137
|
["top", t.getTop()],
|
|
140
138
|
["left", t.getLeft()],
|
|
@@ -148,28 +146,28 @@ var S = {
|
|
|
148
146
|
for (let [e, t] of n) {
|
|
149
147
|
let n = t?.getStyle?.();
|
|
150
148
|
if (!n || n === "none") continue;
|
|
151
|
-
let i =
|
|
149
|
+
let i = O(t?.getColor?.()), a = i ? `${n} ${i}` : n, o = r.get(a);
|
|
152
150
|
o ? o.push(e) : r.set(a, [e]);
|
|
153
151
|
}
|
|
154
152
|
let i = [];
|
|
155
153
|
for (let [e, t] of r) {
|
|
156
|
-
let n = t.length === 4 && t.every((e) =>
|
|
154
|
+
let n = t.length === 4 && t.every((e) => ne.has(e));
|
|
157
155
|
i.push(`${n ? "outline" : t.join("+")} ${e}`);
|
|
158
156
|
}
|
|
159
157
|
return i;
|
|
160
|
-
},
|
|
158
|
+
}, ie = (e) => {
|
|
161
159
|
let t = e.getNumberFormat();
|
|
162
160
|
return t && t !== "General" ? t : null;
|
|
163
|
-
},
|
|
161
|
+
}, ae = (e, t) => {
|
|
164
162
|
let n = e.getAlignment(), r = t.getAlignment(), i = [];
|
|
165
163
|
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;
|
|
166
|
-
},
|
|
164
|
+
}, oe = (e, t) => {
|
|
167
165
|
let n = e.getFont(), r = t.getFont(), i = [];
|
|
168
166
|
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());
|
|
169
|
-
let a =
|
|
170
|
-
return a !==
|
|
171
|
-
},
|
|
172
|
-
function
|
|
167
|
+
let a = O(n.getColor());
|
|
168
|
+
return a !== O(r.getColor()) && i.push(a ?? "no color"), i.length > 0 ? i.join(" · ") : null;
|
|
169
|
+
}, se = i.Feature;
|
|
170
|
+
function j(e, t, n) {
|
|
173
171
|
let { rowIndex: r, colIndex: i } = t, a = n === "row", o = a ? i : r;
|
|
174
172
|
if (o === 0) return null;
|
|
175
173
|
let s = e.getRange({
|
|
@@ -179,7 +177,7 @@ function M(e, t, n) {
|
|
|
179
177
|
colEnd: i
|
|
180
178
|
}).getSurrounding({ contentOnly: !0 }).getCoords(), c = a ? s.colStart : s.rowStart;
|
|
181
179
|
if (c < o) {
|
|
182
|
-
let t =
|
|
180
|
+
let t = le(e, a ? r : c, a ? c : i);
|
|
183
181
|
if (t) return t;
|
|
184
182
|
}
|
|
185
183
|
let l = a ? e.getRange({
|
|
@@ -194,71 +192,71 @@ function M(e, t, n) {
|
|
|
194
192
|
colEnd: i
|
|
195
193
|
});
|
|
196
194
|
for (let t of l.entries({
|
|
197
|
-
features: [
|
|
195
|
+
features: [se.Contentful],
|
|
198
196
|
axis: a ? u.Axis.Column : u.Axis.Row,
|
|
199
197
|
reverse: !0
|
|
200
198
|
})) {
|
|
201
|
-
if (t.context.getType() !==
|
|
199
|
+
if (t.context.getType() !== _.String) continue;
|
|
202
200
|
let n = t.context.getCoords();
|
|
203
|
-
return
|
|
201
|
+
return le(e, n.rowIndex, n.colIndex);
|
|
204
202
|
}
|
|
205
203
|
return null;
|
|
206
204
|
}
|
|
207
|
-
var
|
|
208
|
-
function
|
|
205
|
+
var ce = (e) => e ? `${JSON.stringify(e.text)} (${e.address})` : null;
|
|
206
|
+
function le(e, t, n) {
|
|
209
207
|
let r = e.getRange({
|
|
210
208
|
rowStart: t,
|
|
211
209
|
rowEnd: t,
|
|
212
210
|
colStart: n,
|
|
213
211
|
colEnd: n
|
|
214
212
|
}).getCell();
|
|
215
|
-
if (r.getType() !==
|
|
216
|
-
let i =
|
|
213
|
+
if (r.getType() !== _.String) return null;
|
|
214
|
+
let i = w(r, x.Mode.Display)?.match;
|
|
217
215
|
return i ? {
|
|
218
216
|
text: i,
|
|
219
217
|
address: r.getAddress()
|
|
220
218
|
} : null;
|
|
221
219
|
}
|
|
222
|
-
function
|
|
220
|
+
function M(e) {
|
|
223
221
|
let t = e, n = "";
|
|
224
222
|
do
|
|
225
223
|
n = String.fromCharCode(65 + t % 26) + n, t = Math.floor(t / 26) - 1;
|
|
226
224
|
while (t >= 0);
|
|
227
225
|
return n;
|
|
228
226
|
}
|
|
229
|
-
var
|
|
230
|
-
function
|
|
227
|
+
var N = i.Feature;
|
|
228
|
+
function ue(e, t) {
|
|
231
229
|
let n = t?.maxSeries ?? 24, r = t?.maxProfileCells ?? 2e4, i = t?.maxCategories ?? 3, a = e.getRowCount(), o = e.getColumnCount();
|
|
232
230
|
if (a === 1 && o === 1) return {
|
|
233
231
|
shape: "cell",
|
|
234
|
-
summary:
|
|
232
|
+
summary: w(e.getCell(), x.Mode.Display)?.display ?? "(blank)",
|
|
235
233
|
series: []
|
|
236
234
|
};
|
|
237
235
|
let s = e.getRange(), c = s.getCoords(), l = a >= o;
|
|
238
236
|
if (a === 1 || o === 1) return {
|
|
239
237
|
shape: "list",
|
|
240
|
-
summary:
|
|
238
|
+
summary: xe(s, i),
|
|
241
239
|
series: []
|
|
242
240
|
};
|
|
243
|
-
let u =
|
|
244
|
-
for (let t = 0; t <
|
|
245
|
-
let n = l ? s.getRangeAt(m, c.colStart + t,
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
let k =
|
|
249
|
-
d >
|
|
250
|
-
let
|
|
241
|
+
let u = de(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 = me(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, S = y * b > r, C = S && l ? Math.max(1, Math.floor(r / Math.max(1, b))) : y, T = S && !l ? Math.max(1, Math.floor(r / Math.max(1, y))) : b, ee = Math.min(_, m + C - 1), te = Math.min(v, h + T - 1), E = Math.min(d, n), D = [], O = [];
|
|
242
|
+
for (let t = 0; t < E; t++) {
|
|
243
|
+
let n = l ? s.getRangeAt(m, c.colStart + t, ee, c.colStart + t) : s.getRangeAt(c.rowStart + t, h, c.rowStart + t, te);
|
|
244
|
+
D.push(be(e, l, t, u.names)), O.push(xe(n, i));
|
|
245
|
+
}
|
|
246
|
+
let k = D.length ? Math.max(...D.map((e) => e.length)) : 0, A = D.map((e, t) => `${e.padEnd(k)} ${O[t]}`);
|
|
247
|
+
d > E && A.push(`…${d - E} more ${l ? "columns" : "rows"} not profiled · read them with getStats()`);
|
|
248
|
+
let ne = [
|
|
251
249
|
f,
|
|
252
250
|
u.note,
|
|
253
251
|
g?.note
|
|
254
252
|
];
|
|
255
|
-
return
|
|
253
|
+
return S && ne.push(`profiled from the first ${l ? `${C} rows` : `${T} columns`} of ${l ? y : b}`), {
|
|
256
254
|
shape: u.present ? "table" : "block",
|
|
257
|
-
summary:
|
|
255
|
+
summary: ne.filter(Boolean).join(" · "),
|
|
258
256
|
series: A
|
|
259
257
|
};
|
|
260
258
|
}
|
|
261
|
-
function
|
|
259
|
+
function de(e, t) {
|
|
262
260
|
let n = e.getRange(), r = n.getCoords(), i = e.getCell().getTable();
|
|
263
261
|
if (i) {
|
|
264
262
|
let e = i.getColumns().map((e) => e.getName()), n = i.getRange().getCoords();
|
|
@@ -269,21 +267,21 @@ function oe(e, t) {
|
|
|
269
267
|
names: t ? e : null
|
|
270
268
|
};
|
|
271
269
|
}
|
|
272
|
-
let a = t ? r.rowStart + 1 : r.colStart + 1, o =
|
|
273
|
-
if (
|
|
270
|
+
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);
|
|
271
|
+
if (ve(s) && !o) return {
|
|
274
272
|
present: !0,
|
|
275
273
|
inside: !0,
|
|
276
|
-
note: "header " + (t ? `row ${r.rowStart + 1}` : `column ${
|
|
277
|
-
names:
|
|
274
|
+
note: "header " + (t ? `row ${r.rowStart + 1}` : `column ${M(r.colStart)}`),
|
|
275
|
+
names: ye(s, e, t)
|
|
278
276
|
};
|
|
279
277
|
let c = (t ? r.rowStart : r.colStart) - 1;
|
|
280
|
-
if (c >= 0 && !
|
|
278
|
+
if (c >= 0 && !ve(n)) {
|
|
281
279
|
let i = t ? n.getRangeAt(c, r.colStart, c, r.colEnd) : n.getRangeAt(r.rowStart, c, r.rowEnd, c);
|
|
282
|
-
if (
|
|
280
|
+
if (ve(i)) return {
|
|
283
281
|
present: !0,
|
|
284
282
|
inside: !1,
|
|
285
|
-
note: `header ${t ? `row ${c + 1}` : `column ${
|
|
286
|
-
names:
|
|
283
|
+
note: `header ${t ? `row ${c + 1}` : `column ${M(c)}`} (above this block)`,
|
|
284
|
+
names: ye(i, e, t)
|
|
287
285
|
};
|
|
288
286
|
}
|
|
289
287
|
return {
|
|
@@ -293,19 +291,19 @@ function oe(e, t) {
|
|
|
293
291
|
names: null
|
|
294
292
|
};
|
|
295
293
|
}
|
|
296
|
-
var
|
|
297
|
-
function
|
|
294
|
+
var fe = 3;
|
|
295
|
+
function pe(e, t = 2e4) {
|
|
298
296
|
let n = e.getRowCount(), r = e.getColumnCount();
|
|
299
297
|
if (n < 2 || r < 2) return null;
|
|
300
|
-
let i = n >= r, a = e.getCoords(), o =
|
|
298
|
+
let i = n >= r, a = e.getCoords(), o = de({
|
|
301
299
|
getRowCount: () => n,
|
|
302
300
|
getColumnCount: () => r,
|
|
303
301
|
getCell: () => e.getCell(),
|
|
304
302
|
getRange: () => e
|
|
305
303
|
}, i), s = o.present && o.inside;
|
|
306
|
-
return
|
|
304
|
+
return me(e, i, (i ? a.rowStart : a.colStart) + +!!s, t);
|
|
307
305
|
}
|
|
308
|
-
function
|
|
306
|
+
function me(e, t, n, r) {
|
|
309
307
|
let i = e.getCoords(), a = t ? i.rowEnd : i.colEnd, o = t ? i.colStart : i.rowStart, s = t ? i.colEnd : i.rowEnd, c, l = -1, u = e.getCell().getTable(), d = t && !!u?.isShowTotals() && u.getRange().getCoords().rowEnd === i.rowEnd;
|
|
310
308
|
if (d) l = a;
|
|
311
309
|
else {
|
|
@@ -313,13 +311,13 @@ function le(e, t, n, r) {
|
|
|
313
311
|
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);
|
|
314
312
|
for (let r = n; r <= a; r++) {
|
|
315
313
|
if (r - n >= 2) {
|
|
316
|
-
let n =
|
|
314
|
+
let n = he(f, (e) => d(r, o + e), p, m, (e) => t ? `${M(o + e)}${r + 1}` : `${M(r)}${o + e + 1}`);
|
|
317
315
|
if (n.matches >= 2 && 2 * n.matches > n.candidates) {
|
|
318
316
|
let i = t ? e.getRangeAt(r, o, r, s) : e.getRangeAt(o, r, s, r);
|
|
319
317
|
l = r, c = {
|
|
320
318
|
...n,
|
|
321
319
|
byColumn: t,
|
|
322
|
-
typed: (i.getCounts([
|
|
320
|
+
typed: (i.getCounts([N.Formula])[N.Formula] ?? 0) === 0
|
|
323
321
|
};
|
|
324
322
|
break;
|
|
325
323
|
}
|
|
@@ -339,17 +337,17 @@ function le(e, t, n, r) {
|
|
|
339
337
|
} : {
|
|
340
338
|
rowIndex: i.rowStart,
|
|
341
339
|
colIndex: n
|
|
342
|
-
}, a =
|
|
340
|
+
}, a = _e(e, r) ?? j(f, r, t ? "row" : "column");
|
|
343
341
|
p.push({
|
|
344
342
|
index: n,
|
|
345
343
|
label: a,
|
|
346
344
|
...n === l && c ? { sums: c } : {}
|
|
347
345
|
});
|
|
348
346
|
}
|
|
349
|
-
let m = (e) => t ? String(e + 1) :
|
|
347
|
+
let m = (e) => t ? String(e + 1) : M(e), h = l === a ? `${t ? "row" : "column"} ${m(l)}` : `${t ? "rows" : "columns"} ${m(l)}:${m(a)}`, g = p.slice(0, fe).map((e) => [
|
|
350
348
|
m(e.index),
|
|
351
349
|
e.label ? JSON.stringify(e.label.text) : null,
|
|
352
|
-
e.sums ?
|
|
350
|
+
e.sums ? ge(e.sums) : e.index === l && d ? "table totals" : null
|
|
353
351
|
].filter(Boolean).join(" ")), _ = p.length - g.length;
|
|
354
352
|
return {
|
|
355
353
|
byColumn: t,
|
|
@@ -358,13 +356,13 @@ function le(e, t, n, r) {
|
|
|
358
356
|
note: `${h} not profiled: ${g.join(" · ")}${_ > 0 ? ` · +${_} more` : ""}`
|
|
359
357
|
};
|
|
360
358
|
}
|
|
361
|
-
function
|
|
359
|
+
function he(e, t, n, r, i) {
|
|
362
360
|
let a = 0, o = 0, s = [];
|
|
363
361
|
for (let c = 0; c < e; c++) {
|
|
364
362
|
if (!r[c]) continue;
|
|
365
363
|
o++;
|
|
366
364
|
let e = t(c), l = n[c];
|
|
367
|
-
typeof e == "number" && Math.abs(e - l) <= 1e-9 * Math.max(1, Math.abs(l)) ? a++ : typeof e == "number" ? s.push(`${i(c)} ${
|
|
365
|
+
typeof e == "number" && Math.abs(e - l) <= 1e-9 * Math.max(1, Math.abs(l)) ? a++ : typeof e == "number" ? s.push(`${i(c)} ${S(e)} ≠ Σ ${S(l)}`) : s.push(`${i(c)} ${e == null ? "blank" : typeof e == "string" ? "text" : String(e)}`);
|
|
368
366
|
}
|
|
369
367
|
return {
|
|
370
368
|
matches: a,
|
|
@@ -372,93 +370,93 @@ function ue(e, t, n, r, i) {
|
|
|
372
370
|
misses: s
|
|
373
371
|
};
|
|
374
372
|
}
|
|
375
|
-
function
|
|
373
|
+
function ge(e) {
|
|
376
374
|
let t = e.misses.slice(0, 3), n = e.misses.length - t.length, r = t.length > 0 ? `; ${t.join(", ")}${n > 0 ? `, +${n} more` : ""}` : "";
|
|
377
375
|
return `${e.typed ? "typed, " : ""}= Σ ${e.byColumn ? "above" : "to the left"} (${e.matches} of ${e.candidates}${r})`;
|
|
378
376
|
}
|
|
379
|
-
function
|
|
377
|
+
function _e(e, t) {
|
|
380
378
|
let n = e.getRangeAt(t.rowIndex, t.colIndex).getCell();
|
|
381
|
-
if (n.getType() !==
|
|
382
|
-
let r =
|
|
379
|
+
if (n.getType() !== _.String) return null;
|
|
380
|
+
let r = w(n, x.Mode.Display)?.match;
|
|
383
381
|
return r ? {
|
|
384
382
|
text: r,
|
|
385
383
|
address: n.getAddress()
|
|
386
384
|
} : null;
|
|
387
385
|
}
|
|
388
|
-
function
|
|
386
|
+
function ve(e) {
|
|
389
387
|
let t = e.getStats({ onError: "ignore" }), n = t.getCount();
|
|
390
|
-
return n > 0 && (t.getTypedCounts()[
|
|
388
|
+
return n > 0 && (t.getTypedCounts()[_.String] ?? 0) === n;
|
|
391
389
|
}
|
|
392
|
-
function
|
|
390
|
+
function ye(e, t, n) {
|
|
393
391
|
let r = t.getRange().getCoords(), i = e.getCoords(), a = n ? r.colEnd - r.colStart + 1 : r.rowEnd - r.rowStart + 1, o = [];
|
|
394
392
|
for (let t = 0; t < a; t++) {
|
|
395
393
|
let a = n ? e.getRangeAt(i.rowStart, r.colStart + t).getCell() : e.getRangeAt(r.rowStart + t, i.colStart).getCell();
|
|
396
|
-
o.push(
|
|
394
|
+
o.push(w(a, x.Mode.Display)?.match ?? "");
|
|
397
395
|
}
|
|
398
396
|
return o;
|
|
399
397
|
}
|
|
400
|
-
function
|
|
401
|
-
let i = e.getRange().getCoords(), a = t ?
|
|
398
|
+
function be(e, t, n, r) {
|
|
399
|
+
let i = e.getRange().getCoords(), a = t ? M(i.colStart + n) : String(i.rowStart + n + 1), o = r?.[n];
|
|
402
400
|
return o ? `${a} ${o}` : a;
|
|
403
401
|
}
|
|
404
|
-
function
|
|
402
|
+
function xe(e, t = 3) {
|
|
405
403
|
let n = e.getStats({ onError: "ignore" }), r = n.getTypedCounts(), i = n.getCount(), a = n.getSize(), o = a - i;
|
|
406
404
|
if (i === 0) return `${a} cells, all blank`;
|
|
407
|
-
let s = e.getCounts([
|
|
405
|
+
let s = e.getCounts([N.Formula])[N.Formula] ?? 0, c = Ce(e), l = r[_.Number] ?? 0, u = r[_.String] ?? 0, d = r[_.Error] ?? 0, f = [String(i)], p = !1;
|
|
408
406
|
if (s === i) {
|
|
409
|
-
let t = [...e.getRegions(
|
|
407
|
+
let t = [...e.getRegions(N.Formula)];
|
|
410
408
|
if (t.length === 1) {
|
|
411
409
|
let e = t[0].getCell().getFormulaText();
|
|
412
410
|
f.push("formula", e || "(uniform)");
|
|
413
411
|
} else f.push("formula", `${t.length} distinct`);
|
|
414
|
-
} else if (c === i) f.push("date",
|
|
412
|
+
} else if (c === i) f.push("date", Te(n, we(e).format));
|
|
415
413
|
else if (l === i) {
|
|
416
|
-
let t =
|
|
417
|
-
f.push("number",
|
|
418
|
-
} else if (u === i) f.push("text",
|
|
414
|
+
let t = we(e);
|
|
415
|
+
f.push("number", Te(n, t.format), ...Ee(n, t));
|
|
416
|
+
} else if (u === i) f.push("text", De(n, t));
|
|
419
417
|
else {
|
|
420
418
|
let e = [
|
|
421
419
|
l ? `number ${l}` : null,
|
|
422
420
|
u ? `text ${u}` : null,
|
|
423
|
-
r[
|
|
421
|
+
r[_.Boolean] ? `boolean ${r[_.Boolean]}` : null,
|
|
424
422
|
d ? `error ${d}` : null
|
|
425
423
|
].filter(Boolean);
|
|
426
424
|
f.push("mixed", e.join(" · ")), p = !0;
|
|
427
425
|
}
|
|
428
|
-
let
|
|
426
|
+
let m = [
|
|
429
427
|
d > 0 && !p ? `error ${d}` : null,
|
|
430
428
|
o > 0 ? `${o} blank` : null,
|
|
431
429
|
s > 0 && s !== i ? `${s} formula` : null
|
|
432
|
-
].filter(Boolean),
|
|
433
|
-
return
|
|
430
|
+
].filter(Boolean), h = f.filter(Boolean).join(" ");
|
|
431
|
+
return m.length ? `${h} · ${m.join(" · ")}` : h;
|
|
434
432
|
}
|
|
435
|
-
function
|
|
436
|
-
let n = e.getStats({ onError: "ignore" }), r = n.getTypedCounts(), i = [], a = r[
|
|
433
|
+
function Se(e, t = 3) {
|
|
434
|
+
let n = e.getStats({ onError: "ignore" }), r = n.getTypedCounts(), i = [], a = r[_.Number] ?? 0;
|
|
437
435
|
if (a > 0) {
|
|
438
|
-
let t =
|
|
436
|
+
let t = we(e), r = [Te(n, t.format), ...Ee(n, t)].filter(Boolean);
|
|
439
437
|
i.push(`Number: ${a} ${r.join(" ")}`.trimEnd());
|
|
440
438
|
}
|
|
441
|
-
let o = r[
|
|
439
|
+
let o = r[_.String] ?? 0;
|
|
442
440
|
if (o > 0) {
|
|
443
|
-
let e =
|
|
441
|
+
let e = De(n, t, (e) => typeof e == "string");
|
|
444
442
|
i.push(`String: ${o} ${e}`.trimEnd());
|
|
445
443
|
}
|
|
446
|
-
let s = r[
|
|
444
|
+
let s = r[_.Boolean] ?? 0;
|
|
447
445
|
if (s > 0) {
|
|
448
|
-
let e =
|
|
446
|
+
let e = De(n, t, (e) => typeof e == "boolean");
|
|
449
447
|
i.push(`Boolean: ${s} ${e}`.trimEnd());
|
|
450
448
|
}
|
|
451
449
|
return i;
|
|
452
450
|
}
|
|
453
|
-
function
|
|
451
|
+
function Ce(e) {
|
|
454
452
|
let t = 0;
|
|
455
453
|
return e.forEach((e, n) => {
|
|
456
|
-
n.getInteropType() ===
|
|
454
|
+
n.getInteropType() === h.Date && t++;
|
|
457
455
|
}), t;
|
|
458
456
|
}
|
|
459
|
-
function
|
|
460
|
-
let t = (e) => e.getStats({ onError: "ignore" }).getTypedCounts()[
|
|
461
|
-
for (let i of e.getRegions(
|
|
457
|
+
function we(e) {
|
|
458
|
+
let t = (e) => e.getStats({ onError: "ignore" }).getTypedCounts()[_.Number] ?? 0, n = /* @__PURE__ */ new Map(), r = 0;
|
|
459
|
+
for (let i of e.getRegions(N.NumberFormat)) {
|
|
462
460
|
let e = i.getRange().getStyle().getNumberFormat(), a = t(i.getRange());
|
|
463
461
|
r += a, e && a > 0 && n.set(e, (n.get(e) ?? 0) + a);
|
|
464
462
|
}
|
|
@@ -469,7 +467,7 @@ function ye(e) {
|
|
|
469
467
|
format: null,
|
|
470
468
|
mixed: null
|
|
471
469
|
};
|
|
472
|
-
let o =
|
|
470
|
+
let o = g.getEngine(), s = (e) => {
|
|
473
471
|
if (e === "General") return "1";
|
|
474
472
|
let t = o.getFormatInfo(e);
|
|
475
473
|
return t ? `${t.isDate ? "date" : t.scale}` : "1";
|
|
@@ -482,51 +480,51 @@ function ye(e) {
|
|
|
482
480
|
mixed: a.map(([e, t]) => `${e} ${t}`).join(" · ")
|
|
483
481
|
};
|
|
484
482
|
}
|
|
485
|
-
function
|
|
483
|
+
function Te(e, t) {
|
|
486
484
|
let n = e.getAggregates({ onError: "ignore" });
|
|
487
485
|
if (n.min === null || n.max === null) return "";
|
|
488
|
-
let r =
|
|
486
|
+
let r = C(n.min, t), i = C(n.max, t);
|
|
489
487
|
return r === i ? r : `${r} … ${i}`;
|
|
490
488
|
}
|
|
491
|
-
function
|
|
489
|
+
function Ee(e, { format: t, mixed: n }) {
|
|
492
490
|
if (n) return [`mixed formats (${n})`];
|
|
493
491
|
let r = e.getAggregates({ onError: "ignore" }), i = [];
|
|
494
|
-
return r.sum !== null && i.push(`Σ ${
|
|
492
|
+
return r.sum !== null && i.push(`Σ ${C(r.sum, t)}`), r.average !== null && i.push(`x̄ ${C(r.average, t)}`), i;
|
|
495
493
|
}
|
|
496
|
-
function
|
|
494
|
+
function De(e, t, n) {
|
|
497
495
|
let r = e.getFrequencies(n ? { filterFn: n } : void 0), i = r.getUniqueCount();
|
|
498
496
|
if (i === 0) return "";
|
|
499
497
|
if (i === r.getTotalCount()) return `${i} distinct, no repeats`;
|
|
500
498
|
let a = Array.from(r.getValueCounts()).slice(0, t);
|
|
501
499
|
return `${i} unique (${a.map(([e, t]) => `${e} ${t}`).join(" · ")}${i > a.length ? " · …" : ""})`;
|
|
502
500
|
}
|
|
503
|
-
var
|
|
501
|
+
var P = i.Feature, Oe = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), ke = (e, t) => {
|
|
504
502
|
let n = Math.min(e.rowEnd, t.rowEnd) - Math.max(e.rowStart, t.rowStart) + 1;
|
|
505
503
|
if (n <= 0) return 0;
|
|
506
504
|
let r = Math.min(e.colEnd, t.colEnd) - Math.max(e.colStart, t.colStart) + 1;
|
|
507
505
|
return r <= 0 ? 0 : n * r;
|
|
508
|
-
},
|
|
509
|
-
let n = `×${
|
|
510
|
-
return t === "times" || e.styled === e.content ? n : `${n} (+${
|
|
511
|
-
},
|
|
506
|
+
}, Ae = (e) => e.toLocaleString("en-US"), je = (e, t) => {
|
|
507
|
+
let n = `×${Ae(e.content)}`;
|
|
508
|
+
return t === "times" || e.styled === e.content ? n : `${n} (+${Ae(e.styled - e.content)} blank)`;
|
|
509
|
+
}, Me = (t) => {
|
|
512
510
|
if (t.length === 0) return "";
|
|
513
511
|
let n = e.rangeToString(t[0]);
|
|
514
512
|
if (t.length === 1) return n;
|
|
515
513
|
let r = t.length - 1;
|
|
516
514
|
return `${n}, +${r} block${r === 1 ? "" : "s"}`;
|
|
517
515
|
};
|
|
518
|
-
function
|
|
519
|
-
let n = t?.manyDistinct ?? 20, { sorted: r, top: i, rare: a, more: o } =
|
|
516
|
+
function F(e, t) {
|
|
517
|
+
let n = t?.manyDistinct ?? 20, { sorted: r, top: i, rare: a, more: o } = Ne(e, t);
|
|
520
518
|
if (r.length === 0) return "";
|
|
521
519
|
let s = (e) => ((e, t) => {
|
|
522
|
-
let n =
|
|
523
|
-
return `${e.label === t?.hideLabel ? "" : `${e.label} `}${
|
|
520
|
+
let n = Me(e.blocks);
|
|
521
|
+
return `${e.label === t?.hideLabel ? "" : `${e.label} `}${je(e, t?.countStyle ?? "cells")}${n ? ` ${n}` : ""}`;
|
|
524
522
|
})(e, t);
|
|
525
523
|
if (o === 0) return r.map(s).join(" · ");
|
|
526
524
|
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 ` : "";
|
|
527
525
|
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(" · ");
|
|
528
526
|
}
|
|
529
|
-
function
|
|
527
|
+
function Ne(e, t) {
|
|
530
528
|
let n = t?.maxValues ?? 8, r = [...e].sort((e, t) => t.content - e.content || t.styled - e.styled || (e.label < t.label ? -1 : 1));
|
|
531
529
|
if (r.length <= n) return {
|
|
532
530
|
sorted: r,
|
|
@@ -543,97 +541,97 @@ function Oe(e, t) {
|
|
|
543
541
|
more: r.length - a.length - o.length
|
|
544
542
|
};
|
|
545
543
|
}
|
|
546
|
-
var
|
|
544
|
+
var Pe = [
|
|
547
545
|
{
|
|
548
546
|
name: "family",
|
|
549
|
-
project: (e, t) =>
|
|
547
|
+
project: (e, t) => I(e.getFont().getFamily(), t?.getFont().getFamily())
|
|
550
548
|
},
|
|
551
549
|
{
|
|
552
550
|
name: "size",
|
|
553
|
-
project: (e, t) =>
|
|
551
|
+
project: (e, t) => I(e.getFont().getSize(), t?.getFont().getSize(), (e) => `${e}pt`)
|
|
554
552
|
},
|
|
555
553
|
{
|
|
556
554
|
name: "bold",
|
|
557
|
-
project: (e, t) =>
|
|
555
|
+
project: (e, t) => I(e.getFont().getBold(), t?.getFont().getBold() ?? !1, (e) => e ? "bold" : "not bold")
|
|
558
556
|
},
|
|
559
557
|
{
|
|
560
558
|
name: "italic",
|
|
561
|
-
project: (e, t) =>
|
|
559
|
+
project: (e, t) => I(e.getFont().getItalic(), t?.getFont().getItalic() ?? !1, (e) => e ? "italic" : "not italic")
|
|
562
560
|
},
|
|
563
561
|
{
|
|
564
562
|
name: "underline",
|
|
565
|
-
project: (e, t) =>
|
|
563
|
+
project: (e, t) => I(e.getFont().getUnderline(), t?.getFont().getUnderline(), (e) => String(e))
|
|
566
564
|
},
|
|
567
565
|
{
|
|
568
566
|
name: "strike",
|
|
569
|
-
project: (e, t) =>
|
|
567
|
+
project: (e, t) => I(e.getFont().getStrike(), t?.getFont().getStrike() ?? !1, (e) => e ? "strike" : "not strike")
|
|
570
568
|
},
|
|
571
569
|
{
|
|
572
570
|
name: "color",
|
|
573
|
-
project: (e, t) =>
|
|
571
|
+
project: (e, t) => I(O(e.getFont().getColor()), t ? O(t.getFont().getColor()) : null)
|
|
574
572
|
}
|
|
575
|
-
],
|
|
573
|
+
], Fe = (e) => He(e) ?? "Custom", Ie = {
|
|
576
574
|
name: "category",
|
|
577
575
|
project: (e) => {
|
|
578
|
-
let t =
|
|
579
|
-
return t === null ? null :
|
|
576
|
+
let t = ie(e);
|
|
577
|
+
return t === null ? null : Fe(t);
|
|
580
578
|
}
|
|
581
|
-
},
|
|
579
|
+
}, Le = {
|
|
582
580
|
name: "format",
|
|
583
|
-
project: (e) =>
|
|
584
|
-
},
|
|
581
|
+
project: (e) => ie(e)
|
|
582
|
+
}, Re = [Ie, Le], ze = [{
|
|
585
583
|
name: "color",
|
|
586
|
-
project: (e) =>
|
|
587
|
-
}],
|
|
584
|
+
project: (e) => k(e)
|
|
585
|
+
}], Be = [{
|
|
588
586
|
name: "edges",
|
|
589
|
-
project: (e) =>
|
|
590
|
-
}],
|
|
587
|
+
project: (e) => A(e)
|
|
588
|
+
}], Ve = [
|
|
591
589
|
{
|
|
592
590
|
name: "h",
|
|
593
591
|
ambiguous: !0,
|
|
594
|
-
project: (e, t) =>
|
|
592
|
+
project: (e, t) => I(e.getAlignment().getHorizontal(), t?.getAlignment().getHorizontal())
|
|
595
593
|
},
|
|
596
594
|
{
|
|
597
595
|
name: "v",
|
|
598
596
|
ambiguous: !0,
|
|
599
|
-
project: (e, t) =>
|
|
597
|
+
project: (e, t) => I(e.getAlignment().getVertical(), t?.getAlignment().getVertical())
|
|
600
598
|
},
|
|
601
599
|
{
|
|
602
600
|
name: "overflow",
|
|
603
|
-
project: (e, t) =>
|
|
601
|
+
project: (e, t) => I(e.getAlignment().getOverflow(), t?.getAlignment().getOverflow())
|
|
604
602
|
},
|
|
605
603
|
{
|
|
606
604
|
name: "indent",
|
|
607
|
-
project: (e, t) =>
|
|
605
|
+
project: (e, t) => I(e.getAlignment().getIndent(), t?.getAlignment().getIndent() ?? 0, (e) => `indent ${e}`)
|
|
608
606
|
},
|
|
609
607
|
{
|
|
610
608
|
name: "rotation",
|
|
611
|
-
project: (e, t) =>
|
|
609
|
+
project: (e, t) => I(e.getAlignment().getRotation(), t?.getAlignment().getRotation() ?? 0, (e) => `rotation ${e}`)
|
|
612
610
|
}
|
|
613
611
|
];
|
|
614
|
-
function
|
|
612
|
+
function I(e, t, n = String) {
|
|
615
613
|
return e == null || t !== void 0 && e === t ? null : n(e);
|
|
616
614
|
}
|
|
617
|
-
function
|
|
615
|
+
function He(e) {
|
|
618
616
|
if (!e || e === "General") return null;
|
|
619
|
-
let t =
|
|
617
|
+
let t = g.Builder.parse(e);
|
|
620
618
|
if (t.category === "General") return null;
|
|
621
619
|
let n = t.decimalPlaces;
|
|
622
620
|
return n == null ? t.category : `${t.category} ${n}dp`;
|
|
623
621
|
}
|
|
624
|
-
var
|
|
625
|
-
[
|
|
626
|
-
[
|
|
627
|
-
[
|
|
628
|
-
[
|
|
629
|
-
[
|
|
630
|
-
},
|
|
631
|
-
function
|
|
632
|
-
let i =
|
|
622
|
+
var Ue = {
|
|
623
|
+
[P.Font]: Pe,
|
|
624
|
+
[P.NumberFormat]: Re,
|
|
625
|
+
[P.Fill]: ze,
|
|
626
|
+
[P.Borders]: Be,
|
|
627
|
+
[P.Alignment]: Ve
|
|
628
|
+
}, We = (e) => e in Ue;
|
|
629
|
+
function Ge(e, t, n, r) {
|
|
630
|
+
let i = Ue[t];
|
|
633
631
|
if (!i) return null;
|
|
634
632
|
let a = e.getEntireCoords(), o = e.getUsedRange()?.getCoords() ?? null, s = [...e.getEntireRange().getRegions(t)];
|
|
635
633
|
if (s.length === 0) return null;
|
|
636
|
-
let c = r?.content ?? (o ? [...e.getEntireRange().getRegions(
|
|
634
|
+
let c = r?.content ?? (o ? [...e.getEntireRange().getRegions(P.Contentful)].map((e) => e.getCoords()) : []), l = (e) => c.reduce((t, n) => t + ke(e, n), 0), u = (e) => o ? ke(e, o) : 0, d = (e) => {
|
|
637
635
|
let t = e.getRange().getStyle(), r = [];
|
|
638
636
|
for (let e of i) {
|
|
639
637
|
let i = e.project(t, n);
|
|
@@ -648,7 +646,7 @@ function Be(e, t, n, r) {
|
|
|
648
646
|
2 * (t.rowEnd - t.rowStart + 1) > m ? g.push(e) : 2 * (t.colEnd - t.colStart + 1) > h ? _.push(e) : v.push(e);
|
|
649
647
|
}
|
|
650
648
|
let y = [];
|
|
651
|
-
y.push(...
|
|
649
|
+
y.push(...Qe("columns", g, d, a, !0)), y.push(...Qe("rows", _, d, a, !1));
|
|
652
650
|
let b = v.reduce((e, t) => e + u(t.getCoords()), 0), x = (e) => {
|
|
653
651
|
let t = [];
|
|
654
652
|
for (let r of v) {
|
|
@@ -690,31 +688,31 @@ function Be(e, t, n, r) {
|
|
|
690
688
|
}
|
|
691
689
|
return [...r.values()].map((e) => ({
|
|
692
690
|
...e,
|
|
693
|
-
blocks: e.blocks.sort((e, t) =>
|
|
691
|
+
blocks: e.blocks.sort((e, t) => Oe(t) - Oe(e))
|
|
694
692
|
}));
|
|
695
693
|
}, S = [];
|
|
696
|
-
if (t ===
|
|
697
|
-
let { top: r, rare: i, more: a } =
|
|
694
|
+
if (t === P.NumberFormat) S.push(...function(e, t, n) {
|
|
695
|
+
let { top: r, rare: i, more: a } = Ne(e, n), o = [], s = -1;
|
|
698
696
|
for (let e of [...r, ...i]) {
|
|
699
697
|
e === i[0] && (s = o.length);
|
|
700
|
-
let n =
|
|
698
|
+
let n = Ne(t.filter((t) => Fe(t.label) === e.label), { maxValues: Infinity }).sorted, r = n.length === 1;
|
|
701
699
|
if (o.push([
|
|
702
700
|
e.label,
|
|
703
|
-
|
|
704
|
-
|
|
701
|
+
je(e, "cells"),
|
|
702
|
+
Me(e.blocks),
|
|
705
703
|
r ? n[0].label : `${n.length} formats`
|
|
706
704
|
]), !r) {
|
|
707
|
-
for (let e of n.slice(0,
|
|
705
|
+
for (let e of n.slice(0, Ze)) o.push([
|
|
708
706
|
"",
|
|
709
|
-
|
|
710
|
-
|
|
707
|
+
je(e, "cells"),
|
|
708
|
+
Me(e.blocks),
|
|
711
709
|
e.label
|
|
712
710
|
]);
|
|
713
|
-
n.length >
|
|
711
|
+
n.length > Ze && o.push([
|
|
714
712
|
"",
|
|
715
713
|
"",
|
|
716
714
|
"",
|
|
717
|
-
`…and ${n.length -
|
|
715
|
+
`…and ${n.length - Ze} more`
|
|
718
716
|
]);
|
|
719
717
|
}
|
|
720
718
|
}
|
|
@@ -724,25 +722,25 @@ function Be(e, t, n, r) {
|
|
|
724
722
|
2
|
|
725
723
|
].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());
|
|
726
724
|
return a > 0 && l.splice(s < 0 ? l.length : s, 0, `…and ${a} more${n?.recovery ? ` · ${n.recovery}` : ""}`), l;
|
|
727
|
-
}(x(
|
|
725
|
+
}(x(Ie), x(Le), r));
|
|
728
726
|
else for (let e of i) {
|
|
729
727
|
let t = x(e);
|
|
730
728
|
if (t.length === 0) continue;
|
|
731
|
-
let n =
|
|
729
|
+
let n = F(t, {
|
|
732
730
|
...r,
|
|
733
731
|
hideLabel: e.name
|
|
734
732
|
});
|
|
735
|
-
n.length <=
|
|
733
|
+
n.length <= Ye ? S.push(`${e.name.padEnd(10)}${n}`) : S.push(...Xe(e.name, t, r));
|
|
736
734
|
}
|
|
737
735
|
return {
|
|
738
736
|
distinct: f.size,
|
|
739
737
|
cells: b,
|
|
740
|
-
normal: n ?
|
|
738
|
+
normal: n ? Je(t, n) : null,
|
|
741
739
|
tiers: y,
|
|
742
740
|
attributes: S
|
|
743
741
|
};
|
|
744
742
|
}
|
|
745
|
-
function
|
|
743
|
+
function Ke(e, t) {
|
|
746
744
|
if (e.length === 0) return null;
|
|
747
745
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = 0;
|
|
748
746
|
for (let t of e) {
|
|
@@ -768,7 +766,7 @@ function Ve(e, t) {
|
|
|
768
766
|
label: e.label,
|
|
769
767
|
content: e.cells,
|
|
770
768
|
styled: e.cells,
|
|
771
|
-
blocks: e.blocks.sort((e, t) =>
|
|
769
|
+
blocks: e.blocks.sort((e, t) => Oe(t) - Oe(e))
|
|
772
770
|
})), s = [...r.entries()].map(([e, t]) => ({
|
|
773
771
|
label: e,
|
|
774
772
|
content: t,
|
|
@@ -782,10 +780,10 @@ function Ve(e, t) {
|
|
|
782
780
|
blocks: []
|
|
783
781
|
}), {
|
|
784
782
|
distinct: n.size,
|
|
785
|
-
lines: [`${"distinct".padEnd(10)}${
|
|
783
|
+
lines: [`${"distinct".padEnd(10)}${F(o, a)}`, `${"functions".padEnd(10)}${F(s, a)}`]
|
|
786
784
|
};
|
|
787
785
|
}
|
|
788
|
-
function
|
|
786
|
+
function qe(e, t) {
|
|
789
787
|
let n = e.getStats({ onError: "ignore" }).getTypedCounts(), r = /* @__PURE__ */ new Map(), i = [
|
|
790
788
|
["number", "number"],
|
|
791
789
|
["string", "text"],
|
|
@@ -797,7 +795,7 @@ function He(e, t) {
|
|
|
797
795
|
let i = n[e] ?? 0;
|
|
798
796
|
i > 0 && r.set(t, i);
|
|
799
797
|
}
|
|
800
|
-
let a =
|
|
798
|
+
let a = Ce(e), o = 0;
|
|
801
799
|
for (let e of t) {
|
|
802
800
|
let t = e.getRange().getStats({ onError: "ignore" }).getTypedCounts();
|
|
803
801
|
o += e.getRowCount() * e.getColumnCount();
|
|
@@ -805,42 +803,42 @@ function He(e, t) {
|
|
|
805
803
|
let i = t[e] ?? 0;
|
|
806
804
|
i > 0 && r.set(n, (r.get(n) ?? 0) - i);
|
|
807
805
|
}
|
|
808
|
-
a > 0 && (t.number ?? 0) > 0 && (a -=
|
|
806
|
+
a > 0 && (t.number ?? 0) > 0 && (a -= Ce(e.getRange()));
|
|
809
807
|
}
|
|
810
808
|
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]);
|
|
811
809
|
}
|
|
812
|
-
function
|
|
810
|
+
function Je(e, t) {
|
|
813
811
|
switch (e) {
|
|
814
|
-
case
|
|
815
|
-
let t = e.getFont(), n = [t.getFamily(), `${t.getSize()}pt`], r =
|
|
812
|
+
case P.Font: return function(e) {
|
|
813
|
+
let t = e.getFont(), n = [t.getFamily(), `${t.getSize()}pt`], r = O(t.getColor());
|
|
816
814
|
return r && n.push(r), t.getBold() && n.push("bold"), t.getItalic() && n.push("italic"), n.join(" · ");
|
|
817
815
|
}(t);
|
|
818
|
-
case
|
|
819
|
-
let e =
|
|
820
|
-
return e === null ? null : `${
|
|
816
|
+
case P.NumberFormat: {
|
|
817
|
+
let e = ie(t);
|
|
818
|
+
return e === null ? null : `${Fe(e)} ${e}`;
|
|
821
819
|
}
|
|
822
|
-
case
|
|
823
|
-
case
|
|
824
|
-
case
|
|
820
|
+
case P.Fill: return k(t);
|
|
821
|
+
case P.Borders: return A(t);
|
|
822
|
+
case P.Alignment: {
|
|
825
823
|
let e = t.getAlignment(), n = [];
|
|
826
824
|
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;
|
|
827
825
|
}
|
|
828
826
|
default: return null;
|
|
829
827
|
}
|
|
830
828
|
}
|
|
831
|
-
var
|
|
832
|
-
function
|
|
833
|
-
let { sorted: r, top: i, rare: a, more: o } =
|
|
834
|
-
|
|
835
|
-
|
|
829
|
+
var Ye = 110;
|
|
830
|
+
function Xe(e, t, n) {
|
|
831
|
+
let { sorted: r, top: i, rare: a, more: o } = Ne(t, n), s = [...i, ...a].map((e) => [
|
|
832
|
+
je(e, "cells"),
|
|
833
|
+
Me(e.blocks),
|
|
836
834
|
e.label
|
|
837
835
|
]), 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]}`);
|
|
838
836
|
o > 0 && l.splice(i.length, 0, ` …and ${o} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
|
|
839
837
|
let u = n?.manyDistinct ?? 20;
|
|
840
838
|
return [r.length > u ? `${e.padEnd(10)}${r.length} distinct` : e, ...l];
|
|
841
839
|
}
|
|
842
|
-
var
|
|
843
|
-
function
|
|
840
|
+
var Ze = 6;
|
|
841
|
+
function Qe(t, n, r, i, a) {
|
|
844
842
|
if (n.length === 0) return [];
|
|
845
843
|
let o = /* @__PURE__ */ new Map();
|
|
846
844
|
for (let e of n) {
|
|
@@ -859,20 +857,20 @@ function qe(t, n, r, i, a) {
|
|
|
859
857
|
}
|
|
860
858
|
return c;
|
|
861
859
|
}
|
|
862
|
-
var
|
|
860
|
+
var $e = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, et = (e) => {
|
|
863
861
|
if (!e) return null;
|
|
864
|
-
if (typeof e != "string") return
|
|
862
|
+
if (typeof e != "string") return O(e);
|
|
865
863
|
let t = e.replace(/^#/, "");
|
|
866
864
|
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;
|
|
867
|
-
},
|
|
865
|
+
}, tt = (e) => {
|
|
868
866
|
if (!e) return null;
|
|
869
867
|
let t = [], n = ((e) => {
|
|
870
868
|
if (!e) return null;
|
|
871
|
-
if (typeof e == "string") return
|
|
869
|
+
if (typeof e == "string") return et(e);
|
|
872
870
|
let t = e.type;
|
|
873
871
|
if (t === c.Type.None) return null;
|
|
874
872
|
if (t === c.Type.Gradient) return "gradient";
|
|
875
|
-
let n = e, r =
|
|
873
|
+
let n = e, r = et(n.foreground ?? e.color ?? n.background), i = n.patternType;
|
|
876
874
|
return [i && i !== c.BuiltInSheetPattern.Solid ? `${i} pattern` : null, r].filter(Boolean).join(" ") || null;
|
|
877
875
|
})(e.fill);
|
|
878
876
|
n && t.push(`fill ${n}`);
|
|
@@ -880,97 +878,97 @@ var Je = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, R = (e) => {
|
|
|
880
878
|
if (r) {
|
|
881
879
|
let e = [];
|
|
882
880
|
(r.weight === void 0 ? !0 === r.bold : r.weight >= 600) && e.push("bold"), (r.style === void 0 ? !0 === r.italic : r.style === l.Style.Italic) && e.push("italic"), r.strike && e.push("strike"), r.underline && r.underline !== l.UnderlineStyle.None && e.push(`underline ${r.underline}`);
|
|
883
|
-
let n = r.color === "auto" ? null :
|
|
881
|
+
let n = r.color === "auto" ? null : et(r.color);
|
|
884
882
|
n && e.push(`text ${n}`), e.length > 0 && t.push(e.join(" "));
|
|
885
883
|
}
|
|
886
884
|
if (e.numberFormat !== void 0 && e.numberFormat !== null) {
|
|
887
|
-
let n = typeof e.numberFormat == "number" ?
|
|
885
|
+
let n = typeof e.numberFormat == "number" ? g.resolve(e.numberFormat) : String(e.numberFormat);
|
|
888
886
|
n && t.push(n);
|
|
889
887
|
}
|
|
890
888
|
return e.borders && t.push("border"), e.alignment && t.push("alignment"), t.length > 0 ? t.join(" · ") : null;
|
|
891
|
-
},
|
|
892
|
-
let t = e.type ?? o.ColorStopType.Num, n = e.value, r = n == null || n === "" ? t : `${t} ${n}`, i =
|
|
889
|
+
}, nt = (e) => {
|
|
890
|
+
let t = e.type ?? o.ColorStopType.Num, n = e.value, r = n == null || n === "" ? t : `${t} ${n}`, i = et(e.color);
|
|
893
891
|
return i ? `${r} ${i}` : r;
|
|
894
|
-
},
|
|
892
|
+
}, rt = (e) => {
|
|
895
893
|
let t = e.type;
|
|
896
894
|
if (e.type === o.ScaleType.DataBar) {
|
|
897
|
-
let n =
|
|
895
|
+
let n = et(e.color);
|
|
898
896
|
n && (t += ` ${n}`);
|
|
899
897
|
} else e.type === o.ScaleType.IconSet && (e.iconSet && (t += ` ${e.iconSet}`), e.reverse && (t += " reversed"), e.icon?.length && (t += " custom icons"));
|
|
900
|
-
let n = (e.stops ?? []).map(
|
|
898
|
+
let n = (e.stops ?? []).map(nt).join(" → ");
|
|
901
899
|
return n ? `${t} · ${n}` : t;
|
|
902
|
-
},
|
|
900
|
+
}, it = "(no rule)", at = (e) => {
|
|
903
901
|
let t = e.getScale(), n = [];
|
|
904
|
-
if (t) n.push(
|
|
902
|
+
if (t) n.push(rt(t));
|
|
905
903
|
else {
|
|
906
|
-
n.push(e.getCondition()?.toString() ||
|
|
907
|
-
let t =
|
|
904
|
+
n.push(e.getCondition()?.toString() || it);
|
|
905
|
+
let t = tt(e.getStyle());
|
|
908
906
|
t && n.push(`→ ${t}`);
|
|
909
907
|
}
|
|
910
|
-
return e.isStopIfTrue() && n.push("· stop if true"),
|
|
911
|
-
},
|
|
912
|
-
let t = [e.getCondition()?.toString() ||
|
|
913
|
-
return n && t.push(n), e.isIncludeBlanks() && t.push("blanks allowed"), e.isHideDropdown() && t.push("no dropdown"),
|
|
914
|
-
},
|
|
908
|
+
return e.isStopIfTrue() && n.push("· stop if true"), $e(n.join(" "), 90);
|
|
909
|
+
}, ot = (e) => {
|
|
910
|
+
let t = [e.getCondition()?.toString() || it], n = e.getAlertStyle();
|
|
911
|
+
return n && t.push(n), e.isIncludeBlanks() && t.push("blanks allowed"), e.isHideDropdown() && t.push("no dropdown"), $e(t.join(" · "), 90);
|
|
912
|
+
}, st = (e) => {
|
|
915
913
|
if (e?.getOperator()?.getName() !== a.BuiltInOperatorNames.InSet) return null;
|
|
916
914
|
let t = e.getParam()?.items;
|
|
917
915
|
if (!t) return null;
|
|
918
916
|
if (typeof t == "string") return t;
|
|
919
|
-
let n = t.slice(0, 20).map((e) =>
|
|
917
|
+
let n = t.slice(0, 20).map((e) => T(e)?.match ?? ""), r = t.length - n.length;
|
|
920
918
|
return r > 0 ? `${n.join(", ")}, +${r} more` : n.join(", ");
|
|
921
|
-
},
|
|
919
|
+
}, ct = (e, t) => {
|
|
922
920
|
if (e.length === 0) return null;
|
|
923
921
|
let n = e.slice(0, 3).map(t), r = e.length - n.length;
|
|
924
922
|
return r > 0 ? `${n.join(" | ")} | +${r} more` : n.join(" | ");
|
|
925
|
-
},
|
|
926
|
-
function
|
|
923
|
+
}, L = i.Feature, R = (e) => e.getRange().getStyle(), lt = (e) => w(e.getCell(), x.Mode.Display)?.display ?? null;
|
|
924
|
+
function ut(e, t) {
|
|
927
925
|
switch (e) {
|
|
928
|
-
case
|
|
929
|
-
case
|
|
930
|
-
case
|
|
931
|
-
let t =
|
|
926
|
+
case L.Formula: return (e) => e.getCell().getFormulaText();
|
|
927
|
+
case L.Error: return lt;
|
|
928
|
+
case L.CalcError: return (e) => {
|
|
929
|
+
let t = lt(e) ?? "", n = e.getCell().getFormulaText();
|
|
932
930
|
return (n ? `${t} ${n}` : t).trim() || null;
|
|
933
931
|
};
|
|
934
|
-
case
|
|
935
|
-
case
|
|
932
|
+
case L.Merge: return lt;
|
|
933
|
+
case L.Comments: return (e) => {
|
|
936
934
|
let t = e.getCell().getComments()?.getContent();
|
|
937
935
|
if (typeof t != "string") return null;
|
|
938
936
|
let n = t.replace(/\s+/g, " ").trim();
|
|
939
937
|
return n ? n.length > 60 ? `${n.slice(0, 59)}…` : n : null;
|
|
940
938
|
};
|
|
941
|
-
case
|
|
942
|
-
case
|
|
943
|
-
case
|
|
944
|
-
case
|
|
945
|
-
case
|
|
946
|
-
case
|
|
947
|
-
case
|
|
948
|
-
case
|
|
949
|
-
case
|
|
950
|
-
let t =
|
|
939
|
+
case L.Spills: return (e) => e.getCell().getSpill()?.getValuesRange().toString() ?? null;
|
|
940
|
+
case L.Hyperlink: return (e) => e.getCell().getHyperlink()?.getAddress() ?? null;
|
|
941
|
+
case L.Table: return (e) => e.getCell().getTable()?.getName() ?? null;
|
|
942
|
+
case L.Fill: return (e) => k(R(e));
|
|
943
|
+
case L.Borders: return (e) => A(R(e));
|
|
944
|
+
case L.NumberFormat: return (e) => ie(R(e));
|
|
945
|
+
case L.Alignment: return t ? (e) => ae(R(e), t) : void 0;
|
|
946
|
+
case L.Font: return t ? (e) => oe(R(e), t) : void 0;
|
|
947
|
+
case L.Protection: return (e) => {
|
|
948
|
+
let t = R(e).getProtection(), n = [];
|
|
951
949
|
return t.isAlwaysUnlocked() && n.push("always unlocked"), t.isShowFormulas() || n.push("formulas hidden"), n.join(", ") || null;
|
|
952
950
|
};
|
|
953
|
-
case
|
|
951
|
+
case L.Unlock: return (e) => {
|
|
954
952
|
let t = [];
|
|
955
953
|
e.getCell().getProtection().isAlwaysUnlocked() && t.push("always unlocked");
|
|
956
954
|
let n = e.getRange();
|
|
957
955
|
for (let e of n.getSheet().getProtectedRanges().getItems({ address: n })) t.push(`range ${e.getName()}${e.isUnlocked() ? "" : " · password"}`);
|
|
958
956
|
return t.join(", ") || null;
|
|
959
957
|
};
|
|
960
|
-
case
|
|
961
|
-
case
|
|
962
|
-
case
|
|
958
|
+
case L.Conditionals: return (e) => ct(e.getRange().getConditionalFormats(), at);
|
|
959
|
+
case L.DataValidations: return (e) => ct(e.getRange().getDataValidations(), ot);
|
|
960
|
+
case L.Contentful: return (e) => Se(e.getRange()).join(" ") || null;
|
|
963
961
|
default: return;
|
|
964
962
|
}
|
|
965
963
|
}
|
|
966
|
-
function
|
|
967
|
-
let n = e.map((e) =>
|
|
964
|
+
function dt(e, t) {
|
|
965
|
+
let n = e.map((e) => ut(e, t)).filter((e) => !!e);
|
|
968
966
|
if (n.length !== 0) return n.length === 1 ? n[0] : (e) => {
|
|
969
967
|
let t = n.map((t) => t(e)).filter(Boolean);
|
|
970
968
|
return t.length > 0 ? t.join(" ") : null;
|
|
971
969
|
};
|
|
972
970
|
}
|
|
973
|
-
var
|
|
971
|
+
var z = class {
|
|
974
972
|
constructor() {
|
|
975
973
|
this._lines = [], this._headingOffset = 0;
|
|
976
974
|
}
|
|
@@ -1011,7 +1009,7 @@ var V = class {
|
|
|
1011
1009
|
return `\`\`\`${t}\n${e}\n\`\`\``;
|
|
1012
1010
|
}
|
|
1013
1011
|
beginFrame(e) {
|
|
1014
|
-
return new
|
|
1012
|
+
return new ft(this, e);
|
|
1015
1013
|
}
|
|
1016
1014
|
_addLines(e) {
|
|
1017
1015
|
this._lines.push(...e);
|
|
@@ -1019,7 +1017,7 @@ var V = class {
|
|
|
1019
1017
|
toLines() {
|
|
1020
1018
|
return [...this._lines];
|
|
1021
1019
|
}
|
|
1022
|
-
},
|
|
1020
|
+
}, ft = class {
|
|
1023
1021
|
constructor(e, t) {
|
|
1024
1022
|
this._parent = e, this._headers = t, this._indexWidth = 0, this._rows = [], this._colWidths = t.map((e) => e.length);
|
|
1025
1023
|
}
|
|
@@ -1046,28 +1044,28 @@ var V = class {
|
|
|
1046
1044
|
_renderLines() {
|
|
1047
1045
|
let e = this._indexWidth > 0 ? " ".repeat(this._indexWidth) : "", t = this._colWidths.map((e, t) => this._columnAlignment(t)), n = [];
|
|
1048
1046
|
if (this._headers.some((e) => e.length > 0)) {
|
|
1049
|
-
let r = this._headers.map((e, n) =>
|
|
1047
|
+
let r = this._headers.map((e, n) => pt(e, this._colWidths[n], t[n])).join(" ");
|
|
1050
1048
|
n.push(`${e}${e ? " " : ""}${r}`.trimEnd());
|
|
1051
1049
|
}
|
|
1052
1050
|
for (let e of this._rows) {
|
|
1053
|
-
let t = e.cells.map((e, t) =>
|
|
1051
|
+
let t = e.cells.map((e, t) => pt(e.text, this._colWidths[t], e.alignment)).join(" "), r = this._indexWidth > 0 ? (e.index ?? "").padStart(this._indexWidth) + " " : "";
|
|
1054
1052
|
n.push(`${r}${t}`.trimEnd());
|
|
1055
1053
|
}
|
|
1056
1054
|
return n;
|
|
1057
1055
|
}
|
|
1058
|
-
},
|
|
1056
|
+
}, pt = (e, t, n) => {
|
|
1059
1057
|
if (e.length >= t) return e;
|
|
1060
1058
|
let r = t - e.length;
|
|
1061
1059
|
return n === "right" ? e.padStart(t) : n === "center" ? " ".repeat(Math.floor(r / 2)) + e + " ".repeat(Math.ceil(r / 2)) : e.padEnd(t);
|
|
1062
1060
|
};
|
|
1063
|
-
function
|
|
1064
|
-
let r =
|
|
1061
|
+
function mt(e, t, n) {
|
|
1062
|
+
let r = D(t.length, n?.maxRegions ?? 200), i = t.length > r ? t.slice(0, r) : t, a = i.length < t.length;
|
|
1065
1063
|
if (i.length === 0) return void e.text("None");
|
|
1066
1064
|
let o = i.map((e) => e.toString()), s = Math.max(...o.map((e) => e.length)), c = i.map((e) => `${e.getRowCount()}×${e.getColumnCount()}`), l = Math.max(...c.map((e) => e.length)), u = n?.profile ? n?.maxProfiled ?? 12 : 0;
|
|
1067
1065
|
for (let t = 0; t < i.length; t++) {
|
|
1068
1066
|
let r = i[t], a = n?.payload?.(r), d = r.isClipped() ? " ✂ clipped at the query edge — the block continues" : "", f = ` ${o[t].padEnd(s)} ${c[t].padEnd(l)}`;
|
|
1069
1067
|
if (t < u) {
|
|
1070
|
-
let t =
|
|
1068
|
+
let t = ue(r, n);
|
|
1071
1069
|
if (e.text(`${f} ${t.summary}${d}`), !1 === n?.series) continue;
|
|
1072
1070
|
for (let n of t.series) e.text(` ${n}`);
|
|
1073
1071
|
continue;
|
|
@@ -1079,21 +1077,21 @@ function ct(e, t, n) {
|
|
|
1079
1077
|
e.text(` …truncated at ${r} of ${t.length} regions · ${i}`);
|
|
1080
1078
|
}
|
|
1081
1079
|
}
|
|
1082
|
-
function
|
|
1083
|
-
let n = [...e], r = e.getFeatures(), a = r.join(", "), o = r.length === 1 && r[0] === i.Feature.Contentful, s = e.getRange().getSheet().getWorkbook()?.getStyles().getNormal() ?? null, c = new
|
|
1084
|
-
return c.h1(`Regions — ${a} (${n.length})`),
|
|
1080
|
+
function ht(e, t) {
|
|
1081
|
+
let n = [...e], r = e.getFeatures(), a = r.join(", "), o = r.length === 1 && r[0] === i.Feature.Contentful, s = e.getRange().getSheet().getWorkbook()?.getStyles().getNormal() ?? null, c = new z();
|
|
1082
|
+
return c.h1(`Regions — ${a} (${n.length})`), mt(c, n, {
|
|
1085
1083
|
...t,
|
|
1086
1084
|
profile: o,
|
|
1087
|
-
payload: o ? void 0 :
|
|
1085
|
+
payload: o ? void 0 : dt(r, s)
|
|
1088
1086
|
}), c.toLines().join("\n").trimEnd();
|
|
1089
1087
|
}
|
|
1090
|
-
function
|
|
1088
|
+
function gt(e, t = []) {
|
|
1091
1089
|
let n = [...t], r = e.getDescription();
|
|
1092
1090
|
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"]);
|
|
1093
1091
|
let i = Math.max(10, ...n.map(([e]) => e.length + 2));
|
|
1094
1092
|
return n.map(([e, t]) => `${e.padEnd(i)}${t}`);
|
|
1095
1093
|
}
|
|
1096
|
-
function
|
|
1094
|
+
function _t(e, t, n) {
|
|
1097
1095
|
if (t.length === 0) return;
|
|
1098
1096
|
let r = t.map((e) => {
|
|
1099
1097
|
let t = e.getRange();
|
|
@@ -1106,44 +1104,44 @@ function dt(e, t, n) {
|
|
|
1106
1104
|
e.h2(`Tables (${n} cell${n === 1 ? "" : "s"} · ${t.length} table${t.length === 1 ? "" : "s"})`);
|
|
1107
1105
|
for (let t of r) {
|
|
1108
1106
|
e.text(` ${t.address.padEnd(i)} ${t.size.padEnd(a)} ${t.table.getName()}`);
|
|
1109
|
-
for (let n of
|
|
1107
|
+
for (let n of gt(t.table)) e.text(` ${n}`);
|
|
1110
1108
|
}
|
|
1111
1109
|
e.blank();
|
|
1112
1110
|
}
|
|
1113
|
-
function
|
|
1114
|
-
let t = new
|
|
1115
|
-
return t.h1(`Table — ${e.getName()}`), t.fact(
|
|
1116
|
-
}
|
|
1117
|
-
var
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
],
|
|
1135
|
-
function
|
|
1136
|
-
let t = new Map(Object.values(
|
|
1111
|
+
function vt(e) {
|
|
1112
|
+
let t = new z();
|
|
1113
|
+
return t.h1(`Table — ${e.getName()}`), t.fact(gt(e, [["range", Tt(e.getRange())]])), t.toLines().join("\n").trimEnd();
|
|
1114
|
+
}
|
|
1115
|
+
var B = i.Feature, yt = [
|
|
1116
|
+
B.Error,
|
|
1117
|
+
B.CalcError,
|
|
1118
|
+
B.Contentful,
|
|
1119
|
+
B.Formula,
|
|
1120
|
+
B.Spills,
|
|
1121
|
+
B.Merge,
|
|
1122
|
+
B.AutoTable,
|
|
1123
|
+
B.Hyperlink,
|
|
1124
|
+
B.Comments,
|
|
1125
|
+
B.NumberFormat,
|
|
1126
|
+
B.Font,
|
|
1127
|
+
B.Fill,
|
|
1128
|
+
B.Borders,
|
|
1129
|
+
B.Alignment,
|
|
1130
|
+
B.Conditionals,
|
|
1131
|
+
B.DataValidations
|
|
1132
|
+
], bt = new Map(Object.entries(B).map(([e, t]) => [t, e])), xt = (e) => bt.get(e) ?? e;
|
|
1133
|
+
function St(e) {
|
|
1134
|
+
let t = new Map(Object.values(B).map((e) => [e.toLowerCase(), e])), n = [];
|
|
1137
1135
|
for (let r of e.split(",")) {
|
|
1138
1136
|
let e = r.trim();
|
|
1139
1137
|
if (!e) continue;
|
|
1140
1138
|
let i = t.get(e.toLowerCase());
|
|
1141
|
-
if (!i) throw Error(`Unknown feature '${e}'. Features: ${Object.values(
|
|
1139
|
+
if (!i) throw Error(`Unknown feature '${e}'. Features: ${Object.values(B).join(", ")}.`);
|
|
1142
1140
|
n.push(i);
|
|
1143
1141
|
}
|
|
1144
1142
|
return n;
|
|
1145
1143
|
}
|
|
1146
|
-
var
|
|
1144
|
+
var V = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, H = (t) => e.sheetNameToString(t) ?? "Untitled", U = (e) => `wb.getSheet(${JSON.stringify(e.getSheet().getName())})`, Ct = (e) => ((e) => {
|
|
1147
1145
|
if (!e.includes("$")) return e;
|
|
1148
1146
|
let t = "", n = !1;
|
|
1149
1147
|
for (let r of e) {
|
|
@@ -1152,71 +1150,71 @@ var U = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, W =
|
|
|
1152
1150
|
t += r;
|
|
1153
1151
|
}
|
|
1154
1152
|
return t;
|
|
1155
|
-
})(e.getAddress()),
|
|
1156
|
-
let t =
|
|
1157
|
-
return t.includes("!") ? t : `${
|
|
1158
|
-
},
|
|
1153
|
+
})(e.getAddress()), wt = (e) => {
|
|
1154
|
+
let t = Ct(e);
|
|
1155
|
+
return t.includes("!") ? t : `${H(e.getSheet().getName())}!${t}`;
|
|
1156
|
+
}, Tt = (e) => {
|
|
1159
1157
|
let t = e.toString();
|
|
1160
|
-
return `${t.includes("!") ? t : `${
|
|
1158
|
+
return `${t.includes("!") ? t : `${H(e.getSheet().getName())}!${t}`}, ${e.getRowCount()}×${e.getColumnCount()}`;
|
|
1161
1159
|
};
|
|
1162
|
-
function
|
|
1163
|
-
let n =
|
|
1160
|
+
function Et(e, t) {
|
|
1161
|
+
let n = qe(t, [...t.getRegions(B.Formula)]), r = t.getStats({ onError: "ignore" }).getCount();
|
|
1164
1162
|
e.h2(`Kind (${r} cell${r === 1 ? "" : "s"} · ${n.length} kind${n.length === 1 ? "" : "s"})`);
|
|
1165
1163
|
for (let [t, r] of n) e.text(` ${t.padEnd(10)}${r}`);
|
|
1166
1164
|
n.length === 0 && e.fact("None"), e.blank();
|
|
1167
1165
|
}
|
|
1168
|
-
function
|
|
1169
|
-
let r = t.getSheet().getWorkbook()?.getStyles().getNormal() ?? null, i = n?.features === void 0 ? null : new Set(typeof n.features == "string" ? [n.features] : n.features), a =
|
|
1166
|
+
function Dt(e, t, n) {
|
|
1167
|
+
let r = t.getSheet().getWorkbook()?.getStyles().getNormal() ?? null, i = n?.features === void 0 ? null : new Set(typeof n.features == "string" ? [n.features] : n.features), a = yt.filter((e) => !i || i.has(e));
|
|
1170
1168
|
if (a.length === 0) return;
|
|
1171
|
-
let o = t.getCounts(a), s, c = () => s ??= [...t.getSheet().getEntireRange().getRegions(
|
|
1169
|
+
let o = t.getCounts(a), s, c = () => s ??= [...t.getSheet().getEntireRange().getRegions(B.Contentful)].map((e) => e.getCoords());
|
|
1172
1170
|
for (let i of a) {
|
|
1173
|
-
let a = i ===
|
|
1171
|
+
let a = i === B.Contentful ? Ot(t) : [...t.getRegions(i)];
|
|
1174
1172
|
if (a.length === 0) {
|
|
1175
|
-
let t = r && i !==
|
|
1176
|
-
t && (e.h2(`${
|
|
1173
|
+
let t = r && i !== B.Font ? Je(i, r) : null;
|
|
1174
|
+
t && (e.h2(`${xt(i)} (${kt(0, 0)})`), e.text(` ${"normal".padEnd(10)}${t}`), e.blank());
|
|
1177
1175
|
continue;
|
|
1178
1176
|
}
|
|
1179
|
-
let s = !!n?.profile && i ===
|
|
1177
|
+
let s = !!n?.profile && i === B.Contentful, l = `${U(t)}.getRegions(${JSON.stringify(i)})`, u = `${l} lists all ${a.length}`, d = We(i) ? Ge(t.getSheet(), i, r, {
|
|
1180
1178
|
recovery: u,
|
|
1181
1179
|
content: c()
|
|
1182
|
-
}) : null, f = i ===
|
|
1183
|
-
if (e.h2(`${
|
|
1180
|
+
}) : null, f = i === B.Formula ? Ke(a, { recovery: u }) : null, p = d ? `${kt(a.length, d.cells)} · ${d.distinct} distinct` : f ? `${kt(a.length, o[i])} · ${f.distinct} distinct` : kt(a.length, o[i]);
|
|
1181
|
+
if (e.h2(`${xt(i)} (${p})`), d) {
|
|
1184
1182
|
d.normal && e.text(` ${"normal".padEnd(10)}${d.normal}`);
|
|
1185
1183
|
for (let t of d.tiers) e.text(` ${t}`);
|
|
1186
1184
|
for (let t of d.attributes) e.text(` ${t}`);
|
|
1187
1185
|
e.text(` ${"regions".padEnd(10)}${l}`), e.blank();
|
|
1188
1186
|
} else {
|
|
1189
1187
|
if (f) for (let t of f.lines) e.text(` ${t}`);
|
|
1190
|
-
i ===
|
|
1188
|
+
i === B.Contentful && a.sort((e, t) => t.getRowCount() * t.getColumnCount() - e.getRowCount() * e.getColumnCount()), mt(e, a, {
|
|
1191
1189
|
maxRegions: n?.maxRegions,
|
|
1192
1190
|
maxProfiled: n?.maxProfiled,
|
|
1193
1191
|
profile: s,
|
|
1194
1192
|
series: !1,
|
|
1195
|
-
payload: s ? void 0 :
|
|
1193
|
+
payload: s ? void 0 : ut(i, r),
|
|
1196
1194
|
recovery: u
|
|
1197
1195
|
}), e.blank();
|
|
1198
1196
|
}
|
|
1199
1197
|
}
|
|
1200
1198
|
}
|
|
1201
|
-
var
|
|
1199
|
+
var Ot = (e) => [...e.getRegions([B.Contentful, B.Table])].filter((e) => e.getCell().isContentful()), kt = (e, t) => `${t} cell${t === 1 ? "" : "s"} · ${e} region${e === 1 ? "" : "s"}`, At = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, jt = (e) => e.isIFormula ? e : null, Mt = (e) => {
|
|
1202
1200
|
let t = e.getScope();
|
|
1203
|
-
return t ? `${
|
|
1204
|
-
},
|
|
1201
|
+
return t ? `${H(t)}!${e.getName()}` : e.getName();
|
|
1202
|
+
}, Nt = (e) => {
|
|
1205
1203
|
let t = e.getAddress();
|
|
1206
|
-
return t.includes("!") ? t : `${
|
|
1204
|
+
return t.includes("!") ? t : `${H(e.getSheet().getName())}!${t}`;
|
|
1207
1205
|
};
|
|
1208
|
-
async function
|
|
1209
|
-
let t =
|
|
1206
|
+
async function Pt(e) {
|
|
1207
|
+
let t = jt(e), n;
|
|
1210
1208
|
return n = t ? "=" + t.getExpression() : e.getRanges?.()?.getAddress() ?? "", t && await t.isVolatile() && (n += " (volatile)"), n.trim();
|
|
1211
1209
|
}
|
|
1212
|
-
var
|
|
1210
|
+
var Ft = /* @__PURE__ */ new Set([t.Code.Ref, t.Code.Name]), It = (e) => {
|
|
1213
1211
|
let n = e.value, r = typeof n == "string" ? n : n?.error, i = typeof r == "string" ? t.getBuiltInByLabel(r) : void 0;
|
|
1214
|
-
return i &&
|
|
1215
|
-
},
|
|
1212
|
+
return i && Ft.has(i.getCode()) ? i.getCode() === t.Code.Name ? "#NAME?" : "#REF!" : null;
|
|
1213
|
+
}, Lt = /* @__PURE__ */ new Set(), Rt = (e) => {
|
|
1216
1214
|
let t = e.value;
|
|
1217
1215
|
return typeof t == "object" && t?.name ? t.name : e.text ?? "";
|
|
1218
1216
|
};
|
|
1219
|
-
function
|
|
1217
|
+
function zt(e) {
|
|
1220
1218
|
let t = null;
|
|
1221
1219
|
for (let n = 0; n < e.length; n++) {
|
|
1222
1220
|
let r = e[n];
|
|
@@ -1226,12 +1224,12 @@ function Nt(e) {
|
|
|
1226
1224
|
let a = n + 1;
|
|
1227
1225
|
for (; a < e.length && e[a].type === "whitespace";) a++;
|
|
1228
1226
|
if (e[a]?.type !== "separator") continue;
|
|
1229
|
-
let o =
|
|
1227
|
+
let o = Rt(r).toLowerCase();
|
|
1230
1228
|
o && (t ??= /* @__PURE__ */ new Set()).add(o);
|
|
1231
1229
|
}
|
|
1232
|
-
return t ??
|
|
1230
|
+
return t ?? Lt;
|
|
1233
1231
|
}
|
|
1234
|
-
async function
|
|
1232
|
+
async function W(e, t, n) {
|
|
1235
1233
|
if (t.length === 0) return;
|
|
1236
1234
|
let r = /* @__PURE__ */ new Set();
|
|
1237
1235
|
for (let e of n?.symbols ?? t) r.add(e.getName().toLowerCase());
|
|
@@ -1239,17 +1237,17 @@ async function Pt(e, t, n) {
|
|
|
1239
1237
|
for (let e of t) i.set(e.getId(), e), e.getScope() && a.add(e.getName().toLowerCase());
|
|
1240
1238
|
let o = await Promise.all(t.map(async (e) => {
|
|
1241
1239
|
let t = function(e, t) {
|
|
1242
|
-
let n =
|
|
1240
|
+
let n = jt(e), r = [];
|
|
1243
1241
|
if (n) {
|
|
1244
1242
|
let e = n.getTokens(), i = null, a = null;
|
|
1245
1243
|
for (let n of e) {
|
|
1246
1244
|
if (n.type === "error") {
|
|
1247
|
-
a ??=
|
|
1245
|
+
a ??= It(n);
|
|
1248
1246
|
continue;
|
|
1249
1247
|
}
|
|
1250
1248
|
if (n.type !== "named") continue;
|
|
1251
|
-
let o =
|
|
1252
|
-
o && !t.has(o.toLowerCase()) && (i ??=
|
|
1249
|
+
let o = Rt(n);
|
|
1250
|
+
o && !t.has(o.toLowerCase()) && (i ??= zt(e), i.has(o.toLowerCase()) || r.includes(o) || r.push(o));
|
|
1253
1251
|
}
|
|
1254
1252
|
if (a || r.length > 0) return {
|
|
1255
1253
|
broken: !0,
|
|
@@ -1278,7 +1276,7 @@ async function Pt(e, t, n) {
|
|
|
1278
1276
|
missing: r,
|
|
1279
1277
|
error: a ? "#REF!" : ""
|
|
1280
1278
|
};
|
|
1281
|
-
}(e, r), n =
|
|
1279
|
+
}(e, r), n = jt(e), o = n ? await async function(e, t) {
|
|
1282
1280
|
let n = await e.getDirectDependents(), r = 0, i = [], a = /* @__PURE__ */ new Set(), o = [];
|
|
1283
1281
|
if (n) {
|
|
1284
1282
|
let e = n.getCoords(), s = n.getCount();
|
|
@@ -1289,10 +1287,10 @@ async function Pt(e, t, n) {
|
|
|
1289
1287
|
if (a.has(e.getId())) continue;
|
|
1290
1288
|
a.add(e.getId());
|
|
1291
1289
|
let n = t.get(e.getId());
|
|
1292
|
-
i.push(n ?
|
|
1290
|
+
i.push(n ? Mt(n) : e.getName());
|
|
1293
1291
|
} else {
|
|
1294
1292
|
let t = e[c];
|
|
1295
|
-
r += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), o.push(
|
|
1293
|
+
r += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), o.push(Nt(s));
|
|
1296
1294
|
}
|
|
1297
1295
|
}
|
|
1298
1296
|
}
|
|
@@ -1305,7 +1303,7 @@ async function Pt(e, t, n) {
|
|
|
1305
1303
|
for (let e = 0; e < c.length; e++) {
|
|
1306
1304
|
let t = (l.length > 0 ? 2 : 0) + c[e].length;
|
|
1307
1305
|
if (l.length > 0 && u + t > 60) break;
|
|
1308
|
-
l.push(l.length === 0 ?
|
|
1306
|
+
l.push(l.length === 0 ? At(c[e], 60) : c[e]), u += t;
|
|
1309
1307
|
}
|
|
1310
1308
|
let d = c.length - l.length, f = d > 0 ? `, +${d} more` : "";
|
|
1311
1309
|
return {
|
|
@@ -1317,13 +1315,13 @@ async function Pt(e, t, n) {
|
|
|
1317
1315
|
...o,
|
|
1318
1316
|
text: "unused · shadowed"
|
|
1319
1317
|
});
|
|
1320
|
-
let s = e.getComment() ?? "", c =
|
|
1318
|
+
let s = e.getComment() ?? "", c = Mt(e);
|
|
1321
1319
|
return {
|
|
1322
1320
|
name: c,
|
|
1323
|
-
refersTo: await
|
|
1321
|
+
refersTo: await Pt(e),
|
|
1324
1322
|
dependents: o,
|
|
1325
1323
|
hidden: e.isHidden(),
|
|
1326
|
-
comment:
|
|
1324
|
+
comment: At(s, 60),
|
|
1327
1325
|
broken: t.broken,
|
|
1328
1326
|
error: t.error,
|
|
1329
1327
|
sortKey: c.toLowerCase().replace(/'/g, "")
|
|
@@ -1331,7 +1329,7 @@ async function Pt(e, t, n) {
|
|
|
1331
1329
|
})), s = (e, t) => {
|
|
1332
1330
|
let n = (t.dependents?.weight ?? 0) - (e.dependents?.weight ?? 0);
|
|
1333
1331
|
return n === 0 ? e.sortKey.localeCompare(t.sortKey) : n;
|
|
1334
|
-
}, c = [...o.filter((e) => e.broken).sort(s), ...o.filter((e) => !e.broken).sort(s)], l =
|
|
1332
|
+
}, c = [...o.filter((e) => e.broken).sort(s), ...o.filter((e) => !e.broken).sort(s)], l = D(c.length, n?.maxNames ?? 200), u = c.length > l ? c.slice(0, l) : c, d = u.filter((e) => e.broken), f = u.filter((e) => !e.broken);
|
|
1335
1333
|
e.h2(`${n?.heading ?? "Names"} (${o.length})`);
|
|
1336
1334
|
let p = (t, n) => {
|
|
1337
1335
|
let r = t.some((e) => e.hidden), i = t.some((e) => e.comment.length > 0), a = t.some((e) => e.dependents !== null), o = ["Name", "Refers To"];
|
|
@@ -1353,7 +1351,7 @@ async function Pt(e, t, n) {
|
|
|
1353
1351
|
}
|
|
1354
1352
|
e.blank();
|
|
1355
1353
|
}
|
|
1356
|
-
function
|
|
1354
|
+
function Bt(e, t, n) {
|
|
1357
1355
|
let r = n.getCoords().min, i = [], a = 0, o = 0;
|
|
1358
1356
|
if (n.forEachSpan((e, t) => {
|
|
1359
1357
|
let s = t.getCoords();
|
|
@@ -1372,10 +1370,21 @@ function Ft(e, t, n) {
|
|
|
1372
1370
|
for (let t of i) e.text(` ${t.address.padEnd(s)} ${t.count}`);
|
|
1373
1371
|
o > i.length && e.text(` …and ${o - i.length} more`), e.blank();
|
|
1374
1372
|
}
|
|
1375
|
-
function
|
|
1373
|
+
function Vt(e) {
|
|
1374
|
+
let t = e.getOutline(), n = [];
|
|
1375
|
+
for (let [e, r] of [[u.Axis.Row, "rows"], [u.Axis.Column, "columns"]]) {
|
|
1376
|
+
let i = t.getLevelCount(e);
|
|
1377
|
+
if (i === 0) continue;
|
|
1378
|
+
let a = t.getGroups(e), o = 0;
|
|
1379
|
+
for (let e of a) e.collapsed && o++;
|
|
1380
|
+
n.push(`${r} ${i} ${i === 1 ? "level" : "levels"}, ${a.length} ${a.length === 1 ? "group" : "groups"}` + (o > 0 ? ` (${o} collapsed)` : ""));
|
|
1381
|
+
}
|
|
1382
|
+
return n.length > 0 ? n.join(" · ") : null;
|
|
1383
|
+
}
|
|
1384
|
+
function Ht(e, t, n, r) {
|
|
1376
1385
|
if (n.length === 0) return;
|
|
1377
1386
|
let i = n.length > 50 ? n.slice(0, 50) : n, a = i.map((e) => ({
|
|
1378
|
-
address:
|
|
1387
|
+
address: At(Ct(e.getRanges()), 40),
|
|
1379
1388
|
rule: r(e)
|
|
1380
1389
|
}));
|
|
1381
1390
|
e.h2(`${t} (${n.length})`);
|
|
@@ -1383,7 +1392,7 @@ function It(e, t, n, r) {
|
|
|
1383
1392
|
for (let t of a) e.text(` ${t.address.padEnd(o)} ${t.rule}`.trimEnd());
|
|
1384
1393
|
i.length < n.length && e.text(` …and ${n.length - i.length} more`), e.blank();
|
|
1385
1394
|
}
|
|
1386
|
-
function
|
|
1395
|
+
function Ut(e, t = !1) {
|
|
1387
1396
|
let n = e.getSheet(), r = e.getCoords(), i = n.getName(), a = [];
|
|
1388
1397
|
for (let e of n.getNames().getItems({
|
|
1389
1398
|
type: "formula",
|
|
@@ -1400,23 +1409,23 @@ function Lt(e, t = !1) {
|
|
|
1400
1409
|
}
|
|
1401
1410
|
return a;
|
|
1402
1411
|
}
|
|
1403
|
-
async function
|
|
1412
|
+
async function Wt(e, t) {
|
|
1404
1413
|
let n = t.getSheet();
|
|
1405
|
-
await
|
|
1414
|
+
await W(e, Ut(t, !0), { symbols: n.getWorkbook()?.getNames().getItems({ includeHidden: !0 }) ?? n.getNames().getItems({ includeHidden: !0 }) ?? [] });
|
|
1406
1415
|
let r = t.getColumnHeaders(), i = t.getRowHeaders();
|
|
1407
|
-
|
|
1416
|
+
Bt(e, "Hidden Columns", r), Bt(e, "Hidden Rows", i);
|
|
1408
1417
|
let a = t.getTables();
|
|
1409
|
-
a.length > 0 &&
|
|
1418
|
+
a.length > 0 && _t(e, a, t.getCounts([B.Table])[B.Table] ?? 0);
|
|
1410
1419
|
}
|
|
1411
|
-
var
|
|
1420
|
+
var Gt = "#REF!", G = (e) => {
|
|
1412
1421
|
let t = e.getContent();
|
|
1413
1422
|
return t.getType() === "chart" && typeof t.getSeries == "function" ? t : null;
|
|
1414
|
-
},
|
|
1423
|
+
}, Kt = (t, n) => `${H(t.getName())}!${e.rangeToString(n) ?? ""}`, qt = (e, t) => e ? Kt(e.getSheet(), e.getCoords()) : t, K = (e) => e.replace(/\s*[\r\n]+\s*/g, " ⏎ ").trim(), Jt = (e, t) => ({
|
|
1415
1424
|
colStart: Math.min(e.colStart, t.colStart),
|
|
1416
1425
|
rowStart: Math.min(e.rowStart, t.rowStart),
|
|
1417
1426
|
colEnd: Math.max(e.colEnd, t.colEnd),
|
|
1418
1427
|
rowEnd: Math.max(e.rowEnd, t.rowEnd)
|
|
1419
|
-
}),
|
|
1428
|
+
}), Yt = (e) => {
|
|
1420
1429
|
if (e.length === 0) return null;
|
|
1421
1430
|
let t = e[0], n = t.getValuesRange();
|
|
1422
1431
|
if (!n) return null;
|
|
@@ -1441,78 +1450,78 @@ var zt = "#REF!", K = (e) => {
|
|
|
1441
1450
|
}
|
|
1442
1451
|
}
|
|
1443
1452
|
return {
|
|
1444
|
-
values:
|
|
1453
|
+
values: Kt(r, Jt(i, f)),
|
|
1445
1454
|
by: a ? null : c,
|
|
1446
|
-
names: u && p ?
|
|
1447
|
-
categories:
|
|
1455
|
+
names: u && p ? Kt(u.getSheet(), Jt(u.getCoords(), p)) : null,
|
|
1456
|
+
categories: qt(t.getCategoriesRange(), l)
|
|
1448
1457
|
};
|
|
1449
|
-
},
|
|
1458
|
+
}, Xt = (e) => {
|
|
1450
1459
|
let t = [], n = [
|
|
1451
1460
|
["name", e.getNameFormula()],
|
|
1452
1461
|
["values", e.getValuesFormula()],
|
|
1453
1462
|
["categories", e.getCategoriesFormula()]
|
|
1454
1463
|
];
|
|
1455
|
-
for (let [e, r] of n) r?.includes(
|
|
1464
|
+
for (let [e, r] of n) r?.includes(Gt) && t.push(`${e} ${r}`);
|
|
1456
1465
|
return t;
|
|
1457
|
-
},
|
|
1466
|
+
}, Zt = (e) => {
|
|
1458
1467
|
let t = 0;
|
|
1459
|
-
for (let n of e)
|
|
1468
|
+
for (let n of e) Xt(n).length > 0 && t++;
|
|
1460
1469
|
return t;
|
|
1461
|
-
},
|
|
1470
|
+
}, Qt = (e) => {
|
|
1462
1471
|
let t = e.getChartType();
|
|
1463
1472
|
return t && t !== "unknown" ? t : null;
|
|
1464
1473
|
};
|
|
1465
|
-
function
|
|
1466
|
-
let t = [], n =
|
|
1474
|
+
function $t(e) {
|
|
1475
|
+
let t = [], n = Qt(e);
|
|
1467
1476
|
n && t.push(n);
|
|
1468
1477
|
let r = e.getChartTitle();
|
|
1469
1478
|
var i, a;
|
|
1470
|
-
r && t.push(`"${i =
|
|
1479
|
+
r && t.push(`"${i = K(r), a = 40, i.length > a ? `${i.slice(0, a - 1)}…` : i}"`);
|
|
1471
1480
|
let o = e.getSeries();
|
|
1472
1481
|
if (o.length > 0) {
|
|
1473
1482
|
t.push(`${o.length} series`);
|
|
1474
|
-
let n = e.getPivotSource(), r = n ? null :
|
|
1483
|
+
let n = e.getPivotSource(), r = n ? null : Yt(o);
|
|
1475
1484
|
n ? t.push(`pivot table ${n}`) : r && (t.push(`values ${r.values}`), r.categories && t.push(`categories ${r.categories}`));
|
|
1476
|
-
let i =
|
|
1477
|
-
i > 0 && t.push(`${
|
|
1485
|
+
let i = Zt(o);
|
|
1486
|
+
i > 0 && t.push(`${Gt} in ${i} series`);
|
|
1478
1487
|
}
|
|
1479
1488
|
return t.length > 0 ? t.join(" · ") : null;
|
|
1480
1489
|
}
|
|
1481
|
-
function
|
|
1490
|
+
function en(e) {
|
|
1482
1491
|
let t = [], n = e.getChartTitle();
|
|
1483
|
-
n && t.push(["title", `"${
|
|
1492
|
+
n && t.push(["title", `"${K(n)}"`]);
|
|
1484
1493
|
let r = e.getSeries();
|
|
1485
1494
|
if (r.length === 0) return t;
|
|
1486
|
-
let i = e.getPivotSource(), a = i ? null :
|
|
1495
|
+
let i = e.getPivotSource(), a = i ? null : Yt(r);
|
|
1487
1496
|
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)]);
|
|
1488
|
-
let o =
|
|
1489
|
-
return o > 0 && t.push(["broken", `${
|
|
1497
|
+
let o = Zt(r);
|
|
1498
|
+
return o > 0 && t.push(["broken", `${Gt} in ${o} series`]), t;
|
|
1490
1499
|
}
|
|
1491
|
-
var
|
|
1492
|
-
let t = e.getTitle(), n = [t ? `"${
|
|
1500
|
+
var tn = (e) => Qt(e) ?? "", nn = (e) => {
|
|
1501
|
+
let t = e.getTitle(), n = [t ? `"${K(t)}"` : "no title"], r = e.getNumberFormat();
|
|
1493
1502
|
return r && r !== "General" && n.push(`format ${r}`), `${e.getKind()} (${n.join(", ")})`;
|
|
1494
1503
|
};
|
|
1495
|
-
function
|
|
1496
|
-
let n =
|
|
1504
|
+
function rn(e, t) {
|
|
1505
|
+
let n = Qt(t);
|
|
1497
1506
|
e.fact("Type: chart" + (n ? ` — ${n}` : ""));
|
|
1498
1507
|
let r = t.getChartTitle();
|
|
1499
|
-
e.fact("Title: " + (r ? `"${
|
|
1508
|
+
e.fact("Title: " + (r ? `"${K(r)}"` : "(none)"));
|
|
1500
1509
|
let i = t.getSeries(), a = t.getPivotSource();
|
|
1501
1510
|
if (a) e.fact(`Series (${i.length}): from pivot table ${a}`);
|
|
1502
1511
|
else if (i.length > 0) {
|
|
1503
|
-
let t =
|
|
1512
|
+
let t = Yt(i);
|
|
1504
1513
|
if (t) {
|
|
1505
1514
|
let n = [`values ${t.values}${t.by ? ` by ${t.by}` : ""}`];
|
|
1506
1515
|
t.names && n.push(`${i.length === 1 ? "name" : "names"} ${t.names}`), t.categories && n.push(`categories ${t.categories}`), e.fact(`Series (${i.length}): ${n.join(" · ")}`);
|
|
1507
1516
|
} else (function(e, t) {
|
|
1508
|
-
let n = t.slice(0,
|
|
1509
|
-
let t =
|
|
1517
|
+
let n = t.slice(0, D(t.length, 12)), r = n.map((e) => {
|
|
1518
|
+
let t = qt(e.getValuesRange(), e.getValuesFormula()) ?? "(no values)", n = qt(e.getCategoriesRange(), e.getCategoriesFormula()), r = [`values ${t}`];
|
|
1510
1519
|
n && r.push(`categories ${n}`);
|
|
1511
|
-
let i =
|
|
1520
|
+
let i = qt(e.getNameRange(), e.getNameFormula());
|
|
1512
1521
|
i && r.push(`name ${i}`);
|
|
1513
1522
|
let a = e.getName();
|
|
1514
1523
|
return {
|
|
1515
|
-
name: a ?
|
|
1524
|
+
name: a ? K(a) : "(unnamed)",
|
|
1516
1525
|
type: e.isSecondaryAxis() ? `${e.getChartType()} · secondary axis` : e.getChartType(),
|
|
1517
1526
|
source: r.join(" · ")
|
|
1518
1527
|
};
|
|
@@ -1524,27 +1533,143 @@ function Zt(e, t) {
|
|
|
1524
1533
|
})(e, i);
|
|
1525
1534
|
}
|
|
1526
1535
|
let o = t.getAxes();
|
|
1527
|
-
o.length > 0 && e.fact(`Axes: ${o.map(
|
|
1536
|
+
o.length > 0 && e.fact(`Axes: ${o.map(nn).join(" · ")}`);
|
|
1528
1537
|
}
|
|
1529
|
-
var
|
|
1538
|
+
var an = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd, on = (e) => {
|
|
1530
1539
|
let t = e.movable.getRange();
|
|
1531
|
-
return `${
|
|
1532
|
-
},
|
|
1533
|
-
let n = t.getRange();
|
|
1534
|
-
return e.rangeToString(n.getCoords()) ?? n.toString();
|
|
1535
|
-
}, an = (e, t, n) => {
|
|
1540
|
+
return `${Kt(t.getSheet(), t.getCoords())} "${e.movable.getContent().getName?.() || "(unnamed)"}"${e.direct ? "" : " (through its dependents)"}`;
|
|
1541
|
+
}, sn = (e, t, n) => {
|
|
1536
1542
|
let r = e.replace(/\r\n?|\n/g, " ⏎ ");
|
|
1537
1543
|
if (t === null || r.length <= t) return `"${r}"`;
|
|
1538
|
-
let i = r.charCodeAt(t - 1), a = i >= 55296 && i <= 56319 ? t - 1 : t
|
|
1539
|
-
return `"${r.slice(0, a)}…"
|
|
1540
|
-
},
|
|
1544
|
+
let i = r.charCodeAt(t - 1), a = i >= 55296 && i <= 56319 ? t - 1 : t, o = `(+${r.length - a} chars)`;
|
|
1545
|
+
return `"${r.slice(0, a)}…" ${n ? `${o} · full: ${n}` : o}`;
|
|
1546
|
+
}, cn = (e) => e.paragraphs.map((e) => e.runs.map((e) => e.text ?? "").join("")).join("\n").trim(), ln = (e) => {
|
|
1547
|
+
if (e.type === d.Type.Group) return "group";
|
|
1548
|
+
if (e.type === d.Type.Picture) return "picture";
|
|
1549
|
+
let t = e.geometry;
|
|
1550
|
+
return typeof t == "string" ? t : t ? "custom" : "rect";
|
|
1551
|
+
}, un = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, dn = (e, t) => {
|
|
1552
|
+
switch (e.type) {
|
|
1553
|
+
case c.Type.None: return "none";
|
|
1554
|
+
case c.Type.Solid: return String(e.color ?? "solid");
|
|
1555
|
+
case c.Type.Gradient: {
|
|
1556
|
+
let t = e, n = (t.stops ?? []).map((e) => String(typeof e == "object" && e && "color" in e ? e.color : e)), r = t.angle === void 0 ? "" : ` at ${t.angle}°`;
|
|
1557
|
+
return `${t.gradientType ?? "linear"} gradient${n.length ? ` ${n.join(" → ")}` : ""}${r}`;
|
|
1558
|
+
}
|
|
1559
|
+
case c.Type.Pattern: {
|
|
1560
|
+
let t = e, n = [t.foreground, t.background].filter((e) => e !== void 0).join(" on ");
|
|
1561
|
+
return `pattern ${t.patternType ?? ""}${n ? ` ${n}` : ""}`.replace(/ +/g, " ").trim();
|
|
1562
|
+
}
|
|
1563
|
+
case c.Type.Image: {
|
|
1564
|
+
let n = e, r = n.resId === void 0 ? null : t.getResource(n.resId), i = [n.tile ? "tiled" : null, n.sourceRect ? "cropped" : null].filter(Boolean);
|
|
1565
|
+
return `image ${r?.getName() || "(no image)"}${i.length ? `, ${i.join(", ")}` : ""}`;
|
|
1566
|
+
}
|
|
1567
|
+
default: return String(e.type);
|
|
1568
|
+
}
|
|
1569
|
+
}, fn = (e, t) => {
|
|
1570
|
+
if (e.style === null) return "none";
|
|
1571
|
+
let n = e.style?.[t] ?? v.defaultStyleRefs(e)[t];
|
|
1572
|
+
return !n || n.index <= 0 ? "none" : `theme style ${n.index}${n.color ? `, ${n.color}` : ""}`;
|
|
1573
|
+
}, pn = (e, t, n) => {
|
|
1574
|
+
if (!e || e === p.LineEndType.None) return null;
|
|
1575
|
+
let r = [t && t !== p.LineEndSize.Medium ? `wide ${t}` : null, n && n !== p.LineEndSize.Medium ? `long ${n}` : null].filter(Boolean);
|
|
1576
|
+
return r.length ? `${e} (${r.join(", ")})` : e;
|
|
1577
|
+
}, mn = {
|
|
1578
|
+
top: "top",
|
|
1579
|
+
center: "middle",
|
|
1580
|
+
bottom: "bottom",
|
|
1581
|
+
justify: "justified",
|
|
1582
|
+
distributed: "distributed"
|
|
1583
|
+
}, hn = (e) => {
|
|
1584
|
+
if (typeof e == "string") return e;
|
|
1585
|
+
let t = e.address ?? e.action ?? "(no address)";
|
|
1586
|
+
return e.screenTip ? `${t} — "${e.screenTip}"` : t;
|
|
1587
|
+
}, gn = (e, t) => {
|
|
1588
|
+
if (!e || !e.start && !e.end) return null;
|
|
1589
|
+
let n = (e, n) => {
|
|
1590
|
+
if (!n) return null;
|
|
1591
|
+
let r = t().get(n.id);
|
|
1592
|
+
return `${e} → ${r ? `"${r}"` : `shape id ${n.id} (not on this sheet)`} (site ${n.index})`;
|
|
1593
|
+
};
|
|
1594
|
+
return [n("start", e.start), n("end", e.end)].filter(Boolean).join(" · ");
|
|
1595
|
+
}, _n = (e, t, n, r, i) => {
|
|
1596
|
+
for (let a of t) {
|
|
1597
|
+
let t = [ln(a), a.name || "(unnamed)"];
|
|
1598
|
+
if (a.type === d.Type.Picture) {
|
|
1599
|
+
let e = a.fill?.resId;
|
|
1600
|
+
t.push(e === void 0 ? "(no image)" : n.getResource(e)?.getName() || "(no image)");
|
|
1601
|
+
}
|
|
1602
|
+
if (a.text) {
|
|
1603
|
+
let e = cn(a.text);
|
|
1604
|
+
e && t.push(sn(e, 120, ""));
|
|
1605
|
+
}
|
|
1606
|
+
let o = gn(a.connectorEnds, r);
|
|
1607
|
+
o && t.push(o), e.text(`${" ".repeat(i + 2)}${t.join(" · ")}`), a.children?.length && _n(e, a.children, n, r, i + 1);
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
function vn(e, t) {
|
|
1611
|
+
let n = t.toJSON() ?? {}, r = n.type === d.Type.Group, i = null, a = () => i ??= ((e) => {
|
|
1612
|
+
let t = /* @__PURE__ */ new Map();
|
|
1613
|
+
if (!e) return t;
|
|
1614
|
+
let n = (e, r) => {
|
|
1615
|
+
e.sourceId !== void 0 && t.set(e.sourceId, r || `(unnamed ${ln(e)})`);
|
|
1616
|
+
for (let t of e.children ?? []) n(t, t.name);
|
|
1617
|
+
};
|
|
1618
|
+
for (let t of e.getRange().getSheet().getMovables().getItems({ type: "shape" })) {
|
|
1619
|
+
let e = t.getContent(), r = e.toJSON?.();
|
|
1620
|
+
r && n(r, e.getName());
|
|
1621
|
+
}
|
|
1622
|
+
return t;
|
|
1623
|
+
})(t.getMovable());
|
|
1624
|
+
e.fact(`Shape: ${((e) => {
|
|
1625
|
+
let t = ln(e), n = [];
|
|
1626
|
+
e.type === d.Type.Group && n.push(un(e.children?.length ?? 0, "member"));
|
|
1627
|
+
let r = e.geometry;
|
|
1628
|
+
return r && typeof r == "object" && (n.push(un(r.paths.length, "path")), r.ah?.length && n.push(un(r.ah.length, "handle"))), e.type === d.Type.Connector && n.push("connector"), e.textBox && n.push("text box"), n.length > 0 ? `${t} — ${n.join(", ")}` : t;
|
|
1629
|
+
})(n)}`);
|
|
1630
|
+
let o = ((e) => {
|
|
1631
|
+
let t = Object.entries(e);
|
|
1632
|
+
return t.length === 0 ? null : t.map(([e, t]) => `${e} ${t}`).join(" · ");
|
|
1633
|
+
})(t.getAdjustments());
|
|
1634
|
+
if (o && e.fact(`Adjustments: ${o} — the rest at the preset's defaults`), !r) {
|
|
1635
|
+
let r = t.getTextFrame();
|
|
1636
|
+
r && e.fact(`Text: ${sn(r.getText(), null, "")}`);
|
|
1637
|
+
let i = ((e) => {
|
|
1638
|
+
if (!e) return null;
|
|
1639
|
+
let t = [];
|
|
1640
|
+
return e.anchor && t.push(mn[e.anchor] ?? e.anchor), e.anchorCenter && t.push("centered"), e.wrap === "none" && t.push("no wrap"), e.verticalOverflow !== m.Overflow.Visible && e.horizontalOverflow !== m.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 !== m.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;
|
|
1641
|
+
})(n.text?.body);
|
|
1642
|
+
i && e.fact(`Text Layout: ${i}`);
|
|
1643
|
+
}
|
|
1644
|
+
n.textLink && e.fact(`Text Link: ${n.textLink} — the text shows this cell's value`), r && !n.fill || e.fact(`Fill: ${n.fill ? dn(n.fill, t) : fn(n, "fill")}`), r && !n.stroke || e.fact(`Line: ${((e, t) => {
|
|
1645
|
+
let n = e.stroke, r = fn(e, "stroke");
|
|
1646
|
+
if (!n) return r;
|
|
1647
|
+
if (n.fill?.type === c.Type.None) return "none";
|
|
1648
|
+
let i = [];
|
|
1649
|
+
typeof n.width == "number" && i.push(`${n.width} pt`), i.push(n.fill ? dn(n.fill, t) : `color from ${r}`), n.dash !== void 0 && n.dash !== p.StrokeStyle.Solid && i.push(`dash ${Array.isArray(n.dash) ? n.dash.join(" ") : n.dash}`), n.compound && n.compound !== p.Compound.Single && i.push(`compound ${n.compound}`);
|
|
1650
|
+
let a = pn(n.headType, n.headWidth, n.headLength);
|
|
1651
|
+
a && i.push(`head ${a}`);
|
|
1652
|
+
let o = pn(n.tailType, n.tailWidth, n.tailLength);
|
|
1653
|
+
return o && i.push(`tail ${o}`), i.join(" · ");
|
|
1654
|
+
})(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");
|
|
1655
|
+
let s = [n.flipH ? "horizontal" : null, n.flipV ? "vertical" : null].filter(Boolean);
|
|
1656
|
+
s.length && e.fact(`Flip: ${s.join(", ")}`);
|
|
1657
|
+
let l = gn(n.connectorEnds, a);
|
|
1658
|
+
l && e.fact(`Connected: ${l}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${hn(n.hyperlink)}`), n.hoverHyperlink && e.fact(`Hover Hyperlink: ${hn(n.hoverHyperlink)}`), n.macro && e.fact(`Macro: ${n.macro}`);
|
|
1659
|
+
let u = Object.entries(n.locks ?? {}).filter(([, e]) => e).map(([e]) => e);
|
|
1660
|
+
u.length && e.fact(`Locks: ${u.join(", ")}`), r && n.children?.length && (e.fact(`Members: ${n.children.length}, in z-order`), _n(e, n.children, t, a, 0));
|
|
1661
|
+
}
|
|
1662
|
+
var yn = (e) => e.toJSON()?.rotation ?? 0, bn = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, xn = (e) => e.replace(/[\r\n]+/g, " ").trim(), Sn = (t) => {
|
|
1663
|
+
let n = t.getRange();
|
|
1664
|
+
return e.rangeToString(n.getCoords()) ?? n.toString();
|
|
1665
|
+
}, Cn = ({ movable: e, text: t }) => sn(t, 300, ((e) => `${U(e.getRange())}.getRange(${JSON.stringify(Sn(e))}).getMovables()`)(e)), wn = (e) => {
|
|
1541
1666
|
let t = e.getContent();
|
|
1542
1667
|
return typeof t.getTextFrame == "function" ? t.getTextFrame()?.getText() ?? "" : null;
|
|
1543
1668
|
};
|
|
1544
|
-
function
|
|
1669
|
+
function Tn(e) {
|
|
1545
1670
|
let t = [];
|
|
1546
1671
|
for (let n of e) {
|
|
1547
|
-
let e =
|
|
1672
|
+
let e = wn(n) ?? "";
|
|
1548
1673
|
e.trim() !== "" && t.push({
|
|
1549
1674
|
movable: n,
|
|
1550
1675
|
text: e
|
|
@@ -1555,25 +1680,25 @@ function cn(e) {
|
|
|
1555
1680
|
return n.rowStart - r.rowStart || n.colStart - r.colStart;
|
|
1556
1681
|
});
|
|
1557
1682
|
}
|
|
1558
|
-
var
|
|
1559
|
-
let t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), r =
|
|
1560
|
-
if (r) return
|
|
1561
|
-
|
|
1562
|
-
n ?
|
|
1683
|
+
var En = (e) => e.getType() === "picture" && e.getResource?.()?.getName() || null, Dn = (e) => {
|
|
1684
|
+
let t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), r = G(e);
|
|
1685
|
+
if (r) return bn([
|
|
1686
|
+
$t(r),
|
|
1687
|
+
n ? xn(n) : null,
|
|
1563
1688
|
t
|
|
1564
1689
|
].filter(Boolean).join(" · "), 140);
|
|
1565
|
-
let i = e.getContent(), a = [], o =
|
|
1566
|
-
return o && a.push(o), n && a.push(
|
|
1567
|
-
},
|
|
1690
|
+
let i = e.getContent(), a = [], o = En(i);
|
|
1691
|
+
return o && a.push(o), n && a.push(xn(n)), bn(a.length > 0 ? `${t} — ${a.join(" · ")}` : t, 90);
|
|
1692
|
+
}, On = (e) => {
|
|
1568
1693
|
let t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription();
|
|
1569
|
-
return
|
|
1570
|
-
},
|
|
1694
|
+
return bn(n ? `${t} — ${xn(n)}` : t, 90);
|
|
1695
|
+
}, kn = /* @__PURE__ */ new Map([
|
|
1571
1696
|
["chart", "Charts"],
|
|
1572
1697
|
["shape", "Shapes"],
|
|
1573
1698
|
["picture", "Pictures"],
|
|
1574
1699
|
["slicer", "Slicers"]
|
|
1575
|
-
]),
|
|
1576
|
-
function
|
|
1700
|
+
]), An = (e) => kn.get(e) ?? `${e.charAt(0).toUpperCase()}${e.slice(1)}s`;
|
|
1701
|
+
function jn(e) {
|
|
1577
1702
|
let t = /* @__PURE__ */ new Map();
|
|
1578
1703
|
for (let n of e) {
|
|
1579
1704
|
let e = n.getContent().getType();
|
|
@@ -1582,29 +1707,30 @@ function mn(e) {
|
|
|
1582
1707
|
r ? r.push(n) : t.set(e, [n]);
|
|
1583
1708
|
}
|
|
1584
1709
|
let n = /* @__PURE__ */ new Map();
|
|
1585
|
-
for (let e of
|
|
1710
|
+
for (let e of kn.keys()) {
|
|
1586
1711
|
let r = t.get(e);
|
|
1587
1712
|
r && n.set(e, r);
|
|
1588
1713
|
}
|
|
1589
1714
|
for (let [e, r] of t) n.set(e, r);
|
|
1590
1715
|
return n;
|
|
1591
1716
|
}
|
|
1592
|
-
function
|
|
1593
|
-
for (let [n, r] of
|
|
1717
|
+
function Mn(e, t) {
|
|
1718
|
+
for (let [n, r] of jn(t)) Nn(e, n, r);
|
|
1594
1719
|
}
|
|
1595
|
-
function
|
|
1596
|
-
let r =
|
|
1597
|
-
let t = i.get(e), n =
|
|
1720
|
+
function Nn(e, t, n) {
|
|
1721
|
+
let r = Tn(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, D(a.length, 50)), s = o.map((e) => {
|
|
1722
|
+
let t = i.get(e), n = G(e);
|
|
1598
1723
|
return {
|
|
1599
|
-
address:
|
|
1600
|
-
preset: n ?
|
|
1601
|
-
summary: n ?
|
|
1602
|
-
details: n ?
|
|
1603
|
-
text: t ?
|
|
1724
|
+
address: Sn(e),
|
|
1725
|
+
preset: n ? tn(n) : (r = e.getContent(), r.getShapeType?.() ?? ""),
|
|
1726
|
+
summary: n ? On(e) : Dn(e),
|
|
1727
|
+
details: n ? en(n) : [],
|
|
1728
|
+
text: t ? Cn(t) : "",
|
|
1604
1729
|
hidden: e.isHidden() ? " (hidden)" : ""
|
|
1605
1730
|
};
|
|
1731
|
+
var r;
|
|
1606
1732
|
});
|
|
1607
|
-
e.h2(`${
|
|
1733
|
+
e.h2(`${An(t)} (${n.length}${r.length > 0 ? ` · ${r.length} with text` : ""})`);
|
|
1608
1734
|
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)));
|
|
1609
1735
|
for (let t of s) {
|
|
1610
1736
|
let n = l > 0 ? `${t.preset.padEnd(l)} ` : "", r = t.text ? `${t.summary.padEnd(u)} ${t.text}` : t.summary;
|
|
@@ -1613,41 +1739,50 @@ function gn(e, t, n) {
|
|
|
1613
1739
|
for (let [n, r] of t.details) e.text(` ${n.padEnd(i)}${r}`);
|
|
1614
1740
|
}
|
|
1615
1741
|
if (o.length < a.length) {
|
|
1616
|
-
let r = `${
|
|
1742
|
+
let r = `${U(n[0].getRange())}.getMovables().getItems({ type: ${JSON.stringify(t)} })`;
|
|
1617
1743
|
e.text(` …and ${a.length - o.length} more · ${r} reports every one in full`);
|
|
1618
1744
|
}
|
|
1619
1745
|
e.blank();
|
|
1620
1746
|
}
|
|
1621
|
-
function
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1747
|
+
function Pn(e) {
|
|
1748
|
+
return Ln(e, "Movable");
|
|
1749
|
+
}
|
|
1750
|
+
function Fn(e) {
|
|
1751
|
+
let t = e.getMovable();
|
|
1752
|
+
if (t) return Ln(t, "Shape");
|
|
1753
|
+
let n = new z();
|
|
1754
|
+
return n.h1(`Shape — ${e.getName() || "(unnamed)"}`), n.blank(), vn(n, e), n.toLines().join("\n").trimEnd();
|
|
1755
|
+
}
|
|
1756
|
+
var In = (e) => {
|
|
1757
|
+
let t = e.getContent();
|
|
1758
|
+
return !0 === t?.isIShape ? t : null;
|
|
1759
|
+
};
|
|
1760
|
+
function Ln(e, t) {
|
|
1761
|
+
let r = new z(), i = e.getRange(), a = e.getContent(), o = a.getType(), s = In(e);
|
|
1762
|
+
r.h1(`${t} — ${Tt(i)}`), r.blank(), r.fact(`Name: ${e.getContent().getName?.() || "(unnamed)"}`);
|
|
1763
|
+
let c = G(e);
|
|
1764
|
+
c ? rn(r, c) : r.fact(`Type: ${o}`);
|
|
1765
|
+
let l = En(a);
|
|
1766
|
+
l && r.fact(`Content: ${l}`), s && vn(r, s);
|
|
1632
1767
|
let u = e.getContent().getDescription();
|
|
1633
|
-
u &&
|
|
1768
|
+
u && r.fact(`Alt Text: ${xn(u)}`), r.fact(`Anchor: ${V(i)}, ${((e) => {
|
|
1634
1769
|
switch (e) {
|
|
1635
1770
|
case n.Type.Absolute: return "absolute — stays put when rows or columns move";
|
|
1636
1771
|
case n.Type.OneCell: return "oneCell — moves with the cells, keeps its size";
|
|
1637
1772
|
default: return "twoCell — moves and resizes with the cells";
|
|
1638
1773
|
}
|
|
1639
|
-
})(e.getAnchorType?.())}`),
|
|
1774
|
+
})(e.getAnchorType?.())}`), r.fact(`Bounds: ${((e) => {
|
|
1640
1775
|
let t = e.getBounds();
|
|
1641
1776
|
if (!t) return "not laid out";
|
|
1642
1777
|
let n = (e) => Math.round(e);
|
|
1643
1778
|
return `${n(t.width)}×${n(t.height)} px at (${n(t.x)}, ${n(t.y)})`;
|
|
1644
|
-
})(e)}`), e.isHidden() &&
|
|
1645
|
-
let d = e.getRotation();
|
|
1646
|
-
return d !== 0 &&
|
|
1779
|
+
})(e)}`), e.isHidden() && r.fact("Hidden: true — this object is not visible in the UI");
|
|
1780
|
+
let d = e.getRotation() || (s ? yn(s) : 0);
|
|
1781
|
+
return d !== 0 && r.fact(`Rotation: ${d}°`), r.fact(`Z-Order: ${e.getZIndex()}`), r.blank(), r.text(`Sheet: ${H(i.getSheet().getName())}`), r.toLines().join("\n").trimEnd();
|
|
1647
1782
|
}
|
|
1648
|
-
var
|
|
1783
|
+
var Rn = (e) => e.getVisibility() === "visible", zn = (e, t, n) => {
|
|
1649
1784
|
let r = e.getSheets().getItems({ visibility: "veryHidden" }), i = t?.trim();
|
|
1650
|
-
if (!i) return r.filter((e) => n ||
|
|
1785
|
+
if (!i) return r.filter((e) => n || Rn(e)).map((e) => ({
|
|
1651
1786
|
sheet: e,
|
|
1652
1787
|
address: null
|
|
1653
1788
|
}));
|
|
@@ -1669,14 +1804,14 @@ var vn = (e) => e.getVisibility() === "visible", yn = (e, t, n) => {
|
|
|
1669
1804
|
let e = ((e) => {
|
|
1670
1805
|
let t = e.replace(/[.*+?^${}()|[\]\\]/g, (e) => e === "*" ? ".*" : e === "?" ? "." : `\\${e}`);
|
|
1671
1806
|
return RegExp(`^${t}$`);
|
|
1672
|
-
})(i), t = r.filter((t) => e.test(t.getName()) && (n ||
|
|
1807
|
+
})(i), t = r.filter((t) => e.test(t.getName()) && (n || Rn(t)));
|
|
1673
1808
|
if (t.length === 0) throw Error(`No sheets match ${JSON.stringify(i)}. Sheets: ${r.map((e) => e.getName()).join(", ")}`);
|
|
1674
1809
|
return t.map((e) => ({
|
|
1675
1810
|
sheet: e,
|
|
1676
1811
|
address: null
|
|
1677
1812
|
}));
|
|
1678
1813
|
}
|
|
1679
|
-
let s = r.filter((e) => n ||
|
|
1814
|
+
let s = r.filter((e) => n || Rn(e));
|
|
1680
1815
|
try {
|
|
1681
1816
|
s[0]?.getRange(i);
|
|
1682
1817
|
} catch {
|
|
@@ -1686,11 +1821,10 @@ var vn = (e) => e.getVisibility() === "visible", yn = (e, t, n) => {
|
|
|
1686
1821
|
sheet: e,
|
|
1687
1822
|
address: i
|
|
1688
1823
|
}));
|
|
1689
|
-
},
|
|
1824
|
+
}, Bn = (e, t) => {
|
|
1690
1825
|
switch (t) {
|
|
1691
|
-
case "display": return
|
|
1692
|
-
case "value": return
|
|
1693
|
-
case "raw": return x(e.getValue());
|
|
1826
|
+
case "display": return w(e, x.Mode.Display);
|
|
1827
|
+
case "value": return w(e, x.Mode.Value);
|
|
1694
1828
|
case "formula": {
|
|
1695
1829
|
let t = e.getFormulaText();
|
|
1696
1830
|
return t ? {
|
|
@@ -1714,23 +1848,23 @@ var vn = (e) => e.getVisibility() === "visible", yn = (e, t, n) => {
|
|
|
1714
1848
|
}
|
|
1715
1849
|
default: return null;
|
|
1716
1850
|
}
|
|
1717
|
-
},
|
|
1851
|
+
}, Vn = ["hyperlink", "numberFormat"], q = (e, t) => t && t.trim() !== "" ? [{
|
|
1718
1852
|
field: e,
|
|
1719
1853
|
text: {
|
|
1720
1854
|
match: t,
|
|
1721
1855
|
display: t
|
|
1722
1856
|
}
|
|
1723
|
-
}] : [],
|
|
1724
|
-
let n =
|
|
1857
|
+
}] : [], Hn = (e) => [...q("comment", e.getContent()), ...e.getReplies().flatMap((e) => q("comment", e.getContent()))], Un = (e, t) => {
|
|
1858
|
+
let n = G(e);
|
|
1725
1859
|
if (n) return t.includes("chart") ? [
|
|
1726
|
-
...
|
|
1727
|
-
...n.getAxes().flatMap((e) =>
|
|
1728
|
-
...n.getSeries().flatMap((e) => e.getNameFormula() === null ?
|
|
1729
|
-
...
|
|
1860
|
+
...q("chart", n.getChartTitle()),
|
|
1861
|
+
...n.getAxes().flatMap((e) => q("chart", e.getTitle())),
|
|
1862
|
+
...n.getSeries().flatMap((e) => e.getNameFormula() === null ? q("chart", e.getName()) : []),
|
|
1863
|
+
...q("chart", e.getContent().getDescription())
|
|
1730
1864
|
] : [];
|
|
1731
|
-
let r =
|
|
1732
|
-
return r !== null && t.includes("shape") ? [...
|
|
1733
|
-
},
|
|
1865
|
+
let r = wn(e);
|
|
1866
|
+
return r !== null && t.includes("shape") ? [...q("shape", r), ...q("shape", e.getContent().getDescription())] : [];
|
|
1867
|
+
}, Wn = (e) => {
|
|
1734
1868
|
let t = e.isIFormula ? `=${e.getExpression()}` : null, n = t ?? e.getRanges?.()?.getAddress() ?? e.getName();
|
|
1735
1869
|
return [
|
|
1736
1870
|
{
|
|
@@ -1740,21 +1874,21 @@ var vn = (e) => e.getVisibility() === "visible", yn = (e, t, n) => {
|
|
|
1740
1874
|
display: n
|
|
1741
1875
|
}
|
|
1742
1876
|
},
|
|
1743
|
-
...t ?
|
|
1744
|
-
...
|
|
1877
|
+
...t ? q("name", t) : [],
|
|
1878
|
+
...q("name", e.getComment())
|
|
1745
1879
|
];
|
|
1746
|
-
},
|
|
1880
|
+
}, Gn = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd, Kn = (e, t) => {
|
|
1747
1881
|
let n = e.getRanges?.() ?? null;
|
|
1748
1882
|
return t.some(({ sheet: t, address: r }) => {
|
|
1749
1883
|
if (r === null && e.getScope() === t.getName()) return !0;
|
|
1750
1884
|
let i = r === null ? null : t.getRange(r).getCoords();
|
|
1751
1885
|
for (let e = 0; e < (n?.length ?? 0); e++) {
|
|
1752
1886
|
let r = n.at(e);
|
|
1753
|
-
if (r.getSheet() === t && (!i ||
|
|
1887
|
+
if (r.getSheet() === t && (!i || Gn(r.getCoords(), i))) return !0;
|
|
1754
1888
|
}
|
|
1755
1889
|
return !1;
|
|
1756
1890
|
});
|
|
1757
|
-
},
|
|
1891
|
+
}, qn = (e, t) => e.rowStart - t.rowStart || e.colStart - t.colStart, Jn = (e, t, n) => {
|
|
1758
1892
|
let r = null, i = (e) => ({
|
|
1759
1893
|
range: `${t}!${e.getRange().toString()}`,
|
|
1760
1894
|
table: e.getName()
|
|
@@ -1779,9 +1913,9 @@ var vn = (e) => e.getVisibility() === "visible", yn = (e, t, n) => {
|
|
|
1779
1913
|
} : s ? i(s) : void 0;
|
|
1780
1914
|
} };
|
|
1781
1915
|
};
|
|
1782
|
-
async function
|
|
1916
|
+
async function Yn(t, n) {
|
|
1783
1917
|
if (!n.pattern) throw Error("grep requires a pattern");
|
|
1784
|
-
let r = n.fields?.length ? n.fields :
|
|
1918
|
+
let r = n.fields?.length ? n.fields : E, i = n.output ?? "content", a = n.maxCount ?? 200, o = !0 === n.invert, s = !0 === n.hidden, c = ((e) => {
|
|
1785
1919
|
if (e === void 0 || !1 === e) return null;
|
|
1786
1920
|
if (!0 === e) return "contentful";
|
|
1787
1921
|
if (e === "contentful" || e === "table") return e;
|
|
@@ -1799,7 +1933,7 @@ async function kn(t, n) {
|
|
|
1799
1933
|
throw Error(`Invalid regex ${JSON.stringify(e.pattern)}: ${t instanceof Error ? t.message : String(t)}. Use fixedStrings (-F) to search for the literal text.`);
|
|
1800
1934
|
}
|
|
1801
1935
|
}
|
|
1802
|
-
})(n), u =
|
|
1936
|
+
})(n), u = zn(t, n.scope, s), d = !r.some((e) => Vn.includes(e)), f = r.includes("display") && r.includes("value"), p = i === "content" || i === "addresses", m = [], h = [], g = 0, _ = 0, v = 0, y = !1, b = (e) => {
|
|
1803
1937
|
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);
|
|
1804
1938
|
return o ? t.length === 0 && e.length > 0 ? [e[0]] : null : t.length === 0 ? null : i === "addresses" ? t.slice(0, 1) : t;
|
|
1805
1939
|
}, x = (e, t, n, r, i) => {
|
|
@@ -1817,7 +1951,7 @@ async function kn(t, n) {
|
|
|
1817
1951
|
if (y) continue;
|
|
1818
1952
|
let a = t.getName();
|
|
1819
1953
|
v++, await t.getCalculation().ready();
|
|
1820
|
-
let o = n === null ? t.getUsedRange() : t.getRange(n), l = o && c && i === "content" ?
|
|
1954
|
+
let o = n === null ? t.getUsedRange() : t.getRange(n), l = o && c && i === "content" ? Jn(c, a, o) : null, u = {
|
|
1821
1955
|
...n === null ? {} : { address: n },
|
|
1822
1956
|
...s ? {} : { ignoreHidden: !0 }
|
|
1823
1957
|
}, p = /* @__PURE__ */ new Map();
|
|
@@ -1832,11 +1966,11 @@ async function kn(t, n) {
|
|
|
1832
1966
|
for (let e of r) {
|
|
1833
1967
|
if (e === "comment") {
|
|
1834
1968
|
let e = `${i.rowIndex}:${i.colIndex}`, t = p.get(e);
|
|
1835
|
-
t && (o.push(...
|
|
1969
|
+
t && (o.push(...Hn(t)), p.delete(e));
|
|
1836
1970
|
continue;
|
|
1837
1971
|
}
|
|
1838
|
-
let t =
|
|
1839
|
-
e === "display" && (s = t?.match ?? null), t !== null && (e === "value" && f && (s === void 0 && (s =
|
|
1972
|
+
let t = Bn(n, e);
|
|
1973
|
+
e === "display" && (s = t?.match ?? null), t !== null && (e === "value" && f && (s === void 0 && (s = Bn(n, "display")?.match ?? null), t.match === s) || o.push({
|
|
1840
1974
|
field: e,
|
|
1841
1975
|
text: t
|
|
1842
1976
|
}));
|
|
@@ -1850,10 +1984,10 @@ async function kn(t, n) {
|
|
|
1850
1984
|
let g = [...p.values()].map((e) => ({
|
|
1851
1985
|
comment: e,
|
|
1852
1986
|
at: e.getRange().getCoords()
|
|
1853
|
-
})).sort((e, t) =>
|
|
1987
|
+
})).sort((e, t) => qn(e.at, t.at));
|
|
1854
1988
|
for (let { comment: t, at: n } of g) {
|
|
1855
1989
|
if (y) break;
|
|
1856
|
-
let r = b(
|
|
1990
|
+
let r = b(Hn(t));
|
|
1857
1991
|
if (!r) continue;
|
|
1858
1992
|
let i = l?.resolve(t.getRange().getCell(), {
|
|
1859
1993
|
rowIndex: n.rowStart,
|
|
@@ -1866,9 +2000,9 @@ async function kn(t, n) {
|
|
|
1866
2000
|
let n = t.getMovables().getItems(u).filter((e) => e.getContent().getType() !== "note").filter((e) => s || !e.isHidden()).map((e) => ({
|
|
1867
2001
|
movable: e,
|
|
1868
2002
|
at: e.getRange().getCoords()
|
|
1869
|
-
})).sort((e, t) =>
|
|
2003
|
+
})).sort((e, t) => qn(e.at, t.at));
|
|
1870
2004
|
for (let { movable: t, at: i } of n) {
|
|
1871
|
-
let n = b(
|
|
2005
|
+
let n = b(Un(t, r));
|
|
1872
2006
|
if (n) {
|
|
1873
2007
|
if (!x("object", a, e.rangeToString(i) ?? t.getRange().toString(), n)) break;
|
|
1874
2008
|
_++;
|
|
@@ -1884,8 +2018,8 @@ async function kn(t, n) {
|
|
|
1884
2018
|
if (!y && r.includes("name")) {
|
|
1885
2019
|
let e = !!n.scope?.trim(), r = t.getNames().getItems(s ? { includeHidden: !0 } : void 0) ?? [];
|
|
1886
2020
|
for (let t of r) {
|
|
1887
|
-
if (e && !
|
|
1888
|
-
let n = b(
|
|
2021
|
+
if (e && !Kn(t, u)) continue;
|
|
2022
|
+
let n = b(Wn(t));
|
|
1889
2023
|
if (n && !x("object", t.getScope() ?? "", t.getName(), n)) break;
|
|
1890
2024
|
}
|
|
1891
2025
|
}
|
|
@@ -1903,27 +2037,27 @@ async function kn(t, n) {
|
|
|
1903
2037
|
output: i
|
|
1904
2038
|
};
|
|
1905
2039
|
}
|
|
1906
|
-
var
|
|
2040
|
+
var Xn = (e) => {
|
|
1907
2041
|
let t = e.replace(/\s+/g, " ").trim();
|
|
1908
2042
|
return t.length > 120 ? `${t.slice(0, 119)}…` : t;
|
|
1909
|
-
},
|
|
1910
|
-
let i = t.map((e) => r ?
|
|
2043
|
+
}, Zn = (e) => e.sheet ? `${e.sheet}!${e.address}` : e.address, Qn = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, $n = (e, t) => t > 0 ? `${Qn(e, "cell")} · ${Qn(t, "object")}` : Qn(e, "cell"), er = (e, t, n, r) => {
|
|
2044
|
+
let i = t.map((e) => r ? Zn(e) : e.address), a = Math.max(...i.map((e) => e.length)), o = Math.max(...t.map((e) => e.field.length));
|
|
1911
2045
|
for (let r = 0; r < t.length; r++) {
|
|
1912
2046
|
let s = t[r];
|
|
1913
|
-
e.push(`${n}${i[r].padEnd(a)} ${s.field.padEnd(o)} ${
|
|
2047
|
+
e.push(`${n}${i[r].padEnd(a)} ${s.field.padEnd(o)} ${Xn(s.text)}`);
|
|
1914
2048
|
}
|
|
1915
2049
|
};
|
|
1916
|
-
function
|
|
1917
|
-
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(",")} · ${
|
|
2050
|
+
function tr(e) {
|
|
2051
|
+
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(",")} · ${$n(a, o)} in ${c} of ${s} ${s === 1 ? "sheet" : "sheets"}`];
|
|
1918
2052
|
if (e.output === "count") {
|
|
1919
|
-
for (let t of e.sheets) l.push(` ${t.sheet}: ${t.objects > 0 ?
|
|
2053
|
+
for (let t of e.sheets) l.push(` ${t.sheet}: ${t.objects > 0 ? $n(t.cells, t.objects) : t.cells}`);
|
|
1920
2054
|
let t = o - e.sheets.reduce((e, t) => e + t.objects, 0);
|
|
1921
2055
|
t > 0 && l.push(` names: ${t}`);
|
|
1922
2056
|
} else if (e.output === "sheets") {
|
|
1923
2057
|
for (let t of e.sheets) l.push(` ${t.sheet}`);
|
|
1924
2058
|
e.sheets.length === 0 && l.push(o > 0 ? " no sheets · names only" : " no matches");
|
|
1925
2059
|
} else if (i.length === 0) l.push(" no matches");
|
|
1926
|
-
else if (e.output === "addresses") for (let e of i) l.push(` ${
|
|
2060
|
+
else if (e.output === "addresses") for (let e of i) l.push(` ${Zn(e)}`);
|
|
1927
2061
|
else {
|
|
1928
2062
|
let e = [], t = /* @__PURE__ */ new Map();
|
|
1929
2063
|
for (let n of i) {
|
|
@@ -1934,11 +2068,11 @@ function Fn(e) {
|
|
|
1934
2068
|
rows: []
|
|
1935
2069
|
}, t.set(r, i), e.push(i)), i.rows.push(n);
|
|
1936
2070
|
}
|
|
1937
|
-
for (let t of e) t.heading ? (l.push(` ${t.heading}`),
|
|
2071
|
+
for (let t of e) t.heading ? (l.push(` ${t.heading}`), er(l, t.rows, " ", !1)) : er(l, t.rows, " ", !0);
|
|
1938
2072
|
}
|
|
1939
|
-
return e.truncated && l.push(` …truncated at ${
|
|
2073
|
+
return e.truncated && l.push(` …truncated at ${$n(a, o)} · narrow the pattern, or scope the search to one sheet or range`), l.join("\n");
|
|
1940
2074
|
}
|
|
1941
|
-
var
|
|
2075
|
+
var nr = {
|
|
1942
2076
|
name: "grep",
|
|
1943
2077
|
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.",
|
|
1944
2078
|
params: [
|
|
@@ -1952,9 +2086,9 @@ var In = {
|
|
|
1952
2086
|
{
|
|
1953
2087
|
name: "fields",
|
|
1954
2088
|
type: "enum[]",
|
|
1955
|
-
values:
|
|
1956
|
-
defaultValue:
|
|
1957
|
-
description: "Layers to search: display (number format applied), value (
|
|
2089
|
+
values: te,
|
|
2090
|
+
defaultValue: E,
|
|
2091
|
+
description: "Layers to search: display (number format applied), value (the stored scalar, what getValue() returns — 0.4 behind 40%, dates as serials; duplicate of display suppressed per cell), formula, hyperlink, numberFormat (the format code, e.g. \"0.00%\"), comment (comments, notes and replies), shape (text on a shape, alt text), chart (title, axis titles, literal series names, alt text), name (defined names and tables: the name, what it refers to, its comment)."
|
|
1958
2092
|
},
|
|
1959
2093
|
{
|
|
1960
2094
|
name: "fixedStrings",
|
|
@@ -2023,9 +2157,9 @@ var In = {
|
|
|
2023
2157
|
description: "What to return: content (address, layer and text), addresses (one per matched cell), count (per sheet), or sheets (names with a match)."
|
|
2024
2158
|
}
|
|
2025
2159
|
],
|
|
2026
|
-
run:
|
|
2027
|
-
render:
|
|
2028
|
-
},
|
|
2160
|
+
run: Yn,
|
|
2161
|
+
render: tr
|
|
2162
|
+
}, rr = [
|
|
2029
2163
|
"IWorkbook",
|
|
2030
2164
|
"ISheet",
|
|
2031
2165
|
"ICellRange",
|
|
@@ -2034,16 +2168,16 @@ var In = {
|
|
|
2034
2168
|
"ITable",
|
|
2035
2169
|
"IStyle",
|
|
2036
2170
|
"IScript.ScriptContext"
|
|
2037
|
-
],
|
|
2038
|
-
function
|
|
2171
|
+
], ir = (e) => e.slice(e.lastIndexOf(".") + 1);
|
|
2172
|
+
function J(e, t) {
|
|
2039
2173
|
if (e.types[t]) return t;
|
|
2040
2174
|
let n = Object.keys(e.types), r = t.toLowerCase(), i = n.filter((e) => e.toLowerCase() === r);
|
|
2041
2175
|
if (i.length === 1) return i[0];
|
|
2042
2176
|
if (t.includes(".")) return null;
|
|
2043
|
-
let a = n.filter((e) =>
|
|
2177
|
+
let a = n.filter((e) => ir(e).toLowerCase() === r);
|
|
2044
2178
|
return a.length === 1 ? a[0] : null;
|
|
2045
2179
|
}
|
|
2046
|
-
function
|
|
2180
|
+
function ar(e, t, n) {
|
|
2047
2181
|
let r = n.replace(/<[\s\S]*$/, "").trim(), i = t.split(".");
|
|
2048
2182
|
for (let t = i.length - 1; t >= 0; t--) {
|
|
2049
2183
|
let n = [...i.slice(0, t), r].join(".");
|
|
@@ -2051,7 +2185,7 @@ function Bn(e, t, n) {
|
|
|
2051
2185
|
}
|
|
2052
2186
|
return null;
|
|
2053
2187
|
}
|
|
2054
|
-
function
|
|
2188
|
+
function or(e, t, n, r = /* @__PURE__ */ new Set()) {
|
|
2055
2189
|
if (r.has(t)) return null;
|
|
2056
2190
|
r.add(t);
|
|
2057
2191
|
let i = e.types[t];
|
|
@@ -2062,14 +2196,14 @@ function Vn(e, t, n, r = /* @__PURE__ */ new Set()) {
|
|
|
2062
2196
|
members: a
|
|
2063
2197
|
};
|
|
2064
2198
|
for (let a of i.extends ?? []) {
|
|
2065
|
-
let i =
|
|
2199
|
+
let i = ar(e, t, a), o = i ? or(e, i, n, r) : null;
|
|
2066
2200
|
if (o) return o;
|
|
2067
2201
|
}
|
|
2068
2202
|
return null;
|
|
2069
2203
|
}
|
|
2070
|
-
function
|
|
2204
|
+
function sr(e, t, n) {
|
|
2071
2205
|
let r = e.types[t], i = (r.extends ?? []).map((n) => {
|
|
2072
|
-
let r =
|
|
2206
|
+
let r = ar(e, t, n);
|
|
2073
2207
|
return {
|
|
2074
2208
|
text: n,
|
|
2075
2209
|
key: r,
|
|
@@ -2085,7 +2219,7 @@ function Hn(e, t, n) {
|
|
|
2085
2219
|
...n ? { filter: n } : {}
|
|
2086
2220
|
};
|
|
2087
2221
|
}
|
|
2088
|
-
function
|
|
2222
|
+
function cr(e, t, n) {
|
|
2089
2223
|
let r = (e) => {
|
|
2090
2224
|
let r = t(e).toLowerCase();
|
|
2091
2225
|
return r === n ? 0 : r.startsWith(n) ? 1 : 2;
|
|
@@ -2096,12 +2230,12 @@ function Un(e, t, n) {
|
|
|
2096
2230
|
score: r(e)
|
|
2097
2231
|
})).sort((e, t) => e.score - t.score || e.order - t.order).map((e) => e.item);
|
|
2098
2232
|
}
|
|
2099
|
-
function
|
|
2233
|
+
function lr(e, t) {
|
|
2100
2234
|
let n = function(e) {
|
|
2101
2235
|
return e.trim().replace(/^SheetXL\./, "").replace(/\(\)$/, "").replace(/#/g, ".");
|
|
2102
2236
|
}(t ?? "");
|
|
2103
2237
|
if (!n) {
|
|
2104
|
-
let t =
|
|
2238
|
+
let t = rr.filter((t) => e.types[t]).map((t) => ({
|
|
2105
2239
|
key: t,
|
|
2106
2240
|
entry: e.types[t]
|
|
2107
2241
|
}));
|
|
@@ -2111,33 +2245,33 @@ function Wn(e, t) {
|
|
|
2111
2245
|
entryPoints: t
|
|
2112
2246
|
};
|
|
2113
2247
|
}
|
|
2114
|
-
let r =
|
|
2115
|
-
if (r) return
|
|
2248
|
+
let r = J(e, n);
|
|
2249
|
+
if (r) return sr(e, r);
|
|
2116
2250
|
let i = n.lastIndexOf(".");
|
|
2117
2251
|
if (i > 0) {
|
|
2118
|
-
let t =
|
|
2252
|
+
let t = J(e, n.slice(0, i)), r = n.slice(i + 1);
|
|
2119
2253
|
if (t && r) {
|
|
2120
|
-
let n = r.toLowerCase(), i =
|
|
2254
|
+
let n = r.toLowerCase(), i = or(e, t, (e) => e.name === r) ?? or(e, t, (e) => e.name.toLowerCase() === n);
|
|
2121
2255
|
if (i) return {
|
|
2122
2256
|
kind: "member",
|
|
2123
2257
|
key: t,
|
|
2124
2258
|
declaredOn: i.key,
|
|
2125
2259
|
members: i.members
|
|
2126
2260
|
};
|
|
2127
|
-
let a =
|
|
2261
|
+
let a = sr(e, t, r);
|
|
2128
2262
|
if (a.members.length > 0) return a;
|
|
2129
2263
|
}
|
|
2130
2264
|
}
|
|
2131
2265
|
return function(e, t) {
|
|
2132
2266
|
let n = t.toLowerCase(), r = [], i = [];
|
|
2133
2267
|
for (let [t, a] of Object.entries(e.types)) {
|
|
2134
|
-
|
|
2268
|
+
ir(t).toLowerCase().includes(n) && r.push(t);
|
|
2135
2269
|
for (let e of a.members ?? []) e.name.toLowerCase().includes(n) && i.push({
|
|
2136
2270
|
key: t,
|
|
2137
2271
|
member: e
|
|
2138
2272
|
});
|
|
2139
2273
|
}
|
|
2140
|
-
let a =
|
|
2274
|
+
let a = cr(r, ir, n), o = cr(i, (e) => e.member.name, n);
|
|
2141
2275
|
return {
|
|
2142
2276
|
kind: "search",
|
|
2143
2277
|
query: t,
|
|
@@ -2147,7 +2281,7 @@ function Wn(e, t) {
|
|
|
2147
2281
|
};
|
|
2148
2282
|
}(e, i > 0 ? n.slice(i + 1) : n);
|
|
2149
2283
|
}
|
|
2150
|
-
function
|
|
2284
|
+
function ur(e, t) {
|
|
2151
2285
|
if (!t || typeof t != "object" && typeof t != "function") return null;
|
|
2152
2286
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
2153
2287
|
for (let i = t; i && i !== Object.prototype; i = Object.getPrototypeOf(i)) for (let a of Object.getOwnPropertyNames(i)) {
|
|
@@ -2157,13 +2291,13 @@ function Gn(e, t) {
|
|
|
2157
2291
|
try {
|
|
2158
2292
|
i = !0 === t[a];
|
|
2159
2293
|
} catch {}
|
|
2160
|
-
let o = i ?
|
|
2294
|
+
let o = i ? J(e, a.slice(2)) : null;
|
|
2161
2295
|
o && !n.includes(o) && n.push(o);
|
|
2162
2296
|
}
|
|
2163
2297
|
if (n.length <= 1) return n[0] ?? null;
|
|
2164
2298
|
let i = (t, n = /* @__PURE__ */ new Set()) => {
|
|
2165
2299
|
for (let r of e.types[t].extends ?? []) {
|
|
2166
|
-
let a =
|
|
2300
|
+
let a = ar(e, t, r);
|
|
2167
2301
|
a && !n.has(a) && (n.add(a), i(a, n));
|
|
2168
2302
|
}
|
|
2169
2303
|
return n;
|
|
@@ -2171,16 +2305,16 @@ function Gn(e, t) {
|
|
|
2171
2305
|
for (let e of n) for (let t of i(e)) a.add(t);
|
|
2172
2306
|
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];
|
|
2173
2307
|
}
|
|
2174
|
-
function
|
|
2308
|
+
function dr(e, t) {
|
|
2175
2309
|
let n = /\bon type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(e)?.[1];
|
|
2176
2310
|
return n ? `\`${t} ${n}\` lists its members.` : null;
|
|
2177
2311
|
}
|
|
2178
|
-
var
|
|
2312
|
+
var fr = [{
|
|
2179
2313
|
match: /^(get|set)?(number)?(format|numfmt)s?$/i,
|
|
2180
2314
|
relies: ["IStyle", "setNumberFormat"],
|
|
2181
2315
|
hint: "Formatting lives on the style: `getStyle().setNumberFormat('0.00%')`, `getStyle().getNumberFormat()`."
|
|
2182
2316
|
}];
|
|
2183
|
-
function
|
|
2317
|
+
function pr(e, t) {
|
|
2184
2318
|
let n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (t) => {
|
|
2185
2319
|
if (i.has(t)) return;
|
|
2186
2320
|
i.add(t);
|
|
@@ -2188,14 +2322,14 @@ function Jn(e, t) {
|
|
|
2188
2322
|
if (o) {
|
|
2189
2323
|
for (let e of o.members ?? []) r.has(e.name) || (r.add(e.name), n.push(e));
|
|
2190
2324
|
for (let n of o.extends ?? []) {
|
|
2191
|
-
let r =
|
|
2325
|
+
let r = ar(e, t, n);
|
|
2192
2326
|
r && a(r);
|
|
2193
2327
|
}
|
|
2194
2328
|
}
|
|
2195
2329
|
};
|
|
2196
2330
|
return a(t), n;
|
|
2197
2331
|
}
|
|
2198
|
-
function
|
|
2332
|
+
function mr(e, t) {
|
|
2199
2333
|
let n = e.toLowerCase(), r = t.toLowerCase();
|
|
2200
2334
|
if (n === r) return 0;
|
|
2201
2335
|
if (n.startsWith(r) || r.startsWith(n)) return 1;
|
|
@@ -2213,24 +2347,24 @@ function Yn(e, t) {
|
|
|
2213
2347
|
}(n, r);
|
|
2214
2348
|
return i <= Math.max(2, Math.floor(.3 * n.length)) ? 1 + i : null;
|
|
2215
2349
|
}
|
|
2216
|
-
var
|
|
2217
|
-
function
|
|
2350
|
+
var hr = (e, t) => `${t ? `${t}.` : ""}${e.signature.replace(/;$/, "")}${e.summary ? ` — ${e.summary}` : ""}`;
|
|
2351
|
+
function gr(e, t, n) {
|
|
2218
2352
|
let r = /Property '([\w$]+)' does not exist on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(t), i = r ? null : /(?:^|[.\s])([A-Za-z_$][\w$]*) is not a function/.exec(t), a = r?.[1] ?? i?.[1];
|
|
2219
2353
|
if (!a) return null;
|
|
2220
2354
|
let o = [];
|
|
2221
|
-
for (let t of
|
|
2355
|
+
for (let t of fr) {
|
|
2222
2356
|
let [n, r] = t.relies;
|
|
2223
2357
|
t.match.test(a) && e.types[n]?.members?.some((e) => e.name === r) && o.push(t.hint);
|
|
2224
2358
|
}
|
|
2225
|
-
let s = r ?
|
|
2359
|
+
let s = r ? J(e, r[2]) : null;
|
|
2226
2360
|
if (s) {
|
|
2227
|
-
let r =
|
|
2361
|
+
let r = pr(e, s), i = /Did you mean '([\w$]+)'/.exec(t)?.[1], c = r.map((e) => ({
|
|
2228
2362
|
member: e,
|
|
2229
|
-
score: e.name === i ? -1 :
|
|
2363
|
+
score: e.name === i ? -1 : mr(a, e.name)
|
|
2230
2364
|
})).filter((e) => e.score !== null).sort((e, t) => e.score - t.score).slice(0, 3);
|
|
2231
2365
|
if (c.length > 0) {
|
|
2232
2366
|
o.push(`Closest on ${s}:`);
|
|
2233
|
-
for (let { member: e } of c) o.push(` ${
|
|
2367
|
+
for (let { member: e } of c) o.push(` ${hr(e)}`);
|
|
2234
2368
|
}
|
|
2235
2369
|
o.push(`\`${n} ${s}\` lists all ${r.length} members.`);
|
|
2236
2370
|
} else if (i) {
|
|
@@ -2239,26 +2373,26 @@ function Zn(e, t, n) {
|
|
|
2239
2373
|
let e = t.slice(0, 3).join(", "), n = t.length > 3 ? ` and ${t.length - 3} more` : "";
|
|
2240
2374
|
return o.push(`'${a}' is a member of ${e}${n}, not of the object it was called on.`), o.join("\n");
|
|
2241
2375
|
}
|
|
2242
|
-
let n =
|
|
2376
|
+
let n = rr.map((t) => J(e, t)).filter((e) => e !== null).flatMap((t) => pr(e, t).map((e) => ({
|
|
2243
2377
|
owner: t,
|
|
2244
2378
|
member: e,
|
|
2245
|
-
score:
|
|
2379
|
+
score: mr(a, e.name)
|
|
2246
2380
|
}))).filter((e) => e.score !== null && e.score > 0 && e.score <= 2).sort((e, t) => e.score - t.score).slice(0, 3);
|
|
2247
2381
|
if (o.length === 0 && n.length === 0) return null;
|
|
2248
2382
|
if (o.unshift(`No SheetXL member is named '${a}'.`), n.length > 0) {
|
|
2249
2383
|
o.push("Closest:");
|
|
2250
|
-
for (let { owner: e, member: t } of n) o.push(` ${
|
|
2384
|
+
for (let { owner: e, member: t } of n) o.push(` ${hr(t, e)}`);
|
|
2251
2385
|
}
|
|
2252
2386
|
}
|
|
2253
2387
|
return o.length > 0 ? o.join("\n") : null;
|
|
2254
2388
|
}
|
|
2255
2389
|
var Y = (e, t, n = `${t}s`) => `${e.toLocaleString("en-US")} ${e === 1 ? t : n}`;
|
|
2256
|
-
function
|
|
2390
|
+
function _r(e, t) {
|
|
2257
2391
|
let n = t ? `${t} · ` : "", r = e.summary ? ` — ${e.summary}` : "", i = e.deprecated ? " (deprecated)" : "";
|
|
2258
2392
|
return `- ${n}\`${a = e.signature, a.replace(/;$/, "")}\`${i}${r}`;
|
|
2259
2393
|
var a;
|
|
2260
2394
|
}
|
|
2261
|
-
function
|
|
2395
|
+
function vr(e, t) {
|
|
2262
2396
|
let n = t?.command ?? "api";
|
|
2263
2397
|
switch (e.kind) {
|
|
2264
2398
|
case "overview": return function(e, t) {
|
|
@@ -2283,7 +2417,7 @@ function $n(e, t) {
|
|
|
2283
2417
|
}
|
|
2284
2418
|
if (r.members) {
|
|
2285
2419
|
s.push(""), e.filter && s.push(`${Y(i.length, "member")} of ${a} matching '${e.filter}':`);
|
|
2286
|
-
for (let e of i) s.push(
|
|
2420
|
+
for (let e of i) s.push(_r(e));
|
|
2287
2421
|
}
|
|
2288
2422
|
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");
|
|
2289
2423
|
}(e, n);
|
|
@@ -2303,16 +2437,16 @@ function $n(e, t) {
|
|
|
2303
2437
|
}
|
|
2304
2438
|
if (e.members.length > 0) {
|
|
2305
2439
|
n.push("", "Members:");
|
|
2306
|
-
for (let { key: t, member: r } of e.members) n.push(
|
|
2440
|
+
for (let { key: t, member: r } of e.members) n.push(_r(r, t));
|
|
2307
2441
|
}
|
|
2308
2442
|
return e.omitted > 0 && n.push("", `…and ${Y(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");
|
|
2309
2443
|
}(e, n);
|
|
2310
2444
|
}
|
|
2311
2445
|
}
|
|
2312
|
-
async function
|
|
2313
|
-
let t =
|
|
2446
|
+
async function yr(e) {
|
|
2447
|
+
let t = lr(await y(), e);
|
|
2314
2448
|
if (t.kind === "member") try {
|
|
2315
|
-
let e = (await
|
|
2449
|
+
let e = (await b()).split(/\r?\n/);
|
|
2316
2450
|
t.sources = t.members.map((t) => function(e, t, n) {
|
|
2317
2451
|
let r = e.slice(t - 1, n), i = Math.min(...r.filter((e) => e.trim()).map((e) => e.length - e.trimStart().length));
|
|
2318
2452
|
return r.map((e) => e.slice(Number.isFinite(i) ? i : 0)).join("\n");
|
|
@@ -2320,7 +2454,7 @@ async function er(e) {
|
|
|
2320
2454
|
} catch {}
|
|
2321
2455
|
return t;
|
|
2322
2456
|
}
|
|
2323
|
-
var
|
|
2457
|
+
var br = {
|
|
2324
2458
|
name: "api",
|
|
2325
2459
|
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.",
|
|
2326
2460
|
params: [{
|
|
@@ -2329,15 +2463,15 @@ var tr = {
|
|
|
2329
2463
|
description: "A type (`ICellRange`), a member (`ICellRange.setValues`), or a word to search for. Omit for the overview. A leading `SheetXL.` is accepted.",
|
|
2330
2464
|
positional: 0
|
|
2331
2465
|
}],
|
|
2332
|
-
run: (e) =>
|
|
2333
|
-
render:
|
|
2334
|
-
},
|
|
2335
|
-
async function
|
|
2336
|
-
await
|
|
2466
|
+
run: (e) => yr(e?.name),
|
|
2467
|
+
render: vr
|
|
2468
|
+
}, xr = i.Feature;
|
|
2469
|
+
async function Sr(e, t, n, r) {
|
|
2470
|
+
await Cr(e, t, "precedents", n, r), await Cr(e, t, "dependents", n, r);
|
|
2337
2471
|
}
|
|
2338
|
-
async function
|
|
2472
|
+
async function Cr(e, t, n, r, i) {
|
|
2339
2473
|
let a = n === "precedents" ? "Precedents" : "Dependents", o = await (n === "precedents" ? t.getPrecedents() : t.getDependents()), s = n === "dependents" && i?.subject ? function(e, t) {
|
|
2340
|
-
let n = e.getSheet(), r = n.getWorkbook()?.getSheets().getItems({ visibility:
|
|
2474
|
+
let n = e.getSheet(), r = n.getWorkbook()?.getSheets().getItems({ visibility: f.Visibility.VeryHidden }) ?? [n], i = /* @__PURE__ */ new Map();
|
|
2341
2475
|
for (let e = 0; e < (t?.length ?? 0); e++) {
|
|
2342
2476
|
let n = t.at(e);
|
|
2343
2477
|
if (n.isINamedRange) continue;
|
|
@@ -2346,7 +2480,7 @@ async function ir(e, t, n, r, i) {
|
|
|
2346
2480
|
}
|
|
2347
2481
|
let a = e.getCoords(), o = [];
|
|
2348
2482
|
for (let e of r) for (let t of e.getMovables().getItems({ type: "chart" })) {
|
|
2349
|
-
let e =
|
|
2483
|
+
let e = G(t);
|
|
2350
2484
|
if (!e || e.getPivotSource()) continue;
|
|
2351
2485
|
let r = null;
|
|
2352
2486
|
for (let t of e.getSeries()) {
|
|
@@ -2357,11 +2491,11 @@ async function ir(e, t, n, r, i) {
|
|
|
2357
2491
|
]) {
|
|
2358
2492
|
if (!e) continue;
|
|
2359
2493
|
let t = e.getCoords();
|
|
2360
|
-
if (e.getSheet() === n &&
|
|
2494
|
+
if (e.getSheet() === n && an(t, a)) {
|
|
2361
2495
|
r = !0;
|
|
2362
2496
|
break;
|
|
2363
2497
|
}
|
|
2364
|
-
r === null && i.get(e.getSheet())?.some((e) =>
|
|
2498
|
+
r === null && i.get(e.getSheet())?.some((e) => an(e, t)) && (r = !1);
|
|
2365
2499
|
}
|
|
2366
2500
|
if (!0 === r) break;
|
|
2367
2501
|
}
|
|
@@ -2374,7 +2508,7 @@ async function ir(e, t, n, r, i) {
|
|
|
2374
2508
|
}(i.subject, o) : [];
|
|
2375
2509
|
if (!o || o.length === 0) {
|
|
2376
2510
|
let t = n === "precedents" ? i?.zeroPrecedents : i?.zeroDependents;
|
|
2377
|
-
s.length > 0 ? (e.h2(`${a} (${
|
|
2511
|
+
s.length > 0 ? (e.h2(`${a} (${wr(s.length)})`), e.text(` ${"charts".padEnd(Er)}${Tr(s)}`), e.blank()) : t && (e.h2(`${a} (0)`), e.blank());
|
|
2378
2512
|
return;
|
|
2379
2513
|
}
|
|
2380
2514
|
let c = await async function(e, t, n) {
|
|
@@ -2386,8 +2520,8 @@ async function ir(e, t, n, r, i) {
|
|
|
2386
2520
|
continue;
|
|
2387
2521
|
}
|
|
2388
2522
|
a++;
|
|
2389
|
-
let c = n.getCounts([
|
|
2390
|
-
r += l, i += c[
|
|
2523
|
+
let c = n.getCounts([xr.Contentful, xr.Formula]), l = c[xr.Contentful] ?? 0;
|
|
2524
|
+
r += l, i += c[xr.Formula] ?? 0;
|
|
2391
2525
|
let u = n.getSheet()?.getName() ?? "";
|
|
2392
2526
|
s.set(u, (s.get(u) ?? 0) + l);
|
|
2393
2527
|
}
|
|
@@ -2397,10 +2531,10 @@ async function ir(e, t, n, r, i) {
|
|
|
2397
2531
|
if (!t) return 0;
|
|
2398
2532
|
let c = 0;
|
|
2399
2533
|
for (let e = 0; e < t.length; e++) {
|
|
2400
|
-
let o = t.at(e), l =
|
|
2534
|
+
let o = t.at(e), l = Nr(o);
|
|
2401
2535
|
if (r.has(l)) continue;
|
|
2402
2536
|
let u = n.get(l);
|
|
2403
|
-
u === void 0 && (++i >
|
|
2537
|
+
u === void 0 && (++i > Or ? (a = !0, u = 0) : (r.add(l), u = await s(o), r.delete(l), n.set(l, u))), c = Math.max(c, u + 1);
|
|
2404
2538
|
}
|
|
2405
2539
|
return c;
|
|
2406
2540
|
};
|
|
@@ -2417,14 +2551,14 @@ async function ir(e, t, n, r, i) {
|
|
|
2417
2551
|
depth: c,
|
|
2418
2552
|
depthCapped: l,
|
|
2419
2553
|
sheets: s,
|
|
2420
|
-
outputs: n === "dependents" ? await
|
|
2554
|
+
outputs: n === "dependents" ? await Ar(t) : {
|
|
2421
2555
|
ranges: [],
|
|
2422
2556
|
cells: 0
|
|
2423
2557
|
}
|
|
2424
2558
|
};
|
|
2425
2559
|
}(t, o, n), l = [`${c.cells} ${c.cells === 1 ? "cell" : "cells"}`];
|
|
2426
|
-
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(
|
|
2427
|
-
let u = i?.home?.getName() ?? null,
|
|
2560
|
+
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(wr(s.length)), e.h2(`${a} (${l.join(" · ")})`);
|
|
2561
|
+
let u = i?.home?.getName() ?? null, d = await async function(e, t, n, r) {
|
|
2428
2562
|
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) => {
|
|
2429
2563
|
let r = e?.length ?? 0;
|
|
2430
2564
|
for (let a = 0; a < r && d.length - p < i - l; a++) d.push({
|
|
@@ -2435,7 +2569,7 @@ async function ir(e, t, n, r, i) {
|
|
|
2435
2569
|
return r;
|
|
2436
2570
|
}, p = 0;
|
|
2437
2571
|
for (c = f(await a(e), null, 0); p < d.length && l < i;) {
|
|
2438
|
-
let { range: e, parent: t, depth: n } = d[p++], r =
|
|
2572
|
+
let { range: e, parent: t, depth: n } = d[p++], r = Nr(e), i = {
|
|
2439
2573
|
range: e,
|
|
2440
2574
|
key: r,
|
|
2441
2575
|
depth: n,
|
|
@@ -2469,11 +2603,11 @@ async function ir(e, t, n, r, i) {
|
|
|
2469
2603
|
};
|
|
2470
2604
|
g(o);
|
|
2471
2605
|
let _ = new Map(h.map((e, t) => [e, t])), v = c - o.length, y = h.map((e) => {
|
|
2472
|
-
let { address: t, sheet: n, isName: r } =
|
|
2606
|
+
let { address: t, sheet: n, isName: r } = Pr(e.range), i;
|
|
2473
2607
|
if (e.mark === "circular") i = "↺ circular";
|
|
2474
2608
|
else if (e.mark === "repeat") i = _.get(e.first) < _.get(e) ? "↑ shown above" : "↓ shown below";
|
|
2475
2609
|
else {
|
|
2476
|
-
i = [
|
|
2610
|
+
i = [Fr(e.range), Mr(e.range, m)].filter(Boolean).join(" ");
|
|
2477
2611
|
let t = e.childCount - e.children.length;
|
|
2478
2612
|
t > 0 && (v += t, i = `${i} ▸ ${t} more`);
|
|
2479
2613
|
}
|
|
@@ -2486,7 +2620,7 @@ async function ir(e, t, n, r, i) {
|
|
|
2486
2620
|
detail: i
|
|
2487
2621
|
};
|
|
2488
2622
|
}), b = y.filter((e) => !e.isName);
|
|
2489
|
-
if (b.length > 0 && b.some((e) => e.sheet !== b[0].sheet)) for (let e of y) e.isName || (e.label = `${e.indent}${
|
|
2623
|
+
if (b.length > 0 && b.some((e) => e.sheet !== b[0].sheet)) for (let e of y) e.isName || (e.label = `${e.indent}${H(e.sheet)}!${e.label.slice(e.indent.length)}`);
|
|
2490
2624
|
let x = [], S = Math.max(...y.map((e) => e.label.length));
|
|
2491
2625
|
for (let e of y) x.push(` ${e.label.padEnd(S)} ${e.detail}`.trimEnd());
|
|
2492
2626
|
if (u && x.push(" ↺ circular reference — the chain returns to a cell already on this branch"), v > 0) {
|
|
@@ -2498,34 +2632,34 @@ async function ir(e, t, n, r, i) {
|
|
|
2498
2632
|
shown: new Set(h.map((e) => e.key))
|
|
2499
2633
|
};
|
|
2500
2634
|
}(t, n, c.areas, r), p = c.outputs.ranges;
|
|
2501
|
-
if (n === "dependents" && p.some((e) => !
|
|
2502
|
-
let n = e.ranges.slice(0,
|
|
2503
|
-
let { address: n, sheet: r } =
|
|
2635
|
+
if (n === "dependents" && p.some((e) => !d.shown.has(Nr(e))) && e.text(` ${"outputs".padEnd(Er)}${function(e, t) {
|
|
2636
|
+
let n = e.ranges.slice(0, kr).map((e) => {
|
|
2637
|
+
let { address: n, sheet: r } = Pr(e);
|
|
2504
2638
|
return [
|
|
2505
|
-
t !== null && r !== t ? `${
|
|
2506
|
-
e.isSingleCell() ?
|
|
2507
|
-
|
|
2639
|
+
t !== null && r !== t ? `${H(r)}!${n}` : n,
|
|
2640
|
+
e.isSingleCell() ? w(e.getCell(), x.Mode.Display)?.display ?? "" : `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
2641
|
+
Mr(e)
|
|
2508
2642
|
].filter(Boolean).join(" ");
|
|
2509
2643
|
}), r = e.ranges.length - n.length;
|
|
2510
2644
|
return r > 0 && n.push(`+${r} more (getDependents())`), n.join(" · ");
|
|
2511
2645
|
}(c.outputs, u)}`), u !== null) {
|
|
2512
2646
|
let t = [...c.sheets].filter(([e]) => e !== u);
|
|
2513
2647
|
if (t.length > 0) {
|
|
2514
|
-
let n = t.map(([e, t]) => `${
|
|
2515
|
-
e.text(` ${"sheets".padEnd(
|
|
2648
|
+
let n = t.map(([e, t]) => `${H(e)} ${t} ${t === 1 ? "cell" : "cells"}`);
|
|
2649
|
+
e.text(` ${"sheets".padEnd(Er)}${n.join(" · ")}`);
|
|
2516
2650
|
}
|
|
2517
2651
|
}
|
|
2518
|
-
s.length > 0 && e.text(` ${"charts".padEnd(
|
|
2519
|
-
for (let t of
|
|
2652
|
+
s.length > 0 && e.text(` ${"charts".padEnd(Er)}${Tr(s)}`);
|
|
2653
|
+
for (let t of d.lines) e.text(t);
|
|
2520
2654
|
e.blank();
|
|
2521
2655
|
}
|
|
2522
|
-
var
|
|
2523
|
-
function
|
|
2524
|
-
let t = e.slice(0,
|
|
2656
|
+
var wr = (e) => `${e} ${e === 1 ? "chart" : "charts"}`;
|
|
2657
|
+
function Tr(e) {
|
|
2658
|
+
let t = e.slice(0, Dr).map(on), n = e.length - t.length;
|
|
2525
2659
|
return n > 0 && t.push(`+${n} more`), t.join(" · ");
|
|
2526
2660
|
}
|
|
2527
|
-
var
|
|
2528
|
-
async function
|
|
2661
|
+
var Er = 10, Dr = 6, Or = 2e3, kr = 4;
|
|
2662
|
+
async function Ar(e) {
|
|
2529
2663
|
let t = /* @__PURE__ */ new Map(), n = await e.getPrecedents(!1);
|
|
2530
2664
|
for (let e = 0; e < (n?.length ?? 0); e++) {
|
|
2531
2665
|
let r = n.at(e);
|
|
@@ -2538,7 +2672,7 @@ async function dr(e) {
|
|
|
2538
2672
|
let a = e.at(n);
|
|
2539
2673
|
if (a.isINamedRange) continue;
|
|
2540
2674
|
let o = [a.getCoords()];
|
|
2541
|
-
for (let e of t.get(a.getSheet()?.getName() ?? "") ?? []) if (o = o.flatMap((t) =>
|
|
2675
|
+
for (let e of t.get(a.getSheet()?.getName() ?? "") ?? []) if (o = o.flatMap((t) => jr(t, e)), o.length === 0) break;
|
|
2542
2676
|
for (let e of o) i += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), r.push(a.getSheet().getRange(e));
|
|
2543
2677
|
}
|
|
2544
2678
|
return {
|
|
@@ -2546,7 +2680,7 @@ async function dr(e) {
|
|
|
2546
2680
|
cells: i
|
|
2547
2681
|
};
|
|
2548
2682
|
}
|
|
2549
|
-
function
|
|
2683
|
+
function jr(e, t) {
|
|
2550
2684
|
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);
|
|
2551
2685
|
if (n > r || i > a) return [e];
|
|
2552
2686
|
let o = [];
|
|
@@ -2568,28 +2702,28 @@ function fr(e, t) {
|
|
|
2568
2702
|
colEnd: e.colEnd
|
|
2569
2703
|
}), o;
|
|
2570
2704
|
}
|
|
2571
|
-
function
|
|
2705
|
+
function Mr(e, t) {
|
|
2572
2706
|
if (e.isINamedRange || !e.isSingleCell()) return "";
|
|
2573
2707
|
let n = e.getCell();
|
|
2574
|
-
if (n.getType() ===
|
|
2708
|
+
if (n.getType() === _.String) return "";
|
|
2575
2709
|
let r = n.getCoords(), i = e.getSheet(), a = [];
|
|
2576
2710
|
if (!t || r.rowIndex < t.rowStart || r.rowIndex > t.rowEnd) {
|
|
2577
|
-
let e =
|
|
2711
|
+
let e = j(i, r, "row");
|
|
2578
2712
|
e && a.push(`row ${JSON.stringify(e.text)}`);
|
|
2579
2713
|
}
|
|
2580
2714
|
if (!t || r.colIndex < t.colStart || r.colIndex > t.colEnd) {
|
|
2581
|
-
let e =
|
|
2715
|
+
let e = j(i, r, "column");
|
|
2582
2716
|
e && a.push(`col ${JSON.stringify(e.text)}`);
|
|
2583
2717
|
}
|
|
2584
2718
|
return a.join(" ");
|
|
2585
2719
|
}
|
|
2586
|
-
function
|
|
2720
|
+
function Nr(e) {
|
|
2587
2721
|
let t = e.isINamedRange ? e.getId() : null;
|
|
2588
2722
|
if (t) return `name:${t}`;
|
|
2589
2723
|
let n = e.getCoords();
|
|
2590
2724
|
return `${e.getSheet()?.getName() ?? ""}!${n.rowStart},${n.colStart},${n.rowEnd},${n.colEnd}`;
|
|
2591
2725
|
}
|
|
2592
|
-
function
|
|
2726
|
+
function Pr(e) {
|
|
2593
2727
|
let t = e.getSheet()?.getName() ?? "";
|
|
2594
2728
|
if (e.isINamedRange) return {
|
|
2595
2729
|
address: e.getName(),
|
|
@@ -2603,40 +2737,40 @@ function hr(e) {
|
|
|
2603
2737
|
isName: !1
|
|
2604
2738
|
};
|
|
2605
2739
|
}
|
|
2606
|
-
function
|
|
2740
|
+
function Fr(e) {
|
|
2607
2741
|
if (e.isINamedRange) {
|
|
2608
2742
|
let t = e.getRanges();
|
|
2609
2743
|
return t ? `name → ${t.getAddress()}` : "name";
|
|
2610
2744
|
}
|
|
2611
2745
|
if (e.isSingleCell()) {
|
|
2612
|
-
let t = e.getCell(), n =
|
|
2746
|
+
let t = e.getCell(), n = w(t, x.Mode.Display), r = t.getFormulaText(), i = n ? n.display : "(empty)";
|
|
2613
2747
|
return r ? `${i} ${r}` : i;
|
|
2614
2748
|
}
|
|
2615
|
-
let t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(
|
|
2749
|
+
let t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(xr.Formula)];
|
|
2616
2750
|
if (n.length === 1 && n[0].getRange().isEqual(e)) {
|
|
2617
2751
|
let e = n[0].getCell().getFormulaText();
|
|
2618
2752
|
if (e) return `${t} ${e}`;
|
|
2619
2753
|
}
|
|
2620
2754
|
return t;
|
|
2621
2755
|
}
|
|
2622
|
-
var
|
|
2623
|
-
features: (e) =>
|
|
2756
|
+
var Ir = {
|
|
2757
|
+
features: (e) => St(e),
|
|
2624
2758
|
mode: (e, t) => function(e, t, n) {
|
|
2625
2759
|
let r = new Map(Object.values(n).map((e) => [e.toLowerCase(), e])).get(e.trim().toLowerCase());
|
|
2626
2760
|
if (!r) throw Error(`Unknown ${t} '${e}'. Values: ${Object.values(n).join(", ")}.`);
|
|
2627
2761
|
return r;
|
|
2628
|
-
}(e, t,
|
|
2629
|
-
},
|
|
2630
|
-
function
|
|
2762
|
+
}(e, t, x.Mode)
|
|
2763
|
+
}, Lr = Object.keys(Ir);
|
|
2764
|
+
function Rr(e) {
|
|
2631
2765
|
let t = {};
|
|
2632
2766
|
for (let [n, r] of Object.entries(e)) {
|
|
2633
|
-
let e =
|
|
2634
|
-
if (!e) throw Error(`Unknown report option '${n}'. Options: ${
|
|
2767
|
+
let e = Ir[n];
|
|
2768
|
+
if (!e) throw Error(`Unknown report option '${n}'. Options: ${Lr.join(", ")}.`);
|
|
2635
2769
|
t[n] = e(r, n);
|
|
2636
2770
|
}
|
|
2637
2771
|
return t;
|
|
2638
2772
|
}
|
|
2639
|
-
var
|
|
2773
|
+
var zr = i.Feature, Br = [
|
|
2640
2774
|
["formatCells", "format cells"],
|
|
2641
2775
|
["formatColumns", "format columns"],
|
|
2642
2776
|
["formatRows", "format rows"],
|
|
@@ -2650,32 +2784,32 @@ var br = i.Feature, xr = [
|
|
|
2650
2784
|
["pivotTables", "pivot tables"],
|
|
2651
2785
|
["objects", "edit objects"],
|
|
2652
2786
|
["scenarios", "edit scenarios"]
|
|
2653
|
-
],
|
|
2787
|
+
], Vr = [["structure", "structure"], ["windows", "windows"]], X = (e) => {
|
|
2654
2788
|
let t = e.hasPassword() ? " · password" : "";
|
|
2655
2789
|
return e.isLocked() ? `locked${t}` : e.isPaused() ? `paused${t} — nothing is refused until resume()` : null;
|
|
2656
|
-
},
|
|
2790
|
+
}, Hr = (e) => {
|
|
2657
2791
|
let t = e.getProperties();
|
|
2658
2792
|
if (!t) return null;
|
|
2659
|
-
let n =
|
|
2793
|
+
let n = Br.filter(([e]) => !0 === t[e]).map(([, e]) => e);
|
|
2660
2794
|
return n.length > 0 ? n.join(", ") : null;
|
|
2661
|
-
},
|
|
2795
|
+
}, Ur = (e) => {
|
|
2662
2796
|
let t = e.getProperties();
|
|
2663
2797
|
if (!t) return null;
|
|
2664
|
-
let n =
|
|
2798
|
+
let n = Vr.filter(([e]) => !0 !== t[e]).map(([, e]) => e);
|
|
2665
2799
|
return n.length > 0 ? n.join(", ") : null;
|
|
2666
|
-
},
|
|
2667
|
-
let t =
|
|
2800
|
+
}, Wr = (e) => {
|
|
2801
|
+
let t = X(e);
|
|
2668
2802
|
if (!t) return null;
|
|
2669
|
-
let n =
|
|
2803
|
+
let n = Ur(e);
|
|
2670
2804
|
return n ? `${n} ${t}` : t;
|
|
2671
|
-
},
|
|
2805
|
+
}, Gr = (e) => [...e.getEntireRange().getRegions(zr.Unlock)], Kr = (e) => {
|
|
2672
2806
|
let t = 0;
|
|
2673
2807
|
for (let n of e) {
|
|
2674
2808
|
let e = n.getCoords();
|
|
2675
2809
|
t += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
|
|
2676
2810
|
}
|
|
2677
2811
|
return t;
|
|
2678
|
-
},
|
|
2812
|
+
}, qr = (t) => {
|
|
2679
2813
|
let n = null;
|
|
2680
2814
|
for (let e of t) {
|
|
2681
2815
|
let t = e.getCoords();
|
|
@@ -2687,75 +2821,88 @@ var br = i.Feature, xr = [
|
|
|
2687
2821
|
} : { ...t };
|
|
2688
2822
|
}
|
|
2689
2823
|
return n ? e.rangeToString(n) ?? "" : "";
|
|
2690
|
-
},
|
|
2691
|
-
function
|
|
2692
|
-
let t = e.getProtection(), n =
|
|
2824
|
+
}, Jr = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`;
|
|
2825
|
+
function Yr(e) {
|
|
2826
|
+
let t = e.getProtection(), n = X(t);
|
|
2693
2827
|
if (!n) return null;
|
|
2694
|
-
let r =
|
|
2828
|
+
let r = Gr(e), i = [r.length > 0 ? `${Jr(Kr(r), "editable cell")} · ${Jr(r.length, "region")}` : "no editable cells", n];
|
|
2695
2829
|
return !1 === t.getProperties()?.showFormulas && i.push("formulas hidden"), {
|
|
2696
|
-
extent:
|
|
2830
|
+
extent: qr(r),
|
|
2697
2831
|
detail: i.join(" · ")
|
|
2698
2832
|
};
|
|
2699
2833
|
}
|
|
2700
|
-
function
|
|
2701
|
-
let n = t.getProtection(), r =
|
|
2834
|
+
function Xr(e, t) {
|
|
2835
|
+
let n = t.getProtection(), r = X(n);
|
|
2702
2836
|
if (!r) return;
|
|
2703
2837
|
e.h2(`Protection (${r})`);
|
|
2704
2838
|
let i = (e) => ` ${e.padEnd(10)}`;
|
|
2705
|
-
e.text(`${i("allowed")}${
|
|
2706
|
-
let a =
|
|
2839
|
+
e.text(`${i("allowed")}${Hr(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`);
|
|
2840
|
+
let a = Gr(t);
|
|
2707
2841
|
if (a.length === 0) return e.text(`${i("editable")}none — every cell refuses a write`), void e.blank();
|
|
2708
|
-
e.text(`${i("editable")}${
|
|
2842
|
+
e.text(`${i("editable")}${Jr(Kr(a), "cell")} · ${Jr(a.length, "region")}`), mt(e, a, {
|
|
2709
2843
|
maxRegions: 12,
|
|
2710
|
-
payload:
|
|
2711
|
-
recovery: `${
|
|
2844
|
+
payload: ut(zr.Unlock, null),
|
|
2845
|
+
recovery: `${U(t.getEntireRange())}.getRegions("unlock") lists all ${a.length}`
|
|
2712
2846
|
}), e.blank();
|
|
2713
2847
|
}
|
|
2714
|
-
function
|
|
2848
|
+
function Zr(e) {
|
|
2715
2849
|
if (!e.getSheet().getProtection().isLocked()) return null;
|
|
2716
|
-
let t = [...e.getRegions(
|
|
2850
|
+
let t = [...e.getRegions(zr.Unlock)], n = e.getRowCount() * e.getColumnCount(), r = Kr(t);
|
|
2717
2851
|
if (r === 0) return "sheet locked — no cell here takes a write";
|
|
2718
2852
|
if (r === n) return "sheet locked — every cell here is editable";
|
|
2719
2853
|
let i = e.getSheet().getProtectedRanges().getItems({ address: e }).some((e) => !e.isUnlocked());
|
|
2720
|
-
return `sheet locked — ${r} of ${
|
|
2854
|
+
return `sheet locked — ${r} of ${Jr(n, "cell")} editable (${qr(t)})` + (i ? " · some behind a range password" : "");
|
|
2721
2855
|
}
|
|
2722
|
-
function
|
|
2856
|
+
function Qr(e) {
|
|
2723
2857
|
return e.getSheet().getProtection().isLocked() ? e.isEditAllowed() ? "true — unlocked on a protected sheet" : "false — the sheet is protected and this cell is locked" : null;
|
|
2724
2858
|
}
|
|
2725
|
-
function
|
|
2859
|
+
function $r(e) {
|
|
2726
2860
|
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;
|
|
2727
2861
|
}
|
|
2728
|
-
function
|
|
2729
|
-
let t = new
|
|
2862
|
+
function ei(e) {
|
|
2863
|
+
let t = new z(), n = !0 === e.isISheetProtection;
|
|
2730
2864
|
t.h1(n ? "Sheet Protection" : "Workbook Protection"), t.blank();
|
|
2731
|
-
let r =
|
|
2865
|
+
let r = X(e);
|
|
2732
2866
|
t.fact(`State: ${r ?? "not protected"}${e.isReadOnly() ? " · read-only" : ""}`);
|
|
2733
2867
|
let i = r ? "" : " (when next locked)";
|
|
2734
2868
|
if (n) {
|
|
2735
|
-
let n =
|
|
2869
|
+
let n = Hr(e);
|
|
2736
2870
|
(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");
|
|
2737
2871
|
} else {
|
|
2738
|
-
let n =
|
|
2872
|
+
let n = Ur(e);
|
|
2739
2873
|
(r || e.getProperties()) && t.fact(`Refused${i}: ${n ?? "nothing"}`);
|
|
2740
2874
|
}
|
|
2741
2875
|
return t.toLines().join("\n").trimEnd();
|
|
2742
2876
|
}
|
|
2743
|
-
function
|
|
2744
|
-
let t = new
|
|
2745
|
-
t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${
|
|
2877
|
+
function ti(e) {
|
|
2878
|
+
let t = new z(), n = e.getRanges();
|
|
2879
|
+
t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${wt(n)}`), t.fact(`Cells: ${n.size}`), t.fact("Password: " + (e.hasPassword() ? e.isUnlocked() ? "set · unlocked for this session" : "set · unlock(password) grants access" : "none"));
|
|
2746
2880
|
let r = n.getSheet().getProtection().isLocked();
|
|
2747
2881
|
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();
|
|
2748
2882
|
}
|
|
2749
|
-
var
|
|
2750
|
-
async function
|
|
2883
|
+
var ni = i.Feature;
|
|
2884
|
+
async function ri(e, t) {
|
|
2751
2885
|
let n = e.getSheet().getRange(e.getCoords());
|
|
2752
2886
|
e = n.getCell();
|
|
2753
|
-
let r = new
|
|
2754
|
-
r.h1(`Cell — ${
|
|
2887
|
+
let r = new z();
|
|
2888
|
+
r.h1(`Cell — ${H(e.getSheet().getName())}!${e.getAddress()}`), r.blank();
|
|
2755
2889
|
let i = !!e.getFormulaText(), a = e.getType();
|
|
2756
2890
|
(function(e, t) {
|
|
2757
|
-
let n =
|
|
2758
|
-
(n || i)
|
|
2891
|
+
let n = w(t, x.Mode.Display), r = w(t, x.Mode.Value), i = t.getFormulaText(), a = e.toLines().length;
|
|
2892
|
+
if (n || i) {
|
|
2893
|
+
if (e.fact(`Type: ${t.getType()}`), n && e.fact(`Display: ${n.display}`), r && r.match !== n?.match) {
|
|
2894
|
+
let i = function(e) {
|
|
2895
|
+
let t = e.getDate();
|
|
2896
|
+
if (!t) return null;
|
|
2897
|
+
let n = (e, t = 2) => String(e).padStart(t, "0"), r = `${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
|
|
2898
|
+
if (!g.getEngine().isDateFormat(e.getStyle().getNumberFormat())) return e.getValue() < 1 ? r : null;
|
|
2899
|
+
let i = `${n(t.getFullYear(), 4)}-${n(t.getMonth() + 1)}-${n(t.getDate())}`;
|
|
2900
|
+
return r === "00:00:00" ? i : `${i}T${r}`;
|
|
2901
|
+
}(t);
|
|
2902
|
+
e.fact(`Value: ${r.display}${i && i !== n?.match ? ` (${i})` : ""}`);
|
|
2903
|
+
}
|
|
2904
|
+
i && e.fact(`Formula: ${e.codespan(i)}`);
|
|
2905
|
+
}
|
|
2759
2906
|
let o = t.getHyperlink();
|
|
2760
2907
|
o && e.fact(`Hyperlink: ${o.getAddress()}`);
|
|
2761
2908
|
let s = t.getSpans(), c = !t.isTopLeft();
|
|
@@ -2776,56 +2923,56 @@ async function Rr(e, t) {
|
|
|
2776
2923
|
}
|
|
2777
2924
|
return r.join(" · ");
|
|
2778
2925
|
}(u, t.getCoords())}`);
|
|
2779
|
-
let d =
|
|
2780
|
-
d.length > 0 && e.fact(`Names: ${d.map((e) => `${e.getName()} (${
|
|
2781
|
-
let f =
|
|
2926
|
+
let d = Ut(t.getSheet().getRange(t.getCoords()));
|
|
2927
|
+
d.length > 0 && e.fact(`Names: ${d.map((e) => `${e.getName()} (${Ct(e.getRanges())})`).join(" · ")}`);
|
|
2928
|
+
let f = Qr(t);
|
|
2782
2929
|
f && e.fact(`Editable: ${f}`);
|
|
2783
2930
|
let p = t.getErrors();
|
|
2784
2931
|
p.length > 0 && e.fact(`Errors: ${p.join("; ")}`);
|
|
2785
2932
|
let m = t.getWarnings();
|
|
2786
2933
|
m.length > 0 && e.fact(`Warnings: ${m.join("; ")}`);
|
|
2787
|
-
let h = function(e) {
|
|
2788
|
-
let
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2934
|
+
let h = function(e, t) {
|
|
2935
|
+
let n = t.getStyle(), r = t.getSheet().getWorkbook()?.getStyles().getNormal() ?? null, i = n.getNamed().getName(), a = i === (r?.getNamed().getName() ?? "Normal"), o = n.getNumberFormat(), s = He(o), c = s ? `${s} ${e.codespan(o)}` : null, l = r ? oe(n, r) : null, u = k(n), d = re(n), f = r ? ae(n, r) : null, p = [
|
|
2936
|
+
a ? null : i,
|
|
2937
|
+
c ? `format ${c}` : null,
|
|
2938
|
+
l ? `font ${l}` : null,
|
|
2939
|
+
u ? `fill ${u}` : null,
|
|
2940
|
+
d.length > 0 ? `border ${d.join(", ")}` : null,
|
|
2941
|
+
f ? `align ${f}` : null
|
|
2795
2942
|
].filter(Boolean);
|
|
2796
|
-
return
|
|
2797
|
-
}(t);
|
|
2943
|
+
return p.length > 0 ? p.join(" · ") : null;
|
|
2944
|
+
}(e, t);
|
|
2798
2945
|
h && e.fact(`Style (effective): ${h}`), e.toLines().length > a && e.blank();
|
|
2799
2946
|
})(r, e);
|
|
2800
2947
|
let o = function(e, t) {
|
|
2801
|
-
if (!t.getFormulaText() && t.getType() ===
|
|
2948
|
+
if (!t.getFormulaText() && t.getType() === _.Null) return null;
|
|
2802
2949
|
let n = e.getSurrounding({ contentOnly: !0 });
|
|
2803
2950
|
return n.isSingleCell() ? null : n;
|
|
2804
2951
|
}(n, e);
|
|
2805
2952
|
return o && function(e, t, n) {
|
|
2806
2953
|
let r = t.getCoords(), i = t.getSheet();
|
|
2807
2954
|
e.h2(`Current Region — ${n.getAddress()} · ${n.getRowCount()}×${n.getColumnCount()}`);
|
|
2808
|
-
let a =
|
|
2955
|
+
let a = pe(n), o = (e) => {
|
|
2809
2956
|
if (!a || a.byColumn !== (e === "row")) return null;
|
|
2810
2957
|
let t = e === "row" ? r.rowIndex : r.colIndex;
|
|
2811
2958
|
if (t < a.start) return null;
|
|
2812
2959
|
let n = a.lines.find((e) => e.index === t);
|
|
2813
|
-
if (n?.sums) return `totals, ${
|
|
2814
|
-
let i = a.byColumn ? `row ${a.start + 1}` : `column ${
|
|
2960
|
+
if (n?.sums) return `totals, ${ge(n.sums)}`;
|
|
2961
|
+
let i = a.byColumn ? `row ${a.start + 1}` : `column ${M(a.start)}`;
|
|
2815
2962
|
return t === a.start ? "totals" : `below the totals ${i}`;
|
|
2816
2963
|
}, s = [["row", [
|
|
2817
2964
|
String(r.rowIndex + 1),
|
|
2818
|
-
|
|
2965
|
+
ce(j(i, r, "row")),
|
|
2819
2966
|
o("row")
|
|
2820
2967
|
].filter(Boolean).join(" · ")], ["column", [
|
|
2821
|
-
|
|
2822
|
-
|
|
2968
|
+
M(r.colIndex),
|
|
2969
|
+
ce(j(i, r, "column")),
|
|
2823
2970
|
o("column")
|
|
2824
2971
|
].filter(Boolean).join(" · ")]];
|
|
2825
2972
|
for (let [t, n] of s) e.text(` ${t.padEnd(7)}${n}`);
|
|
2826
2973
|
e.blank();
|
|
2827
2974
|
}(r, e, o), function(e, t, n) {
|
|
2828
|
-
let r = t.getCoords(), i = n?.getCoords() ??
|
|
2975
|
+
let r = t.getCoords(), i = n?.getCoords() ?? ai(r), a = t.getSheet(), o = a.getRange({
|
|
2829
2976
|
rowStart: r.rowIndex,
|
|
2830
2977
|
rowEnd: r.rowIndex,
|
|
2831
2978
|
colStart: i.colStart,
|
|
@@ -2835,7 +2982,7 @@ async function Rr(e, t) {
|
|
|
2835
2982
|
rowEnd: i.rowEnd,
|
|
2836
2983
|
colStart: r.colIndex,
|
|
2837
2984
|
colEnd: r.colIndex
|
|
2838
|
-
}), c = [
|
|
2985
|
+
}), c = [oi(o, "row", r.colIndex), oi(s, "column", r.rowIndex)].filter((e) => e !== null);
|
|
2839
2986
|
if (c.length === 0) return;
|
|
2840
2987
|
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({
|
|
2841
2988
|
rowStart: r.rowIndex,
|
|
@@ -2852,7 +2999,7 @@ async function Rr(e, t) {
|
|
|
2852
2999
|
let t = d.map((e) => {
|
|
2853
3000
|
let t = u >= e.start && u <= e.end, n = e.range.getAddress(), r;
|
|
2854
3001
|
if (e.r1c1 === null) r = e.range.isSingleCell() ? function(e) {
|
|
2855
|
-
let t =
|
|
3002
|
+
let t = w(e, x.Mode.Display);
|
|
2856
3003
|
return t ? `${t.display} typed` : "blank";
|
|
2857
3004
|
}(e.range.getCell()) : e.end - e.start + 1 + " cells, no formula";
|
|
2858
3005
|
else {
|
|
@@ -2863,28 +3010,28 @@ async function Rr(e, t) {
|
|
|
2863
3010
|
address: n,
|
|
2864
3011
|
detail: t ? `${r} ← this cell` : r
|
|
2865
3012
|
};
|
|
2866
|
-
}), n = Math.max(...t.map((e) => e.address.length)), r = t.slice(0,
|
|
3013
|
+
}), n = Math.max(...t.map((e) => e.address.length)), r = t.slice(0, ii);
|
|
2867
3014
|
for (let t of r) e.text(` ${t.address.padEnd(n)} ${t.detail}`);
|
|
2868
3015
|
t.length > r.length && e.text(` …${t.length - r.length} more · getRegions("formula") on ${p.getAddress()} lists them`);
|
|
2869
3016
|
}
|
|
2870
3017
|
e.blank();
|
|
2871
|
-
}(r, e, o), await
|
|
3018
|
+
}(r, e, o), await Sr(r, e, t, {
|
|
2872
3019
|
home: e.getSheet(),
|
|
2873
3020
|
subject: n,
|
|
2874
3021
|
zeroPrecedents: i,
|
|
2875
|
-
zeroDependents: i || a !==
|
|
3022
|
+
zeroDependents: i || a !== _.Null && a !== _.String
|
|
2876
3023
|
}), r.toLines().join("\n").trimEnd();
|
|
2877
3024
|
}
|
|
2878
|
-
var
|
|
3025
|
+
var ii = 8, ai = (e) => ({
|
|
2879
3026
|
rowStart: e.rowIndex,
|
|
2880
3027
|
rowEnd: e.rowIndex,
|
|
2881
3028
|
colStart: e.colIndex,
|
|
2882
3029
|
colEnd: e.colIndex
|
|
2883
3030
|
});
|
|
2884
|
-
function
|
|
3031
|
+
function oi(e, t, n) {
|
|
2885
3032
|
if (e.isSingleCell()) return null;
|
|
2886
3033
|
let r = [];
|
|
2887
|
-
for (let n of e.getRegions(
|
|
3034
|
+
for (let n of e.getRegions(ni.Formula)) {
|
|
2888
3035
|
let e = n.getCoords();
|
|
2889
3036
|
r.push({
|
|
2890
3037
|
start: t === "row" ? e.colStart : e.rowStart,
|
|
@@ -2903,7 +3050,7 @@ function Vr(e, t, n) {
|
|
|
2903
3050
|
let a = r.filter((e) => e.r1c1 === i), s = a[0].start, c = a[a.length - 1].end;
|
|
2904
3051
|
if (n < s || n > c) continue;
|
|
2905
3052
|
let l = [], u = s;
|
|
2906
|
-
for (let n of r) n.end < s || n.start > c || (n.start > u && l.push(
|
|
3053
|
+
for (let n of r) n.end < s || n.start > c || (n.start > u && l.push(si(e, t, u, n.start - 1)), l.push(n), u = n.end + 1);
|
|
2907
3054
|
return {
|
|
2908
3055
|
axis: t,
|
|
2909
3056
|
segments: l,
|
|
@@ -2915,7 +3062,7 @@ function Vr(e, t, n) {
|
|
|
2915
3062
|
}
|
|
2916
3063
|
return null;
|
|
2917
3064
|
}
|
|
2918
|
-
function
|
|
3065
|
+
function si(e, t, n, r) {
|
|
2919
3066
|
let i = e.getCoords();
|
|
2920
3067
|
return {
|
|
2921
3068
|
start: n,
|
|
@@ -2934,13 +3081,13 @@ function Hr(e, t, n, r) {
|
|
|
2934
3081
|
})
|
|
2935
3082
|
};
|
|
2936
3083
|
}
|
|
2937
|
-
async function
|
|
2938
|
-
let n = new
|
|
2939
|
-
n.h1(`Cell Range — ${
|
|
2940
|
-
let r =
|
|
2941
|
-
r && n.text(`Protection: ${r}`), n.blank(),
|
|
3084
|
+
async function ci(e, t) {
|
|
3085
|
+
let n = new z();
|
|
3086
|
+
n.h1(`Cell Range — ${Tt(e)}`);
|
|
3087
|
+
let r = Zr(e);
|
|
3088
|
+
r && n.text(`Protection: ${r}`), n.blank(), Et(n, e), function(e, t, n) {
|
|
2942
3089
|
if (!1 === n?.profile || t.isSingleCell() || !t.isContentful()) return;
|
|
2943
|
-
let r =
|
|
3090
|
+
let r = ue({
|
|
2944
3091
|
getRowCount: () => t.getRowCount(),
|
|
2945
3092
|
getColumnCount: () => t.getColumnCount(),
|
|
2946
3093
|
getCell: () => t.getCell(),
|
|
@@ -2951,10 +3098,10 @@ async function Ur(e, t) {
|
|
|
2951
3098
|
e.blank();
|
|
2952
3099
|
}(n, e, t);
|
|
2953
3100
|
let a = function(e, t, n) {
|
|
2954
|
-
let r = n?.mode ??
|
|
3101
|
+
let r = n?.mode ?? x.Mode.Display, i = n?.maxCells ?? 1e3, { rowStart: a, colStart: o } = t.getCoords(), s = t.getRowHeaders(), c = t.getColumnHeaders(), l = /* @__PURE__ */ new Map(), u = [], d = 0, f = !1;
|
|
2955
3102
|
t.forEach((e, t) => {
|
|
2956
3103
|
if (d >= i) return f = !0, { break: !0 };
|
|
2957
|
-
let n = t.getCell(), a = n.getFormulaText(), o =
|
|
3104
|
+
let n = t.getCell(), a = n.getFormulaText(), o = w(n, r);
|
|
2958
3105
|
if (!o && !a) return;
|
|
2959
3106
|
let s = {
|
|
2960
3107
|
text: (o?.display ?? "").replace(/\|/g, "\\|").replace(/[\r\n]+/g, " "),
|
|
@@ -2976,14 +3123,14 @@ async function Ur(e, t) {
|
|
|
2976
3123
|
rowEnd: p[p.length - 1],
|
|
2977
3124
|
colStart: h[0],
|
|
2978
3125
|
colEnd: h[h.length - 1]
|
|
2979
|
-
}),
|
|
2980
|
-
e.h2(`Values (${
|
|
2981
|
-
let
|
|
3126
|
+
}), _ = `${d} cell${d === 1 ? "" : "s"}`, v = g.toString() !== t.toString();
|
|
3127
|
+
e.h2(`Values (${v ? `${V(g)} · ` : ""}${_})`);
|
|
3128
|
+
let y = e.beginFrame(h.map((e) => c.at(e - o).getText()));
|
|
2982
3129
|
for (let e of p) {
|
|
2983
3130
|
let t = l.get(e);
|
|
2984
|
-
|
|
3131
|
+
y.addRow(h.map((e) => t?.get(e) ?? { text: "" }), s.at(e - a).getText());
|
|
2985
3132
|
}
|
|
2986
|
-
return
|
|
3133
|
+
return y.endFrame(), f && e.text(`…truncated at ${i} cells · narrow the address, or summarize the whole range with getStats()`), e.blank(), { spills: u };
|
|
2987
3134
|
}(n, e, t);
|
|
2988
3135
|
return function(e, t, n) {
|
|
2989
3136
|
let r = [];
|
|
@@ -3006,54 +3153,54 @@ async function Ur(e, t) {
|
|
|
3006
3153
|
let n = Math.max(...t.map((e) => e.address.length));
|
|
3007
3154
|
for (let { address: r, valuesRange: i } of t) e.text(` ${r.padEnd(n)} ${i}`);
|
|
3008
3155
|
e.blank();
|
|
3009
|
-
}(n, a.spills), await
|
|
3156
|
+
}(n, a.spills), await Wt(n, e), Mn(n, e.getMovables()), Ht(n, "Conditional Formats", e.getConditionalFormats(), at), Ht(n, "Data Validations", e.getDataValidations(), ot), await Sr(n, e, t, {
|
|
3010
3157
|
home: e.getSheet(),
|
|
3011
3158
|
subject: e
|
|
3012
3159
|
}), n.toLines().join("\n").trimEnd();
|
|
3013
3160
|
}
|
|
3014
|
-
function
|
|
3015
|
-
let t = new
|
|
3016
|
-
t.h1(`Conditional Format — ${
|
|
3161
|
+
function li(e) {
|
|
3162
|
+
let t = new z(), n = e.getRanges();
|
|
3163
|
+
t.h1(`Conditional Format — ${wt(n)}`), t.blank(), t.fact(`Order: ${e.getIndex() + 1}`);
|
|
3017
3164
|
let r = e.getScale();
|
|
3018
|
-
if (r) t.fact(`Rule: ${
|
|
3165
|
+
if (r) t.fact(`Rule: ${rt(r)}`);
|
|
3019
3166
|
else {
|
|
3020
3167
|
let n = e.getCondition();
|
|
3021
3168
|
t.fact(`Rule: ${n?.toString() || "none — this rule tests nothing"}`);
|
|
3022
|
-
let r =
|
|
3169
|
+
let r = tt(e.getStyle());
|
|
3023
3170
|
r && t.fact(`Format: ${r}`);
|
|
3024
3171
|
}
|
|
3025
3172
|
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();
|
|
3026
3173
|
}
|
|
3027
|
-
function
|
|
3028
|
-
let t = new
|
|
3174
|
+
function ui(e) {
|
|
3175
|
+
let t = new z();
|
|
3029
3176
|
t.h1("Counts");
|
|
3030
3177
|
let n = !1;
|
|
3031
3178
|
for (let [r, i] of Object.entries(e)) i > 0 && (t.fact(`${r}: ${i}`), n = !0);
|
|
3032
3179
|
return n || t.fact("None"), t.toLines().join("\n").trimEnd();
|
|
3033
3180
|
}
|
|
3034
|
-
function
|
|
3035
|
-
let t = new
|
|
3036
|
-
t.h1(`Data Validation — ${
|
|
3181
|
+
function di(e) {
|
|
3182
|
+
let t = new z(), n = e.getRanges();
|
|
3183
|
+
t.h1(`Data Validation — ${wt(n)}`), t.blank();
|
|
3037
3184
|
let r = e.getCondition();
|
|
3038
3185
|
t.fact(`Rule: ${r?.toString() || "none — anything is accepted here"}`);
|
|
3039
|
-
let i =
|
|
3186
|
+
let i = st(r);
|
|
3040
3187
|
i && t.fact(`Allowed: ${i}`), t.fact("Blanks: " + (e.isIncludeBlanks() ? "allowed" : "rejected"));
|
|
3041
3188
|
let a = e.getAlertStyle();
|
|
3042
3189
|
if (t.fact(`Alert: ${a}${a === s.AlertStyle.Stop ? " — the entry is refused" : " — the entry is accepted anyway"}`), e.isShowAlertMessage()) {
|
|
3043
|
-
let n =
|
|
3190
|
+
let n = fi(e.getAlertTitle(), e.getAlertMessage());
|
|
3044
3191
|
n && t.fact(`Alert Message: ${n}`);
|
|
3045
3192
|
}
|
|
3046
3193
|
if (e.isShowPromptMessage()) {
|
|
3047
|
-
let n =
|
|
3194
|
+
let n = fi(e.getPromptTitle(), e.getPromptMessage());
|
|
3048
3195
|
n && t.fact(`Prompt: ${n}`);
|
|
3049
3196
|
}
|
|
3050
3197
|
return e.isHideDropdown() && t.fact("Dropdown: hidden"), t.fact(`Cells: ${n.size}`), t.toLines().join("\n").trimEnd();
|
|
3051
3198
|
}
|
|
3052
|
-
var
|
|
3199
|
+
var fi = (e, t) => {
|
|
3053
3200
|
let n = [e?.trim(), t?.trim()].filter(Boolean);
|
|
3054
3201
|
return n.length > 0 ? n.join(" — ") : null;
|
|
3055
|
-
},
|
|
3056
|
-
function
|
|
3202
|
+
}, pi = "function", mi = "named", hi = "tableReference", gi = "tableColumn", _i = "externalReference", vi = [["isReferenceOnly", "reference-only"], ["isVolatile", "volatile"]], yi = (e, t) => e ? ` (${H(e)}!${t})` : "";
|
|
3203
|
+
function bi(e, t, n, r) {
|
|
3057
3204
|
if (e === "external") return "another workbook — not resolvable from here";
|
|
3058
3205
|
if (!n) return "";
|
|
3059
3206
|
switch (e) {
|
|
@@ -3064,17 +3211,17 @@ function ti(e, t, n, r) {
|
|
|
3064
3211
|
case "named": return function(e, t) {
|
|
3065
3212
|
let n = t.getNames(), r = n.getByName(e) ?? n.getByName(e, !0);
|
|
3066
3213
|
if (r) {
|
|
3067
|
-
let e =
|
|
3214
|
+
let e = yi(r.getScope(), r.getName()), t = r.getRanges?.();
|
|
3068
3215
|
return !t || t.isInvalid() ? `defined name — reference does not resolve${e}` : `${t.toString()}${e}`;
|
|
3069
3216
|
}
|
|
3070
3217
|
let i = t.getCalculation().getNamedFormulas().getByName(e);
|
|
3071
|
-
return i ? `=${i.getExpression()}${
|
|
3218
|
+
return i ? `=${i.getExpression()}${yi(i.getScope(), i.getName())}` : "unknown — evaluates to #NAME?";
|
|
3072
3219
|
}(t, n);
|
|
3073
3220
|
case "table": {
|
|
3074
3221
|
let e = n.getTables().getByName(t) ?? n.getWorkbook()?.getSheets().getItems().map((e) => e.getTables().getByName(t)).find(Boolean) ?? null;
|
|
3075
3222
|
return e ? ((e, t) => {
|
|
3076
3223
|
let n = e.getSheet(), r = e.toString();
|
|
3077
|
-
return !n || t && n.getName() === t.getName() || r.includes("!") ? r : `${
|
|
3224
|
+
return !n || t && n.getName() === t.getName() || r.includes("!") ? r : `${H(n.getName())}!${r}`;
|
|
3078
3225
|
})(e.getRange(), n) : "unknown — evaluates to #NAME?";
|
|
3079
3226
|
}
|
|
3080
3227
|
case "column": {
|
|
@@ -3087,9 +3234,9 @@ function ti(e, t, n, r) {
|
|
|
3087
3234
|
}
|
|
3088
3235
|
return "";
|
|
3089
3236
|
}
|
|
3090
|
-
async function
|
|
3091
|
-
let n = t?.maxTokens ?? 200, r = new
|
|
3092
|
-
if (r.h1(i ? `Name — ${
|
|
3237
|
+
async function xi(e, t) {
|
|
3238
|
+
let n = t?.maxTokens ?? 200, r = new z(), i = ((e) => e.isINamed ? e : null)(e);
|
|
3239
|
+
if (r.h1(i ? `Name — ${Mt(i)}` : "Formula"), r.text(r.codespan("=" + e.getExpression())), r.blank(), i) {
|
|
3093
3240
|
i.isHidden() && r.fact("Hidden: true — not offered in the UI; formulas resolve it normally");
|
|
3094
3241
|
let e = i.getComment();
|
|
3095
3242
|
e && r.fact(`Comment: ${e}`);
|
|
@@ -3106,10 +3253,10 @@ async function ni(e, t) {
|
|
|
3106
3253
|
}
|
|
3107
3254
|
if ((r = n) && typeof r == "object" && !0 === r.isIRange) return void e.fact(`Value: spills ${n.getRowCount()}×${n.getColumnCount()} — an array result`);
|
|
3108
3255
|
var r;
|
|
3109
|
-
let i =
|
|
3256
|
+
let i = T(n);
|
|
3110
3257
|
e.fact(`Value: ${i ? i.display : "(empty)"}`);
|
|
3111
3258
|
}(r, e), r.fact(`Status: ${e.getCalculationStatus()}`), e.isValid() || r.fact("Valid: false — the text did not parse as a complete expression");
|
|
3112
|
-
let a =
|
|
3259
|
+
let a = vi.filter(([t]) => e[t]()).map(([, e]) => e);
|
|
3113
3260
|
a.length > 0 && r.fact(`Flags: ${a.join(" · ")}`), r.blank();
|
|
3114
3261
|
let o = e.getReferences(), s = t?.context ?? o?.getSheet() ?? null, c = function(e, t) {
|
|
3115
3262
|
let n = /* @__PURE__ */ new Map(), r = null;
|
|
@@ -3118,19 +3265,19 @@ async function ni(e, t) {
|
|
|
3118
3265
|
if (!e) continue;
|
|
3119
3266
|
let a;
|
|
3120
3267
|
switch (i.type) {
|
|
3121
|
-
case
|
|
3268
|
+
case pi:
|
|
3122
3269
|
a = "function";
|
|
3123
3270
|
break;
|
|
3124
|
-
case
|
|
3271
|
+
case mi:
|
|
3125
3272
|
a = "named";
|
|
3126
3273
|
break;
|
|
3127
|
-
case
|
|
3274
|
+
case hi:
|
|
3128
3275
|
a = "table", r = e;
|
|
3129
3276
|
break;
|
|
3130
|
-
case
|
|
3277
|
+
case gi:
|
|
3131
3278
|
a = "column";
|
|
3132
3279
|
break;
|
|
3133
|
-
case
|
|
3280
|
+
case _i:
|
|
3134
3281
|
a = "external";
|
|
3135
3282
|
break;
|
|
3136
3283
|
default: continue;
|
|
@@ -3140,7 +3287,7 @@ async function ni(e, t) {
|
|
|
3140
3287
|
kind: a,
|
|
3141
3288
|
text: e,
|
|
3142
3289
|
uses: 1,
|
|
3143
|
-
resolution:
|
|
3290
|
+
resolution: bi(a, e, t, r)
|
|
3144
3291
|
});
|
|
3145
3292
|
}
|
|
3146
3293
|
return [...n.values()];
|
|
@@ -3164,7 +3311,7 @@ async function ni(e, t) {
|
|
|
3164
3311
|
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()}`);
|
|
3165
3312
|
else r.text("None");
|
|
3166
3313
|
r.blank(), i && await async function(e, t) {
|
|
3167
|
-
await t.getDirectDependents() || (e.h2("Dependents (0)"), e.text(" None — no formula references this name"), e.blank()), await
|
|
3314
|
+
await t.getDirectDependents() || (e.h2("Dependents (0)"), e.text(" None — no formula references this name"), e.blank()), await Sr(e, t);
|
|
3168
3315
|
}(r, i);
|
|
3169
3316
|
let l = e.getTokens();
|
|
3170
3317
|
if (r.h2("Tokens"), l.length === 0) r.text("None");
|
|
@@ -3193,7 +3340,7 @@ async function ni(e, t) {
|
|
|
3193
3340
|
}
|
|
3194
3341
|
return r.toLines().join("\n").trimEnd();
|
|
3195
3342
|
}
|
|
3196
|
-
var
|
|
3343
|
+
var Si = [
|
|
3197
3344
|
"Workbook_Open",
|
|
3198
3345
|
"Auto_Open",
|
|
3199
3346
|
"Workbook_BeforeClose",
|
|
@@ -3206,42 +3353,42 @@ var ri = [
|
|
|
3206
3353
|
"Worksheet_Activate",
|
|
3207
3354
|
"Worksheet_BeforeDoubleClick",
|
|
3208
3355
|
"Worksheet_Calculate"
|
|
3209
|
-
],
|
|
3356
|
+
], Ci = (e) => {
|
|
3210
3357
|
let t = [];
|
|
3211
|
-
for (let n of
|
|
3358
|
+
for (let n of Si) RegExp(`(?:Sub|Function)\\s+${n}\\b`, "i").test(e) && t.push(n);
|
|
3212
3359
|
return t;
|
|
3213
|
-
},
|
|
3360
|
+
}, wi = (e) => {
|
|
3214
3361
|
try {
|
|
3215
3362
|
return e.getFunctions().getItems({ type: "autoRun" }).map((e) => e.getName());
|
|
3216
3363
|
} catch {
|
|
3217
3364
|
return [];
|
|
3218
3365
|
}
|
|
3219
|
-
},
|
|
3366
|
+
}, Ti = (e) => {
|
|
3220
3367
|
let t = e.getScope();
|
|
3221
3368
|
return t ? !0 === t.isISheet ? `sheet '${t.getName()}'` : "workbook" : "global";
|
|
3222
|
-
},
|
|
3369
|
+
}, Ei = (e) => {
|
|
3223
3370
|
let t = ((e) => e.getSource()?.trim() ?? "")(e);
|
|
3224
3371
|
return {
|
|
3225
3372
|
module: e,
|
|
3226
3373
|
name: e.getName(),
|
|
3227
3374
|
language: e.getLanguage(),
|
|
3228
|
-
scope:
|
|
3375
|
+
scope: Ti(e),
|
|
3229
3376
|
body: t,
|
|
3230
3377
|
lines: t.length === 0 ? 0 : t.split("\n").length,
|
|
3231
|
-
runsInExcel:
|
|
3232
|
-
runsHere:
|
|
3378
|
+
runsInExcel: Ci(t),
|
|
3379
|
+
runsHere: wi(e),
|
|
3233
3380
|
executable: !!e.toJSON().compiled
|
|
3234
3381
|
};
|
|
3235
3382
|
};
|
|
3236
|
-
function
|
|
3383
|
+
function Di(e) {
|
|
3237
3384
|
let t = [], n = e.getModules?.();
|
|
3238
3385
|
n && t.push(...n.getItems({ language: null }));
|
|
3239
3386
|
for (let n of e.getSheets().getItems()) t.push(...n.getModules().getItems({ language: null }));
|
|
3240
3387
|
return t;
|
|
3241
3388
|
}
|
|
3242
|
-
function
|
|
3389
|
+
function Oi(e, t, n) {
|
|
3243
3390
|
if (t.length === 0) return;
|
|
3244
|
-
let r = t.map(
|
|
3391
|
+
let r = t.map(Ei), i = r.filter((e) => e.lines > 0);
|
|
3245
3392
|
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();
|
|
3246
3393
|
e.h2(`Code (${i.length} module${i.length === 1 ? "" : "s"})`);
|
|
3247
3394
|
let a = i.filter((e) => !e.executable);
|
|
@@ -3277,7 +3424,7 @@ function li(e, t, n) {
|
|
|
3277
3424
|
}
|
|
3278
3425
|
f.endFrame(), c.length < i.length && e.text(` …and ${i.length - c.length} more · wb.getModules() renders the full view`), e.blank();
|
|
3279
3426
|
}
|
|
3280
|
-
function
|
|
3427
|
+
function ki(e, t, n, r) {
|
|
3281
3428
|
n(`Module — ${t.name}`), e.blank();
|
|
3282
3429
|
let i = [
|
|
3283
3430
|
`language: ${t.language}`,
|
|
@@ -3289,127 +3436,129 @@ function ui(e, t, n, r) {
|
|
|
3289
3436
|
let a = r?.maxSourceLines ?? 200, o = t.body.split("\n"), s = o.length > a ? o.slice(0, a) : o;
|
|
3290
3437
|
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`);
|
|
3291
3438
|
}
|
|
3292
|
-
function
|
|
3293
|
-
let n = new
|
|
3294
|
-
return
|
|
3439
|
+
function Ai(e, t) {
|
|
3440
|
+
let n = new z();
|
|
3441
|
+
return ki(n, Ei(e), (e) => n.h1(e), t), n.toLines().join("\n").trimEnd();
|
|
3295
3442
|
}
|
|
3296
|
-
function
|
|
3297
|
-
let n = new
|
|
3443
|
+
function ji(e, t) {
|
|
3444
|
+
let n = new z(), r = e.getItems({ language: null }) ?? [];
|
|
3298
3445
|
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();
|
|
3299
|
-
let i = r.map(
|
|
3300
|
-
|
|
3301
|
-
for (let e of i) e.lines !== 0 && (
|
|
3446
|
+
let i = r.map(Ei);
|
|
3447
|
+
Oi(n, r, t);
|
|
3448
|
+
for (let e of i) e.lines !== 0 && (ki(n, e, (e) => n.h2(e), t), n.blank());
|
|
3302
3449
|
return n.toLines().join("\n").trimEnd();
|
|
3303
3450
|
}
|
|
3304
|
-
var
|
|
3305
|
-
async function
|
|
3306
|
-
let n = new
|
|
3451
|
+
var Mi = [["formula", "Names"], ["table", "Tables"]];
|
|
3452
|
+
async function Ni(e, t) {
|
|
3453
|
+
let n = new z(), r = e.getItems({ includeHidden: !0 }) ?? [];
|
|
3307
3454
|
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();
|
|
3308
|
-
let i = new Set(
|
|
3309
|
-
for (let [e, i] of
|
|
3455
|
+
let i = new Set(Mi.map(([e]) => e));
|
|
3456
|
+
for (let [e, i] of Mi) await W(n, r.filter((t) => t.getType() === e), {
|
|
3310
3457
|
...t,
|
|
3311
3458
|
heading: i,
|
|
3312
3459
|
symbols: r
|
|
3313
3460
|
});
|
|
3314
3461
|
let a = r.filter((e) => !i.has(e.getType())), o = [...new Set(a.map((e) => e.getType()))].sort();
|
|
3315
|
-
for (let e of o) await
|
|
3462
|
+
for (let e of o) await W(n, a.filter((t) => t.getType() === e), {
|
|
3316
3463
|
...t,
|
|
3317
3464
|
heading: e,
|
|
3318
3465
|
symbols: r
|
|
3319
3466
|
});
|
|
3320
3467
|
return n.toLines().join("\n").trimEnd();
|
|
3321
3468
|
}
|
|
3322
|
-
var
|
|
3469
|
+
var Pi = (e) => {
|
|
3323
3470
|
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
3324
3471
|
let t = Object.getPrototypeOf(e);
|
|
3325
3472
|
return t === Object.prototype || t === null;
|
|
3326
3473
|
};
|
|
3327
|
-
function
|
|
3328
|
-
let n = t?.maxCells ?? 1e3, r = Array.isArray(e) ? e : [e], i = new
|
|
3474
|
+
function Fi(e, t) {
|
|
3475
|
+
let n = t?.maxCells ?? 1e3, r = Array.isArray(e) ? e : [e], i = new z();
|
|
3329
3476
|
if (i.h1("Records"), i.text(`Count: ${r.length}`), i.blank(), r.length === 0) return i.text("None"), i.toLines().join("\n").trimEnd();
|
|
3330
3477
|
let a = (e) => {
|
|
3331
3478
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
3332
3479
|
for (let r of e) for (let e of Object.keys(r ?? {})) n.has(e) || (n.add(e), t.push(e));
|
|
3333
3480
|
return t;
|
|
3334
|
-
}, o = Math.max(1, a(r).length), s =
|
|
3481
|
+
}, o = Math.max(1, a(r).length), s = D(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);
|
|
3335
3482
|
if (l.length === 0) return i.text("No fields"), i.toLines().join("\n").trimEnd();
|
|
3336
3483
|
let u = i.beginFrame(l);
|
|
3337
|
-
for (let e of c) u.addRow(l.map((t) =>
|
|
3484
|
+
for (let e of c) u.addRow(l.map((t) => Ii(e?.[t])));
|
|
3338
3485
|
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();
|
|
3339
3486
|
}
|
|
3340
|
-
var
|
|
3487
|
+
var Ii = (e) => {
|
|
3341
3488
|
if (e == null) return { text: "" };
|
|
3342
3489
|
if (typeof e == "function") return { text: "[Function]" };
|
|
3343
|
-
if (typeof e == "bigint" || typeof e == "symbol") return { text:
|
|
3490
|
+
if (typeof e == "bigint" || typeof e == "symbol") return { text: Ri(String(e)) };
|
|
3344
3491
|
if (typeof e == "object") {
|
|
3345
3492
|
if (e instanceof Date) return { text: e.toISOString() };
|
|
3346
3493
|
let t = e;
|
|
3347
|
-
if (!0 === t.isFormulaError || !0 === t.isIRichData) return { text:
|
|
3348
|
-
if (
|
|
3494
|
+
if (!0 === t.isFormulaError || !0 === t.isIRichData) return { text: Ri(Li(e)) };
|
|
3495
|
+
if (Pi(e) || Array.isArray(e)) {
|
|
3349
3496
|
let t;
|
|
3350
3497
|
try {
|
|
3351
3498
|
t = JSON.stringify(e) ?? String(e);
|
|
3352
3499
|
} catch {
|
|
3353
3500
|
t = "[circular]";
|
|
3354
3501
|
}
|
|
3355
|
-
return { text:
|
|
3502
|
+
return { text: Ri(t) };
|
|
3356
3503
|
}
|
|
3357
|
-
return { text:
|
|
3504
|
+
return { text: Ri(String(e)) };
|
|
3358
3505
|
}
|
|
3359
|
-
let t =
|
|
3506
|
+
let t = Ri(Li(e).replace(/[\r\n]+/g, " "));
|
|
3360
3507
|
return typeof e == "number" ? {
|
|
3361
3508
|
text: t,
|
|
3362
3509
|
alignment: "right"
|
|
3363
3510
|
} : { text: t };
|
|
3364
|
-
},
|
|
3511
|
+
}, Li = (e) => {
|
|
3365
3512
|
try {
|
|
3366
|
-
return
|
|
3513
|
+
return T(e)?.match ?? String(e);
|
|
3367
3514
|
} catch {
|
|
3368
3515
|
return String(e);
|
|
3369
3516
|
}
|
|
3370
|
-
},
|
|
3371
|
-
function
|
|
3372
|
-
let n = e.length, r =
|
|
3517
|
+
}, Ri = (e) => e.length > 80 ? `${e.slice(0, 79)}…` : e;
|
|
3518
|
+
function zi(e, t) {
|
|
3519
|
+
let n = e.length, r = D(n, t?.maxRanges ?? 100), i = Math.min(n, r), a = [];
|
|
3373
3520
|
for (let t = 0; t < i; t++) {
|
|
3374
3521
|
let n = e.at(t);
|
|
3375
3522
|
a.push({
|
|
3376
|
-
...
|
|
3377
|
-
detail: [
|
|
3523
|
+
...Pr(n),
|
|
3524
|
+
detail: [Fr(n), Mr(n)].filter(Boolean).join(" ")
|
|
3378
3525
|
});
|
|
3379
3526
|
}
|
|
3380
|
-
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.getSheet()?.getName(), l = new
|
|
3381
|
-
if (l.h1(u ? `Ranges — ${
|
|
3382
|
-
let d = a.map((e) => s && !e.isName ? `${
|
|
3527
|
+
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.getSheet()?.getName(), l = new z(), u = a.length > 0 && !s && !!c;
|
|
3528
|
+
if (l.h1(u ? `Ranges — ${H(c)} (${n})` : `Ranges (${n})`), a.length === 0) return l.text("none"), l.toLines().join("\n").trimEnd();
|
|
3529
|
+
let d = a.map((e) => s && !e.isName ? `${H(e.sheet)}!${e.address}` : e.address), f = Math.max(...d.map((e) => e.length));
|
|
3383
3530
|
for (let e = 0; e < a.length; e++) l.text(` ${d[e].padEnd(f)} ${a[e].detail}`.trimEnd());
|
|
3384
3531
|
return i < n && l.text(` …and ${n - i} more · loop the collection in code to see them all`), l.toLines().join("\n").trimEnd();
|
|
3385
3532
|
}
|
|
3386
|
-
var
|
|
3387
|
-
async function
|
|
3388
|
-
let n = new
|
|
3389
|
-
n.h1(`Sheet — ${
|
|
3533
|
+
var Bi = (e) => /<location\b[^>]*?\sref="([^"]*)"/.exec(e.getXML() ?? "")?.[1] ?? "";
|
|
3534
|
+
async function Vi(e, t) {
|
|
3535
|
+
let n = new z(), r = e.getSelectedRange(), i = e.getUsedRange();
|
|
3536
|
+
n.h1(`Sheet — ${H(e.getName())}${function(e) {
|
|
3390
3537
|
let t = e.getWorkbook(), n = "";
|
|
3391
3538
|
t && t.getSelectedSheet()?.getId() === e.getId() && (n += " (selected)");
|
|
3392
3539
|
let r = e.getVisibility();
|
|
3393
|
-
return r ===
|
|
3394
|
-
}(e)}`), n.text(`Used: ${i ?
|
|
3395
|
-
let a =
|
|
3396
|
-
|
|
3540
|
+
return r === f.Visibility.Hidden ? n += " (hidden)" : r === f.Visibility.VeryHidden && (n += " (very hidden)"), e.getProtection().isLocked() && (n += " (protected)"), n;
|
|
3541
|
+
}(e)}`), n.text(`Used: ${i ? V(i) : "empty"}`), n.text(`Selection: ${V(r)}`);
|
|
3542
|
+
let a = Vt(e);
|
|
3543
|
+
a && n.text(`Outline: ${a}`), n.blank();
|
|
3544
|
+
let o = i ?? r;
|
|
3545
|
+
Et(n, o), Dt(n, o, {
|
|
3397
3546
|
profile: !0,
|
|
3398
3547
|
...t
|
|
3399
3548
|
});
|
|
3400
|
-
let
|
|
3401
|
-
return
|
|
3549
|
+
let s = t?.features === void 0 ? null : typeof t.features == "string" ? [t.features] : [...t.features];
|
|
3550
|
+
return s && !s.some((e) => e === "unlock" || e === "protection") || Xr(n, e), await Wt(n, o), function(e, t) {
|
|
3402
3551
|
if (t.length === 0) return;
|
|
3403
3552
|
let n = t.map((e) => ({
|
|
3404
|
-
address:
|
|
3553
|
+
address: Bi(e),
|
|
3405
3554
|
name: e.getName()
|
|
3406
3555
|
})), r = Math.max(...n.map((e) => e.address.length));
|
|
3407
3556
|
e.h2(`Pivot Tables (${t.length})`);
|
|
3408
3557
|
for (let t of n) e.text(r > 0 ? ` ${t.address.padEnd(r)} ${t.name}` : ` ${t.name}`);
|
|
3409
3558
|
e.text(" Read-only — the cells hold the last refresh; getXML() on one is its definition."), e.blank();
|
|
3410
|
-
}(n, e.getPivotTables().getItems()),
|
|
3559
|
+
}(n, e.getPivotTables().getItems()), Mn(n, e.getMovables().getItems()), n.toLines().join("\n").trimEnd();
|
|
3411
3560
|
}
|
|
3412
|
-
var
|
|
3561
|
+
var Hi = 1e4, Ui = [
|
|
3413
3562
|
["numericalCount", "Numbers"],
|
|
3414
3563
|
["sum", "Sum"],
|
|
3415
3564
|
["min", "Min"],
|
|
@@ -3417,26 +3566,26 @@ var Ci = 1e4, wi = [
|
|
|
3417
3566
|
["average", "Average"],
|
|
3418
3567
|
["stdDev", "StdDev"]
|
|
3419
3568
|
];
|
|
3420
|
-
function
|
|
3421
|
-
let n = new
|
|
3569
|
+
function Wi(t) {
|
|
3570
|
+
let n = new z(), r = t.getCoords(), i = r ? e.rangeToString(r) : null;
|
|
3422
3571
|
n.h1(i ? `Stats — ${i}` : "Stats");
|
|
3423
3572
|
let a = t.getTypedCounts();
|
|
3424
3573
|
n.fact(`Cells: ${t.getSize()}`), n.fact(`Values: ${t.getCount()}`);
|
|
3425
|
-
let o = a[
|
|
3574
|
+
let o = a[_.Error] ?? 0;
|
|
3426
3575
|
o > 0 && n.fact(`Errors: ${o}`);
|
|
3427
3576
|
let s = function(e) {
|
|
3428
|
-
let t = e.getFrequencies({ limit:
|
|
3577
|
+
let t = e.getFrequencies({ limit: Hi }), n = t.getUniqueCount();
|
|
3429
3578
|
if (n === 0) return null;
|
|
3430
|
-
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${
|
|
3579
|
+
if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${Hi.toLocaleString("en-US")})`;
|
|
3431
3580
|
if (n === t.getTotalCount()) return `${n.toLocaleString("en-US")}, no repeats`;
|
|
3432
3581
|
let r = [];
|
|
3433
3582
|
for (let [e, n] of t.getValueCounts()) {
|
|
3434
3583
|
let i = t.getExtent(e);
|
|
3435
3584
|
r.push({
|
|
3436
|
-
label:
|
|
3585
|
+
label: T(e)?.display ?? "",
|
|
3437
3586
|
content: n,
|
|
3438
3587
|
styled: n,
|
|
3439
|
-
blocks: i &&
|
|
3588
|
+
blocks: i && Gi(i) === n ? [i] : []
|
|
3440
3589
|
});
|
|
3441
3590
|
}
|
|
3442
3591
|
let i = {
|
|
@@ -3444,63 +3593,63 @@ function Ti(t) {
|
|
|
3444
3593
|
maxValues: 8,
|
|
3445
3594
|
recovery: "getStats().getFrequencies()"
|
|
3446
3595
|
};
|
|
3447
|
-
if (n <= 8) return `${n} · ${
|
|
3596
|
+
if (n <= 8) return `${n} · ${F(r, i)}`;
|
|
3448
3597
|
let a = r.filter((e) => e.content > 1);
|
|
3449
|
-
return `${n.toLocaleString("en-US")} · repeats ${
|
|
3598
|
+
return `${n.toLocaleString("en-US")} · repeats ${F(a, i)}`;
|
|
3450
3599
|
}(t);
|
|
3451
3600
|
s && n.fact(`Distinct: ${s}`);
|
|
3452
3601
|
let c = t.getAggregates({ onError: "ignore" });
|
|
3453
|
-
for (let [e, t] of
|
|
3602
|
+
for (let [e, t] of Ui) {
|
|
3454
3603
|
let r = c[e];
|
|
3455
|
-
r != null && n.fact(`${t}: ${
|
|
3604
|
+
r != null && n.fact(`${t}: ${S(r)}`);
|
|
3456
3605
|
}
|
|
3457
3606
|
let l = [];
|
|
3458
|
-
for (let [e, t] of Object.entries(a)) e !==
|
|
3607
|
+
for (let [e, t] of Object.entries(a)) e !== _.Null && t && l.push(`${e.charAt(0).toUpperCase()}${e.slice(1)}: ${t}`);
|
|
3459
3608
|
return l.length > 0 && (n.blank(), n.h2("Type"), n.fact(l)), n.toLines().join("\n").trimEnd();
|
|
3460
3609
|
}
|
|
3461
|
-
var
|
|
3462
|
-
function
|
|
3463
|
-
let t = new
|
|
3610
|
+
var Gi = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
|
|
3611
|
+
function Ki(e) {
|
|
3612
|
+
let t = new z();
|
|
3464
3613
|
t.h1("Style"), t.text(`Named: ${e.getNamed().getName()}`), t.blank();
|
|
3465
3614
|
let n = e.toJSON(), r = n ? Object.entries(n).filter(([, e]) => e !== void 0) : [];
|
|
3466
3615
|
if (r.length === 0) t.fact("No direct styling (inherits the named style)");
|
|
3467
3616
|
else for (let [e, n] of r) t.fact(`${e}: ${t.codespan(typeof n == "string" ? n : JSON.stringify(n))}`);
|
|
3468
3617
|
return t.toLines().join("\n").trimEnd();
|
|
3469
3618
|
}
|
|
3470
|
-
function
|
|
3471
|
-
let n = t?.maxCells ?? 1e3, r =
|
|
3619
|
+
function qi(e, t) {
|
|
3620
|
+
let n = t?.maxCells ?? 1e3, r = Ji(e) ? e.getValues() : e, i = r.length, a = r.reduce((e, t) => Math.max(e, t?.length ?? 0), 0), o = new z();
|
|
3472
3621
|
if (o.h1("Values"), o.text(`Size: ${i}×${a}`), o.blank(), i === 0 || a === 0) return o.text("None"), o.toLines().join("\n").trimEnd();
|
|
3473
|
-
let s =
|
|
3474
|
-
for (let e of c) l.addRow(Array.from({ length: a }, (t, n) =>
|
|
3622
|
+
let s = D(i, Math.max(1, Math.floor(n / a))), c = i > s ? r.slice(0, s) : r, l = o.beginFrame(Array(a).fill(""));
|
|
3623
|
+
for (let e of c) l.addRow(Array.from({ length: a }, (t, n) => Yi(e?.[n])));
|
|
3475
3624
|
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();
|
|
3476
3625
|
}
|
|
3477
|
-
var
|
|
3626
|
+
var Ji = (e) => !!e && typeof e == "object" && !0 === e.isIRange, Yi = (e) => {
|
|
3478
3627
|
if (e == null) return { text: "" };
|
|
3479
|
-
let t = (
|
|
3628
|
+
let t = (T(e)?.display ?? "").replace(/[\r\n]+/g, " ");
|
|
3480
3629
|
return typeof e == "number" ? {
|
|
3481
3630
|
text: t,
|
|
3482
3631
|
alignment: "right"
|
|
3483
3632
|
} : { text: t };
|
|
3484
|
-
}, Z = i.Feature,
|
|
3633
|
+
}, Z = i.Feature, Xi = [
|
|
3485
3634
|
[Z.Font, "fonts"],
|
|
3486
3635
|
[Z.NumberFormat, "formats"],
|
|
3487
3636
|
[Z.Fill, "fills"],
|
|
3488
3637
|
[Z.Borders, "borders"],
|
|
3489
3638
|
[Z.Alignment, "alignments"]
|
|
3490
3639
|
];
|
|
3491
|
-
async function
|
|
3492
|
-
let n = new
|
|
3640
|
+
async function Zi(e, t) {
|
|
3641
|
+
let n = new z();
|
|
3493
3642
|
n.h1(`Workbook — ${e.getName() ?? "Untitled"}`), n.text(`Locale: ${e.getRuntime().getLocale()}`);
|
|
3494
3643
|
let i = e.getCalculation();
|
|
3495
3644
|
i.getStatus() === r.Status.Off ? n.text("Calculation: off — formulas have not been evaluated; values are as loaded. wb.getCalculation().calculate() evaluates them") : i.getStatus() === r.Status.Error ? n.text("Calculation: error — the engine failed to start; values are as loaded. wb.getCalculation().start() tries again") : i.getCalculationMode() === r.CalculationMode.Manual && n.text("Calculation: manual — values are as of the last calculation. wb.getCalculation().calculate() refreshes them");
|
|
3496
|
-
let a =
|
|
3645
|
+
let a = Wr(e.getProtection());
|
|
3497
3646
|
a && n.text(`Protection: ${a}`), n.blank();
|
|
3498
|
-
let o = e.getSheets().getItems({ visibility:
|
|
3647
|
+
let o = e.getSheets().getItems({ visibility: f.Visibility.VeryHidden }), s = e.getSelectedSheet(), c = e.getStyles().getNormal(), l = [];
|
|
3499
3648
|
for (let e of o) {
|
|
3500
|
-
let t =
|
|
3649
|
+
let t = Qi(e, c);
|
|
3501
3650
|
l.push({
|
|
3502
3651
|
sheet: e,
|
|
3503
|
-
label:
|
|
3652
|
+
label: ia(e, e.getId() === s.getId()),
|
|
3504
3653
|
counts: t.counts,
|
|
3505
3654
|
lines: t.lines,
|
|
3506
3655
|
formulaSignature: t.formulaSignature
|
|
@@ -3513,22 +3662,22 @@ async function Mi(e, t) {
|
|
|
3513
3662
|
t ? t.push(e) : u.set(e.formulaSignature, [e]);
|
|
3514
3663
|
}
|
|
3515
3664
|
for (let e of u.values()) if (!(e.length < 2)) for (let t of e) {
|
|
3516
|
-
let n = e.filter((e) => e !== t).map((e) =>
|
|
3665
|
+
let n = e.filter((e) => e !== t).map((e) => H(e.sheet.getName()));
|
|
3517
3666
|
t.lines.push({
|
|
3518
3667
|
label: "twin of",
|
|
3519
3668
|
extent: n.join(", "),
|
|
3520
3669
|
detail: ""
|
|
3521
3670
|
});
|
|
3522
3671
|
}
|
|
3523
|
-
let
|
|
3672
|
+
let d = l;
|
|
3524
3673
|
if (l.length > 250) {
|
|
3525
|
-
|
|
3674
|
+
d = l.slice(0, 250);
|
|
3526
3675
|
let e = l.find((e) => e.sheet.getId() === s.getId());
|
|
3527
|
-
e && !
|
|
3676
|
+
e && !d.includes(e) && (d[d.length - 1] = e);
|
|
3528
3677
|
}
|
|
3529
3678
|
n.h2(`Sheets (${l.length})`), n.blank();
|
|
3530
|
-
let p =
|
|
3531
|
-
for (let e of
|
|
3679
|
+
let p = d.flatMap((e) => e.lines).filter((e) => e.detail), m = Math.max(9, ...d.flatMap((e) => e.lines).map((e) => e.label.length)) + 1, h = Math.max(0, ...p.map((e) => e.extent.length)) + 2;
|
|
3680
|
+
for (let e of d) {
|
|
3532
3681
|
n.h3(e.label), e.lines.length === 0 && n.text(" empty");
|
|
3533
3682
|
for (let t of e.lines) {
|
|
3534
3683
|
let e = t.detail ? ` ${t.label.padEnd(m)}${t.extent.padEnd(h)}${t.detail}` : ` ${t.label.padEnd(m)}${t.extent}`;
|
|
@@ -3536,20 +3685,24 @@ async function Mi(e, t) {
|
|
|
3536
3685
|
}
|
|
3537
3686
|
n.blank();
|
|
3538
3687
|
}
|
|
3539
|
-
return
|
|
3688
|
+
return d.length < l.length && (n.text(`…and ${l.length - d.length} more sheets · wb.getSheets().getItems() lists all`), n.blank()), aa(n, "Errors", l, Z.Error), aa(n, "Calc Failures", l, Z.CalcError), aa(n, "Circular References", l, Z.Circular), await W(n, e.getNames().getItems({
|
|
3540
3689
|
type: "formula",
|
|
3541
3690
|
includeHidden: !0
|
|
3542
3691
|
}) ?? [], {
|
|
3543
3692
|
maxNames: t?.maxNames ?? 30,
|
|
3544
3693
|
recovery: "wb.getNames() renders the full view",
|
|
3545
3694
|
symbols: e.getNames().getItems({ includeHidden: !0 }) ?? []
|
|
3546
|
-
}),
|
|
3695
|
+
}), Oi(n, Di(e), t), n.toLines().join("\n").trimEnd();
|
|
3547
3696
|
}
|
|
3548
|
-
function
|
|
3697
|
+
function Qi(e, t) {
|
|
3549
3698
|
let n = e.getUsedRange();
|
|
3550
3699
|
if (!n) return {
|
|
3551
3700
|
counts: null,
|
|
3552
|
-
lines: [
|
|
3701
|
+
lines: [
|
|
3702
|
+
...ea(e),
|
|
3703
|
+
...$i(e),
|
|
3704
|
+
...ta(e)
|
|
3705
|
+
],
|
|
3553
3706
|
formulaRegions: 0,
|
|
3554
3707
|
formulaSignature: ""
|
|
3555
3708
|
};
|
|
@@ -3560,20 +3713,20 @@ function Ni(e, t) {
|
|
|
3560
3713
|
Z.CalcError,
|
|
3561
3714
|
Z.Circular,
|
|
3562
3715
|
Z.Table
|
|
3563
|
-
]), i = [], a =
|
|
3716
|
+
]), i = [], a = Ot(n), o = [...n.getRegions(Z.Formula)];
|
|
3564
3717
|
if (a.length > 0) {
|
|
3565
3718
|
let e = function(e, t) {
|
|
3566
|
-
let n =
|
|
3567
|
-
return n.length === 0 ? null : n.map(([e, t]) => `${e} ×${
|
|
3719
|
+
let n = qe(e, t);
|
|
3720
|
+
return n.length === 0 ? null : n.map(([e, t]) => `${e} ×${Ae(t)}`).join(" · ");
|
|
3568
3721
|
}(n, o);
|
|
3569
3722
|
i.push({
|
|
3570
3723
|
label: "content",
|
|
3571
|
-
extent:
|
|
3724
|
+
extent: ra(a),
|
|
3572
3725
|
detail: [
|
|
3573
3726
|
Q(r[Z.Contentful] ?? 0, "cell"),
|
|
3574
3727
|
Q(a.length, "block"),
|
|
3575
3728
|
e,
|
|
3576
|
-
`${
|
|
3729
|
+
`${U(n)} lists the blocks`
|
|
3577
3730
|
].filter(Boolean).join(" · ")
|
|
3578
3731
|
});
|
|
3579
3732
|
}
|
|
@@ -3586,7 +3739,7 @@ function Ni(e, t) {
|
|
|
3586
3739
|
}
|
|
3587
3740
|
s = t.sort().join("\n"), i.push({
|
|
3588
3741
|
label: "formula",
|
|
3589
|
-
extent:
|
|
3742
|
+
extent: ra(o),
|
|
3590
3743
|
detail: [
|
|
3591
3744
|
Q(r[Z.Formula] ?? 0, "cell"),
|
|
3592
3745
|
Q(o.length, "region"),
|
|
@@ -3604,56 +3757,64 @@ function Ni(e, t) {
|
|
|
3604
3757
|
let o = [...n.getRegions(e)];
|
|
3605
3758
|
i.push({
|
|
3606
3759
|
label: t,
|
|
3607
|
-
extent:
|
|
3760
|
+
extent: ra(o),
|
|
3608
3761
|
detail: [Q(a, "cell"), Q(o.length, "region")].join(" · ")
|
|
3609
3762
|
});
|
|
3610
3763
|
}
|
|
3611
3764
|
let c = n.getTables();
|
|
3612
3765
|
c.length > 0 && i.push({
|
|
3613
3766
|
label: "tables",
|
|
3614
|
-
extent:
|
|
3767
|
+
extent: ra(c.map((e) => e.getRange())),
|
|
3615
3768
|
detail: [
|
|
3616
3769
|
Q(r[Z.Table] ?? 0, "cell"),
|
|
3617
3770
|
Q(c.length, "table"),
|
|
3618
|
-
|
|
3771
|
+
na(c.map((e) => e.getName()))
|
|
3619
3772
|
].join(" · ")
|
|
3620
3773
|
});
|
|
3621
3774
|
let l = e.getPivotTables().getItems();
|
|
3622
3775
|
l.length > 0 && i.push({
|
|
3623
3776
|
label: "pivots",
|
|
3624
3777
|
extent: String(l.length),
|
|
3625
|
-
detail:
|
|
3626
|
-
}), i.push(...
|
|
3778
|
+
detail: na(l.map((e) => e.getName()))
|
|
3779
|
+
}), i.push(...ea(e));
|
|
3627
3780
|
let u = a.map((e) => e.getCoords()), d = [];
|
|
3628
|
-
for (let [n, r] of
|
|
3629
|
-
let i =
|
|
3781
|
+
for (let [n, r] of Xi) {
|
|
3782
|
+
let i = Ge(e, n, t, { content: u })?.distinct ?? 0;
|
|
3630
3783
|
i > 0 && d.push(`${r} ${i}`);
|
|
3631
3784
|
}
|
|
3632
3785
|
return d.length > 0 && i.push({
|
|
3633
3786
|
label: "style",
|
|
3634
3787
|
extent: n.toString(),
|
|
3635
3788
|
detail: d.join(" · ")
|
|
3636
|
-
}), i.push(...
|
|
3789
|
+
}), i.push(...$i(e)), i.push(...ta(e)), {
|
|
3637
3790
|
counts: r,
|
|
3638
3791
|
lines: i,
|
|
3639
3792
|
formulaRegions: o.length,
|
|
3640
3793
|
formulaSignature: s
|
|
3641
3794
|
};
|
|
3642
3795
|
}
|
|
3643
|
-
function
|
|
3796
|
+
function $i(e) {
|
|
3797
|
+
let t = Vt(e);
|
|
3798
|
+
return t ? [{
|
|
3799
|
+
label: "outline",
|
|
3800
|
+
extent: "",
|
|
3801
|
+
detail: t
|
|
3802
|
+
}] : [];
|
|
3803
|
+
}
|
|
3804
|
+
function ea(e) {
|
|
3644
3805
|
let t = [];
|
|
3645
|
-
for (let [n, r] of
|
|
3646
|
-
let i =
|
|
3806
|
+
for (let [n, r] of jn(e.getMovables().getItems())) {
|
|
3807
|
+
let i = Tn(r), a = n === "chart" ? na(r.map(Dn)) : i.length > 0 ? `${i.length} with text` : "";
|
|
3647
3808
|
t.push({
|
|
3648
|
-
label:
|
|
3809
|
+
label: An(n).toLowerCase(),
|
|
3649
3810
|
extent: String(r.length),
|
|
3650
3811
|
detail: a
|
|
3651
3812
|
});
|
|
3652
|
-
let o = i.slice(0,
|
|
3813
|
+
let o = i.slice(0, D(i.length, 5));
|
|
3653
3814
|
for (let e of o) t.push({
|
|
3654
3815
|
label: "",
|
|
3655
|
-
extent:
|
|
3656
|
-
detail:
|
|
3816
|
+
extent: Sn(e.movable),
|
|
3817
|
+
detail: Cn(e) + (e.movable.isHidden() ? " (hidden)" : "")
|
|
3657
3818
|
});
|
|
3658
3819
|
o.length < i.length && t.push({
|
|
3659
3820
|
label: "",
|
|
@@ -3663,15 +3824,15 @@ function Pi(e) {
|
|
|
3663
3824
|
}
|
|
3664
3825
|
return t;
|
|
3665
3826
|
}
|
|
3666
|
-
function
|
|
3667
|
-
let t =
|
|
3827
|
+
function ta(e) {
|
|
3828
|
+
let t = Yr(e);
|
|
3668
3829
|
return t ? [{
|
|
3669
3830
|
label: "protected",
|
|
3670
3831
|
extent: t.extent,
|
|
3671
3832
|
detail: t.detail
|
|
3672
3833
|
}] : [];
|
|
3673
3834
|
}
|
|
3674
|
-
function
|
|
3835
|
+
function na(e) {
|
|
3675
3836
|
let t = [], n = 0;
|
|
3676
3837
|
for (let r of e) {
|
|
3677
3838
|
let e = (t.length > 0 ? 2 : 0) + r.length;
|
|
@@ -3681,7 +3842,7 @@ function Ii(e) {
|
|
|
3681
3842
|
let r = e.length - t.length;
|
|
3682
3843
|
return r > 0 ? `${t.join(", ")}, +${r} more` : t.join(", ");
|
|
3683
3844
|
}
|
|
3684
|
-
function
|
|
3845
|
+
function ra(t) {
|
|
3685
3846
|
let n = null;
|
|
3686
3847
|
for (let e of t) {
|
|
3687
3848
|
let t = e.getCoords();
|
|
@@ -3695,22 +3856,22 @@ function Li(t) {
|
|
|
3695
3856
|
return n ? e.rangeToString(n) ?? "" : "";
|
|
3696
3857
|
}
|
|
3697
3858
|
var Q = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`;
|
|
3698
|
-
function
|
|
3859
|
+
function ia(e, t) {
|
|
3699
3860
|
let n = e.getVisibility(), r = "";
|
|
3700
|
-
return t && (r += " (selected)"), n ===
|
|
3861
|
+
return t && (r += " (selected)"), n === f.Visibility.Hidden ? r += " (hidden)" : n === f.Visibility.VeryHidden && (r += " (very hidden)"), e.getProtection().isLocked() && (r += " (protected)"), `${H(e.getName())}${r}`;
|
|
3701
3862
|
}
|
|
3702
|
-
function
|
|
3863
|
+
function aa(t, n, r, i) {
|
|
3703
3864
|
let a = r.reduce((e, t) => e + (t.counts?.[i] ?? 0), 0), o = i === Z.Error ? r.flatMap((e) => function(e) {
|
|
3704
3865
|
let t = [];
|
|
3705
3866
|
for (let n of e.getMovables().getItems({ type: "chart" })) {
|
|
3706
|
-
let e =
|
|
3867
|
+
let e = G(n);
|
|
3707
3868
|
if (e) for (let r of e.getSeries()) {
|
|
3708
|
-
let e =
|
|
3869
|
+
let e = Xt(r);
|
|
3709
3870
|
if (e.length === 0) continue;
|
|
3710
3871
|
let i = r.getName();
|
|
3711
3872
|
t.push({
|
|
3712
3873
|
movable: n,
|
|
3713
|
-
detail: `series ${i ? `"${
|
|
3874
|
+
detail: `series ${i ? `"${K(i)}"` : "(unnamed)"} ${e.join(" · ")}`
|
|
3714
3875
|
});
|
|
3715
3876
|
}
|
|
3716
3877
|
}
|
|
@@ -3722,18 +3883,18 @@ function zi(t, n, r, i) {
|
|
|
3722
3883
|
if (!e.counts?.[i]) continue;
|
|
3723
3884
|
let t = e.sheet.getUsedRange();
|
|
3724
3885
|
if (!t) continue;
|
|
3725
|
-
let n =
|
|
3886
|
+
let n = H(e.sheet.getName());
|
|
3726
3887
|
for (let e of t.getRegions(i)) c++, s.length >= 20 || s.push({
|
|
3727
3888
|
address: `${n}!${e.toString()}`,
|
|
3728
3889
|
size: `${e.getRowCount()}×${e.getColumnCount()}`,
|
|
3729
|
-
payload:
|
|
3890
|
+
payload: oa(e)
|
|
3730
3891
|
});
|
|
3731
3892
|
}
|
|
3732
3893
|
let l = o.slice(0, 20);
|
|
3733
3894
|
for (let { movable: t, detail: n } of l) {
|
|
3734
3895
|
let r = t.getRange();
|
|
3735
3896
|
s.push({
|
|
3736
|
-
address: `${
|
|
3897
|
+
address: `${H(r.getSheet().getName())}!${e.rangeToString(r.getCoords()) ?? ""}`,
|
|
3737
3898
|
size: "chart",
|
|
3738
3899
|
payload: `${t.getContent().getName?.() || "(unnamed)"} · ${n}`
|
|
3739
3900
|
});
|
|
@@ -3744,164 +3905,169 @@ function zi(t, n, r, i) {
|
|
|
3744
3905
|
for (let e of s) t.text(` ${e.address.padEnd(d)} ${e.size.padEnd(f)} ${e.payload}`.trimEnd());
|
|
3745
3906
|
c > s.length - l.length && t.text(` …and ${c - (s.length - l.length)} more · getRegions('${i}') on a sheet's used range lists the rest`), o.length > l.length && t.text(` …and ${o.length - l.length} more in charts · a sheet's report lists its charts under Charts`), t.blank();
|
|
3746
3907
|
}
|
|
3747
|
-
function
|
|
3748
|
-
let t = e.getCell(), n =
|
|
3908
|
+
function oa(e) {
|
|
3909
|
+
let t = e.getCell(), n = w(t, x.Mode.Display)?.display ?? "", r = t.getFormulaText();
|
|
3749
3910
|
return r ? `${n} ${r}`.trim() : n;
|
|
3750
3911
|
}
|
|
3751
|
-
var $ = (e, t) => !!e && typeof e == "object" && !0 === e[t],
|
|
3912
|
+
var $ = (e, t) => !!e && typeof e == "object" && !0 === e[t], sa = {
|
|
3752
3913
|
kind: "protectedRanges",
|
|
3753
3914
|
is: (e) => $(e, "isIProtectedRangeCollection"),
|
|
3754
3915
|
render: (e) => {
|
|
3755
3916
|
let t = e.getItems();
|
|
3756
|
-
return t.length === 0 ? "# Unlocked Ranges (0)\nNone" : t.slice(0,
|
|
3917
|
+
return t.length === 0 ? "# Unlocked Ranges (0)\nNone" : t.slice(0, ca).map(ti).concat(t.length > ca ? [`…and ${t.length - ca} more · render one at a time to see them`] : []).join("\n\n");
|
|
3757
3918
|
}
|
|
3758
|
-
},
|
|
3919
|
+
}, ca = 20, la = [
|
|
3759
3920
|
{
|
|
3760
3921
|
kind: "workbook",
|
|
3761
3922
|
is: (e) => $(e, "isIWorkbook"),
|
|
3762
|
-
render: (e, t) =>
|
|
3923
|
+
render: (e, t) => Zi(e, t)
|
|
3763
3924
|
},
|
|
3764
3925
|
{
|
|
3765
3926
|
kind: "sheet",
|
|
3766
3927
|
is: (e) => $(e, "isISheet"),
|
|
3767
|
-
render: (e, t) =>
|
|
3928
|
+
render: (e, t) => Vi(e, t)
|
|
3768
3929
|
},
|
|
3769
3930
|
{
|
|
3770
3931
|
kind: "cell",
|
|
3771
3932
|
is: (e) => $(e, "isICell"),
|
|
3772
|
-
render: (e, t) =>
|
|
3933
|
+
render: (e, t) => ri(e, t)
|
|
3773
3934
|
},
|
|
3774
3935
|
{
|
|
3775
3936
|
kind: "names",
|
|
3776
3937
|
is: (e) => $(e, "isINamedCollection"),
|
|
3777
|
-
render: (e, t) =>
|
|
3938
|
+
render: (e, t) => Ni(e, t)
|
|
3778
3939
|
},
|
|
3779
3940
|
{
|
|
3780
3941
|
kind: "modules",
|
|
3781
3942
|
is: (e) => $(e, "isIModuleCollection"),
|
|
3782
|
-
render: (e, t) =>
|
|
3943
|
+
render: (e, t) => ji(e, t)
|
|
3783
3944
|
},
|
|
3784
3945
|
{
|
|
3785
3946
|
kind: "module",
|
|
3786
3947
|
is: (e) => $(e, "isIModule"),
|
|
3787
|
-
render: (e, t) =>
|
|
3948
|
+
render: (e, t) => Ai(e, t)
|
|
3788
3949
|
},
|
|
3789
3950
|
{
|
|
3790
3951
|
kind: "formula",
|
|
3791
3952
|
is: (e) => $(e, "isIFormula"),
|
|
3792
|
-
render: (e, t) =>
|
|
3953
|
+
render: (e, t) => xi(e, t)
|
|
3793
3954
|
},
|
|
3794
3955
|
{
|
|
3795
3956
|
kind: "table",
|
|
3796
3957
|
is: (e) => $(e, "isITable"),
|
|
3797
|
-
render: (e) =>
|
|
3958
|
+
render: (e) => vt(e)
|
|
3798
3959
|
},
|
|
3799
3960
|
{
|
|
3800
3961
|
kind: "movable",
|
|
3801
3962
|
is: (e) => $(e, "isIMovable"),
|
|
3802
|
-
render: (e) =>
|
|
3963
|
+
render: (e) => Pn(e)
|
|
3964
|
+
},
|
|
3965
|
+
{
|
|
3966
|
+
kind: "shape",
|
|
3967
|
+
is: (e) => $(e, "isIShape"),
|
|
3968
|
+
render: (e) => Fn(e)
|
|
3803
3969
|
},
|
|
3804
3970
|
{
|
|
3805
3971
|
kind: "conditionalFormat",
|
|
3806
3972
|
is: (e) => $(e, "isIConditionalFormat"),
|
|
3807
|
-
render: (e) =>
|
|
3973
|
+
render: (e) => li(e)
|
|
3808
3974
|
},
|
|
3809
3975
|
{
|
|
3810
3976
|
kind: "dataValidation",
|
|
3811
3977
|
is: (e) => $(e, "isIDataValidation"),
|
|
3812
|
-
render: (e) =>
|
|
3978
|
+
render: (e) => di(e)
|
|
3813
3979
|
},
|
|
3814
3980
|
{
|
|
3815
3981
|
kind: "protection",
|
|
3816
3982
|
is: (e) => $(e, "isISheetProtection") || $(e, "isIWorkbookProtection"),
|
|
3817
|
-
render: (e) =>
|
|
3983
|
+
render: (e) => ei(e)
|
|
3818
3984
|
},
|
|
3819
|
-
|
|
3985
|
+
sa,
|
|
3820
3986
|
{
|
|
3821
3987
|
kind: "protectedRange",
|
|
3822
3988
|
is: (e) => $(e, "isIProtectedRange"),
|
|
3823
|
-
render: (e) =>
|
|
3989
|
+
render: (e) => ti(e)
|
|
3824
3990
|
},
|
|
3825
3991
|
{
|
|
3826
3992
|
kind: "stats",
|
|
3827
3993
|
is: (e) => $(e, "isIRangeStats"),
|
|
3828
|
-
render: (e) =>
|
|
3994
|
+
render: (e) => Wi(e)
|
|
3829
3995
|
},
|
|
3830
3996
|
{
|
|
3831
3997
|
kind: "counts",
|
|
3832
3998
|
is: (e) => $(e, "isICellRangeCounts"),
|
|
3833
|
-
render: (e) =>
|
|
3999
|
+
render: (e) => ui(e)
|
|
3834
4000
|
},
|
|
3835
4001
|
{
|
|
3836
4002
|
kind: "style",
|
|
3837
4003
|
is: (e) => $(e, "isIStyle"),
|
|
3838
|
-
render: (e) =>
|
|
4004
|
+
render: (e) => Ki(e)
|
|
3839
4005
|
},
|
|
3840
4006
|
{
|
|
3841
4007
|
kind: "regions",
|
|
3842
4008
|
is: (e) => $(e, "isICellRegions"),
|
|
3843
|
-
render: (e, t) =>
|
|
4009
|
+
render: (e, t) => ht(e, t)
|
|
3844
4010
|
},
|
|
3845
4011
|
{
|
|
3846
4012
|
kind: "cellRange",
|
|
3847
4013
|
is: (e) => $(e, "isICellRange"),
|
|
3848
|
-
render: (e, t) =>
|
|
4014
|
+
render: (e, t) => ci(e, t)
|
|
3849
4015
|
},
|
|
3850
4016
|
{
|
|
3851
4017
|
kind: "ranges",
|
|
3852
4018
|
is: (e) => $(e, "isICellRanges"),
|
|
3853
|
-
render: (e, t) =>
|
|
4019
|
+
render: (e, t) => zi(e, t)
|
|
3854
4020
|
},
|
|
3855
4021
|
{
|
|
3856
4022
|
kind: "range",
|
|
3857
4023
|
is: (e) => $(e, "isIRange"),
|
|
3858
|
-
render: (e, t) =>
|
|
4024
|
+
render: (e, t) => qi(e, t)
|
|
3859
4025
|
},
|
|
3860
4026
|
{
|
|
3861
4027
|
kind: "values",
|
|
3862
4028
|
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Array.isArray(e)),
|
|
3863
|
-
render: (e, t) =>
|
|
4029
|
+
render: (e, t) => qi(e, t)
|
|
3864
4030
|
},
|
|
3865
4031
|
{
|
|
3866
4032
|
kind: "records",
|
|
3867
|
-
is: (e) => Array.isArray(e) && e.length > 0 && e.every(
|
|
3868
|
-
render: (e, t) =>
|
|
4033
|
+
is: (e) => Array.isArray(e) && e.length > 0 && e.every(Pi),
|
|
4034
|
+
render: (e, t) => Fi(e, t)
|
|
3869
4035
|
},
|
|
3870
4036
|
{
|
|
3871
4037
|
kind: "record",
|
|
3872
|
-
is: (e) =>
|
|
3873
|
-
render: (e, t) =>
|
|
4038
|
+
is: (e) => Pi(e),
|
|
4039
|
+
render: (e, t) => Fi(e, t)
|
|
3874
4040
|
},
|
|
3875
4041
|
{
|
|
3876
4042
|
kind: "items",
|
|
3877
|
-
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!
|
|
4043
|
+
is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!fa(e)),
|
|
3878
4044
|
render: async (e, t) => {
|
|
3879
|
-
let n = e.length >
|
|
3880
|
-
for (let e of n) r.push(await
|
|
4045
|
+
let n = e.length > ca ? e.slice(0, ca) : e, r = [];
|
|
4046
|
+
for (let e of n) r.push(await fa(e).render(e, t));
|
|
3881
4047
|
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");
|
|
3882
4048
|
}
|
|
3883
4049
|
}
|
|
3884
|
-
],
|
|
4050
|
+
], ua = la.map((e) => e.kind), da = class extends Error {
|
|
3885
4051
|
constructor(e) {
|
|
3886
4052
|
super(e), this.name = "NoRendererError";
|
|
3887
4053
|
}
|
|
3888
4054
|
};
|
|
3889
|
-
function
|
|
3890
|
-
for (let t of
|
|
4055
|
+
function fa(e) {
|
|
4056
|
+
for (let t of la) if (t.is(e)) return t;
|
|
3891
4057
|
return null;
|
|
3892
4058
|
}
|
|
3893
|
-
async function
|
|
4059
|
+
async function pa(e, t, n) {
|
|
3894
4060
|
await e?.getCalculation().ready();
|
|
3895
|
-
let r =
|
|
4061
|
+
let r = fa(t), i = t;
|
|
3896
4062
|
if (!r && i && typeof i == "object" && !Array.isArray(i) && typeof i[Symbol.iterator] == "function") {
|
|
3897
4063
|
let e = [];
|
|
3898
4064
|
for (let t of i) if (e.push(t), e.length >= 1e3) break;
|
|
3899
|
-
i = e, r =
|
|
4065
|
+
i = e, r = fa(i);
|
|
3900
4066
|
}
|
|
3901
|
-
if (!r) throw new
|
|
4067
|
+
if (!r) throw new da(`No markdown renderer for this value. Renderable kinds: ${ua.join(", ")}.`);
|
|
3902
4068
|
return r.render(i, n);
|
|
3903
4069
|
}
|
|
3904
|
-
async function
|
|
4070
|
+
async function ma(e, t, n) {
|
|
3905
4071
|
if (t === void 0) return {
|
|
3906
4072
|
text: void 0,
|
|
3907
4073
|
rendered: !0
|
|
@@ -3912,11 +4078,11 @@ async function Ji(e, t, n) {
|
|
|
3912
4078
|
};
|
|
3913
4079
|
if (typeof t == "object" && t) try {
|
|
3914
4080
|
return {
|
|
3915
|
-
text: await
|
|
4081
|
+
text: await pa(e, t, n),
|
|
3916
4082
|
rendered: !0
|
|
3917
4083
|
};
|
|
3918
4084
|
} catch (e) {
|
|
3919
|
-
if (!(e instanceof
|
|
4085
|
+
if (!(e instanceof da)) throw e;
|
|
3920
4086
|
}
|
|
3921
4087
|
return function(e) {
|
|
3922
4088
|
if (e === null) return {
|
|
@@ -3926,7 +4092,7 @@ async function Ji(e, t, n) {
|
|
|
3926
4092
|
switch (typeof e) {
|
|
3927
4093
|
case "number":
|
|
3928
4094
|
case "boolean": return {
|
|
3929
|
-
text:
|
|
4095
|
+
text: T(e)?.display ?? String(e),
|
|
3930
4096
|
rendered: !0
|
|
3931
4097
|
};
|
|
3932
4098
|
case "bigint":
|
|
@@ -3941,7 +4107,7 @@ async function Ji(e, t, n) {
|
|
|
3941
4107
|
}
|
|
3942
4108
|
let t = e;
|
|
3943
4109
|
if (!0 === t.isFormulaError || !0 === t.isIRichData) return {
|
|
3944
|
-
text:
|
|
4110
|
+
text: T(e)?.display ?? "",
|
|
3945
4111
|
rendered: !0
|
|
3946
4112
|
};
|
|
3947
4113
|
let n;
|
|
@@ -3956,5 +4122,5 @@ async function Ji(e, t, n) {
|
|
|
3956
4122
|
};
|
|
3957
4123
|
}(t);
|
|
3958
4124
|
}
|
|
3959
|
-
var
|
|
3960
|
-
export {
|
|
4125
|
+
var ha = [nr], ga = [br];
|
|
4126
|
+
export { rr as API_ENTRY_POINTS, x as CellEncoding, te as GREP_FIELDS, E as GREP_FIELDS_DEFAULT, ee as GrepField, z as MarkdownBuilder, ft as MarkdownFrameSection, da as NoRendererError, ga as REFERENCES, ua as RENDERABLE_KINDS, la as RENDERERS, Lr as RENDER_OPTION_KEYS, yt as REPORTED_FEATURES, ha as TOOLS, dr as apiPointerFor, gr as apiSuggestionsFor, br as apiTool, ur as apiTypeOf, Sr as appendDependencies, Et as appendKinds, Oi as appendModules, Mn as appendMovables, W as appendNames, mt as appendRegionList, Dt as appendRegions, Ht as appendRules, vn as appendShapeFacts, Wt as appendSheetObjects, Xr as appendSheetProtection, _t as appendTables, Di as collectModules, Tn as collectShapeText, Ot as contentfulBlocks, Ce as countDates, ae as describeAlignment, st as describeAllowedValues, Sn as describeAnchor, yr as describeApi, A as describeBorder, re as describeBorderParts, Qr as describeCellProtection, O as describeColor, at as describeConditionalFormat, ot as describeDataValidation, V as describeExtent, k as describeFill, oe as describeFont, X as describeLock, Dn as describeMovableSummary, Fr as describeNode, Pr as describeNodeLabel, Mr as describeNodeLabels, ie as describeNumberFormat, Vt as describeOutline, Tt as describeQualifiedExtent, Mt as describeQualifiedName, wt as describeQualifiedRanges, Zr as describeRangeProtection, Ct as describeRanges, tt as describeRuleStyle, ct as describeRules, rt as describeScale, Cn as describeShapeText, U as describeSheetCall, H as describeSheetName, ge as describeSums, An as describeTypeHeading, Wr as describeWorkbookProtection, pe as detectTotals, w as encodeCell, C as encodeFormattedNumber, S as encodeNumber, T as encodeScalar, Ut as findNames, Yn as grep, nr as grepTool, jn as groupMovables, Pi as isPlainRecord, lr as lookupApi, St as parseFeatures, Rr as parseRenderOptions, Se as profileKinds, ue as profileRegion, $r as protectionPointerFor, sn as quoteShapeText, wn as readShapeText, ut as regionPayload, dt as regionPayloads, vr as renderApi, ri as renderCell, ci as renderCellRange, li as renderConditionalFormat, ui as renderCounts, di as renderDataValidation, xi as renderFormula, tr as renderGrep, pa as renderMarkdown, Ai as renderModule, ji as renderModules, Pn as renderMovable, Ni as renderNames, ti as renderProtectedRange, ei as renderProtection, zi as renderRanges, Fi as renderRecords, ht as renderRegions, ma as renderResult, Fn as renderShape, Vi as renderSheet, Wi as renderStats, Ki as renderStyle, vt as renderTable, qi as renderValues, Zi as renderWorkbook, fa as resolveRenderer, yn as shapeRotation, Yr as summarizeSheetProtection };
|