@mjsz-vbr-elements/core 2.30.2 → 2.31.1

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.
@@ -0,0 +1,912 @@
1
+ /**
2
+ * name: @mjsz-vbr-elements/core
3
+ * version: v2.31.1 - 27/10/2025, 20:57:06
4
+ * (c) 2025
5
+ * description: Data visualization for MJSZ VBR
6
+ * author: Ákos Stegner <akos.stegner@gmail.com>
7
+ */
8
+ import { ref as R, watch as S, unref as C, reactive as Te, defineComponent as De, h as Le, computed as j, provide as we, inject as Ee, onErrorCaptured as _e, nextTick as se, shallowRef as k, shallowReadonly as xe, toRef as We, readonly as Oe, customRef as Fe, isRef as Ie, getCurrentScope as Me, onScopeDispose as je, toValue as x } from "vue";
9
+ import { _ as Be, C as $e, D as fe, E as Ge, F as ze, x as de, G as H, H as ee, I as q, w as Ke, u as Ue, v as He, J as qe, A as Je } from "./datetime-bWwGbGlR.js";
10
+ import { SORT_STATE_DESCEND as ne, SORT_STATE_ORIGINAL as X, SORT_STATE_ASCEND as Z } from "./constants.js";
11
+ var Ve = /* @__PURE__ */ Be(function e(t, r, n) {
12
+ return $e(function(s, o, a) {
13
+ return fe(o) && fe(a) ? e(t, o, a) : t(s, o, a);
14
+ }, r, n);
15
+ }), Qe = /* @__PURE__ */ Ge(function(t, r) {
16
+ return Ve(function(n, s, o) {
17
+ return o;
18
+ }, t, r);
19
+ });
20
+ function Ot(e, t, r, n) {
21
+ const s = R(""), o = R(!1), a = (u) => {
22
+ const i = ze(de(t), u), m = i.length > 0;
23
+ if (o.value = m, !m)
24
+ return s.value = "";
25
+ const f = i.map((d) => ({
26
+ team: d.team.longName,
27
+ points: Math.abs(de(t, d))
28
+ })).map((d) => r(`additionalText.${t}.content`, d)).join(", ");
29
+ s.value = [
30
+ r(`additionalText.${t}.prependix`),
31
+ f,
32
+ ...r(`additionalText.${t}.appendix`) && [r(`additionalText.${t}.appendix`)]
33
+ ].join(" ");
34
+ };
35
+ return S(e, a, { immediate: !0 }), S(
36
+ () => C(n),
37
+ () => a(C(e))
38
+ ), {
39
+ text: s,
40
+ isVisible: o
41
+ };
42
+ }
43
+ const Se = Symbol("I18nContext"), O = Te({
44
+ messages: {},
45
+ locale: "",
46
+ fallbackLocale: ""
47
+ });
48
+ function It({ messages: e = {}, locale: t = "", fallbackLocale: r = "" }) {
49
+ O.messages = Qe(O.messages, e), O.locale = t, O.fallbackLocale = r;
50
+ const n = (i, m = {}) => {
51
+ const v = !Ue(m), f = H(ee, q(".", i));
52
+ return j(() => {
53
+ const p = Ae(f);
54
+ return v ? Ze(p, m) : p;
55
+ }).value;
56
+ }, s = (i) => {
57
+ const m = H(ee, q(".", i));
58
+ return !!ae(O.locale, m, O.messages);
59
+ }, o = (i) => {
60
+ O.locale = i;
61
+ }, u = {
62
+ locale: j({
63
+ get() {
64
+ return O.locale;
65
+ },
66
+ set(i) {
67
+ O.locale = i;
68
+ }
69
+ }),
70
+ setLocale: o,
71
+ translate: n,
72
+ hasTranslation: s
73
+ };
74
+ return we(Se, u), {
75
+ translate: n
76
+ };
77
+ }
78
+ function Xe(e) {
79
+ e && (O.messages = e.messages, O.locale = e.locale, O.fallbackLocale = e.fallbackLocale);
80
+ const t = Ye();
81
+ return {
82
+ locale: t.locale,
83
+ t: t.translate,
84
+ setLocale: t.setLocale,
85
+ hasTranslation: t.hasTranslation
86
+ };
87
+ }
88
+ function Ye() {
89
+ const e = Ee(Se, null);
90
+ if (e === null)
91
+ throw new Error("Provider is missing a parent component.");
92
+ return e;
93
+ }
94
+ function Ae(e = []) {
95
+ let t = ae(O.locale, e, O.messages);
96
+ return !t && O.fallbackLocale && (t = ae(O.fallbackLocale, e, O.messages)), t || e.join(".");
97
+ }
98
+ function ae(e, t, r) {
99
+ return Ke([e, ...t], r);
100
+ }
101
+ function Ze(e, t) {
102
+ return e.replace(/\{(\w+)\}/g, (r, n) => t[n]);
103
+ }
104
+ const St = De({
105
+ props: {
106
+ tag: {
107
+ type: String,
108
+ default: "div"
109
+ },
110
+ path: {
111
+ type: String,
112
+ defult: ""
113
+ }
114
+ },
115
+ setup(e, { slots: t }) {
116
+ const r = H(ee, q(".", e.path)), n = Ae(r), s = q(/\{|\}/, n), o = Object.keys(t).map((a) => {
117
+ const u = s.indexOf(a);
118
+ return u > -1 && (s[u] = t[a]()[0]), s;
119
+ });
120
+ return () => Le(e.tag, o);
121
+ }
122
+ });
123
+ function At(e, t = "", r = {}) {
124
+ const n = R(""), { t: s } = Xe(), o = j(() => {
125
+ if (C(t))
126
+ try {
127
+ const i = et(C(e), C(t));
128
+ return He(i, C(e));
129
+ } catch (i) {
130
+ n.value = i;
131
+ }
132
+ return C(e);
133
+ }), a = (i) => ({
134
+ ...i,
135
+ ...i.label && { label: s(i.label ?? "", C(r)) },
136
+ ...i.tooltip && { tooltip: s(i.tooltip ?? "") }
137
+ });
138
+ return {
139
+ columns: j(() => H(a, o.value)),
140
+ error: n
141
+ };
142
+ }
143
+ function et(e, t = "") {
144
+ const r = H(ee, q(",", t)), n = qe(e);
145
+ if (r[0] === "")
146
+ return [];
147
+ const s = r.findIndex((o) => !n.includes(o));
148
+ if (s > -1)
149
+ throw r[s];
150
+ return r;
151
+ }
152
+ const Ce = Symbol("ErrorProviderContext");
153
+ function Ct() {
154
+ const e = R(""), t = R({}), r = (o) => {
155
+ console.error({ error: o }), e.value = o.message || o.error.message, t.value = {
156
+ message: o.message,
157
+ key: o.key || Je(o.message),
158
+ cause: o.cause
159
+ };
160
+ }, n = () => {
161
+ e.value = "", t.value = {};
162
+ };
163
+ return we(Ce, {
164
+ onError: r,
165
+ reset: n
166
+ }), window.onerror = (o) => {
167
+ console.error("WINDOW_ONERROR:", o);
168
+ }, _e((o, a, u) => {
169
+ console.error("onErrorCaptured:", o, a, u);
170
+ }), {
171
+ hasError: j(() => e.value.length > 0),
172
+ message: e,
173
+ error: t,
174
+ reset: n,
175
+ onError: r
176
+ };
177
+ }
178
+ function Rt() {
179
+ const e = tt();
180
+ return {
181
+ onError: e.onError,
182
+ reset: e.reset
183
+ };
184
+ }
185
+ function tt() {
186
+ const e = Ee(Ce, null);
187
+ if (e === null)
188
+ throw new Error("Provider is missing a parent component.");
189
+ return e;
190
+ }
191
+ function J(e) {
192
+ return Me() ? (je(e), !0) : !1;
193
+ }
194
+ const D = typeof window < "u" && typeof document < "u", me = typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope, nt = Object.prototype.toString, rt = (e) => nt.call(e) === "[object Object]", N = () => {
195
+ }, ot = /* @__PURE__ */ it();
196
+ function it() {
197
+ var e, t;
198
+ return D && ((e = window?.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window?.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
199
+ }
200
+ function Re(...e) {
201
+ if (e.length !== 1)
202
+ return We(...e);
203
+ const t = e[0];
204
+ return typeof t == "function" ? Oe(Fe(() => ({ get: t, set: N }))) : R(t);
205
+ }
206
+ function st(e, t) {
207
+ function r(...n) {
208
+ return new Promise((s, o) => {
209
+ Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(s).catch(o);
210
+ });
211
+ }
212
+ return r;
213
+ }
214
+ const Pe = (e) => e();
215
+ function at(e = Pe, t = {}) {
216
+ const {
217
+ initialState: r = "active"
218
+ } = t, n = Re(r === "active");
219
+ function s() {
220
+ n.value = !1;
221
+ }
222
+ function o() {
223
+ n.value = !0;
224
+ }
225
+ const a = (...u) => {
226
+ n.value && e(...u);
227
+ };
228
+ return { isActive: Oe(n), pause: s, resume: o, eventFilter: a };
229
+ }
230
+ function ue(e, t = !1, r = "Timeout") {
231
+ return new Promise((n, s) => {
232
+ setTimeout(t ? () => s(r) : n, e);
233
+ });
234
+ }
235
+ function re(e) {
236
+ return Array.isArray(e) ? e : [e];
237
+ }
238
+ function ut(e, t, r = {}) {
239
+ const {
240
+ eventFilter: n = Pe,
241
+ ...s
242
+ } = r;
243
+ return S(
244
+ e,
245
+ st(
246
+ n,
247
+ t
248
+ ),
249
+ s
250
+ );
251
+ }
252
+ function Pt(e, t, r = {}) {
253
+ const {
254
+ eventFilter: n,
255
+ initialState: s = "active",
256
+ ...o
257
+ } = r, { eventFilter: a, pause: u, resume: i, isActive: m } = at(n, { initialState: s });
258
+ return { stop: ut(
259
+ e,
260
+ t,
261
+ {
262
+ ...o,
263
+ eventFilter: a
264
+ }
265
+ ), pause: u, resume: i, isActive: m };
266
+ }
267
+ function le(e, t = !1) {
268
+ function r(f, { flush: d = "sync", deep: p = !1, timeout: y, throwOnTimeout: T } = {}) {
269
+ let l = null;
270
+ const h = [new Promise((w) => {
271
+ l = S(
272
+ e,
273
+ (g) => {
274
+ f(g) !== t && (l ? l() : se(() => l?.()), w(g));
275
+ },
276
+ {
277
+ flush: d,
278
+ deep: p,
279
+ immediate: !0
280
+ }
281
+ );
282
+ })];
283
+ return y != null && h.push(
284
+ ue(y, T).then(() => x(e)).finally(() => l?.())
285
+ ), Promise.race(h);
286
+ }
287
+ function n(f, d) {
288
+ if (!Ie(f))
289
+ return r((g) => g === f, d);
290
+ const { flush: p = "sync", deep: y = !1, timeout: T, throwOnTimeout: l } = d ?? {};
291
+ let c = null;
292
+ const w = [new Promise((g) => {
293
+ c = S(
294
+ [e, f],
295
+ ([L, B]) => {
296
+ t !== (L === B) && (c ? c() : se(() => c?.()), g(L));
297
+ },
298
+ {
299
+ flush: p,
300
+ deep: y,
301
+ immediate: !0
302
+ }
303
+ );
304
+ })];
305
+ return T != null && w.push(
306
+ ue(T, l).then(() => x(e)).finally(() => (c?.(), x(e)))
307
+ ), Promise.race(w);
308
+ }
309
+ function s(f) {
310
+ return r((d) => !!d, f);
311
+ }
312
+ function o(f) {
313
+ return n(null, f);
314
+ }
315
+ function a(f) {
316
+ return n(void 0, f);
317
+ }
318
+ function u(f) {
319
+ return r(Number.isNaN, f);
320
+ }
321
+ function i(f, d) {
322
+ return r((p) => {
323
+ const y = Array.from(p);
324
+ return y.includes(f) || y.includes(x(f));
325
+ }, d);
326
+ }
327
+ function m(f) {
328
+ return v(1, f);
329
+ }
330
+ function v(f = 1, d) {
331
+ let p = -1;
332
+ return r(() => (p += 1, p >= f), d);
333
+ }
334
+ return Array.isArray(x(e)) ? {
335
+ toMatch: r,
336
+ toContains: i,
337
+ changed: m,
338
+ changedTimes: v,
339
+ get not() {
340
+ return le(e, !t);
341
+ }
342
+ } : {
343
+ toMatch: r,
344
+ toBe: n,
345
+ toBeTruthy: s,
346
+ toBeNull: o,
347
+ toBeNaN: u,
348
+ toBeUndefined: a,
349
+ changed: m,
350
+ changedTimes: v,
351
+ get not() {
352
+ return le(e, !t);
353
+ }
354
+ };
355
+ }
356
+ function lt(e) {
357
+ return le(e);
358
+ }
359
+ function ct(e, t = 1e3, r = {}) {
360
+ const {
361
+ immediate: n = !0,
362
+ immediateCallback: s = !1
363
+ } = r;
364
+ let o = null;
365
+ const a = k(!1);
366
+ function u() {
367
+ o && (clearInterval(o), o = null);
368
+ }
369
+ function i() {
370
+ a.value = !1, u();
371
+ }
372
+ function m() {
373
+ const v = x(t);
374
+ v <= 0 || (a.value = !0, s && e(), u(), a.value && (o = setInterval(e, v)));
375
+ }
376
+ if (n && D && m(), Ie(t) || typeof t == "function") {
377
+ const v = S(t, () => {
378
+ a.value && D && m();
379
+ });
380
+ J(v);
381
+ }
382
+ return J(i), {
383
+ isActive: xe(a),
384
+ pause: i,
385
+ resume: m
386
+ };
387
+ }
388
+ function ft(e, t, r = {}) {
389
+ const {
390
+ immediate: n = !0,
391
+ immediateCallback: s = !1
392
+ } = r, o = k(!1);
393
+ let a;
394
+ function u() {
395
+ a && (clearTimeout(a), a = void 0);
396
+ }
397
+ function i() {
398
+ o.value = !1, u();
399
+ }
400
+ function m(...v) {
401
+ s && e(), u(), o.value = !0, a = setTimeout(() => {
402
+ o.value = !1, a = void 0, e(...v);
403
+ }, x(t));
404
+ }
405
+ return n && (o.value = !0, D && m()), J(i), {
406
+ isPending: xe(o),
407
+ start: m,
408
+ stop: i
409
+ };
410
+ }
411
+ function dt(e, t, r) {
412
+ return S(
413
+ e,
414
+ t,
415
+ {
416
+ ...r,
417
+ immediate: !0
418
+ }
419
+ );
420
+ }
421
+ function Nt(e, t, r) {
422
+ return S(
423
+ e,
424
+ t,
425
+ {
426
+ ...r,
427
+ once: !0
428
+ }
429
+ );
430
+ }
431
+ function kt(e, t, r) {
432
+ const n = S(
433
+ e,
434
+ (s, o, a) => {
435
+ s && (r?.once && se(() => n()), t(s, o, a));
436
+ },
437
+ {
438
+ ...r,
439
+ once: !1
440
+ }
441
+ );
442
+ return n;
443
+ }
444
+ const Ne = D ? window : void 0, mt = D ? window.document : void 0;
445
+ function K(e) {
446
+ var t;
447
+ const r = x(e);
448
+ return (t = r?.$el) != null ? t : r;
449
+ }
450
+ function U(...e) {
451
+ const t = [], r = () => {
452
+ t.forEach((u) => u()), t.length = 0;
453
+ }, n = (u, i, m, v) => (u.addEventListener(i, m, v), () => u.removeEventListener(i, m, v)), s = j(() => {
454
+ const u = re(x(e[0])).filter((i) => i != null);
455
+ return u.every((i) => typeof i != "string") ? u : void 0;
456
+ }), o = dt(
457
+ () => {
458
+ var u, i;
459
+ return [
460
+ (i = (u = s.value) == null ? void 0 : u.map((m) => K(m))) != null ? i : [Ne].filter((m) => m != null),
461
+ re(x(s.value ? e[1] : e[0])),
462
+ re(C(s.value ? e[2] : e[1])),
463
+ // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
464
+ x(s.value ? e[3] : e[2])
465
+ ];
466
+ },
467
+ ([u, i, m, v]) => {
468
+ if (r(), !u?.length || !i?.length || !m?.length)
469
+ return;
470
+ const f = rt(v) ? { ...v } : v;
471
+ t.push(
472
+ ...u.flatMap(
473
+ (d) => i.flatMap(
474
+ (p) => m.map((y) => n(d, p, y, f))
475
+ )
476
+ )
477
+ );
478
+ },
479
+ { flush: "post" }
480
+ ), a = () => {
481
+ o(), r();
482
+ };
483
+ return J(r), a;
484
+ }
485
+ let ve = !1;
486
+ function Dt(e, t, r = {}) {
487
+ const { window: n = Ne, ignore: s = [], capture: o = !0, detectIframe: a = !1, controls: u = !1 } = r;
488
+ if (!n)
489
+ return u ? { stop: N, cancel: N, trigger: N } : N;
490
+ if (ot && !ve) {
491
+ ve = !0;
492
+ const l = { passive: !0 };
493
+ Array.from(n.document.body.children).forEach((c) => c.addEventListener("click", N, l)), n.document.documentElement.addEventListener("click", N, l);
494
+ }
495
+ let i = !0;
496
+ const m = (l) => x(s).some((c) => {
497
+ if (typeof c == "string")
498
+ return Array.from(n.document.querySelectorAll(c)).some((h) => h === l.target || l.composedPath().includes(h));
499
+ {
500
+ const h = K(c);
501
+ return h && (l.target === h || l.composedPath().includes(h));
502
+ }
503
+ });
504
+ function v(l) {
505
+ const c = x(l);
506
+ return c && c.$.subTree.shapeFlag === 16;
507
+ }
508
+ function f(l, c) {
509
+ const h = x(l), w = h.$.subTree && h.$.subTree.children;
510
+ return w == null || !Array.isArray(w) ? !1 : w.some((g) => g.el === c.target || c.composedPath().includes(g.el));
511
+ }
512
+ const d = (l) => {
513
+ const c = K(e);
514
+ if (l.target != null && !(!(c instanceof Element) && v(e) && f(e, l)) && !(!c || c === l.target || l.composedPath().includes(c))) {
515
+ if ("detail" in l && l.detail === 0 && (i = !m(l)), !i) {
516
+ i = !0;
517
+ return;
518
+ }
519
+ t(l);
520
+ }
521
+ };
522
+ let p = !1;
523
+ const y = [
524
+ U(n, "click", (l) => {
525
+ p || (p = !0, setTimeout(() => {
526
+ p = !1;
527
+ }, 0), d(l));
528
+ }, { passive: !0, capture: o }),
529
+ U(n, "pointerdown", (l) => {
530
+ const c = K(e);
531
+ i = !m(l) && !!(c && !l.composedPath().includes(c));
532
+ }, { passive: !0 }),
533
+ a && U(n, "blur", (l) => {
534
+ setTimeout(() => {
535
+ var c;
536
+ const h = K(e);
537
+ ((c = n.document.activeElement) == null ? void 0 : c.tagName) === "IFRAME" && !h?.contains(n.document.activeElement) && t(l);
538
+ }, 0);
539
+ }, { passive: !0 })
540
+ ].filter(Boolean), T = () => y.forEach((l) => l());
541
+ return u ? {
542
+ stop: T,
543
+ cancel: () => {
544
+ i = !1;
545
+ },
546
+ trigger: (l) => {
547
+ i = !0, d(l), i = !1;
548
+ }
549
+ } : T;
550
+ }
551
+ function vt(e, t, r) {
552
+ const {
553
+ immediate: n = !0,
554
+ delay: s = 0,
555
+ onError: o = N,
556
+ onSuccess: a = N,
557
+ resetOnExecute: u = !0,
558
+ shallow: i = !0,
559
+ throwError: m
560
+ } = r ?? {}, v = i ? k(t) : R(t), f = k(!1), d = k(!1), p = k(void 0);
561
+ async function y(c = 0, ...h) {
562
+ u && (v.value = t), p.value = void 0, f.value = !1, d.value = !0, c > 0 && await ue(c);
563
+ const w = typeof e == "function" ? e(...h) : e;
564
+ try {
565
+ const g = await w;
566
+ v.value = g, f.value = !0, a(g);
567
+ } catch (g) {
568
+ if (p.value = g, o(g), m)
569
+ throw g;
570
+ } finally {
571
+ d.value = !1;
572
+ }
573
+ return v.value;
574
+ }
575
+ n && y(s);
576
+ const T = {
577
+ state: v,
578
+ isReady: f,
579
+ isLoading: d,
580
+ error: p,
581
+ execute: y,
582
+ executeImmediate: (...c) => y(0, ...c)
583
+ };
584
+ function l() {
585
+ return new Promise((c, h) => {
586
+ lt(d).toBe(!1).then(() => c(T)).catch(h);
587
+ });
588
+ }
589
+ return {
590
+ ...T,
591
+ then(c, h) {
592
+ return l().then(c, h);
593
+ }
594
+ };
595
+ }
596
+ function Lt(e = {}) {
597
+ const { document: t = mt } = e;
598
+ if (!t)
599
+ return k("visible");
600
+ const r = k(t.visibilityState);
601
+ return U(t, "visibilitychange", () => {
602
+ r.value = t.visibilityState;
603
+ }, { passive: !0 }), r;
604
+ }
605
+ async function pt(e) {
606
+ return new Promise((t, r) => {
607
+ const n = new Image(), { src: s, srcset: o, sizes: a, class: u, loading: i, crossorigin: m, referrerPolicy: v, width: f, height: d, decoding: p, fetchPriority: y, ismap: T, usemap: l } = e;
608
+ n.src = s, o != null && (n.srcset = o), a != null && (n.sizes = a), u != null && (n.className = u), i != null && (n.loading = i), m != null && (n.crossOrigin = m), v != null && (n.referrerPolicy = v), f != null && (n.width = f), d != null && (n.height = d), p != null && (n.decoding = p), y != null && (n.fetchPriority = y), T != null && (n.isMap = T), l != null && (n.useMap = l), n.onload = () => t(n), n.onerror = r;
609
+ });
610
+ }
611
+ function _t(e, t = {}) {
612
+ const r = vt(
613
+ () => pt(x(e)),
614
+ void 0,
615
+ {
616
+ resetOnExecute: !0,
617
+ ...t
618
+ }
619
+ );
620
+ return S(
621
+ () => x(e),
622
+ () => r.execute(t.delay),
623
+ { deep: !0 }
624
+ ), r;
625
+ }
626
+ const pe = "ping";
627
+ function oe(e) {
628
+ return e === !0 ? {} : e;
629
+ }
630
+ function Wt(e, t = {}) {
631
+ const {
632
+ onConnected: r,
633
+ onDisconnected: n,
634
+ onError: s,
635
+ onMessage: o,
636
+ immediate: a = !0,
637
+ autoConnect: u = !0,
638
+ autoClose: i = !0,
639
+ protocols: m = []
640
+ } = t, v = R(null), f = k("CLOSED"), d = R(), p = Re(e);
641
+ let y, T, l = !1, c = 0, h = [], w, g;
642
+ const L = () => {
643
+ if (h.length && d.value && f.value === "OPEN") {
644
+ for (const b of h)
645
+ d.value.send(b);
646
+ h = [];
647
+ }
648
+ }, B = () => {
649
+ w != null && (clearTimeout(w), w = void 0);
650
+ }, $ = () => {
651
+ clearTimeout(g), g = void 0;
652
+ }, W = (b = 1e3, I) => {
653
+ B(), !(!D && !me || !d.value) && (l = !0, $(), y?.(), d.value.close(b, I), d.value = void 0);
654
+ }, V = (b, I = !0) => !d.value || f.value !== "OPEN" ? (I && h.push(b), !1) : (L(), d.value.send(b), !0), Q = () => {
655
+ if (l || typeof p.value > "u")
656
+ return;
657
+ const b = new WebSocket(p.value, m);
658
+ d.value = b, f.value = "CONNECTING", b.onopen = () => {
659
+ f.value = "OPEN", c = 0, r?.(b), T?.(), L();
660
+ }, b.onclose = (I) => {
661
+ if (f.value = "CLOSED", $(), y?.(), n?.(b, I), !l && t.autoReconnect && (d.value == null || b === d.value)) {
662
+ const {
663
+ retries: A = -1,
664
+ delay: F = 1e3,
665
+ onFailed: M
666
+ } = oe(t.autoReconnect);
667
+ (typeof A == "function" ? A : () => typeof A == "number" && (A < 0 || c < A))(c) ? (c += 1, w = setTimeout(Q, F)) : M?.();
668
+ }
669
+ }, b.onerror = (I) => {
670
+ s?.(b, I);
671
+ }, b.onmessage = (I) => {
672
+ if (t.heartbeat) {
673
+ $();
674
+ const {
675
+ message: A = pe,
676
+ responseMessage: F = A
677
+ } = oe(t.heartbeat);
678
+ if (I.data === x(F))
679
+ return;
680
+ }
681
+ v.value = I.data, o?.(b, I);
682
+ };
683
+ };
684
+ if (t.heartbeat) {
685
+ const {
686
+ message: b = pe,
687
+ interval: I = 1e3,
688
+ pongTimeout: A = 1e3
689
+ } = oe(t.heartbeat), { pause: F, resume: M } = ct(
690
+ () => {
691
+ V(x(b), !1), g == null && (g = setTimeout(() => {
692
+ W(), l = !1;
693
+ }, A));
694
+ },
695
+ I,
696
+ { immediate: !1 }
697
+ );
698
+ y = F, T = M;
699
+ }
700
+ i && (D && U("beforeunload", () => W(), { passive: !0 }), J(W));
701
+ const z = () => {
702
+ !D && !me || (W(), l = !1, c = 0, Q());
703
+ };
704
+ return a && z(), u && S(p, z), {
705
+ data: v,
706
+ status: f,
707
+ close: W,
708
+ send: V,
709
+ open: z,
710
+ ws: d
711
+ };
712
+ }
713
+ function Ft(e = [], t = {}) {
714
+ const { delay: r = 0 } = t, n = R(!1), s = j(() => {
715
+ const u = C(e);
716
+ return Array.isArray(u) ? u.map((i) => C(i)).some(Boolean) : u;
717
+ }), { start: o, stop: a } = ft(() => {
718
+ n.value = !0;
719
+ }, r);
720
+ return S(
721
+ s,
722
+ (u) => {
723
+ if (u)
724
+ return o();
725
+ a(), n.value = !1;
726
+ },
727
+ { immediate: !0, deep: !0 }
728
+ ), n;
729
+ }
730
+ /*! *****************************************************************************
731
+ Copyright (c) Microsoft Corporation.
732
+
733
+ Permission to use, copy, modify, and/or distribute this software for any
734
+ purpose with or without fee is hereby granted.
735
+
736
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
737
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
738
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
739
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
740
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
741
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
742
+ PERFORMANCE OF THIS SOFTWARE.
743
+ ***************************************************************************** */
744
+ function ie(e, t) {
745
+ var r = typeof Symbol == "function" && e[Symbol.iterator];
746
+ if (!r) return e;
747
+ var n, s, o = r.call(e), a = [];
748
+ try {
749
+ for (; (t === void 0 || t-- > 0) && !(n = o.next()).done; ) a.push(n.value);
750
+ } catch (u) {
751
+ s = { error: u };
752
+ } finally {
753
+ try {
754
+ n && !n.done && (r = o.return) && r.call(o);
755
+ } finally {
756
+ if (s) throw s.error;
757
+ }
758
+ }
759
+ return a;
760
+ }
761
+ var he;
762
+ (function(e) {
763
+ e[e.NotStarted = 0] = "NotStarted", e[e.Running = 1] = "Running", e[e.Stopped = 2] = "Stopped";
764
+ })(he || (he = {}));
765
+ var ht = { type: "xstate.init" };
766
+ function Y(e) {
767
+ return e === void 0 ? [] : [].concat(e);
768
+ }
769
+ function ye(e, t) {
770
+ return typeof (e = typeof e == "string" && t && t[e] ? t[e] : e) == "string" ? { type: e } : typeof e == "function" ? { type: e.name, exec: e } : e;
771
+ }
772
+ function ce(e) {
773
+ return function(t) {
774
+ return e === t;
775
+ };
776
+ }
777
+ function yt(e) {
778
+ return typeof e == "string" ? { type: e } : e;
779
+ }
780
+ function ge(e, t) {
781
+ return { value: e, context: t, actions: [], changed: !1, matches: ce(e) };
782
+ }
783
+ function be(e, t, r) {
784
+ var n = t, s = !1;
785
+ return [e.filter(function(o) {
786
+ if (o.type === "xstate.assign") {
787
+ s = !0;
788
+ var a = Object.assign({}, n);
789
+ return typeof o.assignment == "function" ? a = o.assignment(n, r) : Object.keys(o.assignment).forEach(function(u) {
790
+ a[u] = typeof o.assignment[u] == "function" ? o.assignment[u](n, r) : o.assignment[u];
791
+ }), n = a, !1;
792
+ }
793
+ return !0;
794
+ }), n, s];
795
+ }
796
+ function gt(e, t) {
797
+ t === void 0 && (t = {});
798
+ var r = ie(be(Y(e.states[e.initial].entry).map(function(a) {
799
+ return ye(a, t.actions);
800
+ }), e.context, ht), 2), n = r[0], s = r[1], o = { config: e, _options: t, initialState: { value: e.initial, actions: n, context: s, matches: ce(e.initial) }, transition: function(a, u) {
801
+ var i, m, v = typeof a == "string" ? { value: a, context: e.context } : a, f = v.value, d = v.context, p = yt(u), y = e.states[f];
802
+ if (y.on) {
803
+ var T = Y(y.on[p.type]);
804
+ "*" in y.on && T.push.apply(T, function(E, P, te) {
805
+ if (arguments.length === 2) for (var _, G = 0, ke = P.length; G < ke; G++) !_ && G in P || (_ || (_ = Array.prototype.slice.call(P, 0, G)), _[G] = P[G]);
806
+ return E.concat(_ || Array.prototype.slice.call(P));
807
+ }([], ie(Y(y.on["*"])), !1));
808
+ try {
809
+ for (var l = function(E) {
810
+ var P = typeof Symbol == "function" && Symbol.iterator, te = P && E[P], _ = 0;
811
+ if (te) return te.call(E);
812
+ if (E && typeof E.length == "number") return { next: function() {
813
+ return E && _ >= E.length && (E = void 0), { value: E && E[_++], done: !E };
814
+ } };
815
+ throw new TypeError(P ? "Object is not iterable." : "Symbol.iterator is not defined.");
816
+ }(T), c = l.next(); !c.done; c = l.next()) {
817
+ var h = c.value;
818
+ if (h === void 0) return ge(f, d);
819
+ var w = typeof h == "string" ? { target: h } : h, g = w.target, L = w.actions, B = L === void 0 ? [] : L, $ = w.cond, W = $ === void 0 ? function() {
820
+ return !0;
821
+ } : $, V = g === void 0, Q = g ?? f, z = e.states[Q];
822
+ if (W(d, p)) {
823
+ var b = ie(be((V ? Y(B) : [].concat(y.exit, B, z.entry).filter(function(E) {
824
+ return E;
825
+ })).map(function(E) {
826
+ return ye(E, o._options.actions);
827
+ }), d, p), 3), I = b[0], A = b[1], F = b[2], M = g ?? f;
828
+ return { value: M, context: A, actions: I, changed: g !== f || I.length > 0 || F, matches: ce(M) };
829
+ }
830
+ }
831
+ } catch (E) {
832
+ i = { error: E };
833
+ } finally {
834
+ try {
835
+ c && !c.done && (m = l.return) && m.call(l);
836
+ } finally {
837
+ if (i) throw i.error;
838
+ }
839
+ }
840
+ }
841
+ return ge(f, d);
842
+ } };
843
+ return o;
844
+ }
845
+ const bt = gt({
846
+ id: "sort",
847
+ initial: X,
848
+ states: {
849
+ [X]: {
850
+ on: {
851
+ DIRECTION1: ne,
852
+ DIRECTION2: Z
853
+ }
854
+ },
855
+ [ne]: {
856
+ on: {
857
+ DIRECTION1: Z,
858
+ DIRECTION2: X
859
+ }
860
+ },
861
+ [Z]: {
862
+ on: {
863
+ DIRECTION1: X,
864
+ DIRECTION2: ne
865
+ }
866
+ }
867
+ }
868
+ });
869
+ function Tt(e, t) {
870
+ const r = t === Z ? "DIRECTION2" : "DIRECTION1";
871
+ return bt.transition(e, r).value;
872
+ }
873
+ function Mt(e = {}) {
874
+ const { sortTarget: t = null, orders: r = [] } = e, n = Te({ sortTarget: t, orders: r });
875
+ return {
876
+ sort: n,
877
+ change: ({ target: o, orders: a }) => {
878
+ if (n.sortTarget !== o) {
879
+ n.sortTarget = o, n.orders = a;
880
+ return;
881
+ }
882
+ const u = a.map((i, m) => ({
883
+ ...i,
884
+ direction: Tt(n.orders[m].direction, i.direction)
885
+ }));
886
+ n.sortTarget = o, n.orders = u;
887
+ }
888
+ };
889
+ }
890
+ export {
891
+ At as a,
892
+ Ct as b,
893
+ Rt as c,
894
+ It as d,
895
+ Xe as e,
896
+ Ft as f,
897
+ Mt as g,
898
+ _t as h,
899
+ St as i,
900
+ Wt as j,
901
+ Nt as k,
902
+ Pt as l,
903
+ Qe as m,
904
+ N as n,
905
+ Dt as o,
906
+ K as p,
907
+ vt as q,
908
+ Lt as r,
909
+ Ot as u,
910
+ et as v,
911
+ kt as w
912
+ };