@3deye-toolkit/react-event-list 0.0.1-alpha.19 → 0.0.1-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,23 @@
1
1
  import { default as React_2 } from 'react';
2
2
 
3
3
  declare class CameraEvent {
4
- id: number;
5
- startTime: Date;
6
- endTime: Date;
7
4
  cameraId: number;
8
5
  type: EventType;
6
+ raw: RawSensorEvent;
9
7
  thumbnailUrl: string;
10
- raw: RawEvent;
11
- foundObjects: FoundObject[];
8
+ detectedObjects: DetectedObject[];
12
9
  faces: Face[];
10
+ instant: boolean;
11
+ get id(): number;
12
+ get startTime(): Date;
13
+ get endTime(): Date;
13
14
  get isLive(): boolean;
14
- constructor(raw: RawEvent);
15
+ get acknowledged(): boolean;
16
+ constructor(raw: RawSensorEvent);
15
17
  }
16
18
 
17
- declare const EventList: React_2.FC<Props>;
18
- export default EventList;
19
-
20
- declare enum EventType {
21
- Default = "Default",
22
- Analytic = "Analytic"
23
- }
24
-
25
- declare interface Face {
26
- PersonId: number;
27
- Name: string;
19
+ declare interface DetectedObject {
20
+ Type: string;
28
21
  Box: {
29
22
  Left: number;
30
23
  Top: number;
@@ -32,10 +25,19 @@ declare interface Face {
32
25
  Bottom: number;
33
26
  };
34
27
  Probability: number;
28
+ Colors: {
29
+ Color: string;
30
+ }[];
35
31
  }
36
32
 
37
- declare interface FoundObject {
38
- Type: string;
33
+ declare const EventList: React_2.FC<Props>;
34
+ export default EventList;
35
+
36
+ declare type EventType = 'Motion' | 'Tampering' | 'PanTiltZoom' | 'CrossLine' | 'Intrusion' | 'LicensePlate' | 'FaceDetection' | 'Audio' | 'Analytic' | 'SpeedDetection' | 'PeopleCounter' | 'Temperature' | 'PoS' | 'GPS' | 'DigitalInput' | 'Normal' | 'Suspicious' | 'Loitering' | 'Vandalism' | 'Trespass' | 'Emergency' | 'LifeInDanger' | 'ErroneousAlert' | 'Misidentification' | 'Fire' | 'MedicalDuress' | 'HoldUp' | 'CheckIn' | 'CheckOut' | 'ClockIn' | 'ClockOut' | 'ParkingStart' | 'ParkingEnd' | 'ParkingViolation' | 'GateAccess' | 'DoorAccess' | 'TemperatureCheck' | 'IDCheck' | 'PPECheck' | 'WelfareCheck' | 'Uncategorized' | 'Unknown';
37
+
38
+ declare interface Face {
39
+ PersonId: number;
40
+ Name: string;
39
41
  Box: {
40
42
  Left: number;
41
43
  Top: number;
@@ -43,22 +45,27 @@ declare interface FoundObject {
43
45
  Bottom: number;
44
46
  };
45
47
  Probability: number;
46
- Colors: {
47
- Color: string;
48
- }[];
49
48
  }
50
49
 
51
50
  declare interface Props {
52
51
  onEventClick: (event: CameraEvent) => void;
53
52
  }
54
53
 
55
- declare interface RawEvent {
54
+ declare interface RawSensorEvent {
55
+ message: string;
56
+ data: string | null;
56
57
  id: number;
58
+ customerId: number;
59
+ sensorId: number;
60
+ sensorType: 'CameraSensor' | 'MotionSensor' | 'IntrusionSensor' | 'AudioSensor' | 'TemperatureSensor' | 'SpeedSensor' | 'Unknown';
61
+ eventType: EventType;
62
+ ackEventType: string;
63
+ description?: any;
64
+ tags?: any;
65
+ customerData?: any;
57
66
  startTime: string;
58
- endTime?: string;
59
- cameraId: number;
60
- thumbnailUrl: string;
61
- data: string;
67
+ endTime: string;
68
+ userId: string;
62
69
  }
63
70
 
64
71
  export { }
@@ -1,60 +1 @@
1
- import e,{createElement as t,useState as n,useRef as o,useMemo as i,useEffect as r,useCallback as a,useContext as s,Fragment as l}from"react";import{AppContext as c,app as d}from"@3deye-toolkit/core";import{reaction as u,observable as p,action as h,computed as m}from"mobx";import{observer as f,disposeOnUnmount as v}from"mobx-react";import g from"react-datepicker";import y from"i18next";import{format as b,isSameYear as E,isSameDay as _}from"date-fns/esm";import{Subject as C,empty as w,Subscription as T}from"rxjs";import x from"classnames";import S from"react-ink";import R from"@reach/tooltip";import M from"material-colors";import A,{findDOMNode as O}from"react-dom";import{useSpring as D,animated as N}from"react-spring";import{Slider as H}from"@rmwc/slider";import L from"resize-observer-polyfill";import k from"react-virtualized-auto-sizer";import{FixedSizeList as P}from"react-window";import{switchMap as I,debounceTime as F}from"rxjs/operators";import z,{components as V}from"react-select";const B=e.createContext(null);
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
- this file except in compliance with the License. You may obtain a copy of the
6
- License at http://www.apache.org/licenses/LICENSE-2.0
7
-
8
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
10
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11
- MERCHANTABLITY OR NON-INFRINGEMENT.
12
-
13
- See the Apache Version 2.0 License for specific language governing permissions
14
- and limitations under the License.
15
- ***************************************************************************** */var U=function(e,t){return(U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function j(e,t){function n(){this.constructor=e}U(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var $=function(){return($=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function G(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]])}return n}function W(e,t,n,o){var i,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(r<3?i(a):r>3?i(t,n,a):i(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function q(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function K(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a}function X(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(K(arguments[t]));return e}const Y=new Map,Z=y.createInstance();function J(e,t){const n=Y.get(Z.language);return b(e,t,{locale:n})}const Q={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},ee=({label:t,children:n})=>e.createElement(R,{label:t,style:Q},n);ee.displayName="Tooltip";class te extends e.Component{render(){const{forwardedRef:t,children:n,className:o,fullwidth:i,type:r,title:a,...s}=this.props,l=x(o,"x-3deye-button",{fullwidth:i}),c=e.createElement("button",Object.assign({ref:t,className:l,type:r||"button"},s),n,s.disabled?null:e.createElement(S,null));return a?e.createElement(ee,{label:a},c):c}}var ne=e.forwardRef((t,n)=>e.createElement(te,Object.assign({forwardedRef:n},t)));const oe=t=>{const{className:n,children:o,...i}=t;return e.createElement("div",Object.assign({className:x("x-3deye-button-group",n)},i),o)};function ie(t){return n=>{const{size:o=24,color:i="currentColor",className:r,...a}=n,s=t.viewBox||"0 0 24 24",l=t.svg;return e.createElement("svg",Object.assign({preserveAspectRatio:"xMinYMin",className:`icon ${r}`,width:o,fill:i,viewBox:s,height:o},a),l)}}const re=ie({viewBox:"0 0 24 24",svg:e.createElement(e.Fragment,null,e.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),e.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});re.displayName="DoneIcon";const ae=ie({viewBox:"0 0 24 24",svg:e.createElement("g",null,e.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"}),e.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});ae.displayName="CloseIcon";const se=[{color:M.red[500],name:"red",highlightColor:M.red[100]},{color:M.green[500],name:"green",highlightColor:M.green[100]},{color:M.blue[500],name:"blue",highlightColor:M.blue[100]},{color:M.yellow[500],name:"yellow",highlightColor:M.yellow[900]},{color:M.black,name:"black",highlightColor:M.white},{color:M.white,name:"white",highlightColor:M.black},{color:M.grey[500],name:"dimgrey",highlightColor:M.grey[100]}];let le=class extends e.Component{constructor(){super(...arguments),this.toggleColor=e=>{this.props.toggle(e)}}render(){const{value:t,clear:n}=this.props;return e.createElement("div",{className:"color-selector"},e.createElement("div",null,"COLOR"),e.createElement("div",{className:"color-selector__items"},se.map(({color:n,highlightColor:o,name:i})=>e.createElement("button",{key:i,className:x("color-selector__item",{selected:t.has(i)}),style:{backgroundColor:n,color:o},onClick:this.toggleColor.bind(null,i)},e.createElement(re,{size:20}))),e.createElement(ne,{disabled:!t.size,onClick:n},e.createElement(ae,{size:20}))))}};le=W([f],le);var ce=le;const de=e=>`scale(${e})`,ue=({children:e,from:n,style:o})=>{const i=D({opacity:1,from:{opacity:0},config:{tension:300}});return t(N.div,{style:{...o,...i,transform:i.opacity.interpolate(de),transformOrigin:`${n||"bottom"} center`,width:"max-content"}},e)},pe=document.body;class he extends e.Component{constructor(e){super(e),this.el=document.createElement("div")}componentDidMount(){pe.appendChild(this.el)}componentWillUnmount(){pe.removeChild(this.el)}render(){return A.createPortal(this.props.children,this.el)}}const me=({width:t,height:n,color:o,position:i="top",style:r})=>{const a=[0,"top"===i?n:0],s=[t,a[1]],l=[t/2,n-a[1]],c=[t/4,n*("top"===i?3:1)/4],d=[.325*t,n-a[1]],u=[t-d[0],d[1]],p=[t-c[0],c[1]],h=e=>e.join(","),m=`M ${h(a)} `+`C ${h(c)} ${h(d)} ${h(l)} `+`${h(u)} ${h(p)} ${h(s)} Z`;return e.createElement("svg",{className:"tip",style:r,width:t,height:n,fill:o},e.createElement("path",{d:m}))};class fe extends e.Component{constructor(){super(...arguments),this.state={top:0,left:0,bottom:"auto",tipPosition:"bottom",tipOffset:0},this.targetRef=e.createRef(),this.popoverRef=e.createRef(),this.outsideClickListener=e=>{const t=e.target;if(this.popoverRef.current.contains(t))return;const n=A.findDOMNode(this.targetRef.current);n&&n.contains(t)||this.props.onCloseRequest()},this.updatePosition=()=>{if(!this.popoverRef)return;const{disablePortal:e}=this.props,t=A.findDOMNode(this.targetRef.current);if(!t)return void console.warn("popover: no target element found");const{top:n,left:o,bottom:i,height:r,width:a}=t.getBoundingClientRect();let s="calc(50% - 12px)",l="auto";const c=this.popoverRef.current;let d="bottom"===this.props.position?i+10:n-c.clientHeight-10,u=o+a/2-c.clientWidth/2,p="bottom"===this.props.position?"top":"bottom";d<0&&(d=i+10,p="top"),u<0&&(u=0,s=o+a/2-12),u+c.clientWidth>window.innerWidth&&(u=window.innerWidth-c.clientWidth,s=o-u+a/2-12),e&&(d=r+10,u=0,s=8,"top"===this.props.position&&(l=d,d="auto")),this.setState({top:d,bottom:l,left:u,tipPosition:p,tipOffset:s},()=>{this.forceUpdate()})}}componentWillUnmount(){this.stopOutsideClickListening()}componentDidUpdate(e){const{ignoreOutsideClick:t}=this.props;this.props.opened&&!e.opened&&(t||this.startOutsideClickListening(),requestAnimationFrame(this.updatePosition)),!this.props.opened&&e.opened&&this.stopOutsideClickListening()}render(){const{top:t,left:n,bottom:o,tipPosition:i,tipOffset:r}=this.state,{className:a,opened:s,disablePortal:l,disableAnimation:c}=this.props,d={position:"absolute",left:r};"bottom"===i?d.bottom=-8:d.top=-8;const u=x(a,"x-3deye-popover-body");let p=null;if(s){const r={zIndex:l?1:100000001,position:"absolute",top:t,bottom:o,left:n},a=e.createElement("div",{className:u,ref:this.popoverRef},this.props.children,e.createElement(me,{width:24,height:8,position:i,color:"white",style:d}));p=c?e.createElement("div",{style:r},a):e.createElement(ue,{from:i,style:r},a)}const h=e.cloneElement(this.props.target,{ref:this.targetRef});if(l)return e.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},h,p);const m=s&&e.createElement(he,null,p);return e.createElement(e.Fragment,null,h,m)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}let ve=class extends e.Component{constructor(){super(...arguments),this.containerRef=e.createRef(),this.sliderRef=e.createRef(),this.probabilityThreshold=0,this.width=0,this.resizeObserver=null,this.onSliderInput=e=>{this.probabilityThreshold=e.detail.value},this.onSliderChange=()=>{this.props.setter(this.probabilityThreshold/100)}}reactToValueChange(){this.disposeReactionToValue&&this.disposeReactionToValue(),this.disposeReactionToValue=u(this.props.getter,e=>{this.probabilityThreshold=Math.floor(100*e)},{fireImmediately:!0})}componentDidMount(){this.reactToValueChange(),this.resizeObserver=new L(e=>{for(const t of e){const e=t.contentRect.width;this.width=e}}),this.resizeObserver.observe(this.containerRef.current),v(this,u(()=>this.width,()=>{this.sliderRef.current.layout()}))}componentDidUpdate(e){e.getter!==this.props.getter&&this.reactToValueChange()}componentWillUnmount(){this.disposeReactionToValue()}render(){const t=Math.floor(100*this.props.getter());return e.createElement("div",{ref:this.containerRef,style:{paddingLeft:8,paddingRight:8,marginTop:5}},e.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},e.createElement("div",null,"CONFIDENCE"),e.createElement("div",{style:{fontSize:"1.1em"}},t,"%")),e.createElement(H,{foundationRef:this.sliderRef,onInput:this.onSliderInput,onChange:this.onSliderChange,value:this.probabilityThreshold,discrete:!0,displayMarkers:!0,min:0,max:100,step:5}))}};W([p],ve.prototype,"probabilityThreshold",void 0),W([p],ve.prototype,"width",void 0),W([h],ve.prototype,"onSliderInput",void 0),W([h],ve.prototype,"onSliderChange",void 0),ve=W([f],ve);var ge=ve;const ye=()=>e.createElement("svg",{width:"48px",height:"48px",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},e.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),e.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)"},e.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));ye.displayName="Preloader";var be,Ee,_e=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0})}(be={exports:{}},be.exports),be.exports);(Ee=_e)&&Ee.__esModule&&Object.prototype.hasOwnProperty.call(Ee,"default")&&Ee.default;var Ce,we={blur:"onBlur",cancel:"onCancel",click:"onClick",close:"onClose",contextmenu:"onContextMenu",copy:"onCopy",cut:"onCut",auxclick:"onAuxClick",doubleclick:"onDoubleClick",dragend:"onDragEnd",dragstart:"onDragStart",drop:"onDrop",focus:"onFocus",input:"onInput",invalid:"onInvalid",keydown:"onKeyDown",keypress:"onKeyPress",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",paste:"onPaste",pause:"onPause",play:"onPlay",pointercancel:"onPointerCancel",pointerdown:"onPointerDown",pointerup:"onPointerUp",ratechange:"onRateChange",reset:"onReset",seeked:"onSeeked",submit:"onSubmit",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchstart:"onTouchStart",volumechange:"onVolumeChange",abort:"onAbort",animationend:"onAnimationEnd",animationiteration:"onAnimationIteration",animationstart:"onAnimationStart",canplay:"onCanPlay",canplaythrough:"onCanPlayThrough",drag:"onDrag",dragenter:"onDragEnter",dragexit:"onDragExit",dragleave:"onDragLeave",dragover:"onDragOver",durationchange:"onDurationChange",emptied:"onEmptied",encrypted:"onEncrypted",ended:"onEnded",error:"onError",gotpointercapture:"onGotPointerCapture",load:"onLoad",loadeddata:"onLoadedData",loadedmetadata:"onLoadedMetadata",loadstart:"onLoadStart",lostpointercapture:"onLostPointerCapture",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseover:"onMouseOver",playing:"onPlaying",pointermove:"onPointerMove",pointerout:"onPointerOut",pointerover:"onPointerOver",progress:"onProgress",scroll:"onScroll",seeking:"onSeeking",stalled:"onStalled",suspend:"onSuspend",timeupdate:"onTimeUpdate",toggle:"onToggle",touchmove:"onTouchMove",transitionend:"onTransitionEnd",waiting:"onWaiting",wheel:"onWheel",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",change:"onChange",select:"onSelect",beforeinput:"onBeforeInput",compositionend:"onCompositionEnd",compositionstart:"onCompositionStart",compositionupdate:"onCompositionUpdate"};function Te(e,t){if(void 0===e&&(e=window),void 0===t&&(t=!1),void 0===Ce||t){var n=!1;try{e.document.addEventListener("test",(function(){}),{get passive(){return n=!0}})}catch(e){}Ce=n}return!!Ce&&{passive:!0}}var xe,Se={bottom:0,height:0,left:0,right:0,top:0,width:0},Re=(e.forwardRef((function(t,n){var o=t.tag,i=void 0===o?"div":o,r=(t.theme,t.element),a=G(t,["tag","theme","element"]),s=r?r.props(a):a,l=r?Re(n,r.setRef):n;return e.createElement(i,$({},s,{ref:l}))})),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var n,o;try{for(var i=q(e),r=i.next();!r.done;r=i.next()){var a=r.value;"function"==typeof a?a(t):a&&"current"in a&&(a.current=t)}}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}}),Me=function(e,t){"function"==typeof e?e(t):e&&"current"in e&&(e.current=t)},Ae=function(e){return we[e]||e},Oe=function(){function e(e){this._classes=new Set,this._events={},this._style={},this._props={},this._ref=null,this._onChange=null,this._onChange=e,this.onChange=this.onChange.bind(this),this.addClass=this.addClass.bind(this),this.removeClass=this.removeClass.bind(this),this.hasClass=this.hasClass.bind(this),this.setProp=this.setProp.bind(this),this.getProp=this.getProp.bind(this),this.removeProp=this.removeProp.bind(this),this.setStyle=this.setStyle.bind(this),this.addEventListener=this.addEventListener.bind(this),this.removeEventListener=this.removeEventListener.bind(this),this.setRef=this.setRef.bind(this)}return e.prototype.onChange=function(){this._onChange&&this._onChange()},e.prototype.destroy=function(){var e=this;this._onChange=null,this._events={},this._style={},this._props={},this._classes=new Set,setTimeout((function(){e._ref=null}))},e.prototype.addClass=function(e){this._classes.has(e)||(this._classes.add(e),this.onChange())},e.prototype.removeClass=function(e){this._classes.has(e)&&(this._classes.delete(e),this.onChange())},e.prototype.hasClass=function(e){return this._classes.has(e)},e.prototype.setProp=function(e,t,n){void 0===n&&(n=!1),this._props[e]!==t&&(this._props[e]=t,!n&&this.onChange())},e.prototype.getProp=function(e){return this._props[e]},e.prototype.removeProp=function(e){void 0!==this._props[e]&&(delete this._props[e],this.onChange())},e.prototype.props=function(e){var t=this,n=e.className,o=void 0===n?"":n,i=e.style,r=void 0===i?{}:i,a=Object.entries(e).reduce((function(e,n){var o=K(n,2),i=o[0],r=o[1],a=t._events[i];if("function"==typeof r&&"function"==typeof a){e[i]=function(e){return a(e),r(e)}}return e}),$({},this._events)),s=x(o,X(this._classes)),l=$($({},this._style),r);return $($($($({},e),this._props),a),{style:l,className:s})},e.prototype.setStyle=function(e,t){e=e.startsWith("--")?e:e.replace(/(-[a-z])/g,(function(e){return e.toUpperCase().replace("-","")})),this._style[e]!==t&&(this._style[e]=t,this.onChange())},e.prototype.addEventListener=function(e,t){var n=Ae(e);this._events[n]!==t&&(this._events[n]=t,this.onChange())},e.prototype.removeEventListener=function(e,t){var n=Ae(e);this._events[n]&&(delete this._events[n],this.onChange())},e.prototype.setRef=function(e){e&&(this._ref=e)},Object.defineProperty(e.prototype,"ref",{get:function(){return this._ref},enumerable:!0,configurable:!0}),e}(),De=function(e){return function(t,n,o){var i;void 0===o&&(o=!1),i=new CustomEvent(t,{detail:n,bubbles:o}),Object.defineProperty(i,"target",{value:n,writable:!1}),Object.defineProperty(i,"currentTarget",{value:n,writable:!1});var r=t;return e[r]&&e[r](i),i}};
16
- /**
17
- * @license
18
- * Copyright 2016 Google Inc.
19
- *
20
- * Permission is hereby granted, free of charge, to any person obtaining a copy
21
- * of this software and associated documentation files (the "Software"), to deal
22
- * in the Software without restriction, including without limitation the rights
23
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
- * copies of the Software, and to permit persons to whom the Software is
25
- * furnished to do so, subject to the following conditions:
26
- *
27
- * The above copyright notice and this permission notice shall be included in
28
- * all copies or substantial portions of the Software.
29
- *
30
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
36
- * THE SOFTWARE.
37
- */
38
- var Ne,He=function(){function e(e){void 0===e&&(e={}),this.adapter_=e}return Object.defineProperty(e,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.destroy=function(){},e}(),Le={BG_FOCUSED:"mdc-ripple-upgraded--background-focused",FG_ACTIVATION:"mdc-ripple-upgraded--foreground-activation",FG_DEACTIVATION:"mdc-ripple-upgraded--foreground-deactivation",ROOT:"mdc-ripple-upgraded",UNBOUNDED:"mdc-ripple-upgraded--unbounded"},ke={VAR_FG_SCALE:"--mdc-ripple-fg-scale",VAR_FG_SIZE:"--mdc-ripple-fg-size",VAR_FG_TRANSLATE_END:"--mdc-ripple-fg-translate-end",VAR_FG_TRANSLATE_START:"--mdc-ripple-fg-translate-start",VAR_LEFT:"--mdc-ripple-left",VAR_TOP:"--mdc-ripple-top"},Pe={DEACTIVATION_TIMEOUT_MS:225,FG_DEACTIVATION_MS:150,INITIAL_ORIGIN_SCALE:.6,PADDING:10,TAP_DELAY_MS:300},Ie=["touchstart","pointerdown","mousedown","keydown"],Fe=["touchend","pointerup","mouseup","contextmenu"],ze=[],Ve=function(e){function t(n){var o=e.call(this,$({},t.defaultAdapter,n))||this;return o.activationAnimationHasEnded_=!1,o.activationTimer_=0,o.fgDeactivationRemovalTimer_=0,o.fgScale_="0",o.frame_={width:0,height:0},o.initialSize_=0,o.layoutFrame_=0,o.maxRadius_=0,o.unboundedCoords_={left:0,top:0},o.activationState_=o.defaultActivationState_(),o.activationTimerCallback_=function(){o.activationAnimationHasEnded_=!0,o.runDeactivationUXLogicIfReady_()},o.activateHandler_=function(e){return o.activate_(e)},o.deactivateHandler_=function(){return o.deactivate_()},o.focusHandler_=function(){return o.handleFocus()},o.blurHandler_=function(){return o.handleBlur()},o.resizeHandler_=function(){return o.layout()},o}return j(t,e),Object.defineProperty(t,"cssClasses",{get:function(){return Le},enumerable:!0,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return ke},enumerable:!0,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return Pe},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{addClass:function(){},browserSupportsCssVars:function(){return!0},computeBoundingRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},containsEventTarget:function(){return!0},deregisterDocumentInteractionHandler:function(){},deregisterInteractionHandler:function(){},deregisterResizeHandler:function(){},getWindowPageOffset:function(){return{x:0,y:0}},isSurfaceActive:function(){return!0},isSurfaceDisabled:function(){return!0},isUnbounded:function(){return!0},registerDocumentInteractionHandler:function(){},registerInteractionHandler:function(){},registerResizeHandler:function(){},removeClass:function(){},updateCssVariable:function(){}}},enumerable:!0,configurable:!0}),t.prototype.init=function(){var e=this,n=this.supportsPressRipple_();if(this.registerRootHandlers_(n),n){var o=t.cssClasses,i=o.ROOT,r=o.UNBOUNDED;requestAnimationFrame((function(){e.adapter_.addClass(i),e.adapter_.isUnbounded()&&(e.adapter_.addClass(r),e.layoutInternal_())}))}},t.prototype.destroy=function(){var e=this;if(this.supportsPressRipple_()){this.activationTimer_&&(clearTimeout(this.activationTimer_),this.activationTimer_=0,this.adapter_.removeClass(t.cssClasses.FG_ACTIVATION)),this.fgDeactivationRemovalTimer_&&(clearTimeout(this.fgDeactivationRemovalTimer_),this.fgDeactivationRemovalTimer_=0,this.adapter_.removeClass(t.cssClasses.FG_DEACTIVATION));var n=t.cssClasses,o=n.ROOT,i=n.UNBOUNDED;requestAnimationFrame((function(){e.adapter_.removeClass(o),e.adapter_.removeClass(i),e.removeCssVars_()}))}this.deregisterRootHandlers_(),this.deregisterDeactivationHandlers_()},t.prototype.activate=function(e){this.activate_(e)},t.prototype.deactivate=function(){this.deactivate_()},t.prototype.layout=function(){var e=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame((function(){e.layoutInternal_(),e.layoutFrame_=0}))},t.prototype.setUnbounded=function(e){var n=t.cssClasses.UNBOUNDED;e?this.adapter_.addClass(n):this.adapter_.removeClass(n)},t.prototype.handleFocus=function(){var e=this;requestAnimationFrame((function(){return e.adapter_.addClass(t.cssClasses.BG_FOCUSED)}))},t.prototype.handleBlur=function(){var e=this;requestAnimationFrame((function(){return e.adapter_.removeClass(t.cssClasses.BG_FOCUSED)}))},t.prototype.supportsPressRipple_=function(){return this.adapter_.browserSupportsCssVars()},t.prototype.defaultActivationState_=function(){return{activationEvent:void 0,hasDeactivationUXRun:!1,isActivated:!1,isProgrammatic:!1,wasActivatedByPointer:!1,wasElementMadeActive:!1}},t.prototype.registerRootHandlers_=function(e){var t=this;e&&(Ie.forEach((function(e){t.adapter_.registerInteractionHandler(e,t.activateHandler_)})),this.adapter_.isUnbounded()&&this.adapter_.registerResizeHandler(this.resizeHandler_)),this.adapter_.registerInteractionHandler("focus",this.focusHandler_),this.adapter_.registerInteractionHandler("blur",this.blurHandler_)},t.prototype.registerDeactivationHandlers_=function(e){var t=this;"keydown"===e.type?this.adapter_.registerInteractionHandler("keyup",this.deactivateHandler_):Fe.forEach((function(e){t.adapter_.registerDocumentInteractionHandler(e,t.deactivateHandler_)}))},t.prototype.deregisterRootHandlers_=function(){var e=this;Ie.forEach((function(t){e.adapter_.deregisterInteractionHandler(t,e.activateHandler_)})),this.adapter_.deregisterInteractionHandler("focus",this.focusHandler_),this.adapter_.deregisterInteractionHandler("blur",this.blurHandler_),this.adapter_.isUnbounded()&&this.adapter_.deregisterResizeHandler(this.resizeHandler_)},t.prototype.deregisterDeactivationHandlers_=function(){var e=this;this.adapter_.deregisterInteractionHandler("keyup",this.deactivateHandler_),Fe.forEach((function(t){e.adapter_.deregisterDocumentInteractionHandler(t,e.deactivateHandler_)}))},t.prototype.removeCssVars_=function(){var e=this,n=t.strings;Object.keys(n).forEach((function(t){0===t.indexOf("VAR_")&&e.adapter_.updateCssVariable(n[t],null)}))},t.prototype.activate_=function(e){var t=this;if(!this.adapter_.isSurfaceDisabled()){var n=this.activationState_;if(!n.isActivated){var o=this.previousActivationEvent_;if(!(o&&void 0!==e&&o.type!==e.type))n.isActivated=!0,n.isProgrammatic=void 0===e,n.activationEvent=e,n.wasActivatedByPointer=!n.isProgrammatic&&(void 0!==e&&("mousedown"===e.type||"touchstart"===e.type||"pointerdown"===e.type)),void 0!==e&&ze.length>0&&ze.some((function(e){return t.adapter_.containsEventTarget(e)}))?this.resetActivationState_():(void 0!==e&&(ze.push(e.target),this.registerDeactivationHandlers_(e)),n.wasElementMadeActive=this.checkElementMadeActive_(e),n.wasElementMadeActive&&this.animateActivation_(),requestAnimationFrame((function(){ze=[],n.wasElementMadeActive||void 0===e||" "!==e.key&&32!==e.keyCode||(n.wasElementMadeActive=t.checkElementMadeActive_(e),n.wasElementMadeActive&&t.animateActivation_()),n.wasElementMadeActive||(t.activationState_=t.defaultActivationState_())})))}}},t.prototype.checkElementMadeActive_=function(e){return void 0===e||"keydown"!==e.type||this.adapter_.isSurfaceActive()},t.prototype.animateActivation_=function(){var e=this,n=t.strings,o=n.VAR_FG_TRANSLATE_START,i=n.VAR_FG_TRANSLATE_END,r=t.cssClasses,a=r.FG_DEACTIVATION,s=r.FG_ACTIVATION,l=t.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal_();var c="",d="";if(!this.adapter_.isUnbounded()){var u=this.getFgTranslationCoordinates_(),p=u.startPoint,h=u.endPoint;c=p.x+"px, "+p.y+"px",d=h.x+"px, "+h.y+"px"}this.adapter_.updateCssVariable(o,c),this.adapter_.updateCssVariable(i,d),clearTimeout(this.activationTimer_),clearTimeout(this.fgDeactivationRemovalTimer_),this.rmBoundedActivationClasses_(),this.adapter_.removeClass(a),this.adapter_.computeBoundingRect(),this.adapter_.addClass(s),this.activationTimer_=setTimeout((function(){return e.activationTimerCallback_()}),l)},t.prototype.getFgTranslationCoordinates_=function(){var e,t=this.activationState_,n=t.activationEvent;return{startPoint:e={x:(e=t.wasActivatedByPointer?function(e,t,n){if(!e)return{x:0,y:0};var o,i,r=t.x,a=t.y,s=r+n.left,l=a+n.top;if("touchstart"===e.type){var c=e;o=c.changedTouches[0].pageX-s,i=c.changedTouches[0].pageY-l}else{var d=e;o=d.pageX-s,i=d.pageY-l}return{x:o,y:i}}(n,this.adapter_.getWindowPageOffset(),this.adapter_.computeBoundingRect()):{x:this.frame_.width/2,y:this.frame_.height/2}).x-this.initialSize_/2,y:e.y-this.initialSize_/2},endPoint:{x:this.frame_.width/2-this.initialSize_/2,y:this.frame_.height/2-this.initialSize_/2}}},t.prototype.runDeactivationUXLogicIfReady_=function(){var e=this,n=t.cssClasses.FG_DEACTIVATION,o=this.activationState_,i=o.hasDeactivationUXRun,r=o.isActivated;(i||!r)&&this.activationAnimationHasEnded_&&(this.rmBoundedActivationClasses_(),this.adapter_.addClass(n),this.fgDeactivationRemovalTimer_=setTimeout((function(){e.adapter_.removeClass(n)}),Pe.FG_DEACTIVATION_MS))},t.prototype.rmBoundedActivationClasses_=function(){var e=t.cssClasses.FG_ACTIVATION;this.adapter_.removeClass(e),this.activationAnimationHasEnded_=!1,this.adapter_.computeBoundingRect()},t.prototype.resetActivationState_=function(){var e=this;this.previousActivationEvent_=this.activationState_.activationEvent,this.activationState_=this.defaultActivationState_(),setTimeout((function(){return e.previousActivationEvent_=void 0}),t.numbers.TAP_DELAY_MS)},t.prototype.deactivate_=function(){var e=this,t=this.activationState_;if(t.isActivated){var n=$({},t);t.isProgrammatic?(requestAnimationFrame((function(){return e.animateDeactivation_(n)})),this.resetActivationState_()):(this.deregisterDeactivationHandlers_(),requestAnimationFrame((function(){e.activationState_.hasDeactivationUXRun=!0,e.animateDeactivation_(n),e.resetActivationState_()})))}},t.prototype.animateDeactivation_=function(e){var t=e.wasActivatedByPointer,n=e.wasElementMadeActive;(t||n)&&this.runDeactivationUXLogicIfReady_()},t.prototype.layoutInternal_=function(){var e=this;this.frame_=this.adapter_.computeBoundingRect();var n=Math.max(this.frame_.height,this.frame_.width);this.maxRadius_=this.adapter_.isUnbounded()?n:Math.sqrt(Math.pow(e.frame_.width,2)+Math.pow(e.frame_.height,2))+t.numbers.PADDING;var o=Math.floor(n*t.numbers.INITIAL_ORIGIN_SCALE);this.adapter_.isUnbounded()&&o%2!=0?this.initialSize_=o-1:this.initialSize_=o,this.fgScale_=""+this.maxRadius_/this.initialSize_,this.updateLayoutCssVars_()},t.prototype.updateLayoutCssVars_=function(){var e=t.strings,n=e.VAR_FG_SIZE,o=e.VAR_LEFT,i=e.VAR_TOP,r=e.VAR_FG_SCALE;this.adapter_.updateCssVariable(n,this.initialSize_+"px"),this.adapter_.updateCssVariable(r,this.fgScale_),this.adapter_.isUnbounded()&&(this.unboundedCoords_={left:Math.round(this.frame_.width/2-this.initialSize_/2),top:Math.round(this.frame_.height/2-this.initialSize_/2)},this.adapter_.updateCssVariable(o,this.unboundedCoords_.left+"px"),this.adapter_.updateCssVariable(i,this.unboundedCoords_.top+"px"))},t}(He),Be=function(e){var t=o(!1),s=function(e){var t=e.foundation,a=e.props,s=e.elements,l=e.api,c=K(n(0),2)[1],d=o(a);d.current=a;var u=i((function(){return Object.keys(s).reduce((function(e,t){return e[t]=new Oe((function(){c((function(e){return e+1}))})),e}),{})}),[]),p=i((function(){var e=t($($({},u),{getProps:function(){return d.current},emit:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return De(d.current).apply(void 0,X(e))}}));return l&&Me(d.current.apiRef,l($({foundation:e},u))),e}),[]);return r((function(){var e=p;return e.init(),Me(d.current.foundationRef,e),function(){e.destroy(),Me(d.current.apiRef,null),Me(d.current.foundationRef,null),Object.values(u).map((function(e){return e.destroy()})),d.current={}}}),[p,u]),$({foundation:p},u)}({props:e,elements:{rootEl:!0,surfaceEl:!0},foundation:function(e){var t=e.rootEl,n=e.surfaceEl,o=e.getProps;return new Ve({browserSupportsCssVars:function(){return function(e,t){void 0===t&&(t=!1);var n,o=e.CSS;if("boolean"==typeof xe&&!t)return xe;if(!(o&&"function"==typeof o.supports))return!1;var i=o.supports("--css-vars","yes"),r=o.supports("(--css-vars: yes)")&&o.supports("color","#00000000");return n=i||r,t||(xe=n),n}(window)},isUnbounded:function(){return!!o().unbounded},isSurfaceActive:function(){return!!t.ref&&(e=t.ref,n=":active",(e.matches||e.webkitMatchesSelector||e.msMatchesSelector).call(e,n));var e,n},isSurfaceDisabled:function(){return!!o().disabled},addClass:function(e){n.addClass(e)},removeClass:function(e){n.removeClass(e)},containsEventTarget:function(e){return!!t.ref&&t.ref.contains(e)},registerInteractionHandler:function(e,t){},deregisterInteractionHandler:function(e,t){},registerDocumentInteractionHandler:function(e,t){return document.documentElement.addEventListener(e,t,Te())},deregisterDocumentInteractionHandler:function(e,t){return document.documentElement.removeEventListener(e,t,Te())},registerResizeHandler:function(e){return window.addEventListener("resize",e)},deregisterResizeHandler:function(e){return window.removeEventListener("resize",e)},updateCssVariable:function(e,t){return n.setStyle(e,t)},computeBoundingRect:function(){return t.ref?t.ref.getBoundingClientRect():Se},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}}})}}),l=s.foundation,c=G(s,["foundation"]),d=c.rootEl,u=a((function(e){e.persist(),l.activate(e)}),[l]),p=a((function(e){e.persist(),l.deactivate()}),[l]),h=a((function(t){var n;null===(n=e.onFocus)||void 0===n||n.call(e,t),l.handleFocus()}),[l,e.onFocus]),m=a((function(t){var n;null===(n=e.onBlur)||void 0===n||n.call(e,t),l.handleBlur()}),[l,e.onBlur]),f=a((function(n){var o;null===(o=e.onMouseDown)||void 0===o||o.call(e,n),t.current||u(n),t.current=!1}),[e.onMouseDown,u]),v=a((function(t){var n;null===(n=e.onMouseUp)||void 0===n||n.call(e,t),p(t)}),[e.onMouseUp,p]),g=a((function(n){var o;t.current=!0,null===(o=e.onTouchStart)||void 0===o||o.call(e,n),u(n)}),[e.onTouchStart,u]),y=a((function(t){var n;null===(n=e.onTouchEnd)||void 0===n||n.call(e,t),p(t)}),[e.onTouchEnd,p]),b=a((function(t){var n;null===(n=e.onKeyDown)||void 0===n||n.call(e,t),u(t)}),[e.onKeyDown,u]),E=a((function(t){var n;null===(n=e.onKeyUp)||void 0===n||n.call(e,t),p(t)}),[e.onKeyUp,p]);return d.setProp("onFocus",h,!0),d.setProp("onBlur",m,!0),d.setProp("onMouseDown",f,!0),d.setProp("onMouseUp",v,!0),d.setProp("onTouchStart",g,!0),d.setProp("onTouchEnd",y,!0),d.setProp("onKeyDown",b,!0),d.setProp("onKeyUp",E,!0),r((function(){d.setRef(e.domNode)}),[d,e.domNode]),r((function(){l.setUnbounded(!!e.unbounded)}),[e.unbounded,l]),r((function(){e.disabled&&l.handleBlur()}),[e.disabled,l]),$({},c)},Ue=e.createContext({}),je=(Ne=function(t){var n=t.children,o=t.className,i=t.primary,r=t.accent,a=t.unbounded,s=t.surface,l=(t.domNode,t.foundationRef,G(t,["children","className","primary","accent","unbounded","surface","domNode","foundationRef"])),c=Be(t),d=c.rootEl,u=c.surfaceEl,p=e.Children.only(n);if(!e.isValidElement(p))return null;var h=a?{"data-mdc-ripple-is-unbounded":!0}:{},m=s&&a?{}:u.props({style:p.props.style}),f=x(o!==p.props.className&&o,m.className,p.props.className,{"mdc-ripple-surface":"boolean"==typeof s?s:void 0===s,"mdc-ripple-surface--primary":i,"mdc-ripple-surface--accent":r});l.disabled&&(f=f.replace("mdc-ripple-upgraded--background-focused",""));var v=e.cloneElement(p,$($($({},p.props),h),d.props($($($($({},l),{style:p.props.style}),m),{className:f}))));return e.createElement(Ue.Provider,{value:u.props({style:p.props.style})},v)},function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.state={domNode:null},e}return j(n,t),n.prototype.componentDidMount=function(){this.setState({domNode:O(this)})},n.prototype.componentDidUpdate=function(){var e=O(this);e!==this.state.domNode&&this.setState({rootRippleElement:e})},n.prototype.render=function(){return e.createElement(Ne,$({},this.props,{domNode:this.state.domNode}))},n}(e.Component));
39
- /**
40
- * @license
41
- * Copyright 2016 Google Inc.
42
- *
43
- * Permission is hereby granted, free of charge, to any person obtaining a copy
44
- * of this software and associated documentation files (the "Software"), to deal
45
- * in the Software without restriction, including without limitation the rights
46
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
47
- * copies of the Software, and to permit persons to whom the Software is
48
- * furnished to do so, subject to the following conditions:
49
- *
50
- * The above copyright notice and this permission notice shall be included in
51
- * all copies or substantial portions of the Software.
52
- *
53
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
54
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
55
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
56
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
57
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
58
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
59
- * THE SOFTWARE.
60
- */const $e=({Type:t,Box:{Top:n,Left:o,Right:i,Bottom:r},Probability:a,height:l})=>{const{eventSchema:c}=s(B);let d="top";d=l&&n*l>12||n>.1?"top":1-r-n>.5?"bottom":"top inset";const u={top:"top"===d?-12:"top inset"===d?0:"auto",bottom:"bottom"===d?-12:"auto",left:"top"===d?-2:0};return e.createElement("div",{style:{position:"absolute",top:100*n+"%",left:100*o+"%",bottom:100*(1-r)+"%",right:100*(1-i)+"%",outline:`2px solid ${c.colorsByFoundObjectType.get(t)}`}},e.createElement("div",{style:{color:c.colorsByFoundObjectType.get(t),backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",padding:"0 2px",...u},title:`${t.toLowerCase()} ${Math.floor(100*a)}%`},t.toLowerCase()," ",Math.floor(100*a),"%"))};$e.displayName="FoundObjectBox";const Ge=ie({viewBox:"0 0 24 24",svg:e.createElement(e.Fragment,null,e.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e.createElement("path",{d:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"}))});Ge.displayName="ShareIcon";class We{constructor(e){this.isDownloading=!1,this.update(e)}get isTimelapse(){return this.type.startsWith("Timelaps")}update(e){this.raw=e,this.id=e.id,this.startTime=new Date(e.startTime),this.endTime=new Date(e.endTime),this.type=e.recordType,this.duration=e.duration,this.cameraId=e.cameraId,this.name=e.name||e.tagName,this.description=e.description,this.clipUrl=e.clipUrl,this.version=e.version}}W([p],We.prototype,"name",void 0),W([p],We.prototype,"clipUrl",void 0),W([p],We.prototype,"isDownloading",void 0);let qe=class extends e.Component{constructor(t){super(t),this.containerRef=e.createRef(),this.thumbnail=null,this.thumbnailRequests=new C,this.onDragStart=e=>{e.dataTransfer&&(e.dataTransfer.setData("x-3deye/event",""+this.props.data.id),e.dataTransfer.dropEffect="move")},this.onClick=()=>{this.props.onClick(this.props.data)},this.share=e=>{var t,n;e.stopPropagation();const{cameraId:o}=this.props.data;let{startTime:i,endTime:r}=this.props.data;+r-+i<5e3&&(i=new Date(+i-5e3),r=new Date(+r+5e3)),null===(t=this.clipSharingStore)||void 0===t||t.openModalWithSelectedClip(new We({cameraId:o,startTime:i,endTime:r,name:null===(n=this.camerasStore.camerasById.get(o))||void 0===n?void 0:n.name}))},this.thumbnailSubscription=this.thumbnailRequests.pipe(I(e=>e?this.context.thumbnails.fetchThumbnail(e[0],e[1],e[2]):w())).subscribe(e=>{this.thumbnail=e||null})}get camerasStore(){return this.context.cameras}get eventSchema(){return this.context.eventSchema}get clipSharingStore(){return"clipSharing"in this.context?this.context.clipSharing:null}componentDidMount(){this.containerRef.current.addEventListener("dragstart",this.onDragStart);const{cameraId:e,startTime:t,thumbnailUrl:n}=this.props.data;n||this.thumbnailRequests.next([e,t,t])}componentDidUpdate(e){if(e.data.id===this.props.data.id)return;const{cameraId:t,startTime:n,thumbnailUrl:o}=this.props.data;o?this.thumbnailRequests.next(null):(this.thumbnail=null,this.thumbnailRequests.next([t,n,n]))}componentWillUnmount(){this.thumbnailRequests.unsubscribe(),this.thumbnailSubscription.unsubscribe(),this.containerRef.current.removeEventListener("dragstart",this.onDragStart)}render(){var t,n;const{camerasStore:o,eventSchema:i}=this,{data:r,hideCameraName:a,height:s}=this.props,{account:c}=this.context,d=this.clipSharingStore&&c.camerasPermissions.has(r.cameraId)&&c.camerasPermissions.get(r.cameraId).includes("Share");if(!r)return null;let u=null;r.foundObjects.length&&(u=r.foundObjects.filter(({Type:e})=>i.foundObjectTypes.includes(e)).map((t,n)=>e.createElement($e,Object.assign({key:n},t,{height:s}))));let p="",h=!1;if(r.thumbnailUrl?p=r.thumbnailUrl:null===this.thumbnail&&o.loaded?(p=(null===(t=o.camerasById.get(r.cameraId))||void 0===t?void 0:t.imageUrl)||"",h=!0):this.thumbnail&&(p=this.thumbnail.url),r.faces){const{Width:t,Height:n}=JSON.parse(this.props.data.raw.data).ThumbnailSize;u||(u=[]);const o=100,i=u.length;u=u.concat(r.faces.map(({Name:r,Box:{Top:a,Left:s,Right:c,Bottom:d},Probability:u},h)=>{const m=o/t/(c-s),f={top:2},v={};return s>=1-c?(f.left=2,v.right=-2):(f.right=2,v.left=-2),a>=1-d?v.bottom="calc(100% + 1px)":v.top="calc(100% + 1px)",e.createElement(l,{key:i+h},e.createElement("div",{className:"event-list-item-face-trigger",style:{position:"absolute",top:100*a+"%",left:100*s+"%",bottom:100*(1-d)+"%",right:100*(1-c)+"%",outline:"1px solid orange"}},e.createElement("div",{style:{color:"orange",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",...v},title:`${r} ${Math.floor(100*u)}%`},r," ",Math.floor(100*u),"%")),e.createElement("div",{className:"event-list-item-face",style:{overflow:"hidden",width:t*(c-s)*m,height:n*(d-a)*m,...f}},e.createElement("img",{style:{width:t*m,height:n*m,transform:`translate(-${100*s}%, -${100*a}%)`},src:p}),e.createElement("div",{className:"frame"},e.createElement("div",{className:"corner-highlight-tl"}),e.createElement("div",{className:"corner-highlight-tr"}),e.createElement("div",{className:"corner-highlight-br"}),e.createElement("div",{className:"corner-highlight-bl"}))))}))}const m=o.loaded&&(null===(n=o.camerasById.get(r.cameraId))||void 0===n?void 0:n.name)||"...";return e.createElement(je,null,e.createElement("div",{ref:this.containerRef,className:"event-list-item",onClick:this.onClick,draggable:!0},p&&e.createElement("img",{key:p,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:p}),h?e.createElement("div",{className:"no-preview-overlay"}):null,u,d&&e.createElement(ne,{onClick:this.share,onMouseDown:e=>e.stopPropagation(),className:"x-3deye-button--icon",style:{position:"absolute",top:10,right:10}},e.createElement(Ge,null)),e.createElement("div",{className:"event-list-item-caption"},a?null:e.createElement("div",{title:m,style:{fontWeight:"bold",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textShadow:"0 1px 2px black"}},m),e.createElement("div",null,function(e,t){let n="",o="";return E(e,new Date)?_(e,new Date)?n=o="HH:mm":_(e,t)?(n="EEE d MMM HH:mm",o="HH:mm"):n=o="EEE d MMM HH:mm":E(e,t)?(n="yyyy d MMM HH:mm",o="d MMM HH:mm"):n=o="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(n+=":ss",o+=":ss"),+e==+t?`${J(e,n)}`:`${J(e,n)} - ${J(t,o)}`}(r.startTime,r.endTime)),+r.endTime-+r.startTime>0&&e.createElement("div",{className:"event-list-item-duration"},function(e){if((e=Math.round(e/1e3))<60)return`${e}s`;const t=e%60;let n=(e-t)/60;if(n<60)return t?`${n}m ${t}s`:`${n}m`;const o=Math.floor(n/60);return n-=60*o,t||n?!t&&n?`${o}h ${n}m`:`${o}h ${n}m ${t}s`:`${o}h`}(+r.endTime-+r.startTime)))))}};qe.contextType=B,W([p],qe.prototype,"thumbnail",void 0),qe=W([f],qe);var Ke=qe;let Xe=class extends e.Component{constructor(){super(...arguments),this.disposables=[],this.listRef=e.createRef(),this.updates=-1,this.scrolls=new C,this.lastScrollEventTimestamp=0,this.rowRenderer=({index:t,style:n})=>e.createElement("div",{style:n},e.createElement(Ke,{data:this.eventListStore.data[t],height:n.height,width:n.width,onClick:this.props.onItemClick})),this.onScroll=({scrollOffset:e})=>{this.scrollTop=e,this.lastScrollEventTimestamp=Date.now(),this.scrolls.next(e),this.eventListStore.paused=!!this.scrollTop}}get eventListStore(){return"eventList"in this.context?this.context.eventList:null}componentDidMount(){const e=this.eventListStore;this.disposables.push(this.scrolls.pipe(F(200)).subscribe(t=>{if(!e.pendingData.length)return;const n=Math.floor(t/this.getRowHeightByWidth(this.width)),o=e.data[n].startTime;this.updates=e.pendingData.filter(e=>e.startTime>o).length,e.flushUpdates()})),v(this,u(()=>e.pendingData,t=>{if(!t.length)return;if(Date.now()-this.lastScrollEventTimestamp<200)return;const n=Math.floor(this.scrollTop/this.getRowHeightByWidth(this.width)),o=e.data[n].startTime;this.updates=t.filter(e=>e.startTime>o).length,e.flushUpdates()}))}componentWillUnmount(){this.disposables.forEach(e=>{e instanceof T?e.closed||e.unsubscribe():e()})}componentDidUpdate(){0!==this.scrollTop&&this.listRef.current&&(this.updates>0?(this.listRef.current.scrollTo(this.scrollTop+this.updates*this.getRowHeightByWidth(this.width)),this.updates=-1):this.updates&&this.listRef.current.scrollTo(0))}getRowHeightByWidth(e){return e/16*9+2}render(){const{data:t,loading:n}=this.eventListStore;return n?e.createElement("div",{className:"preloader-container"},e.createElement(ye,null)):e.createElement(k,null,({width:n,height:o})=>(this.width=n,e.createElement(P,{ref:this.listRef,width:n,height:o,itemCount:t.length,itemSize:this.getRowHeightByWidth(n),onScroll:this.onScroll},this.rowRenderer)))}};Xe.contextType=B,Xe=W([f],Xe);var Ye=Xe;var Ze,Je=(Ze=8,{container:e=>({...e,padding:Ze}),control:(e,t)=>({...e,borderRadius:8,backgroundColor:t.isFocused?"white":"rgba(0, 0, 0, 0.5)",border:"none",boxShadow:null,"&:hover":{borderColor:null}}),menu:e=>({...e,borderRadius:"0 0 4px 4px",marginTop:0,marginLeft:-Ze,marginRight:Ze}),option:e=>({...e,color:"black"}),multiValueRemove:e=>({...e,color:"black"})});const Qe=ie({viewBox:"0 0 24 24",svg:e.createElement("g",null,e.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e.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"}))});Qe.displayName="LabelIcon";const et=ie({viewBox:"0 0 24 24",svg:e.createElement("g",null,e.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e.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"}))});et.displayName="CameraIcon";const tt=ie({viewBox:"0 0 24 24",svg:e.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"})});tt.displayName="LuggageIcon";const nt=ie({viewBox:"0 0 24 24",svg:e.createElement(e.Fragment,null,e.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e.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"}))});nt.displayName="CarIcon";const ot=ie({viewBox:"0 0 24 24",svg:e.createElement(e.Fragment,null,e.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e.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"}))});ot.displayName="BoatIcon";const it=ie({viewBox:"0 0 24 24",svg:e.createElement(e.Fragment,null,e.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"}))});it.displayName="BicycleIcon";const rt=ie({viewBox:"0 0 24 24",svg:e.createElement("g",null,e.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e.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"}))});rt.displayName="DirectionsWalkIcon";const at=ie({viewBox:"0 0 24 24",svg:e.createElement(e.Fragment,null,e.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),e.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),e.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),e.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),e.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 st=({data:t})=>t.isEventType?"Luggage"===t.id?e.createElement(tt,{size:16}):"Car"===t.id?e.createElement(nt,{size:16}):"Person"===t.id?e.createElement(rt,{size:16}):"Bicycle"===t.id?e.createElement(it,{size:16}):"Boat"===t.id?e.createElement(ot,{size:16}):"Animal"===t.id?e.createElement(at,{size:16}):e.createElement(Qe,{size:16}):e.createElement(et,{size:16}),lt=t=>{const{children:n,innerProps:o,...i}=t,{Option:r}=V,{data:a}=t;if(!a.isEventType)return e.createElement(r,Object.assign({},t));const s={...o,style:{display:"inline-flex",alignItems:"center",width:"auto"}};return e.createElement(r,Object.assign({innerProps:s},i),e.createElement(st,{data:a}),e.createElement("div",{style:{marginLeft:4}},n))},ct=t=>{const{children:n,innerProps:o,...i}=t,{MultiValueLabel:r}=V,{data:a}=t,s={...o,style:{display:"flex",alignItems:"center"}};return e.createElement(r,Object.assign({innerProps:s},i),e.createElement(st,{data:a}),e.createElement("div",{style:{marginLeft:4}},n))},dt=ie({viewBox:"0 0 24 24",svg:e.createElement(e.Fragment,null,e.createElement("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),e.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});dt.displayName="FilterListIcon";const ut={...Je,multiValue:(e,{data:t})=>t.color?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>t.color?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>t.color?{...e,color:"white"}:e,option:(e,{data:t})=>t.color?{...e,color:t.color}:e},pt=t=>{const{children:n,...o}=t;return e.createElement(V.Placeholder,Object.assign({},o),e.createElement(dt,{size:16,style:{position:"relative",top:4}})," ",n)};let ht=class extends e.Component{constructor(){super(...arguments),this.onSelectChange=e=>{this.eventListStore.setFilters(e)}}get camerasStore(){return this.context.cameras}get eventSchema(){return"eventSchema"in this.context?this.context.eventSchema:null}get eventListStore(){return"eventList"in this.context?this.context.eventList:null}get options(){const{camerasStore:e,eventSchema:t,eventListStore:n}=this;if(!t)return[];const o=n.onlyFaces?[]:t.foundObjectTypesForSelect;return e.loaded?[].concat(o,e.data.slice()):o}render(){const{filters:t}=this.eventListStore;return e.createElement(z,{closeMenuOnSelect:!1,isMulti:!0,onChange:this.onSelectChange,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:this.options,placeholder:Z.t("filter"),value:t,components:{MultiValueLabel:ct,Option:lt,Placeholder:pt},styles:ut})}};ht.contextType=B,W([p.ref],ht.prototype,"context",void 0),W([m],ht.prototype,"options",null),ht=W([f],ht);var mt=ht;let ft=class extends e.Component{constructor(){super(...arguments),this.value=[],this.onSelectChange=e=>{this.eventListStore.setFilters(e)},this.onFromChange=e=>{this.eventListStore.from=e},this.onToChange=e=>{this.eventListStore.to=e},this.clearTo=()=>{this.eventListStore.to=null},this.closeDatepickerTo=()=>{this.datepickerToOpened=!1},this.closeDatepickerFrom=()=>{this.datepickerFromOpened=!1},this.toggleDatepickerTo=()=>{this.datepickerToOpened=!this.datepickerToOpened},this.toggleDatepickerFrom=()=>{this.datepickerFromOpened=!this.datepickerFromOpened}}get eventListStore(){return"eventList"in this.context?this.context.eventList:null}render(){const{eventListStore:t}=this,{from:n,to:o,onlyFaces:i}=t,{onEventClick:r}=this.props,a=e.createElement(ne,{className:"date-button",style:{flex:1,textAlign:"left"},onClick:this.toggleDatepickerFrom},n?J(n,"MMM d, HH:mm"):""),s=o?e.createElement("div",{style:{flex:1,display:"flex"}},e.createElement(ne,{className:"date-button",style:{flex:1,textAlign:"right"},onClick:this.toggleDatepickerTo},J(o,"MMM d, HH:mm")),e.createElement(ne,{onClick:this.clearTo},e.createElement(ae,{size:16}))):e.createElement("div",{style:{flex:1,display:"flex"}},e.createElement(ne,{className:"date-button",style:{flex:1,textAlign:"right"},onClick:this.toggleDatepickerTo},"now"));return e.createElement(e.Fragment,null,e.createElement("div",{style:{color:"black",zIndex:3}},e.createElement(mt,null)),e.createElement("div",{className:"events-panel-datepicker"},e.createElement("div",{style:{position:"relative"}},e.createElement(fe,{target:a,opened:this.datepickerFromOpened,onCloseRequest:this.closeDatepickerFrom,disableAnimation:!0,className:"popover-datepicker"},e.createElement(g,{selected:n,onChange:this.onFromChange,showTimeSelect:!0,dateFormat:"MMM d, HH:mm",timeFormat:"HH:mm",inline:!0}),e.createElement(ne,{onClick:this.closeDatepickerFrom,className:"x-3deye-button--save"},"Ok"))),e.createElement("div",{style:{position:"relative"}},e.createElement(fe,{target:s,opened:this.datepickerToOpened,onCloseRequest:this.closeDatepickerTo,disableAnimation:!0,className:"popover-datepicker"},e.createElement(g,{selected:o||new Date,onChange:this.onToChange,showTimeSelect:!0,dateFormat:"MMM d, HH:mm",timeFormat:"HH:mm",inline:!0}),e.createElement(ne,{onClick:this.closeDatepickerTo,className:"x-3deye-button--save"},"Ok")))),(t.someAnalyticsFilterSelected||t.onlyFaces)&&e.createElement(ge,{getter:i?t.getFacesProbabilityTreshold:t.getProbabilityTreshold,setter:i?t.setFacesProbabilityTreshold:t.setProbabilityTreshold}),!i&&t.someAnalyticsFilterSelected?e.createElement(ce,{value:t.colors,toggle:t.toggleColor,clear:t.clearColors}):null,e.createElement("div",{style:{display:"flex",flex:1}},e.createElement(Ye,{onItemClick:r})),e.createElement(oe,null,e.createElement(ne,{className:i?"button-unselected":"button-selected",onClick:t.toggleFaces},"ALL ",t.totalCount?e.createElement("sup",null,t.totalCount):null),e.createElement(ne,{className:i?"button-selected":"button-unselected",onClick:t.toggleFaces},"Faces ",t.facesCount?e.createElement("sup",null,t.facesCount):null)))}};ft.contextType=B,W([p],ft.prototype,"datepickerToOpened",void 0),W([p],ft.prototype,"datepickerFromOpened",void 0),W([p.ref],ft.prototype,"value",void 0),W([p],ft.prototype,"from",void 0),W([h],ft.prototype,"onFromChange",void 0),W([h],ft.prototype,"onToChange",void 0),W([h],ft.prototype,"clearTo",void 0),W([h],ft.prototype,"closeDatepickerTo",void 0),W([h],ft.prototype,"closeDatepickerFrom",void 0),W([h],ft.prototype,"toggleDatepickerTo",void 0),W([h],ft.prototype,"toggleDatepickerFrom",void 0),ft=W([f],ft);var vt=ft;const gt=({onEventClick:t})=>{var n;const o=null!==(n=s(c))&&void 0!==n?n:d;return e.createElement(B.Provider,{value:o},e.createElement(vt,{onEventClick:t}))};gt.displayName="EventList";export default gt;
1
+ import*as e from"react";import t,{useContext as r,useEffect as i,createContext as n,useState as o,useImperativeHandle as a,useRef as l,useLayoutEffect as s,useCallback as c,Fragment as d}from"react";import{AppContext as u,app as h}from"@3deye-toolkit/core";import{observer as m,Observer as p,useLocalObservable as b}from"mobx-react-lite";import f from"react-ink";import{makeObservable as v,observable as g,makeAutoObservable as y,runInAction as w,action as E,reaction as C,computed as P,when as O}from"mobx";import{format as j,isSameYear as T,isSameDay as x,subHours as M,startOfHour as S}from"date-fns/esm";import L from"i18next";import{fromEvent as N,from as I,Subject as D,Subscription as k,Observable as _,of as F,throwError as H,EMPTY as z}from"rxjs";import R from"clsx";import{map as A,share as V,debounceTime as U,startWith as $,switchMap as B,bufferCount as W,mergeMap as q,sequenceEqual as G,filter as J,catchError as Z,mapTo as K,concatMap as Y}from"rxjs/operators";import X from"@reach/tooltip";import Q from"react-dom";import{FixedSizeGrid as ee}from"react-window";import te from"react-virtualized-auto-sizer";import re from"react-window-infinite-loader";import ie from"@seznam/compose-react-refs";import ne from"material-colors";import{MDCSlider as oe}from"@material/slider";import ae from"resize-observer-polyfill";import{useSpring as le,animated as se}from"@react-spring/web";import ce from"react-datepicker";import de,{components as ue}from"react-select";import{subHours as he}from"date-fns";const me=t.createContext(null);class pe{constructor(e){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chunks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clipUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isDownloading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"archives",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),v(this,{name:g,clipUrl:g,isDownloading:g}),this.update(e)}get isTimelapse(){return this.type.startsWith("Timelaps")}update(e){this.raw=e,this.id=e.id,this.startTime=new Date(e.startTime),this.endTime=new Date(e.endTime),this.type=e.recordType,this.duration=e.duration,this.cameraId=e.cameraId,this.name=e.name||e.tagName,this.description=e.description,this.clipUrl=e.clipUrl,this.version=e.version}}function be(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}const fe=new Map,ve=L.createInstance();function ge(e,t){const r=fe.get(ve.language);return j(e,t,{locale:r})}function ye(e){return r=>{const{size:i=24,color:n="currentColor",className:o,...a}=r,l=e.viewBox||"0 0 24 24",s=e.svg;return t.createElement("svg",{preserveAspectRatio:"xMinYMin",className:`icon ${o}`,width:i,fill:n,viewBox:l,height:i,...a},s)}}const we=ye({viewBox:"0 0 24 24",svg:t.createElement("g",null,t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.createElement("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}))});we.displayName="MoreVertIcon";const Ee=({Type:e,Box:{Top:i,Left:n,Right:o,Bottom:a},Probability:l,height:s})=>{const{eventSchema:c}=r(me);let d="top";d=s&&i*s>12||i>.1?"top":1-a-i>.5?"bottom":"top inset";const u={top:"top"===d?-12:"top inset"===d?0:"auto",bottom:"bottom"===d?-12:"auto",left:"top"===d?-2:0};return t.createElement("div",{style:{position:"absolute",top:100*i+"%",left:100*n+"%",bottom:100*(1-a)+"%",right:100*(1-o)+"%",outline:`2px solid ${c.colorsByFoundObjectType.get(e)}`}},t.createElement("div",{style:{color:c.colorsByFoundObjectType.get(e),backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",padding:"0 2px",...u},title:`${e.toLowerCase()} ${Math.floor(100*l)}%`},e.toLowerCase()," ",Math.floor(100*l),"%"))};Ee.displayName="FoundObjectBox";const Ce=/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Pe=N(document,"keydown").pipe(A((function({target:e,code:t,shiftKey:r,metaKey:i,ctrlKey:n,altKey:o}){var a;if(/^(input|select|textarea)$/i.test(e.tagName))return;const l=[];if("Space"===t&&"button"===(null===(a=document.activeElement)||void 0===a?void 0:a.tagName.toLowerCase()))return;t.startsWith("Key")&&(t=t.substr(3).toLowerCase());Ce&&i&&l.push("CtrlCmd");!Ce&&n&&l.push("CtrlCmd");o&&l.push("Alt");r&&l.push("Shift");return l.push(t),l.join("+")})),V());function Oe(e,t,r=!0){i((()=>{if(!r)return;const i=t=>{t.key===e&&t.preventDefault()};"ArrowUp"!==e&&"ArrowDown"!==e||document.addEventListener("keydown",i);const n=e.split(" "),o=Pe.pipe(U(1e3),$(null),B((()=>Pe.pipe(W(n.length,1)))),q((e=>I(e).pipe(G(I(n)),J(Boolean))))).subscribe(t);return()=>{o.unsubscribe(),"ArrowUp"!==e&&"ArrowDown"!==e||document.removeEventListener("keydown",i)}}),[r])}const je={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},Te=({label:e,children:r})=>t.createElement(X,{label:e,style:je},r);Te.displayName="Tooltip";class xe extends t.Component{render(){const{forwardedRef:e,children:r,className:i,fullwidth:n,type:o,title:a,...l}=this.props,s=R(i,"x-3deye-button",{fullwidth:n}),c=t.createElement("button",{ref:e,className:s,type:o||"button",...l},r,l.disabled?null:t.createElement(f,null));return a?t.createElement(Te,{label:a},c):c}}const Me=t.forwardRef(((e,r)=>t.createElement(xe,{forwardedRef:r,...e}))),Se=document.body;class Le extends t.Component{constructor(e){super(e),Object.defineProperty(this,"el",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.el=document.createElement("div")}componentDidMount(){Se.appendChild(this.el)}componentWillUnmount(){Se.removeChild(this.el)}render(){return Q.createPortal(this.props.children,this.el)}}class Ne{constructor(){Object.defineProperty(this,"opened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"top",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"left",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bottom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"right",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"buttonRef",{enumerable:!0,configurable:!0,writable:!0,value:t.createRef()}),Object.defineProperty(this,"requestedPlacement",{enumerable:!0,configurable:!0,writable:!0,value:"bottom-end"}),Object.defineProperty(this,"placement",{enumerable:!0,configurable:!0,writable:!0,value:"bottom-end"}),Object.defineProperty(this,"targetPosition",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,left:0,width:0,height:0}}),Object.defineProperty(this,"toggleMenu",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.opened=!this.opened}}),Object.defineProperty(this,"toggleAt",{enumerable:!0,configurable:!0,writable:!0,value:({top:e,left:t})=>{this.setTargetPosition({top:e,left:t,width:0,height:0}),this.placement="bottom-start",this.opened=!this.opened}}),Object.defineProperty(this,"setRequestedPlacement",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.requestedPlacement=e}}),Object.defineProperty(this,"resetPlacement",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.placement=this.requestedPlacement}}),y(this)}setTargetPosition({top:e,left:t,width:r,height:i}){this.targetPosition={top:e,left:t,width:r,height:i}}}const Ie=n(null),De=()=>{const e=r(Ie);if(!e)throw new Error("MenuContext is not defined");return e},ke=m((({children:e,placement:r="bottom-end"},n)=>{const[l]=o((()=>new Ne));return a(n,(()=>l)),i((()=>{l.requestedPlacement=r}),[r]),t.createElement(Ie.Provider,{value:l},e)}),{forwardRef:!0});ke.displayName="Menu";const _e=m((({children:e,className:r,...n})=>{const o=De(),a=l(null);return i((()=>{if(!o.opened)return;const e=e=>{const t=e.target;a.current&&(a.current.contains(t)||o.buttonRef.current.contains(t)||o.toggleMenu())};return document.addEventListener("mousedown",e,!0),()=>document.removeEventListener("mousedown",e)}),[o.opened]),Oe("ArrowUp",(()=>{var e;const t=Array.from(a.current.querySelectorAll(".menu-item"));if(!t.length)return;const r=document.activeElement;if(!(null===(e=a.current)||void 0===e?void 0:e.contains(r)))return void t[0].focus();if(1===t.length)return;const i=t.findIndex((e=>e.contains(r)));t[(i+t.length-1)%t.length].focus()}),o.opened),Oe("ArrowDown",(()=>{var e;const t=Array.from(a.current.querySelectorAll(".menu-item"));if(!t.length)return;const r=document.activeElement;if(!(null===(e=a.current)||void 0===e?void 0:e.contains(r)))return void t[0].focus();if(1===t.length)return;const i=t.findIndex((e=>e.contains(r)));t[(i+1)%t.length].focus()}),o.opened),Oe("Escape",o.toggleMenu,o.opened),s((()=>{if(o.opened){if(!a.current)return;const{offsetWidth:e,offsetHeight:t}=a.current,r=o.targetPosition.left,i=o.targetPosition.top,n=o.targetPosition.width,l=o.targetPosition.height,s=window.innerHeight,c=window.innerWidth;let d,u=r+n-e,h=i+l,m=o.placement;"bottom-start"===m?(u=r,h=i,u+e>c&&(u-=e,m="bottom-end"),h+t>s&&(h-=t,m=m.endsWith("start")?"top-start":"top-end")):"bottom-end"===m?(i+l+t>s&&(h=void 0,d=s-i+4,m="top-end"),r-e<0&&(u=r,m=m.startsWith("top")?"top-start":"bottom-start")):"top"===m&&(u=r+(n-e)/2,h=i-t,m="top"),a.current.dataset.placement=m,a.current.style.top=h?`${h}px`:void 0,a.current.style.bottom=d?`${d}px`:void 0,a.current.style.left=u?`${u}px`:void 0}}),[o.opened]),o.opened?t.createElement(Le,null,t.createElement("div",{ref:a,onClick:e=>{e.stopPropagation()},className:R("menu-items-container",r),...n},e)):null}));_e.displayName="MenuList";const Fe=({children:e,style:r,className:i,noClose:n,action:o})=>{const a=De();return t.createElement(Me,{onClick:e=>{e.stopPropagation(),null==o||o(),n||a.toggleMenu()},className:R("menu-item",i),style:r},e)};Fe.displayName="MenuItem";const He=({className:e,children:r,...i})=>{const n=De(),o=c((e=>{if(e.stopPropagation(),!n.opened){const e=n.buttonRef.current;n.setTargetPosition(e.getBoundingClientRect()),n.resetPlacement()}n.toggleMenu()}),[]);return t.createElement(Me,{ref:n.buttonRef,className:R("menu-button",e),onClick:o,...i},r)};He.displayName="MenuButton";const ze=m((({data:e,width:n,hideCameraName:a,height:s,onClick:c})=>{var u,h,m,p;const b=l(null),v=l(null),[g,y]=o(null),w=r(me),{cameras:E,eventSchema:C,thumbnails:P}=w;i((()=>{if(e.thumbnailUrl)return void y(null);const t=P.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{y(e||null)}));return()=>t.unsubscribe()}),[e.id]);const O="clipSharing"in w&&!!(4&(null!==(h=null===(u=E.camerasById.get(e.cameraId))||void 0===u?void 0:u.permissions)&&void 0!==h?h:0));let j=null;e.detectedObjects.length&&(j=e.detectedObjects.filter((({Type:e})=>C.foundObjectTypes.includes(e))).map(((e,r)=>t.createElement(Ee,{key:r,...e,height:s}))));let M="",S=!1;if(e.thumbnailUrl?M=e.thumbnailUrl:null===g&&E.loaded?(M=(null===(m=E.camerasById.get(e.cameraId))||void 0===m?void 0:m.imageUrl)||"",S=!0):g&&(M=g.url),e.faces){const{Width:r,Height:i}=JSON.parse(e.raw.data).ThumbnailSize;j||(j=[]);const n=100,o=j.length;j=j.concat(e.faces.map((({Name:e,Box:{Top:a,Left:l,Right:s,Bottom:c},Probability:u},h)=>{const m=n/r/(s-l),p={top:2},b={};return l>=1-s?(p.left=2,b.right=-2):(p.right=2,b.left=-2),a>=1-c?b.bottom="calc(100% + 1px)":b.top="calc(100% + 1px)",t.createElement(d,{key:o+h},t.createElement("div",{className:"event-list-item-face-trigger",style:{position:"absolute",top:100*a+"%",left:100*l+"%",bottom:100*(1-c)+"%",right:100*(1-s)+"%",outline:"1px solid orange"}},t.createElement("div",{style:{color:"orange",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",...b},title:`${e} ${Math.floor(100*u)}%`},e," ",Math.floor(100*u),"%")),t.createElement("div",{className:"event-list-item-face",style:{overflow:"hidden",width:r*(s-l)*m,height:i*(c-a)*m,...p}},t.createElement("img",{style:{width:r*m,height:i*m,transform:`translate(-${100*l}%, -${100*a}%)`},src:M}),t.createElement("div",{className:"frame"},t.createElement("div",{className:"corner-highlight-tl"}),t.createElement("div",{className:"corner-highlight-tr"}),t.createElement("div",{className:"corner-highlight-br"}),t.createElement("div",{className:"corner-highlight-bl"}))))})))}const L=E.loaded&&(null===(p=E.camerasById.get(e.cameraId))||void 0===p?void 0:p.name)||"...";return t.createElement("div",{onDragStart:t=>{if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",""+e.id),t.dataTransfer.dropEffect="move";const r=v.current;if(r){const{x:e,y:i}=r.getBoundingClientRect();t.dataTransfer.setDragImage(r,t.clientX-e,t.clientY-i)}},className:"event-list-item",onClick:()=>c(e),onContextMenu:e=>{var t;e.preventDefault(),null===(t=b.current)||void 0===t||t.toggleAt({top:e.clientY,left:e.clientX})},draggable:!0},M&&t.createElement("img",{key:M,ref:v,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:M}),t.createElement(f,{radius:n}),S?t.createElement("div",{className:"no-preview-overlay"}):null,e.acknowledged?t.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,j,t.createElement(ke,{ref:b},t.createElement(He,{className:"x-3deye-button--icon"},t.createElement(we,null)),t.createElement(_e,null,O&&t.createElement(Fe,{action:()=>{var t;const{cameraId:r}=e;let{startTime:i,endTime:n}=e;+n-+i<5e3&&(i=new Date(+i-5e3),n=new Date(+n+5e3));const o="clipSharing"in w?w.clipSharing:void 0;null==o||o.openModalWithSelectedClip(new pe({cameraId:r,startTime:i,endTime:n,name:null===(t=E.camerasById.get(r))||void 0===t?void 0:t.name}))}},"Share"),t.createElement(Fe,{action:()=>{be(e.id.toString())}},"Copy ID to clipboard"),t.createElement(Fe,{action:()=>{be(e.cameraId.toString())}},"Copy camera ID to clipboard"))),t.createElement("div",{className:"event-list-item-caption"},t.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",i="";return T(e,new Date)?x(e,new Date)?r=i="HH:mm":x(e,t)?(r="EEE d MMM HH:mm",i="HH:mm"):r=i="EEE d MMM HH:mm":T(e,t)?(r="yyyy d MMM HH:mm",i="d MMM HH:mm"):r=i="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",i+=":ss"),+e==+t?`${ge(e,r)}`:`${ge(e,r)} - ${ge(t,i)}`}(e.startTime,e.endTime)),a?null:t.createElement("div",{className:"event-list-item__camera-name",title:L},L),+e.endTime-+e.startTime>0&&t.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,i=t?`${r}`:`${r}`.padStart(2,"0");let n=(e-r)/60;if(n<60)return!r&&t?`${n}m`:`${n}m ${i}s`;const o=Math.floor(n/60);if(n-=60*o,!r&&!n&&t)return`${o}h`;const a=t?`${n}`:`${n}`.padStart(2,"0");return!r&&n&&t?`${o}h ${a}m`:`${o}h ${a}m ${i}s`}(+e.endTime-+e.startTime))))}));ze.displayName="EventListItem";var Re="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ae="object"==typeof Re&&Re&&Re.Object===Object&&Re,Ve="object"==typeof self&&self&&self.Object===Object&&self,Ue=Ae||Ve||Function("return this")(),$e=Ue.Symbol,Be=Object.prototype,We=Be.hasOwnProperty,qe=Be.toString,Ge=$e?$e.toStringTag:void 0;var Je=function(e){var t=We.call(e,Ge),r=e[Ge];try{e[Ge]=void 0;var i=!0}catch(e){}var n=qe.call(e);return i&&(t?e[Ge]=r:delete e[Ge]),n},Ze=Object.prototype.toString;var Ke=function(e){return Ze.call(e)},Ye=$e?$e.toStringTag:void 0;var Xe=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ye&&Ye in Object(e)?Je(e):Ke(e)};var Qe=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var et,tt=function(e){if(!Qe(e))return!1;var t=Xe(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},rt=Ue["__core-js_shared__"],it=(et=/[^.]+$/.exec(rt&&rt.keys&&rt.keys.IE_PROTO||""))?"Symbol(src)_1."+et:"";var nt=function(e){return!!it&&it in e},ot=Function.prototype.toString;var at=function(e){if(null!=e){try{return ot.call(e)}catch(e){}try{return e+""}catch(e){}}return""},lt=/^\[object .+?Constructor\]$/,st=Function.prototype,ct=Object.prototype,dt=st.toString,ut=ct.hasOwnProperty,ht=RegExp("^"+dt.call(ut).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var mt=function(e){return!(!Qe(e)||nt(e))&&(tt(e)?ht:lt).test(at(e))};var pt=function(e,t){return null==e?void 0:e[t]};var bt=function(e,t){var r=pt(e,t);return mt(r)?r:void 0},ft=bt(Object,"create");var vt=function(){this.__data__=ft?ft(null):{},this.size=0};var gt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},yt=Object.prototype.hasOwnProperty;var wt=function(e){var t=this.__data__;if(ft){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return yt.call(t,e)?t[e]:void 0},Et=Object.prototype.hasOwnProperty;var Ct=function(e){var t=this.__data__;return ft?void 0!==t[e]:Et.call(t,e)};var Pt=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ft&&void 0===t?"__lodash_hash_undefined__":t,this};function Ot(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Ot.prototype.clear=vt,Ot.prototype.delete=gt,Ot.prototype.get=wt,Ot.prototype.has=Ct,Ot.prototype.set=Pt;var jt=Ot;var Tt=function(){this.__data__=[],this.size=0};var xt=function(e,t){return e===t||e!=e&&t!=t};var Mt=function(e,t){for(var r=e.length;r--;)if(xt(e[r][0],t))return r;return-1},St=Array.prototype.splice;var Lt=function(e){var t=this.__data__,r=Mt(t,e);return!(r<0)&&(r==t.length-1?t.pop():St.call(t,r,1),--this.size,!0)};var Nt=function(e){var t=this.__data__,r=Mt(t,e);return r<0?void 0:t[r][1]};var It=function(e){return Mt(this.__data__,e)>-1};var Dt=function(e,t){var r=this.__data__,i=Mt(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this};function kt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}kt.prototype.clear=Tt,kt.prototype.delete=Lt,kt.prototype.get=Nt,kt.prototype.has=It,kt.prototype.set=Dt;var _t=kt,Ft=bt(Ue,"Map");var Ht=function(){this.size=0,this.__data__={hash:new jt,map:new(Ft||_t),string:new jt}};var zt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Rt=function(e,t){var r=e.__data__;return zt(t)?r["string"==typeof t?"string":"hash"]:r.map};var At=function(e){var t=Rt(this,e).delete(e);return this.size-=t?1:0,t};var Vt=function(e){return Rt(this,e).get(e)};var Ut=function(e){return Rt(this,e).has(e)};var $t=function(e,t){var r=Rt(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this};function Bt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Bt.prototype.clear=Ht,Bt.prototype.delete=At,Bt.prototype.get=Vt,Bt.prototype.has=Ut,Bt.prototype.set=$t;var Wt=Bt;function qt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var a=e.apply(this,i);return r.cache=o.set(n,a)||o,a};return r.cache=new(qt.Cache||Wt),r}qt.Cache=Wt;const Gt=qt((()=>{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})),Jt=({size:e=48})=>t.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},t.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),t.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)"},t.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));Jt.displayName="Preloader";class Zt extends t.Component{constructor(e){super(e),Object.defineProperty(this,"scrollState",{enumerable:!0,configurable:!0,writable:!0,value:{rowIndex:0,columnIndex:0}}),Object.defineProperty(this,"scrollTop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"columnCount",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"rowHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastScrollEventTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"scrolls",{enumerable:!0,configurable:!0,writable:!0,value:new D}),Object.defineProperty(this,"updates",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"listRef",{enumerable:!0,configurable:!0,writable:!0,value:t.createRef()}),Object.defineProperty(this,"setScrollState",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{this.scrollState.rowIndex=e,this.scrollState.columnIndex=t}}),Object.defineProperty(this,"resetScrollState",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.scrollState.rowIndex=0,this.scrollState.columnIndex=0}}),Object.defineProperty(this,"onScroll",{enumerable:!0,configurable:!0,writable:!0,value:({scrollTop:e})=>{this.scrollTop=e,this.lastScrollEventTimestamp=Date.now(),this.scrolls.next(e),"disabled"!==this.props.store.liveUpdateMode&&w((()=>this.props.store.liveUpdateMode=this.scrollTop?"manual":"auto"))}}),Object.defineProperty(this,"rowRenderer",{enumerable:!0,configurable:!0,writable:!0,value:e=>({columnIndex:r,rowIndex:i,style:n})=>t.createElement(p,null,(()=>{var o;const a=i*e+r,l=this.props.store.data[a];return a===this.props.store.data.length?this.props.store.error?t.createElement("div",{style:n},t.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},t.createElement("div",{style:{textAlign:"center"}},t.createElement("div",null,"Couldn't fetch more data"),t.createElement(Me,{onClick:this.props.store.loadMore},"Retry")))):t.createElement("div",{style:n},t.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},t.createElement(Jt,{size:32}))):!l&&(null===(o=this.props.store.pageInfo)||void 0===o?void 0:o.haveMore)?t.createElement("div",{style:n}):l?t.createElement("div",{style:n},t.createElement(ze,{data:l,hideCameraName:this.props.hideCameraName,onClick:this.props.onEventClick})):t.createElement("div",{style:n})}))}),Object.defineProperty(this,"loadMoreItems",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>(this.props.store.loadMore(),Promise.resolve())}),v(this,{scrollState:g,setScrollState:E,resetScrollState:E})}componentDidMount(){this.disposables.push(this.scrolls.pipe(U(200)).subscribe((()=>{this.props.store.pendingData.length&&(this.updates=this.props.store.pendingData.length,this.props.store.flushUpdates(),this.forceUpdate())}))),this.disposables.push(C((()=>this.props.store.pendingData),(e=>{e.length&&(Date.now()-this.lastScrollEventTimestamp<200||(this.updates=e.length,this.props.store.flushUpdates(),this.forceUpdate()))})))}componentWillUnmount(){this.disposables.forEach((e=>{e instanceof k?e.closed||e.unsubscribe():e()})),"disabled"!==this.props.store.liveUpdateMode&&w((()=>this.props.store.liveUpdateMode="auto"))}componentDidUpdate(){if(0!==this.scrollTop&&this.listRef.current&&this.updates){const e=this.scrollTop+Math.round(this.updates/this.columnCount)*this.rowHeight;this.listRef.current.scrollTo({scrollTop:e,scrollLeft:0}),this.updates=0}}render(){return t.createElement(p,null,(()=>{const{store:e}=this.props;return e.error&&!e.data.length?(this.resetScrollState(),t.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},t.createElement("div",{style:{textAlign:"center"}},t.createElement("div",null,"Couldn't fetch data"),t.createElement(Me,{onClick:e.reload},"Retry")))):e.loading?(this.resetScrollState(),t.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},t.createElement(Jt,null))):e.data.length?t.createElement(te,null,(({width:r,height:i})=>t.createElement(p,null,(()=>{var n;const{minColumnWidth:o=180}=this.props,a=Math.floor(r/o)||1,l=r/a/16*9,s=a*Math.floor(i/l)>=e.data.length?0:Gt(),c=Math.max(1,Math.floor((r-s)/o)),d=Math.ceil(this.props.store.data.length/c),u=(r-s)/c/16*9;this.rowHeight=u,this.columnCount=c;return t.createElement(re,{isItemLoaded:e=>e<d,itemCount:d+((null===(n=e.pageInfo)||void 0===n?void 0:n.haveMore)?1:0),loadMoreItems:this.loadMoreItems},(({onItemsRendered:n,ref:o})=>{var a;return t.createElement(ee,{ref:ie(this.listRef,o),columnCount:c,columnWidth:(r-s)/c,height:i,width:r,rowCount:d+((null===(a=e.pageInfo)||void 0===a?void 0:a.haveMore)||e.error?1:0),rowHeight:u,initialScrollTop:u*this.scrollState.rowIndex,onScroll:this.onScroll,onItemsRendered:({visibleRowStartIndex:e,visibleColumnStartIndex:t,visibleRowStopIndex:r,overscanRowStopIndex:i,overscanRowStartIndex:o})=>{this.setScrollState(e,t),n({overscanStartIndex:o,overscanStopIndex:i,visibleStartIndex:e,visibleStopIndex:r})}},this.rowRenderer(c))}))})))):(this.resetScrollState(),t.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},ve.t("noEventsFound")))}))}}const Kt=e=>{const{className:r,children:i,...n}=e;return t.createElement("div",{className:R("x-3deye-button-group",r),...n},i)},Yt=ye({viewBox:"0 0 24 24",svg:t.createElement("g",null,t.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"}),t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Yt.displayName="CloseIcon";const Xt=ye({viewBox:"0 0 24 24",svg:t.createElement(t.Fragment,null,t.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),t.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});Xt.displayName="DoneIcon";const Qt=[{color:ne.red[500],name:"red",highlightColor:ne.red[100]},{color:ne.green[500],name:"green",highlightColor:ne.green[100]},{color:ne.blue[500],name:"blue",highlightColor:ne.blue[100]},{color:ne.yellow[500],name:"yellow",highlightColor:ne.yellow[900]},{color:ne.black,name:"black",highlightColor:ne.white},{color:ne.white,name:"white",highlightColor:ne.black},{color:ne.grey[500],name:"dimgrey",highlightColor:ne.grey[100]}],er=m((({value:e,clear:r,toggle:i})=>t.createElement("div",{className:"color-selector"},t.createElement("div",null,"COLOR"),t.createElement("div",{className:"color-selector__items"},Qt.map((({color:r,highlightColor:n,name:o})=>t.createElement("button",{key:o,className:R("color-selector__item",{selected:e.has(o)}),style:{backgroundColor:r,color:n},onClick:i.bind(null,o)},t.createElement(Xt,{size:20})))),t.createElement(Me,{disabled:!e.size,onClick:r},t.createElement(Yt,{size:20}))))));er.displayName="ColorSelector";const tr=({value:e,onChange:r})=>{const n=l(null),a=l(),[s,c]=o(0);return i((()=>{if(!n.current)return;const e=new oe(n.current);return a.current=e,e.listen("MDCSlider:change",(()=>{null==r||r(e.value)})),()=>{a.current=void 0,e.destroy()}}),[]),i((()=>{const e=new ae((e=>{var t;for(const r of e){const e=r.contentRect.width;e!==s&&(null===(t=a.current)||void 0===t||t.layout()),c(e)}}));return e.observe(n.current),()=>e.disconnect()}),[]),i((()=>{a.current&&(a.current.value=e)}),[e]),t.createElement("div",{ref:n,className:"mdc-slider mdc-slider--discrete mdc-slider--display-markers",tabIndex:0,role:"slider","data-step":5,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e,"aria-label":"Select Value"},t.createElement("div",{className:"mdc-slider__track-container"},t.createElement("div",{className:"mdc-slider__track"}),t.createElement("div",{className:"mdc-slider__track-marker-container"})),t.createElement("div",{className:"mdc-slider__thumb-container"},t.createElement("div",{className:"mdc-slider__pin"},t.createElement("span",{className:"mdc-slider__pin-value-marker"})),t.createElement("svg",{className:"mdc-slider__thumb",width:"21",height:"21"},t.createElement("circle",{cx:"10.5",cy:"10.5",r:"7.875"})),t.createElement("div",{className:"mdc-slider__focus-ring"})))};tr.displayName="Slider";const rr=m((({getter:e,setter:r})=>{const[n,a]=o(0),s=l(null),c=Math.floor(100*e());return i((()=>C(e,(e=>{a(Math.floor(100*e))}),{fireImmediately:!0})),[e]),t.createElement("div",{ref:s,style:{paddingLeft:8,paddingRight:8,marginTop:5}},t.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},t.createElement("div",null,"CONFIDENCE"),t.createElement("div",{style:{fontSize:"1.1em"}},c,"%")),t.createElement(tr,{value:n,onChange:e=>{r(e/100)}}))}));rr.displayName="ProbabilitySlider";const ir=e=>`scale(${e})`,nr=({children:t,from:r,style:i})=>{const n=le({opacity:1,from:{opacity:0},config:{tension:300}});return e.createElement(se.div,{style:{...i,...n,transform:n.opacity.to(ir),transformOrigin:`${r||"bottom"} center`,width:"max-content"}},t)},or=({width:e,height:r,color:i,position:n="top",style:o})=>{const a=[0,"top"===n?r:0],l=[e,a[1]],s=[e/2,r-a[1]],c=[e/4,r*("top"===n?3:1)/4],d=[.325*e,r-a[1]],u=[e-d[0],d[1]],h=[e-c[0],c[1]],m=e=>e.join(","),p=`M ${m(a)} C ${m(c)} ${m(d)} ${m(s)} ${m(u)} ${m(h)} ${m(l)} Z`;return t.createElement("svg",{className:"tip",style:o,width:e,height:r,fill:i},t.createElement("path",{d:p}))};class ar extends t.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:t.createRef()}),Object.defineProperty(this,"popoverRef",{enumerable:!0,configurable:!0,writable:!0,value:t.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:i,bottom:n,height:o,width:a}=t.getBoundingClientRect();let l="calc(50% - 12px)",s="auto";const c=this.popoverRef.current;let d="bottom"===this.props.placement?n+10:r-c.clientHeight-10,u=i+a/2-c.clientWidth/2,h="bottom"===this.props.placement?"top":"bottom";d<0&&(d=n+10,h="top"),u<0&&(u=0,l=i+a/2-12),u+c.clientWidth>window.innerWidth&&(u=window.innerWidth-c.clientWidth,l=i-u+a/2-12),e&&(d=o+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:r,bottom:i,tipPosition:n,tipOffset:o}=this.state,{className:a,opened:l,disablePortal:s,disableAnimation:c}=this.props,d={position:"absolute",left:o};"bottom"===n?d.bottom=-8:d.top=-8;const u=R(a,"x-3deye-popover-body");let h=null;if(l){const o={zIndex:s?1:100000001,position:"absolute",top:e,bottom:i,left:r},a=t.createElement("div",{className:u,ref:this.popoverRef},this.props.children,t.createElement(or,{width:24,height:8,position:n,color:"white",style:d}));h=c?t.createElement("div",{style:o},a):t.createElement(nr,{from:n,style:o},a)}const m=t.cloneElement(this.props.target,{ref:this.targetRef});if(s)return t.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},m,h);const p=l&&t.createElement(Le,null,h);return t.createElement(t.Fragment,null,m,p)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}const lr=ye({viewBox:"0 0 24 24",svg:t.createElement("path",{fill:"currentColor",d:"M21 17H24L20 21L16 17H19V3H21V17M8 16H11V13H8V16M13 5H12V3H10V5H6V3H4V5H3C1.89 5 1 5.89 1 7V18C1 19.11 1.89 20 3 20H13C14.11 20 15 19.11 15 18V7C15 5.89 14.11 5 13 5M3 18L3 11H13L13 18L3 18Z"})});lr.displayName="SortCalendarAsc";const sr=ye({viewBox:"0 0 24 24",svg:t.createElement("path",{fill:"currentColor",d:"M19 7H16L20 3L24 7H21V21H19V7M8 16H11V13H8V16M13 5H12V3H10V5H6V3H4V5H3C1.89 5 1 5.89 1 7V18C1 19.11 1.89 20 3 20H13C14.11 20 15 19.11 15 18V7C15 5.89 14.11 5 13 5M3 18L3 11H13L13 18L3 18Z"})});sr.displayName="SortCalendarDesc";const cr=m((({store:e})=>{const{date:r,sortDirection:i}=e,n=b((()=>({opened:!1,toggle(){this.opened=!this.opened},close(){this.opened=!1,e.applyFilters()},onDateChange(t){e.date=t},clear(){e.date=null,e.applyFilters()}}))),o=t.createElement("div",{style:{flex:1,display:"flex"}},t.createElement(Me,{className:"date-button",style:{flex:1,textAlign:"left"},onClick:n.toggle},r?ge(r,"MMM d, HH:mm"):"now"),"DESC"===i&&r?t.createElement(Me,{onClick:n.clear},t.createElement(Yt,{size:16})):null);return t.createElement("div",{className:"events-panel-datepicker"},t.createElement("div",{style:{position:"relative"}},t.createElement(ar,{target:o,opened:n.opened,onCloseRequest:n.close,disableAnimation:!0,className:"popover-datepicker"},t.createElement(ce,{selected:r||new Date,onChange:n.onDateChange,showTimeSelect:!0,dateFormat:"MMM d, HH:mm",timeFormat:"HH:mm",inline:!0}),t.createElement(Me,{onClick:n.close,className:"x-3deye-button--ok"},"Ok")),t.createElement(Me,{className:"x-3deye-button--icon events-panel-datepicker__sorting-button",onClick:e.toggleSorting},"ASC"===i?t.createElement(lr,null):t.createElement(sr,null))))}));cr.displayName="EventsPanelDatepicker";var dr,ur=(dr=8,{container:e=>({...e,padding:dr}),control:(e,t)=>({...e,borderRadius:8,backgroundColor:t.isFocused?"white":"rgba(0, 0, 0, 0.5)",border:"none",boxShadow:null,"&:hover":{borderColor:null}}),menu:e=>({...e,borderRadius:"0 0 4px 4px",marginTop:0,marginLeft:-dr,marginRight:dr}),option:e=>({...e,color:"black"}),multiValueRemove:e=>({...e,color:"black"})});const hr=ye({viewBox:"0 0 24 24",svg:t.createElement("g",null,t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.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"}))});hr.displayName="LabelIcon";const mr=ye({viewBox:"0 0 24 24",svg:t.createElement("g",null,t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.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"}))});mr.displayName="CameraIcon";const pr=ye({viewBox:"0 0 24 24",svg:t.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"})});pr.displayName="LuggageIcon";const br=ye({viewBox:"0 0 24 24",svg:t.createElement(t.Fragment,null,t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.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"}))});br.displayName="CarIcon";const fr=ye({viewBox:"0 0 24 24",svg:t.createElement(t.Fragment,null,t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.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"}))});fr.displayName="BoatIcon";const vr=ye({viewBox:"0 0 24 24",svg:t.createElement(t.Fragment,null,t.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"}))});vr.displayName="BicycleIcon";const gr=ye({viewBox:"0 0 24 24",svg:t.createElement("g",null,t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.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"}))});gr.displayName="DirectionsWalkIcon";const yr=ye({viewBox:"0 0 24 24",svg:t.createElement(t.Fragment,null,t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),t.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),t.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),t.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),t.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"}))});yr.displayName="PetsIcon";const wr=({data:e})=>{const r=16;return e.isEventType?"Luggage"===e.id?t.createElement(pr,{size:r}):"Car"===e.id?t.createElement(br,{size:r}):"Person"===e.id?t.createElement(gr,{size:r}):"Bicycle"===e.id?t.createElement(vr,{size:r}):"Boat"===e.id?t.createElement(fr,{size:r}):"Animal"===e.id?t.createElement(yr,{size:r}):t.createElement(hr,{size:r}):t.createElement(mr,{size:r})},Er=e=>{const{children:r,innerProps:i,...n}=e,{Option:o}=ue,{data:a}=e;if(!a.isEventType)return t.createElement(o,{...e});const l={...i,style:{display:"inline-flex",alignItems:"center",width:"auto"}};return t.createElement(o,{innerProps:l,...n},t.createElement(wr,{data:a}),t.createElement("div",{style:{marginLeft:4}},r))},Cr=e=>{const{children:r,innerProps:i,...n}=e,{MultiValueLabel:o}=ue,{data:a}=e,l={...i,style:{display:"flex",alignItems:"center"}};return t.createElement(o,{innerProps:l,...n},t.createElement(wr,{data:a}),t.createElement("div",{style:{marginLeft:4}},r))},Pr=ye({viewBox:"0 0 24 24",svg:t.createElement(t.Fragment,null,t.createElement("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Pr.displayName="FilterListIcon";const Or={...ur,multiValue:(e,{data:t})=>t.color?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>t.color?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>t.color?{...e,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.7)",color:t.color}}:e,option:(e,{data:t})=>t.color?{...e,color:t.color}:e},jr=e=>{const{children:r,...i}=e;return t.createElement(ue.Placeholder,{...i},t.createElement(Pr,{size:16,style:{position:"relative",top:4}})," ",r)},Tr=m((({store:e})=>{const{cameras:i,eventSchema:n}=r(me),o=l({opened:!1});if(!("filters"in e))return null;return t.createElement(de,{closeMenuOnSelect:!1,isMulti:!0,onChange:(t,r)=>{e.setFilters(t),"remove-value"!==r.action||o.current.opened||e.applyFilters()},onMenuOpen:()=>o.current.opened=!0,onMenuClose:()=>{o.current.opened=!1,e.applyFilters()},getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:(()=>{if(!n)return[];const t=e.facesSelected?[]:n.foundObjectTypesForSelect;return i.loaded?[].concat(t,i.data.slice()):t})(),placeholder:ve.t("filter"),value:e.filters,components:{MultiValueLabel:Cr,Option:Er,Placeholder:jr},styles:Or})}));Tr.displayName="EventsPanelSelect";const xr=m((({store:e,onEventClick:r})=>{const{facesSelected:i,getFacesProbabilityTreshold:n,getProbabilityTreshold:o,setFacesProbabilityTreshold:a,setProbabilityTreshold:l,someAnalyticsFilterSelected:s,colors:c,toggleColor:d,clearColors:u,selectEvents:h,selectFaces:m}=e;return t.createElement(t.Fragment,null,t.createElement("div",{style:{color:"black",zIndex:3}},t.createElement(Tr,{store:e})),t.createElement(cr,{store:e}),s&&!i&&t.createElement(rr,{getter:i?n:o,setter:i?a:l}),!i&&s?t.createElement(er,{value:c,toggle:d,clear:u}):null,t.createElement("div",{style:{display:"flex",flex:1}},i?t.createElement(Zt,{key:"faces",minColumnWidth:800,hideCameraName:!1,store:e.facesLoader,onEventClick:r}):t.createElement(Zt,{key:"events",minColumnWidth:800,hideCameraName:!1,store:e.eventsLoader,onEventClick:r})),t.createElement(Kt,null,t.createElement(Me,{className:i?"button-unselected":"button-selected",onClick:h},"ALL"),t.createElement(Me,{className:i?"button-selected":"button-unselected",onClick:m},"Face recognition")))}));var Mr,Sr;function Lr(e,t=!1){const r=P(e);return new _((e=>{const i=r.observe_((({newValue:t})=>e.next(t)),t);return()=>i()}))}xr.displayName="EventsPanelContents",function(e){e[e.CONNECTING=0]="CONNECTING",e[e.CONNECTED=1]="CONNECTED",e[e.RECONNECTING=2]="RECONNECTING",e[e.DISCONNECTED=3]="DISCONNECTED"}(Mr||(Mr={})),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"}(Sr||(Sr={}));class Nr{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 k?e.closed||e.unsubscribe():e()}))}}const Ir=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class Dr{constructor(e){if(Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thumbnailUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"faces",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"instant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),v(this,{id:P,startTime:P,endTime:P,acknowledged:P,isLive:P,raw:g.ref}),this.raw=e,this.type=e.eventType,this.cameraId=e.sensorId,("Analytic"===this.type||"FaceDetection"===this.type)&&e.data)try{const t=JSON.parse(e.data);t.FoundObjects&&(this.type="Analytic",this.detectedObjects=t.FoundObjects),t.Faces&&(this.type="FaceDetection",this.faces=t.Faces),this.thumbnailUrl=t.ThumbnailUrl}catch{console.warn("invalid data",e.data),this.type="Motion"}this.instant=Ir.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!Ir.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class kr extends Nr{constructor(e){super(),Object.defineProperty(this,"eventsStore",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pendingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"liveUpdateMode",{enumerable:!0,configurable:!0,writable:!0,value:"auto"}),Object.defineProperty(this,"updateTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pageInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"loading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"loadMoreTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"retryTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"sortDirection",{enumerable:!0,configurable:!0,writable:!0,value:"DESC"}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"to",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameras",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"polygons",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"eventTypes",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"loadingInited",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"flushUpdates",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.data=[...this.pendingData,...this.data],this.pendingData=[]}}),Object.defineProperty(this,"load",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.loadingInited||(this.loadingInited=!0,this.initDataLoading(),this.initLiveUpdates())}}),Object.defineProperty(this,"reload",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error&&(this.retryTrigger=+!this.retryTrigger)}}),Object.defineProperty(this,"loadMore",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error=null,this.loadMoreTrigger=+!this.loadMoreTrigger}}),Object.defineProperty(this,"requestData",{enumerable:!0,configurable:!0,writable:!0,value:({sortDirection:e,from:t,to:r,filter:i,pageInfo:n,cameras:o,polygons:a})=>this.api.cameras.GetSensorEventsPage({sensorIds:o,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==n?void 0:n.nextPageToken},i,a).pipe(q((e=>e.success?F({events:e.resultItems,pageInfo:e.pageInfo}):H(e.error))),Z((e=>(console.error(e),this.error=e,F({events:[],pageInfo:null})))))}),v(this,{data:g.ref,cameras:g.struct,detectedObjects:g.struct,from:g,to:g,sortDirection:g,probabilityThreshold:g,pendingData:g.ref,liveUpdateMode:g,updateTrigger:g,colors:g.ref,flushUpdates:E,pageInfo:g.ref,isLive:P,loading:g,loadMoreTrigger:g,retryTrigger:g,error:g.ref,loadMore:E,filterJson:P})}get isLive(){return"DESC"==this.sortDirection&&!this.to}get totalCount(){return this.data.length}get filterJson(){if(1===this.eventTypes.length&&this.eventTypes[0]===Sr.FaceDetection)return null;const{probabilityThreshold:e}=this;if(null===e)return null;const t={And:[]};return this.detectedObjects.length&&t.And.push({Or:this.detectedObjects.map((e=>({Type:e})))}),this.colors.size&&t.And.push({Or:[...this.colors].map((e=>({ObjectColors:[e]})))}),t.And.push({Or:[{Probability:e}]}),JSON.stringify(t)}initDataLoading(){const e=Lr((()=>({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(B((e=>Lr((()=>this.retryTrigger),!0).pipe(K(e)))),B((({from:e,to:t,sortDirection:r,filter:i,cameraFilters:n,polygons:o})=>(w((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[]})),this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:i,cameras:n,pageInfo:this.pageInfo,polygons:o}))))).subscribe((({events:e,pageInfo:t})=>{w((()=>{var r,i,n;if(!t)return;const o=e.map(_r);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:6===this.eventTypes[0]?["FaceDetection"]:[],from:null!==(i=null===(r=o[0])||void 0===r?void 0:r.startTime)&&void 0!==i?i:he(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(n=this.probabilityThreshold)&&void 0!==n?n:void 0}),o):this.data=o,this.eventsStore.add(o),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(B((({from:e,to:t,sortDirection:r,filter:i,cameraFilters:n})=>Lr((()=>this.loadMoreTrigger)).pipe(Y((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:i,cameras:n,pageInfo:this.pageInfo,polygons:this.polygons}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(_r);this.eventsStore.add(r),w((()=>{this.data=this.data.concat(r),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(Lr((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(B((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?Lr((()=>this.eventsStore.recentAdditions)):z))).subscribe((e=>{if(this.loading)return;if(!this.pageInfo&&this.error)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&w((()=>{this.data=[...t,...this.data]}))}))),this.disposables.push(Lr((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(B((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?Lr((()=>this.eventsStore.recentAdditions)):(this.pendingData&&w((()=>this.pendingData=[])),z)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&w((()=>{this.pendingData=[...t,...this.pendingData]}))})))}filter(e){let t=e;const{from:r,to:i}=this;return r&&(t=t.filter((e=>e.startTime>=r))),i&&(t=t.filter((e=>e.startTime<=i))),this.cameras.length&&(t=t.filter((e=>this.cameras.includes(e.cameraId)))),this.eventTypes.length&&6===this.eventTypes[0]&&(t=t.filter((e=>"FaceDetection"===e.type))),this.detectedObjects.length&&(t=t.filter((e=>e.detectedObjects.some((e=>{const{probabilityThreshold:t}=this;return!(null!==t&&e.Probability<t)&&(this.colors.size?this.detectedObjects.includes(e.Type)&&e.Colors.some((e=>this.colors.has(e.Color))):this.detectedObjects.includes(e.Type))}))))),t}uniquelyConcat(e,t){if(!e.length)return t.concat();if(!t.length)return e.concat();const r=e=>[e.id,e];return Array.from(new Map([...e.map(r),...t.map(r)]).values())}dispose(){this.disposables.forEach((e=>{e instanceof k?e.closed||e.unsubscribe():e()}))}}function _r(e){return new Dr(e)}class Fr extends Nr{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,"facesSelected",{enumerable:!0,configurable:!0,writable:!0,value:!1}),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,"facesLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"selectEvents",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.facesSelected=!1}}),Object.defineProperty(this,"selectFaces",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.facesSelected=!0}}),Object.defineProperty(this,"toggleSorting",{enumerable:!0,configurable:!0,writable:!0,value:()=>{"ASC"===this.sortDirection?(this.sortDirection="DESC",this.date=null):(this.sortDirection="ASC",null===this.date&&(this.date=M(S(new Date),1))),this.applyFilters()}}),Object.defineProperty(this,"applyFilters",{enumerable:!0,configurable:!0,writable:!0,value:()=>{var e;this.eventsLoader.cameras=this.cameraFilters.map((e=>e.id)),this.facesLoader.cameras=this.eventsLoader.cameras,this.eventsLoader.detectedObjects=this.objectFilters.map((e=>e.id)),this.eventsLoader.colors=this.colors,this.eventsLoader.probabilityThreshold=this.objectFilters.length?this.probabilityThreshold:null,this.facesLoader.probabilityThreshold=this.facesProbabilityThreshold,"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),this.facesLoader.sortDirection=this.eventsLoader.sortDirection,this.facesLoader.from=this.eventsLoader.from,this.facesLoader.to=this.eventsLoader.to}}),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()}}),Object.defineProperty(this,"getFacesProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.facesProbabilityThreshold}),Object.defineProperty(this,"setFacesProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.facesProbabilityThreshold=e,this.applyFilters()}}),v(this,{cameraFilters:g.ref,objectFilters:g.ref,date:g,sortDirection:g,probabilityThreshold:g,setProbabilityTreshold:E,facesProbabilityThreshold:g,setFacesProbabilityTreshold:E,facesSelected:g,colors:g.ref,someAnalyticsFilterSelected:P,filters:P,setFilters:E,selectEvents:E,selectFaces:E,load:E,toggleColor:E.bound,clearColors:E.bound,applyFilters:E,toggleSorting:E}),this.eventsLoader=new kr(e),this.eventsLoader.loading=!0,this.eventsLoader.probabilityThreshold=null,this.facesLoader=new kr(e),this.facesLoader.eventTypes=[Sr.FaceDetection],this.facesLoader.loading=!0}get someAnalyticsFilterSelected(){return!!this.objectFilters.length}get filters(){return this.facesSelected?this.cameraFilters:this.objectFilters.concat(this.cameraFilters)}load(){this.eventsLoader.load()}TEMP_FIX_loadFaces(){this.facesLoader.load()}setFilters(e){this.cameraFilters=e?e.filter((e=>!("isEventType"in e))):[],this.facesSelected||(this.objectFilters=e?e.filter((e=>"isEventType"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),this.facesLoader.initWith(this.api)}dispose(){this.disposables.forEach((e=>{e instanceof k?e.closed||e.unsubscribe():e()})),this.eventsLoader.dispose()}}const Hr=({onEventClick:e})=>{var n;const a=null!==(n=r(u))&&void 0!==n?n:h,[l,s]=o();return i((()=>{null==l||l.dispose();const e=new Fr(a.events);return e.initWith(a.api),e.load(),s(e),O((()=>e.facesSelected),(()=>{e.TEMP_FIX_loadFaces()}))}),[a]),t.createElement(me.Provider,{value:a},l?t.createElement(xr,{store:l,onEventClick:e}):null)};Hr.displayName="EventList";export{Hr as default};
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.9.13"
8
+ "packageVersion": "7.18.14"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
1
  {
2
2
  "name": "@3deye-toolkit/react-event-list",
3
- "version": "0.0.1-alpha.19",
3
+ "version": "0.0.1-alpha.22",
4
4
  "module": "dist/react-event-list.js",
5
- "types": "dist/react-events-list.d.ts",
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.19",
11
- "@reach/tooltip": "^0.10.2",
12
- "@rmwc/slider": "^6.0.14",
13
- "classnames": "^2.2.5",
14
- "crossfilter2": "^1.5.2",
15
- "date-fns": "^2.13.0",
16
- "i18next": "^19.4.4",
17
- "lodash": "4.17.19",
18
- "material-colors": "^1.2.5",
19
- "mobx": "^5.15.4",
20
- "mobx-react": "^6.2.2",
21
- "react-datepicker": "^2.16.0",
22
- "react-ink": "^6.2.0",
23
- "react-select": "^3.1.0",
24
- "react-spring": "^8.0.5",
25
- "react-virtualized-auto-sizer": "^1.0.2",
26
- "react-window": "^1.8.4",
10
+ "@3deye-toolkit/core": "0.0.1-alpha.22",
11
+ "@material/slider": "^5.1.0",
12
+ "@reach/tooltip": "^0.15.3",
13
+ "@react-spring/web": "^9.2.5",
14
+ "@seznam/compose-react-refs": "^1.0.6",
15
+ "clsx": "^1.1.1",
16
+ "date-fns": "^2.22.1",
17
+ "i18next": "21.5.3",
18
+ "lodash": "4.17.21",
19
+ "material-colors": "^1.2.6",
20
+ "mobx": "^6.3.2",
21
+ "mobx-react-lite": "^3.2.0",
22
+ "react-datepicker": "^4.1.1",
23
+ "react-ink": "^6.5.1",
24
+ "react-select": "^4.3.1",
25
+ "react-virtualized-auto-sizer": "^1.0.5",
26
+ "react-window": "^1.8.6",
27
+ "react-window-infinite-loader": "^1.0.7",
27
28
  "resize-observer-polyfill": "^1.5.1",
28
- "rxjs": "^6.5.5",
29
- "string-natural-compare": "^2.0.2"
29
+ "rxjs": "^6.5.5"
30
30
  },
31
31
  "peerDependencies": {
32
- "react": "^16.12.x",
33
- "react-dom": "^16.12.x"
32
+ "react": "^16.8.0 || ^17",
33
+ "react-dom": "^16.8.0 || ^17"
34
34
  },
35
35
  "sideEffects": [
36
36
  "*.css"