@3deye-toolkit/react-event-search 0.0.1-alpha.28 → 0.0.1-alpha.30

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.
@@ -4,24 +4,23 @@
4
4
  border: none;
5
5
  position: relative;
6
6
  padding: 0 8px;
7
- height: 32px;
8
- text-transform: uppercase;
7
+ height: 32px;
9
8
  -webkit-user-select: none;
10
9
  -moz-user-select: none;
11
10
  -ms-user-select: none;
12
11
  user-select: none;
13
- display: inline-flex;
12
+ display: inline-flex;
14
13
  justify-content: center;
15
14
  align-items: center;
16
- border-radius: 4px;
17
- letter-spacing: .0107142857em;
18
- font-weight: 500;
15
+ border-radius: 4px;
16
+ letter-spacing: 0.0107142857em;
17
+ font-weight: 500;
19
18
  }
20
19
 
21
20
  .x-3deye-button sup {
22
- position: relative;
23
- top: -0.5em;
24
- left: 0.25em;
21
+ position: relative;
22
+ top: -0.5em;
23
+ left: 0.25em;
25
24
  }
26
25
 
27
26
  .x-3deye-button.x-3deye-button--fullwidth {
@@ -35,7 +34,7 @@
35
34
 
36
35
  .x-3deye-button--icon {
37
36
  border-radius: 16px;
38
- padding: 4px;
37
+ padding: 4px;
39
38
  width: 32px;
40
39
  height: 32px;
41
40
  display: inline-flex;
@@ -53,22 +52,22 @@
53
52
 
54
53
  .x-3deye-button.x-3deye-button--filled,
55
54
  .x-3deye-button.x-3deye-button--text {
56
- min-width: 80px;
57
- text-transform: capitalize;
58
- font-family: 'Roboto', sans-serif;
59
- font-size: 0.875rem;
60
- font-weight: 500;
61
- border-radius: 0.25rem;
62
- padding: 0 1rem;
55
+ min-width: 80px;
56
+ text-transform: capitalize;
57
+ font-family: 'Roboto', sans-serif;
58
+ font-size: 0.875rem;
59
+ font-weight: 500;
60
+ border-radius: 0.25rem;
61
+ padding: 0 1rem;
63
62
  }
64
63
 
65
64
  .x-3deye-button.x-3deye-button--filled {
66
- background-color: #27b9a1;
67
- color: white;
65
+ background-color: rgb(39, 185, 161);
66
+ color: white;
68
67
  }
69
68
 
70
69
  .x-3deye-button.x-3deye-button--filled:not(:disabled):hover {
71
- background-color: #61beaf;
70
+ background-color: rgb(34, 163, 142);
72
71
  }
73
72
 
74
73
  .x-3deye-button.x-3deye-button--filled:focus {
@@ -87,26 +86,25 @@
87
86
  color: white;
88
87
  }
89
88
 
90
- .x-3deye-button.x-3deye-button--overlay:focus, .x-3deye-button.x-3deye-button--overlay:not(:disabled):hover {
91
- background: rgba(0, 0, 0, 0.5);
89
+ .x-3deye-button.x-3deye-button--overlay:focus,
90
+ .x-3deye-button.x-3deye-button--overlay:not(:disabled):hover {
91
+ background: rgba(0, 0, 0, 0.5);
92
92
  border: 2px solid rgba(255, 255, 255, 0.5);
93
93
  }
94
94
 
95
- :root {
96
- --reach-tooltip: 1;
95
+ .x-3deye-button.x-3deye-button--overlay.x-3deye-button--overlay-danger:not(:disabled),
96
+ .x-3deye-button.x-3deye-button--overlay.x-3deye-button--overlay-danger:not(:disabled):hover {
97
+ background-color: rgba(156, 51, 49, 0.5);
97
98
  }
98
99
 
99
- [data-reach-tooltip] {
100
- z-index: 1;
101
- pointer-events: none;
102
- position: absolute;
103
- padding: 0.25em 0.5em;
104
- box-shadow: 2px 2px 10px hsla(0, 0%, 0%, 0.1);
105
- white-space: nowrap;
106
- font-size: 85%;
107
- background: #f0f0f0;
108
- color: #444;
109
- border: solid 1px #ccc;
100
+ .x-3deye-tooltip {
101
+ background: rgb(0 0 0 / 0.9);
102
+ color: white;
103
+ border: none;
104
+ border-radius: 4px;
105
+ padding: 0.5em 1em;
106
+ font-size: 12px;
107
+ border: rgb(255 255 255 / 0.15) 1px solid;
110
108
  }
111
109
 
112
110
  .color-selector {
@@ -281,14 +279,6 @@
281
279
  border-top: 5px solid var(--primary-color, #0067ac);
282
280
  }
283
281
 
284
- .preloader-container {
285
- color: var(--on-container);
286
- flex: 1;
287
- display: flex;
288
- justify-content: center;
289
- align-items: center;
290
- }
291
-
292
282
  .event-list-item {
293
283
  -webkit-user-select: none;
294
284
  -moz-user-select: none;
@@ -552,6 +542,14 @@
552
542
  right: 0;
553
543
  }
554
544
 
545
+ .preloader-container {
546
+ color: var(--on-container);
547
+ flex: 1;
548
+ display: flex;
549
+ justify-content: center;
550
+ align-items: center;
551
+ }
552
+
555
553
  .frame .corner-highlight-tl {
556
554
  position: absolute;
557
555
  top: -1px;
@@ -1384,6 +1382,41 @@
1384
1382
  font-size: 1.44rem;
1385
1383
  }
1386
1384
 
1385
+ .x-3deye-popover-container.popover-datetimepicker,
1386
+ .x-3deye-popover-container.popover-datepicker {
1387
+ background: white;
1388
+ color: black;
1389
+ }
1390
+
1391
+ .x-3deye-popover-container.popover-datetimepicker .tip,
1392
+ .x-3deye-popover-container.popover-datepicker .tip {
1393
+ --tip-background: white;
1394
+ --tip-border: transparent;
1395
+ }
1396
+
1397
+ .popover-datetimepicker {
1398
+ --surface-inverse: #e1e1e1;
1399
+ }
1400
+
1401
+ .popover-datepicker .react-datepicker {
1402
+ width: 242px;
1403
+ }
1404
+
1405
+ .popover-datetimepicker .react-datepicker {
1406
+ width: 328px;
1407
+ }
1408
+
1409
+ .popover-datetimepicker .react-datepicker__time-list {
1410
+ padding: 0 !important;
1411
+ }
1412
+
1413
+ .popover-datepicker.x-3deye-popover-body,
1414
+ .popover-datetimepicker.x-3deye-popover-body {
1415
+ display: flex;
1416
+ flex-direction: column;
1417
+ gap: 10px;
1418
+ }
1419
+
1387
1420
  .x-3deye-button-group {
1388
1421
  display: flex;
1389
1422
  padding: 4px;
@@ -1394,6 +1427,7 @@
1394
1427
  flex: 1;
1395
1428
  height: 35px;
1396
1429
  font-size: 11px;
1430
+ text-transform: uppercase;
1397
1431
  }
1398
1432
 
1399
1433
  .x-3deye-button-group > .x-3deye-button.button-selected,
@@ -1418,15 +1452,29 @@
1418
1452
  color: var(--container);
1419
1453
  }
1420
1454
 
1421
- .x-3deye-popover {
1422
- position: relative;
1455
+ .x-3deye-popover-container {
1456
+ background: #222;
1457
+ box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgb(0 0 0 / 0.1),
1458
+ inset 0 0 0 1px rgb(255 255 255 /0.05);
1459
+ color: white;
1460
+ border-radius: 6px;
1461
+ padding: 8px;
1462
+ text-align: left;
1463
+ -webkit-animation: slide-in 0.15s ease-in;
1464
+ animation: slide-in 0.15s ease-in;
1423
1465
  }
1424
1466
 
1425
- .x-3deye-popover-body {
1426
- background-color: white;
1427
- padding: 8px;
1428
- border-radius: 8px;
1429
- box-shadow: 0 0 8px 0px black;
1467
+ @media(prefers-reduced-motion: reduce) {
1468
+ .x-3deye-popover-container {
1469
+ -webkit-animation: none;
1470
+ animation: none;
1471
+ }
1472
+ }
1473
+
1474
+
1475
+ .x-3deye-popover-container .tip {
1476
+ --tip-background: #222;
1477
+ --tip-border: rgb(255 255 255 /0.05);
1430
1478
  }
1431
1479
 
1432
1480
  .event-search-results {
@@ -15,7 +15,7 @@ declare class AccountStore extends ApiStore {
15
15
  constructor(notification?: NotificationService | undefined);
16
16
  get userDisplayName(): string | null;
17
17
  protected afterInit(): void;
18
- loadUser(): Observable<RawUser | null>;
18
+ loadUser$(): Observable<RawUser | null>;
19
19
  setUser: (user: User | null) => void;
20
20
  setAuthStore(auth: Auth): void;
21
21
  updateUserPassword(passwordData: {
@@ -384,7 +384,7 @@ declare class EventSearchStore extends ApiStore {
384
384
  filters: DetectedObjectOption[];
385
385
  colors: Set<string>;
386
386
  peopleCountingDataLoading: boolean;
387
- heatmapHidden: boolean;
387
+ heatmapMode: HeatmapMode;
388
388
  heatmapLoading: boolean;
389
389
  data: CameraEvent[];
390
390
  heatmap: Heatmap | null;
@@ -411,20 +411,11 @@ declare class EventSearchStore extends ApiStore {
411
411
  x: number;
412
412
  y: number;
413
413
  }[][]) => void;
414
- toggleHeatmap: () => void;
414
+ setHeatmapMode: (mode: HeatmapMode) => void;
415
415
  toggleColor: (color: string) => void;
416
416
  clearColors: () => void;
417
417
  clear: () => void;
418
418
  initDataFetching: () => void;
419
- /**
420
- * given region as array of vertices in normalized coordinates
421
- * returns its representation in WKT: https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry
422
- * @param region
423
- */
424
- regionToWktPolygon(region: {
425
- x: number;
426
- y: number;
427
- }[]): string;
428
419
  boxRegions(regions: {
429
420
  x: number;
430
421
  y: number;
@@ -440,9 +431,16 @@ declare class EventSearchStore extends ApiStore {
440
431
 
441
432
  declare class EventsLoader extends ApiStore {
442
433
  private eventsStore;
434
+ readonly mode: 'events' | 'objects';
443
435
  api: ExtendedApi;
444
- data: CameraEvent[];
445
- pendingData: CameraEvent[];
436
+ data: {
437
+ data: CameraEvent;
438
+ objectIdx: number;
439
+ }[];
440
+ pendingData: {
441
+ data: CameraEvent;
442
+ objectIdx: number;
443
+ }[];
446
444
  liveUpdateMode: 'manual' | 'auto' | 'disabled';
447
445
  updateTrigger: number;
448
446
  colors: Set<string>;
@@ -458,13 +456,16 @@ declare class EventsLoader extends ApiStore {
458
456
  to?: Date;
459
457
  cameras: number[];
460
458
  detectedObjects: string[];
461
- polygons: string[];
459
+ regions: {
460
+ x: number;
461
+ y: number;
462
+ }[][] | null;
462
463
  eventTypes: SensorEventType[];
463
464
  private loadingInited;
464
465
  get isLive(): boolean;
465
466
  get totalCount(): number;
466
467
  get filterJson(): string | null;
467
- constructor(eventsStore: EventsStore);
468
+ constructor(eventsStore: EventsStore, mode?: 'events' | 'objects');
468
469
  flushUpdates: () => void;
469
470
  setLiveUpdateMode: (mode: 'manual' | 'auto' | 'disabled') => void;
470
471
  load: () => void;
@@ -474,6 +475,14 @@ declare class EventsLoader extends ApiStore {
474
475
  private initDataLoading;
475
476
  private initLiveUpdates;
476
477
  private filter;
478
+ private toObjects;
479
+ private boxToAabb;
480
+ /**
481
+ * given region as array of vertices in normalized coordinates
482
+ * returns its representation in WKT: https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry
483
+ * @param region
484
+ */
485
+ private regionToWktPolygon;
477
486
  /**
478
487
  * Joins to arrays leaving only unique events
479
488
  * TODO: check if using map only on joint is more efficient
@@ -625,6 +634,8 @@ declare class Heatmap {
625
634
  constructor(raw: RawHeatmap, cameraId: number, duration: number);
626
635
  }
627
636
 
637
+ declare type HeatmapMode = 'fullframe' | 'selection' | 'none';
638
+
628
639
  declare class HeatmapsStore extends ApiStore {
629
640
  api: ExtendedApi;
630
641
  fetchHeatmaps(cameraId: number, from: Date, to: Date, count: number): Observable<Heatmap[]>;
@@ -1151,6 +1162,7 @@ declare class Token {
1151
1162
 
1152
1163
  declare class ToolkitApp {
1153
1164
  readonly name: string;
1165
+ initialized: boolean;
1154
1166
  cameras: CamerasStore;
1155
1167
  archives: ArchivesStore;
1156
1168
  events: EventsStore;
@@ -1 +1 @@
1
- import{format as e,startOfDay as t,endOfDay as r,isSameYear as n,isSameDay as a,subDays as i,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}from"rxjs";import{computed as p,makeObservable as f,observable as b,action as g,runInAction as v,reaction as y}from"mobx";import{mergeMap as w,catchError as E,switchMap as x,mapTo as C,concatMap as j,distinctUntilChanged as O,share as P,map as _}from"rxjs/operators";import T from"earcut";import{subHours as L}from"date-fns";import{AppContext as M,app as I}from"@3deye-toolkit/core";import N,{useRef as D,useState as k,useEffect as S,useCallback as A,useContext as z,useLayoutEffect as F}from"react";import{observer as H,useLocalObservable as R,Observer as $}from"mobx-react-lite";import B,{components as U}from"react-select";import V from"clsx";import W from"react-ink";import q from"@reach/tooltip";import G from"@seznam/compose-react-refs";import Y from"react-virtualized-auto-sizer";import Z from"react-window-infinite-loader";import{VariableSizeGrid as J}from"react-window";import*as X from"@sentry/browser";import{useSpring as K,animated as Q}from"@react-spring/web";import ee from"react-dom";import te from"react-datepicker";import{extent as re,bin as ne,max as ae}from"d3-array";import{select as ie}from"d3-selection";import{scaleTime as oe,scaleLinear as le}from"d3-scale";import{timeHours as se,timeHour as ce,timeMinute as ue}from"d3-time";import{axisBottom as de}from"d3-axis";import{brushX as he}from"d3-brush";import{timeFormat as me}from"d3-time-format";import pe from"resize-observer-polyfill";var fe={eventSearchRequestError:{peopleCounting:"Sorry, an error occured during event search. Couldn't fetch people counting data. Please try again later",heatmap:"Sorry, an error occured during event search. Couldn't fetch heatmap. Please try again later"},selectObjectType:"Select object type",noEventsFound:"no events found",showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events",today:"today",yesterday:"yesterday",button:{ok:"Ok"},peopleCounting:"People Counting",selected:"selected",total:"total"};const be=new Map,ge={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},ve=l.createInstance();function ye(t,r){const n=be.get(ve.language);return e(t,r,{locale:n})}function we(e,t=!1){const r=p(e);return new c((e=>{const n=r.observe_((({newValue:t})=>e.next(t)),t);return()=>n()}))}var Ee,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"}(Ee||(Ee={})),function(e){e[e.CONNECTING=0]="CONNECTING",e[e.CONNECTED=1]="CONNECTED",e[e.RECONNECTING=2]="RECONNECTING",e[e.DISCONNECTED=3]="DISCONNECTED"}(xe||(xe={}));var Ce="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var je=function(){this.__data__=[],this.size=0};var Oe=function(e,t){return e===t||e!=e&&t!=t},Pe=Oe;var _e=function(e,t){for(var r=e.length;r--;)if(Pe(e[r][0],t))return r;return-1},Te=_e,Le=Array.prototype.splice;var Me=function(e){var t=this.__data__,r=Te(t,e);return!(r<0)&&(r==t.length-1?t.pop():Le.call(t,r,1),--this.size,!0)},Ie=_e;var Ne=function(e){var t=this.__data__,r=Ie(t,e);return r<0?void 0:t[r][1]},De=_e;var ke=_e;var Se=function(e,t){var r=this.__data__,n=ke(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Ae=je,ze=Me,Fe=Ne,He=function(e){return De(this.__data__,e)>-1},Re=Se;function $e(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])}}$e.prototype.clear=Ae,$e.prototype.delete=ze,$e.prototype.get=Fe,$e.prototype.has=He,$e.prototype.set=Re;var Be=$e,Ue=Be;var Ve=function(){this.__data__=new Ue,this.size=0};var We=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var qe=function(e){return this.__data__.get(e)};var Ge=function(e){return this.__data__.has(e)},Ye="object"==typeof Ce&&Ce&&Ce.Object===Object&&Ce,Ze=Ye,Je="object"==typeof self&&self&&self.Object===Object&&self,Xe=Ze||Je||Function("return this")(),Ke=Xe.Symbol,Qe=Ke,et=Object.prototype,tt=et.hasOwnProperty,rt=et.toString,nt=Qe?Qe.toStringTag:void 0;var at=function(e){var t=tt.call(e,nt),r=e[nt];try{e[nt]=void 0;var n=!0}catch(e){}var a=rt.call(e);return n&&(t?e[nt]=r:delete e[nt]),a},it=Object.prototype.toString;var ot=at,lt=function(e){return it.call(e)},st=Ke?Ke.toStringTag:void 0;var ct=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":st&&st in Object(e)?ot(e):lt(e)};var ut=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},dt=ct,ht=ut;var mt,pt=function(e){if(!ht(e))return!1;var t=dt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},ft=Xe["__core-js_shared__"],bt=(mt=/[^.]+$/.exec(ft&&ft.keys&&ft.keys.IE_PROTO||""))?"Symbol(src)_1."+mt:"";var gt=function(e){return!!bt&&bt in e},vt=Function.prototype.toString;var yt=function(e){if(null!=e){try{return vt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},wt=pt,Et=gt,xt=ut,Ct=yt,jt=/^\[object .+?Constructor\]$/,Ot=Function.prototype,Pt=Object.prototype,_t=Ot.toString,Tt=Pt.hasOwnProperty,Lt=RegExp("^"+_t.call(Tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Mt=function(e){return!(!xt(e)||Et(e))&&(wt(e)?Lt:jt).test(Ct(e))},It=function(e,t){return null==e?void 0:e[t]};var Nt=function(e,t){var r=It(e,t);return Mt(r)?r:void 0},Dt=Nt(Xe,"Map"),kt=Nt(Object,"create"),St=kt;var At=function(){this.__data__=St?St(null):{},this.size=0};var zt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ft=kt,Ht=Object.prototype.hasOwnProperty;var Rt=function(e){var t=this.__data__;if(Ft){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Ht.call(t,e)?t[e]:void 0},$t=kt,Bt=Object.prototype.hasOwnProperty;var Ut=function(e){var t=this.__data__;return $t?void 0!==t[e]:Bt.call(t,e)},Vt=kt;var Wt=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Vt&&void 0===t?"__lodash_hash_undefined__":t,this},qt=At,Gt=zt,Yt=Rt,Zt=Ut,Jt=Wt;function Xt(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])}}Xt.prototype.clear=qt,Xt.prototype.delete=Gt,Xt.prototype.get=Yt,Xt.prototype.has=Zt,Xt.prototype.set=Jt;var Kt=Xt,Qt=Be,er=Dt;var tr=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var rr=function(e,t){var r=e.__data__;return tr(t)?r["string"==typeof t?"string":"hash"]:r.map},nr=rr;var ar=rr;var ir=rr;var or=rr;var lr=function(e,t){var r=or(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},sr=function(){this.size=0,this.__data__={hash:new Kt,map:new(er||Qt),string:new Kt}},cr=function(e){var t=nr(this,e).delete(e);return this.size-=t?1:0,t},ur=function(e){return ar(this,e).get(e)},dr=function(e){return ir(this,e).has(e)},hr=lr;function mr(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])}}mr.prototype.clear=sr,mr.prototype.delete=cr,mr.prototype.get=ur,mr.prototype.has=dr,mr.prototype.set=hr;var pr=mr,fr=Be,br=Dt,gr=pr;var vr=function(e,t){var r=this.__data__;if(r instanceof fr){var n=r.__data__;if(!br||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new gr(n)}return r.set(e,t),this.size=r.size,this},yr=Be,wr=Ve,Er=We,xr=qe,Cr=Ge,jr=vr;function Or(e){var t=this.__data__=new yr(e);this.size=t.size}Or.prototype.clear=wr,Or.prototype.delete=Er,Or.prototype.get=xr,Or.prototype.has=Cr,Or.prototype.set=jr;var Pr=Or;var _r=pr,Tr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Lr=function(e){return this.__data__.has(e)};function Mr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new _r;++t<r;)this.add(e[t])}Mr.prototype.add=Mr.prototype.push=Tr,Mr.prototype.has=Lr;var Ir=Mr,Nr=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},Dr=function(e,t){return e.has(t)};var kr=function(e,t,r,n,a,i){var o=1&r,l=e.length,s=t.length;if(l!=s&&!(o&&s>l))return!1;var c=i.get(e),u=i.get(t);if(c&&u)return c==t&&u==e;var d=-1,h=!0,m=2&r?new Ir:void 0;for(i.set(e,t),i.set(t,e);++d<l;){var p=e[d],f=t[d];if(n)var b=o?n(f,p,d,t,e,i):n(p,f,d,e,t,i);if(void 0!==b){if(b)continue;h=!1;break}if(m){if(!Nr(t,(function(e,t){if(!Dr(m,t)&&(p===e||a(p,e,r,n,i)))return m.push(t)}))){h=!1;break}}else if(p!==f&&!a(p,f,r,n,i)){h=!1;break}}return i.delete(e),i.delete(t),h};var Sr=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};var Ar=Xe.Uint8Array,zr=Oe,Fr=kr,Hr=Sr,Rr=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},$r=Ke?Ke.prototype:void 0,Br=$r?$r.valueOf:void 0;var Ur=function(e,t,r,n,a,i,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||!i(new Ar(e),new Ar(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return zr(+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=Hr;case"[object Set]":var s=1&n;if(l||(l=Rr),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=Fr(l(e),l(t),n,a,i,o);return o.delete(e),u;case"[object Symbol]":if(Br)return Br.call(e)==Br.call(t)}return!1};var Vr=function(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e},Wr=Array.isArray,qr=Vr,Gr=Wr;var Yr=function(e,t,r){var n=t(e);return Gr(e)?n:qr(n,r(e))};var Zr=function(e,t){for(var r=-1,n=null==e?0:e.length,a=0,i=[];++r<n;){var o=e[r];t(o,r,e)&&(i[a++]=o)}return i},Jr=function(){return[]},Xr=Object.prototype.propertyIsEnumerable,Kr=Object.getOwnPropertySymbols,Qr=Kr?function(e){return null==e?[]:(e=Object(e),Zr(Kr(e),(function(t){return Xr.call(e,t)})))}:Jr;var en=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var tn=function(e){return null!=e&&"object"==typeof e},rn=ct,nn=tn;var an=function(e){return nn(e)&&"[object Arguments]"==rn(e)},on=tn,ln=Object.prototype,sn=ln.hasOwnProperty,cn=ln.propertyIsEnumerable,un=an(function(){return arguments}())?an:function(e){return on(e)&&sn.call(e,"callee")&&!cn.call(e,"callee")},dn={exports:{}};var hn=function(){return!1};!function(e,t){var r=Xe,n=hn,a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,o=i&&i.exports===a?r.Buffer:void 0,l=(o?o.isBuffer:void 0)||n;e.exports=l}(dn,dn.exports);var mn=/^(?:0|[1-9]\d*)$/;var pn=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&mn.test(e))&&e>-1&&e%1==0&&e<t};var fn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},bn=ct,gn=fn,vn=tn,yn={};yn["[object Float32Array]"]=yn["[object Float64Array]"]=yn["[object Int8Array]"]=yn["[object Int16Array]"]=yn["[object Int32Array]"]=yn["[object Uint8Array]"]=yn["[object Uint8ClampedArray]"]=yn["[object Uint16Array]"]=yn["[object Uint32Array]"]=!0,yn["[object Arguments]"]=yn["[object Array]"]=yn["[object ArrayBuffer]"]=yn["[object Boolean]"]=yn["[object DataView]"]=yn["[object Date]"]=yn["[object Error]"]=yn["[object Function]"]=yn["[object Map]"]=yn["[object Number]"]=yn["[object Object]"]=yn["[object RegExp]"]=yn["[object Set]"]=yn["[object String]"]=yn["[object WeakMap]"]=!1;var wn=function(e){return vn(e)&&gn(e.length)&&!!yn[bn(e)]};var En=function(e){return function(t){return e(t)}},xn={exports:{}};!function(e,t){var r=Ye,n=t&&!t.nodeType&&t,a=n&&e&&!e.nodeType&&e,i=a&&a.exports===n&&r.process,o=function(){try{var e=a&&a.require&&a.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o}(xn,xn.exports);var Cn=wn,jn=En,On=xn.exports,Pn=On&&On.isTypedArray,_n=Pn?jn(Pn):Cn,Tn=en,Ln=un,Mn=Wr,In=dn.exports,Nn=pn,Dn=_n,kn=Object.prototype.hasOwnProperty;var Sn=function(e,t){var r=Mn(e),n=!r&&Ln(e),a=!r&&!n&&In(e),i=!r&&!n&&!a&&Dn(e),o=r||n||a||i,l=o?Tn(e.length,String):[],s=l.length;for(var c in e)!t&&!kn.call(e,c)||o&&("length"==c||a&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Nn(c,s))||l.push(c);return l},An=Object.prototype;var zn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||An)};var Fn=function(e,t){return function(r){return e(t(r))}},Hn=Fn(Object.keys,Object),Rn=zn,$n=Hn,Bn=Object.prototype.hasOwnProperty;var Un=pt,Vn=fn;var Wn=function(e){return null!=e&&Vn(e.length)&&!Un(e)},qn=Sn,Gn=function(e){if(!Rn(e))return $n(e);var t=[];for(var r in Object(e))Bn.call(e,r)&&"constructor"!=r&&t.push(r);return t},Yn=Wn;var Zn=Yr,Jn=Qr,Xn=function(e){return Yn(e)?qn(e):Gn(e)};var Kn=function(e){return Zn(e,Xn,Jn)},Qn=Object.prototype.hasOwnProperty;var ea=function(e,t,r,n,a,i){var o=1&r,l=Kn(e),s=l.length;if(s!=Kn(t).length&&!o)return!1;for(var c=s;c--;){var u=l[c];if(!(o?u in t:Qn.call(t,u)))return!1}var d=i.get(e),h=i.get(t);if(d&&h)return d==t&&h==e;var m=!0;i.set(e,t),i.set(t,e);for(var p=o;++c<s;){var f=e[u=l[c]],b=t[u];if(n)var g=o?n(b,f,u,t,e,i):n(f,b,u,e,t,i);if(!(void 0===g?f===b||a(f,b,r,n,i):g)){m=!1;break}p||(p="constructor"==u)}if(m&&!p){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(m=!1)}return i.delete(e),i.delete(t),m},ta=Nt(Xe,"DataView"),ra=Dt,na=Nt(Xe,"Promise"),aa=Nt(Xe,"Set"),ia=Nt(Xe,"WeakMap"),oa=ct,la=yt,sa=la(ta),ca=la(ra),ua=la(na),da=la(aa),ha=la(ia),ma=oa;(ta&&"[object DataView]"!=ma(new ta(new ArrayBuffer(1)))||ra&&"[object Map]"!=ma(new ra)||na&&"[object Promise]"!=ma(na.resolve())||aa&&"[object Set]"!=ma(new aa)||ia&&"[object WeakMap]"!=ma(new ia))&&(ma=function(e){var t=oa(e),r="[object Object]"==t?e.constructor:void 0,n=r?la(r):"";if(n)switch(n){case sa:return"[object DataView]";case ca:return"[object Map]";case ua:return"[object Promise]";case da:return"[object Set]";case ha:return"[object WeakMap]"}return t});var pa=Pr,fa=kr,ba=Ur,ga=ea,va=ma,ya=Wr,wa=dn.exports,Ea=_n,xa="[object Object]",Ca=Object.prototype.hasOwnProperty;var ja=function(e,t,r,n,a,i){var o=ya(e),l=ya(t),s=o?"[object Array]":va(e),c=l?"[object Array]":va(t),u=(s="[object Arguments]"==s?xa:s)==xa,d=(c="[object Arguments]"==c?xa:c)==xa,h=s==c;if(h&&wa(e)){if(!wa(t))return!1;o=!0,u=!1}if(h&&!u)return i||(i=new pa),o||Ea(e)?fa(e,t,r,n,a,i):ba(e,t,s,r,n,a,i);if(!(1&r)){var m=u&&Ca.call(e,"__wrapped__"),p=d&&Ca.call(t,"__wrapped__");if(m||p){var f=m?e.value():e,b=p?t.value():t;return i||(i=new pa),a(f,b,r,n,i)}}return!!h&&(i||(i=new pa),ga(e,t,r,n,a,i))},Oa=tn;var Pa=function e(t,r,n,a,i){return t===r||(null==t||null==r||!Oa(t)&&!Oa(r)?t!=t&&r!=r:ja(t,r,n,a,e,i))},_a=Pa;var Ta=function(e,t){return _a(e,t)};class La{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 Ma=Oe,Ia=Wn,Na=pn,Da=ut;var ka=/\s/;var Sa=function(e){for(var t=e.length;t--&&ka.test(e.charAt(t)););return t},Aa=/^\s+/;var za=ct,Fa=tn;var Ha=function(e){return e?e.slice(0,Sa(e)+1).replace(Aa,""):e},Ra=ut,$a=function(e){return"symbol"==typeof e||Fa(e)&&"[object Symbol]"==za(e)},Ba=/^[-+]0x[0-9a-f]+$/i,Ua=/^0b[01]+$/i,Va=/^0o[0-7]+$/i,Wa=parseInt;var qa=function(e){if("number"==typeof e)return e;if($a(e))return NaN;if(Ra(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ra(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ha(e);var r=Ua.test(e);return r||Va.test(e)?Wa(e.slice(2),r?2:8):Ba.test(e)?NaN:+e};var Ga=function(e){return e?Infinity===(e=qa(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var Ya=function(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(a);++n<a;)i[n]=e[n+t];return i},Za=function(e,t,r){if(!Da(r))return!1;var n=typeof t;return!!("number"==n?Ia(r)&&Na(t,r.length):"string"==n&&t in r)&&Ma(r[t],e)},Ja=function(e){var t=Ga(e),r=t%1;return t==t?r?t-r:t:0},Xa=Math.ceil,Ka=Math.max;var Qa=function(e,t,r){t=(r?Za(e,t,r):void 0===t)?1:Ka(Ja(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var a=0,i=0,o=Array(Xa(n/t));a<n;)o[i++]=Ya(e,a,a+=t);return o};const ei=([e,t],[r,n],[a,i])=>{const o=(n-t)*(a-r)-(r-e)*(i-n);return 0===o?0:o>0?1:2},ti=([e,t],[r,n],[a,i])=>r<=Math.max(e,a)&&r>=Math.min(e,a)&&n<=Math.max(t,i)&&n>=Math.min(t,i),ri=(e,t,r)=>!(e<r.x||t<r.y||e>r.x+r.width||t>r.y+r.height),ni=(e,t,r)=>{const n=r.y1*r.x3-r.x1*r.y3+(r.y3-r.y1)*e+(r.x1-r.x3)*t,a=r.x1*r.y2-r.y1*r.x2+(r.y1-r.y2)*e+(r.x2-r.x1)*t;if(n<0!=a<0)return!1;const i=-r.y2*r.x3+r.y1*(r.x3-r.x2)+r.x1*(r.y2-r.y3)+r.x2*r.y3;return i<0?n<=0&&n+a>=i:n>=0&&n+a<=i},ai=(e,t)=>{if(ri(t.x1,t.y1,e))return!0;if(ri(t.x2,t.y2,e))return!0;if(ri(t.x3,t.y3,e))return!0;if(ni(e.x,e.y,t))return!0;if(ni(e.x+e.width,e.y,t))return!0;if(ni(e.x+e.width,e.y+e.height,t))return!0;if(ni(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 a=ei(e,t,r),i=ei(e,t,n),o=ei(r,n,e),l=ei(r,n,t);return a!==i&&o!==l||!(0!==a||!ti(e,r,t))||!(0!==i||!ti(e,n,t))||!(0!==o||!ti(r,e,n))||!(0!==l||!ti(r,t,n))})(t,e)))))},ii=(e,t)=>{const r=e.map((({x:e,y:t})=>[e,t]));return Qa(T(r.flat()),3).some((r=>ai(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})))},oi=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class li{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}),f(this,{id:p,startTime:p,endTime:p,acknowledged:p,isLive:p,raw:b.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=oi.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!oi.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class si extends La{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,"setLiveUpdateMode",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.liveUpdateMode=e}}),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:a,cameras:i,polygons:o})=>this.api.cameras.GetSensorEventsPage({sensorIds:i,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==a?void 0:a.nextPageToken},n,o).pipe(w((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})))))}),f(this,{data:b.ref,cameras:b.struct,detectedObjects:b.struct,from:b,to:b,sortDirection:b,probabilityThreshold:b,pendingData:b.ref,liveUpdateMode:b,setLiveUpdateMode:g,updateTrigger:b,colors:b.ref,flushUpdates:g,pageInfo:b.ref,isLive:p,loading:b,loadMoreTrigger:b,retryTrigger:b,error:b.ref,loadMore:g,filterJson:p})}get isLive(){return"DESC"==this.sortDirection&&!this.to}get totalCount(){return this.data.length}get filterJson(){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=we((()=>({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(x((e=>we((()=>this.retryTrigger),!0).pipe(C(e)))),x((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:a,polygons:i})=>(v((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[],this.pendingData=[]})),this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:a,pageInfo:this.pageInfo,polygons:i}))))).subscribe((({events:e,pageInfo:t})=>{v((()=>{var r,n,a;if(!t)return;const i=e.map(ci);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:this.eventTypes.map((e=>Ee[e])),from:null!==(n=null===(r=i[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:L(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(a=this.probabilityThreshold)&&void 0!==a?a:void 0}),i):this.data=i,this.eventsStore.add(i),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(x((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:a})=>we((()=>this.loadMoreTrigger)).pipe(j((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:a,pageInfo:this.pageInfo,polygons:this.polygons}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(ci);this.eventsStore.add(r),v((()=>{this.data=this.data.concat(r),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(we((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(x((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?we((()=>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&&v((()=>{this.data=[...t,...this.data]}))}))),this.disposables.push(we((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(x((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?we((()=>this.eventsStore.recentAdditions)):(this.pendingData&&v((()=>this.pendingData=[])),m)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&v((()=>{this.pendingData=[...t,...this.pendingData]}))})))}filter(e){let t=e;const{from:r,to:n}=this;if(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){const e=this.eventTypes.map((e=>Ee[e]));t=t.filter((t=>e.includes(t.type)))}return this.detectedObjects.length&&(t=t.filter((e=>e.detectedObjects.some((e=>{var t;const{probabilityThreshold:r}=this;return!(null!==r&&e.Probability<r)&&(this.colors.size?this.detectedObjects.includes(e.Type)&&(null===(t=e.Colors)||void 0===t?void 0:t.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 ci(e){return new li(e)}const ui={Top:0,Left:0,Bottom:1,Right:1};class di extends La{constructor(e,n,a,i){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:a}),Object.defineProperty(this,"heatmaps",{enumerable:!0,configurable:!0,writable:!0,value:i}),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=we((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId}))).pipe(O(Ta),P());this.disposables.push(we((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId,filters:this.filters,brushFilter:this.brushFilter,colors:this.colors,probabilityThreshold:this.probabilityThreshold}))).pipe(O(Ta),P()).subscribe((e=>{v((()=>{if(!e.date||!e.cameraId)return;this.eventsLoader.sortDirection="DESC";const n=t(e.date),a=r(e.date);this.eventsLoader.from=n,this.eventsLoader.to=a;const{brushFilter:i}=e;i&&([this.eventsLoader.from,this.eventsLoader.to]=i),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=[Ee.Analytic],this.eventsLoader.colors=e.colors,this.eventsLoader.probabilityThreshold=e.probabilityThreshold,this.eventsLoader.load()}))})));const n=this.heatmaps;n&&(this.disposables.push(e.pipe(x((e=>{if(!e.date||!e.cameraId)return m;v((()=>{this.peopleCountingDataLoading=!0}));const n=t(e.date),a=r(e.date),i=e.regions?this.boxRegions(e.regions):ui;return this.api.cameras.GetPeopleCountingData(e.cameraId,n,a,i).pipe(w((e=>e.success?d(e.resultItems):h((()=>e.error))))).pipe(E((e=>(this.notification.error(ve.t("eventSearchRequestError.peopleCounting")),console.error(e),d([])))))}))).subscribe((e=>{v((()=>{this.peopleCountingData=e,this.peopleCountingDataLoading=!1}))}))),this.disposables.push(we((()=>({date:this.date,cameraId:this.cameraId}))).pipe(O(Ta),x((e=>{if(!e.date||!e.cameraId)return m;v((()=>{this.heatmapLoading=!0}));const a=t(e.date),i=r(e.date);return n.fetchHeatmaps(e.cameraId,a,i,1).pipe(_((e=>e[0]||null))).pipe(E((e=>(this.notification.error(ve.t("eventSearchRequestError.heatmap")),console.error(e),d(null)))))}))).subscribe((e=>{v((()=>{this.heatmap=e,this.heatmapLoading=!1}))}))))}}),f(this,{cameraId:b,date:b,regions:b.ref,filters:b.ref,colors:b.ref,peopleCountingDataLoading:b,heatmapHidden:b,heatmapLoading:b,data:b.ref,heatmap:b.ref,peopleCountingData:b.ref,probabilityThreshold:b,brushFilter:b.ref,params:p,filteredData:p,filteredPeopleCountingData:p,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(i),this.eventsLoader=new si(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=>{var t;return null===(t=e.Colors)||void 0===t?void 0:t.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=>{var r;return(!t.length||t.includes(e.Type))&&(!this.colors.size||(null===(r=e.Colors)||void 0===r?void 0:r.some((e=>this.colors.has(e.Color)))))&&e.Probability>=this.probabilityThreshold&&n.some((t=>ii(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=>ii(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 hi=N.createContext(null);function mi(e){return t=>{const{size:r=24,color:n="currentColor",className:a,...i}=t,o=e.viewBox||"0 0 24 24",l=e.svg;return N.createElement("svg",{preserveAspectRatio:"xMinYMin",className:V("icon",a),width:r,fill:n,viewBox:o,...i},l)}}const pi=mi({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"}))});pi.displayName="LabelIcon";const fi=mi({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"}))});fi.displayName="CameraIcon";const bi=mi({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"})});bi.displayName="LuggageIcon";const gi=mi({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"}))});gi.displayName="CarIcon";const vi=mi({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"}))});vi.displayName="BoatIcon";const yi=mi({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"}))});yi.displayName="BicycleIcon";const wi=mi({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"}))});wi.displayName="DirectionsWalkIcon";const Ei=mi({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"}))});Ei.displayName="PetsIcon";const xi=mi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M4 4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H5Zm0 2h4v2h8V6h4v12H4Z"}),N.createElement("path",{d:"M9.923 10 8.43 12.433 10 15h-.8L8 13.036 6.8 15H6l1.602-2.616L6.136 10h.8l1.093 1.781L9.123 10Z"}),N.createElement("path",{d:"m13.709 10-1.492 2.433L13.787 15h-.8l-1.2-1.964L10.585 15h-.8l1.603-2.616L9.923 10h.799l1.094 1.781L12.91 10Z"}),N.createElement("path",{d:"m17.709 10-1.492 2.433L17.787 15h-.8l-1.2-1.964L14.585 15h-.8l1.603-2.616L13.923 10h.799l1.094 1.781L16.91 10Z"}))});xi.displayName="LicensePlateIcon";const Ci=({data:e})=>{const t=16;return"licensePlate"===e.type?null:"detectedObject"!==e.type?N.createElement(fi,{size:t}):"Luggage"===e.id?N.createElement(bi,{size:t}):"Car"===e.id?N.createElement(gi,{size:t}):"Person"===e.id?N.createElement(wi,{size:t}):"Bicycle"===e.id?N.createElement(yi,{size:t}):"Boat"===e.id?N.createElement(vi,{size:t}):"Animal"===e.id?N.createElement(Ei,{size:t}):"LicensePlate"===e.id?N.createElement(xi,{size:t}):N.createElement(pi,{size:t})},ji=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:a}=U,{data:i}=e,o={...r,style:{display:"flex",alignItems:"center"}};return N.createElement(a,{innerProps:o,...n},N.createElement(Ci,{data:i}),N.createElement("div",{style:{marginLeft:4}},t))},Oi={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},Pi={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},_i={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Ti={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},Li={50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",A100:"#ffff8d",A200:"#ffff00",A400:"#ffea00",A700:"#ffd600"},Mi={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},Ii=({label:e,children:t})=>N.createElement(q,{label:e,style:Mi},t);Ii.displayName="Tooltip";class Ni extends N.Component{render(){const{forwardedRef:e,children:t,className:r,fullWidth:n,variant:a,type:i,title:o,...l}=this.props,s=V(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},a?`x-3deye-button--${a}`:void 0),c=N.createElement("button",{ref:e,className:s,type:i||"button",...l},t,l.disabled?null:N.createElement(W,null));return o?N.createElement(Ii,{label:o},c):c}}const Di=N.forwardRef(((e,t)=>N.createElement(Ni,{forwardedRef:t,...e}))),ki=mi({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"}))});ki.displayName="CloseIcon";const Si=mi({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"}))});Si.displayName="DoneIcon";const Ai=[{color:Ti[500],name:"red",highlightColor:Ti[100]},{color:Pi[500],name:"green",highlightColor:Pi[100]},{color:Oi[500],name:"blue",highlightColor:Oi[100]},{color:Li[500],name:"yellow",highlightColor:Li[900]},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:_i[500],name:"dimgrey",highlightColor:_i[100]}],zi=H((({value:e,clear:t,toggle:r})=>N.createElement("div",{className:"color-selector"},N.createElement("div",null,"COLOR"),N.createElement("div",{className:"color-selector__items"},Ai.map((({color:t,highlightColor:n,name:a})=>N.createElement("button",{key:a,className:V("color-selector__item",{selected:e.has(a)}),style:{backgroundColor:t},onClick:r.bind(null,a)},N.createElement(Si,{color:n,size:20})))),N.createElement(Di,{className:"color-selector__clear",disabled:!e.size,onClick:t},N.createElement(ki,{size:20}))))));zi.displayName="ColorSelector";const Fi=(e,t,r)=>Math.min(Math.max(e,t),r),Hi=e=>Math.round(e),Ri=N.forwardRef((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:a=!1,labelFormat:i=(e=>`${e}`),style:o},l)=>{const s=D(null),c=D(null),[u,d]=k(!1),[h,m]=k(e);S((()=>{if(!u)return;const e=s.current;if(!e)return;let a=0,i=0;const o=e.getBoundingClientRect();if(!o)return;const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(a=Fi(e-o.x,0,o.width),l=a/o.width*100,c.current.style.transform=`translateX(${a}px)`):(i=o.height-Fi(r-o.y,0,o.height),l=i/o.height*100,c.current.style.transform=`translateY(${-i}px)`),m(l),null==t||t(Hi(l))},h=({clientX:e,clientY:a})=>{if(d(!1),!c.current)return;const i="horizontal"===n?Fi(e-o.x,0,o.width)/o.width*100:100*(1-Fi(a-o.y,0,o.height)/o.height);c.current.style.transform="",m(i),null==t||t(Hi(i)),null==r||r(Hi(i))},p=()=>{if(d(!1),!c.current)return;const e="horizontal"===n?a/o.width*100:i/o.height*100;c.current.style.transform="",null==t||t(Hi(e)),null==r||r(Hi(e))};return e.addEventListener("pointercancel",p),e.addEventListener("pointermove",l),e.addEventListener("pointerup",h),()=>{e.removeEventListener("pointercancel",p),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",h)}}),[u,n,t]);const p=A((({clientX:e,clientY:r,pointerId:i})=>{if(!s.current||a)return;d(!0),s.current.setPointerCapture(i);const o=s.current.getBoundingClientRect();if(!o)return;if(!c.current)return;let l=0;if("horizontal"===n){const t=Fi(e-o.x,0,o.width);l=t/o.width*100,c.current.style.transform=`translateX(${t}px)`}else{const e=o.height-Fi(r-o.y,0,o.height);l=e/o.height*100,c.current.style.transform=`translateY(${-e}px)`}m(l),null==t||t(Hi(l))}),[n,a]),f=A((n=>{if(a)return;let i=null;"ArrowLeft"===n.code?i=Math.max(e-1,0):"ArrowRight"===n.code?i=Math.min(e+1,100):"ArrowDown"===n.code?i=Math.max(e-1,0):"ArrowUp"===n.code&&(i=Math.min(e+1,100)),null!==i&&(n.stopPropagation(),n.preventDefault(),null==t||t(i),null==r||r(i))}),[e,t,r,n,a]);return N.createElement("div",{ref:G(l,s),tabIndex:0,onKeyDown:f,className:V("x-3deye-slider",n,{disabled:a}),onPointerDown:p,style:o},N.createElement("div",{className:"x-3deye-slider__track"},N.createElement("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${u?h:e}%`:void 0,height:"vertical"===n?`${u?h:e}%`:void 0}})),N.createElement("div",{ref:c,className:V("x-3deye-slider__thumb",{active:u}),style:{touchAction:"none",userSelect:"none",position:"absolute",left:"horizontal"===n?u?0:`${e}%`:"auto",bottom:"vertical"===n?u?0:`${e}%`:"auto"}},N.createElement("div",{className:"x-3deye-slider__label "+(u?"open":"")},i(u?Hi(h):e))))}));Ri.displayName="Slider";const $i=H((({getter:e,setter:t})=>{const[r,n]=k(0),a=D(null),i=Math.floor(100*e());return S((()=>y(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),N.createElement("div",{ref:a,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"}},i,"%")),N.createElement("div",{style:{padding:"0 10px"}},N.createElement(Ri,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})))}));$i.displayName="ProbabilitySlider";var Bi,Ui=(Bi=8,{container:e=>({...e,padding:Bi}),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,width:`calc(100% - ${2*Bi}px)`,marginTop:Bi?0:e.marginTop}),option:e=>({...e,color:"black"}),multiValueRemove:e=>({...e,color:"black"}),placeholder:(e,t)=>({...e,color:t.isFocused?e.color:"hsl(0, 0%, 70%)"})});const 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";var Wi=pr;function qi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(qi.Cache||Wi),r}qi.Cache=Wi;const Gi=qi((()=>{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})),Yi=H((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:a})=>{const i=D(null),o=D(null);return N.createElement("div",{ref:i,onDragStart:t=>{var r;if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",""+e.id),t.dataTransfer.setData("x-3deye/camera",""+e.cameraId),t.dataTransfer.setData("x-3deye/starttime",e.startTime.toISOString()),t.dataTransfer.dropEffect="move";const n=null===(r=i.current)||void 0===r?void 0:r.querySelector("img");if(n){const{x:e,y:r}=n.getBoundingClientRect();t.dataTransfer.setDragImage(n,t.clientX-e,t.clientY-r)}},className:"event-list-item",onClick:()=>null==r?void 0:r(e),onAuxClick:t=>null==n?void 0:n(t,e),onContextMenu:e=>{var t;e.preventDefault(),i.current&&(null===(t=o.current)||void 0===t||t.toggleAt(i.current,{top:e.clientY,left:e.clientX}))},draggable:!0},t,a&&N.createElement(a,{ref:o,data:e}))}));Yi.displayName="EventListItem";const Zi=({className:e,style:t,box:{Top:r,Left:n,Right:a,Bottom:i}})=>N.createElement(N.Fragment,null,N.createElement("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-i)+"%",right:100*(1-a)+"%",...t}}));Zi.displayName="LicensePlateLpr";const Ji=({Type:e,Box:t,Probability:r,width:n,height:a})=>{const{eventSchema:i}=z(hi),o=D(null),{Top:l,Left:s,Right:c,Bottom:u}=t;return F((()=>{if(!n||!a)return;if(!o.current)return;const e=o.current.getBoundingClientRect();let t=(s+c)/2*n-e.width/2,r=l*a-e.height-4;r<0&&(r=u*a+4),t<0&&(t=0),t>n-e.width&&(t=n-e.width),r>a-e.height&&(r=a-e.height),o.current.style.top=`${r}px`,o.current.style.left=`${t}px`})),N.createElement(N.Fragment,null,N.createElement(Zi,{box:t,style:{outline:`2px solid ${i.colorsByFoundObjectType.get(e)}`}}),N.createElement("div",{ref:o,className:"event-list-item__detected-object-label",title:`${e.toLowerCase()} ${Math.floor(100*r)}%`},N.createElement("div",{style:{padding:4,lineHeight:"24px"}},e.toLowerCase()),N.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:i.colorsByFoundObjectType.get(e)}},Math.floor(100*r),"%")))};function Xi({style:e}){return N.createElement("div",{className:"frame",style:e},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"}))}Ji.displayName="DetectedObjectHighlight";const Ki=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:a,thumbHeight:i,width:o,height:l})=>{const{Top:s,Left:c,Right:u,Bottom:d}=t,h=100/a/(u-c),m={top:2},p=D(null);return F((()=>{if(!p.current)return;const e=p.current.getBoundingClientRect();let t=(c+u)/2*o-e.width/2,r=s*l-e.height-4;r<0&&(r=d*l+4),t<0&&(t=0),t>o-e.width&&(t=o-e.width),p.current.style.top=`${r}px`,p.current.style.left=`${t}px`})),c>=1-u?m.left=2:m.right=2,N.createElement(N.Fragment,null,N.createElement("div",{ref:p,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`},N.createElement("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"}},e),N.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"}},Math.floor(100*r),"%")),N.createElement(Zi,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),N.createElement("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:a*(u-c)*h,height:i*(d-s)*h,...m}},N.createElement("img",{style:{width:a*h,height:i*h,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),N.createElement(Xi,null)))};Ki.displayName="FaceHighlight";const Qi=N.memo((({value:e})=>e?N.createElement(N.Fragment,null,e.split("").map(((e,t)=>{const r=e.charCodeAt(0);return r<48||r>57?N.createElement(N.Fragment,{key:t},e):N.createElement("span",{key:t,className:"digit"},e)}))):null));Qi.displayName="LicensePlateNumber";const eo=({detectedObject:e,height:t,width:r,url:n,thumbWidth:a,thumbHeight:i})=>{const{Type:o,Box:{Top:l,Left:s,Right:c,Bottom:u},Probability:d}=e,h=e.Value||e.Number,m=D(null);F((()=>{if(!m.current)return;const e=m.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,a=l*t-e.height-4;a<0&&(a=u*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),m.current.style.top=`${a}px`,m.current.style.left=`${n}px`}));const p={top:2};s>=1-c?p.left=2:p.right=2;const f=100/a/(c-s);return N.createElement(N.Fragment,null,N.createElement("div",{ref:m,className:"event-list-item__license-plate-label trigger",title:`${o.toLowerCase()} ${Math.floor(100*d)}%`},N.createElement("div",{style:{padding:4}},N.createElement(Qi,{value:h})),N.createElement("div",{className:"event-list-item__license-plate-label__caption"},Math.floor(100*d),"%")),N.createElement(Zi,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),N.createElement("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:a*(c-s)*f,height:i*(u-l)*f+16,position:"absolute",...p}},N.createElement("img",{style:{width:a*f,height:i*f,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),N.createElement("div",{className:"plate-number"},N.createElement(Qi,{value:h})),N.createElement(Xi,{style:{height:i*(u-l)*f}})))};eo.displayName="LicensePlateHighlight";const to=mi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4zm-4-8c0-.55.45-1 1-1s1 .45 1 1h-1v1h1v2h-1v1h1v2h-2V5z"}))});to.displayName="ThermostatIcon";const ro=H((({data:e})=>{if("Temperature"!==e.type)return null;let t=Number(e.raw.data);return t=5*(t-32)/9+273.15,N.createElement("div",{className:"event-list-item__temperature"},N.createElement(to,null),(t-273.15).toFixed(1),"°C / ",(9*t/5-459.67).toFixed(1),"°F")}));ro.displayName="Temperature";const no=H((({data:e,cameraNameHidden:t})=>{var r;const i=z(hi),{cameras:o}=i,l=o.loaded&&(null===(r=o.camerasById.get(e.cameraId))||void 0===r?void 0:r.name)||"...";return N.createElement("div",{className:"event-list-item-caption"},N.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",i="";return n(e,new Date)?a(e,new Date)?r=i="HH:mm":a(e,t)?(r="EEE d MMM HH:mm",i="HH:mm"):r=i="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",i="d MMM HH:mm"):r=i="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",i+=":ss"),+e==+t?`${ye(e,r)}`:`${ye(e,r)} - ${ye(t,i)}`}(e.startTime,e.endTime)),t?null:N.createElement("div",{className:"event-list-item__camera-name",title:l},l),+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 a=(e-r)/60;if(a<60)return!r&&t?`${a}m`:`${a}m ${n}s`;const i=Math.floor(a/60);if(a-=60*i,!r&&!a&&t)return`${i}h`;const o=t?`${a}`:`${a}`.padStart(2,"0");return!r&&a&&t?`${i}h ${o}m`:`${i}h ${o}m ${n}s`}(+e.endTime-+e.startTime)),N.createElement(ro,{data:e}))}));no.displayName="EventListItemCaption";const ao=H((({url:e,noPreview:t,width:r})=>N.createElement(N.Fragment,null,e?N.createElement("img",{key:e,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e}):null,N.createElement(W,{radius:r}),t?N.createElement("div",{className:"no-preview-overlay"}):null)));ao.displayName="EventThumbnail";const io=H((({data:e,width:t,height:r,cameraNameHidden:n,onClick:a,onAuxClick:i,menuComponent:o})=>{const l=z(hi),{eventSchema:s}=l,[c,u]=function(e){var t;const[r,n]=k(null),a=z(hi),{cameras:i,thumbnails:o}=a;S((()=>{if(e.thumbnailUrl)return void n(null);const t=o.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{n(e||null)}));return()=>t.unsubscribe()}),[e.id]);let l="",s=!1;return e.thumbnailUrl?l=e.thumbnailUrl:null===r&&i.loaded?(l=(null===(t=i.camerasById.get(e.cameraId))||void 0===t?void 0:t.imageUrl)||"",s=!0):r&&(l=r.url),[l,s]}(e);let d=null,h=null,m=null;if(e.detectedObjects.length){let n,a;const{ThumbnailSize:i}=JSON.parse(e.raw.data);i&&(n=i.Width,a=i.Height),d=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)).map(((e,n)=>N.createElement(Ji,{key:n,...e,height:r,width:t}))),h=e.detectedObjects.filter((({Type:e})=>"LicensePlate"===e)).map(((e,i)=>N.createElement(eo,{key:i,detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:a,url:c})))}if(e.faces){const{Width:n,Height:a}=JSON.parse(e.raw.data).ThumbnailSize;m=e.faces.map(((e,i)=>N.createElement(Ki,{key:i,face:e,url:c,thumbWidth:n,thumbHeight:a,width:t,height:r})))}return N.createElement(Yi,{onClick:a,onAuxClick:i,data:e,width:t,height:r,cameraNameHidden:n,menuComponent:o},N.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},N.createElement(ao,{url:c,noPreview:u,width:t}),d,h,m,e.acknowledged?N.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,N.createElement(no,{data:e,cameraNameHidden:n})))}));io.displayName="EventItem";class oo extends N.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{hasError:!1}})}componentDidCatch(e,t){this.setState({hasError:!0}),X.withScope((r=>{Object.keys(t).forEach((e=>{r.setExtra(e,t[e])})),X.captureException(e)})),console.error(e),console.log(t)}render(){if(!this.state.hasError)return this.props.children;const{style:e,children:t,...r}=this.props;return N.createElement("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r},N.createElement("h1",null,"Oops. Something went wrong"),N.createElement("div",null,"We've been notified about this problem"),N.createElement(Di,{onClick:()=>this.setState({hasError:!1})},"retry"))}}const lo=H((({store:e,captionHeight:t=0,minColumnWidth:r=180,onEventClick:n,onEventAuxClick:a,eventRenderer:i=(({data:e,width:t,height:r})=>N.createElement(io,{data:e,cameraNameHidden:!1,onClick:n,onAuxClick:a,width:t,height:r}))})=>{const o=D(),l=R((()=>({rowIndex:0,columnIndex:0,update(e,t){this.rowIndex=e,this.columnIndex=t},reset(){this.rowIndex=0,this.columnIndex=0}})));if(e.error&&!e.data.length)return l.reset(),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(Di,{onClick:e.reload},"Retry")));if(e.loading)return l.reset(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement(Vi,null));if(!e.data.length)return l.reset(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},ve.t("noEventsFound"));const s=(t,r)=>(e.loadMore(),Promise.resolve()),c=({scrollTop:t})=>{"disabled"!==e.liveUpdateMode&&e.setLiveUpdateMode(t>=1||e.pendingData.length?"manual":"auto")};return N.createElement(Y,null,(({width:n,height:a})=>N.createElement($,null,(()=>{var u;const d=Math.floor(n/r)||1,h=n/d/16*9+t,m=d*Math.floor(a/h)>=e.data.length?0:Gi(),p=Math.max(1,Math.floor((n-m)/r)),f=Math.ceil(e.data.length/p),b=(n-m-2*(p-1))/p,g=b/16*9+t;return N.createElement(N.Fragment,null,N.createElement(Z,{isItemLoaded:e=>e<f,itemCount:f+((null===(u=e.pageInfo)||void 0===u?void 0:u.haveMore)?1:0),loadMoreItems:s},(({onItemsRendered:t,ref:r})=>{var s;return N.createElement(J,{key:`${n}x${a}`,ref:G(o,r),columnCount:p,columnWidth:e=>b+(e?2:0),height:a,width:n,rowCount:f+((null===(s=e.pageInfo)||void 0===s?void 0:s.haveMore)||e.error?1:0),rowHeight:e=>g+(e?2:0),initialScrollTop:g*l.rowIndex,onScroll:c,onItemsRendered:({visibleRowStartIndex:e,visibleColumnStartIndex:r,visibleRowStopIndex:n,overscanRowStopIndex:a,overscanRowStartIndex:i})=>{l.update(e,r),t({overscanStartIndex:i,overscanStopIndex:a,visibleStartIndex:e,visibleStopIndex:n})}},(t=>({columnIndex:r,rowIndex:n,style:a})=>N.createElement($,null,(()=>{var o,l;const s=n*t+r,c=e.data[s];return a={...a,left:a.left+(r?2:0),width:a.width-(r?2:0),top:a.top+(n?2:0),height:a.height-(n?2:0)},s===e.data.length?e.error?N.createElement("div",{style:a},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(Di,{onClick:e.loadMore},"Retry")))):(null===(o=e.pageInfo)||void 0===o?void 0:o.haveMore)?N.createElement("div",{style:a},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement(Vi,{size:32}))):N.createElement("div",{style:a}):!c&&(null===(l=e.pageInfo)||void 0===l?void 0:l.haveMore)?N.createElement("div",{style:a}):c?N.createElement("div",{style:a},N.createElement(oo,null,i({data:c,width:a.width,height:a.height}))):N.createElement("div",{style:a})})))(p))})),N.createElement($,null,(()=>e.pendingData.length?N.createElement("div",{style:{position:"absolute",top:0,left:0,right:m,pointerEvents:"none",textAlign:"center",padding:8}},N.createElement(Di,{className:"x-3deye-button--overlay",style:{background:"rgba(0, 0, 0, 0.75)",padding:"8px 16px",backdropFilter:"blur(2px)",borderRadius:32,pointerEvents:"auto"},onClick:()=>{var t;e.flushUpdates(),null===(t=o.current)||void 0===t||t.scrollTo({scrollLeft:0,scrollTop:0}),e.setLiveUpdateMode("auto")}},ve.t("showEvents",{count:e.pendingData.length}))):null)))}))))}));lo.displayName="EventGrid";const so=e=>{const{className:t,children:r,...n}=e;return N.createElement("div",{className:V("x-3deye-button-group",t),...n},r)},co=e=>`scale(${e})`,uo=({children:e,from:t,style:r})=>{const n=K({opacity:1,from:{opacity:0},config:{tension:300}});return N.createElement(Q.div,{style:{...r,...n,transform:n.opacity.to(co),transformOrigin:`${t||"bottom"} center`,width:"max-content"}},e)},ho=document.body;class mo 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(){ho.appendChild(this.el)}componentWillUnmount(){ho.removeChild(this.el)}render(){return ee.createPortal(this.props.children,this.el)}}const po=({width:e,height:t,color:r,position:n="top",style:a})=>{const i=[0,"top"===n?t:0],o=[e,i[1]],l=[e/2,t-i[1]],s=[e/4,t*("top"===n?3:1)/4],c=[.325*e,t-i[1]],u=[e-c[0],c[1]],d=[e-s[0],s[1]],h=e=>e.join(","),m=`M ${h(i)} C ${h(s)} ${h(c)} ${h(l)} ${h(u)} ${h(d)} ${h(o)} Z`;return N.createElement("svg",{className:"tip",style:a,width:e,height:t,fill:r},N.createElement("path",{d:m}))};class fo 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:a,height:i,width:o}=t.getBoundingClientRect();let l="calc(50% - 12px)",s="auto";const c=this.popoverRef.current;let u="bottom"===this.props.placement?a+10:r-c.clientHeight-10,d=n+o/2-c.clientWidth/2,h="bottom"===this.props.placement?"top":"bottom";u<0&&(u=a+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=i+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:a}=this.state,{className:i,opened:o,disablePortal:l,disableAnimation:s}=this.props,c={position:"absolute",left:a};"bottom"===n?c.bottom=-8:c.top=-8;const u=V(i,"x-3deye-popover-body");let d=null;if(o){const a={zIndex:l?1:100000001,position:"absolute",top:e,bottom:r,left:t},i=N.createElement("div",{className:u,ref:this.popoverRef},this.props.children,N.createElement(po,{width:24,height:8,position:n,color:"white",style:c}));d=s?N.createElement("div",{style:a},i):N.createElement(uo,{from:n,style:a},i)}const h=N.cloneElement(this.props.target,{ref:this.targetRef});if(l)return N.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},h,d);const m=o&&N.createElement(mo,null,d);return N.createElement(N.Fragment,null,h,m)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}const bo=H((({store:e})=>{const[t,r]=k(!1),{cameras:n}=z(hi),{date:l,setDate:s,cameraId:c}=e,u=c?n.camerasById.get(c):void 0,d=i(new Date,1),h=l&&a(l,new Date),m=l&&a(l,d),p=u?o(new Date,u.archiveDuration):new Date,f=()=>r(!1);return N.createElement(so,null,N.createElement(Di,{className:V({"button-selected":h}),onClick:()=>s(new Date)},ve.t("today")),c&&!a(new Date,p)?N.createElement(Di,{className:V({"button-selected":m}),onClick:()=>s(d)},ve.t("yesterday")):null,l&&N.createElement(fo,{target:N.createElement(Di,{className:"date-button",onClick:()=>r(!t)},ye(l,"EEE dd MMM")),opened:t,onCloseRequest:f,disableAnimation:!0},N.createElement(te,{selected:l,onChange:s,dateFormat:"EEE dd MMM",inline:!0,minDate:p,maxDate:new Date}),N.createElement("div",{style:{display:"flex"}},N.createElement(Di,{style:{flex:1},onClick:f,variant:"filled"},ve.t("button.ok")))))}));bo.displayName="DateSelector";const go=H((()=>{const e=z(hi),t=D(null),r=D(null),n=D(null),a=D([]),[i,o]=k(0),l=100,s=20,c=20,u=30,d=20,{eventSearch:h}=e.eventSearchPanel,{filteredPeopleCountingData:m}=h,{brushFilter:p}=h,f=p?a.current.filter((e=>e.x0>=+p[0]&&e.x1<=+p[1])).reduce(((e,t)=>e+t.length),0):null;return S((()=>{const e=new pe((e=>{for(const t of e){const e=t.contentRect.width;o(e)}}));return e.observe(t.current),()=>e.disconnect()}),[]),S((()=>{const e=ie(r.current);if(!i)return;m.forEach((e=>e.timestamp=new Date(e.TimeStamp)));const t=re(m,(e=>e.timestamp)),o=se(ce.offset(t[0],-1),ce.offset(t[1],1)),p=he().extent([[d,s],[i-c,l-u]]).on("end",(function({selection:e,sourceEvent:t}){if(!t)return;if(!e)return void h.setBrushFilter(null);const r=ue.every((+a.current[0].x1-+a.current[0].x0)/6e4||30);let[n,i]=e.map((e=>r.round(f.invert(e))));if(+n==+i&&(n=r.floor(f.invert(e[0])),i=r.ceil(f.invert(e[1])),+n==+i))return ie(this).transition().call(p.move,null),void h.setBrushFilter(null);h.setBrushFilter([n,i]),ie(this).transition().call(p.move,i>n?[n,i].map(f):null)}));n.current=p;const f=oe().domain(re(o)).nice().range([d,i-c]);a.current=m.length?ne().value((e=>e.timestamp)).domain(f.domain()).thresholds(f.ticks(24))(m):[];const b=le().domain([0,ae(a.current,(e=>e.length))]).nice().range([l-u,s]),g=e.select(".bars").selectAll(".bar").data(a.current);g.exit().remove();const v=g.enter().append("g").attr("class","bar");if(v.append("rect").attr("x",(e=>f(e.x0)+1)).attr("width",(e=>Math.max(0,f(e.x1)-f(e.x0)-1))).attr("y",(e=>b(e.length))).attr("height",(e=>b(0)-b(e.length))),g.select("rect").attr("x",(e=>f(e.x0)+1)).attr("width",(e=>Math.max(0,f(e.x1)-f(e.x0)-1))).attr("y",(e=>b(e.length))).attr("height",(e=>b(0)-b(e.length))),v.append("text").attr("dy",".75em").attr("y",(e=>b(e.length)-10)).attr("x",(e=>f(e.x0)+1+Math.max(0,f(e.x1)-f(e.x0)-1)/2)).attr("text-anchor","middle").text((function(e){return e.length?e.length:""})),g.select("text").attr("dy",".75em").attr("y",(e=>b(e.length)-10)).attr("x",(e=>f(e.x0)+1+Math.max(0,f(e.x1)-f(e.x0)-1)/2)).attr("text-anchor","middle").text((e=>e.length?e.length:"")),m.length){const[t,r]=f.domain(),[n,a]=f.range(),i=(a-n)/(+r-+t)*3600*1e3,o=30,l=de(f).ticks(ce.every(1)).tickFormat((e=>i>=o?me("%H:%M")(e):e.getHours()%(Math.floor(o/i)+1)?"":me("%H:%M")(e)));l.scale(f),e.select(".x-axis").attr("transform","translate(0,70)").call(l),e.select(".brush").call(p),h.brushFilter&&e.select(".brush").call(p.move,h.brushFilter.map(f))}else e.select(".x-axis").html(""),e.select(".brush").call(p),e.select(".brush").html("").call(p.move,null)}),[i,m]),S((()=>{n.current&&(h.brushFilter||ie(r.current).select(".brush").call(n.current.move,null))}),[h.brushFilter]),N.createElement("div",{ref:t},N.createElement("div",{style:{paddingLeft:10,paddingRight:10,display:"flex"}},ve.t("peopleCounting"),N.createElement("div",{style:{marginLeft:"auto"}},null===f?null:N.createElement(Ii,{label:ve.t("selected")},N.createElement("span",null,f)),null===f?null:"/",N.createElement(Ii,{label:ve.t("total")},N.createElement("span",null,m.length)))),N.createElement("svg",{className:"people-histogram",ref:r,width:i,height:l,viewBox:`0 0 ${i} 100`},N.createElement("g",{className:"bars"}),N.createElement("g",{className:"x-axis"}),N.createElement("g",{className:"brush"})))}));go.displayName="PeopleHistogram";const vo=e=>{const{children:t,innerProps:r,...n}=e,{Option:a}=U,{data:i}=e,o={...r,style:{display:"flex",alignItems:"center",width:"auto"}};return N.createElement(a,{innerProps:o,...n},N.createElement(Ci,{data:i}),N.createElement("div",{style:{marginLeft:4}},t))},yo=H((({store:e,onEventClick:t})=>{if(!e)return null;const{filters:r,setFilters:n}=e,{foundObjectTypesForSelect:a}=e.eventSchema;return N.createElement(N.Fragment,null,N.createElement(bo,{store:e}),N.createElement("div",{style:{zIndex:2}},N.createElement(B,{closeMenuOnSelect:!1,isMulti:!0,onChange:n,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:a,placeholder:ve.t("selectObjectType"),value:r,components:{MultiValueLabel:ji,Option:vo},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}})),N.createElement($i,{getter:e.getProbabilityThreshold,setter:e.setProbabilityThreshold}),e.filters.length?N.createElement(zi,{value:e.colors,toggle:e.toggleColor,clear:e.clearColors}):null,e.analyticsEnabled?N.createElement(go,null):null,N.createElement("div",{style:{flex:1}},N.createElement(lo,{store:e.eventsLoader,eventRenderer:({data:e,width:r,height:n})=>N.createElement(io,{data:e,cameraNameHidden:!0,onClick:t,width:r,height:n})})))}));yo.displayName="EventSearch";const wo=e=>{var t;const r=null!==(t=z(M))&&void 0!==t?t:I;return N.createElement(hi.Provider,{value:r},N.createElement(yo,{...e}))};var Eo;wo.displayName="EventSearch",(Eo={resources:{en:{translation:fe}}})&&Object.assign(ge,Eo),s(ve.init(ge));const xo=(e=I)=>{const t=new di(e.eventSchema,e.events,e.notification);return t.initWith(e.api),t};export{xo as createEventSearchStore,wo as default};
1
+ import{format as e,startOfDay as t,endOfDay as r,isSameYear as n,isSameDay as a,subDays as i,subHours as o}from"date-fns/esm";import l from"i18next";import{of as s,from as c,Observable as d,Subscription as u,throwError as h,EMPTY as m}from"rxjs";import{computed as p,makeObservable as f,observable as b,action as g,runInAction as v,reaction as y}from"mobx";import{mergeMap as E,catchError as w,switchMap as x,map as C,exhaustMap as j,distinctUntilChanged as O,share as T}from"rxjs/operators";import M from"earcut";import{subHours as P}from"date-fns";import{AppContext as _,app as L}from"@3deye-toolkit/core";import N,{useState as I,cloneElement as D,useRef as k,useEffect as S,useCallback as z,useContext as A,useLayoutEffect as F}from"react";import{useElementSize as B}from"@mantine/hooks";import{observer as R}from"mobx-react-lite";import H,{components as $}from"react-select";import U from"clsx";import V from"react-ink";import{useFloating as W,offset as G,flip as q,shift as Y,autoUpdate as Z,useInteractions as J,useHover as X,useFocus as K,useRole as Q,useDismiss as ee,FloatingPortal as te,arrow as re,FloatingFocusManager as ne}from"@floating-ui/react-dom-interactions";import ae from"@seznam/compose-react-refs";import*as ie from"@sentry/browser";import oe from"react-datepicker";import{extent as le,bin as se,max as ce}from"d3-array";import{select as de}from"d3-selection";import{scaleTime as ue,scaleLinear as he}from"d3-scale";import{timeHours as me,timeHour as pe,timeMinute as fe}from"d3-time";import{axisBottom as be}from"d3-axis";import{brushX as ge}from"d3-brush";import{timeFormat as ve}from"d3-time-format";import ye from"resize-observer-polyfill";var Ee={eventSearchRequestError:{peopleCounting:"Sorry, an error occured during event search. Couldn't fetch people counting data. Please try again later",heatmap:"Sorry, an error occured during event search. Couldn't fetch heatmap. Please try again later"},selectObjectType:"Select object type",showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events",noEventsFound:"no events found",today:"today",yesterday:"yesterday",button:{ok:"Ok"},peopleCounting:"People Counting",selected:"selected",total:"total"};const we=new Map,xe={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},Ce=l.createInstance();function je(t,r){const n=we.get(Ce.language);return e(t,r,{locale:n})}var Oe,Te;function Me(e,t=!1){const r=p(e);return new d((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"}(Oe||(Oe={})),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"}(Te||(Te={}));var Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var _e=function(){this.__data__=[],this.size=0};var Le=function(e,t){return e===t||e!=e&&t!=t},Ne=Le;var Ie=function(e,t){for(var r=e.length;r--;)if(Ne(e[r][0],t))return r;return-1},De=Ie,ke=Array.prototype.splice;var Se=function(e){var t=this.__data__,r=De(t,e);return!(r<0)&&(r==t.length-1?t.pop():ke.call(t,r,1),--this.size,!0)},ze=Ie;var Ae=function(e){var t=this.__data__,r=ze(t,e);return r<0?void 0:t[r][1]},Fe=Ie;var Be=Ie;var Re=function(e,t){var r=this.__data__,n=Be(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},He=_e,$e=Se,Ue=Ae,Ve=function(e){return Fe(this.__data__,e)>-1},We=Re;function Ge(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])}}Ge.prototype.clear=He,Ge.prototype.delete=$e,Ge.prototype.get=Ue,Ge.prototype.has=Ve,Ge.prototype.set=We;var qe=Ge,Ye=qe;var Ze=function(){this.__data__=new Ye,this.size=0};var Je=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Xe=function(e){return this.__data__.get(e)};var Ke=function(e){return this.__data__.has(e)},Qe="object"==typeof Pe&&Pe&&Pe.Object===Object&&Pe,et=Qe,tt="object"==typeof self&&self&&self.Object===Object&&self,rt=et||tt||Function("return this")(),nt=rt.Symbol,at=nt,it=Object.prototype,ot=it.hasOwnProperty,lt=it.toString,st=at?at.toStringTag:void 0;var ct=function(e){var t=ot.call(e,st),r=e[st];try{e[st]=void 0;var n=!0}catch(e){}var a=lt.call(e);return n&&(t?e[st]=r:delete e[st]),a},dt=Object.prototype.toString;var ut=ct,ht=function(e){return dt.call(e)},mt=nt?nt.toStringTag:void 0;var pt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":mt&&mt in Object(e)?ut(e):ht(e)};var ft=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},bt=pt,gt=ft;var vt,yt=function(e){if(!gt(e))return!1;var t=bt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Et=rt["__core-js_shared__"],wt=(vt=/[^.]+$/.exec(Et&&Et.keys&&Et.keys.IE_PROTO||""))?"Symbol(src)_1."+vt:"";var xt=function(e){return!!wt&&wt in e},Ct=Function.prototype.toString;var jt=function(e){if(null!=e){try{return Ct.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Ot=yt,Tt=xt,Mt=ft,Pt=jt,_t=/^\[object .+?Constructor\]$/,Lt=Function.prototype,Nt=Object.prototype,It=Lt.toString,Dt=Nt.hasOwnProperty,kt=RegExp("^"+It.call(Dt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var St=function(e){return!(!Mt(e)||Tt(e))&&(Ot(e)?kt:_t).test(Pt(e))},zt=function(e,t){return null==e?void 0:e[t]};var At=function(e,t){var r=zt(e,t);return St(r)?r:void 0},Ft=At(rt,"Map"),Bt=At(Object,"create"),Rt=Bt;var Ht=function(){this.__data__=Rt?Rt(null):{},this.size=0};var $t=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ut=Bt,Vt=Object.prototype.hasOwnProperty;var Wt=function(e){var t=this.__data__;if(Ut){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Vt.call(t,e)?t[e]:void 0},Gt=Bt,qt=Object.prototype.hasOwnProperty;var Yt=function(e){var t=this.__data__;return Gt?void 0!==t[e]:qt.call(t,e)},Zt=Bt;var Jt=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Zt&&void 0===t?"__lodash_hash_undefined__":t,this},Xt=Ht,Kt=$t,Qt=Wt,er=Yt,tr=Jt;function rr(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])}}rr.prototype.clear=Xt,rr.prototype.delete=Kt,rr.prototype.get=Qt,rr.prototype.has=er,rr.prototype.set=tr;var nr=rr,ar=qe,ir=Ft;var or=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var lr=function(e,t){var r=e.__data__;return or(t)?r["string"==typeof t?"string":"hash"]:r.map},sr=lr;var cr=lr;var dr=lr;var ur=lr;var hr=function(e,t){var r=ur(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},mr=function(){this.size=0,this.__data__={hash:new nr,map:new(ir||ar),string:new nr}},pr=function(e){var t=sr(this,e).delete(e);return this.size-=t?1:0,t},fr=function(e){return cr(this,e).get(e)},br=function(e){return dr(this,e).has(e)},gr=hr;function vr(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])}}vr.prototype.clear=mr,vr.prototype.delete=pr,vr.prototype.get=fr,vr.prototype.has=br,vr.prototype.set=gr;var yr=vr,Er=qe,wr=Ft,xr=yr;var Cr=function(e,t){var r=this.__data__;if(r instanceof Er){var n=r.__data__;if(!wr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new xr(n)}return r.set(e,t),this.size=r.size,this},jr=qe,Or=Ze,Tr=Je,Mr=Xe,Pr=Ke,_r=Cr;function Lr(e){var t=this.__data__=new jr(e);this.size=t.size}Lr.prototype.clear=Or,Lr.prototype.delete=Tr,Lr.prototype.get=Mr,Lr.prototype.has=Pr,Lr.prototype.set=_r;var Nr=Lr;var Ir=yr,Dr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},kr=function(e){return this.__data__.has(e)};function Sr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Ir;++t<r;)this.add(e[t])}Sr.prototype.add=Sr.prototype.push=Dr,Sr.prototype.has=kr;var zr=Sr,Ar=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},Fr=function(e,t){return e.has(t)};var Br=function(e,t,r,n,a,i){var o=1&r,l=e.length,s=t.length;if(l!=s&&!(o&&s>l))return!1;var c=i.get(e),d=i.get(t);if(c&&d)return c==t&&d==e;var u=-1,h=!0,m=2&r?new zr:void 0;for(i.set(e,t),i.set(t,e);++u<l;){var p=e[u],f=t[u];if(n)var b=o?n(f,p,u,t,e,i):n(p,f,u,e,t,i);if(void 0!==b){if(b)continue;h=!1;break}if(m){if(!Ar(t,(function(e,t){if(!Fr(m,t)&&(p===e||a(p,e,r,n,i)))return m.push(t)}))){h=!1;break}}else if(p!==f&&!a(p,f,r,n,i)){h=!1;break}}return i.delete(e),i.delete(t),h};var Rr=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};var Hr=rt.Uint8Array,$r=Le,Ur=Br,Vr=Rr,Wr=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},Gr=nt?nt.prototype:void 0,qr=Gr?Gr.valueOf:void 0;var Yr=function(e,t,r,n,a,i,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||!i(new Hr(e),new Hr(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return $r(+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=Vr;case"[object Set]":var s=1&n;if(l||(l=Wr),e.size!=t.size&&!s)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var d=Ur(l(e),l(t),n,a,i,o);return o.delete(e),d;case"[object Symbol]":if(qr)return qr.call(e)==qr.call(t)}return!1};var Zr=function(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e},Jr=Array.isArray,Xr=Zr,Kr=Jr;var Qr=function(e,t,r){var n=t(e);return Kr(e)?n:Xr(n,r(e))};var en=function(e,t){for(var r=-1,n=null==e?0:e.length,a=0,i=[];++r<n;){var o=e[r];t(o,r,e)&&(i[a++]=o)}return i},tn=function(){return[]},rn=Object.prototype.propertyIsEnumerable,nn=Object.getOwnPropertySymbols,an=nn?function(e){return null==e?[]:(e=Object(e),en(nn(e),(function(t){return rn.call(e,t)})))}:tn;var on=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var ln=function(e){return null!=e&&"object"==typeof e},sn=pt,cn=ln;var dn=function(e){return cn(e)&&"[object Arguments]"==sn(e)},un=ln,hn=Object.prototype,mn=hn.hasOwnProperty,pn=hn.propertyIsEnumerable,fn=dn(function(){return arguments}())?dn:function(e){return un(e)&&mn.call(e,"callee")&&!pn.call(e,"callee")},bn={exports:{}};var gn=function(){return!1};!function(e,t){var r=rt,n=gn,a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,o=i&&i.exports===a?r.Buffer:void 0,l=(o?o.isBuffer:void 0)||n;e.exports=l}(bn,bn.exports);var vn=/^(?:0|[1-9]\d*)$/;var yn=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&vn.test(e))&&e>-1&&e%1==0&&e<t};var En=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},wn=pt,xn=En,Cn=ln,jn={};jn["[object Float32Array]"]=jn["[object Float64Array]"]=jn["[object Int8Array]"]=jn["[object Int16Array]"]=jn["[object Int32Array]"]=jn["[object Uint8Array]"]=jn["[object Uint8ClampedArray]"]=jn["[object Uint16Array]"]=jn["[object Uint32Array]"]=!0,jn["[object Arguments]"]=jn["[object Array]"]=jn["[object ArrayBuffer]"]=jn["[object Boolean]"]=jn["[object DataView]"]=jn["[object Date]"]=jn["[object Error]"]=jn["[object Function]"]=jn["[object Map]"]=jn["[object Number]"]=jn["[object Object]"]=jn["[object RegExp]"]=jn["[object Set]"]=jn["[object String]"]=jn["[object WeakMap]"]=!1;var On=function(e){return Cn(e)&&xn(e.length)&&!!jn[wn(e)]};var Tn=function(e){return function(t){return e(t)}},Mn={exports:{}};!function(e,t){var r=Qe,n=t&&!t.nodeType&&t,a=n&&e&&!e.nodeType&&e,i=a&&a.exports===n&&r.process,o=function(){try{var e=a&&a.require&&a.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o}(Mn,Mn.exports);var Pn=On,_n=Tn,Ln=Mn.exports,Nn=Ln&&Ln.isTypedArray,In=Nn?_n(Nn):Pn,Dn=on,kn=fn,Sn=Jr,zn=bn.exports,An=yn,Fn=In,Bn=Object.prototype.hasOwnProperty;var Rn=function(e,t){var r=Sn(e),n=!r&&kn(e),a=!r&&!n&&zn(e),i=!r&&!n&&!a&&Fn(e),o=r||n||a||i,l=o?Dn(e.length,String):[],s=l.length;for(var c in e)!t&&!Bn.call(e,c)||o&&("length"==c||a&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||An(c,s))||l.push(c);return l},Hn=Object.prototype;var $n=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Hn)};var Un=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Vn=$n,Wn=Un,Gn=Object.prototype.hasOwnProperty;var qn=yt,Yn=En;var Zn=function(e){return null!=e&&Yn(e.length)&&!qn(e)},Jn=Rn,Xn=function(e){if(!Vn(e))return Wn(e);var t=[];for(var r in Object(e))Gn.call(e,r)&&"constructor"!=r&&t.push(r);return t},Kn=Zn;var Qn=Qr,ea=an,ta=function(e){return Kn(e)?Jn(e):Xn(e)};var ra=function(e){return Qn(e,ta,ea)},na=Object.prototype.hasOwnProperty;var aa=function(e,t,r,n,a,i){var o=1&r,l=ra(e),s=l.length;if(s!=ra(t).length&&!o)return!1;for(var c=s;c--;){var d=l[c];if(!(o?d in t:na.call(t,d)))return!1}var u=i.get(e),h=i.get(t);if(u&&h)return u==t&&h==e;var m=!0;i.set(e,t),i.set(t,e);for(var p=o;++c<s;){var f=e[d=l[c]],b=t[d];if(n)var g=o?n(b,f,d,t,e,i):n(f,b,d,e,t,i);if(!(void 0===g?f===b||a(f,b,r,n,i):g)){m=!1;break}p||(p="constructor"==d)}if(m&&!p){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(m=!1)}return i.delete(e),i.delete(t),m},ia=At(rt,"DataView"),oa=Ft,la=At(rt,"Promise"),sa=At(rt,"Set"),ca=At(rt,"WeakMap"),da=pt,ua=jt,ha=ua(ia),ma=ua(oa),pa=ua(la),fa=ua(sa),ba=ua(ca),ga=da;(ia&&"[object DataView]"!=ga(new ia(new ArrayBuffer(1)))||oa&&"[object Map]"!=ga(new oa)||la&&"[object Promise]"!=ga(la.resolve())||sa&&"[object Set]"!=ga(new sa)||ca&&"[object WeakMap]"!=ga(new ca))&&(ga=function(e){var t=da(e),r="[object Object]"==t?e.constructor:void 0,n=r?ua(r):"";if(n)switch(n){case ha:return"[object DataView]";case ma:return"[object Map]";case pa:return"[object Promise]";case fa:return"[object Set]";case ba:return"[object WeakMap]"}return t});var va=Nr,ya=Br,Ea=Yr,wa=aa,xa=ga,Ca=Jr,ja=bn.exports,Oa=In,Ta="[object Object]",Ma=Object.prototype.hasOwnProperty;var Pa=function(e,t,r,n,a,i){var o=Ca(e),l=Ca(t),s=o?"[object Array]":xa(e),c=l?"[object Array]":xa(t),d=(s="[object Arguments]"==s?Ta:s)==Ta,u=(c="[object Arguments]"==c?Ta:c)==Ta,h=s==c;if(h&&ja(e)){if(!ja(t))return!1;o=!0,d=!1}if(h&&!d)return i||(i=new va),o||Oa(e)?ya(e,t,r,n,a,i):Ea(e,t,s,r,n,a,i);if(!(1&r)){var m=d&&Ma.call(e,"__wrapped__"),p=u&&Ma.call(t,"__wrapped__");if(m||p){var f=m?e.value():e,b=p?t.value():t;return i||(i=new va),a(f,b,r,n,i)}}return!!h&&(i||(i=new va),wa(e,t,r,n,a,i))},_a=ln;var La=function e(t,r,n,a,i){return t===r||(null==t||null==r||!_a(t)&&!_a(r)?t!=t&&r!=r:Pa(t,r,n,a,e,i))},Na=La;var Ia=function(e,t){return Na(e,t)};class Da{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 ka=Le,Sa=Zn,za=yn,Aa=ft;var Fa=/\s/;var Ba=function(e){for(var t=e.length;t--&&Fa.test(e.charAt(t)););return t},Ra=/^\s+/;var Ha=pt,$a=ln;var Ua=function(e){return e?e.slice(0,Ba(e)+1).replace(Ra,""):e},Va=ft,Wa=function(e){return"symbol"==typeof e||$a(e)&&"[object Symbol]"==Ha(e)},Ga=/^[-+]0x[0-9a-f]+$/i,qa=/^0b[01]+$/i,Ya=/^0o[0-7]+$/i,Za=parseInt;var Ja=function(e){if("number"==typeof e)return e;if(Wa(e))return NaN;if(Va(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Va(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ua(e);var r=qa.test(e);return r||Ya.test(e)?Za(e.slice(2),r?2:8):Ga.test(e)?NaN:+e};var Xa=function(e){return e?Infinity===(e=Ja(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var Ka=function(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(a);++n<a;)i[n]=e[n+t];return i},Qa=function(e,t,r){if(!Aa(r))return!1;var n=typeof t;return!!("number"==n?Sa(r)&&za(t,r.length):"string"==n&&t in r)&&ka(r[t],e)},ei=function(e){var t=Xa(e),r=t%1;return t==t?r?t-r:t:0},ti=Math.ceil,ri=Math.max;var ni=function(e,t,r){t=(r?Qa(e,t,r):void 0===t)?1:ri(ei(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var a=0,i=0,o=Array(ti(n/t));a<n;)o[i++]=Ka(e,a,a+=t);return o};const ai=([e,t],[r,n],[a,i])=>{const o=(n-t)*(a-r)-(r-e)*(i-n);return 0===o?0:o>0?1:2},ii=([e,t],[r,n],[a,i])=>r<=Math.max(e,a)&&r>=Math.min(e,a)&&n<=Math.max(t,i)&&n>=Math.min(t,i),oi=(e,t,r)=>!(e<r.x||t<r.y||e>r.x+r.width||t>r.y+r.height),li=(e,t,r)=>{const n=r.y1*r.x3-r.x1*r.y3+(r.y3-r.y1)*e+(r.x1-r.x3)*t,a=r.x1*r.y2-r.y1*r.x2+(r.y1-r.y2)*e+(r.x2-r.x1)*t;if(n<0!=a<0)return!1;const i=-r.y2*r.x3+r.y1*(r.x3-r.x2)+r.x1*(r.y2-r.y3)+r.x2*r.y3;return i<0?n<=0&&n+a>=i:n>=0&&n+a<=i},si=(e,t)=>{if(oi(t.x1,t.y1,e))return!0;if(oi(t.x2,t.y2,e))return!0;if(oi(t.x3,t.y3,e))return!0;if(li(e.x,e.y,t))return!0;if(li(e.x+e.width,e.y,t))return!0;if(li(e.x+e.width,e.y+e.height,t))return!0;if(li(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 a=ai(e,t,r),i=ai(e,t,n),o=ai(r,n,e),l=ai(r,n,t);return a!==i&&o!==l||!(0!==a||!ii(e,r,t))||!(0!==i||!ii(e,n,t))||!(0!==o||!ii(r,e,n))||!(0!==l||!ii(r,t,n))})(t,e)))))},ci=(e,t)=>{const r=e.map((({x:e,y:t})=>[e,t]));return ni(M(r.flat()),3).some((r=>si(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})))},di=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class ui{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}),f(this,{id:p,startTime:p,endTime:p,acknowledged:p,isLive:p,raw:b.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=di.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!di.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class hi extends Da{constructor(e,t="events"){super(),Object.defineProperty(this,"eventsStore",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:t}),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,"regions",{enumerable:!0,configurable:!0,writable:!0,value:null}),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,"setLiveUpdateMode",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.liveUpdateMode=e}}),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:a,cameras:i,regions:o})=>{var l;return this.api.cameras.GetSensorEventsPage({sensorIds:i,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==a?void 0:a.nextPageToken},n,null!==(l=null==o?void 0:o.map(this.regionToWktPolygon))&&void 0!==l?l:[]).pipe(E((e=>e.success?s({events:e.resultItems,pageInfo:e.pageInfo}):h((()=>e.error)))),w((e=>(console.error(e),this.error=e,s({events:[],pageInfo:null})))))}}),Object.defineProperty(this,"toObjects",{enumerable:!0,configurable:!0,writable:!0,value:e=>"events"===this.mode?[{data:e,objectIdx:-1}]:e.detectedObjects.map(((e,t)=>{var r,n;return this.detectedObjects.length&&!this.detectedObjects.includes(e.Type)||this.colors.size&&!(null===(r=e.Colors)||void 0===r?void 0:r.some((e=>this.colors.has(e.Color))))||null!==this.probabilityThreshold&&e.Probability<this.probabilityThreshold||(null===(n=this.regions)||void 0===n?void 0:n.length)&&!this.regions.some((t=>ci(t,this.boxToAabb(e.Box))))?-1:t})).filter((e=>-1!==e)).map((t=>({data:e,objectIdx:t})))}),f(this,{data:b.ref,cameras:b.struct,detectedObjects:b.struct,from:b,to:b,sortDirection:b,probabilityThreshold:b,pendingData:b.ref,liveUpdateMode:b,setLiveUpdateMode:g,updateTrigger:b,colors:b.ref,flushUpdates:g,pageInfo:b.ref,isLive:p,loading:b,loadMoreTrigger:b,retryTrigger:b,error:b.ref,loadMore:g,filterJson:p})}get isLive(){return"DESC"===this.sortDirection&&!this.to}get totalCount(){return this.data.length}get filterJson(){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=Me((()=>({from:this.from?+this.from:void 0,to:this.to?+this.to:void 0,sortDirection:this.sortDirection,filter:this.filterJson,cameraFilters:this.cameras,regions:this.regions})),!0);this.disposables.push(e.pipe(x((e=>Me((()=>this.retryTrigger),!0).pipe(C((()=>e))))),x((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:a,regions:i})=>(v((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[],this.pendingData=[]})),this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:a,pageInfo:this.pageInfo,regions:i}))))).subscribe((({events:e,pageInfo:t})=>{v((()=>{var r,n,a;if(!t)return;const i=e.map(mi);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:this.eventTypes.map((e=>Te[e])),from:null!==(n=null===(r=i[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:P(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(a=this.probabilityThreshold)&&void 0!==a?a:void 0}),i).flatMap(this.toObjects):this.data=i.flatMap(this.toObjects),this.eventsStore.add(i),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(x((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:a})=>Me((()=>this.loadMoreTrigger)).pipe(j((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:a,pageInfo:this.pageInfo,regions:this.regions}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(mi);this.eventsStore.add(r),v((()=>{this.data=this.data.concat(r.flatMap(this.toObjects)),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(Me((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(x((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?Me((()=>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&&v((()=>{this.data=[...t.flatMap(this.toObjects),...this.data]}))}))),this.disposables.push(Me((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(x((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?Me((()=>this.eventsStore.recentAdditions)):(this.pendingData&&v((()=>this.pendingData=[])),m)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&v((()=>{this.pendingData=[...t.flatMap(this.toObjects),...this.pendingData]}))})))}filter(e){let t=e;const{from:r,to:n}=this;if(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){const e=this.eventTypes.map((e=>Te[e]));t=t.filter((t=>e.includes(t.type)))}return this.detectedObjects.length&&(t=t.filter((e=>e.detectedObjects.some((e=>{var t;const{probabilityThreshold:r}=this;return!(null!==r&&e.Probability<r)&&(this.colors.size?this.detectedObjects.includes(e.Type)&&(null===(t=e.Colors)||void 0===t?void 0:t.some((e=>this.colors.has(e.Color)))):this.detectedObjects.includes(e.Type))}))))),t}boxToAabb(e){return{x:e.Left,y:e.Top,width:e.Right-e.Left,height:e.Bottom-e.Top}}regionToWktPolygon(e){return e.length?"POLYGON (("+e.concat(e[0]).map((({x:e,y:t})=>`${e} ${t}`)).join(", ")+"))":"POLYGON (())"}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 mi(e){return new ui(e)}const pi={Top:0,Left:0,Bottom:1,Right:1};class fi extends Da{constructor(e,n,a,i){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:a}),Object.defineProperty(this,"heatmaps",{enumerable:!0,configurable:!0,writable:!0,value:i}),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,"heatmapMode",{enumerable:!0,configurable:!0,writable:!0,value:"selection"}),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,"setHeatmapMode",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.heatmapMode=e}}),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=Me((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId}))).pipe(O(Ia),T());this.disposables.push(Me((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId,filters:this.filters,brushFilter:this.brushFilter,colors:this.colors,probabilityThreshold:this.probabilityThreshold}))).pipe(O(Ia),T()).subscribe((e=>{v((()=>{if(!e.date||!e.cameraId)return;this.eventsLoader.sortDirection="DESC";const n=t(e.date),a=r(e.date);this.eventsLoader.from=n,this.eventsLoader.to=a;const{brushFilter:i}=e;i&&([this.eventsLoader.from,this.eventsLoader.to]=i),this.eventsLoader.regions=[...e.regions||[]],this.eventsLoader.cameras=[e.cameraId],this.eventsLoader.detectedObjects=e.filters.map((e=>e.id)),this.eventsLoader.eventTypes=[Te.Analytic],this.eventsLoader.colors=e.colors,this.eventsLoader.probabilityThreshold=e.probabilityThreshold,this.eventsLoader.load()}))})));const n=this.heatmaps;n&&(this.disposables.push(e.pipe(x((e=>{if(!e.date||!e.cameraId)return m;v((()=>{this.peopleCountingDataLoading=!0}));const n=t(e.date),a=r(e.date),i=e.regions?this.boxRegions(e.regions):pi;return this.api.cameras.GetPeopleCountingData(e.cameraId,n,a,i).pipe(E((e=>e.success?s(e.resultItems):h((()=>e.error))))).pipe(w((e=>(this.notification.error(Ce.t("eventSearchRequestError.peopleCounting")),console.error(e),s([])))))}))).subscribe((e=>{v((()=>{this.peopleCountingData=e,this.peopleCountingDataLoading=!1}))}))),this.disposables.push(Me((()=>({date:this.date,cameraId:this.cameraId}))).pipe(O(Ia),x((e=>{if(!e.date||!e.cameraId)return m;v((()=>{this.heatmapLoading=!0}));const a=t(e.date),i=r(e.date);return n.fetchHeatmaps(e.cameraId,a,i,1).pipe(C((e=>e[0]||null))).pipe(w((e=>(this.notification.error(Ce.t("eventSearchRequestError.heatmap")),console.error(e),s(null)))))}))).subscribe((e=>{v((()=>{this.heatmap=e,this.heatmapLoading=!1}))}))))}}),f(this,{cameraId:b,date:b,regions:b.ref,filters:b.ref,colors:b.ref,peopleCountingDataLoading:b,heatmapMode:b,heatmapLoading:b,data:b.ref,heatmap:b.ref,peopleCountingData:b.ref,probabilityThreshold:b,brushFilter:b.ref,params:p,filteredData:p,filteredPeopleCountingData:p,setDate:g,setFilters:g,setBrushFilter:g,setParams:g,openForPlayer:g,searchFullFrame:g,setRegions:g,setHeatmapMode:g,toggleColor:g,clearColors:g,clear:g}),this.analyticsEnabled=Boolean(i),this.eventsLoader=new hi(n,"objects"),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=>{var t;return null===(t=e.Colors)||void 0===t?void 0:t.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=>{var r;return(!t.length||t.includes(e.Type))&&(!this.colors.size||(null===(r=e.Colors)||void 0===r?void 0:r.some((e=>this.colors.has(e.Color)))))&&e.Probability>=this.probabilityThreshold&&n.some((t=>ci(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=>ci(e,{x:t.Left,y:t.Top,width:t.Right-t.Left,height:t.Bottom-t.Top}))))):this.peopleCountingData}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 bi=N.createContext(null);function gi(e){return N.forwardRef(((t,r)=>{const{size:n=24,color:a="currentColor",className:i,...o}=t,l=e.viewBox||"0 0 24 24",s=e.svg;return N.createElement("svg",{ref:r,preserveAspectRatio:"xMinYMin",className:U("icon",i),width:n,fill:a,viewBox:l,...o},s)}))}const vi=gi({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"}))});vi.displayName="LabelIcon";const yi=gi({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"}))});yi.displayName="CameraIcon";const Ei=gi({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"})});Ei.displayName="LuggageIcon";const wi=gi({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"}))});wi.displayName="CarIcon";const xi=gi({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"}))});xi.displayName="BoatIcon";const Ci=gi({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"}))});Ci.displayName="BicycleIcon";const ji=gi({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"}))});ji.displayName="DirectionsWalkIcon";const Oi=gi({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"}))});Oi.displayName="PetsIcon";const Ti=gi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M4 4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H5Zm0 2h4v2h8V6h4v12H4Z"}),N.createElement("path",{d:"M9.923 10 8.43 12.433 10 15h-.8L8 13.036 6.8 15H6l1.602-2.616L6.136 10h.8l1.093 1.781L9.123 10Z"}),N.createElement("path",{d:"m13.709 10-1.492 2.433L13.787 15h-.8l-1.2-1.964L10.585 15h-.8l1.603-2.616L9.923 10h.799l1.094 1.781L12.91 10Z"}),N.createElement("path",{d:"m17.709 10-1.492 2.433L17.787 15h-.8l-1.2-1.964L14.585 15h-.8l1.603-2.616L13.923 10h.799l1.094 1.781L16.91 10Z"}))});Ti.displayName="LicensePlateIcon";const Mi=({data:e})=>{const t=16;return"licensePlate"===e.type?null:"detectedObject"!==e.type?N.createElement(yi,{size:t}):"Luggage"===e.id?N.createElement(Ei,{size:t}):"Car"===e.id?N.createElement(wi,{size:t}):"Person"===e.id?N.createElement(ji,{size:t}):"Bicycle"===e.id?N.createElement(Ci,{size:t}):"Boat"===e.id?N.createElement(xi,{size:t}):"Animal"===e.id?N.createElement(Oi,{size:t}):"LicensePlate"===e.id?N.createElement(Ti,{size:t}):N.createElement(vi,{size:t})},Pi=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:a}=$,{data:i}=e,o={...r,style:{display:"flex",alignItems:"center"}};return N.createElement(a,{innerProps:o,...n},N.createElement(Mi,{data:i}),N.createElement("div",{style:{marginLeft:4}},t))},_i={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},Li={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},Ni={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Ii={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},Di={50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",A100:"#ffff8d",A200:"#ffff00",A400:"#ffea00",A700:"#ffd600"},ki=e=>({reference:{onClick(){e.onOpenChange(!1),e.events.emit("dismiss")}}}),Si=({children:e,label:t,placement:r="bottom"})=>{const[n,a]=I(!1),{x:i,y:o,reference:l,floating:s,strategy:c,context:d}=W({placement:r,open:n,onOpenChange:a,middleware:[G(5),q(),Y({padding:8})],whileElementsMounted:(e,t,r)=>Z(e,t,r,{animationFrame:!0})}),{getReferenceProps:u,getFloatingProps:h}=J([X(d),K(d),ki(d),Q(d,{role:"tooltip"}),ee(d)]);return N.createElement(N.Fragment,null,D(e,u({ref:ae(l,e.ref),...e.props})),N.createElement(te,{id:"x-3deye-floating-ui-root"},n&&N.createElement("div",{...h({ref:s,className:"x-3deye-tooltip",style:{position:c,top:null!=o?o:0,left:null!=i?i:0}})},t)))};class zi extends N.Component{render(){const{forwardedRef:e,children:t,className:r,fullWidth:n,variant:a,type:i,title:o,placement:l,...s}=this.props,c=U(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},a?`x-3deye-button--${a}`:void 0),d=N.createElement("button",{ref:e,className:c,type:i||"button",...s},t,s.disabled?null:N.createElement(V,null));return o?N.createElement(Si,{label:o,placement:l},d):d}}const Ai=N.forwardRef(((e,t)=>N.createElement(zi,{forwardedRef:t,...e}))),Fi=gi({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"}))});Fi.displayName="CloseIcon";const Bi=gi({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"}))});Bi.displayName="DoneIcon";const Ri=[{color:Ii[500],name:"red",highlightColor:Ii[100]},{color:Li[500],name:"green",highlightColor:Li[100]},{color:_i[500],name:"blue",highlightColor:_i[100]},{color:Di[500],name:"yellow",highlightColor:Di[900]},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:Ni[500],name:"dimgrey",highlightColor:Ni[100]}],Hi=R((({value:e,clear:t,toggle:r})=>N.createElement("div",{className:"color-selector"},N.createElement("div",null,"COLOR"),N.createElement("div",{className:"color-selector__items"},Ri.map((({color:t,highlightColor:n,name:a})=>N.createElement("button",{key:a,className:U("color-selector__item",{selected:e.has(a)}),style:{backgroundColor:t},onClick:r.bind(null,a)},N.createElement(Bi,{color:n,size:20})))),N.createElement(Ai,{className:"color-selector__clear",disabled:!e.size,onClick:t},N.createElement(Fi,{size:20}))))));Hi.displayName="ColorSelector";const $i=(e,t,r)=>Math.min(Math.max(e,t),r);/Mac|iPod|iPhone|iPad/.test(window.navigator.platform);const Ui=e=>Math.round(e),Vi=N.forwardRef((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:a=!1,labelFormat:i=(e=>`${e}`),style:o},l)=>{const s=k(null),c=k(null),[d,u]=I(!1),[h,m]=I(e);S((()=>{if(!d)return;const e=s.current;if(!e)return;let a=0,i=0;const o=e.getBoundingClientRect();if(!o)return;const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(a=$i(e-o.x,0,o.width),l=a/o.width*100,c.current.style.transform=`translateX(${a}px)`):(i=o.height-$i(r-o.y,0,o.height),l=i/o.height*100,c.current.style.transform=`translateY(${-i}px)`),m(l),null==t||t(Ui(l))},h=({clientX:e,clientY:a})=>{if(u(!1),!c.current)return;const i="horizontal"===n?$i(e-o.x,0,o.width)/o.width*100:100*(1-$i(a-o.y,0,o.height)/o.height);c.current.style.transform="",m(i),null==t||t(Ui(i)),null==r||r(Ui(i))},p=()=>{if(u(!1),!c.current)return;const e="horizontal"===n?a/o.width*100:i/o.height*100;c.current.style.transform="",null==t||t(Ui(e)),null==r||r(Ui(e))};return e.addEventListener("pointercancel",p),e.addEventListener("pointermove",l),e.addEventListener("pointerup",h),()=>{e.removeEventListener("pointercancel",p),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",h)}}),[d,n,t]);const p=z((({clientX:e,clientY:r,pointerId:i})=>{if(!s.current||a)return;u(!0),s.current.setPointerCapture(i);const o=s.current.getBoundingClientRect();if(!o)return;if(!c.current)return;let l=0;if("horizontal"===n){const t=$i(e-o.x,0,o.width);l=t/o.width*100,c.current.style.transform=`translateX(${t}px)`}else{const e=o.height-$i(r-o.y,0,o.height);l=e/o.height*100,c.current.style.transform=`translateY(${-e}px)`}m(l),null==t||t(Ui(l))}),[n,a]),f=z((n=>{if(a)return;let i=null;"ArrowLeft"===n.code?i=Math.max(e-1,0):"ArrowRight"===n.code?i=Math.min(e+1,100):"ArrowDown"===n.code?i=Math.max(e-1,0):"ArrowUp"===n.code&&(i=Math.min(e+1,100)),null!==i&&(n.stopPropagation(),n.preventDefault(),null==t||t(i),null==r||r(i))}),[e,t,r,n,a]);return N.createElement("div",{ref:ae(l,s),tabIndex:0,onKeyDown:f,className:U("x-3deye-slider",n,{disabled:a}),onPointerDown:p,style:o},N.createElement("div",{className:"x-3deye-slider__track"},N.createElement("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${d?h:e}%`:void 0,height:"vertical"===n?`${d?h:e}%`:void 0}})),N.createElement("div",{ref:c,className:U("x-3deye-slider__thumb",{active:d}),style:{touchAction:"none",userSelect:"none",position:"absolute",left:"horizontal"===n?d?0:`${e}%`:"auto",bottom:"vertical"===n?d?0:`${e}%`:"auto"}},N.createElement("div",{className:"x-3deye-slider__label "+(d?"open":"")},i(d?Ui(h):e))))}));Vi.displayName="Slider";const Wi=R((({getter:e,setter:t})=>{const[r,n]=I(0),a=k(null),i=Math.floor(100*e());return S((()=>y(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),N.createElement("div",{ref:a,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"}},i,"%")),N.createElement("div",{style:{padding:"0 10px"}},N.createElement(Vi,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})))}));Wi.displayName="ProbabilitySlider";var Gi,qi=(Gi=8,{container:e=>({...e,padding:Gi}),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,width:`calc(100% - ${2*Gi}px)`,marginTop:Gi?0:e.marginTop}),option:e=>({...e,color:"black"}),multiValueRemove:e=>({...e,color:"black"}),placeholder:(e,t)=>({...e,color:t.isFocused?e.color:"hsl(0, 0%, 70%)"})});const Yi=R((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:a})=>{const i=k(null),o=k(null);return N.createElement("div",{ref:i,onDragStart:t=>{var r;if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",""+e.id),t.dataTransfer.setData("x-3deye/camera",""+e.cameraId),t.dataTransfer.setData("x-3deye/starttime",e.startTime.toISOString()),t.dataTransfer.dropEffect="move";const n=null===(r=i.current)||void 0===r?void 0:r.querySelector("img");if(n){const{x:e,y:r}=n.getBoundingClientRect();t.dataTransfer.setDragImage(n,t.clientX-e,t.clientY-r)}},className:"event-list-item",onClick:()=>null==r?void 0:r(e),onAuxClick:t=>null==n?void 0:n(t,e),onContextMenu:e=>{var t;e.preventDefault(),i.current&&(null===(t=o.current)||void 0===t||t.toggleAt(i.current,{top:e.clientY,left:e.clientX}))},draggable:!0},t,a&&N.createElement(a,{ref:o,data:e}))}));Yi.displayName="EventListItem";const Zi=gi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4zm-4-8c0-.55.45-1 1-1s1 .45 1 1h-1v1h1v2h-1v1h1v2h-2V5z"}))});Zi.displayName="ThermostatIcon";const Ji=R((({data:e})=>{if("Temperature"!==e.type)return null;let t=Number(e.raw.data);return t=5*(t-32)/9+273.15,N.createElement("div",{className:"event-list-item__temperature"},N.createElement(Zi,null),(t-273.15).toFixed(1),"°C / ",(9*t/5-459.67).toFixed(1),"°F")}));Ji.displayName="Temperature";const Xi=R((({data:e,cameraNameHidden:t})=>{var r;const i=A(bi),{cameras:o}=i,l=o.loaded&&(null===(r=o.camerasById.get(e.cameraId))||void 0===r?void 0:r.name)||"...";return N.createElement("div",{className:"event-list-item-caption"},N.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",i="";return n(e,new Date)?a(e,new Date)?r=i="HH:mm":a(e,t)?(r="EEE d MMM HH:mm",i="HH:mm"):r=i="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",i="d MMM HH:mm"):r=i="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",i+=":ss"),+e==+t?`${je(e,r)}`:`${je(e,r)} - ${je(t,i)}`}(e.startTime,e.endTime)),t?null:N.createElement("div",{className:"event-list-item__camera-name",title:l},l),+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 a=(e-r)/60;if(a<60)return!r&&t?`${a}m`:`${a}m ${n}s`;const i=Math.floor(a/60);if(a-=60*i,!r&&!a&&t)return`${i}h`;const o=t?`${a}`:`${a}`.padStart(2,"0");return!r&&a&&t?`${i}h ${o}m`:`${i}h ${o}m ${n}s`}(+e.endTime-+e.startTime)),N.createElement(Ji,{data:e}))}));Xi.displayName="EventListItemCaption";const Ki=R((({data:{data:e,objectIdx:t},width:r,height:n,cameraNameHidden:a,onClick:i,onAuxClick:o,menuComponent:l})=>{let s=null,c=1,d=1,u=0,h=0,m=1,p=1;const{ThumbnailSize:f}=JSON.parse(e.raw.data);f&&(c=f.Width,d=f.Height),s=e.detectedObjects[t];const{Box:{Bottom:b,Left:g,Right:v,Top:y}}=s;u=y*d,h=g*c,p=(b-y)*d,m=(v-g)*c;let E=1,w=0,x=0,C="Person"===(null==s?void 0:s.Type)?.8:1;return r/n>m/p?(E=n/p*C,w=-u*E+(n-p*E)/2,x=-(h+m/2)*E+r/2):(E=r/m*C,w=-(u+p/2)*E+n/2,x=-h*E),N.createElement(Yi,{onClick:i,onAuxClick:o,data:e,width:r,height:n,cameraNameHidden:a,menuComponent:l},N.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},N.createElement("img",{key:e.thumbnailUrl,src:e.thumbnailUrl,style:{position:"absolute",top:w,left:x,width:c*E,height:d*E}}),N.createElement(V,{radius:r}),N.createElement(Xi,{data:e,cameraNameHidden:!0})))}));Ki.displayName="DetectedObjectCell";const Qi=({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"})));Qi.displayName="Preloader";var eo=yr;function to(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(to.Cache||eo),r}to.Cache=eo;const ro=to((()=>{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}));function no(e,t,r,n){return e.Top<-n&&(e.Bottom=e.Bottom-e.Top+n,e.Top=-n),e.Left<-n&&(e.Right=e.Right-e.Left+n,e.Left=-n),e.Right+n>t&&(e.Left=e.Left-(e.Right-t)+n,e.Right=t-n),e.Bottom+n>r&&(e.Top=e.Top-(e.Bottom-r)+n,e.Bottom=r-n),e}const ao=({className:e,style:t,box:{Top:r,Left:n,Right:a,Bottom:i}})=>N.createElement(N.Fragment,null,N.createElement("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-i)+"%",right:100*(1-a)+"%",...t}}));function io({style:e}){return N.createElement("div",{className:"frame",style:e},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"}))}function oo({Top:e,Left:t,Bottom:r,Right:n},a,i,o,l){const s=l*e,c=l*r;return s>i?[0,-1]:c>i?[0,1]:o*t>a?[-1,0]:o*n>a?[1,0]:[0,s>c?1:-1]}function lo(e,t){return{Top:e.Top+t[1],Left:e.Left+t[0],Bottom:e.Bottom+t[1],Right:e.Right+t[0]}}ao.displayName="LicensePlateLpr";const so=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:a,thumbHeight:i,width:o,height:l})=>{const{Top:s,Left:c,Right:d,Bottom:u}=t,h=100/a/(d-c),m={top:2},p=k(null);return F((()=>{if(!p.current)return;const{width:e,height:r}=p.current.getBoundingClientRect(),n=oo(t,e,r,o,l);n[0]=n[0]*(e+(d-c)*o)/2,n[1]=n[1]*(r+(u-s)*l)/2;const a=no(lo({Top:(s+u)/2*l-r/2,Left:(c+d)/2*o-e/2,Bottom:(s+u)/2*l+r/2,Right:(c+d)/2*o+e/2},n),o,l,0);p.current.style.top=`${a.Top+2*Math.sign(n[1])}px`,p.current.style.left=`${a.Left+2*Math.sign(n[0])}px`})),c>=1-d?m.left=2:m.right=2,N.createElement(N.Fragment,null,N.createElement("div",{ref:p,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`},N.createElement("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"}},e),N.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"}},Math.floor(100*r),"%")),N.createElement(ao,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),N.createElement("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:a*(d-c)*h,height:i*(u-s)*h,...m}},N.createElement("img",{style:{width:a*h,height:i*h,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),N.createElement(io,null)))};so.displayName="FaceHighlight";const co=N.memo((({value:e})=>e?N.createElement(N.Fragment,null,e.split("").map(((e,t)=>{const r=e.charCodeAt(0);return r<48||r>57?N.createElement(N.Fragment,{key:t},e):N.createElement("span",{key:t,className:"digit"},e)}))):null));co.displayName="LicensePlateNumber";const uo=({detectedObject:e,height:t,width:r,url:n,thumbWidth:a,thumbHeight:i})=>{const{Type:o,Box:{Top:l,Left:s,Right:c,Bottom:d},Probability:u}=e,h=e.Value||e.Number,m=k(null);F((()=>{if(!m.current)return;const e=m.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,a=l*t-e.height-4;a<0&&(a=d*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),m.current.style.top=`${a}px`,m.current.style.left=`${n}px`}));const p={top:2};s>=1-c?p.left=2:p.right=2;const f=100/a/(c-s);return N.createElement(N.Fragment,null,N.createElement("div",{ref:m,className:"event-list-item__license-plate-label trigger",title:`${o.toLowerCase()} ${Math.floor(100*u)}%`},N.createElement("div",{style:{padding:4}},N.createElement(co,{value:h})),N.createElement("div",{className:"event-list-item__license-plate-label__caption"},Math.floor(100*u),"%")),N.createElement(ao,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),N.createElement("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:a*(c-s)*f,height:i*(d-l)*f+16,position:"absolute",...p}},N.createElement("img",{style:{width:a*f,height:i*f,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),N.createElement("div",{className:"plate-number"},N.createElement(co,{value:h})),N.createElement(io,{style:{height:i*(d-l)*f}})))};uo.displayName="LicensePlateHighlight";const ho=R((({url:e,noPreview:t,width:r})=>N.createElement(N.Fragment,null,e?N.createElement("img",{key:e,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e}):null,N.createElement(V,{radius:r}),t?N.createElement("div",{className:"no-preview-overlay"}):null)));function mo({Top:e,Left:t,Bottom:r,Right:n}){return[(t+n)/2,(e+r)/2]}function po(e,t){const[r,n]=mo(e),[a,i]=mo(t);return[a-r,i-n]}function fo(e,t){return!(e.Left>t.Right||e.Top>t.Bottom||e.Right<t.Left||e.Bottom<t.Top)}function bo([e,t]){const r=Math.sqrt(e*e+t*t);return 0===r?[0,0]:[e/r,t/r]}ho.displayName="EventThumbnail";const go=R((({data:e,width:t,height:r})=>{const n=k(null),{eventSchema:a}=A(bi);return F((()=>{if(!n.current)return;const a=[],i=[];for(let o=0;o<e.length;o++){const l=n.current.children[2*o+1],s=e[o].Box;a.push({Top:s.Top*r,Left:s.Left*t,Bottom:s.Bottom*r,Right:s.Right*t});const[c,d]=mo(a[o]),{width:u,height:h}=l.getBoundingClientRect(),m=oo(s,u,h,t,r);i.push(lo({Top:d-h/2-4,Left:c-u/2-4,Bottom:d+h/2+4,Right:c+u/2+4},m))}let o=!0,l=0;for(;o;){if(o=!1,l++>1e3){console.warn("Reached max iterations for label positioning");break}for(let t=0;t<e.length;t++){const r=i[t],n=[0,0];for(let l=0;l<e.length;l++){const e=a[l],s=i[l];if(fo(r,e)){const t=po(e,r);n[0]=n[0]+t[0],n[1]=n[1]+t[1],o=!0}if(l!==t&&fo(r,s)){const e=po(s,r);n[0]=n[0]+e[0],n[1]=n[1]+e[1],o=!0}}[n[0],n[1]]=bo(n),r.Top+=n[1],r.Left+=n[0],r.Bottom+=n[1],r.Right+=n[0]}}for(let a=0;a<e.length;a++){const e=n.current.children[2*a+1],{Top:o,Left:l}=no(i[a],t,r,4);e.style.top=o+4+"px",e.style.left=l+4+"px"}}),[e,t,r]),N.createElement("div",{ref:n},e.map((({Box:e,Probability:t,Type:r},n)=>N.createElement(N.Fragment,{key:n},N.createElement(ao,{box:e,style:{outline:`2px solid ${a.colorsByFoundObjectType.get(r)}`}}),N.createElement("div",{className:"event-list-item__detected-object-label",title:`${r.toLowerCase()} ${Math.floor(100*t)}%`},N.createElement("div",{style:{padding:4,lineHeight:"24px"}},r.toLowerCase()),N.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:a.colorsByFoundObjectType.get(r)}},Math.floor(100*t),"%"))))))}));go.displayName="DetectedObjects";const vo=R((({data:e,width:t,height:r,cameraNameHidden:n,onClick:a,onAuxClick:i,menuComponent:o})=>{const l=A(bi),{eventSchema:s}=l,[c,d]=function(e){var t;const[r,n]=I(null),a=A(bi),{cameras:i,thumbnails:o}=a;S((()=>{if(e.thumbnailUrl)return void n(null);const t=o.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{n(e||null)}));return()=>t.unsubscribe()}),[e.id]);let l="",s=!1;return e.thumbnailUrl?l=e.thumbnailUrl:null===r&&i.loaded?(l=(null===(t=i.camerasById.get(e.cameraId))||void 0===t?void 0:t.imageUrl)||"",s=!0):r&&(l=r.url),[l,s]}(e);let u=[],h=null,m=null;if(e.detectedObjects.length){let n,a;const{ThumbnailSize:i}=JSON.parse(e.raw.data);i&&(n=i.Width,a=i.Height),u=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)),h=e.detectedObjects.filter((({Type:e})=>"LicensePlate"===e)).map(((e,i)=>N.createElement(uo,{key:i,detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:a,url:c})))}if(e.faces){const{Width:n,Height:a}=JSON.parse(e.raw.data).ThumbnailSize;m=e.faces.map(((e,i)=>N.createElement(so,{key:i,face:e,url:c,thumbWidth:n,thumbHeight:a,width:t,height:r})))}return N.createElement(Yi,{onClick:a,onAuxClick:i,data:e,width:t,height:r,cameraNameHidden:n,menuComponent:o},N.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},N.createElement(ho,{url:c,noPreview:d,width:t}),N.createElement(go,{data:u,width:t,height:r}),h,m,e.acknowledged?N.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,N.createElement(Xi,{data:e,cameraNameHidden:n})))}));vo.displayName="EventItem";class yo extends N.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{hasError:!1}})}componentDidCatch(e,t){this.setState({hasError:!0}),ie.withScope((r=>{Object.keys(t).forEach((e=>{r.setExtra(e,t[e])})),ie.captureException(e)})),console.error(e),console.log(t)}render(){if(!this.state.hasError)return this.props.children;const{style:e,children:t,...r}=this.props;return N.createElement("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r},N.createElement("h1",null,"Oops. Something went wrong"),N.createElement("div",null,"We've been notified about this problem"),N.createElement(Ai,{onClick:()=>this.setState({hasError:!1})},"retry"))}}function Eo({count:e,overscan:t=1,itemSize:r,horizontal:n=!1,spacing:a=0}){const[i,o]=I(),[l,s]=I(0),c=z((e=>{o(e||void 0)}),[]);S((()=>{if(!i)return;const e=()=>{s(n?i.scrollLeft:i.scrollTop)};return i.addEventListener("scroll",e,{passive:!0,capture:!0}),()=>{i.removeEventListener("scroll",e)}}),[i,n]);return{parentRef:c,getItems:()=>{if(!i)return[];const o=[],{height:s,width:c}=i.getBoundingClientRect(),d=Math.max(0,Math.floor(l/(r+a))-t),u=Math.ceil((n?c:s)/(r+a))+2*t;for(let t=d;t<Math.min(e,d+u);t++)o.push({idx:t,start:t*(r+a),size:r});return o},getTotalSize:()=>r*e+Math.max(e-1,0)*a}}const wo=R((({columnIndex:e,rowIndex:t,style:r,store:n,columnCount:a,eventRenderer:i})=>{var o,l;const s=t*a+e,c=n.data[s];return s===n.data.length?n.error?N.createElement("div",{style:r},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(Ai,{onClick:n.loadMore},"Retry")))):(null===(o=n.pageInfo)||void 0===o?void 0:o.haveMore)?N.createElement("div",{style:r},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement(Qi,{size:32}))):N.createElement("div",{style:r}):!c&&(null===(l=n.pageInfo)||void 0===l?void 0:l.haveMore)?N.createElement("div",{style:r}):c?N.createElement("div",{style:r},N.createElement(yo,null,i({data:c,width:r.width,height:r.height}))):N.createElement("div",{style:r})})),xo=R((({store:e,scrollWidth:t,onClick:r})=>e.pendingData.length?N.createElement("div",{style:{position:"absolute",top:0,left:0,right:t,pointerEvents:"none",textAlign:"center",padding:8}},N.createElement(Ai,{className:"x-3deye-button--overlay",style:{background:"rgba(0, 0, 0, 0.75)",padding:"8px 16px",backdropFilter:"blur(2px)",borderRadius:32,pointerEvents:"auto"},onClick:r},Ce.t("showEvents",{count:e.pendingData.length}))):null)),Co=R((({store:e,width:t,height:r,captionHeight:n=0,minColumnWidth:a=180,aspectRatio:i=16/9,onEventClick:o,onEventAuxClick:l,eventRenderer:s})=>{const c=k(null),d=()=>{c.current&&(c.current.scrollTop=0)};if(e.error&&!e.data.length)return d(),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(Ai,{onClick:e.reload},"Retry")));if(e.loading)return d(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement(Qi,null));if(!e.data.length)return d(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},Ce.t("noEventsFound"));const u={store:e,width:t,minColumnWidth:a,aspectRatio:i,captionHeight:n,height:r,onEventClick:o,onEventAuxClick:l,eventRenderer:s,containerRef:c,resetScroll:d};return N.createElement(jo,{...u})}));Co.displayName="EventGrid";const jo=R((({store:e,width:t,height:r,captionHeight:n=0,minColumnWidth:a=180,aspectRatio:i,containerRef:o,onEventClick:l,onEventAuxClick:s,eventRenderer:c=(({data:e,width:t,height:r})=>N.createElement(vo,{data:e.data,cameraNameHidden:!1,onClick:l,onAuxClick:s,width:t,height:r})),resetScroll:d})=>{var u,h;const m=Math.floor(t/a)||1,p=t/m/i+n,f=m*Math.floor(r/p)>=e.data.length?0:ro(),b=Math.max(1,Math.floor((t-f)/a));let g=Math.ceil(e.data.length/b);const v=(t-f-2*(b-1))/b,y=v/i+n;(null===(u=e.pageInfo)||void 0===u?void 0:u.haveMore)&&g*b===e.data.length&&g++;const{parentRef:E,getItems:w,getTotalSize:x}=Eo({count:g,overscan:5,itemSize:y,spacing:2}),{parentRef:C,getItems:j,getTotalSize:O}=Eo({count:b,overscan:5,itemSize:v,horizontal:!0,spacing:2}),T=w(),M=j();S((()=>{var t;e.error||(null===(t=e.pageInfo)||void 0===t?void 0:t.haveMore)&&(e.loading||T.length&&T.at(-1).idx+1===g&&e.loadMore())}),[e.error,null===(h=e.pageInfo)||void 0===h?void 0:h.haveMore,T]);const P=T.flatMap((({idx:t,size:r,start:n})=>M.map((({idx:a,size:i,start:o})=>{var l;const s=t*b+a;return s>e.data.length?null:s!==e.data.length||(null===(l=e.pageInfo)||void 0===l?void 0:l.haveMore)?N.createElement(wo,{key:e.data[s]?`${e.data[s].data.id}-${e.data[s].objectIdx}`:"loading",columnIndex:a,rowIndex:t,columnCount:b,style:{position:"absolute",top:0,left:0,height:r,width:i,transform:`translate(${o}px, ${n}px)`,display:"flex"},store:e,eventRenderer:c}):null}))));return N.createElement("div",{style:{width:"100%",height:"100%",overflow:"hidden",position:"relative"}},N.createElement("div",{ref:ae(o,E,C),style:{width:t,height:r,overflow:"auto"},onScroll:t=>{const{scrollTop:r}=t.target;"disabled"!==e.liveUpdateMode&&e.setLiveUpdateMode(r>=1||e.pendingData.length?"manual":"auto")}},N.createElement("div",{style:{position:"relative",height:x(),width:O()}},P)),N.createElement(xo,{store:e,scrollWidth:f,onClick:()=>{e.flushUpdates(),e.setLiveUpdateMode("auto"),d()}}))})),Oo=e=>{const{className:t,children:r,...n}=e;return N.createElement("div",{className:U("x-3deye-button-group",t),...n},r)},To=N.forwardRef((function({width:e,height:t,placement:r="top",style:n},a){const i=[0,"top"===r?t:0],o=[e,i[1]],l=[e/2,t-i[1]],s=[e/4,t*("top"===r?3:1)/4],c=[.325*e,t-i[1]],d=[e-c[0],c[1]],u=[e-s[0],s[1]],h=e=>e.join(","),m=`M ${h(i)} C ${h(s)} ${h(c)} ${h(l)} ${h(d)} ${h(u)} ${h(o)}`,p=`${m} Z`;return N.createElement("svg",{ref:a,className:"tip",style:n,width:e,height:t,fill:"var(--tip-background, #fff)"},N.createElement("path",{className:"tip-body",d:p}),N.createElement("path",{className:"tip-border",d:m,stroke:"var(--tip-border, transparent)",strokeWidth:1}))})),Mo=({opened:e,onOpenChange:t,children:r,target:n,placement:a,className:i,autoDismiss:o=!0,withArrow:l=!1})=>{var s,c,d;const u=k(null),{x:h,y:m,reference:p,floating:f,strategy:b,context:g,middlewareData:v,placement:y,update:E}=W({open:e,onOpenChange:t,middleware:[G(5),q(),Y(),re({element:u})],placement:a,whileElementsMounted:(e,t,r)=>Z(e,t,r,{animationFrame:!0})}),{getReferenceProps:w,getFloatingProps:x}=J([Q(g),ee(g,{ancestorScroll:!0,enabled:o})]),C=z((e=>{u.current=e,E()}),[E]),j={top:"bottom",right:"left",bottom:"top",left:"right"}[null!==(s=null==y?void 0:y.split("-")[0])&&void 0!==s?s:"top"]||"top",O=N.createElement("div",{...x({className:U("x-3deye-popover-container",i),ref:f,style:{position:b,top:null!=m?m:0,left:null!=h?h:0}})},l&&N.createElement(To,{ref:C,width:24,height:8,placement:j,style:{position:"absolute",left:null===(c=v.arrow)||void 0===c?void 0:c.x,top:null===(d=v.arrow)||void 0===d?void 0:d.y,[j]:-7}}),r);return N.createElement(N.Fragment,null,D(n,w({ref:p,...n.props})),N.createElement(te,{id:"x-3deye-floating-ui-root"},o&&e&&N.createElement(ne,{context:g,modal:!1,order:["reference","content"],returnFocus:!1},O),!o&&e&&O))},Po=R((({store:e})=>{const[t,r]=I(!1),{cameras:n}=A(bi),{date:l,setDate:s,cameraId:c}=e,d=c?n.camerasById.get(c):void 0,u=i(new Date,1),h=l&&a(l,new Date),m=l&&a(l,u),p=d?o(new Date,d.archiveDuration):new Date;return N.createElement(Oo,null,N.createElement(Ai,{className:U({"button-selected":h}),onClick:()=>s(new Date)},Ce.t("today")),c&&!a(new Date,p)?N.createElement(Ai,{className:U({"button-selected":m}),onClick:()=>s(u)},Ce.t("yesterday")):null,l&&N.createElement(Mo,{className:"popover-datepicker",target:N.createElement(Ai,{className:"date-button",onClick:()=>r(!t)},je(l,"EEE dd MMM")),opened:t,withArrow:!0,onOpenChange:r},N.createElement(oe,{selected:l,onChange:s,dateFormat:"EEE dd MMM",inline:!0,minDate:p,maxDate:new Date}),N.createElement("div",{style:{display:"flex"}},N.createElement(Ai,{style:{flex:1},onClick:()=>r(!1),variant:"filled"},Ce.t("button.ok")))))}));Po.displayName="DateSelector";const _o=R((()=>{const e=A(bi),t=k(null),r=k(null),n=k(null),a=k([]),[i,o]=I(0),l=100,s=20,c=20,d=30,u=20,{eventSearch:h}=e.eventSearchPanel,{filteredPeopleCountingData:m}=h,{brushFilter:p}=h,f=p?a.current.filter((e=>e.x0>=+p[0]&&e.x1<=+p[1])).reduce(((e,t)=>e+t.length),0):null;return S((()=>{const e=new ye((e=>{for(const t of e){const e=t.contentRect.width;o(e)}}));return e.observe(t.current),()=>e.disconnect()}),[]),S((()=>{const e=de(r.current);if(!i)return;m.forEach((e=>e.timestamp=new Date(e.TimeStamp)));const t=le(m,(e=>e.timestamp)),o=me(pe.offset(t[0],-1),pe.offset(t[1],1)),p=ge().extent([[u,s],[i-c,l-d]]).on("end",(function({selection:e,sourceEvent:t}){if(!t)return;if(!e)return void h.setBrushFilter(null);const r=fe.every((+a.current[0].x1-+a.current[0].x0)/6e4||30);let[n,i]=e.map((e=>r.round(f.invert(e))));if(+n==+i&&(n=r.floor(f.invert(e[0])),i=r.ceil(f.invert(e[1])),+n==+i))return de(this).transition().call(p.move,null),void h.setBrushFilter(null);h.setBrushFilter([n,i]),de(this).transition().call(p.move,i>n?[n,i].map(f):null)}));n.current=p;const f=ue().domain(le(o)).nice().range([u,i-c]);a.current=m.length?se().value((e=>e.timestamp)).domain(f.domain()).thresholds(f.ticks(24))(m):[];const b=he().domain([0,ce(a.current,(e=>e.length))]).nice().range([l-d,s]),g=e.select(".bars").selectAll(".bar").data(a.current);g.exit().remove();const v=g.enter().append("g").attr("class","bar");if(v.append("rect").attr("x",(e=>f(e.x0)+1)).attr("width",(e=>Math.max(0,f(e.x1)-f(e.x0)-1))).attr("y",(e=>b(e.length))).attr("height",(e=>b(0)-b(e.length))),g.select("rect").attr("x",(e=>f(e.x0)+1)).attr("width",(e=>Math.max(0,f(e.x1)-f(e.x0)-1))).attr("y",(e=>b(e.length))).attr("height",(e=>b(0)-b(e.length))),v.append("text").attr("dy",".75em").attr("y",(e=>b(e.length)-10)).attr("x",(e=>f(e.x0)+1+Math.max(0,f(e.x1)-f(e.x0)-1)/2)).attr("text-anchor","middle").text((function(e){return e.length?e.length:""})),g.select("text").attr("dy",".75em").attr("y",(e=>b(e.length)-10)).attr("x",(e=>f(e.x0)+1+Math.max(0,f(e.x1)-f(e.x0)-1)/2)).attr("text-anchor","middle").text((e=>e.length?e.length:"")),m.length){const[t,r]=f.domain(),[n,a]=f.range(),i=(a-n)/(+r-+t)*3600*1e3,o=30,l=be(f).ticks(pe.every(1)).tickFormat((e=>i>=o?ve("%H:%M")(e):e.getHours()%(Math.floor(o/i)+1)?"":ve("%H:%M")(e)));l.scale(f),e.select(".x-axis").attr("transform","translate(0,70)").call(l),e.select(".brush").call(p),h.brushFilter&&e.select(".brush").call(p.move,h.brushFilter.map(f))}else e.select(".x-axis").html(""),e.select(".brush").call(p),e.select(".brush").html("").call(p.move,null)}),[i,m]),S((()=>{n.current&&(h.brushFilter||de(r.current).select(".brush").call(n.current.move,null))}),[h.brushFilter]),N.createElement("div",{ref:t},N.createElement("div",{style:{paddingLeft:10,paddingRight:10,display:"flex"}},Ce.t("peopleCounting"),N.createElement("div",{style:{marginLeft:"auto"}},null===f?null:N.createElement(Si,{label:Ce.t("selected")},N.createElement("span",null,f)),null===f?null:"/",N.createElement(Si,{label:Ce.t("total")},N.createElement("span",null,m.length)))),N.createElement("svg",{className:"people-histogram",ref:r,width:i,height:l,viewBox:`0 0 ${i} 100`},N.createElement("g",{className:"bars"}),N.createElement("g",{className:"x-axis"}),N.createElement("g",{className:"brush"})))}));_o.displayName="PeopleHistogram";const Lo=e=>{const{children:t,innerProps:r,...n}=e,{Option:a}=$,{data:i}=e,o={...r,style:{display:"flex",alignItems:"center",width:"auto"}};return N.createElement(a,{innerProps:o,...n},N.createElement(Mi,{data:i}),N.createElement("div",{style:{marginLeft:4}},t))},No=R((({store:e,onEventClick:t})=>{if(!e)return null;const{filters:r,setFilters:n}=e,{foundObjectTypesForSelect:a}=e.eventSchema,{ref:i,width:o,height:l}=B();return N.createElement(N.Fragment,null,N.createElement(Po,{store:e}),N.createElement("div",{style:{zIndex:2}},N.createElement(H,{closeMenuOnSelect:!1,isMulti:!0,onChange:n,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:a,placeholder:Ce.t("selectObjectType"),value:r,components:{MultiValueLabel:Pi,Option:Lo},styles:{...qi,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(Wi,{getter:e.getProbabilityThreshold,setter:e.setProbabilityThreshold}),e.filters.length?N.createElement(Hi,{value:e.colors,toggle:e.toggleColor,clear:e.clearColors}):null,e.analyticsEnabled?N.createElement(_o,null):null,N.createElement("div",{ref:i,style:{flex:1,overflow:"hidden"}},N.createElement(Co,{width:o,height:l,minColumnWidth:120,aspectRatio:1,store:e.eventsLoader,eventRenderer:({data:e,width:r,height:n})=>N.createElement(Ki,{data:e,cameraNameHidden:!0,onClick:t,width:r,height:n})})))}));No.displayName="EventSearch";const Io=e=>{var t;const r=null!==(t=A(_))&&void 0!==t?t:L;return N.createElement(bi.Provider,{value:r},N.createElement(No,{...e}))};var Do;Io.displayName="EventSearch",(Do={resources:{en:{translation:Ee}}})&&Object.assign(xe,Do),Ce.isInitialized?(xe.resources?Object.keys(xe.resources).forEach((e=>{Ce.addResourceBundle(e,"translation",xe.resources[e].translation,!0)})):console.warn("i18n is already initialized"),s(Ce.t)):c(Ce.init(xe));const ko=(e=L)=>{const t=new fi(e.eventSchema,e.events,e.notification);return t.initWith(e.api),t};export{ko as createEventSearchStore,Io as default};
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@3deye-toolkit/react-event-search",
3
- "version": "0.0.1-alpha.28",
3
+ "version": "0.0.1-alpha.30",
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.28",
11
- "@reach/tooltip": "^0.17.0",
12
- "@react-spring/web": "^9.4.2",
10
+ "@3deye-toolkit/core": "0.0.1-alpha.30",
11
+ "@floating-ui/react-dom-interactions": "^0.12.0",
12
+ "@mantine/hooks": "^5.5.6",
13
13
  "@sentry/browser": "^5.15.5",
14
14
  "@seznam/compose-react-refs": "^1.0.6",
15
15
  "clsx": "^1.1.1",
@@ -27,21 +27,17 @@
27
27
  "mobx": "^6.3.13",
28
28
  "mobx-react-lite": "^3.2.3",
29
29
  "react-datepicker": "^4.6.0",
30
- "react-ink": "^6.5.1",
30
+ "react-ink": "^6.5.3",
31
31
  "react-select": "^5.2.2",
32
- "react-virtualized-auto-sizer": "^1.0.6",
33
- "react-window": "^1.8.6",
34
- "react-window-infinite-loader": "^1.0.7",
35
32
  "resize-observer-polyfill": "^1.5.1",
36
33
  "rxjs": "^7.5.3"
37
34
  },
38
35
  "peerDependencies": {
39
- "react": "^16.8.0 || ^17",
40
- "react-dom": "^16.8.0 || ^17"
36
+ "react": "^16.8.0 || ^17 || ^18",
37
+ "react-dom": "^16.8.0 || ^17 || ^18"
41
38
  },
42
39
  "sideEffects": [
43
40
  "*.css"
44
41
  ],
45
- "license": "mit",
46
- "gitHead": "5fee2afc8e47448ae697956f0da87d06f31252a1"
47
- }
42
+ "license": "mit"
43
+ }