@sheetxl/query 0.8.0-beta.6 → 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.
@@ -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.6
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 o, ICellRange as r, ICondition as s, IConditionalFormat as a, IDataValidation as l, IFill as i, IFont as c, IRange as u, ISheet as g, InteropScalarType as d, NumberFormat as h, ScalarType as m, getScriptingApi as f, getScriptingDeclarations as p } from "@sheetxl/sdk";
8
- var $;
9
- ($ || ($ = {})).Mode = {
7
+ import { AddressUtils as e, FormulaError as t, IAnchored as n, ICalculation as o, ICellRange as r, ICondition as s, IConditionalFormat as l, IDataValidation as a, IFill as i, IFont as c, IRange as u, IShape as g, ISheet as d, IStroke as h, ITextFrame as m, InteropScalarType as f, NumberFormat as p, ScalarType as $, ShapeStyleUtils as w, getScriptingApi as y, getScriptingDeclarations as S } from "@sheetxl/sdk";
8
+ var b;
9
+ (b || (b = {})).Mode = {
10
10
  Display: "display",
11
11
  Value: "value"
12
12
  };
13
- function w(e) {
13
+ function x(e) {
14
14
  return Number.isFinite(e) ? function(e) {
15
15
  const t = e.indexOf("e");
16
16
  if (-1 === t) return e;
@@ -18,27 +18,28 @@ function w(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 S(e, t) {
21
+ function C(e, t) {
22
22
  if (!Number.isFinite(e)) return String(e);
23
- if (!t || "General" === t) return w(e);
23
+ if (!t || "General" === t) return x(e);
24
24
  try {
25
- const n = h.getEngine().format(t, e)?.text;
26
- return n ? n.trim() : w(e);
25
+ const n = p.getEngine().format(t, e)?.text;
26
+ return n ? n.trim() : x(e);
27
27
  } catch {
28
- return w(e);
28
+ return x(e);
29
29
  }
30
30
  }
31
- function y(e, t) {
32
- const n = t === $.Mode.Value, o = e.getText({
33
- hideStringPrefix: !0,
34
- useFormattingCategory: n
35
- });
36
- return o ? {
37
- match: o,
38
- display: e.getText({ useFormattingCategory: n })
31
+ function k(e, t) {
32
+ if (t === b.Mode.Value) {
33
+ const t = E(e.getValue());
34
+ return t?.match ? t : null;
35
+ }
36
+ const n = e.getText({ hideStringPrefix: !0 });
37
+ return n ? {
38
+ match: n,
39
+ display: e.getText()
39
40
  } : null;
40
41
  }
41
- function b(e) {
42
+ function E(e) {
42
43
  if (null == e) return null;
43
44
  if ("string" == typeof e) return {
44
45
  match: e,
@@ -52,7 +53,7 @@ function b(e) {
52
53
  };
53
54
  }
54
55
  if ("number" == typeof e) {
55
- const t = w(e);
56
+ const t = x(e);
56
57
  return {
57
58
  match: t,
58
59
  display: t
@@ -71,10 +72,9 @@ function b(e) {
71
72
  display: n
72
73
  };
73
74
  }
74
- var x = {
75
+ var v = {
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 x = {
82
82
  Shape: "shape",
83
83
  Chart: "chart",
84
84
  Name: "name"
85
- }, C = [
85
+ }, R = [
86
86
  "display",
87
87
  "value",
88
- "raw",
89
88
  "formula",
90
89
  "hyperlink",
91
90
  "numberFormat",
@@ -93,15 +92,14 @@ var x = {
93
92
  "shape",
94
93
  "chart",
95
94
  "name"
96
- ], E = [
95
+ ], N = [
97
96
  "display",
98
- "value",
99
97
  "formula",
100
98
  "comment",
101
99
  "shape",
102
100
  "chart",
103
101
  "name"
104
- ], k = (e, t) => e <= t + 3 ? e : t, v = (e) => {
102
+ ], j = (e, t) => e <= t + 3 ? e : t, I = (e) => {
105
103
  if (!e) return null;
106
104
  const t = String(e.toHex?.() ?? "");
107
105
  if (!t) return e.toString();
@@ -109,32 +107,32 @@ var x = {
109
107
  if (!o) return n;
110
108
  const r = o.toLowerCase().replace(/^#/, "");
111
109
  return r === n.slice(1).toLowerCase() || r === t.slice(1).toLowerCase() ? n : `${n} (${o.replace(/\d+\.\d{4,}/g, (e) => String(parseFloat(Number(e).toFixed(2))))})`;
112
- }, R = (e) => {
110
+ }, F = (e) => {
113
111
  const t = e.getFill(), n = t.getType();
114
112
  if (n === i.Type.None) return null;
115
113
  if (n === i.Type.Pattern) {
116
114
  const e = t, n = e.getPatternType();
117
115
  if (n === i.BuiltInSheetPattern.None) return null;
118
- const o = v(e.getForeground());
116
+ const o = I(e.getForeground());
119
117
  if (n === i.BuiltInSheetPattern.Solid) return o ? `solid ${o}` : "solid";
120
- const r = v(e.getBackground());
118
+ const r = I(e.getBackground());
121
119
  return [
122
120
  `${n} pattern`,
123
121
  o,
124
122
  r ? `on ${r}` : null
125
123
  ].filter(Boolean).join(" ");
126
124
  }
127
- const o = v(t.getColor?.());
125
+ const o = I(t.getColor?.());
128
126
  return o ? `${n} ${o}` : n;
129
- }, N = (e) => {
130
- const t = j(e);
127
+ }, M = (e) => {
128
+ const t = A(e);
131
129
  return t.length > 0 ? t.join(" · ") : null;
132
- }, I = /* @__PURE__ */ new Set([
130
+ }, T = /* @__PURE__ */ new Set([
133
131
  "top",
134
132
  "left",
135
133
  "bottom",
136
134
  "right"
137
- ]), j = (e) => {
135
+ ]), A = (e) => {
138
136
  const t = e.getBorders(), n = [
139
137
  ["top", t.getTop()],
140
138
  ["left", t.getLeft()],
@@ -148,38 +146,38 @@ var x = {
148
146
  for (const [e, t] of n) {
149
147
  const n = t?.getStyle?.();
150
148
  if (!n || "none" === n) continue;
151
- const r = v(t?.getColor?.()), s = r ? `${n} ${r}` : n, a = o.get(s);
152
- a ? a.push(e) : o.set(s, [e]);
149
+ const r = I(t?.getColor?.()), s = r ? `${n} ${r}` : n, l = o.get(s);
150
+ l ? l.push(e) : o.set(s, [e]);
153
151
  }
154
152
  const r = [];
155
153
  for (const [e, t] of o) {
156
- const n = 4 === t.length && t.every((e) => I.has(e));
154
+ const n = 4 === t.length && t.every((e) => T.has(e));
157
155
  r.push(`${n ? "outline" : t.join("+")} ${e}`);
158
156
  }
159
157
  return r;
160
- }, F = (e) => {
158
+ }, L = (e) => {
161
159
  const t = e.getNumberFormat();
162
160
  return t && "General" !== t ? t : null;
163
- }, M = (e, t) => {
161
+ }, O = (e, t) => {
164
162
  const n = e.getAlignment(), o = t.getAlignment(), r = [];
165
163
  return n.getHorizontal() !== o.getHorizontal() && r.push(`h ${n.getHorizontal()}`), n.getVertical() !== o.getVertical() && r.push(`v ${n.getVertical()}`), n.getOverflow() !== o.getOverflow() && r.push(n.getOverflow()), n.getIndent() !== o.getIndent() && r.push(`indent ${n.getIndent()}`), n.getRotation() !== o.getRotation() && r.push(`rotation ${n.getRotation()}`), r.length > 0 ? r.join(" · ") : null;
166
- }, T = (e, t) => {
164
+ }, P = (e, t) => {
167
165
  const n = e.getFont(), o = t.getFont(), r = [];
168
166
  n.getBold() !== o.getBold() && r.push(n.getBold() ? "bold" : "not bold"), n.getItalic() !== o.getItalic() && r.push(n.getItalic() ? "italic" : "not italic"), n.getUnderline() !== o.getUnderline() && r.push(`underline ${n.getUnderline()}`), n.getStrike() !== o.getStrike() && r.push(n.getStrike() ? "strike" : "not strike"), n.getSize() !== o.getSize() && r.push(`${n.getSize()}pt`), n.getFamily() !== o.getFamily() && r.push(n.getFamily());
169
- const s = v(n.getColor());
170
- return s !== v(o.getColor()) && r.push(s ?? "no color"), r.length > 0 ? r.join(" · ") : null;
171
- }, A = r.Feature;
172
- function L(e, t, n) {
173
- const { rowIndex: o, colIndex: r } = t, s = "row" === n, a = s ? r : o;
174
- if (0 === a) return null;
175
- const l = e.getRange({
167
+ const s = I(n.getColor());
168
+ return s !== I(o.getColor()) && r.push(s ?? "no color"), r.length > 0 ? r.join(" · ") : null;
169
+ }, D = r.Feature;
170
+ function V(e, t, n) {
171
+ const { rowIndex: o, colIndex: r } = t, s = "row" === n, l = s ? r : o;
172
+ if (0 === l) return null;
173
+ const a = e.getRange({
176
174
  rowStart: o,
177
175
  rowEnd: o,
178
176
  colStart: r,
179
177
  colEnd: r
180
- }).getSurrounding({ contentOnly: !0 }).getCoords(), i = s ? l.colStart : l.rowStart;
181
- if (i < a) {
182
- const t = P(e, s ? o : i, s ? i : r);
178
+ }).getSurrounding({ contentOnly: !0 }).getCoords(), i = s ? a.colStart : a.rowStart;
179
+ if (i < l) {
180
+ const t = H(e, s ? o : i, s ? i : r);
183
181
  if (t) return t;
184
182
  }
185
183
  const c = s ? e.getRange({
@@ -194,71 +192,71 @@ function L(e, t, n) {
194
192
  colEnd: r
195
193
  });
196
194
  for (const t of c.entries({
197
- features: [A.Contentful],
195
+ features: [D.Contentful],
198
196
  axis: s ? u.Axis.Column : u.Axis.Row,
199
197
  reverse: !0
200
198
  })) {
201
- if (t.context.getType() !== m.String) continue;
199
+ if (t.context.getType() !== $.String) continue;
202
200
  const n = t.context.getCoords();
203
- return P(e, n.rowIndex, n.colIndex);
201
+ return H(e, n.rowIndex, n.colIndex);
204
202
  }
205
203
  return null;
206
204
  }
207
- var O = (e) => e ? `${JSON.stringify(e.text)} (${e.address})` : null;
208
- function P(e, t, n) {
205
+ var B = (e) => e ? `${JSON.stringify(e.text)} (${e.address})` : null;
206
+ function H(e, t, n) {
209
207
  const o = e.getRange({
210
208
  rowStart: t,
211
209
  rowEnd: t,
212
210
  colStart: n,
213
211
  colEnd: n
214
212
  }).getCell();
215
- if (o.getType() !== m.String) return null;
216
- const r = y(o, $.Mode.Display)?.match;
213
+ if (o.getType() !== $.String) return null;
214
+ const r = k(o, b.Mode.Display)?.match;
217
215
  return r ? {
218
216
  text: r,
219
217
  address: o.getAddress()
220
218
  } : null;
221
219
  }
222
- function D(e) {
220
+ function _(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 V = r.Feature;
230
- function B(e, t) {
231
- const n = t?.maxSeries ?? 24, o = t?.maxProfileCells ?? 2e4, r = t?.maxCategories ?? 3, s = e.getRowCount(), a = e.getColumnCount();
232
- if (1 === s && 1 === a) return {
227
+ var z = r.Feature;
228
+ function U(e, t) {
229
+ const n = t?.maxSeries ?? 24, o = t?.maxProfileCells ?? 2e4, r = t?.maxCategories ?? 3, s = e.getRowCount(), l = e.getColumnCount();
230
+ if (1 === s && 1 === l) return {
233
231
  shape: "cell",
234
- summary: y(e.getCell(), $.Mode.Display)?.display ?? "(blank)",
232
+ summary: k(e.getCell(), b.Mode.Display)?.display ?? "(blank)",
235
233
  series: []
236
234
  };
237
- const l = e.getRange(), i = l.getCoords(), c = s >= a;
238
- if (1 === s || 1 === a) return {
235
+ const a = e.getRange(), i = a.getCoords(), c = s >= l;
236
+ if (1 === s || 1 === l) return {
239
237
  shape: "list",
240
- summary: K(l, r),
238
+ summary: te(a, r),
241
239
  series: []
242
240
  };
243
- const u = H(e, c), g = c ? a : s, d = c ? null : "by row", h = u.present && u.inside, m = c && h ? i.rowStart + 1 : i.rowStart, f = !c && h ? i.colStart + 1 : i.colStart, p = z(l, c, c ? m : f, o), w = c && p ? p.start - 1 : i.rowEnd, S = !c && p ? p.start - 1 : i.colEnd, b = w - m + 1, x = S - f + 1, C = b * x > o, E = C && c ? Math.max(1, Math.floor(o / Math.max(1, x))) : b, k = C && !c ? Math.max(1, Math.floor(o / Math.max(1, b))) : x, v = Math.min(w, m + E - 1), R = Math.min(S, f + k - 1), N = Math.min(g, n), I = [], j = [];
241
+ const u = W(e, c), g = c ? l : s, d = c ? null : "by row", h = u.present && u.inside, m = c && h ? i.rowStart + 1 : i.rowStart, f = !c && h ? i.colStart + 1 : i.colStart, p = G(a, c, c ? m : f, o), $ = c && p ? p.start - 1 : i.rowEnd, w = !c && p ? p.start - 1 : i.colEnd, y = $ - m + 1, S = w - f + 1, x = y * S > o, C = x && c ? Math.max(1, Math.floor(o / Math.max(1, S))) : y, E = x && !c ? Math.max(1, Math.floor(o / Math.max(1, y))) : S, v = Math.min($, m + C - 1), R = Math.min(w, f + E - 1), N = Math.min(g, n), j = [], I = [];
244
242
  for (let t = 0; t < N; t++) {
245
- const n = c ? l.getRangeAt(m, i.colStart + t, v, i.colStart + t) : l.getRangeAt(i.rowStart + t, f, i.rowStart + t, R);
246
- I.push(Z(e, c, t, u.names)), j.push(K(n, r));
243
+ const n = c ? a.getRangeAt(m, i.colStart + t, v, i.colStart + t) : a.getRangeAt(i.rowStart + t, f, i.rowStart + t, R);
244
+ j.push(ee(e, c, t, u.names)), I.push(te(n, r));
247
245
  }
248
- const F = I.length ? Math.max(...I.map((e) => e.length)) : 0, M = I.map((e, t) => `${e.padEnd(F)} ${j[t]}`);
246
+ const F = j.length ? Math.max(...j.map((e) => e.length)) : 0, M = j.map((e, t) => `${e.padEnd(F)} ${I[t]}`);
249
247
  g > N && M.push(`…${g - N} more ${c ? "columns" : "rows"} not profiled · read them with getStats()`);
250
248
  const T = [
251
249
  d,
252
250
  u.note,
253
251
  p?.note
254
252
  ];
255
- return C && T.push(`profiled from the first ${c ? `${E} rows` : `${k} columns`} of ${c ? b : x}`), {
253
+ return x && T.push(`profiled from the first ${c ? `${C} rows` : `${E} columns`} of ${c ? y : S}`), {
256
254
  shape: u.present ? "table" : "block",
257
255
  summary: T.filter(Boolean).join(" · "),
258
256
  series: M
259
257
  };
260
258
  }
261
- function H(e, t) {
259
+ function W(e, t) {
262
260
  const n = e.getRange(), o = n.getCoords(), r = e.getCell().getTable();
263
261
  if (r) {
264
262
  const e = r.getColumns().map((e) => e.getName()), n = r.getRange().getCoords();
@@ -269,21 +267,21 @@ function H(e, t) {
269
267
  names: t ? e : null
270
268
  };
271
269
  }
272
- const s = t ? o.rowStart + 1 : o.colStart + 1, l = G(t ? n.getRangeAt(s, o.colStart, o.rowEnd, o.colEnd) : n.getRangeAt(o.rowStart, s, o.rowEnd, o.colEnd)), i = t ? n.getRangeAt(o.rowStart, o.colStart, o.rowStart, o.colEnd) : n.getRangeAt(o.rowStart, o.colStart, o.rowEnd, o.colStart);
273
- if (G(i) && !l) return {
270
+ const s = t ? o.rowStart + 1 : o.colStart + 1, a = Q(t ? n.getRangeAt(s, o.colStart, o.rowEnd, o.colEnd) : n.getRangeAt(o.rowStart, s, o.rowEnd, o.colEnd)), i = t ? n.getRangeAt(o.rowStart, o.colStart, o.rowStart, o.colEnd) : n.getRangeAt(o.rowStart, o.colStart, o.rowEnd, o.colStart);
271
+ if (Q(i) && !a) return {
274
272
  present: !0,
275
273
  inside: !0,
276
- note: "header " + (t ? `row ${o.rowStart + 1}` : `column ${D(o.colStart)}`),
277
- names: X(i, e, t)
274
+ note: "header " + (t ? `row ${o.rowStart + 1}` : `column ${_(o.colStart)}`),
275
+ names: Y(i, e, t)
278
276
  };
279
277
  const c = (t ? o.rowStart : o.colStart) - 1;
280
- if (c >= 0 && !G(n)) {
278
+ if (c >= 0 && !Q(n)) {
281
279
  const r = t ? n.getRangeAt(c, o.colStart, c, o.colEnd) : n.getRangeAt(o.rowStart, c, o.rowEnd, c);
282
- if (G(r)) return {
280
+ if (Q(r)) return {
283
281
  present: !0,
284
282
  inside: !1,
285
- note: `header ${t ? `row ${c + 1}` : `column ${D(c)}`} (above this block)`,
286
- names: X(r, e, t)
283
+ note: `header ${t ? `row ${c + 1}` : `column ${_(c)}`} (above this block)`,
284
+ names: Y(r, e, t)
287
285
  };
288
286
  }
289
287
  return {
@@ -293,41 +291,41 @@ function H(e, t) {
293
291
  names: null
294
292
  };
295
293
  }
296
- var _ = 3;
297
- function U(e, t = 2e4) {
294
+ var J = 3;
295
+ function q(e, t = 2e4) {
298
296
  const n = e.getRowCount(), o = e.getColumnCount();
299
297
  if (n < 2 || o < 2) return null;
300
- const r = n >= o, s = e.getCoords(), a = H({
298
+ const r = n >= o, s = e.getCoords(), l = W({
301
299
  getRowCount: () => n,
302
300
  getColumnCount: () => o,
303
301
  getCell: () => e.getCell(),
304
302
  getRange: () => e
305
- }, r), l = a.present && a.inside;
306
- return z(e, r, (r ? s.rowStart : s.colStart) + (l ? 1 : 0), t);
303
+ }, r), a = l.present && l.inside;
304
+ return G(e, r, (r ? s.rowStart : s.colStart) + (a ? 1 : 0), t);
307
305
  }
308
- function z(e, t, n, o) {
309
- const r = e.getCoords(), s = t ? r.rowEnd : r.colEnd, a = t ? r.colStart : r.rowStart, l = t ? r.colEnd : r.rowEnd;
306
+ function G(e, t, n, o) {
307
+ const r = e.getCoords(), s = t ? r.rowEnd : r.colEnd, l = t ? r.colStart : r.rowStart, a = t ? r.colEnd : r.rowEnd;
310
308
  let i, c = -1;
311
309
  const u = e.getCell().getTable(), g = t && !!u?.isShowTotals() && u.getRange().getCoords().rowEnd === r.rowEnd;
312
310
  if (g) c = s;
313
311
  else {
314
312
  if (e.getRowCount() * e.getColumnCount() > o) return null;
315
- const u = e.getValues(), g = (e, n) => t ? u[e - r.rowStart][n - r.colStart] : u[n - r.rowStart][e - r.colStart], d = l - a + 1, h = new Array(d).fill(0), m = new Array(d).fill(!1);
313
+ const u = e.getValues(), g = (e, n) => t ? u[e - r.rowStart][n - r.colStart] : u[n - r.rowStart][e - r.colStart], d = a - l + 1, h = new Array(d).fill(0), m = new Array(d).fill(!1);
316
314
  for (let o = n; o <= s; o++) {
317
315
  if (o - n >= 2) {
318
- const n = W(d, (e) => g(o, a + e), h, m, (e) => t ? `${D(a + e)}${o + 1}` : `${D(o)}${a + e + 1}`);
316
+ const n = X(d, (e) => g(o, l + e), h, m, (e) => t ? `${_(l + e)}${o + 1}` : `${_(o)}${l + e + 1}`);
319
317
  if (n.matches >= 2 && 2 * n.matches > n.candidates) {
320
- const r = t ? e.getRangeAt(o, a, o, l) : e.getRangeAt(a, o, l, o);
318
+ const r = t ? e.getRangeAt(o, l, o, a) : e.getRangeAt(l, o, a, o);
321
319
  c = o, i = {
322
320
  ...n,
323
321
  byColumn: t,
324
- typed: 0 === (r.getCounts([V.Formula])[V.Formula] ?? 0)
322
+ typed: 0 === (r.getCounts([z.Formula])[z.Formula] ?? 0)
325
323
  };
326
324
  break;
327
325
  }
328
326
  }
329
327
  for (let e = 0; e < d; e++) {
330
- const t = g(o, a + e);
328
+ const t = g(o, l + e);
331
329
  "number" == typeof t && (h[e] += t, m[e] = !0);
332
330
  }
333
331
  }
@@ -341,17 +339,17 @@ function z(e, t, n, o) {
341
339
  } : {
342
340
  rowIndex: r.rowStart,
343
341
  colIndex: n
344
- }, s = J(e, o) ?? L(d, o, t ? "row" : "column");
342
+ }, s = K(e, o) ?? V(d, o, t ? "row" : "column");
345
343
  h.push({
346
344
  index: n,
347
345
  label: s,
348
346
  ...n === c && i ? { sums: i } : {}
349
347
  });
350
348
  }
351
- const m = (e) => t ? String(e + 1) : D(e), f = c === s ? `${t ? "row" : "column"} ${m(c)}` : `${t ? "rows" : "columns"} ${m(c)}:${m(s)}`, p = h.slice(0, _).map((e) => [
349
+ const m = (e) => t ? String(e + 1) : _(e), f = c === s ? `${t ? "row" : "column"} ${m(c)}` : `${t ? "rows" : "columns"} ${m(c)}:${m(s)}`, p = h.slice(0, J).map((e) => [
352
350
  m(e.index),
353
351
  e.label ? JSON.stringify(e.label.text) : null,
354
- e.sums ? q(e.sums) : e.index === c && g ? "table totals" : null
352
+ e.sums ? Z(e.sums) : e.index === c && g ? "table totals" : null
355
353
  ].filter(Boolean).join(" ")), $ = h.length - p.length;
356
354
  return {
357
355
  byColumn: t,
@@ -360,110 +358,110 @@ function z(e, t, n, o) {
360
358
  note: `${f} not profiled: ${p.join(" · ")}${$ > 0 ? ` · +${$} more` : ""}`
361
359
  };
362
360
  }
363
- function W(e, t, n, o, r) {
364
- let s = 0, a = 0;
365
- const l = [];
361
+ function X(e, t, n, o, r) {
362
+ let s = 0, l = 0;
363
+ const a = [];
366
364
  for (let i = 0; i < e; i++) {
367
365
  if (!o[i]) continue;
368
- a++;
366
+ l++;
369
367
  const e = t(i), c = n[i];
370
- "number" == typeof e && Math.abs(e - c) <= 1e-9 * Math.max(1, Math.abs(c)) ? s++ : "number" == typeof e ? l.push(`${r(i)} ${w(e)} ≠ Σ ${w(c)}`) : l.push(`${r(i)} ${null == e ? "blank" : "string" == typeof e ? "text" : String(e)}`);
368
+ "number" == typeof e && Math.abs(e - c) <= 1e-9 * Math.max(1, Math.abs(c)) ? s++ : "number" == typeof e ? a.push(`${r(i)} ${x(e)} ≠ Σ ${x(c)}`) : a.push(`${r(i)} ${null == e ? "blank" : "string" == typeof e ? "text" : String(e)}`);
371
369
  }
372
370
  return {
373
371
  matches: s,
374
- candidates: a,
375
- misses: l
372
+ candidates: l,
373
+ misses: a
376
374
  };
377
375
  }
378
- function q(e) {
376
+ function Z(e) {
379
377
  const t = e.misses.slice(0, 3), n = e.misses.length - t.length, o = t.length > 0 ? `; ${t.join(", ")}${n > 0 ? `, +${n} more` : ""}` : "";
380
378
  return `${e.typed ? "typed, " : ""}= Σ ${e.byColumn ? "above" : "to the left"} (${e.matches} of ${e.candidates}${o})`;
381
379
  }
382
- function J(e, t) {
380
+ function K(e, t) {
383
381
  const n = e.getRangeAt(t.rowIndex, t.colIndex).getCell();
384
- if (n.getType() !== m.String) return null;
385
- const o = y(n, $.Mode.Display)?.match;
382
+ if (n.getType() !== $.String) return null;
383
+ const o = k(n, b.Mode.Display)?.match;
386
384
  return o ? {
387
385
  text: o,
388
386
  address: n.getAddress()
389
387
  } : null;
390
388
  }
391
- function G(e) {
389
+ function Q(e) {
392
390
  const t = e.getStats({ onError: "ignore" }), n = t.getCount();
393
- return n > 0 && (t.getTypedCounts()[m.String] ?? 0) === n;
391
+ return n > 0 && (t.getTypedCounts()[$.String] ?? 0) === n;
394
392
  }
395
- function X(e, t, n) {
396
- const o = t.getRange().getCoords(), r = e.getCoords(), s = n ? o.colEnd - o.colStart + 1 : o.rowEnd - o.rowStart + 1, a = [];
393
+ function Y(e, t, n) {
394
+ const o = t.getRange().getCoords(), r = e.getCoords(), s = n ? o.colEnd - o.colStart + 1 : o.rowEnd - o.rowStart + 1, l = [];
397
395
  for (let t = 0; t < s; t++) {
398
396
  const s = n ? e.getRangeAt(r.rowStart, o.colStart + t).getCell() : e.getRangeAt(o.rowStart + t, r.colStart).getCell();
399
- a.push(y(s, $.Mode.Display)?.match ?? "");
397
+ l.push(k(s, b.Mode.Display)?.match ?? "");
400
398
  }
401
- return a;
399
+ return l;
402
400
  }
403
- function Z(e, t, n, o) {
404
- const r = e.getRange().getCoords(), s = t ? D(r.colStart + n) : String(r.rowStart + n + 1), a = o?.[n];
405
- return a ? `${s} ${a}` : s;
401
+ function ee(e, t, n, o) {
402
+ const r = e.getRange().getCoords(), s = t ? _(r.colStart + n) : String(r.rowStart + n + 1), l = o?.[n];
403
+ return l ? `${s} ${l}` : s;
406
404
  }
407
- function K(e, t = 3) {
408
- const n = e.getStats({ onError: "ignore" }), o = n.getTypedCounts(), r = n.getCount(), s = n.getSize(), a = s - r;
405
+ function te(e, t = 3) {
406
+ const n = e.getStats({ onError: "ignore" }), o = n.getTypedCounts(), r = n.getCount(), s = n.getSize(), l = s - r;
409
407
  if (0 === r) return `${s} cells, all blank`;
410
- const l = e.getCounts([V.Formula])[V.Formula] ?? 0, i = Y(e), c = o[m.Number] ?? 0, u = o[m.String] ?? 0, g = o[m.Error] ?? 0, d = [String(r)];
408
+ const a = e.getCounts([z.Formula])[z.Formula] ?? 0, i = oe(e), c = o[$.Number] ?? 0, u = o[$.String] ?? 0, g = o[$.Error] ?? 0, d = [String(r)];
411
409
  let h = !1;
412
- if (l === r) {
413
- const t = [...e.getRegions(V.Formula)];
410
+ if (a === r) {
411
+ const t = [...e.getRegions(z.Formula)];
414
412
  if (1 === t.length) {
415
413
  const e = t[0].getCell().getFormulaText();
416
414
  d.push("formula", e || "(uniform)");
417
415
  } else d.push("formula", `${t.length} distinct`);
418
- } else if (i === r) d.push("date", te(n, ee(e).format));
416
+ } else if (i === r) d.push("date", se(n, re(e).format));
419
417
  else if (c === r) {
420
- const t = ee(e);
421
- d.push("number", te(n, t.format), ...ne(n, t));
422
- } else if (u === r) d.push("text", oe(n, t));
418
+ const t = re(e);
419
+ d.push("number", se(n, t.format), ...le(n, t));
420
+ } else if (u === r) d.push("text", ae(n, t));
423
421
  else {
424
422
  const e = [
425
423
  c ? `number ${c}` : null,
426
424
  u ? `text ${u}` : null,
427
- o[m.Boolean] ? `boolean ${o[m.Boolean]}` : null,
425
+ o[$.Boolean] ? `boolean ${o[$.Boolean]}` : null,
428
426
  g ? `error ${g}` : null
429
427
  ].filter(Boolean);
430
428
  d.push("mixed", e.join(" · ")), h = !0;
431
429
  }
432
- const f = [
430
+ const m = [
433
431
  g > 0 && !h ? `error ${g}` : null,
434
- a > 0 ? `${a} blank` : null,
435
- l > 0 && l !== r ? `${l} formula` : null
436
- ].filter(Boolean), p = d.filter(Boolean).join(" ");
437
- return f.length ? `${p} · ${f.join(" · ")}` : p;
432
+ l > 0 ? `${l} blank` : null,
433
+ a > 0 && a !== r ? `${a} formula` : null
434
+ ].filter(Boolean), f = d.filter(Boolean).join(" ");
435
+ return m.length ? `${f} · ${m.join(" · ")}` : f;
438
436
  }
439
- function Q(e, t = 3) {
440
- const n = e.getStats({ onError: "ignore" }), o = n.getTypedCounts(), r = [], s = o[m.Number] ?? 0;
437
+ function ne(e, t = 3) {
438
+ const n = e.getStats({ onError: "ignore" }), o = n.getTypedCounts(), r = [], s = o[$.Number] ?? 0;
441
439
  if (s > 0) {
442
- const t = ee(e), o = [te(n, t.format), ...ne(n, t)].filter(Boolean);
440
+ const t = re(e), o = [se(n, t.format), ...le(n, t)].filter(Boolean);
443
441
  r.push(`Number: ${s} ${o.join(" ")}`.trimEnd());
444
442
  }
445
- const a = o[m.String] ?? 0;
446
- if (a > 0) {
447
- const e = oe(n, t, (e) => "string" == typeof e);
448
- r.push(`String: ${a} ${e}`.trimEnd());
449
- }
450
- const l = o[m.Boolean] ?? 0;
443
+ const l = o[$.String] ?? 0;
451
444
  if (l > 0) {
452
- const e = oe(n, t, (e) => "boolean" == typeof e);
453
- r.push(`Boolean: ${l} ${e}`.trimEnd());
445
+ const e = ae(n, t, (e) => "string" == typeof e);
446
+ r.push(`String: ${l} ${e}`.trimEnd());
447
+ }
448
+ const a = o[$.Boolean] ?? 0;
449
+ if (a > 0) {
450
+ const e = ae(n, t, (e) => "boolean" == typeof e);
451
+ r.push(`Boolean: ${a} ${e}`.trimEnd());
454
452
  }
455
453
  return r;
456
454
  }
457
- function Y(e) {
455
+ function oe(e) {
458
456
  let t = 0;
459
457
  return e.forEach((e, n) => {
460
- n.getInteropType() === d.Date && t++;
458
+ n.getInteropType() === f.Date && t++;
461
459
  }), t;
462
460
  }
463
- function ee(e) {
464
- const t = (e) => e.getStats({ onError: "ignore" }).getTypedCounts()[m.Number] ?? 0, n = /* @__PURE__ */ new Map();
461
+ function re(e) {
462
+ const t = (e) => e.getStats({ onError: "ignore" }).getTypedCounts()[$.Number] ?? 0, n = /* @__PURE__ */ new Map();
465
463
  let o = 0;
466
- for (const r of e.getRegions(V.NumberFormat)) {
464
+ for (const r of e.getRegions(z.NumberFormat)) {
467
465
  const e = r.getRange().getStyle().getNumberFormat(), s = t(r.getRange());
468
466
  o += s, e && s > 0 && n.set(e, (n.get(e) ?? 0) + s);
469
467
  }
@@ -474,12 +472,12 @@ function ee(e) {
474
472
  format: null,
475
473
  mixed: null
476
474
  };
477
- const a = h.getEngine(), l = (e) => {
475
+ const l = p.getEngine(), a = (e) => {
478
476
  if ("General" === e) return "1";
479
- const t = a.getFormatInfo(e);
477
+ const t = l.getFormatInfo(e);
480
478
  return t ? `${t.isDate ? "date" : t.scale}` : "1";
481
479
  }, i = s[0][0];
482
- return s.every(([e]) => l(e) === l(i)) ? {
480
+ return s.every(([e]) => a(e) === a(i)) ? {
483
481
  format: "General" === i ? null : i,
484
482
  mixed: null
485
483
  } : {
@@ -487,52 +485,52 @@ function ee(e) {
487
485
  mixed: s.map(([e, t]) => `${e} ${t}`).join(" · ")
488
486
  };
489
487
  }
490
- function te(e, t) {
488
+ function se(e, t) {
491
489
  const n = e.getAggregates({ onError: "ignore" });
492
490
  if (null === n.min || null === n.max) return "";
493
- const o = S(n.min, t), r = S(n.max, t);
491
+ const o = C(n.min, t), r = C(n.max, t);
494
492
  return o === r ? o : `${o} … ${r}`;
495
493
  }
496
- function ne(e, { format: t, mixed: n }) {
494
+ function le(e, { format: t, mixed: n }) {
497
495
  if (n) return [`mixed formats (${n})`];
498
496
  const o = e.getAggregates({ onError: "ignore" }), r = [];
499
- return null !== o.sum && r.push(`Σ ${S(o.sum, t)}`), null !== o.average && r.push(`x̄ ${S(o.average, t)}`), r;
497
+ return null !== o.sum && r.push(`Σ ${C(o.sum, t)}`), null !== o.average && r.push(`x̄ ${C(o.average, t)}`), r;
500
498
  }
501
- function oe(e, t, n) {
499
+ function ae(e, t, n) {
502
500
  const o = e.getFrequencies(n ? { filterFn: n } : void 0), r = o.getUniqueCount();
503
501
  if (0 === r) return "";
504
502
  if (r === o.getTotalCount()) return `${r} distinct, no repeats`;
505
503
  const s = Array.from(o.getValueCounts()).slice(0, t);
506
504
  return `${r} unique (${s.map(([e, t]) => `${e} ${t}`).join(" · ")}${r > s.length ? " · …" : ""})`;
507
505
  }
508
- var re = r.Feature, se = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), ae = (e, t) => {
506
+ var ie = r.Feature, ce = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), ue = (e, t) => {
509
507
  const n = Math.min(e.rowEnd, t.rowEnd) - Math.max(e.rowStart, t.rowStart) + 1;
510
508
  if (n <= 0) return 0;
511
509
  const o = Math.min(e.colEnd, t.colEnd) - Math.max(e.colStart, t.colStart) + 1;
512
510
  return o <= 0 ? 0 : n * o;
513
511
  };
514
- var le = (e) => e.toLocaleString("en-US"), ie = (e, t) => {
515
- const n = `×${le(e.content)}`;
516
- return "times" === t || e.styled === e.content ? n : `${n} (+${le(e.styled - e.content)} blank)`;
517
- }, ce = (t) => {
512
+ var ge = (e) => e.toLocaleString("en-US"), de = (e, t) => {
513
+ const n = `×${ge(e.content)}`;
514
+ return "times" === t || e.styled === e.content ? n : `${n} (+${ge(e.styled - e.content)} blank)`;
515
+ }, he = (t) => {
518
516
  if (0 === t.length) return "";
519
517
  const n = e.rangeToString(t[0]);
520
518
  if (1 === t.length) return n;
521
519
  const o = t.length - 1;
522
520
  return `${n}, +${o} block${1 === o ? "" : "s"}`;
523
521
  };
524
- function ue(e, t) {
525
- const n = t?.manyDistinct ?? 20, { sorted: o, top: r, rare: s, more: a } = ge(e, t);
522
+ function me(e, t) {
523
+ const n = t?.manyDistinct ?? 20, { sorted: o, top: r, rare: s, more: l } = fe(e, t);
526
524
  if (0 === o.length) return "";
527
- const l = (e) => ((e, t) => {
528
- const n = ce(e.blocks);
529
- return `${e.label === t?.hideLabel ? "" : `${e.label} `}${ie(e, t?.countStyle ?? "cells")}${n ? ` ${n}` : ""}`;
525
+ const a = (e) => ((e, t) => {
526
+ const n = he(e.blocks);
527
+ return `${e.label === t?.hideLabel ? "" : `${e.label} `}${de(e, t?.countStyle ?? "cells")}${n ? ` ${n}` : ""}`;
530
528
  })(e, t);
531
- if (0 === a) return o.map(l).join(" · ");
529
+ if (0 === l) return o.map(a).join(" · ");
532
530
  const i = o.reduce((e, t) => e + t.content, 0), c = i > 0 ? o[0].content / i : 0, u = [], g = o.length > n ? `${o.length} distinct${c < .5 ? ", no convention" : ""}; largest ` : "";
533
- return u.push(g + r.map(l).join(" · ")), s.length > 0 && u.push(`rarest ${s.map(l).join(" · ")}`), u.push(`+${a} more${t?.recovery ? ` (${t.recovery})` : ""}`), u.join(" · ");
531
+ return u.push(g + r.map(a).join(" · ")), s.length > 0 && u.push(`rarest ${s.map(a).join(" · ")}`), u.push(`+${l} more${t?.recovery ? ` (${t.recovery})` : ""}`), u.join(" · ");
534
532
  }
535
- function ge(e, t) {
533
+ function fe(e, t) {
536
534
  const n = t?.maxValues ?? 8, o = [...e].sort((e, t) => t.content - e.content || t.styled - e.styled || (e.label < t.label ? -1 : 1));
537
535
  if (o.length <= n) return {
538
536
  sorted: o,
@@ -540,106 +538,106 @@ function ge(e, t) {
540
538
  rare: [],
541
539
  more: 0
542
540
  };
543
- const r = Math.max(1, Math.floor(n / 2)), s = o.slice(0, r), a = [];
544
- for (let e = o.length - 1; e >= r && a.length < n - r; e--) o[e].content > 0 && a.push(o[e]);
545
- return a.reverse(), {
541
+ const r = Math.max(1, Math.floor(n / 2)), s = o.slice(0, r), l = [];
542
+ for (let e = o.length - 1; e >= r && l.length < n - r; e--) o[e].content > 0 && l.push(o[e]);
543
+ return l.reverse(), {
546
544
  sorted: o,
547
545
  top: s,
548
- rare: a,
549
- more: o.length - s.length - a.length
546
+ rare: l,
547
+ more: o.length - s.length - l.length
550
548
  };
551
549
  }
552
- var de = [
550
+ var pe = [
553
551
  {
554
552
  name: "family",
555
- project: (e, t) => ye(e.getFont().getFamily(), t?.getFont().getFamily())
553
+ project: (e, t) => ke(e.getFont().getFamily(), t?.getFont().getFamily())
556
554
  },
557
555
  {
558
556
  name: "size",
559
- project: (e, t) => ye(e.getFont().getSize(), t?.getFont().getSize(), (e) => `${e}pt`)
557
+ project: (e, t) => ke(e.getFont().getSize(), t?.getFont().getSize(), (e) => `${e}pt`)
560
558
  },
561
559
  {
562
560
  name: "bold",
563
- project: (e, t) => ye(e.getFont().getBold(), t?.getFont().getBold() ?? !1, (e) => e ? "bold" : "not bold")
561
+ project: (e, t) => ke(e.getFont().getBold(), t?.getFont().getBold() ?? !1, (e) => e ? "bold" : "not bold")
564
562
  },
565
563
  {
566
564
  name: "italic",
567
- project: (e, t) => ye(e.getFont().getItalic(), t?.getFont().getItalic() ?? !1, (e) => e ? "italic" : "not italic")
565
+ project: (e, t) => ke(e.getFont().getItalic(), t?.getFont().getItalic() ?? !1, (e) => e ? "italic" : "not italic")
568
566
  },
569
567
  {
570
568
  name: "underline",
571
- project: (e, t) => ye(e.getFont().getUnderline(), t?.getFont().getUnderline(), (e) => String(e))
569
+ project: (e, t) => ke(e.getFont().getUnderline(), t?.getFont().getUnderline(), (e) => String(e))
572
570
  },
573
571
  {
574
572
  name: "strike",
575
- project: (e, t) => ye(e.getFont().getStrike(), t?.getFont().getStrike() ?? !1, (e) => e ? "strike" : "not strike")
573
+ project: (e, t) => ke(e.getFont().getStrike(), t?.getFont().getStrike() ?? !1, (e) => e ? "strike" : "not strike")
576
574
  },
577
575
  {
578
576
  name: "color",
579
- project: (e, t) => ye(v(e.getFont().getColor()), t ? v(t.getFont().getColor()) : null)
577
+ project: (e, t) => ke(I(e.getFont().getColor()), t ? I(t.getFont().getColor()) : null)
580
578
  }
581
- ], he = (e) => be(e) ?? "Custom", me = {
579
+ ], $e = (e) => Ee(e) ?? "Custom", we = {
582
580
  name: "category",
583
581
  project: (e) => {
584
- const t = F(e);
585
- return null === t ? null : he(t);
582
+ const t = L(e);
583
+ return null === t ? null : $e(t);
586
584
  }
587
- }, fe = {
585
+ }, ye = {
588
586
  name: "format",
589
- project: (e) => F(e)
590
- }, pe = [me, fe], $e = [{
587
+ project: (e) => L(e)
588
+ }, Se = [we, ye], be = [{
591
589
  name: "color",
592
- project: (e) => R(e)
593
- }], we = [{
590
+ project: (e) => F(e)
591
+ }], xe = [{
594
592
  name: "edges",
595
- project: (e) => N(e)
596
- }], Se = [
593
+ project: (e) => M(e)
594
+ }], Ce = [
597
595
  {
598
596
  name: "h",
599
597
  ambiguous: !0,
600
- project: (e, t) => ye(e.getAlignment().getHorizontal(), t?.getAlignment().getHorizontal())
598
+ project: (e, t) => ke(e.getAlignment().getHorizontal(), t?.getAlignment().getHorizontal())
601
599
  },
602
600
  {
603
601
  name: "v",
604
602
  ambiguous: !0,
605
- project: (e, t) => ye(e.getAlignment().getVertical(), t?.getAlignment().getVertical())
603
+ project: (e, t) => ke(e.getAlignment().getVertical(), t?.getAlignment().getVertical())
606
604
  },
607
605
  {
608
606
  name: "overflow",
609
- project: (e, t) => ye(e.getAlignment().getOverflow(), t?.getAlignment().getOverflow())
607
+ project: (e, t) => ke(e.getAlignment().getOverflow(), t?.getAlignment().getOverflow())
610
608
  },
611
609
  {
612
610
  name: "indent",
613
- project: (e, t) => ye(e.getAlignment().getIndent(), t?.getAlignment().getIndent() ?? 0, (e) => `indent ${e}`)
611
+ project: (e, t) => ke(e.getAlignment().getIndent(), t?.getAlignment().getIndent() ?? 0, (e) => `indent ${e}`)
614
612
  },
615
613
  {
616
614
  name: "rotation",
617
- project: (e, t) => ye(e.getAlignment().getRotation(), t?.getAlignment().getRotation() ?? 0, (e) => `rotation ${e}`)
615
+ project: (e, t) => ke(e.getAlignment().getRotation(), t?.getAlignment().getRotation() ?? 0, (e) => `rotation ${e}`)
618
616
  }
619
617
  ];
620
- function ye(e, t, n = String) {
618
+ function ke(e, t, n = String) {
621
619
  return null == e || void 0 !== t && e === t ? null : n(e);
622
620
  }
623
- function be(e) {
621
+ function Ee(e) {
624
622
  if (!e || "General" === e) return null;
625
- const t = h.Builder.parse(e);
623
+ const t = p.Builder.parse(e);
626
624
  if ("General" === t.category) return null;
627
625
  const n = t.decimalPlaces;
628
626
  return null != n ? `${t.category} ${n}dp` : t.category;
629
627
  }
630
- var xe = {
631
- [re.Font]: de,
632
- [re.NumberFormat]: pe,
633
- [re.Fill]: $e,
634
- [re.Borders]: we,
635
- [re.Alignment]: Se
636
- }, Ce = (e) => e in xe;
637
- function Ee(e, t, n, o) {
638
- const r = xe[t];
628
+ var ve = {
629
+ [ie.Font]: pe,
630
+ [ie.NumberFormat]: Se,
631
+ [ie.Fill]: be,
632
+ [ie.Borders]: xe,
633
+ [ie.Alignment]: Ce
634
+ }, Re = (e) => e in ve;
635
+ function Ne(e, t, n, o) {
636
+ const r = ve[t];
639
637
  if (!r) return null;
640
- const s = e.getEntireCoords(), a = e.getUsedRange()?.getCoords() ?? null, l = [...e.getEntireRange().getRegions(t)];
641
- if (0 === l.length) return null;
642
- const i = o?.content ?? (a ? [...e.getEntireRange().getRegions(re.Contentful)].map((e) => e.getCoords()) : []), c = (e) => i.reduce((t, n) => t + ae(e, n), 0), u = (e) => a ? ae(e, a) : 0, g = (e) => {
638
+ const s = e.getEntireCoords(), l = e.getUsedRange()?.getCoords() ?? null, a = [...e.getEntireRange().getRegions(t)];
639
+ if (0 === a.length) return null;
640
+ const i = o?.content ?? (l ? [...e.getEntireRange().getRegions(ie.Contentful)].map((e) => e.getCoords()) : []), c = (e) => i.reduce((t, n) => t + ue(e, n), 0), u = (e) => l ? ue(e, l) : 0, g = (e) => {
643
641
  const t = e.getRange().getStyle(), o = [];
644
642
  for (const e of r) {
645
643
  const r = e.project(t, n);
@@ -647,15 +645,15 @@ function Ee(e, t, n, o) {
647
645
  }
648
646
  return o.join(" · ");
649
647
  }, d = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
650
- for (const e of l) h.set(e, e.getRange().getStyle()), d.add(g(e));
648
+ for (const e of a) h.set(e, e.getRange().getStyle()), d.add(g(e));
651
649
  const m = s.rowEnd - s.rowStart + 1, f = s.colEnd - s.colStart + 1, p = [], $ = [], w = [];
652
- for (const e of l) {
650
+ for (const e of a) {
653
651
  const t = e.getCoords();
654
652
  2 * (t.rowEnd - t.rowStart + 1) > m ? p.push(e) : 2 * (t.colEnd - t.colStart + 1) > f ? $.push(e) : w.push(e);
655
653
  }
656
- const S = [];
657
- S.push(...Fe("columns", p, g, s, !0)), S.push(...Fe("rows", $, g, s, !1));
658
- const y = w.reduce((e, t) => e + u(t.getCoords()), 0), b = (e) => {
654
+ const y = [];
655
+ y.push(...Le("columns", p, g, s, !0)), y.push(...Le("rows", $, g, s, !1));
656
+ const S = w.reduce((e, t) => e + u(t.getCoords()), 0), b = (e) => {
659
657
  const t = [];
660
658
  for (const o of w) {
661
659
  const r = e.project(h.get(o), n);
@@ -697,32 +695,32 @@ function Ee(e, t, n, o) {
697
695
  }
698
696
  return [...o.values()].map((e) => ({
699
697
  ...e,
700
- blocks: e.blocks.sort((e, t) => se(t) - se(e))
698
+ blocks: e.blocks.sort((e, t) => ce(t) - ce(e))
701
699
  }));
702
700
  }, x = [];
703
- if (t === re.NumberFormat) x.push(...function(e, t, n) {
704
- const { top: o, rare: r, more: s } = ge(e, n), a = [];
705
- let l = -1;
701
+ if (t === ie.NumberFormat) x.push(...function(e, t, n) {
702
+ const { top: o, rare: r, more: s } = fe(e, n), l = [];
703
+ let a = -1;
706
704
  for (const e of [...o, ...r]) {
707
- e === r[0] && (l = a.length);
708
- const n = ge(t.filter((t) => he(t.label) === e.label), { maxValues: Infinity }).sorted, o = 1 === n.length;
709
- if (a.push([
705
+ e === r[0] && (a = l.length);
706
+ const n = fe(t.filter((t) => $e(t.label) === e.label), { maxValues: Infinity }).sorted, o = 1 === n.length;
707
+ if (l.push([
710
708
  e.label,
711
- ie(e, "cells"),
712
- ce(e.blocks),
709
+ de(e, "cells"),
710
+ he(e.blocks),
713
711
  o ? n[0].label : `${n.length} formats`
714
712
  ]), !o) {
715
- for (const e of n.slice(0, je)) a.push([
713
+ for (const e of n.slice(0, Ae)) l.push([
716
714
  "",
717
- ie(e, "cells"),
718
- ce(e.blocks),
715
+ de(e, "cells"),
716
+ he(e.blocks),
719
717
  e.label
720
718
  ]);
721
- n.length > je && a.push([
719
+ n.length > Ae && l.push([
722
720
  "",
723
721
  "",
724
722
  "",
725
- `…and ${n.length - je} more`
723
+ `…and ${n.length - Ae} more`
726
724
  ]);
727
725
  }
728
726
  }
@@ -730,38 +728,38 @@ function Ee(e, t, n, o) {
730
728
  0,
731
729
  1,
732
730
  2
733
- ].map((e) => Math.max(...a.map((t) => t[e].length))), c = a.map((e) => `${e[0].padEnd(i[0])} ${e[1].padEnd(i[1])} ${e[2].padEnd(i[2])} ${e[3]}`.trimEnd());
734
- s > 0 && c.splice(l < 0 ? c.length : l, 0, `…and ${s} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
731
+ ].map((e) => Math.max(...l.map((t) => t[e].length))), c = l.map((e) => `${e[0].padEnd(i[0])} ${e[1].padEnd(i[1])} ${e[2].padEnd(i[2])} ${e[3]}`.trimEnd());
732
+ s > 0 && c.splice(a < 0 ? c.length : a, 0, `…and ${s} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
735
733
  return c;
736
- }(b(me), b(fe), o));
734
+ }(b(we), b(ye), o));
737
735
  else for (const e of r) {
738
736
  const t = b(e);
739
737
  if (0 === t.length) continue;
740
- const n = ue(t, {
738
+ const n = me(t, {
741
739
  ...o,
742
740
  hideLabel: e.name
743
741
  });
744
- n.length <= Ne ? x.push(`${e.name.padEnd(10)}${n}`) : x.push(...Ie(e.name, t, o));
742
+ n.length <= Me ? x.push(`${e.name.padEnd(10)}${n}`) : x.push(...Te(e.name, t, o));
745
743
  }
746
744
  return {
747
745
  distinct: d.size,
748
- cells: y,
749
- normal: n ? Re(t, n) : null,
750
- tiers: S,
746
+ cells: S,
747
+ normal: n ? Fe(t, n) : null,
748
+ tiers: y,
751
749
  attributes: x
752
750
  };
753
751
  }
754
- function ke(e, t) {
752
+ function je(e, t) {
755
753
  if (0 === e.length) return null;
756
754
  const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
757
755
  let r = 0;
758
756
  for (const t of e) {
759
- const e = t.getRowCount() * t.getColumnCount(), s = t.getCell(), a = s.getFormulaText({ r1c1: !0 }) ?? "", l = n.get(a) ?? {
760
- label: a,
757
+ const e = t.getRowCount() * t.getColumnCount(), s = t.getCell(), l = s.getFormulaText({ r1c1: !0 }) ?? "", a = n.get(l) ?? {
758
+ label: l,
761
759
  cells: 0,
762
760
  blocks: []
763
761
  };
764
- l.cells += e, l.blocks.push(t.getCoords()), n.set(a, l);
762
+ a.cells += e, a.blocks.push(t.getCoords()), n.set(l, a);
765
763
  const i = /* @__PURE__ */ new Set();
766
764
  for (const e of s.getFormula()?.getTokens() ?? []) {
767
765
  if ("function" !== e.type) continue;
@@ -774,28 +772,28 @@ function ke(e, t) {
774
772
  const s = {
775
773
  ...t,
776
774
  countStyle: "times"
777
- }, a = [...n.values()].map((e) => ({
775
+ }, l = [...n.values()].map((e) => ({
778
776
  label: e.label,
779
777
  content: e.cells,
780
778
  styled: e.cells,
781
- blocks: e.blocks.sort((e, t) => se(t) - se(e))
782
- })), l = [...o.entries()].map(([e, t]) => ({
779
+ blocks: e.blocks.sort((e, t) => ce(t) - ce(e))
780
+ })), a = [...o.entries()].map(([e, t]) => ({
783
781
  label: e,
784
782
  content: t,
785
783
  styled: t,
786
784
  blocks: []
787
785
  }));
788
- return r > 0 && l.push({
786
+ return r > 0 && a.push({
789
787
  label: "no function",
790
788
  content: r,
791
789
  styled: r,
792
790
  blocks: []
793
791
  }), {
794
792
  distinct: n.size,
795
- lines: [`${"distinct".padEnd(10)}${ue(a, s)}`, `${"functions".padEnd(10)}${ue(l, s)}`]
793
+ lines: [`${"distinct".padEnd(10)}${me(l, s)}`, `${"functions".padEnd(10)}${me(a, s)}`]
796
794
  };
797
795
  }
798
- function ve(e, t) {
796
+ function Ie(e, t) {
799
797
  const n = e.getStats({ onError: "ignore" }).getTypedCounts(), o = /* @__PURE__ */ new Map(), r = [
800
798
  ["number", "number"],
801
799
  ["string", "text"],
@@ -807,86 +805,86 @@ function ve(e, t) {
807
805
  const r = n[e] ?? 0;
808
806
  r > 0 && o.set(t, r);
809
807
  }
810
- let s = Y(e), a = 0;
808
+ let s = oe(e), l = 0;
811
809
  for (const e of t) {
812
810
  const t = e.getRange().getStats({ onError: "ignore" }).getTypedCounts();
813
- a += e.getRowCount() * e.getColumnCount();
811
+ l += e.getRowCount() * e.getColumnCount();
814
812
  for (const [e, n] of r) {
815
813
  const r = t[e] ?? 0;
816
814
  r > 0 && o.set(n, (o.get(n) ?? 0) - r);
817
815
  }
818
- s > 0 && (t.number ?? 0) > 0 && (s -= Y(e.getRange()));
816
+ s > 0 && (t.number ?? 0) > 0 && (s -= oe(e.getRange()));
819
817
  }
820
- return s > 0 && (o.set("date", s), o.set("number", (o.get("number") ?? 0) - s)), a > 0 && o.set("formula", a), [...o.entries()].filter(([, e]) => e > 0).sort((e, t) => t[1] - e[1]);
818
+ return s > 0 && (o.set("date", s), o.set("number", (o.get("number") ?? 0) - s)), l > 0 && o.set("formula", l), [...o.entries()].filter(([, e]) => e > 0).sort((e, t) => t[1] - e[1]);
821
819
  }
822
- function Re(e, t) {
820
+ function Fe(e, t) {
823
821
  switch (e) {
824
- case re.Font: return function(e) {
825
- const t = e.getFont(), n = [t.getFamily(), `${t.getSize()}pt`], o = v(t.getColor());
822
+ case ie.Font: return function(e) {
823
+ const t = e.getFont(), n = [t.getFamily(), `${t.getSize()}pt`], o = I(t.getColor());
826
824
  o && n.push(o);
827
825
  t.getBold() && n.push("bold");
828
826
  t.getItalic() && n.push("italic");
829
827
  return n.join(" · ");
830
828
  }(t);
831
- case re.NumberFormat: {
832
- const e = F(t);
833
- return null === e ? null : `${he(e)} ${e}`;
829
+ case ie.NumberFormat: {
830
+ const e = L(t);
831
+ return null === e ? null : `${$e(e)} ${e}`;
834
832
  }
835
- case re.Fill: return R(t);
836
- case re.Borders: return N(t);
837
- case re.Alignment: {
833
+ case ie.Fill: return F(t);
834
+ case ie.Borders: return M(t);
835
+ case ie.Alignment: {
838
836
  const e = t.getAlignment(), n = [];
839
837
  return "general" !== e.getHorizontal() && n.push(`h ${e.getHorizontal()}`), "bottom" !== e.getVertical() && n.push(`v ${e.getVertical()}`), "visible" !== e.getOverflow() && n.push(String(e.getOverflow())), e.getIndent() && n.push(`indent ${e.getIndent()}`), e.getRotation() && n.push(`rotation ${e.getRotation()}`), n.length > 0 ? n.join(" · ") : null;
840
838
  }
841
839
  default: return null;
842
840
  }
843
841
  }
844
- var Ne = 110;
845
- function Ie(e, t, n) {
846
- const { sorted: o, top: r, rare: s, more: a } = ge(t, n), l = [...r, ...s].map((e) => [
847
- ie(e, "cells"),
848
- ce(e.blocks),
842
+ var Me = 110;
843
+ function Te(e, t, n) {
844
+ const { sorted: o, top: r, rare: s, more: l } = fe(t, n), a = [...r, ...s].map((e) => [
845
+ de(e, "cells"),
846
+ he(e.blocks),
849
847
  e.label
850
- ]), i = [0, 1].map((e) => Math.max(...l.map((t) => t[e].length))), c = l.map((e) => ` ${e[0].padEnd(i[0])} ${e[1].padEnd(i[1])} ${e[2]}`);
851
- a > 0 && c.splice(r.length, 0, ` …and ${a} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
848
+ ]), i = [0, 1].map((e) => Math.max(...a.map((t) => t[e].length))), c = a.map((e) => ` ${e[0].padEnd(i[0])} ${e[1].padEnd(i[1])} ${e[2]}`);
849
+ l > 0 && c.splice(r.length, 0, ` …and ${l} more${n?.recovery ? ` · ${n.recovery}` : ""}`);
852
850
  const u = n?.manyDistinct ?? 20;
853
851
  return [o.length > u ? `${e.padEnd(10)}${o.length} distinct` : e, ...c];
854
852
  }
855
- var je = 6;
856
- function Fe(t, n, o, r, s) {
853
+ var Ae = 6;
854
+ function Le(t, n, o, r, s) {
857
855
  if (0 === n.length) return [];
858
- const a = /* @__PURE__ */ new Map();
856
+ const l = /* @__PURE__ */ new Map();
859
857
  for (const e of n) {
860
- const t = o(e), n = a.get(t);
861
- n ? n.push(e) : a.set(t, [e]);
858
+ const t = o(e), n = l.get(t);
859
+ n ? n.push(e) : l.set(t, [e]);
862
860
  }
863
- const l = s ? r.colEnd - r.colStart + 1 : r.rowEnd - r.rowStart + 1, i = [];
864
- for (const [n, o] of a) {
861
+ const a = s ? r.colEnd - r.colStart + 1 : r.rowEnd - r.rowStart + 1, i = [];
862
+ for (const [n, o] of l) {
865
863
  let r = 0;
866
- const a = o.map((t) => {
864
+ const l = o.map((t) => {
867
865
  const n = t.getCoords();
868
866
  r += s ? n.colEnd - n.colStart + 1 : n.rowEnd - n.rowStart + 1;
869
- const o = s ? e.runToString(n.colStart, n.colEnd, !0) : e.runToString(n.rowStart, n.rowEnd, !1), a = s ? n.rowStart : n.colStart;
870
- return 0 === a ? o : `${o} (from ${s ? `row ${a + 1}` : `column ${e.runToString(a, a, !0).split(":")[0]}`})`;
867
+ const o = s ? e.runToString(n.colStart, n.colEnd, !0) : e.runToString(n.rowStart, n.rowEnd, !1), l = s ? n.rowStart : n.colStart;
868
+ return 0 === l ? o : `${o} (from ${s ? `row ${l + 1}` : `column ${e.runToString(l, l, !0).split(":")[0]}`})`;
871
869
  });
872
- 2 * r > l ? i.push(`${"sheet".padEnd(10)}${n || "default"}`) : i.push(`${t.padEnd(10)}${a.join(", ")} ${n || "default"}`);
870
+ 2 * r > a ? i.push(`${"sheet".padEnd(10)}${n || "default"}`) : i.push(`${t.padEnd(10)}${l.join(", ")} ${n || "default"}`);
873
871
  }
874
872
  return i;
875
873
  }
876
- var Me = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Te = (e) => {
874
+ var Oe = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Pe = (e) => {
877
875
  if (!e) return null;
878
- if ("string" != typeof e) return v(e);
876
+ if ("string" != typeof e) return I(e);
879
877
  const t = e.replace(/^#/, "");
880
878
  return /^[0-9a-f]{6}$/i.test(t) || /^[0-9a-f]{8}$/i.test(t) ? `#${(8 === t.length && /^ff/i.test(t) ? t.slice(2) : t).toUpperCase()}` : e;
881
- }, Ae = (e) => {
879
+ }, De = (e) => {
882
880
  if (!e) return null;
883
881
  const t = [], n = ((e) => {
884
882
  if (!e) return null;
885
- if ("string" == typeof e) return Te(e);
883
+ if ("string" == typeof e) return Pe(e);
886
884
  const t = e.type;
887
885
  if (t === i.Type.None) return null;
888
886
  if (t === i.Type.Gradient) return "gradient";
889
- const n = e, o = Te(n.foreground ?? e.color ?? n.background), r = n.patternType;
887
+ const n = e, o = Pe(n.foreground ?? e.color ?? n.background), r = n.patternType;
890
888
  return [r && r !== i.BuiltInSheetPattern.Solid ? `${r} pattern` : null, o].filter(Boolean).join(" ") || null;
891
889
  })(e.fill);
892
890
  n && t.push(`fill ${n}`);
@@ -894,97 +892,97 @@ var Me = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Te = (e) => {
894
892
  if (o) {
895
893
  const e = [];
896
894
  (void 0 !== o.weight ? o.weight >= 600 : !0 === o.bold) && e.push("bold"), (void 0 !== o.style ? o.style === c.Style.Italic : !0 === o.italic) && e.push("italic"), o.strike && e.push("strike"), o.underline && o.underline !== c.UnderlineStyle.None && e.push(`underline ${o.underline}`);
897
- const n = "auto" === o.color ? null : Te(o.color);
895
+ const n = "auto" === o.color ? null : Pe(o.color);
898
896
  n && e.push(`text ${n}`), e.length > 0 && t.push(e.join(" "));
899
897
  }
900
898
  if (void 0 !== e.numberFormat && null !== e.numberFormat) {
901
- const n = "number" == typeof e.numberFormat ? h.resolve(e.numberFormat) : String(e.numberFormat);
899
+ const n = "number" == typeof e.numberFormat ? p.resolve(e.numberFormat) : String(e.numberFormat);
902
900
  n && t.push(n);
903
901
  }
904
902
  return e.borders && t.push("border"), e.alignment && t.push("alignment"), t.length > 0 ? t.join(" · ") : null;
905
- }, Le = (e) => {
906
- const t = e.type ?? a.ColorStopType.Num, n = e.value, o = null == n || "" === n ? t : `${t} ${n}`, r = Te(e.color);
903
+ }, Ve = (e) => {
904
+ const t = e.type ?? l.ColorStopType.Num, n = e.value, o = null == n || "" === n ? t : `${t} ${n}`, r = Pe(e.color);
907
905
  return r ? `${o} ${r}` : o;
908
- }, Oe = (e) => {
906
+ }, Be = (e) => {
909
907
  let t = e.type;
910
- if (e.type === a.ScaleType.DataBar) {
911
- const n = Te(e.color);
908
+ if (e.type === l.ScaleType.DataBar) {
909
+ const n = Pe(e.color);
912
910
  n && (t += ` ${n}`);
913
- } else e.type === a.ScaleType.IconSet && (e.iconSet && (t += ` ${e.iconSet}`), e.reverse && (t += " reversed"), e.icon?.length && (t += " custom icons"));
914
- const n = (e.stops ?? []).map(Le).join(" → ");
911
+ } else e.type === l.ScaleType.IconSet && (e.iconSet && (t += ` ${e.iconSet}`), e.reverse && (t += " reversed"), e.icon?.length && (t += " custom icons"));
912
+ const n = (e.stops ?? []).map(Ve).join(" → ");
915
913
  return n ? `${t} · ${n}` : t;
916
- }, Pe = "(no rule)", De = (e) => {
914
+ }, He = "(no rule)", _e = (e) => {
917
915
  const t = e.getScale(), n = [];
918
- if (t) n.push(Oe(t));
916
+ if (t) n.push(Be(t));
919
917
  else {
920
- n.push(e.getCondition()?.toString() || Pe);
921
- const t = Ae(e.getStyle());
918
+ n.push(e.getCondition()?.toString() || He);
919
+ const t = De(e.getStyle());
922
920
  t && n.push(`→ ${t}`);
923
921
  }
924
- return e.isStopIfTrue() && n.push("· stop if true"), Me(n.join(" "), 90);
925
- }, Ve = (e) => {
926
- const t = [e.getCondition()?.toString() || Pe], n = e.getAlertStyle();
927
- return n && t.push(n), e.isIncludeBlanks() && t.push("blanks allowed"), e.isHideDropdown() && t.push("no dropdown"), Me(t.join(" · "), 90);
928
- }, Be = (e) => {
922
+ return e.isStopIfTrue() && n.push("· stop if true"), Oe(n.join(" "), 90);
923
+ }, ze = (e) => {
924
+ const t = [e.getCondition()?.toString() || He], n = e.getAlertStyle();
925
+ return n && t.push(n), e.isIncludeBlanks() && t.push("blanks allowed"), e.isHideDropdown() && t.push("no dropdown"), Oe(t.join(" · "), 90);
926
+ }, Ue = (e) => {
929
927
  if (e?.getOperator()?.getName() !== s.BuiltInOperatorNames.InSet) return null;
930
928
  const t = e.getParam()?.items;
931
929
  if (!t) return null;
932
930
  if ("string" == typeof t) return t;
933
- const n = t.slice(0, 20).map((e) => b(e)?.match ?? ""), o = t.length - n.length;
931
+ const n = t.slice(0, 20).map((e) => E(e)?.match ?? ""), o = t.length - n.length;
934
932
  return o > 0 ? `${n.join(", ")}, +${o} more` : n.join(", ");
935
- }, He = (e, t) => {
933
+ }, We = (e, t) => {
936
934
  if (0 === e.length) return null;
937
935
  const n = e.slice(0, 3).map(t), o = e.length - n.length;
938
936
  return o > 0 ? `${n.join(" | ")} | +${o} more` : n.join(" | ");
939
- }, _e = r.Feature, Ue = (e) => e.getRange().getStyle(), ze = (e) => y(e.getCell(), $.Mode.Display)?.display ?? null;
940
- function We(e, t) {
937
+ }, Je = r.Feature, qe = (e) => e.getRange().getStyle(), Ge = (e) => k(e.getCell(), b.Mode.Display)?.display ?? null;
938
+ function Xe(e, t) {
941
939
  switch (e) {
942
- case _e.Formula: return (e) => e.getCell().getFormulaText();
943
- case _e.Error: return ze;
944
- case _e.CalcError: return (e) => {
945
- const t = ze(e) ?? "", n = e.getCell().getFormulaText();
940
+ case Je.Formula: return (e) => e.getCell().getFormulaText();
941
+ case Je.Error: return Ge;
942
+ case Je.CalcError: return (e) => {
943
+ const t = Ge(e) ?? "", n = e.getCell().getFormulaText();
946
944
  return (n ? `${t} ${n}` : t).trim() || null;
947
945
  };
948
- case _e.Merge: return ze;
949
- case _e.Comments: return (e) => {
946
+ case Je.Merge: return Ge;
947
+ case Je.Comments: return (e) => {
950
948
  const t = e.getCell().getComments()?.getContent();
951
949
  if ("string" != typeof t) return null;
952
950
  const n = t.replace(/\s+/g, " ").trim();
953
951
  return n ? n.length > 60 ? `${n.slice(0, 59)}…` : n : null;
954
952
  };
955
- case _e.Spills: return (e) => e.getCell().getSpill()?.getValuesRange().toString() ?? null;
956
- case _e.Hyperlink: return (e) => e.getCell().getHyperlink()?.getAddress() ?? null;
957
- case _e.Table: return (e) => e.getCell().getTable()?.getName() ?? null;
958
- case _e.Fill: return (e) => R(Ue(e));
959
- case _e.Borders: return (e) => N(Ue(e));
960
- case _e.NumberFormat: return (e) => F(Ue(e));
961
- case _e.Alignment: return t ? (e) => M(Ue(e), t) : void 0;
962
- case _e.Font: return t ? (e) => T(Ue(e), t) : void 0;
963
- case _e.Protection: return (e) => {
964
- const t = Ue(e).getProtection(), n = [];
953
+ case Je.Spills: return (e) => e.getCell().getSpill()?.getValuesRange().toString() ?? null;
954
+ case Je.Hyperlink: return (e) => e.getCell().getHyperlink()?.getAddress() ?? null;
955
+ case Je.Table: return (e) => e.getCell().getTable()?.getName() ?? null;
956
+ case Je.Fill: return (e) => F(qe(e));
957
+ case Je.Borders: return (e) => M(qe(e));
958
+ case Je.NumberFormat: return (e) => L(qe(e));
959
+ case Je.Alignment: return t ? (e) => O(qe(e), t) : void 0;
960
+ case Je.Font: return t ? (e) => P(qe(e), t) : void 0;
961
+ case Je.Protection: return (e) => {
962
+ const t = qe(e).getProtection(), n = [];
965
963
  return t.isAlwaysUnlocked() && n.push("always unlocked"), t.isShowFormulas() || n.push("formulas hidden"), n.join(", ") || null;
966
964
  };
967
- case _e.Unlock: return (e) => {
965
+ case Je.Unlock: return (e) => {
968
966
  const t = [];
969
967
  e.getCell().getProtection().isAlwaysUnlocked() && t.push("always unlocked");
970
968
  const n = e.getRange();
971
969
  for (const e of n.getSheet().getProtectedRanges().getItems({ address: n })) t.push(`range ${e.getName()}${e.isUnlocked() ? "" : " · password"}`);
972
970
  return t.join(", ") || null;
973
971
  };
974
- case _e.Conditionals: return (e) => He(e.getRange().getConditionalFormats(), De);
975
- case _e.DataValidations: return (e) => He(e.getRange().getDataValidations(), Ve);
976
- case _e.Contentful: return (e) => Q(e.getRange()).join(" ") || null;
972
+ case Je.Conditionals: return (e) => We(e.getRange().getConditionalFormats(), _e);
973
+ case Je.DataValidations: return (e) => We(e.getRange().getDataValidations(), ze);
974
+ case Je.Contentful: return (e) => ne(e.getRange()).join(" ") || null;
977
975
  default: return;
978
976
  }
979
977
  }
980
- function qe(e, t) {
981
- const n = e.map((e) => We(e, t)).filter((e) => !!e);
978
+ function Ze(e, t) {
979
+ const n = e.map((e) => Xe(e, t)).filter((e) => !!e);
982
980
  if (0 !== n.length) return 1 === n.length ? n[0] : (e) => {
983
981
  const t = n.map((t) => t(e)).filter(Boolean);
984
982
  return t.length > 0 ? t.join(" ") : null;
985
983
  };
986
984
  }
987
- var Je = class {
985
+ var Ke = class {
988
986
  constructor() {
989
987
  this._lines = [], this._headingOffset = 0;
990
988
  }
@@ -1025,7 +1023,7 @@ var Je = class {
1025
1023
  return `\`\`\`${t}\n${e}\n\`\`\``;
1026
1024
  }
1027
1025
  beginFrame(e) {
1028
- return new Ge(this, e);
1026
+ return new Qe(this, e);
1029
1027
  }
1030
1028
  _addLines(e) {
1031
1029
  this._lines.push(...e);
@@ -1033,7 +1031,7 @@ var Je = class {
1033
1031
  toLines() {
1034
1032
  return [...this._lines];
1035
1033
  }
1036
- }, Ge = class {
1034
+ }, Qe = class {
1037
1035
  constructor(e, t) {
1038
1036
  this._parent = e, this._headers = t, this._indexWidth = 0, this._rows = [], this._colWidths = t.map((e) => e.length);
1039
1037
  }
@@ -1060,28 +1058,28 @@ var Je = class {
1060
1058
  _renderLines() {
1061
1059
  const e = " ", t = this._indexWidth > 0 ? " ".repeat(this._indexWidth) : "", n = this._colWidths.map((e, t) => this._columnAlignment(t)), o = [];
1062
1060
  if (this._headers.some((e) => e.length > 0)) {
1063
- const r = this._headers.map((e, t) => Xe(e, this._colWidths[t], n[t])).join(e);
1061
+ const r = this._headers.map((e, t) => Ye(e, this._colWidths[t], n[t])).join(e);
1064
1062
  o.push(`${t}${t ? e : ""}${r}`.trimEnd());
1065
1063
  }
1066
1064
  for (const t of this._rows) {
1067
- const n = t.cells.map((e, t) => Xe(e.text, this._colWidths[t], e.alignment)).join(e), r = this._indexWidth > 0 ? (t.index ?? "").padStart(this._indexWidth) + e : "";
1065
+ const n = t.cells.map((e, t) => Ye(e.text, this._colWidths[t], e.alignment)).join(e), r = this._indexWidth > 0 ? (t.index ?? "").padStart(this._indexWidth) + e : "";
1068
1066
  o.push(`${r}${n}`.trimEnd());
1069
1067
  }
1070
1068
  return o;
1071
1069
  }
1072
- }, Xe = (e, t, n) => {
1070
+ }, Ye = (e, t, n) => {
1073
1071
  if (e.length >= t) return e;
1074
1072
  const o = t - e.length;
1075
1073
  return "right" === n ? e.padStart(t) : "center" === n ? " ".repeat(Math.floor(o / 2)) + e + " ".repeat(Math.ceil(o / 2)) : e.padEnd(t);
1076
1074
  };
1077
- function Ze(e, t, n) {
1078
- const o = k(t.length, n?.maxRegions ?? 200), r = t.length > o ? t.slice(0, o) : t, s = r.length < t.length;
1075
+ function et(e, t, n) {
1076
+ const o = j(t.length, n?.maxRegions ?? 200), r = t.length > o ? t.slice(0, o) : t, s = r.length < t.length;
1079
1077
  if (0 === r.length) return void e.text("None");
1080
- const a = r.map((e) => e.toString()), l = Math.max(...a.map((e) => e.length)), i = r.map((e) => `${e.getRowCount()}×${e.getColumnCount()}`), c = Math.max(...i.map((e) => e.length)), u = n?.profile ? n?.maxProfiled ?? 12 : 0;
1078
+ const l = r.map((e) => e.toString()), a = Math.max(...l.map((e) => e.length)), i = r.map((e) => `${e.getRowCount()}×${e.getColumnCount()}`), c = Math.max(...i.map((e) => e.length)), u = n?.profile ? n?.maxProfiled ?? 12 : 0;
1081
1079
  for (let t = 0; t < r.length; t++) {
1082
- const o = r[t], s = n?.payload?.(o), g = o.isClipped() ? " ✂ clipped at the query edge — the block continues" : "", d = ` ${a[t].padEnd(l)} ${i[t].padEnd(c)}`;
1080
+ const o = r[t], s = n?.payload?.(o), g = o.isClipped() ? " ✂ clipped at the query edge — the block continues" : "", d = ` ${l[t].padEnd(a)} ${i[t].padEnd(c)}`;
1083
1081
  if (t < u) {
1084
- const t = B(o, n);
1082
+ const t = U(o, n);
1085
1083
  if (e.text(`${d} ${t.summary}${g}`), !1 === n?.series) continue;
1086
1084
  for (const n of t.series) e.text(` ${n}`);
1087
1085
  continue;
@@ -1093,21 +1091,21 @@ function Ze(e, t, n) {
1093
1091
  e.text(` …truncated at ${o} of ${t.length} regions · ${r}`);
1094
1092
  }
1095
1093
  }
1096
- function Ke(e, t) {
1097
- const n = [...e], o = e.getFeatures(), s = o.join(", "), a = 1 === o.length && o[0] === r.Feature.Contentful, l = e.getRange().getSheet().getWorkbook()?.getStyles().getNormal() ?? null, i = new Je();
1098
- return i.h1(`Regions — ${s} (${n.length})`), Ze(i, n, {
1094
+ function tt(e, t) {
1095
+ const n = [...e], o = e.getFeatures(), s = o.join(", "), l = 1 === o.length && o[0] === r.Feature.Contentful, a = e.getRange().getSheet().getWorkbook()?.getStyles().getNormal() ?? null, i = new Ke();
1096
+ return i.h1(`Regions — ${s} (${n.length})`), et(i, n, {
1099
1097
  ...t,
1100
- profile: a,
1101
- payload: a ? void 0 : qe(o, l)
1098
+ profile: l,
1099
+ payload: l ? void 0 : Ze(o, a)
1102
1100
  }), i.toLines().join("\n").trimEnd();
1103
1101
  }
1104
- function Qe(e, t = []) {
1102
+ function nt(e, t = []) {
1105
1103
  const n = [...t], o = e.getDescription();
1106
1104
  o && n.push(["description", o]), n.push(["columns", e.getColumns().map((e) => e.getName()).join(", ")]), n.push(["headers", e.isShowHeaders() ? "shown" : "hidden"]), n.push(["totals", e.isShowTotals() ? "shown" : "hidden"]);
1107
1105
  const r = Math.max(10, ...n.map(([e]) => e.length + 2));
1108
1106
  return n.map(([e, t]) => `${e.padEnd(r)}${t}`);
1109
1107
  }
1110
- function Ye(e, t, n) {
1108
+ function ot(e, t, n) {
1111
1109
  if (0 === t.length) return;
1112
1110
  const o = t.map((e) => {
1113
1111
  const t = e.getRange();
@@ -1120,44 +1118,44 @@ function Ye(e, t, n) {
1120
1118
  e.h2(`Tables (${n} cell${1 !== n ? "s" : ""} · ${t.length} table${1 !== t.length ? "s" : ""})`);
1121
1119
  for (const t of o) {
1122
1120
  e.text(` ${t.address.padEnd(r)} ${t.size.padEnd(s)} ${t.table.getName()}`);
1123
- for (const n of Qe(t.table)) e.text(` ${n}`);
1121
+ for (const n of nt(t.table)) e.text(` ${n}`);
1124
1122
  }
1125
1123
  e.blank();
1126
1124
  }
1127
- function et(e) {
1128
- const t = new Je();
1129
- return t.h1(`Table — ${e.getName()}`), t.fact(Qe(e, [["range", gt(e.getRange())]])), t.toLines().join("\n").trimEnd();
1130
- }
1131
- var tt = r.Feature, nt = [
1132
- tt.Error,
1133
- tt.CalcError,
1134
- tt.Contentful,
1135
- tt.Formula,
1136
- tt.Spills,
1137
- tt.Merge,
1138
- tt.AutoTable,
1139
- tt.Hyperlink,
1140
- tt.Comments,
1141
- tt.NumberFormat,
1142
- tt.Font,
1143
- tt.Fill,
1144
- tt.Borders,
1145
- tt.Alignment,
1146
- tt.Conditionals,
1147
- tt.DataValidations
1148
- ], ot = new Map(Object.entries(tt).map(([e, t]) => [t, e])), rt = (e) => ot.get(e) ?? e;
1149
- function st(e) {
1150
- const t = new Map(Object.values(tt).map((e) => [e.toLowerCase(), e])), n = [];
1125
+ function rt(e) {
1126
+ const t = new Ke();
1127
+ return t.h1(`Table — ${e.getName()}`), t.fact(nt(e, [["range", ft(e.getRange())]])), t.toLines().join("\n").trimEnd();
1128
+ }
1129
+ var st = r.Feature, lt = [
1130
+ st.Error,
1131
+ st.CalcError,
1132
+ st.Contentful,
1133
+ st.Formula,
1134
+ st.Spills,
1135
+ st.Merge,
1136
+ st.AutoTable,
1137
+ st.Hyperlink,
1138
+ st.Comments,
1139
+ st.NumberFormat,
1140
+ st.Font,
1141
+ st.Fill,
1142
+ st.Borders,
1143
+ st.Alignment,
1144
+ st.Conditionals,
1145
+ st.DataValidations
1146
+ ], at = new Map(Object.entries(st).map(([e, t]) => [t, e])), it = (e) => at.get(e) ?? e;
1147
+ function ct(e) {
1148
+ const t = new Map(Object.values(st).map((e) => [e.toLowerCase(), e])), n = [];
1151
1149
  for (const o of e.split(",")) {
1152
1150
  const e = o.trim();
1153
1151
  if (!e) continue;
1154
1152
  const r = t.get(e.toLowerCase());
1155
- if (!r) throw new Error(`Unknown feature '${e}'. Features: ${Object.values(tt).join(", ")}.`);
1153
+ if (!r) throw new Error(`Unknown feature '${e}'. Features: ${Object.values(st).join(", ")}.`);
1156
1154
  n.push(r);
1157
1155
  }
1158
1156
  return n;
1159
1157
  }
1160
- var at = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, lt = (t) => e.sheetNameToString(t) ?? "Untitled", it = (e) => `wb.getSheet(${JSON.stringify(e.getSheet().getName())})`, ct = (e) => ((e) => {
1158
+ var ut = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, gt = (t) => e.sheetNameToString(t) ?? "Untitled", dt = (e) => `wb.getSheet(${JSON.stringify(e.getSheet().getName())})`, ht = (e) => ((e) => {
1161
1159
  if (!e.includes("$")) return e;
1162
1160
  let t = "", n = !1;
1163
1161
  for (const o of e) {
@@ -1166,74 +1164,74 @@ var at = (e) => `${e.toString()}, ${e.getRowCount()}×${e.getColumnCount()}`, lt
1166
1164
  t += o;
1167
1165
  }
1168
1166
  return t;
1169
- })(e.getAddress()), ut = (e) => {
1170
- const t = ct(e);
1171
- return t.includes("!") ? t : `${lt(e.getSheet().getName())}!${t}`;
1172
- }, gt = (e) => {
1167
+ })(e.getAddress()), mt = (e) => {
1168
+ const t = ht(e);
1169
+ return t.includes("!") ? t : `${gt(e.getSheet().getName())}!${t}`;
1170
+ }, ft = (e) => {
1173
1171
  const t = e.toString();
1174
- return `${t.includes("!") ? t : `${lt(e.getSheet().getName())}!${t}`}, ${e.getRowCount()}×${e.getColumnCount()}`;
1172
+ return `${t.includes("!") ? t : `${gt(e.getSheet().getName())}!${t}`}, ${e.getRowCount()}×${e.getColumnCount()}`;
1175
1173
  };
1176
- function dt(e, t) {
1177
- const n = ve(t, [...t.getRegions(tt.Formula)]), o = t.getStats({ onError: "ignore" }).getCount();
1174
+ function pt(e, t) {
1175
+ const n = Ie(t, [...t.getRegions(st.Formula)]), o = t.getStats({ onError: "ignore" }).getCount();
1178
1176
  e.h2(`Kind (${o} cell${1 !== o ? "s" : ""} · ${n.length} kind${1 !== n.length ? "s" : ""})`);
1179
1177
  for (const [t, o] of n) e.text(` ${t.padEnd(10)}${o}`);
1180
1178
  0 === n.length && e.fact("None"), e.blank();
1181
1179
  }
1182
- function ht(e, t, n) {
1183
- const o = t.getSheet().getWorkbook()?.getStyles().getNormal() ?? null, r = void 0 === n?.features ? null : new Set("string" == typeof n.features ? [n.features] : n.features), s = nt.filter((e) => !r || r.has(e));
1180
+ function $t(e, t, n) {
1181
+ const o = t.getSheet().getWorkbook()?.getStyles().getNormal() ?? null, r = void 0 === n?.features ? null : new Set("string" == typeof n.features ? [n.features] : n.features), s = lt.filter((e) => !r || r.has(e));
1184
1182
  if (0 === s.length) return;
1185
- const a = t.getCounts(s);
1186
- let l;
1187
- const i = () => l ??= [...t.getSheet().getEntireRange().getRegions(tt.Contentful)].map((e) => e.getCoords());
1183
+ const l = t.getCounts(s);
1184
+ let a;
1185
+ const i = () => a ??= [...t.getSheet().getEntireRange().getRegions(st.Contentful)].map((e) => e.getCoords());
1188
1186
  for (const r of s) {
1189
- const s = r === tt.Contentful ? mt(t) : [...t.getRegions(r)];
1187
+ const s = r === st.Contentful ? wt(t) : [...t.getRegions(r)];
1190
1188
  if (0 === s.length) {
1191
- const t = o && r !== tt.Font ? Re(r, o) : null;
1192
- t && (e.h2(`${rt(r)} (${ft(0, 0)})`), e.text(` ${"normal".padEnd(10)}${t}`), e.blank());
1189
+ const t = o && r !== st.Font ? Fe(r, o) : null;
1190
+ t && (e.h2(`${it(r)} (${yt(0, 0)})`), e.text(` ${"normal".padEnd(10)}${t}`), e.blank());
1193
1191
  continue;
1194
1192
  }
1195
- const l = !!n?.profile && r === tt.Contentful, c = `${it(t)}.getRegions(${JSON.stringify(r)})`, u = `${c} lists all ${s.length}`, g = Ce(r) ? Ee(t.getSheet(), r, o, {
1193
+ const a = !!n?.profile && r === st.Contentful, c = `${dt(t)}.getRegions(${JSON.stringify(r)})`, u = `${c} lists all ${s.length}`, g = Re(r) ? Ne(t.getSheet(), r, o, {
1196
1194
  recovery: u,
1197
1195
  content: i()
1198
- }) : null, d = r === tt.Formula ? ke(s, { recovery: u }) : null, h = g ? `${ft(s.length, g.cells)} · ${g.distinct} distinct` : d ? `${ft(s.length, a[r])} · ${d.distinct} distinct` : ft(s.length, a[r]);
1199
- if (e.h2(`${rt(r)} (${h})`), g) {
1196
+ }) : null, d = r === st.Formula ? je(s, { recovery: u }) : null, h = g ? `${yt(s.length, g.cells)} · ${g.distinct} distinct` : d ? `${yt(s.length, l[r])} · ${d.distinct} distinct` : yt(s.length, l[r]);
1197
+ if (e.h2(`${it(r)} (${h})`), g) {
1200
1198
  g.normal && e.text(` ${"normal".padEnd(10)}${g.normal}`);
1201
1199
  for (const t of g.tiers) e.text(` ${t}`);
1202
1200
  for (const t of g.attributes) e.text(` ${t}`);
1203
1201
  e.text(` ${"regions".padEnd(10)}${c}`), e.blank();
1204
1202
  } else {
1205
1203
  if (d) for (const t of d.lines) e.text(` ${t}`);
1206
- r === tt.Contentful && s.sort((e, t) => t.getRowCount() * t.getColumnCount() - e.getRowCount() * e.getColumnCount()), Ze(e, s, {
1204
+ r === st.Contentful && s.sort((e, t) => t.getRowCount() * t.getColumnCount() - e.getRowCount() * e.getColumnCount()), et(e, s, {
1207
1205
  maxRegions: n?.maxRegions,
1208
1206
  maxProfiled: n?.maxProfiled,
1209
- profile: l,
1207
+ profile: a,
1210
1208
  series: !1,
1211
- payload: l ? void 0 : We(r, o),
1209
+ payload: a ? void 0 : Xe(r, o),
1212
1210
  recovery: u
1213
1211
  }), e.blank();
1214
1212
  }
1215
1213
  }
1216
1214
  }
1217
- var mt = (e) => [...e.getRegions([tt.Contentful, tt.Table])].filter((e) => e.getCell().isContentful()), ft = (e, t) => `${t} cell${1 !== t ? "s" : ""} · ${e} region${1 !== e ? "s" : ""}`, pt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, $t = (e) => e.isIFormula ? e : null, wt = (e) => {
1215
+ var wt = (e) => [...e.getRegions([st.Contentful, st.Table])].filter((e) => e.getCell().isContentful()), yt = (e, t) => `${t} cell${1 !== t ? "s" : ""} · ${e} region${1 !== e ? "s" : ""}`, St = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, bt = (e) => e.isIFormula ? e : null, xt = (e) => {
1218
1216
  const t = e.getScope();
1219
- return t ? `${lt(t)}!${e.getName()}` : e.getName();
1220
- }, St = (e) => {
1217
+ return t ? `${gt(t)}!${e.getName()}` : e.getName();
1218
+ }, Ct = (e) => {
1221
1219
  const t = e.getAddress();
1222
- return t.includes("!") ? t : `${lt(e.getSheet().getName())}!${t}`;
1220
+ return t.includes("!") ? t : `${gt(e.getSheet().getName())}!${t}`;
1223
1221
  };
1224
- async function yt(e) {
1225
- const t = $t(e);
1222
+ async function kt(e) {
1223
+ const t = bt(e);
1226
1224
  let n;
1227
1225
  return n = t ? "=" + t.getExpression() : e.getRanges?.()?.getAddress() ?? "", t && await t.isVolatile() && (n += " (volatile)"), n.trim();
1228
1226
  }
1229
- var bt = /* @__PURE__ */ new Set([t.Code.Ref, t.Code.Name]), xt = (e) => {
1227
+ var Et = /* @__PURE__ */ new Set([t.Code.Ref, t.Code.Name]), vt = (e) => {
1230
1228
  const n = e.value, o = "string" == typeof n ? n : n?.error, r = "string" == typeof o ? t.getBuiltInByLabel(o) : void 0;
1231
- return r && bt.has(r.getCode()) ? r.getCode() === t.Code.Name ? "#NAME?" : "#REF!" : null;
1232
- }, Ct = /* @__PURE__ */ new Set(), Et = (e) => {
1229
+ return r && Et.has(r.getCode()) ? r.getCode() === t.Code.Name ? "#NAME?" : "#REF!" : null;
1230
+ }, Rt = /* @__PURE__ */ new Set(), Nt = (e) => {
1233
1231
  const t = e.value;
1234
1232
  return "object" == typeof t && t?.name ? t.name : e.text ?? "";
1235
1233
  };
1236
- function kt(e) {
1234
+ function jt(e) {
1237
1235
  let t = null;
1238
1236
  for (let n = 0; n < e.length; n++) {
1239
1237
  const o = e[n];
@@ -1243,31 +1241,31 @@ function kt(e) {
1243
1241
  let s = n + 1;
1244
1242
  for (; s < e.length && "whitespace" === e[s].type;) s++;
1245
1243
  if ("separator" !== e[s]?.type) continue;
1246
- const a = Et(o).toLowerCase();
1247
- a && (t ??= /* @__PURE__ */ new Set()).add(a);
1244
+ const l = Nt(o).toLowerCase();
1245
+ l && (t ??= /* @__PURE__ */ new Set()).add(l);
1248
1246
  }
1249
- return t ?? Ct;
1247
+ return t ?? Rt;
1250
1248
  }
1251
- async function vt(e, t, n) {
1249
+ async function It(e, t, n) {
1252
1250
  if (0 === t.length) return;
1253
1251
  const o = /* @__PURE__ */ new Set();
1254
1252
  for (const e of n?.symbols ?? t) o.add(e.getName().toLowerCase());
1255
1253
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
1256
1254
  for (const e of t) r.set(e.getId(), e), e.getScope() && s.add(e.getName().toLowerCase());
1257
- const a = await Promise.all(t.map(async (e) => {
1255
+ const l = await Promise.all(t.map(async (e) => {
1258
1256
  const t = function(e, t) {
1259
- const n = $t(e), o = [];
1257
+ const n = bt(e), o = [];
1260
1258
  if (n) {
1261
1259
  const e = n.getTokens();
1262
1260
  let r = null, s = null;
1263
1261
  for (const n of e) {
1264
1262
  if ("error" === n.type) {
1265
- s ??= xt(n);
1263
+ s ??= vt(n);
1266
1264
  continue;
1267
1265
  }
1268
1266
  if ("named" !== n.type) continue;
1269
- const a = Et(n);
1270
- a && !t.has(a.toLowerCase()) && (r ??= kt(e), r.has(a.toLowerCase()) || o.includes(a) || o.push(a));
1267
+ const l = Nt(n);
1268
+ l && !t.has(l.toLowerCase()) && (r ??= jt(e), r.has(l.toLowerCase()) || o.includes(l) || o.push(l));
1271
1269
  }
1272
1270
  if (s || o.length > 0) return {
1273
1271
  broken: !0,
@@ -1296,117 +1294,129 @@ async function vt(e, t, n) {
1296
1294
  missing: o,
1297
1295
  error: s ? "#REF!" : ""
1298
1296
  };
1299
- }(e, o), n = $t(e);
1300
- let a = n ? await async function(e, t) {
1297
+ }(e, o), n = bt(e);
1298
+ let l = n ? await async function(e, t) {
1301
1299
  const n = await e.getDirectDependents();
1302
1300
  let o = 0;
1303
- const r = [], s = /* @__PURE__ */ new Set(), a = [];
1301
+ const r = [], s = /* @__PURE__ */ new Set(), l = [];
1304
1302
  if (n) {
1305
- const e = n.getCoords(), l = n.getCount();
1306
- for (let i = 0; i < l; i++) {
1307
- const l = n.at(i);
1308
- if (l.isINamedRange) {
1309
- const e = l;
1303
+ const e = n.getCoords(), a = n.getCount();
1304
+ for (let i = 0; i < a; i++) {
1305
+ const a = n.at(i);
1306
+ if (a.isINamedRange) {
1307
+ const e = a;
1310
1308
  if (s.has(e.getId())) continue;
1311
1309
  s.add(e.getId());
1312
1310
  const n = t.get(e.getId());
1313
- r.push(n ? wt(n) : e.getName());
1311
+ r.push(n ? xt(n) : e.getName());
1314
1312
  } else {
1315
1313
  const t = e[i];
1316
- o += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), a.push(St(l));
1314
+ o += (t.rowEnd - t.rowStart + 1) * (t.colEnd - t.colStart + 1), l.push(Ct(a));
1317
1315
  }
1318
1316
  }
1319
1317
  }
1320
- const l = o + r.length;
1321
- if (0 === l) return {
1318
+ const a = o + r.length;
1319
+ if (0 === a) return {
1322
1320
  text: "unused",
1323
- weight: l
1321
+ weight: a
1324
1322
  };
1325
- const i = [...r, ...a], c = [];
1323
+ const i = [...r, ...l], c = [];
1326
1324
  let u = 0;
1327
1325
  for (let e = 0; e < i.length; e++) {
1328
1326
  const t = (c.length > 0 ? 2 : 0) + i[e].length;
1329
1327
  if (c.length > 0 && u + t > 60) break;
1330
- c.push(0 === c.length ? pt(i[e], 60) : i[e]), u += t;
1328
+ c.push(0 === c.length ? St(i[e], 60) : i[e]), u += t;
1331
1329
  }
1332
1330
  const g = i.length - c.length, d = g > 0 ? `, +${g} more` : "";
1333
1331
  return {
1334
- text: `${l} · ${c.join(", ")}${d}`,
1335
- weight: l
1332
+ text: `${a} · ${c.join(", ")}${d}`,
1333
+ weight: a
1336
1334
  };
1337
1335
  }(n, r) : null;
1338
- 0 === a?.weight && !e.getScope() && s.has(e.getName().toLowerCase()) && (a = {
1339
- ...a,
1336
+ 0 === l?.weight && !e.getScope() && s.has(e.getName().toLowerCase()) && (l = {
1337
+ ...l,
1340
1338
  text: "unused · shadowed"
1341
1339
  });
1342
- const l = e.getComment() ?? "", i = wt(e);
1340
+ const a = e.getComment() ?? "", i = xt(e);
1343
1341
  return {
1344
1342
  name: i,
1345
- refersTo: await yt(e),
1346
- dependents: a,
1343
+ refersTo: await kt(e),
1344
+ dependents: l,
1347
1345
  hidden: e.isHidden(),
1348
- comment: pt(l, 60),
1346
+ comment: St(a, 60),
1349
1347
  broken: t.broken,
1350
1348
  error: t.error,
1351
1349
  sortKey: i.toLowerCase().replace(/'/g, "")
1352
1350
  };
1353
- })), l = (e, t) => {
1351
+ })), a = (e, t) => {
1354
1352
  const n = (t.dependents?.weight ?? 0) - (e.dependents?.weight ?? 0);
1355
1353
  return 0 !== n ? n : e.sortKey.localeCompare(t.sortKey);
1356
- }, i = [...a.filter((e) => e.broken).sort(l), ...a.filter((e) => !e.broken).sort(l)], c = k(i.length, n?.maxNames ?? 200), u = i.length > c ? i.slice(0, c) : i, g = u.filter((e) => e.broken), d = u.filter((e) => !e.broken);
1357
- e.h2(`${n?.heading ?? "Names"} (${a.length})`);
1354
+ }, i = [...l.filter((e) => e.broken).sort(a), ...l.filter((e) => !e.broken).sort(a)], c = j(i.length, n?.maxNames ?? 200), u = i.length > c ? i.slice(0, c) : i, g = u.filter((e) => e.broken), d = u.filter((e) => !e.broken);
1355
+ e.h2(`${n?.heading ?? "Names"} (${l.length})`);
1358
1356
  const h = (t, n) => {
1359
- const o = t.some((e) => e.hidden), r = t.some((e) => e.comment.length > 0), s = t.some((e) => null !== e.dependents), a = ["Name", "Refers To"];
1360
- n && a.push("Error"), s && a.push("Dependents"), o && a.push("Hidden"), r && a.push("Comment");
1361
- const l = e.beginFrame(a);
1357
+ const o = t.some((e) => e.hidden), r = t.some((e) => e.comment.length > 0), s = t.some((e) => null !== e.dependents), l = ["Name", "Refers To"];
1358
+ n && l.push("Error"), s && l.push("Dependents"), o && l.push("Hidden"), r && l.push("Comment");
1359
+ const a = e.beginFrame(l);
1362
1360
  for (const e of t) {
1363
1361
  const t = [{ text: e.name }, { text: e.refersTo }];
1364
- n && t.push({ text: e.error }), s && t.push({ text: e.dependents?.text ?? "" }), o && t.push({ text: e.hidden ? "hidden" : "" }), r && t.push({ text: e.comment }), l.addRow(t);
1362
+ n && t.push({ text: e.error }), s && t.push({ text: e.dependents?.text ?? "" }), o && t.push({ text: e.hidden ? "hidden" : "" }), r && t.push({ text: e.comment }), a.addRow(t);
1365
1363
  }
1366
- l.endFrame();
1364
+ a.endFrame();
1367
1365
  };
1368
1366
  if (g.length > 0) {
1369
1367
  const t = i.reduce((e, t) => e + (t.broken ? 1 : 0), 0);
1370
1368
  e.text(`${t} ${1 === t ? "does" : "do"} not resolve:`), h(g, !0), e.blank();
1371
1369
  }
1372
- if (d.length > 0 && h(d, !1), u.length < a.length) {
1370
+ if (d.length > 0 && h(d, !1), u.length < l.length) {
1373
1371
  const t = n?.recovery ?? "getByName('Name') renders one in full";
1374
- e.text(` …and ${a.length - u.length} more · ${t}`);
1372
+ e.text(` …and ${l.length - u.length} more · ${t}`);
1375
1373
  }
1376
1374
  e.blank();
1377
1375
  }
1378
- function Rt(e, t, n) {
1376
+ function Ft(e, t, n) {
1379
1377
  const o = n.getCoords().min, r = [];
1380
- let s = 0, a = 0;
1378
+ let s = 0, l = 0;
1381
1379
  if (n.forEachSpan((e, t) => {
1382
- const l = t.getCoords();
1383
- if (a++, s += l.max - l.min + 1, r.length >= 100) return;
1384
- const i = n.at(l.min - o).getText(), c = n.at(l.max - o).getText();
1380
+ const a = t.getCoords();
1381
+ if (l++, s += a.max - a.min + 1, r.length >= 100) return;
1382
+ const i = n.at(a.min - o).getText(), c = n.at(a.max - o).getText();
1385
1383
  r.push({
1386
1384
  address: `${i}:${c}`,
1387
- count: l.max - l.min + 1
1385
+ count: a.max - a.min + 1
1388
1386
  });
1389
1387
  }, {
1390
1388
  visibility: "hidden",
1391
1389
  includeEmpty: !0
1392
1390
  }), 0 === s) return;
1393
1391
  e.h2(`${t} (${s})`);
1394
- const l = Math.max(...r.map((e) => e.address.length));
1395
- for (const t of r) e.text(` ${t.address.padEnd(l)} ${t.count}`);
1396
- a > r.length && e.text(` …and ${a - r.length} more`), e.blank();
1392
+ const a = Math.max(...r.map((e) => e.address.length));
1393
+ for (const t of r) e.text(` ${t.address.padEnd(a)} ${t.count}`);
1394
+ l > r.length && e.text(` …and ${l - r.length} more`), e.blank();
1395
+ }
1396
+ function Mt(e) {
1397
+ const t = e.getOutline(), n = [];
1398
+ for (const [e, o] of [[u.Axis.Row, "rows"], [u.Axis.Column, "columns"]]) {
1399
+ const r = t.getLevelCount(e);
1400
+ if (0 === r) continue;
1401
+ const s = t.getGroups(e);
1402
+ let l = 0;
1403
+ for (const e of s) e.collapsed && l++;
1404
+ n.push(`${o} ${r} ${1 === r ? "level" : "levels"}, ${s.length} ${1 === s.length ? "group" : "groups"}` + (l > 0 ? ` (${l} collapsed)` : ""));
1405
+ }
1406
+ return n.length > 0 ? n.join(" · ") : null;
1397
1407
  }
1398
- function Nt(e, t, n, o) {
1408
+ function Tt(e, t, n, o) {
1399
1409
  if (0 === n.length) return;
1400
1410
  const r = n.length > 50 ? n.slice(0, 50) : n, s = r.map((e) => ({
1401
- address: pt(ct(e.getRanges()), 40),
1411
+ address: St(ht(e.getRanges()), 40),
1402
1412
  rule: o(e)
1403
1413
  }));
1404
1414
  e.h2(`${t} (${n.length})`);
1405
- const a = Math.max(...s.map((e) => e.address.length));
1406
- for (const t of s) e.text(` ${t.address.padEnd(a)} ${t.rule}`.trimEnd());
1415
+ const l = Math.max(...s.map((e) => e.address.length));
1416
+ for (const t of s) e.text(` ${t.address.padEnd(l)} ${t.rule}`.trimEnd());
1407
1417
  r.length < n.length && e.text(` …and ${n.length - r.length} more`), e.blank();
1408
1418
  }
1409
- function It(e, t = !1) {
1419
+ function At(e, t = !1) {
1410
1420
  const n = e.getSheet(), o = e.getCoords(), r = n.getName(), s = [];
1411
1421
  for (const e of n.getNames().getItems({
1412
1422
  type: "formula",
@@ -1423,29 +1433,29 @@ function It(e, t = !1) {
1423
1433
  }
1424
1434
  return s;
1425
1435
  }
1426
- async function jt(e, t) {
1436
+ async function Lt(e, t) {
1427
1437
  const n = t.getSheet();
1428
- await vt(e, It(t, !0), { symbols: n.getWorkbook()?.getNames().getItems({ includeHidden: !0 }) ?? n.getNames().getItems({ includeHidden: !0 }) ?? [] });
1438
+ await It(e, At(t, !0), { symbols: n.getWorkbook()?.getNames().getItems({ includeHidden: !0 }) ?? n.getNames().getItems({ includeHidden: !0 }) ?? [] });
1429
1439
  const o = t.getColumnHeaders(), r = t.getRowHeaders();
1430
- Rt(e, "Hidden Columns", o), Rt(e, "Hidden Rows", r);
1440
+ Ft(e, "Hidden Columns", o), Ft(e, "Hidden Rows", r);
1431
1441
  const s = t.getTables();
1432
- s.length > 0 && Ye(e, s, t.getCounts([tt.Table])[tt.Table] ?? 0);
1442
+ s.length > 0 && ot(e, s, t.getCounts([st.Table])[st.Table] ?? 0);
1433
1443
  }
1434
- var Ft = "#REF!", Mt = (e) => {
1444
+ var Ot = "#REF!", Pt = (e) => {
1435
1445
  const t = e.getContent();
1436
1446
  return "chart" === t.getType() && "function" == typeof t.getSeries ? t : null;
1437
- }, Tt = (t, n) => `${lt(t.getName())}!${e.rangeToString(n) ?? ""}`, At = (e, t) => e ? Tt(e.getSheet(), e.getCoords()) : t, Lt = (e) => e.replace(/\s*[\r\n]+\s*/g, " ⏎ ").trim(), Ot = (e, t) => ({
1447
+ }, Dt = (t, n) => `${gt(t.getName())}!${e.rangeToString(n) ?? ""}`, Vt = (e, t) => e ? Dt(e.getSheet(), e.getCoords()) : t, Bt = (e) => e.replace(/\s*[\r\n]+\s*/g, " ⏎ ").trim(), Ht = (e, t) => ({
1438
1448
  colStart: Math.min(e.colStart, t.colStart),
1439
1449
  rowStart: Math.min(e.rowStart, t.rowStart),
1440
1450
  colEnd: Math.max(e.colEnd, t.colEnd),
1441
1451
  rowEnd: Math.max(e.rowEnd, t.rowEnd)
1442
- }), Pt = (e) => {
1452
+ }), _t = (e) => {
1443
1453
  if (0 === e.length) return null;
1444
1454
  const t = e[0], n = t.getValuesRange();
1445
1455
  if (!n) return null;
1446
- const o = n.getSheet(), r = n.getCoords(), s = 1 === e.length, a = r.colStart === r.colEnd, l = r.rowStart === r.rowEnd;
1447
- if (!s && !a && !l) return null;
1448
- let i = a && l ? null : a ? "column" : l ? "row" : null;
1456
+ const o = n.getSheet(), r = n.getCoords(), s = 1 === e.length, l = r.colStart === r.colEnd, a = r.rowStart === r.rowEnd;
1457
+ if (!s && !l && !a) return null;
1458
+ let i = l && a ? null : l ? "column" : a ? "row" : null;
1449
1459
  const c = t.getCategoriesFormula(), u = t.getNameRange(), g = null !== t.getNameFormula();
1450
1460
  if (g && !u?.isSingleCell()) return null;
1451
1461
  let d = r, h = u?.getCoords() ?? null;
@@ -1456,7 +1466,7 @@ var Ft = "#REF!", Mt = (e) => {
1456
1466
  const m = s.getValuesRange();
1457
1467
  if (!m || m.getSheet() !== o) return null;
1458
1468
  const f = m.getCoords(), p = f.colStart === d.colStart + 1 && f.colEnd === d.colEnd + 1 && f.rowStart === r.rowStart && f.rowEnd === r.rowEnd, $ = f.rowStart === d.rowStart + 1 && f.rowEnd === d.rowEnd + 1 && f.colStart === r.colStart && f.colEnd === r.colEnd;
1459
- if (null === i && (i = p && a ? "column" : $ && l ? "row" : null), null === i || ("column" === i ? !p : !$)) return null;
1469
+ if (null === i && (i = p && l ? "column" : $ && a ? "row" : null), null === i || ("column" === i ? !p : !$)) return null;
1460
1470
  if (d = f, null !== s.getNameFormula() !== g) return null;
1461
1471
  if (g) {
1462
1472
  const e = s.getNameRange();
@@ -1467,78 +1477,78 @@ var Ft = "#REF!", Mt = (e) => {
1467
1477
  }
1468
1478
  }
1469
1479
  return {
1470
- values: Tt(o, Ot(r, d)),
1480
+ values: Dt(o, Ht(r, d)),
1471
1481
  by: s ? null : i,
1472
- names: u && h ? Tt(u.getSheet(), Ot(u.getCoords(), h)) : null,
1473
- categories: At(t.getCategoriesRange(), c)
1482
+ names: u && h ? Dt(u.getSheet(), Ht(u.getCoords(), h)) : null,
1483
+ categories: Vt(t.getCategoriesRange(), c)
1474
1484
  };
1475
- }, Dt = (e) => {
1485
+ }, zt = (e) => {
1476
1486
  const t = [], n = [
1477
1487
  ["name", e.getNameFormula()],
1478
1488
  ["values", e.getValuesFormula()],
1479
1489
  ["categories", e.getCategoriesFormula()]
1480
1490
  ];
1481
- for (const [e, o] of n) o?.includes(Ft) && t.push(`${e} ${o}`);
1491
+ for (const [e, o] of n) o?.includes(Ot) && t.push(`${e} ${o}`);
1482
1492
  return t;
1483
- }, Vt = (e) => {
1493
+ }, Ut = (e) => {
1484
1494
  let t = 0;
1485
- for (const n of e) Dt(n).length > 0 && t++;
1495
+ for (const n of e) zt(n).length > 0 && t++;
1486
1496
  return t;
1487
- }, Bt = (e) => {
1497
+ }, Wt = (e) => {
1488
1498
  const t = e.getChartType();
1489
1499
  return t && "unknown" !== t ? t : null;
1490
1500
  };
1491
- function Ht(e) {
1492
- const t = [], n = Bt(e);
1501
+ function Jt(e) {
1502
+ const t = [], n = Wt(e);
1493
1503
  n && t.push(n);
1494
1504
  const o = e.getChartTitle();
1495
1505
  var r, s;
1496
- o && t.push(`"${r = Lt(o), s = 40, r.length > s ? `${r.slice(0, s - 1)}…` : r}"`);
1497
- const a = e.getSeries();
1498
- if (a.length > 0) {
1499
- t.push(`${a.length} series`);
1500
- const n = e.getPivotSource(), o = n ? null : Pt(a);
1506
+ o && t.push(`"${r = Bt(o), s = 40, r.length > s ? `${r.slice(0, s - 1)}…` : r}"`);
1507
+ const l = e.getSeries();
1508
+ if (l.length > 0) {
1509
+ t.push(`${l.length} series`);
1510
+ const n = e.getPivotSource(), o = n ? null : _t(l);
1501
1511
  n ? t.push(`pivot table ${n}`) : o && (t.push(`values ${o.values}`), o.categories && t.push(`categories ${o.categories}`));
1502
- const r = Vt(a);
1503
- r > 0 && t.push(`${Ft} in ${r} series`);
1512
+ const r = Ut(l);
1513
+ r > 0 && t.push(`${Ot} in ${r} series`);
1504
1514
  }
1505
1515
  return t.length > 0 ? t.join(" · ") : null;
1506
1516
  }
1507
- function _t(e) {
1517
+ function qt(e) {
1508
1518
  const t = [], n = e.getChartTitle();
1509
- n && t.push(["title", `"${Lt(n)}"`]);
1519
+ n && t.push(["title", `"${Bt(n)}"`]);
1510
1520
  const o = e.getSeries();
1511
1521
  if (0 === o.length) return t;
1512
- const r = e.getPivotSource(), s = r ? null : Pt(o);
1522
+ const r = e.getPivotSource(), s = r ? null : _t(o);
1513
1523
  r ? t.push(["series", `${o.length} · from pivot table ${r}`]) : s ? (t.push(["series", `${o.length} · ${s.values}${s.by ? ` by ${s.by}` : ""}`]), s.names && t.push([1 === o.length ? "name" : "names", s.names]), s.categories && t.push(["categories", s.categories])) : t.push(["series", String(o.length)]);
1514
- const a = Vt(o);
1515
- return a > 0 && t.push(["broken", `${Ft} in ${a} series`]), t;
1524
+ const l = Ut(o);
1525
+ return l > 0 && t.push(["broken", `${Ot} in ${l} series`]), t;
1516
1526
  }
1517
- var Ut = (e) => Bt(e) ?? "", zt = (e) => {
1518
- const t = e.getTitle(), n = [t ? `"${Lt(t)}"` : "no title"], o = e.getNumberFormat();
1527
+ var Gt = (e) => Wt(e) ?? "", Xt = (e) => {
1528
+ const t = e.getTitle(), n = [t ? `"${Bt(t)}"` : "no title"], o = e.getNumberFormat();
1519
1529
  return o && "General" !== o && n.push(`format ${o}`), `${e.getKind()} (${n.join(", ")})`;
1520
1530
  };
1521
- function Wt(e, t) {
1522
- const n = Bt(t);
1531
+ function Zt(e, t) {
1532
+ const n = Wt(t);
1523
1533
  e.fact("Type: chart" + (n ? ` — ${n}` : ""));
1524
1534
  const o = t.getChartTitle();
1525
- e.fact("Title: " + (o ? `"${Lt(o)}"` : "(none)"));
1535
+ e.fact("Title: " + (o ? `"${Bt(o)}"` : "(none)"));
1526
1536
  const r = t.getSeries(), s = t.getPivotSource();
1527
1537
  if (s) e.fact(`Series (${r.length}): from pivot table ${s}`);
1528
1538
  else if (r.length > 0) {
1529
- const t = Pt(r);
1539
+ const t = _t(r);
1530
1540
  if (t) {
1531
1541
  const n = [`values ${t.values}${t.by ? ` by ${t.by}` : ""}`];
1532
1542
  t.names && n.push(`${1 === r.length ? "name" : "names"} ${t.names}`), t.categories && n.push(`categories ${t.categories}`), e.fact(`Series (${r.length}): ${n.join(" · ")}`);
1533
1543
  } else (function(e, t) {
1534
- const n = t.slice(0, k(t.length, 12)), o = n.map((e) => {
1535
- const t = At(e.getValuesRange(), e.getValuesFormula()) ?? "(no values)", n = At(e.getCategoriesRange(), e.getCategoriesFormula()), o = [`values ${t}`];
1544
+ const n = t.slice(0, j(t.length, 12)), o = n.map((e) => {
1545
+ const t = Vt(e.getValuesRange(), e.getValuesFormula()) ?? "(no values)", n = Vt(e.getCategoriesRange(), e.getCategoriesFormula()), o = [`values ${t}`];
1536
1546
  n && o.push(`categories ${n}`);
1537
- const r = At(e.getNameRange(), e.getNameFormula());
1547
+ const r = Vt(e.getNameRange(), e.getNameFormula());
1538
1548
  r && o.push(`name ${r}`);
1539
1549
  const s = e.getName();
1540
1550
  return {
1541
- name: s ? Lt(s) : "(unnamed)",
1551
+ name: s ? Bt(s) : "(unnamed)",
1542
1552
  type: e.isSecondaryAxis() ? `${e.getChartType()} · secondary axis` : e.getChartType(),
1543
1553
  source: o.join(" · ")
1544
1554
  };
@@ -1549,29 +1559,147 @@ function Wt(e, t) {
1549
1559
  n.length < t.length && e.text(` …and ${t.length - n.length} more · getContent().getSeries() on this movable lists every one`);
1550
1560
  })(e, r);
1551
1561
  }
1552
- const a = t.getAxes();
1553
- a.length > 0 && e.fact(`Axes: ${a.map(zt).join(" · ")}`);
1562
+ const l = t.getAxes();
1563
+ l.length > 0 && e.fact(`Axes: ${l.map(Xt).join(" · ")}`);
1554
1564
  }
1555
- var qt = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd;
1556
- var Jt = (e) => {
1565
+ var Kt = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd;
1566
+ var Qt = (e) => {
1557
1567
  const t = e.movable.getRange();
1558
- return `${Tt(t.getSheet(), t.getCoords())} "${e.movable.getContent().getName?.() || "(unnamed)"}"${e.direct ? "" : " (through its dependents)"}`;
1559
- }, Gt = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Xt = (e) => e.replace(/[\r\n]+/g, " ").trim(), Zt = (e) => e.getShapeType?.() ?? "", Kt = (t) => {
1560
- const n = t.getRange();
1561
- return e.rangeToString(n.getCoords()) ?? n.toString();
1562
- }, Qt = (e, t, n) => {
1568
+ return `${Dt(t.getSheet(), t.getCoords())} "${e.movable.getContent().getName?.() || "(unnamed)"}"${e.direct ? "" : " (through its dependents)"}`;
1569
+ }, Yt = (e, t, n) => {
1563
1570
  const o = e.replace(/\r\n?|\n/g, " ⏎ ");
1564
1571
  if (null === t || o.length <= t) return `"${o}"`;
1565
- const r = o.charCodeAt(t - 1), s = r >= 55296 && r <= 56319 ? t - 1 : t;
1566
- return `"${o.slice(0, s)}…" (+${o.length - s} chars) · full: ${n}`;
1567
- }, Yt = ({ movable: e, text: t }) => Qt(t, 300, ((e) => `${it(e.getRange())}.getRange(${JSON.stringify(Kt(e))}).getMovables()`)(e)), en = (e) => {
1572
+ const r = o.charCodeAt(t - 1), s = r >= 55296 && r <= 56319 ? t - 1 : t, l = `(+${o.length - s} chars)`;
1573
+ return `"${o.slice(0, s)}…" ${n ? `${l} · full: ${n}` : l}`;
1574
+ }, en = (e) => e.paragraphs.map((e) => e.runs.map((e) => e.text ?? "").join("")).join("\n").trim(), tn = (e) => {
1575
+ if (e.type === g.Type.Group) return "group";
1576
+ if (e.type === g.Type.Picture) return "picture";
1577
+ const t = e.geometry;
1578
+ return "string" == typeof t ? t : t ? "custom" : "rect";
1579
+ }, nn = (e, t) => `${e} ${t}${1 === e ? "" : "s"}`, on = (e, t) => {
1580
+ switch (e.type) {
1581
+ case i.Type.None: return "none";
1582
+ case i.Type.Solid: return String(e.color ?? "solid");
1583
+ case i.Type.Gradient: {
1584
+ const t = e, n = (t.stops ?? []).map((e) => String("object" == typeof e && null !== e && "color" in e ? e.color : e)), o = void 0 !== t.angle ? ` at ${t.angle}°` : "";
1585
+ return `${t.gradientType ?? "linear"} gradient${n.length ? ` ${n.join(" → ")}` : ""}${o}`;
1586
+ }
1587
+ case i.Type.Pattern: {
1588
+ const t = e, n = [t.foreground, t.background].filter((e) => void 0 !== e).join(" on ");
1589
+ return `pattern ${t.patternType ?? ""}${n ? ` ${n}` : ""}`.replace(/ +/g, " ").trim();
1590
+ }
1591
+ case i.Type.Image: {
1592
+ const n = e, o = void 0 === n.resId ? null : t.getResource(n.resId), r = [n.tile ? "tiled" : null, n.sourceRect ? "cropped" : null].filter(Boolean);
1593
+ return `image ${o?.getName() || "(no image)"}${r.length ? `, ${r.join(", ")}` : ""}`;
1594
+ }
1595
+ default: return String(e.type);
1596
+ }
1597
+ }, rn = (e, t) => {
1598
+ if (null === e.style) return "none";
1599
+ const n = e.style?.[t] ?? w.defaultStyleRefs(e)[t];
1600
+ return !n || n.index <= 0 ? "none" : `theme style ${n.index}${n.color ? `, ${n.color}` : ""}`;
1601
+ }, sn = (e, t, n) => {
1602
+ if (!e || e === h.LineEndType.None) return null;
1603
+ const o = [t && t !== h.LineEndSize.Medium ? `wide ${t}` : null, n && n !== h.LineEndSize.Medium ? `long ${n}` : null].filter(Boolean);
1604
+ return o.length ? `${e} (${o.join(", ")})` : e;
1605
+ }, ln = {
1606
+ top: "top",
1607
+ center: "middle",
1608
+ bottom: "bottom",
1609
+ justify: "justified",
1610
+ distributed: "distributed"
1611
+ }, an = (e) => {
1612
+ if ("string" == typeof e) return e;
1613
+ const t = e.address ?? e.action ?? "(no address)";
1614
+ return e.screenTip ? `${t} — "${e.screenTip}"` : t;
1615
+ }, cn = (e, t) => {
1616
+ if (!e || !e.start && !e.end) return null;
1617
+ const n = (e, n) => {
1618
+ if (!n) return null;
1619
+ const o = t().get(n.id);
1620
+ return `${e} → ${o ? `"${o}"` : `shape id ${n.id} (not on this sheet)`} (site ${n.index})`;
1621
+ };
1622
+ return [n("start", e.start), n("end", e.end)].filter(Boolean).join(" · ");
1623
+ }, un = (e, t, n, o, r) => {
1624
+ for (const s of t) {
1625
+ const t = [tn(s), s.name || "(unnamed)"];
1626
+ if (s.type === g.Type.Picture) {
1627
+ const e = s.fill?.resId;
1628
+ t.push(void 0 === e ? "(no image)" : n.getResource(e)?.getName() || "(no image)");
1629
+ }
1630
+ if (s.text) {
1631
+ const e = en(s.text);
1632
+ e && t.push(Yt(e, 120, ""));
1633
+ }
1634
+ const l = cn(s.connectorEnds, o);
1635
+ l && t.push(l), e.text(`${" ".repeat(r + 2)}${t.join(" · ")}`), s.children?.length && un(e, s.children, n, o, r + 1);
1636
+ }
1637
+ };
1638
+ function gn(e, t) {
1639
+ const n = t.toJSON() ?? {}, o = n.type === g.Type.Group;
1640
+ let r = null;
1641
+ const s = () => r ??= ((e) => {
1642
+ const t = /* @__PURE__ */ new Map();
1643
+ if (!e) return t;
1644
+ const n = (e, o) => {
1645
+ void 0 !== e.sourceId && t.set(e.sourceId, o || `(unnamed ${tn(e)})`);
1646
+ for (const t of e.children ?? []) n(t, t.name);
1647
+ };
1648
+ for (const t of e.getRange().getSheet().getMovables().getItems({ type: "shape" })) {
1649
+ const e = t.getContent(), o = e.toJSON?.();
1650
+ o && n(o, e.getName());
1651
+ }
1652
+ return t;
1653
+ })(t.getMovable());
1654
+ e.fact(`Shape: ${((e) => {
1655
+ const t = tn(e), n = [];
1656
+ e.type === g.Type.Group && n.push(nn(e.children?.length ?? 0, "member"));
1657
+ const o = e.geometry;
1658
+ return o && "object" == typeof o && (n.push(nn(o.paths.length, "path")), o.ah?.length && n.push(nn(o.ah.length, "handle"))), e.type === g.Type.Connector && n.push("connector"), e.textBox && n.push("text box"), n.length > 0 ? `${t} — ${n.join(", ")}` : t;
1659
+ })(n)}`);
1660
+ const l = ((e) => {
1661
+ const t = Object.entries(e);
1662
+ return 0 === t.length ? null : t.map(([e, t]) => `${e} ${t}`).join(" · ");
1663
+ })(t.getAdjustments());
1664
+ if (l && e.fact(`Adjustments: ${l} — the rest at the preset's defaults`), !o) {
1665
+ const o = t.getTextFrame();
1666
+ o && e.fact(`Text: ${Yt(o.getText(), null, "")}`);
1667
+ const r = ((e) => {
1668
+ if (!e) return null;
1669
+ const t = [];
1670
+ return e.anchor && t.push(ln[e.anchor] ?? e.anchor), e.anchorCenter && t.push("centered"), "none" === e.wrap && t.push("no wrap"), e.verticalOverflow !== m.Overflow.Visible && e.horizontalOverflow !== m.Overflow.Visible || t.push("text may overflow the shape"), "shape" === e.autoFit && t.push("shape grows to fit text"), "normal" === e.autoFit && t.push("text shrinks to fit" + (void 0 !== e.fontScale ? ` (${e.fontScale}%)` : "")), e.vertical && e.vertical !== 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;
1671
+ })(n.text?.body);
1672
+ r && e.fact(`Text Layout: ${r}`);
1673
+ }
1674
+ n.textLink && e.fact(`Text Link: ${n.textLink} — the text shows this cell's value`), o && !n.fill || e.fact(`Fill: ${n.fill ? on(n.fill, t) : rn(n, "fill")}`), o && !n.stroke || e.fact(`Line: ${((e, t) => {
1675
+ const n = e.stroke, o = rn(e, "stroke");
1676
+ if (!n) return o;
1677
+ if (n.fill?.type === i.Type.None) return "none";
1678
+ const r = [];
1679
+ "number" == typeof n.width && r.push(`${n.width} pt`), r.push(n.fill ? on(n.fill, t) : `color from ${o}`), void 0 !== n.dash && n.dash !== h.StrokeStyle.Solid && r.push(`dash ${Array.isArray(n.dash) ? n.dash.join(" ") : n.dash}`), n.compound && n.compound !== h.Compound.Single && r.push(`compound ${n.compound}`);
1680
+ const s = sn(n.headType, n.headWidth, n.headLength);
1681
+ s && r.push(`head ${s}`);
1682
+ const l = sn(n.tailType, n.tailWidth, n.tailLength);
1683
+ return l && r.push(`tail ${l}`), r.join(" · ");
1684
+ })(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");
1685
+ const a = [n.flipH ? "horizontal" : null, n.flipV ? "vertical" : null].filter(Boolean);
1686
+ a.length && e.fact(`Flip: ${a.join(", ")}`);
1687
+ const c = cn(n.connectorEnds, s);
1688
+ c && e.fact(`Connected: ${c}`), n.title && e.fact(`Title: ${n.title}`), n.hyperlink && e.fact(`Hyperlink: ${an(n.hyperlink)}`), n.hoverHyperlink && e.fact(`Hover Hyperlink: ${an(n.hoverHyperlink)}`), n.macro && e.fact(`Macro: ${n.macro}`);
1689
+ const u = Object.entries(n.locks ?? {}).filter(([, e]) => e).map(([e]) => e);
1690
+ u.length && e.fact(`Locks: ${u.join(", ")}`), o && n.children?.length && (e.fact(`Members: ${n.children.length}, in z-order`), un(e, n.children, t, s, 0));
1691
+ }
1692
+ var dn = (e) => e.toJSON()?.rotation ?? 0, hn = (e, t) => e.length > t ? `${e.slice(0, t - 1)}…` : e, mn = (e) => e.replace(/[\r\n]+/g, " ").trim(), fn = (t) => {
1693
+ const n = t.getRange();
1694
+ return e.rangeToString(n.getCoords()) ?? n.toString();
1695
+ }, pn = ({ movable: e, text: t }) => Yt(t, 300, ((e) => `${dt(e.getRange())}.getRange(${JSON.stringify(fn(e))}).getMovables()`)(e)), $n = (e) => {
1568
1696
  const t = e.getContent();
1569
1697
  return "function" == typeof t.getTextFrame ? t.getTextFrame()?.getText() ?? "" : null;
1570
1698
  };
1571
- function tn(e) {
1699
+ function wn(e) {
1572
1700
  const t = [];
1573
1701
  for (const n of e) {
1574
- const e = en(n) ?? "";
1702
+ const e = $n(n) ?? "";
1575
1703
  "" !== e.trim() && t.push({
1576
1704
  movable: n,
1577
1705
  text: e
@@ -1582,26 +1710,26 @@ function tn(e) {
1582
1710
  return n.rowStart - o.rowStart || n.colStart - o.colStart;
1583
1711
  });
1584
1712
  }
1585
- var nn = (e) => "picture" === e.getType() && e.getResource?.()?.getName() || null, on = (e) => {
1586
- const t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), o = Mt(e);
1587
- if (o) return Gt([
1588
- Ht(o),
1589
- n ? Xt(n) : null,
1713
+ var yn = (e) => "picture" === e.getType() && e.getResource?.()?.getName() || null, Sn = (e) => {
1714
+ const t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription(), o = Pt(e);
1715
+ if (o) return hn([
1716
+ Jt(o),
1717
+ n ? mn(n) : null,
1590
1718
  t
1591
1719
  ].filter(Boolean).join(" · "), 140);
1592
- const r = e.getContent(), s = [], a = nn(r);
1593
- a && s.push(a), n && s.push(Xt(n));
1594
- return Gt(s.length > 0 ? `${t} — ${s.join(" · ")}` : t, 90);
1595
- }, rn = (e) => {
1720
+ const r = e.getContent(), s = [], l = yn(r);
1721
+ l && s.push(l), n && s.push(mn(n));
1722
+ return hn(s.length > 0 ? `${t} — ${s.join(" · ")}` : t, 90);
1723
+ }, bn = (e) => {
1596
1724
  const t = e.getContent().getName?.() || "(unnamed)", n = e.getContent().getDescription();
1597
- return Gt(n ? `${t} — ${Xt(n)}` : t, 90);
1598
- }, sn = /* @__PURE__ */ new Map([
1725
+ return hn(n ? `${t} — ${mn(n)}` : t, 90);
1726
+ }, xn = /* @__PURE__ */ new Map([
1599
1727
  ["chart", "Charts"],
1600
1728
  ["shape", "Shapes"],
1601
1729
  ["picture", "Pictures"],
1602
1730
  ["slicer", "Slicers"]
1603
- ]), an = (e) => sn.get(e) ?? `${e.charAt(0).toUpperCase()}${e.slice(1)}s`;
1604
- function ln(e) {
1731
+ ]), Cn = (e) => xn.get(e) ?? `${e.charAt(0).toUpperCase()}${e.slice(1)}s`;
1732
+ function kn(e) {
1605
1733
  const t = /* @__PURE__ */ new Map();
1606
1734
  for (const n of e) {
1607
1735
  const e = n.getContent().getType();
@@ -1610,72 +1738,82 @@ function ln(e) {
1610
1738
  o ? o.push(n) : t.set(e, [n]);
1611
1739
  }
1612
1740
  const n = /* @__PURE__ */ new Map();
1613
- for (const e of sn.keys()) {
1741
+ for (const e of xn.keys()) {
1614
1742
  const o = t.get(e);
1615
1743
  o && n.set(e, o);
1616
1744
  }
1617
1745
  for (const [e, o] of t) n.set(e, o);
1618
1746
  return n;
1619
1747
  }
1620
- function cn(e, t) {
1621
- for (const [n, o] of ln(t)) un(e, n, o);
1748
+ function En(e, t) {
1749
+ for (const [n, o] of kn(t)) vn(e, n, o);
1622
1750
  }
1623
- function un(e, t, n) {
1624
- const o = tn(n), r = new Map(o.map((e) => [e.movable, e])), s = [...o.map((e) => e.movable), ...n.filter((e) => !r.has(e))], a = s.slice(0, k(s.length, 50)), l = a.map((e) => {
1625
- const t = r.get(e), n = Mt(e);
1751
+ function vn(e, t, n) {
1752
+ const o = wn(n), r = new Map(o.map((e) => [e.movable, e])), s = [...o.map((e) => e.movable), ...n.filter((e) => !r.has(e))], l = s.slice(0, j(s.length, 50)), a = l.map((e) => {
1753
+ const t = r.get(e), n = Pt(e);
1626
1754
  return {
1627
- address: Kt(e),
1628
- preset: n ? Ut(n) : Zt(e.getContent()),
1629
- summary: n ? rn(e) : on(e),
1630
- details: n ? _t(n) : [],
1631
- text: t ? Yt(t) : "",
1755
+ address: fn(e),
1756
+ preset: n ? Gt(n) : (o = e.getContent(), o.getShapeType?.() ?? ""),
1757
+ summary: n ? bn(e) : Sn(e),
1758
+ details: n ? qt(n) : [],
1759
+ text: t ? pn(t) : "",
1632
1760
  hidden: e.isHidden() ? " (hidden)" : ""
1633
1761
  };
1762
+ var o;
1634
1763
  });
1635
- e.h2(`${an(t)} (${n.length}${o.length > 0 ? ` · ${o.length} with text` : ""})`);
1636
- const i = Math.max(...l.map((e) => e.address.length)), c = Math.max(...l.map((e) => e.preset.length)), u = Math.min(40, Math.max(0, ...l.filter((e) => e.text).map((e) => e.summary.length)));
1637
- for (const t of l) {
1764
+ e.h2(`${Cn(t)} (${n.length}${o.length > 0 ? ` · ${o.length} with text` : ""})`);
1765
+ const i = Math.max(...a.map((e) => e.address.length)), c = Math.max(...a.map((e) => e.preset.length)), u = Math.min(40, Math.max(0, ...a.filter((e) => e.text).map((e) => e.summary.length)));
1766
+ for (const t of a) {
1638
1767
  const n = c > 0 ? `${t.preset.padEnd(c)} ` : "", o = t.text ? `${t.summary.padEnd(u)} ${t.text}` : t.summary;
1639
1768
  e.text(` ${t.address.padEnd(i)} ${n}${o}${t.hidden}`.trimEnd());
1640
1769
  const r = Math.max(10, ...t.details.map(([e]) => e.length + 2));
1641
1770
  for (const [n, o] of t.details) e.text(` ${n.padEnd(r)}${o}`);
1642
1771
  }
1643
- if (a.length < s.length) {
1644
- const o = `${it(n[0].getRange())}.getMovables().getItems({ type: ${JSON.stringify(t)} })`;
1645
- e.text(` …and ${s.length - a.length} more · ${o} reports every one in full`);
1772
+ if (l.length < s.length) {
1773
+ const o = `${dt(n[0].getRange())}.getMovables().getItems({ type: ${JSON.stringify(t)} })`;
1774
+ e.text(` …and ${s.length - l.length} more · ${o} reports every one in full`);
1646
1775
  }
1647
1776
  e.blank();
1648
1777
  }
1649
- function gn(e) {
1650
- const t = new Je(), o = e.getRange(), r = e.getContent(), s = r.getType();
1651
- t.h1(`Movable — ${gt(o)}`), t.blank(), t.fact(`Name: ${e.getContent().getName?.() || "(unnamed)"}`);
1652
- const a = Mt(e);
1653
- a ? Wt(t, a) : t.fact(`Type: ${s}`);
1654
- const l = nn(r);
1655
- l && t.fact(`Content: ${l}`);
1656
- const i = Zt(r);
1657
- i && t.fact(`Shape: ${i}`);
1658
- const c = r.getTextFrame?.();
1659
- c && t.fact(`Text: ${Qt(c.getText(), null, "")}`);
1778
+ function Rn(e) {
1779
+ return In(e, "Movable");
1780
+ }
1781
+ function Nn(e) {
1782
+ const t = e.getMovable();
1783
+ if (t) return In(t, "Shape");
1784
+ const n = new Ke();
1785
+ return n.h1(`Shape — ${e.getName() || "(unnamed)"}`), n.blank(), gn(n, e), n.toLines().join("\n").trimEnd();
1786
+ }
1787
+ var jn = (e) => {
1788
+ const t = e.getContent();
1789
+ return !0 === t?.isIShape ? t : null;
1790
+ };
1791
+ function In(e, t) {
1792
+ const o = new Ke(), r = e.getRange(), s = e.getContent(), l = s.getType(), a = jn(e);
1793
+ o.h1(`${t} — ${ft(r)}`), o.blank(), o.fact(`Name: ${e.getContent().getName?.() || "(unnamed)"}`);
1794
+ const i = Pt(e);
1795
+ i ? Zt(o, i) : o.fact(`Type: ${l}`);
1796
+ const c = yn(s);
1797
+ c && o.fact(`Content: ${c}`), a && gn(o, a);
1660
1798
  const u = e.getContent().getDescription();
1661
- u && t.fact(`Alt Text: ${Xt(u)}`), t.fact(`Anchor: ${at(o)}, ${((e) => {
1799
+ u && o.fact(`Alt Text: ${mn(u)}`), o.fact(`Anchor: ${ut(r)}, ${((e) => {
1662
1800
  switch (e) {
1663
1801
  case n.Type.Absolute: return "absolute — stays put when rows or columns move";
1664
1802
  case n.Type.OneCell: return "oneCell — moves with the cells, keeps its size";
1665
1803
  default: return "twoCell — moves and resizes with the cells";
1666
1804
  }
1667
- })(e.getAnchorType?.())}`), t.fact(`Bounds: ${((e) => {
1805
+ })(e.getAnchorType?.())}`), o.fact(`Bounds: ${((e) => {
1668
1806
  const t = e.getBounds();
1669
1807
  if (!t) return "not laid out";
1670
1808
  const n = (e) => Math.round(e);
1671
1809
  return `${n(t.width)}×${n(t.height)} px at (${n(t.x)}, ${n(t.y)})`;
1672
- })(e)}`), e.isHidden() && t.fact("Hidden: true — this object is not visible in the UI");
1673
- const g = e.getRotation();
1674
- return 0 !== g && t.fact(`Rotation: ${g}°`), t.fact(`Z-Order: ${e.getZIndex()}`), t.blank(), t.text(`Sheet: ${lt(o.getSheet().getName())}`), t.toLines().join("\n").trimEnd();
1810
+ })(e)}`), e.isHidden() && o.fact("Hidden: true — this object is not visible in the UI");
1811
+ const g = e.getRotation() || (a ? dn(a) : 0);
1812
+ return 0 !== g && o.fact(`Rotation: ${g}°`), o.fact(`Z-Order: ${e.getZIndex()}`), o.blank(), o.text(`Sheet: ${gt(r.getSheet().getName())}`), o.toLines().join("\n").trimEnd();
1675
1813
  }
1676
- var dn = (e) => "visible" === e.getVisibility(), hn = (e, t, n) => {
1814
+ var Fn = (e) => "visible" === e.getVisibility(), Mn = (e, t, n) => {
1677
1815
  const o = e.getSheets().getItems({ visibility: "veryHidden" }), r = t?.trim();
1678
- if (!r) return o.filter((e) => n || dn(e)).map((e) => ({
1816
+ if (!r) return o.filter((e) => n || Fn(e)).map((e) => ({
1679
1817
  sheet: e,
1680
1818
  address: null
1681
1819
  }));
@@ -1688,37 +1826,36 @@ var dn = (e) => "visible" === e.getVisibility(), hn = (e, t, n) => {
1688
1826
  address: t
1689
1827
  }];
1690
1828
  }
1691
- const a = o.find((e) => e.getName() === r);
1692
- if (a) return [{
1693
- sheet: a,
1829
+ const l = o.find((e) => e.getName() === r);
1830
+ if (l) return [{
1831
+ sheet: l,
1694
1832
  address: null
1695
1833
  }];
1696
1834
  if (/[*?]/.test(r)) {
1697
1835
  const e = ((e) => {
1698
1836
  const t = e.replace(/[.*+?^${}()|[\]\\]/g, (e) => "*" === e ? ".*" : "?" === e ? "." : `\\${e}`);
1699
1837
  return new RegExp(`^${t}$`);
1700
- })(r), t = o.filter((t) => e.test(t.getName()) && (n || dn(t)));
1838
+ })(r), t = o.filter((t) => e.test(t.getName()) && (n || Fn(t)));
1701
1839
  if (0 === t.length) throw new Error(`No sheets match ${JSON.stringify(r)}. Sheets: ${o.map((e) => e.getName()).join(", ")}`);
1702
1840
  return t.map((e) => ({
1703
1841
  sheet: e,
1704
1842
  address: null
1705
1843
  }));
1706
1844
  }
1707
- const l = o.filter((e) => n || dn(e));
1845
+ const a = o.filter((e) => n || Fn(e));
1708
1846
  try {
1709
- l[0]?.getRange(r);
1847
+ a[0]?.getRange(r);
1710
1848
  } catch {
1711
1849
  throw new Error(`Unknown scope ${JSON.stringify(r)}: not a sheet name or a range. Sheets: ${o.map((e) => e.getName()).join(", ")}`);
1712
1850
  }
1713
- return l.map((e) => ({
1851
+ return a.map((e) => ({
1714
1852
  sheet: e,
1715
1853
  address: r
1716
1854
  }));
1717
- }, mn = (e, t) => {
1855
+ }, Tn = (e, t) => {
1718
1856
  switch (t) {
1719
- case "display": return y(e, $.Mode.Display);
1720
- case "value": return y(e, $.Mode.Value);
1721
- case "raw": return b(e.getValue());
1857
+ case "display": return k(e, b.Mode.Display);
1858
+ case "value": return k(e, b.Mode.Value);
1722
1859
  case "formula": {
1723
1860
  const t = e.getFormulaText();
1724
1861
  return t ? {
@@ -1742,23 +1879,23 @@ var dn = (e) => "visible" === e.getVisibility(), hn = (e, t, n) => {
1742
1879
  }
1743
1880
  default: return null;
1744
1881
  }
1745
- }, fn = ["hyperlink", "numberFormat"], pn = (e, t) => t && "" !== t.trim() ? [{
1882
+ }, An = ["hyperlink", "numberFormat"], Ln = (e, t) => t && "" !== t.trim() ? [{
1746
1883
  field: e,
1747
1884
  text: {
1748
1885
  match: t,
1749
1886
  display: t
1750
1887
  }
1751
- }] : [], $n = (e) => [...pn("comment", e.getContent()), ...e.getReplies().flatMap((e) => pn("comment", e.getContent()))], wn = (e, t) => {
1752
- const n = Mt(e);
1888
+ }] : [], On = (e) => [...Ln("comment", e.getContent()), ...e.getReplies().flatMap((e) => Ln("comment", e.getContent()))], Pn = (e, t) => {
1889
+ const n = Pt(e);
1753
1890
  if (n) return t.includes("chart") ? [
1754
- ...pn("chart", n.getChartTitle()),
1755
- ...n.getAxes().flatMap((e) => pn("chart", e.getTitle())),
1756
- ...n.getSeries().flatMap((e) => null === e.getNameFormula() ? pn("chart", e.getName()) : []),
1757
- ...pn("chart", e.getContent().getDescription())
1891
+ ...Ln("chart", n.getChartTitle()),
1892
+ ...n.getAxes().flatMap((e) => Ln("chart", e.getTitle())),
1893
+ ...n.getSeries().flatMap((e) => null === e.getNameFormula() ? Ln("chart", e.getName()) : []),
1894
+ ...Ln("chart", e.getContent().getDescription())
1758
1895
  ] : [];
1759
- const o = en(e);
1760
- return null !== o && t.includes("shape") ? [...pn("shape", o), ...pn("shape", e.getContent().getDescription())] : [];
1761
- }, Sn = (e) => {
1896
+ const o = $n(e);
1897
+ return null !== o && t.includes("shape") ? [...Ln("shape", o), ...Ln("shape", e.getContent().getDescription())] : [];
1898
+ }, Dn = (e) => {
1762
1899
  const t = e.isIFormula ? `=${e.getExpression()}` : null, n = t ?? e.getRanges?.()?.getAddress() ?? e.getName();
1763
1900
  return [
1764
1901
  {
@@ -1768,29 +1905,29 @@ var dn = (e) => "visible" === e.getVisibility(), hn = (e, t, n) => {
1768
1905
  display: n
1769
1906
  }
1770
1907
  },
1771
- ...t ? pn("name", t) : [],
1772
- ...pn("name", e.getComment())
1908
+ ...t ? Ln("name", t) : [],
1909
+ ...Ln("name", e.getComment())
1773
1910
  ];
1774
- }, yn = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd, bn = (e, t) => {
1911
+ }, Vn = (e, t) => e.colStart <= t.colEnd && t.colStart <= e.colEnd && e.rowStart <= t.rowEnd && t.rowStart <= e.rowEnd, Bn = (e, t) => {
1775
1912
  const n = e.getRanges?.() ?? null;
1776
1913
  return t.some(({ sheet: t, address: o }) => {
1777
1914
  if (null === o && e.getScope() === t.getName()) return !0;
1778
1915
  const r = null !== o ? t.getRange(o).getCoords() : null;
1779
1916
  for (let e = 0; e < (n?.length ?? 0); e++) {
1780
1917
  const o = n.at(e);
1781
- if (o.getSheet() === t && (!r || yn(o.getCoords(), r))) return !0;
1918
+ if (o.getSheet() === t && (!r || Vn(o.getCoords(), r))) return !0;
1782
1919
  }
1783
1920
  return !1;
1784
1921
  });
1785
- }, xn = (e, t) => e.rowStart - t.rowStart || e.colStart - t.colStart, Cn = (e, t, n) => {
1922
+ }, Hn = (e, t) => e.rowStart - t.rowStart || e.colStart - t.colStart, _n = (e, t, n) => {
1786
1923
  let o = null;
1787
1924
  const r = (e) => ({
1788
1925
  range: `${t}!${e.getRange().toString()}`,
1789
1926
  table: e.getName()
1790
1927
  });
1791
- return { resolve(s, a) {
1792
- const l = ((e) => e.getTable())(s);
1793
- if ("table" === e) return l ? r(l) : void 0;
1928
+ return { resolve(s, l) {
1929
+ const a = ((e) => e.getTable())(s);
1930
+ if ("table" === e) return a ? r(a) : void 0;
1794
1931
  if (null === o) {
1795
1932
  o = [];
1796
1933
  for (const e of n.getRegions()) {
@@ -1801,16 +1938,16 @@ var dn = (e) => "visible" === e.getVisibility(), hn = (e, t, n) => {
1801
1938
  });
1802
1939
  }
1803
1940
  }
1804
- const i = o.find(({ coords: e }) => a.rowIndex >= e.rowStart && a.rowIndex <= e.rowEnd && a.colIndex >= e.colStart && a.colIndex <= e.colEnd);
1941
+ const i = o.find(({ coords: e }) => l.rowIndex >= e.rowStart && l.rowIndex <= e.rowEnd && l.colIndex >= e.colStart && l.colIndex <= e.colEnd);
1805
1942
  return i ? {
1806
1943
  range: i.address,
1807
- ...l ? { table: l.getName() } : {}
1808
- } : l ? r(l) : void 0;
1944
+ ...a ? { table: a.getName() } : {}
1945
+ } : a ? r(a) : void 0;
1809
1946
  } };
1810
1947
  };
1811
- async function En(t, n) {
1948
+ async function zn(t, n) {
1812
1949
  if (!n.pattern) throw new Error("grep requires a pattern");
1813
- const o = n.fields?.length ? n.fields : E, r = n.output ?? "content", s = n.maxCount ?? 200, a = !0 === n.invert, l = !0 === n.hidden, i = ((e) => {
1950
+ const o = n.fields?.length ? n.fields : N, r = n.output ?? "content", s = n.maxCount ?? 200, l = !0 === n.invert, a = !0 === n.hidden, i = ((e) => {
1814
1951
  if (void 0 === e || !1 === e) return null;
1815
1952
  if (!0 === e) return "contentful";
1816
1953
  if ("contentful" === e || "table" === e) return e;
@@ -1828,13 +1965,13 @@ async function En(t, n) {
1828
1965
  throw new Error(`Invalid regex ${JSON.stringify(e.pattern)}: ${t instanceof Error ? t.message : String(t)}. Use fixedStrings (-F) to search for the literal text.`);
1829
1966
  }
1830
1967
  }
1831
- })(n), u = hn(t, n.scope, l), g = !o.some((e) => fn.includes(e)), d = o.includes("display") && o.includes("value"), h = "content" === r || "addresses" === r, m = [], f = [];
1832
- let p = 0, $ = 0, w = 0, S = !1;
1833
- const y = (e) => {
1968
+ })(n), u = Mn(t, n.scope, a), g = !o.some((e) => An.includes(e)), d = o.includes("display") && o.includes("value"), h = "content" === r || "addresses" === r, m = [], f = [];
1969
+ let p = 0, $ = 0, w = 0, y = !1;
1970
+ const S = (e) => {
1834
1971
  const t = e.filter((t, n) => c.test(t.text.match) && e.findIndex((e) => e.field === t.field && e.text.display === t.text.display && c.test(e.text.match)) === n);
1835
- return a ? 0 === t.length && e.length > 0 ? [e[0]] : null : 0 === t.length ? null : "addresses" === r ? t.slice(0, 1) : t;
1972
+ return l ? 0 === t.length && e.length > 0 ? [e[0]] : null : 0 === t.length ? null : "addresses" === r ? t.slice(0, 1) : t;
1836
1973
  }, b = (e, t, n, o, r) => {
1837
- if (s > 0 && p + $ >= s) return S = !0, !1;
1974
+ if (s > 0 && p + $ >= s) return y = !0, !1;
1838
1975
  if ("cell" === e ? p++ : $++, h) for (const e of o) m.push({
1839
1976
  sheet: t,
1840
1977
  address: n,
@@ -1845,47 +1982,47 @@ async function En(t, n) {
1845
1982
  return !0;
1846
1983
  };
1847
1984
  for (const { sheet: t, address: n } of u) {
1848
- if (S) continue;
1985
+ if (y) continue;
1849
1986
  const s = t.getName();
1850
1987
  w++, await t.getCalculation().ready();
1851
- const a = null !== n ? t.getRange(n) : t.getUsedRange(), c = a && i && "content" === r ? Cn(i, s, a) : null, u = {
1988
+ const l = null !== n ? t.getRange(n) : t.getUsedRange(), c = l && i && "content" === r ? _n(i, s, l) : null, u = {
1852
1989
  ...null !== n ? { address: n } : {},
1853
- ...l ? {} : { ignoreHidden: !0 }
1990
+ ...a ? {} : { ignoreHidden: !0 }
1854
1991
  }, h = /* @__PURE__ */ new Map();
1855
1992
  if (o.includes("comment")) for (const e of t.getComments().getItems(u)) {
1856
1993
  const t = e.getRange().getCoords();
1857
1994
  h.set(`${t.rowStart}:${t.colStart}`, e);
1858
1995
  }
1859
1996
  let m = 0;
1860
- a?.forEach((e, t) => {
1997
+ l?.forEach((e, t) => {
1861
1998
  if (g && null == e) return;
1862
- const n = t.getCell(), r = t.getCoords(), a = [];
1863
- let l;
1999
+ const n = t.getCell(), r = t.getCoords(), l = [];
2000
+ let a;
1864
2001
  for (const e of o) {
1865
2002
  if ("comment" === e) {
1866
2003
  const e = `${r.rowIndex}:${r.colIndex}`, t = h.get(e);
1867
- t && (a.push(...$n(t)), h.delete(e));
2004
+ t && (l.push(...On(t)), h.delete(e));
1868
2005
  continue;
1869
2006
  }
1870
- const t = mn(n, e);
1871
- "display" === e && (l = t?.match ?? null), null !== t && ("value" === e && d && (void 0 === l && (l = mn(n, "display")?.match ?? null), t.match === l) || a.push({
2007
+ const t = Tn(n, e);
2008
+ "display" === e && (a = t?.match ?? null), null !== t && ("value" === e && d && (void 0 === a && (a = Tn(n, "display")?.match ?? null), t.match === a) || l.push({
1872
2009
  field: e,
1873
2010
  text: t
1874
2011
  }));
1875
2012
  }
1876
- const i = y(a);
2013
+ const i = S(l);
1877
2014
  if (!i) return;
1878
2015
  const u = c?.resolve(n, r);
1879
2016
  if (!b("cell", s, t.getAddress(), i, u)) return { break: !0 };
1880
2017
  m++;
1881
- }, l ? void 0 : { ignoreHidden: !0 });
2018
+ }, a ? void 0 : { ignoreHidden: !0 });
1882
2019
  const p = [...h.values()].map((e) => ({
1883
2020
  comment: e,
1884
2021
  at: e.getRange().getCoords()
1885
- })).sort((e, t) => xn(e.at, t.at));
2022
+ })).sort((e, t) => Hn(e.at, t.at));
1886
2023
  for (const { comment: t, at: n } of p) {
1887
- if (S) break;
1888
- const o = y($n(t));
2024
+ if (y) break;
2025
+ const o = S(On(t));
1889
2026
  if (!o) continue;
1890
2027
  const r = c?.resolve(t.getRange().getCell(), {
1891
2028
  rowIndex: n.rowStart,
@@ -1894,13 +2031,13 @@ async function En(t, n) {
1894
2031
  b("cell", s, e.rangeToString(n) ?? t.getRange().toString(), o, r) && m++;
1895
2032
  }
1896
2033
  let $ = 0;
1897
- if (!S && (o.includes("shape") || o.includes("chart"))) {
1898
- const n = t.getMovables().getItems(u).filter((e) => "note" !== e.getContent().getType()).filter((e) => l || !e.isHidden()).map((e) => ({
2034
+ if (!y && (o.includes("shape") || o.includes("chart"))) {
2035
+ const n = t.getMovables().getItems(u).filter((e) => "note" !== e.getContent().getType()).filter((e) => a || !e.isHidden()).map((e) => ({
1899
2036
  movable: e,
1900
2037
  at: e.getRange().getCoords()
1901
- })).sort((e, t) => xn(e.at, t.at));
2038
+ })).sort((e, t) => Hn(e.at, t.at));
1902
2039
  for (const { movable: t, at: r } of n) {
1903
- const n = y(wn(t, o));
2040
+ const n = S(Pn(t, o));
1904
2041
  if (n) {
1905
2042
  if (!b("object", s, e.rangeToString(r) ?? t.getRange().toString(), n)) break;
1906
2043
  $++;
@@ -1913,11 +2050,11 @@ async function En(t, n) {
1913
2050
  objects: $
1914
2051
  });
1915
2052
  }
1916
- if (!S && o.includes("name")) {
1917
- const e = Boolean(n.scope?.trim()), o = t.getNames().getItems(l ? { includeHidden: !0 } : void 0) ?? [];
2053
+ if (!y && o.includes("name")) {
2054
+ const e = Boolean(n.scope?.trim()), o = t.getNames().getItems(a ? { includeHidden: !0 } : void 0) ?? [];
1918
2055
  for (const t of o) {
1919
- if (e && !bn(t, u)) continue;
1920
- const n = y(Sn(t));
2056
+ if (e && !Bn(t, u)) continue;
2057
+ const n = S(Dn(t));
1921
2058
  if (n && !b("object", t.getScope() ?? "", t.getName(), n)) break;
1922
2059
  }
1923
2060
  }
@@ -1931,31 +2068,31 @@ async function En(t, n) {
1931
2068
  sheets: f,
1932
2069
  sheetsSearched: w,
1933
2070
  sheetsMatched: f.length,
1934
- truncated: S,
2071
+ truncated: y,
1935
2072
  output: r
1936
2073
  };
1937
2074
  }
1938
- var kn = (e) => {
2075
+ var Un = (e) => {
1939
2076
  const t = e.replace(/\s+/g, " ").trim();
1940
2077
  return t.length > 120 ? `${t.slice(0, 119)}…` : t;
1941
- }, vn = (e) => e.sheet ? `${e.sheet}!${e.address}` : e.address, Rn = (e, t) => `${e} ${t}${1 === e ? "" : "s"}`, Nn = (e, t) => t > 0 ? `${Rn(e, "cell")} · ${Rn(t, "object")}` : Rn(e, "cell"), In = (e, t, n, o) => {
1942
- const r = t.map((e) => o ? vn(e) : e.address), s = Math.max(...r.map((e) => e.length)), a = Math.max(...t.map((e) => e.field.length));
2078
+ }, Wn = (e) => e.sheet ? `${e.sheet}!${e.address}` : e.address, Jn = (e, t) => `${e} ${t}${1 === e ? "" : "s"}`, qn = (e, t) => t > 0 ? `${Jn(e, "cell")} · ${Jn(t, "object")}` : Jn(e, "cell"), Gn = (e, t, n, o) => {
2079
+ const r = t.map((e) => o ? Wn(e) : e.address), s = Math.max(...r.map((e) => e.length)), l = Math.max(...t.map((e) => e.field.length));
1943
2080
  for (let o = 0; o < t.length; o++) {
1944
- const l = t[o];
1945
- e.push(`${n}${r[o].padEnd(s)} ${l.field.padEnd(a)} ${kn(l.text)}`);
2081
+ const a = t[o];
2082
+ e.push(`${n}${r[o].padEnd(s)} ${a.field.padEnd(l)} ${Un(a.text)}`);
1946
2083
  }
1947
2084
  };
1948
- function jn(e) {
1949
- const { pattern: t, fields: n, scope: o, matches: r, cellCount: s, objectCount: a, sheetsSearched: l, sheetsMatched: i } = e, c = [`grep "${t}" · ${o} · fields ${n.join(",")} · ${Nn(s, a)} in ${i} of ${l} ${1 === l ? "sheet" : "sheets"}`];
2085
+ function Xn(e) {
2086
+ const { pattern: t, fields: n, scope: o, matches: r, cellCount: s, objectCount: l, sheetsSearched: a, sheetsMatched: i } = e, c = [`grep "${t}" · ${o} · fields ${n.join(",")} · ${qn(s, l)} in ${i} of ${a} ${1 === a ? "sheet" : "sheets"}`];
1950
2087
  if ("count" === e.output) {
1951
- for (const t of e.sheets) c.push(` ${t.sheet}: ${t.objects > 0 ? Nn(t.cells, t.objects) : t.cells}`);
1952
- const t = a - e.sheets.reduce((e, t) => e + t.objects, 0);
2088
+ for (const t of e.sheets) c.push(` ${t.sheet}: ${t.objects > 0 ? qn(t.cells, t.objects) : t.cells}`);
2089
+ const t = l - e.sheets.reduce((e, t) => e + t.objects, 0);
1953
2090
  t > 0 && c.push(` names: ${t}`);
1954
2091
  } else if ("sheets" === e.output) {
1955
2092
  for (const t of e.sheets) c.push(` ${t.sheet}`);
1956
- 0 === e.sheets.length && c.push(a > 0 ? " no sheets · names only" : " no matches");
2093
+ 0 === e.sheets.length && c.push(l > 0 ? " no sheets · names only" : " no matches");
1957
2094
  } else if (0 === r.length) c.push(" no matches");
1958
- else if ("addresses" === e.output) for (const e of r) c.push(` ${vn(e)}`);
2095
+ else if ("addresses" === e.output) for (const e of r) c.push(` ${Wn(e)}`);
1959
2096
  else {
1960
2097
  const e = [], t = /* @__PURE__ */ new Map();
1961
2098
  for (const n of r) {
@@ -1967,11 +2104,11 @@ function jn(e) {
1967
2104
  rows: []
1968
2105
  }, t.set(o, r), e.push(r)), r.rows.push(n);
1969
2106
  }
1970
- for (const t of e) t.heading ? (c.push(` ${t.heading}`), In(c, t.rows, " ", !1)) : In(c, t.rows, " ", !0);
2107
+ for (const t of e) t.heading ? (c.push(` ${t.heading}`), Gn(c, t.rows, " ", !1)) : Gn(c, t.rows, " ", !0);
1971
2108
  }
1972
- return e.truncated && c.push(` …truncated at ${Nn(s, a)} · narrow the pattern, or scope the search to one sheet or range`), c.join("\n");
2109
+ return e.truncated && c.push(` …truncated at ${qn(s, l)} · narrow the pattern, or scope the search to one sheet or range`), c.join("\n");
1973
2110
  }
1974
- var Fn = {
2111
+ var Zn = {
1975
2112
  name: "grep",
1976
2113
  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.",
1977
2114
  params: [
@@ -1985,9 +2122,9 @@ var Fn = {
1985
2122
  {
1986
2123
  name: "fields",
1987
2124
  type: "enum[]",
1988
- values: C,
1989
- defaultValue: E,
1990
- description: "Layers to search: display (number format applied), value (as the formula bar shows it; duplicate of display suppressed per cell), raw (the stored scalar — dates as serials), 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)."
2125
+ values: R,
2126
+ defaultValue: N,
2127
+ 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)."
1991
2128
  },
1992
2129
  {
1993
2130
  name: "fixedStrings",
@@ -2056,9 +2193,9 @@ var Fn = {
2056
2193
  description: "What to return: content (address, layer and text), addresses (one per matched cell), count (per sheet), or sheets (names with a match)."
2057
2194
  }
2058
2195
  ],
2059
- run: En,
2060
- render: jn
2061
- }, Mn = [
2196
+ run: zn,
2197
+ render: Xn
2198
+ }, Kn = [
2062
2199
  "IWorkbook",
2063
2200
  "ISheet",
2064
2201
  "ICellRange",
@@ -2068,16 +2205,16 @@ var Fn = {
2068
2205
  "IStyle",
2069
2206
  "IScript.ScriptContext"
2070
2207
  ];
2071
- var Tn = (e) => e.slice(e.lastIndexOf(".") + 1);
2072
- function An(e, t) {
2208
+ var Qn = (e) => e.slice(e.lastIndexOf(".") + 1);
2209
+ function Yn(e, t) {
2073
2210
  if (e.types[t]) return t;
2074
2211
  const n = Object.keys(e.types), o = t.toLowerCase(), r = n.filter((e) => e.toLowerCase() === o);
2075
2212
  if (1 === r.length) return r[0];
2076
2213
  if (t.includes(".")) return null;
2077
- const s = n.filter((e) => Tn(e).toLowerCase() === o);
2214
+ const s = n.filter((e) => Qn(e).toLowerCase() === o);
2078
2215
  return 1 === s.length ? s[0] : null;
2079
2216
  }
2080
- function Ln(e, t, n) {
2217
+ function eo(e, t, n) {
2081
2218
  const o = n.replace(/<[\s\S]*$/, "").trim(), r = t.split(".");
2082
2219
  for (let t = r.length - 1; t >= 0; t--) {
2083
2220
  const n = [...r.slice(0, t), o].join(".");
@@ -2085,7 +2222,7 @@ function Ln(e, t, n) {
2085
2222
  }
2086
2223
  return null;
2087
2224
  }
2088
- function On(e, t, n, o = /* @__PURE__ */ new Set()) {
2225
+ function to(e, t, n, o = /* @__PURE__ */ new Set()) {
2089
2226
  if (o.has(t)) return null;
2090
2227
  o.add(t);
2091
2228
  const r = e.types[t];
@@ -2096,30 +2233,30 @@ function On(e, t, n, o = /* @__PURE__ */ new Set()) {
2096
2233
  members: s
2097
2234
  };
2098
2235
  for (const s of r.extends ?? []) {
2099
- const r = Ln(e, t, s), a = r ? On(e, r, n, o) : null;
2100
- if (a) return a;
2236
+ const r = eo(e, t, s), l = r ? to(e, r, n, o) : null;
2237
+ if (l) return l;
2101
2238
  }
2102
2239
  return null;
2103
2240
  }
2104
- function Pn(e, t, n) {
2241
+ function no(e, t, n) {
2105
2242
  const o = e.types[t], r = (o.extends ?? []).map((n) => {
2106
- const o = Ln(e, t, n);
2243
+ const o = eo(e, t, n);
2107
2244
  return {
2108
2245
  text: n,
2109
2246
  key: o,
2110
2247
  memberCount: o ? e.types[o].members?.length ?? 0 : 0
2111
2248
  };
2112
- }), s = o.members ?? [], a = n?.toLowerCase();
2249
+ }), s = o.members ?? [], l = n?.toLowerCase();
2113
2250
  return {
2114
2251
  kind: "type",
2115
2252
  key: t,
2116
2253
  entry: o,
2117
2254
  bases: r,
2118
- members: a ? s.filter((e) => e.name.toLowerCase().includes(a)) : s,
2255
+ members: l ? s.filter((e) => e.name.toLowerCase().includes(l)) : s,
2119
2256
  ...n ? { filter: n } : {}
2120
2257
  };
2121
2258
  }
2122
- function Dn(e, t, n) {
2259
+ function oo(e, t, n) {
2123
2260
  const o = (e) => {
2124
2261
  const o = t(e).toLowerCase();
2125
2262
  return o === n ? 0 : o.startsWith(n) ? 1 : 2;
@@ -2130,12 +2267,12 @@ function Dn(e, t, n) {
2130
2267
  score: o(e)
2131
2268
  })).sort((e, t) => e.score - t.score || e.order - t.order).map((e) => e.item);
2132
2269
  }
2133
- function Vn(e, t) {
2270
+ function ro(e, t) {
2134
2271
  const n = function(e) {
2135
2272
  return e.trim().replace(/^SheetXL\./, "").replace(/\(\)$/, "").replace(/#/g, ".");
2136
2273
  }(t ?? "");
2137
2274
  if (!n) {
2138
- const t = Mn.filter((t) => e.types[t]).map((t) => ({
2275
+ const t = Kn.filter((t) => e.types[t]).map((t) => ({
2139
2276
  key: t,
2140
2277
  entry: e.types[t]
2141
2278
  }));
@@ -2145,43 +2282,43 @@ function Vn(e, t) {
2145
2282
  entryPoints: t
2146
2283
  };
2147
2284
  }
2148
- const o = An(e, n);
2149
- if (o) return Pn(e, o);
2285
+ const o = Yn(e, n);
2286
+ if (o) return no(e, o);
2150
2287
  const r = n.lastIndexOf(".");
2151
2288
  if (r > 0) {
2152
- const t = An(e, n.slice(0, r)), o = n.slice(r + 1);
2289
+ const t = Yn(e, n.slice(0, r)), o = n.slice(r + 1);
2153
2290
  if (t && o) {
2154
- const n = o.toLowerCase(), r = On(e, t, (e) => e.name === o) ?? On(e, t, (e) => e.name.toLowerCase() === n);
2291
+ const n = o.toLowerCase(), r = to(e, t, (e) => e.name === o) ?? to(e, t, (e) => e.name.toLowerCase() === n);
2155
2292
  if (r) return {
2156
2293
  kind: "member",
2157
2294
  key: t,
2158
2295
  declaredOn: r.key,
2159
2296
  members: r.members
2160
2297
  };
2161
- const s = Pn(e, t, o);
2298
+ const s = no(e, t, o);
2162
2299
  if (s.members.length > 0) return s;
2163
2300
  }
2164
2301
  }
2165
2302
  return function(e, t) {
2166
2303
  const n = t.toLowerCase(), o = [], r = [];
2167
2304
  for (const [t, s] of Object.entries(e.types)) {
2168
- Tn(t).toLowerCase().includes(n) && o.push(t);
2305
+ Qn(t).toLowerCase().includes(n) && o.push(t);
2169
2306
  for (const e of s.members ?? []) e.name.toLowerCase().includes(n) && r.push({
2170
2307
  key: t,
2171
2308
  member: e
2172
2309
  });
2173
2310
  }
2174
- const s = Dn(o, Tn, n), a = Dn(r, (e) => e.member.name, n);
2311
+ const s = oo(o, Qn, n), l = oo(r, (e) => e.member.name, n);
2175
2312
  return {
2176
2313
  kind: "search",
2177
2314
  query: t,
2178
2315
  types: s.slice(0, 20),
2179
- members: a.slice(0, 40),
2180
- omitted: Math.max(0, s.length - 20) + Math.max(0, a.length - 40)
2316
+ members: l.slice(0, 40),
2317
+ omitted: Math.max(0, s.length - 20) + Math.max(0, l.length - 40)
2181
2318
  };
2182
2319
  }(e, r > 0 ? n.slice(r + 1) : n);
2183
2320
  }
2184
- function Bn(e, t) {
2321
+ function so(e, t) {
2185
2322
  if (!t || "object" != typeof t && "function" != typeof t) return null;
2186
2323
  const n = [], o = /* @__PURE__ */ new Set();
2187
2324
  for (let r = t; r && r !== Object.prototype; r = Object.getPrototypeOf(r)) for (const s of Object.getOwnPropertyNames(r)) {
@@ -2191,13 +2328,13 @@ function Bn(e, t) {
2191
2328
  try {
2192
2329
  r = !0 === t[s];
2193
2330
  } catch {}
2194
- const a = r ? An(e, s.slice(2)) : null;
2195
- a && !n.includes(a) && n.push(a);
2331
+ const l = r ? Yn(e, s.slice(2)) : null;
2332
+ l && !n.includes(l) && n.push(l);
2196
2333
  }
2197
2334
  if (n.length <= 1) return n[0] ?? null;
2198
2335
  const r = (t, n = /* @__PURE__ */ new Set()) => {
2199
2336
  for (const o of e.types[t].extends ?? []) {
2200
- const s = Ln(e, t, o);
2337
+ const s = eo(e, t, o);
2201
2338
  s && !n.has(s) && (n.add(s), r(s, n));
2202
2339
  }
2203
2340
  return n;
@@ -2205,31 +2342,31 @@ function Bn(e, t) {
2205
2342
  for (const e of n) for (const t of r(e)) s.add(t);
2206
2343
  return n.filter((e) => !s.has(e)).sort((t, n) => (e.types[n].members?.length ?? 0) - (e.types[t].members?.length ?? 0))[0] ?? n[0];
2207
2344
  }
2208
- function Hn(e, t) {
2345
+ function lo(e, t) {
2209
2346
  const n = /\bon type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(e)?.[1];
2210
2347
  return n ? `\`${t} ${n}\` lists its members.` : null;
2211
2348
  }
2212
- var _n = [{
2349
+ var ao = [{
2213
2350
  match: /^(get|set)?(number)?(format|numfmt)s?$/i,
2214
2351
  relies: ["IStyle", "setNumberFormat"],
2215
2352
  hint: "Formatting lives on the style: `getStyle().setNumberFormat('0.00%')`, `getStyle().getNumberFormat()`."
2216
2353
  }];
2217
- function Un(e, t) {
2354
+ function io(e, t) {
2218
2355
  const n = [], o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = (t) => {
2219
2356
  if (r.has(t)) return;
2220
2357
  r.add(t);
2221
- const a = e.types[t];
2222
- if (a) {
2223
- for (const e of a.members ?? []) o.has(e.name) || (o.add(e.name), n.push(e));
2224
- for (const n of a.extends ?? []) {
2225
- const o = Ln(e, t, n);
2358
+ const l = e.types[t];
2359
+ if (l) {
2360
+ for (const e of l.members ?? []) o.has(e.name) || (o.add(e.name), n.push(e));
2361
+ for (const n of l.extends ?? []) {
2362
+ const o = eo(e, t, n);
2226
2363
  o && s(o);
2227
2364
  }
2228
2365
  }
2229
2366
  };
2230
2367
  return s(t), n;
2231
2368
  }
2232
- function zn(e, t) {
2369
+ function co(e, t) {
2233
2370
  const n = e.toLowerCase(), o = t.toLowerCase();
2234
2371
  if (n === o) return 0;
2235
2372
  if (n.startsWith(o) || o.startsWith(n)) return 1;
@@ -2239,87 +2376,87 @@ function zn(e, t) {
2239
2376
  let r = n[0];
2240
2377
  n[0] = o;
2241
2378
  for (let s = 1; s <= t.length; s++) {
2242
- const a = n[s];
2243
- n[s] = Math.min(n[s] + 1, n[s - 1] + 1, r + (e[o - 1] === t[s - 1] ? 0 : 1)), r = a;
2379
+ const l = n[s];
2380
+ n[s] = Math.min(n[s] + 1, n[s - 1] + 1, r + (e[o - 1] === t[s - 1] ? 0 : 1)), r = l;
2244
2381
  }
2245
2382
  }
2246
2383
  return n[t.length];
2247
2384
  }(n, o);
2248
2385
  return r <= Math.max(2, Math.floor(.3 * n.length)) ? 1 + r : null;
2249
2386
  }
2250
- var Wn = (e, t) => `${t ? `${t}.` : ""}${e.signature.replace(/;$/, "")}${e.summary ? ` — ${e.summary}` : ""}`;
2251
- function qn(e, t, n) {
2387
+ var uo = (e, t) => `${t ? `${t}.` : ""}${e.signature.replace(/;$/, "")}${e.summary ? ` — ${e.summary}` : ""}`;
2388
+ function go(e, t, n) {
2252
2389
  const o = /Property '([\w$]+)' does not exist on type '(?:SheetXL\.)?([A-Z][\w$]*(?:\.[A-Z][\w$]*)*)'/.exec(t), r = o ? null : /(?:^|[.\s])([A-Za-z_$][\w$]*) is not a function/.exec(t), s = o?.[1] ?? r?.[1];
2253
2390
  if (!s) return null;
2254
- const a = [];
2255
- for (const t of _n) {
2391
+ const l = [];
2392
+ for (const t of ao) {
2256
2393
  const [n, o] = t.relies;
2257
- t.match.test(s) && e.types[n]?.members?.some((e) => e.name === o) && a.push(t.hint);
2394
+ t.match.test(s) && e.types[n]?.members?.some((e) => e.name === o) && l.push(t.hint);
2258
2395
  }
2259
- const l = o ? An(e, o[2]) : null;
2260
- if (l) {
2261
- const o = Un(e, l), r = /Did you mean '([\w$]+)'/.exec(t)?.[1], i = o.map((e) => ({
2396
+ const a = o ? Yn(e, o[2]) : null;
2397
+ if (a) {
2398
+ const o = io(e, a), r = /Did you mean '([\w$]+)'/.exec(t)?.[1], i = o.map((e) => ({
2262
2399
  member: e,
2263
- score: e.name === r ? -1 : zn(s, e.name)
2400
+ score: e.name === r ? -1 : co(s, e.name)
2264
2401
  })).filter((e) => null !== e.score).sort((e, t) => e.score - t.score).slice(0, 3);
2265
2402
  if (i.length > 0) {
2266
- a.push(`Closest on ${l}:`);
2267
- for (const { member: e } of i) a.push(` ${Wn(e)}`);
2403
+ l.push(`Closest on ${a}:`);
2404
+ for (const { member: e } of i) l.push(` ${uo(e)}`);
2268
2405
  }
2269
- a.push(`\`${n} ${l}\` lists all ${o.length} members.`);
2406
+ l.push(`\`${n} ${a}\` lists all ${o.length} members.`);
2270
2407
  } else if (r) {
2271
2408
  const t = Object.entries(e.types).filter(([, e]) => e.members?.some((e) => e.name === s)).map(([e]) => e);
2272
2409
  if (t.length > 0) {
2273
2410
  const e = t.slice(0, 3).join(", "), n = t.length > 3 ? ` and ${t.length - 3} more` : "";
2274
- return a.push(`'${s}' is a member of ${e}${n}, not of the object it was called on.`), a.join("\n");
2411
+ return l.push(`'${s}' is a member of ${e}${n}, not of the object it was called on.`), l.join("\n");
2275
2412
  }
2276
- const n = Mn.map((t) => An(e, t)).filter((e) => null !== e).flatMap((t) => Un(e, t).map((e) => ({
2413
+ const n = Kn.map((t) => Yn(e, t)).filter((e) => null !== e).flatMap((t) => io(e, t).map((e) => ({
2277
2414
  owner: t,
2278
2415
  member: e,
2279
- score: zn(s, e.name)
2416
+ score: co(s, e.name)
2280
2417
  }))).filter((e) => null !== e.score && e.score > 0 && e.score <= 2).sort((e, t) => e.score - t.score).slice(0, 3);
2281
- if (0 === a.length && 0 === n.length) return null;
2282
- if (a.unshift(`No SheetXL member is named '${s}'.`), n.length > 0) {
2283
- a.push("Closest:");
2284
- for (const { owner: e, member: t } of n) a.push(` ${Wn(t, e)}`);
2418
+ if (0 === l.length && 0 === n.length) return null;
2419
+ if (l.unshift(`No SheetXL member is named '${s}'.`), n.length > 0) {
2420
+ l.push("Closest:");
2421
+ for (const { owner: e, member: t } of n) l.push(` ${uo(t, e)}`);
2285
2422
  }
2286
2423
  }
2287
- return a.length > 0 ? a.join("\n") : null;
2424
+ return l.length > 0 ? l.join("\n") : null;
2288
2425
  }
2289
- var Jn = (e, t, n = `${t}s`) => `${e.toLocaleString("en-US")} ${1 === e ? t : n}`;
2290
- function Gn(e, t) {
2426
+ var ho = (e, t, n = `${t}s`) => `${e.toLocaleString("en-US")} ${1 === e ? t : n}`;
2427
+ function mo(e, t) {
2291
2428
  const n = t ? `${t} · ` : "", o = e.summary ? ` — ${e.summary}` : "", r = e.deprecated ? " (deprecated)" : "";
2292
2429
  return `- ${n}\`${s = e.signature, s.replace(/;$/, "")}\`${r}${o}`;
2293
2430
  var s;
2294
2431
  }
2295
- function Xn(e, t) {
2432
+ function fo(e, t) {
2296
2433
  const n = t?.command ?? "api";
2297
2434
  switch (e.kind) {
2298
2435
  case "overview": return function(e, t) {
2299
2436
  const n = [
2300
- `# SheetXL scripting API — ${Jn(e.total, "name")}`,
2437
+ `# SheetXL scripting API — ${ho(e.total, "name")}`,
2301
2438
  "",
2302
2439
  "Where a script starts:"
2303
2440
  ];
2304
2441
  for (const { key: t, entry: o } of e.entryPoints) {
2305
- const e = o.members ? ` (${Jn(o.members.length, "member")})` : "";
2442
+ const e = o.members ? ` (${ho(o.members.length, "member")})` : "";
2306
2443
  n.push(`- \`${t}\`${e}${o.summary ? ` — ${o.summary}` : ""}`);
2307
2444
  }
2308
2445
  return n.push("", `\`${t} <Type>\` lists what you can call on a type, one line per member.`, `\`${t} <Type>.<member>\` prints that member's full documentation.`, `\`${t} <word>\` searches type and member names.`, "", "Every type answers, not only the ones above. In a script each name is written `SheetXL.<Type>`."), n.join("\n");
2309
2446
  }(e, n);
2310
2447
  case "type": return function(e, t) {
2311
- const { key: n, entry: o, members: r } = e, s = o.members?.length ?? 0, a = [o.kind + (o.typeParams ?? "")];
2312
- o.members && a.push(Jn(s, "member")), o.deprecated && a.push("deprecated");
2313
- const l = [`# ${n} — ${a.join(" · ")}`];
2314
- if (o.summary && l.push(o.summary), o.signature && l.push("", "```ts", o.signature, "```"), e.bases.length > 0) {
2315
- l.push("");
2316
- for (const n of e.bases) l.push(n.key ? `Also has everything on \`${n.text}\` (${Jn(n.memberCount, "member")}): \`${t} ${n.key}\`` : `Extends \`${n.text}\`.`);
2448
+ const { key: n, entry: o, members: r } = e, s = o.members?.length ?? 0, l = [o.kind + (o.typeParams ?? "")];
2449
+ o.members && l.push(ho(s, "member")), o.deprecated && l.push("deprecated");
2450
+ const a = [`# ${n} — ${l.join(" · ")}`];
2451
+ if (o.summary && a.push(o.summary), o.signature && a.push("", "```ts", o.signature, "```"), e.bases.length > 0) {
2452
+ a.push("");
2453
+ for (const n of e.bases) a.push(n.key ? `Also has everything on \`${n.text}\` (${ho(n.memberCount, "member")}): \`${t} ${n.key}\`` : `Extends \`${n.text}\`.`);
2317
2454
  }
2318
2455
  if (o.members) {
2319
- l.push(""), e.filter && l.push(`${Jn(r.length, "member")} of ${s} matching '${e.filter}':`);
2320
- for (const e of r) l.push(Gn(e));
2456
+ a.push(""), e.filter && a.push(`${ho(r.length, "member")} of ${s} matching '${e.filter}':`);
2457
+ for (const e of r) a.push(mo(e));
2321
2458
  }
2322
- return o.nested && o.nested.length > 0 && !e.filter && l.push("", `Nested types — \`${t} ${n}.<name>\`: ${o.nested.join(", ")}`), l.push("", o.members ? `Full documentation for one member: \`${t} ${n}.<member>\` · scripting.d.ts:${o.lines[0]}-${o.lines[1]}` : `scripting.d.ts:${o.lines[0]}-${o.lines[1]}`), l.join("\n");
2459
+ return o.nested && o.nested.length > 0 && !e.filter && a.push("", `Nested types — \`${t} ${n}.<name>\`: ${o.nested.join(", ")}`), a.push("", o.members ? `Full documentation for one member: \`${t} ${n}.<member>\` · scripting.d.ts:${o.lines[0]}-${o.lines[1]}` : `scripting.d.ts:${o.lines[0]}-${o.lines[1]}`), a.join("\n");
2323
2460
  }(e, n);
2324
2461
  case "member": return function(e, t) {
2325
2462
  const n = e.members[0].name, o = [`# ${e.key}.${n}`];
@@ -2337,16 +2474,16 @@ function Xn(e, t) {
2337
2474
  }
2338
2475
  if (e.members.length > 0) {
2339
2476
  n.push("", "Members:");
2340
- for (const { key: t, member: o } of e.members) n.push(Gn(o, t));
2477
+ for (const { key: t, member: o } of e.members) n.push(mo(o, t));
2341
2478
  }
2342
- return e.omitted > 0 && n.push("", `…and ${Jn(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");
2479
+ return e.omitted > 0 && n.push("", `…and ${ho(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");
2343
2480
  }(e, n);
2344
2481
  }
2345
2482
  }
2346
- async function Zn(e) {
2347
- const t = Vn(await f(), e);
2483
+ async function po(e) {
2484
+ const t = ro(await y(), e);
2348
2485
  if ("member" === t.kind) try {
2349
- const e = (await p()).split(/\r?\n/);
2486
+ const e = (await S()).split(/\r?\n/);
2350
2487
  t.sources = t.members.map((t) => function(e, t, n) {
2351
2488
  const o = e.slice(t - 1, n), r = Math.min(...o.filter((e) => e.trim()).map((e) => e.length - e.trimStart().length));
2352
2489
  return o.map((e) => e.slice(Number.isFinite(r) ? r : 0)).join("\n");
@@ -2354,7 +2491,7 @@ async function Zn(e) {
2354
2491
  } catch {}
2355
2492
  return t;
2356
2493
  }
2357
- var Kn = {
2494
+ var $o = {
2358
2495
  name: "api",
2359
2496
  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.",
2360
2497
  params: [{
@@ -2363,24 +2500,24 @@ var Kn = {
2363
2500
  description: "A type (`ICellRange`), a member (`ICellRange.setValues`), or a word to search for. Omit for the overview. A leading `SheetXL.` is accepted.",
2364
2501
  positional: 0
2365
2502
  }],
2366
- run: (e) => Zn(e?.name),
2367
- render: Xn
2368
- }, Qn = r.Feature;
2369
- async function Yn(e, t, n, o) {
2370
- await eo(e, t, "precedents", n, o), await eo(e, t, "dependents", n, o);
2503
+ run: (e) => po(e?.name),
2504
+ render: fo
2505
+ }, wo = r.Feature;
2506
+ async function yo(e, t, n, o) {
2507
+ await So(e, t, "precedents", n, o), await So(e, t, "dependents", n, o);
2371
2508
  }
2372
- async function eo(e, t, n, o, r) {
2373
- const s = "precedents" === n ? "Precedents" : "Dependents", a = await ("precedents" === n ? t.getPrecedents() : t.getDependents()), l = "dependents" === n && r?.subject ? function(e, t) {
2374
- const n = e.getSheet(), o = n.getWorkbook()?.getSheets().getItems({ visibility: g.Visibility.VeryHidden }) ?? [n], r = /* @__PURE__ */ new Map();
2509
+ async function So(e, t, n, o, r) {
2510
+ const s = "precedents" === n ? "Precedents" : "Dependents", l = await ("precedents" === n ? t.getPrecedents() : t.getDependents()), a = "dependents" === n && r?.subject ? function(e, t) {
2511
+ const n = e.getSheet(), o = n.getWorkbook()?.getSheets().getItems({ visibility: d.Visibility.VeryHidden }) ?? [n], r = /* @__PURE__ */ new Map();
2375
2512
  for (let e = 0; e < (t?.length ?? 0); e++) {
2376
2513
  const n = t.at(e);
2377
2514
  if (n.isINamedRange) continue;
2378
2515
  const o = r.get(n.getSheet());
2379
2516
  o ? o.push(n.getCoords()) : r.set(n.getSheet(), [n.getCoords()]);
2380
2517
  }
2381
- const s = e.getCoords(), a = [];
2518
+ const s = e.getCoords(), l = [];
2382
2519
  for (const e of o) for (const t of e.getMovables().getItems({ type: "chart" })) {
2383
- const e = Mt(t);
2520
+ const e = Pt(t);
2384
2521
  if (!e || e.getPivotSource()) continue;
2385
2522
  let o = null;
2386
2523
  for (const t of e.getSeries()) {
@@ -2391,58 +2528,58 @@ async function eo(e, t, n, o, r) {
2391
2528
  ]) {
2392
2529
  if (!e) continue;
2393
2530
  const t = e.getCoords();
2394
- if (e.getSheet() === n && qt(t, s)) {
2531
+ if (e.getSheet() === n && Kt(t, s)) {
2395
2532
  o = !0;
2396
2533
  break;
2397
2534
  }
2398
- null === o && r.get(e.getSheet())?.some((e) => qt(e, t)) && (o = !1);
2535
+ null === o && r.get(e.getSheet())?.some((e) => Kt(e, t)) && (o = !1);
2399
2536
  }
2400
2537
  if (!0 === o) break;
2401
2538
  }
2402
- null !== o && a.push({
2539
+ null !== o && l.push({
2403
2540
  movable: t,
2404
2541
  direct: o
2405
2542
  });
2406
2543
  }
2407
- return a;
2408
- }(r.subject, a) : [];
2409
- if (!a || 0 === a.length) {
2544
+ return l;
2545
+ }(r.subject, l) : [];
2546
+ if (!l || 0 === l.length) {
2410
2547
  const t = "precedents" === n ? r?.zeroPrecedents : r?.zeroDependents;
2411
- l.length > 0 ? (e.h2(`${s} (${to(l.length)})`), e.text(` ${"charts".padEnd(oo)}${no(l)}`), e.blank()) : t && (e.h2(`${s} (0)`), e.blank());
2548
+ a.length > 0 ? (e.h2(`${s} (${bo(a.length)})`), e.text(` ${"charts".padEnd(Co)}${xo(a)}`), e.blank()) : t && (e.h2(`${s} (0)`), e.blank());
2412
2549
  return;
2413
2550
  }
2414
2551
  const i = await async function(e, t, n) {
2415
- let o = 0, r = 0, s = 0, a = 0;
2416
- const l = /* @__PURE__ */ new Map();
2552
+ let o = 0, r = 0, s = 0, l = 0;
2553
+ const a = /* @__PURE__ */ new Map();
2417
2554
  for (let e = 0; e < t.length; e++) {
2418
2555
  const n = t.at(e);
2419
2556
  if (n.isINamedRange) {
2420
- a++;
2557
+ l++;
2421
2558
  continue;
2422
2559
  }
2423
2560
  s++;
2424
- const i = n.getCounts([Qn.Contentful, Qn.Formula]), c = i[Qn.Contentful] ?? 0;
2425
- o += c, r += i[Qn.Formula] ?? 0;
2561
+ const i = n.getCounts([wo.Contentful, wo.Formula]), c = i[wo.Contentful] ?? 0;
2562
+ o += c, r += i[wo.Formula] ?? 0;
2426
2563
  const u = n.getSheet()?.getName() ?? "";
2427
- l.set(u, (l.get(u) ?? 0) + c);
2564
+ a.set(u, (a.get(u) ?? 0) + c);
2428
2565
  }
2429
2566
  const { depth: i, capped: c } = await async function(e, t) {
2430
2567
  const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set();
2431
2568
  let r = 0, s = !1;
2432
- const a = (e) => "precedents" === t ? e.getDirectPrecedents() : e.getDirectDependents(), l = async (e) => {
2433
- const t = await a(e);
2569
+ const l = (e) => "precedents" === t ? e.getDirectPrecedents() : e.getDirectDependents(), a = async (e) => {
2570
+ const t = await l(e);
2434
2571
  if (!t) return 0;
2435
2572
  let i = 0;
2436
2573
  for (let e = 0; e < t.length; e++) {
2437
- const a = t.at(e), c = uo(a);
2574
+ const l = t.at(e), c = Io(l);
2438
2575
  if (o.has(c)) continue;
2439
2576
  let u = n.get(c);
2440
- void 0 === u && (++r > so ? (s = !0, u = 0) : (o.add(c), u = await l(a), o.delete(c), n.set(c, u))), i = Math.max(i, u + 1);
2577
+ void 0 === u && (++r > Eo ? (s = !0, u = 0) : (o.add(c), u = await a(l), o.delete(c), n.set(c, u))), i = Math.max(i, u + 1);
2441
2578
  }
2442
2579
  return i;
2443
2580
  };
2444
2581
  return {
2445
- depth: await l(e),
2582
+ depth: await a(e),
2446
2583
  capped: s
2447
2584
  };
2448
2585
  }(e, n);
@@ -2450,19 +2587,19 @@ async function eo(e, t, n, o, r) {
2450
2587
  cells: o,
2451
2588
  inputs: o - r,
2452
2589
  areas: s,
2453
- names: a,
2590
+ names: l,
2454
2591
  depth: i,
2455
2592
  depthCapped: c,
2456
- sheets: l,
2457
- outputs: "dependents" === n ? await lo(t) : {
2593
+ sheets: a,
2594
+ outputs: "dependents" === n ? await Ro(t) : {
2458
2595
  ranges: [],
2459
2596
  cells: 0
2460
2597
  }
2461
2598
  };
2462
- }(t, a, n), c = [`${i.cells} ${1 === i.cells ? "cell" : "cells"}`];
2463
- "precedents" === n ? c.push(`${i.inputs} ${1 === i.inputs ? "input" : "inputs"}`) : c.push(`${i.outputs.cells} ${1 === i.outputs.cells ? "output" : "outputs"}`), c.push(`depth ${i.depthCapped ? "≥ " : ""}${i.depth}`), c.push(`${i.areas} ${1 === i.areas ? "area" : "areas"}`), i.names > 0 && c.push(`${i.names} ${1 === i.names ? "name" : "names"}`), l.length > 0 && c.push(to(l.length)), e.h2(`${s} (${c.join(" · ")})`);
2464
- const u = r?.home?.getName() ?? null, d = await async function(e, t, n, o) {
2465
- const r = Math.max(1, o?.maxTreeRows ?? 12), s = (e) => "precedents" === t ? e.getDirectPrecedents() : e.getDirectDependents(), a = [], l = /* @__PURE__ */ new Map();
2599
+ }(t, l, n), c = [`${i.cells} ${1 === i.cells ? "cell" : "cells"}`];
2600
+ "precedents" === n ? c.push(`${i.inputs} ${1 === i.inputs ? "input" : "inputs"}`) : c.push(`${i.outputs.cells} ${1 === i.outputs.cells ? "output" : "outputs"}`), c.push(`depth ${i.depthCapped ? "≥ " : ""}${i.depth}`), c.push(`${i.areas} ${1 === i.areas ? "area" : "areas"}`), i.names > 0 && c.push(`${i.names} ${1 === i.names ? "name" : "names"}`), a.length > 0 && c.push(bo(a.length)), e.h2(`${s} (${c.join(" · ")})`);
2601
+ const u = r?.home?.getName() ?? null, g = await async function(e, t, n, o) {
2602
+ const r = Math.max(1, o?.maxTreeRows ?? 12), s = (e) => "precedents" === t ? e.getDirectPrecedents() : e.getDirectDependents(), l = [], a = /* @__PURE__ */ new Map();
2466
2603
  let i = 0, c = 0, u = !1;
2467
2604
  const g = [], d = (e, t, n) => {
2468
2605
  const o = e?.length ?? 0;
@@ -2476,7 +2613,7 @@ async function eo(e, t, n, o, r) {
2476
2613
  let h = 0;
2477
2614
  i = d(await s(e), null, 0);
2478
2615
  for (; h < g.length && c < r;) {
2479
- const { range: e, parent: t, depth: n } = g[h++], o = uo(e), r = {
2616
+ const { range: e, parent: t, depth: n } = g[h++], o = Io(e), r = {
2480
2617
  range: e,
2481
2618
  key: o,
2482
2619
  depth: n,
@@ -2486,15 +2623,15 @@ async function eo(e, t, n, o, r) {
2486
2623
  mark: null,
2487
2624
  first: null
2488
2625
  };
2489
- c++, (t ? t.children : a).push(r);
2626
+ c++, (t ? t.children : l).push(r);
2490
2627
  let i = t;
2491
2628
  for (; i && i.key !== o;) i = i.parent;
2492
2629
  if (i) {
2493
2630
  r.mark = "circular", u = !0;
2494
2631
  continue;
2495
2632
  }
2496
- const m = l.get(o);
2497
- m ? (r.mark = "repeat", r.first = m) : (l.set(o, r), r.childCount = d(await s(e), r, n + 1));
2633
+ const m = a.get(o);
2634
+ m ? (r.mark = "repeat", r.first = m) : (a.set(o, r), r.childCount = d(await s(e), r, n + 1));
2498
2635
  }
2499
2636
  const m = function(e) {
2500
2637
  if (e.isINamedRange || "function" != typeof e.getCoords) return null;
@@ -2508,16 +2645,16 @@ async function eo(e, t, n, o, r) {
2508
2645
  }(e), f = [], p = (e) => {
2509
2646
  for (const t of e) f.push(t), p(t.children);
2510
2647
  };
2511
- p(a);
2648
+ p(l);
2512
2649
  const $ = new Map(f.map((e, t) => [e, t]));
2513
- let w = i - a.length;
2514
- const S = f.map((e) => {
2515
- const { address: t, sheet: n, isName: o } = go(e.range);
2650
+ let w = i - l.length;
2651
+ const y = f.map((e) => {
2652
+ const { address: t, sheet: n, isName: o } = Fo(e.range);
2516
2653
  let r;
2517
2654
  if ("circular" === e.mark) r = "↺ circular";
2518
2655
  else if ("repeat" === e.mark) r = $.get(e.first) < $.get(e) ? "↑ shown above" : "↓ shown below";
2519
2656
  else {
2520
- r = [ho(e.range), co(e.range, m)].filter(Boolean).join(" ");
2657
+ r = [Mo(e.range), jo(e.range, m)].filter(Boolean).join(" ");
2521
2658
  const t = e.childCount - e.children.length;
2522
2659
  t > 0 && (w += t, r = `${r} ▸ ${t} more`);
2523
2660
  }
@@ -2529,10 +2666,10 @@ async function eo(e, t, n, o, r) {
2529
2666
  label: `${s}${t}`,
2530
2667
  detail: r
2531
2668
  };
2532
- }), y = S.filter((e) => !e.isName);
2533
- if (y.length > 0 && y.some((e) => e.sheet !== y[0].sheet)) for (const e of S) e.isName || (e.label = `${e.indent}${lt(e.sheet)}!${e.label.slice(e.indent.length)}`);
2534
- const b = [], x = Math.max(...S.map((e) => e.label.length));
2535
- for (const e of S) b.push(` ${e.label.padEnd(x)} ${e.detail}`.trimEnd());
2669
+ }), S = y.filter((e) => !e.isName);
2670
+ if (S.length > 0 && S.some((e) => e.sheet !== S[0].sheet)) for (const e of y) e.isName || (e.label = `${e.indent}${gt(e.sheet)}!${e.label.slice(e.indent.length)}`);
2671
+ const b = [], x = Math.max(...y.map((e) => e.label.length));
2672
+ for (const e of y) b.push(` ${e.label.padEnd(x)} ${e.detail}`.trimEnd());
2536
2673
  u && b.push(" ↺ circular reference — the chain returns to a cell already on this branch");
2537
2674
  if (w > 0) {
2538
2675
  const e = "precedents" === t ? "getPrecedents()" : "getDependents()";
@@ -2543,13 +2680,13 @@ async function eo(e, t, n, o, r) {
2543
2680
  shown: new Set(f.map((e) => e.key))
2544
2681
  };
2545
2682
  }(t, n, i.areas, o), h = i.outputs.ranges;
2546
- if ("dependents" === n && h.some((e) => !d.shown.has(uo(e))) && e.text(` ${"outputs".padEnd(oo)}${function(e, t) {
2547
- const n = e.ranges.slice(0, ao).map((e) => {
2548
- const { address: n, sheet: o } = go(e);
2683
+ if ("dependents" === n && h.some((e) => !g.shown.has(Io(e))) && e.text(` ${"outputs".padEnd(Co)}${function(e, t) {
2684
+ const n = e.ranges.slice(0, vo).map((e) => {
2685
+ const { address: n, sheet: o } = Fo(e);
2549
2686
  return [
2550
- null !== t && o !== t ? `${lt(o)}!${n}` : n,
2551
- e.isSingleCell() ? y(e.getCell(), $.Mode.Display)?.display ?? "" : `${e.getRowCount()}×${e.getColumnCount()}`,
2552
- co(e)
2687
+ null !== t && o !== t ? `${gt(o)}!${n}` : n,
2688
+ e.isSingleCell() ? k(e.getCell(), b.Mode.Display)?.display ?? "" : `${e.getRowCount()}×${e.getColumnCount()}`,
2689
+ jo(e)
2553
2690
  ].filter(Boolean).join(" ");
2554
2691
  }), o = e.ranges.length - n.length;
2555
2692
  o > 0 && n.push(`+${o} more (getDependents())`);
@@ -2557,21 +2694,21 @@ async function eo(e, t, n, o, r) {
2557
2694
  }(i.outputs, u)}`), null !== u) {
2558
2695
  const t = [...i.sheets].filter(([e]) => e !== u);
2559
2696
  if (t.length > 0) {
2560
- const n = t.map(([e, t]) => `${lt(e)} ${t} ${1 === t ? "cell" : "cells"}`);
2561
- e.text(` ${"sheets".padEnd(oo)}${n.join(" · ")}`);
2697
+ const n = t.map(([e, t]) => `${gt(e)} ${t} ${1 === t ? "cell" : "cells"}`);
2698
+ e.text(` ${"sheets".padEnd(Co)}${n.join(" · ")}`);
2562
2699
  }
2563
2700
  }
2564
- l.length > 0 && e.text(` ${"charts".padEnd(oo)}${no(l)}`);
2565
- for (const t of d.lines) e.text(t);
2701
+ a.length > 0 && e.text(` ${"charts".padEnd(Co)}${xo(a)}`);
2702
+ for (const t of g.lines) e.text(t);
2566
2703
  e.blank();
2567
2704
  }
2568
- var to = (e) => `${e} ${1 === e ? "chart" : "charts"}`;
2569
- function no(e) {
2570
- const t = e.slice(0, ro).map(Jt), n = e.length - t.length;
2705
+ var bo = (e) => `${e} ${1 === e ? "chart" : "charts"}`;
2706
+ function xo(e) {
2707
+ const t = e.slice(0, ko).map(Qt), n = e.length - t.length;
2571
2708
  return n > 0 && t.push(`+${n} more`), t.join(" · ");
2572
2709
  }
2573
- var oo = 10, ro = 6, so = 2e3, ao = 4;
2574
- async function lo(e) {
2710
+ var Co = 10, ko = 6, Eo = 2e3, vo = 4;
2711
+ async function Ro(e) {
2575
2712
  const t = /* @__PURE__ */ new Map(), n = await e.getPrecedents(!1);
2576
2713
  for (let e = 0; e < (n?.length ?? 0); e++) {
2577
2714
  const o = n.at(e);
@@ -2584,59 +2721,59 @@ async function lo(e) {
2584
2721
  for (let n = 0; n < e.length; n++) {
2585
2722
  const s = e.at(n);
2586
2723
  if (s.isINamedRange) continue;
2587
- let a = [s.getCoords()];
2588
- for (const e of t.get(s.getSheet()?.getName() ?? "") ?? []) if (a = a.flatMap((t) => io(t, e)), 0 === a.length) break;
2589
- for (const e of a) r += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), o.push(s.getSheet().getRange(e));
2724
+ let l = [s.getCoords()];
2725
+ for (const e of t.get(s.getSheet()?.getName() ?? "") ?? []) if (l = l.flatMap((t) => No(t, e)), 0 === l.length) break;
2726
+ for (const e of l) r += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), o.push(s.getSheet().getRange(e));
2590
2727
  }
2591
2728
  return {
2592
2729
  ranges: o,
2593
2730
  cells: r
2594
2731
  };
2595
2732
  }
2596
- function io(e, t) {
2733
+ function No(e, t) {
2597
2734
  const n = Math.max(e.rowStart, t.rowStart), o = Math.min(e.rowEnd, t.rowEnd), r = Math.max(e.colStart, t.colStart), s = Math.min(e.colEnd, t.colEnd);
2598
2735
  if (n > o || r > s) return [e];
2599
- const a = [];
2600
- return e.rowStart < n && a.push({
2736
+ const l = [];
2737
+ return e.rowStart < n && l.push({
2601
2738
  ...e,
2602
2739
  rowEnd: n - 1
2603
- }), o < e.rowEnd && a.push({
2740
+ }), o < e.rowEnd && l.push({
2604
2741
  ...e,
2605
2742
  rowStart: o + 1
2606
- }), e.colStart < r && a.push({
2743
+ }), e.colStart < r && l.push({
2607
2744
  rowStart: n,
2608
2745
  rowEnd: o,
2609
2746
  colStart: e.colStart,
2610
2747
  colEnd: r - 1
2611
- }), s < e.colEnd && a.push({
2748
+ }), s < e.colEnd && l.push({
2612
2749
  rowStart: n,
2613
2750
  rowEnd: o,
2614
2751
  colStart: s + 1,
2615
2752
  colEnd: e.colEnd
2616
- }), a;
2753
+ }), l;
2617
2754
  }
2618
- function co(e, t) {
2755
+ function jo(e, t) {
2619
2756
  if (e.isINamedRange || !e.isSingleCell()) return "";
2620
2757
  const n = e.getCell();
2621
- if (n.getType() === m.String) return "";
2758
+ if (n.getType() === $.String) return "";
2622
2759
  const o = n.getCoords(), r = e.getSheet(), s = [];
2623
2760
  if (!t || o.rowIndex < t.rowStart || o.rowIndex > t.rowEnd) {
2624
- const e = L(r, o, "row");
2761
+ const e = V(r, o, "row");
2625
2762
  e && s.push(`row ${JSON.stringify(e.text)}`);
2626
2763
  }
2627
2764
  if (!t || o.colIndex < t.colStart || o.colIndex > t.colEnd) {
2628
- const e = L(r, o, "column");
2765
+ const e = V(r, o, "column");
2629
2766
  e && s.push(`col ${JSON.stringify(e.text)}`);
2630
2767
  }
2631
2768
  return s.join(" ");
2632
2769
  }
2633
- function uo(e) {
2770
+ function Io(e) {
2634
2771
  const t = e.isINamedRange ? e.getId() : null;
2635
2772
  if (t) return `name:${t}`;
2636
2773
  const n = e.getCoords();
2637
2774
  return `${e.getSheet()?.getName() ?? ""}!${n.rowStart},${n.colStart},${n.rowEnd},${n.colEnd}`;
2638
2775
  }
2639
- function go(e) {
2776
+ function Fo(e) {
2640
2777
  const t = e.getSheet()?.getName() ?? "";
2641
2778
  if (e.isINamedRange) return {
2642
2779
  address: e.getName(),
@@ -2650,40 +2787,40 @@ function go(e) {
2650
2787
  isName: !1
2651
2788
  };
2652
2789
  }
2653
- function ho(e) {
2790
+ function Mo(e) {
2654
2791
  if (e.isINamedRange) {
2655
2792
  const t = e.getRanges();
2656
2793
  return t ? `name → ${t.getAddress()}` : "name";
2657
2794
  }
2658
2795
  if (e.isSingleCell()) {
2659
- const t = e.getCell(), n = y(t, $.Mode.Display), o = t.getFormulaText(), r = n ? n.display : "(empty)";
2796
+ const t = e.getCell(), n = k(t, b.Mode.Display), o = t.getFormulaText(), r = n ? n.display : "(empty)";
2660
2797
  return o ? `${r} ${o}` : r;
2661
2798
  }
2662
- const t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(Qn.Formula)];
2799
+ const t = `${e.getRowCount()}×${e.getColumnCount()}`, n = [...e.getRegions(wo.Formula)];
2663
2800
  if (1 === n.length && n[0].getRange().isEqual(e)) {
2664
2801
  const e = n[0].getCell().getFormulaText();
2665
2802
  if (e) return `${t} ${e}`;
2666
2803
  }
2667
2804
  return t;
2668
2805
  }
2669
- var mo = {
2670
- features: (e) => st(e),
2806
+ var To = {
2807
+ features: (e) => ct(e),
2671
2808
  mode: (e, t) => function(e, t, n) {
2672
2809
  const o = new Map(Object.values(n).map((e) => [e.toLowerCase(), e])).get(e.trim().toLowerCase());
2673
2810
  if (!o) throw new Error(`Unknown ${t} '${e}'. Values: ${Object.values(n).join(", ")}.`);
2674
2811
  return o;
2675
- }(e, t, $.Mode)
2676
- }, fo = Object.keys(mo);
2677
- function po(e) {
2812
+ }(e, t, b.Mode)
2813
+ }, Ao = Object.keys(To);
2814
+ function Lo(e) {
2678
2815
  const t = {};
2679
2816
  for (const [n, o] of Object.entries(e)) {
2680
- const e = mo[n];
2681
- if (!e) throw new Error(`Unknown report option '${n}'. Options: ${fo.join(", ")}.`);
2817
+ const e = To[n];
2818
+ if (!e) throw new Error(`Unknown report option '${n}'. Options: ${Ao.join(", ")}.`);
2682
2819
  t[n] = e(o, n);
2683
2820
  }
2684
2821
  return t;
2685
2822
  }
2686
- var $o = r.Feature, wo = [
2823
+ var Oo = r.Feature, Po = [
2687
2824
  ["formatCells", "format cells"],
2688
2825
  ["formatColumns", "format columns"],
2689
2826
  ["formatRows", "format rows"],
@@ -2697,32 +2834,32 @@ var $o = r.Feature, wo = [
2697
2834
  ["pivotTables", "pivot tables"],
2698
2835
  ["objects", "edit objects"],
2699
2836
  ["scenarios", "edit scenarios"]
2700
- ], So = [["structure", "structure"], ["windows", "windows"]], yo = (e) => {
2837
+ ], Do = [["structure", "structure"], ["windows", "windows"]], Vo = (e) => {
2701
2838
  const t = e.hasPassword() ? " · password" : "";
2702
2839
  return e.isLocked() ? `locked${t}` : e.isPaused() ? `paused${t} — nothing is refused until resume()` : null;
2703
- }, bo = (e) => {
2840
+ }, Bo = (e) => {
2704
2841
  const t = e.getProperties();
2705
2842
  if (!t) return null;
2706
- const n = wo.filter(([e]) => !0 === t[e]).map(([, e]) => e);
2843
+ const n = Po.filter(([e]) => !0 === t[e]).map(([, e]) => e);
2707
2844
  return n.length > 0 ? n.join(", ") : null;
2708
- }, xo = (e) => {
2845
+ }, Ho = (e) => {
2709
2846
  const t = e.getProperties();
2710
2847
  if (!t) return null;
2711
- const n = So.filter(([e]) => !0 !== t[e]).map(([, e]) => e);
2848
+ const n = Do.filter(([e]) => !0 !== t[e]).map(([, e]) => e);
2712
2849
  return n.length > 0 ? n.join(", ") : null;
2713
- }, Co = (e) => {
2714
- const t = yo(e);
2850
+ }, _o = (e) => {
2851
+ const t = Vo(e);
2715
2852
  if (!t) return null;
2716
- const n = xo(e);
2853
+ const n = Ho(e);
2717
2854
  return n ? `${n} ${t}` : t;
2718
- }, Eo = (e) => [...e.getEntireRange().getRegions($o.Unlock)], ko = (e) => {
2855
+ }, zo = (e) => [...e.getEntireRange().getRegions(Oo.Unlock)], Uo = (e) => {
2719
2856
  let t = 0;
2720
2857
  for (const n of e) {
2721
2858
  const e = n.getCoords();
2722
2859
  t += (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
2723
2860
  }
2724
2861
  return t;
2725
- }, vo = (t) => {
2862
+ }, Wo = (t) => {
2726
2863
  let n = null;
2727
2864
  for (const e of t) {
2728
2865
  const t = e.getCoords();
@@ -2734,81 +2871,94 @@ var $o = r.Feature, wo = [
2734
2871
  } : { ...t };
2735
2872
  }
2736
2873
  return n ? e.rangeToString(n) ?? "" : "";
2737
- }, Ro = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`;
2738
- function No(e) {
2739
- const t = e.getProtection(), n = yo(t);
2874
+ }, Jo = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`;
2875
+ function qo(e) {
2876
+ const t = e.getProtection(), n = Vo(t);
2740
2877
  if (!n) return null;
2741
- const o = Eo(e), r = [o.length > 0 ? `${Ro(ko(o), "editable cell")} · ${Ro(o.length, "region")}` : "no editable cells", n];
2878
+ const o = zo(e), r = [o.length > 0 ? `${Jo(Uo(o), "editable cell")} · ${Jo(o.length, "region")}` : "no editable cells", n];
2742
2879
  return !1 === t.getProperties()?.showFormulas && r.push("formulas hidden"), {
2743
- extent: vo(o),
2880
+ extent: Wo(o),
2744
2881
  detail: r.join(" · ")
2745
2882
  };
2746
2883
  }
2747
- function Io(e, t) {
2748
- const n = t.getProtection(), o = yo(n);
2884
+ function Go(e, t) {
2885
+ const n = t.getProtection(), o = Vo(n);
2749
2886
  if (!o) return;
2750
2887
  e.h2(`Protection (${o})`);
2751
2888
  const r = (e) => ` ${e.padEnd(10)}`;
2752
- e.text(`${r("allowed")}${bo(n) ?? "none — only the editable cells take a write"}`), !1 === n.getProperties()?.showFormulas && e.text(`${r("formulas")}hidden — a cell reads as a value unless its style shows its formula`);
2753
- const s = Eo(t);
2889
+ e.text(`${r("allowed")}${Bo(n) ?? "none — only the editable cells take a write"}`), !1 === n.getProperties()?.showFormulas && e.text(`${r("formulas")}hidden — a cell reads as a value unless its style shows its formula`);
2890
+ const s = zo(t);
2754
2891
  if (0 === s.length) return e.text(`${r("editable")}none — every cell refuses a write`), void e.blank();
2755
- e.text(`${r("editable")}${Ro(ko(s), "cell")} · ${Ro(s.length, "region")}`), Ze(e, s, {
2892
+ e.text(`${r("editable")}${Jo(Uo(s), "cell")} · ${Jo(s.length, "region")}`), et(e, s, {
2756
2893
  maxRegions: 12,
2757
- payload: We($o.Unlock, null),
2758
- recovery: `${it(t.getEntireRange())}.getRegions("unlock") lists all ${s.length}`
2894
+ payload: Xe(Oo.Unlock, null),
2895
+ recovery: `${dt(t.getEntireRange())}.getRegions("unlock") lists all ${s.length}`
2759
2896
  }), e.blank();
2760
2897
  }
2761
- function jo(e) {
2898
+ function Xo(e) {
2762
2899
  if (!e.getSheet().getProtection().isLocked()) return null;
2763
- const t = [...e.getRegions($o.Unlock)], n = e.getRowCount() * e.getColumnCount(), o = ko(t);
2900
+ const t = [...e.getRegions(Oo.Unlock)], n = e.getRowCount() * e.getColumnCount(), o = Uo(t);
2764
2901
  if (0 === o) return "sheet locked — no cell here takes a write";
2765
2902
  if (o === n) return "sheet locked — every cell here is editable";
2766
2903
  const r = e.getSheet().getProtectedRanges().getItems({ address: e }).some((e) => !e.isUnlocked());
2767
- return `sheet locked — ${o} of ${Ro(n, "cell")} editable (${vo(t)})` + (r ? " · some behind a range password" : "");
2904
+ return `sheet locked — ${o} of ${Jo(n, "cell")} editable (${Wo(t)})` + (r ? " · some behind a range password" : "");
2768
2905
  }
2769
- function Fo(e) {
2906
+ function Zo(e) {
2770
2907
  return e.getSheet().getProtection().isLocked() ? e.isEditAllowed() ? "true — unlocked on a protected sheet" : "false — the sheet is protected and this cell is locked" : null;
2771
2908
  }
2772
- function Mo(e) {
2909
+ function Ko(e) {
2773
2910
  return "ProtectedError" !== e?.name ? null : "`sheet.getProtection()` (`wb.getProtection()` for the workbook) lists what is still allowed; `sheet.getRegions(\"unlock\")` lists the cells that take a write.";
2774
2911
  }
2775
- function To(e) {
2776
- const t = new Je(), n = !0 === e.isISheetProtection;
2912
+ function Qo(e) {
2913
+ const t = new Ke(), n = !0 === e.isISheetProtection;
2777
2914
  t.h1(n ? "Sheet Protection" : "Workbook Protection"), t.blank();
2778
- const o = yo(e);
2915
+ const o = Vo(e);
2779
2916
  t.fact(`State: ${o ?? "not protected"}${e.isReadOnly() ? " · read-only" : ""}`);
2780
2917
  const r = o ? "" : " (when next locked)";
2781
2918
  if (n) {
2782
- const n = bo(e);
2919
+ const n = Bo(e);
2783
2920
  (o || n) && t.fact(`Allowed${r}: ${n ?? "none — only the editable cells take a write"}`), !1 === e.getProperties()?.showFormulas && t.fact(`Formulas${r}: hidden`), o && t.fact("Editable: sheet.getRegions(\"unlock\") lists the cells that take a write");
2784
2921
  } else {
2785
- const n = xo(e);
2922
+ const n = Ho(e);
2786
2923
  (o || e.getProperties()) && t.fact(`Refused${r}: ${n ?? "nothing"}`);
2787
2924
  }
2788
2925
  return t.toLines().join("\n").trimEnd();
2789
2926
  }
2790
- function Ao(e) {
2791
- const t = new Je(), n = e.getRanges();
2792
- t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${ut(n)}`), t.fact(`Cells: ${n.size}`), t.fact("Password: " + (e.hasPassword() ? e.isUnlocked() ? "set · unlocked for this session" : "set · unlock(password) grants access" : "none"));
2927
+ function Yo(e) {
2928
+ const t = new Ke(), n = e.getRanges();
2929
+ t.h1(`Unlocked Range — ${e.getName()}`), t.blank(), t.fact(`Ranges: ${mt(n)}`), t.fact(`Cells: ${n.size}`), t.fact("Password: " + (e.hasPassword() ? e.isUnlocked() ? "set · unlocked for this session" : "set · unlock(password) grants access" : "none"));
2793
2930
  const o = n.getSheet().getProtection().isLocked();
2794
2931
  return t.fact("In force: " + (o ? "true — the sheet is protected" : "false — the sheet is not protected, so every cell is editable")), e.getSecurityDescriptor() && t.fact("Security Descriptor: present · not evaluated"), t.toLines().join("\n").trimEnd();
2795
2932
  }
2796
- var Lo = r.Feature;
2797
- async function Oo(e, t) {
2933
+ var er = r.Feature;
2934
+ async function tr(e, t) {
2798
2935
  const n = e.getSheet().getRange(e.getCoords());
2799
2936
  e = n.getCell();
2800
- const o = new Je();
2801
- o.h1(`Cell — ${lt(e.getSheet().getName())}!${e.getAddress()}`), o.blank();
2937
+ const o = new Ke();
2938
+ o.h1(`Cell — ${gt(e.getSheet().getName())}!${e.getAddress()}`), o.blank();
2802
2939
  const r = !!e.getFormulaText(), s = e.getType();
2803
2940
  (function(e, t) {
2804
- const n = y(t, $.Mode.Display), o = y(t, $.Mode.Value), r = t.getFormulaText(), s = e.toLines().length;
2805
- (n || r) && (e.fact(`Type: ${t.getType()}`), n && e.fact(`Display: ${n.display}`), o && o.match !== n?.match && e.fact(`Value: ${o.display}`), r && e.fact(`Formula: ${e.codespan(r)}`));
2806
- const a = t.getHyperlink();
2807
- a && e.fact(`Hyperlink: ${a.getAddress()}`);
2808
- const l = t.getSpans(), i = !t.isTopLeft();
2809
- if (i || l.height > 1 || l.width > 1) {
2941
+ const n = k(t, b.Mode.Display), o = k(t, b.Mode.Value), r = t.getFormulaText(), s = e.toLines().length;
2942
+ if (n || r) {
2943
+ if (e.fact(`Type: ${t.getType()}`), n && e.fact(`Display: ${n.display}`), o && o.match !== n?.match) {
2944
+ const r = function(e) {
2945
+ const t = e.getDate();
2946
+ if (!t) return null;
2947
+ const n = (e, t = 2) => String(e).padStart(t, "0"), o = `${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
2948
+ if (!p.getEngine().isDateFormat(e.getStyle().getNumberFormat())) return e.getValue() < 1 ? o : null;
2949
+ const r = `${n(t.getFullYear(), 4)}-${n(t.getMonth() + 1)}-${n(t.getDate())}`;
2950
+ return "00:00:00" === o ? r : `${r}T${o}`;
2951
+ }(t);
2952
+ e.fact(`Value: ${o.display}${r && r !== n?.match ? ` (${r})` : ""}`);
2953
+ }
2954
+ r && e.fact(`Formula: ${e.codespan(r)}`);
2955
+ }
2956
+ const l = t.getHyperlink();
2957
+ l && e.fact(`Hyperlink: ${l.getAddress()}`);
2958
+ const a = t.getSpans(), i = !t.isTopLeft();
2959
+ if (i || a.height > 1 || a.width > 1) {
2810
2960
  const n = t.getRange().toString();
2811
- e.fact(`Merge: ${n} · ${l.height}×${l.width}`), i && e.fact("Merge Anchor: false — this cell is covered; the value lives at the top-left");
2961
+ e.fact(`Merge: ${n} · ${a.height}×${a.width}`), i && e.fact("Merge Anchor: false — this cell is covered; the value lives at the top-left");
2812
2962
  }
2813
2963
  const c = t.getSpill();
2814
2964
  c && e.fact(`Spill: ${c.toString()}`);
@@ -2825,67 +2975,67 @@ async function Oo(e, t) {
2825
2975
  }
2826
2976
  return o.join(" · ");
2827
2977
  }(u, t.getCoords())}`);
2828
- const g = It(t.getSheet().getRange(t.getCoords()));
2829
- g.length > 0 && e.fact(`Names: ${g.map((e) => `${e.getName()} (${ct(e.getRanges())})`).join(" · ")}`);
2830
- const d = Fo(t);
2978
+ const g = At(t.getSheet().getRange(t.getCoords()));
2979
+ g.length > 0 && e.fact(`Names: ${g.map((e) => `${e.getName()} (${ht(e.getRanges())})`).join(" · ")}`);
2980
+ const d = Zo(t);
2831
2981
  d && e.fact(`Editable: ${d}`);
2832
2982
  const h = t.getErrors();
2833
2983
  h.length > 0 && e.fact(`Errors: ${h.join("; ")}`);
2834
2984
  const m = t.getWarnings();
2835
2985
  m.length > 0 && e.fact(`Warnings: ${m.join("; ")}`);
2836
- const f = function(e) {
2837
- const t = e.getStyle(), n = e.getSheet().getWorkbook()?.getStyles().getNormal() ?? null, o = t.getNamed().getName(), r = o === (n?.getNamed().getName() ?? "Normal"), s = be(t.getNumberFormat()), a = n ? T(t, n) : null, l = R(t), i = j(t), c = n ? M(t, n) : null, u = [
2838
- r ? null : o,
2839
- s ? `format ${s}` : null,
2840
- a ? `font ${a}` : null,
2841
- l ? `fill ${l}` : null,
2842
- i.length > 0 ? `border ${i.join(", ")}` : null,
2843
- c ? `align ${c}` : null
2986
+ const f = function(e, t) {
2987
+ const n = t.getStyle(), o = t.getSheet().getWorkbook()?.getStyles().getNormal() ?? null, r = n.getNamed().getName(), s = r === (o?.getNamed().getName() ?? "Normal"), l = n.getNumberFormat(), a = Ee(l), i = a ? `${a} ${e.codespan(l)}` : null, c = o ? P(n, o) : null, u = F(n), g = A(n), d = o ? O(n, o) : null, h = [
2988
+ s ? null : r,
2989
+ i ? `format ${i}` : null,
2990
+ c ? `font ${c}` : null,
2991
+ u ? `fill ${u}` : null,
2992
+ g.length > 0 ? `border ${g.join(", ")}` : null,
2993
+ d ? `align ${d}` : null
2844
2994
  ].filter(Boolean);
2845
- return u.length > 0 ? u.join(" · ") : null;
2846
- }(t);
2995
+ return h.length > 0 ? h.join(" · ") : null;
2996
+ }(e, t);
2847
2997
  f && e.fact(`Style (effective): ${f}`);
2848
2998
  e.toLines().length > s && e.blank();
2849
2999
  })(o, e);
2850
- const a = function(e, t) {
2851
- if (!t.getFormulaText() && t.getType() === m.Null) return null;
3000
+ const l = function(e, t) {
3001
+ if (!t.getFormulaText() && t.getType() === $.Null) return null;
2852
3002
  const n = e.getSurrounding({ contentOnly: !0 });
2853
3003
  return n.isSingleCell() ? null : n;
2854
3004
  }(n, e);
2855
- return a && function(e, t, n) {
3005
+ return l && function(e, t, n) {
2856
3006
  const o = t.getCoords(), r = t.getSheet();
2857
3007
  e.h2(`Current Region — ${n.getAddress()} · ${n.getRowCount()}×${n.getColumnCount()}`);
2858
- const s = U(n), a = (e) => {
3008
+ const s = q(n), l = (e) => {
2859
3009
  if (!s || s.byColumn !== ("row" === e)) return null;
2860
3010
  const t = "row" === e ? o.rowIndex : o.colIndex;
2861
3011
  if (t < s.start) return null;
2862
3012
  const n = s.lines.find((e) => e.index === t);
2863
- if (n?.sums) return `totals, ${q(n.sums)}`;
2864
- const r = s.byColumn ? `row ${s.start + 1}` : `column ${D(s.start)}`;
3013
+ if (n?.sums) return `totals, ${Z(n.sums)}`;
3014
+ const r = s.byColumn ? `row ${s.start + 1}` : `column ${_(s.start)}`;
2865
3015
  return t === s.start ? "totals" : `below the totals ${r}`;
2866
- }, l = [["row", [
3016
+ }, a = [["row", [
2867
3017
  String(o.rowIndex + 1),
2868
- O(L(r, o, "row")),
2869
- a("row")
3018
+ B(V(r, o, "row")),
3019
+ l("row")
2870
3020
  ].filter(Boolean).join(" · ")], ["column", [
2871
- D(o.colIndex),
2872
- O(L(r, o, "column")),
2873
- a("column")
3021
+ _(o.colIndex),
3022
+ B(V(r, o, "column")),
3023
+ l("column")
2874
3024
  ].filter(Boolean).join(" · ")]];
2875
- for (const [t, n] of l) e.text(` ${t.padEnd(7)}${n}`);
3025
+ for (const [t, n] of a) e.text(` ${t.padEnd(7)}${n}`);
2876
3026
  e.blank();
2877
- }(o, e, a), function(e, t, n) {
2878
- const o = t.getCoords(), r = n?.getCoords() ?? Do(o), s = t.getSheet(), a = s.getRange({
3027
+ }(o, e, l), function(e, t, n) {
3028
+ const o = t.getCoords(), r = n?.getCoords() ?? or(o), s = t.getSheet(), l = s.getRange({
2879
3029
  rowStart: o.rowIndex,
2880
3030
  rowEnd: o.rowIndex,
2881
3031
  colStart: r.colStart,
2882
3032
  colEnd: r.colEnd
2883
- }), l = s.getRange({
3033
+ }), a = s.getRange({
2884
3034
  rowStart: r.rowStart,
2885
3035
  rowEnd: r.rowEnd,
2886
3036
  colStart: o.colIndex,
2887
3037
  colEnd: o.colIndex
2888
- }), i = [Vo(a, "row", o.colIndex), Vo(l, "column", o.rowIndex)].filter((e) => null !== e);
3038
+ }), i = [rr(l, "row", o.colIndex), rr(a, "column", o.rowIndex)].filter((e) => null !== e);
2889
3039
  if (0 === i.length) return;
2890
3040
  const c = i.reduce((e, t) => t.share > e.share ? t : e), u = "row" === c.axis ? o.colIndex : o.rowIndex, g = c.segments.filter((e) => e.end >= c.start && e.start <= c.end), d = c.end - c.start + 1, h = "row" === c.axis ? s.getRange({
2891
3041
  rowStart: o.rowIndex,
@@ -2903,7 +3053,7 @@ async function Oo(e, t) {
2903
3053
  const t = u >= e.start && u <= e.end, n = e.range.getAddress();
2904
3054
  let o;
2905
3055
  if (null === e.r1c1) o = e.range.isSingleCell() ? function(e) {
2906
- const t = y(e, $.Mode.Display);
3056
+ const t = k(e, b.Mode.Display);
2907
3057
  return t ? `${t.display} typed` : "blank";
2908
3058
  }(e.range.getCell()) : e.end - e.start + 1 + " cells, no formula";
2909
3059
  else {
@@ -2914,28 +3064,28 @@ async function Oo(e, t) {
2914
3064
  address: n,
2915
3065
  detail: t ? `${o} ← this cell` : o
2916
3066
  };
2917
- }), n = Math.max(...t.map((e) => e.address.length)), o = t.slice(0, Po);
3067
+ }), n = Math.max(...t.map((e) => e.address.length)), o = t.slice(0, nr);
2918
3068
  for (const t of o) e.text(` ${t.address.padEnd(n)} ${t.detail}`);
2919
3069
  t.length > o.length && e.text(` …${t.length - o.length} more · getRegions("formula") on ${h.getAddress()} lists them`);
2920
3070
  }
2921
3071
  e.blank();
2922
- }(o, e, a), await Yn(o, e, t, {
3072
+ }(o, e, l), await yo(o, e, t, {
2923
3073
  home: e.getSheet(),
2924
3074
  subject: n,
2925
3075
  zeroPrecedents: r,
2926
- zeroDependents: r || s !== m.Null && s !== m.String
3076
+ zeroDependents: r || s !== $.Null && s !== $.String
2927
3077
  }), o.toLines().join("\n").trimEnd();
2928
3078
  }
2929
- var Po = 8, Do = (e) => ({
3079
+ var nr = 8, or = (e) => ({
2930
3080
  rowStart: e.rowIndex,
2931
3081
  rowEnd: e.rowIndex,
2932
3082
  colStart: e.colIndex,
2933
3083
  colEnd: e.colIndex
2934
3084
  });
2935
- function Vo(e, t, n) {
3085
+ function rr(e, t, n) {
2936
3086
  if (e.isSingleCell()) return null;
2937
3087
  const o = [];
2938
- for (const n of e.getRegions(Lo.Formula)) {
3088
+ for (const n of e.getRegions(er.Formula)) {
2939
3089
  const e = n.getCoords();
2940
3090
  o.push({
2941
3091
  start: "row" === t ? e.colStart : e.rowStart,
@@ -2949,25 +3099,25 @@ function Vo(e, t, n) {
2949
3099
  const r = /* @__PURE__ */ new Map();
2950
3100
  for (const e of o) r.set(e.r1c1, (r.get(e.r1c1) ?? 0) + e.end - e.start + 1);
2951
3101
  const s = [...r].sort((e, t) => t[1] - e[1]);
2952
- for (const [r, a] of s) {
2953
- if (a < 2) break;
2954
- const s = o.filter((e) => e.r1c1 === r), l = s[0].start, i = s[s.length - 1].end;
2955
- if (n < l || n > i) continue;
3102
+ for (const [r, l] of s) {
3103
+ if (l < 2) break;
3104
+ const s = o.filter((e) => e.r1c1 === r), a = s[0].start, i = s[s.length - 1].end;
3105
+ if (n < a || n > i) continue;
2956
3106
  const c = [];
2957
- let u = l;
2958
- for (const n of o) n.end < l || n.start > i || (n.start > u && c.push(Bo(e, t, u, n.start - 1)), c.push(n), u = n.end + 1);
3107
+ let u = a;
3108
+ for (const n of o) n.end < a || n.start > i || (n.start > u && c.push(sr(e, t, u, n.start - 1)), c.push(n), u = n.end + 1);
2959
3109
  return {
2960
3110
  axis: t,
2961
3111
  segments: c,
2962
3112
  key: r,
2963
- share: a,
2964
- start: l,
3113
+ share: l,
3114
+ start: a,
2965
3115
  end: i
2966
3116
  };
2967
3117
  }
2968
3118
  return null;
2969
3119
  }
2970
- function Bo(e, t, n, o) {
3120
+ function sr(e, t, n, o) {
2971
3121
  const r = e.getCoords();
2972
3122
  return {
2973
3123
  start: n,
@@ -2986,14 +3136,14 @@ function Bo(e, t, n, o) {
2986
3136
  })
2987
3137
  };
2988
3138
  }
2989
- async function Ho(e, t) {
2990
- const n = new Je();
2991
- n.h1(`Cell Range — ${gt(e)}`);
2992
- const o = jo(e);
2993
- o && n.text(`Protection: ${o}`), n.blank(), dt(n, e), function(e, t, n) {
3139
+ async function lr(e, t) {
3140
+ const n = new Ke();
3141
+ n.h1(`Cell Range — ${ft(e)}`);
3142
+ const o = Xo(e);
3143
+ o && n.text(`Protection: ${o}`), n.blank(), pt(n, e), function(e, t, n) {
2994
3144
  if (!1 === n?.profile) return;
2995
3145
  if (t.isSingleCell() || !t.isContentful()) return;
2996
- const o = B({
3146
+ const o = U({
2997
3147
  getRowCount: () => t.getRowCount(),
2998
3148
  getColumnCount: () => t.getColumnCount(),
2999
3149
  getCell: () => t.getCell(),
@@ -3004,14 +3154,14 @@ async function Ho(e, t) {
3004
3154
  e.blank();
3005
3155
  }(n, e, t);
3006
3156
  const s = function(e, t, n) {
3007
- const o = n?.mode ?? $.Mode.Display, r = n?.maxCells ?? 1e3, { rowStart: s, colStart: a } = t.getCoords(), l = t.getRowHeaders(), i = t.getColumnHeaders(), c = /* @__PURE__ */ new Map(), u = [];
3157
+ const o = n?.mode ?? b.Mode.Display, r = n?.maxCells ?? 1e3, { rowStart: s, colStart: l } = t.getCoords(), a = t.getRowHeaders(), i = t.getColumnHeaders(), c = /* @__PURE__ */ new Map(), u = [];
3008
3158
  let g = 0, d = !1;
3009
3159
  t.forEach((e, t) => {
3010
3160
  if (g >= r) return d = !0, { break: !0 };
3011
- const n = t.getCell(), s = n.getFormulaText(), a = y(n, o);
3012
- if (!a && !s) return;
3013
- const l = {
3014
- text: (a?.display ?? "").replace(/\|/g, "\\|").replace(/[\r\n]+/g, " "),
3161
+ const n = t.getCell(), s = n.getFormulaText(), l = k(n, o);
3162
+ if (!l && !s) return;
3163
+ const a = {
3164
+ text: (l?.display ?? "").replace(/\|/g, "\\|").replace(/[\r\n]+/g, " "),
3015
3165
  alignment: n.getRenderHorizontalAlignment()
3016
3166
  }, i = n.getSpill();
3017
3167
  i && u.push({
@@ -3020,7 +3170,7 @@ async function Ho(e, t) {
3020
3170
  });
3021
3171
  const { rowIndex: h, colIndex: m } = t.getCoords();
3022
3172
  let f = c.get(h);
3023
- f || (f = /* @__PURE__ */ new Map(), c.set(h, f)), f.set(m, l), g++;
3173
+ f || (f = /* @__PURE__ */ new Map(), c.set(h, f)), f.set(m, a), g++;
3024
3174
  });
3025
3175
  const h = Array.from(c.keys()).sort((e, t) => e - t), m = /* @__PURE__ */ new Set();
3026
3176
  c.forEach((e) => e.forEach((e, t) => m.add(t)));
@@ -3031,14 +3181,14 @@ async function Ho(e, t) {
3031
3181
  rowEnd: h[h.length - 1],
3032
3182
  colStart: f[0],
3033
3183
  colEnd: f[f.length - 1]
3034
- }), w = `${g} cell${1 !== g ? "s" : ""}`, S = p.toString() !== t.toString();
3035
- e.h2(`Values (${S ? `${at(p)} · ` : ""}${w})`);
3036
- const b = e.beginFrame(f.map((e) => i.at(e - a).getText()));
3184
+ }), $ = `${g} cell${1 !== g ? "s" : ""}`, w = p.toString() !== t.toString();
3185
+ e.h2(`Values (${w ? `${ut(p)} · ` : ""}${$})`);
3186
+ const y = e.beginFrame(f.map((e) => i.at(e - l).getText()));
3037
3187
  for (const e of h) {
3038
3188
  const t = c.get(e);
3039
- b.addRow(f.map((e) => t?.get(e) ?? { text: "" }), l.at(e - s).getText());
3189
+ y.addRow(f.map((e) => t?.get(e) ?? { text: "" }), a.at(e - s).getText());
3040
3190
  }
3041
- b.endFrame(), d && e.text(`…truncated at ${r} cells · narrow the address, or summarize the whole range with getStats()`);
3191
+ y.endFrame(), d && e.text(`…truncated at ${r} cells · narrow the address, or summarize the whole range with getStats()`);
3042
3192
  return e.blank(), { spills: u };
3043
3193
  }(n, e, t);
3044
3194
  return function(e, t, n) {
@@ -3053,8 +3203,8 @@ async function Ho(e, t) {
3053
3203
  }
3054
3204
  if (0 === o.length) return;
3055
3205
  e.h2("Formulas");
3056
- const s = Math.max(...o.map((e) => e.address.length)), a = Math.max(...o.map((e) => e.size.length));
3057
- for (const t of o) e.text(` ${t.address.padEnd(s)} ${t.size.padEnd(a)} ${t.formula}`);
3206
+ const s = Math.max(...o.map((e) => e.address.length)), l = Math.max(...o.map((e) => e.size.length));
3207
+ for (const t of o) e.text(` ${t.address.padEnd(s)} ${t.size.padEnd(l)} ${t.formula}`);
3058
3208
  e.blank();
3059
3209
  }(n, e, t), function(e, t) {
3060
3210
  if (0 === t.length) return;
@@ -3062,55 +3212,55 @@ async function Ho(e, t) {
3062
3212
  const n = Math.max(...t.map((e) => e.address.length));
3063
3213
  for (const { address: o, valuesRange: r } of t) e.text(` ${o.padEnd(n)} ${r}`);
3064
3214
  e.blank();
3065
- }(n, s.spills), await jt(n, e), cn(n, e.getMovables()), Nt(n, "Conditional Formats", e.getConditionalFormats(), De), Nt(n, "Data Validations", e.getDataValidations(), Ve), await Yn(n, e, t, {
3215
+ }(n, s.spills), await Lt(n, e), En(n, e.getMovables()), Tt(n, "Conditional Formats", e.getConditionalFormats(), _e), Tt(n, "Data Validations", e.getDataValidations(), ze), await yo(n, e, t, {
3066
3216
  home: e.getSheet(),
3067
3217
  subject: e
3068
3218
  }), n.toLines().join("\n").trimEnd();
3069
3219
  }
3070
- function _o(e) {
3071
- const t = new Je(), n = e.getRanges();
3072
- t.h1(`Conditional Format — ${ut(n)}`), t.blank(), t.fact(`Order: ${e.getIndex() + 1}`);
3220
+ function ar(e) {
3221
+ const t = new Ke(), n = e.getRanges();
3222
+ t.h1(`Conditional Format — ${mt(n)}`), t.blank(), t.fact(`Order: ${e.getIndex() + 1}`);
3073
3223
  const o = e.getScale();
3074
- if (o) t.fact(`Rule: ${Oe(o)}`);
3224
+ if (o) t.fact(`Rule: ${Be(o)}`);
3075
3225
  else {
3076
3226
  const n = e.getCondition();
3077
3227
  t.fact(`Rule: ${n?.toString() || "none — this rule tests nothing"}`);
3078
- const o = Ae(e.getStyle());
3228
+ const o = De(e.getStyle());
3079
3229
  o && t.fact(`Format: ${o}`);
3080
3230
  }
3081
3231
  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();
3082
3232
  }
3083
- function Uo(e) {
3084
- const t = new Je();
3233
+ function ir(e) {
3234
+ const t = new Ke();
3085
3235
  t.h1("Counts");
3086
3236
  let n = !1;
3087
3237
  for (const [o, r] of Object.entries(e)) r > 0 && (t.fact(`${o}: ${r}`), n = !0);
3088
3238
  return n || t.fact("None"), t.toLines().join("\n").trimEnd();
3089
3239
  }
3090
- function zo(e) {
3091
- const t = new Je(), n = e.getRanges();
3092
- t.h1(`Data Validation — ${ut(n)}`), t.blank();
3240
+ function cr(e) {
3241
+ const t = new Ke(), n = e.getRanges();
3242
+ t.h1(`Data Validation — ${mt(n)}`), t.blank();
3093
3243
  const o = e.getCondition();
3094
3244
  t.fact(`Rule: ${o?.toString() || "none — anything is accepted here"}`);
3095
- const r = Be(o);
3245
+ const r = Ue(o);
3096
3246
  r && t.fact(`Allowed: ${r}`), t.fact("Blanks: " + (e.isIncludeBlanks() ? "allowed" : "rejected"));
3097
3247
  const s = e.getAlertStyle();
3098
- if (t.fact(`Alert: ${s}${s === l.AlertStyle.Stop ? " — the entry is refused" : " — the entry is accepted anyway"}`), e.isShowAlertMessage()) {
3099
- const n = Wo(e.getAlertTitle(), e.getAlertMessage());
3248
+ if (t.fact(`Alert: ${s}${s === a.AlertStyle.Stop ? " — the entry is refused" : " — the entry is accepted anyway"}`), e.isShowAlertMessage()) {
3249
+ const n = ur(e.getAlertTitle(), e.getAlertMessage());
3100
3250
  n && t.fact(`Alert Message: ${n}`);
3101
3251
  }
3102
3252
  if (e.isShowPromptMessage()) {
3103
- const n = Wo(e.getPromptTitle(), e.getPromptMessage());
3253
+ const n = ur(e.getPromptTitle(), e.getPromptMessage());
3104
3254
  n && t.fact(`Prompt: ${n}`);
3105
3255
  }
3106
3256
  return e.isHideDropdown() && t.fact("Dropdown: hidden"), t.fact(`Cells: ${n.size}`), t.toLines().join("\n").trimEnd();
3107
3257
  }
3108
- var Wo = (e, t) => {
3258
+ var ur = (e, t) => {
3109
3259
  const n = [e?.trim(), t?.trim()].filter(Boolean);
3110
3260
  return n.length > 0 ? n.join(" — ") : null;
3111
- }, qo = "function", Jo = "named", Go = "tableReference", Xo = "tableColumn", Zo = "externalReference", Ko = [["isReferenceOnly", "reference-only"], ["isVolatile", "volatile"]];
3112
- var Qo = (e, t) => e ? ` (${lt(e)}!${t})` : "";
3113
- function Yo(e, t, n, o) {
3261
+ }, gr = "function", dr = "named", hr = "tableReference", mr = "tableColumn", fr = "externalReference", pr = [["isReferenceOnly", "reference-only"], ["isVolatile", "volatile"]];
3262
+ var $r = (e, t) => e ? ` (${gt(e)}!${t})` : "";
3263
+ function wr(e, t, n, o) {
3114
3264
  if ("external" === e) return "another workbook — not resolvable from here";
3115
3265
  if (!n) return "";
3116
3266
  switch (e) {
@@ -3121,17 +3271,17 @@ function Yo(e, t, n, o) {
3121
3271
  case "named": return function(e, t) {
3122
3272
  const n = t.getNames(), o = n.getByName(e) ?? n.getByName(e, !0);
3123
3273
  if (o) {
3124
- const e = Qo(o.getScope(), o.getName()), t = o.getRanges?.();
3274
+ const e = $r(o.getScope(), o.getName()), t = o.getRanges?.();
3125
3275
  return !t || t.isInvalid() ? `defined name — reference does not resolve${e}` : `${t.toString()}${e}`;
3126
3276
  }
3127
3277
  const r = t.getCalculation().getNamedFormulas().getByName(e);
3128
- return r ? `=${r.getExpression()}${Qo(r.getScope(), r.getName())}` : "unknown — evaluates to #NAME?";
3278
+ return r ? `=${r.getExpression()}${$r(r.getScope(), r.getName())}` : "unknown — evaluates to #NAME?";
3129
3279
  }(t, n);
3130
3280
  case "table": {
3131
3281
  const e = n.getTables().getByName(t) ?? n.getWorkbook()?.getSheets().getItems().map((e) => e.getTables().getByName(t)).find(Boolean) ?? null;
3132
3282
  return e ? ((e, t) => {
3133
3283
  const n = e.getSheet(), o = e.toString();
3134
- return !n || t && n.getName() === t.getName() || o.includes("!") ? o : `${lt(n.getName())}!${o}`;
3284
+ return !n || t && n.getName() === t.getName() || o.includes("!") ? o : `${gt(n.getName())}!${o}`;
3135
3285
  })(e.getRange(), n) : "unknown — evaluates to #NAME?";
3136
3286
  }
3137
3287
  case "column": {
@@ -3144,9 +3294,9 @@ function Yo(e, t, n, o) {
3144
3294
  }
3145
3295
  return "";
3146
3296
  }
3147
- async function er(e, t) {
3148
- const n = t?.maxTokens ?? 200, o = new Je(), r = ((e) => e.isINamed ? e : null)(e);
3149
- if (o.h1(r ? `Name — ${wt(r)}` : "Formula"), o.text(o.codespan("=" + e.getExpression())), o.blank(), r) {
3297
+ async function yr(e, t) {
3298
+ const n = t?.maxTokens ?? 200, o = new Ke(), r = ((e) => e.isINamed ? e : null)(e);
3299
+ if (o.h1(r ? `Name — ${xt(r)}` : "Formula"), o.text(o.codespan("=" + e.getExpression())), o.blank(), r) {
3150
3300
  r.isHidden() && o.fact("Hidden: true — not offered in the UI; formulas resolve it normally");
3151
3301
  const e = r.getComment();
3152
3302
  e && o.fact(`Comment: ${e}`);
@@ -3163,12 +3313,12 @@ async function er(e, t) {
3163
3313
  }
3164
3314
  if ((o = n) && "object" == typeof o && !0 === o.isIRange) return void e.fact(`Value: spills ${n.getRowCount()}×${n.getColumnCount()} — an array result`);
3165
3315
  var o;
3166
- const r = b(n);
3316
+ const r = E(n);
3167
3317
  e.fact(`Value: ${r ? r.display : "(empty)"}`);
3168
3318
  }(o, e), o.fact(`Status: ${e.getCalculationStatus()}`), e.isValid() || o.fact("Valid: false — the text did not parse as a complete expression");
3169
- const s = Ko.filter(([t]) => e[t]()).map(([, e]) => e);
3319
+ const s = pr.filter(([t]) => e[t]()).map(([, e]) => e);
3170
3320
  s.length > 0 && o.fact(`Flags: ${s.join(" · ")}`), o.blank();
3171
- const a = e.getReferences(), l = t?.context ?? a?.getSheet() ?? null, i = function(e, t) {
3321
+ const l = e.getReferences(), a = t?.context ?? l?.getSheet() ?? null, i = function(e, t) {
3172
3322
  const n = /* @__PURE__ */ new Map();
3173
3323
  let o = null;
3174
3324
  for (const r of e) {
@@ -3176,33 +3326,33 @@ async function er(e, t) {
3176
3326
  if (!e) continue;
3177
3327
  let s;
3178
3328
  switch (r.type) {
3179
- case qo:
3329
+ case gr:
3180
3330
  s = "function";
3181
3331
  break;
3182
- case Jo:
3332
+ case dr:
3183
3333
  s = "named";
3184
3334
  break;
3185
- case Go:
3335
+ case hr:
3186
3336
  s = "table", o = e;
3187
3337
  break;
3188
- case Xo:
3338
+ case mr:
3189
3339
  s = "column";
3190
3340
  break;
3191
- case Zo:
3341
+ case fr:
3192
3342
  s = "external";
3193
3343
  break;
3194
3344
  default: continue;
3195
3345
  }
3196
- const a = `${s}${e.toLowerCase()}`, l = n.get(a);
3197
- l ? l.uses++ : n.set(a, {
3346
+ const l = `${s}${e.toLowerCase()}`, a = n.get(l);
3347
+ a ? a.uses++ : n.set(l, {
3198
3348
  kind: s,
3199
3349
  text: e,
3200
3350
  uses: 1,
3201
- resolution: Yo(s, e, t, o)
3351
+ resolution: wr(s, e, t, o)
3202
3352
  });
3203
3353
  }
3204
3354
  return [...n.values()];
3205
- }(e.getTokens(), l);
3355
+ }(e.getTokens(), a);
3206
3356
  if (i.length > 0) {
3207
3357
  o.h2(`Symbols (${i.length})`);
3208
3358
  const e = o.beginFrame([
@@ -3217,12 +3367,12 @@ async function er(e, t) {
3217
3367
  String(t.uses),
3218
3368
  t.resolution
3219
3369
  ]);
3220
- e.endFrame(), l || o.text("…no sheet context — pass `context` to resolve these"), o.blank();
3370
+ e.endFrame(), a || o.text("…no sheet context — pass `context` to resolve these"), o.blank();
3221
3371
  }
3222
- if (o.h2("References"), a && 0 !== a.length) for (let e = 0; e < a.length; e++) o.text(` ${String(e).padStart(2)} ${a.at(e).getAddress()}`);
3372
+ if (o.h2("References"), l && 0 !== l.length) for (let e = 0; e < l.length; e++) o.text(` ${String(e).padStart(2)} ${l.at(e).getAddress()}`);
3223
3373
  else o.text("None");
3224
3374
  o.blank(), r && await async function(e, t) {
3225
- await t.getDirectDependents() || (e.h2("Dependents (0)"), e.text(" None — no formula references this name"), e.blank()), await Yn(e, t);
3375
+ await t.getDirectDependents() || (e.h2("Dependents (0)"), e.text(" None — no formula references this name"), e.blank()), await yo(e, t);
3226
3376
  }(o, r);
3227
3377
  const c = e.getTokens();
3228
3378
  if (o.h2("Tokens"), 0 === c.length) o.text("None");
@@ -3251,7 +3401,7 @@ async function er(e, t) {
3251
3401
  }
3252
3402
  return o.toLines().join("\n").trimEnd();
3253
3403
  }
3254
- var tr = [
3404
+ var Sr = [
3255
3405
  "Workbook_Open",
3256
3406
  "Auto_Open",
3257
3407
  "Workbook_BeforeClose",
@@ -3264,42 +3414,42 @@ var tr = [
3264
3414
  "Worksheet_Activate",
3265
3415
  "Worksheet_BeforeDoubleClick",
3266
3416
  "Worksheet_Calculate"
3267
- ], nr = (e) => {
3417
+ ], br = (e) => {
3268
3418
  const t = [];
3269
- for (const n of tr) new RegExp(`(?:Sub|Function)\\s+${n}\\b`, "i").test(e) && t.push(n);
3419
+ for (const n of Sr) new RegExp(`(?:Sub|Function)\\s+${n}\\b`, "i").test(e) && t.push(n);
3270
3420
  return t;
3271
- }, or = (e) => {
3421
+ }, xr = (e) => {
3272
3422
  try {
3273
3423
  return e.getFunctions().getItems({ type: "autoRun" }).map((e) => e.getName());
3274
3424
  } catch {
3275
3425
  return [];
3276
3426
  }
3277
- }, rr = (e) => {
3427
+ }, Cr = (e) => {
3278
3428
  const t = e.getScope();
3279
3429
  return t ? !0 === t.isISheet ? `sheet '${t.getName()}'` : "workbook" : "global";
3280
- }, sr = (e) => {
3430
+ }, kr = (e) => {
3281
3431
  const t = ((e) => e.getSource()?.trim() ?? "")(e);
3282
3432
  return {
3283
3433
  module: e,
3284
3434
  name: e.getName(),
3285
3435
  language: e.getLanguage(),
3286
- scope: rr(e),
3436
+ scope: Cr(e),
3287
3437
  body: t,
3288
3438
  lines: 0 === t.length ? 0 : t.split("\n").length,
3289
- runsInExcel: nr(t),
3290
- runsHere: or(e),
3439
+ runsInExcel: br(t),
3440
+ runsHere: xr(e),
3291
3441
  executable: !!e.toJSON().compiled
3292
3442
  };
3293
3443
  };
3294
- function ar(e) {
3444
+ function Er(e) {
3295
3445
  const t = [], n = e.getModules?.();
3296
3446
  n && t.push(...n.getItems({ language: null }));
3297
3447
  for (const n of e.getSheets().getItems()) t.push(...n.getModules().getItems({ language: null }));
3298
3448
  return t;
3299
3449
  }
3300
- function lr(e, t, n) {
3450
+ function vr(e, t, n) {
3301
3451
  if (0 === t.length) return;
3302
- const o = t.map(sr), r = o.filter((e) => e.lines > 0);
3452
+ const o = t.map(kr), r = o.filter((e) => e.lines > 0);
3303
3453
  if (0 === r.length) return e.h2("Code (none)"), e.text(`${o.length} module${1 !== o.length ? "s" : ""}, none with any source.`), void e.blank();
3304
3454
  e.h2(`Code (${r.length} module${1 !== r.length ? "s" : ""})`);
3305
3455
  const s = r.filter((e) => !e.executable);
@@ -3307,13 +3457,13 @@ function lr(e, t, n) {
3307
3457
  const t = [...new Set(s.map((e) => e.language))].sort();
3308
3458
  e.text(`SheetXL reads ${t.join(" and ")} as source only and never runs it.`), s.length === r.length && e.text("Values in this workbook were computed by whatever wrote the file, not by these modules."), e.blank();
3309
3459
  }
3310
- const a = r.filter((e) => e.runsInExcel.length > 0 || e.runsHere.length > 0);
3311
- if (a.length > 0) {
3460
+ const l = r.filter((e) => e.runsInExcel.length > 0 || e.runsHere.length > 0);
3461
+ if (l.length > 0) {
3312
3462
  e.text(e.bold("Runs on its own:"));
3313
- for (const t of a) t.runsHere.length > 0 && e.fact(`${t.name} · ${t.runsHere.join(", ")} — SheetXL ran this when the workbook loaded`), t.runsInExcel.length > 0 && e.fact(`${t.name} · ${t.runsInExcel.join(", ")} — Excel runs this on open; SheetXL did not`);
3463
+ for (const t of l) t.runsHere.length > 0 && e.fact(`${t.name} · ${t.runsHere.join(", ")} — SheetXL ran this when the workbook loaded`), t.runsInExcel.length > 0 && e.fact(`${t.name} · ${t.runsInExcel.join(", ")} — Excel runs this on open; SheetXL did not`);
3314
3464
  e.blank();
3315
3465
  }
3316
- const l = n?.maxModules ?? 40, i = r.length > l ? r.slice(0, l) : r, c = (e) => [...e.runsHere, ...e.runsInExcel].join(", "), u = i.some((e) => c(e).length > 0), g = [
3466
+ const a = n?.maxModules ?? 40, i = r.length > a ? r.slice(0, a) : r, c = (e) => [...e.runsHere, ...e.runsInExcel].join(", "), u = i.some((e) => c(e).length > 0), g = [
3317
3467
  "Module",
3318
3468
  "Language",
3319
3469
  "Scope",
@@ -3335,7 +3485,7 @@ function lr(e, t, n) {
3335
3485
  }
3336
3486
  d.endFrame(), i.length < r.length && e.text(` …and ${r.length - i.length} more · wb.getModules() renders the full view`), e.blank();
3337
3487
  }
3338
- function ir(e, t, n, o) {
3488
+ function Rr(e, t, n, o) {
3339
3489
  n(`Module — ${t.name}`), e.blank();
3340
3490
  const r = [
3341
3491
  `language: ${t.language}`,
@@ -3344,133 +3494,135 @@ function ir(e, t, n, o) {
3344
3494
  ];
3345
3495
  if (t.runsHere.length > 0 && r.push(`ran on load: ${t.runsHere.join(", ")}`), t.runsInExcel.length > 0 && r.push(`Excel runs on open: ${t.runsInExcel.join(", ")}`), e.fact(r), e.blank(), 0 === t.lines) return void e.text("No source. Excel writes an empty document module for the workbook and for each sheet whether or not anyone wrote code in it.");
3346
3496
  t.executable || e.text(`SheetXL reads ${t.language} as source only and never runs it.`), e.blank();
3347
- const s = o?.maxSourceLines ?? 200, a = t.body.split("\n"), l = a.length > s ? a.slice(0, s) : a;
3348
- e.text(e.code(l.join("\n"), t.language)), l.length < a.length && e.text(`…and ${a.length - l.length} more lines · getSource() returns the whole module`);
3497
+ const s = o?.maxSourceLines ?? 200, l = t.body.split("\n"), a = l.length > s ? l.slice(0, s) : l;
3498
+ e.text(e.code(a.join("\n"), t.language)), a.length < l.length && e.text(`…and ${l.length - a.length} more lines · getSource() returns the whole module`);
3349
3499
  }
3350
- function cr(e, t) {
3351
- const n = new Je();
3352
- return ir(n, sr(e), (e) => n.h1(e), t), n.toLines().join("\n").trimEnd();
3500
+ function Nr(e, t) {
3501
+ const n = new Ke();
3502
+ return Rr(n, kr(e), (e) => n.h1(e), t), n.toLines().join("\n").trimEnd();
3353
3503
  }
3354
- function ur(e, t) {
3355
- const n = new Je(), o = e.getItems({ language: null }) ?? [];
3504
+ function jr(e, t) {
3505
+ const n = new Ke(), o = e.getItems({ language: null }) ?? [];
3356
3506
  if (n.h1(`Modules — ${o.length} module${1 !== o.length ? "s" : ""}`), n.blank(), 0 === o.length) return n.text("None"), n.toLines().join("\n").trimEnd();
3357
- const r = o.map(sr);
3358
- lr(n, o, t);
3359
- for (const e of r) 0 !== e.lines && (ir(n, e, (e) => n.h2(e), t), n.blank());
3507
+ const r = o.map(kr);
3508
+ vr(n, o, t);
3509
+ for (const e of r) 0 !== e.lines && (Rr(n, e, (e) => n.h2(e), t), n.blank());
3360
3510
  return n.toLines().join("\n").trimEnd();
3361
3511
  }
3362
- var gr = [["formula", "Names"], ["table", "Tables"]];
3363
- async function dr(e, t) {
3364
- const n = new Je(), o = e.getItems({ includeHidden: !0 }) ?? [];
3512
+ var Ir = [["formula", "Names"], ["table", "Tables"]];
3513
+ async function Fr(e, t) {
3514
+ const n = new Ke(), o = e.getItems({ includeHidden: !0 }) ?? [];
3365
3515
  if (n.h1(`Names — ${o.length} item${1 !== o.length ? "s" : ""}`), n.blank(), 0 === o.length) return n.text("None"), n.toLines().join("\n").trimEnd();
3366
- const r = new Set(gr.map(([e]) => e));
3367
- for (const [e, r] of gr) await vt(n, o.filter((t) => t.getType() === e), {
3516
+ const r = new Set(Ir.map(([e]) => e));
3517
+ for (const [e, r] of Ir) await It(n, o.filter((t) => t.getType() === e), {
3368
3518
  ...t,
3369
3519
  heading: r,
3370
3520
  symbols: o
3371
3521
  });
3372
- const s = o.filter((e) => !r.has(e.getType())), a = [...new Set(s.map((e) => e.getType()))].sort();
3373
- for (const e of a) await vt(n, s.filter((t) => t.getType() === e), {
3522
+ const s = o.filter((e) => !r.has(e.getType())), l = [...new Set(s.map((e) => e.getType()))].sort();
3523
+ for (const e of l) await It(n, s.filter((t) => t.getType() === e), {
3374
3524
  ...t,
3375
3525
  heading: e,
3376
3526
  symbols: o
3377
3527
  });
3378
3528
  return n.toLines().join("\n").trimEnd();
3379
3529
  }
3380
- var hr = (e) => {
3530
+ var Mr = (e) => {
3381
3531
  if (!e || "object" != typeof e || Array.isArray(e)) return !1;
3382
3532
  const t = Object.getPrototypeOf(e);
3383
3533
  return t === Object.prototype || null === t;
3384
3534
  };
3385
- function mr(e, t) {
3386
- const n = t?.maxCells ?? 1e3, o = Array.isArray(e) ? e : [e], r = new Je();
3535
+ function Tr(e, t) {
3536
+ const n = t?.maxCells ?? 1e3, o = Array.isArray(e) ? e : [e], r = new Ke();
3387
3537
  if (r.h1("Records"), r.text(`Count: ${o.length}`), r.blank(), 0 === o.length) return r.text("None"), r.toLines().join("\n").trimEnd();
3388
3538
  const s = (e) => {
3389
3539
  const t = [], n = /* @__PURE__ */ new Set();
3390
3540
  for (const o of e) for (const e of Object.keys(o ?? {})) n.has(e) || (n.add(e), t.push(e));
3391
3541
  return t;
3392
- }, a = Math.max(1, s(o).length), l = k(o.length, Math.max(1, Math.floor(n / a))), i = o.length > l ? o.slice(0, l) : o, c = i.length === o.length ? s(o) : s(i);
3542
+ }, l = Math.max(1, s(o).length), a = j(o.length, Math.max(1, Math.floor(n / l))), i = o.length > a ? o.slice(0, a) : o, c = i.length === o.length ? s(o) : s(i);
3393
3543
  if (0 === c.length) return r.text("No fields"), r.toLines().join("\n").trimEnd();
3394
3544
  const u = r.beginFrame(c);
3395
- for (const e of i) u.addRow(c.map((t) => fr(e?.[t])));
3545
+ for (const e of i) u.addRow(c.map((t) => Ar(e?.[t])));
3396
3546
  return u.endFrame(), i.length < o.length && r.text(`…truncated at ${i.length} of ${o.length} records · filter, sort or aggregate the array in the expression`), r.toLines().join("\n").trimEnd();
3397
3547
  }
3398
- var fr = (e) => {
3548
+ var Ar = (e) => {
3399
3549
  if (null == e) return { text: "" };
3400
3550
  if ("function" == typeof e) return { text: "[Function]" };
3401
- if ("bigint" == typeof e || "symbol" == typeof e) return { text: $r(String(e)) };
3551
+ if ("bigint" == typeof e || "symbol" == typeof e) return { text: Or(String(e)) };
3402
3552
  if ("object" == typeof e) {
3403
3553
  if (e instanceof Date) return { text: e.toISOString() };
3404
3554
  const t = e;
3405
- if (!0 === t.isFormulaError || !0 === t.isIRichData) return { text: $r(pr(e)) };
3406
- if (hr(e) || Array.isArray(e)) {
3555
+ if (!0 === t.isFormulaError || !0 === t.isIRichData) return { text: Or(Lr(e)) };
3556
+ if (Mr(e) || Array.isArray(e)) {
3407
3557
  let t;
3408
3558
  try {
3409
3559
  t = JSON.stringify(e) ?? String(e);
3410
3560
  } catch {
3411
3561
  t = "[circular]";
3412
3562
  }
3413
- return { text: $r(t) };
3563
+ return { text: Or(t) };
3414
3564
  }
3415
- return { text: $r(String(e)) };
3565
+ return { text: Or(String(e)) };
3416
3566
  }
3417
- const t = $r(pr(e).replace(/[\r\n]+/g, " "));
3567
+ const t = Or(Lr(e).replace(/[\r\n]+/g, " "));
3418
3568
  return "number" == typeof e ? {
3419
3569
  text: t,
3420
3570
  alignment: "right"
3421
3571
  } : { text: t };
3422
- }, pr = (e) => {
3572
+ }, Lr = (e) => {
3423
3573
  try {
3424
- return b(e)?.match ?? String(e);
3574
+ return E(e)?.match ?? String(e);
3425
3575
  } catch {
3426
3576
  return String(e);
3427
3577
  }
3428
- }, $r = (e) => e.length > 80 ? `${e.slice(0, 79)}…` : e;
3429
- function wr(e, t) {
3430
- const n = e.length, o = k(n, t?.maxRanges ?? 100), r = Math.min(n, o), s = [];
3578
+ }, Or = (e) => e.length > 80 ? `${e.slice(0, 79)}…` : e;
3579
+ function Pr(e, t) {
3580
+ const n = e.length, o = j(n, t?.maxRanges ?? 100), r = Math.min(n, o), s = [];
3431
3581
  for (let t = 0; t < r; t++) {
3432
3582
  const n = e.at(t);
3433
3583
  s.push({
3434
- ...go(n),
3435
- detail: [ho(n), co(n)].filter(Boolean).join(" ")
3584
+ ...Fo(n),
3585
+ detail: [Mo(n), jo(n)].filter(Boolean).join(" ")
3436
3586
  });
3437
3587
  }
3438
- const a = s.filter((e) => !e.isName), l = a.length > 0 && a.some((e) => e.sheet !== a[0].sheet), i = a.length > 0 ? a[0].sheet : e.getSheet()?.getName(), c = new Je(), u = s.length > 0 && !l && !!i;
3439
- if (c.h1(u ? `Ranges — ${lt(i)} (${n})` : `Ranges (${n})`), 0 === s.length) return c.text("none"), c.toLines().join("\n").trimEnd();
3440
- const g = s.map((e) => l && !e.isName ? `${lt(e.sheet)}!${e.address}` : e.address), d = Math.max(...g.map((e) => e.length));
3588
+ const l = s.filter((e) => !e.isName), a = l.length > 0 && l.some((e) => e.sheet !== l[0].sheet), i = l.length > 0 ? l[0].sheet : e.getSheet()?.getName(), c = new Ke(), u = s.length > 0 && !a && !!i;
3589
+ if (c.h1(u ? `Ranges — ${gt(i)} (${n})` : `Ranges (${n})`), 0 === s.length) return c.text("none"), c.toLines().join("\n").trimEnd();
3590
+ const g = s.map((e) => a && !e.isName ? `${gt(e.sheet)}!${e.address}` : e.address), d = Math.max(...g.map((e) => e.length));
3441
3591
  for (let e = 0; e < s.length; e++) c.text(` ${g[e].padEnd(d)} ${s[e].detail}`.trimEnd());
3442
3592
  return r < n && c.text(` …and ${n - r} more · loop the collection in code to see them all`), c.toLines().join("\n").trimEnd();
3443
3593
  }
3444
- var Sr = (e) => /<location\b[^>]*?\sref="([^"]*)"/.exec(e.getXML() ?? "")?.[1] ?? "";
3445
- async function yr(e, t) {
3446
- const n = new Je(), o = e.getSelectedRange(), r = e.getUsedRange();
3447
- n.h1(`Sheet — ${lt(e.getName())}${function(e) {
3594
+ var Dr = (e) => /<location\b[^>]*?\sref="([^"]*)"/.exec(e.getXML() ?? "")?.[1] ?? "";
3595
+ async function Vr(e, t) {
3596
+ const n = new Ke(), o = e.getSelectedRange(), r = e.getUsedRange();
3597
+ n.h1(`Sheet — ${gt(e.getName())}${function(e) {
3448
3598
  const t = e.getWorkbook();
3449
3599
  let n = "";
3450
3600
  t && t.getSelectedSheet()?.getId() === e.getId() && (n += " (selected)");
3451
3601
  const o = e.getVisibility();
3452
- o === g.Visibility.Hidden ? n += " (hidden)" : o === g.Visibility.VeryHidden && (n += " (very hidden)");
3602
+ o === d.Visibility.Hidden ? n += " (hidden)" : o === d.Visibility.VeryHidden && (n += " (very hidden)");
3453
3603
  e.getProtection().isLocked() && (n += " (protected)");
3454
3604
  return n;
3455
- }(e)}`), n.text(`Used: ${r ? at(r) : "empty"}`), n.text(`Selection: ${at(o)}`), n.blank();
3456
- const s = r ?? o;
3457
- dt(n, s), ht(n, s, {
3605
+ }(e)}`), n.text(`Used: ${r ? ut(r) : "empty"}`), n.text(`Selection: ${ut(o)}`);
3606
+ const s = Mt(e);
3607
+ s && n.text(`Outline: ${s}`), n.blank();
3608
+ const l = r ?? o;
3609
+ pt(n, l), $t(n, l, {
3458
3610
  profile: !0,
3459
3611
  ...t
3460
3612
  });
3461
3613
  const a = void 0 === t?.features ? null : "string" == typeof t.features ? [t.features] : [...t.features];
3462
- return a && !a.some((e) => "unlock" === e || "protection" === e) || Io(n, e), await jt(n, s), function(e, t) {
3614
+ return a && !a.some((e) => "unlock" === e || "protection" === e) || Go(n, e), await Lt(n, l), function(e, t) {
3463
3615
  if (0 === t.length) return;
3464
3616
  const n = t.map((e) => ({
3465
- address: Sr(e),
3617
+ address: Dr(e),
3466
3618
  name: e.getName()
3467
3619
  })), o = Math.max(...n.map((e) => e.address.length));
3468
3620
  e.h2(`Pivot Tables (${t.length})`);
3469
3621
  for (const t of n) e.text(o > 0 ? ` ${t.address.padEnd(o)} ${t.name}` : ` ${t.name}`);
3470
3622
  e.text(" Read-only — the cells hold the last refresh; getXML() on one is its definition."), e.blank();
3471
- }(n, e.getPivotTables().getItems()), cn(n, e.getMovables().getItems()), n.toLines().join("\n").trimEnd();
3623
+ }(n, e.getPivotTables().getItems()), En(n, e.getMovables().getItems()), n.toLines().join("\n").trimEnd();
3472
3624
  }
3473
- var br = 1e4, xr = [
3625
+ var Br = 1e4, Hr = [
3474
3626
  ["numericalCount", "Numbers"],
3475
3627
  ["sum", "Sum"],
3476
3628
  ["min", "Min"],
@@ -3478,26 +3630,26 @@ var br = 1e4, xr = [
3478
3630
  ["average", "Average"],
3479
3631
  ["stdDev", "StdDev"]
3480
3632
  ];
3481
- function Cr(t) {
3482
- const n = new Je(), o = t.getCoords(), r = o ? e.rangeToString(o) : null;
3633
+ function _r(t) {
3634
+ const n = new Ke(), o = t.getCoords(), r = o ? e.rangeToString(o) : null;
3483
3635
  n.h1(r ? `Stats — ${r}` : "Stats");
3484
3636
  const s = t.getTypedCounts();
3485
3637
  n.fact(`Cells: ${t.getSize()}`), n.fact(`Values: ${t.getCount()}`);
3486
- const a = s[m.Error] ?? 0;
3487
- a > 0 && n.fact(`Errors: ${a}`);
3488
- const l = function(e) {
3489
- const t = e.getFrequencies({ limit: br }), n = t.getUniqueCount();
3638
+ const l = s[$.Error] ?? 0;
3639
+ l > 0 && n.fact(`Errors: ${l}`);
3640
+ const a = function(e) {
3641
+ const t = e.getFrequencies({ limit: Br }), n = t.getUniqueCount();
3490
3642
  if (0 === n) return null;
3491
- if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${br.toLocaleString("en-US")})`;
3643
+ if (t.isTruncated()) return `${n.toLocaleString("en-US")}+ (scan capped at ${Br.toLocaleString("en-US")})`;
3492
3644
  if (n === t.getTotalCount()) return `${n.toLocaleString("en-US")}, no repeats`;
3493
3645
  const o = [];
3494
3646
  for (const [e, n] of t.getValueCounts()) {
3495
3647
  const r = t.getExtent(e);
3496
3648
  o.push({
3497
- label: b(e)?.display ?? "",
3649
+ label: E(e)?.display ?? "",
3498
3650
  content: n,
3499
3651
  styled: n,
3500
- blocks: r && Er(r) === n ? [r] : []
3652
+ blocks: r && zr(r) === n ? [r] : []
3501
3653
  });
3502
3654
  }
3503
3655
  const r = {
@@ -3505,63 +3657,63 @@ function Cr(t) {
3505
3657
  maxValues: 8,
3506
3658
  recovery: "getStats().getFrequencies()"
3507
3659
  };
3508
- if (n <= 8) return `${n} · ${ue(o, r)}`;
3660
+ if (n <= 8) return `${n} · ${me(o, r)}`;
3509
3661
  const s = o.filter((e) => e.content > 1);
3510
- return `${n.toLocaleString("en-US")} · repeats ${ue(s, r)}`;
3662
+ return `${n.toLocaleString("en-US")} · repeats ${me(s, r)}`;
3511
3663
  }(t);
3512
- l && n.fact(`Distinct: ${l}`);
3664
+ a && n.fact(`Distinct: ${a}`);
3513
3665
  const i = t.getAggregates({ onError: "ignore" });
3514
- for (const [e, t] of xr) {
3666
+ for (const [e, t] of Hr) {
3515
3667
  const o = i[e];
3516
- null != o && n.fact(`${t}: ${w(o)}`);
3668
+ null != o && n.fact(`${t}: ${x(o)}`);
3517
3669
  }
3518
3670
  const c = [];
3519
- for (const [e, t] of Object.entries(s)) e !== m.Null && t && c.push(`${e.charAt(0).toUpperCase()}${e.slice(1)}: ${t}`);
3671
+ for (const [e, t] of Object.entries(s)) e !== $.Null && t && c.push(`${e.charAt(0).toUpperCase()}${e.slice(1)}: ${t}`);
3520
3672
  return c.length > 0 && (n.blank(), n.h2("Type"), n.fact(c)), n.toLines().join("\n").trimEnd();
3521
3673
  }
3522
- var Er = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
3523
- function kr(e) {
3524
- const t = new Je();
3674
+ var zr = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1);
3675
+ function Ur(e) {
3676
+ const t = new Ke();
3525
3677
  t.h1("Style"), t.text(`Named: ${e.getNamed().getName()}`), t.blank();
3526
3678
  const n = e.toJSON(), o = n ? Object.entries(n).filter(([, e]) => void 0 !== e) : [];
3527
3679
  if (0 === o.length) t.fact("No direct styling (inherits the named style)");
3528
3680
  else for (const [e, n] of o) t.fact(`${e}: ${t.codespan("string" == typeof n ? n : JSON.stringify(n))}`);
3529
3681
  return t.toLines().join("\n").trimEnd();
3530
3682
  }
3531
- function vr(e, t) {
3532
- const n = t?.maxCells ?? 1e3, o = Rr(e) ? e.getValues() : e, r = o.length, s = o.reduce((e, t) => Math.max(e, t?.length ?? 0), 0), a = new Je();
3533
- if (a.h1("Values"), a.text(`Size: ${r}×${s}`), a.blank(), 0 === r || 0 === s) return a.text("None"), a.toLines().join("\n").trimEnd();
3534
- const l = k(r, Math.max(1, Math.floor(n / s))), i = r > l ? o.slice(0, l) : o, c = a.beginFrame(new Array(s).fill(""));
3535
- for (const e of i) c.addRow(Array.from({ length: s }, (t, n) => Nr(e?.[n])));
3536
- return c.endFrame(), i.length < r && a.text(`…truncated at ${i.length} of ${r} rows · slice or aggregate in the expression before returning it`), a.toLines().join("\n").trimEnd();
3683
+ function Wr(e, t) {
3684
+ const n = t?.maxCells ?? 1e3, o = Jr(e) ? e.getValues() : e, r = o.length, s = o.reduce((e, t) => Math.max(e, t?.length ?? 0), 0), l = new Ke();
3685
+ if (l.h1("Values"), l.text(`Size: ${r}×${s}`), l.blank(), 0 === r || 0 === s) return l.text("None"), l.toLines().join("\n").trimEnd();
3686
+ const a = j(r, Math.max(1, Math.floor(n / s))), i = r > a ? o.slice(0, a) : o, c = l.beginFrame(new Array(s).fill(""));
3687
+ for (const e of i) c.addRow(Array.from({ length: s }, (t, n) => qr(e?.[n])));
3688
+ return c.endFrame(), i.length < r && l.text(`…truncated at ${i.length} of ${r} rows · slice or aggregate in the expression before returning it`), l.toLines().join("\n").trimEnd();
3537
3689
  }
3538
- var Rr = (e) => !!e && "object" == typeof e && !0 === e.isIRange, Nr = (e) => {
3690
+ var Jr = (e) => !!e && "object" == typeof e && !0 === e.isIRange, qr = (e) => {
3539
3691
  if (null == e) return { text: "" };
3540
- const t = (b(e)?.display ?? "").replace(/[\r\n]+/g, " ");
3692
+ const t = (E(e)?.display ?? "").replace(/[\r\n]+/g, " ");
3541
3693
  return "number" == typeof e ? {
3542
3694
  text: t,
3543
3695
  alignment: "right"
3544
3696
  } : { text: t };
3545
- }, Ir = r.Feature, jr = [
3546
- [Ir.Font, "fonts"],
3547
- [Ir.NumberFormat, "formats"],
3548
- [Ir.Fill, "fills"],
3549
- [Ir.Borders, "borders"],
3550
- [Ir.Alignment, "alignments"]
3697
+ }, Gr = r.Feature, Xr = [
3698
+ [Gr.Font, "fonts"],
3699
+ [Gr.NumberFormat, "formats"],
3700
+ [Gr.Fill, "fills"],
3701
+ [Gr.Borders, "borders"],
3702
+ [Gr.Alignment, "alignments"]
3551
3703
  ];
3552
- async function Fr(e, t) {
3553
- const n = new Je();
3704
+ async function Zr(e, t) {
3705
+ const n = new Ke();
3554
3706
  n.h1(`Workbook — ${e.getName() ?? "Untitled"}`), n.text(`Locale: ${e.getRuntime().getLocale()}`);
3555
3707
  const r = e.getCalculation();
3556
3708
  r.getStatus() === o.Status.Off ? n.text("Calculation: off — formulas have not been evaluated; values are as loaded. wb.getCalculation().calculate() evaluates them") : r.getStatus() === o.Status.Error ? n.text("Calculation: error — the engine failed to start; values are as loaded. wb.getCalculation().start() tries again") : r.getCalculationMode() === o.CalculationMode.Manual && n.text("Calculation: manual — values are as of the last calculation. wb.getCalculation().calculate() refreshes them");
3557
- const s = Co(e.getProtection());
3709
+ const s = _o(e.getProtection());
3558
3710
  s && n.text(`Protection: ${s}`), n.blank();
3559
- const a = e.getSheets().getItems({ visibility: g.Visibility.VeryHidden }), l = e.getSelectedSheet(), i = e.getStyles().getNormal(), c = [];
3560
- for (const e of a) {
3561
- const t = Mr(e, i);
3711
+ const l = e.getSheets().getItems({ visibility: d.Visibility.VeryHidden }), a = e.getSelectedSheet(), i = e.getStyles().getNormal(), c = [];
3712
+ for (const e of l) {
3713
+ const t = Kr(e, i);
3562
3714
  c.push({
3563
3715
  sheet: e,
3564
- label: Dr(e, e.getId() === l.getId()),
3716
+ label: rs(e, e.getId() === a.getId()),
3565
3717
  counts: t.counts,
3566
3718
  lines: t.lines,
3567
3719
  formulaSignature: t.formulaSignature
@@ -3574,22 +3726,22 @@ async function Fr(e, t) {
3574
3726
  t ? t.push(e) : u.set(e.formulaSignature, [e]);
3575
3727
  }
3576
3728
  for (const e of u.values()) if (!(e.length < 2)) for (const t of e) {
3577
- const n = e.filter((e) => e !== t).map((e) => lt(e.sheet.getName()));
3729
+ const n = e.filter((e) => e !== t).map((e) => gt(e.sheet.getName()));
3578
3730
  t.lines.push({
3579
3731
  label: "twin of",
3580
3732
  extent: n.join(", "),
3581
3733
  detail: ""
3582
3734
  });
3583
3735
  }
3584
- let d = c;
3736
+ let g = c;
3585
3737
  if (c.length > 250) {
3586
- d = c.slice(0, 250);
3587
- const e = c.find((e) => e.sheet.getId() === l.getId());
3588
- e && !d.includes(e) && (d[d.length - 1] = e);
3738
+ g = c.slice(0, 250);
3739
+ const e = c.find((e) => e.sheet.getId() === a.getId());
3740
+ e && !g.includes(e) && (g[g.length - 1] = e);
3589
3741
  }
3590
3742
  n.h2(`Sheets (${c.length})`), n.blank();
3591
- const h = d.flatMap((e) => e.lines).filter((e) => e.detail), m = Math.max(9, ...d.flatMap((e) => e.lines).map((e) => e.label.length)) + 1, f = Math.max(0, ...h.map((e) => e.extent.length)) + 2;
3592
- for (const e of d) {
3743
+ const h = g.flatMap((e) => e.lines).filter((e) => e.detail), m = Math.max(9, ...g.flatMap((e) => e.lines).map((e) => e.label.length)) + 1, f = Math.max(0, ...h.map((e) => e.extent.length)) + 2;
3744
+ for (const e of g) {
3593
3745
  n.h3(e.label), 0 === e.lines.length && n.text(" empty");
3594
3746
  for (const t of e.lines) {
3595
3747
  const e = t.detail ? ` ${t.label.padEnd(m)}${t.extent.padEnd(f)}${t.detail}` : ` ${t.label.padEnd(m)}${t.extent}`;
@@ -3597,142 +3749,154 @@ async function Fr(e, t) {
3597
3749
  }
3598
3750
  n.blank();
3599
3751
  }
3600
- return d.length < c.length && (n.text(`…and ${c.length - d.length} more sheets · wb.getSheets().getItems() lists all`), n.blank()), Vr(n, "Errors", c, Ir.Error), Vr(n, "Calc Failures", c, Ir.CalcError), Vr(n, "Circular References", c, Ir.Circular), await vt(n, e.getNames().getItems({
3752
+ return g.length < c.length && (n.text(`…and ${c.length - g.length} more sheets · wb.getSheets().getItems() lists all`), n.blank()), ss(n, "Errors", c, Gr.Error), ss(n, "Calc Failures", c, Gr.CalcError), ss(n, "Circular References", c, Gr.Circular), await It(n, e.getNames().getItems({
3601
3753
  type: "formula",
3602
3754
  includeHidden: !0
3603
3755
  }) ?? [], {
3604
3756
  maxNames: t?.maxNames ?? 30,
3605
3757
  recovery: "wb.getNames() renders the full view",
3606
3758
  symbols: e.getNames().getItems({ includeHidden: !0 }) ?? []
3607
- }), lr(n, ar(e), t), n.toLines().join("\n").trimEnd();
3759
+ }), vr(n, Er(e), t), n.toLines().join("\n").trimEnd();
3608
3760
  }
3609
- function Mr(e, t) {
3761
+ function Kr(e, t) {
3610
3762
  const n = e.getUsedRange();
3611
3763
  if (!n) return {
3612
3764
  counts: null,
3613
- lines: [...Tr(e), ...Ar(e)],
3765
+ lines: [
3766
+ ...Yr(e),
3767
+ ...Qr(e),
3768
+ ...es(e)
3769
+ ],
3614
3770
  formulaRegions: 0,
3615
3771
  formulaSignature: ""
3616
3772
  };
3617
3773
  const o = n.getCounts([
3618
- Ir.Contentful,
3619
- Ir.Formula,
3620
- Ir.Error,
3621
- Ir.CalcError,
3622
- Ir.Circular,
3623
- Ir.Table
3624
- ]), r = [], s = mt(n), a = [...n.getRegions(Ir.Formula)];
3774
+ Gr.Contentful,
3775
+ Gr.Formula,
3776
+ Gr.Error,
3777
+ Gr.CalcError,
3778
+ Gr.Circular,
3779
+ Gr.Table
3780
+ ]), r = [], s = wt(n), l = [...n.getRegions(Gr.Formula)];
3625
3781
  if (s.length > 0) {
3626
3782
  const e = function(e, t) {
3627
- const n = ve(e, t);
3628
- return 0 === n.length ? null : n.map(([e, t]) => `${e} ×${le(t)}`).join(" · ");
3629
- }(n, a);
3783
+ const n = Ie(e, t);
3784
+ return 0 === n.length ? null : n.map(([e, t]) => `${e} ×${ge(t)}`).join(" · ");
3785
+ }(n, l);
3630
3786
  r.push({
3631
3787
  label: "content",
3632
- extent: Or(s),
3788
+ extent: ns(s),
3633
3789
  detail: [
3634
- Pr(o[Ir.Contentful] ?? 0, "cell"),
3635
- Pr(s.length, "block"),
3790
+ os(o[Gr.Contentful] ?? 0, "cell"),
3791
+ os(s.length, "block"),
3636
3792
  e,
3637
- `${it(n)} lists the blocks`
3793
+ `${dt(n)} lists the blocks`
3638
3794
  ].filter(Boolean).join(" · ")
3639
3795
  });
3640
3796
  }
3641
- let l = "";
3642
- if (a.length > 0) {
3797
+ let a = "";
3798
+ if (l.length > 0) {
3643
3799
  const e = /* @__PURE__ */ new Set(), t = [];
3644
- for (const n of a) {
3800
+ for (const n of l) {
3645
3801
  const o = n.getCell().getFormulaText({ r1c1: !0 }) ?? "";
3646
3802
  e.add(o), t.push(`${n.toString()}${o}`);
3647
3803
  }
3648
- l = t.sort().join("\n"), r.push({
3804
+ a = t.sort().join("\n"), r.push({
3649
3805
  label: "formula",
3650
- extent: Or(a),
3806
+ extent: ns(l),
3651
3807
  detail: [
3652
- Pr(o[Ir.Formula] ?? 0, "cell"),
3653
- Pr(a.length, "region"),
3808
+ os(o[Gr.Formula] ?? 0, "cell"),
3809
+ os(l.length, "region"),
3654
3810
  `${e.size} distinct`
3655
3811
  ].join(" · ")
3656
3812
  });
3657
3813
  }
3658
3814
  for (const [e, t] of [
3659
- [Ir.Error, "errors"],
3660
- [Ir.CalcError, "calc failures"],
3661
- [Ir.Circular, "circular"]
3815
+ [Gr.Error, "errors"],
3816
+ [Gr.CalcError, "calc failures"],
3817
+ [Gr.Circular, "circular"]
3662
3818
  ]) {
3663
3819
  const s = o[e] ?? 0;
3664
3820
  if (0 === s) continue;
3665
- const a = [...n.getRegions(e)];
3821
+ const l = [...n.getRegions(e)];
3666
3822
  r.push({
3667
3823
  label: t,
3668
- extent: Or(a),
3669
- detail: [Pr(s, "cell"), Pr(a.length, "region")].join(" · ")
3824
+ extent: ns(l),
3825
+ detail: [os(s, "cell"), os(l.length, "region")].join(" · ")
3670
3826
  });
3671
3827
  }
3672
3828
  const i = n.getTables();
3673
3829
  i.length > 0 && r.push({
3674
3830
  label: "tables",
3675
- extent: Or(i.map((e) => e.getRange())),
3831
+ extent: ns(i.map((e) => e.getRange())),
3676
3832
  detail: [
3677
- Pr(o[Ir.Table] ?? 0, "cell"),
3678
- Pr(i.length, "table"),
3679
- Lr(i.map((e) => e.getName()))
3833
+ os(o[Gr.Table] ?? 0, "cell"),
3834
+ os(i.length, "table"),
3835
+ ts(i.map((e) => e.getName()))
3680
3836
  ].join(" · ")
3681
3837
  });
3682
3838
  const c = e.getPivotTables().getItems();
3683
3839
  c.length > 0 && r.push({
3684
3840
  label: "pivots",
3685
3841
  extent: String(c.length),
3686
- detail: Lr(c.map((e) => e.getName()))
3687
- }), r.push(...Tr(e));
3842
+ detail: ts(c.map((e) => e.getName()))
3843
+ }), r.push(...Yr(e));
3688
3844
  const u = s.map((e) => e.getCoords()), g = [];
3689
- for (const [n, o] of jr) {
3690
- const r = Ee(e, n, t, { content: u })?.distinct ?? 0;
3845
+ for (const [n, o] of Xr) {
3846
+ const r = Ne(e, n, t, { content: u })?.distinct ?? 0;
3691
3847
  r > 0 && g.push(`${o} ${r}`);
3692
3848
  }
3693
3849
  return g.length > 0 && r.push({
3694
3850
  label: "style",
3695
3851
  extent: n.toString(),
3696
3852
  detail: g.join(" · ")
3697
- }), r.push(...Ar(e)), {
3853
+ }), r.push(...Qr(e)), r.push(...es(e)), {
3698
3854
  counts: o,
3699
3855
  lines: r,
3700
- formulaRegions: a.length,
3701
- formulaSignature: l
3856
+ formulaRegions: l.length,
3857
+ formulaSignature: a
3702
3858
  };
3703
3859
  }
3704
- function Tr(e) {
3860
+ function Qr(e) {
3861
+ const t = Mt(e);
3862
+ return t ? [{
3863
+ label: "outline",
3864
+ extent: "",
3865
+ detail: t
3866
+ }] : [];
3867
+ }
3868
+ function Yr(e) {
3705
3869
  const t = [];
3706
- for (const [n, o] of ln(e.getMovables().getItems())) {
3707
- const r = tn(o), s = "chart" === n ? Lr(o.map(on)) : r.length > 0 ? `${r.length} with text` : "";
3870
+ for (const [n, o] of kn(e.getMovables().getItems())) {
3871
+ const r = wn(o), s = "chart" === n ? ts(o.map(Sn)) : r.length > 0 ? `${r.length} with text` : "";
3708
3872
  t.push({
3709
- label: an(n).toLowerCase(),
3873
+ label: Cn(n).toLowerCase(),
3710
3874
  extent: String(o.length),
3711
3875
  detail: s
3712
3876
  });
3713
- const a = r.slice(0, k(r.length, 5));
3714
- for (const e of a) t.push({
3877
+ const l = r.slice(0, j(r.length, 5));
3878
+ for (const e of l) t.push({
3715
3879
  label: "",
3716
- extent: Kt(e.movable),
3717
- detail: Yt(e) + (e.movable.isHidden() ? " (hidden)" : "")
3880
+ extent: fn(e.movable),
3881
+ detail: pn(e) + (e.movable.isHidden() ? " (hidden)" : "")
3718
3882
  });
3719
- a.length < r.length && t.push({
3883
+ l.length < r.length && t.push({
3720
3884
  label: "",
3721
3885
  extent: "",
3722
- detail: `…and ${r.length - a.length} more · wb.getSheet(${JSON.stringify(e.getName())}) quotes every one`
3886
+ detail: `…and ${r.length - l.length} more · wb.getSheet(${JSON.stringify(e.getName())}) quotes every one`
3723
3887
  });
3724
3888
  }
3725
3889
  return t;
3726
3890
  }
3727
- function Ar(e) {
3728
- const t = No(e);
3891
+ function es(e) {
3892
+ const t = qo(e);
3729
3893
  return t ? [{
3730
3894
  label: "protected",
3731
3895
  extent: t.extent,
3732
3896
  detail: t.detail
3733
3897
  }] : [];
3734
3898
  }
3735
- function Lr(e) {
3899
+ function ts(e) {
3736
3900
  const t = [];
3737
3901
  let n = 0;
3738
3902
  for (const o of e) {
@@ -3743,7 +3907,7 @@ function Lr(e) {
3743
3907
  const o = e.length - t.length;
3744
3908
  return o > 0 ? `${t.join(", ")}, +${o} more` : t.join(", ");
3745
3909
  }
3746
- function Or(t) {
3910
+ function ns(t) {
3747
3911
  let n = null;
3748
3912
  for (const e of t) {
3749
3913
  const t = e.getCoords();
@@ -3756,216 +3920,221 @@ function Or(t) {
3756
3920
  }
3757
3921
  return n ? e.rangeToString(n) ?? "" : "";
3758
3922
  }
3759
- var Pr = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`;
3760
- function Dr(e, t) {
3923
+ var os = (e, t) => `${e} ${t}${1 !== e ? "s" : ""}`;
3924
+ function rs(e, t) {
3761
3925
  const n = e.getVisibility();
3762
3926
  let o = "";
3763
- return t && (o += " (selected)"), n === g.Visibility.Hidden ? o += " (hidden)" : n === g.Visibility.VeryHidden && (o += " (very hidden)"), e.getProtection().isLocked() && (o += " (protected)"), `${lt(e.getName())}${o}`;
3927
+ return t && (o += " (selected)"), n === d.Visibility.Hidden ? o += " (hidden)" : n === d.Visibility.VeryHidden && (o += " (very hidden)"), e.getProtection().isLocked() && (o += " (protected)"), `${gt(e.getName())}${o}`;
3764
3928
  }
3765
- function Vr(t, n, o, r) {
3766
- const s = o.reduce((e, t) => e + (t.counts?.[r] ?? 0), 0), a = r === Ir.Error ? o.flatMap((e) => function(e) {
3929
+ function ss(t, n, o, r) {
3930
+ const s = o.reduce((e, t) => e + (t.counts?.[r] ?? 0), 0), l = r === Gr.Error ? o.flatMap((e) => function(e) {
3767
3931
  const t = [];
3768
3932
  for (const n of e.getMovables().getItems({ type: "chart" })) {
3769
- const e = Mt(n);
3933
+ const e = Pt(n);
3770
3934
  if (e) for (const o of e.getSeries()) {
3771
- const e = Dt(o);
3935
+ const e = zt(o);
3772
3936
  if (0 === e.length) continue;
3773
3937
  const r = o.getName();
3774
3938
  t.push({
3775
3939
  movable: n,
3776
- detail: `series ${r ? `"${Lt(r)}"` : "(unnamed)"} ${e.join(" · ")}`
3940
+ detail: `series ${r ? `"${Bt(r)}"` : "(unnamed)"} ${e.join(" · ")}`
3777
3941
  });
3778
3942
  }
3779
3943
  }
3780
3944
  return t;
3781
3945
  }(e.sheet)) : [];
3782
- if (0 === s && 0 === a.length) return;
3783
- const l = [];
3946
+ if (0 === s && 0 === l.length) return;
3947
+ const a = [];
3784
3948
  let i = 0;
3785
3949
  for (const e of o) {
3786
3950
  if (!e.counts?.[r]) continue;
3787
3951
  const t = e.sheet.getUsedRange();
3788
3952
  if (!t) continue;
3789
- const n = lt(e.sheet.getName());
3790
- for (const e of t.getRegions(r)) i++, l.length >= 20 || l.push({
3953
+ const n = gt(e.sheet.getName());
3954
+ for (const e of t.getRegions(r)) i++, a.length >= 20 || a.push({
3791
3955
  address: `${n}!${e.toString()}`,
3792
3956
  size: `${e.getRowCount()}×${e.getColumnCount()}`,
3793
- payload: Br(e)
3957
+ payload: ls(e)
3794
3958
  });
3795
3959
  }
3796
- const c = a.slice(0, 20);
3960
+ const c = l.slice(0, 20);
3797
3961
  for (const { movable: t, detail: n } of c) {
3798
3962
  const o = t.getRange();
3799
- l.push({
3800
- address: `${lt(o.getSheet().getName())}!${e.rangeToString(o.getCoords()) ?? ""}`,
3963
+ a.push({
3964
+ address: `${gt(o.getSheet().getName())}!${e.rangeToString(o.getCoords()) ?? ""}`,
3801
3965
  size: "chart",
3802
3966
  payload: `${t.getContent().getName?.() || "(unnamed)"} · ${n}`
3803
3967
  });
3804
3968
  }
3805
3969
  const u = [];
3806
- s > 0 && u.push(String(s)), a.length > 0 && u.push(`${a.length} in charts`), t.h2(`${n} (${u.join(" · ")})`);
3807
- const g = Math.max(0, ...l.map((e) => e.address.length)), d = Math.max(0, ...l.map((e) => e.size.length));
3808
- for (const e of l) t.text(` ${e.address.padEnd(g)} ${e.size.padEnd(d)} ${e.payload}`.trimEnd());
3809
- i > l.length - c.length && t.text(` …and ${i - (l.length - c.length)} more · getRegions('${r}') on a sheet's used range lists the rest`), a.length > c.length && t.text(` …and ${a.length - c.length} more in charts · a sheet's report lists its charts under Charts`), t.blank();
3970
+ s > 0 && u.push(String(s)), l.length > 0 && u.push(`${l.length} in charts`), t.h2(`${n} (${u.join(" · ")})`);
3971
+ const g = Math.max(0, ...a.map((e) => e.address.length)), d = Math.max(0, ...a.map((e) => e.size.length));
3972
+ for (const e of a) t.text(` ${e.address.padEnd(g)} ${e.size.padEnd(d)} ${e.payload}`.trimEnd());
3973
+ i > a.length - c.length && t.text(` …and ${i - (a.length - c.length)} more · getRegions('${r}') on a sheet's used range lists the rest`), l.length > c.length && t.text(` …and ${l.length - c.length} more in charts · a sheet's report lists its charts under Charts`), t.blank();
3810
3974
  }
3811
- function Br(e) {
3812
- const t = e.getCell(), n = y(t, $.Mode.Display)?.display ?? "", o = t.getFormulaText();
3975
+ function ls(e) {
3976
+ const t = e.getCell(), n = k(t, b.Mode.Display)?.display ?? "", o = t.getFormulaText();
3813
3977
  return o ? `${n} ${o}`.trim() : n;
3814
3978
  }
3815
- var Hr = (e, t) => !!e && "object" == typeof e && !0 === e[t], _r = {
3979
+ var as = (e, t) => !!e && "object" == typeof e && !0 === e[t], is = {
3816
3980
  kind: "protectedRanges",
3817
- is: (e) => Hr(e, "isIProtectedRangeCollection"),
3981
+ is: (e) => as(e, "isIProtectedRangeCollection"),
3818
3982
  render: (e) => {
3819
3983
  const t = e.getItems();
3820
- return 0 === t.length ? "# Unlocked Ranges (0)\nNone" : t.slice(0, Ur).map(Ao).concat(t.length > Ur ? [`…and ${t.length - Ur} more · render one at a time to see them`] : []).join("\n\n");
3984
+ return 0 === t.length ? "# Unlocked Ranges (0)\nNone" : t.slice(0, cs).map(Yo).concat(t.length > cs ? [`…and ${t.length - cs} more · render one at a time to see them`] : []).join("\n\n");
3821
3985
  }
3822
- }, Ur = 20, zr = [
3986
+ }, cs = 20, us = [
3823
3987
  {
3824
3988
  kind: "workbook",
3825
- is: (e) => Hr(e, "isIWorkbook"),
3826
- render: (e, t) => Fr(e, t)
3989
+ is: (e) => as(e, "isIWorkbook"),
3990
+ render: (e, t) => Zr(e, t)
3827
3991
  },
3828
3992
  {
3829
3993
  kind: "sheet",
3830
- is: (e) => Hr(e, "isISheet"),
3831
- render: (e, t) => yr(e, t)
3994
+ is: (e) => as(e, "isISheet"),
3995
+ render: (e, t) => Vr(e, t)
3832
3996
  },
3833
3997
  {
3834
3998
  kind: "cell",
3835
- is: (e) => Hr(e, "isICell"),
3836
- render: (e, t) => Oo(e, t)
3999
+ is: (e) => as(e, "isICell"),
4000
+ render: (e, t) => tr(e, t)
3837
4001
  },
3838
4002
  {
3839
4003
  kind: "names",
3840
- is: (e) => Hr(e, "isINamedCollection"),
3841
- render: (e, t) => dr(e, t)
4004
+ is: (e) => as(e, "isINamedCollection"),
4005
+ render: (e, t) => Fr(e, t)
3842
4006
  },
3843
4007
  {
3844
4008
  kind: "modules",
3845
- is: (e) => Hr(e, "isIModuleCollection"),
3846
- render: (e, t) => ur(e, t)
4009
+ is: (e) => as(e, "isIModuleCollection"),
4010
+ render: (e, t) => jr(e, t)
3847
4011
  },
3848
4012
  {
3849
4013
  kind: "module",
3850
- is: (e) => Hr(e, "isIModule"),
3851
- render: (e, t) => cr(e, t)
4014
+ is: (e) => as(e, "isIModule"),
4015
+ render: (e, t) => Nr(e, t)
3852
4016
  },
3853
4017
  {
3854
4018
  kind: "formula",
3855
- is: (e) => Hr(e, "isIFormula"),
3856
- render: (e, t) => er(e, t)
4019
+ is: (e) => as(e, "isIFormula"),
4020
+ render: (e, t) => yr(e, t)
3857
4021
  },
3858
4022
  {
3859
4023
  kind: "table",
3860
- is: (e) => Hr(e, "isITable"),
3861
- render: (e) => et(e)
4024
+ is: (e) => as(e, "isITable"),
4025
+ render: (e) => rt(e)
3862
4026
  },
3863
4027
  {
3864
4028
  kind: "movable",
3865
- is: (e) => Hr(e, "isIMovable"),
3866
- render: (e) => gn(e)
4029
+ is: (e) => as(e, "isIMovable"),
4030
+ render: (e) => Rn(e)
4031
+ },
4032
+ {
4033
+ kind: "shape",
4034
+ is: (e) => as(e, "isIShape"),
4035
+ render: (e) => Nn(e)
3867
4036
  },
3868
4037
  {
3869
4038
  kind: "conditionalFormat",
3870
- is: (e) => Hr(e, "isIConditionalFormat"),
3871
- render: (e) => _o(e)
4039
+ is: (e) => as(e, "isIConditionalFormat"),
4040
+ render: (e) => ar(e)
3872
4041
  },
3873
4042
  {
3874
4043
  kind: "dataValidation",
3875
- is: (e) => Hr(e, "isIDataValidation"),
3876
- render: (e) => zo(e)
4044
+ is: (e) => as(e, "isIDataValidation"),
4045
+ render: (e) => cr(e)
3877
4046
  },
3878
4047
  {
3879
4048
  kind: "protection",
3880
- is: (e) => Hr(e, "isISheetProtection") || Hr(e, "isIWorkbookProtection"),
3881
- render: (e) => To(e)
4049
+ is: (e) => as(e, "isISheetProtection") || as(e, "isIWorkbookProtection"),
4050
+ render: (e) => Qo(e)
3882
4051
  },
3883
- _r,
4052
+ is,
3884
4053
  {
3885
4054
  kind: "protectedRange",
3886
- is: (e) => Hr(e, "isIProtectedRange"),
3887
- render: (e) => Ao(e)
4055
+ is: (e) => as(e, "isIProtectedRange"),
4056
+ render: (e) => Yo(e)
3888
4057
  },
3889
4058
  {
3890
4059
  kind: "stats",
3891
- is: (e) => Hr(e, "isIRangeStats"),
3892
- render: (e) => Cr(e)
4060
+ is: (e) => as(e, "isIRangeStats"),
4061
+ render: (e) => _r(e)
3893
4062
  },
3894
4063
  {
3895
4064
  kind: "counts",
3896
- is: (e) => Hr(e, "isICellRangeCounts"),
3897
- render: (e) => Uo(e)
4065
+ is: (e) => as(e, "isICellRangeCounts"),
4066
+ render: (e) => ir(e)
3898
4067
  },
3899
4068
  {
3900
4069
  kind: "style",
3901
- is: (e) => Hr(e, "isIStyle"),
3902
- render: (e) => kr(e)
4070
+ is: (e) => as(e, "isIStyle"),
4071
+ render: (e) => Ur(e)
3903
4072
  },
3904
4073
  {
3905
4074
  kind: "regions",
3906
- is: (e) => Hr(e, "isICellRegions"),
3907
- render: (e, t) => Ke(e, t)
4075
+ is: (e) => as(e, "isICellRegions"),
4076
+ render: (e, t) => tt(e, t)
3908
4077
  },
3909
4078
  {
3910
4079
  kind: "cellRange",
3911
- is: (e) => Hr(e, "isICellRange"),
3912
- render: (e, t) => Ho(e, t)
4080
+ is: (e) => as(e, "isICellRange"),
4081
+ render: (e, t) => lr(e, t)
3913
4082
  },
3914
4083
  {
3915
4084
  kind: "ranges",
3916
- is: (e) => Hr(e, "isICellRanges"),
3917
- render: (e, t) => wr(e, t)
4085
+ is: (e) => as(e, "isICellRanges"),
4086
+ render: (e, t) => Pr(e, t)
3918
4087
  },
3919
4088
  {
3920
4089
  kind: "range",
3921
- is: (e) => Hr(e, "isIRange"),
3922
- render: (e, t) => vr(e, t)
4090
+ is: (e) => as(e, "isIRange"),
4091
+ render: (e, t) => Wr(e, t)
3923
4092
  },
3924
4093
  {
3925
4094
  kind: "values",
3926
4095
  is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Array.isArray(e)),
3927
- render: (e, t) => vr(e, t)
4096
+ render: (e, t) => Wr(e, t)
3928
4097
  },
3929
4098
  {
3930
4099
  kind: "records",
3931
- is: (e) => Array.isArray(e) && e.length > 0 && e.every(hr),
3932
- render: (e, t) => mr(e, t)
4100
+ is: (e) => Array.isArray(e) && e.length > 0 && e.every(Mr),
4101
+ render: (e, t) => Tr(e, t)
3933
4102
  },
3934
4103
  {
3935
4104
  kind: "record",
3936
- is: (e) => hr(e),
3937
- render: (e, t) => mr(e, t)
4105
+ is: (e) => Mr(e),
4106
+ render: (e, t) => Tr(e, t)
3938
4107
  },
3939
4108
  {
3940
4109
  kind: "items",
3941
- is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!Jr(e)),
4110
+ is: (e) => Array.isArray(e) && e.length > 0 && e.every((e) => !!hs(e)),
3942
4111
  render: async (e, t) => {
3943
- const n = e.length > Ur ? e.slice(0, Ur) : e, o = [];
3944
- for (const e of n) o.push(await Jr(e).render(e, t));
4112
+ const n = e.length > cs ? e.slice(0, cs) : e, o = [];
4113
+ for (const e of n) o.push(await hs(e).render(e, t));
3945
4114
  return n.length < e.length && o.push(`…and ${e.length - n.length} more · render one at a time to see them`), o.join("\n\n");
3946
4115
  }
3947
4116
  }
3948
- ], Wr = zr.map((e) => e.kind), qr = class extends Error {
4117
+ ], gs = us.map((e) => e.kind), ds = class extends Error {
3949
4118
  constructor(e) {
3950
4119
  super(e), this.name = "NoRendererError";
3951
4120
  }
3952
4121
  };
3953
- function Jr(e) {
3954
- for (const t of zr) if (t.is(e)) return t;
4122
+ function hs(e) {
4123
+ for (const t of us) if (t.is(e)) return t;
3955
4124
  return null;
3956
4125
  }
3957
- async function Gr(e, t, n) {
4126
+ async function ms(e, t, n) {
3958
4127
  await e?.getCalculation().ready();
3959
- let o = Jr(t), r = t;
4128
+ let o = hs(t), r = t;
3960
4129
  if (!o && r && "object" == typeof r && !Array.isArray(r) && "function" == typeof r[Symbol.iterator]) {
3961
4130
  const e = [];
3962
4131
  for (const t of r) if (e.push(t), e.length >= 1e3) break;
3963
- r = e, o = Jr(r);
4132
+ r = e, o = hs(r);
3964
4133
  }
3965
- if (!o) throw new qr(`No markdown renderer for this value. Renderable kinds: ${Wr.join(", ")}.`);
4134
+ if (!o) throw new ds(`No markdown renderer for this value. Renderable kinds: ${gs.join(", ")}.`);
3966
4135
  return o.render(r, n);
3967
4136
  }
3968
- async function Xr(e, t, n) {
4137
+ async function fs(e, t, n) {
3969
4138
  if (void 0 === t) return {
3970
4139
  text: void 0,
3971
4140
  rendered: !0
@@ -3976,11 +4145,11 @@ async function Xr(e, t, n) {
3976
4145
  };
3977
4146
  if (null !== t && "object" == typeof t) try {
3978
4147
  return {
3979
- text: await Gr(e, t, n),
4148
+ text: await ms(e, t, n),
3980
4149
  rendered: !0
3981
4150
  };
3982
4151
  } catch (e) {
3983
- if (!(e instanceof qr)) throw e;
4152
+ if (!(e instanceof ds)) throw e;
3984
4153
  }
3985
4154
  return function(e) {
3986
4155
  if (null === e) return {
@@ -3990,7 +4159,7 @@ async function Xr(e, t, n) {
3990
4159
  switch (typeof e) {
3991
4160
  case "number":
3992
4161
  case "boolean": return {
3993
- text: b(e)?.display ?? String(e),
4162
+ text: E(e)?.display ?? String(e),
3994
4163
  rendered: !0
3995
4164
  };
3996
4165
  case "bigint":
@@ -4005,7 +4174,7 @@ async function Xr(e, t, n) {
4005
4174
  }
4006
4175
  const t = e;
4007
4176
  if (!0 === t.isFormulaError || !0 === t.isIRichData) return {
4008
- text: b(e)?.display ?? "",
4177
+ text: E(e)?.display ?? "",
4009
4178
  rendered: !0
4010
4179
  };
4011
4180
  let n;
@@ -4020,5 +4189,5 @@ async function Xr(e, t, n) {
4020
4189
  };
4021
4190
  }(t);
4022
4191
  }
4023
- var Zr = [Fn], Kr = [Kn];
4024
- export { Mn as API_ENTRY_POINTS, $ as CellEncoding, C as GREP_FIELDS, E as GREP_FIELDS_DEFAULT, x as GrepField, Je as MarkdownBuilder, Ge as MarkdownFrameSection, qr as NoRendererError, Kr as REFERENCES, Wr as RENDERABLE_KINDS, zr as RENDERERS, fo as RENDER_OPTION_KEYS, nt as REPORTED_FEATURES, Zr as TOOLS, Hn as apiPointerFor, qn as apiSuggestionsFor, Kn as apiTool, Bn as apiTypeOf, Yn as appendDependencies, dt as appendKinds, lr as appendModules, cn as appendMovables, vt as appendNames, Ze as appendRegionList, ht as appendRegions, Nt as appendRules, jt as appendSheetObjects, Io as appendSheetProtection, Ye as appendTables, ar as collectModules, tn as collectShapeText, mt as contentfulBlocks, Y as countDates, M as describeAlignment, Be as describeAllowedValues, Kt as describeAnchor, Zn as describeApi, N as describeBorder, j as describeBorderParts, Fo as describeCellProtection, v as describeColor, De as describeConditionalFormat, Ve as describeDataValidation, at as describeExtent, R as describeFill, T as describeFont, yo as describeLock, on as describeMovableSummary, ho as describeNode, go as describeNodeLabel, co as describeNodeLabels, F as describeNumberFormat, gt as describeQualifiedExtent, wt as describeQualifiedName, ut as describeQualifiedRanges, jo as describeRangeProtection, ct as describeRanges, Ae as describeRuleStyle, He as describeRules, Oe as describeScale, Yt as describeShapeText, it as describeSheetCall, lt as describeSheetName, q as describeSums, an as describeTypeHeading, Co as describeWorkbookProtection, U as detectTotals, y as encodeCell, S as encodeFormattedNumber, w as encodeNumber, b as encodeScalar, It as findNames, En as grep, Fn as grepTool, ln as groupMovables, hr as isPlainRecord, Vn as lookupApi, st as parseFeatures, po as parseRenderOptions, Q as profileKinds, B as profileRegion, Mo as protectionPointerFor, en as readShapeText, We as regionPayload, qe as regionPayloads, Xn as renderApi, Oo as renderCell, Ho as renderCellRange, _o as renderConditionalFormat, Uo as renderCounts, zo as renderDataValidation, er as renderFormula, jn as renderGrep, Gr as renderMarkdown, cr as renderModule, ur as renderModules, gn as renderMovable, dr as renderNames, Ao as renderProtectedRange, To as renderProtection, wr as renderRanges, mr as renderRecords, Ke as renderRegions, Xr as renderResult, yr as renderSheet, Cr as renderStats, kr as renderStyle, et as renderTable, vr as renderValues, Fr as renderWorkbook, Jr as resolveRenderer, No as summarizeSheetProtection };
4192
+ var ps = [Zn], $s = [$o];
4193
+ export { Kn as API_ENTRY_POINTS, b as CellEncoding, R as GREP_FIELDS, N as GREP_FIELDS_DEFAULT, v as GrepField, Ke as MarkdownBuilder, Qe as MarkdownFrameSection, ds as NoRendererError, $s as REFERENCES, gs as RENDERABLE_KINDS, us as RENDERERS, Ao as RENDER_OPTION_KEYS, lt as REPORTED_FEATURES, ps as TOOLS, lo as apiPointerFor, go as apiSuggestionsFor, $o as apiTool, so as apiTypeOf, yo as appendDependencies, pt as appendKinds, vr as appendModules, En as appendMovables, It as appendNames, et as appendRegionList, $t as appendRegions, Tt as appendRules, gn as appendShapeFacts, Lt as appendSheetObjects, Go as appendSheetProtection, ot as appendTables, Er as collectModules, wn as collectShapeText, wt as contentfulBlocks, oe as countDates, O as describeAlignment, Ue as describeAllowedValues, fn as describeAnchor, po as describeApi, M as describeBorder, A as describeBorderParts, Zo as describeCellProtection, I as describeColor, _e as describeConditionalFormat, ze as describeDataValidation, ut as describeExtent, F as describeFill, P as describeFont, Vo as describeLock, Sn as describeMovableSummary, Mo as describeNode, Fo as describeNodeLabel, jo as describeNodeLabels, L as describeNumberFormat, Mt as describeOutline, ft as describeQualifiedExtent, xt as describeQualifiedName, mt as describeQualifiedRanges, Xo as describeRangeProtection, ht as describeRanges, De as describeRuleStyle, We as describeRules, Be as describeScale, pn as describeShapeText, dt as describeSheetCall, gt as describeSheetName, Z as describeSums, Cn as describeTypeHeading, _o as describeWorkbookProtection, q as detectTotals, k as encodeCell, C as encodeFormattedNumber, x as encodeNumber, E as encodeScalar, At as findNames, zn as grep, Zn as grepTool, kn as groupMovables, Mr as isPlainRecord, ro as lookupApi, ct as parseFeatures, Lo as parseRenderOptions, ne as profileKinds, U as profileRegion, Ko as protectionPointerFor, Yt as quoteShapeText, $n as readShapeText, Xe as regionPayload, Ze as regionPayloads, fo as renderApi, tr as renderCell, lr as renderCellRange, ar as renderConditionalFormat, ir as renderCounts, cr as renderDataValidation, yr as renderFormula, Xn as renderGrep, ms as renderMarkdown, Nr as renderModule, jr as renderModules, Rn as renderMovable, Fr as renderNames, Yo as renderProtectedRange, Qo as renderProtection, Pr as renderRanges, Tr as renderRecords, tt as renderRegions, fs as renderResult, Nn as renderShape, Vr as renderSheet, _r as renderStats, Ur as renderStyle, rt as renderTable, Wr as renderValues, Zr as renderWorkbook, hs as resolveRenderer, dn as shapeRotation, qo as summarizeSheetProtection };