@svgrid/grid-wc 2.2.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,13 @@
1
+ import { R as e, X as t, Z as n } from "./client-DoXxrq8q.js";
1
2
  //#region ../grid/dist/sv-grid-scrollbar.js
2
- var e = 16, t = 280, n = 50, r = "http://www.w3.org/2000/svg";
3
- function i() {
4
- let e = document.createElementNS(r, "svg");
3
+ var r = 16, i = 280, a = 50, o = "http://www.w3.org/2000/svg";
4
+ function s() {
5
+ let e = document.createElementNS(o, "svg");
5
6
  e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("fill", "none"), e.setAttribute("stroke", "currentColor"), e.setAttribute("stroke-width", "3"), e.setAttribute("stroke-linecap", "round"), e.setAttribute("stroke-linejoin", "round");
6
- let t = document.createElementNS(r, "path");
7
+ let t = document.createElementNS(o, "path");
7
8
  return t.setAttribute("d", "M6 9l6 6 6-6"), e.appendChild(t), e;
8
9
  }
9
- var a = `
10
+ var c = `
10
11
  :host {
11
12
  display: flex;
12
13
  user-select: none;
@@ -28,7 +29,7 @@ var a = `
28
29
  }
29
30
  :host([orientation="vertical"]) {
30
31
  flex-direction: column;
31
- width: ${e}px;
32
+ width: ${r}px;
32
33
  /* LTR: vertical scrollbar sits at the right, inner edge is the left. */
33
34
  box-shadow: inset 1px 0 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
34
35
  }
@@ -38,7 +39,7 @@ var a = `
38
39
  }
39
40
  :host([orientation="horizontal"]) {
40
41
  flex-direction: row;
41
- height: ${e}px;
42
+ height: ${r}px;
42
43
  /* Horizontal scrollbar sits at the bottom, inner edge is the top. */
43
44
  box-shadow: inset 0 1px 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
44
45
  }
@@ -47,8 +48,8 @@ var a = `
47
48
  display: flex;
48
49
  align-items: center;
49
50
  justify-content: center;
50
- width: ${e}px;
51
- height: ${e}px;
51
+ width: ${r}px;
52
+ height: ${r}px;
52
53
  margin: 0;
53
54
  padding: 0;
54
55
  border: 0;
@@ -114,7 +115,7 @@ var a = `
114
115
  top: 3px;
115
116
  bottom: 3px;
116
117
  }
