@3deye-toolkit/react-event-search 0.0.1-alpha.21 → 0.0.1-alpha.22
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/react-event-search.css +158 -291
- package/dist/react-event-search.d.ts +1 -1
- package/dist/react-event-search.js +1 -65
- package/package.json +3 -3
|
@@ -1,77 +1,87 @@
|
|
|
1
1
|
.x-3deye-button {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
color: inherit;
|
|
3
|
+
background: none;
|
|
4
|
+
border: none;
|
|
5
|
+
position: relative;
|
|
6
|
+
padding: 4px;
|
|
7
|
+
text-transform: uppercase;
|
|
8
|
+
-webkit-user-select: none;
|
|
9
|
+
-moz-user-select: none;
|
|
10
|
+
-ms-user-select: none;
|
|
11
|
+
user-select: none;
|
|
12
|
+
font-family: 'Roboto', sans-serif;
|
|
13
|
+
text-align: center;
|
|
14
|
+
align-items: flex-start;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.x-3deye-button.fullwidth {
|
|
18
|
-
|
|
18
|
+
width: 100%;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.x-3deye-button:focus,
|
|
22
|
-
|
|
21
|
+
.x-3deye-button:focus,
|
|
22
|
+
.x-3deye-button.x-3deye-button:not(:disabled):hover {
|
|
23
|
+
background-color: rgba(var(--surface-highlight-rgb), 0.1);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.x-3deye-button--icon {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
border-radius: 16px;
|
|
28
|
+
width: 32px;
|
|
29
|
+
height: 32px;
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
.x-3deye-button:disabled {
|
|
35
|
-
|
|
36
|
+
opacity: 0.4;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
.x-3deye-button.x-3deye-button--
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
.x-3deye-button.x-3deye-button--ok,
|
|
40
|
+
.x-3deye-button.x-3deye-button--cancel {
|
|
41
|
+
color: white;
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
text-transform: none;
|
|
44
|
+
margin: 4px;
|
|
45
|
+
min-width: 80px;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
.x-3deye-button.x-3deye-button--
|
|
47
|
-
|
|
48
|
+
.x-3deye-button.x-3deye-button--ok.fullwidth,
|
|
49
|
+
.x-3deye-button.x-3deye-button--cancel.fullwidth {
|
|
50
|
+
width: calc(100% - 8px);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
.x-3deye-button:not(:disabled) {
|
|
51
|
-
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.x-3deye-button.x-3deye-button--ok {
|
|
58
|
+
background-color: #27b9a1;
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
.x-3deye-button.x-3deye-button--
|
|
55
|
-
|
|
61
|
+
.x-3deye-button.x-3deye-button--ok:not(:disabled):hover {
|
|
62
|
+
background-color: #61beaf;
|
|
56
63
|
}
|
|
57
64
|
|
|
58
|
-
.x-3deye-button.x-3deye-button--
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
.x-3deye-button.x-3deye-button--ok:focus {
|
|
66
|
+
transition: box-shadow 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
67
|
+
box-shadow: 0 0 0 2px rgba(39, 185, 161, 0.33);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
.x-3deye-button.x-3deye-button--cancel {
|
|
64
|
-
|
|
71
|
+
background-color: rgb(119, 87, 178);
|
|
65
72
|
}
|
|
66
73
|
|
|
67
|
-
.x-3deye-button.x-3deye-button--cancel:
|
|
68
|
-
|
|
69
|
-
box-shadow: 0 0 0 2px rgba(119, 87, 178, 0.33);
|
|
74
|
+
.x-3deye-button.x-3deye-button--cancel:not(:disabled):hover {
|
|
75
|
+
background-color: rgb(142, 122, 180);
|
|
70
76
|
}
|
|
71
77
|
|
|
78
|
+
.x-3deye-button.x-3deye-button--cancel:focus {
|
|
79
|
+
transition: box-shadow 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
80
|
+
box-shadow: 0 0 0 2px rgba(119, 87, 178, 0.33);
|
|
81
|
+
}
|
|
72
82
|
|
|
73
83
|
.x-3deye-button canvas {
|
|
74
|
-
|
|
84
|
+
color: rgb(var(--surface-highlight-rgb));
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
:root {
|
|
@@ -402,254 +412,6 @@
|
|
|
402
412
|
.mdc-slider--discrete.mdc-slider--display-markers .mdc-slider__track-marker-container {
|
|
403
413
|
visibility: visible;
|
|
404
414
|
}
|
|
405
|
-
.menu-items-container {
|
|
406
|
-
background: rgba(0, 0, 0, 0.9);
|
|
407
|
-
box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2),0 2px 4px 0 rgb(0 0 0 / 0.1),inset 0 0 0 1px rgb(255 255 255 /0.05);
|
|
408
|
-
border-radius: 4px;
|
|
409
|
-
padding: 4px;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.menu-items-container .x-3deye-button {
|
|
413
|
-
text-transform: none;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
.menu-items-container button {
|
|
417
|
-
background: none;
|
|
418
|
-
border: none;
|
|
419
|
-
text-align: left;
|
|
420
|
-
color: white;
|
|
421
|
-
padding: 8px 16px;
|
|
422
|
-
display: block;
|
|
423
|
-
width: 100%;
|
|
424
|
-
border-radius: 4px;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
.menu-items-container button:hover {
|
|
428
|
-
background-color: rgba(255, 255, 255, 0.22);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
.themed-menu.menu-items-container {
|
|
432
|
-
background-color: var(--background);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
.themed-menu.menu-items-container button {
|
|
436
|
-
color: var(--primary-text);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
.themed-menu.menu-items-container button:hover {
|
|
440
|
-
background-color: rgba(var(--surface-highlight-rgb), var(--surface-highlight-opacity));
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* @license
|
|
445
|
-
* Copyright Google LLC All Rights Reserved.
|
|
446
|
-
*
|
|
447
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
448
|
-
* found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE
|
|
449
|
-
*/
|
|
450
|
-
@-webkit-keyframes mdc-ripple-fg-radius-in {
|
|
451
|
-
from {
|
|
452
|
-
-webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
453
|
-
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
454
|
-
transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);
|
|
455
|
-
}
|
|
456
|
-
to {
|
|
457
|
-
transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
@keyframes mdc-ripple-fg-radius-in {
|
|
461
|
-
from {
|
|
462
|
-
-webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
463
|
-
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
464
|
-
transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);
|
|
465
|
-
}
|
|
466
|
-
to {
|
|
467
|
-
transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
@-webkit-keyframes mdc-ripple-fg-opacity-in {
|
|
471
|
-
from {
|
|
472
|
-
-webkit-animation-timing-function: linear;
|
|
473
|
-
animation-timing-function: linear;
|
|
474
|
-
opacity: 0;
|
|
475
|
-
}
|
|
476
|
-
to {
|
|
477
|
-
opacity: var(--mdc-ripple-fg-opacity, 0);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
@keyframes mdc-ripple-fg-opacity-in {
|
|
481
|
-
from {
|
|
482
|
-
-webkit-animation-timing-function: linear;
|
|
483
|
-
animation-timing-function: linear;
|
|
484
|
-
opacity: 0;
|
|
485
|
-
}
|
|
486
|
-
to {
|
|
487
|
-
opacity: var(--mdc-ripple-fg-opacity, 0);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
@-webkit-keyframes mdc-ripple-fg-opacity-out {
|
|
491
|
-
from {
|
|
492
|
-
-webkit-animation-timing-function: linear;
|
|
493
|
-
animation-timing-function: linear;
|
|
494
|
-
opacity: var(--mdc-ripple-fg-opacity, 0);
|
|
495
|
-
}
|
|
496
|
-
to {
|
|
497
|
-
opacity: 0;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
@keyframes mdc-ripple-fg-opacity-out {
|
|
501
|
-
from {
|
|
502
|
-
-webkit-animation-timing-function: linear;
|
|
503
|
-
animation-timing-function: linear;
|
|
504
|
-
opacity: var(--mdc-ripple-fg-opacity, 0);
|
|
505
|
-
}
|
|
506
|
-
to {
|
|
507
|
-
opacity: 0;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
.mdc-ripple-surface {
|
|
511
|
-
--mdc-ripple-fg-size: 0;
|
|
512
|
-
--mdc-ripple-left: 0;
|
|
513
|
-
--mdc-ripple-top: 0;
|
|
514
|
-
--mdc-ripple-fg-scale: 1;
|
|
515
|
-
--mdc-ripple-fg-translate-end: 0;
|
|
516
|
-
--mdc-ripple-fg-translate-start: 0;
|
|
517
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
518
|
-
position: relative;
|
|
519
|
-
outline: none;
|
|
520
|
-
overflow: hidden;
|
|
521
|
-
}
|
|
522
|
-
.mdc-ripple-surface::before, .mdc-ripple-surface::after {
|
|
523
|
-
position: absolute;
|
|
524
|
-
border-radius: 50%;
|
|
525
|
-
opacity: 0;
|
|
526
|
-
pointer-events: none;
|
|
527
|
-
content: "";
|
|
528
|
-
}
|
|
529
|
-
.mdc-ripple-surface::before {
|
|
530
|
-
transition: opacity 15ms linear, background-color 15ms linear;
|
|
531
|
-
z-index: 1;
|
|
532
|
-
}
|
|
533
|
-
.mdc-ripple-surface.mdc-ripple-upgraded::before {
|
|
534
|
-
transform: scale(var(--mdc-ripple-fg-scale, 1));
|
|
535
|
-
}
|
|
536
|
-
.mdc-ripple-surface.mdc-ripple-upgraded::after {
|
|
537
|
-
top: 0;
|
|
538
|
-
/* @noflip */
|
|
539
|
-
left: 0;
|
|
540
|
-
transform: scale(0);
|
|
541
|
-
transform-origin: center center;
|
|
542
|
-
}
|
|
543
|
-
.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after {
|
|
544
|
-
top: var(--mdc-ripple-top, 0);
|
|
545
|
-
/* @noflip */
|
|
546
|
-
left: var(--mdc-ripple-left, 0);
|
|
547
|
-
}
|
|
548
|
-
.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after {
|
|
549
|
-
-webkit-animation: mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards;
|
|
550
|
-
animation: mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards;
|
|
551
|
-
}
|
|
552
|
-
.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after {
|
|
553
|
-
-webkit-animation: mdc-ripple-fg-opacity-out 150ms;
|
|
554
|
-
animation: mdc-ripple-fg-opacity-out 150ms;
|
|
555
|
-
transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
|
|
556
|
-
}
|
|
557
|
-
.mdc-ripple-surface::before, .mdc-ripple-surface::after {
|
|
558
|
-
background-color: #000;
|
|
559
|
-
}
|
|
560
|
-
.mdc-ripple-surface:hover::before {
|
|
561
|
-
opacity: 0.04;
|
|
562
|
-
}
|
|
563
|
-
.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before, .mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before {
|
|
564
|
-
transition-duration: 75ms;
|
|
565
|
-
opacity: 0.12;
|
|
566
|
-
}
|
|
567
|
-
.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after {
|
|
568
|
-
transition: opacity 150ms linear;
|
|
569
|
-
}
|
|
570
|
-
.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after {
|
|
571
|
-
transition-duration: 75ms;
|
|
572
|
-
opacity: 0.12;
|
|
573
|
-
}
|
|
574
|
-
.mdc-ripple-surface.mdc-ripple-upgraded {
|
|
575
|
-
--mdc-ripple-fg-opacity: 0.12;
|
|
576
|
-
}
|
|
577
|
-
.mdc-ripple-surface::before, .mdc-ripple-surface::after {
|
|
578
|
-
top: calc(50% - 100%);
|
|
579
|
-
/* @noflip */
|
|
580
|
-
left: calc(50% - 100%);
|
|
581
|
-
width: 200%;
|
|
582
|
-
height: 200%;
|
|
583
|
-
}
|
|
584
|
-
.mdc-ripple-surface.mdc-ripple-upgraded::after {
|
|
585
|
-
width: var(--mdc-ripple-fg-size, 100%);
|
|
586
|
-
height: var(--mdc-ripple-fg-size, 100%);
|
|
587
|
-
}
|
|
588
|
-
.mdc-ripple-surface[data-mdc-ripple-is-unbounded] {
|
|
589
|
-
overflow: visible;
|
|
590
|
-
}
|
|
591
|
-
.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before, .mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after {
|
|
592
|
-
top: calc(50% - 50%);
|
|
593
|
-
/* @noflip */
|
|
594
|
-
left: calc(50% - 50%);
|
|
595
|
-
width: 100%;
|
|
596
|
-
height: 100%;
|
|
597
|
-
}
|
|
598
|
-
.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before, .mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after {
|
|
599
|
-
top: var(--mdc-ripple-top, calc(50% - 50%));
|
|
600
|
-
/* @noflip */
|
|
601
|
-
left: var(--mdc-ripple-left, calc(50% - 50%));
|
|
602
|
-
width: var(--mdc-ripple-fg-size, 100%);
|
|
603
|
-
height: var(--mdc-ripple-fg-size, 100%);
|
|
604
|
-
}
|
|
605
|
-
.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after {
|
|
606
|
-
width: var(--mdc-ripple-fg-size, 100%);
|
|
607
|
-
height: var(--mdc-ripple-fg-size, 100%);
|
|
608
|
-
}
|
|
609
|
-
.mdc-ripple-surface--primary::before, .mdc-ripple-surface--primary::after {
|
|
610
|
-
background-color: #6200ee;
|
|
611
|
-
/* @alternate */
|
|
612
|
-
background-color: var(--mdc-theme-primary, #6200ee);
|
|
613
|
-
}
|
|
614
|
-
.mdc-ripple-surface--primary:hover::before {
|
|
615
|
-
opacity: 0.04;
|
|
616
|
-
}
|
|
617
|
-
.mdc-ripple-surface--primary.mdc-ripple-upgraded--background-focused::before, .mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):focus::before {
|
|
618
|
-
transition-duration: 75ms;
|
|
619
|
-
opacity: 0.12;
|
|
620
|
-
}
|
|
621
|
-
.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded)::after {
|
|
622
|
-
transition: opacity 150ms linear;
|
|
623
|
-
}
|
|
624
|
-
.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):active::after {
|
|
625
|
-
transition-duration: 75ms;
|
|
626
|
-
opacity: 0.12;
|
|
627
|
-
}
|
|
628
|
-
.mdc-ripple-surface--primary.mdc-ripple-upgraded {
|
|
629
|
-
--mdc-ripple-fg-opacity: 0.12;
|
|
630
|
-
}
|
|
631
|
-
.mdc-ripple-surface--accent::before, .mdc-ripple-surface--accent::after {
|
|
632
|
-
background-color: #018786;
|
|
633
|
-
/* @alternate */
|
|
634
|
-
background-color: var(--mdc-theme-secondary, #018786);
|
|
635
|
-
}
|
|
636
|
-
.mdc-ripple-surface--accent:hover::before {
|
|
637
|
-
opacity: 0.04;
|
|
638
|
-
}
|
|
639
|
-
.mdc-ripple-surface--accent.mdc-ripple-upgraded--background-focused::before, .mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):focus::before {
|
|
640
|
-
transition-duration: 75ms;
|
|
641
|
-
opacity: 0.12;
|
|
642
|
-
}
|
|
643
|
-
.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded)::after {
|
|
644
|
-
transition: opacity 150ms linear;
|
|
645
|
-
}
|
|
646
|
-
.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):active::after {
|
|
647
|
-
transition-duration: 75ms;
|
|
648
|
-
opacity: 0.12;
|
|
649
|
-
}
|
|
650
|
-
.mdc-ripple-surface--accent.mdc-ripple-upgraded {
|
|
651
|
-
--mdc-ripple-fg-opacity: 0.12;
|
|
652
|
-
}
|
|
653
415
|
.event-list-item {
|
|
654
416
|
-webkit-user-select: none;
|
|
655
417
|
-moz-user-select: none;
|
|
@@ -663,7 +425,7 @@
|
|
|
663
425
|
bottom: 2px;
|
|
664
426
|
left: 0;
|
|
665
427
|
right: 0;
|
|
666
|
-
|
|
428
|
+
overflow: hidden;
|
|
667
429
|
}
|
|
668
430
|
|
|
669
431
|
.event-list-item.mdc-ripple-surface {
|
|
@@ -858,6 +620,111 @@
|
|
|
858
620
|
background-color: orange;
|
|
859
621
|
}
|
|
860
622
|
|
|
623
|
+
.event-list-item .menu-button {
|
|
624
|
+
position: absolute;
|
|
625
|
+
top: 0;
|
|
626
|
+
right: 0;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
@-webkit-keyframes slide-in {
|
|
630
|
+
0% {
|
|
631
|
+
opacity: 0;
|
|
632
|
+
transform: scale(0.9);
|
|
633
|
+
}
|
|
634
|
+
100% {
|
|
635
|
+
opacity: 1;
|
|
636
|
+
transform: scale(1);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
@keyframes slide-in {
|
|
641
|
+
0% {
|
|
642
|
+
opacity: 0;
|
|
643
|
+
transform: scale(0.9);
|
|
644
|
+
}
|
|
645
|
+
100% {
|
|
646
|
+
opacity: 1;
|
|
647
|
+
transform: scale(1);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
.menu-items-container {
|
|
652
|
+
transform-origin: right top;
|
|
653
|
+
position: absolute;
|
|
654
|
+
z-index: 10000001;
|
|
655
|
+
background: rgba(0, 0, 0, 0.9);
|
|
656
|
+
box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgb(0 0 0 / 0.1), inset 0 0 0 1px rgb(255 255 255 /0.05);
|
|
657
|
+
border-radius: 4px;
|
|
658
|
+
padding: 4px;
|
|
659
|
+
-webkit-animation: slide-in 0.15s ease-in;
|
|
660
|
+
animation: slide-in 0.15s ease-in;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
@media (prefers-reduced-motion) {
|
|
664
|
+
.menu-items-container {
|
|
665
|
+
-webkit-animation: none;
|
|
666
|
+
animation: none;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
.menu-items-container[data-placement='top-start'] {
|
|
671
|
+
transform-origin: left bottom;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
.menu-items-container[data-placement='top-end'] {
|
|
675
|
+
transform-origin: right bottom;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
.menu-items-container[data-placement='bottom-start'] {
|
|
679
|
+
transform-origin: left top;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
.menu-items-container[data-placement='bottom-end'] {
|
|
683
|
+
transform-origin: right top;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
.menu-items-container[data-placement='top'] {
|
|
687
|
+
transform-origin: center bottom;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
.menu-items-container .x-3deye-button {
|
|
691
|
+
text-transform: none;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
.menu-items-container button {
|
|
695
|
+
font-size: 14px;
|
|
696
|
+
background: none;
|
|
697
|
+
border: none;
|
|
698
|
+
text-align: left;
|
|
699
|
+
color: white;
|
|
700
|
+
padding: 8px 16px;
|
|
701
|
+
display: block;
|
|
702
|
+
width: 100%;
|
|
703
|
+
border-radius: 4px;
|
|
704
|
+
letter-spacing: 0.5px;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
.menu-items-container .x-3deye-button.menu-item:hover,
|
|
708
|
+
.menu-items-container .x-3deye-button.menu-item:focus {
|
|
709
|
+
background-color: rgba(255, 255, 255, 0.22);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
.menu-items-container .menu-item--danger {
|
|
713
|
+
color: #f44336;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
.themed-menu.menu-items-container {
|
|
717
|
+
background-color: var(--background);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.themed-menu.menu-items-container .x-3deye-button.menu-item {
|
|
721
|
+
color: var(--primary-text);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
.themed-menu.menu-items-container .x-3deye-button.menu-item:hover {
|
|
725
|
+
background-color: rgba(var(--surface-highlight-rgb), var(--surface-highlight-opacity));
|
|
726
|
+
}
|
|
727
|
+
|
|
861
728
|
.preloader-container {
|
|
862
729
|
color: var(--primary-text);
|
|
863
730
|
flex: 1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { app } from '@3deye-toolkit/core';
|
|
2
2
|
import { BehaviorSubject } from 'rxjs';
|
|
3
3
|
import crossfilter from 'crossfilter2';
|
|
4
|
-
import { IReactionDisposer } from 'mobx';
|
|
4
|
+
import type { IReactionDisposer } from 'mobx';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { default as React_2 } from 'react';
|
|
7
7
|
import { Subject } from 'rxjs';
|
|
@@ -1,65 +1 @@
|
|
|
1
|
-
import{format as e,startOfDay as t,endOfDay as r,isSameYear as n,isSameDay as i,subDays as a,subHours as o}from"date-fns/esm";import s from"i18next";import{from as l,Observable as c,Subscription as u,of as d,throwError as h,EMPTY as p,Subject as m}from"rxjs";import{computed as f,makeObservable as b,observable as v,action as g,runInAction as y,reaction as w}from"mobx";import{mergeMap as _,catchError as E,switchMap as C,mapTo as O,concatMap as P,distinctUntilChanged as x,share as j,map as T,debounceTime as S}from"rxjs/operators";import I from"earcut";import{subHours as D}from"date-fns";import{AppContext as M,app as A}from"@3deye-toolkit/core";import*as L from"react";import N,{useRef as R,useState as k,useEffect as z,useMemo as H,useCallback as F,useContext as U,Fragment as B}from"react";import{observer as V,Observer as $,useLocalObservable as W}from"mobx-react-lite";import G,{components as q}from"react-select";import Y from"clsx";import X from"material-colors";import K from"react-ink";import J from"@reach/tooltip";import{MDCSlider as Z}from"@material/slider";import Q from"resize-observer-polyfill";import*as ee from"react-dom";import te from"react-dom";import{FixedSizeGrid as re}from"react-window";import ne from"react-virtualized-auto-sizer";import ie from"react-window-infinite-loader";import ae from"@seznam/compose-react-refs";import{useSpring as oe,animated as se}from"@react-spring/web";import le from"react-datepicker";import{extent as ce,bin as ue,max as de}from"d3-array";import{select as he}from"d3-selection";import{scaleTime as pe,scaleLinear as me}from"d3-scale";import{timeMinute as fe,timeHours as be,timeHour as ve}from"d3-time";import{axisBottom as ge}from"d3-axis";import{brushX as ye}from"d3-brush";import{timeFormat as we}from"d3-time-format";var _e={eventSearchRequestError:"Sorry, an error occured during event search. Please try again later",today:"today",yesterday:"yesterday",selectObjectType:"Select object type",noEventsFound:"no events found"};const Ee=new Map,Ce={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},Oe=s.createInstance();function Pe(t,r){const n=Ee.get(Oe.language);return e(t,r,{locale:n})}var xe,je;function Te(e,t=!1){const r=f(e);return new c((e=>{const n=r.observe_((({newValue:t})=>e.next(t)),t);return()=>n()}))}!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.CONNECTED=1]="CONNECTED",e[e.RECONNECTING=2]="RECONNECTING",e[e.DISCONNECTED=3]="DISCONNECTED"}(xe||(xe={})),function(e){e[e.Motion=0]="Motion",e[e.Tampering=1]="Tampering",e[e.PanTiltZoom=2]="PanTiltZoom",e[e.CrossLine=3]="CrossLine",e[e.Intrusion=4]="Intrusion",e[e.LicensePlate=5]="LicensePlate",e[e.FaceDetection=6]="FaceDetection",e[e.Audio=7]="Audio",e[e.Analytic=8]="Analytic",e[e.SpeedDetection=9]="SpeedDetection",e[e.PeopleCounter=10]="PeopleCounter",e[e.Temperature=11]="Temperature",e[e.PoS=12]="PoS",e[e.GPS=13]="GPS",e[e.DigitalInput=14]="DigitalInput",e[e.Normal=15]="Normal",e[e.Suspicious=16]="Suspicious",e[e.Loitering=17]="Loitering",e[e.Vandalism=18]="Vandalism",e[e.Trespass=19]="Trespass",e[e.Emergency=20]="Emergency",e[e.LifeInDanger=21]="LifeInDanger",e[e.ErroneousAlert=22]="ErroneousAlert",e[e.Misidentification=23]="Misidentification",e[e.Fire=24]="Fire",e[e.MedicalDuress=25]="MedicalDuress",e[e.HoldUp=26]="HoldUp",e[e.CheckIn=27]="CheckIn",e[e.CheckOut=28]="CheckOut",e[e.ClockIn=29]="ClockIn",e[e.ClockOut=30]="ClockOut",e[e.ParkingStart=31]="ParkingStart",e[e.ParkingEnd=32]="ParkingEnd",e[e.ParkingViolation=33]="ParkingViolation",e[e.GateAccess=34]="GateAccess",e[e.DoorAccess=35]="DoorAccess",e[e.TemperatureCheck=36]="TemperatureCheck",e[e.IDCheck=37]="IDCheck",e[e.PPECheck=38]="PPECheck",e[e.WelfareCheck=39]="WelfareCheck",e[e.Uncategorized=40]="Uncategorized",e[e.Unknown=999]="Unknown"}(je||(je={}));var Se=function(){this.__data__=[],this.size=0};var Ie=function(e,t){return e===t||e!=e&&t!=t};var De=function(e,t){for(var r=e.length;r--;)if(Ie(e[r][0],t))return r;return-1},Me=Array.prototype.splice;var Ae=function(e){var t=this.__data__,r=De(t,e);return!(r<0)&&(r==t.length-1?t.pop():Me.call(t,r,1),--this.size,!0)};var Le=function(e){var t=this.__data__,r=De(t,e);return r<0?void 0:t[r][1]};var Ne=function(e){return De(this.__data__,e)>-1};var Re=function(e,t){var r=this.__data__,n=De(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function ke(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ke.prototype.clear=Se,ke.prototype.delete=Ae,ke.prototype.get=Le,ke.prototype.has=Ne,ke.prototype.set=Re;var ze=ke;var He=function(){this.__data__=new ze,this.size=0};var Fe=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Ue=function(e){return this.__data__.get(e)};var Be=function(e){return this.__data__.has(e)},Ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $e(e){var t={exports:{}};return e(t,t.exports),t.exports}var We="object"==typeof Ve&&Ve&&Ve.Object===Object&&Ve,Ge="object"==typeof self&&self&&self.Object===Object&&self,qe=We||Ge||Function("return this")(),Ye=qe.Symbol,Xe=Object.prototype,Ke=Xe.hasOwnProperty,Je=Xe.toString,Ze=Ye?Ye.toStringTag:void 0;var Qe=function(e){var t=Ke.call(e,Ze),r=e[Ze];try{e[Ze]=void 0;var n=!0}catch(e){}var i=Je.call(e);return n&&(t?e[Ze]=r:delete e[Ze]),i},et=Object.prototype.toString;var tt=function(e){return et.call(e)},rt=Ye?Ye.toStringTag:void 0;var nt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":rt&&rt in Object(e)?Qe(e):tt(e)};var it=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var at,ot=function(e){if(!it(e))return!1;var t=nt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},st=qe["__core-js_shared__"],lt=(at=/[^.]+$/.exec(st&&st.keys&&st.keys.IE_PROTO||""))?"Symbol(src)_1."+at:"";var ct=function(e){return!!lt&< in e},ut=Function.prototype.toString;var dt=function(e){if(null!=e){try{return ut.call(e)}catch(e){}try{return e+""}catch(e){}}return""},ht=/^\[object .+?Constructor\]$/,pt=Function.prototype,mt=Object.prototype,ft=pt.toString,bt=mt.hasOwnProperty,vt=RegExp("^"+ft.call(bt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var gt=function(e){return!(!it(e)||ct(e))&&(ot(e)?vt:ht).test(dt(e))};var yt=function(e,t){return null==e?void 0:e[t]};var wt=function(e,t){var r=yt(e,t);return gt(r)?r:void 0},_t=wt(qe,"Map"),Et=wt(Object,"create");var Ct=function(){this.__data__=Et?Et(null):{},this.size=0};var Ot=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Pt=Object.prototype.hasOwnProperty;var xt=function(e){var t=this.__data__;if(Et){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Pt.call(t,e)?t[e]:void 0},jt=Object.prototype.hasOwnProperty;var Tt=function(e){var t=this.__data__;return Et?void 0!==t[e]:jt.call(t,e)};var St=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Et&&void 0===t?"__lodash_hash_undefined__":t,this};function It(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}It.prototype.clear=Ct,It.prototype.delete=Ot,It.prototype.get=xt,It.prototype.has=Tt,It.prototype.set=St;var Dt=It;var Mt=function(){this.size=0,this.__data__={hash:new Dt,map:new(_t||ze),string:new Dt}};var At=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Lt=function(e,t){var r=e.__data__;return At(t)?r["string"==typeof t?"string":"hash"]:r.map};var Nt=function(e){var t=Lt(this,e).delete(e);return this.size-=t?1:0,t};var Rt=function(e){return Lt(this,e).get(e)};var kt=function(e){return Lt(this,e).has(e)};var zt=function(e,t){var r=Lt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function Ht(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ht.prototype.clear=Mt,Ht.prototype.delete=Nt,Ht.prototype.get=Rt,Ht.prototype.has=kt,Ht.prototype.set=zt;var Ft=Ht;var Ut=function(e,t){var r=this.__data__;if(r instanceof ze){var n=r.__data__;if(!_t||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ft(n)}return r.set(e,t),this.size=r.size,this};function Bt(e){var t=this.__data__=new ze(e);this.size=t.size}Bt.prototype.clear=He,Bt.prototype.delete=Fe,Bt.prototype.get=Ue,Bt.prototype.has=Be,Bt.prototype.set=Ut;var Vt=Bt;var $t=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Wt=function(e){return this.__data__.has(e)};function Gt(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Ft;++t<r;)this.add(e[t])}Gt.prototype.add=Gt.prototype.push=$t,Gt.prototype.has=Wt;var qt=Gt;var Yt=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1};var Xt=function(e,t){return e.has(t)};var Kt=function(e,t,r,n,i,a){var o=1&r,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var c=a.get(e),u=a.get(t);if(c&&u)return c==t&&u==e;var d=-1,h=!0,p=2&r?new qt:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],f=t[d];if(n)var b=o?n(f,m,d,t,e,a):n(m,f,d,e,t,a);if(void 0!==b){if(b)continue;h=!1;break}if(p){if(!Yt(t,(function(e,t){if(!Xt(p,t)&&(m===e||i(m,e,r,n,a)))return p.push(t)}))){h=!1;break}}else if(m!==f&&!i(m,f,r,n,a)){h=!1;break}}return a.delete(e),a.delete(t),h},Jt=qe.Uint8Array;var Zt=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};var Qt=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},er=Ye?Ye.prototype:void 0,tr=er?er.valueOf:void 0;var rr=function(e,t,r,n,i,a,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new Jt(e),new Jt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ie(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=Zt;case"[object Set]":var l=1&n;if(s||(s=Qt),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var u=Kt(s(e),s(t),n,i,a,o);return o.delete(e),u;case"[object Symbol]":if(tr)return tr.call(e)==tr.call(t)}return!1};var nr=function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e},ir=Array.isArray;var ar=function(e,t,r){var n=t(e);return ir(e)?n:nr(n,r(e))};var or=function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a};var sr=function(){return[]},lr=Object.prototype.propertyIsEnumerable,cr=Object.getOwnPropertySymbols,ur=cr?function(e){return null==e?[]:(e=Object(e),or(cr(e),(function(t){return lr.call(e,t)})))}:sr;var dr=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var hr=function(e){return null!=e&&"object"==typeof e};var pr=function(e){return hr(e)&&"[object Arguments]"==nt(e)},mr=Object.prototype,fr=mr.hasOwnProperty,br=mr.propertyIsEnumerable,vr=pr(function(){return arguments}())?pr:function(e){return hr(e)&&fr.call(e,"callee")&&!br.call(e,"callee")};var gr=function(){return!1},yr=$e((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r?qe.Buffer:void 0,a=(i?i.isBuffer:void 0)||gr;e.exports=a})),wr=/^(?:0|[1-9]\d*)$/;var _r=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&wr.test(e))&&e>-1&&e%1==0&&e<t};var Er=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Cr={};Cr["[object Float32Array]"]=Cr["[object Float64Array]"]=Cr["[object Int8Array]"]=Cr["[object Int16Array]"]=Cr["[object Int32Array]"]=Cr["[object Uint8Array]"]=Cr["[object Uint8ClampedArray]"]=Cr["[object Uint16Array]"]=Cr["[object Uint32Array]"]=!0,Cr["[object Arguments]"]=Cr["[object Array]"]=Cr["[object ArrayBuffer]"]=Cr["[object Boolean]"]=Cr["[object DataView]"]=Cr["[object Date]"]=Cr["[object Error]"]=Cr["[object Function]"]=Cr["[object Map]"]=Cr["[object Number]"]=Cr["[object Object]"]=Cr["[object RegExp]"]=Cr["[object Set]"]=Cr["[object String]"]=Cr["[object WeakMap]"]=!1;var Or=function(e){return hr(e)&&Er(e.length)&&!!Cr[nt(e)]};var Pr=function(e){return function(t){return e(t)}},xr=$e((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r&&We.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=a})),jr=xr&&xr.isTypedArray,Tr=jr?Pr(jr):Or,Sr=Object.prototype.hasOwnProperty;var Ir=function(e,t){var r=ir(e),n=!r&&vr(e),i=!r&&!n&&yr(e),a=!r&&!n&&!i&&Tr(e),o=r||n||i||a,s=o?dr(e.length,String):[],l=s.length;for(var c in e)!t&&!Sr.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||_r(c,l))||s.push(c);return s},Dr=Object.prototype;var Mr=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Dr)};var Ar=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Lr=Object.prototype.hasOwnProperty;var Nr=function(e){if(!Mr(e))return Ar(e);var t=[];for(var r in Object(e))Lr.call(e,r)&&"constructor"!=r&&t.push(r);return t};var Rr=function(e){return null!=e&&Er(e.length)&&!ot(e)};var kr=function(e){return Rr(e)?Ir(e):Nr(e)};var zr=function(e){return ar(e,kr,ur)},Hr=Object.prototype.hasOwnProperty;var Fr=function(e,t,r,n,i,a){var o=1&r,s=zr(e),l=s.length;if(l!=zr(t).length&&!o)return!1;for(var c=l;c--;){var u=s[c];if(!(o?u in t:Hr.call(t,u)))return!1}var d=a.get(e),h=a.get(t);if(d&&h)return d==t&&h==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++c<l;){var f=e[u=s[c]],b=t[u];if(n)var v=o?n(b,f,u,t,e,a):n(f,b,u,e,t,a);if(!(void 0===v?f===b||i(f,b,r,n,a):v)){p=!1;break}m||(m="constructor"==u)}if(p&&!m){var g=e.constructor,y=t.constructor;g==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof y&&y instanceof y||(p=!1)}return a.delete(e),a.delete(t),p},Ur=wt(qe,"DataView"),Br=wt(qe,"Promise"),Vr=wt(qe,"Set"),$r=wt(qe,"WeakMap"),Wr=dt(Ur),Gr=dt(_t),qr=dt(Br),Yr=dt(Vr),Xr=dt($r),Kr=nt;(Ur&&"[object DataView]"!=Kr(new Ur(new ArrayBuffer(1)))||_t&&"[object Map]"!=Kr(new _t)||Br&&"[object Promise]"!=Kr(Br.resolve())||Vr&&"[object Set]"!=Kr(new Vr)||$r&&"[object WeakMap]"!=Kr(new $r))&&(Kr=function(e){var t=nt(e),r="[object Object]"==t?e.constructor:void 0,n=r?dt(r):"";if(n)switch(n){case Wr:return"[object DataView]";case Gr:return"[object Map]";case qr:return"[object Promise]";case Yr:return"[object Set]";case Xr:return"[object WeakMap]"}return t});var Jr=Kr,Zr="[object Object]",Qr=Object.prototype.hasOwnProperty;var en=function(e,t,r,n,i,a){var o=ir(e),s=ir(t),l=o?"[object Array]":Jr(e),c=s?"[object Array]":Jr(t),u=(l="[object Arguments]"==l?Zr:l)==Zr,d=(c="[object Arguments]"==c?Zr:c)==Zr,h=l==c;if(h&&yr(e)){if(!yr(t))return!1;o=!0,u=!1}if(h&&!u)return a||(a=new Vt),o||Tr(e)?Kt(e,t,r,n,i,a):rr(e,t,l,r,n,i,a);if(!(1&r)){var p=u&&Qr.call(e,"__wrapped__"),m=d&&Qr.call(t,"__wrapped__");if(p||m){var f=p?e.value():e,b=m?t.value():t;return a||(a=new Vt),i(f,b,r,n,a)}}return!!h&&(a||(a=new Vt),Fr(e,t,r,n,i,a))};var tn=function e(t,r,n,i,a){return t===r||(null==t||null==r||!hr(t)&&!hr(r)?t!=t&&r!=r:en(t,r,n,i,e,a))};var rn=function(e,t){return tn(e,t)};class nn{constructor(){Object.defineProperty(this,"api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]})}initWith(e){this.api=e,this.afterInit&&this.afterInit()}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}var an=function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=e[n+t];return a};var on=function(e,t,r){if(!it(r))return!1;var n=typeof t;return!!("number"==n?Rr(r)&&_r(t,r.length):"string"==n&&t in r)&&Ie(r[t],e)},sn=/\s/;var ln=function(e){for(var t=e.length;t--&&sn.test(e.charAt(t)););return t},cn=/^\s+/;var un=function(e){return e?e.slice(0,ln(e)+1).replace(cn,""):e};var dn=function(e){return"symbol"==typeof e||hr(e)&&"[object Symbol]"==nt(e)},hn=/^[-+]0x[0-9a-f]+$/i,pn=/^0b[01]+$/i,mn=/^0o[0-7]+$/i,fn=parseInt;var bn=function(e){if("number"==typeof e)return e;if(dn(e))return NaN;if(it(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=it(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=un(e);var r=pn.test(e);return r||mn.test(e)?fn(e.slice(2),r?2:8):hn.test(e)?NaN:+e};var vn=function(e){return e?Infinity===(e=bn(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var gn=function(e){var t=vn(e),r=t%1;return t==t?r?t-r:t:0},yn=Math.ceil,wn=Math.max;var _n=function(e,t,r){t=(r?on(e,t,r):void 0===t)?1:wn(gn(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var i=0,a=0,o=Array(yn(n/t));i<n;)o[a++]=an(e,i,i+=t);return o};const En=([e,t],[r,n],[i,a])=>{const o=(n-t)*(i-r)-(r-e)*(a-n);return 0===o?0:o>0?1:2},Cn=([e,t],[r,n],[i,a])=>r<=Math.max(e,i)&&r>=Math.min(e,i)&&n<=Math.max(t,a)&&n>=Math.min(t,a),On=(e,t,r)=>!(e<r.x||t<r.y||e>r.x+r.width||t>r.y+r.height),Pn=(e,t,r)=>{const n=r.y1*r.x3-r.x1*r.y3+(r.y3-r.y1)*e+(r.x1-r.x3)*t,i=r.x1*r.y2-r.y1*r.x2+(r.y1-r.y2)*e+(r.x2-r.x1)*t;if(n<0!=i<0)return!1;const a=-r.y2*r.x3+r.y1*(r.x3-r.x2)+r.x1*(r.y2-r.y3)+r.x2*r.y3;return a<0?n<=0&&n+i>=a:n>=0&&n+i<=a},xn=(e,t)=>{if(On(t.x1,t.y1,e))return!0;if(On(t.x2,t.y2,e))return!0;if(On(t.x3,t.y3,e))return!0;if(Pn(e.x,e.y,t))return!0;if(Pn(e.x+e.width,e.y,t))return!0;if(Pn(e.x+e.width,e.y+e.height,t))return!0;if(Pn(e.x,e.y+e.height,t))return!0;const r=[[[e.x,e.y],[e.x+e.width,e.y]],[[e.x+e.width,e.y],[e.x+e.width,e.y+e.height]],[[e.x,e.y+e.height],[e.x+e.width,e.y+e.height]],[[e.x,e.y],[e.x,e.y+e.height]]];return!![[[t.x1,t.y1],[t.x2,t.y2]],[[t.x1,t.y1],[t.x3,t.y3]]].some((e=>r.some((t=>(([e,t],[r,n])=>{const i=En(e,t,r),a=En(e,t,n),o=En(r,n,e),s=En(r,n,t);return i!==a&&o!==s||!(0!==i||!Cn(e,r,t))||!(0!==a||!Cn(e,n,t))||!(0!==o||!Cn(r,e,n))||!(0!==s||!Cn(r,t,n))})(t,e)))))},jn=(e,t)=>{const r=e.map((({x:e,y:t})=>[e,t]));return _n(I(r.flat()),3).some((r=>xn(t,{x1:e[r[0]].x,y1:e[r[0]].y,x2:e[r[1]].x,y2:e[r[1]].y,x3:e[r[2]].x,y3:e[r[2]].y})))},Tn=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class Sn{constructor(e){if(Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thumbnailUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"faces",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"instant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),b(this,{id:f,startTime:f,endTime:f,acknowledged:f,isLive:f,raw:v.ref}),this.raw=e,this.type=e.eventType,this.cameraId=e.sensorId,("Analytic"===this.type||"FaceDetection"===this.type)&&e.data)try{const t=JSON.parse(e.data);t.FoundObjects&&(this.type="Analytic",this.detectedObjects=t.FoundObjects),t.Faces&&(this.type="FaceDetection",this.faces=t.Faces),this.thumbnailUrl=t.ThumbnailUrl}catch{console.warn("invalid data",e.data),this.type="Motion"}this.instant=Tn.has(this.type),this.detectedObjects||(this.detectedObjects=[])}get id(){return this.raw.id}get startTime(){return new Date(this.raw.startTime)}get endTime(){return new Date(this.raw.endTime)}get isLive(){return!Tn.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class In extends nn{constructor(e){super(),Object.defineProperty(this,"eventsStore",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pendingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"liveUpdateMode",{enumerable:!0,configurable:!0,writable:!0,value:"auto"}),Object.defineProperty(this,"updateTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pageInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"loading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"loadMoreTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"retryTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"sortDirection",{enumerable:!0,configurable:!0,writable:!0,value:"DESC"}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"to",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameras",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"polygons",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"eventTypes",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"loadingInited",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"flushUpdates",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.data=[...this.pendingData,...this.data],this.pendingData=[]}}),Object.defineProperty(this,"load",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.loadingInited||(this.loadingInited=!0,this.initDataLoading(),this.initLiveUpdates())}}),Object.defineProperty(this,"reload",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error&&(this.retryTrigger=+!this.retryTrigger)}}),Object.defineProperty(this,"loadMore",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error=null,this.loadMoreTrigger=+!this.loadMoreTrigger}}),Object.defineProperty(this,"requestData",{enumerable:!0,configurable:!0,writable:!0,value:({sortDirection:e,from:t,to:r,filter:n,pageInfo:i,cameras:a,polygons:o})=>this.api.cameras.GetSensorEventsPage({sensorIds:a,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==i?void 0:i.nextPageToken},n,o).pipe(_((e=>e.success?d({events:e.resultItems,pageInfo:e.pageInfo}):h(e.error))),E((e=>(console.error(e),this.error=e,d({events:[],pageInfo:null})))))}),b(this,{data:v.ref,cameras:v.struct,detectedObjects:v.struct,from:v,to:v,sortDirection:v,probabilityThreshold:v,pendingData:v.ref,liveUpdateMode:v,updateTrigger:v,colors:v.ref,flushUpdates:g,pageInfo:v.ref,isLive:f,loading:v,loadMoreTrigger:v,retryTrigger:v,error:v.ref,loadMore:g,filterJson:f})}get isLive(){return"DESC"==this.sortDirection&&!this.to}get totalCount(){return this.data.length}get filterJson(){if(1===this.eventTypes.length&&this.eventTypes[0]===je.FaceDetection)return null;const{probabilityThreshold:e}=this;if(null===e)return null;const t={And:[]};return this.detectedObjects.length&&t.And.push({Or:this.detectedObjects.map((e=>({Type:e})))}),this.colors.size&&t.And.push({Or:[...this.colors].map((e=>({ObjectColors:[e]})))}),t.And.push({Or:[{Probability:e}]}),JSON.stringify(t)}initDataLoading(){const e=Te((()=>({from:this.from?+this.from:void 0,to:this.to?+this.to:void 0,sortDirection:this.sortDirection,filter:this.filterJson,cameraFilters:this.cameras,polygons:this.polygons})),!0);this.disposables.push(e.pipe(C((e=>Te((()=>this.retryTrigger),!0).pipe(O(e)))),C((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i,polygons:a})=>(y((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[]})),this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:i,pageInfo:this.pageInfo,polygons:a}))))).subscribe((({events:e,pageInfo:t})=>{y((()=>{var r,n,i;if(!t)return;const a=e.map(Dn);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:6===this.eventTypes[0]?["FaceDetection"]:[],from:null!==(n=null===(r=a[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:D(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(i=this.probabilityThreshold)&&void 0!==i?i:void 0}),a):this.data=a,this.eventsStore.add(a),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(C((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i})=>Te((()=>this.loadMoreTrigger)).pipe(P((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:i,pageInfo:this.pageInfo,polygons:this.polygons}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(Dn);this.eventsStore.add(r),y((()=>{this.data=this.data.concat(r),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(Te((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(C((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?Te((()=>this.eventsStore.recentAdditions)):p))).subscribe((e=>{if(this.loading)return;if(!this.pageInfo&&this.error)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&y((()=>{this.data=[...t,...this.data]}))}))),this.disposables.push(Te((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(C((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?Te((()=>this.eventsStore.recentAdditions)):(this.pendingData&&y((()=>this.pendingData=[])),p)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&y((()=>{this.pendingData=[...t,...this.pendingData]}))})))}filter(e){let t=e;const{from:r,to:n}=this;return r&&(t=t.filter((e=>e.startTime>=r))),n&&(t=t.filter((e=>e.startTime<=n))),this.cameras.length&&(t=t.filter((e=>this.cameras.includes(e.cameraId)))),this.eventTypes.length&&6===this.eventTypes[0]&&(t=t.filter((e=>"FaceDetection"===e.type))),this.detectedObjects.length&&(t=t.filter((e=>e.detectedObjects.some((e=>{const{probabilityThreshold:t}=this;return!(null!==t&&e.Probability<t)&&(this.colors.size?this.detectedObjects.includes(e.Type)&&e.Colors.some((e=>this.colors.has(e.Color))):this.detectedObjects.includes(e.Type))}))))),t}uniquelyConcat(e,t){if(!e.length)return t.concat();if(!t.length)return e.concat();const r=e=>[e.id,e];return Array.from(new Map([...e.map(r),...t.map(r)]).values())}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}function Dn(e){return new Sn(e)}const Mn={Top:0,Left:0,Bottom:1,Right:1};class An extends nn{constructor(e,n,i,a){super(),Object.defineProperty(this,"eventSchema",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"notification",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"heatmaps",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"analyticsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposeReactionToCamera",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"regions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"filters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"peopleCountingDataLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"heatmapHidden",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"heatmapLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"heatmap",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"peopleCountingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"brushFilter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"eventsLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"setDate",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.date=e}}),Object.defineProperty(this,"setFilters",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.filters=e}}),Object.defineProperty(this,"getProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.probabilityThreshold}),Object.defineProperty(this,"setProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.probabilityThreshold=e}}),Object.defineProperty(this,"setBrushFilter",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.brushFilter=e}}),Object.defineProperty(this,"setParams",{enumerable:!0,configurable:!0,writable:!0,value:({cameraId:e,box:t})=>{this.cameraId=e,this.regions=[[{x:t.Left,y:t.Top},{x:t.Right,y:t.Top},{x:t.Right,y:t.Bottom},{x:t.Left,y:t.Bottom}]],this.date||(this.date=new Date)}}),Object.defineProperty(this,"openForPlayer",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e}}),Object.defineProperty(this,"searchFullFrame",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e,this.clear(),this.peopleCountingData=[],this.date||(this.date=new Date)}}),Object.defineProperty(this,"setRegions",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.regions=e.length?e:null}}),Object.defineProperty(this,"toggleHeatmap",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.heatmapHidden=!this.heatmapHidden}}),Object.defineProperty(this,"toggleColor",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Set(this.colors);this.colors.has(e)?t.delete(e):t.add(e),this.colors=t}}),Object.defineProperty(this,"clearColors",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.colors=new Set}}),Object.defineProperty(this,"clear",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.date=null,this.regions=null,this.brushFilter=null,this.heatmap=null,this.data=[],this.peopleCountingData=[]}}),Object.defineProperty(this,"initDataFetching",{enumerable:!0,configurable:!0,writable:!0,value:()=>{const e=Te((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId}))).pipe(x(rn),j());this.disposables.push(Te((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId,filters:this.filters,brushFilter:this.brushFilter,colors:this.colors,probabilityThreshold:this.probabilityThreshold}))).pipe(x(rn),j()).subscribe((e=>{y((()=>{if(!e.date||!e.cameraId)return;this.eventsLoader.sortDirection="DESC";const n=t(e.date),i=r(e.date);this.eventsLoader.from=n,this.eventsLoader.to=i;const{brushFilter:a}=e;a&&([this.eventsLoader.from,this.eventsLoader.to]=a),this.eventsLoader.polygons=e.regions?e.regions.map(this.regionToWktPolygon):[],this.eventsLoader.cameras=[e.cameraId],this.eventsLoader.detectedObjects=e.filters.map((e=>e.id)),this.eventsLoader.eventTypes=[je.Analytic],this.eventsLoader.colors=e.colors,this.eventsLoader.probabilityThreshold=e.probabilityThreshold,this.eventsLoader.load()}))})));const n=this.heatmaps;n&&(this.disposables.push(e.pipe(C((e=>{if(!e.date||!e.cameraId)return p;y((()=>{this.peopleCountingDataLoading=!0}));const n=t(e.date),i=r(e.date),a=e.regions?this.boxRegions(e.regions):Mn;return this.api.cameras.GetPeopleCountingData(e.cameraId,n,i,a).pipe(_((e=>e.success?d(e.resultItems):h(e.error)))).pipe(E((e=>(this.notification.error(Oe.t("eventSearchRequestError.peopleCounting")),console.error(e),d([])))))}))).subscribe((e=>{y((()=>{this.peopleCountingData=e,this.peopleCountingDataLoading=!1}))}))),this.disposables.push(Te((()=>({date:this.date,cameraId:this.cameraId}))).pipe(x(rn),C((e=>{if(!e.date||!e.cameraId)return p;y((()=>{this.heatmapLoading=!0}));const i=t(e.date),a=r(e.date);return n.fetchHeatmaps(e.cameraId,i,a,1).pipe(T((e=>e[0]||null))).pipe(E((e=>(this.notification.error(Oe.t("eventSearchRequestError.heatmap")),console.error(e),d(null)))))}))).subscribe((e=>{y((()=>{this.heatmap=e,this.heatmapLoading=!1}))}))))}}),b(this,{cameraId:v,date:v,regions:v.ref,filters:v.ref,colors:v.ref,peopleCountingDataLoading:v,heatmapHidden:v,heatmapLoading:v,data:v.ref,heatmap:v.ref,peopleCountingData:v.ref,probabilityThreshold:v,brushFilter:v.ref,params:f,filteredData:f,filteredPeopleCountingData:f,setDate:g,setFilters:g,setBrushFilter:g,setParams:g,openForPlayer:g,searchFullFrame:g,setRegions:g,toggleHeatmap:g,toggleColor:g,clearColors:g,clear:g}),this.analyticsEnabled=Boolean(a),this.eventsLoader=new In(n),this.eventsLoader.liveUpdateMode="disabled",this.initDataFetching()}get params(){return this.eventSchema.schemaDescription.filter((e=>"filter"===e.parameterType))}get filteredData(){let e=[];const t=this.filters.map((e=>e.id));t.length?(e=this.data.filter((e=>e.detectedObjects.some((e=>t.includes(e.Type)&&e.Probability>=this.probabilityThreshold)))),this.colors.size&&(e=e.filter((e=>e.detectedObjects.some((e=>e.Colors.some((e=>this.colors.has(e.Color))))))))):e=this.data.filter((e=>e.detectedObjects.some((e=>e.Probability>=this.probabilityThreshold))));const{brushFilter:r}=this;r&&(e=e.filter((e=>e.startTime>=r[0]&&e.startTime<=r[1]&&e.detectedObjects.some((e=>"Person"===e.Type)))));const{regions:n}=this;return n&&n.length&&(e=e.filter((e=>e.detectedObjects.some((e=>(!t.length||t.includes(e.Type))&&(!this.colors.size||e.Colors.some((e=>this.colors.has(e.Color))))&&e.Probability>=this.probabilityThreshold&&n.some((t=>jn(t,{x:e.Box.Left,y:e.Box.Top,width:e.Box.Right-e.Box.Left,height:e.Box.Bottom-e.Box.Top})))))))),e}get filteredPeopleCountingData(){const{regions:e}=this;return(null==e?void 0:e.length)?this.peopleCountingData.filter((t=>e.some((e=>jn(e,{x:t.Left,y:t.Top,width:t.Right-t.Left,height:t.Bottom-t.Top}))))):this.peopleCountingData}regionToWktPolygon(e){return e.length?"POLYGON (("+e.concat(e[0]).map((({x:e,y:t})=>`${e} ${t}`)).join(", ")+"))":"POLYGON (())"}boxRegions(e){const t=e.flatMap((e=>e.map((({x:e})=>e)))),r=e.flatMap((e=>e.map((({y:e})=>e))));return{Left:Math.min(...t),Right:Math.max(...t),Top:Math.min(...r),Bottom:Math.max(...r)}}afterInit(){this.eventsLoader.initWith(this.api)}dispose(){this.disposeReactionToCamera&&this.disposeReactionToCamera(),this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}const Ln=N.createContext(null);function Nn(e){return t=>{const{size:r=24,color:n="currentColor",className:i,...a}=t,o=e.viewBox||"0 0 24 24",s=e.svg;return N.createElement("svg",{preserveAspectRatio:"xMinYMin",className:`icon ${i}`,width:r,fill:n,viewBox:o,height:r,...a},s)}}const Rn=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M10.13 3.245a1.994 1.994 0 0 0-1.542.992l-5.491 9.53c-.55.954-.23 2.178.723 2.728l8.66 5c.953.55 2.174.216 2.724-.737l5.509-9.521c.335-.58.349-1.265.087-1.832L17.65 2.54z"}))});Rn.displayName="LabelIcon";const kn=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"}))});kn.displayName="CameraIcon";const zn=Nn({viewBox:"0 0 24 24",svg:N.createElement("path",{d:"M17,6h-2V3c0-0.55-0.45-1-1-1h-4C9.45,2,9,2.45,9,3v3H7C5.9,6,5,6.9,5,8v11c0,1.1,0.9,2,2,2c0,0.55,0.45,1,1,1 c0.55,0,1-0.45,1-1h6c0,0.55,0.45,1,1,1c0.55,0,1-0.45,1-1c1.1,0,2-0.9,2-2V8C19,6.9,18.1,6,17,6z M9.5,18H8V9h1.5V18z M12.75,18 h-1.5V9h1.5V18z M13.5,6h-3V3.5h3V6z M16,18h-1.5V9H16V18z"})});zn.displayName="LuggageIcon";const Hn=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z"}))});Hn.displayName="CarIcon";const Fn=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.65 2.62.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"}))});Fn.displayName="BoatIcon";const Un=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M11.74 13.36L14.14 7.71L13.06 5.5H10.5V4H14L14.73 5.5H21.75L20.75 9H16.44L17.11 10.37C17.69 10.13 18.33 10 19 10C21.76 10 24 12.24 24 15C24 17.76 21.76 20 19 20C16.24 20 14 17.76 14 15C14 13.45 14.71 12.06 15.82 11.15L15 9.5L12.25 16H9.9C9.44 18.28 7.42 20 5 20C2.24 20 0 17.76 0 15C0 12.24 2.24 10 5 10C7.59 10 9.72 11.97 10 14.5H10.58L8.3 9H7.5C7.09 9 6.75 8.66 6.75 8.25C6.75 7.84 7.09 7.5 7.5 7.5H10.25C10.66 7.5 11 7.84 11 8.25C11 8.66 10.66 9 10.25 9H9.97L11.74 13.36M5 11.5C3.07 11.5 1.5 13.07 1.5 15C1.5 16.93 3.07 18.5 5 18.5C6.59 18.5 7.93 17.45 8.36 16H4V14.5H8.47C8.22 12.8 6.76 11.5 5 11.5M19 11.5C18.57 11.5 18.15 11.58 17.77 11.72L19.7 15.68L18.35 16.34L16.5 12.55C15.88 13.18 15.5 14.05 15.5 15C15.5 16.93 17.07 18.5 19 18.5C20.93 18.5 22.5 16.93 22.5 15C22.5 13.07 20.93 11.5 19 11.5Z"}))});Un.displayName="BicycleIcon";const Bn=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7"}))});Bn.displayName="DirectionsWalkIcon";const Vn=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),N.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),N.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),N.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),N.createElement("path",{d:"M17.34 14.86c-.87-1.02-1.6-1.89-2.48-2.91-.46-.54-1.05-1.08-1.75-1.32-.11-.04-.22-.07-.33-.09-.25-.04-.52-.04-.78-.04s-.53 0-.79.05c-.11.02-.22.05-.33.09-.7.24-1.28.78-1.75 1.32-.87 1.02-1.6 1.89-2.48 2.91-1.31 1.31-2.92 2.76-2.62 4.79.29 1.02 1.02 2.03 2.33 2.32.73.15 3.06-.44 5.54-.44h.18c2.48 0 4.81.58 5.54.44 1.31-.29 2.04-1.31 2.33-2.32.31-2.04-1.3-3.49-2.61-4.8z"}))});Vn.displayName="PetsIcon";const $n=({data:e})=>{const t=16;return e.isEventType?"Luggage"===e.id?N.createElement(zn,{size:t}):"Car"===e.id?N.createElement(Hn,{size:t}):"Person"===e.id?N.createElement(Bn,{size:t}):"Bicycle"===e.id?N.createElement(Un,{size:t}):"Boat"===e.id?N.createElement(Fn,{size:t}):"Animal"===e.id?N.createElement(Vn,{size:t}):N.createElement(Rn,{size:t}):N.createElement(kn,{size:t})},Wn=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:i}=q,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center"}};return N.createElement(i,{innerProps:o,...n},N.createElement($n,{data:a}),N.createElement("div",{style:{marginLeft:4}},t))},Gn={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},qn=({label:e,children:t})=>N.createElement(J,{label:e,style:Gn},t);qn.displayName="Tooltip";class Yn extends N.Component{render(){const{forwardedRef:e,children:t,className:r,fullwidth:n,type:i,title:a,...o}=this.props,s=Y(r,"x-3deye-button",{fullwidth:n}),l=N.createElement("button",{ref:e,className:s,type:i||"button",...o},t,o.disabled?null:N.createElement(K,null));return a?N.createElement(qn,{label:a},l):l}}const Xn=N.forwardRef(((e,t)=>N.createElement(Yn,{forwardedRef:t,...e}))),Kn=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Kn.displayName="CloseIcon";const Jn=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),N.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});Jn.displayName="DoneIcon";const Zn=[{color:X.red[500],name:"red",highlightColor:X.red[100]},{color:X.green[500],name:"green",highlightColor:X.green[100]},{color:X.blue[500],name:"blue",highlightColor:X.blue[100]},{color:X.yellow[500],name:"yellow",highlightColor:X.yellow[900]},{color:X.black,name:"black",highlightColor:X.white},{color:X.white,name:"white",highlightColor:X.black},{color:X.grey[500],name:"dimgrey",highlightColor:X.grey[100]}],Qn=V((({value:e,clear:t,toggle:r})=>N.createElement("div",{className:"color-selector"},N.createElement("div",null,"COLOR"),N.createElement("div",{className:"color-selector__items"},Zn.map((({color:t,highlightColor:n,name:i})=>N.createElement("button",{key:i,className:Y("color-selector__item",{selected:e.has(i)}),style:{backgroundColor:t,color:n},onClick:r.bind(null,i)},N.createElement(Jn,{size:20})))),N.createElement(Xn,{disabled:!e.size,onClick:t},N.createElement(Kn,{size:20}))))));Qn.displayName="ColorSelector";const ei=({value:e,onChange:t})=>{const r=R(null),n=R(),[i,a]=k(0);return z((()=>{if(!r.current)return;const e=new Z(r.current);return n.current=e,e.listen("MDCSlider:change",(()=>{null==t||t(e.value)})),()=>{n.current=void 0,e.destroy()}}),[]),z((()=>{const e=new Q((e=>{var t;for(const r of e){const e=r.contentRect.width;e!==i&&(null===(t=n.current)||void 0===t||t.layout()),a(e)}}));return e.observe(r.current),()=>e.disconnect()}),[]),z((()=>{n.current&&(n.current.value=e)}),[e]),N.createElement("div",{ref:r,className:"mdc-slider mdc-slider--discrete mdc-slider--display-markers",tabIndex:0,role:"slider","data-step":5,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e,"aria-label":"Select Value"},N.createElement("div",{className:"mdc-slider__track-container"},N.createElement("div",{className:"mdc-slider__track"}),N.createElement("div",{className:"mdc-slider__track-marker-container"})),N.createElement("div",{className:"mdc-slider__thumb-container"},N.createElement("div",{className:"mdc-slider__pin"},N.createElement("span",{className:"mdc-slider__pin-value-marker"})),N.createElement("svg",{className:"mdc-slider__thumb",width:"21",height:"21"},N.createElement("circle",{cx:"10.5",cy:"10.5",r:"7.875"})),N.createElement("div",{className:"mdc-slider__focus-ring"})))};ei.displayName="Slider";const ti=V((({getter:e,setter:t})=>{const[r,n]=k(0),i=R(null),a=Math.floor(100*e());return z((()=>w(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),N.createElement("div",{ref:i,style:{paddingLeft:8,paddingRight:8,marginTop:5}},N.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},N.createElement("div",null,"CONFIDENCE"),N.createElement("div",{style:{fontSize:"1.1em"}},a,"%")),N.createElement(ei,{value:r,onChange:e=>{t(e/100)}}))}));ti.displayName="ProbabilitySlider";var ri,ni=(ri=8,{container:e=>({...e,padding:ri}),control:(e,t)=>({...e,borderRadius:8,backgroundColor:t.isFocused?"white":"rgba(0, 0, 0, 0.5)",border:"none",boxShadow:null,"&:hover":{borderColor:null}}),menu:e=>({...e,borderRadius:"0 0 4px 4px",marginTop:0,marginLeft:-ri,marginRight:ri}),option:e=>({...e,color:"black"}),multiValueRemove:e=>({...e,color:"black"})}),ii=function(e,t){return(ii=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
6
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
|
|
8
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
9
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
10
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
11
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
12
|
-
|
|
13
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
|
-
and limitations under the License.
|
|
15
|
-
***************************************************************************** */function ai(e,t){function r(){this.constructor=e}ii(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var oi=function(){return(oi=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function si(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function li(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function ci(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function ui(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ci(arguments[t]));return e}
|
|
16
|
-
/*!
|
|
17
|
-
Copyright (c) 2018 Jed Watson.
|
|
18
|
-
Licensed under the MIT License (MIT), see
|
|
19
|
-
http://jedwatson.github.io/classnames
|
|
20
|
-
*/var di=$e((function(e){!function(){var t={}.hasOwnProperty;function r(){for(var e=[],n=0;n<arguments.length;n++){var i=arguments[n];if(i){var a=typeof i;if("string"===a||"number"===a)e.push(i);else if(Array.isArray(i)){if(i.length){var o=r.apply(null,i);o&&e.push(o)}}else if("object"===a)if(i.toString===Object.prototype.toString)for(var s in i)t.call(i,s)&&i[s]&&e.push(s);else e.push(i.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):window.classNames=r}()})),hi={blur:"onBlur",cancel:"onCancel",click:"onClick",close:"onClose",contextmenu:"onContextMenu",copy:"onCopy",cut:"onCut",auxclick:"onAuxClick",doubleclick:"onDoubleClick",dragend:"onDragEnd",dragstart:"onDragStart",drop:"onDrop",focus:"onFocus",input:"onInput",invalid:"onInvalid",keydown:"onKeyDown",keypress:"onKeyPress",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",paste:"onPaste",pause:"onPause",play:"onPlay",pointercancel:"onPointerCancel",pointerdown:"onPointerDown",pointerup:"onPointerUp",ratechange:"onRateChange",reset:"onReset",seeked:"onSeeked",submit:"onSubmit",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchstart:"onTouchStart",volumechange:"onVolumeChange",abort:"onAbort",animationend:"onAnimationEnd",animationiteration:"onAnimationIteration",animationstart:"onAnimationStart",canplay:"onCanPlay",canplaythrough:"onCanPlayThrough",drag:"onDrag",dragenter:"onDragEnter",dragexit:"onDragExit",dragleave:"onDragLeave",dragover:"onDragOver",durationchange:"onDurationChange",emptied:"onEmptied",encrypted:"onEncrypted",ended:"onEnded",error:"onError",gotpointercapture:"onGotPointerCapture",load:"onLoad",loadeddata:"onLoadedData",loadedmetadata:"onLoadedMetadata",loadstart:"onLoadStart",lostpointercapture:"onLostPointerCapture",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseover:"onMouseOver",playing:"onPlaying",pointermove:"onPointerMove",pointerout:"onPointerOut",pointerover:"onPointerOver",progress:"onProgress",scroll:"onScroll",seeking:"onSeeking",stalled:"onStalled",suspend:"onSuspend",timeupdate:"onTimeUpdate",toggle:"onToggle",touchmove:"onTouchMove",transitionend:"onTransitionEnd",waiting:"onWaiting",wheel:"onWheel",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",change:"onChange",select:"onSelect",beforeinput:"onBeforeInput",compositionend:"onCompositionEnd",compositionstart:"onCompositionStart",compositionupdate:"onCompositionUpdate"},pi={bottom:0,height:0,left:0,right:0,top:0,width:0};N.forwardRef((function(e,t){var r=e.tag,n=void 0===r?"div":r;e.theme;var i=e.element,a=si(e,["tag","theme","element"]),o=i?i.props(a):a,s=i?fi(t,i.setRef):t;return N.createElement(n,oi({},o,{ref:s}))}));var mi,fi=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var r,n;try{for(var i=li(e),a=i.next();!a.done;a=i.next()){var o=a.value;"function"==typeof o?o(t):o&&"current"in o&&(o.current=t)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}},bi=function(e,t){"function"==typeof e?e(t):e&&"current"in e&&(e.current=t)},vi=function(e){return hi[e]||e},gi=function(){function e(e){this._classes=new Set,this._events={},this._style={},this._props={},this._ref=null,this._onChange=null,this._onChange=e,this.onChange=this.onChange.bind(this),this.addClass=this.addClass.bind(this),this.removeClass=this.removeClass.bind(this),this.hasClass=this.hasClass.bind(this),this.setProp=this.setProp.bind(this),this.getProp=this.getProp.bind(this),this.removeProp=this.removeProp.bind(this),this.setStyle=this.setStyle.bind(this),this.addEventListener=this.addEventListener.bind(this),this.removeEventListener=this.removeEventListener.bind(this),this.setRef=this.setRef.bind(this)}return e.prototype.onChange=function(){this._onChange&&this._onChange()},e.prototype.destroy=function(){var e=this;this._onChange=null,this._events={},this._style={},this._props={},this._classes=new Set,setTimeout((function(){e._ref=null}))},e.prototype.addClass=function(e){this._classes.has(e)||(this._classes.add(e),this.onChange())},e.prototype.removeClass=function(e){this._classes.has(e)&&(this._classes.delete(e),this.onChange())},e.prototype.hasClass=function(e){return this._classes.has(e)},e.prototype.setProp=function(e,t,r){void 0===r&&(r=!1),this._props[e]!==t&&(this._props[e]=t,!r&&this.onChange())},e.prototype.getProp=function(e){return this._props[e]},e.prototype.removeProp=function(e){void 0!==this._props[e]&&(delete this._props[e],this.onChange())},e.prototype.props=function(e){var t=this,r=e.className,n=void 0===r?"":r,i=e.style,a=void 0===i?{}:i,o=Object.entries(e).reduce((function(e,r){var n=ci(r,2),i=n[0],a=n[1],o=t._events[i];if("function"==typeof a&&"function"==typeof o){e[i]=function(e){return o(e),a(e)}}return e}),oi({},this._events)),s=di(n,ui(this._classes)),l=oi(oi({},this._style),a);return oi(oi(oi(oi({},e),this._props),o),{style:l,className:s})},e.prototype.setStyle=function(e,t){e=e.startsWith("--")?e:e.replace(/(-[a-z])/g,(function(e){return e.toUpperCase().replace("-","")})),this._style[e]!==t&&(this._style[e]=t,this.onChange())},e.prototype.addEventListener=function(e,t){var r=vi(e);this._events[r]!==t&&(this._events[r]=t,this.onChange())},e.prototype.removeEventListener=function(e,t){var r=vi(e);this._events[r]&&(delete this._events[r],this.onChange())},e.prototype.setRef=function(e){e&&(this._ref=e)},Object.defineProperty(e.prototype,"ref",{get:function(){return this._ref},enumerable:!1,configurable:!0}),e}(),yi=function(e){return function(t,r,n){var i;void 0===n&&(n=!1),i=new CustomEvent(t,{detail:r,bubbles:n}),Object.defineProperty(i,"target",{value:r,writable:!1}),Object.defineProperty(i,"currentTarget",{value:r,writable:!1});var a=t;return e[a]&&e[a](i),i}};
|
|
21
|
-
/**
|
|
22
|
-
* @license
|
|
23
|
-
* Copyright 2016 Google Inc.
|
|
24
|
-
*
|
|
25
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
27
|
-
* in the Software without restriction, including without limitation the rights
|
|
28
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
29
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
30
|
-
* furnished to do so, subject to the following conditions:
|
|
31
|
-
*
|
|
32
|
-
* The above copyright notice and this permission notice shall be included in
|
|
33
|
-
* all copies or substantial portions of the Software.
|
|
34
|
-
*
|
|
35
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
36
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
37
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
38
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
39
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
40
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
41
|
-
* THE SOFTWARE.
|
|
42
|
-
*/
|
|
43
|
-
var wi,_i=function(){function e(e){void 0===e&&(e={}),this.adapter_=e}return Object.defineProperty(e,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.destroy=function(){},e}(),Ei={BG_FOCUSED:"mdc-ripple-upgraded--background-focused",FG_ACTIVATION:"mdc-ripple-upgraded--foreground-activation",FG_DEACTIVATION:"mdc-ripple-upgraded--foreground-deactivation",ROOT:"mdc-ripple-upgraded",UNBOUNDED:"mdc-ripple-upgraded--unbounded"},Ci={VAR_FG_SCALE:"--mdc-ripple-fg-scale",VAR_FG_SIZE:"--mdc-ripple-fg-size",VAR_FG_TRANSLATE_END:"--mdc-ripple-fg-translate-end",VAR_FG_TRANSLATE_START:"--mdc-ripple-fg-translate-start",VAR_LEFT:"--mdc-ripple-left",VAR_TOP:"--mdc-ripple-top"},Oi={DEACTIVATION_TIMEOUT_MS:225,FG_DEACTIVATION_MS:150,INITIAL_ORIGIN_SCALE:.6,PADDING:10,TAP_DELAY_MS:300},Pi=["touchstart","pointerdown","mousedown","keydown"],xi=["touchend","pointerup","mouseup","contextmenu"],ji=[],Ti=function(e){function t(r){var n=e.call(this,oi({},t.defaultAdapter,r))||this;return n.activationAnimationHasEnded_=!1,n.activationTimer_=0,n.fgDeactivationRemovalTimer_=0,n.fgScale_="0",n.frame_={width:0,height:0},n.initialSize_=0,n.layoutFrame_=0,n.maxRadius_=0,n.unboundedCoords_={left:0,top:0},n.activationState_=n.defaultActivationState_(),n.activationTimerCallback_=function(){n.activationAnimationHasEnded_=!0,n.runDeactivationUXLogicIfReady_()},n.activateHandler_=function(e){return n.activate_(e)},n.deactivateHandler_=function(){return n.deactivate_()},n.focusHandler_=function(){return n.handleFocus()},n.blurHandler_=function(){return n.handleBlur()},n.resizeHandler_=function(){return n.layout()},n}return ai(t,e),Object.defineProperty(t,"cssClasses",{get:function(){return Ei},enumerable:!0,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return Ci},enumerable:!0,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return Oi},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{addClass:function(){},browserSupportsCssVars:function(){return!0},computeBoundingRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},containsEventTarget:function(){return!0},deregisterDocumentInteractionHandler:function(){},deregisterInteractionHandler:function(){},deregisterResizeHandler:function(){},getWindowPageOffset:function(){return{x:0,y:0}},isSurfaceActive:function(){return!0},isSurfaceDisabled:function(){return!0},isUnbounded:function(){return!0},registerDocumentInteractionHandler:function(){},registerInteractionHandler:function(){},registerResizeHandler:function(){},removeClass:function(){},updateCssVariable:function(){}}},enumerable:!0,configurable:!0}),t.prototype.init=function(){var e=this,r=this.supportsPressRipple_();if(this.registerRootHandlers_(r),r){var n=t.cssClasses,i=n.ROOT,a=n.UNBOUNDED;requestAnimationFrame((function(){e.adapter_.addClass(i),e.adapter_.isUnbounded()&&(e.adapter_.addClass(a),e.layoutInternal_())}))}},t.prototype.destroy=function(){var e=this;if(this.supportsPressRipple_()){this.activationTimer_&&(clearTimeout(this.activationTimer_),this.activationTimer_=0,this.adapter_.removeClass(t.cssClasses.FG_ACTIVATION)),this.fgDeactivationRemovalTimer_&&(clearTimeout(this.fgDeactivationRemovalTimer_),this.fgDeactivationRemovalTimer_=0,this.adapter_.removeClass(t.cssClasses.FG_DEACTIVATION));var r=t.cssClasses,n=r.ROOT,i=r.UNBOUNDED;requestAnimationFrame((function(){e.adapter_.removeClass(n),e.adapter_.removeClass(i),e.removeCssVars_()}))}this.deregisterRootHandlers_(),this.deregisterDeactivationHandlers_()},t.prototype.activate=function(e){this.activate_(e)},t.prototype.deactivate=function(){this.deactivate_()},t.prototype.layout=function(){var e=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame((function(){e.layoutInternal_(),e.layoutFrame_=0}))},t.prototype.setUnbounded=function(e){var r=t.cssClasses.UNBOUNDED;e?this.adapter_.addClass(r):this.adapter_.removeClass(r)},t.prototype.handleFocus=function(){var e=this;requestAnimationFrame((function(){return e.adapter_.addClass(t.cssClasses.BG_FOCUSED)}))},t.prototype.handleBlur=function(){var e=this;requestAnimationFrame((function(){return e.adapter_.removeClass(t.cssClasses.BG_FOCUSED)}))},t.prototype.supportsPressRipple_=function(){return this.adapter_.browserSupportsCssVars()},t.prototype.defaultActivationState_=function(){return{activationEvent:void 0,hasDeactivationUXRun:!1,isActivated:!1,isProgrammatic:!1,wasActivatedByPointer:!1,wasElementMadeActive:!1}},t.prototype.registerRootHandlers_=function(e){var t=this;e&&(Pi.forEach((function(e){t.adapter_.registerInteractionHandler(e,t.activateHandler_)})),this.adapter_.isUnbounded()&&this.adapter_.registerResizeHandler(this.resizeHandler_)),this.adapter_.registerInteractionHandler("focus",this.focusHandler_),this.adapter_.registerInteractionHandler("blur",this.blurHandler_)},t.prototype.registerDeactivationHandlers_=function(e){var t=this;"keydown"===e.type?this.adapter_.registerInteractionHandler("keyup",this.deactivateHandler_):xi.forEach((function(e){t.adapter_.registerDocumentInteractionHandler(e,t.deactivateHandler_)}))},t.prototype.deregisterRootHandlers_=function(){var e=this;Pi.forEach((function(t){e.adapter_.deregisterInteractionHandler(t,e.activateHandler_)})),this.adapter_.deregisterInteractionHandler("focus",this.focusHandler_),this.adapter_.deregisterInteractionHandler("blur",this.blurHandler_),this.adapter_.isUnbounded()&&this.adapter_.deregisterResizeHandler(this.resizeHandler_)},t.prototype.deregisterDeactivationHandlers_=function(){var e=this;this.adapter_.deregisterInteractionHandler("keyup",this.deactivateHandler_),xi.forEach((function(t){e.adapter_.deregisterDocumentInteractionHandler(t,e.deactivateHandler_)}))},t.prototype.removeCssVars_=function(){var e=this,r=t.strings;Object.keys(r).forEach((function(t){0===t.indexOf("VAR_")&&e.adapter_.updateCssVariable(r[t],null)}))},t.prototype.activate_=function(e){var t=this;if(!this.adapter_.isSurfaceDisabled()){var r=this.activationState_;if(!r.isActivated){var n=this.previousActivationEvent_;if(!(n&&void 0!==e&&n.type!==e.type))r.isActivated=!0,r.isProgrammatic=void 0===e,r.activationEvent=e,r.wasActivatedByPointer=!r.isProgrammatic&&(void 0!==e&&("mousedown"===e.type||"touchstart"===e.type||"pointerdown"===e.type)),void 0!==e&&ji.length>0&&ji.some((function(e){return t.adapter_.containsEventTarget(e)}))?this.resetActivationState_():(void 0!==e&&(ji.push(e.target),this.registerDeactivationHandlers_(e)),r.wasElementMadeActive=this.checkElementMadeActive_(e),r.wasElementMadeActive&&this.animateActivation_(),requestAnimationFrame((function(){ji=[],r.wasElementMadeActive||void 0===e||" "!==e.key&&32!==e.keyCode||(r.wasElementMadeActive=t.checkElementMadeActive_(e),r.wasElementMadeActive&&t.animateActivation_()),r.wasElementMadeActive||(t.activationState_=t.defaultActivationState_())})))}}},t.prototype.checkElementMadeActive_=function(e){return void 0===e||"keydown"!==e.type||this.adapter_.isSurfaceActive()},t.prototype.animateActivation_=function(){var e=this,r=t.strings,n=r.VAR_FG_TRANSLATE_START,i=r.VAR_FG_TRANSLATE_END,a=t.cssClasses,o=a.FG_DEACTIVATION,s=a.FG_ACTIVATION,l=t.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal_();var c="",u="";if(!this.adapter_.isUnbounded()){var d=this.getFgTranslationCoordinates_(),h=d.startPoint,p=d.endPoint;c=h.x+"px, "+h.y+"px",u=p.x+"px, "+p.y+"px"}this.adapter_.updateCssVariable(n,c),this.adapter_.updateCssVariable(i,u),clearTimeout(this.activationTimer_),clearTimeout(this.fgDeactivationRemovalTimer_),this.rmBoundedActivationClasses_(),this.adapter_.removeClass(o),this.adapter_.computeBoundingRect(),this.adapter_.addClass(s),this.activationTimer_=setTimeout((function(){return e.activationTimerCallback_()}),l)},t.prototype.getFgTranslationCoordinates_=function(){var e,t=this.activationState_,r=t.activationEvent;return{startPoint:e={x:(e=t.wasActivatedByPointer?function(e,t,r){if(!e)return{x:0,y:0};var n,i,a=t.x,o=t.y,s=a+r.left,l=o+r.top;if("touchstart"===e.type){var c=e;n=c.changedTouches[0].pageX-s,i=c.changedTouches[0].pageY-l}else{var u=e;n=u.pageX-s,i=u.pageY-l}return{x:n,y:i}}(r,this.adapter_.getWindowPageOffset(),this.adapter_.computeBoundingRect()):{x:this.frame_.width/2,y:this.frame_.height/2}).x-this.initialSize_/2,y:e.y-this.initialSize_/2},endPoint:{x:this.frame_.width/2-this.initialSize_/2,y:this.frame_.height/2-this.initialSize_/2}}},t.prototype.runDeactivationUXLogicIfReady_=function(){var e=this,r=t.cssClasses.FG_DEACTIVATION,n=this.activationState_,i=n.hasDeactivationUXRun,a=n.isActivated;(i||!a)&&this.activationAnimationHasEnded_&&(this.rmBoundedActivationClasses_(),this.adapter_.addClass(r),this.fgDeactivationRemovalTimer_=setTimeout((function(){e.adapter_.removeClass(r)}),Oi.FG_DEACTIVATION_MS))},t.prototype.rmBoundedActivationClasses_=function(){var e=t.cssClasses.FG_ACTIVATION;this.adapter_.removeClass(e),this.activationAnimationHasEnded_=!1,this.adapter_.computeBoundingRect()},t.prototype.resetActivationState_=function(){var e=this;this.previousActivationEvent_=this.activationState_.activationEvent,this.activationState_=this.defaultActivationState_(),setTimeout((function(){return e.previousActivationEvent_=void 0}),t.numbers.TAP_DELAY_MS)},t.prototype.deactivate_=function(){var e=this,t=this.activationState_;if(t.isActivated){var r=oi({},t);t.isProgrammatic?(requestAnimationFrame((function(){return e.animateDeactivation_(r)})),this.resetActivationState_()):(this.deregisterDeactivationHandlers_(),requestAnimationFrame((function(){e.activationState_.hasDeactivationUXRun=!0,e.animateDeactivation_(r),e.resetActivationState_()})))}},t.prototype.animateDeactivation_=function(e){var t=e.wasActivatedByPointer,r=e.wasElementMadeActive;(t||r)&&this.runDeactivationUXLogicIfReady_()},t.prototype.layoutInternal_=function(){var e=this;this.frame_=this.adapter_.computeBoundingRect();var r=Math.max(this.frame_.height,this.frame_.width);this.maxRadius_=this.adapter_.isUnbounded()?r:Math.sqrt(Math.pow(e.frame_.width,2)+Math.pow(e.frame_.height,2))+t.numbers.PADDING;var n=Math.floor(r*t.numbers.INITIAL_ORIGIN_SCALE);this.adapter_.isUnbounded()&&n%2!=0?this.initialSize_=n-1:this.initialSize_=n,this.fgScale_=""+this.maxRadius_/this.initialSize_,this.updateLayoutCssVars_()},t.prototype.updateLayoutCssVars_=function(){var e=t.strings,r=e.VAR_FG_SIZE,n=e.VAR_LEFT,i=e.VAR_TOP,a=e.VAR_FG_SCALE;this.adapter_.updateCssVariable(r,this.initialSize_+"px"),this.adapter_.updateCssVariable(a,this.fgScale_),this.adapter_.isUnbounded()&&(this.unboundedCoords_={left:Math.round(this.frame_.width/2-this.initialSize_/2),top:Math.round(this.frame_.height/2-this.initialSize_/2)},this.adapter_.updateCssVariable(n,this.unboundedCoords_.left+"px"),this.adapter_.updateCssVariable(i,this.unboundedCoords_.top+"px"))},t}(_i),Si=function(e){var t=R(!1),r=function(e){var t=e.foundation,r=e.props,n=e.elements,i=e.api,a=ci(k(0),2)[1],o=R(r);o.current=r;var s=H((function(){return Object.keys(n).reduce((function(e,t){return e[t]=new gi((function(){a((function(e){return e+1}))})),e}),{})}),[]),l=H((function(){var e=t(oi(oi({},s),{getProps:function(){return o.current},emit:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return yi(o.current).apply(void 0,ui(e))}}));return i&&bi(o.current.apiRef,i(oi({foundation:e},s))),e}),[]);return z((function(){var e=l;return e.init(),i&&bi(o.current.apiRef,i(oi({foundation:e},s))),bi(o.current.foundationRef,e),function(){e.destroy(),bi(o.current.apiRef,null),bi(o.current.foundationRef,null),Object.values(s).map((function(e){return e.destroy()})),o.current={}}}),[l,s]),oi({foundation:l},s)}({props:e,elements:{rootEl:!0,surfaceEl:!0},foundation:function(e){var t=e.rootEl,r=e.surfaceEl,n=e.getProps;return new Ti({browserSupportsCssVars:function(){return function(e,t){void 0===t&&(t=!1);var r,n=e.CSS;if("boolean"==typeof mi&&!t)return mi;if(!n||"function"!=typeof n.supports)return!1;var i=n.supports("--css-vars","yes"),a=n.supports("(--css-vars: yes)")&&n.supports("color","#00000000");return r=i||a,t||(mi=r),r}(window)},isUnbounded:function(){return!!n().unbounded},isSurfaceActive:function(){return!!t.ref&&(e=t.ref,r=":active",(e.matches||e.webkitMatchesSelector||e.msMatchesSelector).call(e,r));var e,r},isSurfaceDisabled:function(){return!!n().disabled},addClass:function(e){r.addClass(e)},removeClass:function(e){r.removeClass(e)},containsEventTarget:function(e){return!!t.ref&&t.ref.contains(e)},registerInteractionHandler:function(e,t){},deregisterInteractionHandler:function(e,t){},registerDocumentInteractionHandler:function(e,t){return document.documentElement.addEventListener(e,t,{passive:!0})},deregisterDocumentInteractionHandler:function(e,t){return document.documentElement.removeEventListener(e,t)},registerResizeHandler:function(e){return window.addEventListener("resize",e)},deregisterResizeHandler:function(e){return window.removeEventListener("resize",e)},updateCssVariable:function(e,t){return r.setStyle(e,t)},computeBoundingRect:function(){return t.ref?t.ref.getBoundingClientRect():pi},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}}})}}),n=r.foundation,i=si(r,["foundation"]),a=i.rootEl,o=F((function(e){e.persist(),n.activate(e)}),[n]),s=F((function(e){e.persist(),n.deactivate()}),[n]),l=F((function(t){var r;null===(r=e.onFocus)||void 0===r||r.call(e,t),n.handleFocus()}),[n,e.onFocus]),c=F((function(t){var r;null===(r=e.onBlur)||void 0===r||r.call(e,t),n.handleBlur()}),[n,e.onBlur]),u=F((function(r){var n;null===(n=e.onMouseDown)||void 0===n||n.call(e,r),t.current||o(r),t.current=!1}),[e.onMouseDown,o]),d=F((function(t){var r;null===(r=e.onMouseUp)||void 0===r||r.call(e,t),s(t)}),[e.onMouseUp,s]),h=F((function(r){var n;t.current=!0,null===(n=e.onTouchStart)||void 0===n||n.call(e,r),o(r)}),[e.onTouchStart,o]),p=F((function(t){var r;null===(r=e.onTouchEnd)||void 0===r||r.call(e,t),s(t)}),[e.onTouchEnd,s]),m=F((function(t){var r;null===(r=e.onKeyDown)||void 0===r||r.call(e,t),o(t)}),[e.onKeyDown,o]),f=F((function(t){var r;null===(r=e.onKeyUp)||void 0===r||r.call(e,t),s(t)}),[e.onKeyUp,s]);return a.setProp("onFocus",l,!0),a.setProp("onBlur",c,!0),a.setProp("onMouseDown",u,!0),a.setProp("onMouseUp",d,!0),a.setProp("onTouchStart",h,!0),a.setProp("onTouchEnd",p,!0),a.setProp("onKeyDown",m,!0),a.setProp("onKeyUp",f,!0),z((function(){a.setRef(e.domNode)}),[a,e.domNode]),z((function(){n.setUnbounded(!!e.unbounded)}),[e.unbounded,n]),z((function(){e.disabled&&n.handleBlur()}),[e.disabled,n]),oi({},i)},Ii=N.createContext({}),Di=(wi=function(e){var t=e.children,r=e.className,n=e.primary,i=e.accent,a=e.unbounded,o=e.surface;e.domNode,e.foundationRef;var s=si(e,["children","className","primary","accent","unbounded","surface","domNode","foundationRef"]),l=Si(e),c=l.rootEl,u=l.surfaceEl,d=N.Children.only(t);if(!N.isValidElement(d))return null;var h=a?{"data-mdc-ripple-is-unbounded":!0}:{},p=o&&a?{}:u.props({style:d.props.style}),m=di(r!==d.props.className&&r,p.className,d.props.className,{"mdc-ripple-surface":"boolean"==typeof o?o:void 0===o,"mdc-ripple-surface--primary":n,"mdc-ripple-surface--accent":i});s.disabled&&(m=m.replace("mdc-ripple-upgraded--background-focused",""));var f=N.cloneElement(d,oi(oi(oi({},d.props),h),c.props(oi(oi(oi(oi({},s),{style:d.props.style}),p),{className:m}))));return N.createElement(Ii.Provider,{value:u.props({style:d.props.style})},f)},function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={domNode:null},t}return ai(t,e),t.prototype.componentDidMount=function(){this.setState({domNode:ee.findDOMNode(this)})},t.prototype.componentDidUpdate=function(){var e=ee.findDOMNode(this);e!==this.state.domNode&&this.setState({rootRippleElement:e})},t.prototype.render=function(){return N.createElement(wi,oi({},this.props,{domNode:this.state.domNode}))},t}(N.Component));
|
|
44
|
-
/**
|
|
45
|
-
* @license
|
|
46
|
-
* Copyright 2016 Google Inc.
|
|
47
|
-
*
|
|
48
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
49
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
50
|
-
* in the Software without restriction, including without limitation the rights
|
|
51
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
52
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
53
|
-
* furnished to do so, subject to the following conditions:
|
|
54
|
-
*
|
|
55
|
-
* The above copyright notice and this permission notice shall be included in
|
|
56
|
-
* all copies or substantial portions of the Software.
|
|
57
|
-
*
|
|
58
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
59
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
60
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
61
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
62
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
63
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
64
|
-
* THE SOFTWARE.
|
|
65
|
-
*/const Mi=document.body;class Ai extends N.Component{constructor(e){super(e),Object.defineProperty(this,"el",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.el=document.createElement("div")}componentDidMount(){Mi.appendChild(this.el)}componentWillUnmount(){Mi.removeChild(this.el)}render(){return te.createPortal(this.props.children,this.el)}}class Li extends N.Component{constructor(e){super(e),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{isOpened:!1,top:0,left:0,bottom:void 0,right:void 0}}),Object.defineProperty(this,"buttonRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"menuRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"outsideClickListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"windowResizeListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"updatePosition",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if(!this.menuRef)return;const{top:t,height:r,left:n,width:i}=e?{...e,width:0,height:0}:this.buttonRef.current.getBoundingClientRect(),{offsetWidth:a,offsetHeight:o}=this.menuRef.current||{offsetHeight:0,offsetWidth:0},s=window.innerHeight,l=window.innerWidth;let c,u=n+i-a,d=t+r;e?(u=n,d=t,u+a>l&&(u-=a),d+o>s&&(d-=o)):(t+r+o>s&&(d=void 0,c=s-t+4),n-a<0&&(u=n+i,c&&(c-=r),d&&(d-=r))),this.setState({top:d,bottom:c,left:u},(()=>{this.forceUpdate()}))}}),Object.defineProperty(this,"toggleMenu",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.setState((({isOpened:e})=>({isOpened:!e})),(()=>{this.state.isOpened?(this.startOutsideClickListening(),this.startWindowResizeListening(),this.updatePosition(e)):(this.stopOutsideClickListening(),this.stopWindowResizeListening())}))}}),Object.defineProperty(this,"targetClick",{enumerable:!0,configurable:!0,writable:!0,value:e=>{e.stopPropagation(),this.toggleMenu()}}),Object.defineProperty(this,"itemClick",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{t.stopPropagation();const{autoClose:r=!0}=this.props;r&&this.toggleMenu(),this.props.onSelect(e,this.props.options[e])}}),this.outsideClickListener=e=>{const t=e.target;this.menuRef.current&&(this.menuRef.current.contains(t)||this.buttonRef.current.contains(t)||this.toggleMenu())}}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener)}startWindowResizeListening(){this.windowResizeListener&&this.stopWindowResizeListening(),this.windowResizeListener=this.updatePosition.bind(null,void 0),window.addEventListener("resize",this.windowResizeListener)}stopWindowResizeListening(){window.removeEventListener("resize",this.windowResizeListener),this.windowResizeListener=null}componentWillUnmount(){this.stopOutsideClickListening(),this.stopWindowResizeListening()}render(){const{top:e,left:t,bottom:r,right:n,isOpened:i}=this.state,{className:a,itemRenderer:o,containerStyle:s}=this.props,l=Y(a,"menu-items-container"),c=i&&N.createElement(Ai,null,N.createElement("div",{className:l,ref:this.menuRef,style:{zIndex:10000001,position:"absolute",top:e,left:t,bottom:r,right:n}},this.props.options.map(((e,t)=>N.createElement(Xn,{key:t,onClick:this.itemClick.bind(null,t)},o?o(t,e):e))))),u=this.props.target(this.buttonRef,this.targetClick),d=Y(a,"menu",{"menu-opened":i});return N.createElement("div",{className:d,style:s},u,c)}}class Ni{constructor(e){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chunks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clipUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isDownloading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"archives",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),b(this,{name:v,clipUrl:v,isDownloading:v}),this.update(e)}get isTimelapse(){return this.type.startsWith("Timelaps")}update(e){this.raw=e,this.id=e.id,this.startTime=new Date(e.startTime),this.endTime=new Date(e.endTime),this.type=e.recordType,this.duration=e.duration,this.cameraId=e.cameraId,this.name=e.name||e.tagName,this.description=e.description,this.clipUrl=e.clipUrl,this.version=e.version}}const Ri=()=>!0;function ki(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}const zi=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}))});zi.displayName="MoreVertIcon";const Hi=({Type:e,Box:{Top:t,Left:r,Right:n,Bottom:i},Probability:a,height:o})=>{const{eventSchema:s}=U(Ln);let l="top";l=o&&t*o>12||t>.1?"top":1-i-t>.5?"bottom":"top inset";const c={top:"top"===l?-12:"top inset"===l?0:"auto",bottom:"bottom"===l?-12:"auto",left:"top"===l?-2:0};return N.createElement("div",{style:{position:"absolute",top:100*t+"%",left:100*r+"%",bottom:100*(1-i)+"%",right:100*(1-n)+"%",outline:`2px solid ${s.colorsByFoundObjectType.get(e)}`}},N.createElement("div",{style:{color:s.colorsByFoundObjectType.get(e),backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",padding:"0 2px",...c},title:`${e.toLowerCase()} ${Math.floor(100*a)}%`},e.toLowerCase()," ",Math.floor(100*a),"%"))};Hi.displayName="FoundObjectBox";const Fi=V((({data:e,hideCameraName:t,height:r,onClick:a})=>{var o,s,l,c;const u=R(null),d=R(null),[h,p]=k(null),m=U(Ln),{cameras:f,eventSchema:b,thumbnails:v}=m;z((()=>{if(e.thumbnailUrl)return void p(null);const t=v.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{p(e||null)}));return()=>t.unsubscribe()}),[e.id]);const g="clipSharing"in m&&!!(4&(null!==(s=null===(o=f.camerasById.get(e.cameraId))||void 0===o?void 0:o.permissions)&&void 0!==s?s:0));let y=null;e.detectedObjects.length&&(y=e.detectedObjects.filter((({Type:e})=>b.foundObjectTypes.includes(e))).map(((e,t)=>N.createElement(Hi,{key:t,...e,height:r}))));let w="",_=!1;if(e.thumbnailUrl?w=e.thumbnailUrl:null===h&&f.loaded?(w=(null===(l=f.camerasById.get(e.cameraId))||void 0===l?void 0:l.imageUrl)||"",_=!0):h&&(w=h.url),e.faces){const{Width:t,Height:r}=JSON.parse(e.raw.data).ThumbnailSize;y||(y=[]);const n=100,i=y.length;y=y.concat(e.faces.map((({Name:e,Box:{Top:a,Left:o,Right:s,Bottom:l},Probability:c},u)=>{const d=n/t/(s-o),h={top:2},p={};return o>=1-s?(h.left=2,p.right=-2):(h.right=2,p.left=-2),a>=1-l?p.bottom="calc(100% + 1px)":p.top="calc(100% + 1px)",N.createElement(B,{key:i+u},N.createElement("div",{className:"event-list-item-face-trigger",style:{position:"absolute",top:100*a+"%",left:100*o+"%",bottom:100*(1-l)+"%",right:100*(1-s)+"%",outline:"1px solid orange"}},N.createElement("div",{style:{color:"orange",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",...p},title:`${e} ${Math.floor(100*c)}%`},e," ",Math.floor(100*c),"%")),N.createElement("div",{className:"event-list-item-face",style:{overflow:"hidden",width:t*(s-o)*d,height:r*(l-a)*d,...h}},N.createElement("img",{style:{width:t*d,height:r*d,transform:`translate(-${100*o}%, -${100*a}%)`},src:w}),N.createElement("div",{className:"frame"},N.createElement("div",{className:"corner-highlight-tl"}),N.createElement("div",{className:"corner-highlight-tr"}),N.createElement("div",{className:"corner-highlight-br"}),N.createElement("div",{className:"corner-highlight-bl"}))))})))}const E=f.loaded&&(null===(c=f.camerasById.get(e.cameraId))||void 0===c?void 0:c.name)||"...",C=[{name:"share",action:()=>{var t;const{cameraId:r}=e;let{startTime:n,endTime:i}=e;+i-+n<5e3&&(n=new Date(+n-5e3),i=new Date(+i+5e3));const a="clipSharing"in m?m.clipSharing:void 0;null==a||a.openModalWithSelectedClip(new Ni({cameraId:r,startTime:n,endTime:i,name:null===(t=f.camerasById.get(r))||void 0===t?void 0:t.name}))},visible:()=>g},{name:"copy id to clipboard",action:()=>{ki(e.id.toString())},visible:Ri},{name:"copy camera id to clipboard",action:()=>{ki(e.cameraId.toString())},visible:Ri}];return N.createElement(Di,null,N.createElement("div",{onDragStart:t=>{if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",""+e.id),t.dataTransfer.dropEffect="move";const r=d.current;if(r){const{x:e,y:n}=r.getBoundingClientRect();t.dataTransfer.setDragImage(r,t.clientX-e,t.clientY-n)}},className:"event-list-item",onClick:()=>a(e),onContextMenu:e=>{var t;e.preventDefault(),null===(t=u.current)||void 0===t||t.toggleMenu({top:e.clientY,left:e.clientX})},draggable:!0},w&&N.createElement("img",{key:w,ref:d,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:w}),_?N.createElement("div",{className:"no-preview-overlay"}):null,e.acknowledged?N.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,y,N.createElement(Li,{ref:u,containerStyle:{position:"absolute",right:0,top:0},target:(e,t)=>N.createElement(Xn,{ref:e,onClick:t,className:"x-3deye-button--icon camera-list-item-button"},N.createElement(zi,null)),options:C.filter((e=>e.visible())),itemRenderer:(e,t)=>t.name,onSelect:(e,t)=>{t.action(void 0)}}),N.createElement("div",{className:"event-list-item-caption"},N.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",a="";return n(e,new Date)?i(e,new Date)?r=a="HH:mm":i(e,t)?(r="EEE d MMM HH:mm",a="HH:mm"):r=a="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",a="d MMM HH:mm"):r=a="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",a+=":ss"),+e==+t?`${Pe(e,r)}`:`${Pe(e,r)} - ${Pe(t,a)}`}(e.startTime,e.endTime)),t?null:N.createElement("div",{className:"event-list-item__camera-name",title:E},E),+e.endTime-+e.startTime>0&&N.createElement("div",{className:"event-list-item__duration"},function(e,t=!0){if((e=Math.round(e/1e3))<60)return`${e}s`;const r=e%60,n=t?`${r}`:`${r}`.padStart(2,"0");let i=(e-r)/60;if(i<60)return!r&&t?`${i}m`:`${i}m ${n}s`;const a=Math.floor(i/60);if(i-=60*a,!r&&!i&&t)return`${a}h`;const o=t?`${i}`:`${i}`.padStart(2,"0");return!r&&i&&t?`${a}h ${o}m`:`${a}h ${o}m ${n}s`}(+e.endTime-+e.startTime)))))}));Fi.displayName="EventListItem";function Ui(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Ui.Cache||Ft),r}Ui.Cache=Ft;const Bi=Ui((()=>{const e=document.createElement("div");e.style.overflowY="scroll",e.style.position="absolute",e.style.top="-9999px",document.body.append(e);const t=e.offsetWidth;return e.remove(),t})),Vi=({size:e=48})=>N.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},N.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(0 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(30 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(60 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(90 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(120 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(150 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(180 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(210 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(240 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(270 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(300 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(330 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));Vi.displayName="Preloader";class $i extends N.Component{constructor(e){super(e),Object.defineProperty(this,"scrollState",{enumerable:!0,configurable:!0,writable:!0,value:{rowIndex:0,columnIndex:0}}),Object.defineProperty(this,"scrollTop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"columnCount",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"rowHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastScrollEventTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"scrolls",{enumerable:!0,configurable:!0,writable:!0,value:new m}),Object.defineProperty(this,"updates",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"listRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"setScrollState",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{this.scrollState.rowIndex=e,this.scrollState.columnIndex=t}}),Object.defineProperty(this,"resetScrollState",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.scrollState.rowIndex=0,this.scrollState.columnIndex=0}}),Object.defineProperty(this,"onScroll",{enumerable:!0,configurable:!0,writable:!0,value:({scrollTop:e})=>{this.scrollTop=e,this.lastScrollEventTimestamp=Date.now(),this.scrolls.next(e),"disabled"!==this.props.store.liveUpdateMode&&y((()=>this.props.store.liveUpdateMode=this.scrollTop?"manual":"auto"))}}),Object.defineProperty(this,"rowRenderer",{enumerable:!0,configurable:!0,writable:!0,value:e=>({columnIndex:t,rowIndex:r,style:n})=>N.createElement($,null,(()=>{var i;const a=r*e+t,o=this.props.store.data[a];return a===this.props.store.data.length?this.props.store.error?N.createElement("div",{style:n},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement("div",{style:{textAlign:"center"}},N.createElement("div",null,"Couldn't fetch more data"),N.createElement(Xn,{onClick:this.props.store.loadMore},"Retry")))):N.createElement("div",{style:n},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement(Vi,{size:32}))):!o&&(null===(i=this.props.store.pageInfo)||void 0===i?void 0:i.haveMore)?N.createElement("div",{style:n}):o?N.createElement("div",{style:n},N.createElement(Fi,{data:o,hideCameraName:this.props.hideCameraName,onClick:this.props.onEventClick})):N.createElement("div",{style:n})}))}),Object.defineProperty(this,"loadMoreItems",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>(this.props.store.loadMore(),Promise.resolve())}),b(this,{scrollState:v,setScrollState:g,resetScrollState:g})}componentDidMount(){this.disposables.push(this.scrolls.pipe(S(200)).subscribe((()=>{this.props.store.pendingData.length&&(this.updates=this.props.store.pendingData.length,this.props.store.flushUpdates(),this.forceUpdate())}))),this.disposables.push(w((()=>this.props.store.pendingData),(e=>{e.length&&(Date.now()-this.lastScrollEventTimestamp<200||(this.updates=e.length,this.props.store.flushUpdates(),this.forceUpdate()))})))}componentWillUnmount(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()})),"disabled"!==this.props.store.liveUpdateMode&&y((()=>this.props.store.liveUpdateMode="auto"))}componentDidUpdate(){if(0!==this.scrollTop&&this.listRef.current&&this.updates){const e=this.scrollTop+Math.round(this.updates/this.columnCount)*this.rowHeight;this.listRef.current.scrollTo({scrollTop:e,scrollLeft:0}),this.updates=0}}render(){return N.createElement($,null,(()=>{const{store:e}=this.props;return e.error&&!e.data.length?(this.resetScrollState(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement("div",{style:{textAlign:"center"}},N.createElement("div",null,"Couldn't fetch data"),N.createElement(Xn,{onClick:e.reload},"Retry")))):e.loading?(this.resetScrollState(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement(Vi,null))):e.data.length?N.createElement(ne,null,(({width:t,height:r})=>N.createElement($,null,(()=>{var n;const{minColumnWidth:i=180}=this.props,a=Math.floor(t/i)||1,o=t/a/16*9,s=a*Math.floor(r/o)>=e.data.length?0:Bi(),l=Math.max(1,Math.floor((t-s)/i)),c=Math.ceil(this.props.store.data.length/l),u=(t-s)/l/16*9;this.rowHeight=u,this.columnCount=l;return N.createElement(ie,{isItemLoaded:e=>e<c,itemCount:c+((null===(n=e.pageInfo)||void 0===n?void 0:n.haveMore)?1:0),loadMoreItems:this.loadMoreItems},(({onItemsRendered:n,ref:i})=>{var a;return N.createElement(re,{ref:ae(this.listRef,i),columnCount:l,columnWidth:(t-s)/l,height:r,width:t,rowCount:c+((null===(a=e.pageInfo)||void 0===a?void 0:a.haveMore)||e.error?1:0),rowHeight:u,initialScrollTop:u*this.scrollState.rowIndex,onScroll:this.onScroll,onItemsRendered:({visibleRowStartIndex:e,visibleColumnStartIndex:t,visibleRowStopIndex:r,overscanRowStopIndex:i,overscanRowStartIndex:a})=>{this.setScrollState(e,t),n({overscanStartIndex:a,overscanStopIndex:i,visibleStartIndex:e,visibleStopIndex:r})}},this.rowRenderer(l))}))})))):(this.resetScrollState(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},Oe.t("noEventsFound")))}))}}const Wi=e=>{const{className:t,children:r,...n}=e;return N.createElement("div",{className:Y("x-3deye-button-group",t),...n},r)},Gi=e=>`scale(${e})`,qi=({children:e,from:t,style:r})=>{const n=oe({opacity:1,from:{opacity:0},config:{tension:300}});return L.createElement(se.div,{style:{...r,...n,transform:n.opacity.to(Gi),transformOrigin:`${t||"bottom"} center`,width:"max-content"}},e)},Yi=({width:e,height:t,color:r,position:n="top",style:i})=>{const a=[0,"top"===n?t:0],o=[e,a[1]],s=[e/2,t-a[1]],l=[e/4,t*("top"===n?3:1)/4],c=[.325*e,t-a[1]],u=[e-c[0],c[1]],d=[e-l[0],l[1]],h=e=>e.join(","),p=`M ${h(a)} C ${h(l)} ${h(c)} ${h(s)} ${h(u)} ${h(d)} ${h(o)} Z`;return N.createElement("svg",{className:"tip",style:i,width:e,height:t,fill:r},N.createElement("path",{d:p}))};class Xi extends N.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,left:0,bottom:"auto",tipPosition:"bottom",tipOffset:0}}),Object.defineProperty(this,"targetRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"popoverRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"outsideClickListener",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=e.target;if(this.popoverRef.current.contains(t))return;const r=this.targetRef.current;r&&r.contains(t)||this.props.onCloseRequest()}}),Object.defineProperty(this,"updatePosition",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!this.popoverRef)return;const{disablePortal:e}=this.props,t=this.targetRef.current;if(!t)return void console.warn("popover: no target element found");const{top:r,left:n,bottom:i,height:a,width:o}=t.getBoundingClientRect();let s="calc(50% - 12px)",l="auto";const c=this.popoverRef.current;let u="bottom"===this.props.placement?i+10:r-c.clientHeight-10,d=n+o/2-c.clientWidth/2,h="bottom"===this.props.placement?"top":"bottom";u<0&&(u=i+10,h="top"),d<0&&(d=0,s=n+o/2-12),d+c.clientWidth>window.innerWidth&&(d=window.innerWidth-c.clientWidth,s=n-d+o/2-12),e&&(u=a+10,d=0,s=8,"top"===this.props.placement&&(l=u,u="auto")),this.setState({top:u,bottom:l,left:d,tipPosition:h,tipOffset:s},(()=>{this.forceUpdate()}))}})}componentWillUnmount(){this.stopOutsideClickListening()}componentDidUpdate(e){const{ignoreOutsideClick:t}=this.props;this.props.opened&&!e.opened&&(t||this.startOutsideClickListening(),requestAnimationFrame(this.updatePosition)),!this.props.opened&&e.opened&&this.stopOutsideClickListening()}render(){const{top:e,left:t,bottom:r,tipPosition:n,tipOffset:i}=this.state,{className:a,opened:o,disablePortal:s,disableAnimation:l}=this.props,c={position:"absolute",left:i};"bottom"===n?c.bottom=-8:c.top=-8;const u=Y(a,"x-3deye-popover-body");let d=null;if(o){const i={zIndex:s?1:100000001,position:"absolute",top:e,bottom:r,left:t},a=N.createElement("div",{className:u,ref:this.popoverRef},this.props.children,N.createElement(Yi,{width:24,height:8,position:n,color:"white",style:c}));d=l?N.createElement("div",{style:i},a):N.createElement(qi,{from:n,style:i},a)}const h=N.cloneElement(this.props.target,{ref:this.targetRef});if(s)return N.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},h,d);const p=o&&N.createElement(Ai,null,d);return N.createElement(N.Fragment,null,h,p)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}const Ki=V((({store:e})=>{const[t,r]=k(!1),{cameras:n}=U(Ln),{date:s,setDate:l,cameraId:c}=e,u=c?n.camerasById.get(c):void 0,d=a(new Date,1),h=s&&i(s,new Date),p=s&&i(s,d),m=u?o(new Date,u.archiveDuration):new Date,f=()=>r(!1);return N.createElement(Wi,null,N.createElement(Xn,{className:Y({"button-selected":h}),onClick:()=>l(new Date)},Oe.t("today")),c&&!i(new Date,m)?N.createElement(Xn,{className:Y({"button-selected":p}),onClick:()=>l(d)},Oe.t("yesterday")):null,s&&N.createElement(Xi,{target:N.createElement(Xn,{className:"date-button",onClick:()=>r(!t)},Pe(s,"EEE dd MMM")),opened:t,onCloseRequest:f,disableAnimation:!0},N.createElement(le,{selected:s,onChange:l,dateFormat:"EEE dd MMM",inline:!0,minDate:m,maxDate:new Date}),N.createElement("div",{style:{display:"flex"}},N.createElement(Xn,{style:{flex:1},onClick:f,className:"x-3deye-button--save"},"Ok"))))}));Ki.displayName="DateSelector";const Ji=V((()=>{const e=U(Ln),t=R(null),r=R(null),n=W((()=>({width:0,setWidth:e=>n.width=e}))),i=100,a=20,o=20,s=30,l=20;return z((()=>{const c=he(r.current),u=new Q((e=>{for(const t of e){const e=t.contentRect.width;n.setWidth(e)}})),d=fe.every(30);if(u.observe(t.current),!("eventSearchPanel"in e))return;const h=w((()=>({data:e.eventSearchPanel.eventSearch.filteredPeopleCountingData,width:n.width})),(({data:t,width:r})=>{if(!r)return;t.forEach((e=>e.timestamp=new Date(e.TimeStamp)));const n=ce(t,(e=>e.timestamp)),u=be(ve.offset(n[0],-1),ve.offset(n[1],1)),h=ye().extent([[l,a],[r-o,i-s]]).on("end",(function({selection:t,sourceEvent:r}){if(!("eventSearchPanel"in e))return;if(!r)return;if(!t)return void e.eventSearchPanel.eventSearch.setBrushFilter(null);const[n,i]=t.map((e=>d.round(p.invert(e))));e.eventSearchPanel.eventSearch.setBrushFilter([n,i]),he(this).transition().call(h.move,i>n?[n,i].map(p):null)}));const p=pe().domain(ce(u)).nice().range([l,r-o]),m=t.length?ue().value((e=>e.timestamp)).domain(p.domain()).thresholds(p.ticks(24))(t):[],f=me().domain([0,de(m,(e=>e.length))]).nice().range([i-s,a]),b=c.select(".bars").selectAll(".bar").data(m);b.exit().remove();const v=b.enter().append("g").attr("class","bar");if(v.append("rect").attr("x",(e=>p(e.x0)+1)).attr("width",(e=>Math.max(0,p(e.x1)-p(e.x0)-1))).attr("y",(e=>f(e.length))).attr("height",(e=>f(0)-f(e.length))),b.select("rect").attr("x",(e=>p(e.x0)+1)).attr("width",(e=>Math.max(0,p(e.x1)-p(e.x0)-1))).attr("y",(e=>f(e.length))).attr("height",(e=>f(0)-f(e.length))),v.append("text").attr("dy",".75em").attr("y",(e=>f(e.length)-10)).attr("x",(e=>p(e.x0)+1+Math.max(0,p(e.x1)-p(e.x0)-1)/2)).attr("text-anchor","middle").text((function(e){return e.length?e.length:""})),b.select("text").attr("dy",".75em").attr("y",(e=>f(e.length)-10)).attr("x",(e=>p(e.x0)+1+Math.max(0,p(e.x1)-p(e.x0)-1)/2)).attr("text-anchor","middle").text((e=>e.length?e.length:"")),t.length){const[e,t]=p.domain(),[r,n]=p.range(),i=(n-r)/(+t-+e)*3600*1e3,a=30,o=ge(p).ticks(ve.every(1)).tickFormat((e=>i>=a?we("%H:%M")(e):e.getHours()%(Math.floor(a/i)+1)?"":we("%H:%M")(e)));o.scale(p),c.select(".x-axis").attr("transform","translate(0,70)").call(o),c.select(".brush").call(h)}else c.select(".x-axis").html(""),c.select(".brush").call(h),c.select(".brush").html("").call(h.move,null)}),{fireImmediately:!0});return()=>{h(),u.disconnect()}}),[]),N.createElement("div",{ref:t},N.createElement("div",{style:{marginLeft:10}},"People Counting"),N.createElement("svg",{className:"people-histogram",ref:r,width:n.width,height:i,viewBox:`0 0 ${n.width} 100`},N.createElement("g",{className:"bars"}),N.createElement("g",{className:"x-axis"}),N.createElement("g",{className:"brush"})))}));Ji.displayName="PeopleHistogram";const Zi=e=>{const{children:t,innerProps:r,...n}=e,{Option:i}=q,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center",width:"auto"}};return N.createElement(i,{innerProps:o,...n},N.createElement($n,{data:a}),N.createElement("div",{style:{marginLeft:4}},t))},Qi=V((({store:e,onEventClick:t})=>{if(!e)return null;const{filters:r,setFilters:n}=e,{foundObjectTypesForSelect:i}=e.eventSchema;return N.createElement(N.Fragment,null,N.createElement(Ki,{store:e}),N.createElement("div",{style:{zIndex:2}},N.createElement(G,{closeMenuOnSelect:!1,isMulti:!0,onChange:n,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:i,placeholder:Oe.t("selectObjectType"),value:r,components:{MultiValueLabel:Wn,Option:Zi},styles:{...ni,multiValue:(e,{data:t})=>t.color?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>t.color?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>t.color?{...e,color:"white"}:e,option:(e,{data:t})=>t.color?{...e,color:t.color}:e}})),N.createElement(ti,{getter:e.getProbabilityThreshold,setter:e.setProbabilityThreshold}),e.filters.length?N.createElement(Qn,{value:e.colors,toggle:e.toggleColor,clear:e.clearColors}):null,e.analyticsEnabled?N.createElement(Ji,null):null,N.createElement("div",{style:{flex:1}},N.createElement($i,{hideCameraName:!0,store:e.eventsLoader,onEventClick:t})))}));Qi.displayName="EventSearch";const ea=e=>{var t;const r=null!==(t=U(M))&&void 0!==t?t:A;return N.createElement(Ln.Provider,{value:r},N.createElement(Qi,{...e}))};var ta;ea.displayName="EventSearch",(ta={resources:{en:{translation:_e}}})&&Object.assign(Ce,ta),l(Oe.init(Ce));const ra=(e=A)=>{const t=new An(e.eventSchema,e.events,e.notification);return t.initWith(e.api),t};export default ea;export{ra as createEventSearchStore};
|
|
1
|
+
import{format as e,startOfDay as t,endOfDay as r,isSameYear as n,isSameDay as i,subDays as a,subHours as o}from"date-fns/esm";import l from"i18next";import{from as s,Observable as c,Subscription as u,of as d,throwError as h,EMPTY as m,fromEvent as p,Subject as f}from"rxjs";import{computed as b,makeObservable as v,observable as g,action as y,runInAction as w,reaction as E,makeAutoObservable as x}from"mobx";import{mergeMap as j,catchError as O,switchMap as C,mapTo as P,concatMap as T,distinctUntilChanged as M,share as _,map as I,debounceTime as S,startWith as D,bufferCount as N,sequenceEqual as L,filter as k}from"rxjs/operators";import z from"earcut";import{subHours as R}from"date-fns";import{AppContext as A,app as F}from"@3deye-toolkit/core";import*as H from"react";import B,{useRef as U,useState as $,useEffect as V,useContext as W,createContext as q,useImperativeHandle as G,useLayoutEffect as Y,useCallback as J,Fragment as K}from"react";import{observer as Z,Observer as X,useLocalObservable as Q}from"mobx-react-lite";import ee,{components as te}from"react-select";import re from"clsx";import ne from"material-colors";import ie from"react-ink";import ae from"@reach/tooltip";import{MDCSlider as oe}from"@material/slider";import le from"resize-observer-polyfill";import se from"react-dom";import{FixedSizeGrid as ce}from"react-window";import ue from"react-virtualized-auto-sizer";import de from"react-window-infinite-loader";import he from"@seznam/compose-react-refs";import{useSpring as me,animated as pe}from"@react-spring/web";import fe from"react-datepicker";import{extent as be,bin as ve,max as ge}from"d3-array";import{select as ye}from"d3-selection";import{scaleTime as we,scaleLinear as Ee}from"d3-scale";import{timeHours as xe,timeHour as je,timeMinute as Oe}from"d3-time";import{axisBottom as Ce}from"d3-axis";import{brushX as Pe}from"d3-brush";import{timeFormat as Te}from"d3-time-format";var Me={eventSearchRequestError:"Sorry, an error occured during event search. Please try again later",today:"today",yesterday:"yesterday",selectObjectType:"Select object type",noEventsFound:"no events found"};const _e=new Map,Ie={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},Se=l.createInstance();function De(t,r){const n=_e.get(Se.language);return e(t,r,{locale:n})}var Ne,Le;function ke(e,t=!1){const r=b(e);return new c((e=>{const n=r.observe_((({newValue:t})=>e.next(t)),t);return()=>n()}))}!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.CONNECTED=1]="CONNECTED",e[e.RECONNECTING=2]="RECONNECTING",e[e.DISCONNECTED=3]="DISCONNECTED"}(Ne||(Ne={})),function(e){e[e.Motion=0]="Motion",e[e.Tampering=1]="Tampering",e[e.PanTiltZoom=2]="PanTiltZoom",e[e.CrossLine=3]="CrossLine",e[e.Intrusion=4]="Intrusion",e[e.LicensePlate=5]="LicensePlate",e[e.FaceDetection=6]="FaceDetection",e[e.Audio=7]="Audio",e[e.Analytic=8]="Analytic",e[e.SpeedDetection=9]="SpeedDetection",e[e.PeopleCounter=10]="PeopleCounter",e[e.Temperature=11]="Temperature",e[e.PoS=12]="PoS",e[e.GPS=13]="GPS",e[e.DigitalInput=14]="DigitalInput",e[e.Normal=15]="Normal",e[e.Suspicious=16]="Suspicious",e[e.Loitering=17]="Loitering",e[e.Vandalism=18]="Vandalism",e[e.Trespass=19]="Trespass",e[e.Emergency=20]="Emergency",e[e.LifeInDanger=21]="LifeInDanger",e[e.ErroneousAlert=22]="ErroneousAlert",e[e.Misidentification=23]="Misidentification",e[e.Fire=24]="Fire",e[e.MedicalDuress=25]="MedicalDuress",e[e.HoldUp=26]="HoldUp",e[e.CheckIn=27]="CheckIn",e[e.CheckOut=28]="CheckOut",e[e.ClockIn=29]="ClockIn",e[e.ClockOut=30]="ClockOut",e[e.ParkingStart=31]="ParkingStart",e[e.ParkingEnd=32]="ParkingEnd",e[e.ParkingViolation=33]="ParkingViolation",e[e.GateAccess=34]="GateAccess",e[e.DoorAccess=35]="DoorAccess",e[e.TemperatureCheck=36]="TemperatureCheck",e[e.IDCheck=37]="IDCheck",e[e.PPECheck=38]="PPECheck",e[e.WelfareCheck=39]="WelfareCheck",e[e.Uncategorized=40]="Uncategorized",e[e.Unknown=999]="Unknown"}(Le||(Le={}));var ze=function(){this.__data__=[],this.size=0};var Re=function(e,t){return e===t||e!=e&&t!=t};var Ae=function(e,t){for(var r=e.length;r--;)if(Re(e[r][0],t))return r;return-1},Fe=Array.prototype.splice;var He=function(e){var t=this.__data__,r=Ae(t,e);return!(r<0)&&(r==t.length-1?t.pop():Fe.call(t,r,1),--this.size,!0)};var Be=function(e){var t=this.__data__,r=Ae(t,e);return r<0?void 0:t[r][1]};var Ue=function(e){return Ae(this.__data__,e)>-1};var $e=function(e,t){var r=this.__data__,n=Ae(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Ve(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ve.prototype.clear=ze,Ve.prototype.delete=He,Ve.prototype.get=Be,Ve.prototype.has=Ue,Ve.prototype.set=$e;var We=Ve;var qe=function(){this.__data__=new We,this.size=0};var Ge=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Ye=function(e){return this.__data__.get(e)};var Je=function(e){return this.__data__.has(e)},Ke="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ze(e){var t={exports:{}};return e(t,t.exports),t.exports}var Xe="object"==typeof Ke&&Ke&&Ke.Object===Object&&Ke,Qe="object"==typeof self&&self&&self.Object===Object&&self,et=Xe||Qe||Function("return this")(),tt=et.Symbol,rt=Object.prototype,nt=rt.hasOwnProperty,it=rt.toString,at=tt?tt.toStringTag:void 0;var ot=function(e){var t=nt.call(e,at),r=e[at];try{e[at]=void 0;var n=!0}catch(e){}var i=it.call(e);return n&&(t?e[at]=r:delete e[at]),i},lt=Object.prototype.toString;var st=function(e){return lt.call(e)},ct=tt?tt.toStringTag:void 0;var ut=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ct&&ct in Object(e)?ot(e):st(e)};var dt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var ht,mt=function(e){if(!dt(e))return!1;var t=ut(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},pt=et["__core-js_shared__"],ft=(ht=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||""))?"Symbol(src)_1."+ht:"";var bt=function(e){return!!ft&&ft in e},vt=Function.prototype.toString;var gt=function(e){if(null!=e){try{return vt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},yt=/^\[object .+?Constructor\]$/,wt=Function.prototype,Et=Object.prototype,xt=wt.toString,jt=Et.hasOwnProperty,Ot=RegExp("^"+xt.call(jt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Ct=function(e){return!(!dt(e)||bt(e))&&(mt(e)?Ot:yt).test(gt(e))};var Pt=function(e,t){return null==e?void 0:e[t]};var Tt=function(e,t){var r=Pt(e,t);return Ct(r)?r:void 0},Mt=Tt(et,"Map"),_t=Tt(Object,"create");var It=function(){this.__data__=_t?_t(null):{},this.size=0};var St=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Dt=Object.prototype.hasOwnProperty;var Nt=function(e){var t=this.__data__;if(_t){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Dt.call(t,e)?t[e]:void 0},Lt=Object.prototype.hasOwnProperty;var kt=function(e){var t=this.__data__;return _t?void 0!==t[e]:Lt.call(t,e)};var zt=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=_t&&void 0===t?"__lodash_hash_undefined__":t,this};function Rt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Rt.prototype.clear=It,Rt.prototype.delete=St,Rt.prototype.get=Nt,Rt.prototype.has=kt,Rt.prototype.set=zt;var At=Rt;var Ft=function(){this.size=0,this.__data__={hash:new At,map:new(Mt||We),string:new At}};var Ht=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Bt=function(e,t){var r=e.__data__;return Ht(t)?r["string"==typeof t?"string":"hash"]:r.map};var Ut=function(e){var t=Bt(this,e).delete(e);return this.size-=t?1:0,t};var $t=function(e){return Bt(this,e).get(e)};var Vt=function(e){return Bt(this,e).has(e)};var Wt=function(e,t){var r=Bt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function qt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}qt.prototype.clear=Ft,qt.prototype.delete=Ut,qt.prototype.get=$t,qt.prototype.has=Vt,qt.prototype.set=Wt;var Gt=qt;var Yt=function(e,t){var r=this.__data__;if(r instanceof We){var n=r.__data__;if(!Mt||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Gt(n)}return r.set(e,t),this.size=r.size,this};function Jt(e){var t=this.__data__=new We(e);this.size=t.size}Jt.prototype.clear=qe,Jt.prototype.delete=Ge,Jt.prototype.get=Ye,Jt.prototype.has=Je,Jt.prototype.set=Yt;var Kt=Jt;var Zt=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Xt=function(e){return this.__data__.has(e)};function Qt(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Gt;++t<r;)this.add(e[t])}Qt.prototype.add=Qt.prototype.push=Zt,Qt.prototype.has=Xt;var er=Qt;var tr=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1};var rr=function(e,t){return e.has(t)};var nr=function(e,t,r,n,i,a){var o=1&r,l=e.length,s=t.length;if(l!=s&&!(o&&s>l))return!1;var c=a.get(e),u=a.get(t);if(c&&u)return c==t&&u==e;var d=-1,h=!0,m=2&r?new er:void 0;for(a.set(e,t),a.set(t,e);++d<l;){var p=e[d],f=t[d];if(n)var b=o?n(f,p,d,t,e,a):n(p,f,d,e,t,a);if(void 0!==b){if(b)continue;h=!1;break}if(m){if(!tr(t,(function(e,t){if(!rr(m,t)&&(p===e||i(p,e,r,n,a)))return m.push(t)}))){h=!1;break}}else if(p!==f&&!i(p,f,r,n,a)){h=!1;break}}return a.delete(e),a.delete(t),h},ir=et.Uint8Array;var ar=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};var or=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},lr=tt?tt.prototype:void 0,sr=lr?lr.valueOf:void 0;var cr=function(e,t,r,n,i,a,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new ir(e),new ir(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Re(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=ar;case"[object Set]":var s=1&n;if(l||(l=or),e.size!=t.size&&!s)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var u=nr(l(e),l(t),n,i,a,o);return o.delete(e),u;case"[object Symbol]":if(sr)return sr.call(e)==sr.call(t)}return!1};var ur=function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e},dr=Array.isArray;var hr=function(e,t,r){var n=t(e);return dr(e)?n:ur(n,r(e))};var mr=function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a};var pr=function(){return[]},fr=Object.prototype.propertyIsEnumerable,br=Object.getOwnPropertySymbols,vr=br?function(e){return null==e?[]:(e=Object(e),mr(br(e),(function(t){return fr.call(e,t)})))}:pr;var gr=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var yr=function(e){return null!=e&&"object"==typeof e};var wr=function(e){return yr(e)&&"[object Arguments]"==ut(e)},Er=Object.prototype,xr=Er.hasOwnProperty,jr=Er.propertyIsEnumerable,Or=wr(function(){return arguments}())?wr:function(e){return yr(e)&&xr.call(e,"callee")&&!jr.call(e,"callee")};var Cr=function(){return!1},Pr=Ze((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r?et.Buffer:void 0,a=(i?i.isBuffer:void 0)||Cr;e.exports=a})),Tr=/^(?:0|[1-9]\d*)$/;var Mr=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&Tr.test(e))&&e>-1&&e%1==0&&e<t};var _r=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Ir={};Ir["[object Float32Array]"]=Ir["[object Float64Array]"]=Ir["[object Int8Array]"]=Ir["[object Int16Array]"]=Ir["[object Int32Array]"]=Ir["[object Uint8Array]"]=Ir["[object Uint8ClampedArray]"]=Ir["[object Uint16Array]"]=Ir["[object Uint32Array]"]=!0,Ir["[object Arguments]"]=Ir["[object Array]"]=Ir["[object ArrayBuffer]"]=Ir["[object Boolean]"]=Ir["[object DataView]"]=Ir["[object Date]"]=Ir["[object Error]"]=Ir["[object Function]"]=Ir["[object Map]"]=Ir["[object Number]"]=Ir["[object Object]"]=Ir["[object RegExp]"]=Ir["[object Set]"]=Ir["[object String]"]=Ir["[object WeakMap]"]=!1;var Sr=function(e){return yr(e)&&_r(e.length)&&!!Ir[ut(e)]};var Dr=function(e){return function(t){return e(t)}},Nr=Ze((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r&&Xe.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=a})),Lr=Nr&&Nr.isTypedArray,kr=Lr?Dr(Lr):Sr,zr=Object.prototype.hasOwnProperty;var Rr=function(e,t){var r=dr(e),n=!r&&Or(e),i=!r&&!n&&Pr(e),a=!r&&!n&&!i&&kr(e),o=r||n||i||a,l=o?gr(e.length,String):[],s=l.length;for(var c in e)!t&&!zr.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Mr(c,s))||l.push(c);return l},Ar=Object.prototype;var Fr=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ar)};var Hr=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Br=Object.prototype.hasOwnProperty;var Ur=function(e){if(!Fr(e))return Hr(e);var t=[];for(var r in Object(e))Br.call(e,r)&&"constructor"!=r&&t.push(r);return t};var $r=function(e){return null!=e&&_r(e.length)&&!mt(e)};var Vr=function(e){return $r(e)?Rr(e):Ur(e)};var Wr=function(e){return hr(e,Vr,vr)},qr=Object.prototype.hasOwnProperty;var Gr=function(e,t,r,n,i,a){var o=1&r,l=Wr(e),s=l.length;if(s!=Wr(t).length&&!o)return!1;for(var c=s;c--;){var u=l[c];if(!(o?u in t:qr.call(t,u)))return!1}var d=a.get(e),h=a.get(t);if(d&&h)return d==t&&h==e;var m=!0;a.set(e,t),a.set(t,e);for(var p=o;++c<s;){var f=e[u=l[c]],b=t[u];if(n)var v=o?n(b,f,u,t,e,a):n(f,b,u,e,t,a);if(!(void 0===v?f===b||i(f,b,r,n,a):v)){m=!1;break}p||(p="constructor"==u)}if(m&&!p){var g=e.constructor,y=t.constructor;g==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof y&&y instanceof y||(m=!1)}return a.delete(e),a.delete(t),m},Yr=Tt(et,"DataView"),Jr=Tt(et,"Promise"),Kr=Tt(et,"Set"),Zr=Tt(et,"WeakMap"),Xr=gt(Yr),Qr=gt(Mt),en=gt(Jr),tn=gt(Kr),rn=gt(Zr),nn=ut;(Yr&&"[object DataView]"!=nn(new Yr(new ArrayBuffer(1)))||Mt&&"[object Map]"!=nn(new Mt)||Jr&&"[object Promise]"!=nn(Jr.resolve())||Kr&&"[object Set]"!=nn(new Kr)||Zr&&"[object WeakMap]"!=nn(new Zr))&&(nn=function(e){var t=ut(e),r="[object Object]"==t?e.constructor:void 0,n=r?gt(r):"";if(n)switch(n){case Xr:return"[object DataView]";case Qr:return"[object Map]";case en:return"[object Promise]";case tn:return"[object Set]";case rn:return"[object WeakMap]"}return t});var an=nn,on="[object Object]",ln=Object.prototype.hasOwnProperty;var sn=function(e,t,r,n,i,a){var o=dr(e),l=dr(t),s=o?"[object Array]":an(e),c=l?"[object Array]":an(t),u=(s="[object Arguments]"==s?on:s)==on,d=(c="[object Arguments]"==c?on:c)==on,h=s==c;if(h&&Pr(e)){if(!Pr(t))return!1;o=!0,u=!1}if(h&&!u)return a||(a=new Kt),o||kr(e)?nr(e,t,r,n,i,a):cr(e,t,s,r,n,i,a);if(!(1&r)){var m=u&&ln.call(e,"__wrapped__"),p=d&&ln.call(t,"__wrapped__");if(m||p){var f=m?e.value():e,b=p?t.value():t;return a||(a=new Kt),i(f,b,r,n,a)}}return!!h&&(a||(a=new Kt),Gr(e,t,r,n,i,a))};var cn=function e(t,r,n,i,a){return t===r||(null==t||null==r||!yr(t)&&!yr(r)?t!=t&&r!=r:sn(t,r,n,i,e,a))};var un=function(e,t){return cn(e,t)};class dn{constructor(){Object.defineProperty(this,"api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]})}initWith(e){this.api=e,this.afterInit&&this.afterInit()}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}var hn=function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=e[n+t];return a};var mn=function(e,t,r){if(!dt(r))return!1;var n=typeof t;return!!("number"==n?$r(r)&&Mr(t,r.length):"string"==n&&t in r)&&Re(r[t],e)},pn=/\s/;var fn=function(e){for(var t=e.length;t--&&pn.test(e.charAt(t)););return t},bn=/^\s+/;var vn=function(e){return e?e.slice(0,fn(e)+1).replace(bn,""):e};var gn=function(e){return"symbol"==typeof e||yr(e)&&"[object Symbol]"==ut(e)},yn=/^[-+]0x[0-9a-f]+$/i,wn=/^0b[01]+$/i,En=/^0o[0-7]+$/i,xn=parseInt;var jn=function(e){if("number"==typeof e)return e;if(gn(e))return NaN;if(dt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=dt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=vn(e);var r=wn.test(e);return r||En.test(e)?xn(e.slice(2),r?2:8):yn.test(e)?NaN:+e};var On=function(e){return e?Infinity===(e=jn(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var Cn=function(e){var t=On(e),r=t%1;return t==t?r?t-r:t:0},Pn=Math.ceil,Tn=Math.max;var Mn=function(e,t,r){t=(r?mn(e,t,r):void 0===t)?1:Tn(Cn(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var i=0,a=0,o=Array(Pn(n/t));i<n;)o[a++]=hn(e,i,i+=t);return o};const _n=([e,t],[r,n],[i,a])=>{const o=(n-t)*(i-r)-(r-e)*(a-n);return 0===o?0:o>0?1:2},In=([e,t],[r,n],[i,a])=>r<=Math.max(e,i)&&r>=Math.min(e,i)&&n<=Math.max(t,a)&&n>=Math.min(t,a),Sn=(e,t,r)=>!(e<r.x||t<r.y||e>r.x+r.width||t>r.y+r.height),Dn=(e,t,r)=>{const n=r.y1*r.x3-r.x1*r.y3+(r.y3-r.y1)*e+(r.x1-r.x3)*t,i=r.x1*r.y2-r.y1*r.x2+(r.y1-r.y2)*e+(r.x2-r.x1)*t;if(n<0!=i<0)return!1;const a=-r.y2*r.x3+r.y1*(r.x3-r.x2)+r.x1*(r.y2-r.y3)+r.x2*r.y3;return a<0?n<=0&&n+i>=a:n>=0&&n+i<=a},Nn=(e,t)=>{if(Sn(t.x1,t.y1,e))return!0;if(Sn(t.x2,t.y2,e))return!0;if(Sn(t.x3,t.y3,e))return!0;if(Dn(e.x,e.y,t))return!0;if(Dn(e.x+e.width,e.y,t))return!0;if(Dn(e.x+e.width,e.y+e.height,t))return!0;if(Dn(e.x,e.y+e.height,t))return!0;const r=[[[e.x,e.y],[e.x+e.width,e.y]],[[e.x+e.width,e.y],[e.x+e.width,e.y+e.height]],[[e.x,e.y+e.height],[e.x+e.width,e.y+e.height]],[[e.x,e.y],[e.x,e.y+e.height]]];return!![[[t.x1,t.y1],[t.x2,t.y2]],[[t.x1,t.y1],[t.x3,t.y3]]].some((e=>r.some((t=>(([e,t],[r,n])=>{const i=_n(e,t,r),a=_n(e,t,n),o=_n(r,n,e),l=_n(r,n,t);return i!==a&&o!==l||!(0!==i||!In(e,r,t))||!(0!==a||!In(e,n,t))||!(0!==o||!In(r,e,n))||!(0!==l||!In(r,t,n))})(t,e)))))},Ln=(e,t)=>{const r=e.map((({x:e,y:t})=>[e,t]));return Mn(z(r.flat()),3).some((r=>Nn(t,{x1:e[r[0]].x,y1:e[r[0]].y,x2:e[r[1]].x,y2:e[r[1]].y,x3:e[r[2]].x,y3:e[r[2]].y})))},kn=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class zn{constructor(e){if(Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thumbnailUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"faces",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"instant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),v(this,{id:b,startTime:b,endTime:b,acknowledged:b,isLive:b,raw:g.ref}),this.raw=e,this.type=e.eventType,this.cameraId=e.sensorId,("Analytic"===this.type||"FaceDetection"===this.type)&&e.data)try{const t=JSON.parse(e.data);t.FoundObjects&&(this.type="Analytic",this.detectedObjects=t.FoundObjects),t.Faces&&(this.type="FaceDetection",this.faces=t.Faces),this.thumbnailUrl=t.ThumbnailUrl}catch{console.warn("invalid data",e.data),this.type="Motion"}this.instant=kn.has(this.type),this.detectedObjects||(this.detectedObjects=[])}get id(){return this.raw.id}get startTime(){return new Date(this.raw.startTime)}get endTime(){return new Date(this.raw.endTime)}get isLive(){return!kn.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class Rn extends dn{constructor(e){super(),Object.defineProperty(this,"eventsStore",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pendingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"liveUpdateMode",{enumerable:!0,configurable:!0,writable:!0,value:"auto"}),Object.defineProperty(this,"updateTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pageInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"loading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"loadMoreTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"retryTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"sortDirection",{enumerable:!0,configurable:!0,writable:!0,value:"DESC"}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"to",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameras",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"polygons",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"eventTypes",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"loadingInited",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"flushUpdates",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.data=[...this.pendingData,...this.data],this.pendingData=[]}}),Object.defineProperty(this,"load",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.loadingInited||(this.loadingInited=!0,this.initDataLoading(),this.initLiveUpdates())}}),Object.defineProperty(this,"reload",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error&&(this.retryTrigger=+!this.retryTrigger)}}),Object.defineProperty(this,"loadMore",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error=null,this.loadMoreTrigger=+!this.loadMoreTrigger}}),Object.defineProperty(this,"requestData",{enumerable:!0,configurable:!0,writable:!0,value:({sortDirection:e,from:t,to:r,filter:n,pageInfo:i,cameras:a,polygons:o})=>this.api.cameras.GetSensorEventsPage({sensorIds:a,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==i?void 0:i.nextPageToken},n,o).pipe(j((e=>e.success?d({events:e.resultItems,pageInfo:e.pageInfo}):h(e.error))),O((e=>(console.error(e),this.error=e,d({events:[],pageInfo:null})))))}),v(this,{data:g.ref,cameras:g.struct,detectedObjects:g.struct,from:g,to:g,sortDirection:g,probabilityThreshold:g,pendingData:g.ref,liveUpdateMode:g,updateTrigger:g,colors:g.ref,flushUpdates:y,pageInfo:g.ref,isLive:b,loading:g,loadMoreTrigger:g,retryTrigger:g,error:g.ref,loadMore:y,filterJson:b})}get isLive(){return"DESC"==this.sortDirection&&!this.to}get totalCount(){return this.data.length}get filterJson(){if(1===this.eventTypes.length&&this.eventTypes[0]===Le.FaceDetection)return null;const{probabilityThreshold:e}=this;if(null===e)return null;const t={And:[]};return this.detectedObjects.length&&t.And.push({Or:this.detectedObjects.map((e=>({Type:e})))}),this.colors.size&&t.And.push({Or:[...this.colors].map((e=>({ObjectColors:[e]})))}),t.And.push({Or:[{Probability:e}]}),JSON.stringify(t)}initDataLoading(){const e=ke((()=>({from:this.from?+this.from:void 0,to:this.to?+this.to:void 0,sortDirection:this.sortDirection,filter:this.filterJson,cameraFilters:this.cameras,polygons:this.polygons})),!0);this.disposables.push(e.pipe(C((e=>ke((()=>this.retryTrigger),!0).pipe(P(e)))),C((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i,polygons:a})=>(w((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[]})),this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:i,pageInfo:this.pageInfo,polygons:a}))))).subscribe((({events:e,pageInfo:t})=>{w((()=>{var r,n,i;if(!t)return;const a=e.map(An);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:6===this.eventTypes[0]?["FaceDetection"]:[],from:null!==(n=null===(r=a[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:R(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(i=this.probabilityThreshold)&&void 0!==i?i:void 0}),a):this.data=a,this.eventsStore.add(a),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(C((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i})=>ke((()=>this.loadMoreTrigger)).pipe(T((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:i,pageInfo:this.pageInfo,polygons:this.polygons}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(An);this.eventsStore.add(r),w((()=>{this.data=this.data.concat(r),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(ke((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(C((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?ke((()=>this.eventsStore.recentAdditions)):m))).subscribe((e=>{if(this.loading)return;if(!this.pageInfo&&this.error)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&w((()=>{this.data=[...t,...this.data]}))}))),this.disposables.push(ke((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(C((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?ke((()=>this.eventsStore.recentAdditions)):(this.pendingData&&w((()=>this.pendingData=[])),m)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&w((()=>{this.pendingData=[...t,...this.pendingData]}))})))}filter(e){let t=e;const{from:r,to:n}=this;return r&&(t=t.filter((e=>e.startTime>=r))),n&&(t=t.filter((e=>e.startTime<=n))),this.cameras.length&&(t=t.filter((e=>this.cameras.includes(e.cameraId)))),this.eventTypes.length&&6===this.eventTypes[0]&&(t=t.filter((e=>"FaceDetection"===e.type))),this.detectedObjects.length&&(t=t.filter((e=>e.detectedObjects.some((e=>{const{probabilityThreshold:t}=this;return!(null!==t&&e.Probability<t)&&(this.colors.size?this.detectedObjects.includes(e.Type)&&e.Colors.some((e=>this.colors.has(e.Color))):this.detectedObjects.includes(e.Type))}))))),t}uniquelyConcat(e,t){if(!e.length)return t.concat();if(!t.length)return e.concat();const r=e=>[e.id,e];return Array.from(new Map([...e.map(r),...t.map(r)]).values())}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}function An(e){return new zn(e)}const Fn={Top:0,Left:0,Bottom:1,Right:1};class Hn extends dn{constructor(e,n,i,a){super(),Object.defineProperty(this,"eventSchema",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"notification",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"heatmaps",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"analyticsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposeReactionToCamera",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"regions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"filters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"peopleCountingDataLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"heatmapHidden",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"heatmapLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"heatmap",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"peopleCountingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"brushFilter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"eventsLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"setDate",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.date=e,this.brushFilter=null}}),Object.defineProperty(this,"setFilters",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.filters=e}}),Object.defineProperty(this,"getProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.probabilityThreshold}),Object.defineProperty(this,"setProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.probabilityThreshold=e}}),Object.defineProperty(this,"setBrushFilter",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.brushFilter=e}}),Object.defineProperty(this,"setParams",{enumerable:!0,configurable:!0,writable:!0,value:({cameraId:e,box:t})=>{this.cameraId=e,this.regions=[[{x:t.Left,y:t.Top},{x:t.Right,y:t.Top},{x:t.Right,y:t.Bottom},{x:t.Left,y:t.Bottom}]],this.date||(this.date=new Date)}}),Object.defineProperty(this,"openForPlayer",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e}}),Object.defineProperty(this,"searchFullFrame",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e,this.clear(),this.peopleCountingData=[],this.date||(this.date=new Date)}}),Object.defineProperty(this,"setRegions",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.regions=e.length?e:null}}),Object.defineProperty(this,"toggleHeatmap",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.heatmapHidden=!this.heatmapHidden}}),Object.defineProperty(this,"toggleColor",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Set(this.colors);this.colors.has(e)?t.delete(e):t.add(e),this.colors=t}}),Object.defineProperty(this,"clearColors",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.colors=new Set}}),Object.defineProperty(this,"clear",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.date=null,this.regions=null,this.brushFilter=null,this.heatmap=null,this.data=[],this.peopleCountingData=[]}}),Object.defineProperty(this,"initDataFetching",{enumerable:!0,configurable:!0,writable:!0,value:()=>{const e=ke((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId}))).pipe(M(un),_());this.disposables.push(ke((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId,filters:this.filters,brushFilter:this.brushFilter,colors:this.colors,probabilityThreshold:this.probabilityThreshold}))).pipe(M(un),_()).subscribe((e=>{w((()=>{if(!e.date||!e.cameraId)return;this.eventsLoader.sortDirection="DESC";const n=t(e.date),i=r(e.date);this.eventsLoader.from=n,this.eventsLoader.to=i;const{brushFilter:a}=e;a&&([this.eventsLoader.from,this.eventsLoader.to]=a),this.eventsLoader.polygons=e.regions?e.regions.map(this.regionToWktPolygon):[],this.eventsLoader.cameras=[e.cameraId],this.eventsLoader.detectedObjects=e.filters.map((e=>e.id)),this.eventsLoader.eventTypes=[Le.Analytic],this.eventsLoader.colors=e.colors,this.eventsLoader.probabilityThreshold=e.probabilityThreshold,this.eventsLoader.load()}))})));const n=this.heatmaps;n&&(this.disposables.push(e.pipe(C((e=>{if(!e.date||!e.cameraId)return m;w((()=>{this.peopleCountingDataLoading=!0}));const n=t(e.date),i=r(e.date),a=e.regions?this.boxRegions(e.regions):Fn;return this.api.cameras.GetPeopleCountingData(e.cameraId,n,i,a).pipe(j((e=>e.success?d(e.resultItems):h(e.error)))).pipe(O((e=>(this.notification.error(Se.t("eventSearchRequestError.peopleCounting")),console.error(e),d([])))))}))).subscribe((e=>{w((()=>{this.peopleCountingData=e,this.peopleCountingDataLoading=!1}))}))),this.disposables.push(ke((()=>({date:this.date,cameraId:this.cameraId}))).pipe(M(un),C((e=>{if(!e.date||!e.cameraId)return m;w((()=>{this.heatmapLoading=!0}));const i=t(e.date),a=r(e.date);return n.fetchHeatmaps(e.cameraId,i,a,1).pipe(I((e=>e[0]||null))).pipe(O((e=>(this.notification.error(Se.t("eventSearchRequestError.heatmap")),console.error(e),d(null)))))}))).subscribe((e=>{w((()=>{this.heatmap=e,this.heatmapLoading=!1}))}))))}}),v(this,{cameraId:g,date:g,regions:g.ref,filters:g.ref,colors:g.ref,peopleCountingDataLoading:g,heatmapHidden:g,heatmapLoading:g,data:g.ref,heatmap:g.ref,peopleCountingData:g.ref,probabilityThreshold:g,brushFilter:g.ref,params:b,filteredData:b,filteredPeopleCountingData:b,setDate:y,setFilters:y,setBrushFilter:y,setParams:y,openForPlayer:y,searchFullFrame:y,setRegions:y,toggleHeatmap:y,toggleColor:y,clearColors:y,clear:y}),this.analyticsEnabled=Boolean(a),this.eventsLoader=new Rn(n),this.eventsLoader.liveUpdateMode="disabled",this.initDataFetching()}get params(){return this.eventSchema.schemaDescription.filter((e=>"filter"===e.parameterType))}get filteredData(){let e=[];const t=this.filters.map((e=>e.id));t.length?(e=this.data.filter((e=>e.detectedObjects.some((e=>t.includes(e.Type)&&e.Probability>=this.probabilityThreshold)))),this.colors.size&&(e=e.filter((e=>e.detectedObjects.some((e=>e.Colors.some((e=>this.colors.has(e.Color))))))))):e=this.data.filter((e=>e.detectedObjects.some((e=>e.Probability>=this.probabilityThreshold))));const{brushFilter:r}=this;r&&(e=e.filter((e=>e.startTime>=r[0]&&e.startTime<=r[1]&&e.detectedObjects.some((e=>"Person"===e.Type)))));const{regions:n}=this;return n&&n.length&&(e=e.filter((e=>e.detectedObjects.some((e=>(!t.length||t.includes(e.Type))&&(!this.colors.size||e.Colors.some((e=>this.colors.has(e.Color))))&&e.Probability>=this.probabilityThreshold&&n.some((t=>Ln(t,{x:e.Box.Left,y:e.Box.Top,width:e.Box.Right-e.Box.Left,height:e.Box.Bottom-e.Box.Top})))))))),e}get filteredPeopleCountingData(){const{regions:e}=this;return(null==e?void 0:e.length)?this.peopleCountingData.filter((t=>e.some((e=>Ln(e,{x:t.Left,y:t.Top,width:t.Right-t.Left,height:t.Bottom-t.Top}))))):this.peopleCountingData}regionToWktPolygon(e){return e.length?"POLYGON (("+e.concat(e[0]).map((({x:e,y:t})=>`${e} ${t}`)).join(", ")+"))":"POLYGON (())"}boxRegions(e){const t=e.flatMap((e=>e.map((({x:e})=>e)))),r=e.flatMap((e=>e.map((({y:e})=>e))));return{Left:Math.min(...t),Right:Math.max(...t),Top:Math.min(...r),Bottom:Math.max(...r)}}afterInit(){this.eventsLoader.initWith(this.api)}dispose(){this.disposeReactionToCamera&&this.disposeReactionToCamera(),this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}const Bn=B.createContext(null);function Un(e){return t=>{const{size:r=24,color:n="currentColor",className:i,...a}=t,o=e.viewBox||"0 0 24 24",l=e.svg;return B.createElement("svg",{preserveAspectRatio:"xMinYMin",className:`icon ${i}`,width:r,fill:n,viewBox:o,height:r,...a},l)}}const $n=Un({viewBox:"0 0 24 24",svg:B.createElement("g",null,B.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),B.createElement("path",{d:"M10.13 3.245a1.994 1.994 0 0 0-1.542.992l-5.491 9.53c-.55.954-.23 2.178.723 2.728l8.66 5c.953.55 2.174.216 2.724-.737l5.509-9.521c.335-.58.349-1.265.087-1.832L17.65 2.54z"}))});$n.displayName="LabelIcon";const Vn=Un({viewBox:"0 0 24 24",svg:B.createElement("g",null,B.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),B.createElement("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"}))});Vn.displayName="CameraIcon";const Wn=Un({viewBox:"0 0 24 24",svg:B.createElement("path",{d:"M17,6h-2V3c0-0.55-0.45-1-1-1h-4C9.45,2,9,2.45,9,3v3H7C5.9,6,5,6.9,5,8v11c0,1.1,0.9,2,2,2c0,0.55,0.45,1,1,1 c0.55,0,1-0.45,1-1h6c0,0.55,0.45,1,1,1c0.55,0,1-0.45,1-1c1.1,0,2-0.9,2-2V8C19,6.9,18.1,6,17,6z M9.5,18H8V9h1.5V18z M12.75,18 h-1.5V9h1.5V18z M13.5,6h-3V3.5h3V6z M16,18h-1.5V9H16V18z"})});Wn.displayName="LuggageIcon";const qn=Un({viewBox:"0 0 24 24",svg:B.createElement(B.Fragment,null,B.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),B.createElement("path",{d:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z"}))});qn.displayName="CarIcon";const Gn=Un({viewBox:"0 0 24 24",svg:B.createElement(B.Fragment,null,B.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),B.createElement("path",{d:"M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.65 2.62.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"}))});Gn.displayName="BoatIcon";const Yn=Un({viewBox:"0 0 24 24",svg:B.createElement(B.Fragment,null,B.createElement("path",{d:"M11.74 13.36L14.14 7.71L13.06 5.5H10.5V4H14L14.73 5.5H21.75L20.75 9H16.44L17.11 10.37C17.69 10.13 18.33 10 19 10C21.76 10 24 12.24 24 15C24 17.76 21.76 20 19 20C16.24 20 14 17.76 14 15C14 13.45 14.71 12.06 15.82 11.15L15 9.5L12.25 16H9.9C9.44 18.28 7.42 20 5 20C2.24 20 0 17.76 0 15C0 12.24 2.24 10 5 10C7.59 10 9.72 11.97 10 14.5H10.58L8.3 9H7.5C7.09 9 6.75 8.66 6.75 8.25C6.75 7.84 7.09 7.5 7.5 7.5H10.25C10.66 7.5 11 7.84 11 8.25C11 8.66 10.66 9 10.25 9H9.97L11.74 13.36M5 11.5C3.07 11.5 1.5 13.07 1.5 15C1.5 16.93 3.07 18.5 5 18.5C6.59 18.5 7.93 17.45 8.36 16H4V14.5H8.47C8.22 12.8 6.76 11.5 5 11.5M19 11.5C18.57 11.5 18.15 11.58 17.77 11.72L19.7 15.68L18.35 16.34L16.5 12.55C15.88 13.18 15.5 14.05 15.5 15C15.5 16.93 17.07 18.5 19 18.5C20.93 18.5 22.5 16.93 22.5 15C22.5 13.07 20.93 11.5 19 11.5Z"}))});Yn.displayName="BicycleIcon";const Jn=Un({viewBox:"0 0 24 24",svg:B.createElement("g",null,B.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),B.createElement("path",{d:"M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7"}))});Jn.displayName="DirectionsWalkIcon";const Kn=Un({viewBox:"0 0 24 24",svg:B.createElement(B.Fragment,null,B.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),B.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),B.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),B.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),B.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),B.createElement("path",{d:"M17.34 14.86c-.87-1.02-1.6-1.89-2.48-2.91-.46-.54-1.05-1.08-1.75-1.32-.11-.04-.22-.07-.33-.09-.25-.04-.52-.04-.78-.04s-.53 0-.79.05c-.11.02-.22.05-.33.09-.7.24-1.28.78-1.75 1.32-.87 1.02-1.6 1.89-2.48 2.91-1.31 1.31-2.92 2.76-2.62 4.79.29 1.02 1.02 2.03 2.33 2.32.73.15 3.06-.44 5.54-.44h.18c2.48 0 4.81.58 5.54.44 1.31-.29 2.04-1.31 2.33-2.32.31-2.04-1.3-3.49-2.61-4.8z"}))});Kn.displayName="PetsIcon";const Zn=({data:e})=>{const t=16;return e.isEventType?"Luggage"===e.id?B.createElement(Wn,{size:t}):"Car"===e.id?B.createElement(qn,{size:t}):"Person"===e.id?B.createElement(Jn,{size:t}):"Bicycle"===e.id?B.createElement(Yn,{size:t}):"Boat"===e.id?B.createElement(Gn,{size:t}):"Animal"===e.id?B.createElement(Kn,{size:t}):B.createElement($n,{size:t}):B.createElement(Vn,{size:t})},Xn=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:i}=te,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center"}};return B.createElement(i,{innerProps:o,...n},B.createElement(Zn,{data:a}),B.createElement("div",{style:{marginLeft:4}},t))},Qn={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},ei=({label:e,children:t})=>B.createElement(ae,{label:e,style:Qn},t);ei.displayName="Tooltip";class ti extends B.Component{render(){const{forwardedRef:e,children:t,className:r,fullwidth:n,type:i,title:a,...o}=this.props,l=re(r,"x-3deye-button",{fullwidth:n}),s=B.createElement("button",{ref:e,className:l,type:i||"button",...o},t,o.disabled?null:B.createElement(ie,null));return a?B.createElement(ei,{label:a},s):s}}const ri=B.forwardRef(((e,t)=>B.createElement(ti,{forwardedRef:t,...e}))),ni=Un({viewBox:"0 0 24 24",svg:B.createElement("g",null,B.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),B.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});ni.displayName="CloseIcon";const ii=Un({viewBox:"0 0 24 24",svg:B.createElement(B.Fragment,null,B.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),B.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});ii.displayName="DoneIcon";const ai=[{color:ne.red[500],name:"red",highlightColor:ne.red[100]},{color:ne.green[500],name:"green",highlightColor:ne.green[100]},{color:ne.blue[500],name:"blue",highlightColor:ne.blue[100]},{color:ne.yellow[500],name:"yellow",highlightColor:ne.yellow[900]},{color:ne.black,name:"black",highlightColor:ne.white},{color:ne.white,name:"white",highlightColor:ne.black},{color:ne.grey[500],name:"dimgrey",highlightColor:ne.grey[100]}],oi=Z((({value:e,clear:t,toggle:r})=>B.createElement("div",{className:"color-selector"},B.createElement("div",null,"COLOR"),B.createElement("div",{className:"color-selector__items"},ai.map((({color:t,highlightColor:n,name:i})=>B.createElement("button",{key:i,className:re("color-selector__item",{selected:e.has(i)}),style:{backgroundColor:t,color:n},onClick:r.bind(null,i)},B.createElement(ii,{size:20})))),B.createElement(ri,{disabled:!e.size,onClick:t},B.createElement(ni,{size:20}))))));oi.displayName="ColorSelector";const li=({value:e,onChange:t})=>{const r=U(null),n=U(),[i,a]=$(0);return V((()=>{if(!r.current)return;const e=new oe(r.current);return n.current=e,e.listen("MDCSlider:change",(()=>{null==t||t(e.value)})),()=>{n.current=void 0,e.destroy()}}),[]),V((()=>{const e=new le((e=>{var t;for(const r of e){const e=r.contentRect.width;e!==i&&(null===(t=n.current)||void 0===t||t.layout()),a(e)}}));return e.observe(r.current),()=>e.disconnect()}),[]),V((()=>{n.current&&(n.current.value=e)}),[e]),B.createElement("div",{ref:r,className:"mdc-slider mdc-slider--discrete mdc-slider--display-markers",tabIndex:0,role:"slider","data-step":5,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e,"aria-label":"Select Value"},B.createElement("div",{className:"mdc-slider__track-container"},B.createElement("div",{className:"mdc-slider__track"}),B.createElement("div",{className:"mdc-slider__track-marker-container"})),B.createElement("div",{className:"mdc-slider__thumb-container"},B.createElement("div",{className:"mdc-slider__pin"},B.createElement("span",{className:"mdc-slider__pin-value-marker"})),B.createElement("svg",{className:"mdc-slider__thumb",width:"21",height:"21"},B.createElement("circle",{cx:"10.5",cy:"10.5",r:"7.875"})),B.createElement("div",{className:"mdc-slider__focus-ring"})))};li.displayName="Slider";const si=Z((({getter:e,setter:t})=>{const[r,n]=$(0),i=U(null),a=Math.floor(100*e());return V((()=>E(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),B.createElement("div",{ref:i,style:{paddingLeft:8,paddingRight:8,marginTop:5}},B.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},B.createElement("div",null,"CONFIDENCE"),B.createElement("div",{style:{fontSize:"1.1em"}},a,"%")),B.createElement(li,{value:r,onChange:e=>{t(e/100)}}))}));si.displayName="ProbabilitySlider";var ci,ui=(ci=8,{container:e=>({...e,padding:ci}),control:(e,t)=>({...e,borderRadius:8,backgroundColor:t.isFocused?"white":"rgba(0, 0, 0, 0.5)",border:"none",boxShadow:null,"&:hover":{borderColor:null}}),menu:e=>({...e,borderRadius:"0 0 4px 4px",marginTop:0,marginLeft:-ci,marginRight:ci}),option:e=>({...e,color:"black"}),multiValueRemove:e=>({...e,color:"black"})});class di{constructor(e){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chunks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clipUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isDownloading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"archives",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),v(this,{name:g,clipUrl:g,isDownloading:g}),this.update(e)}get isTimelapse(){return this.type.startsWith("Timelaps")}update(e){this.raw=e,this.id=e.id,this.startTime=new Date(e.startTime),this.endTime=new Date(e.endTime),this.type=e.recordType,this.duration=e.duration,this.cameraId=e.cameraId,this.name=e.name||e.tagName,this.description=e.description,this.clipUrl=e.clipUrl,this.version=e.version}}function hi(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}const mi=Un({viewBox:"0 0 24 24",svg:B.createElement("g",null,B.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),B.createElement("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}))});mi.displayName="MoreVertIcon";const pi=({Type:e,Box:{Top:t,Left:r,Right:n,Bottom:i},Probability:a,height:o})=>{const{eventSchema:l}=W(Bn);let s="top";s=o&&t*o>12||t>.1?"top":1-i-t>.5?"bottom":"top inset";const c={top:"top"===s?-12:"top inset"===s?0:"auto",bottom:"bottom"===s?-12:"auto",left:"top"===s?-2:0};return B.createElement("div",{style:{position:"absolute",top:100*t+"%",left:100*r+"%",bottom:100*(1-i)+"%",right:100*(1-n)+"%",outline:`2px solid ${l.colorsByFoundObjectType.get(e)}`}},B.createElement("div",{style:{color:l.colorsByFoundObjectType.get(e),backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",padding:"0 2px",...c},title:`${e.toLowerCase()} ${Math.floor(100*a)}%`},e.toLowerCase()," ",Math.floor(100*a),"%"))};pi.displayName="FoundObjectBox";const fi=/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),bi=p(document,"keydown").pipe(I((function({target:e,code:t,shiftKey:r,metaKey:n,ctrlKey:i,altKey:a}){var o;if(/^(input|select|textarea)$/i.test(e.tagName))return;const l=[];if("Space"===t&&"button"===(null===(o=document.activeElement)||void 0===o?void 0:o.tagName.toLowerCase()))return;t.startsWith("Key")&&(t=t.substr(3).toLowerCase());fi&&n&&l.push("CtrlCmd");!fi&&i&&l.push("CtrlCmd");a&&l.push("Alt");r&&l.push("Shift");return l.push(t),l.join("+")})),_());function vi(e,t,r=!0){V((()=>{if(!r)return;const n=t=>{t.key===e&&t.preventDefault()};"ArrowUp"!==e&&"ArrowDown"!==e||document.addEventListener("keydown",n);const i=e.split(" "),a=bi.pipe(S(1e3),D(null),C((()=>bi.pipe(N(i.length,1)))),j((e=>s(e).pipe(L(s(i)),k(Boolean))))).subscribe(t);return()=>{a.unsubscribe(),"ArrowUp"!==e&&"ArrowDown"!==e||document.removeEventListener("keydown",n)}}),[r])}const gi=document.body;class yi extends B.Component{constructor(e){super(e),Object.defineProperty(this,"el",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.el=document.createElement("div")}componentDidMount(){gi.appendChild(this.el)}componentWillUnmount(){gi.removeChild(this.el)}render(){return se.createPortal(this.props.children,this.el)}}class wi{constructor(){Object.defineProperty(this,"opened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"top",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"left",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bottom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"right",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"buttonRef",{enumerable:!0,configurable:!0,writable:!0,value:B.createRef()}),Object.defineProperty(this,"requestedPlacement",{enumerable:!0,configurable:!0,writable:!0,value:"bottom-end"}),Object.defineProperty(this,"placement",{enumerable:!0,configurable:!0,writable:!0,value:"bottom-end"}),Object.defineProperty(this,"targetPosition",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,left:0,width:0,height:0}}),Object.defineProperty(this,"toggleMenu",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.opened=!this.opened}}),Object.defineProperty(this,"toggleAt",{enumerable:!0,configurable:!0,writable:!0,value:({top:e,left:t})=>{this.setTargetPosition({top:e,left:t,width:0,height:0}),this.placement="bottom-start",this.opened=!this.opened}}),Object.defineProperty(this,"setRequestedPlacement",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.requestedPlacement=e}}),Object.defineProperty(this,"resetPlacement",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.placement=this.requestedPlacement}}),x(this)}setTargetPosition({top:e,left:t,width:r,height:n}){this.targetPosition={top:e,left:t,width:r,height:n}}}const Ei=q(null),xi=()=>{const e=W(Ei);if(!e)throw new Error("MenuContext is not defined");return e},ji=Z((({children:e,placement:t="bottom-end"},r)=>{const[n]=$((()=>new wi));return G(r,(()=>n)),V((()=>{n.requestedPlacement=t}),[t]),B.createElement(Ei.Provider,{value:n},e)}),{forwardRef:!0});ji.displayName="Menu";const Oi=Z((({children:e,className:t,...r})=>{const n=xi(),i=U(null);return V((()=>{if(!n.opened)return;const e=e=>{const t=e.target;i.current&&(i.current.contains(t)||n.buttonRef.current.contains(t)||n.toggleMenu())};return document.addEventListener("mousedown",e,!0),()=>document.removeEventListener("mousedown",e)}),[n.opened]),vi("ArrowUp",(()=>{var e;const t=Array.from(i.current.querySelectorAll(".menu-item"));if(!t.length)return;const r=document.activeElement;if(!(null===(e=i.current)||void 0===e?void 0:e.contains(r)))return void t[0].focus();if(1===t.length)return;const n=t.findIndex((e=>e.contains(r)));t[(n+t.length-1)%t.length].focus()}),n.opened),vi("ArrowDown",(()=>{var e;const t=Array.from(i.current.querySelectorAll(".menu-item"));if(!t.length)return;const r=document.activeElement;if(!(null===(e=i.current)||void 0===e?void 0:e.contains(r)))return void t[0].focus();if(1===t.length)return;const n=t.findIndex((e=>e.contains(r)));t[(n+1)%t.length].focus()}),n.opened),vi("Escape",n.toggleMenu,n.opened),Y((()=>{if(n.opened){if(!i.current)return;const{offsetWidth:e,offsetHeight:t}=i.current,r=n.targetPosition.left,a=n.targetPosition.top,o=n.targetPosition.width,l=n.targetPosition.height,s=window.innerHeight,c=window.innerWidth;let u,d=r+o-e,h=a+l,m=n.placement;"bottom-start"===m?(d=r,h=a,d+e>c&&(d-=e,m="bottom-end"),h+t>s&&(h-=t,m=m.endsWith("start")?"top-start":"top-end")):"bottom-end"===m?(a+l+t>s&&(h=void 0,u=s-a+4,m="top-end"),r-e<0&&(d=r,m=m.startsWith("top")?"top-start":"bottom-start")):"top"===m&&(d=r+(o-e)/2,h=a-t,m="top"),i.current.dataset.placement=m,i.current.style.top=h?`${h}px`:void 0,i.current.style.bottom=u?`${u}px`:void 0,i.current.style.left=d?`${d}px`:void 0}}),[n.opened]),n.opened?B.createElement(yi,null,B.createElement("div",{ref:i,onClick:e=>{e.stopPropagation()},className:re("menu-items-container",t),...r},e)):null}));Oi.displayName="MenuList";const Ci=({children:e,style:t,className:r,noClose:n,action:i})=>{const a=xi();return B.createElement(ri,{onClick:e=>{e.stopPropagation(),null==i||i(),n||a.toggleMenu()},className:re("menu-item",r),style:t},e)};Ci.displayName="MenuItem";const Pi=({className:e,children:t,...r})=>{const n=xi(),i=J((e=>{if(e.stopPropagation(),!n.opened){const e=n.buttonRef.current;n.setTargetPosition(e.getBoundingClientRect()),n.resetPlacement()}n.toggleMenu()}),[]);return B.createElement(ri,{ref:n.buttonRef,className:re("menu-button",e),onClick:i,...r},t)};Pi.displayName="MenuButton";const Ti=Z((({data:e,width:t,hideCameraName:r,height:a,onClick:o})=>{var l,s,c,u;const d=U(null),h=U(null),[m,p]=$(null),f=W(Bn),{cameras:b,eventSchema:v,thumbnails:g}=f;V((()=>{if(e.thumbnailUrl)return void p(null);const t=g.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{p(e||null)}));return()=>t.unsubscribe()}),[e.id]);const y="clipSharing"in f&&!!(4&(null!==(s=null===(l=b.camerasById.get(e.cameraId))||void 0===l?void 0:l.permissions)&&void 0!==s?s:0));let w=null;e.detectedObjects.length&&(w=e.detectedObjects.filter((({Type:e})=>v.foundObjectTypes.includes(e))).map(((e,t)=>B.createElement(pi,{key:t,...e,height:a}))));let E="",x=!1;if(e.thumbnailUrl?E=e.thumbnailUrl:null===m&&b.loaded?(E=(null===(c=b.camerasById.get(e.cameraId))||void 0===c?void 0:c.imageUrl)||"",x=!0):m&&(E=m.url),e.faces){const{Width:t,Height:r}=JSON.parse(e.raw.data).ThumbnailSize;w||(w=[]);const n=100,i=w.length;w=w.concat(e.faces.map((({Name:e,Box:{Top:a,Left:o,Right:l,Bottom:s},Probability:c},u)=>{const d=n/t/(l-o),h={top:2},m={};return o>=1-l?(h.left=2,m.right=-2):(h.right=2,m.left=-2),a>=1-s?m.bottom="calc(100% + 1px)":m.top="calc(100% + 1px)",B.createElement(K,{key:i+u},B.createElement("div",{className:"event-list-item-face-trigger",style:{position:"absolute",top:100*a+"%",left:100*o+"%",bottom:100*(1-s)+"%",right:100*(1-l)+"%",outline:"1px solid orange"}},B.createElement("div",{style:{color:"orange",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",...m},title:`${e} ${Math.floor(100*c)}%`},e," ",Math.floor(100*c),"%")),B.createElement("div",{className:"event-list-item-face",style:{overflow:"hidden",width:t*(l-o)*d,height:r*(s-a)*d,...h}},B.createElement("img",{style:{width:t*d,height:r*d,transform:`translate(-${100*o}%, -${100*a}%)`},src:E}),B.createElement("div",{className:"frame"},B.createElement("div",{className:"corner-highlight-tl"}),B.createElement("div",{className:"corner-highlight-tr"}),B.createElement("div",{className:"corner-highlight-br"}),B.createElement("div",{className:"corner-highlight-bl"}))))})))}const j=b.loaded&&(null===(u=b.camerasById.get(e.cameraId))||void 0===u?void 0:u.name)||"...";return B.createElement("div",{onDragStart:t=>{if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",""+e.id),t.dataTransfer.dropEffect="move";const r=h.current;if(r){const{x:e,y:n}=r.getBoundingClientRect();t.dataTransfer.setDragImage(r,t.clientX-e,t.clientY-n)}},className:"event-list-item",onClick:()=>o(e),onContextMenu:e=>{var t;e.preventDefault(),null===(t=d.current)||void 0===t||t.toggleAt({top:e.clientY,left:e.clientX})},draggable:!0},E&&B.createElement("img",{key:E,ref:h,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:E}),B.createElement(ie,{radius:t}),x?B.createElement("div",{className:"no-preview-overlay"}):null,e.acknowledged?B.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,w,B.createElement(ji,{ref:d},B.createElement(Pi,{className:"x-3deye-button--icon"},B.createElement(mi,null)),B.createElement(Oi,null,y&&B.createElement(Ci,{action:()=>{var t;const{cameraId:r}=e;let{startTime:n,endTime:i}=e;+i-+n<5e3&&(n=new Date(+n-5e3),i=new Date(+i+5e3));const a="clipSharing"in f?f.clipSharing:void 0;null==a||a.openModalWithSelectedClip(new di({cameraId:r,startTime:n,endTime:i,name:null===(t=b.camerasById.get(r))||void 0===t?void 0:t.name}))}},"Share"),B.createElement(Ci,{action:()=>{hi(e.id.toString())}},"Copy ID to clipboard"),B.createElement(Ci,{action:()=>{hi(e.cameraId.toString())}},"Copy camera ID to clipboard"))),B.createElement("div",{className:"event-list-item-caption"},B.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",a="";return n(e,new Date)?i(e,new Date)?r=a="HH:mm":i(e,t)?(r="EEE d MMM HH:mm",a="HH:mm"):r=a="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",a="d MMM HH:mm"):r=a="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",a+=":ss"),+e==+t?`${De(e,r)}`:`${De(e,r)} - ${De(t,a)}`}(e.startTime,e.endTime)),r?null:B.createElement("div",{className:"event-list-item__camera-name",title:j},j),+e.endTime-+e.startTime>0&&B.createElement("div",{className:"event-list-item__duration"},function(e,t=!0){if((e=Math.round(e/1e3))<60)return`${e}s`;const r=e%60,n=t?`${r}`:`${r}`.padStart(2,"0");let i=(e-r)/60;if(i<60)return!r&&t?`${i}m`:`${i}m ${n}s`;const a=Math.floor(i/60);if(i-=60*a,!r&&!i&&t)return`${a}h`;const o=t?`${i}`:`${i}`.padStart(2,"0");return!r&&i&&t?`${a}h ${o}m`:`${a}h ${o}m ${n}s`}(+e.endTime-+e.startTime))))}));Ti.displayName="EventListItem";function Mi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Mi.Cache||Gt),r}Mi.Cache=Gt;const _i=Mi((()=>{const e=document.createElement("div");e.style.overflowY="scroll",e.style.position="absolute",e.style.top="-9999px",document.body.append(e);const t=e.offsetWidth;return e.remove(),t})),Ii=({size:e=48})=>B.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},B.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(0 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(30 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(60 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(90 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(120 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(150 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(180 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(210 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(240 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(270 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(300 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),B.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(330 50 50) translate(0 -30)"},B.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));Ii.displayName="Preloader";class Si extends B.Component{constructor(e){super(e),Object.defineProperty(this,"scrollState",{enumerable:!0,configurable:!0,writable:!0,value:{rowIndex:0,columnIndex:0}}),Object.defineProperty(this,"scrollTop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"columnCount",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"rowHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastScrollEventTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"scrolls",{enumerable:!0,configurable:!0,writable:!0,value:new f}),Object.defineProperty(this,"updates",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"listRef",{enumerable:!0,configurable:!0,writable:!0,value:B.createRef()}),Object.defineProperty(this,"setScrollState",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{this.scrollState.rowIndex=e,this.scrollState.columnIndex=t}}),Object.defineProperty(this,"resetScrollState",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.scrollState.rowIndex=0,this.scrollState.columnIndex=0}}),Object.defineProperty(this,"onScroll",{enumerable:!0,configurable:!0,writable:!0,value:({scrollTop:e})=>{this.scrollTop=e,this.lastScrollEventTimestamp=Date.now(),this.scrolls.next(e),"disabled"!==this.props.store.liveUpdateMode&&w((()=>this.props.store.liveUpdateMode=this.scrollTop?"manual":"auto"))}}),Object.defineProperty(this,"rowRenderer",{enumerable:!0,configurable:!0,writable:!0,value:e=>({columnIndex:t,rowIndex:r,style:n})=>B.createElement(X,null,(()=>{var i;const a=r*e+t,o=this.props.store.data[a];return a===this.props.store.data.length?this.props.store.error?B.createElement("div",{style:n},B.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},B.createElement("div",{style:{textAlign:"center"}},B.createElement("div",null,"Couldn't fetch more data"),B.createElement(ri,{onClick:this.props.store.loadMore},"Retry")))):B.createElement("div",{style:n},B.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},B.createElement(Ii,{size:32}))):!o&&(null===(i=this.props.store.pageInfo)||void 0===i?void 0:i.haveMore)?B.createElement("div",{style:n}):o?B.createElement("div",{style:n},B.createElement(Ti,{data:o,hideCameraName:this.props.hideCameraName,onClick:this.props.onEventClick})):B.createElement("div",{style:n})}))}),Object.defineProperty(this,"loadMoreItems",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>(this.props.store.loadMore(),Promise.resolve())}),v(this,{scrollState:g,setScrollState:y,resetScrollState:y})}componentDidMount(){this.disposables.push(this.scrolls.pipe(S(200)).subscribe((()=>{this.props.store.pendingData.length&&(this.updates=this.props.store.pendingData.length,this.props.store.flushUpdates(),this.forceUpdate())}))),this.disposables.push(E((()=>this.props.store.pendingData),(e=>{e.length&&(Date.now()-this.lastScrollEventTimestamp<200||(this.updates=e.length,this.props.store.flushUpdates(),this.forceUpdate()))})))}componentWillUnmount(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()})),"disabled"!==this.props.store.liveUpdateMode&&w((()=>this.props.store.liveUpdateMode="auto"))}componentDidUpdate(){if(0!==this.scrollTop&&this.listRef.current&&this.updates){const e=this.scrollTop+Math.round(this.updates/this.columnCount)*this.rowHeight;this.listRef.current.scrollTo({scrollTop:e,scrollLeft:0}),this.updates=0}}render(){return B.createElement(X,null,(()=>{const{store:e}=this.props;return e.error&&!e.data.length?(this.resetScrollState(),B.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},B.createElement("div",{style:{textAlign:"center"}},B.createElement("div",null,"Couldn't fetch data"),B.createElement(ri,{onClick:e.reload},"Retry")))):e.loading?(this.resetScrollState(),B.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},B.createElement(Ii,null))):e.data.length?B.createElement(ue,null,(({width:t,height:r})=>B.createElement(X,null,(()=>{var n;const{minColumnWidth:i=180}=this.props,a=Math.floor(t/i)||1,o=t/a/16*9,l=a*Math.floor(r/o)>=e.data.length?0:_i(),s=Math.max(1,Math.floor((t-l)/i)),c=Math.ceil(this.props.store.data.length/s),u=(t-l)/s/16*9;this.rowHeight=u,this.columnCount=s;return B.createElement(de,{isItemLoaded:e=>e<c,itemCount:c+((null===(n=e.pageInfo)||void 0===n?void 0:n.haveMore)?1:0),loadMoreItems:this.loadMoreItems},(({onItemsRendered:n,ref:i})=>{var a;return B.createElement(ce,{ref:he(this.listRef,i),columnCount:s,columnWidth:(t-l)/s,height:r,width:t,rowCount:c+((null===(a=e.pageInfo)||void 0===a?void 0:a.haveMore)||e.error?1:0),rowHeight:u,initialScrollTop:u*this.scrollState.rowIndex,onScroll:this.onScroll,onItemsRendered:({visibleRowStartIndex:e,visibleColumnStartIndex:t,visibleRowStopIndex:r,overscanRowStopIndex:i,overscanRowStartIndex:a})=>{this.setScrollState(e,t),n({overscanStartIndex:a,overscanStopIndex:i,visibleStartIndex:e,visibleStopIndex:r})}},this.rowRenderer(s))}))})))):(this.resetScrollState(),B.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},Se.t("noEventsFound")))}))}}const Di=e=>{const{className:t,children:r,...n}=e;return B.createElement("div",{className:re("x-3deye-button-group",t),...n},r)},Ni=e=>`scale(${e})`,Li=({children:e,from:t,style:r})=>{const n=me({opacity:1,from:{opacity:0},config:{tension:300}});return H.createElement(pe.div,{style:{...r,...n,transform:n.opacity.to(Ni),transformOrigin:`${t||"bottom"} center`,width:"max-content"}},e)},ki=({width:e,height:t,color:r,position:n="top",style:i})=>{const a=[0,"top"===n?t:0],o=[e,a[1]],l=[e/2,t-a[1]],s=[e/4,t*("top"===n?3:1)/4],c=[.325*e,t-a[1]],u=[e-c[0],c[1]],d=[e-s[0],s[1]],h=e=>e.join(","),m=`M ${h(a)} C ${h(s)} ${h(c)} ${h(l)} ${h(u)} ${h(d)} ${h(o)} Z`;return B.createElement("svg",{className:"tip",style:i,width:e,height:t,fill:r},B.createElement("path",{d:m}))};class zi extends B.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,left:0,bottom:"auto",tipPosition:"bottom",tipOffset:0}}),Object.defineProperty(this,"targetRef",{enumerable:!0,configurable:!0,writable:!0,value:B.createRef()}),Object.defineProperty(this,"popoverRef",{enumerable:!0,configurable:!0,writable:!0,value:B.createRef()}),Object.defineProperty(this,"outsideClickListener",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=e.target;if(this.popoverRef.current.contains(t))return;const r=this.targetRef.current;r&&r.contains(t)||this.props.onCloseRequest()}}),Object.defineProperty(this,"updatePosition",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!this.popoverRef)return;const{disablePortal:e}=this.props,t=this.targetRef.current;if(!t)return void console.warn("popover: no target element found");const{top:r,left:n,bottom:i,height:a,width:o}=t.getBoundingClientRect();let l="calc(50% - 12px)",s="auto";const c=this.popoverRef.current;let u="bottom"===this.props.placement?i+10:r-c.clientHeight-10,d=n+o/2-c.clientWidth/2,h="bottom"===this.props.placement?"top":"bottom";u<0&&(u=i+10,h="top"),d<0&&(d=0,l=n+o/2-12),d+c.clientWidth>window.innerWidth&&(d=window.innerWidth-c.clientWidth,l=n-d+o/2-12),e&&(u=a+10,d=0,l=8,"top"===this.props.placement&&(s=u,u="auto")),this.setState({top:u,bottom:s,left:d,tipPosition:h,tipOffset:l},(()=>{this.forceUpdate()}))}})}componentWillUnmount(){this.stopOutsideClickListening()}componentDidUpdate(e){const{ignoreOutsideClick:t}=this.props;this.props.opened&&!e.opened&&(t||this.startOutsideClickListening(),requestAnimationFrame(this.updatePosition)),!this.props.opened&&e.opened&&this.stopOutsideClickListening()}render(){const{top:e,left:t,bottom:r,tipPosition:n,tipOffset:i}=this.state,{className:a,opened:o,disablePortal:l,disableAnimation:s}=this.props,c={position:"absolute",left:i};"bottom"===n?c.bottom=-8:c.top=-8;const u=re(a,"x-3deye-popover-body");let d=null;if(o){const i={zIndex:l?1:100000001,position:"absolute",top:e,bottom:r,left:t},a=B.createElement("div",{className:u,ref:this.popoverRef},this.props.children,B.createElement(ki,{width:24,height:8,position:n,color:"white",style:c}));d=s?B.createElement("div",{style:i},a):B.createElement(Li,{from:n,style:i},a)}const h=B.cloneElement(this.props.target,{ref:this.targetRef});if(l)return B.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},h,d);const m=o&&B.createElement(yi,null,d);return B.createElement(B.Fragment,null,h,m)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}const Ri=Z((({store:e})=>{const[t,r]=$(!1),{cameras:n}=W(Bn),{date:l,setDate:s,cameraId:c}=e,u=c?n.camerasById.get(c):void 0,d=a(new Date,1),h=l&&i(l,new Date),m=l&&i(l,d),p=u?o(new Date,u.archiveDuration):new Date,f=()=>r(!1);return B.createElement(Di,null,B.createElement(ri,{className:re({"button-selected":h}),onClick:()=>s(new Date)},Se.t("today")),c&&!i(new Date,p)?B.createElement(ri,{className:re({"button-selected":m}),onClick:()=>s(d)},Se.t("yesterday")):null,l&&B.createElement(zi,{target:B.createElement(ri,{className:"date-button",onClick:()=>r(!t)},De(l,"EEE dd MMM")),opened:t,onCloseRequest:f,disableAnimation:!0},B.createElement(fe,{selected:l,onChange:s,dateFormat:"EEE dd MMM",inline:!0,minDate:p,maxDate:new Date}),B.createElement("div",{style:{display:"flex"}},B.createElement(ri,{style:{flex:1},onClick:f,className:"x-3deye-button--ok"},"Ok"))))}));Ri.displayName="DateSelector";const Ai=Z((()=>{const e=W(Bn),t=U(null),r=U(null),n=U(null),i=Q((()=>({width:0,setWidth(e){this.width=e}}))),a=100,o=20,l=20,s=30,c=20;return V((()=>{const u=ye(r.current),d=new le((e=>{for(const t of e){const e=t.contentRect.width;i.setWidth(e)}}));d.observe(t.current);const h=E((()=>({data:e.eventSearchPanel.eventSearch.filteredPeopleCountingData,width:i.width})),(({data:t,width:r})=>{if(!r)return;t.forEach((e=>e.timestamp=new Date(e.TimeStamp)));const i=be(t,(e=>e.timestamp)),d=xe(je.offset(i[0],-1),je.offset(i[1],1)),h=Pe().extent([[c,o],[r-l,a-s]]).on("end",(function({selection:t,sourceEvent:r}){if(!r)return;if(!t)return void e.eventSearchPanel.eventSearch.setBrushFilter(null);const n=Oe.every((+p[0].x1-+p[0].x0)/6e4||30);let[i,a]=t.map((e=>n.round(m.invert(e))));if(+i==+a&&(i=n.floor(m.invert(t[0])),a=n.ceil(m.invert(t[1])),+i==+a))return ye(this).transition().call(h.move,null),void e.eventSearchPanel.eventSearch.setBrushFilter(null);e.eventSearchPanel.eventSearch.setBrushFilter([i,a]),ye(this).transition().call(h.move,a>i?[i,a].map(m):null)}));n.current=h;const m=we().domain(be(d)).nice().range([c,r-l]),p=t.length?ve().value((e=>e.timestamp)).domain(m.domain()).thresholds(m.ticks(24))(t):[],f=Ee().domain([0,ge(p,(e=>e.length))]).nice().range([a-s,o]),b=u.select(".bars").selectAll(".bar").data(p);b.exit().remove();const v=b.enter().append("g").attr("class","bar");if(v.append("rect").attr("x",(e=>m(e.x0)+1)).attr("width",(e=>Math.max(0,m(e.x1)-m(e.x0)-1))).attr("y",(e=>f(e.length))).attr("height",(e=>f(0)-f(e.length))),b.select("rect").attr("x",(e=>m(e.x0)+1)).attr("width",(e=>Math.max(0,m(e.x1)-m(e.x0)-1))).attr("y",(e=>f(e.length))).attr("height",(e=>f(0)-f(e.length))),v.append("text").attr("dy",".75em").attr("y",(e=>f(e.length)-10)).attr("x",(e=>m(e.x0)+1+Math.max(0,m(e.x1)-m(e.x0)-1)/2)).attr("text-anchor","middle").text((function(e){return e.length?e.length:""})),b.select("text").attr("dy",".75em").attr("y",(e=>f(e.length)-10)).attr("x",(e=>m(e.x0)+1+Math.max(0,m(e.x1)-m(e.x0)-1)/2)).attr("text-anchor","middle").text((e=>e.length?e.length:"")),t.length){const[e,t]=m.domain(),[r,n]=m.range(),i=(n-r)/(+t-+e)*3600*1e3,a=30,o=Ce(m).ticks(je.every(1)).tickFormat((e=>i>=a?Te("%H:%M")(e):e.getHours()%(Math.floor(a/i)+1)?"":Te("%H:%M")(e)));o.scale(m),u.select(".x-axis").attr("transform","translate(0,70)").call(o),u.select(".brush").call(h)}else u.select(".x-axis").html(""),u.select(".brush").call(h),u.select(".brush").html("").call(h.move,null)}),{fireImmediately:!0}),m=E((()=>e.eventSearchPanel.eventSearch.brushFilter),(e=>{null===e&&n.current&&u.select(".brush").call(n.current.move,null)}));return()=>{n.current=null,m(),h(),d.disconnect()}}),[]),B.createElement("div",{ref:t},B.createElement("div",{style:{marginLeft:10}},"People Counting"),B.createElement("svg",{className:"people-histogram",ref:r,width:i.width,height:a,viewBox:`0 0 ${i.width} 100`},B.createElement("g",{className:"bars"}),B.createElement("g",{className:"x-axis"}),B.createElement("g",{className:"brush"})))}));Ai.displayName="PeopleHistogram";const Fi=e=>{const{children:t,innerProps:r,...n}=e,{Option:i}=te,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center",width:"auto"}};return B.createElement(i,{innerProps:o,...n},B.createElement(Zn,{data:a}),B.createElement("div",{style:{marginLeft:4}},t))},Hi=Z((({store:e,onEventClick:t})=>{if(!e)return null;const{filters:r,setFilters:n}=e,{foundObjectTypesForSelect:i}=e.eventSchema;return B.createElement(B.Fragment,null,B.createElement(Ri,{store:e}),B.createElement("div",{style:{zIndex:2}},B.createElement(ee,{closeMenuOnSelect:!1,isMulti:!0,onChange:n,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:i,placeholder:Se.t("selectObjectType"),value:r,components:{MultiValueLabel:Xn,Option:Fi},styles:{...ui,multiValue:(e,{data:t})=>t.color?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>t.color?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>t.color?{...e,color:"white"}:e,option:(e,{data:t})=>t.color?{...e,color:t.color}:e}})),B.createElement(si,{getter:e.getProbabilityThreshold,setter:e.setProbabilityThreshold}),e.filters.length?B.createElement(oi,{value:e.colors,toggle:e.toggleColor,clear:e.clearColors}):null,e.analyticsEnabled?B.createElement(Ai,null):null,B.createElement("div",{style:{flex:1}},B.createElement(Si,{hideCameraName:!0,store:e.eventsLoader,onEventClick:t})))}));Hi.displayName="EventSearch";const Bi=e=>{var t;const r=null!==(t=W(A))&&void 0!==t?t:F;return B.createElement(Bn.Provider,{value:r},B.createElement(Hi,{...e}))};var Ui;Bi.displayName="EventSearch",(Ui={resources:{en:{translation:Me}}})&&Object.assign(Ie,Ui),s(Se.init(Ie));const $i=(e=F)=>{const t=new Hn(e.eventSchema,e.events,e.notification);return t.initWith(e.api),t};export{$i as createEventSearchStore,Bi as default};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3deye-toolkit/react-event-search",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.22",
|
|
4
4
|
"module": "dist/react-event-search.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"types": "dist/react-event-search.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@3deye-toolkit/core": "0.0.1-alpha.
|
|
10
|
+
"@3deye-toolkit/core": "0.0.1-alpha.22",
|
|
11
11
|
"@material/slider": "^5.1.0",
|
|
12
12
|
"@reach/tooltip": "^0.15.3",
|
|
13
13
|
"@react-spring/web": "^9.2.5",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"d3-time-format": "^3.0.0",
|
|
23
23
|
"date-fns": "^2.22.1",
|
|
24
24
|
"earcut": "^2.2.3",
|
|
25
|
-
"i18next": "
|
|
25
|
+
"i18next": "21.5.3",
|
|
26
26
|
"lodash": "4.17.21",
|
|
27
27
|
"material-colors": "^1.2.6",
|
|
28
28
|
"mobx": "^6.3.2",
|