@extable/core 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { D as ft, R as st, g as Q, c as _t, s as oe, r as O, m as lt, a as pt, b as mt, d as at, e as ct, t as Be, C as rt, f as Mt, h as kt, i as Wt, j as Kt, k as he, H as dt, l as ut, p as $e, n as ne, o as se, q as We, u as Oe, v as le, w as je } from "./numberIO-BMnYEoog.js";
2
- function qe(c) {
1
+ import { D as ft, R as lt, g as Y, c as Ft, s as ne, r as O, m as rt, a as pt, b as mt, d as ct, e as ht, t as $e, C as at, f as Mt, h as Rt, i as Ot, j as Kt, k as de, H as st, l as ut, p as We, n as Vt, o as se, q as le, u as Oe, v as je, w as qe, x as re, y as ze } from "./numberIO-CGTV3-KW.js";
2
+ function Ue(c) {
3
3
  const t = c.payload;
4
4
  if (!t) return null;
5
5
  const e = t.batchId;
6
6
  return typeof e == "string" && e.length ? e : null;
7
7
  }
8
- class Ue {
8
+ class Xe {
9
9
  constructor(t = 100) {
10
10
  this.applied = [], this.undone = [], this.cap = t;
11
11
  }
12
12
  enqueue(t) {
13
- const e = qe(t), i = this.applied.at(-1);
13
+ const e = Ue(t), i = this.applied.at(-1);
14
14
  for (e && i && i.batchId === e ? i.commands.push(t) : this.applied.push({ batchId: e, commands: [t] }); this.applied.length > this.cap; ) this.applied.shift();
15
15
  this.undone = [];
16
16
  }
@@ -43,7 +43,7 @@ class Ue {
43
43
  this.applied = [], this.undone = [];
44
44
  }
45
45
  }
46
- function ze(c, t) {
46
+ function Ge(c, t) {
47
47
  const e = c.getSchema(), i = c.listRows(), o = (s, l) => {
48
48
  if (!Number.isInteger(s) || !Number.isInteger(l) || s < 0 || s >= i.length || l < 0 || l >= e.columns.length) return null;
49
49
  const a = i[s], r = e.columns[l];
@@ -68,7 +68,7 @@ function ze(c, t) {
68
68
  }
69
69
  return null;
70
70
  }
71
- class Xe {
71
+ class Ye {
72
72
  constructor(t, e, i) {
73
73
  this.lockedRows = /* @__PURE__ */ new Set(), this.mode = "none", this.mode = t, this.server = e, this.user = i;
74
74
  }
@@ -109,7 +109,7 @@ class Xe {
109
109
  return new Set(this.lockedRows);
110
110
  }
111
111
  }
112
- const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "), Ge = (c) => {
112
+ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "), Qe = (c) => {
113
113
  const t = [];
114
114
  if (c)
115
115
  for (const e of c) {
@@ -117,7 +117,7 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
117
117
  !i || t.includes(i) || t.push(i);
118
118
  }
119
119
  return t.length === 0 ? t.push("en") : t.includes("en") || t.push("en"), t;
120
- }, Ye = (c, t) => {
120
+ }, Je = (c, t) => {
121
121
  const e = c.items.indexOf(t);
122
122
  if (e !== -1)
123
123
  return e;
@@ -128,7 +128,7 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
128
128
  return null;
129
129
  const o = c.items.indexOf(i);
130
130
  return o === -1 ? null : o;
131
- }, Qe = (c, t) => {
131
+ }, Ze = (c, t) => {
132
132
  const e = xt(t);
133
133
  if (xt(c.id).includes(e))
134
134
  return !0;
@@ -138,7 +138,7 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
138
138
  return c.aliases ? Object.keys(c.aliases).some(
139
139
  (i) => xt(i).includes(e)
140
140
  ) : !1;
141
- }, Je = (c, t) => {
141
+ }, ti = (c, t) => {
142
142
  if (c.langs.length === 0)
143
143
  return 0;
144
144
  let e = Number.POSITIVE_INFINITY;
@@ -147,10 +147,10 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
147
147
  o !== -1 && o < e && (e = o);
148
148
  }
149
149
  return e;
150
- }, Ze = (c, t) => !c.langs || c.langs.length === 0 ? !0 : c.langs.some((e) => t.includes(e));
151
- class ti {
150
+ }, ei = (c, t) => !c.langs || c.langs.length === 0 ? !0 : c.langs.some((e) => t.includes(e));
151
+ class ii {
152
152
  constructor(t) {
153
- this.lists = [], this.matchers = [], this.langs = Ge(t?.langs);
153
+ this.lists = [], this.matchers = [], this.langs = Qe(t?.langs);
154
154
  }
155
155
  register(t) {
156
156
  const e = this.lists.findIndex((i) => i.id === t.id);
@@ -170,7 +170,7 @@ class ti {
170
170
  e = e.filter((n) => o.has(n.id));
171
171
  }
172
172
  const i = t?.queryText;
173
- return i && (e = e.filter((o) => Qe(o, i))), e;
173
+ return i && (e = e.filter((o) => Ze(o, i))), e;
174
174
  }
175
175
  match(t, e) {
176
176
  if (t.length === 0)
@@ -178,7 +178,7 @@ class ti {
178
178
  let i = null, o = Number.NEGATIVE_INFINITY;
179
179
  const n = e?.enabledIds ? new Set(e.enabledIds) : null;
180
180
  for (const l of this.matchers) {
181
- if (n && !n.has(l.id) || !Ze(l, this.langs))
181
+ if (n && !n.has(l.id) || !ei(l, this.langs))
182
182
  continue;
183
183
  const a = l.match(t);
184
184
  if (!a)
@@ -191,12 +191,12 @@ class ti {
191
191
  state: a.state
192
192
  });
193
193
  }
194
- const s = this.list(e).map((l) => ({ list: l, rank: Je(l, this.langs) })).filter((l) => Number.isFinite(l.rank)).sort((l, a) => l.rank - a.rank);
194
+ const s = this.list(e).map((l) => ({ list: l, rank: ti(l, this.langs) })).filter((l) => Number.isFinite(l.rank)).sort((l, a) => l.rank - a.rank);
195
195
  for (const { list: l, rank: a } of s) {
196
196
  const r = [];
197
197
  let h = !1;
198
198
  for (const p of t) {
199
- const m = Ye(l, p);
199
+ const m = Je(l, p);
200
200
  if (m === null) {
201
201
  h = !0;
202
202
  break;
@@ -244,12 +244,12 @@ class ti {
244
244
  return n >= e ? null : n;
245
245
  }
246
246
  }
247
- const ei = {
247
+ const oi = {
248
248
  id: "weekdays-en-long",
249
249
  mode: "cycle",
250
250
  langs: ["en"],
251
251
  items: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
252
- }, ii = {
252
+ }, ni = {
253
253
  id: "weekdays-en-short",
254
254
  mode: "cycle",
255
255
  langs: ["en"],
@@ -259,22 +259,22 @@ const ei = {
259
259
  Thur: "Thu",
260
260
  Thurs: "Thu"
261
261
  }
262
- }, oi = {
262
+ }, si = {
263
263
  id: "weekdays-ja-long",
264
264
  mode: "cycle",
265
265
  langs: ["ja"],
266
266
  items: ["月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日", "日曜日"]
267
- }, ni = {
267
+ }, li = {
268
268
  id: "weekdays-ja-short",
269
269
  mode: "cycle",
270
270
  langs: ["ja"],
271
271
  items: ["月曜", "火曜", "水曜", "木曜", "金曜", "土曜", "日曜"]
272
- }, si = {
272
+ }, ri = {
273
273
  id: "weekdays-ja-single",
274
274
  mode: "cycle",
275
275
  langs: ["ja"],
276
276
  items: ["月", "火", "水", "木", "金", "土", "日"]
277
- }, li = {
277
+ }, ai = {
278
278
  id: "months-en-long",
279
279
  mode: "cycle",
280
280
  langs: ["en"],
@@ -292,7 +292,7 @@ const ei = {
292
292
  "November",
293
293
  "December"
294
294
  ]
295
- }, ri = {
295
+ }, ci = {
296
296
  id: "months-en-short",
297
297
  mode: "cycle",
298
298
  langs: ["en"],
@@ -300,32 +300,32 @@ const ei = {
300
300
  aliases: {
301
301
  Sept: "Sep"
302
302
  }
303
- }, ai = {
303
+ }, hi = {
304
304
  id: "months-ja",
305
305
  mode: "cycle",
306
306
  langs: ["ja"],
307
307
  items: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
308
- }, ci = {
308
+ }, di = {
309
309
  id: "months-ja-traditional",
310
310
  mode: "cycle",
311
311
  langs: ["ja"],
312
312
  items: ["睦月", "如月", "弥生", "卯月", "皐月", "水無月", "文月", "葉月", "長月", "神無月", "霜月", "師走"]
313
- }, hi = {
313
+ }, ui = {
314
314
  id: "quarters-en",
315
315
  mode: "cycle",
316
316
  langs: ["en"],
317
317
  items: ["Q1", "Q2", "Q3", "Q4"]
318
- }, di = {
318
+ }, fi = {
319
319
  id: "quarters-ja",
320
320
  mode: "cycle",
321
321
  langs: ["ja"],
322
322
  items: ["第1四半期", "第2四半期", "第3四半期", "第4四半期"]
323
- }, ui = {
323
+ }, pi = {
324
324
  id: "zodiac-animals-ja",
325
325
  mode: "cycle",
326
326
  langs: ["ja"],
327
327
  items: ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]
328
- }, fi = {
328
+ }, mi = {
329
329
  id: "zodiac-signs-en",
330
330
  mode: "cycle",
331
331
  langs: ["en"],
@@ -343,7 +343,7 @@ const ei = {
343
343
  "Aquarius",
344
344
  "Pisces"
345
345
  ]
346
- }, pi = {
346
+ }, gi = {
347
347
  id: "zodiac-signs-ja",
348
348
  mode: "cycle",
349
349
  langs: ["ja"],
@@ -351,7 +351,7 @@ const ei = {
351
351
  aliases: {
352
352
  さそり座: "蠍座"
353
353
  }
354
- }, mi = {
354
+ }, yi = {
355
355
  id: "directions-16-en",
356
356
  mode: "cycle",
357
357
  langs: ["en"],
@@ -373,7 +373,7 @@ const ei = {
373
373
  "Northwest",
374
374
  "North-Northwest"
375
375
  ]
376
- }, gi = {
376
+ }, wi = {
377
377
  id: "directions-16-ja",
378
378
  mode: "cycle",
379
379
  langs: ["ja"],
@@ -395,7 +395,7 @@ const ei = {
395
395
  "北西",
396
396
  "北北西"
397
397
  ]
398
- }, yi = {
398
+ }, vi = {
399
399
  id: "ampm-en",
400
400
  mode: "cycle",
401
401
  langs: ["en"],
@@ -404,12 +404,12 @@ const ei = {
404
404
  "A.M.": "AM",
405
405
  "P.M.": "PM"
406
406
  }
407
- }, wi = {
407
+ }, Ci = {
408
408
  id: "ampm-ja",
409
409
  mode: "cycle",
410
410
  langs: ["ja"],
411
411
  items: ["午前", "午後"]
412
- }, vi = {
412
+ }, bi = {
413
413
  id: "seasons-en",
414
414
  mode: "cycle",
415
415
  langs: ["en"],
@@ -417,17 +417,17 @@ const ei = {
417
417
  aliases: {
418
418
  Fall: "Autumn"
419
419
  }
420
- }, Ci = {
420
+ }, xi = {
421
421
  id: "seasons-ja",
422
422
  mode: "cycle",
423
423
  langs: ["ja"],
424
424
  items: ["春", "夏", "秋", "冬"]
425
- }, bi = {
425
+ }, Si = {
426
426
  id: "solfege-ja",
427
427
  mode: "cycle",
428
428
  langs: ["ja"],
429
429
  items: ["ド", "レ", "ミ", "ファ", "ソ", "ラ", "シ"]
430
- }, xi = {
430
+ }, Mi = {
431
431
  id: "solfege-en",
432
432
  mode: "cycle",
433
433
  langs: ["en"],
@@ -436,7 +436,7 @@ const ei = {
436
436
  So: "Sol",
437
437
  Si: "Ti"
438
438
  }
439
- }, Si = {
439
+ }, Ri = {
440
440
  id: "greek-letters-en",
441
441
  mode: "cycle",
442
442
  langs: ["en"],
@@ -466,7 +466,7 @@ const ei = {
466
466
  "Psi",
467
467
  "Omega"
468
468
  ]
469
- }, Mi = {
469
+ }, ki = {
470
470
  id: "greek-letters-ja",
471
471
  mode: "cycle",
472
472
  langs: ["ja"],
@@ -496,7 +496,7 @@ const ei = {
496
496
  "プサイ",
497
497
  "オメガ"
498
498
  ]
499
- }, ki = {
499
+ }, Ii = {
500
500
  id: "greek-letters-symbols",
501
501
  mode: "cycle",
502
502
  langs: ["en", "ja"],
@@ -529,37 +529,37 @@ const ei = {
529
529
  aliases: {
530
530
  ς: "σ"
531
531
  }
532
- }, Ri = {
532
+ }, Ti = {
533
533
  id: "rokuyo-ja",
534
534
  mode: "cycle",
535
535
  langs: ["ja"],
536
536
  items: ["先勝", "友引", "先負", "仏滅", "大安", "赤口"]
537
- }, Ii = {
537
+ }, Ei = {
538
538
  id: "heavenly-stems-ja",
539
539
  mode: "finite",
540
540
  langs: ["ja"],
541
541
  items: ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"]
542
- }, Ti = {
542
+ }, Ai = {
543
543
  id: "planets-en",
544
544
  mode: "finite",
545
545
  langs: ["en"],
546
546
  items: ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
547
- }, Ei = {
547
+ }, Hi = {
548
548
  id: "planets-ja",
549
549
  mode: "finite",
550
550
  langs: ["ja"],
551
551
  items: ["水星", "金星", "地球", "火星", "木星", "土星", "天王星", "海王星"]
552
- }, Ai = {
552
+ }, Li = {
553
553
  id: "kuji-in-ja",
554
554
  mode: "finite",
555
555
  langs: ["ja"],
556
556
  items: ["臨", "兵", "闘", "者", "皆", "陣", "烈", "在", "前"]
557
- }, Hi = {
557
+ }, Di = {
558
558
  id: "eight-virtues-ja",
559
559
  mode: "finite",
560
560
  langs: ["ja"],
561
561
  items: ["仁", "義", "礼", "智", "忠", "信", "孝", "悌"]
562
- }, Li = {
562
+ }, Ki = {
563
563
  id: "element-symbols",
564
564
  mode: "finite",
565
565
  langs: ["ja", "en"],
@@ -683,7 +683,7 @@ const ei = {
683
683
  "Ts",
684
684
  "Og"
685
685
  ]
686
- }, Di = {
686
+ }, _i = {
687
687
  id: "element-names-ja",
688
688
  mode: "finite",
689
689
  langs: ["ja"],
@@ -807,7 +807,7 @@ const ei = {
807
807
  "テネシン",
808
808
  "オガネソン"
809
809
  ]
810
- }, Ki = {
810
+ }, Fi = {
811
811
  id: "shoguns-kamakura-ja",
812
812
  mode: "finite",
813
813
  langs: ["ja"],
@@ -822,7 +822,7 @@ const ei = {
822
822
  "久明親王",
823
823
  "守邦親王"
824
824
  ]
825
- }, Fi = {
825
+ }, Vi = {
826
826
  id: "shoguns-ashikaga-ja",
827
827
  mode: "finite",
828
828
  langs: ["ja"],
@@ -843,7 +843,7 @@ const ei = {
843
843
  "足利義栄",
844
844
  "足利義昭"
845
845
  ]
846
- }, _i = {
846
+ }, Ni = {
847
847
  id: "shoguns-ashikaga-given-ja",
848
848
  mode: "finite",
849
849
  langs: ["ja"],
@@ -864,7 +864,7 @@ const ei = {
864
864
  "義栄",
865
865
  "義昭"
866
866
  ]
867
- }, Vi = {
867
+ }, Pi = {
868
868
  id: "shoguns-tokugawa-ja",
869
869
  mode: "finite",
870
870
  langs: ["ja"],
@@ -885,7 +885,7 @@ const ei = {
885
885
  "徳川家茂",
886
886
  "徳川慶喜"
887
887
  ]
888
- }, Ni = {
888
+ }, Bi = {
889
889
  id: "shoguns-tokugawa-given-ja",
890
890
  mode: "finite",
891
891
  langs: ["ja"],
@@ -906,7 +906,7 @@ const ei = {
906
906
  "家茂",
907
907
  "慶喜"
908
908
  ]
909
- }, de = [
909
+ }, ue = [
910
910
  "北海道",
911
911
  "青森県",
912
912
  "岩手県",
@@ -954,7 +954,7 @@ const ei = {
954
954
  "宮崎県",
955
955
  "鹿児島県",
956
956
  "沖縄県"
957
- ], Pi = de.reduce(
957
+ ], $i = ue.reduce(
958
958
  (c, t) => {
959
959
  if (t === "北海道")
960
960
  return c;
@@ -965,13 +965,13 @@ const ei = {
965
965
  return c;
966
966
  },
967
967
  {}
968
- ), Bi = {
968
+ ), Wi = {
969
969
  id: "prefectures-ja",
970
970
  mode: "finite",
971
971
  langs: ["ja"],
972
- items: de,
973
- aliases: Pi
974
- }, $i = {
972
+ items: ue,
973
+ aliases: $i
974
+ }, Oi = {
975
975
  id: "us-states-en",
976
976
  mode: "finite",
977
977
  langs: ["en"],
@@ -1027,7 +1027,7 @@ const ei = {
1027
1027
  "Wisconsin",
1028
1028
  "Wyoming"
1029
1029
  ]
1030
- }, Wi = {
1030
+ }, ji = {
1031
1031
  id: "us-states-abbrev-en",
1032
1032
  mode: "finite",
1033
1033
  langs: ["en"],
@@ -1083,7 +1083,7 @@ const ei = {
1083
1083
  "WI",
1084
1084
  "WY"
1085
1085
  ]
1086
- }, Oi = {
1086
+ }, qi = {
1087
1087
  id: "windows-versions",
1088
1088
  mode: "finite",
1089
1089
  langs: ["ja", "en"],
@@ -1106,7 +1106,7 @@ const ei = {
1106
1106
  "Windows 10",
1107
1107
  "Windows 11"
1108
1108
  ]
1109
- }, ji = {
1109
+ }, zi = {
1110
1110
  id: "macos-versions",
1111
1111
  mode: "finite",
1112
1112
  langs: ["ja", "en"],
@@ -1134,7 +1134,7 @@ const ei = {
1134
1134
  "Sequoia",
1135
1135
  "Tahoe"
1136
1136
  ]
1137
- }, qi = {
1137
+ }, Ui = {
1138
1138
  id: "debian-codenames",
1139
1139
  mode: "finite",
1140
1140
  langs: ["ja", "en"],
@@ -1158,9 +1158,7 @@ const ei = {
1158
1158
  "bookworm",
1159
1159
  "trixie"
1160
1160
  ]
1161
- }, Ui = [
1162
- ei,
1163
- ii,
1161
+ }, Xi = [
1164
1162
  oi,
1165
1163
  ni,
1166
1164
  si,
@@ -1183,8 +1181,8 @@ const ei = {
1183
1181
  xi,
1184
1182
  Si,
1185
1183
  Mi,
1186
- ki,
1187
1184
  Ri,
1185
+ ki,
1188
1186
  Ii,
1189
1187
  Ti,
1190
1188
  Ei,
@@ -1193,22 +1191,24 @@ const ei = {
1193
1191
  Li,
1194
1192
  Di,
1195
1193
  Ki,
1196
- Fi,
1197
1194
  _i,
1195
+ Fi,
1198
1196
  Vi,
1199
1197
  Ni,
1198
+ Pi,
1200
1199
  Bi,
1201
- $i,
1202
1200
  Wi,
1203
1201
  Oi,
1204
1202
  ji,
1205
- qi
1203
+ qi,
1204
+ zi,
1205
+ Ui
1206
1206
  ], Tt = (c) => {
1207
1207
  const t = c % 100;
1208
1208
  if (t >= 11 && t <= 13) return "th";
1209
1209
  const e = c % 10;
1210
1210
  return e === 1 ? "st" : e === 2 ? "nd" : e === 3 ? "rd" : "th";
1211
- }, Vt = {
1211
+ }, Nt = {
1212
1212
  1: "first",
1213
1213
  2: "second",
1214
1214
  3: "third",
@@ -1228,7 +1228,7 @@ const ei = {
1228
1228
  17: "seventeenth",
1229
1229
  18: "eighteenth",
1230
1230
  19: "nineteenth"
1231
- }, Nt = {
1231
+ }, Pt = {
1232
1232
  20: "twentieth",
1233
1233
  30: "thirtieth",
1234
1234
  40: "fortieth",
@@ -1237,7 +1237,7 @@ const ei = {
1237
1237
  70: "seventieth",
1238
1238
  80: "eightieth",
1239
1239
  90: "ninetieth"
1240
- }, ue = {
1240
+ }, fe = {
1241
1241
  20: "twenty",
1242
1242
  30: "thirty",
1243
1243
  40: "forty",
@@ -1246,31 +1246,31 @@ const ei = {
1246
1246
  70: "seventy",
1247
1247
  80: "eighty",
1248
1248
  90: "ninety"
1249
- }, re = Object.fromEntries(
1250
- Object.entries(Vt).map(([c, t]) => [t, Number(c)])
1251
- ), zi = Object.fromEntries(
1249
+ }, ae = Object.fromEntries(
1252
1250
  Object.entries(Nt).map(([c, t]) => [t, Number(c)])
1253
- ), Xi = Object.fromEntries(
1254
- Object.entries(ue).map(([c, t]) => [t, Number(c)])
1255
- ), fe = (c) => {
1251
+ ), Gi = Object.fromEntries(
1252
+ Object.entries(Pt).map(([c, t]) => [t, Number(c)])
1253
+ ), Yi = Object.fromEntries(
1254
+ Object.entries(fe).map(([c, t]) => [t, Number(c)])
1255
+ ), pe = (c) => {
1256
1256
  const t = c.trim().toLowerCase();
1257
1257
  if (!t) return null;
1258
- const e = re[t] ?? zi[t];
1258
+ const e = ae[t] ?? Gi[t];
1259
1259
  if (e) return e;
1260
1260
  const i = t.split(/[-\s]+/);
1261
1261
  if (i.length !== 2) return null;
1262
- const o = Xi[i[0] ?? ""], n = re[i[1] ?? ""];
1262
+ const o = Yi[i[0] ?? ""], n = ae[i[1] ?? ""];
1263
1263
  return !o || !n ? null : o + n;
1264
- }, pe = (c) => {
1264
+ }, me = (c) => {
1265
1265
  if (!Number.isFinite(c) || c <= 0 || Math.floor(c) !== c) return null;
1266
- if (c <= 19) return Vt[c] ?? null;
1266
+ if (c <= 19) return Nt[c] ?? null;
1267
1267
  if (c < 100) {
1268
- if (Nt[c]) return Nt[c] ?? null;
1269
- const t = Math.floor(c / 10) * 10, e = c % 10, i = ue[t], o = Vt[e];
1268
+ if (Pt[c]) return Pt[c] ?? null;
1269
+ const t = Math.floor(c / 10) * 10, e = c % 10, i = fe[t], o = Nt[e];
1270
1270
  return !i || !o ? null : `${i}-${o}`;
1271
1271
  }
1272
1272
  return null;
1273
- }, ae = (c) => {
1273
+ }, ce = (c) => {
1274
1274
  const t = /^(\d+)(st|nd|rd|th)$/i.exec(c);
1275
1275
  if (t) {
1276
1276
  const i = Number(t[1]);
@@ -1278,14 +1278,14 @@ const ei = {
1278
1278
  const o = t[2]?.toLowerCase();
1279
1279
  return Tt(i) !== o ? null : { value: i, format: "numeric" };
1280
1280
  }
1281
- const e = fe(c);
1281
+ const e = pe(c);
1282
1282
  return e !== null ? { value: e, format: "word" } : null;
1283
- }, Gi = {
1283
+ }, Qi = {
1284
1284
  id: "ordinal-en",
1285
1285
  langs: ["en"],
1286
1286
  match(c) {
1287
1287
  if (c.length < 2) return null;
1288
- const t = c.map((n) => ae(n));
1288
+ const t = c.map((n) => ce(n));
1289
1289
  if (t.some((n) => n === null)) return null;
1290
1290
  const e = t[0].format;
1291
1291
  if (t.some((n) => n?.format !== e)) return null;
@@ -1295,29 +1295,29 @@ const ei = {
1295
1295
  return { score: 80, step: o, state: { format: e } };
1296
1296
  },
1297
1297
  createIterator(c, t) {
1298
- const e = ae(c[c.length - 1] ?? ""), i = t.state?.format ?? "numeric";
1298
+ const e = ce(c[c.length - 1] ?? ""), i = t.state?.format ?? "numeric";
1299
1299
  let o = e?.value ?? 0;
1300
1300
  return {
1301
1301
  next() {
1302
1302
  if (o += t.step, o <= 0 || !Number.isFinite(o))
1303
1303
  return { value: void 0, done: !0 };
1304
1304
  if (i === "word") {
1305
- const n = pe(o);
1305
+ const n = me(o);
1306
1306
  return n ? { value: n, done: !1 } : { value: void 0, done: !0 };
1307
1307
  }
1308
1308
  return { value: `${o}${Tt(o)}`, done: !1 };
1309
1309
  }
1310
1310
  };
1311
1311
  }
1312
- }, Yi = (c) => {
1313
- for (const t of Ui)
1314
- c.register(t);
1315
- }, Qi = (c) => {
1316
- c.registerMatch(Gi);
1317
- }, me = (c) => {
1318
- const t = c ?? ["en", "ja"], e = new ti({ langs: t });
1319
- return Yi(e), Qi(e), e;
1320
1312
  }, Ji = (c) => {
1313
+ for (const t of Xi)
1314
+ c.register(t);
1315
+ }, Zi = (c) => {
1316
+ c.registerMatch(Qi);
1317
+ }, ge = (c) => {
1318
+ const t = c ?? ["en", "ja"], e = new ii({ langs: t });
1319
+ return Ji(e), Zi(e), e;
1320
+ }, to = (c) => {
1321
1321
  let t = 0;
1322
1322
  return {
1323
1323
  next() {
@@ -1331,7 +1331,7 @@ const ei = {
1331
1331
  class G {
1332
1332
  constructor(...t) {
1333
1333
  const e = t;
1334
- this.seed = e, this.kind = e.length === 1 ? "copy" : "seed-repeat", this.iterator = Ji(e);
1334
+ this.seed = e, this.kind = e.length === 1 ? "copy" : "seed-repeat", this.iterator = to(e);
1335
1335
  }
1336
1336
  static fromSeed(t, e, i) {
1337
1337
  const o = new G(...t);
@@ -1344,11 +1344,11 @@ class G {
1344
1344
  return this;
1345
1345
  }
1346
1346
  }
1347
- const ge = 1e-9, Zi = 100, to = (c) => ({
1347
+ const ye = 1e-9, eo = 100, io = (c) => ({
1348
1348
  next() {
1349
1349
  return { value: c, done: !1 };
1350
1350
  }
1351
- }), ce = (c) => {
1351
+ }), he = (c) => {
1352
1352
  let t = 0;
1353
1353
  return {
1354
1354
  next() {
@@ -1358,28 +1358,28 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1358
1358
  return t += 1, { value: e, done: !1 };
1359
1359
  }
1360
1360
  };
1361
- }, eo = (c, t) => {
1361
+ }, oo = (c, t) => {
1362
1362
  let e = 0;
1363
1363
  return {
1364
1364
  next() {
1365
1365
  return e += 1, { value: c + t * e, done: !1 };
1366
1366
  }
1367
1367
  };
1368
- }, io = (c, t) => {
1368
+ }, no = (c, t) => {
1369
1369
  let e = 0;
1370
1370
  return {
1371
1371
  next() {
1372
1372
  return e += 1, { value: new Date(c.getTime() + t * e), done: !1 };
1373
1373
  }
1374
1374
  };
1375
- }, oo = (c, t) => {
1375
+ }, so = (c, t) => {
1376
1376
  let e = 0;
1377
1377
  return {
1378
1378
  next() {
1379
1379
  return e += 1, { value: c * t ** e, done: !1 };
1380
1380
  }
1381
1381
  };
1382
- }, no = (c, t) => {
1382
+ }, lo = (c, t) => {
1383
1383
  if (c.kind === "matcher")
1384
1384
  return c.matcher.createIterator(t, { step: c.step, state: c.state });
1385
1385
  const { list: e, startIndex: i, step: o } = c, n = e.items.length;
@@ -1393,7 +1393,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1393
1393
  return s = (s + o) % n, { value: e.items[s], done: !1 };
1394
1394
  }
1395
1395
  };
1396
- }, so = (c) => c.every((t) => typeof t == "number" && Number.isFinite(t)), lo = (c) => c.every((t) => t instanceof Date && !Number.isNaN(t.getTime())), ro = (c) => c.every((t) => typeof t == "string"), ao = (c) => {
1396
+ }, ro = (c) => c.every((t) => typeof t == "number" && Number.isFinite(t)), ao = (c) => c.every((t) => t instanceof Date && !Number.isNaN(t.getTime())), co = (c) => c.every((t) => typeof t == "string"), ho = (c) => {
1397
1397
  const t = /^(.*?)(-?\d+)([^0-9]*)$/.exec(c);
1398
1398
  if (!t)
1399
1399
  return null;
@@ -1402,7 +1402,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1402
1402
  return null;
1403
1403
  const s = i.replace("-", "").length;
1404
1404
  return { prefix: e, num: n, width: s, suffix: o };
1405
- }, co = (c) => {
1405
+ }, uo = (c) => {
1406
1406
  const t = /^(.*?)(\d+)(st|nd|rd|th)([^0-9]*)$/i.exec(c);
1407
1407
  if (t) {
1408
1408
  const o = Number(t[2]);
@@ -1417,14 +1417,14 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1417
1417
  }
1418
1418
  const e = /^(.*?)([A-Za-z-]+)([^A-Za-z]*)$/.exec(c);
1419
1419
  if (!e) return null;
1420
- const i = fe(e[2] ?? "");
1420
+ const i = pe(e[2] ?? "");
1421
1421
  return i === null ? null : {
1422
1422
  prefix: e[1] ?? "",
1423
1423
  num: i,
1424
1424
  suffix: e[3] ?? "",
1425
1425
  format: "word"
1426
1426
  };
1427
- }, ho = (c, t, e) => {
1427
+ }, fo = (c, t, e) => {
1428
1428
  let i = 0;
1429
1429
  return {
1430
1430
  next() {
@@ -1433,7 +1433,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1433
1433
  if (o <= 0 || !Number.isFinite(o))
1434
1434
  return { value: void 0, done: !0 };
1435
1435
  if (c.format === "word") {
1436
- const n = pe(o);
1436
+ const n = me(o);
1437
1437
  return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
1438
1438
  }
1439
1439
  return {
@@ -1442,7 +1442,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1442
1442
  };
1443
1443
  }
1444
1444
  };
1445
- }, uo = (c, t, e) => {
1445
+ }, po = (c, t, e) => {
1446
1446
  let i = 0;
1447
1447
  return {
1448
1448
  next() {
@@ -1451,7 +1451,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1451
1451
  return { value: `${c.prefix}${n}${s}${c.suffix}`, done: !1 };
1452
1452
  }
1453
1453
  };
1454
- }, ye = [
1454
+ }, we = [
1455
1455
  ["C", 100],
1456
1456
  ["XC", 90],
1457
1457
  ["L", 50],
@@ -1461,39 +1461,39 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1461
1461
  ["V", 5],
1462
1462
  ["IV", 4],
1463
1463
  ["I", 1]
1464
- ], Ot = (c) => {
1465
- if (c < 1 || c > Zi)
1464
+ ], jt = (c) => {
1465
+ if (c < 1 || c > eo)
1466
1466
  return null;
1467
1467
  let t = c, e = "";
1468
- for (const [i, o] of ye)
1468
+ for (const [i, o] of we)
1469
1469
  for (; t >= o; )
1470
1470
  e += i, t -= o;
1471
1471
  return e;
1472
- }, we = (c) => {
1472
+ }, ve = (c) => {
1473
1473
  if (c.length === 0 || c !== c.toUpperCase())
1474
1474
  return null;
1475
1475
  let t = c, e = 0;
1476
- for (const [o, n] of ye)
1476
+ for (const [o, n] of we)
1477
1477
  for (; t.startsWith(o); )
1478
1478
  e += n, t = t.slice(o.length);
1479
1479
  if (t.length > 0)
1480
1480
  return null;
1481
- const i = Ot(e);
1481
+ const i = jt(e);
1482
1482
  return !i || i !== c ? null : e;
1483
- }, fo = (c, t) => {
1483
+ }, mo = (c, t) => {
1484
1484
  let e = 0;
1485
1485
  return {
1486
1486
  next() {
1487
1487
  e += 1;
1488
- const i = c + t * e, o = Ot(i);
1488
+ const i = c + t * e, o = jt(i);
1489
1489
  return o ? { value: o, done: !1 } : { value: void 0, done: !0 };
1490
1490
  }
1491
1491
  };
1492
- }, po = (c) => new RegExp("\\p{White_Space}", "u").test(c) ? "space" : new RegExp("\\p{P}", "u").test(c) ? "punct" : new RegExp("\\p{S}", "u").test(c) ? "symbol" : new RegExp("\\p{Script=Latin}", "u").test(c) ? "latin" : new RegExp("\\p{Script=Han}", "u").test(c) ? "han" : new RegExp("\\p{Script=Hiragana}", "u").test(c) ? "hiragana" : new RegExp("\\p{Script=Katakana}", "u").test(c) ? "katakana" : new RegExp("\\p{N}", "u").test(c) ? "number" : "other", mo = (c) => {
1492
+ }, go = (c) => new RegExp("\\p{White_Space}", "u").test(c) ? "space" : new RegExp("\\p{P}", "u").test(c) ? "punct" : new RegExp("\\p{S}", "u").test(c) ? "symbol" : new RegExp("\\p{Script=Latin}", "u").test(c) ? "latin" : new RegExp("\\p{Script=Han}", "u").test(c) ? "han" : new RegExp("\\p{Script=Hiragana}", "u").test(c) ? "hiragana" : new RegExp("\\p{Script=Katakana}", "u").test(c) ? "katakana" : new RegExp("\\p{N}", "u").test(c) ? "number" : "other", yo = (c) => {
1493
1493
  const t = [];
1494
1494
  let e = "", i = null;
1495
1495
  for (const o of c) {
1496
- const n = po(o);
1496
+ const n = go(o);
1497
1497
  if (i === n) {
1498
1498
  e += o;
1499
1499
  continue;
@@ -1501,22 +1501,22 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1501
1501
  i !== null && t.push({ value: e, group: i }), e = o, i = n;
1502
1502
  }
1503
1503
  return i !== null && t.push({ value: e, group: i }), t;
1504
- }, go = (c) => {
1505
- const t = mo(c), e = t.map((l, a) => ({ index: a, num: we(l.value) })).filter((l) => l.num !== null);
1504
+ }, wo = (c) => {
1505
+ const t = yo(c), e = t.map((l, a) => ({ index: a, num: ve(l.value) })).filter((l) => l.num !== null);
1506
1506
  if (e.length !== 1)
1507
1507
  return null;
1508
1508
  const i = e[0].index, o = e[0].num, n = t.slice(0, i).map((l) => l.value).join(""), s = t.slice(i + 1).map((l) => l.value).join("");
1509
1509
  return { prefix: n, num: o, suffix: s };
1510
- }, yo = (c, t, e) => {
1510
+ }, vo = (c, t, e) => {
1511
1511
  let i = 0;
1512
1512
  return {
1513
1513
  next() {
1514
1514
  i += 1;
1515
- const o = t + e * i, n = Ot(o);
1515
+ const o = t + e * i, n = jt(o);
1516
1516
  return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
1517
1517
  }
1518
1518
  };
1519
- }, Pt = {
1519
+ }, Bt = {
1520
1520
  一: 1,
1521
1521
  二: 2,
1522
1522
  三: 3,
@@ -1526,7 +1526,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1526
1526
  七: 7,
1527
1527
  八: 8,
1528
1528
  九: 9
1529
- }, Bt = {
1529
+ }, $t = {
1530
1530
  壱: 1,
1531
1531
  弐: 2,
1532
1532
  参: 3,
@@ -1536,42 +1536,42 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1536
1536
  柒: 7,
1537
1537
  捌: 8,
1538
1538
  玖: 9
1539
- }, ve = {
1539
+ }, Ce = {
1540
1540
  十: 10,
1541
1541
  拾: 10,
1542
1542
  百: 100,
1543
1543
  佰: 100,
1544
1544
  千: 1e3,
1545
1545
  仟: 1e3
1546
- }, wo = {
1546
+ }, Co = {
1547
1547
  万: 1e4,
1548
1548
  萬: 1e4
1549
- }, vo = /* @__PURE__ */ new Set([
1550
- ...Object.keys(Pt),
1549
+ }, bo = /* @__PURE__ */ new Set([
1551
1550
  ...Object.keys(Bt),
1552
- ...Object.keys(ve),
1553
- ...Object.keys(wo)
1554
- ]), Co = (c) => vo.has(c), bo = (c) => /[壱弐参肆伍陸柒捌玖拾萬佰仟]/.test(c) ? "traditional" : "modern", Ce = (c) => {
1551
+ ...Object.keys($t),
1552
+ ...Object.keys(Ce),
1553
+ ...Object.keys(Co)
1554
+ ]), xo = (c) => bo.has(c), So = (c) => /[壱弐参肆伍陸柒捌玖拾萬佰仟]/.test(c) ? "traditional" : "modern", be = (c) => {
1555
1555
  if (!c)
1556
1556
  return null;
1557
- const t = bo(c);
1557
+ const t = So(c);
1558
1558
  if (c.includes("万") || c.includes("萬")) {
1559
1559
  const s = /^([一二三四五六七八九壱弐参肆伍陸柒捌玖])?(万|萬)$/.exec(c);
1560
1560
  if (!s)
1561
1561
  return null;
1562
1562
  const l = s[1];
1563
- return l ? (Pt[l] ?? Bt[l]) !== 1 ? null : { num: 1e4, style: t } : { num: 1e4, style: t };
1563
+ return l ? (Bt[l] ?? $t[l]) !== 1 ? null : { num: 1e4, style: t } : { num: 1e4, style: t };
1564
1564
  }
1565
1565
  let e = 0, i = 0, o = Number.POSITIVE_INFINITY, n = !1;
1566
1566
  for (const s of c) {
1567
- const l = Pt[s] ?? Bt[s];
1567
+ const l = Bt[s] ?? $t[s];
1568
1568
  if (l) {
1569
1569
  if (n)
1570
1570
  return null;
1571
1571
  i = l, n = !0;
1572
1572
  continue;
1573
1573
  }
1574
- const a = ve[s];
1574
+ const a = Ce[s];
1575
1575
  if (a) {
1576
1576
  if (a >= o)
1577
1577
  return null;
@@ -1581,13 +1581,13 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1581
1581
  return null;
1582
1582
  }
1583
1583
  return e += i, e <= 0 || e > 1e4 ? null : { num: e, style: t };
1584
- }, xo = (c) => {
1584
+ }, Mo = (c) => {
1585
1585
  const t = [];
1586
1586
  let e = "", i = 0, o = 0;
1587
1587
  for (const r of c)
1588
- Co(r) ? (e || (i = o), e += r) : e && (t.push({ start: i, end: o, text: e }), e = ""), o += r.length;
1588
+ xo(r) ? (e || (i = o), e += r) : e && (t.push({ start: i, end: o, text: e }), e = ""), o += r.length;
1589
1589
  e && t.push({ start: i, end: o, text: e });
1590
- const n = t.map((r) => ({ run: r, parsed: Ce(r.text) })).filter((r) => r.parsed !== null);
1590
+ const n = t.map((r) => ({ run: r, parsed: be(r.text) })).filter((r) => r.parsed !== null);
1591
1591
  if (n.length !== 1)
1592
1592
  return null;
1593
1593
  const s = n[0], l = c.slice(0, s.run.start), a = c.slice(s.run.end);
@@ -1597,7 +1597,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1597
1597
  suffix: a,
1598
1598
  style: s.parsed.style
1599
1599
  };
1600
- }, be = (c, t) => {
1600
+ }, xe = (c, t) => {
1601
1601
  if (!Number.isFinite(c) || c <= 0 || c > 1e4)
1602
1602
  return null;
1603
1603
  const e = t === "traditional" ? ["", "壱", "弐", "参", "肆", "伍", "陸", "柒", "捌", "玖"] : ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"], i = t === "traditional" ? "拾" : "十", o = t === "traditional" ? "萬" : "万";
@@ -1610,21 +1610,21 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1610
1610
  a > 0 && (a > 1 && (s += e[a]), s += "百", n %= 100);
1611
1611
  const r = Math.floor(n / 10);
1612
1612
  return r > 0 && (r > 1 && (s += e[r]), s += i, n %= 10), n > 0 && (s += e[n]), s || null;
1613
- }, So = (c, t, e) => {
1613
+ }, Ro = (c, t, e) => {
1614
1614
  let i = 0;
1615
1615
  return {
1616
1616
  next() {
1617
1617
  i += 1;
1618
- const o = c + t * i, n = be(o, e);
1618
+ const o = c + t * i, n = xe(o, e);
1619
1619
  return n ? { value: n, done: !1 } : { value: void 0, done: !0 };
1620
1620
  }
1621
1621
  };
1622
- }, Mo = (c, t, e) => {
1622
+ }, ko = (c, t, e) => {
1623
1623
  let i = 0;
1624
1624
  return {
1625
1625
  next() {
1626
1626
  i += 1;
1627
- const o = t + e * i, n = be(o, c.style);
1627
+ const o = t + e * i, n = xe(o, c.style);
1628
1628
  return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
1629
1629
  }
1630
1630
  };
@@ -1633,19 +1633,19 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1633
1633
  return null;
1634
1634
  const t = c[1] - c[0];
1635
1635
  for (let e = 2; e < c.length; e += 1)
1636
- if (Math.abs(c[e] - c[e - 1] - t) > ge)
1636
+ if (Math.abs(c[e] - c[e - 1] - t) > ye)
1637
1637
  return null;
1638
1638
  return t;
1639
- }, ko = (c) => {
1639
+ }, Io = (c) => {
1640
1640
  if (c.length < 2 || c[0] === 0)
1641
1641
  return null;
1642
1642
  const t = c[1] / c[0];
1643
1643
  for (let e = 2; e < c.length; e += 1)
1644
- if (c[e - 1] === 0 || Math.abs(c[e] / c[e - 1] - t) > ge)
1644
+ if (c[e - 1] === 0 || Math.abs(c[e] / c[e - 1] - t) > ye)
1645
1645
  return null;
1646
1646
  return t;
1647
- }, Ro = (c) => {
1648
- const t = c.map((l) => co(l));
1647
+ }, To = (c) => {
1648
+ const t = c.map((l) => uo(l));
1649
1649
  if (t.every((l) => l !== null)) {
1650
1650
  const l = t, a = l[0];
1651
1651
  if (l.every(
@@ -1656,7 +1656,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1656
1656
  const d = l[l.length - 1];
1657
1657
  return {
1658
1658
  kind: "arithmetic",
1659
- iterator: ho(
1659
+ iterator: fo(
1660
1660
  { prefix: a.prefix, suffix: a.suffix, format: a.format },
1661
1661
  d.num,
1662
1662
  h
@@ -1665,7 +1665,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1665
1665
  }
1666
1666
  }
1667
1667
  }
1668
- const e = c.map((l) => ao(l));
1668
+ const e = c.map((l) => ho(l));
1669
1669
  if (e.every(Boolean)) {
1670
1670
  const l = e[0], a = e[e.length - 1];
1671
1671
  if (e.every(
@@ -1675,7 +1675,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1675
1675
  if (h !== null)
1676
1676
  return {
1677
1677
  kind: "arithmetic",
1678
- iterator: uo(
1678
+ iterator: po(
1679
1679
  { prefix: a.prefix, suffix: a.suffix, width: a.width },
1680
1680
  a.num,
1681
1681
  h
@@ -1683,18 +1683,18 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1683
1683
  };
1684
1684
  }
1685
1685
  }
1686
- const i = c.map((l) => we(l));
1686
+ const i = c.map((l) => ve(l));
1687
1687
  if (i.every((l) => l !== null)) {
1688
1688
  const l = i, a = tt(l);
1689
1689
  if (a !== null) {
1690
1690
  const r = l[l.length - 1];
1691
1691
  return {
1692
1692
  kind: "arithmetic",
1693
- iterator: fo(r, a)
1693
+ iterator: mo(r, a)
1694
1694
  };
1695
1695
  }
1696
1696
  }
1697
- const o = c.map((l) => Ce(l));
1697
+ const o = c.map((l) => be(l));
1698
1698
  if (o.every((l) => l !== null)) {
1699
1699
  const l = o, a = l[0].style;
1700
1700
  if (l.every((r) => r.style === a)) {
@@ -1703,12 +1703,12 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1703
1703
  const d = l[l.length - 1];
1704
1704
  return {
1705
1705
  kind: "arithmetic",
1706
- iterator: So(d.num, h, d.style)
1706
+ iterator: Ro(d.num, h, d.style)
1707
1707
  };
1708
1708
  }
1709
1709
  }
1710
1710
  }
1711
- const n = c.map((l) => go(l));
1711
+ const n = c.map((l) => wo(l));
1712
1712
  if (n.every((l) => l !== null)) {
1713
1713
  const l = n, a = l[0];
1714
1714
  if (l.every(
@@ -1719,7 +1719,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1719
1719
  const d = r[r.length - 1];
1720
1720
  return {
1721
1721
  kind: "arithmetic",
1722
- iterator: yo(
1722
+ iterator: vo(
1723
1723
  { prefix: a.prefix, suffix: a.suffix },
1724
1724
  d,
1725
1725
  h
@@ -1728,7 +1728,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1728
1728
  }
1729
1729
  }
1730
1730
  }
1731
- const s = c.map((l) => xo(l));
1731
+ const s = c.map((l) => Mo(l));
1732
1732
  if (s.every((l) => l !== null)) {
1733
1733
  const l = s, a = l[0];
1734
1734
  if (l.every(
@@ -1739,7 +1739,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1739
1739
  const d = l[l.length - 1];
1740
1740
  return {
1741
1741
  kind: "arithmetic",
1742
- iterator: Mo(
1742
+ iterator: ko(
1743
1743
  { prefix: a.prefix, suffix: a.suffix, style: a.style },
1744
1744
  d.num,
1745
1745
  h
@@ -1749,55 +1749,55 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1749
1749
  }
1750
1750
  }
1751
1751
  return null;
1752
- }, Io = (c, t) => {
1752
+ }, Eo = (c, t) => {
1753
1753
  const e = t.match(c);
1754
1754
  return e ? {
1755
1755
  kind: "list",
1756
- iterator: no(e, c)
1756
+ iterator: lo(e, c)
1757
1757
  } : null;
1758
1758
  };
1759
- function Ft(c, t) {
1760
- const e = t?.registry ?? me();
1759
+ function _t(c, t) {
1760
+ const e = t?.registry ?? ge();
1761
1761
  if (c.length === 0)
1762
- return G.fromSeed(c, "seed-repeat", ce(c));
1762
+ return G.fromSeed(c, "seed-repeat", he(c));
1763
1763
  if (c.length === 1)
1764
- return G.fromSeed(c, "copy", to(c[0]));
1765
- if (ro(c)) {
1766
- const i = Io(c, e);
1764
+ return G.fromSeed(c, "copy", io(c[0]));
1765
+ if (co(c)) {
1766
+ const i = Eo(c, e);
1767
1767
  if (i)
1768
1768
  return G.fromSeed(c, i.kind, i.iterator);
1769
- const o = Ro(c);
1769
+ const o = To(c);
1770
1770
  if (o)
1771
1771
  return G.fromSeed(c, o.kind, o.iterator);
1772
1772
  }
1773
- if (so(c)) {
1773
+ if (ro(c)) {
1774
1774
  const i = tt(c);
1775
1775
  if (i !== null)
1776
1776
  return G.fromSeed(
1777
1777
  c,
1778
1778
  "arithmetic",
1779
- eo(c[c.length - 1], i)
1779
+ oo(c[c.length - 1], i)
1780
1780
  );
1781
- const o = ko(c);
1781
+ const o = Io(c);
1782
1782
  if (o !== null)
1783
1783
  return G.fromSeed(
1784
1784
  c,
1785
1785
  "geometric",
1786
- oo(c[c.length - 1], o)
1786
+ so(c[c.length - 1], o)
1787
1787
  );
1788
1788
  }
1789
- if (lo(c)) {
1789
+ if (ao(c)) {
1790
1790
  const i = c.map((n) => n.getTime()), o = tt(i);
1791
1791
  if (o !== null)
1792
1792
  return G.fromSeed(
1793
1793
  c,
1794
1794
  "arithmetic",
1795
- io(c[c.length - 1], o)
1795
+ no(c[c.length - 1], o)
1796
1796
  );
1797
1797
  }
1798
- return G.fromSeed(c, "seed-repeat", ce(c));
1798
+ return G.fromSeed(c, "seed-repeat", he(c));
1799
1799
  }
1800
- function To(c) {
1800
+ function Ao(c) {
1801
1801
  return {
1802
1802
  ...c,
1803
1803
  startRow: Math.min(c.startRow, c.endRow),
@@ -1806,7 +1806,7 @@ function To(c) {
1806
1806
  endCol: Math.max(c.startCol, c.endCol)
1807
1807
  };
1808
1808
  }
1809
- function Eo(c) {
1809
+ function Ho(c) {
1810
1810
  if (c instanceof Date) return c;
1811
1811
  if (typeof c == "number" && Number.isFinite(c)) return new Date(c);
1812
1812
  if (typeof c == "string") {
@@ -1820,7 +1820,7 @@ function Eo(c) {
1820
1820
  }
1821
1821
  return null;
1822
1822
  }
1823
- function Ao(c) {
1823
+ function Lo(c) {
1824
1824
  if (c instanceof Date) return c;
1825
1825
  if (typeof c == "number" && Number.isFinite(c)) return new Date(c);
1826
1826
  if (typeof c == "string") {
@@ -1829,9 +1829,9 @@ function Ao(c) {
1829
1829
  }
1830
1830
  return null;
1831
1831
  }
1832
- function xe(c, t) {
1832
+ function Se(c, t) {
1833
1833
  if (t.length !== 1) return null;
1834
- const e = To(t[0]);
1834
+ const e = Ao(t[0]);
1835
1835
  if (e.kind !== "cells") return null;
1836
1836
  const i = e.endCol - e.startCol + 1, o = e.endRow - e.startRow + 1;
1837
1837
  if (i !== 1 || o < 1) return null;
@@ -1850,7 +1850,7 @@ function xe(c, t) {
1850
1850
  mode: "sequence"
1851
1851
  } : null : null;
1852
1852
  }
1853
- function Ho(c, t, e) {
1853
+ function Do(c, t, e) {
1854
1854
  const i = c.getSchema(), o = c.listRows(), n = i.columns[t.colIndex];
1855
1855
  if (!n) return null;
1856
1856
  const s = [];
@@ -1863,11 +1863,11 @@ function Ho(c, t, e) {
1863
1863
  const a = s[s.length - 1];
1864
1864
  return () => a;
1865
1865
  }
1866
- const l = me(e);
1866
+ const l = ge(e);
1867
1867
  if (n.type === "number") {
1868
1868
  const a = s.map((u) => typeof u == "number" ? u : Number(u));
1869
1869
  if (!a.every((u) => Number.isFinite(u))) return null;
1870
- const r = Ft(a, { registry: l }), h = [];
1870
+ const r = _t(a, { registry: l }), h = [];
1871
1871
  let d = !1;
1872
1872
  return (u) => {
1873
1873
  for (; !d && h.length < u; ) {
@@ -1883,10 +1883,10 @@ function Ho(c, t, e) {
1883
1883
  }
1884
1884
  if (n.type === "date" || n.type === "time" || n.type === "datetime") {
1885
1885
  const a = s.map(
1886
- (u) => n.type === "time" ? Eo(u) : Ao(u)
1886
+ (u) => n.type === "time" ? Ho(u) : Lo(u)
1887
1887
  );
1888
1888
  if (!a.every((u) => u instanceof Date)) return null;
1889
- const r = Ft(a, { registry: l }), h = [];
1889
+ const r = _t(a, { registry: l }), h = [];
1890
1890
  let d = !1;
1891
1891
  return (u) => {
1892
1892
  for (; !d && h.length < u; ) {
@@ -1901,7 +1901,7 @@ function Ho(c, t, e) {
1901
1901
  };
1902
1902
  }
1903
1903
  if (n.type === "string") {
1904
- const a = s.map((u) => String(u ?? "")), r = Ft(a, { registry: l }), h = [];
1904
+ const a = s.map((u) => String(u ?? "")), r = _t(a, { registry: l }), h = [];
1905
1905
  let d = !1;
1906
1906
  return (u) => {
1907
1907
  for (; !d && h.length < u; ) {
@@ -1917,24 +1917,24 @@ function Ho(c, t, e) {
1917
1917
  }
1918
1918
  return null;
1919
1919
  }
1920
- const Se = 12, Me = 14;
1921
- function ke(c, t = Se) {
1920
+ const Me = 12, Re = 14;
1921
+ function ke(c, t = Me) {
1922
1922
  return new DOMRect(c.right - t - 1, c.bottom - t - 1, t, t);
1923
1923
  }
1924
- function Re(c, t, e) {
1924
+ function Ie(c, t, e) {
1925
1925
  return c >= e.left && c <= e.right && t >= e.top && t <= e.bottom;
1926
1926
  }
1927
- function Rt(c, t, e, i, o) {
1927
+ function kt(c, t, e, i, o) {
1928
1928
  if (o === "readonly") return !1;
1929
- const n = xe(c, t);
1929
+ const n = Se(c, t);
1930
1930
  return !(!n || !e || e === "__all__" || i === null || i === "__all__" || i === null || i !== n.colKey || c.isReadonly(e, i));
1931
1931
  }
1932
- const Y = '"Inter","Segoe UI",system-ui,-apple-system,"Helvetica Neue",sans-serif', Z = 13.5, Lo = 10;
1933
- function Ie(c, t) {
1932
+ const Q = '"Inter","Segoe UI",system-ui,-apple-system,"Helvetica Neue",sans-serif', Z = 13.5, Ko = 10;
1933
+ function Te(c, t) {
1934
1934
  const e = c.sorts?.[0];
1935
1935
  return e && e.key === t ? e.dir : null;
1936
1936
  }
1937
- function Te(c, t) {
1937
+ function Ee(c, t) {
1938
1938
  if ((c.filters ?? []).some((o) => {
1939
1939
  const n = o;
1940
1940
  return n?.kind === "values" && n.key === t;
@@ -1942,27 +1942,27 @@ function Te(c, t) {
1942
1942
  const i = c.columnDiagnostics?.[t];
1943
1943
  return !!(i?.errors || i?.warnings);
1944
1944
  }
1945
- function Do() {
1945
+ function _o() {
1946
1946
  return `
1947
1947
  <svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
1948
1948
  <path d="M3 5h18l-7 8v6l-4 2v-8L3 5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
1949
1949
  </svg>
1950
1950
  `.trim();
1951
1951
  }
1952
- function Ko(c) {
1952
+ function Fo(c) {
1953
1953
  return `
1954
1954
  <svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
1955
1955
  <path d="${c === "asc" ? "M12 6l6 8H6l6-8z" : "M12 18l-6-8h12l-6 8z"}" fill="currentColor"/>
1956
1956
  </svg>
1957
1957
  `.trim();
1958
1958
  }
1959
- function Fo(c, t, e, i, o, n) {
1959
+ function Vo(c, t, e, i, o, n) {
1960
1960
  const s = Math.min(10, Math.floor(Math.min(i, o) / 2));
1961
1961
  if (s <= 0) return;
1962
1962
  const l = n === "error" ? "#ef4444" : "#f59e0b";
1963
1963
  c.save(), c.fillStyle = l, c.beginPath(), c.moveTo(t + i, e), c.lineTo(t + i - s, e), c.lineTo(t + i, e + s), c.closePath(), c.fill(), c.restore();
1964
1964
  }
1965
- class Ee {
1965
+ class Ae {
1966
1966
  constructor() {
1967
1967
  this.numberFormatCache = /* @__PURE__ */ new Map(), this.dateParseCache = /* @__PURE__ */ new Map();
1968
1968
  }
@@ -1974,17 +1974,17 @@ class Ee {
1974
1974
  parseIsoDate(t) {
1975
1975
  const e = this.dateParseCache.get(t);
1976
1976
  if (e) return e;
1977
- const i = $e(t);
1977
+ const i = We(t);
1978
1978
  return !i || Number.isNaN(i.getTime()) ? null : (this.dateParseCache.set(t, i), i);
1979
1979
  }
1980
1980
  }
1981
- function _o(c, t, e, i, o) {
1981
+ function No(c, t, e, i, o) {
1982
1982
  c.save(), c.globalAlpha = o, c.strokeStyle = "rgba(15,23,42,1)", c.lineWidth = 2, c.lineJoin = "round", c.beginPath(), c.moveTo(t, e), c.lineTo(t + i, e), c.lineTo(t + Math.round(i * 0.62), e + Math.round(i * 0.46)), c.lineTo(t + Math.round(i * 0.38), e + Math.round(i * 0.46)), c.closePath(), c.stroke(), c.beginPath(), c.moveTo(t + Math.round(i * 0.46), e + Math.round(i * 0.46)), c.lineTo(t + Math.round(i * 0.46), e + i), c.lineTo(t + Math.round(i * 0.54), e + i - 2), c.lineTo(t + Math.round(i * 0.54), e + Math.round(i * 0.46)), c.stroke(), c.restore();
1983
1983
  }
1984
- function Vo(c, t, e, i, o, n) {
1984
+ function Po(c, t, e, i, o, n) {
1985
1985
  c.save(), c.globalAlpha = o, c.fillStyle = "rgba(15,23,42,1)", c.beginPath(), n === "asc" ? (c.moveTo(t + i / 2, e), c.lineTo(t + i, e + i), c.lineTo(t, e + i)) : (c.moveTo(t, e), c.lineTo(t + i, e), c.lineTo(t + i / 2, e + i)), c.closePath(), c.fill(), c.restore();
1986
1986
  }
1987
- function $t(c) {
1987
+ function Wt(c) {
1988
1988
  if (Array.isArray(c) && c.every((t) => typeof t == "string"))
1989
1989
  return c;
1990
1990
  if (c && typeof c == "object") {
@@ -1997,17 +1997,17 @@ function $t(c) {
1997
1997
  }
1998
1998
  return null;
1999
1999
  }
2000
- function Ae(c) {
2000
+ function He(c) {
2001
2001
  if (!c || typeof c != "object") return null;
2002
2002
  const t = c;
2003
2003
  return typeof t.kind == "string" ? null : typeof t.label == "string" && "value" in t ? t.label : null;
2004
2004
  }
2005
- class jt {
2005
+ class qt {
2006
2006
  constructor(t) {
2007
2007
  this.n = t, this.tree = new Array(t + 1).fill(0);
2008
2008
  }
2009
2009
  static from(t) {
2010
- const e = new jt(t.length);
2010
+ const e = new qt(t.length);
2011
2011
  for (let i = 0; i < t.length; i += 1) e.add(i, t[i] ?? 0);
2012
2012
  return e;
2013
2013
  }
@@ -2049,7 +2049,7 @@ class jt {
2049
2049
  }
2050
2050
  class St {
2051
2051
  constructor(t) {
2052
- this.dataModel = t, this.tableEl = null, this.defaultRowHeight = ft, this.rowHeaderWidth = st, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Ee(), this.measureCache = /* @__PURE__ */ new Map(), this.frame = 0;
2052
+ this.dataModel = t, this.tableEl = null, this.defaultRowHeight = ft, this.rowHeaderWidth = lt, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Ae(), this.measureCache = /* @__PURE__ */ new Map(), this.frame = 0;
2053
2053
  }
2054
2054
  mount(t) {
2055
2055
  this.tableEl = document.createElement("table"), this.tableEl.dataset.extableRenderer = "html", t.innerHTML = "", t.appendChild(this.tableEl), this.render();
@@ -2064,7 +2064,7 @@ class St {
2064
2064
  if (this.frame += 1, !this.tableEl) return;
2065
2065
  const e = this.tableEl.parentElement, i = e?.scrollTop ?? 0, o = e?.scrollLeft ?? 0, n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows();
2066
2066
  this.tableEl.innerHTML = "";
2067
- const a = Q(n, s), r = n.columns.map((p) => _t(p)), h = r.map((p) => oe(p)), d = this.rowHeaderWidth + a.reduce((p, m) => p + (m ?? 0), 0);
2067
+ const a = Y(n, s), r = n.columns.map((p) => Ft(p)), h = r.map((p) => ne(p)), d = this.rowHeaderWidth + a.reduce((p, m) => p + (m ?? 0), 0);
2068
2068
  this.tableEl.style.width = `${d}px`, this.tableEl.appendChild(this.renderHeader(n, a));
2069
2069
  const u = document.createElement("tbody");
2070
2070
  for (const p of l)
@@ -2092,21 +2092,29 @@ class St {
2092
2092
  };
2093
2093
  const o = e.closest("th.extable-row-header:not(.extable-corner)");
2094
2094
  if (o) {
2095
- const l = o.closest("tr[data-row-id]");
2096
- if (l)
2095
+ const a = o.closest("tr[data-row-id]");
2096
+ if (a)
2097
2097
  return {
2098
- rowId: l.dataset.rowId ?? "",
2098
+ rowId: a.dataset.rowId ?? "",
2099
2099
  colKey: null,
2100
2100
  element: o,
2101
2101
  rect: o.getBoundingClientRect()
2102
2102
  };
2103
2103
  }
2104
- const n = e.closest("td[data-col-key]"), s = n?.closest("tr[data-row-id]");
2105
- return !n || !s ? null : {
2106
- rowId: s.dataset.rowId ?? "",
2107
- colKey: n.dataset.colKey ?? "",
2108
- element: n,
2109
- rect: n.getBoundingClientRect()
2104
+ const n = e.closest("th[data-col-key]:not(.extable-row-header)");
2105
+ if (n)
2106
+ return {
2107
+ rowId: "__header__",
2108
+ colKey: n.dataset.colKey ?? "",
2109
+ element: n,
2110
+ rect: n.getBoundingClientRect()
2111
+ };
2112
+ const s = e.closest("td[data-col-key]"), l = s?.closest("tr[data-row-id]");
2113
+ return !s || !l ? null : {
2114
+ rowId: l.dataset.rowId ?? "",
2115
+ colKey: s.dataset.colKey ?? "",
2116
+ element: s,
2117
+ rect: s.getBoundingClientRect()
2110
2118
  };
2111
2119
  }
2112
2120
  hitTestAction(t) {
@@ -2146,16 +2154,16 @@ class St {
2146
2154
  if (!a) continue;
2147
2155
  const r = document.createElement("th");
2148
2156
  r.dataset.colKey = a.key;
2149
- const h = Ie(s, a.key), d = Te(s, a.key);
2157
+ const h = Te(s, a.key), d = Ee(s, a.key);
2150
2158
  h ? r.dataset.extableSortDir = h : r.removeAttribute("data-extable-sort-dir"), d ? r.dataset.extableFsActive = "1" : r.removeAttribute("data-extable-fs-active");
2151
2159
  const u = document.createElement("div");
2152
2160
  u.className = "extable-col-header";
2153
2161
  const p = document.createElement("span");
2154
2162
  p.className = "extable-col-header-text", p.textContent = a.header ?? a.key;
2155
2163
  const m = document.createElement("button");
2156
- m.type = "button", m.className = "extable-filter-sort-trigger", m.dataset.extableFsOpen = "1", m.dataset.extableColKey = a.key, m.title = "Filter / Sort", m.innerHTML = h ? Ko(h) : Do(), u.appendChild(p), u.appendChild(m), r.appendChild(u);
2157
- const C = e[l] ?? a.width;
2158
- C && (r.style.width = `${C}px`), r.dataset.colKey = a.key, this.activeColKey !== null && this.activeColKey === a.key && r.classList.add("extable-active-col-header"), o.appendChild(r);
2164
+ m.type = "button", m.className = "extable-filter-sort-trigger", m.dataset.extableFsOpen = "1", m.dataset.extableColKey = a.key, m.title = "Filter / Sort", m.innerHTML = h ? Fo(h) : _o(), u.appendChild(p), u.appendChild(m), r.appendChild(u);
2165
+ const b = e[l] ?? a.width;
2166
+ b && (r.style.width = `${b}px`), r.dataset.colKey = a.key, this.activeColKey !== null && this.activeColKey === a.key && r.classList.add("extable-active-col-header"), o.appendChild(r);
2159
2167
  }
2160
2168
  return i.appendChild(o), i;
2161
2169
  }
@@ -2171,68 +2179,68 @@ class St {
2171
2179
  if (!p) continue;
2172
2180
  const m = document.createElement("td");
2173
2181
  m.classList.add("extable-cell"), m.dataset.colKey = p.key, p.type === "boolean" && m.classList.add("extable-boolean");
2174
- const C = this.dataModel.hasPending(t.id, p.key), x = this.dataModel.resolveConditionalStyle(t.id, p), f = this.dataModel.getCellStyle(t.id, p.key), g = !!(f?.textColor || x.delta?.textColor || p.style?.textColor);
2175
- if (!f && !x.delta && !C) {
2176
- const M = n[u] ?? "";
2177
- M && (m.style.cssText = M);
2182
+ const b = this.dataModel.hasPending(t.id, p.key), x = this.dataModel.resolveConditionalStyle(t.id, p), w = this.dataModel.getCellStyle(t.id, p.key), f = !!(w?.textColor || x.delta?.textColor || p.style?.textColor);
2183
+ if (!w && !x.delta && !b) {
2184
+ const k = n[u] ?? "";
2185
+ k && (m.style.cssText = k);
2178
2186
  } else {
2179
- const M = o[u] ?? {}, B = x.delta ? lt(M, x.delta) : M, A = f ? lt(B, f) : B, H = C ? { ...A, textColor: void 0 } : A, E = oe(H);
2180
- E && (m.style.cssText = E);
2187
+ const k = o[u] ?? {}, N = x.delta ? rt(k, x.delta) : k, T = w ? rt(N, w) : N, E = b ? { ...T, textColor: void 0 } : T, H = ne(E);
2188
+ H && (m.style.cssText = H);
2181
2189
  }
2182
2190
  const y = a.wrapText?.[p.key] ?? p.wrapText;
2183
2191
  m.classList.add(y ? "cell-wrap" : "cell-nowrap");
2184
- const w = this.dataModel.getRawCell(t.id, p.key), b = this.dataModel.resolveCellValue(t.id, p), S = b.textOverride ?? (x.forceErrorText ? "#ERROR" : void 0), v = S ? { text: S } : this.formatValue(b.value, p), I = this.dataModel.getCellInteraction(t.id, p.key), D = p.type === "tags" && !S ? $t(b.value) : null, K = p.type === "button" || p.type === "link", T = K ? p.type === "button" ? pt(b.value) : mt(b.value) : null, k = K ? p.type === "button" ? at(b.value) : ct(b.value) : "";
2185
- if (D && D.length) {
2186
- const M = document.createElement("div");
2187
- M.className = "extable-tag-list", D.forEach((B, A) => {
2188
- const H = document.createElement("span");
2189
- H.className = "extable-tag";
2192
+ const g = this.dataModel.getRawCell(t.id, p.key), v = this.dataModel.resolveCellValue(t.id, p), C = v.textOverride ?? (x.forceErrorText ? "#ERROR" : void 0), S = C ? { text: C } : this.formatValue(v.value, p), M = this.dataModel.getCellInteraction(t.id, p.key), L = p.type === "tags" && !C ? Wt(v.value) : null, _ = p.type === "button" || p.type === "link", K = _ ? p.type === "button" ? pt(v.value) : mt(v.value) : null, R = _ ? p.type === "button" ? ct(v.value) : ht(v.value) : "";
2193
+ if (L && L.length) {
2194
+ const k = document.createElement("div");
2195
+ k.className = "extable-tag-list", L.forEach((N, T) => {
2190
2196
  const E = document.createElement("span");
2191
- E.className = "extable-tag-label", E.textContent = B;
2192
- const N = document.createElement("button");
2193
- N.type = "button", N.className = "extable-tag-remove", N.dataset.extableTagRemove = "1", N.dataset.extableTagIndex = String(A), N.textContent = "×", (I.readonly || I.disabled) && (N.disabled = !0), H.appendChild(E), H.appendChild(N), M.appendChild(H);
2194
- }), m.replaceChildren(M);
2195
- } else if (K && !S && T && k) {
2196
- const M = p.type === "button" ? document.createElement("button") : document.createElement("span");
2197
- M instanceof HTMLButtonElement && (M.type = "button"), M.className = p.type === "button" ? "extable-action-button" : "extable-action-link", I.disabled && M.classList.add("extable-action-disabled"), p.type === "link" && g && (M.style.color = "inherit"), M.dataset.extableAction = p.type, M.textContent = k, m.replaceChildren(M);
2198
- } else if (p.type === "boolean" && !S)
2197
+ E.className = "extable-tag";
2198
+ const H = document.createElement("span");
2199
+ H.className = "extable-tag-label", H.textContent = N;
2200
+ const P = document.createElement("button");
2201
+ P.type = "button", P.className = "extable-tag-remove", P.dataset.extableTagRemove = "1", P.dataset.extableTagIndex = String(T), P.textContent = "×", (M.readonly || M.disabled) && (P.disabled = !0), E.appendChild(H), E.appendChild(P), k.appendChild(E);
2202
+ }), m.replaceChildren(k);
2203
+ } else if (_ && !C && K && R) {
2204
+ const k = p.type === "button" ? document.createElement("button") : document.createElement("span");
2205
+ k instanceof HTMLButtonElement && (k.type = "button"), k.className = p.type === "button" ? "extable-action-button" : "extable-action-link", M.disabled && k.classList.add("extable-action-disabled"), p.type === "link" && f && (k.style.color = "inherit"), k.dataset.extableAction = p.type, k.textContent = R, m.replaceChildren(k);
2206
+ } else if (p.type === "boolean" && !C)
2199
2207
  if (p.unique) {
2200
- const M = document.createElement("input");
2201
- M.type = "radio", M.name = `extable-unique-${String(p.key)}`, M.checked = !!b.value, (I.readonly || I.disabled) && (M.disabled = !0), M.className = "extable-unique-radio", M.setAttribute("aria-label", p.header ?? String(p.key)), m.replaceChildren(M);
2208
+ const k = document.createElement("input");
2209
+ k.type = "radio", k.name = `extable-unique-${String(p.key)}`, k.checked = !!v.value, (M.readonly || M.disabled) && (k.disabled = !0), k.className = "extable-unique-radio", k.setAttribute("aria-label", p.header ?? String(p.key)), m.replaceChildren(k);
2202
2210
  } else
2203
- m.textContent = v.text, v.color && (m.style.color = v.color);
2211
+ m.textContent = S.text, S.color && (m.style.color = S.color);
2204
2212
  else
2205
- m.textContent = k || v.text, v.color && (m.style.color = v.color);
2206
- const L = this.dataModel.getCellMarker(t.id, p.key);
2207
- L ? (m.classList.toggle("extable-diag-warning", L.level === "warning"), m.classList.toggle("extable-diag-error", L.level === "error"), m.dataset.extableDiagMessage = L.message) : (m.classList.remove("extable-diag-warning", "extable-diag-error"), m.removeAttribute("data-extable-diag-message"));
2208
- const F = p.style?.align ?? (p.type === "number" || p.type === "int" || p.type === "uint" ? "right" : "left");
2209
- m.classList.add(F === "right" ? "align-right" : "align-left");
2210
- const V = Be(w, b.value, p);
2213
+ m.textContent = R || S.text, S.color && (m.style.color = S.color);
2214
+ const A = this.dataModel.getCellMarker(t.id, p.key);
2215
+ A ? (m.classList.toggle("extable-diag-warning", A.level === "warning"), m.classList.toggle("extable-diag-error", A.level === "error"), m.dataset.extableDiagMessage = A.message) : (m.classList.remove("extable-diag-warning", "extable-diag-error"), m.removeAttribute("data-extable-diag-message"));
2216
+ const D = p.style?.align ?? (p.type === "number" || p.type === "int" || p.type === "uint" ? "right" : "left");
2217
+ m.classList.add(D === "right" ? "align-right" : "align-left");
2218
+ const V = $e(g, v.value, p);
2211
2219
  if (V !== null)
2212
2220
  m.dataset.raw = V;
2213
2221
  else {
2214
- const M = w == null ? "" : String(w);
2215
- m.dataset.raw = M;
2222
+ const k = g == null ? "" : String(g);
2223
+ m.dataset.raw = k;
2216
2224
  }
2217
- C && m.classList.add("pending"), I.readonly ? (m.classList.add("extable-readonly"), p.formula && m.classList.add("extable-readonly-formula")) : m.classList.add("extable-editable"), I.muted && m.classList.add("extable-readonly-muted"), I.disabled && m.classList.add("extable-disabled"), this.activeRowId === t.id && this.activeColKey !== null && this.activeColKey === p.key && m.classList.add("extable-active-cell"), s.appendChild(m);
2225
+ b && m.classList.add("pending"), M.readonly ? (m.classList.add("extable-readonly"), p.formula && m.classList.add("extable-readonly-formula")) : m.classList.add("extable-editable"), M.muted && m.classList.add("extable-readonly-muted"), M.disabled && m.classList.add("extable-disabled"), this.activeRowId === t.id && this.activeColKey !== null && this.activeColKey === p.key && m.classList.add("extable-active-cell"), s.appendChild(m);
2218
2226
  }
2219
2227
  if (e.columns.some((u) => a.wrapText?.[u.key] ?? u.wrapText)) {
2220
2228
  let u = this.defaultRowHeight;
2221
2229
  for (let p = 0; p < e.columns.length; p += 1) {
2222
2230
  const m = e.columns[p];
2223
2231
  if (!m || !m.wrapText) continue;
2224
- const C = i[p] ?? a.columnWidths?.[m.key] ?? m.width ?? 100, x = this.dataModel.resolveCellValue(t.id, m), f = this.dataModel.resolveConditionalStyle(t.id, m), y = x.textOverride ?? (f.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(x.value, m).text, w = this.dataModel.getRowVersion(t.id), b = `${t.id}|${m.key}|${w}|${C}|${y}`, S = this.measureCache.get(b);
2225
- if (S) {
2226
- S.frame = this.frame, this.measureCache.set(b, S), u = Math.max(u, S.height);
2232
+ const b = i[p] ?? a.columnWidths?.[m.key] ?? m.width ?? 100, x = this.dataModel.resolveCellValue(t.id, m), w = this.dataModel.resolveConditionalStyle(t.id, m), y = x.textOverride ?? (w.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(x.value, m).text, g = this.dataModel.getRowVersion(t.id), v = `${t.id}|${m.key}|${g}|${b}|${y}`, C = this.measureCache.get(v);
2233
+ if (C) {
2234
+ C.frame = this.frame, this.measureCache.set(v, C), u = Math.max(u, C.height);
2227
2235
  continue;
2228
2236
  }
2229
- const v = document.createElement("span");
2230
- v.style.visibility = "hidden", v.style.position = "absolute", v.style.left = "-10000px", v.style.top = "0", v.style.whiteSpace = "pre-wrap", v.style.overflowWrap = "anywhere", v.style.display = "inline-block", v.style.width = `${C}px`, v.textContent = y;
2231
- const I = this.tableEl?.parentElement;
2232
- if (!I) continue;
2233
- I.appendChild(v);
2234
- const D = v.clientHeight + rt + Mt + 2;
2235
- v.remove(), this.measureCache.set(b, { height: D, frame: this.frame }), u = Math.max(u, D);
2237
+ const S = document.createElement("span");
2238
+ S.style.visibility = "hidden", S.style.position = "absolute", S.style.left = "-10000px", S.style.top = "0", S.style.whiteSpace = "pre-wrap", S.style.overflowWrap = "anywhere", S.style.display = "inline-block", S.style.width = `${b}px`, S.textContent = y;
2239
+ const M = this.tableEl?.parentElement;
2240
+ if (!M) continue;
2241
+ M.appendChild(S);
2242
+ const L = S.clientHeight + at + Mt + 2;
2243
+ S.remove(), this.measureCache.set(v, { height: L, frame: this.frame }), u = Math.max(u, L);
2236
2244
  }
2237
2245
  s.style.height = `${u}px`, this.dataModel.setRowHeight(t.id, u);
2238
2246
  } else
@@ -2297,15 +2305,15 @@ class St {
2297
2305
  const i = t;
2298
2306
  if (i.kind === "lookup" && typeof i.label == "string")
2299
2307
  return { text: i.label };
2300
- const o = Ae(t);
2308
+ const o = He(t);
2301
2309
  if (o !== null) return { text: o };
2302
2310
  }
2303
2311
  if (e.type === "button")
2304
- return { text: at(t) || String(t) };
2305
- if (e.type === "link")
2306
2312
  return { text: ct(t) || String(t) };
2313
+ if (e.type === "link")
2314
+ return { text: ht(t) || String(t) };
2307
2315
  if (e.type === "tags") {
2308
- const i = $t(t);
2316
+ const i = Wt(t);
2309
2317
  if (i) return { text: i.join(", ") };
2310
2318
  }
2311
2319
  if (e.type === "boolean")
@@ -2313,7 +2321,7 @@ class St {
2313
2321
  if (e.type === "number" && typeof t == "number") {
2314
2322
  const i = t, o = e.format;
2315
2323
  if ((o?.format ?? "decimal") === "scientific") {
2316
- const r = kt(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2324
+ const r = Rt(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2317
2325
  return { text: r, color: h };
2318
2326
  }
2319
2327
  const s = {};
@@ -2324,7 +2332,7 @@ class St {
2324
2332
  if ((e.type === "int" || e.type === "uint") && typeof t == "number") {
2325
2333
  const i = t, o = e.format, n = o?.format ?? "decimal";
2326
2334
  if (n === "binary" || n === "octal" || n === "hex") {
2327
- const r = Wt(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2335
+ const r = Ot(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2328
2336
  return { text: r, color: h };
2329
2337
  }
2330
2338
  const s = {
@@ -2337,32 +2345,32 @@ class St {
2337
2345
  if ((e.type === "date" || e.type === "time" || e.type === "datetime") && (t instanceof Date || typeof t == "string")) {
2338
2346
  const i = e.format, o = e.type === "date" ? Kt(i, "date") : e.type === "time" ? Kt(i, "time") : Kt(i, "datetime");
2339
2347
  let n = null;
2340
- return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: he(n, o) } : { text: String(t) };
2348
+ return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: de(n, o) } : { text: String(t) };
2341
2349
  }
2342
2350
  return { text: String(t) };
2343
2351
  }
2344
2352
  }
2345
- const U = class U {
2353
+ const z = class z {
2346
2354
  constructor(t, e = () => "direct") {
2347
- this.getEditMode = e, this.root = null, this.canvas = null, this.spacer = null, this.overlayLayer = null, this.tooltip = null, this.tooltipTarget = null, this.tooltipMessage = null, this.rowHeight = ft, this.headerHeight = dt, this.lineHeight = 16, this.padding = 12, this.rowHeaderWidth = st, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Ee(), this.textMeasureCache = /* @__PURE__ */ new Map(), this.frame = 0, this.cursorTimer = null, this.pendingCursorPoint = null, this.hoverHeaderColKey = null, this.hoverHeaderIcon = !1, this.hoverActionKey = null, this.activeActionKey = null, this.rowHeightCacheKey = null, this.rowHeightMeasuredVersion = /* @__PURE__ */ new Map(), this.rowHeightMeasureRaf = null, this.rowHeightMeasureTask = null, this.heightIndex = null, this.handleClick = (i) => {
2355
+ this.getEditMode = e, this.root = null, this.canvas = null, this.spacer = null, this.overlayLayer = null, this.tooltip = null, this.tooltipTarget = null, this.tooltipMessage = null, this.rowHeight = ft, this.headerHeight = st, this.lineHeight = 16, this.padding = 12, this.rowHeaderWidth = lt, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Ae(), this.textMeasureCache = /* @__PURE__ */ new Map(), this.frame = 0, this.cursorTimer = null, this.pendingCursorPoint = null, this.hoverHeaderColKey = null, this.hoverHeaderIcon = !1, this.hoverActionKey = null, this.activeActionKey = null, this.rowHeightCacheKey = null, this.rowHeightMeasuredVersion = /* @__PURE__ */ new Map(), this.rowHeightMeasureRaf = null, this.rowHeightMeasureTask = null, this.heightIndex = null, this.handleClick = (i) => {
2348
2356
  if (!this.root || !this.canvas) return;
2349
2357
  const o = this.canvas.getBoundingClientRect(), n = i.clientX - o.left, s = i.clientY - o.top, l = n + this.root.scrollLeft, a = s;
2350
2358
  if (a >= this.headerHeight || l < this.rowHeaderWidth) return;
2351
- const r = this.dataModel.getSchema(), h = this.dataModel.getView(), d = Q(r, h);
2359
+ const r = this.dataModel.getSchema(), h = this.dataModel.getView(), d = Y(r, h);
2352
2360
  let u = this.rowHeaderWidth, p = -1;
2353
- for (let b = 0; b < d.length; b += 1) {
2354
- const S = d[b] ?? 100;
2355
- if (l >= u && l <= u + S) {
2356
- p = b;
2361
+ for (let v = 0; v < d.length; v += 1) {
2362
+ const C = d[v] ?? 100;
2363
+ if (l >= u && l <= u + C) {
2364
+ p = v;
2357
2365
  break;
2358
2366
  }
2359
- u += S;
2367
+ u += C;
2360
2368
  }
2361
2369
  if (p < 0) return;
2362
2370
  const m = r.columns[p];
2363
2371
  if (!m) return;
2364
- const C = d[p] ?? 100, x = 18, g = u + C - x - 4, y = Math.floor((this.headerHeight - x) / 2);
2365
- l >= g && l <= g + x && a >= y && a <= y + x && this.root.dispatchEvent(
2372
+ const b = d[p] ?? 100, x = 18, f = u + b - x - 4, y = Math.floor((this.headerHeight - x) / 2);
2373
+ l >= f && l <= f + x && a >= y && a <= y + x && this.root.dispatchEvent(
2366
2374
  new CustomEvent("extable:filter-sort-open", { bubbles: !0, detail: { colKey: m.key } })
2367
2375
  );
2368
2376
  }, this.handlePointerMove = (i) => {
@@ -2387,7 +2395,7 @@ const U = class U {
2387
2395
  }
2388
2396
  mount(t) {
2389
2397
  this.root = t, this.canvas = document.createElement("canvas");
2390
- const e = U.MAX_CANVAS_DIM_PX;
2398
+ const e = z.MAX_CANVAS_DIM_PX;
2391
2399
  this.canvas.width = Math.max(1, Math.min(e, Math.floor(t.clientWidth || 600))), this.canvas.height = Math.max(1, Math.min(e, Math.floor(t.clientHeight || 400))), this.canvas.style.width = `${this.canvas.width}px`, this.canvas.style.height = `${this.canvas.height}px`, this.canvas.dataset.extableRenderer = "canvas", this.canvas.style.position = "sticky", this.canvas.style.top = "0", this.canvas.style.left = "0", this.canvas.style.zIndex = "1", this.canvas.style.cursor = "cell", this.canvas.addEventListener("pointermove", this.handlePointerMove), this.canvas.addEventListener("pointerdown", this.handlePointerDown), this.canvas.addEventListener("pointerup", this.handlePointerUp), this.canvas.addEventListener("pointerleave", this.handlePointerLeave), this.canvas.addEventListener("click", this.handleClick), this.spacer = document.createElement("div"), this.spacer.style.width = "1px", this.tooltip && this.tooltip.remove(), this.overlayLayer && this.overlayLayer.remove(), this.overlayLayer = document.createElement("div"), this.overlayLayer.className = "extable-overlay-layer", this.tooltip = document.createElement("div"), this.tooltip.className = "extable-tooltip", this.tooltip.dataset.visible = "0", this.overlayLayer.appendChild(this.tooltip), t.innerHTML = "", t.style.position = "relative", t.appendChild(this.overlayLayer), t.appendChild(this.canvas), t.appendChild(this.spacer), this.render();
2392
2400
  }
2393
2401
  setActiveCell(t, e) {
@@ -2401,99 +2409,99 @@ const U = class U {
2401
2409
  if (this.frame += 1, !this.canvas || !this.root) return;
2402
2410
  const e = this.canvas.getContext("2d");
2403
2411
  if (!e) return;
2404
- e.font = `${Z}px ${Y}`;
2412
+ e.font = `${Z}px ${Q}`;
2405
2413
  let i = e.font;
2406
- const o = this.activeRowId === "__all__" && this.activeColKey === "__all__", n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows(), a = Q(n, s), r = n.columns.map((A) => _t(A)), h = /* @__PURE__ */ new Map(), d = n.columns.some((A) => s.wrapText?.[A.key] ?? A.wrapText), u = d ? this.getRowHeightCacheKey(n, s, a) : null;
2414
+ const o = this.activeRowId === "__all__" && this.activeColKey === "__all__", n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows(), a = Y(n, s), r = n.columns.map((T) => Ft(T)), h = /* @__PURE__ */ new Map(), d = n.columns.some((T) => s.wrapText?.[T.key] ?? T.wrapText), u = d ? this.getRowHeightCacheKey(n, s, a) : null;
2407
2415
  u !== this.rowHeightCacheKey && (this.rowHeightCacheKey = u, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null), d || this.cancelRowHeightMeasurement(), this.ensureHeightIndex(l, d ? u : null, d);
2408
2416
  const p = this.heightIndex;
2409
2417
  if (!p) return;
2410
- const m = this.rowHeaderWidth + a.reduce((A, H) => A + (H ?? 0), 0), C = t?.clientWidth ?? (this.root.clientWidth || 600), x = t?.clientHeight ?? (this.root.clientHeight || this.canvas.height || 400), f = U.MAX_CANVAS_DIM_PX, g = Math.max(1, Math.min(f, Math.floor(C))), y = Math.max(1, Math.min(f, Math.floor(x)));
2411
- this.canvas.width !== g && (this.canvas.width = g), this.canvas.height !== y && (this.canvas.height = y), this.canvas.style.width = `${g}px`, this.canvas.style.height = `${y}px`, e.font = `${Z}px ${Y}`, i = e.font, this.refreshTooltipPosition();
2412
- const w = t?.scrollTop ?? this.root.scrollTop, b = t?.scrollLeft ?? this.root.scrollLeft, S = (A) => {
2413
- const H = A + 1, E = Math.max(
2418
+ const m = this.rowHeaderWidth + a.reduce((T, E) => T + (E ?? 0), 0), b = t?.clientWidth ?? (this.root.clientWidth || 600), x = t?.clientHeight ?? (this.root.clientHeight || this.canvas.height || 400), w = z.MAX_CANVAS_DIM_PX, f = Math.max(1, Math.min(w, Math.floor(b))), y = Math.max(1, Math.min(w, Math.floor(x)));
2419
+ this.canvas.width !== f && (this.canvas.width = f), this.canvas.height !== y && (this.canvas.height = y), this.canvas.style.width = `${f}px`, this.canvas.style.height = `${y}px`, e.font = `${Z}px ${Q}`, i = e.font, this.refreshTooltipPosition();
2420
+ const g = t?.scrollTop ?? this.root.scrollTop, v = t?.scrollLeft ?? this.root.scrollLeft, C = (T) => {
2421
+ const E = T + 1, H = Math.max(
2414
2422
  0,
2415
- Math.min(l.length - 1, p.fenwick.lowerBound(H))
2416
- ), N = p.fenwick.sum(E);
2417
- let _ = E, q = 0;
2423
+ Math.min(l.length - 1, p.fenwick.lowerBound(E))
2424
+ ), P = p.fenwick.sum(H);
2425
+ let F = H, q = 0;
2418
2426
  const j = (this.canvas?.height ?? 0) + this.rowHeight * 2;
2419
- for (let R = E; R < l.length && q < j; R += 1)
2420
- q += p.heights[R] ?? this.rowHeight, _ = R + 1;
2421
- return { accum: N, visibleStart: E, visibleEnd: _ };
2427
+ for (let I = H; I < l.length && q < j; I += 1)
2428
+ q += p.heights[I] ?? this.rowHeight, F = I + 1;
2429
+ return { accum: P, visibleStart: H, visibleEnd: F };
2422
2430
  };
2423
- let v = p.fenwick.total();
2424
- const I = this.canvas?.height ?? this.root.clientHeight, D = Math.max(0, I - this.headerHeight);
2425
- let K = Math.max(0, v - D), T = Math.max(0, Math.min(w, K)), { accum: k, visibleStart: L, visibleEnd: F } = S(T);
2431
+ let S = p.fenwick.total();
2432
+ const M = this.canvas?.height ?? this.root.clientHeight, L = Math.max(0, M - this.headerHeight);
2433
+ let _ = Math.max(0, S - L), K = Math.max(0, Math.min(g, _)), { accum: R, visibleStart: A, visibleEnd: D } = C(K);
2426
2434
  if (d && u) {
2427
- const A = {};
2428
- for (let H = L; H < F; H += 1) {
2429
- const E = l[H];
2430
- if (!E) continue;
2431
- const N = this.dataModel.getRowVersion(E.id);
2432
- if (this.rowHeightMeasuredVersion.get(E.id) === N) continue;
2433
- const _ = this.measureRowHeight(e, E, n, a);
2434
- A[E.id] = _, this.rowHeightMeasuredVersion.set(E.id, N);
2435
+ const T = {};
2436
+ for (let E = A; E < D; E += 1) {
2437
+ const H = l[E];
2438
+ if (!H) continue;
2439
+ const P = this.dataModel.getRowVersion(H.id);
2440
+ if (this.rowHeightMeasuredVersion.get(H.id) === P) continue;
2441
+ const F = this.measureRowHeight(e, H, n, a);
2442
+ T[H.id] = F, this.rowHeightMeasuredVersion.set(H.id, P);
2435
2443
  }
2436
- this.applyRowHeightUpdates(A), v = p.fenwick.total(), this.dataModel.setRowHeightsBulk(A), K = Math.max(0, v - D), T = Math.max(0, Math.min(w, K)), { accum: k, visibleStart: L, visibleEnd: F } = S(T), (this.rowHeightMeasureTask || Object.keys(A).length > 0) && this.scheduleRowHeightMeasurement();
2444
+ this.applyRowHeightUpdates(T), S = p.fenwick.total(), this.dataModel.setRowHeightsBulk(T), _ = Math.max(0, S - L), K = Math.max(0, Math.min(g, _)), { accum: R, visibleStart: A, visibleEnd: D } = C(K), (this.rowHeightMeasureTask || Object.keys(T).length > 0) && this.scheduleRowHeightMeasurement();
2437
2445
  }
2438
- this.spacer && (this.spacer.style.height = `${K}px`, this.spacer.style.width = `${m}px`);
2439
- const V = this.rowHeaderWidth - b;
2446
+ this.spacer && (this.spacer.style.height = `${_}px`, this.spacer.style.width = `${m}px`);
2447
+ const V = this.rowHeaderWidth - v;
2440
2448
  e.clearRect(0, 0, this.canvas.width, this.canvas.height), e.fillStyle = "#e5e7eb", e.fillRect(0, 0, this.rowHeaderWidth, this.canvas.height);
2441
- let M = this.headerHeight + k - T;
2442
- for (let A = L; A < F; A += 1) {
2443
- const H = l[A], E = p.heights[A] ?? this.rowHeight;
2444
- e.strokeStyle = "#d0d7de", e.fillStyle = "#e5e7eb", e.fillRect(0, M, this.rowHeaderWidth, E), e.strokeRect(0, M, this.rowHeaderWidth, E);
2445
- const N = this.dataModel.getDisplayIndex(H.id) ?? "";
2446
- this.activeRowId === H.id && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, M, this.rowHeaderWidth, E)), e.fillStyle = "#0f172a", e.font = `bold ${Z}px ${Y}`, e.textAlign = "center", e.textBaseline = "middle", e.fillText(String(N), this.rowHeaderWidth / 2, M + E / 2), e.font = i, e.textAlign = "left", e.textBaseline = "alphabetic", e.save(), e.beginPath(), e.rect(
2449
+ let k = this.headerHeight + R - K;
2450
+ for (let T = A; T < D; T += 1) {
2451
+ const E = l[T], H = p.heights[T] ?? this.rowHeight;
2452
+ e.strokeStyle = "#d0d7de", e.fillStyle = "#e5e7eb", e.fillRect(0, k, this.rowHeaderWidth, H), e.strokeRect(0, k, this.rowHeaderWidth, H);
2453
+ const P = this.dataModel.getDisplayIndex(E.id) ?? "";
2454
+ this.activeRowId === E.id && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, k, this.rowHeaderWidth, H)), e.fillStyle = "#0f172a", e.font = `bold ${Z}px ${Q}`, e.textAlign = "center", e.textBaseline = "middle", e.fillText(String(P), this.rowHeaderWidth / 2, k + H / 2), e.font = i, e.textAlign = "left", e.textBaseline = "alphabetic", e.save(), e.beginPath(), e.rect(
2447
2455
  this.rowHeaderWidth,
2448
2456
  this.headerHeight,
2449
2457
  this.canvas.width - this.rowHeaderWidth,
2450
2458
  this.canvas.height - this.headerHeight
2451
2459
  ), e.clip(), e.translate(V, 0);
2452
- let _ = 0, q = "";
2460
+ let F = 0, q = "";
2453
2461
  for (let j = 0; j < n.columns.length; j += 1) {
2454
- const R = n.columns[j], $ = a[j] ?? 100;
2455
- if (!R) {
2456
- _ += $;
2462
+ const I = n.columns[j], $ = a[j] ?? 100;
2463
+ if (!I) {
2464
+ F += $;
2457
2465
  continue;
2458
2466
  }
2459
- const W = this.dataModel.getCellInteraction(H.id, R.key), it = W.muted;
2467
+ const W = this.dataModel.getCellInteraction(E.id, I.key), it = W.muted;
2460
2468
  e.strokeStyle = "#d0d7de";
2461
- const ot = this.dataModel.resolveConditionalStyle(H.id, R), ht = this.dataModel.getCellStyle(H.id, R.key), qt = r[j] ?? {}, Ut = ot.delta ? lt(qt, ot.delta) : qt, z = ht ? lt(Ut, ht) : Ut, He = n.columns.some((P) => P && P.type === "boolean" && P.unique && this.dataModel.getCell(H.id, P.key) === !0) ? "rgba(59,130,246,0.06)" : it ? "#f3f4f6" : z.backgroundColor ?? "#ffffff";
2462
- e.fillStyle = He, e.fillRect(_, M, $, E), e.strokeRect(_, M, $, E);
2463
- const X = this.dataModel.resolveCellValue(H.id, R), zt = X.textOverride ?? (ot.forceErrorText ? "#ERROR" : void 0), gt = zt ? { text: "#ERROR" } : this.formatValue(X.value, R), Et = R.type === "button" || R.type === "link", Xt = Et ? R.type === "button" ? pt(X.value) : mt(X.value) : null, Gt = Et ? Xt?.label ?? (R.type === "button" ? at(X.value) : ct(X.value)) : "", yt = !!(Et && Xt && Gt && !zt);
2464
- let At = Gt || gt.text;
2465
- R.type === "boolean" && R.unique && (At = X.value === !0 || X.value === "true" || X.value === "1" || X.value === 1 ? "🔵" : "");
2466
- const Yt = R.style?.align ?? (R.type === "number" ? "right" : "left");
2467
- if (this.activeRowId === H.id && this.activeColKey !== null && this.activeColKey === R.key && (e.strokeStyle = "#3b82f6", e.lineWidth = 2, e.strokeRect(_ + 1, M + 1, $ - 2, E - 2), e.lineWidth = 1, Rt(
2469
+ const ot = this.dataModel.resolveConditionalStyle(E.id, I), dt = this.dataModel.getCellStyle(E.id, I.key), zt = r[j] ?? {}, Ut = ot.delta ? rt(zt, ot.delta) : zt, U = dt ? rt(Ut, dt) : Ut, Le = n.columns.some((B) => B && B.type === "boolean" && B.unique && this.dataModel.getCell(E.id, B.key) === !0) ? "rgba(59,130,246,0.06)" : it ? "#f3f4f6" : U.backgroundColor ?? "#ffffff";
2470
+ e.fillStyle = Le, e.fillRect(F, k, $, H), e.strokeRect(F, k, $, H);
2471
+ const X = this.dataModel.resolveCellValue(E.id, I), Xt = X.textOverride ?? (ot.forceErrorText ? "#ERROR" : void 0), gt = Xt ? { text: "#ERROR" } : this.formatValue(X.value, I), Et = I.type === "button" || I.type === "link", Gt = Et ? I.type === "button" ? pt(X.value) : mt(X.value) : null, Yt = Et ? Gt?.label ?? (I.type === "button" ? ct(X.value) : ht(X.value)) : "", yt = !!(Et && Gt && Yt && !Xt);
2472
+ let At = Yt || gt.text;
2473
+ I.type === "boolean" && I.unique && (At = X.value === !0 || X.value === "true" || X.value === "1" || X.value === 1 ? "🔵" : "");
2474
+ const Qt = I.style?.align ?? (I.type === "number" ? "right" : "left");
2475
+ if (this.activeRowId === E.id && this.activeColKey !== null && this.activeColKey === I.key && (e.strokeStyle = "#3b82f6", e.lineWidth = 2, e.strokeRect(F + 1, k + 1, $ - 2, H - 2), e.lineWidth = 1, kt(
2468
2476
  this.dataModel,
2469
2477
  this.selection,
2470
2478
  this.activeRowId,
2471
2479
  this.activeColKey,
2472
2480
  this.getEditMode()
2473
2481
  ))) {
2474
- const P = Se, nt = _ + $ - P - 1, J = M + E - P - 1;
2475
- e.fillStyle = "#3b82f6", e.fillRect(nt, J, P, P), e.strokeStyle = "#ffffff", e.strokeRect(nt + 0.5, J + 0.5, P - 1, P - 1);
2482
+ const B = Me, nt = F + $ - B - 1, J = k + H - B - 1;
2483
+ e.fillStyle = "#3b82f6", e.fillRect(nt, J, B, B), e.strokeStyle = "#ffffff", e.strokeRect(nt + 0.5, J + 0.5, B - 1, B - 1);
2476
2484
  }
2477
- const Qt = yt && R.type === "link" && !it && !z.textColor ? "#2563eb" : void 0, Le = this.getEditMode() === "readonly", De = !!(gt.color || z.textColor || Qt), Ke = !Le && R.formula && W.readonly && !it && !De ? "#99aaff" : void 0;
2478
- e.fillStyle = this.dataModel.hasPending(H.id, R.key) ? "#b91c1c" : gt.color ? gt.color : it ? "#94a3b8" : Qt ?? z.textColor ?? Ke ?? "#0f172a";
2479
- const Jt = s.wrapText?.[R.key] ?? R.wrapText ?? !1, Ht = R.type === "boolean" && (!R.format || R.format === "checkbox"), Fe = R.type === "boolean" && !!(R.format && R.format !== "checkbox");
2485
+ const Jt = yt && I.type === "link" && !it && !U.textColor ? "#2563eb" : void 0, De = this.getEditMode() === "readonly", Ke = !!(gt.color || U.textColor || Jt), _e = !De && I.formula && W.readonly && !it && !Ke ? "#99aaff" : void 0;
2486
+ e.fillStyle = this.dataModel.hasPending(E.id, I.key) ? "#b91c1c" : gt.color ? gt.color : it ? "#94a3b8" : Jt ?? U.textColor ?? _e ?? "#0f172a";
2487
+ const Zt = s.wrapText?.[I.key] ?? I.wrapText ?? !1, Ht = I.type === "boolean" && (!I.format || I.format === "checkbox"), Fe = I.type === "boolean" && !!(I.format && I.format !== "checkbox");
2480
2488
  if (Ht)
2481
2489
  e.font = i, q = "";
2482
2490
  else {
2483
- const P = `${z.italic ? "i" : ""}${z.bold ? "b" : ""}`;
2484
- if (P !== q) {
2485
- const nt = h.get(P);
2491
+ const B = `${U.italic ? "i" : ""}${U.bold ? "b" : ""}`;
2492
+ if (B !== q) {
2493
+ const nt = h.get(B);
2486
2494
  if (nt) e.font = nt;
2487
2495
  else {
2488
- const J = z.bold ? "600 " : "", bt = `${z.italic ? "italic " : ""}${J}${Z}px ${Y}`.trim();
2489
- h.set(P, bt), e.font = bt;
2496
+ const J = U.bold ? "600 " : "", bt = `${U.italic ? "italic " : ""}${J}${Z}px ${Q}`.trim();
2497
+ h.set(B, bt), e.font = bt;
2490
2498
  }
2491
- q = P;
2499
+ q = B;
2492
2500
  }
2493
2501
  }
2494
- const wt = _ + ut, vt = M + rt, Lt = Math.max(0, $ - ut * 2), Dt = Math.max(0, E - (rt + Mt)), _e = {
2495
- underline: !!z.underline || yt && R.type === "link",
2496
- strike: !!z.strike
2502
+ const wt = F + ut, vt = k + at, Lt = Math.max(0, $ - ut * 2), Dt = Math.max(0, H - (at + Mt)), Ve = {
2503
+ underline: !!U.underline || yt && I.type === "link",
2504
+ strike: !!U.strike
2497
2505
  }, et = yt && !Ht ? this.measureTextBounds(
2498
2506
  e,
2499
2507
  At,
@@ -2501,14 +2509,14 @@ const U = class U {
2501
2509
  vt,
2502
2510
  Lt,
2503
2511
  Dt,
2504
- Jt,
2505
- Yt
2512
+ Zt,
2513
+ Qt
2506
2514
  ) : null;
2507
- if (yt && R.type === "button" && et) {
2508
- const J = Math.max(wt, et.x - 6), Ct = Math.max(vt, et.y - 4), bt = Math.min(wt + Lt, et.x + et.width + 6), Ve = Math.min(vt + Dt, et.y + et.height + 4), te = Math.max(0, bt - J), ee = Math.max(0, Ve - Ct);
2515
+ if (yt && I.type === "button" && et) {
2516
+ const J = Math.max(wt, et.x - 6), Ct = Math.max(vt, et.y - 4), bt = Math.min(wt + Lt, et.x + et.width + 6), Ne = Math.min(vt + Dt, et.y + et.height + 4), ee = Math.max(0, bt - J), ie = Math.max(0, Ne - Ct);
2509
2517
  e.save();
2510
- const ie = `${H.id}::${R.key}::button`, Ne = this.hoverActionKey === ie, Pe = this.activeActionKey === ie;
2511
- it ? (e.fillStyle = "#f3f4f6", e.strokeStyle = "#e2e8f0") : Pe ? (e.fillStyle = "#cbd5e1", e.strokeStyle = "#94a3b8") : Ne ? (e.fillStyle = "#e2e8f0", e.strokeStyle = "#94a3b8") : (e.fillStyle = "#f8fafc", e.strokeStyle = "#cbd5e1"), e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(J, Ct, te, ee, 6) : e.rect(J, Ct, te, ee), e.fill(), e.stroke(), e.restore();
2518
+ const oe = `${E.id}::${I.key}::button`, Pe = this.hoverActionKey === oe, Be = this.activeActionKey === oe;
2519
+ it ? (e.fillStyle = "#f3f4f6", e.strokeStyle = "#e2e8f0") : Be ? (e.fillStyle = "#cbd5e1", e.strokeStyle = "#94a3b8") : Pe ? (e.fillStyle = "#e2e8f0", e.strokeStyle = "#94a3b8") : (e.fillStyle = "#f8fafc", e.strokeStyle = "#cbd5e1"), e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(J, Ct, ee, ie, 6) : e.rect(J, Ct, ee, ie), e.fill(), e.stroke(), e.restore();
2512
2520
  }
2513
2521
  this.drawCellText(
2514
2522
  e,
@@ -2517,33 +2525,33 @@ const U = class U {
2517
2525
  vt,
2518
2526
  Lt,
2519
2527
  Dt,
2520
- Jt,
2521
- Yt,
2528
+ Zt,
2529
+ Qt,
2522
2530
  Ht,
2523
2531
  Fe,
2524
- !!R.unique,
2525
- _e
2532
+ !!I.unique,
2533
+ Ve
2526
2534
  );
2527
- const Zt = this.dataModel.getCellMarker(H.id, R.key);
2528
- Zt && Fo(e, _, M, $, E, Zt.level), _ += $;
2535
+ const te = this.dataModel.getCellMarker(E.id, I.key);
2536
+ te && Vo(e, F, k, $, H, te.level), F += $;
2529
2537
  }
2530
- e.restore(), M += E;
2538
+ e.restore(), k += H;
2531
2539
  }
2532
2540
  e.fillStyle = "#e5e7eb", e.fillRect(0, 0, this.canvas.width, this.headerHeight), e.strokeStyle = "#d0d7de", e.strokeRect(0, 0, this.rowHeaderWidth, this.headerHeight), e.fillStyle = "#9ca3af", e.beginPath(), e.moveTo(4, 4), e.lineTo(16, 4), e.lineTo(4, 16), e.closePath(), e.fill(), this.activeRowId && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, 0, this.rowHeaderWidth, this.headerHeight)), e.save(), e.beginPath(), e.rect(this.rowHeaderWidth, 0, this.canvas.width - this.rowHeaderWidth, this.headerHeight), e.clip(), e.translate(V, 0);
2533
- let B = 0;
2534
- for (let A = 0; A < n.columns.length; A += 1) {
2535
- const H = n.columns[A], E = a[A] ?? 100;
2536
- if (!H) {
2537
- B += E;
2541
+ let N = 0;
2542
+ for (let T = 0; T < n.columns.length; T += 1) {
2543
+ const E = n.columns[T], H = a[T] ?? 100;
2544
+ if (!E) {
2545
+ N += H;
2538
2546
  continue;
2539
2547
  }
2540
- this.activeColKey !== null && this.activeColKey === H.key && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(B, 0, E, this.headerHeight)), e.strokeStyle = "#d0d7de", e.strokeRect(B, 0, E, this.headerHeight), e.fillStyle = "#0f172a", e.font = `bold ${Z}px ${Y}`, e.fillText(H.header ?? H.key, B + 8, this.headerHeight - 8), e.font = i;
2541
- const _ = Ie(s, H.key), q = Te(s, H.key), j = this.hoverHeaderColKey !== null && this.hoverHeaderColKey === H.key;
2542
- if (!!_ || q || j) {
2543
- const $ = j ? 0.9 : q || _ ? 0.75 : 0.45, W = 16, ot = B + E - W - 6, ht = Math.floor((this.headerHeight - W) / 2);
2544
- _ ? Vo(e, ot + 3, ht + 3, W - 6, $, _) : _o(e, ot + 2, ht + 2, W - 4, $);
2548
+ this.activeColKey !== null && this.activeColKey === E.key && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(N, 0, H, this.headerHeight)), e.strokeStyle = "#d0d7de", e.strokeRect(N, 0, H, this.headerHeight), e.fillStyle = "#0f172a", e.font = `bold ${Z}px ${Q}`, e.fillText(E.header ?? E.key, N + 8, this.headerHeight - 8), e.font = i;
2549
+ const F = Te(s, E.key), q = Ee(s, E.key), j = this.hoverHeaderColKey !== null && this.hoverHeaderColKey === E.key;
2550
+ if (!!F || q || j) {
2551
+ const $ = j ? 0.9 : q || F ? 0.75 : 0.45, W = 16, ot = N + H - W - 6, dt = Math.floor((this.headerHeight - W) / 2);
2552
+ F ? Po(e, ot + 3, dt + 3, W - 6, $, F) : No(e, ot + 2, dt + 2, W - 4, $);
2545
2553
  }
2546
- B += E;
2554
+ N += H;
2547
2555
  }
2548
2556
  if (e.restore(), this.selection.length) {
2549
2557
  e.save(), e.beginPath(), e.rect(
@@ -2552,18 +2560,18 @@ const U = class U {
2552
2560
  this.canvas.width - this.rowHeaderWidth,
2553
2561
  this.canvas.height - this.headerHeight
2554
2562
  ), e.clip(), e.strokeStyle = "#3b82f6", e.fillStyle = "rgba(59,130,246,0.12)";
2555
- for (const A of this.selection) {
2556
- const H = Math.max(0, Math.min(A.startRow, A.endRow)), E = Math.min(l.length - 1, Math.max(A.startRow, A.endRow)), N = Math.max(0, Math.min(A.startCol, A.endCol)), _ = Math.min(
2563
+ for (const T of this.selection) {
2564
+ const E = Math.max(0, Math.min(T.startRow, T.endRow)), H = Math.min(l.length - 1, Math.max(T.startRow, T.endRow)), P = Math.max(0, Math.min(T.startCol, T.endCol)), F = Math.min(
2557
2565
  n.columns.length - 1,
2558
- Math.max(A.startCol, A.endCol)
2559
- ), q = this.headerHeight + p.fenwick.sum(H) - T, j = p.fenwick.sum(E + 1) - p.fenwick.sum(H);
2560
- let R = this.rowHeaderWidth;
2561
- for (let W = 0; W < N; W += 1)
2562
- R += a[W] ?? 100;
2566
+ Math.max(T.startCol, T.endCol)
2567
+ ), q = this.headerHeight + p.fenwick.sum(E) - K, j = p.fenwick.sum(H + 1) - p.fenwick.sum(E);
2568
+ let I = this.rowHeaderWidth;
2569
+ for (let W = 0; W < P; W += 1)
2570
+ I += a[W] ?? 100;
2563
2571
  let $ = 0;
2564
- for (let W = N; W <= _; W += 1)
2572
+ for (let W = P; W <= F; W += 1)
2565
2573
  $ += a[W] ?? 100;
2566
- R -= b, e.fillRect(R, q, $, j), e.strokeRect(R + 0.5, q + 0.5, $ - 1, j - 1);
2574
+ I -= v, e.fillRect(I, q, $, j), e.strokeRect(I + 0.5, q + 0.5, $ - 1, j - 1);
2567
2575
  }
2568
2576
  e.restore();
2569
2577
  }
@@ -2595,7 +2603,7 @@ const U = class U {
2595
2603
  rowsRef: t,
2596
2604
  idToIndex: s,
2597
2605
  heights: n,
2598
- fenwick: jt.from(n)
2606
+ fenwick: qt.from(n)
2599
2607
  };
2600
2608
  }
2601
2609
  applyRowHeightUpdates(t) {
@@ -2624,8 +2632,8 @@ const U = class U {
2624
2632
  if (!this.canvas) return;
2625
2633
  const t = this.canvas.getContext("2d");
2626
2634
  if (!t) return;
2627
- t.font = `${Z}px ${Y}`;
2628
- const e = this.dataModel.getSchema(), i = this.dataModel.getView(), o = Q(e, i);
2635
+ t.font = `${Z}px ${Q}`;
2636
+ const e = this.dataModel.getSchema(), i = this.dataModel.getView(), o = Y(e, i);
2629
2637
  if (!e.columns.some((u) => i.wrapText?.[u.key] ?? u.wrapText)) return;
2630
2638
  const s = this.getRowHeightCacheKey(e, i, o);
2631
2639
  this.rowHeightCacheKey !== s && (this.rowHeightCacheKey = s, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null);
@@ -2634,7 +2642,7 @@ const U = class U {
2634
2642
  const a = this.dataModel.listRows(), r = {};
2635
2643
  let h = 0;
2636
2644
  const d = performance.now();
2637
- for (; l.nextIndex < a.length && h < U.ROW_HEIGHT_MEASURE_CHUNK && !(performance.now() - d > U.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS); ) {
2645
+ for (; l.nextIndex < a.length && h < z.ROW_HEIGHT_MEASURE_CHUNK && !(performance.now() - d > z.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS); ) {
2638
2646
  const u = a[l.nextIndex];
2639
2647
  if (l.nextIndex += 1, !u) continue;
2640
2648
  const p = this.dataModel.getRowVersion(u.id);
@@ -2649,11 +2657,11 @@ const U = class U {
2649
2657
  }
2650
2658
  hitTest(t) {
2651
2659
  if (!this.root || !this.canvas) return null;
2652
- const e = this.canvas.getBoundingClientRect(), i = t.clientX - e.left, o = t.clientY - e.top, n = i + this.root.scrollLeft, s = this.dataModel.getSchema(), l = this.dataModel.getView(), a = this.dataModel.listRows(), r = this.headerHeight, h = Q(s, l), d = s.columns.some((k) => l.wrapText?.[k.key] ?? k.wrapText), u = d ? this.getRowHeightCacheKey(s, l, h) : null;
2660
+ const e = this.canvas.getBoundingClientRect(), i = t.clientX - e.left, o = t.clientY - e.top, n = i + this.root.scrollLeft, s = this.dataModel.getSchema(), l = this.dataModel.getView(), a = this.dataModel.listRows(), r = this.headerHeight, h = Y(s, l), d = s.columns.some((R) => l.wrapText?.[R.key] ?? R.wrapText), u = d ? this.getRowHeightCacheKey(s, l, h) : null;
2653
2661
  this.ensureHeightIndex(a, u, d);
2654
2662
  const p = this.heightIndex;
2655
2663
  if (!p) return null;
2656
- const m = p.fenwick.total(), C = this.canvas?.height ?? this.root.clientHeight, x = Math.max(0, C - this.headerHeight), f = Math.max(0, m - x), g = Math.max(0, Math.min(this.root.scrollTop, f));
2664
+ const m = p.fenwick.total(), b = this.canvas?.height ?? this.root.clientHeight, x = Math.max(0, b - this.headerHeight), w = Math.max(0, m - x), f = Math.max(0, Math.min(this.root.scrollTop, w));
2657
2665
  if (o < r && i < this.rowHeaderWidth)
2658
2666
  return {
2659
2667
  rowId: "__all__",
@@ -2661,65 +2669,65 @@ const U = class U {
2661
2669
  rect: new DOMRect(e.left, e.top, this.rowHeaderWidth, r)
2662
2670
  };
2663
2671
  if (o < r) {
2664
- let k = this.rowHeaderWidth, L = -1;
2665
- for (let F = 0; F < h.length; F += 1) {
2666
- const V = h[F] ?? 100;
2667
- if (n >= k && n <= k + V) {
2668
- L = F;
2672
+ let R = this.rowHeaderWidth, A = -1;
2673
+ for (let D = 0; D < h.length; D += 1) {
2674
+ const V = h[D] ?? 100;
2675
+ if (n >= R && n <= R + V) {
2676
+ A = D;
2669
2677
  break;
2670
2678
  }
2671
- k += V;
2679
+ R += V;
2672
2680
  }
2673
- if (L >= 0) {
2674
- const F = s.columns[L], V = new DOMRect(
2675
- e.left + k - this.root.scrollLeft,
2681
+ if (A >= 0) {
2682
+ const D = s.columns[A], V = new DOMRect(
2683
+ e.left + R - this.root.scrollLeft,
2676
2684
  e.top,
2677
- h[L] ?? 100,
2685
+ h[A] ?? 100,
2678
2686
  r
2679
2687
  );
2680
- return { rowId: "__header__", colKey: F.key, rect: V };
2688
+ return { rowId: "__header__", colKey: D.key, rect: V };
2681
2689
  }
2682
2690
  return null;
2683
2691
  }
2684
2692
  if (i < this.rowHeaderWidth) {
2685
- const k = o - r + g, L = Math.max(
2693
+ const R = o - r + f, A = Math.max(
2686
2694
  0,
2687
- Math.min(a.length - 1, p.fenwick.lowerBound(k + 1))
2688
- ), F = p.fenwick.sum(L);
2689
- if (L < 0 || L >= a.length) return null;
2690
- const V = a[L], M = e.top + r + F - g, B = new DOMRect(
2695
+ Math.min(a.length - 1, p.fenwick.lowerBound(R + 1))
2696
+ ), D = p.fenwick.sum(A);
2697
+ if (A < 0 || A >= a.length) return null;
2698
+ const V = a[A], k = e.top + r + D - f, N = new DOMRect(
2691
2699
  e.left,
2692
- M,
2700
+ k,
2693
2701
  this.rowHeaderWidth,
2694
- p.heights[L] ?? this.rowHeight
2702
+ p.heights[A] ?? this.rowHeight
2695
2703
  );
2696
- return { rowId: V.id, colKey: null, rect: B };
2697
- }
2698
- const y = o - r + g, w = Math.max(0, Math.min(a.length - 1, p.fenwick.lowerBound(y + 1))), b = p.fenwick.sum(w);
2699
- if (w < 0 || w >= a.length) return null;
2700
- let S = this.rowHeaderWidth, v = -1;
2701
- for (let k = 0; k < h.length; k += 1) {
2702
- const L = h[k] ?? 100;
2703
- if (n >= S && n <= S + L) {
2704
- v = k;
2704
+ return { rowId: V.id, colKey: null, rect: N };
2705
+ }
2706
+ const y = o - r + f, g = Math.max(0, Math.min(a.length - 1, p.fenwick.lowerBound(y + 1))), v = p.fenwick.sum(g);
2707
+ if (g < 0 || g >= a.length) return null;
2708
+ let C = this.rowHeaderWidth, S = -1;
2709
+ for (let R = 0; R < h.length; R += 1) {
2710
+ const A = h[R] ?? 100;
2711
+ if (n >= C && n <= C + A) {
2712
+ S = R;
2705
2713
  break;
2706
2714
  }
2707
- S += L;
2708
- }
2709
- if (v === -1) return null;
2710
- const I = a[w], D = s.columns[v], K = b, T = new DOMRect(
2711
- e.left + S - this.root.scrollLeft,
2712
- e.top + r + K - this.root.scrollTop,
2713
- h[v] ?? 100,
2714
- p.heights[w] ?? this.rowHeight
2715
+ C += A;
2716
+ }
2717
+ if (S === -1) return null;
2718
+ const M = a[g], L = s.columns[S], _ = v, K = new DOMRect(
2719
+ e.left + C - this.root.scrollLeft,
2720
+ e.top + r + _ - this.root.scrollTop,
2721
+ h[S] ?? 100,
2722
+ p.heights[g] ?? this.rowHeight
2715
2723
  );
2716
- return { rowId: I.id, colKey: D.key, rect: T };
2724
+ return { rowId: M.id, colKey: L.key, rect: K };
2717
2725
  }
2718
2726
  hitTestAction(t) {
2719
2727
  if (!this.root || !this.canvas) return null;
2720
2728
  const e = this.hitTest(t);
2721
2729
  if (!e || !e.rowId || !e.colKey || e.rowId === "__all__" || e.rowId === "__header__") return null;
2722
- const o = this.dataModel.getSchema().columns.find((L) => String(L.key) === String(e.colKey));
2730
+ const o = this.dataModel.getSchema().columns.find((A) => String(A.key) === String(e.colKey));
2723
2731
  if (!o || o.type !== "button" && o.type !== "link") return null;
2724
2732
  const n = this.dataModel.resolveCellValue(e.rowId, o), s = this.dataModel.resolveConditionalStyle(e.rowId, o);
2725
2733
  if (n.textOverride ?? (s.forceErrorText ? "#ERROR" : void 0)) return null;
@@ -2727,24 +2735,24 @@ const U = class U {
2727
2735
  if (!a || !a.label) return null;
2728
2736
  const r = this.canvas.getContext("2d");
2729
2737
  if (!r) return null;
2730
- const h = _t(o), d = s.delta ? lt(h, s.delta) : h, u = this.dataModel.getCellStyle(e.rowId, o.key), p = u ? lt(d, u) : d, m = p.bold ? "600 " : "", C = p.italic ? "italic " : "";
2731
- r.save(), r.font = `${C}${m}${Z}px ${Y}`.trim(), r.textBaseline = "alphabetic";
2732
- const f = this.dataModel.getView().wrapText?.[o.key] ?? o.wrapText ?? !1, g = o.style?.align ?? "left", y = e.rect.left + ut, w = e.rect.top + rt, b = Math.max(0, e.rect.width - ut * 2), S = Math.max(
2738
+ const h = Ft(o), d = s.delta ? rt(h, s.delta) : h, u = this.dataModel.getCellStyle(e.rowId, o.key), p = u ? rt(d, u) : d, m = p.bold ? "600 " : "", b = p.italic ? "italic " : "";
2739
+ r.save(), r.font = `${b}${m}${Z}px ${Q}`.trim(), r.textBaseline = "alphabetic";
2740
+ const w = this.dataModel.getView().wrapText?.[o.key] ?? o.wrapText ?? !1, f = o.style?.align ?? "left", y = e.rect.left + ut, g = e.rect.top + at, v = Math.max(0, e.rect.width - ut * 2), C = Math.max(
2733
2741
  0,
2734
- e.rect.height - (rt + Mt)
2735
- ), v = this.measureTextBounds(
2742
+ e.rect.height - (at + Mt)
2743
+ ), S = this.measureTextBounds(
2736
2744
  r,
2737
2745
  a.label,
2738
2746
  y,
2747
+ g,
2748
+ v,
2749
+ C,
2739
2750
  w,
2740
- b,
2741
- S,
2742
- f,
2743
- g
2751
+ f
2744
2752
  );
2745
- if (r.restore(), !v) return null;
2746
- const I = o.type === "button" ? 6 : 2, D = Math.max(e.rect.left, v.x - I), K = Math.max(e.rect.top, v.y - I), T = Math.min(e.rect.right, v.x + v.width + I), k = Math.min(e.rect.bottom, v.y + v.height + I);
2747
- return t.clientX >= D && t.clientX <= T && t.clientY >= K && t.clientY <= k ? { rowId: e.rowId, colKey: String(e.colKey), kind: o.type } : null;
2753
+ if (r.restore(), !S) return null;
2754
+ const M = o.type === "button" ? 6 : 2, L = Math.max(e.rect.left, S.x - M), _ = Math.max(e.rect.top, S.y - M), K = Math.min(e.rect.right, S.x + S.width + M), R = Math.min(e.rect.bottom, S.y + S.height + M);
2755
+ return t.clientX >= L && t.clientX <= K && t.clientY >= _ && t.clientY <= R ? { rowId: e.rowId, colKey: String(e.colKey), kind: o.type } : null;
2748
2756
  }
2749
2757
  isPointInSelection(t, e) {
2750
2758
  if (!this.selection.length) return !1;
@@ -2776,16 +2784,16 @@ const U = class U {
2776
2784
  }
2777
2785
  getCellRect(t, e) {
2778
2786
  if (!this.root || !this.canvas) return null;
2779
- const i = this.canvas.getBoundingClientRect(), o = this.dataModel.getSchema(), n = this.dataModel.getView(), s = this.dataModel.listRows(), l = this.dataModel.getRowIndex(t), a = o.columns.findIndex((C) => C.key === e);
2787
+ const i = this.canvas.getBoundingClientRect(), o = this.dataModel.getSchema(), n = this.dataModel.getView(), s = this.dataModel.listRows(), l = this.dataModel.getRowIndex(t), a = o.columns.findIndex((b) => b.key === e);
2780
2788
  if (l < 0 || a < 0) return null;
2781
- const r = Q(o, n), h = o.columns.some((C) => n.wrapText?.[C.key] ?? C.wrapText), d = h ? this.getRowHeightCacheKey(o, n, r) : null;
2789
+ const r = Y(o, n), h = o.columns.some((b) => n.wrapText?.[b.key] ?? b.wrapText), d = h ? this.getRowHeightCacheKey(o, n, r) : null;
2782
2790
  this.ensureHeightIndex(s, d, h);
2783
2791
  const u = this.heightIndex;
2784
2792
  if (!u) return null;
2785
2793
  const p = u.fenwick.sum(l);
2786
2794
  let m = this.rowHeaderWidth;
2787
- for (let C = 0; C < a; C += 1)
2788
- m += r[C] ?? 100;
2795
+ for (let b = 0; b < a; b += 1)
2796
+ m += r[b] ?? 100;
2789
2797
  return new DOMRect(
2790
2798
  i.left + m - this.root.scrollLeft,
2791
2799
  i.top + this.headerHeight + p - this.root.scrollTop,
@@ -2799,33 +2807,41 @@ const U = class U {
2799
2807
  this.canvas.style.cursor = "crosshair";
2800
2808
  return;
2801
2809
  }
2810
+ if (this.root.dataset.extableColumnResize === "1") {
2811
+ this.canvas.style.cursor = "col-resize";
2812
+ return;
2813
+ }
2802
2814
  {
2803
- const d = this.canvas.getBoundingClientRect(), u = t - d.left, p = e - d.top, m = u + this.root.scrollLeft, C = p, x = this.hoverHeaderColKey, f = this.hoverHeaderIcon;
2804
- let g = null, y = !1;
2805
- if (C >= 0 && C < this.headerHeight && m >= this.rowHeaderWidth) {
2806
- const b = this.dataModel.getSchema(), S = this.dataModel.getView(), v = Q(b, S);
2807
- let I = this.rowHeaderWidth, D = -1;
2808
- for (let T = 0; T < v.length; T += 1) {
2809
- const k = v[T] ?? 100;
2810
- if (m >= I && m <= I + k) {
2811
- D = T;
2815
+ const d = this.canvas.getBoundingClientRect(), u = t - d.left, p = e - d.top, m = u + this.root.scrollLeft, b = p, x = this.hoverHeaderColKey, w = this.hoverHeaderIcon;
2816
+ let f = null, y = !1;
2817
+ if (b >= 0 && b < this.headerHeight && m >= this.rowHeaderWidth) {
2818
+ const v = this.dataModel.getSchema(), C = this.dataModel.getView(), S = Y(v, C);
2819
+ let M = this.rowHeaderWidth, L = -1;
2820
+ for (let K = 0; K < S.length; K += 1) {
2821
+ const R = S[K] ?? 100;
2822
+ if (m >= M && m <= M + R) {
2823
+ L = K;
2812
2824
  break;
2813
2825
  }
2814
- I += k;
2826
+ M += R;
2815
2827
  }
2816
- const K = D >= 0 ? b.columns[D] : null;
2817
- if (K) {
2818
- g = K.key;
2819
- const T = v[D] ?? 100, k = 18, F = I + T - k - 4, V = Math.floor((this.headerHeight - k) / 2);
2820
- y = m >= F && m <= F + k && C >= V && C <= V + k;
2828
+ const _ = L >= 0 ? v.columns[L] : null;
2829
+ if (_) {
2830
+ f = _.key;
2831
+ const K = S[L] ?? 100, R = 18, D = M + K - R - 4, V = Math.floor((this.headerHeight - R) / 2);
2832
+ if (y = m >= D && m <= D + R && b >= V && b <= V + R, m >= M + K - Vt && m <= M + K + Vt && !y) {
2833
+ const N = String(x ?? "") !== String(f ?? "") || !!w != !!y;
2834
+ this.hoverHeaderColKey = f, this.hoverHeaderIcon = y, this.canvas.style.cursor = "col-resize", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, N && this.render();
2835
+ return;
2836
+ }
2821
2837
  }
2822
2838
  }
2823
- const w = String(x ?? "") !== String(g ?? "") || !!f != !!y;
2824
- if (this.hoverHeaderColKey = g, this.hoverHeaderIcon = y, g !== null) {
2825
- this.canvas.style.cursor = y ? "pointer" : "default", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, w && this.render();
2839
+ const g = String(x ?? "") !== String(f ?? "") || !!w != !!y;
2840
+ if (this.hoverHeaderColKey = f, this.hoverHeaderIcon = y, f !== null) {
2841
+ this.canvas.style.cursor = y ? "pointer" : "default", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, g && this.render();
2826
2842
  return;
2827
2843
  }
2828
- w && this.render();
2844
+ g && this.render();
2829
2845
  }
2830
2846
  let i = "cell";
2831
2847
  const o = this.hitTest(new MouseEvent("mousemove", { clientX: t, clientY: e }));
@@ -2863,7 +2879,7 @@ const U = class U {
2863
2879
  this.canvas.style.cursor = "cell";
2864
2880
  return;
2865
2881
  }
2866
- if (this.activeRowId && this.activeColKey !== null && this.activeRowId !== "__all__" && this.activeColKey !== "__all__" && Rt(
2882
+ if (this.activeRowId && this.activeColKey !== null && this.activeRowId !== "__all__" && this.activeColKey !== "__all__" && kt(
2867
2883
  this.dataModel,
2868
2884
  this.selection,
2869
2885
  this.activeRowId,
@@ -2872,8 +2888,8 @@ const U = class U {
2872
2888
  )) {
2873
2889
  const d = this.getCellRect(this.activeRowId, this.activeColKey);
2874
2890
  if (d) {
2875
- const u = ke(d, Me);
2876
- if (Re(t, e, u)) {
2891
+ const u = ke(d, Re);
2892
+ if (Ie(t, e, u)) {
2877
2893
  this.canvas.style.cursor = "crosshair";
2878
2894
  return;
2879
2895
  }
@@ -2909,7 +2925,7 @@ const U = class U {
2909
2925
  }
2910
2926
  l.push(r);
2911
2927
  }
2912
- for (this.textMeasureCache.set(o, { lines: l }); this.textMeasureCache.size > U.TEXT_MEASURE_CACHE_MAX; ) {
2928
+ for (this.textMeasureCache.set(o, { lines: l }); this.textMeasureCache.size > z.TEXT_MEASURE_CACHE_MAX; ) {
2913
2929
  const a = this.textMeasureCache.keys().next().value;
2914
2930
  if (!a) break;
2915
2931
  this.textMeasureCache.delete(a);
@@ -2931,44 +2947,44 @@ const U = class U {
2931
2947
  if (!r.length) return null;
2932
2948
  let h = Number.POSITIVE_INFINITY, d = Number.NEGATIVE_INFINITY, u = Number.POSITIVE_INFINITY, p = Number.NEGATIVE_INFINITY;
2933
2949
  for (let m = 0; m < r.length; m += 1) {
2934
- const C = r[m] ?? "", x = t.measureText(C).width;
2935
- let f = i;
2936
- a === "right" ? f = i + n - x : a === "center" && (f = i + (n - x) / 2);
2937
- const g = o + this.lineHeight * m, y = g + this.lineHeight;
2938
- h = Math.min(h, f), d = Math.max(d, f + x), u = Math.min(u, g), p = Math.max(p, y);
2950
+ const b = r[m] ?? "", x = t.measureText(b).width;
2951
+ let w = i;
2952
+ a === "right" ? w = i + n - x : a === "center" && (w = i + (n - x) / 2);
2953
+ const f = o + this.lineHeight * m, y = f + this.lineHeight;
2954
+ h = Math.min(h, w), d = Math.max(d, w + x), u = Math.min(u, f), p = Math.max(p, y);
2939
2955
  }
2940
2956
  return !Number.isFinite(h) || !Number.isFinite(u) ? null : new DOMRect(h, u, d - h, p - u);
2941
2957
  }
2942
2958
  drawCellText(t, e, i, o, n, s, l, a = "left", r = !1, h = !1, d = !1, u) {
2943
2959
  t.save(), t.beginPath(), t.rect(i - 4, o - 4, n + 8, s + 8), t.clip();
2944
2960
  const p = t.font;
2945
- r ? d ? t.font = `${Lo}px ${Y}` : t.font = "28px sans-serif" : h && (t.font = `${Z}px ${Y}`);
2946
- const m = this.getTextLinesForBounds(t, e, n, l, s), C = m.length * this.lineHeight, x = o + Math.max(0, Math.floor((s - C) / 2)), f = (g, y) => {
2947
- const w = x + this.lineHeight * y;
2948
- let b = i, S = i;
2961
+ r ? d ? t.font = `${Ko}px ${Q}` : t.font = "28px sans-serif" : h && (t.font = `${Z}px ${Q}`);
2962
+ const m = this.getTextLinesForBounds(t, e, n, l, s), b = m.length * this.lineHeight, x = o + Math.max(0, Math.floor((s - b) / 2)), w = (f, y) => {
2963
+ const g = x + this.lineHeight * y;
2964
+ let v = i, C = i;
2949
2965
  if (a === "right")
2950
- t.textAlign = "right", S = i + n, b = S - t.measureText(g).width, t.fillText(g, S, w);
2966
+ t.textAlign = "right", C = i + n, v = C - t.measureText(f).width, t.fillText(f, C, g);
2951
2967
  else if (a === "center") {
2952
2968
  t.textAlign = "center";
2953
- const v = i + n / 2, I = t.measureText(g).width;
2954
- b = v - I / 2, S = v + I / 2, t.fillText(g, v, w);
2969
+ const S = i + n / 2, M = t.measureText(f).width;
2970
+ v = S - M / 2, C = S + M / 2, t.fillText(f, S, g);
2955
2971
  } else
2956
- t.textAlign = "left", b = i, S = i + t.measureText(g).width, t.fillText(g, i, w);
2972
+ t.textAlign = "left", v = i, C = i + t.measureText(f).width, t.fillText(f, i, g);
2957
2973
  if (u?.underline || u?.strike) {
2958
- const v = t.strokeStyle, I = t.lineWidth;
2974
+ const S = t.strokeStyle, M = t.lineWidth;
2959
2975
  if (t.strokeStyle = t.fillStyle, t.lineWidth = 1, t.beginPath(), u.underline) {
2960
- const D = w + 2;
2961
- t.moveTo(b, D), t.lineTo(S, D);
2976
+ const L = g + 2;
2977
+ t.moveTo(v, L), t.lineTo(C, L);
2962
2978
  }
2963
2979
  if (u.strike) {
2964
- const D = w - Math.floor(this.lineHeight / 2) + 2;
2965
- t.moveTo(b, D), t.lineTo(S, D);
2980
+ const L = g - Math.floor(this.lineHeight / 2) + 2;
2981
+ t.moveTo(v, L), t.lineTo(C, L);
2966
2982
  }
2967
- t.stroke(), t.strokeStyle = v, t.lineWidth = I;
2983
+ t.stroke(), t.strokeStyle = S, t.lineWidth = M;
2968
2984
  }
2969
2985
  };
2970
- for (let g = 0; g < m.length; g += 1)
2971
- f(m[g] ?? "", g + 1);
2986
+ for (let f = 0; f < m.length; f += 1)
2987
+ w(m[f] ?? "", f + 1);
2972
2988
  t.textAlign = "left", t.font = p, t.restore();
2973
2989
  }
2974
2990
  formatValue(t, e) {
@@ -2977,15 +2993,15 @@ const U = class U {
2977
2993
  const i = t;
2978
2994
  if (i.kind === "lookup" && typeof i.label == "string")
2979
2995
  return { text: i.label };
2980
- const o = Ae(t);
2996
+ const o = He(t);
2981
2997
  if (o !== null) return { text: o };
2982
2998
  }
2983
2999
  if (e.type === "button")
2984
- return { text: at(t) || String(t) };
2985
- if (e.type === "link")
2986
3000
  return { text: ct(t) || String(t) };
3001
+ if (e.type === "link")
3002
+ return { text: ht(t) || String(t) };
2987
3003
  if (e.type === "tags") {
2988
- const i = $t(t);
3004
+ const i = Wt(t);
2989
3005
  if (i) return { text: i.join(", ") };
2990
3006
  }
2991
3007
  if (e.type === "boolean")
@@ -2993,7 +3009,7 @@ const U = class U {
2993
3009
  if (e.type === "number" && typeof t == "number") {
2994
3010
  const i = t, o = e.format;
2995
3011
  if ((o?.format ?? "decimal") === "scientific") {
2996
- const r = kt(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
3012
+ const r = Rt(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2997
3013
  return { text: r, color: h };
2998
3014
  }
2999
3015
  const s = {};
@@ -3004,7 +3020,7 @@ const U = class U {
3004
3020
  if ((e.type === "int" || e.type === "uint") && typeof t == "number") {
3005
3021
  const i = t, o = e.format, n = o?.format ?? "decimal";
3006
3022
  if (n === "binary" || n === "octal" || n === "hex") {
3007
- const r = Wt(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
3023
+ const r = Ot(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
3008
3024
  return { text: r, color: h };
3009
3025
  }
3010
3026
  const s = {
@@ -3017,16 +3033,16 @@ const U = class U {
3017
3033
  if ((e.type === "date" || e.type === "time" || e.type === "datetime") && (t instanceof Date || typeof t == "string")) {
3018
3034
  const i = e.format, o = e.type === "date" ? i ?? "yyyy-MM-dd" : e.type === "time" ? i ?? "HH:mm" : i ?? "yyyy-MM-dd'T'HH:mm:ss'Z'";
3019
3035
  let n = null;
3020
- return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: he(n, o) } : { text: String(t) };
3036
+ return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: de(n, o) } : { text: String(t) };
3021
3037
  }
3022
3038
  return { text: String(t) };
3023
3039
  }
3024
3040
  };
3025
- U.MAX_CANVAS_DIM_PX = 8192, U.ROW_HEIGHT_MEASURE_CHUNK = 500, U.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS = 8, U.TEXT_MEASURE_CACHE_MAX = 2e3;
3026
- let It = U;
3027
- class No {
3028
- constructor(t, e, i, o, n, s, l, a, r, h, d, u, p, m, C, x) {
3029
- this.dataModel = a, this.onActiveChange = u, this.onSelectionChange = m, this.onUndo = C, this.onRedo = x, this.hitAction = null, this.handleDocumentContextMenu = null, this.selectionRanges = [], this.inputEl = null, this.floatingInputWrapper = null, this.selectionInput = null, this.copyToastEl = null, this.copyToastTimer = null, this.lookupDropdownEl = null, this.lookupDropdownTarget = null, this.lookupCandidates = [], this.lookupHighlightIndex = -1, this.lookupRequestId = 0, this.lookupAbort = null, this.lookupDebounceTimer = null, this.lookupInputCleanup = null, this.lookupRecentHistory = /* @__PURE__ */ new Map(), this.lastCommittedLookupCell = null, this.hoverTooltipEl = null, this.hoverTooltipTarget = null, this.hoverTooltipMessage = null, this.hoverTooltipRequestId = 0, this.hoverTooltipAbort = null, this.externalEditInFlight = !1, this.externalEditRequestId = 0, this.selectionMode = !0, this.lastBooleanCell = null, this.selectionAnchor = null, this.dragging = !1, this.dragStart = null, this.pointerDownClient = null, this.dragMoved = !1, this.dragSelectionChanged = !1, this.suppressNextClick = !1, this.fillDragging = !1, this.fillSource = null, this.fillEndRowIndex = null, this.rootCursorBackup = null, this.lastPointerClient = null, this.autoScrollRaf = null, this.autoScrollActive = !1, this.activeCell = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, this.lastCompositionEnd = 0, this.handleInputCompositionStart = () => {
3041
+ z.MAX_CANVAS_DIM_PX = 8192, z.ROW_HEIGHT_MEASURE_CHUNK = 500, z.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS = 8, z.TEXT_MEASURE_CACHE_MAX = 2e3;
3042
+ let It = z;
3043
+ class Bo {
3044
+ constructor(t, e, i, o, n, s, l, a, r, h, d, u, p, m, b, x, w) {
3045
+ this.dataModel = a, this.onActiveChange = p, this.onSelectionChange = b, this.onUndo = x, this.onRedo = w, this.hitAction = null, this.handleDocumentContextMenu = null, this.selectionRanges = [], this.inputEl = null, this.floatingInputWrapper = null, this.selectionInput = null, this.copyToastEl = null, this.copyToastTimer = null, this.lookupDropdownEl = null, this.lookupDropdownTarget = null, this.lookupCandidates = [], this.lookupHighlightIndex = -1, this.lookupRequestId = 0, this.lookupAbort = null, this.lookupDebounceTimer = null, this.lookupInputCleanup = null, this.lookupRecentHistory = /* @__PURE__ */ new Map(), this.lastCommittedLookupCell = null, this.hoverTooltipEl = null, this.hoverTooltipTarget = null, this.hoverTooltipMessage = null, this.hoverTooltipRequestId = 0, this.hoverTooltipAbort = null, this.externalEditInFlight = !1, this.externalEditRequestId = 0, this.selectionMode = !0, this.lastBooleanCell = null, this.selectionAnchor = null, this.dragging = !1, this.dragStart = null, this.pointerDownClient = null, this.dragMoved = !1, this.dragSelectionChanged = !1, this.suppressNextClick = !1, this.fillDragging = !1, this.fillSource = null, this.fillEndRowIndex = null, this.columnResizing = !1, this.columnResizeState = null, this.rootCursorBackup = null, this.resizeCursorBackup = null, this.lastPointerClient = null, this.autoScrollRaf = null, this.autoScrollActive = !1, this.activeCell = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, this.lastCompositionEnd = 0, this.handleInputCompositionStart = () => {
3030
3046
  this.composing = !0;
3031
3047
  }, this.handleInputCompositionEnd = () => {
3032
3048
  this.composing = !1, this.lastCompositionEnd = Date.now();
@@ -3034,31 +3050,40 @@ class No {
3034
3050
  f?.relatedTarget instanceof HTMLElement && this.lookupDropdownEl?.contains(f.relatedTarget) || this.teardownSelectionInput();
3035
3051
  }, this.handleRootKeydown = async (f) => {
3036
3052
  if (f.defaultPrevented || !this.selectionMode || this.inputEl || f.isComposing || this.composing || !(typeof navigator < "u" && /mac/i.test(navigator.platform) ? f.metaKey : f.ctrlKey)) return;
3037
- const w = f.key.toLowerCase();
3038
- w === "c" ? (f.preventDefault(), await this.copySelection()) : w === "x" && (f.preventDefault(), await this.copySelection(), this.clearSelectionValues());
3053
+ const v = f.key.toLowerCase();
3054
+ v === "c" ? (f.preventDefault(), await this.copySelection()) : v === "x" && (f.preventDefault(), await this.copySelection(), this.clearSelectionValues());
3039
3055
  }, this.handlePointerLeave = () => {
3040
3056
  this.hideHoverTooltip();
3041
3057
  }, this.handlePointerDown = (f) => {
3042
3058
  if (f.button !== 0) return;
3043
- const g = f.target;
3044
- if (g?.closest('button[data-extable-fs-open="1"]') || g?.closest(".extable-filter-sort-trigger") || g?.closest("button.extable-lookup-option") || this.inputEl && f.target && this.inputEl.contains(f.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor() || this.fillDragging) return;
3045
- const y = this.hitTest(f);
3046
- if (!y || y.rowId === "__all__" && y.colKey === "__all__" || y.colKey === "__all__") return;
3047
- const w = xe(this.dataModel, this.selectionRanges);
3048
- if (w && this.activeCell) {
3049
- const K = this.dataModel.getSchema(), T = this.dataModel.listRows(), k = w.endRowIndex, L = w.colIndex, F = T[k], V = K.columns[L];
3050
- if (F && V) {
3051
- const M = this.findHtmlCellElement(F.id, V.key)?.getBoundingClientRect() ?? this.computeCanvasCellRect(F.id, V.key);
3052
- if (M && Rt(
3059
+ const y = f.target;
3060
+ if (y?.closest('button[data-extable-fs-open="1"]') || y?.closest(".extable-filter-sort-trigger") || y?.closest("button.extable-lookup-option") || this.inputEl && f.target && this.inputEl.contains(f.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor() || this.fillDragging) return;
3061
+ const g = this.getColumnResizeHit(f.clientX, f.clientY, f.target);
3062
+ if (g) {
3063
+ f.preventDefault(), this.beginColumnResize(g.colKey, g.colIndex, f.clientX), this.suppressNextClick = !0;
3064
+ try {
3065
+ f.target?.setPointerCapture?.(f.pointerId);
3066
+ } catch {
3067
+ }
3068
+ return;
3069
+ }
3070
+ const v = this.hitTest(f);
3071
+ if (!v || v.rowId === "__all__" && v.colKey === "__all__" || v.colKey === "__all__") return;
3072
+ const C = Se(this.dataModel, this.selectionRanges);
3073
+ if (C && this.activeCell) {
3074
+ const R = this.dataModel.getSchema(), A = this.dataModel.listRows(), D = C.endRowIndex, V = C.colIndex, k = A[D], N = R.columns[V];
3075
+ if (k && N) {
3076
+ const T = this.findHtmlCellElement(k.id, N.key)?.getBoundingClientRect() ?? this.computeCanvasCellRect(k.id, N.key);
3077
+ if (T && kt(
3053
3078
  this.dataModel,
3054
3079
  this.selectionRanges,
3055
3080
  this.activeCell.rowId,
3056
3081
  this.activeCell.colKey,
3057
3082
  this.editMode
3058
3083
  )) {
3059
- const B = ke(M, Me);
3060
- if (Re(f.clientX, f.clientY, B)) {
3061
- f.preventDefault(), this.fillDragging = !0, this.fillSource = w, this.fillEndRowIndex = w.endRowIndex, this.root.dataset.extableFillDragging = "1", this.rootCursorBackup === null && (this.rootCursorBackup = this.root.style.cursor || ""), this.root.style.cursor = "crosshair", this.lastPointerClient = { x: f.clientX, y: f.clientY }, this.dragging = !1, this.dragStart = null, this.suppressNextClick = !0;
3084
+ const E = ke(T, Re);
3085
+ if (Ie(f.clientX, f.clientY, E)) {
3086
+ f.preventDefault(), this.fillDragging = !0, this.fillSource = C, this.fillEndRowIndex = C.endRowIndex, this.root.dataset.extableFillDragging = "1", this.rootCursorBackup === null && (this.rootCursorBackup = this.root.style.cursor || ""), this.root.style.cursor = "crosshair", this.lastPointerClient = { x: f.clientX, y: f.clientY }, this.dragging = !1, this.dragStart = null, this.suppressNextClick = !0;
3062
3087
  try {
3063
3088
  f.target?.setPointerCapture?.(f.pointerId);
3064
3089
  } catch {
@@ -3066,10 +3091,10 @@ class No {
3066
3091
  this.selectionRanges = [
3067
3092
  {
3068
3093
  kind: "cells",
3069
- startRow: w.startRowIndex,
3070
- endRow: w.endRowIndex,
3071
- startCol: w.colIndex,
3072
- endCol: w.colIndex
3094
+ startRow: C.startRowIndex,
3095
+ endRow: C.endRowIndex,
3096
+ startCol: C.colIndex,
3097
+ endCol: C.colIndex
3073
3098
  }
3074
3099
  ], this.onSelectionChange(this.selectionRanges), this.startAutoScroll();
3075
3100
  return;
@@ -3077,32 +3102,36 @@ class No {
3077
3102
  }
3078
3103
  }
3079
3104
  }
3080
- const b = this.dataModel.getSchema(), S = this.dataModel.listRows(), v = y.rowId === "__header__" ? 0 : this.dataModel.getRowIndex(y.rowId), I = b.columns.findIndex((K) => String(K.key) === String(y.colKey));
3081
- if (I < 0) return;
3082
- if (y.rowId === "__header__") {
3083
- if (!S.length) return;
3084
- const K = {
3105
+ const S = this.dataModel.getSchema(), M = this.dataModel.listRows(), L = v.rowId === "__header__" ? 0 : this.dataModel.getRowIndex(v.rowId), _ = S.columns.findIndex((R) => String(R.key) === String(v.colKey));
3106
+ if (_ < 0) return;
3107
+ if (v.rowId === "__header__") {
3108
+ if (!M.length) return;
3109
+ const R = {
3085
3110
  kind: "cells",
3086
3111
  startRow: 0,
3087
- endRow: S.length - 1,
3088
- startCol: I,
3089
- endCol: I
3112
+ endRow: M.length - 1,
3113
+ startCol: _,
3114
+ endCol: _
3090
3115
  };
3091
- this.selectionRanges = [K], this.onSelectionChange(this.selectionRanges), this.dragging = !1, this.selectionMode = !0, this.dragStart = null, this.selectionAnchor = null, this.suppressNextClick = !1;
3092
- const T = S[0], k = b.columns[I];
3093
- T && k && (this.activeCell = { rowId: T.id, colKey: k.key }, this.onActiveChange(T.id, k.key)), this.focusSelectionInput("");
3116
+ this.selectionRanges = [R], this.onSelectionChange(this.selectionRanges), this.dragging = !1, this.selectionMode = !0, this.dragStart = null, this.selectionAnchor = null, this.suppressNextClick = !1;
3117
+ const A = M[0], D = S.columns[_];
3118
+ A && D && (this.activeCell = { rowId: A.id, colKey: D.key }, this.onActiveChange(A.id, D.key)), this.focusSelectionInput("");
3094
3119
  return;
3095
3120
  }
3096
- if (v < 0) return;
3097
- const D = y.colKey === null ? "rows" : "cells";
3098
- this.dragging = !0, this.pointerDownClient = { x: f.clientX, y: f.clientY }, this.dragMoved = !1, this.dragSelectionChanged = !1, this.dragStart = { rowIndex: v, colIndex: I, kind: D }, this.suppressNextClick = !1, this.selectionMode = !0, this.selectionAnchor = null, this.lastCommittedLookupCell = null, this.lastPointerClient = { x: f.clientX, y: f.clientY };
3121
+ if (L < 0) return;
3122
+ const K = v.colKey === null ? "rows" : "cells";
3123
+ this.dragging = !0, this.pointerDownClient = { x: f.clientX, y: f.clientY }, this.dragMoved = !1, this.dragSelectionChanged = !1, this.dragStart = { rowIndex: L, colIndex: _, kind: K }, this.suppressNextClick = !1, this.selectionMode = !0, this.selectionAnchor = null, this.lastCommittedLookupCell = null, this.lastPointerClient = { x: f.clientX, y: f.clientY };
3099
3124
  try {
3100
3125
  f.target?.setPointerCapture?.(f.pointerId);
3101
3126
  } catch {
3102
3127
  }
3103
3128
  this.startAutoScroll();
3104
3129
  }, this.handlePointerMove = (f) => {
3105
- if (this.lastPointerClient = { x: f.clientX, y: f.clientY }, this.fillDragging && this.fillSource) {
3130
+ if (this.lastPointerClient = { x: f.clientX, y: f.clientY }, this.columnResizing) {
3131
+ this.updateColumnResize(f.clientX);
3132
+ return;
3133
+ }
3134
+ if (this.fillDragging && this.fillSource) {
3106
3135
  this.updateFillDragFromClientPoint(f.clientX, f.clientY);
3107
3136
  return;
3108
3137
  }
@@ -3111,67 +3140,76 @@ class No {
3111
3140
  return;
3112
3141
  }
3113
3142
  if (!this.dragMoved && this.pointerDownClient) {
3114
- const g = f.clientX - this.pointerDownClient.x, y = f.clientY - this.pointerDownClient.y;
3115
- if (g * g + y * y < 9) return;
3143
+ const y = f.clientX - this.pointerDownClient.x, g = f.clientY - this.pointerDownClient.y;
3144
+ if (y * y + g * g < 9) return;
3116
3145
  this.dragMoved = !0;
3117
3146
  }
3118
3147
  this.updateDragFromClientPoint(f.clientX, f.clientY);
3119
3148
  }, this.handlePointerUp = (f) => {
3149
+ if (this.columnResizing) {
3150
+ this.endColumnResize();
3151
+ try {
3152
+ f.target?.releasePointerCapture?.(f.pointerId);
3153
+ } catch {
3154
+ }
3155
+ this.suppressNextClick = !0;
3156
+ return;
3157
+ }
3120
3158
  if (this.fillDragging && this.fillSource) {
3121
- const y = this.fillSource, w = this.fillEndRowIndex ?? y.endRowIndex;
3159
+ const g = this.fillSource, v = this.fillEndRowIndex ?? g.endRowIndex;
3122
3160
  this.fillDragging = !1, this.fillSource = null, this.fillEndRowIndex = null, this.root.dataset.extableFillDragging = "", this.rootCursorBackup !== null && (this.root.style.cursor = this.rootCursorBackup, this.rootCursorBackup = null), this.stopAutoScroll();
3123
3161
  try {
3124
3162
  f.target?.releasePointerCapture?.(f.pointerId);
3125
3163
  } catch {
3126
3164
  }
3127
- this.commitFill(y, w), this.suppressNextClick = !0;
3165
+ this.commitFill(g, v), this.suppressNextClick = !0;
3128
3166
  return;
3129
3167
  }
3130
3168
  if (!this.dragging) return;
3131
3169
  this.dragging = !1, this.dragStart = null;
3132
- const g = this.dragSelectionChanged;
3170
+ const y = this.dragSelectionChanged;
3133
3171
  this.pointerDownClient = null, this.dragMoved = !1, this.dragSelectionChanged = !1, this.stopAutoScroll();
3134
3172
  try {
3135
3173
  f.target?.releasePointerCapture?.(f.pointerId);
3136
3174
  } catch {
3137
3175
  }
3138
- if (g && (this.suppressNextClick = !0), this.suppressNextClick && this.activeCell && this.activeCell.colKey !== null) {
3139
- const y = this.dataModel.getCell(this.activeCell.rowId, this.activeCell.colKey);
3140
- this.focusSelectionInput(this.cellToClipboardString(y));
3176
+ if (y && (this.suppressNextClick = !0), this.suppressNextClick && this.activeCell && this.activeCell.colKey !== null) {
3177
+ const g = this.dataModel.getCell(this.activeCell.rowId, this.activeCell.colKey);
3178
+ this.focusSelectionInput(this.cellToClipboardString(g));
3141
3179
  }
3142
3180
  }, this.handleSelectionCopy = (f) => {
3143
3181
  if (!this.selectionMode) return;
3144
- const g = this.buildSelectionClipboardPayload();
3145
- g && (f.preventDefault(), f.clipboardData?.setData("text/plain", g.text), f.clipboardData?.setData("text/tab-separated-values", g.text), f.clipboardData?.setData("text/html", g.html), this.showCopyToast(`Copied ${g.cellCount} cells`, "info"));
3182
+ const y = this.buildSelectionClipboardPayload();
3183
+ y && (f.preventDefault(), f.clipboardData?.setData("text/plain", y.text), f.clipboardData?.setData("text/tab-separated-values", y.text), f.clipboardData?.setData("text/html", y.html), this.showCopyToast(`Copied ${y.cellCount} cells`, "info"));
3146
3184
  }, this.handleSelectionCut = (f) => {
3147
3185
  if (!this.selectionMode) return;
3148
- const g = this.buildSelectionClipboardPayload();
3149
- g && (f.preventDefault(), f.clipboardData?.setData("text/plain", g.text), f.clipboardData?.setData("text/tab-separated-values", g.text), f.clipboardData?.setData("text/html", g.html), this.clearSelectionValues());
3186
+ const y = this.buildSelectionClipboardPayload();
3187
+ y && (f.preventDefault(), f.clipboardData?.setData("text/plain", y.text), f.clipboardData?.setData("text/tab-separated-values", y.text), f.clipboardData?.setData("text/html", y.html), this.clearSelectionValues());
3150
3188
  }, this.handleSelectionPaste = (f) => {
3151
3189
  if (!this.selectionMode) return;
3152
3190
  f.preventDefault();
3153
- const g = f.clipboardData?.getData("text/html") ?? "", y = f.clipboardData?.getData("text/tab-separated-values") ?? "", w = f.clipboardData?.getData("text/plain") ?? "", b = this.parseClipboardGrid({ html: g, tsv: y, text: w });
3154
- b && this.applyClipboardGrid(b);
3191
+ const y = f.clipboardData?.getData("text/html") ?? "", g = f.clipboardData?.getData("text/tab-separated-values") ?? "", v = f.clipboardData?.getData("text/plain") ?? "", C = this.parseClipboardGrid({ html: y, tsv: g, text: v });
3192
+ C && this.applyClipboardGrid(C);
3155
3193
  }, this.handleSelectionCompositionStart = (f) => {
3156
3194
  if (!this.selectionMode) return;
3157
- const g = this.activeCell;
3158
- if (!(!g || g.colKey === null)) {
3159
- if (this.isCellReadonly(g.rowId, g.colKey)) {
3195
+ const y = this.activeCell;
3196
+ if (!(!y || y.colKey === null)) {
3197
+ if (this.isCellReadonly(y.rowId, y.colKey)) {
3160
3198
  f?.preventDefault?.(), f?.stopPropagation?.();
3161
- const y = this.dataModel.getCell(g.rowId, g.colKey), w = this.cellToClipboardString(y);
3162
- this.teardownSelectionInput(), this.focusSelectionInput(w);
3199
+ const g = this.dataModel.getCell(y.rowId, y.colKey), v = this.cellToClipboardString(g);
3200
+ this.teardownSelectionInput(), this.focusSelectionInput(v);
3163
3201
  return;
3164
3202
  }
3165
3203
  this.selectionMode = !1, this.openEditorAtActiveCell();
3166
3204
  }
3167
3205
  }, this.handleSelectionBeforeInput = (f) => {
3168
3206
  if (!this.selectionMode) return;
3169
- const g = this.activeCell;
3170
- if (!(!g || g.colKey === null) && this.isCellReadonly(g.rowId, g.colKey)) {
3207
+ const y = this.activeCell;
3208
+ if (!(!y || y.colKey === null) && this.isCellReadonly(y.rowId, y.colKey)) {
3171
3209
  f.preventDefault();
3172
3210
  try {
3173
- const y = this.dataModel.getCell(g.rowId, g.colKey), w = this.cellToClipboardString(y), b = this.ensureSelectionInput();
3174
- b.value = w, b.select();
3211
+ const g = this.dataModel.getCell(y.rowId, y.colKey), v = this.cellToClipboardString(g), C = this.ensureSelectionInput();
3212
+ C.value = v, C.select();
3175
3213
  } catch {
3176
3214
  }
3177
3215
  }
@@ -3183,55 +3221,55 @@ class No {
3183
3221
  }
3184
3222
  if (!this.selectionMode || f.key === "Shift" || f.key === "Control" || f.key === "Alt" || f.key === "Meta" || f.key === "CapsLock" || f.key === "NumLock" || f.key === "ScrollLock")
3185
3223
  return;
3186
- const g = typeof navigator < "u" && /mac/i.test(navigator.platform);
3187
- if (g ? f.metaKey : f.ctrlKey) {
3188
- const v = f.key.toLowerCase();
3189
- if (v === "z") {
3190
- f.preventDefault(), g && f.shiftKey ? this.onRedo() : this.onUndo(), this.selectionAnchor = null;
3224
+ const y = typeof navigator < "u" && /mac/i.test(navigator.platform);
3225
+ if (y ? f.metaKey : f.ctrlKey) {
3226
+ const M = f.key.toLowerCase();
3227
+ if (M === "z") {
3228
+ f.preventDefault(), y && f.shiftKey ? this.onRedo() : this.onUndo(), this.selectionAnchor = null;
3191
3229
  return;
3192
3230
  }
3193
- if (v === "y") {
3231
+ if (M === "y") {
3194
3232
  f.preventDefault(), this.onRedo(), this.selectionAnchor = null;
3195
3233
  return;
3196
3234
  }
3197
- if (v === "c") {
3235
+ if (M === "c") {
3198
3236
  f.preventDefault(), await this.copySelection(), this.selectionAnchor = null;
3199
3237
  return;
3200
3238
  }
3201
- if (v === "x") {
3239
+ if (M === "x") {
3202
3240
  f.preventDefault(), await this.copySelection(), this.clearSelectionValues(), this.selectionAnchor = null;
3203
3241
  return;
3204
3242
  }
3205
- if (v === "v") {
3243
+ if (M === "v") {
3206
3244
  this.selectionAnchor = null;
3207
3245
  return;
3208
3246
  }
3209
3247
  }
3210
3248
  if (f.key === " " && this.activeCell.colKey !== null) {
3211
- const v = this.findColumn(this.activeCell.colKey);
3212
- if (v?.type === "button" || v?.type === "link") {
3213
- f.preventDefault(), this.triggerCellAction(this.activeCell.rowId, this.activeCell.colKey, v.type), this.selectionAnchor = null;
3249
+ const M = this.findColumn(this.activeCell.colKey);
3250
+ if (M?.type === "button" || M?.type === "link") {
3251
+ f.preventDefault(), this.triggerCellAction(this.activeCell.rowId, this.activeCell.colKey, M.type), this.selectionAnchor = null;
3214
3252
  return;
3215
3253
  }
3216
- if (v?.type === "boolean") {
3254
+ if (M?.type === "boolean") {
3217
3255
  f.preventDefault(), this.toggleBoolean(this.activeCell.rowId, this.activeCell.colKey), this.selectionAnchor = null;
3218
3256
  return;
3219
3257
  }
3220
3258
  this.selectionAnchor = null;
3221
3259
  return;
3222
3260
  }
3223
- const w = f.key === "Tab", b = f.key === "Enter", S = f.key === "ArrowLeft" || f.key === "ArrowRight" || f.key === "ArrowUp" || f.key === "ArrowDown";
3224
- if (w || b || S) {
3225
- if (f.preventDefault(), this.teardownSelectionInput(), w) {
3261
+ const v = f.key === "Tab", C = f.key === "Enter", S = f.key === "ArrowLeft" || f.key === "ArrowRight" || f.key === "ArrowUp" || f.key === "ArrowDown";
3262
+ if (v || C || S) {
3263
+ if (f.preventDefault(), this.teardownSelectionInput(), v) {
3226
3264
  this.moveActiveCell(0, f.shiftKey ? -1 : 1, !1);
3227
3265
  return;
3228
3266
  }
3229
- if (b) {
3267
+ if (C) {
3230
3268
  this.moveActiveCell(f.shiftKey ? -1 : 1, 0, !1);
3231
3269
  return;
3232
3270
  }
3233
- const v = f.shiftKey;
3234
- f.key === "ArrowLeft" ? this.moveActiveCell(0, -1, v) : f.key === "ArrowRight" ? this.moveActiveCell(0, 1, v) : f.key === "ArrowUp" ? this.moveActiveCell(-1, 0, v) : f.key === "ArrowDown" && this.moveActiveCell(1, 0, v);
3271
+ const M = f.shiftKey;
3272
+ f.key === "ArrowLeft" ? this.moveActiveCell(0, -1, M) : f.key === "ArrowRight" ? this.moveActiveCell(0, 1, M) : f.key === "ArrowUp" ? this.moveActiveCell(-1, 0, M) : f.key === "ArrowDown" && this.moveActiveCell(1, 0, M);
3235
3273
  return;
3236
3274
  }
3237
3275
  if (this.activeCell.colKey !== null && this.isCellReadonly(this.activeCell.rowId, this.activeCell.colKey)) {
@@ -3240,8 +3278,8 @@ class No {
3240
3278
  }
3241
3279
  this.selectionMode = !1, this.selectionAnchor = null, this.openEditorAtActiveCell();
3242
3280
  }, this.handleClick = (f) => {
3243
- const g = f.target;
3244
- if (f.button !== 0 || g?.closest("button.extable-lookup-option") || g?.closest('button[data-extable-fs-open="1"]'))
3281
+ const y = f.target;
3282
+ if (f.button !== 0 || y?.closest("button.extable-lookup-option") || y?.closest('button[data-extable-fs-open="1"]'))
3245
3283
  return;
3246
3284
  if (this.suppressNextClick) {
3247
3285
  this.suppressNextClick = !1;
@@ -3249,92 +3287,92 @@ class No {
3249
3287
  }
3250
3288
  if (this.inputEl && f.target && this.inputEl.contains(f.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor())
3251
3289
  return;
3252
- const y = this.getHitAtClientPoint(f.clientX, f.clientY, f.target);
3253
- if (f.target?.closest("input.extable-unique-radio") && y) {
3254
- if (y.colKey === null) return;
3255
- const T = this.findColumn(y.colKey);
3256
- if (T && T.type === "boolean" && T.unique) {
3257
- this.toggleBoolean(y.rowId, y.colKey), f.preventDefault();
3290
+ const g = this.getHitAtClientPoint(f.clientX, f.clientY, f.target);
3291
+ if (f.target?.closest("input.extable-unique-radio") && g) {
3292
+ if (g.colKey === null) return;
3293
+ const R = this.findColumn(g.colKey);
3294
+ if (R && R.type === "boolean" && R.unique) {
3295
+ this.toggleBoolean(g.rowId, g.colKey), f.preventDefault();
3258
3296
  return;
3259
3297
  }
3260
3298
  }
3261
- if (!y) return;
3262
- const b = this.hitAction ? this.hitAction(f) : null;
3263
- if (b) {
3264
- if (b.kind === "tag-remove") {
3265
- if (this.removeTagValue(b.rowId, b.colKey, b.tagIndex)) {
3299
+ if (!g) return;
3300
+ const C = this.hitAction ? this.hitAction(f) : null;
3301
+ if (C) {
3302
+ if (C.kind === "tag-remove") {
3303
+ if (this.removeTagValue(C.rowId, C.colKey, C.tagIndex)) {
3266
3304
  f.preventDefault();
3267
3305
  return;
3268
3306
  }
3269
- } else if (this.triggerCellAction(b.rowId, b.colKey, b.kind)) {
3307
+ } else if (this.triggerCellAction(C.rowId, C.colKey, C.kind)) {
3270
3308
  f.preventDefault();
3271
3309
  return;
3272
3310
  }
3273
3311
  }
3274
- const S = this.selectionMode && !f.shiftKey && !f.metaKey && !f.ctrlKey && this.activeCell?.rowId === y.rowId && String(this.activeCell?.colKey) === String(y.colKey);
3275
- if (y.rowId === "__all__" && y.colKey === "__all__") {
3276
- const T = this.dataModel.getSchema(), k = this.dataModel.listRows();
3277
- this.teardownInput(!1), k.length && T.columns.length ? (this.selectionRanges = [
3312
+ const S = this.selectionMode && !f.shiftKey && !f.metaKey && !f.ctrlKey && this.activeCell?.rowId === g.rowId && String(this.activeCell?.colKey) === String(g.colKey);
3313
+ if (g.rowId === "__all__" && g.colKey === "__all__") {
3314
+ const R = this.dataModel.getSchema(), A = this.dataModel.listRows();
3315
+ this.teardownInput(!1), A.length && R.columns.length ? (this.selectionRanges = [
3278
3316
  {
3279
3317
  kind: "cells",
3280
3318
  startRow: 0,
3281
- endRow: k.length - 1,
3319
+ endRow: A.length - 1,
3282
3320
  startCol: 0,
3283
- endCol: T.columns.length - 1
3321
+ endCol: R.columns.length - 1
3284
3322
  }
3285
3323
  ], this.activeCell = { rowId: "__all__", colKey: "__all__" }, this.onActiveChange("__all__", "__all__"), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("")) : (this.activeCell = null, this.onActiveChange("__all__", "__all__"), this.selectionAnchor = null);
3286
3324
  return;
3287
3325
  }
3288
- if (this.onRowSelect(y.rowId), y.rowId === "__header__") {
3289
- const T = this.dataModel.getSchema(), k = this.dataModel.listRows(), L = T.columns.findIndex((F) => String(F.key) === String(y.colKey));
3290
- k.length && L >= 0 && (this.selectionRanges = [
3326
+ if (this.onRowSelect(g.rowId), g.rowId === "__header__") {
3327
+ const R = this.dataModel.getSchema(), A = this.dataModel.listRows(), D = R.columns.findIndex((V) => String(V.key) === String(g.colKey));
3328
+ A.length && D >= 0 && (this.selectionRanges = [
3291
3329
  {
3292
3330
  kind: "cells",
3293
3331
  startRow: 0,
3294
- endRow: k.length - 1,
3295
- startCol: L,
3296
- endCol: L
3332
+ endRow: A.length - 1,
3333
+ startCol: D,
3334
+ endCol: D
3297
3335
  }
3298
- ], this.activeCell = { rowId: k[0].id, colKey: y.colKey }, this.onActiveChange(this.activeCell.rowId, this.activeCell.colKey), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput(""));
3336
+ ], this.activeCell = { rowId: A[0].id, colKey: g.colKey }, this.onActiveChange(this.activeCell.rowId, this.activeCell.colKey), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput(""));
3299
3337
  return;
3300
3338
  }
3301
- if (this.applySelectionFromHit(f, y), y.colKey === null || y.colKey === "__all__") {
3339
+ if (this.applySelectionFromHit(f, g), g.colKey === null || g.colKey === "__all__") {
3302
3340
  this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("");
3303
3341
  return;
3304
3342
  }
3305
- if (y.rowId === "__header__") {
3343
+ if (g.rowId === "__header__") {
3306
3344
  this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("");
3307
3345
  return;
3308
3346
  }
3309
- if (this.isCellReadonly(y.rowId, y.colKey)) {
3347
+ if (this.isCellReadonly(g.rowId, g.colKey)) {
3310
3348
  this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1);
3311
- const T = this.dataModel.getCell(y.rowId, y.colKey);
3312
- this.focusSelectionInput(this.cellToClipboardString(T));
3349
+ const R = this.dataModel.getCell(g.rowId, g.colKey);
3350
+ this.focusSelectionInput(this.cellToClipboardString(R));
3313
3351
  return;
3314
3352
  }
3315
- if (this.findColumn(y.colKey)?.type === "boolean") {
3316
- const T = this.lastBooleanCell?.rowId === y.rowId && String(this.lastBooleanCell?.colKey) === String(y.colKey);
3317
- if (this.lastBooleanCell = { rowId: y.rowId, colKey: y.colKey }, this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1), this.teardownSelectionInput(), T) {
3318
- this.toggleBoolean(y.rowId, y.colKey), this.focusSelectionInput("");
3353
+ if (this.findColumn(g.colKey)?.type === "boolean") {
3354
+ const R = this.lastBooleanCell?.rowId === g.rowId && String(this.lastBooleanCell?.colKey) === String(g.colKey);
3355
+ if (this.lastBooleanCell = { rowId: g.rowId, colKey: g.colKey }, this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1), this.teardownSelectionInput(), R) {
3356
+ this.toggleBoolean(g.rowId, g.colKey), this.focusSelectionInput("");
3319
3357
  return;
3320
3358
  }
3321
3359
  this.focusSelectionInput("");
3322
3360
  return;
3323
3361
  }
3324
3362
  this.lastBooleanCell = null, this.selectionAnchor = null, this.teardownInput(!1);
3325
- const D = this.dataModel.getCell(y.rowId, y.colKey), K = this.cellToClipboardString(D);
3363
+ const _ = this.dataModel.getCell(g.rowId, g.colKey), K = this.cellToClipboardString(_);
3326
3364
  this.focusSelectionInput(K), S && (this.selectionMode = !1, this.openEditorAtActiveCell());
3327
3365
  }, this.handleContextMenu = (f) => {
3328
- const g = f.target;
3366
+ const y = f.target;
3329
3367
  if (f.ctrlKey) {
3330
3368
  f.preventDefault();
3331
3369
  return;
3332
3370
  }
3333
- if (!g || !this.root.contains(g)) return;
3371
+ if (!y || !this.root.contains(y)) return;
3334
3372
  f.preventDefault(), f.stopPropagation();
3335
- const y = this.hitTest(f), w = y?.rowId ?? null, b = y?.colKey ?? null;
3336
- this.onContextMenu(w, b, f.clientX, f.clientY);
3337
- }, this.root = t, this.editMode = e, this.onEdit = i, this.onRowSelect = o, this.onMove = n, this.hitTest = s, this.hitAction = l, this.sequenceLangs = r, this.isCellReadonly = h, this.onCellAction = d, this.onContextMenu = p, this.bind();
3373
+ const g = this.hitTest(f), v = g?.rowId ?? null, C = g?.colKey ?? null;
3374
+ this.onContextMenu(v, C, f.clientX, f.clientY);
3375
+ }, this.root = t, this.editMode = e, this.onEdit = i, this.onRowSelect = o, this.onMove = n, this.hitTest = s, this.hitAction = l, this.sequenceLangs = r, this.isCellReadonly = h, this.onCellAction = d, this.onViewChange = u, this.onContextMenu = m, this.bind();
3338
3376
  }
3339
3377
  setEditMode(t) {
3340
3378
  this.editMode = t;
@@ -3345,9 +3383,9 @@ class No {
3345
3383
  this.selectionRanges = [], this.activeCell = null, this.selectionAnchor = null, this.lastBooleanCell = null, this.teardownInput(!0), this.onActiveChange(null, null), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3346
3384
  return;
3347
3385
  }
3348
- const i = e.length - 1, o = t.columns.length - 1, n = this.activeCell?.rowId ?? null, s = this.activeCell?.colKey ?? null, l = n ? this.dataModel.getRowIndex(n) : -1, a = s !== null ? t.columns.findIndex((g) => String(g.key) === String(s)) : -1;
3386
+ const i = e.length - 1, o = t.columns.length - 1, n = this.activeCell?.rowId ?? null, s = this.activeCell?.colKey ?? null, l = n ? this.dataModel.getRowIndex(n) : -1, a = s !== null ? t.columns.findIndex((f) => String(f.key) === String(s)) : -1;
3349
3387
  if (l >= 0 && a >= 0) {
3350
- let g = !1;
3388
+ let f = !1;
3351
3389
  if (!this.selectionRanges.length)
3352
3390
  this.selectionRanges = [
3353
3391
  {
@@ -3357,29 +3395,29 @@ class No {
3357
3395
  startCol: a,
3358
3396
  endCol: a
3359
3397
  }
3360
- ], g = !0;
3398
+ ], f = !0;
3361
3399
  else {
3362
- const y = this.selectionRanges.map((w) => {
3363
- const b = (v, I) => Math.max(0, Math.min(I, v)), S = {
3364
- ...w,
3365
- startRow: b(w.startRow, i),
3366
- endRow: b(w.endRow, i),
3367
- startCol: b(w.startCol, o),
3368
- endCol: b(w.endCol, o)
3400
+ const y = this.selectionRanges.map((g) => {
3401
+ const v = (S, M) => Math.max(0, Math.min(M, S)), C = {
3402
+ ...g,
3403
+ startRow: v(g.startRow, i),
3404
+ endRow: v(g.endRow, i),
3405
+ startCol: v(g.startCol, o),
3406
+ endCol: v(g.endCol, o)
3369
3407
  };
3370
- return (S.startRow !== w.startRow || S.endRow !== w.endRow || S.startCol !== w.startCol || S.endCol !== w.endCol) && (g = !0), S;
3408
+ return (C.startRow !== g.startRow || C.endRow !== g.endRow || C.startCol !== g.startCol || C.endCol !== g.endCol) && (f = !0), C;
3371
3409
  });
3372
3410
  this.selectionRanges = y;
3373
3411
  }
3374
- g && this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3412
+ f && this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3375
3413
  return;
3376
3414
  }
3377
3415
  const r = s ?? t.columns[0]?.key ?? "";
3378
- let h = t.columns.findIndex((g) => String(g.key) === String(r));
3416
+ let h = t.columns.findIndex((f) => String(f.key) === String(r));
3379
3417
  h < 0 && (h = 0);
3380
- const d = t.columns[h]?.key ?? "", u = n ? this.dataModel.getBaseRowIndex(n) : 0, p = e[e.length - 1] ?? e[0] ?? null, m = e.find((g) => this.dataModel.getBaseRowIndex(g.id) >= u) ?? p;
3418
+ const d = t.columns[h]?.key ?? "", u = n ? this.dataModel.getBaseRowIndex(n) : 0, p = e[e.length - 1] ?? e[0] ?? null, m = e.find((f) => this.dataModel.getBaseRowIndex(f.id) >= u) ?? p;
3381
3419
  if (!m) return;
3382
- const C = m.id, x = this.dataModel.getRowIndex(C);
3420
+ const b = m.id, x = this.dataModel.getRowIndex(b);
3383
3421
  this.selectionAnchor = null, this.lastBooleanCell = null, this.teardownInput(!1), this.selectionRanges = [
3384
3422
  {
3385
3423
  kind: "cells",
@@ -3388,9 +3426,9 @@ class No {
3388
3426
  startCol: h,
3389
3427
  endCol: h
3390
3428
  }
3391
- ], this.activeCell = { rowId: C, colKey: d }, this.onActiveChange(C, d), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(C, d);
3392
- const f = this.dataModel.getCell(C, d);
3393
- this.focusSelectionInput(this.cellToClipboardString(f)), this.updateFillHandleFlag();
3429
+ ], this.activeCell = { rowId: b, colKey: d }, this.onActiveChange(b, d), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(b, d);
3430
+ const w = this.dataModel.getCell(b, d);
3431
+ this.focusSelectionInput(this.cellToClipboardString(w)), this.updateFillHandleFlag();
3394
3432
  }
3395
3433
  navigateToCell(t, e) {
3396
3434
  const i = this.dataModel.getSchema(), o = this.dataModel.getRowIndex(t), n = i.columns.findIndex((a) => String(a.key) === String(e));
@@ -3411,7 +3449,7 @@ class No {
3411
3449
  this.teardownInput(!0);
3412
3450
  }
3413
3451
  destroy() {
3414
- this.root.removeEventListener("click", this.handleClick), this.root.removeEventListener("pointerdown", this.handlePointerDown), this.root.removeEventListener("pointermove", this.handlePointerMove), this.root.removeEventListener("pointerup", this.handlePointerUp), this.root.removeEventListener("pointercancel", this.handlePointerUp), this.root.removeEventListener("pointerleave", this.handlePointerLeave), this.root.removeEventListener("keydown", this.handleRootKeydown), this.handleDocumentContextMenu && document.removeEventListener("contextmenu", this.handleDocumentContextMenu, !0), this.teardownInput(!0), this.teardownSelectionInput(), this.teardownCopyToast(), O(this.lookupDropdownEl), this.lookupDropdownEl = null, this.hideHoverTooltip(), this.teardownHoverTooltip(), this.stopAutoScroll();
3452
+ this.root.removeEventListener("click", this.handleClick), this.root.removeEventListener("pointerdown", this.handlePointerDown), this.root.removeEventListener("pointermove", this.handlePointerMove), this.root.removeEventListener("pointerup", this.handlePointerUp), this.root.removeEventListener("pointercancel", this.handlePointerUp), this.root.removeEventListener("pointerleave", this.handlePointerLeave), this.root.removeEventListener("keydown", this.handleRootKeydown), this.handleDocumentContextMenu && document.removeEventListener("contextmenu", this.handleDocumentContextMenu, !0), this.teardownInput(!0), this.teardownSelectionInput(), this.teardownCopyToast(), O(this.lookupDropdownEl), this.lookupDropdownEl = null, this.hideHoverTooltip(), this.teardownHoverTooltip(), this.stopAutoScroll(), this.endColumnResize();
3415
3453
  }
3416
3454
  onScroll(t, e) {
3417
3455
  this.positionCopyToast(), this.refreshHoverTooltipPosition(), this.refreshLookupDropdownPosition();
@@ -3421,7 +3459,7 @@ class No {
3421
3459
  }
3422
3460
  updateFillHandleFlag() {
3423
3461
  const t = this.activeCell?.colKey ?? null, e = this.activeCell?.rowId ?? null;
3424
- this.root.dataset.extableFillHandle = Rt(
3462
+ this.root.dataset.extableFillHandle = kt(
3425
3463
  this.dataModel,
3426
3464
  this.selectionRanges,
3427
3465
  e,
@@ -3573,6 +3611,39 @@ class No {
3573
3611
  this.hideHoverTooltip(), this.showCopyToast("Tooltip failed", "error", 1800);
3574
3612
  }
3575
3613
  }
3614
+ getColumnResizeHit(t, e, i) {
3615
+ const o = this.getHitAtClientPoint(t, e, i);
3616
+ if (!o || o.rowId !== "__header__" || !o.colKey || o.colKey === "__all__" || Math.abs(t - o.rect.right) > Vt) return null;
3617
+ if (!o.element) {
3618
+ const r = o.rect.right - 18 - 4, h = o.rect.top + Math.floor((st - 18) / 2);
3619
+ if (t >= r && t <= r + 18 && e >= h && e <= h + 18) return null;
3620
+ }
3621
+ const s = this.dataModel.getSchema().columns.findIndex((l) => String(l.key) === String(o.colKey));
3622
+ return s < 0 ? null : { colKey: String(o.colKey), colIndex: s };
3623
+ }
3624
+ beginColumnResize(t, e, i) {
3625
+ const o = this.dataModel.getSchema(), n = this.dataModel.getView(), s = o.columns[e];
3626
+ if (!s) return;
3627
+ const l = String(t), a = n.columnWidths?.[l] ?? s.width ?? 100, h = Y(o, n)[e] ?? a, d = Math.max(0, h - a), u = je(0, d);
3628
+ this.columnResizing = !0, this.columnResizeState = {
3629
+ colKey: l,
3630
+ startX: i,
3631
+ startWidth: a,
3632
+ minWidth: u,
3633
+ lastWidth: a
3634
+ }, this.resizeCursorBackup === null && (this.resizeCursorBackup = this.root.style.cursor || ""), this.root.style.cursor = "col-resize", this.root.dataset.extableColumnResize = "1";
3635
+ }
3636
+ updateColumnResize(t) {
3637
+ if (!this.columnResizeState) return;
3638
+ const e = t - this.columnResizeState.startX, i = this.columnResizeState.startWidth + e, o = Math.round(Math.max(this.columnResizeState.minWidth, i));
3639
+ if (o === this.columnResizeState.lastWidth) return;
3640
+ this.columnResizeState.lastWidth = o;
3641
+ const n = this.dataModel.getView(), s = { ...n.columnWidths ?? {} };
3642
+ s[this.columnResizeState.colKey] = o, this.onViewChange({ ...n, columnWidths: s });
3643
+ }
3644
+ endColumnResize() {
3645
+ this.columnResizing && (this.columnResizing = !1, this.columnResizeState = null, this.resizeCursorBackup !== null && (this.root.style.cursor = this.resizeCursorBackup, this.resizeCursorBackup = null), this.root.dataset.extableColumnResize = "");
3646
+ }
3576
3647
  ensureLookupDropdown() {
3577
3648
  if (this.lookupDropdownEl)
3578
3649
  return this.lookupDropdownEl;
@@ -3659,29 +3730,29 @@ class No {
3659
3730
  this.lookupDebounceTimer && (window.clearTimeout(this.lookupDebounceTimer), this.lookupDebounceTimer = null), this.lookupAbort?.abort(), this.lookupAbort = null, this.lookupRequestId += 1;
3660
3731
  const u = this.lookupRequestId, p = s, m = () => {
3661
3732
  this.lookupDebounceTimer = null;
3662
- const C = new AbortController();
3663
- this.lookupAbort = C, n.fetchCandidates({ query: d, rowId: t, colKey: e, signal: C.signal }).then((x) => {
3664
- if (u !== this.lookupRequestId || C.signal.aborted || !this.activeCell || this.activeCell.rowId !== t || this.activeCell.colKey !== e)
3733
+ const b = new AbortController();
3734
+ this.lookupAbort = b, n.fetchCandidates({ query: d, rowId: t, colKey: e, signal: b.signal }).then((x) => {
3735
+ if (u !== this.lookupRequestId || b.signal.aborted || !this.activeCell || this.activeCell.rowId !== t || this.activeCell.colKey !== e)
3665
3736
  return;
3666
- let f = Array.from(x);
3737
+ let w = Array.from(x);
3667
3738
  if (n.recentLookup !== !1) {
3668
3739
  const y = this.lookupRecentHistory.get(e);
3669
3740
  if (y) {
3670
- f = f.filter((b) => !(b.label === y.label && b.value === y.value));
3671
- const w = { ...y, isRecent: !0 };
3672
- f.unshift(w);
3741
+ w = w.filter((v) => !(v.label === y.label && v.value === y.value));
3742
+ const g = { ...y, isRecent: !0 };
3743
+ w.unshift(g);
3673
3744
  }
3674
3745
  }
3675
- s = f.length;
3676
- const g = f.filter((y) => !y.isRecent);
3677
- if (!n.allowFreeInput && p > 1 && g.length === 1) {
3678
- const y = f.indexOf(g[0]);
3679
- this.lookupCandidates = f, this.lookupHighlightIndex = y, this.commitLookupCandidate(y);
3746
+ s = w.length;
3747
+ const f = w.filter((y) => !y.isRecent);
3748
+ if (!n.allowFreeInput && p > 1 && f.length === 1) {
3749
+ const y = w.indexOf(f[0]);
3750
+ this.lookupCandidates = w, this.lookupHighlightIndex = y, this.commitLookupCandidate(y);
3680
3751
  return;
3681
3752
  }
3682
- this.lookupCandidates = f, this.lookupHighlightIndex = f.length ? 0 : -1, this.renderLookupDropdown();
3753
+ this.lookupCandidates = w, this.lookupHighlightIndex = w.length ? 0 : -1, this.renderLookupDropdown();
3683
3754
  }).catch((x) => {
3684
- u === this.lookupRequestId && (C.signal.aborted || (this.hideLookupDropdown(), this.showCopyToast("Lookup failed", "error", 1800)));
3755
+ u === this.lookupRequestId && (b.signal.aborted || (this.hideLookupDropdown(), this.showCopyToast("Lookup failed", "error", 1800)));
3685
3756
  });
3686
3757
  };
3687
3758
  h ? m() : this.lookupDebounceTimer = window.setTimeout(m, l);
@@ -3838,46 +3909,46 @@ class No {
3838
3909
  getCanvasCellMetrics(t, e) {
3839
3910
  const i = this.dataModel.getSchema(), o = this.dataModel.getView(), n = this.dataModel.listRows(), s = n.findIndex((x) => x.id === t), l = i.columns.findIndex((x) => String(x.key) === String(e));
3840
3911
  if (s < 0 || l < 0) return null;
3841
- const a = dt, r = st, h = ft, d = Q(i, o);
3912
+ const a = st, r = lt, h = ft, d = Y(i, o);
3842
3913
  let u = r;
3843
3914
  for (let x = 0; x < l; x += 1) u += d[x] ?? 100;
3844
3915
  let p = a;
3845
3916
  for (let x = 0; x < s; x += 1) {
3846
- const f = n[x];
3847
- if (!f) return null;
3848
- const g = this.dataModel.getRowHeight(f.id) ?? h;
3849
- p += g;
3917
+ const w = n[x];
3918
+ if (!w) return null;
3919
+ const f = this.dataModel.getRowHeight(w.id) ?? h;
3920
+ p += f;
3850
3921
  }
3851
- const m = this.dataModel.getRowHeight(t) ?? h, C = d[l] ?? 100;
3852
- return { left: u, top: p, width: C, height: m, rowIndex: s, colIndex: l };
3922
+ const m = this.dataModel.getRowHeight(t) ?? h, b = d[l] ?? 100;
3923
+ return { left: u, top: p, width: b, height: m, rowIndex: s, colIndex: l };
3853
3924
  }
3854
3925
  getActiveCellRect() {
3855
3926
  const t = this.activeCell;
3856
3927
  if (!t) return null;
3857
3928
  const e = this.root.getBoundingClientRect(), i = this.dataModel.getSchema(), o = this.dataModel.getView();
3858
3929
  if (t.rowId === "__all__" && t.colKey === "__all__")
3859
- return new DOMRect(e.left, e.top, st, dt);
3930
+ return new DOMRect(e.left, e.top, lt, st);
3860
3931
  if (t.rowId === "__header__" && t.colKey !== null) {
3861
3932
  const s = this.escapeCssAttrValue(String(t.colKey)), l = this.root.querySelector(`th[data-col-key="${s}"]`);
3862
3933
  if (l) return l.getBoundingClientRect();
3863
3934
  const a = i.columns.findIndex((r) => String(r.key) === String(t.colKey));
3864
3935
  if (a >= 0) {
3865
- const r = Q(i, o);
3866
- let h = st;
3936
+ const r = Y(i, o);
3937
+ let h = lt;
3867
3938
  for (let u = 0; u < a; u += 1) h += r[u] ?? 100;
3868
3939
  const d = r[a] ?? 100;
3869
3940
  return new DOMRect(
3870
3941
  e.left + h - this.root.scrollLeft,
3871
3942
  e.top,
3872
3943
  d,
3873
- dt
3944
+ st
3874
3945
  );
3875
3946
  }
3876
3947
  }
3877
3948
  if (t.colKey === null) {
3878
3949
  const s = this.dataModel.getRowIndex(t.rowId);
3879
3950
  if (s >= 0) {
3880
- let l = dt;
3951
+ let l = st;
3881
3952
  const a = this.dataModel.listRows();
3882
3953
  for (let h = 0; h < s; h += 1) {
3883
3954
  const d = a[h];
@@ -3888,7 +3959,7 @@ class No {
3888
3959
  return new DOMRect(
3889
3960
  e.left,
3890
3961
  e.top + l - this.root.scrollTop,
3891
- st,
3962
+ lt,
3892
3963
  r
3893
3964
  );
3894
3965
  }
@@ -3921,7 +3992,7 @@ class No {
3921
3992
  if (!d) return;
3922
3993
  const u = o.columns[h];
3923
3994
  if (!u) return;
3924
- const p = d.id, m = u.key, C = a ? {
3995
+ const p = d.id, m = u.key, b = a ? {
3925
3996
  kind: "cells",
3926
3997
  startRow: a.rowIndex,
3927
3998
  endRow: r,
@@ -3934,9 +4005,9 @@ class No {
3934
4005
  startCol: h,
3935
4006
  endCol: h
3936
4007
  };
3937
- this.selectionRanges = [C], this.activeCell = { rowId: p, colKey: m }, this.onActiveChange(p, m), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(p, m);
3938
- const x = this.dataModel.getCell(p, m), f = this.cellToClipboardString(x);
3939
- this.focusSelectionInput(f), this.updateFillHandleFlag();
4008
+ this.selectionRanges = [b], this.activeCell = { rowId: p, colKey: m }, this.onActiveChange(p, m), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(p, m);
4009
+ const x = this.dataModel.getCell(p, m), w = this.cellToClipboardString(x);
4010
+ this.focusSelectionInput(w), this.updateFillHandleFlag();
3940
4011
  return;
3941
4012
  }
3942
4013
  }
@@ -4058,21 +4129,21 @@ class No {
4058
4129
  commitFill(t, e) {
4059
4130
  const i = this.dataModel.getSchema(), o = this.dataModel.listRows(), n = i.columns[t.colIndex];
4060
4131
  if (!n || e <= t.endRowIndex) return;
4061
- const s = Ho(this.dataModel, t, this.sequenceLangs);
4132
+ const s = Do(this.dataModel, t, this.sequenceLangs);
4062
4133
  if (!s) return;
4063
4134
  const l = this.editMode === "direct", a = `fill:${Date.now()}:${Math.random().toString(16).slice(2)}`;
4064
4135
  for (let d = t.endRowIndex + 1; d <= e; d += 1) {
4065
4136
  const u = o[d];
4066
4137
  if (!u) break;
4067
4138
  if (this.isCellReadonly(u.id, n.key)) continue;
4068
- const p = d - t.endRowIndex, m = s(p), C = {
4139
+ const p = d - t.endRowIndex, m = s(p), b = {
4069
4140
  kind: "edit",
4070
4141
  rowId: u.id,
4071
4142
  colKey: n.key,
4072
4143
  next: m,
4073
4144
  payload: { batchId: a }
4074
4145
  };
4075
- this.onEdit(C, l);
4146
+ this.onEdit(b, l);
4076
4147
  }
4077
4148
  const r = o[e];
4078
4149
  if (!r) return;
@@ -4194,11 +4265,11 @@ class No {
4194
4265
  const u = e[d];
4195
4266
  if (!u) continue;
4196
4267
  const p = [], m = [];
4197
- for (let C = i.startCol; C <= i.endCol; C += 1) {
4198
- const x = t.columns[C];
4268
+ for (let b = i.startCol; b <= i.endCol; b += 1) {
4269
+ const x = t.columns[b];
4199
4270
  if (!x) continue;
4200
- const f = this.dataModel.getCell(u.id, x.key), g = this.cellToClipboardString(f);
4201
- p.push(g), m.push(`<td style="${l}">${this.escapeHtml(g)}</td>`), a += 1;
4271
+ const w = this.dataModel.getCell(u.id, x.key), f = this.cellToClipboardString(w);
4272
+ p.push(f), m.push(`<td style="${l}">${this.escapeHtml(f)}</td>`), a += 1;
4202
4273
  }
4203
4274
  o.push(p.join(" ")), n.push(`<tr>${m.join("")}</tr>`);
4204
4275
  }
@@ -4263,9 +4334,9 @@ class No {
4263
4334
  if (!i) return t;
4264
4335
  if (t === "") return "";
4265
4336
  if (i.type === "number" || i.type === "int" || i.type === "uint") {
4266
- const o = ne(t);
4337
+ const o = se(t);
4267
4338
  if (!o.ok) return t;
4268
- const n = se(o.value, i.type);
4339
+ const n = le(o.value, i.type);
4269
4340
  return n.ok ? n.value : t;
4270
4341
  }
4271
4342
  if (i.type === "boolean") {
@@ -4361,10 +4432,10 @@ class No {
4361
4432
  if ((i.type === "number" || i.type === "int" || i.type === "uint") && typeof e == "number") {
4362
4433
  if (i.type === "number") {
4363
4434
  const s = i.format;
4364
- return (s?.format ?? "decimal") === "scientific" ? kt(e, { format: "scientific", precision: s?.precision }) : kt(e, { format: "decimal", scale: s?.scale });
4435
+ return (s?.format ?? "decimal") === "scientific" ? Rt(e, { format: "scientific", precision: s?.precision }) : Rt(e, { format: "decimal", scale: s?.scale });
4365
4436
  }
4366
4437
  const n = i.format?.format ?? "decimal";
4367
- return n === "binary" || n === "octal" || n === "hex" ? Wt(e, n) : String(e);
4438
+ return n === "binary" || n === "octal" || n === "hex" ? Ot(e, n) : String(e);
4368
4439
  }
4369
4440
  return String(e);
4370
4441
  }
@@ -4373,11 +4444,11 @@ class No {
4373
4444
  return { ok: !0, value: this.inputEl?.value ?? "" };
4374
4445
  const t = this.findColumn(this.activeCell.colKey);
4375
4446
  if (t && (t.type === "number" || t.type === "int" || t.type === "uint") && this.inputEl instanceof HTMLInputElement) {
4376
- const e = We(this.inputEl.value);
4447
+ const e = Oe(this.inputEl.value);
4377
4448
  if (e === "") return { ok: !0, value: "" };
4378
- const i = ne(e);
4449
+ const i = se(e);
4379
4450
  if (!i.ok) return { ok: !1 };
4380
- const o = se(i.value, t.type);
4451
+ const o = le(i.value, t.type);
4381
4452
  return o.ok ? { ok: !0, value: o.value } : { ok: !1 };
4382
4453
  }
4383
4454
  return { ok: !0, value: this.readActiveValue() };
@@ -4395,7 +4466,7 @@ class No {
4395
4466
  t.rows = Math.max(1, o), t.style.minHeight = `${i}px`;
4396
4467
  }
4397
4468
  positionFloatingContentBox(t, e) {
4398
- const i = ut, o = rt, n = Mt;
4469
+ const i = ut, o = at, n = Mt;
4399
4470
  e.style.left = `${t.left + i}px`, e.style.top = `${t.top + o}px`, e.style.width = `${Math.max(8, t.width - i * 2)}px`, e.style.height = `${Math.max(8, t.height - (o + n))}px`;
4400
4471
  }
4401
4472
  triggerCellAction(t, e, i) {
@@ -4661,16 +4732,16 @@ class No {
4661
4732
  this.teardownLookupEditor(), this.inputEl && this.inputEl !== this.selectionInput && O(this.inputEl), O(this.floatingInputWrapper), this.activeHost && this.activeHostOriginalText !== null && (this.activeHost.textContent = this.activeHostOriginalText), this.inputEl = null, this.floatingInputWrapper = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, t && (this.activeCell = null, this.onActiveChange(null, null), this.hideHoverTooltip());
4662
4733
  }
4663
4734
  }
4664
- const Oo = (c) => c;
4665
- class Po {
4735
+ const qo = (c) => c;
4736
+ class $o {
4666
4737
  constructor(t) {
4667
4738
  this.shell = null, this.viewportEl = null, this.viewportResizeObserver = null, this.selectionManager = null, this.resizeHandler = null, this.scrollHandler = null, this.viewportState = null, this.rafId = null, this.contextMenu = null, this.contextMenuRowId = null, this.handleGlobalPointer = null, this.toast = null, this.toastTimer = null, this.mounted = !1, this.filterSortSidebar = null, this.filterSortSidebarUnsub = null, this.filterSortKeydown = null, this.filterSortClickCapture = null, this.filterSortOpenEvent = null, this.filterSortActiveColumnKey = null, this.filterSortDraft = null, this.tableStateListeners = /* @__PURE__ */ new Set(), this.selectionListeners = /* @__PURE__ */ new Set(), this.lastTableState = null, this.lastSelectionSnapshot = null, this.lastAction = null, this.selectionRanges = [], this.activeCell = null, this.activeErrors = [], this.rowStateListeners = /* @__PURE__ */ new Set(), this.lastRowStates = /* @__PURE__ */ new Map(), this.root = t.root, this.root.classList.add("extable-root"), this.renderMode = t.options?.renderMode ?? "auto", this.editMode = t.options?.editMode ?? "direct", this.lockMode = t.options?.lockMode ?? "none", this.server = t.options?.server, this.user = t.options?.user, this.sequenceLangs = t.options?.langs;
4668
4739
  const e = t.defaultData ?? null, i = e ?? [];
4669
- this.dataLoaded = e != null, this.dataModel = new Oe(
4740
+ this.dataLoaded = e != null, this.dataModel = new qe(
4670
4741
  i,
4671
4742
  t.schema,
4672
4743
  t.defaultView
4673
- ), this.commandQueue = new Ue(), this.lockManager = new Xe(this.lockMode, this.server, this.user), this.renderer = this.chooseRenderer(this.renderMode), this.applyRootDecor(t.options), this.applyReadonlyClass(), this.loadInitial();
4744
+ ), this.commandQueue = new Xe(), this.lockManager = new Ye(this.lockMode, this.server, this.user), this.renderer = this.chooseRenderer(this.renderMode), this.applyRootDecor(t.options), this.applyReadonlyClass(), this.loadInitial();
4674
4745
  }
4675
4746
  isCellReadonly(t, e) {
4676
4747
  return this.editMode === "readonly" || this.dataModel.isReadonly(t, e);
@@ -4703,7 +4774,7 @@ class Po {
4703
4774
  this.mount();
4704
4775
  }
4705
4776
  applyRootDecor(t) {
4706
- const e = le(t?.defaultClass);
4777
+ const e = re(t?.defaultClass);
4707
4778
  if (e?.length && this.root.classList.add(...e), t?.defaultStyle)
4708
4779
  for (const [i, o] of Object.entries(t.defaultStyle))
4709
4780
  this.root.style[i] = o ?? "";
@@ -4741,7 +4812,7 @@ class Po {
4741
4812
  this.root.dataset.extable = "loading", this.bindViewport(), this.ensureFilterSort(), this.emitTableState(), this.emitSelection("data");
4742
4813
  return;
4743
4814
  }
4744
- this.selectionManager = new No(
4815
+ this.selectionManager = new Bo(
4745
4816
  e,
4746
4817
  this.editMode,
4747
4818
  (i, o) => this.handleEdit(i, o),
@@ -4757,6 +4828,7 @@ class Po {
4757
4828
  this.sequenceLangs,
4758
4829
  (i, o) => this.isCellReadonly(i, o),
4759
4830
  (i) => this.emitAction(i),
4831
+ (i) => this.setView(i),
4760
4832
  (i, o) => {
4761
4833
  const n = i && o !== null ? { rowId: i, colKey: o } : null;
4762
4834
  n && this.renderer.setActiveCell(n.rowId, n.colKey), this.activeCell = n, this.emitSelection("selection");
@@ -4774,7 +4846,7 @@ class Po {
4774
4846
  }
4775
4847
  // editMode/lockMode are configured only at construction time for consistency.
4776
4848
  setRootClass(t) {
4777
- this.root.className = "", this.root.classList.add(...le(t) ?? []);
4849
+ this.root.className = "", this.root.classList.add(...re(t) ?? []);
4778
4850
  }
4779
4851
  setRootStyle(t) {
4780
4852
  for (const [e, i] of Object.entries(t))
@@ -4889,9 +4961,9 @@ class Po {
4889
4961
  if (s.textOverride) return s.textOverride;
4890
4962
  const l = s.value;
4891
4963
  if (n.type === "button")
4892
- return at(l) || (l == null ? "" : String(l));
4893
- if (n.type === "link")
4894
4964
  return ct(l) || (l == null ? "" : String(l));
4965
+ if (n.type === "link")
4966
+ return ht(l) || (l == null ? "" : String(l));
4895
4967
  if (l == null) return "";
4896
4968
  if (l instanceof Date) return l.toISOString();
4897
4969
  if (typeof l == "string") return l;
@@ -5258,33 +5330,33 @@ class Po {
5258
5330
  }
5259
5331
  // Public API: selection callbacks
5260
5332
  getSelectionSnapshot() {
5261
- const t = this.selectionRanges, e = this.dataModel.getSchema(), i = this.activeCell, o = i?.rowId ?? null, n = i?.colKey ?? null, s = o ? this.dataModel.getRowIndex(o) : null, l = n !== null ? e.columns.findIndex((f) => String(f.key) === String(n)) : null, a = l !== null && l >= 0 ? e.columns[l] : null, r = o && a ? this.dataModel.resolveCellValue(o, a) : null, h = o && a ? this.dataModel.resolveConditionalStyle(o, a) : null, d = r?.textOverride ?? (h?.forceErrorText ? "#ERROR" : void 0), u = r ? r.value : null, p = (() => {
5333
+ const t = this.selectionRanges, e = this.dataModel.getSchema(), i = this.activeCell, o = i?.rowId ?? null, n = i?.colKey ?? null, s = o ? this.dataModel.getRowIndex(o) : null, l = n !== null ? e.columns.findIndex((w) => String(w.key) === String(n)) : null, a = l !== null && l >= 0 ? e.columns[l] : null, r = o && a ? this.dataModel.resolveCellValue(o, a) : null, h = o && a ? this.dataModel.resolveConditionalStyle(o, a) : null, d = r?.textOverride ?? (h?.forceErrorText ? "#ERROR" : void 0), u = r ? r.value : null, p = (() => {
5262
5334
  if (d) return d;
5263
- const f = u;
5335
+ const w = u;
5264
5336
  if (a?.type === "button")
5265
- return at(f) || (f == null ? "" : String(f));
5337
+ return ct(w) || (w == null ? "" : String(w));
5266
5338
  if (a?.type === "link")
5267
- return ct(f) || (f == null ? "" : String(f));
5268
- if (f == null) return "";
5269
- if (f instanceof Date) return f.toISOString();
5270
- if (typeof f == "string") return f;
5271
- if (typeof f == "number" || typeof f == "boolean") return String(f);
5272
- if (typeof f == "object") {
5273
- const g = f, y = g.kind;
5274
- if (y === "enum" && typeof g.value == "string") return g.value;
5275
- if (y === "tags" && Array.isArray(g.values))
5276
- return g.values.filter((w) => typeof w == "string").join(", ");
5339
+ return ht(w) || (w == null ? "" : String(w));
5340
+ if (w == null) return "";
5341
+ if (w instanceof Date) return w.toISOString();
5342
+ if (typeof w == "string") return w;
5343
+ if (typeof w == "number" || typeof w == "boolean") return String(w);
5344
+ if (typeof w == "object") {
5345
+ const f = w, y = f.kind;
5346
+ if (y === "enum" && typeof f.value == "string") return f.value;
5347
+ if (y === "tags" && Array.isArray(f.values))
5348
+ return f.values.filter((g) => typeof g == "string").join(", ");
5277
5349
  }
5278
- return String(f);
5279
- })(), m = a?.type ?? null, C = o && n !== null ? this.dataModel.getCellDiagnostic(o, n) : null, x = (() => {
5350
+ return String(w);
5351
+ })(), m = a?.type ?? null, b = o && n !== null ? this.dataModel.getCellDiagnostic(o, n) : null, x = (() => {
5280
5352
  if (!o || !a)
5281
5353
  return { columnStyle: {}, cellStyle: {}, resolved: {} };
5282
- const { columnStyle: f, cellStyle: g, resolved: y } = je(
5354
+ const { columnStyle: w, cellStyle: f, resolved: y } = ze(
5283
5355
  this.dataModel,
5284
5356
  o,
5285
5357
  a
5286
5358
  );
5287
- return { columnStyle: f, cellStyle: g, resolved: y };
5359
+ return { columnStyle: w, cellStyle: f, resolved: y };
5288
5360
  })();
5289
5361
  return {
5290
5362
  ranges: [...t],
@@ -5295,7 +5367,7 @@ class Po {
5295
5367
  activeValueRaw: u,
5296
5368
  activeValueDisplay: p,
5297
5369
  activeValueType: m,
5298
- diagnostic: C,
5370
+ diagnostic: b,
5299
5371
  action: this.lastAction,
5300
5372
  styles: x
5301
5373
  };
@@ -5349,7 +5421,7 @@ class Po {
5349
5421
  }
5350
5422
  // Public API: value updates
5351
5423
  setCellValue(t, e, i) {
5352
- const o = typeof t == "string" ? t : this.dataModel.listRows()[t]?.id, n = o ? ze(this.dataModel, { rowId: o, colKey: e }) : null;
5424
+ const o = typeof t == "string" ? t : this.dataModel.listRows()[t]?.id, n = o ? Ge(this.dataModel, { rowId: o, colKey: e }) : null;
5353
5425
  if (!n || this.isCellReadonly(n.rowId, n.colKey)) return;
5354
5426
  const s = this.dataModel.getCell(n.rowId, n.colKey), l = typeof i == "function" ? i(s) : i;
5355
5427
  this.handleEdit(
@@ -5370,7 +5442,7 @@ class Po {
5370
5442
  if (!p) continue;
5371
5443
  const m = `${d.id}::${String(p.key)}`;
5372
5444
  if (o.has(m) || (o.add(m), this.isCellReadonly(d.id, p.key))) continue;
5373
- const C = this.dataModel.getCell(d.id, p.key), x = typeof t == "function" ? t(C) : t;
5445
+ const b = this.dataModel.getCell(d.id, p.key), x = typeof t == "function" ? t(b) : t;
5374
5446
  this.handleEdit(
5375
5447
  { kind: "edit", rowId: d.id, colKey: p.key, next: x },
5376
5448
  this.editMode === "direct"
@@ -5480,15 +5552,15 @@ class Po {
5480
5552
  this.filterSortDraft && (this.filterSortDraft.diagWarnings = n.checked);
5481
5553
  }), s.addEventListener("input", () => {
5482
5554
  this.filterSortDraft && (this.filterSortDraft.search = s.value, this.renderFilterSortValues());
5483
- }), l.addEventListener("change", (C) => {
5484
- const x = C.target?.closest(
5555
+ }), l.addEventListener("change", (b) => {
5556
+ const x = b.target?.closest(
5485
5557
  'input[type="checkbox"][data-fs-val]'
5486
5558
  );
5487
5559
  if (!x || !this.filterSortDraft) return;
5488
- const f = x.dataset.fsVal ?? "";
5489
- f && (f === "__blanks__" ? this.filterSortDraft.includeBlanks = x.checked : x.checked ? this.filterSortDraft.selected.add(f) : this.filterSortDraft.selected.delete(f));
5560
+ const w = x.dataset.fsVal ?? "";
5561
+ w && (w === "__blanks__" ? this.filterSortDraft.includeBlanks = x.checked : x.checked ? this.filterSortDraft.selected.add(w) : this.filterSortDraft.selected.delete(w));
5490
5562
  }), a.addEventListener("click", () => {
5491
- this.filterSortDraft && (this.filterSortDraft.selected = new Set(this.filterSortDraft.values.map((C) => C.key)), this.filterSortDraft.includeBlanks = this.filterSortDraft.hasBlanks, this.renderFilterSortValues());
5563
+ this.filterSortDraft && (this.filterSortDraft.selected = new Set(this.filterSortDraft.values.map((b) => b.key)), this.filterSortDraft.includeBlanks = this.filterSortDraft.hasBlanks, this.renderFilterSortValues());
5492
5564
  }), r.addEventListener("click", () => {
5493
5565
  this.filterSortDraft && (this.filterSortDraft.selected = /* @__PURE__ */ new Set(), this.filterSortDraft.includeBlanks = !1, this.renderFilterSortValues());
5494
5566
  }), h.addEventListener("click", () => this.applyFilterSortDraft()), d.addEventListener("click", () => this.clearFilterSortForActiveColumn()), u.addEventListener("click", () => this.setSortForActiveColumn("asc")), p.addEventListener("click", () => this.setSortForActiveColumn("desc")), m.addEventListener("click", () => this.clearSort()), this.filterSortSidebarUnsub = this.dataModel.subscribe(() => {
@@ -5674,8 +5746,8 @@ class Po {
5674
5746
  this.rafId = null, this.viewportState && (this.selectionManager?.onScroll(this.viewportState.scrollTop, this.viewportState.scrollLeft), !(this.renderer instanceof St) && this.safeRender(this.viewportState));
5675
5747
  }
5676
5748
  }
5677
- function jo(c, t) {
5678
- return new Po({
5749
+ function zo(c, t) {
5750
+ return new $o({
5679
5751
  root: document.createElement("div"),
5680
5752
  defaultData: c.data,
5681
5753
  defaultView: c.view,
@@ -5683,13 +5755,13 @@ function jo(c, t) {
5683
5755
  options: t
5684
5756
  });
5685
5757
  }
5686
- function qo(c, t) {
5758
+ function Uo(c, t) {
5687
5759
  return t.remount(c), t;
5688
5760
  }
5689
5761
  export {
5690
- Po as ExtableCore,
5691
- jo as createTablePlaceholder,
5692
- Oo as defineSchema,
5693
- qo as mountTable
5762
+ $o as ExtableCore,
5763
+ zo as createTablePlaceholder,
5764
+ qo as defineSchema,
5765
+ Uo as mountTable
5694
5766
  };
5695
5767
  //# sourceMappingURL=index.js.map