117
- `, o = typeof HTMLElement < "u" ? HTMLElement : class {}, s = class extends o {
118
+ `, l = typeof HTMLElement < "u" ? HTMLElement : class {}, u = class extends l {
118
119
  constructor() {
119
120
  super(...arguments), this.dragging = !1, this.dragStart = 0, this.valueStart = 0, this.holdTimer = null, this.resizeObserver = null, this.resizeFrame = 0, this.onArrowStartPointerDown = (e) => {
120
121
  e.preventDefault(), this.startHold(-1);
@@ -148,7 +149,7 @@ var a = `
148
149
  connectedCallback() {
149
150
  if (this.shadowRoot) return;
150
151
  let e = this.attachShadow({ mode: "open" }), t = document.createElement("style");
151
- t.textContent = a, this.startArrow = this.createArrow("start"), this.endArrow = this.createArrow("end"), this.track = document.createElement("div"), this.track.className = "track", this.thumb = document.createElement("div"), this.thumb.className = "thumb", this.track.appendChild(this.thumb), e.append(t, this.startArrow, this.track, this.endArrow), this.thumb.addEventListener("pointerdown", this.onThumbPointerDown), this.track.addEventListener("pointerdown", this.onTrackPointerDown), this.startArrow.addEventListener("pointerdown", this.onArrowStartPointerDown), this.endArrow.addEventListener("pointerdown", this.onArrowEndPointerDown);
152
+ t.textContent = c, this.startArrow = this.createArrow("start"), this.endArrow = this.createArrow("end"), this.track = document.createElement("div"), this.track.className = "track", this.thumb = document.createElement("div"), this.thumb.className = "thumb", this.track.appendChild(this.thumb), e.append(t, this.startArrow, this.track, this.endArrow), this.thumb.addEventListener("pointerdown", this.onThumbPointerDown), this.track.addEventListener("pointerdown", this.onTrackPointerDown), this.startArrow.addEventListener("pointerdown", this.onArrowStartPointerDown), this.endArrow.addEventListener("pointerdown", this.onArrowEndPointerDown);
152
153
  for (let e of [this.startArrow, this.endArrow]) e.addEventListener("pointerup", this.stopHold), e.addEventListener("pointerleave", this.stopHold), e.addEventListener("pointercancel", this.stopHold);
153
154
  this.resizeObserver = new ResizeObserver(() => {
154
155
  this.resizeFrame ||= requestAnimationFrame(() => {
@@ -182,8 +183,8 @@ var a = `
182
183
  return Math.max(this.contentSize - this.viewportSize, 0);
183
184
  }
184
185
  getTrackLength() {
185
- let t = this.track.getBoundingClientRect(), n = this.orientation === "vertical" ? t.height : t.width;
186
- return n > 0 ? n : Math.max(this.viewportSize - e * 2, 1);
186
+ let e = this.track.getBoundingClientRect(), t = this.orientation === "vertical" ? e.height : e.width;
187
+ return t > 0 ? t : Math.max(this.viewportSize - 32, 1);
187
188
  }
188
189
  computeThumbSize(e) {
189
190
  if (this.contentSize <= 0 || this.viewportSize <= 0 || e <= 0) return 0;
@@ -192,14 +193,14 @@ var a = `
192
193
  }
193
194
  createArrow(e) {
194
195
  let t = document.createElement("button");
195
- return t.type = "button", t.className = `arrow arrow-${e}`, t.setAttribute("aria-label", e === "start" ? "Scroll back" : "Scroll forward"), t.appendChild(i()), t;
196
+ return t.type = "button", t.className = `arrow arrow-${e}`, t.setAttribute("aria-label", e === "start" ? "Scroll back" : "Scroll forward"), t.appendChild(s()), t;
196
197
  }
197
198
  startHold(e) {
198
199
  this.stopHold();
199
- let r = () => this.emitScroll(this.value + e * this.step);
200
- r(), this.holdTimer = setTimeout(() => {
201
- this.holdTimer = setInterval(r, n);
202
- }, t);
200
+ let t = () => this.emitScroll(this.value + e * this.step);
201
+ t(), this.holdTimer = setTimeout(() => {
202
+ this.holdTimer = setInterval(t, a);
203
+ }, i);
203
204
  }
204
205
  emitScroll(e) {
205
206
  let t = Math.min(Math.max(e, 0), this.maxValue);
@@ -217,119 +218,20 @@ var a = `
217
218
  this.orientation === "vertical" ? (this.thumb.style.height = `${r}px`, this.thumb.style.transform = `translateY(${a}px)`) : (this.thumb.style.width = `${r}px`, this.thumb.style.transform = `translateX(${a}px)`), this.startArrow.disabled = t || this.value <= 0, this.endArrow.disabled = t || this.value >= i;
218
219
  }
219
220
  };
220
- typeof window < "u" && !customElements.get("sv-grid-scrollbar") && customElements.define("sv-grid-scrollbar", s);
221
- //#endregion
222
- //#region ../grid/dist/render-component.js
223
- var c = class {
224
- constructor(e, t) {
225
- this.component = e, this.props = t;
226
- }
227
- }, l = class {
228
- constructor(e, t) {
229
- this.snippet = e, this.params = t;
230
- }
231
- }, u = {
232
- width: 88,
233
- height: 22,
234
- color: "var(--sg-accent, #2563eb)",
235
- negativeColor: "#ef4444",
236
- lineWidth: 1.5
237
- };
238
- function d(e) {
239
- return Array.isArray(e) ? e.map((e) => Number(e)).filter((e) => Number.isFinite(e)) : typeof e == "string" && e.trim() ? e.split(/[,\s]+/).map((e) => Number(e)).filter((e) => Number.isFinite(e)) : [];
240
- }
241
- function f(e, t = {}) {
242
- if (!e.length) return null;
243
- let n = t.width ?? u.width, r = t.height ?? u.height, i = t.type ?? "line", a = t.color ?? u.color, o = t.negativeColor ?? u.negativeColor, s = t.lineWidth ?? u.lineWidth, c = Math.ceil(s) + 1, l = Math.max(1, n - c * 2), d = Math.max(1, r - c * 2), f = {
244
- width: n,
245
- height: r,
246
- type: i,
247
- color: a,
248
- negativeColor: o,
249
- lineWidth: s
250
- };
251
- if (i === "winloss") {
252
- let t = e.length, n = t > 1 ? Math.min(2, l / t / 3) : 0, i = l / t, a = Math.max(1, i - n), o = r / 2, s = d / 2, u = e.map((e, t) => {
253
- let n = c + t * i + (i - a) / 2;
254
- return e > 0 ? {
255
- x: n,
256
- y: o - s,
257
- w: a,
258
- h: s,
259
- negative: !1
260
- } : e < 0 ? {
261
- x: n,
262
- y: o,
263
- w: a,
264
- h: s,
265
- negative: !0
266
- } : {
267
- x: n,
268
- y: o - 1,
269
- w: a,
270
- h: 2,
271
- negative: !1
272
- };
273
- });
274
- return {
275
- ...f,
276
- linePath: "",
277
- areaPath: "",
278
- bars: u,
279
- lastPoint: null
280
- };
281
- }
282
- let m = t.min ?? Math.min(...e), h = t.max ?? Math.max(...e), g = h - m || 1;
283
- if (i === "bar") {
284
- let t = e.length, n = t > 1 ? Math.min(2, l / t / 3) : 0, r = l / t, i = Math.max(1, r - n), a = m < 0 && h > 0 ? 0 : m, o = c + d - (a - m) / g * d, s = e.map((e, t) => {
285
- let n = c + t * r + (r - i) / 2, s = c + d - (e - m) / g * d;
286
- return {
287
- x: n,
288
- y: Math.min(s, o),
289
- w: i,
290
- h: Math.max(1, Math.abs(s - o)),
291
- negative: e < a
292
- };
293
- });
294
- return {
295
- ...f,
296
- linePath: "",
297
- areaPath: "",
298
- bars: s,
299
- lastPoint: null
300
- };
301
- }
302
- let _ = e.length, v = _ > 1 ? l / (_ - 1) : 0, y = e.map((e, t) => ({
303
- x: _ === 1 ? c + l / 2 : c + t * v,
304
- y: c + d - (e - m) / g * d
305
- })), b = _ === 1 ? `M${p(y[0].x - 1)},${p(y[0].y)} L${p(y[0].x + 1)},${p(y[0].y)}` : y.map((e, t) => `${t === 0 ? "M" : "L"}${p(e.x)},${p(e.y)}`).join(" "), x = y[0], S = y[y.length - 1], C = c + d, w = i === "area" ? `${b} L${p(S.x)},${p(C)} L${p(x.x)},${p(C)} Z` : "";
306
- return {
307
- ...f,
308
- linePath: b,
309
- areaPath: w,
310
- bars: [],
311
- lastPoint: t.lastPoint === !1 ? null : {
312
- x: S.x,
313
- y: S.y
314
- }
315
- };
316
- }
317
- function p(e) {
318
- return Math.round(e * 100) / 100;
319
- }
221
+ typeof window < "u" && !customElements.get("sv-grid-scrollbar") && customElements.define("sv-grid-scrollbar", u);
320
222
  //#endregion
321
223
  //#region ../grid/dist/SvGrid.helpers.js
322
- function m(e) {
224
+ function d(e) {
323
225
  let t = "";
324
226
  return e.color && (t += `color:${e.color};`), e.fontWeight != null && (t += `font-weight:${e.fontWeight};`), t;
325
227
  }
326
- function h(e) {
228
+ function f(e) {
327
229
  return Number.isInteger(e) ? e.toLocaleString() : e.toLocaleString(void 0, { maximumFractionDigits: 2 });
328
230
  }
329
- function g(e, t) {
231
+ function p(e, t) {
330
232
  return `${e}:${t}`;
331
233
  }
332
- function _(e) {
234
+ function m(e) {
333
235
  if (!e) return "";
334
236
  if (typeof e == "string") return e;
335
237
  if (Array.isArray(e)) return e.filter(Boolean).join(" ");
@@ -340,22 +242,22 @@ function _(e) {
340
242
  }
341
243
  return "";
342
244
  }
343
- function v(e) {
245
+ function h(e) {
344
246
  if (e == null || e === "") return "";
345
247
  if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}$/.test(e)) return e;
346
248
  let t = e instanceof Date ? e : new Date(e);
347
249
  return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
348
250
  }
349
- function y(e) {
251
+ function g(e) {
350
252
  if (e == null || e === "") return "";
351
253
  if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(e)) return e;
352
254
  let t = e instanceof Date ? e : new Date(e);
353
255
  return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 16);
354
256
  }
355
- function b(e) {
257
+ function _(e) {
356
258
  return String(e).replace(/-native$/, "");
357
259
  }
358
- function x(e) {
260
+ function v(e) {
359
261
  if (e instanceof Date) return e;
360
262
  if (typeof e == "string") {
361
263
  let t = e.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?/);
@@ -366,46 +268,46 @@ function x(e) {
366
268
  }
367
269
  return null;
368
270
  }
369
- function S(e) {
271
+ function y(e) {
370
272
  return e ? `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}` : null;
371
273
  }
372
- function C(e, t) {
373
- let n = b(e);
374
- return n === "date" ? v(t) : n === "datetime" ? y(t) : String(t ?? "");
274
+ function b(e, t) {
275
+ let n = _(e);
276
+ return n === "date" ? h(t) : n === "datetime" ? g(t) : String(t ?? "");
375
277
  }
376
- function w(e) {
377
- let t = b(e);
278
+ function x(e) {
279
+ let t = _(e);
378
280
  return t === "number" ? "number" : t === "date" ? "date" : t === "datetime" ? "datetime-local" : t === "time" ? "time" : t === "password" ? "password" : t === "color" ? "color" : "text";
379
281
  }
380
- function T(e) {
282
+ function S(e) {
381
283
  return e == null || e === "" ? [] : Array.isArray(e) ? e.filter((e) => e != null && e !== "") : [e];
382
284
  }
383
- function E(e, t) {
285
+ function C(e, t) {
384
286
  let n = e.find((e) => e.value === t || String(e.value) === String(t));
385
287
  return n ? n.label : String(t ?? "");
386
288
  }
387
- function D(e, t) {
289
+ function w(e, t) {
388
290
  return e.find((e) => e.value === t || String(e.value) === String(t))?.color;
389
291
  }
390
- function O(e) {
292
+ function T(e) {
391
293
  return e ? `background: color-mix(in srgb, ${e} 22%, transparent);border-color: color-mix(in srgb, ${e} 45%, transparent);color: color-mix(in srgb, ${e} 80%, var(--sg-fg, #0f172a));` : "";
392
294
  }
393
- function k(e) {
394
- let t = b(e);
295
+ function E(e) {
296
+ let t = _(e);
395
297
  return t === "number" ? "sv-grid-cell-editor sv-grid-cell-editor-number" : t === "date" ? "sv-grid-cell-editor sv-grid-cell-editor-date" : t === "datetime" ? "sv-grid-cell-editor sv-grid-cell-editor-datetime" : t === "color" ? "sv-grid-cell-editor sv-grid-cell-editor-color" : "sv-grid-cell-editor";
396
298
  }
397
- function A(e) {
299
+ function D(e) {
398
300
  if (e == null || e === "") return null;
399
301
  let t = e instanceof Date ? e : new Date(e);
400
302
  return Number.isNaN(t.getTime()) ? null : t;
401
303
  }
402
- function j(e, t) {
304
+ function O(e, t) {
403
305
  return Math.max(8, Math.min(e, window.innerWidth - t - 8));
404
306
  }
405
- function M(e) {
307
+ function k(e) {
406
308
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/"/g, "\\\"");
407
309
  }
408
- function N(e, t) {
310
+ function A(e, t) {
409
311
  if (e == null || e === "") return NaN;
410
312
  if (t) {
411
313
  let t = (e instanceof Date ? e : new Date(String(e))).getTime();
@@ -414,11 +316,11 @@ function N(e, t) {
414
316
  let n = typeof e == "number" ? e : Number(e);
415
317
  return Number.isFinite(n) ? n : NaN;
416
318
  }
417
- function P(e) {
319
+ function j(e) {
418
320
  let t = Math.abs(e), n = t >= 1e3 ? 0 : t >= 100 ? 1 : t >= 1 ? 2 : 4;
419
321
  return e.toLocaleString(void 0, { maximumFractionDigits: n });
420
322
  }
421
- function F(e) {
323
+ function M(e) {
422
324
  return new Date(e).toLocaleDateString(void 0, {
423
325
  year: "numeric",
424
326
  month: "short",
@@ -427,20 +329,59 @@ function F(e) {
427
329
  }
428
330
  //#endregion
429
331
  //#region ../grid/dist/filtering/excel-filters.js
430
- var I = /[̀-ͯ]/g;
431
- function L(e, t) {
332
+ var N = /[̀-ͯ]/g;
333
+ function P(e, t) {
432
334
  if (!e) return "";
433
- let n = e.normalize("NFD").replace(I, "");
335
+ let n = e.normalize("NFD").replace(N, "");
434
336
  return t ? n.toLocaleLowerCase(t) : n.toLowerCase();
435
337
  }
436
- function R(e) {
437
- return String(e ?? "").split(/[\n,]/).map((e) => e.trim()).filter((e) => e.length > 0);
338
+ function F(e) {
339
+ let { tokens: t, trailing: n } = R(e);
340
+ return n && t.push(n), t;
438
341
  }
439
- function z(e) {
440
- return e.map((e) => e.trim()).filter((e) => e.length > 0).join("\n");
342
+ function I(e) {
343
+ return e.map((e) => e.trim()).filter((e) => e.length > 0).map((e) => /["\n,]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e).join(", ");
441
344
  }
442
- function B(e, t, n) {
443
- let r = String(e ?? ""), i = L(r, n?.locale), a = L(String(t.value ?? ""), n?.locale);
345
+ function L(e) {
346
+ return R(e).trailing;
347
+ }
348
+ function R(e) {
349
+ let t = String(e ?? ""), n = [], r = "", i = !1, a = !1, o = !1, s = () => {
350
+ let e = a ? r : r.trim();
351
+ return r = "", a = !1, o = !1, e;
352
+ };
353
+ for (let e = 0; e < t.length; e += 1) {
354
+ let c = t[e];
355
+ if (i) {
356
+ if (c !== "\"") {
357
+ r += c;
358
+ continue;
359
+ }
360
+ if (t[e + 1] === "\"") {
361
+ r += "\"", e += 1;
362
+ continue;
363
+ }
364
+ i = !1, o = !0;
365
+ continue;
366
+ }
367
+ if (c === "," || c === "\n") {
368
+ let e = s();
369
+ e.length && n.push(e);
370
+ continue;
371
+ }
372
+ if (c === "\"" && !o && !r.trim()) {
373
+ i = !0, a = !0, r = "";
374
+ continue;
375
+ }
376
+ r += c;
377
+ }
378
+ return {
379
+ tokens: n,
380
+ trailing: s()
381
+ };
382
+ }
383
+ function z(e, t, n) {
384
+ let r = String(e ?? ""), i = P(r, n?.locale), a = P(String(t.value ?? ""), n?.locale);
444
385
  switch (t.operator) {
445
386
  case "contains": return i.includes(a);
446
387
  case "notContains": return a === "" || !i.includes(a);
@@ -459,9 +400,9 @@ function B(e, t, n) {
459
400
  }
460
401
  case "in":
461
402
  case "notIn": {
462
- let e = R(t.value);
403
+ let e = F(t.value);
463
404
  if (e.length === 0) return !0;
464
- let r = e.some((e) => L(e, n?.locale) === i);
405
+ let r = e.some((e) => P(e, n?.locale) === i);
465
406
  return t.operator === "in" ? r : !r;
466
407
  }
467
408
  case "greaterThan": {
@@ -483,168 +424,191 @@ function B(e, t, n) {
483
424
  }
484
425
  }
485
426
  //#endregion
486
- //#region ../grid/dist/keyboard.js
487
- function V(e) {
488
- return e.ctrlKey && e.key === "Home" ? "gridStart" : e.ctrlKey && e.key === "End" ? "gridEnd" : e.key === "ArrowLeft" ? "moveLeft" : e.key === "ArrowRight" ? "moveRight" : e.key === "ArrowUp" ? "moveUp" : e.key === "ArrowDown" ? "moveDown" : e.key === "Home" ? "rowStart" : e.key === "End" ? "rowEnd" : e.key === "PageUp" ? "pageUp" : e.key === "PageDown" ? "pageDown" : e.key === "Enter" ? e.shiftKey ? "moveUp" : "moveDown" : e.key === "Tab" ? e.shiftKey ? "tabPrev" : "tabNext" : e.key === "F2" || e.key === " " ? "activate" : e.key === "Delete" ? "clearCells" : "noop";
489
- }
490
- function H(e, t, n) {
491
- let r = n.pageSize ?? 10, i = e.rowIndex, a = e.colIndex;
492
- return t === "moveLeft" && --a, t === "moveRight" && (a += 1), t === "moveUp" && --i, t === "moveDown" && (i += 1), t === "tabNext" && (a += 1, a > n.maxCol && (a = 0, i += 1)), t === "tabPrev" && (--a, a < 0 && (a = n.maxCol, --i)), t === "rowStart" && (a = 0), t === "rowEnd" && (a = n.maxCol), t === "gridStart" && (i = 0, a = 0), t === "gridEnd" && (i = n.maxRow, a = n.maxCol), t === "pageUp" && (i -= r), t === "pageDown" && (i += r), i = Math.min(Math.max(i, 0), Math.max(n.maxRow, 0)), a = Math.min(Math.max(a, 0), Math.max(n.maxCol, 0)), {
493
- rowIndex: i,
494
- colIndex: a,
495
- cellId: e.cellId
496
- };
427
+ //#region ../grid/dist/virtualization/virtualizer.js
428
+ function B(e, t, n) {
429
+ return Math.min(Math.max(e, t), n);
497
430
  }
498
- //#endregion
499
- //#region ../grid/dist/fill-patterns.js
500
- var U = [
501
- [
502
- "Sunday",
503
- "Monday",
504
- "Tuesday",
505
- "Wednesday",
506
- "Thursday",
507
- "Friday",
508
- "Saturday"
509
- ],
510
- [
511
- "Sun",
512
- "Mon",
513
- "Tue",
514
- "Wed",
515
- "Thu",
516
- "Fri",
517
- "Sat"
518
- ],
519
- [
520
- "January",
521
- "February",
522
- "March",
523
- "April",
524
- "May",
525
- "June",
526
- "July",
527
- "August",
528
- "September",
529
- "October",
530
- "November",
531
- "December"
532
- ],
533
- [
534
- "Jan",
535
- "Feb",
536
- "Mar",
537
- "Apr",
538
- "May",
539
- "Jun",
540
- "Jul",
541
- "Aug",
542
- "Sep",
543
- "Oct",
544
- "Nov",
545
- "Dec"
546
- ],
547
- [
548
- "Q1",
549
- "Q2",
550
- "Q3",
551
- "Q4"
552
- ]
553
- ];
554
- function W(e, t) {
555
- if (!t) return e;
556
- if (t === t.toUpperCase() && t !== t.toLowerCase()) return e.toUpperCase();
557
- if (t === t.toLowerCase() && t !== t.toUpperCase()) return e.toLowerCase();
558
- let n = t[0];
559
- return n && n === n.toUpperCase() && t.slice(1) === t.slice(1).toLowerCase() ? e[0].toUpperCase() + e.slice(1).toLowerCase() : e;
560
- }
561
- function G(e) {
562
- let t = e.map((e) => e.toLowerCase());
563
- outer: for (let e of U) {
564
- let n = e.map((e) => e.toLowerCase()), r = [];
565
- for (let e of t) {
566
- let t = n.indexOf(e);
567
- if (t < 0) continue outer;
568
- r.push(t);
569
- }
570
- return {
571
- sequence: e,
572
- indices: r
573
- };
574
- }
575
- return null;
431
+ function V(e, t) {
432
+ return e.count === t.count && e.estimateSize === t.estimateSize && (e.overscan ?? 6) === (t.overscan ?? 6) && e.viewportHeight === t.viewportHeight && (e.scrollOffset ?? 0) === (t.scrollOffset ?? 0);
576
433
  }
577
- function K(e, t, n, r) {
578
- let i = e.sequence.length, a = e.indices[e.indices.length - 1], o = t[t.length - 1], s = [];
579
- for (let t = 0; t < r; t += 1) {
580
- let r = ((a + n * (t + 1)) % i + i) % i;
581
- s.push(W(e.sequence[r], o));
434
+ function H(e, t) {
435
+ if (e.totalSize !== t.totalSize || e.startIndex !== t.startIndex || e.endIndex !== t.endIndex || e.viewportHeight !== t.viewportHeight || e.items.length !== t.items.length) return !1;
436
+ for (let n = 0; n < e.items.length; n += 1) {
437
+ let r = e.items[n], i = t.items[n];
438
+ if (r.index !== i.index || r.start !== i.start || r.size !== i.size) return !1;
582
439
  }
583
- return s;
584
- }
585
- function q(e) {
586
- let t = [], n = /^(.*?)(\d+)(.*)$/;
587
- for (let r of e) {
588
- let e = r.match(n);
589
- if (!e) return null;
590
- t.push({
591
- prefix: e[1] ?? "",
592
- numStr: e[2] ?? "",
593
- suffix: e[3] ?? ""
440
+ return !0;
441
+ }
442
+ function U(e, t, n) {
443
+ let r = [];
444
+ for (let i = e; i <= t; i += 1) {
445
+ let t = i * n;
446
+ r.push({
447
+ index: i,
448
+ start: t,
449
+ size: n,
450
+ end: t + n,
451
+ key: `virtual_slot_${i - e}`
594
452
  });
595
453
  }
596
- let r = t[0].prefix, i = t[0].suffix;
597
- for (let e of t) if (e.prefix !== r || e.suffix !== i) return null;
598
- let a = t[0].numStr, o = a.length, s = a.length > 1 && a[0] === "0" && a !== "0" ? "0" : "";
599
- return {
600
- prefix: r,
601
- suffix: i,
602
- numbers: t.map((e) => Number(e.numStr)),
603
- numberFormat: {
604
- width: o,
605
- padChar: s
454
+ return r;
455
+ }
456
+ function W(e, t, n) {
457
+ let r = [];
458
+ for (let i = e; i <= t; i += 1) {
459
+ let t = n[i] ?? 0, a = n[i + 1] ?? t;
460
+ r.push({
461
+ index: i,
462
+ start: t,
463
+ size: a - t,
464
+ end: a,
465
+ key: `virtual_slot_${i - e}`
466
+ });
467
+ }
468
+ return r;
469
+ }
470
+ function G(e, t) {
471
+ let n = Math.max(e.count, 0), r = Math.max(e.overscan ?? 6, 0), i = Math.max(e.viewportHeight, 0);
472
+ if (typeof e.estimateSize == "function" && t) {
473
+ let a = t[n] ?? 0, o = Math.max(a - i, 0), s = B(e.scrollOffset ?? 0, 0, o), c = 0, l = n;
474
+ for (; c < l;) {
475
+ let e = c + l >>> 1;
476
+ (t[e + 1] ?? 0) <= s ? c = e + 1 : l = e;
606
477
  }
478
+ let u = c, d = s + i;
479
+ for (c = u, l = n; c < l;) {
480
+ let e = c + l >>> 1;
481
+ (t[e] ?? 0) < d ? c = e + 1 : l = e;
482
+ }
483
+ let f = Math.max(c - 1, u), p = n === 0 ? 0 : B(u - r, 0, n - 1), m = n === 0 ? -1 : B(f + r, 0, n - 1);
484
+ return {
485
+ items: m >= p ? W(p, m, t) : [],
486
+ totalSize: a,
487
+ startIndex: p,
488
+ endIndex: m,
489
+ scrollOffset: s,
490
+ viewportHeight: i
491
+ };
492
+ }
493
+ let a = Math.max(typeof e.estimateSize == "number" ? e.estimateSize : 1, 1), o = n * a, s = Math.max(o - i, 0), c = B(e.scrollOffset ?? 0, 0, s), l = Math.floor(c / a), u = Math.ceil(i / a), d = Math.min(l + u, Math.max(n - 1, 0)), f = n === 0 ? 0 : B(l - r, 0, n - 1), p = n === 0 ? -1 : B(d + r, 0, n - 1);
494
+ return {
495
+ items: p >= f ? U(f, p, a) : [],
496
+ totalSize: o,
497
+ startIndex: f,
498
+ endIndex: p,
499
+ scrollOffset: c,
500
+ viewportHeight: i
607
501
  };
608
502
  }
609
- function J(e, t) {
610
- let n = String(e);
611
- return !t.padChar || n.length >= t.width ? n : n.padStart(t.width, t.padChar);
612
- }
613
- function Y(e) {
614
- if (e.length < 2) return null;
615
- let t = e[1] - e[0];
616
- for (let n = 2; n < e.length; n += 1) if (e[n] - e[n - 1] !== t) return null;
617
- return t;
618
- }
619
- function X(e, t) {
620
- if (e.length === 0 || t <= 0) return [];
621
- let n = e.map((e) => Number(e));
622
- if (e.every((e) => e !== null && e !== "" && e !== void 0) && n.every((e) => Number.isFinite(e)) && e.length >= 2) {
623
- let e = Y(n);
624
- if (e !== null) {
625
- let r = n[n.length - 1];
626
- return Array.from({ length: t }, (t, n) => r + e * (n + 1));
627
- }
503
+ function K(e) {
504
+ let t = e, n = null;
505
+ function r() {
506
+ if (typeof t.estimateSize != "function") return null;
507
+ let e = Math.max(t.count, 0);
508
+ if (n && n.fn === t.estimateSize && n.count === e) return n.offsets;
509
+ let r = t.estimateSize, i = Array(e + 1);
510
+ i[0] = 0;
511
+ for (let t = 0; t < e; t += 1) i[t + 1] = i[t] + Math.max(r(t), 1);
512
+ return n = {
513
+ fn: r,
514
+ count: e,
515
+ offsets: i
516
+ }, i;
628
517
  }
629
- let r = e.every((e) => typeof e == "string");
630
- if (r && e.length >= 1) {
631
- let n = e, r = G(n);
632
- if (r) return K(r, n, n.length >= 2 ? Y(r.indices) ?? 1 : 1, t);
518
+ let i = G(t, r()), a = /* @__PURE__ */ new Set();
519
+ function o() {
520
+ a.forEach((e) => e());
633
521
  }
634
- if (r && e.length >= 1) {
635
- let n = q(e);
636
- if (n) {
637
- let e = n.numbers.length >= 2 ? Y(n.numbers) ?? 1 : 1, r = n.numbers[n.numbers.length - 1];
638
- return Array.from({ length: t }, (t, i) => {
639
- let a = r + e * (i + 1);
640
- return n.prefix + J(a, n.numberFormat) + n.suffix;
641
- });
642
- }
522
+ function s() {
523
+ let e = G(t, r());
524
+ H(i, e) || (i = e, o());
643
525
  }
644
- return Array.from({ length: t }, (t, n) => Z(e[n % e.length]));
526
+ return {
527
+ setOptions(e) {
528
+ let n = {
529
+ ...t,
530
+ ...e
531
+ };
532
+ V(t, n) || (t = n, s());
533
+ },
534
+ setScrollOffset(e) {
535
+ (t.scrollOffset ?? 0) !== e && (t = {
536
+ ...t,
537
+ scrollOffset: e
538
+ }, s());
539
+ },
540
+ setViewportHeight(e) {
541
+ t.viewportHeight !== e && (t = {
542
+ ...t,
543
+ viewportHeight: e
544
+ }, s());
545
+ },
546
+ scrollToIndex(e) {
547
+ let n = B(e, 0, Math.max(t.count - 1, 0)), a = i.totalSize, o;
548
+ if (typeof t.estimateSize == "function") {
549
+ let e = r();
550
+ if (e) o = e[n] ?? 0;
551
+ else {
552
+ let e = 0, r = t.estimateSize;
553
+ for (let t = 0; t < n; t += 1) e += Math.max(r(t), 1);
554
+ o = e;
555
+ }
556
+ } else o = n * Math.max(t.estimateSize, 1);
557
+ let c = Math.max(a - t.viewportHeight, 0), l = B(o, 0, c);
558
+ (t.scrollOffset ?? 0) !== l && (t = {
559
+ ...t,
560
+ scrollOffset: l
561
+ }, s());
562
+ },
563
+ getVirtualItems() {
564
+ return i.items;
565
+ },
566
+ getTotalSize() {
567
+ return i.totalSize;
568
+ },
569
+ getOffsetForIndex(e) {
570
+ if (e <= 0) return 0;
571
+ let n = Math.max(t.count, 0), i = Math.min(e, n);
572
+ if (typeof t.estimateSize == "function") {
573
+ let e = r();
574
+ if (e) return e[i] ?? 0;
575
+ let n = 0, a = t.estimateSize;
576
+ for (let e = 0; e < i; e += 1) n += Math.max(a(e), 1);
577
+ return n;
578
+ }
579
+ return i * Math.max(t.estimateSize, 1);
580
+ },
581
+ getSizeForIndex(e) {
582
+ return e < 0 || e >= t.count ? 0 : typeof t.estimateSize == "function" ? Math.max(t.estimateSize(e), 1) : Math.max(t.estimateSize, 1);
583
+ },
584
+ getState() {
585
+ return i;
586
+ },
587
+ subscribe(e) {
588
+ return a.add(e), () => a.delete(e);
589
+ }
590
+ };
645
591
  }
646
- function Z(e) {
647
- return Array.isArray(e) ? e.slice() : e && typeof e == "object" && e.constructor === Object ? { ...e } : e;
592
+ //#endregion
593
+ //#region ../grid/dist/virtualization/svelte-virtualizer.svelte.js
594
+ function q(r) {
595
+ let i = K(r), a = n(0);
596
+ return i.subscribe(() => {
597
+ t(a, e(a) + 1);
598
+ }), {
599
+ get version() {
600
+ return e(a);
601
+ },
602
+ setOptions: i.setOptions,
603
+ setScrollOffset: i.setScrollOffset,
604
+ setViewportHeight: i.setViewportHeight,
605
+ scrollToIndex: i.scrollToIndex,
606
+ getVirtualItems: i.getVirtualItems,
607
+ getTotalSize: i.getTotalSize,
608
+ getOffsetForIndex: i.getOffsetForIndex,
609
+ getSizeForIndex: i.getSizeForIndex,
610
+ getState: i.getState
611
+ };
648
612
  }
649
613
  //#endregion
650
- export { l as A, N as C, f as D, T as E, d as O, E as S, x as T, g as _, z as a, w as b, A as c, O as d, M as f, P as g, F as h, B as i, c as k, m as l, h as m, V as n, L as o, S as p, H as r, R as s, X as t, j as u, C as v, _ as w, D as x, k as y };
614
+ export { A as C, S as E, C as S, v as T, p as _, P as a, x as b, D as c, T as d, k as f, j as g, M as h, I as i, d as l, f as m, K as n, F as o, y as p, z as r, L as s, q as t, O as u, b as v, m as w, w as x, E as y };