@3deye-toolkit/react-event-list 0.0.1-alpha.29 → 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.
@@ -1,12 +1,26 @@
1
- .x-3deye-popover {
2
- position: relative;
1
+ .x-3deye-popover-container {
2
+ background: #222;
3
+ box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgb(0 0 0 / 0.1),
4
+ inset 0 0 0 1px rgb(255 255 255 /0.05);
5
+ color: white;
6
+ border-radius: 6px;
7
+ padding: 8px;
8
+ text-align: left;
9
+ -webkit-animation: slide-in 0.15s ease-in;
10
+ animation: slide-in 0.15s ease-in;
11
+ }
12
+
13
+ @media(prefers-reduced-motion: reduce) {
14
+ .x-3deye-popover-container {
15
+ -webkit-animation: none;
16
+ animation: none;
17
+ }
3
18
  }
4
19
 
5
- .x-3deye-popover-body {
6
- background-color: white;
7
- padding: 8px;
8
- border-radius: 8px;
9
- box-shadow: 0 0 8px 0px black;
20
+
21
+ .x-3deye-popover-container .tip {
22
+ --tip-background: #222;
23
+ --tip-border: rgb(255 255 255 /0.05);
10
24
  }
11
25
 
12
26
  .x-3deye-button {
@@ -15,24 +29,23 @@
15
29
  border: none;
16
30
  position: relative;
17
31
  padding: 0 8px;
18
- height: 32px;
19
- text-transform: uppercase;
32
+ height: 32px;
20
33
  -webkit-user-select: none;
21
34
  -moz-user-select: none;
22
35
  -ms-user-select: none;
23
36
  user-select: none;
24
- display: inline-flex;
37
+ display: inline-flex;
25
38
  justify-content: center;
26
39
  align-items: center;
27
- border-radius: 4px;
28
- letter-spacing: .0107142857em;
29
- font-weight: 500;
40
+ border-radius: 4px;
41
+ letter-spacing: 0.0107142857em;
42
+ font-weight: 500;
30
43
  }
31
44
 
32
45
  .x-3deye-button sup {
33
- position: relative;
34
- top: -0.5em;
35
- left: 0.25em;
46
+ position: relative;
47
+ top: -0.5em;
48
+ left: 0.25em;
36
49
  }
37
50
 
38
51
  .x-3deye-button.x-3deye-button--fullwidth {
@@ -46,7 +59,7 @@
46
59
 
47
60
  .x-3deye-button--icon {
48
61
  border-radius: 16px;
49
- padding: 4px;
62
+ padding: 4px;
50
63
  width: 32px;
51
64
  height: 32px;
52
65
  display: inline-flex;
@@ -64,22 +77,22 @@
64
77
 
65
78
  .x-3deye-button.x-3deye-button--filled,
66
79
  .x-3deye-button.x-3deye-button--text {
67
- min-width: 80px;
68
- text-transform: capitalize;
69
- font-family: 'Roboto', sans-serif;
70
- font-size: 0.875rem;
71
- font-weight: 500;
72
- border-radius: 0.25rem;
73
- padding: 0 1rem;
80
+ min-width: 80px;
81
+ text-transform: capitalize;
82
+ font-family: 'Roboto', sans-serif;
83
+ font-size: 0.875rem;
84
+ font-weight: 500;
85
+ border-radius: 0.25rem;
86
+ padding: 0 1rem;
74
87
  }
75
88
 
76
89
  .x-3deye-button.x-3deye-button--filled {
77
- background-color: #27b9a1;
78
- color: white;
90
+ background-color: rgb(39, 185, 161);
91
+ color: white;
79
92
  }
80
93
 
81
94
  .x-3deye-button.x-3deye-button--filled:not(:disabled):hover {
82
- background-color: #61beaf;
95
+ background-color: rgb(34, 163, 142);
83
96
  }
84
97
 
85
98
  .x-3deye-button.x-3deye-button--filled:focus {
@@ -98,26 +111,25 @@
98
111
  color: white;
99
112
  }
100
113
 
101
- .x-3deye-button.x-3deye-button--overlay:focus, .x-3deye-button.x-3deye-button--overlay:not(:disabled):hover {
102
- background: rgba(0, 0, 0, 0.5);
114
+ .x-3deye-button.x-3deye-button--overlay:focus,
115
+ .x-3deye-button.x-3deye-button--overlay:not(:disabled):hover {
116
+ background: rgba(0, 0, 0, 0.5);
103
117
  border: 2px solid rgba(255, 255, 255, 0.5);
104
118
  }
105
119
 
106
- :root {
107
- --reach-tooltip: 1;
120
+ .x-3deye-button.x-3deye-button--overlay.x-3deye-button--overlay-danger:not(:disabled),
121
+ .x-3deye-button.x-3deye-button--overlay.x-3deye-button--overlay-danger:not(:disabled):hover {
122
+ background-color: rgba(156, 51, 49, 0.5);
108
123
  }
109
124
 
110
- [data-reach-tooltip] {
111
- z-index: 1;
112
- pointer-events: none;
113
- position: absolute;
114
- padding: 0.25em 0.5em;
115
- box-shadow: 2px 2px 10px hsla(0, 0%, 0%, 0.1);
116
- white-space: nowrap;
117
- font-size: 85%;
118
- background: #f0f0f0;
119
- color: #444;
120
- border: solid 1px #ccc;
125
+ .x-3deye-tooltip {
126
+ background: rgb(0 0 0 / 0.9);
127
+ color: white;
128
+ border: none;
129
+ border-radius: 4px;
130
+ padding: 0.5em 1em;
131
+ font-size: 12px;
132
+ border: rgb(255 255 255 / 0.15) 1px solid;
121
133
  }
122
134
 
123
135
  @charset "UTF-8";
@@ -893,12 +905,28 @@
893
905
  opacity: 0.5;
894
906
  }
895
907
 
908
+ .x-3deye-popover-container.popover-datetimepicker,
909
+ .x-3deye-popover-container.popover-datepicker {
910
+ background: white;
911
+ color: black;
912
+ }
913
+
914
+ .x-3deye-popover-container.popover-datetimepicker .tip,
915
+ .x-3deye-popover-container.popover-datepicker .tip {
916
+ --tip-background: white;
917
+ --tip-border: transparent;
918
+ }
919
+
920
+ .popover-datetimepicker {
921
+ --surface-inverse: #e1e1e1;
922
+ }
923
+
896
924
  .popover-datepicker .react-datepicker {
897
- width: 242px;
925
+ width: 242px;
898
926
  }
899
927
 
900
928
  .popover-datetimepicker .react-datepicker {
901
- width: 328px;
929
+ width: 328px;
902
930
  }
903
931
 
904
932
  .popover-datetimepicker .react-datepicker__time-list {
@@ -907,15 +935,14 @@
907
935
 
908
936
  .popover-datepicker.x-3deye-popover-body,
909
937
  .popover-datetimepicker.x-3deye-popover-body {
910
- display: flex;
911
- flex-direction: column;
912
- gap: 10px;
938
+ display: flex;
939
+ flex-direction: column;
940
+ gap: 10px;
913
941
  }
914
942
 
915
943
  .segmented-control-wrapper {
916
944
  display: inline-grid;
917
945
  border-radius: 6px;
918
- /* background: rgba(0, 0, 0, 0.065); */
919
946
  background-color: var(--surface-inverse);
920
947
  }
921
948
 
@@ -1 +1 @@
1
- import{format as e,subHours as t,startOfHour as r,isSameYear as n,isSameDay as i}from"date-fns/esm";import a from"i18next";import{from as o,Observable as l,Subscription as s,of as c,throwError as d,EMPTY as u}from"rxjs";import h,{useContext as m,useRef as p,createContext as f,useState as b,Children as v,useEffect as g,useCallback as y,useLayoutEffect as E}from"react";import{AppContext as w,app as C}from"@3deye-toolkit/core";import{computed as x,makeObservable as O,observable as P,action as N,runInAction as L,reaction as I}from"mobx";import{subHours as M}from"date-fns";import{mergeMap as j,catchError as T,switchMap as _,mapTo as k,concatMap as S}from"rxjs/operators";import D,{components as F}from"react-select";import z from"clsx";import{observer as A,useLocalObservable as H,Observer as $}from"mobx-react-lite";import{useSpring as R,animated as V}from"@react-spring/web";import B from"react-dom";import U from"react-datepicker";import W from"react-ink";import G from"@reach/tooltip";import q from"@seznam/compose-react-refs";import Y from"react-virtualized-auto-sizer";import X from"react-window-infinite-loader";import{VariableSizeGrid as Z}from"react-window";import*as J from"@sentry/browser";var K={filter:"Filter",button:{ok:"Ok"},noEventsFound:"no events found",showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events"};const Q=new Map,ee={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},te=a.createInstance();function re(t,r){const n=Q.get(te.language);return e(t,r,{locale:n})}const ne=h.createContext(null);var ie,ae;function oe(e,t=!1){const r=x(e);return new l((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"}(ie||(ie={})),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"}(ae||(ae={}));class le{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 s?e.closed||e.unsubscribe():e()}))}}const se=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class ce{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}),O(this,{id:x,startTime:x,endTime:x,acknowledged:x,isLive:x,raw:P.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=se.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!se.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class de extends le{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:i,cameras:a,polygons:o})=>this.api.cameras.GetSensorEventsPage({sensorIds:a,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==i?void 0:i.nextPageToken},n,o).pipe(j((e=>e.success?c({events:e.resultItems,pageInfo:e.pageInfo}):d((()=>e.error)))),T((e=>(console.error(e),this.error=e,c({events:[],pageInfo:null})))))}),O(this,{data:P.ref,cameras:P.struct,detectedObjects:P.struct,from:P,to:P,sortDirection:P,probabilityThreshold:P,pendingData:P.ref,liveUpdateMode:P,setLiveUpdateMode:N,updateTrigger:P,colors:P.ref,flushUpdates:N,pageInfo:P.ref,isLive:x,loading:P,loadMoreTrigger:P,retryTrigger:P,error:P.ref,loadMore:N,filterJson:x})}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=oe((()=>({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(_((e=>oe((()=>this.retryTrigger),!0).pipe(k(e)))),_((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i,polygons:a})=>(L((()=>{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:i,pageInfo:this.pageInfo,polygons:a}))))).subscribe((({events:e,pageInfo:t})=>{L((()=>{var r,n,i;if(!t)return;const a=e.map(ue);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:this.eventTypes.map((e=>ae[e])),from:null!==(n=null===(r=a[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:M(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(i=this.probabilityThreshold)&&void 0!==i?i:void 0}),a):this.data=a,this.eventsStore.add(a),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(_((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i})=>oe((()=>this.loadMoreTrigger)).pipe(S((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:i,pageInfo:this.pageInfo,polygons:this.polygons}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(ue);this.eventsStore.add(r),L((()=>{this.data=this.data.concat(r),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(oe((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(_((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?oe((()=>this.eventsStore.recentAdditions)):u))).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&&L((()=>{this.data=[...t,...this.data]}))}))),this.disposables.push(oe((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(_((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?oe((()=>this.eventsStore.recentAdditions)):(this.pendingData&&L((()=>this.pendingData=[])),u)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&L((()=>{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=>ae[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 s?e.closed||e.unsubscribe():e()}))}}function ue(e){return new ce(e)}const he={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"},me={50:"#e0f7fa",100:"#b2ebf2",200:"#80deea",300:"#4dd0e1",400:"#26c6da",500:"#00bcd4",600:"#00acc1",700:"#0097a7",800:"#00838f",900:"#006064",A100:"#84ffff",A200:"#18ffff",A400:"#00e5ff",A700:"#00b8d4"},pe={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"},fe={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"},be={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"},ve={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"};class ge extends le{constructor(e){super(),Object.defineProperty(this,"cameraFilters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"objectFilters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"date",{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,"facesProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.7}),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,"eventsLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"toggleSorting",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.sortDirection="ASC"===this.sortDirection?"DESC":"ASC",null===this.date&&(this.date=t(r(new Date),1))}}),Object.defineProperty(this,"applyFilters",{enumerable:!0,configurable:!0,writable:!0,value:()=>{var e;this.eventsLoader.cameras=this.cameraFilters.map((e=>e.id)),this.eventsLoader.detectedObjects=this.objectFilters.map((e=>e.id)),this.eventsLoader.colors=this.colors,this.eventsLoader.probabilityThreshold=this.objectFilters.length?this.probabilityThreshold:null,"ASC"===this.sortDirection?(this.eventsLoader.sortDirection="ASC",this.eventsLoader.to=void 0,this.eventsLoader.from=this.date):(this.eventsLoader.sortDirection="DESC",this.eventsLoader.from=void 0,this.eventsLoader.to=null!==(e=this.date)&&void 0!==e?e:void 0)}}),Object.defineProperty(this,"getProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.probabilityThreshold}),Object.defineProperty(this,"setProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.probabilityThreshold=e,this.applyFilters()}}),O(this,{cameraFilters:P.ref,objectFilters:P.ref,date:P,sortDirection:P,probabilityThreshold:P,setProbabilityTreshold:N,facesProbabilityThreshold:P,colors:P.ref,someAnalyticsFilterSelected:x,filters:x,setFilters:N,load:N,toggleColor:N.bound,clearColors:N.bound,applyFilters:N,toggleSorting:N}),this.eventsLoader=new de(e),this.eventsLoader.loading=!0,this.eventsLoader.probabilityThreshold=null}get someAnalyticsFilterSelected(){return!!this.objectFilters.length}get filters(){return this.objectFilters.concat(this.cameraFilters)}load(){this.eventsLoader.load()}setFilters(e){this.cameraFilters=e?e.filter((e=>!("type"in e))):[],this.objectFilters=e?e.filter((e=>"type"in e)):[]}toggleColor(e){const t=new Set(this.colors);this.colors.has(e)?t.delete(e):t.add(e),this.colors=t,this.applyFilters()}clearColors(){this.colors=new Set,this.applyFilters()}afterInit(){this.eventsLoader.initWith(this.api)}dispose(){this.disposables.forEach((e=>{e instanceof s?e.closed||e.unsubscribe():e()})),this.eventsLoader.dispose()}}var ye,Ee=(ye=8,{container:e=>({...e,padding:ye}),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*ye}px)`,marginTop:ye?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%)"})});function we(e){return t=>{const{size:r=24,color:n="currentColor",className:i,...a}=t,o=e.viewBox||"0 0 24 24",l=e.svg;return h.createElement("svg",{preserveAspectRatio:"xMinYMin",className:z("icon",i),width:r,fill:n,viewBox:o,...a},l)}}const Ce=we({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Ce.displayName="LabelIcon";const xe=we({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});xe.displayName="CameraIcon";const Oe=we({viewBox:"0 0 24 24",svg:h.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"})});Oe.displayName="LuggageIcon";const Pe=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Pe.displayName="CarIcon";const Ne=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Ne.displayName="BoatIcon";const Le=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.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"}))});Le.displayName="BicycleIcon";const Ie=we({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Ie.displayName="DirectionsWalkIcon";const Me=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),h.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),h.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),h.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),h.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"}))});Me.displayName="PetsIcon";const je=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}),h.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"}),h.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"}),h.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"}))});je.displayName="LicensePlateIcon";const Te=({data:e})=>{const t=16;return"licensePlate"===e.type?null:"detectedObject"!==e.type?h.createElement(xe,{size:t}):"Luggage"===e.id?h.createElement(Oe,{size:t}):"Car"===e.id?h.createElement(Pe,{size:t}):"Person"===e.id?h.createElement(Ie,{size:t}):"Bicycle"===e.id?h.createElement(Le,{size:t}):"Boat"===e.id?h.createElement(Ne,{size:t}):"Animal"===e.id?h.createElement(Me,{size:t}):"LicensePlate"===e.id?h.createElement(je,{size:t}):h.createElement(Ce,{size:t})},_e=e=>{const{children:t,innerProps:r,...n}=e,{Option:i}=F,{data:a}=e;if("licensePlate"===a.type)return h.createElement(i,{innerProps:r,...n},h.createElement("span",{style:{paddingLeft:8,paddingRight:8,borderRadius:4,border:"1px solid black"}},t));if("detectedObject"===a.type){const e={display:"inline-flex",alignItems:"center",width:"auto"},o={...r,style:e};return h.createElement(i,{innerProps:o,...n},h.createElement(Te,{data:a}),h.createElement("div",{style:{marginLeft:4}},t))}return h.createElement(i,{...e})},ke=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:i}=F,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center"}};return h.createElement(i,{innerProps:o,...n},h.createElement(Te,{data:a}),h.createElement("div",{style:{marginLeft:4}},t))},Se=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Se.displayName="FilterListIcon";const De={...Ee,multiValue:(e,{data:t})=>"color"in t?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>"color"in t?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>"color"in t?{...e,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.7)",color:t.color}}:{...e,color:"hsl(0, 0%, 20%)"},option:(e,{data:t,isFocused:r})=>"color"in t?"type"in t&&"licensePlate"===t.type?{...e,color:t.color,backgroundColor:r?me[50]:"transparent",":active":{...e[":active"],backgroundColor:me[100]}}:{...e,color:t.color}:{...e,color:"black"}},Fe=e=>{const{children:t,...r}=e;return h.createElement(F.Placeholder,{...r},h.createElement(Se,{size:16,style:{position:"relative",top:4}})," ",t)},ze=A((({addionalFiltersEnabled:e,store:t})=>{const{cameras:r,eventSchema:n}=m(ne),i=p({opened:!1});return h.createElement(D,{closeMenuOnSelect:!1,isMulti:!0,onChange:(e,r)=>{t.setFilters(e),"remove-value"!==r.action||i.current.opened||t.applyFilters()},onMenuOpen:()=>i.current.opened=!0,onMenuClose:()=>{i.current.opened=!1,t.applyFilters()},getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:(()=>{if(!n)return[];const t=e?n.foundObjectTypesForSelect:[];return r.loaded?[].concat(t,r.data.slice()):t})(),placeholder:te.t("filter"),value:t.filters,components:{MultiValueLabel:ke,Option:_e,Placeholder:Fe},styles:De})}));ze.displayName="EventsPanelSelect";const Ae=e=>`scale(${e})`,He=({children:e,from:t,style:r})=>{const n=R({opacity:1,from:{opacity:0},config:{tension:300}});return h.createElement(V.div,{style:{...r,...n,transform:n.opacity.to(Ae),transformOrigin:`${t||"bottom"} center`,width:"max-content"}},e)},$e=document.body;class Re extends h.Component{constructor(e){super(e),Object.defineProperty(this,"el",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.el=document.createElement("div")}componentDidMount(){$e.appendChild(this.el)}componentWillUnmount(){$e.removeChild(this.el)}render(){return B.createPortal(this.props.children,this.el)}}const Ve=({width:e,height:t,color:r,position:n="top",style:i})=>{const a=[0,"top"===n?t:0],o=[e,a[1]],l=[e/2,t-a[1]],s=[e/4,t*("top"===n?3:1)/4],c=[.325*e,t-a[1]],d=[e-c[0],c[1]],u=[e-s[0],s[1]],m=e=>e.join(","),p=`M ${m(a)} C ${m(s)} ${m(c)} ${m(l)} ${m(d)} ${m(u)} ${m(o)} Z`;return h.createElement("svg",{className:"tip",style:i,width:e,height:t,fill:r},h.createElement("path",{d:p}))};class Be extends h.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:h.createRef()}),Object.defineProperty(this,"popoverRef",{enumerable:!0,configurable:!0,writable:!0,value:h.createRef()}),Object.defineProperty(this,"outsideClickListener",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=e.target;if(this.popoverRef.current.contains(t))return;const r=this.targetRef.current;r&&r.contains(t)||this.props.onCloseRequest()}}),Object.defineProperty(this,"updatePosition",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!this.popoverRef)return;const{disablePortal:e}=this.props,t=this.targetRef.current;if(!t)return void console.warn("popover: no target element found");const{top:r,left:n,bottom:i,height:a,width:o}=t.getBoundingClientRect();let l="calc(50% - 12px)",s="auto";const c=this.popoverRef.current;let d="bottom"===this.props.placement?i+10:r-c.clientHeight-10,u=n+o/2-c.clientWidth/2,h="bottom"===this.props.placement?"top":"bottom";d<0&&(d=i+10,h="top"),u<0&&(u=0,l=n+o/2-12),u+c.clientWidth>window.innerWidth&&(u=window.innerWidth-c.clientWidth,l=n-u+o/2-12),e&&(d=a+10,u=0,l=8,"top"===this.props.placement&&(s=d,d="auto")),this.setState({top:d,bottom:s,left:u,tipPosition:h,tipOffset:l},(()=>{this.forceUpdate()}))}})}componentWillUnmount(){this.stopOutsideClickListening()}componentDidUpdate(e){const{ignoreOutsideClick:t}=this.props;this.props.opened&&!e.opened&&(t||this.startOutsideClickListening(),requestAnimationFrame(this.updatePosition)),!this.props.opened&&e.opened&&this.stopOutsideClickListening()}render(){const{top:e,left:t,bottom:r,tipPosition:n,tipOffset:i}=this.state,{className:a,opened:o,disablePortal:l,disableAnimation:s}=this.props,c={position:"absolute",left:i};"bottom"===n?c.bottom=-8:c.top=-8;const d=z(a,"x-3deye-popover-body");let u=null;if(o){const i={zIndex:l?1:100000001,position:"absolute",top:e,bottom:r,left:t},a=h.createElement("div",{className:d,ref:this.popoverRef},this.props.children,h.createElement(Ve,{width:24,height:8,position:n,color:"white",style:c}));u=s?h.createElement("div",{style:i},a):h.createElement(He,{from:n,style:i},a)}const m=h.cloneElement(this.props.target,{ref:this.targetRef});if(l)return h.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},m,u);const p=o&&h.createElement(Re,null,u);return h.createElement(h.Fragment,null,m,p)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}const Ue={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},We=({label:e,children:t})=>h.createElement(G,{label:e,style:Ue},t);We.displayName="Tooltip";class Ge extends h.Component{render(){const{forwardedRef:e,children:t,className:r,fullWidth:n,variant:i,type:a,title:o,...l}=this.props,s=z(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},i?`x-3deye-button--${i}`:void 0),c=h.createElement("button",{ref:e,className:s,type:a||"button",...l},t,l.disabled?null:h.createElement(W,null));return o?h.createElement(We,{label:o},c):c}}const qe=h.forwardRef(((e,t)=>h.createElement(Ge,{forwardedRef:t,...e}))),Ye=we({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.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"}),h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Ye.displayName="CloseIcon";const Xe=(e,t,r)=>Math.min(Math.max(e,t),r),Ze=()=>{},Je=(e,t,r,n)=>Xe(Math.floor((e-t)/r*n),0,n-1),Ke=f({value:null,onPointerDown:Ze,setCurrentValue:Ze,state:{currentIdx:0,currentValue:null,options:[]}});class Qe{constructor(e=0){Object.defineProperty(this,"currentIdx",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"setCurrentIdx",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.currentIdx=e}}),Object.defineProperty(this,"setOptions",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.options=e}}),this.currentIdx=e,O(this,{currentIdx:P,options:P.ref,currentValue:x,setCurrentIdx:N,setOptions:N})}get currentValue(){return this.options[this.currentIdx]}}const et=A((({value:e,onChange:t,children:r,style:n})=>{const[i,a]=b(!1),o=p(null),l=v.map(r,(e=>null==e?void 0:e.props.value))||[],s=H((()=>new Qe(l.indexOf(e))));s.setOptions(l);const c=v.count(r);g((()=>{s.setCurrentIdx(l.indexOf(e))}),[e]),g((()=>{var e;if(!i)return;const r=null===(e=o.current)||void 0===e?void 0:e.getBoundingClientRect();if(!r)return;const n=({clientX:e})=>{s.setCurrentIdx(Je(e,r.left,r.width,c))},d=()=>{a(!1),t(l[s.currentIdx])};return document.addEventListener("pointermove",n),document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",d)}}),[i,c]);return h.createElement(Ke.Provider,{value:{value:e,state:s,onPointerDown:e=>{const t=o.current;if(!t)return;const{left:r,width:n}=t.getBoundingClientRect(),i=Je(e.clientX,r,n,c);i!==s.currentIdx&&s.setCurrentIdx(i),a(!0)},setCurrentValue:e=>{s.setCurrentIdx(l.indexOf(e))}}},h.createElement("div",{className:"segmented-control-wrapper",style:n},h.createElement("div",{role:"radiogroup",ref:o,className:"segmented-control",style:{"--indicator-offset":100*s.currentIdx+"%"}},h.createElement("div",{"aria-hidden":!0,className:z("segmented-control-indicator",{active:i}),style:{width:100/l.length+"%"}},h.createElement("div",{className:"segmented-control-indicator-inner"})),r)))}));et.displayName="SegmentedControl";const tt=A((({value:e,children:t})=>{const r=m(Ke);return h.createElement("button",{role:"radio","aria-checked":r.state.currentValue===e,tabIndex:0,className:z("segmented-control-button",{current:r.state.currentValue===e}),onPointerDown:r.onPointerDown,onClick:()=>r.setCurrentValue(e)},t)}));tt.displayName="SegmentedControlOption";const rt=A((({store:e})=>{const{date:t,sortDirection:r}=e,n=H((()=>({opened:!1,toggle(){this.opened=!this.opened},close(){this.opened=!1,e.applyFilters()},onDateChange(t){e.date=t},clear(){e.date=null,e.applyFilters()}}))),i=h.createElement("div",{style:{flex:1,display:"flex",position:"relative"}},h.createElement(qe,{className:"date-button",style:{flex:1,alignItems:"flex-start",borderRadius:0},onClick:n.toggle},t?h.createElement("sup",null,"ASC"===r?"From":"To"):null,h.createElement("span",null,t?re(t,"MMM d, HH:mm"):"live")),t?h.createElement(qe,{className:"x-3deye-button--icon",style:{position:"absolute",right:0},onClick:n.clear},h.createElement(Ye,{size:16})):null);return h.createElement("div",{className:"events-panel-datepicker"},h.createElement("div",{style:{position:"relative"}},h.createElement(Be,{target:i,opened:n.opened,onCloseRequest:n.close,disableAnimation:!0,className:"popover-datetimepicker"},h.createElement(et,{value:r,onChange:e.toggleSorting},h.createElement(tt,{value:"ASC"},"From"),h.createElement(tt,{value:"DESC"},"To")),h.createElement(U,{selected:t,onChange:n.onDateChange,showTimeSelect:!0,dateFormat:"MMM d, HH:mm",timeFormat:"HH:mm",inline:!0}),h.createElement(qe,{onClick:n.close,variant:"filled",style:{borderRadius:4}},te.t("button.ok")))))}));rt.displayName="EventsPanelDatepicker";const nt=e=>Math.round(e),it=h.forwardRef((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:i=!1,labelFormat:a=(e=>`${e}`),style:o},l)=>{const s=p(null),c=p(null),[d,u]=b(!1),[m,f]=b(e);g((()=>{if(!d)return;const e=s.current;if(!e)return;let i=0,a=0;const o=e.getBoundingClientRect();if(!o)return;const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(i=Xe(e-o.x,0,o.width),l=i/o.width*100,c.current.style.transform=`translateX(${i}px)`):(a=o.height-Xe(r-o.y,0,o.height),l=a/o.height*100,c.current.style.transform=`translateY(${-a}px)`),f(l),null==t||t(nt(l))},h=({clientX:e,clientY:i})=>{if(u(!1),!c.current)return;const a="horizontal"===n?Xe(e-o.x,0,o.width)/o.width*100:100*(1-Xe(i-o.y,0,o.height)/o.height);c.current.style.transform="",f(a),null==t||t(nt(a)),null==r||r(nt(a))},m=()=>{if(u(!1),!c.current)return;const e="horizontal"===n?i/o.width*100:a/o.height*100;c.current.style.transform="",null==t||t(nt(e)),null==r||r(nt(e))};return e.addEventListener("pointercancel",m),e.addEventListener("pointermove",l),e.addEventListener("pointerup",h),()=>{e.removeEventListener("pointercancel",m),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",h)}}),[d,n,t]);const v=y((({clientX:e,clientY:r,pointerId:a})=>{if(!s.current||i)return;u(!0),s.current.setPointerCapture(a);const o=s.current.getBoundingClientRect();if(!o)return;if(!c.current)return;let l=0;if("horizontal"===n){const t=Xe(e-o.x,0,o.width);l=t/o.width*100,c.current.style.transform=`translateX(${t}px)`}else{const e=o.height-Xe(r-o.y,0,o.height);l=e/o.height*100,c.current.style.transform=`translateY(${-e}px)`}f(l),null==t||t(nt(l))}),[n,i]),E=y((n=>{if(i)return;let a=null;"ArrowLeft"===n.code?a=Math.max(e-1,0):"ArrowRight"===n.code?a=Math.min(e+1,100):"ArrowDown"===n.code?a=Math.max(e-1,0):"ArrowUp"===n.code&&(a=Math.min(e+1,100)),null!==a&&(n.stopPropagation(),n.preventDefault(),null==t||t(a),null==r||r(a))}),[e,t,r,n,i]);return h.createElement("div",{ref:q(l,s),tabIndex:0,onKeyDown:E,className:z("x-3deye-slider",n,{disabled:i}),onPointerDown:v,style:o},h.createElement("div",{className:"x-3deye-slider__track"},h.createElement("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${d?m:e}%`:void 0,height:"vertical"===n?`${d?m:e}%`:void 0}})),h.createElement("div",{ref:c,className:z("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"}},h.createElement("div",{className:"x-3deye-slider__label "+(d?"open":"")},a(d?nt(m):e))))}));it.displayName="Slider";const at=A((({getter:e,setter:t})=>{const[r,n]=b(0),i=p(null),a=Math.floor(100*e());return g((()=>I(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),h.createElement("div",{ref:i,style:{paddingLeft:8,paddingRight:8,marginTop:5}},h.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},h.createElement("div",null,"CONFIDENCE"),h.createElement("div",{style:{fontSize:"1.1em"}},a,"%")),h.createElement("div",{style:{padding:"0 10px"}},h.createElement(it,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})))}));at.displayName="ProbabilitySlider";const ot=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),h.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});ot.displayName="DoneIcon";const lt=[{color:be[500],name:"red",highlightColor:be[100]},{color:pe[500],name:"green",highlightColor:pe[100]},{color:he[500],name:"blue",highlightColor:he[100]},{color:ve[500],name:"yellow",highlightColor:ve[900]},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:fe[500],name:"dimgrey",highlightColor:fe[100]}],st=A((({value:e,clear:t,toggle:r})=>h.createElement("div",{className:"color-selector"},h.createElement("div",null,"COLOR"),h.createElement("div",{className:"color-selector__items"},lt.map((({color:t,highlightColor:n,name:i})=>h.createElement("button",{key:i,className:z("color-selector__item",{selected:e.has(i)}),style:{backgroundColor:t},onClick:r.bind(null,i)},h.createElement(ot,{color:n,size:20})))),h.createElement(qe,{className:"color-selector__clear",disabled:!e.size,onClick:t},h.createElement(Ye,{size:20}))))));st.displayName="ColorSelector";const ct=({size:e=48})=>h.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},h.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));ct.displayName="Preloader";var dt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ut="object"==typeof dt&&dt&&dt.Object===Object&&dt,ht="object"==typeof self&&self&&self.Object===Object&&self,mt=ut||ht||Function("return this")(),pt=mt.Symbol,ft=pt,bt=Object.prototype,vt=bt.hasOwnProperty,gt=bt.toString,yt=ft?ft.toStringTag:void 0;var Et=function(e){var t=vt.call(e,yt),r=e[yt];try{e[yt]=void 0;var n=!0}catch(e){}var i=gt.call(e);return n&&(t?e[yt]=r:delete e[yt]),i},wt=Object.prototype.toString;var Ct=Et,xt=function(e){return wt.call(e)},Ot=pt?pt.toStringTag:void 0;var Pt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Nt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ot&&Ot in Object(e)?Ct(e):xt(e)},Lt=Pt;var It,Mt=function(e){if(!Lt(e))return!1;var t=Nt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},jt=mt["__core-js_shared__"],Tt=(It=/[^.]+$/.exec(jt&&jt.keys&&jt.keys.IE_PROTO||""))?"Symbol(src)_1."+It:"";var _t=function(e){return!!Tt&&Tt in e},kt=Function.prototype.toString;var St=Mt,Dt=_t,Ft=Pt,zt=function(e){if(null!=e){try{return kt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},At=/^\[object .+?Constructor\]$/,Ht=Function.prototype,$t=Object.prototype,Rt=Ht.toString,Vt=$t.hasOwnProperty,Bt=RegExp("^"+Rt.call(Vt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Ut=function(e){return!(!Ft(e)||Dt(e))&&(St(e)?Bt:At).test(zt(e))},Wt=function(e,t){return null==e?void 0:e[t]};var Gt=function(e,t){var r=Wt(e,t);return Ut(r)?r:void 0},qt=Gt(Object,"create"),Yt=qt;var Xt=function(){this.__data__=Yt?Yt(null):{},this.size=0};var Zt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Jt=qt,Kt=Object.prototype.hasOwnProperty;var Qt=function(e){var t=this.__data__;if(Jt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Kt.call(t,e)?t[e]:void 0},er=qt,tr=Object.prototype.hasOwnProperty;var rr=function(e){var t=this.__data__;return er?void 0!==t[e]:tr.call(t,e)},nr=qt;var ir=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nr&&void 0===t?"__lodash_hash_undefined__":t,this},ar=Xt,or=Zt,lr=Qt,sr=rr,cr=ir;function dr(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])}}dr.prototype.clear=ar,dr.prototype.delete=or,dr.prototype.get=lr,dr.prototype.has=sr,dr.prototype.set=cr;var ur=dr;var hr=function(){this.__data__=[],this.size=0};var mr=function(e,t){return e===t||e!=e&&t!=t};var pr=function(e,t){for(var r=e.length;r--;)if(mr(e[r][0],t))return r;return-1},fr=pr,br=Array.prototype.splice;var vr=function(e){var t=this.__data__,r=fr(t,e);return!(r<0)&&(r==t.length-1?t.pop():br.call(t,r,1),--this.size,!0)},gr=pr;var yr=function(e){var t=this.__data__,r=gr(t,e);return r<0?void 0:t[r][1]},Er=pr;var wr=pr;var Cr=function(e,t){var r=this.__data__,n=wr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},xr=hr,Or=vr,Pr=yr,Nr=function(e){return Er(this.__data__,e)>-1},Lr=Cr;function Ir(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])}}Ir.prototype.clear=xr,Ir.prototype.delete=Or,Ir.prototype.get=Pr,Ir.prototype.has=Nr,Ir.prototype.set=Lr;var Mr=Ir,jr=Gt(mt,"Map"),Tr=ur,_r=Mr,kr=jr;var Sr=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Dr=function(e,t){var r=e.__data__;return Sr(t)?r["string"==typeof t?"string":"hash"]:r.map},Fr=Dr;var zr=Dr;var Ar=Dr;var Hr=Dr;var $r=function(e,t){var r=Hr(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Rr=function(){this.size=0,this.__data__={hash:new Tr,map:new(kr||_r),string:new Tr}},Vr=function(e){var t=Fr(this,e).delete(e);return this.size-=t?1:0,t},Br=function(e){return zr(this,e).get(e)},Ur=function(e){return Ar(this,e).has(e)},Wr=$r;function Gr(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])}}Gr.prototype.clear=Rr,Gr.prototype.delete=Vr,Gr.prototype.get=Br,Gr.prototype.has=Ur,Gr.prototype.set=Wr;var qr=Gr;function Yr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Yr.Cache||qr),r}Yr.Cache=qr;const Xr=Yr((()=>{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})),Zr=A((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:i})=>{const a=p(null),o=p(null);return h.createElement("div",{ref:a,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=a.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(),a.current&&(null===(t=o.current)||void 0===t||t.toggleAt(a.current,{top:e.clientY,left:e.clientX}))},draggable:!0},t,i&&h.createElement(i,{ref:o,data:e}))}));Zr.displayName="EventListItem";const Jr=({className:e,style:t,box:{Top:r,Left:n,Right:i,Bottom:a}})=>h.createElement(h.Fragment,null,h.createElement("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-a)+"%",right:100*(1-i)+"%",...t}}));Jr.displayName="LicensePlateLpr";const Kr=({Type:e,Box:t,Probability:r,width:n,height:i})=>{const{eventSchema:a}=m(ne),o=p(null),{Top:l,Left:s,Right:c,Bottom:d}=t;return E((()=>{if(!n||!i)return;if(!o.current)return;const e=o.current.getBoundingClientRect();let t=(s+c)/2*n-e.width/2,r=l*i-e.height-4;r<0&&(r=d*i+4),t<0&&(t=0),t>n-e.width&&(t=n-e.width),r>i-e.height&&(r=i-e.height),o.current.style.top=`${r}px`,o.current.style.left=`${t}px`})),h.createElement(h.Fragment,null,h.createElement(Jr,{box:t,style:{outline:`2px solid ${a.colorsByFoundObjectType.get(e)}`}}),h.createElement("div",{ref:o,className:"event-list-item__detected-object-label",title:`${e.toLowerCase()} ${Math.floor(100*r)}%`},h.createElement("div",{style:{padding:4,lineHeight:"24px"}},e.toLowerCase()),h.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:a.colorsByFoundObjectType.get(e)}},Math.floor(100*r),"%")))};function Qr({style:e}){return h.createElement("div",{className:"frame",style:e},h.createElement("div",{className:"corner-highlight-tl"}),h.createElement("div",{className:"corner-highlight-tr"}),h.createElement("div",{className:"corner-highlight-br"}),h.createElement("div",{className:"corner-highlight-bl"}))}Kr.displayName="DetectedObjectHighlight";const en=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:i,thumbHeight:a,width:o,height:l})=>{const{Top:s,Left:c,Right:d,Bottom:u}=t,m=100/i/(d-c),f={top:2},b=p(null);return E((()=>{if(!b.current)return;const e=b.current.getBoundingClientRect();let t=(c+d)/2*o-e.width/2,r=s*l-e.height-4;r<0&&(r=u*l+4),t<0&&(t=0),t>o-e.width&&(t=o-e.width),b.current.style.top=`${r}px`,b.current.style.left=`${t}px`})),c>=1-d?f.left=2:f.right=2,h.createElement(h.Fragment,null,h.createElement("div",{ref:b,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`},h.createElement("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"}},e),h.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"}},Math.floor(100*r),"%")),h.createElement(Jr,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),h.createElement("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:i*(d-c)*m,height:a*(u-s)*m,...f}},h.createElement("img",{style:{width:i*m,height:a*m,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),h.createElement(Qr,null)))};en.displayName="FaceHighlight";const tn=h.memo((({value:e})=>e?h.createElement(h.Fragment,null,e.split("").map(((e,t)=>{const r=e.charCodeAt(0);return r<48||r>57?h.createElement(h.Fragment,{key:t},e):h.createElement("span",{key:t,className:"digit"},e)}))):null));tn.displayName="LicensePlateNumber";const rn=({detectedObject:e,height:t,width:r,url:n,thumbWidth:i,thumbHeight:a})=>{const{Type:o,Box:{Top:l,Left:s,Right:c,Bottom:d},Probability:u}=e,m=e.Value||e.Number,f=p(null);E((()=>{if(!f.current)return;const e=f.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,i=l*t-e.height-4;i<0&&(i=d*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),f.current.style.top=`${i}px`,f.current.style.left=`${n}px`}));const b={top:2};s>=1-c?b.left=2:b.right=2;const v=100/i/(c-s);return h.createElement(h.Fragment,null,h.createElement("div",{ref:f,className:"event-list-item__license-plate-label trigger",title:`${o.toLowerCase()} ${Math.floor(100*u)}%`},h.createElement("div",{style:{padding:4}},h.createElement(tn,{value:m})),h.createElement("div",{className:"event-list-item__license-plate-label__caption"},Math.floor(100*u),"%")),h.createElement(Jr,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),h.createElement("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:i*(c-s)*v,height:a*(d-l)*v+16,position:"absolute",...b}},h.createElement("img",{style:{width:i*v,height:a*v,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),h.createElement("div",{className:"plate-number"},h.createElement(tn,{value:m})),h.createElement(Qr,{style:{height:a*(d-l)*v}})))};rn.displayName="LicensePlateHighlight";const nn=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});nn.displayName="ThermostatIcon";const an=A((({data:e})=>{if("Temperature"!==e.type)return null;let t=Number(e.raw.data);return t=5*(t-32)/9+273.15,h.createElement("div",{className:"event-list-item__temperature"},h.createElement(nn,null),(t-273.15).toFixed(1),"°C / ",(9*t/5-459.67).toFixed(1),"°F")}));an.displayName="Temperature";const on=A((({data:e,cameraNameHidden:t})=>{var r;const a=m(ne),{cameras:o}=a,l=o.loaded&&(null===(r=o.camerasById.get(e.cameraId))||void 0===r?void 0:r.name)||"...";return h.createElement("div",{className:"event-list-item-caption"},h.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",a="";return n(e,new Date)?i(e,new Date)?r=a="HH:mm":i(e,t)?(r="EEE d MMM HH:mm",a="HH:mm"):r=a="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",a="d MMM HH:mm"):r=a="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",a+=":ss"),+e==+t?`${re(e,r)}`:`${re(e,r)} - ${re(t,a)}`}(e.startTime,e.endTime)),t?null:h.createElement("div",{className:"event-list-item__camera-name",title:l},l),+e.endTime-+e.startTime>0&&h.createElement("div",{className:"event-list-item__duration"},function(e,t=!0){if((e=Math.round(e/1e3))<60)return`${e}s`;const r=e%60,n=t?`${r}`:`${r}`.padStart(2,"0");let i=(e-r)/60;if(i<60)return!r&&t?`${i}m`:`${i}m ${n}s`;const a=Math.floor(i/60);if(i-=60*a,!r&&!i&&t)return`${a}h`;const o=t?`${i}`:`${i}`.padStart(2,"0");return!r&&i&&t?`${a}h ${o}m`:`${a}h ${o}m ${n}s`}(+e.endTime-+e.startTime)),h.createElement(an,{data:e}))}));on.displayName="EventListItemCaption";const ln=A((({url:e,noPreview:t,width:r})=>h.createElement(h.Fragment,null,e?h.createElement("img",{key:e,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e}):null,h.createElement(W,{radius:r}),t?h.createElement("div",{className:"no-preview-overlay"}):null)));ln.displayName="EventThumbnail";const sn=A((({data:e,width:t,height:r,cameraNameHidden:n,onClick:i,onAuxClick:a,menuComponent:o})=>{const l=m(ne),{eventSchema:s}=l,[c,d]=function(e){var t;const[r,n]=b(null),i=m(ne),{cameras:a,thumbnails:o}=i;g((()=>{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&&a.loaded?(l=(null===(t=a.camerasById.get(e.cameraId))||void 0===t?void 0:t.imageUrl)||"",s=!0):r&&(l=r.url),[l,s]}(e);let u=null,p=null,f=null;if(e.detectedObjects.length){let n,i;const{ThumbnailSize:a}=JSON.parse(e.raw.data);a&&(n=a.Width,i=a.Height),u=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)).map(((e,n)=>h.createElement(Kr,{key:n,...e,height:r,width:t}))),p=e.detectedObjects.filter((({Type:e})=>"LicensePlate"===e)).map(((e,a)=>h.createElement(rn,{key:a,detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:i,url:c})))}if(e.faces){const{Width:n,Height:i}=JSON.parse(e.raw.data).ThumbnailSize;f=e.faces.map(((e,a)=>h.createElement(en,{key:a,face:e,url:c,thumbWidth:n,thumbHeight:i,width:t,height:r})))}return h.createElement(Zr,{onClick:i,onAuxClick:a,data:e,width:t,height:r,cameraNameHidden:n,menuComponent:o},h.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},h.createElement(ln,{url:c,noPreview:d,width:t}),u,p,f,e.acknowledged?h.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,h.createElement(on,{data:e,cameraNameHidden:n})))}));sn.displayName="EventItem";class cn extends h.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{hasError:!1}})}componentDidCatch(e,t){this.setState({hasError:!0}),J.withScope((r=>{Object.keys(t).forEach((e=>{r.setExtra(e,t[e])})),J.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 h.createElement("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r},h.createElement("h1",null,"Oops. Something went wrong"),h.createElement("div",null,"We've been notified about this problem"),h.createElement(qe,{onClick:()=>this.setState({hasError:!1})},"retry"))}}const dn=A((({store:e,captionHeight:t=0,minColumnWidth:r=180,onEventClick:n,onEventAuxClick:i,eventRenderer:a=(({data:e,width:t,height:r})=>h.createElement(sn,{data:e,cameraNameHidden:!1,onClick:n,onAuxClick:i,width:t,height:r}))})=>{const o=p(),l=H((()=>({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(),h.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},h.createElement("div",{style:{textAlign:"center"}},h.createElement("div",null,"Couldn't fetch data"),h.createElement(qe,{onClick:e.reload},"Retry")));if(e.loading)return l.reset(),h.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},h.createElement(ct,null));if(!e.data.length)return l.reset(),h.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},te.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 h.createElement(Y,null,(({width:n,height:i})=>h.createElement($,null,(()=>{var d;const u=Math.floor(n/r)||1,m=n/u/16*9+t,p=u*Math.floor(i/m)>=e.data.length?0:Xr(),f=Math.max(1,Math.floor((n-p)/r)),b=Math.ceil(e.data.length/f),v=(n-p-2*(f-1))/f,g=v/16*9+t;return h.createElement(h.Fragment,null,h.createElement(X,{isItemLoaded:e=>e<b,itemCount:b+((null===(d=e.pageInfo)||void 0===d?void 0:d.haveMore)?1:0),loadMoreItems:s},(({onItemsRendered:t,ref:r})=>{var s;return h.createElement(Z,{key:`${n}x${i}`,ref:q(o,r),columnCount:f,columnWidth:e=>v+(e?2:0),height:i,width:n,rowCount:b+((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:i,overscanRowStartIndex:a})=>{l.update(e,r),t({overscanStartIndex:a,overscanStopIndex:i,visibleStartIndex:e,visibleStopIndex:n})}},(t=>({columnIndex:r,rowIndex:n,style:i})=>h.createElement($,null,(()=>{var o,l;const s=n*t+r,c=e.data[s];return i={...i,left:i.left+(r?2:0),width:i.width-(r?2:0),top:i.top+(n?2:0),height:i.height-(n?2:0)},s===e.data.length?e.error?h.createElement("div",{style:i},h.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},h.createElement("div",{style:{textAlign:"center"}},h.createElement("div",null,"Couldn't fetch more data"),h.createElement(qe,{onClick:e.loadMore},"Retry")))):(null===(o=e.pageInfo)||void 0===o?void 0:o.haveMore)?h.createElement("div",{style:i},h.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},h.createElement(ct,{size:32}))):h.createElement("div",{style:i}):!c&&(null===(l=e.pageInfo)||void 0===l?void 0:l.haveMore)?h.createElement("div",{style:i}):c?h.createElement("div",{style:i},h.createElement(cn,null,a({data:c,width:i.width,height:i.height}))):h.createElement("div",{style:i})})))(f))})),h.createElement($,null,(()=>e.pendingData.length?h.createElement("div",{style:{position:"absolute",top:0,left:0,right:p,pointerEvents:"none",textAlign:"center",padding:8}},h.createElement(qe,{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")}},te.t("showEvents",{count:e.pendingData.length}))):null)))}))))}));dn.displayName="EventGrid";const un=({onEventClick:e,style:t,...r})=>{var n;const i=null!==(n=m(w))&&void 0!==n?n:C,[a,o]=b();return g((()=>{null==a||a.dispose();const e=new ge(i.events);e.initWith(i.api),e.load(),o(e)}),[i]),h.createElement(ne.Provider,{value:i},a?h.createElement("div",{style:{display:"flex",flexDirection:"column",...t},...r},h.createElement(ze,{addionalFiltersEnabled:!0,store:a}),h.createElement(rt,{store:a}),a.someAnalyticsFilterSelected&&h.createElement(h.Fragment,null,h.createElement(at,{getter:a.getProbabilityTreshold,setter:a.setProbabilityTreshold}),h.createElement(st,{value:a.colors,toggle:a.toggleColor,clear:a.clearColors})),h.createElement("div",{style:{flex:1}},h.createElement(dn,{minColumnWidth:1/0,store:a.eventsLoader,eventRenderer:({data:t,width:r,height:n})=>h.createElement(sn,{data:t,cameraNameHidden:!1,onClick:e,width:r,height:n})}))):null)};var hn;un.displayName="EventList",(hn={resources:{en:{translation:K}}})&&Object.assign(ee,hn),o(te.init(ee));export{un as default};
1
+ import{format as e,subHours as t,startOfHour as r,isSameYear as n,isSameDay as i}from"date-fns/esm";import a from"i18next";import{of as o,from as l,Observable as s,Subscription as c,throwError as d,EMPTY as u}from"rxjs";import h,{useContext as m,useRef as p,useCallback as f,cloneElement as g,useState as v,createContext as b,Children as y,useEffect as E,useLayoutEffect as w}from"react";import{AppContext as x,app as C}from"@3deye-toolkit/core";import{computed as O,makeObservable as T,observable as M,action as L,runInAction as N,reaction as P,when as j}from"mobx";import{subHours as I}from"date-fns";import{mergeMap as _,catchError as k,switchMap as S,map as D,exhaustMap as F}from"rxjs/operators";import z from"earcut";import A,{components as H}from"react-select";import R from"clsx";import{observer as $,useLocalObservable as B}from"mobx-react-lite";import{useFloating as V,offset as U,flip as W,shift as G,arrow as Y,autoUpdate as X,useInteractions as Z,useRole as q,useDismiss as J,FloatingPortal as K,FloatingFocusManager as Q,useHover as ee,useFocus as te}from"@floating-ui/react-dom-interactions";import re from"react-datepicker";import ne from"react-ink";import ie from"@seznam/compose-react-refs";import*as ae from"@sentry/browser";import{useElementSize as oe}from"@mantine/hooks";var le={filter:"Filter",eventSearchFilter:{from:"From",to:"To",live:"Live"},button:{ok:"Ok"},showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events",noEventsFound:"no events found"};const se=new Map,ce={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},de=a.createInstance();function ue(t,r){const n=se.get(de.language);return e(t,r,{locale:n})}const he=h.createContext(null);var me,pe;function fe(e,t=!1){const r=O(e);return new s((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"}(me||(me={})),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"}(pe||(pe={}));class ge{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 c?e.closed||e.unsubscribe():e()}))}}const ve=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class be{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}),T(this,{id:O,startTime:O,endTime:O,acknowledged:O,isLive:O,raw:M.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=ve.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!ve.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}var ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var Ee=function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=e[n+t];return a};var we=function(e,t){return e===t||e!=e&&t!=t},xe="object"==typeof ye&&ye&&ye.Object===Object&&ye,Ce="object"==typeof self&&self&&self.Object===Object&&self,Oe=xe||Ce||Function("return this")(),Te=Oe.Symbol,Me=Te,Le=Object.prototype,Ne=Le.hasOwnProperty,Pe=Le.toString,je=Me?Me.toStringTag:void 0;var Ie=function(e){var t=Ne.call(e,je),r=e[je];try{e[je]=void 0;var n=!0}catch(e){}var i=Pe.call(e);return n&&(t?e[je]=r:delete e[je]),i},_e=Object.prototype.toString;var ke=Ie,Se=function(e){return _e.call(e)},De=Te?Te.toStringTag:void 0;var Fe=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":De&&De in Object(e)?ke(e):Se(e)};var ze=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ae=Fe,He=ze;var Re=function(e){if(!He(e))return!1;var t=Ae(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var $e=Re,Be=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Ve=/^(?:0|[1-9]\d*)$/;var Ue=we,We=function(e){return null!=e&&Be(e.length)&&!$e(e)},Ge=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&Ve.test(e))&&e>-1&&e%1==0&&e<t},Ye=ze;var Xe=/\s/;var Ze=function(e){for(var t=e.length;t--&&Xe.test(e.charAt(t)););return t},qe=/^\s+/;var Je=Fe,Ke=function(e){return null!=e&&"object"==typeof e};var Qe=function(e){return e?e.slice(0,Ze(e)+1).replace(qe,""):e},et=ze,tt=function(e){return"symbol"==typeof e||Ke(e)&&"[object Symbol]"==Je(e)},rt=/^[-+]0x[0-9a-f]+$/i,nt=/^0b[01]+$/i,it=/^0o[0-7]+$/i,at=parseInt;var ot=function(e){if("number"==typeof e)return e;if(tt(e))return NaN;if(et(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=et(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Qe(e);var r=nt.test(e);return r||it.test(e)?at(e.slice(2),r?2:8):rt.test(e)?NaN:+e};var lt=function(e){return e?Infinity===(e=ot(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var st=Ee,ct=function(e,t,r){if(!Ye(r))return!1;var n=typeof t;return!!("number"==n?We(r)&&Ge(t,r.length):"string"==n&&t in r)&&Ue(r[t],e)},dt=function(e){var t=lt(e),r=t%1;return t==t?r?t-r:t:0},ut=Math.ceil,ht=Math.max;var mt=function(e,t,r){t=(r?ct(e,t,r):void 0===t)?1:ht(dt(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var i=0,a=0,o=Array(ut(n/t));i<n;)o[a++]=st(e,i,i+=t);return o};const pt=([e,t],[r,n],[i,a])=>{const o=(n-t)*(i-r)-(r-e)*(a-n);return 0===o?0:o>0?1:2},ft=([e,t],[r,n],[i,a])=>r<=Math.max(e,i)&&r>=Math.min(e,i)&&n<=Math.max(t,a)&&n>=Math.min(t,a),gt=(e,t,r)=>!(e<r.x||t<r.y||e>r.x+r.width||t>r.y+r.height),vt=(e,t,r)=>{const n=r.y1*r.x3-r.x1*r.y3+(r.y3-r.y1)*e+(r.x1-r.x3)*t,i=r.x1*r.y2-r.y1*r.x2+(r.y1-r.y2)*e+(r.x2-r.x1)*t;if(n<0!=i<0)return!1;const a=-r.y2*r.x3+r.y1*(r.x3-r.x2)+r.x1*(r.y2-r.y3)+r.x2*r.y3;return a<0?n<=0&&n+i>=a:n>=0&&n+i<=a},bt=(e,t)=>{if(gt(t.x1,t.y1,e))return!0;if(gt(t.x2,t.y2,e))return!0;if(gt(t.x3,t.y3,e))return!0;if(vt(e.x,e.y,t))return!0;if(vt(e.x+e.width,e.y,t))return!0;if(vt(e.x+e.width,e.y+e.height,t))return!0;if(vt(e.x,e.y+e.height,t))return!0;const r=[[[e.x,e.y],[e.x+e.width,e.y]],[[e.x+e.width,e.y],[e.x+e.width,e.y+e.height]],[[e.x,e.y+e.height],[e.x+e.width,e.y+e.height]],[[e.x,e.y],[e.x,e.y+e.height]]];return!![[[t.x1,t.y1],[t.x2,t.y2]],[[t.x1,t.y1],[t.x3,t.y3]]].some((e=>r.some((t=>(([e,t],[r,n])=>{const i=pt(e,t,r),a=pt(e,t,n),o=pt(r,n,e),l=pt(r,n,t);return i!==a&&o!==l||!(0!==i||!ft(e,r,t))||!(0!==a||!ft(e,n,t))||!(0!==o||!ft(r,e,n))||!(0!==l||!ft(r,t,n))})(t,e)))))};class yt extends ge{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:i,cameras:a,regions:l})=>{var s;return this.api.cameras.GetSensorEventsPage({sensorIds:a,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==i?void 0:i.nextPageToken},n,null!==(s=null==l?void 0:l.map(this.regionToWktPolygon))&&void 0!==s?s:[]).pipe(_((e=>e.success?o({events:e.resultItems,pageInfo:e.pageInfo}):d((()=>e.error)))),k((e=>(console.error(e),this.error=e,o({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=>((e,t)=>{const r=e.map((({x:e,y:t})=>[e,t]));return mt(z(r.flat()),3).some((r=>bt(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})))})(t,this.boxToAabb(e.Box))))?-1:t})).filter((e=>-1!==e)).map((t=>({data:e,objectIdx:t})))}),T(this,{data:M.ref,cameras:M.struct,detectedObjects:M.struct,from:M,to:M,sortDirection:M,probabilityThreshold:M,pendingData:M.ref,liveUpdateMode:M,setLiveUpdateMode:L,updateTrigger:M,colors:M.ref,flushUpdates:L,pageInfo:M.ref,isLive:O,loading:M,loadMoreTrigger:M,retryTrigger:M,error:M.ref,loadMore:L,filterJson:O})}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=fe((()=>({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(S((e=>fe((()=>this.retryTrigger),!0).pipe(D((()=>e))))),S((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i,regions:a})=>(N((()=>{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:i,pageInfo:this.pageInfo,regions:a}))))).subscribe((({events:e,pageInfo:t})=>{N((()=>{var r,n,i;if(!t)return;const a=e.map(Et);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:this.eventTypes.map((e=>pe[e])),from:null!==(n=null===(r=a[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:I(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(i=this.probabilityThreshold)&&void 0!==i?i:void 0}),a).flatMap(this.toObjects):this.data=a.flatMap(this.toObjects),this.eventsStore.add(a),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(S((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i})=>fe((()=>this.loadMoreTrigger)).pipe(F((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:i,pageInfo:this.pageInfo,regions:this.regions}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(Et);this.eventsStore.add(r),N((()=>{this.data=this.data.concat(r.flatMap(this.toObjects)),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(fe((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(S((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?fe((()=>this.eventsStore.recentAdditions)):u))).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&&N((()=>{this.data=[...t.flatMap(this.toObjects),...this.data]}))}))),this.disposables.push(fe((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(S((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?fe((()=>this.eventsStore.recentAdditions)):(this.pendingData&&N((()=>this.pendingData=[])),u)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&N((()=>{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=>pe[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 c?e.closed||e.unsubscribe():e()}))}}function Et(e){return new be(e)}const wt={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"},xt={50:"#e0f7fa",100:"#b2ebf2",200:"#80deea",300:"#4dd0e1",400:"#26c6da",500:"#00bcd4",600:"#00acc1",700:"#0097a7",800:"#00838f",900:"#006064",A100:"#84ffff",A200:"#18ffff",A400:"#00e5ff",A700:"#00b8d4"},Ct={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"},Ot={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"},Tt={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"},Mt={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"};class Lt extends ge{constructor(e){super(),Object.defineProperty(this,"cameraFilters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"objectFilters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"date",{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,"facesProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.7}),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,"eventsLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"toggleSorting",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.sortDirection="ASC"===this.sortDirection?"DESC":"ASC",null===this.date&&(this.date=t(r(new Date),1))}}),Object.defineProperty(this,"applyFilters",{enumerable:!0,configurable:!0,writable:!0,value:()=>{var e;this.eventsLoader.cameras=this.cameraFilters.map((e=>e.id)),this.eventsLoader.detectedObjects=this.objectFilters.map((e=>e.id)),this.eventsLoader.colors=this.colors,this.eventsLoader.probabilityThreshold=this.objectFilters.length?this.probabilityThreshold:null,"ASC"===this.sortDirection?(this.eventsLoader.sortDirection="ASC",this.eventsLoader.to=void 0,this.eventsLoader.from=this.date):(this.eventsLoader.sortDirection="DESC",this.eventsLoader.from=void 0,this.eventsLoader.to=null!==(e=this.date)&&void 0!==e?e:void 0)}}),Object.defineProperty(this,"getProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.probabilityThreshold}),Object.defineProperty(this,"setProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.probabilityThreshold=e,this.applyFilters()}}),T(this,{cameraFilters:M.ref,objectFilters:M.ref,date:M,sortDirection:M,probabilityThreshold:M,setProbabilityTreshold:L,facesProbabilityThreshold:M,colors:M.ref,someAnalyticsFilterSelected:O,filters:O,setFilters:L,load:L,toggleColor:L.bound,clearColors:L.bound,applyFilters:L,toggleSorting:L}),this.eventsLoader=new yt(e),this.eventsLoader.loading=!0,this.eventsLoader.probabilityThreshold=null}get someAnalyticsFilterSelected(){return!!this.objectFilters.length}get filters(){return this.objectFilters.concat(this.cameraFilters)}load(){this.eventsLoader.load()}setFilters(e){this.cameraFilters=e?e.filter((e=>!("type"in e))):[],this.objectFilters=e?e.filter((e=>"type"in e)):[]}toggleColor(e){const t=new Set(this.colors);this.colors.has(e)?t.delete(e):t.add(e),this.colors=t,this.applyFilters()}clearColors(){this.colors=new Set,this.applyFilters()}afterInit(){this.eventsLoader.initWith(this.api)}dispose(){this.disposables.forEach((e=>{e instanceof c?e.closed||e.unsubscribe():e()})),this.eventsLoader.dispose()}}var Nt,Pt=(Nt=8,{container:e=>({...e,padding:Nt}),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*Nt}px)`,marginTop:Nt?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%)"})});function jt(e){return h.forwardRef(((t,r)=>{const{size:n=24,color:i="currentColor",className:a,...o}=t,l=e.viewBox||"0 0 24 24",s=e.svg;return h.createElement("svg",{ref:r,preserveAspectRatio:"xMinYMin",className:R("icon",a),width:n,fill:i,viewBox:l,...o},s)}))}const It=jt({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});It.displayName="LabelIcon";const _t=jt({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});_t.displayName="CameraIcon";const kt=jt({viewBox:"0 0 24 24",svg:h.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"})});kt.displayName="LuggageIcon";const St=jt({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});St.displayName="CarIcon";const Dt=jt({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Dt.displayName="BoatIcon";const Ft=jt({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.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"}))});Ft.displayName="BicycleIcon";const zt=jt({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});zt.displayName="DirectionsWalkIcon";const At=jt({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),h.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),h.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),h.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),h.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"}))});At.displayName="PetsIcon";const Ht=jt({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}),h.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"}),h.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"}),h.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"}))});Ht.displayName="LicensePlateIcon";const Rt=({data:e})=>{const t=16;return"licensePlate"===e.type?null:"detectedObject"!==e.type?h.createElement(_t,{size:t}):"Luggage"===e.id?h.createElement(kt,{size:t}):"Car"===e.id?h.createElement(St,{size:t}):"Person"===e.id?h.createElement(zt,{size:t}):"Bicycle"===e.id?h.createElement(Ft,{size:t}):"Boat"===e.id?h.createElement(Dt,{size:t}):"Animal"===e.id?h.createElement(At,{size:t}):"LicensePlate"===e.id?h.createElement(Ht,{size:t}):h.createElement(It,{size:t})},$t=e=>{const{children:t,innerProps:r,...n}=e,{Option:i}=H,{data:a}=e;if("licensePlate"===a.type)return h.createElement(i,{innerProps:r,...n},h.createElement("span",{style:{paddingLeft:8,paddingRight:8,borderRadius:4,border:"1px solid black"}},t));if("detectedObject"===a.type){const e={display:"inline-flex",alignItems:"center",width:"auto"},o={...r,style:e};return h.createElement(i,{innerProps:o,...n},h.createElement(Rt,{data:a}),h.createElement("div",{style:{marginLeft:4}},t))}return h.createElement(i,{...e})},Bt=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:i}=H,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center"}};return h.createElement(i,{innerProps:o,...n},h.createElement(Rt,{data:a}),h.createElement("div",{style:{marginLeft:4}},t))},Vt=jt({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Vt.displayName="FilterListIcon";const Ut={...Pt,multiValue:(e,{data:t})=>"color"in t?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>"color"in t?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>"color"in t?{...e,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.7)",color:t.color}}:{...e,color:"hsl(0, 0%, 20%)"},option:(e,{data:t,isFocused:r})=>"color"in t?"type"in t&&"licensePlate"===t.type?{...e,color:t.color,backgroundColor:r?xt[50]:"transparent",":active":{...e[":active"],backgroundColor:xt[100]}}:{...e,color:t.color}:{...e,color:"black"}},Wt=e=>{const{children:t,...r}=e;return h.createElement(H.Placeholder,{...r},h.createElement(Vt,{size:16,style:{position:"relative",top:4}})," ",t)},Gt=$((({addionalFiltersEnabled:e,store:t})=>{const{cameras:r,eventSchema:n}=m(he),i=p({opened:!1});return h.createElement(A,{closeMenuOnSelect:!1,isMulti:!0,onChange:(e,r)=>{t.setFilters(e),"remove-value"!==r.action||i.current.opened||t.applyFilters()},onMenuOpen:()=>i.current.opened=!0,onMenuClose:()=>{i.current.opened=!1,t.applyFilters()},getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:(()=>{if(!n)return[];const t=e?n.foundObjectTypesForSelect:[];return r.loaded?[].concat(t,r.data.slice()):t})(),placeholder:de.t("filter"),value:t.filters,components:{MultiValueLabel:Bt,Option:$t,Placeholder:Wt},styles:Ut})}));Gt.displayName="EventsPanelSelect";const Yt=h.forwardRef((function({width:e,height:t,placement:r="top",style:n},i){const a=[0,"top"===r?t:0],o=[e,a[1]],l=[e/2,t-a[1]],s=[e/4,t*("top"===r?3:1)/4],c=[.325*e,t-a[1]],d=[e-c[0],c[1]],u=[e-s[0],s[1]],m=e=>e.join(","),p=`M ${m(a)} C ${m(s)} ${m(c)} ${m(l)} ${m(d)} ${m(u)} ${m(o)}`,f=`${p} Z`;return h.createElement("svg",{ref:i,className:"tip",style:n,width:e,height:t,fill:"var(--tip-background, #fff)"},h.createElement("path",{className:"tip-body",d:f}),h.createElement("path",{className:"tip-border",d:p,stroke:"var(--tip-border, transparent)",strokeWidth:1}))})),Xt=({opened:e,onOpenChange:t,children:r,target:n,placement:i,className:a,autoDismiss:o=!0,withArrow:l=!1})=>{var s,c,d;const u=p(null),{x:m,y:v,reference:b,floating:y,strategy:E,context:w,middlewareData:x,placement:C,update:O}=V({open:e,onOpenChange:t,middleware:[U(5),W(),G(),Y({element:u})],placement:i,whileElementsMounted:(e,t,r)=>X(e,t,r,{animationFrame:!0})}),{getReferenceProps:T,getFloatingProps:M}=Z([q(w),J(w,{ancestorScroll:!0,enabled:o})]),L=f((e=>{u.current=e,O()}),[O]),N={top:"bottom",right:"left",bottom:"top",left:"right"}[null!==(s=null==C?void 0:C.split("-")[0])&&void 0!==s?s:"top"]||"top",P=h.createElement("div",{...M({className:R("x-3deye-popover-container",a),ref:y,style:{position:E,top:null!=v?v:0,left:null!=m?m:0}})},l&&h.createElement(Yt,{ref:L,width:24,height:8,placement:N,style:{position:"absolute",left:null===(c=x.arrow)||void 0===c?void 0:c.x,top:null===(d=x.arrow)||void 0===d?void 0:d.y,[N]:-7}}),r);return h.createElement(h.Fragment,null,g(n,T({ref:b,...n.props})),h.createElement(K,{id:"x-3deye-floating-ui-root"},o&&e&&h.createElement(Q,{context:w,modal:!1,order:["reference","content"],returnFocus:!1},P),!o&&e&&P))},Zt=e=>({reference:{onClick(){e.onOpenChange(!1),e.events.emit("dismiss")}}}),qt=({children:e,label:t,placement:r="bottom"})=>{const[n,i]=v(!1),{x:a,y:o,reference:l,floating:s,strategy:c,context:d}=V({placement:r,open:n,onOpenChange:i,middleware:[U(5),W(),G({padding:8})],whileElementsMounted:(e,t,r)=>X(e,t,r,{animationFrame:!0})}),{getReferenceProps:u,getFloatingProps:m}=Z([ee(d),te(d),Zt(d),q(d,{role:"tooltip"}),J(d)]);return h.createElement(h.Fragment,null,g(e,u({ref:ie(l,e.ref),...e.props})),h.createElement(K,{id:"x-3deye-floating-ui-root"},n&&h.createElement("div",{...m({ref:s,className:"x-3deye-tooltip",style:{position:c,top:null!=o?o:0,left:null!=a?a:0}})},t)))};class Jt extends h.Component{render(){const{forwardedRef:e,children:t,className:r,fullWidth:n,variant:i,type:a,title:o,placement:l,...s}=this.props,c=R(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},i?`x-3deye-button--${i}`:void 0),d=h.createElement("button",{ref:e,className:c,type:a||"button",...s},t,s.disabled?null:h.createElement(ne,null));return o?h.createElement(qt,{label:o,placement:l},d):d}}const Kt=h.forwardRef(((e,t)=>h.createElement(Jt,{forwardedRef:t,...e}))),Qt=jt({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.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"}),h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Qt.displayName="CloseIcon";const er=(e,t,r)=>Math.min(Math.max(e,t),r),tr=()=>{};/Mac|iPod|iPhone|iPad/.test(window.navigator.platform);const rr=(e,t,r,n)=>er(Math.floor((e-t)/r*n),0,n-1),nr=b({value:null,onPointerDown:tr,setCurrentValue:tr,state:{currentIdx:0,currentValue:null,options:[]}});class ir{constructor(e=0){Object.defineProperty(this,"currentIdx",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"setCurrentIdx",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.currentIdx=e}}),Object.defineProperty(this,"setOptions",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.options=e}}),this.currentIdx=e,T(this,{currentIdx:M,options:M.ref,currentValue:O,setCurrentIdx:L,setOptions:L})}get currentValue(){return this.options[this.currentIdx]}}const ar=$((({value:e,onChange:t,children:r,style:n},i)=>{const[a,o]=v(!1),l=p(null),s=y.map(r,(e=>null==e?void 0:e.props.value))||[],c=B((()=>new ir(s.indexOf(e))));c.setOptions(s);const d=y.count(r);E((()=>{c.setCurrentIdx(s.indexOf(e))}),[e]),E((()=>{var e;if(!a)return;const r=null===(e=l.current)||void 0===e?void 0:e.getBoundingClientRect();if(!r)return;const n=({clientX:e})=>{c.setCurrentIdx(rr(e,r.left,r.width,d))},i=()=>{o(!1),t(s[c.currentIdx])};return document.addEventListener("pointermove",n),document.addEventListener("pointerup",i),()=>{document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",i)}}),[a,d]);return h.createElement(nr.Provider,{value:{value:e,state:c,onPointerDown:e=>{const t=l.current;if(!t)return;const{left:r,width:n}=t.getBoundingClientRect(),i=rr(e.clientX,r,n,d);i!==c.currentIdx&&c.setCurrentIdx(i),o(!0)},setCurrentValue:e=>{c.setCurrentIdx(s.indexOf(e))}}},h.createElement("div",{className:"segmented-control-wrapper",style:n,ref:i},h.createElement("div",{role:"radiogroup",ref:l,className:"segmented-control",style:{"--indicator-offset":100*c.currentIdx+"%"}},h.createElement("div",{"aria-hidden":!0,className:R("segmented-control-indicator",{active:a}),style:{width:100/s.length+"%"}},h.createElement("div",{className:"segmented-control-indicator-inner"})),r)))}),{forwardRef:!0});ar.displayName="SegmentedControl";const or=$((({value:e,children:t},r)=>{const n=m(nr);return h.createElement("button",{ref:r,role:"radio","aria-checked":n.state.currentValue===e,tabIndex:0,className:R("segmented-control-button",{current:n.state.currentValue===e}),onPointerDown:n.onPointerDown,onClick:()=>n.setCurrentValue(e)},t)}),{forwardRef:!0});or.displayName="SegmentedControlOption";const lr=$((({store:e})=>{const{date:t,sortDirection:r}=e,n=B((()=>({opened:!1,toggle(){this.opened=!this.opened},setOpened(e){this.opened=e},close(){this.opened=!1,e.applyFilters()},onDateChange(t){e.date=t},clear(){e.date=null,e.applyFilters()}}))),i=h.createElement("div",{style:{flex:1,display:"flex",position:"relative"}},h.createElement(Kt,{className:"date-button",style:{flex:1,alignItems:"flex-start",borderRadius:0,textTransform:"uppercase"},onClick:n.toggle},t?h.createElement("sup",null,"ASC"===r?de.t("eventSearchFilter.from"):de.t("eventSearchFilter.to")):null,h.createElement("span",null,t?ue(t,"MMM d, HH:mm"):de.t("eventSearchFilter.live"))),t?h.createElement(Kt,{className:"x-3deye-button--icon",style:{position:"absolute",right:0},onClick:n.clear},h.createElement(Qt,{size:16})):null);return h.createElement("div",{className:"events-panel-datepicker"},h.createElement("div",{style:{position:"relative"}},h.createElement(Xt,{target:i,opened:n.opened,onOpenChange:e=>n.setOpened(e),withArrow:!0,className:"popover-datetimepicker"},h.createElement("div",{style:{display:"flex",flexDirection:"column",gap:8}},h.createElement(ar,{value:r,onChange:e.toggleSorting},h.createElement(or,{value:"ASC"},de.t("eventSearchFilter.from")),h.createElement(or,{value:"DESC"},de.t("eventSearchFilter.to"))),h.createElement(re,{selected:t,onChange:n.onDateChange,showTimeSelect:!0,dateFormat:"MMM d, HH:mm",timeFormat:"HH:mm",inline:!0}),h.createElement(Kt,{onClick:n.close,variant:"filled",fullWidth:!0},de.t("button.ok"))))))}));lr.displayName="EventsPanelDatepicker";const sr=e=>Math.round(e),cr=h.forwardRef((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:i=!1,labelFormat:a=(e=>`${e}`),style:o},l)=>{const s=p(null),c=p(null),[d,u]=v(!1),[m,g]=v(e);E((()=>{if(!d)return;const e=s.current;if(!e)return;let i=0,a=0;const o=e.getBoundingClientRect();if(!o)return;const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(i=er(e-o.x,0,o.width),l=i/o.width*100,c.current.style.transform=`translateX(${i}px)`):(a=o.height-er(r-o.y,0,o.height),l=a/o.height*100,c.current.style.transform=`translateY(${-a}px)`),g(l),null==t||t(sr(l))},h=({clientX:e,clientY:i})=>{if(u(!1),!c.current)return;const a="horizontal"===n?er(e-o.x,0,o.width)/o.width*100:100*(1-er(i-o.y,0,o.height)/o.height);c.current.style.transform="",g(a),null==t||t(sr(a)),null==r||r(sr(a))},m=()=>{if(u(!1),!c.current)return;const e="horizontal"===n?i/o.width*100:a/o.height*100;c.current.style.transform="",null==t||t(sr(e)),null==r||r(sr(e))};return e.addEventListener("pointercancel",m),e.addEventListener("pointermove",l),e.addEventListener("pointerup",h),()=>{e.removeEventListener("pointercancel",m),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",h)}}),[d,n,t]);const b=f((({clientX:e,clientY:r,pointerId:a})=>{if(!s.current||i)return;u(!0),s.current.setPointerCapture(a);const o=s.current.getBoundingClientRect();if(!o)return;if(!c.current)return;let l=0;if("horizontal"===n){const t=er(e-o.x,0,o.width);l=t/o.width*100,c.current.style.transform=`translateX(${t}px)`}else{const e=o.height-er(r-o.y,0,o.height);l=e/o.height*100,c.current.style.transform=`translateY(${-e}px)`}g(l),null==t||t(sr(l))}),[n,i]),y=f((n=>{if(i)return;let a=null;"ArrowLeft"===n.code?a=Math.max(e-1,0):"ArrowRight"===n.code?a=Math.min(e+1,100):"ArrowDown"===n.code?a=Math.max(e-1,0):"ArrowUp"===n.code&&(a=Math.min(e+1,100)),null!==a&&(n.stopPropagation(),n.preventDefault(),null==t||t(a),null==r||r(a))}),[e,t,r,n,i]);return h.createElement("div",{ref:ie(l,s),tabIndex:0,onKeyDown:y,className:R("x-3deye-slider",n,{disabled:i}),onPointerDown:b,style:o},h.createElement("div",{className:"x-3deye-slider__track"},h.createElement("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${d?m:e}%`:void 0,height:"vertical"===n?`${d?m:e}%`:void 0}})),h.createElement("div",{ref:c,className:R("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"}},h.createElement("div",{className:"x-3deye-slider__label "+(d?"open":"")},a(d?sr(m):e))))}));cr.displayName="Slider";const dr=$((({getter:e,setter:t})=>{const[r,n]=v(0),i=p(null),a=Math.floor(100*e());return E((()=>P(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),h.createElement("div",{ref:i,style:{paddingLeft:8,paddingRight:8,marginTop:5}},h.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},h.createElement("div",null,"CONFIDENCE"),h.createElement("div",{style:{fontSize:"1.1em"}},a,"%")),h.createElement("div",{style:{padding:"0 10px"}},h.createElement(cr,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})))}));dr.displayName="ProbabilitySlider";const ur=jt({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),h.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});ur.displayName="DoneIcon";const hr=[{color:Tt[500],name:"red",highlightColor:Tt[100]},{color:Ct[500],name:"green",highlightColor:Ct[100]},{color:wt[500],name:"blue",highlightColor:wt[100]},{color:Mt[500],name:"yellow",highlightColor:Mt[900]},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:Ot[500],name:"dimgrey",highlightColor:Ot[100]}],mr=$((({value:e,clear:t,toggle:r})=>h.createElement("div",{className:"color-selector"},h.createElement("div",null,"COLOR"),h.createElement("div",{className:"color-selector__items"},hr.map((({color:t,highlightColor:n,name:i})=>h.createElement("button",{key:i,className:R("color-selector__item",{selected:e.has(i)}),style:{backgroundColor:t},onClick:r.bind(null,i)},h.createElement(ur,{color:n,size:20})))),h.createElement(Kt,{className:"color-selector__clear",disabled:!e.size,onClick:t},h.createElement(Qt,{size:20}))))));mr.displayName="ColorSelector";const pr=({size:e=48})=>h.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},h.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));pr.displayName="Preloader";var fr,gr=Oe["__core-js_shared__"],vr=(fr=/[^.]+$/.exec(gr&&gr.keys&&gr.keys.IE_PROTO||""))?"Symbol(src)_1."+fr:"";var br=function(e){return!!vr&&vr in e},yr=Function.prototype.toString;var Er=Re,wr=br,xr=ze,Cr=function(e){if(null!=e){try{return yr.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Or=/^\[object .+?Constructor\]$/,Tr=Function.prototype,Mr=Object.prototype,Lr=Tr.toString,Nr=Mr.hasOwnProperty,Pr=RegExp("^"+Lr.call(Nr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var jr=function(e){return!(!xr(e)||wr(e))&&(Er(e)?Pr:Or).test(Cr(e))},Ir=function(e,t){return null==e?void 0:e[t]};var _r=function(e,t){var r=Ir(e,t);return jr(r)?r:void 0},kr=_r(Object,"create"),Sr=kr;var Dr=function(){this.__data__=Sr?Sr(null):{},this.size=0};var Fr=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},zr=kr,Ar=Object.prototype.hasOwnProperty;var Hr=function(e){var t=this.__data__;if(zr){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Ar.call(t,e)?t[e]:void 0},Rr=kr,$r=Object.prototype.hasOwnProperty;var Br=function(e){var t=this.__data__;return Rr?void 0!==t[e]:$r.call(t,e)},Vr=kr;var Ur=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Vr&&void 0===t?"__lodash_hash_undefined__":t,this},Wr=Dr,Gr=Fr,Yr=Hr,Xr=Br,Zr=Ur;function qr(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])}}qr.prototype.clear=Wr,qr.prototype.delete=Gr,qr.prototype.get=Yr,qr.prototype.has=Xr,qr.prototype.set=Zr;var Jr=qr;var Kr=function(){this.__data__=[],this.size=0},Qr=we;var en=function(e,t){for(var r=e.length;r--;)if(Qr(e[r][0],t))return r;return-1},tn=en,rn=Array.prototype.splice;var nn=function(e){var t=this.__data__,r=tn(t,e);return!(r<0)&&(r==t.length-1?t.pop():rn.call(t,r,1),--this.size,!0)},an=en;var on=function(e){var t=this.__data__,r=an(t,e);return r<0?void 0:t[r][1]},ln=en;var sn=en;var cn=function(e,t){var r=this.__data__,n=sn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},dn=Kr,un=nn,hn=on,mn=function(e){return ln(this.__data__,e)>-1},pn=cn;function fn(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])}}fn.prototype.clear=dn,fn.prototype.delete=un,fn.prototype.get=hn,fn.prototype.has=mn,fn.prototype.set=pn;var gn=fn,vn=_r(Oe,"Map"),bn=Jr,yn=gn,En=vn;var wn=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var xn=function(e,t){var r=e.__data__;return wn(t)?r["string"==typeof t?"string":"hash"]:r.map},Cn=xn;var On=xn;var Tn=xn;var Mn=xn;var Ln=function(e,t){var r=Mn(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Nn=function(){this.size=0,this.__data__={hash:new bn,map:new(En||yn),string:new bn}},Pn=function(e){var t=Cn(this,e).delete(e);return this.size-=t?1:0,t},jn=function(e){return On(this,e).get(e)},In=function(e){return Tn(this,e).has(e)},_n=Ln;function kn(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])}}kn.prototype.clear=Nn,kn.prototype.delete=Pn,kn.prototype.get=jn,kn.prototype.has=In,kn.prototype.set=_n;var Sn=kn;function Dn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Dn.Cache||Sn),r}Dn.Cache=Sn;const Fn=Dn((()=>{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})),zn=$((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:i})=>{const a=p(null),o=p(null);return h.createElement("div",{ref:a,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=a.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(),a.current&&(null===(t=o.current)||void 0===t||t.toggleAt(a.current,{top:e.clientY,left:e.clientX}))},draggable:!0},t,i&&h.createElement(i,{ref:o,data:e}))}));function An(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}zn.displayName="EventListItem";const Hn=({className:e,style:t,box:{Top:r,Left:n,Right:i,Bottom:a}})=>h.createElement(h.Fragment,null,h.createElement("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-a)+"%",right:100*(1-i)+"%",...t}}));function Rn({style:e}){return h.createElement("div",{className:"frame",style:e},h.createElement("div",{className:"corner-highlight-tl"}),h.createElement("div",{className:"corner-highlight-tr"}),h.createElement("div",{className:"corner-highlight-br"}),h.createElement("div",{className:"corner-highlight-bl"}))}function $n({Top:e,Left:t,Bottom:r,Right:n},i,a,o,l){const s=l*e,c=l*r;return s>a?[0,-1]:c>a?[0,1]:o*t>i?[-1,0]:o*n>i?[1,0]:[0,s>c?1:-1]}function Bn(e,t){return{Top:e.Top+t[1],Left:e.Left+t[0],Bottom:e.Bottom+t[1],Right:e.Right+t[0]}}Hn.displayName="LicensePlateLpr";const Vn=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:i,thumbHeight:a,width:o,height:l})=>{const{Top:s,Left:c,Right:d,Bottom:u}=t,m=100/i/(d-c),f={top:2},g=p(null);return w((()=>{if(!g.current)return;const{width:e,height:r}=g.current.getBoundingClientRect(),n=$n(t,e,r,o,l);n[0]=n[0]*(e+(d-c)*o)/2,n[1]=n[1]*(r+(u-s)*l)/2;const i=An(Bn({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);g.current.style.top=`${i.Top+2*Math.sign(n[1])}px`,g.current.style.left=`${i.Left+2*Math.sign(n[0])}px`})),c>=1-d?f.left=2:f.right=2,h.createElement(h.Fragment,null,h.createElement("div",{ref:g,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`},h.createElement("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"}},e),h.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"}},Math.floor(100*r),"%")),h.createElement(Hn,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),h.createElement("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:i*(d-c)*m,height:a*(u-s)*m,...f}},h.createElement("img",{style:{width:i*m,height:a*m,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),h.createElement(Rn,null)))};Vn.displayName="FaceHighlight";const Un=h.memo((({value:e})=>e?h.createElement(h.Fragment,null,e.split("").map(((e,t)=>{const r=e.charCodeAt(0);return r<48||r>57?h.createElement(h.Fragment,{key:t},e):h.createElement("span",{key:t,className:"digit"},e)}))):null));Un.displayName="LicensePlateNumber";const Wn=({detectedObject:e,height:t,width:r,url:n,thumbWidth:i,thumbHeight:a})=>{const{Type:o,Box:{Top:l,Left:s,Right:c,Bottom:d},Probability:u}=e,m=e.Value||e.Number,f=p(null);w((()=>{if(!f.current)return;const e=f.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,i=l*t-e.height-4;i<0&&(i=d*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),f.current.style.top=`${i}px`,f.current.style.left=`${n}px`}));const g={top:2};s>=1-c?g.left=2:g.right=2;const v=100/i/(c-s);return h.createElement(h.Fragment,null,h.createElement("div",{ref:f,className:"event-list-item__license-plate-label trigger",title:`${o.toLowerCase()} ${Math.floor(100*u)}%`},h.createElement("div",{style:{padding:4}},h.createElement(Un,{value:m})),h.createElement("div",{className:"event-list-item__license-plate-label__caption"},Math.floor(100*u),"%")),h.createElement(Hn,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),h.createElement("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:i*(c-s)*v,height:a*(d-l)*v+16,position:"absolute",...g}},h.createElement("img",{style:{width:i*v,height:a*v,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),h.createElement("div",{className:"plate-number"},h.createElement(Un,{value:m})),h.createElement(Rn,{style:{height:a*(d-l)*v}})))};Wn.displayName="LicensePlateHighlight";const Gn=jt({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Gn.displayName="ThermostatIcon";const Yn=$((({data:e})=>{if("Temperature"!==e.type)return null;let t=Number(e.raw.data);return t=5*(t-32)/9+273.15,h.createElement("div",{className:"event-list-item__temperature"},h.createElement(Gn,null),(t-273.15).toFixed(1),"°C / ",(9*t/5-459.67).toFixed(1),"°F")}));Yn.displayName="Temperature";const Xn=$((({data:e,cameraNameHidden:t})=>{var r;const a=m(he),{cameras:o}=a,l=o.loaded&&(null===(r=o.camerasById.get(e.cameraId))||void 0===r?void 0:r.name)||"...";return h.createElement("div",{className:"event-list-item-caption"},h.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",a="";return n(e,new Date)?i(e,new Date)?r=a="HH:mm":i(e,t)?(r="EEE d MMM HH:mm",a="HH:mm"):r=a="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",a="d MMM HH:mm"):r=a="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",a+=":ss"),+e==+t?`${ue(e,r)}`:`${ue(e,r)} - ${ue(t,a)}`}(e.startTime,e.endTime)),t?null:h.createElement("div",{className:"event-list-item__camera-name",title:l},l),+e.endTime-+e.startTime>0&&h.createElement("div",{className:"event-list-item__duration"},function(e,t=!0){if((e=Math.round(e/1e3))<60)return`${e}s`;const r=e%60,n=t?`${r}`:`${r}`.padStart(2,"0");let i=(e-r)/60;if(i<60)return!r&&t?`${i}m`:`${i}m ${n}s`;const a=Math.floor(i/60);if(i-=60*a,!r&&!i&&t)return`${a}h`;const o=t?`${i}`:`${i}`.padStart(2,"0");return!r&&i&&t?`${a}h ${o}m`:`${a}h ${o}m ${n}s`}(+e.endTime-+e.startTime)),h.createElement(Yn,{data:e}))}));Xn.displayName="EventListItemCaption";const Zn=$((({url:e,noPreview:t,width:r})=>h.createElement(h.Fragment,null,e?h.createElement("img",{key:e,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e}):null,h.createElement(ne,{radius:r}),t?h.createElement("div",{className:"no-preview-overlay"}):null)));function qn({Top:e,Left:t,Bottom:r,Right:n}){return[(t+n)/2,(e+r)/2]}function Jn(e,t){const[r,n]=qn(e),[i,a]=qn(t);return[i-r,a-n]}function Kn(e,t){return!(e.Left>t.Right||e.Top>t.Bottom||e.Right<t.Left||e.Bottom<t.Top)}function Qn([e,t]){const r=Math.sqrt(e*e+t*t);return 0===r?[0,0]:[e/r,t/r]}Zn.displayName="EventThumbnail";const ei=$((({data:e,width:t,height:r})=>{const n=p(null),{eventSchema:i}=m(he);return w((()=>{if(!n.current)return;const i=[],a=[];for(let o=0;o<e.length;o++){const l=n.current.children[2*o+1],s=e[o].Box;i.push({Top:s.Top*r,Left:s.Left*t,Bottom:s.Bottom*r,Right:s.Right*t});const[c,d]=qn(i[o]),{width:u,height:h}=l.getBoundingClientRect(),m=$n(s,u,h,t,r);a.push(Bn({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=a[t],n=[0,0];for(let l=0;l<e.length;l++){const e=i[l],s=a[l];if(Kn(r,e)){const t=Jn(e,r);n[0]=n[0]+t[0],n[1]=n[1]+t[1],o=!0}if(l!==t&&Kn(r,s)){const e=Jn(s,r);n[0]=n[0]+e[0],n[1]=n[1]+e[1],o=!0}}[n[0],n[1]]=Qn(n),r.Top+=n[1],r.Left+=n[0],r.Bottom+=n[1],r.Right+=n[0]}}for(let i=0;i<e.length;i++){const e=n.current.children[2*i+1],{Top:o,Left:l}=An(a[i],t,r,4);e.style.top=o+4+"px",e.style.left=l+4+"px"}}),[e,t,r]),h.createElement("div",{ref:n},e.map((({Box:e,Probability:t,Type:r},n)=>h.createElement(h.Fragment,{key:n},h.createElement(Hn,{box:e,style:{outline:`2px solid ${i.colorsByFoundObjectType.get(r)}`}}),h.createElement("div",{className:"event-list-item__detected-object-label",title:`${r.toLowerCase()} ${Math.floor(100*t)}%`},h.createElement("div",{style:{padding:4,lineHeight:"24px"}},r.toLowerCase()),h.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:i.colorsByFoundObjectType.get(r)}},Math.floor(100*t),"%"))))))}));ei.displayName="DetectedObjects";const ti=$((({data:e,width:t,height:r,cameraNameHidden:n,onClick:i,onAuxClick:a,menuComponent:o})=>{const l=m(he),{eventSchema:s}=l,[c,d]=function(e){var t;const[r,n]=v(null),i=m(he),{cameras:a,thumbnails:o}=i;E((()=>{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&&a.loaded?(l=(null===(t=a.camerasById.get(e.cameraId))||void 0===t?void 0:t.imageUrl)||"",s=!0):r&&(l=r.url),[l,s]}(e);let u=[],p=null,f=null;if(e.detectedObjects.length){let n,i;const{ThumbnailSize:a}=JSON.parse(e.raw.data);a&&(n=a.Width,i=a.Height),u=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)),p=e.detectedObjects.filter((({Type:e})=>"LicensePlate"===e)).map(((e,a)=>h.createElement(Wn,{key:a,detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:i,url:c})))}if(e.faces){const{Width:n,Height:i}=JSON.parse(e.raw.data).ThumbnailSize;f=e.faces.map(((e,a)=>h.createElement(Vn,{key:a,face:e,url:c,thumbWidth:n,thumbHeight:i,width:t,height:r})))}return h.createElement(zn,{onClick:i,onAuxClick:a,data:e,width:t,height:r,cameraNameHidden:n,menuComponent:o},h.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},h.createElement(Zn,{url:c,noPreview:d,width:t}),h.createElement(ei,{data:u,width:t,height:r}),p,f,e.acknowledged?h.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,h.createElement(Xn,{data:e,cameraNameHidden:n})))}));ti.displayName="EventItem";class ri extends h.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{hasError:!1}})}componentDidCatch(e,t){this.setState({hasError:!0}),ae.withScope((r=>{Object.keys(t).forEach((e=>{r.setExtra(e,t[e])})),ae.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 h.createElement("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r},h.createElement("h1",null,"Oops. Something went wrong"),h.createElement("div",null,"We've been notified about this problem"),h.createElement(Kt,{onClick:()=>this.setState({hasError:!1})},"retry"))}}function ni({count:e,overscan:t=1,itemSize:r,horizontal:n=!1,spacing:i=0}){const[a,o]=v(),[l,s]=v(0),c=f((e=>{o(e||void 0)}),[]);E((()=>{if(!a)return;const e=()=>{s(n?a.scrollLeft:a.scrollTop)};return a.addEventListener("scroll",e,{passive:!0,capture:!0}),()=>{a.removeEventListener("scroll",e)}}),[a,n]);return{parentRef:c,getItems:()=>{if(!a)return[];const o=[],{height:s,width:c}=a.getBoundingClientRect(),d=Math.max(0,Math.floor(l/(r+i))-t),u=Math.ceil((n?c:s)/(r+i))+2*t;for(let t=d;t<Math.min(e,d+u);t++)o.push({idx:t,start:t*(r+i),size:r});return o},getTotalSize:()=>r*e+Math.max(e-1,0)*i}}const ii=$((({columnIndex:e,rowIndex:t,style:r,store:n,columnCount:i,eventRenderer:a})=>{var o,l;const s=t*i+e,c=n.data[s];return s===n.data.length?n.error?h.createElement("div",{style:r},h.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},h.createElement("div",{style:{textAlign:"center"}},h.createElement("div",null,"Couldn't fetch more data"),h.createElement(Kt,{onClick:n.loadMore},"Retry")))):(null===(o=n.pageInfo)||void 0===o?void 0:o.haveMore)?h.createElement("div",{style:r},h.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},h.createElement(pr,{size:32}))):h.createElement("div",{style:r}):!c&&(null===(l=n.pageInfo)||void 0===l?void 0:l.haveMore)?h.createElement("div",{style:r}):c?h.createElement("div",{style:r},h.createElement(ri,null,a({data:c,width:r.width,height:r.height}))):h.createElement("div",{style:r})})),ai=$((({store:e,scrollWidth:t,onClick:r})=>e.pendingData.length?h.createElement("div",{style:{position:"absolute",top:0,left:0,right:t,pointerEvents:"none",textAlign:"center",padding:8}},h.createElement(Kt,{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},de.t("showEvents",{count:e.pendingData.length}))):null)),oi=$((({store:e,width:t,height:r,captionHeight:n=0,minColumnWidth:i=180,aspectRatio:a=16/9,onEventClick:o,onEventAuxClick:l,eventRenderer:s})=>{const c=p(null),d=()=>{c.current&&(c.current.scrollTop=0)};if(e.error&&!e.data.length)return d(),h.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},h.createElement("div",{style:{textAlign:"center"}},h.createElement("div",null,"Couldn't fetch data"),h.createElement(Kt,{onClick:e.reload},"Retry")));if(e.loading)return d(),h.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},h.createElement(pr,null));if(!e.data.length)return d(),h.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},de.t("noEventsFound"));const u={store:e,width:t,minColumnWidth:i,aspectRatio:a,captionHeight:n,height:r,onEventClick:o,onEventAuxClick:l,eventRenderer:s,containerRef:c,resetScroll:d};return h.createElement(li,{...u})}));oi.displayName="EventGrid";const li=$((({store:e,width:t,height:r,captionHeight:n=0,minColumnWidth:i=180,aspectRatio:a,containerRef:o,onEventClick:l,onEventAuxClick:s,eventRenderer:c=(({data:e,width:t,height:r})=>h.createElement(ti,{data:e.data,cameraNameHidden:!1,onClick:l,onAuxClick:s,width:t,height:r})),resetScroll:d})=>{var u,m;const p=Math.floor(t/i)||1,f=t/p/a+n,g=p*Math.floor(r/f)>=e.data.length?0:Fn(),v=Math.max(1,Math.floor((t-g)/i));let b=Math.ceil(e.data.length/v);const y=(t-g-2*(v-1))/v,w=y/a+n;(null===(u=e.pageInfo)||void 0===u?void 0:u.haveMore)&&b*v===e.data.length&&b++;const{parentRef:x,getItems:C,getTotalSize:O}=ni({count:b,overscan:5,itemSize:w,spacing:2}),{parentRef:T,getItems:M,getTotalSize:L}=ni({count:v,overscan:5,itemSize:y,horizontal:!0,spacing:2}),N=C(),P=M();E((()=>{var t;e.error||(null===(t=e.pageInfo)||void 0===t?void 0:t.haveMore)&&(e.loading||N.length&&N.at(-1).idx+1===b&&e.loadMore())}),[e.error,null===(m=e.pageInfo)||void 0===m?void 0:m.haveMore,N]);const j=N.flatMap((({idx:t,size:r,start:n})=>P.map((({idx:i,size:a,start:o})=>{var l;const s=t*v+i;return s>e.data.length?null:s!==e.data.length||(null===(l=e.pageInfo)||void 0===l?void 0:l.haveMore)?h.createElement(ii,{key:e.data[s]?`${e.data[s].data.id}-${e.data[s].objectIdx}`:"loading",columnIndex:i,rowIndex:t,columnCount:v,style:{position:"absolute",top:0,left:0,height:r,width:a,transform:`translate(${o}px, ${n}px)`,display:"flex"},store:e,eventRenderer:c}):null}))));return h.createElement("div",{style:{width:"100%",height:"100%",overflow:"hidden",position:"relative"}},h.createElement("div",{ref:ie(o,x,T),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")}},h.createElement("div",{style:{position:"relative",height:O(),width:L()}},j)),h.createElement(ai,{store:e,scrollWidth:g,onClick:()=>{e.flushUpdates(),e.setLiveUpdateMode("auto"),d()}}))})),si=({onEventClick:e,style:t,...r})=>{var n;const i=null!==(n=m(x))&&void 0!==n?n:C,[a,o]=v(),{ref:l,width:s,height:c}=(e=>{const{ref:t,width:r,height:n}=oe(),[i,a]=v(0);return E((()=>{a((e=>e+1))}),e),{ref:t,width:r,height:n,fix:i}})([a]);return E((()=>(null==a||a.dispose(),j((()=>i.initialized),(()=>{const e=new Lt(i.events);e.initWith(i.api),e.load(),o(e)})))),[i]),h.createElement(he.Provider,{value:i},a?h.createElement("div",{style:{display:"flex",flexDirection:"column",textAlign:"left",...t},...r},h.createElement(Gt,{addionalFiltersEnabled:!0,store:a}),h.createElement(lr,{store:a}),a.someAnalyticsFilterSelected&&h.createElement(h.Fragment,null,h.createElement(dr,{getter:a.getProbabilityTreshold,setter:a.setProbabilityTreshold}),h.createElement(mr,{value:a.colors,toggle:a.toggleColor,clear:a.clearColors})),h.createElement("div",{ref:l,style:{flex:1,display:"flex"}},h.createElement(oi,{minColumnWidth:1/0,store:a.eventsLoader,width:s,height:c,eventRenderer:({data:t,width:r,height:n})=>h.createElement(ti,{data:t.data,cameraNameHidden:!1,onClick:e,width:r,height:n})}))):null)};var ci;si.displayName="EventList",(ci={resources:{en:{translation:le}}})&&Object.assign(ce,ci),de.isInitialized?(ce.resources?Object.keys(ce.resources).forEach((e=>{de.addResourceBundle(e,"translation",ce.resources[e].translation,!0)})):console.warn("i18n is already initialized"),o(de.t)):l(de.init(ce));export{si as default};
package/package.json CHANGED
@@ -1,38 +1,35 @@
1
1
  {
2
2
  "name": "@3deye-toolkit/react-event-list",
3
- "version": "0.0.1-alpha.29",
3
+ "version": "0.0.1-alpha.30",
4
4
  "module": "dist/react-event-list.js",
5
5
  "types": "dist/react-event-list.d.ts",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
9
  "dependencies": {
10
- "@3deye-toolkit/core": "0.0.1-alpha.29",
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",
16
16
  "date-fns": "^2.28.0",
17
+ "earcut": "^2.2.3",
17
18
  "i18next": "21.6.11",
18
19
  "lodash": "4.17.21",
19
20
  "mobx": "^6.3.13",
20
21
  "mobx-react-lite": "^3.2.3",
21
22
  "react-datepicker": "^4.6.0",
22
- "react-ink": "^6.5.1",
23
+ "react-ink": "^6.5.3",
23
24
  "react-select": "^5.2.2",
24
- "react-virtualized-auto-sizer": "^1.0.6",
25
- "react-window": "^1.8.6",
26
- "react-window-infinite-loader": "^1.0.7",
27
25
  "rxjs": "^7.5.3"
28
26
  },
29
27
  "peerDependencies": {
30
- "react": "^16.8.0 || ^17",
31
- "react-dom": "^16.8.0 || ^17"
28
+ "react": "^16.8.0 || ^17 || ^18",
29
+ "react-dom": "^16.8.0 || ^17 || ^18"
32
30
  },
33
31
  "sideEffects": [
34
32
  "*.css"
35
33
  ],
36
- "license": "mit",
37
- "gitHead": "5b47d51ae43158bf213709f5ef38f5eb401cfc92"
38
- }
34
+ "license": "mit"
35
+ }