@3deye-toolkit/react-event-list 0.0.5 → 0.0.7
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.
|
@@ -80,7 +80,6 @@ declare class Api<T extends DeepPartial<IApi>> {
|
|
|
80
80
|
shutdownConnection(): void;
|
|
81
81
|
private init;
|
|
82
82
|
private createHubMethod;
|
|
83
|
-
private subscribeToEvents;
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
declare type ApiPageResult<T> = {
|
|
@@ -289,7 +288,7 @@ declare interface Connection {
|
|
|
289
288
|
};
|
|
290
289
|
};
|
|
291
290
|
createHubProxy: (hubName: string) => void;
|
|
292
|
-
lastError:
|
|
291
|
+
lastError: unknown;
|
|
293
292
|
qs: {
|
|
294
293
|
access_token: string;
|
|
295
294
|
};
|
|
@@ -329,7 +328,6 @@ export default EventList;
|
|
|
329
328
|
declare const events: {
|
|
330
329
|
[P in keyof PartialApi]: {
|
|
331
330
|
name: string;
|
|
332
|
-
explicit?: boolean;
|
|
333
331
|
}[];
|
|
334
332
|
};
|
|
335
333
|
|
|
@@ -906,7 +904,6 @@ declare interface Storage_2 {
|
|
|
906
904
|
|
|
907
905
|
declare class Token {
|
|
908
906
|
accessToken: string;
|
|
909
|
-
accessTokenExpires: Date;
|
|
910
907
|
accessTokenIssued: Date;
|
|
911
908
|
clientId: string;
|
|
912
909
|
expiresIn: number;
|
|
@@ -920,6 +917,8 @@ declare class Token {
|
|
|
920
917
|
widgetToken?: string;
|
|
921
918
|
json: RawToken;
|
|
922
919
|
constructor(raw: RawToken);
|
|
920
|
+
private _exp;
|
|
921
|
+
get accessTokenExpires(): Date;
|
|
923
922
|
}
|
|
924
923
|
|
|
925
924
|
export { }
|
package/dist/react-event-list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"i18next";import{of as t,from as r,Observable as n,Subscription as i,mergeMap as o,throwError as a,catchError as l,startWith as s,switchMap as c,map as d,exhaustMap as h,EMPTY as u,Subject as p}from"rxjs";import{jsx as m,jsxs as g,Fragment as f}from"react/jsx-runtime";import v,{forwardRef as y,memo as b,useState as C,useRef as x,useEffect as w,useLayoutEffect as T,createContext as D,Component as k,useCallback as M,useMemo as N,cloneElement as I,Children as _,useContext as L}from"react";import{AppContext as F,app as S}from"@3deye-toolkit/core";import{useElementSize as z}from"@mantine/hooks";import{computed as U,observe as O,makeObservable as P,observable as E,action as H,runInAction as B,reaction as A,when as R}from"mobx";import{observer as j,useLocalObservable as $}from"mobx-react-lite";import V from"clsx";import{useMergeRefs as W,useListItem as Y,useFloatingTree as q,useFloating as Z,offset as G,flip as Q,shift as X,arrow as J,autoUpdate as K,useInteractions as ee,useRole as te,useDismiss as re,FloatingPortal as ne,FloatingFocusManager as ie,useId as oe,size as ae,useListNavigation as le,useHover as se}from"@floating-ui/react";import ce from"react-ink";import de from"@seznam/compose-react-refs";import{differenceInCalendarDays as he,max as ue,min as pe}from"date-fns";import me from"memoize-one";var ge={showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events",noEventsFound:"no events found",eventSearchFilter:{after:"After",before:"Before",recentEvents:"Recent events"},button:{ok:"Ok"},eventTypes:{Normal:"Normal",Suspicious:"Suspicious",Misidentification:"Misidentification",Loitering:"Loitering",Vandalism:"Vandalism",Trespass:"Trespass",Emergency:"Emergency",LifeInDanger:"Life in Danger",ErroneousAlert:"Erroneous Alert",Fire:"Fire",MedicalDuress:"Medical Duress",HoldUp:"Hold Up",CheckIn:"Check In",CheckOut:"Check Out",ClockIn:"Clock In",ClockOut:"Clock Out",ParkingStart:"Parking Start",ParkingEnd:"Parking End",ParkingViolation:"Parking Violation",GateAccess:"Gate Access",DoorAccess:"Door Access",TemperatureCheck:"Temperature Check",IDCheck:"ID Check",PPECheck:"PPE Check",WelfareCheck:"Welfare Check",VehicleBreakIn:"Vehicle Break-In",DrugTrafficking:"Drug Trafficking",Assault:"Assault",PackageDelivery:"Package Delivery",Uncategorized:"Uncategorized"},filter:"Filter",event:{acknowledged:"acknowledged"},color:"color",confidence:"confidence",select:{loading:"Loading...",noOptions:"No options"},duration:{minute:"minute",hour:"hour",day:"day",ss:"{{seconds}}s",mm:"{{minutes}}m",hh:"{{hours}}h",mmss:"{{minutes}}m {{seconds}}s",hhmm:"{{hours}}h {{minutes}}m",hhmmss:"{{hours}}h {{minutes}}m {{seconds}}s"},analytics:{car:"car",person:"person",animal:"animal",bicycle:"bicycle",luggage:"luggage",boat:"boat",hardhat:"hardhat",nohardhat:"no hardhat",licenseplate:"license plate",smoke:"smoke",fire:"fire",vest:"vest",novest:"no vest"}};const fe={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},ve=e.createInstance(),ye=v.createContext(null);function be(e,t=!1){const r=U(e);return new n((e=>{const n=O(r,(({newValue:t})=>e.next(t)),t);return()=>n()}))}var Ce;!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.VehicleBreakIn=40]="VehicleBreakIn",e[e.DrugTrafficking=41]="DrugTrafficking",e[e.Assault=42]="Assault",e[e.PackageDelivery=43]="PackageDelivery",e[e.Uncategorized=999]="Uncategorized"}(Ce||(Ce={}));const xe=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput","Loitering"]);class we{id;cameraId;type;raw;thumbnailUrl;thumbnailWidth=0;thumbnailHeight=0;detectedObjects;faces;instant;get startTime(){return new Date(this.raw.startTime)}get endTime(){return new Date(this.raw.endTime)}get isLive(){return!xe.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}update=e=>{this.raw=e};constructor(e){if(P(this,{startTime:U,endTime:U,acknowledged:U,isLive:U,raw:E.ref,update:H}),this.raw=e,this.id=e.id,this.type=e.eventType,this.cameraId=e.sensorId,("Analytic"===this.type||"FaceDetection"===this.type||"Loitering"===this.type)&&e.data)try{const t=JSON.parse(e.data);t.FoundObjects&&(this.detectedObjects=t.FoundObjects),t.Faces&&(this.type="FaceDetection",this.faces=t.Faces),t.ThumbnailSize&&(this.thumbnailWidth=t.ThumbnailSize.Width,this.thumbnailHeight=t.ThumbnailSize.Height),this.thumbnailUrl=t.ThumbnailUrl}catch{console.warn("invalid data",e.data),this.type="Motion"}this.instant=xe.has(this.type),this.detectedObjects||(this.detectedObjects=[])}}const Te=(e,t,r)=>r?e.getUTCFullYear()===t.getUTCFullYear()&&e.getUTCMonth()===t.getUTCMonth()&&e.getUTCDate()===t.getUTCDate():e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),De=(e,t,r)=>r?e.getUTCFullYear()===t.getUTCFullYear():e.getFullYear()===t.getFullYear();function ke(e,t){return new Date(e.getTime()-60*t*60*1e3)}const Me=(e,{locale:t,utc:r=!1,hour12:n=!1,seconds:i,year:o=!1,dayOfWeek:a=!1,day:l=!1})=>{const s={hour:"numeric",minute:"numeric",hour12:n||void 0,hourCycle:n?void 0:"h23"};return r&&(s.timeZone="UTC"),i&&(s.second="numeric"),o&&(s.year="numeric"),a&&(s.weekday="short"),l&&(s.day="numeric",s.month="short"),new Intl.DateTimeFormat(t,s).format(e)},Ne=(e,t)=>t?e.getUTCSeconds():e.getSeconds();function Ie(e,t,{locale:r,utc:n=!1,hour12:i=!1}={}){let o="",a="";const l=Boolean(Ne(e,n)||Ne(t,n)),s={from:!1,to:!1},c={from:!1,to:!1},d={from:!1,to:!1};return De(e,new Date,n)?Te(e,new Date,n)||(Te(e,t,n)?(d.from=!0,c.from=!0):(d.from=!0,c.from=!0,d.to=!0,c.to=!0)):(s.from=!0,d.from=!0,d.to=!0,s.to=!De(e,t,n)),o=Me(e,{locale:r,utc:n,hour12:i,seconds:l,year:s.from,dayOfWeek:c.from,day:d.from}),+e==+t?o:(a=Me(t,{locale:r,utc:n,hour12:i,seconds:l,year:s.to,dayOfWeek:c.to,day:d.to}),`${o} - ${a}`)}var _e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Le(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fe="object"==typeof _e&&_e&&_e.Object===Object&&_e,Se="object"==typeof self&&self&&self.Object===Object&&self,ze=Fe||Se||Function("return this")(),Ue=ze.Symbol,Oe=Ue,Pe=Object.prototype,Ee=Pe.hasOwnProperty,He=Pe.toString,Be=Oe?Oe.toStringTag:void 0;var Ae=function(e){var t=Ee.call(e,Be),r=e[Be];try{e[Be]=void 0;var n=!0}catch(e){}var i=He.call(e);return n&&(t?e[Be]=r:delete e[Be]),i},Re=Object.prototype.toString;var je=Ae,$e=function(e){return Re.call(e)},Ve=Ue?Ue.toStringTag:void 0;var We=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ye=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ve&&Ve in Object(e)?je(e):$e(e)},qe=We;var Ze,Ge=function(e){if(!qe(e))return!1;var t=Ye(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Qe=ze["__core-js_shared__"],Xe=(Ze=/[^.]+$/.exec(Qe&&Qe.keys&&Qe.keys.IE_PROTO||""))?"Symbol(src)_1."+Ze:"";var Je=function(e){return!!Xe&&Xe in e},Ke=Function.prototype.toString;var et=Ge,tt=Je,rt=We,nt=function(e){if(null!=e){try{return Ke.call(e)}catch(e){}try{return e+""}catch(e){}}return""},it=/^\[object .+?Constructor\]$/,ot=Function.prototype,at=Object.prototype,lt=ot.toString,st=at.hasOwnProperty,ct=RegExp("^"+lt.call(st).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var dt=function(e){return!(!rt(e)||tt(e))&&(et(e)?ct:it).test(nt(e))},ht=function(e,t){return null==e?void 0:e[t]};var ut=function(e,t){var r=ht(e,t);return dt(r)?r:void 0},pt=ut(Object,"create"),mt=pt;var gt=function(){this.__data__=mt?mt(null):{},this.size=0};var ft=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},vt=pt,yt=Object.prototype.hasOwnProperty;var bt=function(e){var t=this.__data__;if(vt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return yt.call(t,e)?t[e]:void 0},Ct=pt,xt=Object.prototype.hasOwnProperty;var wt=function(e){var t=this.__data__;return Ct?void 0!==t[e]:xt.call(t,e)},Tt=pt;var Dt=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Tt&&void 0===t?"__lodash_hash_undefined__":t,this},kt=gt,Mt=ft,Nt=bt,It=wt,_t=Dt;function Lt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Lt.prototype.clear=kt,Lt.prototype.delete=Mt,Lt.prototype.get=Nt,Lt.prototype.has=It,Lt.prototype.set=_t;var Ft=Lt;var St=function(){this.__data__=[],this.size=0};var zt=function(e,t){return e===t||e!=e&&t!=t};var Ut=function(e,t){for(var r=e.length;r--;)if(zt(e[r][0],t))return r;return-1},Ot=Ut,Pt=Array.prototype.splice;var Et=function(e){var t=this.__data__,r=Ot(t,e);return!(r<0)&&(r==t.length-1?t.pop():Pt.call(t,r,1),--this.size,!0)},Ht=Ut;var Bt=function(e){var t=this.__data__,r=Ht(t,e);return r<0?void 0:t[r][1]},At=Ut;var Rt=Ut;var jt=function(e,t){var r=this.__data__,n=Rt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},$t=St,Vt=Et,Wt=Bt,Yt=function(e){return At(this.__data__,e)>-1},qt=jt;function Zt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Zt.prototype.clear=$t,Zt.prototype.delete=Vt,Zt.prototype.get=Wt,Zt.prototype.has=Yt,Zt.prototype.set=qt;var Gt=Zt,Qt=ut(ze,"Map"),Xt=Ft,Jt=Gt,Kt=Qt;var er=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var tr=function(e,t){var r=e.__data__;return er(t)?r["string"==typeof t?"string":"hash"]:r.map},rr=tr;var nr=tr;var ir=tr;var or=tr;var ar=function(e,t){var r=or(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},lr=function(){this.size=0,this.__data__={hash:new Xt,map:new(Kt||Jt),string:new Xt}},sr=function(e){var t=rr(this,e).delete(e);return this.size-=t?1:0,t},cr=function(e){return nr(this,e).get(e)},dr=function(e){return ir(this,e).has(e)},hr=ar;function ur(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ur.prototype.clear=lr,ur.prototype.delete=sr,ur.prototype.get=cr,ur.prototype.has=dr,ur.prototype.set=hr;var pr=ur;function mr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(mr.Cache||pr),r}mr.Cache=pr;const gr=Le(mr)((()=>{const e=document.createElement("div");e.style.overflowY="scroll",e.style.position="absolute",e.style.top="-9999px",document.body.append(e);const t=e.offsetWidth;return e.remove(),t}));function fr(e,t,r=!0){if((e=Math.round(e/1e3))<60)return t("duration.ss",{seconds:e});const n=e%60;let i=(e-n)/60;if(i<60)return!n&&r?t("duration.mm",{minutes:i}):t("duration.mmss",{minutes:i,seconds:`${n}`.padStart(2,"0")});const o=Math.floor(i/60);if(i-=60*o,!n&&!i&&r)return t("duration.hh",{hours:o});const a=r?`${i}`:`${i}`.padStart(2,"0");return!n&&i&&r?t("duration.hhmm",{hours:o,minutes:a}):t("duration.hhmmss",{hours:o,minutes:a,seconds:`${n}`.padStart(2,"0")})}const vr=(e,t,r)=>Math.min(Math.max(e,t),r),yr=()=>{};class br{api;disposables=[];initWith(e){this.api=e,this.afterInit&&this.afterInit()}dispose(){for(const e of this.disposables)e instanceof i?e.closed||e.unsubscribe():e()}}class Cr extends br{eventsStore;filters;fetcher;transformData;data=[];pendingData=[];liveUpdateMode="auto";disposables=[];pageInfo=null;loading=!1;loadMoreTrigger=0;retryTrigger=0;error=null;loadingInitiated=!1;get isLive(){return"DESC"===this.filters.sortDirection&&!this.filters.to}constructor(e,t,r,n=e=>[{data:e,objectIdx:-1}]){super(),this.eventsStore=e,this.filters=t,this.fetcher=r,this.transformData=n,P(this,{data:E.ref,pendingData:E.ref,liveUpdateMode:E,setLiveUpdateMode:H,flushUpdates:H,pageInfo:E.ref,isLive:U,loading:E,loadMoreTrigger:E,retryTrigger:E,error:E.ref,loadMore:H})}flushUpdates=()=>{this.data=[...this.pendingData,...this.data],this.pendingData=[]};setLiveUpdateMode=e=>{this.liveUpdateMode=e};load=()=>{this.loadingInitiated||(this.loadingInitiated=!0,this.initDataLoading(),this.initLiveUpdates())};reload=()=>{this.error&&(this.retryTrigger=+!this.retryTrigger)};loadMore=()=>{this.error=null,this.loadMoreTrigger=+!this.loadMoreTrigger};queryEvents=e=>this.fetcher(this.api,e).pipe(o((e=>e.success?t({events:e.resultItems,pageInfo:e.pageInfo}):a((()=>e.error)))),l((e=>(console.error(e),this.error=e,t({events:[],pageInfo:null})))));initDataLoading(){this.disposables.push(this.filters.updated$.pipe(s(null),c((e=>be((()=>this.retryTrigger),!0).pipe(d((()=>e))))),c((()=>(B((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[],this.pendingData=[]})),this.queryEvents())))).subscribe((({events:e,pageInfo:t})=>{B((()=>{if(!t)return;const r=e.map(xr);this.isLive?this.data=this.uniquelyConcat(this.filters.apply(this.eventsStore.getEvents({cameraIds:this.filters.cameras,from:r[0]?.startTime??ke(new Date,1),to:null,probability:this.filters.probabilityThreshold??void 0})),r).flatMap(this.transformData):this.data=r.flatMap(this.transformData),this.eventsStore.add(r),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(this.filters.updated$.pipe(s(null),c((()=>be((()=>this.loadMoreTrigger)).pipe(h((()=>this.queryEvents(this.pageInfo?.nextPageToken))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(xr);this.eventsStore.add(r),B((()=>{this.data=this.data.concat(r.flatMap(this.transformData)),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(be((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(c((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?be((()=>this.eventsStore.recentAdditions)):u))).subscribe((e=>{if(this.loading)return;if(!this.pageInfo&&this.error)return;const t=this.filters.apply(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&B((()=>{this.data=[...t.flatMap(this.transformData),...this.data]}))}))),this.disposables.push(be((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(c((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?be((()=>this.eventsStore.recentAdditions)):(this.pendingData&&B((()=>this.pendingData=[])),u)))).subscribe((e=>{if(!this.data.length)return;const t=this.filters.apply(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&B((()=>{this.pendingData=[...t.flatMap(this.transformData),...this.pendingData]}))})))}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(){for(const e of this.disposables)e instanceof i?e.closed||e.unsubscribe():e()}}function xr(e){return new we(e)}const wr=({forwardedRef:e,children:t,className:r,fullWidth:n,variant:i,type:o,title:a,placement:l,...s})=>{const c=V(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},i?`x-3deye-button--${i}`:void 0),d=g("button",{ref:e,className:c,type:o||"button",...s,children:[t,s.disabled?null:m(ce,{})]});return void 0===a?d:m(Yn,{label:a,placement:l,disabled:!a,children:d})};var Tr=y(((e,t)=>m(wr,{forwardedRef:t,...e})));function Dr(e){return y(((t,r)=>{const{size:n=24,color:i="currentColor",className:o,...a}=t,l=e.viewBox||"0 0 24 24",s=e.svg;return m("svg",{ref:r,preserveAspectRatio:"xMinYMin",className:V("icon",o),width:n,fill:i,viewBox:l,...a,children:s})}))}const kr=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M5.88 4.12L13.76 12l-7.88 7.88L8 22l10-10L8 2z"}),m("path",{fill:"none",d:"M0 0h24v24H0z"})]})});kr.displayName="ArrowForwardIcon";var Mr=kr;const Nr=Dr({viewBox:"0 0 24 24",svg:m(f,{children:m("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"})})});Nr.displayName="BicycleIcon";var Ir=Nr;const _r=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});_r.displayName="BoatIcon";var Lr=_r;const Fr=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});Fr.displayName="CameraIcon";var Sr=Fr;const zr=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});zr.displayName="CarIcon";var Ur=zr;const Or=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z"}),m("path",{d:"M0-.75h24v24H0z",fill:"none"})]})});Or.displayName="ChevronDownIcon";var Pr=Or;const Er=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),m("path",{d:"M0 0h24v24H0z",fill:"none"})]})});Er.displayName="ChevronRightIcon";var Hr=Er;const Br=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("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"}),m("path",{d:"M0 0h24v24H0z",fill:"none"})]})});Br.displayName="CloseIcon";var Ar=Br;const Rr=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});Rr.displayName="DirectionsWalkIcon";var jr=Rr;const $r=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{fill:"none",d:"M0 0h24v24H0z"}),m("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"})]})});$r.displayName="DoneIcon";var Vr=$r;const Wr=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),m("path",{d:"M0 0h24v24H0z",fill:"none"})]})});Wr.displayName="FilterListIcon";var Yr=Wr;const qr=Dr({viewBox:"0 0 24 24",svg:m(f,{children:m("path",{d:"M19.48,12.35c-1.57-4.08-7.16-4.3-5.81-10.23c0.1-0.44-0.37-0.78-0.75-0.55C9.29,3.71,6.68,8,8.87,13.62 c0.18,0.46-0.36,0.89-0.75,0.59c-1.81-1.37-2-3.34-1.84-4.75c0.06-0.52-0.62-0.77-0.91-0.34C4.69,10.16,4,11.84,4,14.37 c0.38,5.6,5.11,7.32,6.81,7.54c2.43,0.31,5.06-0.14,6.95-1.87C19.84,18.11,20.6,15.03,19.48,12.35z M10.2,17.38 c1.44-0.35,2.18-1.39,2.38-2.31c0.33-1.43-0.96-2.83-0.09-5.09c0.33,1.87,3.27,3.04,3.27,5.08C15.84,17.59,13.1,19.76,10.2,17.38z"})})});qr.displayName="FireIcon";var Zr=qr;const Gr=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});Gr.displayName="LabelIcon";var Qr=Gr;const Xr=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M4 4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H5Zm0 2h4v2h8V6h4v12H4Z"}),m("path",{d:"M9.923 10 8.43 12.433 10 15h-.8L8 13.036 6.8 15H6l1.602-2.616L6.136 10h.8l1.093 1.781L9.123 10Z"}),m("path",{d:"m13.709 10-1.492 2.433L13.787 15h-.8l-1.2-1.964L10.585 15h-.8l1.603-2.616L9.923 10h.799l1.094 1.781L12.91 10Z"}),m("path",{d:"m17.709 10-1.492 2.433L17.787 15h-.8l-1.2-1.964L14.585 15h-.8l1.603-2.616L13.923 10h.799l1.094 1.781L16.91 10Z"})]})});Xr.displayName="LicensePlateIcon";var Jr=Xr;const Kr=Dr({viewBox:"0 0 24 24",svg:m("path",{d:"M12.703 5.787a2.171 2.171 0 0 0-1.334.438c-.511.788-.8 1.614-1.217 3.267l-3.172.91a.499.499 0 0 0-.341.62l.13.455a.5.5 0 0 0 .62.343l2.328-.67-.377 1.31-3.96 3.827 1.53 6.693h3.78l2.67-10.14 1.29-4.51V7.01l-.32-.48a2.213 2.213 0 0 0-1.627-.743zM5.801 7.771c-.06.008-.12.05-.17.125l-.094.14c-.136.2-.16.57-.055.827l.631 1.535c.106.258.302.305.438.104l.094-.139c.135-.2.158-.57.052-.828l-.63-1.537C6 7.837 5.9 7.758 5.8 7.771zm4.648 7.338-1.5 6.022-.969-3.83 2.47-2.192zM10.756 5.6a2 2 0 0 0 2.33-1.6 2 2 0 0 0-1.6-2.33 2 2 0 0 0-2.33 1.6 2 2 0 0 0 1.6 2.33zM15.971 1.02h2.648v21.96h-2.648z"})});Kr.displayName="LoiteringIcon";var en=Kr;const tn=Dr({viewBox:"0 0 24 24",svg:m("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"})});tn.displayName="LuggageIcon";var rn=tn;const nn=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),m("circle",{cx:"9",cy:"5.5",r:"2.5"}),m("circle",{cx:"15",cy:"5.5",r:"2.5"}),m("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),m("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"})]})});nn.displayName="PetsIcon";var on=nn;const an=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4zm-4-8c0-.55.45-1 1-1s1 .45 1 1h-1v1h1v2h-1v1h1v2h-2V5z"})]})});an.displayName="ThermostatIcon";var ln=an;const sn=[{color:"#f44336",name:"red",highlightColor:"#ffcdd2"},{color:"#4caf50",name:"green",highlightColor:"#c8e6c9"},{color:"#2196f3",name:"blue",highlightColor:"#bbdefb"},{color:"#ffeb3b",name:"yellow",highlightColor:"#f57f17"},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:"#9e9e9e",name:"dimgrey",highlightColor:"#f5f5f5"}];new Map(sn.map((({color:e,name:t})=>[t,e])));const cn=j((({value:e,clear:t,toggle:r})=>g("div",{className:"color-selector",children:[m("div",{style:{textTransform:"uppercase"},children:ve.t("color")}),g("div",{className:"color-selector__items",children:[sn.map((({color:t,highlightColor:n,name:i})=>m("button",{type:"button",className:V("color-selector__item",{selected:e.has(i)}),style:{backgroundColor:t},onClick:r.bind(null,i),children:m(Vr,{color:n,size:20})},i))),m(Tr,{className:"color-selector__clear",disabled:!e.size,onClick:t,children:m(Ar,{size:20})})]})]})));function dn(e,t,r){return t||r?r?pe(t?[ue([e,t]),r]:[r,e]):ue([t,e]):new Date(e)}cn.displayName="ColorSelector";const hn=me((e=>new Intl.DateTimeFormat(e,{month:"long",year:"numeric"}))),un=me((e=>new Intl.DateTimeFormat(e,{weekday:"short"}))),pn=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),mn=e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),gn=b((function({onChange:e,date:t,minDate:r,maxDate:n,utc:i,startOfWeek:o="sunday"}){const[a]=C((()=>({current:i?mn(new Date):pn(new Date)}))),l=t??a.current,s=x(+l),c=C(0),[,d]=c;w((()=>{s.current=+l,d(0)}),[l?.getTime()]);const h=s.current!==+l?0:c[0],u=i?l.getUTCFullYear():l.getFullYear(),p=(i?l.getUTCMonth():l.getMonth())+h,f=i?new Date(Date.UTC(u,p)):new Date(u,p),v=i?(e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0)).getUTCDate())(f):(e=>new Date(e.getFullYear(),e.getMonth()+1,0).getDate())(f),y=(i?f.getUTCDay():f.getDay())||("monday"===o?7:0),b=y-("monday"===o?1:0),T=i?new Date(Date.UTC(u,p,1-b)):new Date(u,p,1-b),D=t?he(i?new Date(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate())):new Date(l.getFullYear(),l.getMonth(),l.getDate()),T):-1,k=r?he(r,T):Number.NEGATIVE_INFINITY,M=n?he(n,T):Number.POSITIVE_INFINITY,N=he(a.current,T);return m("div",{children:g("div",{style:{display:"flex",flexDirection:"column",fontSize:"0.875rem"},children:[g("div",{style:{fontWeight:500,height:"3rem",fontSize:"1.125rem",display:"flex",alignItems:"center"},children:[hn(ve.language).format(f),m(Tr,{style:{marginLeft:"auto"},className:"x-3deye-button--icon x-3deye-datepicker__button--previous-month",disabled:k>=b,onClick:()=>d(h-1),children:m(Mr,{size:16,style:{scale:"-1 1"}})}),m(Tr,{className:"x-3deye-button--icon x-3deye-datepicker__button--next-month",disabled:M<b+v,onClick:()=>d(h+1),children:m(Mr,{size:16})})]}),g("div",{style:{flex:1,display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"0.25rem",placeItems:"center"},children:[Array.from({length:7}).map(((e,t)=>m("div",{style:{color:"oklch(0.7 0 0)"},children:un(ve.language).format(new Date(u,p,("monday"===o?2:1)-y+t)).substring(0,2)},t))),Array.from({length:42}).map(((t,o)=>{const a=i?new Date(Date.UTC(u,p,o-b+1)):new Date(u,p,o-b+1),s=o<k||o>M;return m("div",{className:V("x-3deye-datepicker__day",{"x-3deye-datepicker__day--today":o===N,"x-3deye-datepicker__day--disabled":s,"x-3deye-datepicker__day--previous-month":o<b,"x-3deye-datepicker__day--next-month":o>=b+v,"x-3deye-datepicker__day--selected":o===D}),onClick:s?void 0:()=>{if(i){const t=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()));return e(dn(t,r,n))}const t=new Date(a.getFullYear(),a.getMonth(),a.getDate(),l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds());return e(dn(t,r,n))},children:i?a.getUTCDate():a.getDate()},o)}))]})]})})})),fn={hour:"numeric",minute:"numeric"},vn=me(((e,t,r,n=!0)=>{const i={...fn,second:n?"numeric":void 0,hour12:r||void 0,hourCycle:r?void 0:"h23",timeZone:t?"UTC":void 0};return new Intl.DateTimeFormat(e,i)})),yn=me(((e,t)=>{const r=new Intl.DateTimeFormat(e,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(new Date("1969-01-01T16:20:00Z")).find((({type:e})=>"dayPeriod"===e))?.value??"PM";return(e,n)=>{const i=e.match(/(?<hours>\d{0,2}):(?<minutes>\d{0,2})(:(?<seconds>\d{0,2}))?/);if(null===i)return new Date(NaN);let{hours:o,minutes:a,seconds:l}=i.groups;o=o.padStart(2,"0"),+o<12&&e.toLowerCase().includes(r.toLowerCase())&&(o=(+o+12).toString()),a=a.padStart(2,"0"),l=l?.padStart(2,"0")??"00";const s=new Date(n);return t?(s.setUTCHours(+o),s.setUTCMinutes(+a),s.setUTCSeconds(+l)):(s.setHours(+o),s.setMinutes(+a),s.setSeconds(+l)),s}}));function bn(e,t){const r=t?new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())):new Date(e.getFullYear(),e.getMonth(),e.getDate()),n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),24);return{hoursInDay:t?24:Math.round((+n-+r)/36e5),startOfTheDay:r}}const Cn=b((({date:e,onChange:t,hour12:r=!1,utc:n=!1})=>{const i=x(null),o=x(null),a=x(null),l=x(null),s=x(!0),[c,d]=C(vn(ve.language,n,r).format(e));T((()=>{e&&s.current&&(s.current=!1,i.current?.children[n?e.getUTCHours():e.getHours()].scrollIntoView(),o.current?.children[n?e.getUTCMinutes():e.getMinutes()].scrollIntoView(),a.current?.children[n?e.getUTCSeconds():e.getSeconds()].scrollIntoView())}));w((()=>{document.activeElement!==l.current&&d(vn(ve.language,n,r).format(e))}),[e]);const{hoursInDay:h,startOfTheDay:u}=bn(e,n);return g("div",{className:"x-3deye-timepicker",style:{display:"grid",gridTemplateRows:"3rem auto 1fr",gridTemplateColumns:"1fr 1fr 1fr"},children:[m("div",{style:{gridColumnStart:1,gridColumnEnd:4,display:"flex",alignItems:"center"},children:m("input",{ref:l,style:{height:32,margin:2},type:"text",value:c,onChange:r=>{const i=yn(ve.language,n)(r.target.value,e);var o;(o=i)instanceof Date&&!isNaN(o.getTime())&&(s.current=!0,t(i)),d(r.target.value)},onBlur:()=>{d(vn(ve.language,n,r).format(e))}})}),m("div",{ref:i,className:"x-3deye-timepicker__column",children:Array.from({length:h},((r,i)=>{const o=new Date(u.getTime()+36e5*i);return m("div",{className:V({selected:o.getUTCDate()===e.getUTCDate()&&o.getUTCHours()===e.getUTCHours()}),onClick:()=>{const r=n?e.getUTCMinutes():e.getMinutes(),i=n?e.getUTCSeconds():e.getSeconds();t(new Date(+o+60*r*1e3+1e3*i+e.getMilliseconds()))},children:m("div",{className:"x-3deye-timepicker__value",children:o[n?"getUTCHours":"getHours"]().toString().padStart(2,"0")})},i)}))}),m("div",{ref:o,className:"x-3deye-timepicker__column",children:Array.from({length:60},((r,i)=>m("div",{className:V({selected:i===e.getMinutes()}),onClick:()=>{const r=i,o=n?e.getUTCSeconds():e.getSeconds(),a=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours())+6e4*r+1e3*o);t(a)},children:m("div",{className:"x-3deye-timepicker__value",children:i.toString().padStart(2,"0")})},i)))}),m("div",{ref:a,className:"x-3deye-timepicker__column",children:Array.from({length:60},((r,i)=>m("div",{className:V({selected:i===e.getSeconds()}),onClick:()=>{const r=n?e.getUTCMinutes():e.getMinutes(),o=i,a=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours())+6e4*r+1e3*o);t(a)},children:m("div",{className:"x-3deye-timepicker__value",children:i.toString().padStart(2,"0")})},i)))})]})}));Cn.displayName="TimePicker";const xn=b((({date:e,onChange:t,utc:r=!1,hour12:n=!1})=>{const i=x(null),o=x(!0);T((()=>{e&&o.current&&(o.current=!1,i.current?.children[r?e.getUTCHours():e.getHours()].scrollIntoView({block:"center"}))}));const a=e||new Date,{hoursInDay:l,startOfTheDay:s}=bn(a,r);return m("div",{className:"x-3deye-timepicker x-3deye-timepicker--alt",children:m("div",{ref:i,className:"x-3deye-timepicker__column",children:Array.from({length:l},((i,o)=>{const a=new Date(s.getTime()+60*o*60*1e3);return m("div",{className:V({selected:!!e&&(a.getUTCDate()===e.getUTCDate()&&a.getUTCHours()===e.getUTCHours())}),onClick:()=>{t(a)},children:m("div",{className:"x-3deye-timepicker__value",children:vn(ve.language,r,n,!1).format(a)})},o)}))})})}));xn.displayName="TimePickerShort";const wn={day:"2-digit",month:"short",weekday:"short",hour:"2-digit",minute:"numeric"},Tn=Array.from({length:3}),Dn=e=>m("svg",{viewBox:"0 0 100 100",...e,children:Tn.map(((e,t)=>m("circle",{fill:"currentColor",stroke:"none",cx:20*t+6,cy:"50",r:"6",children:m("animate",{attributeName:"opacity",dur:"1s",values:"0;1;0",repeatCount:"indefinite",begin:.1*(t+1)})},t)))}),kn=D({reportError:(e,t)=>{}});class Mn extends k{static contextType=kn;state={hasError:!1};componentDidCatch(e,t){this.setState({hasError:!0}),this.context?.reportError(e,t),console.error(e),console.log(t)}render(){if(!this.state.hasError)return this.props.children;const{style:e,children:t,...r}=this.props;return g("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r,children:[m("h1",{children:"Oops. Something went wrong"}),m("div",{children:"We've been notified about this problem"}),m(Tr,{onClick:()=>this.setState({hasError:!1}),children:"retry"})]})}}const Nn=v.createContext(null),In=v.forwardRef((({className:e,children:t,title:r,...n},i)=>{const o=v.useContext(Nn);if(!o)return;const{refs:a,isNested:l,isOpen:s,hasFocusInside:c,item:d,parent:h,setHasFocusInside:u,getReferenceProps:p}=o;return g(Tr,{ref:W([a.setReference,d.ref,i]),tabIndex:l?h?.activeIndex===d.index?0:-1:void 0,role:l?"menuitem":void 0,"data-open":s?"":void 0,"data-nested":l?"":void 0,"data-focus-inside":c?"":void 0,className:V(e,{"menu-item":l,"menu-button":!l}),title:s?null:r,...p(h?.getItemProps({...n,onFocus(e){n.onFocus?.(e),u(!1),h.setHasFocusInside(!0)}})),children:[t,l&&m(Hr,{style:{marginLeft:"auto"},"aria-hidden":!0,size:20})]})}));In.displayName="MenuButton";const _n=v.forwardRef((({label:e,disabled:t,className:r,children:n,...i},o)=>{const a=v.useContext(Nn),l=Y({label:t?null:e}),s=q();if(!a)return null;const c=l.index===a.activeIndex;return m(Tr,{...i,ref:W([l.ref,o]),type:"button",role:"menuitem",className:V(r,"menu-item"),tabIndex:c?0:-1,disabled:t,...a.getItemProps({onClick(e){i.onClick?.(e),s?.events.emit("click")},onFocus(e){i.onFocus?.(e),a.setHasFocusInside(!0)}}),children:e||n})}));_n.displayName="MenuItem";const Ln=({opened:e,onOpenChange:t,children:r,target:n,placement:i,className:o,style:a,autoDismiss:l=!0,initialFocus:s,withArrow:c=!1})=>{const d=x(null),{x:h,y:u,refs:p,strategy:v,context:y,middlewareData:b,placement:C,update:w}=Z({open:e,onOpenChange:t,middleware:[G(5),Q(),X(),J({element:d})],placement:i,whileElementsMounted:(e,t,r)=>K(e,t,(()=>{0!==y.elements.domReference?.getBoundingClientRect().width?r():y.onOpenChange(!1)}),{animationFrame:!0})}),{getReferenceProps:T,getFloatingProps:D}=ee([te(y),re(y,{ancestorScroll:!0,enabled:l})]),k=M((e=>{d.current=e,w()}),[w]),N={top:"bottom",right:"left",bottom:"top",left:"right"}[C?.split("-")[0]??"top"]||"top",_=g("div",{...D({className:V("x-3deye-popover-container",o),ref:p.setFloating,style:{...a,position:v,top:u??0,left:h??0}}),children:[c&&m(Wn,{ref:k,width:24,height:8,placement:N,style:{position:"absolute",left:b.arrow?.x,top:b.arrow?.y,[N]:-7}}),r]});return g(f,{children:[I(n,T({ref:p.setReference,...n.props})),g(ne,{id:"x-3deye-floating-ui-root",children:[l&&e&&m(ie,{context:y,modal:!1,order:["reference","content"],returnFocus:!1,initialFocus:s,children:_}),!l&&e&&_]})]})},Fn=({size:e=48})=>g("svg",{role:"graphics-symbol",width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid",children:[m("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(0 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(30 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(60 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(90 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(120 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(150 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(180 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(210 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(240 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(270 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(300 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(330 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})})]});Fn.displayName="Preloader";const Sn=(e,t,r,n)=>vr(Math.floor((e-t)/r*n),0,n-1),zn=D({value:null,onPointerDown:yr,setCurrentValue:yr,state:{currentIdx:0,currentValue:null,options:[]}});class Un{currentIdx=0;options=[];get currentValue(){return this.options[this.currentIdx]}constructor(e=0){this.currentIdx=e,P(this,{currentIdx:E,options:E.ref,currentValue:U,setCurrentIdx:H,setOptions:H})}setCurrentIdx=e=>{this.currentIdx=e};setOptions=e=>{this.options=e}}var On=j(v.forwardRef((({value:e,onChange:t,children:r,style:n},i)=>{const[o,a]=C(!1),l=x(null),s=_.map(r,(e=>e?.props.value))||[],c=$((()=>new Un(s.indexOf(e))));c.setOptions(s);const d=_.count(r);w((()=>{c.setCurrentIdx(s.indexOf(e))}),[e]),w((()=>{if(!o)return;const e=l.current?.getBoundingClientRect();if(!e)return;const r=({clientX:t})=>{c.setCurrentIdx(Sn(t,e.left,e.width,d))},n=()=>{a(!1),t(s[c.currentIdx])};return document.addEventListener("pointermove",r),document.addEventListener("pointerup",n),()=>{document.removeEventListener("pointermove",r),document.removeEventListener("pointerup",n)}}),[o,d]);return m(zn.Provider,{value:{value:e,state:c,onPointerDown:e=>{const t=l.current;if(!t)return;const{left:r,width:n}=t.getBoundingClientRect(),i=Sn(e.clientX,r,n,d);i!==c.currentIdx&&c.setCurrentIdx(i),a(!0)},setCurrentValue:e=>{c.setCurrentIdx(s.indexOf(e))}},children:m("div",{className:"segmented-control-wrapper",style:n,ref:i,children:g("div",{role:"radiogroup",ref:l,className:"segmented-control",style:{"--indicator-offset":100*c.currentIdx+"%"},children:[m("div",{"aria-hidden":!0,className:V("segmented-control-indicator",{active:o}),style:{width:100/s.length+"%"},children:m("div",{className:"segmented-control-indicator-inner"})}),r]})})})})));const Pn=j(y((({value:e,children:t},r)=>{const n=L(zn);return m("button",{ref:r,role:"radio","aria-checked":n.state.currentValue===e,tabIndex:0,className:V("segmented-control-button",{current:n.state.currentValue===e}),onPointerDown:n.onPointerDown,onClick:()=>n.setCurrentValue(e),children:t})})));Pn.displayName="SegmentedControlOption";var En=Pn;const Hn=y((({active:e,children:t,className:r,style:n,...i},o)=>{const a=oe();return m("div",{ref:o,id:a,className:V("x-3deye-select-option",r),role:"option","aria-selected":e,style:{background:e?"rgb(213, 237, 255)":"none",...n},...i,children:t})})),Bn=({className:e,style:t,children:r,onCloseClick:n,...i})=>g("div",{className:V("x-3deye-select-value",e),style:t,...i,children:[r,m("button",{className:"close-button",type:"button",onClick:n,children:m(Ar,{size:12})})]}),An=(e,t,r)=>m(Bn,{...r,children:t.label},e),Rn=(e,t,r,n)=>m(Hn,{active:r,...n,children:t.label},e),jn=({options:e,values:t,inputId:r,inputValue:n,onMenuClose:i,onChange:o,onInputChange:a,onKeyDown:l,isLoading:s,placeholder:c,hideDropdownIcon:d,renderOption:h=Rn,renderValue:u=An,keyExtractor:p=e=>e.value})=>{const[v,y]=C(!1),[b,T]=C(""),D=n??b,[k,M]=C(null),N=x([]),I=x(null),{refs:_,floatingStyles:L,context:F}=Z({whileElementsMounted:K,open:v,onOpenChange:y,middleware:[Q({padding:10}),G({mainAxis:5}),ae({apply({rects:e,availableHeight:t,elements:r}){Object.assign(r.floating.style,{width:`${e.reference.width}px`,maxHeight:`${Math.min(300,t)}px`})},padding:10})]}),S=te(F,{role:"listbox"}),z=re(F),U=le(F,{listRef:N,activeIndex:k,onNavigate:M,virtual:!0,loop:!0}),{getReferenceProps:O,getFloatingProps:P,getItemProps:E}=ee([S,z,U]);const H=e?.filter((e=>{const r=p(e);return!t.some((e=>p(e)===r))&&e.label.toLowerCase().includes(D.toLowerCase().trim())}));return w((()=>{v||(T(""),i?.())}),[v,i]),g(f,{children:[g("div",{className:V("x-3deye-select-container",{"x-3deye-select-container--open":v}),ref:_.setReference,onPointerDownCapture:e=>{const t=e.target;"BUTTON"!==t.tagName&&null===t.closest("button")&&(e.preventDefault(),e.stopPropagation(),y((e=>!e)),I.current?.focus())},children:[g("div",{className:"x-3deye-multi-select-body",children:[t.map((e=>u(p(e),e,{onCloseClick:r=>{r.stopPropagation(),o(t.filter((t=>t!==e)),{action:"remove",open:v,option:e}),I.current?.focus()}}))),g("div",{className:"x-3deye-select","data-value":D,children:[t.length||D?null:m("div",{className:"x-3deye-select-placeholder",children:c}),m("input",{ref:I,size:3,id:r||void 0,...O({onChange:function(e){const t=e.target.value;T(t),a?.(t),t?(y(!0),M(0)):y(!1)},value:D,placeholder:"","aria-autocomplete":"list",onKeyDown(e){if(l?.(e),"Enter"===e.key&&null!=k&&H?.[k])return T(""),o(t.concat(H[k]),{open:v,action:"add",option:H[k]}),void M(Math.max(k-1,0));if("Backspace"!==e.key);else if(""===D&&t.length){const e=t.at(-1);if(!e)return;o(t.slice(0,t.length-1),{open:v,action:"remove",option:e})}}})})]})]}),g("div",{className:"x-3deye-select-indicators",style:{marginLeft:"auto",display:"flex",paddingRight:8,alignItems:"center"},children:[s?m(Dn,{style:{width:24}}):t.length?m(Tr,{className:"x-3deye-button--icon",onClick:()=>{o([],{open:v,action:"clear"})},children:m(Ar,{size:16})}):null,d?null:m(Pr,{size:24})]})]}),m(ne,{id:"x-3deye-floating-ui-root",children:v&&H?m(ie,{context:F,initialFocus:-1,visuallyHiddenDismiss:!0,children:m("div",{className:"x-3deye-select-menu",...P({ref:_.setFloating,style:{...L,color:"black",overflowY:"auto"}}),children:H.length?H.map(((e,r)=>h(p(e),e,k===r,{...E({ref(e){N.current[r]=e},onClick(r){r.stopPropagation(),T(""),o([...t,e],{open:v,action:"add",option:e}),I.current?.focus()}})}))):m("div",{style:{padding:10,textAlign:"center",fontSize:"0.875rem",color:"#666"},children:s?ve.t("select.loading"):ve.t("select.noOptions")})})}):null})]})},$n=e=>Math.round(e),Vn=y((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:i=!1,labelFormat:o=e=>`${e}`,style:a},l)=>{const s=x(null),c=x(null),[d,h]=C(!1),[u,p]=C(e);w((()=>{if(!d)return;const e=s.current;if(!e)return;let i=0,o=0;const a=e.getBoundingClientRect();if(!a||!a.width||!a.height)return void h(!1);const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(i=vr(e-a.x,0,a.width),l=i/a.width*100,c.current.style.transform=`translateX(${i}px)`):(o=a.height-vr(r-a.y,0,a.height),l=o/a.height*100,c.current.style.transform=`translateY(${-o}px)`),p(l),t?.($n(l))},u=({clientX:e,clientY:i})=>{if(h(!1),!c.current)return;const o="horizontal"===n?vr(e-a.x,0,a.width)/a.width*100:100*(1-vr(i-a.y,0,a.height)/a.height);c.current.style.transform="",p(o),t?.($n(o)),r?.($n(o))},m=()=>{if(h(!1),!c.current)return;const e="horizontal"===n?i/a.width*100:o/a.height*100;c.current.style.transform="",t?.($n(e)),r?.($n(e))};return document.addEventListener("pointercancel",m),document.addEventListener("pointermove",l),document.addEventListener("pointerup",u),()=>{document.removeEventListener("pointercancel",m),document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",u)}}),[d,n,t,r]);const f=M((e=>{if(!s.current||i)return;const{clientX:r,clientY:o}=e;e.preventDefault(),h(!0);const a=s.current.getBoundingClientRect();if(!a)return;if(!c.current)return;let l=0;if("horizontal"===n){const e=vr(r-a.x,0,a.width);l=e/a.width*100,c.current.style.transform=`translateX(${e}px)`}else{const e=a.height-vr(o-a.y,0,a.height);l=e/a.height*100,c.current.style.transform=`translateY(${-e}px)`}p(l),t?.($n(l))}),[i]),v=M((n=>{if(i)return;let o=null;"ArrowLeft"===n.code?o=Math.max(e-1,0):"ArrowRight"===n.code?o=Math.min(e+1,100):"ArrowDown"===n.code?o=Math.max(e-1,0):"ArrowUp"===n.code&&(o=Math.min(e+1,100)),null!==o&&(n.stopPropagation(),n.preventDefault(),t?.(o),r?.(o))}),[e,t,r,i]);return g("div",{ref:de(l,s),tabIndex:0,onKeyDown:v,className:V("x-3deye-slider",n,{disabled:i}),onPointerDown:f,style:a,children:[m("div",{className:"x-3deye-slider__track",children:m("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${d?u:e}%`:void 0,height:"vertical"===n?`${d?u:e}%`:void 0}})}),m("div",{ref:c,className:V("x-3deye-slider__thumb",{active:d}),style:{touchAction:"none",userSelect:"none",position:"absolute",left:"horizontal"===n?d?0:`${e}%`:"auto",bottom:"vertical"===n?d?0:`${e}%`:"auto"},children:null!==o&&m("div",{className:"x-3deye-slider__label "+(d?"open":""),children:o(d?$n(u):e)})})]})}));Vn.displayName="Slider";const Wn=v.forwardRef((function({width:e,height:t,placement:r="top",style:n},i){const o=[0,"top"===r?t:0],a=[e,o[1]],l=[e/2,t-o[1]],s=[e/4,t*("top"===r?3:1)/4],c=[.325*e,t-o[1]],d=[e-c[0],c[1]],h=[e-s[0],s[1]],u=e=>e.join(","),p=`M ${u(o)} C ${u(s)} ${u(c)} ${u(l)} ${u(d)} ${u(h)} ${u(a)}`;return g("svg",{ref:i,role:"graphics-symbol",className:"tip",style:n,width:e,height:t,fill:"var(--tip-background, #fff)",children:[m("path",{className:"tip-body",d:`${p} Z`}),m("path",{className:"tip-border",d:p,stroke:"var(--tip-border, transparent)",strokeWidth:1})]})}));var Yn=({children:e,label:t,placement:r="bottom",disabled:n})=>{const[i,o]=C(!1),{x:a,y:l,refs:s,strategy:c,context:d}=Z({placement:r,open:i,onOpenChange:o,middleware:[G(5),Q(),X({padding:8})],whileElementsMounted:(e,t,r)=>K(e,t,r,{animationFrame:!0})}),{getReferenceProps:h,getFloatingProps:u}=ee([se(d,{enabled:!n}),te(d,{role:"tooltip"}),re(d,{referencePress:!0})]);return g(f,{children:[I(e,h({ref:de(s.setReference,e.ref),...e.props})),m(ne,{id:"x-3deye-floating-ui-root",children:i&&m("div",{...u({ref:s.setFloating,className:"x-3deye-tooltip",style:{position:c,top:l??0,left:a??0}}),children:t})})]})};function qn({count:e,overscan:t=1,itemSize:r,horizontal:n=!1,spacing:i=0}){const[o,a]=C(),[l,s]=C(0),[c,d]=C({width:0,height:0}),h=M((e=>{a(e||void 0)}),[]);w((()=>{if(!o)return;const e=()=>{s(n?o.scrollLeft:o.scrollTop)};return o.addEventListener("scroll",e,{passive:!0,capture:!0}),()=>{o.removeEventListener("scroll",e)}}),[o,n]),w((()=>{if(!o)return;const e=new ResizeObserver((e=>{for(const t of e)t.contentBoxSize?d({width:t.contentBoxSize[0].inlineSize,height:t.contentBoxSize[0].blockSize}):d({width:t.contentRect.width,height:t.contentRect.height})}));return e.observe(o),()=>{e.disconnect()}}),[o]),w((()=>{if(!o)return;const e=o[n?"scrollLeft":"scrollTop"];e!==l&&s(e)}));return{parentRef:h,getItems:()=>{const a=[];if(!o)return a;const{height:s,width:c}=o.getBoundingClientRect(),d=Math.max(0,Math.floor(l/(r+i))-t),h=Math.ceil((n?c:s)/(r+i))+2*t;for(let t=d;t<Math.min(e,d+h);t++)a.push({idx:t,start:t*(r+i),size:r});return a},getTotalSize:()=>r*e+Math.max(e-1,0)*i}}const Zn=j((({getter:e,setter:t})=>{const[r,n]=C(0),i=x(null),o=Math.floor(100*e());return w((()=>A(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),g("div",{ref:i,style:{paddingLeft:8,paddingRight:8,marginTop:5,marginBottom:10},children:[g("div",{style:{display:"flex",justifyContent:"space-between"},children:[m("div",{style:{textTransform:"uppercase"},children:ve.t("confidence")}),g("div",{style:{fontSize:"1.1em"},children:[o,"%"]})]}),m("div",{style:{padding:"0 10px"},children:m(Vn,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})})]})}));Zn.displayName="ProbabilitySlider";const Gn=j((({from:e,to:t})=>{const{account:{preferences:{utc:r,hour12:n}}}=L(ye);return m(f,{children:Ie(e,t,{locale:ve.language,utc:r,hour12:n})})}));Gn.displayName="DisplayPeriod";class Qn{from=null;to=null;probabilityThreshold=.5;cameras=[];detectedObjects=[];colors=new Set;regions=null;eventTypes=[];sortDirection="DESC";updated$=new p;get regionsWkt(){return this.regions?this.regions.map((e=>this.regionToWktPolygon(e))):[]}constructor(){P(this,{from:E,to:E,probabilityThreshold:E,cameras:E.struct,detectedObjects:E.struct,regions:E.ref,eventTypes:E.struct,sortDirection:E,colors:E.ref,filterJson:U}),A((()=>({from:this.from?+this.from:void 0,to:this.to?+this.to:void 0,sortDirection:this.sortDirection,filter:this.filterJson,cameraFilters:this.cameras,eventTypes:this.eventTypes,regions:this.regions})),(()=>this.updated$.next(null)))}apply(e){let t=e;const{from:r,to:n}=this;if(r&&(t=t.filter((e=>e.startTime>=r))),n&&(t=t.filter((e=>e.startTime<=n))),this.cameras.length&&(t=t.filter((e=>this.cameras.includes(e.cameraId)))),this.eventTypes.length){const e=this.eventTypes.map((e=>Ce[e]));t=t.filter((t=>e.includes(t.type)))}return 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)&&"Colors"in e&&e.Colors?.some((e=>this.colors.has(e.Color))):this.detectedObjects.includes(e.Type))}))))),!this.detectedObjects.length&&this.colors.size&&(t=t.filter((e=>e.detectedObjects.some((e=>{const{probabilityThreshold:t}=this;return!(null!==t&&e.Probability<t)&&("Colors"in e&&e.Colors?.some((e=>this.colors.has(e.Color))))}))))),t}get filterJson(){const{probabilityThreshold:e}=this;if(null===e)return null;const t={And:[]};return this.detectedObjects.length&&t.And.push({Or:this.detectedObjects.map((e=>({Type:e})))}),this.colors.size&&t.And.push({Or:[...this.colors].map((e=>({ObjectColors:[e]})))}),t.And.push({Or:[{Probability:e}]}),JSON.stringify(t)}regionToWktPolygon(e){return e.length?"POLYGON (("+e.concat(e[0]).map((({x:e,y:t})=>`${e} ${t}`)).join(", ")+"))":"POLYGON (())"}}class Xn extends br{cameraFilters=[];objectFilters=[];eventTypeFilters=[];date=null;setDate=e=>{this.date=e};clearDate=()=>{this.date=null,this.applyFilters()};resetDate=()=>{this.loaderFilters.from||this.loaderFilters.to||(this.date=null,this.sortDirection="DESC"),this.loaderFilters.from&&(this.date=this.loaderFilters.from,this.sortDirection="ASC"),this.loaderFilters.to&&(this.date=this.loaderFilters.to,this.sortDirection="DESC")};sortDirection="DESC";probabilityThreshold=.5;colors=new Set;disposables=[];loader;loaderFilters;get someAnalyticsFilterSelected(){return!!this.objectFilters.length||!!this.colors.size}get filters(){return this.objectFilters.concat(this.eventTypeFilters,this.cameraFilters)}constructor(e){super(),P(this,{cameraFilters:E.ref,objectFilters:E.ref,date:E,setDate:H,clearDate:H,resetDate:H,sortDirection:E,probabilityThreshold:E,setProbabilityThreshold:H,colors:E.ref,someAnalyticsFilterSelected:U,filters:U,setFilters:H,load:H,toggleColor:H,clearColors:H,applyFilters:H,toggleSorting:H});const t=new Qn;this.loaderFilters=t;const r=(e=>(t,r)=>t.cameras.GetSensorEventsPage({sensorIds:e.cameras,sensorType:"camera",sensorEventTypes:e.eventTypes,startTime:e.from??void 0,endTime:e.to??void 0,isDescending:"DESC"===e.sortDirection,rowsLimit:10,pageToken:r},e.filterJson,e.regionsWkt))(t);this.loader=new Cr(e,t,r),B((()=>{this.loader.loading=!0,this.loaderFilters.probabilityThreshold=null}))}toggleSorting=()=>{this.sortDirection="ASC"===this.sortDirection?"DESC":"ASC",null===this.date&&(this.date=ke(function(e){const t=e.getMinutes(),r=e.getSeconds(),n=e.getMilliseconds();return new Date(e.getTime()-60*t*1e3-1e3*r-n)}(new Date),1))};load(){this.loader.load()}applyFilters=()=>{this.loaderFilters.cameras=this.cameraFilters.map((e=>e.value)),this.loaderFilters.detectedObjects=this.objectFilters.map((e=>e.value)),this.loaderFilters.colors=this.colors,this.loaderFilters.probabilityThreshold=this.objectFilters.length||this.colors.size?this.probabilityThreshold:null,this.loaderFilters.eventTypes=this.eventTypeFilters.map((e=>e.value)),this.date?"ASC"===this.sortDirection?(this.loaderFilters.sortDirection="ASC",this.loaderFilters.to=null,this.loaderFilters.from=this.date):(this.loaderFilters.sortDirection="DESC",this.loaderFilters.from=null,this.loaderFilters.to=this.date??void 0):(this.loaderFilters.sortDirection="DESC",this.loaderFilters.from=null,this.loaderFilters.to=null)};setFilters(e){this.cameraFilters=e?e.filter((e=>"camera"===e.type)):[],this.eventTypeFilters=e?e.filter((e=>"eventType"===e.type)):[],this.objectFilters=e?e.filter((e=>"detectedObject"===e.type)):[]}getProbabilityThreshold=()=>this.probabilityThreshold;setProbabilityThreshold=e=>{this.probabilityThreshold=e,this.applyFilters()};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.loader.initWith(this.api)}dispose(){for(const e of this.disposables)e instanceof i?e.closed||e.unsubscribe():e();this.loader.dispose()}}const Jn=Dr({viewBox:"0 96 960 960",svg:m(f,{children:m("path",{d:"m513 988-57-18 14-42q3-9 4-17.6 1-8.6 1-17.2 0-17.2-3.912-32.473Q467.176 845.455 456 828q-15.938-26.26-22.969-48.63Q426 757 425 727.844q0-11.844 2.5-27.344Q430 685 434 672l13-42 57 18-14 42q-3 9-4 19t-1 19q0 19 4 32t15 30q15.97 25.948 23.485 49.974Q535 864 535 892.933q0 13.067-2.5 26.567T526 946l-13 42Zm-176 0-57-18 14-42q3-9 4-17.049t1-17.707q0-18.244-4-34.744T280 827q-15.03-21.658-23.015-46.612Q249 755.433 249 728.125 249 714 251 700t7-28l13-42 57 18-14 42q-3 9.771-4 20.086-1 10.314-1 17.914 0 21.065 5.5 36.033Q320 779 328 791q15 22 23 48.5t8 52.802Q359 905 356.5 919t-6.5 27l-13 42Zm348 0-57-18 14-42q3-9 4-17.6 1-8.6 1-17.2 0-17.2-4.5-34.7Q638 841 628 827q-15-21-23-47t-8-52.047q0-13.953 2-27.794 2-13.841 7-28.159l13-42 57 18-14 42q-4 11-4.5 19.438-.5 8.437-.5 18.562 0 18.491 4.471 32.632Q665.941 774.772 676 790q16 23 23.5 48.887 7.5 25.886 7.5 53.69 0 13.423-2.5 26.923Q702 933 698 946l-13 42ZM180 336h600v-60H180v60Zm139 120h322l18-60H301l18 60Zm0 60q-19.5 0-35.25-11.625T262 474l-25-78h-57q-24.75 0-42.375-17.625T120 336V216h720v120q0 25-17.625 42.5T780 396h-57l-30 81q-6.932 17.25-22.338 28.125Q655.257 516 636 516H319ZM180 336v-60 60Z"})})});Jn.displayName="DetectorSmokeIcon";var Kn=Jn;const ei=({data:e})=>{const t=16;return"eventType"===e.type&&e.value===Ce.Loitering?m(en,{size:16}):"camera"===e.type?m(Sr,{size:t}):"Luggage"===e.value?m(rn,{size:t}):"Car"===e.value?m(Ur,{size:t}):"Person"===e.value?m(jr,{size:t}):"Bicycle"===e.value?m(Ir,{size:t}):"Boat"===e.value?m(Lr,{size:t}):"Animal"===e.value?m(on,{size:t}):"LicensePlate"===e.value?m(Jr,{size:t}):"Smoke"===e.value?m(Kn,{size:t}):"Fire"===e.value?m(Zr,{size:t}):m(Qr,{size:t})},ti=(e,t,r,n)=>g(Hn,{style:{color:"detectedObject"===t.type?t.color:"black",display:"camera"===t.type?"flex":"inline-flex",gap:4},...n,active:r,children:["camera"!==t.type?m(ei,{data:t}):null,t.label]},e),ri=(e,t,r)=>g(Bn,{style:{"--color":"color"in t&&t.color?t.color:void 0,color:"color"in t&&t.color?"white":void 0,"--background-color":"color"in t&&t.color?"rgba(255, 255, 255, 0.7)":void 0},...r,children:[m(ei,{data:t}),t.label]},e),ni=j((({camerasOnly:e,store:t})=>{const{cameras:r,eventSchema:n}=L(ye),i=(()=>{if(!n)return[];if(e)return r.data.map((e=>({type:"camera",value:e.id,label:e.name})));const t=[{value:Ce.Loitering,label:ve.t("eventTypes.Loitering").toLowerCase(),type:"eventType"}];return[].concat(n.foundObjectTypesForSelect.map((e=>({...e,label:ve.t(`analytics.${e.label}`)}))),t,r.data.map((e=>({type:"camera",value:e.id,label:e.name}))))})();return m(jn,{onChange:(e,r)=>{t.setFilters(e),r.open||"remove"!==r.action&&"clear"!==r.action||t.applyFilters()},onMenuClose:()=>{t.applyFilters()},options:i,renderOption:ti,values:t.filters,renderValue:ri,keyExtractor:e=>`${e.type}:${e.value}`,placeholder:g(f,{children:[m(Yr,{size:16})," ",ve.t("filter")]})})}));ni.displayName="EventGridSelect";const ii=j((({store:e})=>{const{date:t,setDate:r,clearDate:n,resetDate:i,sortDirection:o,toggleSorting:a,applyFilters:l}=e,{account:s}=L(ye),{utc:c,hour12:d,startOfWeek:h}=s.preferences,[u,p]=C(!1),f=N((()=>((e,t,r,n=!0)=>{const i={...wn,second:n?"numeric":void 0,hour12:r||void 0,hourCycle:r?void 0:"h23",timeZone:t?"UTC":void 0,timeZoneName:t?"short":void 0};return new Intl.DateTimeFormat(e,i)})(ve.language,c,d)),[ve.language,c,d]),v=g("div",{style:{flex:1,display:"flex",position:"relative"},children:[g(Tr,{className:"date-button",style:{flex:1,borderRadius:0,textTransform:"uppercase",flexDirection:"row"},onClick:()=>p(!u),children:[g("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[t?m("label",{children:"ASC"===o?ve.t("eventSearchFilter.after"):ve.t("eventSearchFilter.before")}):null,m("span",{children:t?f.format(t):ve.t("eventSearchFilter.recentEvents")})]}),m(Pr,{})]}),t?m(Tr,{className:"x-3deye-button--icon",style:{position:"absolute",right:32},onClick:n,children:m(Ar,{size:16})}):null]});return w((()=>{u||i()}),[u,i]),m("div",{className:"event-grid-datepicker",children:m("div",{style:{position:"relative"},children:m(Ln,{target:v,opened:u,onOpenChange:p,withArrow:!0,className:"popover-datetimepicker",children:g("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[g(On,{value:o,onChange:a,children:[m(En,{value:"DESC",children:ve.t("eventSearchFilter.before")}),m(En,{value:"ASC",children:ve.t("eventSearchFilter.after")})]}),g("div",{style:{display:"flex",gap:"0.5rem"},children:[m(gn,{date:t,onChange:r,utc:c,startOfWeek:h}),m(xn,{date:t,onChange:r,utc:c,hour12:d})]}),m(Tr,{onClick:()=>{l(),p(!1)},variant:"filled",fullWidth:!0,children:ve.t("button.ok")})]})})})})}));ii.displayName="EventGridDatepicker";const oi=j((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:i})=>{const o=x(null),{ref:a,menuContext:l}=function(){const[e,t]=C(!1),[r,n]=C(),i=M((e=>{n(e||void 0)}),[]),[o]=C((()=>new Set)),[a]=C((()=>new Set)),l=N((()=>({subscribe:e=>(o.add(e),()=>o.delete(e)),onOpenChange:e=>(a.add(e),()=>a.delete(e)),setOpened:e=>{t(e);for(const t of a)t(e)}})),[]);return w((()=>{if(r)return r.addEventListener("contextmenu",e),()=>{r.removeEventListener("contextmenu",e)};function e(e){e.preventDefault();for(const t of o)t(e)}}),[r]),{ref:i,menuContext:l,opened:e}}();return g("div",{ref:de(o,a),onDragStart:t=>{if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",`${e.id}`),t.dataTransfer.setData("x-3deye/camera",`${e.cameraId}`),t.dataTransfer.setData("x-3deye/starttime",e.startTime.toISOString()),t.dataTransfer.dropEffect="move";const r=o.current?.querySelector("img");if(r){const{x:e,y:n}=r.getBoundingClientRect();t.dataTransfer.setDragImage(r,t.clientX-e,t.clientY-n)}},className:"event-list-item",onClick:()=>r?.(e),onAuxClick:t=>n?.(t,e),draggable:!0,children:[t,i&&m(i,{ctx:l,data:e})]})}));oi.displayName="EventListItem";const ai=j((({data:e})=>{if("Temperature"!==e.type)return null;const t=Number(e.raw.data);return g("div",{className:"event-list-item__temperature",children:[m(ln,{}),g("span",{children:[(t-273.15).toFixed(1),"°C"]})," / ",g("span",{children:[(9*t/5-459.67).toFixed(1)," °F"]})]})}));ai.displayName="Temperature";var li=ai;const si=j((({data:e,cameraNameHidden:t})=>{const r=L(ye),{cameras:n}=r,i=n.loaded&&n.camerasById.get(e.cameraId)?.name||"...";return g("div",{className:"event-list-item-caption",children:[m("div",{className:"event-list-item__time",children:m(Gn,{from:e.startTime,to:e.endTime})}),t?null:g(f,{children:[m("div",{children:e.type}),m("div",{className:"event-list-item__camera-name",title:i,children:i})]}),+e.endTime-+e.startTime>0&&m("div",{className:"event-list-item__duration",children:fr(+e.endTime-+e.startTime,ve.t)}),m(li,{data:e})]})}));si.displayName="EventListItemCaption";var ci=j((({url:e,noPreview:t,width:r})=>g(f,{children:[e?m("img",{style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e},e):null,m(ce,{radius:r}),t?m("div",{className:"no-preview-overlay"}):null]})));const di=({className:e,style:t,box:{Top:r,Left:n,Right:i,Bottom:o}})=>m(f,{children:m("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-o)+"%",right:100*(1-i)+"%",...t}})});function hi({style:e}){return g("div",{className:"frame",style:e,children:[m("div",{className:"corner-highlight-tl"}),m("div",{className:"corner-highlight-tr"}),m("div",{className:"corner-highlight-br"}),m("div",{className:"corner-highlight-bl"})]})}di.displayName="LicensePlateLpr";const ui=b((({value:e})=>e?m(f,{children:e.split("").map(((e,t)=>(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57})(e)?m("span",{className:"digit",children:e},`d${t}${e}`):m("span",{className:"char",children:e},`${t}${e}`)))}):null));ui.displayName="LicensePlateNumber";const pi=({detectedObject:e,height:t,width:r,url:n,thumbWidth:i,thumbHeight:o})=>{const{Type:a,Box:{Top:l,Left:s,Right:c,Bottom:d},Probability:h,Value:u}=e,p=x(null);T((()=>{if(!p.current)return;const e=p.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,i=l*t-e.height-4;i<0&&(i=d*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),p.current.style.top=`${i}px`,p.current.style.left=`${n}px`}));const v={top:2};s>=1-c?v.left=2:v.right=2;const y=100/i/(c-s);return g(f,{children:[g("div",{ref:p,className:"event-list-item__license-plate-label trigger",title:`${a.toLowerCase()} ${Math.floor(100*h)}%`,children:[m("div",{style:{padding:4},children:m(ui,{value:u})}),m("div",{className:"event-list-item__license-plate-label__caption",children:`${Math.floor(100*h)}%`})]}),m(di,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),g("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:i*(c-s)*y,height:o*(d-l)*y+16,position:"absolute",...v},children:[m("img",{style:{width:i*y,height:o*y,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),m("div",{className:"plate-number",children:m(ui,{value:u})}),m(hi,{style:{height:o*(d-l)*y}})]})]})};function mi(e,t,r,n){return e.Top<-n&&(e.Bottom=e.Bottom-e.Top+n,e.Top=-n),e.Left<-n&&(e.Right=e.Right-e.Left+n,e.Left=-n),e.Right+n>t&&(e.Left=e.Left-(e.Right-t)+n,e.Right=t-n),e.Bottom+n>r&&(e.Top=e.Top-(e.Bottom-r)+n,e.Bottom=r-n),e}function gi({Top:e,Left:t,Bottom:r,Right:n},i,o,a,l){const s=l*e,c=l*r;return s>o?[0,-1]:c>o?[0,1]:a*t>i?[-1,0]:a*n>i?[1,0]:[0,s>c?1:-1]}function fi(e,t){return{Top:e.Top+t[1],Left:e.Left+t[0],Bottom:e.Bottom+t[1],Right:e.Right+t[0]}}pi.displayName="LicensePlateHighlight";const vi=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:i,thumbHeight:o,width:a,height:l})=>{const{Top:s,Left:c,Right:d,Bottom:h}=t,u=100/i/(d-c),p={top:2},v=x(null);return T((()=>{if(!v.current)return;const{width:e,height:r}=v.current.getBoundingClientRect(),n=gi(t,e,r,a,l);n[0]=n[0]*(e+(d-c)*a)/2,n[1]=n[1]*(r+(h-s)*l)/2;const i=mi(fi({Top:(s+h)/2*l-r/2,Left:(c+d)/2*a-e/2,Bottom:(s+h)/2*l+r/2,Right:(c+d)/2*a+e/2},n),a,l,0);v.current.style.top=`${i.Top+2*Math.sign(n[1])}px`,v.current.style.left=`${i.Left+2*Math.sign(n[0])}px`})),c>=1-d?p.left=2:p.right=2,g(f,{children:[g("div",{ref:v,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`,children:[m("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"},children:e}),g("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"},children:[Math.floor(100*r),"%"]})]}),m(di,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),g("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:i*(d-c)*u,height:o*(h-s)*u,...p},children:[m("img",{style:{width:i*u,height:o*u,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),m(hi,{})]})]})};function yi({Top:e,Left:t,Bottom:r,Right:n}){return[(t+n)/2,(e+r)/2]}function bi(e,t){const[r,n]=yi(e),[i,o]=yi(t);return[i-r,o-n]}function Ci(e,t){return!(e.Left>t.Right||e.Top>t.Bottom||e.Right<t.Left||e.Bottom<t.Top)}function xi([e,t]){const r=Math.sqrt(e*e+t*t);return 0===r?[0,0]:[e/r,t/r]}vi.displayName="FaceHighlight";const wi=j((({data:e,width:t,height:r})=>{const n=x(null),{eventSchema:i}=L(ye);return T((()=>{if(!n.current)return;const i=[],o=[];for(let a=0;a<e.length;a++){const l=n.current.children[2*a+1],s=e[a].Box;i.push({Top:s.Top*r,Left:s.Left*t,Bottom:s.Bottom*r,Right:s.Right*t});const[c,d]=yi(i[a]),{width:h,height:u}=l.getBoundingClientRect(),p=gi(s,h,u,t,r);o.push(fi({Top:d-u/2-4,Left:c-h/2-4,Bottom:d+u/2+4,Right:c+h/2+4},p))}let a=!0,l=0;for(;a;){if(a=!1,l++>1e3){console.warn("Reached max iterations for label positioning");break}for(let t=0;t<e.length;t++){const r=o[t],n=[0,0];for(let l=0;l<e.length;l++){const e=i[l],s=o[l];if(Ci(r,e)){const t=bi(e,r);n[0]=n[0]+t[0],n[1]=n[1]+t[1],a=!0}if(l!==t&&Ci(r,s)){const e=bi(s,r);n[0]=n[0]+e[0],n[1]=n[1]+e[1],a=!0}}[n[0],n[1]]=xi(n),r.Top+=n[1],r.Left+=n[0],r.Bottom+=n[1],r.Right+=n[0]}}for(let i=0;i<e.length;i++){const e=n.current.children[2*i+1],{Top:a,Left:l}=mi(o[i],t,r,4);e.style.top=`${a+4}px`,e.style.left=`${l+4}px`}}),[e,t,r]),m("div",{ref:n,children:e.map(((e,t)=>g(v.Fragment,{children:[m(di,{box:e.Box,style:{outline:`2px solid ${i.colorsByFoundObjectType.get(e.Type)??""}`}}),g("div",{className:"event-list-item__detected-object-label",title:`${e.Type.toLowerCase()} ${Math.floor(100*e.Probability)}%`,children:[m("div",{style:{padding:4,lineHeight:"24px"},children:"Car"===e.Type&&"BodyType"in e&&e.BodyType?e.BodyType.toLowerCase():e.Type.toLowerCase()}),g("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:i.colorsByFoundObjectType.get(e.Type)},children:[Math.floor(100*e.Probability),"%"]})]})]},t)))})}));wi.displayName="DetectedObjects";var Ti=wi;const Di=j((({data:e,width:t,height:r,cameraNameHidden:n,onClick:i,onAuxClick:o,menuComponent:a})=>{const l=L(ye),{eventSchema:s}=l,[c,d]=function(e){const[t,r]=C(null),n=L(ye),{cameras:i,thumbnails:o}=n;w((()=>{if(e.thumbnailUrl)return void r(null);const t=o.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{r(e||null)}));return()=>t.unsubscribe()}),[e.id]);let a="",l=!1;return e.thumbnailUrl?a=e.thumbnailUrl:null===t&&i.loaded?(a=i.camerasById.get(e.cameraId)?.imageUrl||"",l=!0):t&&(a=t.url),[a,l]}(e);let h=[],u=null,p=null;if(e.detectedObjects.length){const{thumbnailWidth:n,thumbnailHeight:i}=e;h=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)),u=e.detectedObjects.filter((e=>"LicensePlate"===e.Type)).map(((e,o)=>m(pi,{detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:i,url:c},o)))}if(e.faces){const{thumbnailWidth:n,thumbnailHeight:i}=e;p=e.faces.map(((e,o)=>m(vi,{face:e,url:c,thumbWidth:n,thumbHeight:i,width:t,height:r},o)))}return m(oi,{onClick:i,onAuxClick:o,data:e,width:t,height:r,menuComponent:a,children:g("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0},children:[m(ci,{url:c,noPreview:d,width:t}),m(Ti,{data:h,width:t,height:r}),u,p,e.acknowledged?m("div",{className:"acknowledged-overlay",children:ve.t("event.acknowledged")}):null,m(si,{data:e,cameraNameHidden:n})]})})}));Di.displayName="EventItem";const ki=j((({columnIndex:e,rowIndex:t,style:r,store:n,columnCount:i,eventRenderer:o})=>{const a=t*i+e,l=n.data[a];return a===n.data.length?n.error?m("div",{style:r,children:m("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"},children:g("div",{style:{textAlign:"center"},children:[m("div",{children:"Couldn't fetch more data"}),m(Tr,{onClick:n.loadMore,children:"Retry"})]})})}):n.pageInfo?.haveMore?m("div",{style:r,children:m("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"},children:m(Fn,{size:32})})}):m("div",{style:r}):!l&&n.pageInfo?.haveMore?m("div",{style:r}):m("div",l?{style:r,children:m(Mn,{children:o({data:l,width:r.width,height:r.height})})}:{style:r})})),Mi=j((({store:e,scrollWidth:t,onClick:r})=>e.pendingData.length?m("div",{style:{position:"absolute",top:0,left:0,right:t,pointerEvents:"none",textAlign:"center",padding:8},children:m(Tr,{className:"x-3deye-button--overlay",style:{background:"rgba(0, 0, 0, 0.75)",padding:"8px 16px",backdropFilter:"blur(2px)",borderRadius:32,pointerEvents:"auto"},onClick:r,children:ve.t("showEvents",{count:e.pendingData.length})})}):null)),Ni=j((({store:e,width:t,height:r,captionHeight:n=0,columnsCount:i=0,minColumnWidth:o,aspectRatio:a=16/9,onEventClick:l,onEventAuxClick:s,eventRenderer:c})=>{const d=x(null),h=()=>{d.current&&(e.setLiveUpdateMode("auto"),d.current.scrollTop=0)};if(w((()=>A((()=>e.loading||!e.data.length),(e=>e&&h()))),[]),e.error&&!e.data.length)return m("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"},children:g("div",{style:{textAlign:"center"},children:[m("div",{children:"Couldn't fetch data"}),m(Tr,{onClick:e.reload,children:"Retry"})]})});if(e.loading)return m("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"},children:m(Fn,{})});if(!e.data.length)return m("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"},children:ve.t("noEventsFound")});return m(Ii,{...{store:e,width:t,columnsCount:i,minColumnWidth:o,aspectRatio:a,captionHeight:n,height:r,onEventClick:l,onEventAuxClick:s,eventRenderer:c,containerRef:d,resetScroll:h}})}));Ni.displayName="EventGrid";const Ii=j((({store:e,width:t,height:r,captionHeight:n=0,columnsCount:i=0,minColumnWidth:o=320,aspectRatio:a,containerRef:l,onEventClick:s,onEventAuxClick:c,eventRenderer:d=({data:e,width:t,height:r})=>m(Di,{data:e.data,cameraNameHidden:!1,onClick:s,onAuxClick:c,width:t,height:r}),resetScroll:h})=>{const u=Math.floor(t/o)||1,p=t/u/a+n,f=u*Math.floor(r/p)>=e.data.length?0:gr(),v=Math.min(i,e.data.length)||Math.max(1,Math.floor((t-f)/o));let y=Math.ceil(e.data.length/v);const b=(t-f-2*(v-1))/v,C=b/a+n;e.pageInfo?.haveMore&&y*v===e.data.length&&y++;const{parentRef:x,getItems:T,getTotalSize:D}=qn({count:y,overscan:5,itemSize:C,spacing:2}),{parentRef:k,getItems:M,getTotalSize:N}=qn({count:v,overscan:5,itemSize:b,horizontal:!0,spacing:2}),I=T(),_=M();w((()=>{e.error||e.pageInfo?.haveMore&&(e.loading||I.length&&I.at(-1).idx+1===y&&e.loadMore())}),[e.error,e.pageInfo?.haveMore,I]);const L=I.flatMap((({idx:t,size:r,start:n})=>_.map((({idx:i,size:o,start:a})=>{const l=t*v+i;return l>e.data.length?null:l!==e.data.length||e.pageInfo?.haveMore?m(ki,{columnIndex:i,rowIndex:t,columnCount:v,style:{position:"absolute",top:0,left:0,height:r,width:o,transform:`translate(${a}px, ${n}px)`,display:"flex"},store:e,eventRenderer:d},e.data[l]?`${e.data[l].data.id}-${e.data[l].objectIdx}`:"loading"):null}))));return g("div",{style:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},children:[m("div",{ref:de(l,x,k),style:{width:t,height:r,overflow:"auto"},onScroll:t=>{const{scrollTop:r}=t.target;"disabled"!==e.liveUpdateMode&&e.setLiveUpdateMode(r>=1||e.pendingData.length?"manual":"auto")},children:m("div",{style:{position:"relative",height:D(),width:N()},children:L})}),m(Mi,{store:e,scrollWidth:f,onClick:()=>{e.flushUpdates(),h()}})]})})),_i=({onEventClick:e,style:t,...r})=>{const n=L(F)??S,[i,o]=C(),{ref:a,width:l,height:s}=(e=>{const{ref:t,width:r,height:n}=z(),[i,o]=C(0);return w((()=>{o((e=>e+1))}),e),{ref:t,width:r,height:n,fix:i}})([i]);return w((()=>(i?.dispose(),R((()=>n.initialized),(()=>{const e=new Xn(n.events);e.initWith(n.api),e.load(),o(e)})))),[n]),m(ye.Provider,{value:n,children:i?g("div",{style:{display:"flex",flexDirection:"column",textAlign:"left",...t},...r,children:[m("div",{style:{padding:10},children:m(ni,{store:i})}),m(ii,{store:i}),i.someAnalyticsFilterSelected&&g(f,{children:[m(Zn,{getter:i.getProbabilityThreshold,setter:i.setProbabilityThreshold}),m(cn,{value:i.colors,toggle:i.toggleColor,clear:i.clearColors})]}),m("div",{ref:a,style:{flex:1,display:"flex"},children:m(Ni,{minColumnWidth:Number.POSITIVE_INFINITY,store:i.loader,width:l,height:s,eventRenderer:({data:t,width:r,height:n})=>m(Di,{data:t.data,cameraNameHidden:!1,onClick:e,width:r,height:n})})})]}):null})};_i.displayName="EventList";var Li=_i;(e=>{if(e&&Object.assign(fe,e),ve.isInitialized){if(fe.resources)for(const e of Object.keys(fe.resources))ve.addResourceBundle(e,"translation",fe.resources[e].translation,!0);else console.warn("i18n is already initialized");return t(ve.t)}r(ve.init(fe))})({resources:{en:{translation:ge}}});export{Xn as AllEventsStore,Li as default};
|
|
1
|
+
import e from"i18next";import{of as t,from as r,Observable as n,Subscription as i,mergeMap as o,throwError as a,catchError as l,startWith as s,switchMap as c,map as d,exhaustMap as h,EMPTY as u,Subject as p}from"rxjs";import{jsx as m,jsxs as g,Fragment as f}from"react/jsx-runtime";import v,{forwardRef as y,memo as b,useState as C,useRef as x,useEffect as w,useLayoutEffect as T,createContext as D,Component as k,useCallback as N,useMemo as M,cloneElement as I,Children as _,useContext as L}from"react";import{AppContext as S,app as F}from"@3deye-toolkit/core";import{useElementSize as z}from"@mantine/hooks";import{computed as U,observe as O,makeObservable as P,observable as E,action as H,runInAction as B,reaction as A,when as R}from"mobx";import{observer as j,useLocalObservable as $}from"mobx-react-lite";import V from"clsx";import{useMergeRefs as W,useListItem as Y,useFloatingTree as q,useFloating as Z,offset as G,flip as Q,shift as X,arrow as J,autoUpdate as K,useInteractions as ee,useRole as te,useDismiss as re,FloatingPortal as ne,FloatingFocusManager as ie,useId as oe,size as ae,useListNavigation as le,useHover as se}from"@floating-ui/react";import ce from"react-ink";import de from"@seznam/compose-react-refs";import{differenceInCalendarDays as he,max as ue,min as pe}from"date-fns";import me from"memoize-one";var ge={showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events",noEventsFound:"no events found",eventSearchFilter:{after:"After",before:"Before",recentEvents:"Recent events"},button:{ok:"Ok"},eventTypes:{Normal:"Normal",Suspicious:"Suspicious",Misidentification:"Misidentification",Loitering:"Loitering",Vandalism:"Vandalism",Trespass:"Trespass",Emergency:"Emergency",LifeInDanger:"Life in Danger",ErroneousAlert:"Erroneous Alert",Fire:"Fire",MedicalDuress:"Medical Duress",HoldUp:"Hold Up",CheckIn:"Check In",CheckOut:"Check Out",ClockIn:"Clock In",ClockOut:"Clock Out",ParkingStart:"Parking Start",ParkingEnd:"Parking End",ParkingViolation:"Parking Violation",GateAccess:"Gate Access",DoorAccess:"Door Access",TemperatureCheck:"Temperature Check",IDCheck:"ID Check",PPECheck:"PPE Check",WelfareCheck:"Welfare Check",VehicleBreakIn:"Vehicle Break-In",DrugTrafficking:"Drug Trafficking",Assault:"Assault",PackageDelivery:"Package Delivery",Uncategorized:"Uncategorized"},filter:"Filter",event:{acknowledged:"acknowledged"},color:"color",confidence:"confidence",select:{loading:"Loading...",noOptions:"No options"},duration:{minute:"minute",hour:"hour",day:"day",ss:"{{seconds}}s",mm:"{{minutes}}m",hh:"{{hours}}h",mmss:"{{minutes}}m {{seconds}}s",hhmm:"{{hours}}h {{minutes}}m",hhmmss:"{{hours}}h {{minutes}}m {{seconds}}s"},analytics:{car:"car",person:"person",animal:"animal",bicycle:"bicycle",luggage:"luggage",boat:"boat",hardhat:"hardhat",nohardhat:"no hardhat",licenseplate:"license plate",smoke:"smoke",fire:"fire",vest:"vest",novest:"no vest"}};const fe={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},ve=e.createInstance(),ye=v.createContext(null);function be(e,t=!1){const r=U(e);return new n((e=>{const n=O(r,(({newValue:t})=>e.next(t)),t);return()=>n()}))}var Ce;!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.VehicleBreakIn=40]="VehicleBreakIn",e[e.DrugTrafficking=41]="DrugTrafficking",e[e.Assault=42]="Assault",e[e.PackageDelivery=43]="PackageDelivery",e[e.Uncategorized=999]="Uncategorized"}(Ce||(Ce={}));const xe=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput","Loitering"]);class we{id;cameraId;type;raw;thumbnailUrl;thumbnailWidth=0;thumbnailHeight=0;detectedObjects;faces;instant;get startTime(){return new Date(this.raw.startTime)}get endTime(){return new Date(this.raw.endTime)}get isLive(){return!xe.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}update=e=>{this.raw=e};constructor(e){if(P(this,{startTime:U,endTime:U,acknowledged:U,isLive:U,raw:E.ref,update:H}),this.raw=e,this.id=e.id,this.type=e.eventType,this.cameraId=e.sensorId,("Analytic"===this.type||"FaceDetection"===this.type||"Loitering"===this.type)&&e.data)try{const t=JSON.parse(e.data);t.FoundObjects&&(this.detectedObjects=t.FoundObjects),t.Faces&&(this.type="FaceDetection",this.faces=t.Faces),t.ThumbnailSize&&(this.thumbnailWidth=t.ThumbnailSize.Width,this.thumbnailHeight=t.ThumbnailSize.Height),this.thumbnailUrl=t.ThumbnailUrl}catch{console.warn("invalid data",e.data),this.type="Motion"}this.instant=xe.has(this.type),this.detectedObjects||(this.detectedObjects=[])}}const Te=(e,t,r)=>r?e.getUTCFullYear()===t.getUTCFullYear()&&e.getUTCMonth()===t.getUTCMonth()&&e.getUTCDate()===t.getUTCDate():e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),De=(e,t,r)=>r?e.getUTCFullYear()===t.getUTCFullYear():e.getFullYear()===t.getFullYear();function ke(e,t){return new Date(e.getTime()-60*t*60*1e3)}const Ne=(e,{locale:t,utc:r=!1,hour12:n=!1,seconds:i,year:o=!1,dayOfWeek:a=!1,day:l=!1})=>{const s={hour:"numeric",minute:"numeric",hour12:n||void 0,hourCycle:n?void 0:"h23"};return r&&(s.timeZone="UTC"),i&&(s.second="numeric"),o&&(s.year="numeric"),a&&(s.weekday="short"),l&&(s.day="numeric",s.month="short"),new Intl.DateTimeFormat(t,s).format(e)},Me=(e,t)=>t?e.getUTCSeconds():e.getSeconds();function Ie(e,t,{locale:r,utc:n=!1,hour12:i=!1}={}){let o="",a="";const l=Boolean(Me(e,n)||Me(t,n)),s={from:!1,to:!1},c={from:!1,to:!1},d={from:!1,to:!1};return De(e,new Date,n)?Te(e,new Date,n)||(Te(e,t,n)?(d.from=!0,c.from=!0):(d.from=!0,c.from=!0,d.to=!0,c.to=!0)):(s.from=!0,d.from=!0,d.to=!0,s.to=!De(e,t,n)),o=Ne(e,{locale:r,utc:n,hour12:i,seconds:l,year:s.from,dayOfWeek:c.from,day:d.from}),+e==+t?o:(a=Ne(t,{locale:r,utc:n,hour12:i,seconds:l,year:s.to,dayOfWeek:c.to,day:d.to}),`${o} - ${a}`)}var _e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Le(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Se="object"==typeof _e&&_e&&_e.Object===Object&&_e,Fe="object"==typeof self&&self&&self.Object===Object&&self,ze=Se||Fe||Function("return this")(),Ue=ze.Symbol,Oe=Ue,Pe=Object.prototype,Ee=Pe.hasOwnProperty,He=Pe.toString,Be=Oe?Oe.toStringTag:void 0;var Ae=function(e){var t=Ee.call(e,Be),r=e[Be];try{e[Be]=void 0;var n=!0}catch(e){}var i=He.call(e);return n&&(t?e[Be]=r:delete e[Be]),i},Re=Object.prototype.toString;var je=Ae,$e=function(e){return Re.call(e)},Ve=Ue?Ue.toStringTag:void 0;var We=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ye=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ve&&Ve in Object(e)?je(e):$e(e)},qe=We;var Ze,Ge=function(e){if(!qe(e))return!1;var t=Ye(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Qe=ze["__core-js_shared__"],Xe=(Ze=/[^.]+$/.exec(Qe&&Qe.keys&&Qe.keys.IE_PROTO||""))?"Symbol(src)_1."+Ze:"";var Je=function(e){return!!Xe&&Xe in e},Ke=Function.prototype.toString;var et=Ge,tt=Je,rt=We,nt=function(e){if(null!=e){try{return Ke.call(e)}catch(e){}try{return e+""}catch(e){}}return""},it=/^\[object .+?Constructor\]$/,ot=Function.prototype,at=Object.prototype,lt=ot.toString,st=at.hasOwnProperty,ct=RegExp("^"+lt.call(st).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var dt=function(e){return!(!rt(e)||tt(e))&&(et(e)?ct:it).test(nt(e))},ht=function(e,t){return null==e?void 0:e[t]};var ut=function(e,t){var r=ht(e,t);return dt(r)?r:void 0},pt=ut(Object,"create"),mt=pt;var gt=function(){this.__data__=mt?mt(null):{},this.size=0};var ft=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},vt=pt,yt=Object.prototype.hasOwnProperty;var bt=function(e){var t=this.__data__;if(vt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return yt.call(t,e)?t[e]:void 0},Ct=pt,xt=Object.prototype.hasOwnProperty;var wt=function(e){var t=this.__data__;return Ct?void 0!==t[e]:xt.call(t,e)},Tt=pt;var Dt=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Tt&&void 0===t?"__lodash_hash_undefined__":t,this},kt=gt,Nt=ft,Mt=bt,It=wt,_t=Dt;function Lt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Lt.prototype.clear=kt,Lt.prototype.delete=Nt,Lt.prototype.get=Mt,Lt.prototype.has=It,Lt.prototype.set=_t;var St=Lt;var Ft=function(){this.__data__=[],this.size=0};var zt=function(e,t){return e===t||e!=e&&t!=t};var Ut=function(e,t){for(var r=e.length;r--;)if(zt(e[r][0],t))return r;return-1},Ot=Ut,Pt=Array.prototype.splice;var Et=function(e){var t=this.__data__,r=Ot(t,e);return!(r<0)&&(r==t.length-1?t.pop():Pt.call(t,r,1),--this.size,!0)},Ht=Ut;var Bt=function(e){var t=this.__data__,r=Ht(t,e);return r<0?void 0:t[r][1]},At=Ut;var Rt=Ut;var jt=function(e,t){var r=this.__data__,n=Rt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},$t=Ft,Vt=Et,Wt=Bt,Yt=function(e){return At(this.__data__,e)>-1},qt=jt;function Zt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Zt.prototype.clear=$t,Zt.prototype.delete=Vt,Zt.prototype.get=Wt,Zt.prototype.has=Yt,Zt.prototype.set=qt;var Gt=Zt,Qt=ut(ze,"Map"),Xt=St,Jt=Gt,Kt=Qt;var er=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var tr=function(e,t){var r=e.__data__;return er(t)?r["string"==typeof t?"string":"hash"]:r.map},rr=tr;var nr=tr;var ir=tr;var or=tr;var ar=function(e,t){var r=or(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},lr=function(){this.size=0,this.__data__={hash:new Xt,map:new(Kt||Jt),string:new Xt}},sr=function(e){var t=rr(this,e).delete(e);return this.size-=t?1:0,t},cr=function(e){return nr(this,e).get(e)},dr=function(e){return ir(this,e).has(e)},hr=ar;function ur(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ur.prototype.clear=lr,ur.prototype.delete=sr,ur.prototype.get=cr,ur.prototype.has=dr,ur.prototype.set=hr;var pr=ur;function mr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(mr.Cache||pr),r}mr.Cache=pr;const gr=Le(mr)((()=>{const e=document.createElement("div");e.style.overflowY="scroll",e.style.position="absolute",e.style.top="-9999px",document.body.append(e);const t=e.offsetWidth;return e.remove(),t}));function fr(e,t,r=!0){if((e=Math.round(e/1e3))<60)return t("duration.ss",{seconds:e});const n=e%60;let i=(e-n)/60;if(i<60)return!n&&r?t("duration.mm",{minutes:i}):t("duration.mmss",{minutes:i,seconds:`${n}`.padStart(2,"0")});const o=Math.floor(i/60);if(i-=60*o,!n&&!i&&r)return t("duration.hh",{hours:o});const a=r?`${i}`:`${i}`.padStart(2,"0");return!n&&i&&r?t("duration.hhmm",{hours:o,minutes:a}):t("duration.hhmmss",{hours:o,minutes:a,seconds:`${n}`.padStart(2,"0")})}const vr=(e,t,r)=>Math.min(Math.max(e,t),r),yr=()=>{};class br{api;disposables=[];initWith(e){this.api=e,this.afterInit&&this.afterInit()}dispose(){for(const e of this.disposables)e instanceof i?e.closed||e.unsubscribe():e()}}class Cr extends br{eventsStore;filters;fetcher;transformData;data=[];pendingData=[];liveUpdateMode="auto";disposables=[];pageInfo=null;loading=!1;loadMoreTrigger=0;retryTrigger=0;error=null;loadingInitiated=!1;get isLive(){return"DESC"===this.filters.sortDirection&&!this.filters.to}constructor(e,t,r,n=e=>[{data:e,objectIdx:-1}]){super(),this.eventsStore=e,this.filters=t,this.fetcher=r,this.transformData=n,P(this,{data:E.ref,pendingData:E.ref,liveUpdateMode:E,setLiveUpdateMode:H,flushUpdates:H,pageInfo:E.ref,isLive:U,loading:E,loadMoreTrigger:E,retryTrigger:E,error:E.ref,loadMore:H})}flushUpdates=()=>{this.data=[...this.pendingData,...this.data],this.pendingData=[]};setLiveUpdateMode=e=>{this.liveUpdateMode=e};load=()=>{this.loadingInitiated||(this.loadingInitiated=!0,this.initDataLoading(),this.initLiveUpdates())};reload=()=>{this.error&&(this.retryTrigger=+!this.retryTrigger)};loadMore=()=>{this.error=null,this.loadMoreTrigger=+!this.loadMoreTrigger};queryEvents=e=>this.fetcher(this.api,e).pipe(o((e=>e.success?t({events:e.resultItems,pageInfo:e.pageInfo}):a((()=>e.error)))),l((e=>(console.error(e),this.error=e,t({events:[],pageInfo:null})))));initDataLoading(){this.disposables.push(this.filters.updated$.pipe(s(null),c((e=>be((()=>this.retryTrigger),!0).pipe(d((()=>e))))),c((()=>(B((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[],this.pendingData=[]})),this.queryEvents())))).subscribe((({events:e,pageInfo:t})=>{B((()=>{if(!t)return;const r=e.map(xr);this.isLive?this.data=this.uniquelyConcat(this.filters.apply(this.eventsStore.getEvents({cameraIds:this.filters.cameras,from:r[0]?.startTime??ke(new Date,1),to:null,probability:this.filters.probabilityThreshold??void 0})),r).flatMap(this.transformData):this.data=r.flatMap(this.transformData),this.eventsStore.add(r),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(this.filters.updated$.pipe(s(null),c((()=>be((()=>this.loadMoreTrigger)).pipe(h((()=>this.queryEvents(this.pageInfo?.nextPageToken))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(xr);this.eventsStore.add(r),B((()=>{this.data=this.data.concat(r.flatMap(this.transformData)),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(be((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(c((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?be((()=>this.eventsStore.recentAdditions)):u))).subscribe((e=>{if(this.loading)return;if(!this.pageInfo&&this.error)return;const t=this.filters.apply(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&B((()=>{this.data=[...t.flatMap(this.transformData),...this.data]}))}))),this.disposables.push(be((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(c((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?be((()=>this.eventsStore.recentAdditions)):(this.pendingData&&B((()=>this.pendingData=[])),u)))).subscribe((e=>{if(!this.data.length)return;const t=this.filters.apply(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&B((()=>{this.pendingData=[...t.flatMap(this.transformData),...this.pendingData]}))})))}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(){for(const e of this.disposables)e instanceof i?e.closed||e.unsubscribe():e()}}function xr(e){return new we(e)}const wr=({forwardedRef:e,children:t,className:r,fullWidth:n,variant:i,type:o,title:a,placement:l,...s})=>{const c=V(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},i?`x-3deye-button--${i}`:void 0),d=g("button",{ref:e,className:c,type:o||"button",...s,children:[t,s.disabled?null:m(ce,{})]});return void 0===a?d:m(Yn,{label:a,placement:l,disabled:!a,children:d})};var Tr=y(((e,t)=>m(wr,{forwardedRef:t,...e})));function Dr(e){return y(((t,r)=>{const{size:n=24,color:i="currentColor",className:o,...a}=t,l=e.viewBox||"0 0 24 24",s=e.svg;return m("svg",{ref:r,preserveAspectRatio:"xMinYMin",className:V("icon",o),width:n,fill:i,viewBox:l,...a,children:s})}))}const kr=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M5.88 4.12L13.76 12l-7.88 7.88L8 22l10-10L8 2z"}),m("path",{fill:"none",d:"M0 0h24v24H0z"})]})});kr.displayName="ArrowForwardIcon";var Nr=kr;const Mr=Dr({viewBox:"0 0 24 24",svg:m(f,{children:m("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"})})});Mr.displayName="BicycleIcon";var Ir=Mr;const _r=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});_r.displayName="BoatIcon";var Lr=_r;const Sr=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});Sr.displayName="CameraIcon";var Fr=Sr;const zr=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});zr.displayName="CarIcon";var Ur=zr;const Or=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z"}),m("path",{d:"M0-.75h24v24H0z",fill:"none"})]})});Or.displayName="ChevronDownIcon";var Pr=Or;const Er=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),m("path",{d:"M0 0h24v24H0z",fill:"none"})]})});Er.displayName="ChevronRightIcon";var Hr=Er;const Br=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("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"}),m("path",{d:"M0 0h24v24H0z",fill:"none"})]})});Br.displayName="CloseIcon";var Ar=Br;const Rr=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});Rr.displayName="DirectionsWalkIcon";var jr=Rr;const $r=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{fill:"none",d:"M0 0h24v24H0z"}),m("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"})]})});$r.displayName="DoneIcon";var Vr=$r;const Wr=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),m("path",{d:"M0 0h24v24H0z",fill:"none"})]})});Wr.displayName="FilterListIcon";var Yr=Wr;const qr=Dr({viewBox:"0 0 24 24",svg:m(f,{children:m("path",{d:"M19.48,12.35c-1.57-4.08-7.16-4.3-5.81-10.23c0.1-0.44-0.37-0.78-0.75-0.55C9.29,3.71,6.68,8,8.87,13.62 c0.18,0.46-0.36,0.89-0.75,0.59c-1.81-1.37-2-3.34-1.84-4.75c0.06-0.52-0.62-0.77-0.91-0.34C4.69,10.16,4,11.84,4,14.37 c0.38,5.6,5.11,7.32,6.81,7.54c2.43,0.31,5.06-0.14,6.95-1.87C19.84,18.11,20.6,15.03,19.48,12.35z M10.2,17.38 c1.44-0.35,2.18-1.39,2.38-2.31c0.33-1.43-0.96-2.83-0.09-5.09c0.33,1.87,3.27,3.04,3.27,5.08C15.84,17.59,13.1,19.76,10.2,17.38z"})})});qr.displayName="FireIcon";var Zr=qr;const Gr=Dr({viewBox:"0 0 24 24",svg:g("g",{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("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"})]})});Gr.displayName="LabelIcon";var Qr=Gr;const Xr=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M4 4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H5Zm0 2h4v2h8V6h4v12H4Z"}),m("path",{d:"M9.923 10 8.43 12.433 10 15h-.8L8 13.036 6.8 15H6l1.602-2.616L6.136 10h.8l1.093 1.781L9.123 10Z"}),m("path",{d:"m13.709 10-1.492 2.433L13.787 15h-.8l-1.2-1.964L10.585 15h-.8l1.603-2.616L9.923 10h.799l1.094 1.781L12.91 10Z"}),m("path",{d:"m17.709 10-1.492 2.433L17.787 15h-.8l-1.2-1.964L14.585 15h-.8l1.603-2.616L13.923 10h.799l1.094 1.781L16.91 10Z"})]})});Xr.displayName="LicensePlateIcon";var Jr=Xr;const Kr=Dr({viewBox:"0 0 24 24",svg:m("path",{d:"M12.703 5.787a2.171 2.171 0 0 0-1.334.438c-.511.788-.8 1.614-1.217 3.267l-3.172.91a.499.499 0 0 0-.341.62l.13.455a.5.5 0 0 0 .62.343l2.328-.67-.377 1.31-3.96 3.827 1.53 6.693h3.78l2.67-10.14 1.29-4.51V7.01l-.32-.48a2.213 2.213 0 0 0-1.627-.743zM5.801 7.771c-.06.008-.12.05-.17.125l-.094.14c-.136.2-.16.57-.055.827l.631 1.535c.106.258.302.305.438.104l.094-.139c.135-.2.158-.57.052-.828l-.63-1.537C6 7.837 5.9 7.758 5.8 7.771zm4.648 7.338-1.5 6.022-.969-3.83 2.47-2.192zM10.756 5.6a2 2 0 0 0 2.33-1.6 2 2 0 0 0-1.6-2.33 2 2 0 0 0-2.33 1.6 2 2 0 0 0 1.6 2.33zM15.971 1.02h2.648v21.96h-2.648z"})});Kr.displayName="LoiteringIcon";var en=Kr;const tn=Dr({viewBox:"0 0 24 24",svg:m("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"})});tn.displayName="LuggageIcon";var rn=tn;const nn=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),m("circle",{cx:"9",cy:"5.5",r:"2.5"}),m("circle",{cx:"15",cy:"5.5",r:"2.5"}),m("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),m("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"})]})});nn.displayName="PetsIcon";var on=nn;const an=Dr({viewBox:"0 0 24 24",svg:g(f,{children:[m("path",{d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4zm-4-8c0-.55.45-1 1-1s1 .45 1 1h-1v1h1v2h-1v1h1v2h-2V5z"})]})});an.displayName="ThermostatIcon";var ln=an;const sn=[{color:"#f44336",name:"red",highlightColor:"#ffcdd2"},{color:"#4caf50",name:"green",highlightColor:"#c8e6c9"},{color:"#2196f3",name:"blue",highlightColor:"#bbdefb"},{color:"#ffeb3b",name:"yellow",highlightColor:"#f57f17"},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:"#9e9e9e",name:"dimgrey",highlightColor:"#f5f5f5"}];new Map(sn.map((({color:e,name:t})=>[t,e])));const cn=j((({value:e,clear:t,toggle:r})=>g("div",{className:"color-selector",children:[m("div",{style:{textTransform:"uppercase"},children:ve.t("color")}),g("div",{className:"color-selector__items",children:[sn.map((({color:t,highlightColor:n,name:i})=>m("button",{type:"button",className:V("color-selector__item",{selected:e.has(i)}),style:{backgroundColor:t},onClick:r.bind(null,i),children:m(Vr,{color:n,size:20})},i))),m(Tr,{className:"color-selector__clear",disabled:!e.size,onClick:t,children:m(Ar,{size:20})})]})]})));function dn(e,t,r){return t||r?r?pe(t?[ue([e,t]),r]:[r,e]):ue([t,e]):new Date(e)}cn.displayName="ColorSelector";const hn=me((e=>new Intl.DateTimeFormat(e,{month:"long",year:"numeric"}))),un=me((e=>new Intl.DateTimeFormat(e,{weekday:"short"}))),pn=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),mn=e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),gn=b((function({onChange:e,date:t,minDate:r,maxDate:n,utc:i,startOfWeek:o="sunday"}){const[a]=C((()=>({current:i?mn(new Date):pn(new Date)}))),l=t??a.current,s=x(+l),c=C(0),[,d]=c;w((()=>{s.current=+l,d(0)}),[l?.getTime()]);const h=s.current!==+l?0:c[0],u=i?l.getUTCFullYear():l.getFullYear(),p=(i?l.getUTCMonth():l.getMonth())+h,f=i?new Date(Date.UTC(u,p)):new Date(u,p),v=i?(e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0)).getUTCDate())(f):(e=>new Date(e.getFullYear(),e.getMonth()+1,0).getDate())(f),y=(i?f.getUTCDay():f.getDay())||("monday"===o?7:0),b=y-("monday"===o?1:0),T=i?new Date(Date.UTC(u,p,1-b)):new Date(u,p,1-b),D=t?he(i?new Date(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate())):new Date(l.getFullYear(),l.getMonth(),l.getDate()),T):-1,k=r?he(r,T):Number.NEGATIVE_INFINITY,N=n?he(n,T):Number.POSITIVE_INFINITY,M=he(a.current,T);return m("div",{children:g("div",{style:{display:"flex",flexDirection:"column",fontSize:"0.875rem"},children:[g("div",{style:{fontWeight:500,height:"3rem",fontSize:"1.125rem",display:"flex",alignItems:"center"},children:[hn(ve.language).format(f),m(Tr,{style:{marginLeft:"auto"},className:"x-3deye-button--icon x-3deye-datepicker__button--previous-month",disabled:k>=b,onClick:()=>d(h-1),children:m(Nr,{size:16,style:{scale:"-1 1"}})}),m(Tr,{className:"x-3deye-button--icon x-3deye-datepicker__button--next-month",disabled:N<b+v,onClick:()=>d(h+1),children:m(Nr,{size:16})})]}),g("div",{style:{flex:1,display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"0.25rem",placeItems:"center"},children:[Array.from({length:7}).map(((e,t)=>m("div",{style:{color:"oklch(0.7 0 0)"},children:un(ve.language).format(new Date(u,p,("monday"===o?2:1)-y+t)).substring(0,2)},t))),Array.from({length:42}).map(((t,o)=>{const a=i?new Date(Date.UTC(u,p,o-b+1)):new Date(u,p,o-b+1),s=o<k||o>N;return m("div",{className:V("x-3deye-datepicker__day",{"x-3deye-datepicker__day--today":o===M,"x-3deye-datepicker__day--disabled":s,"x-3deye-datepicker__day--previous-month":o<b,"x-3deye-datepicker__day--next-month":o>=b+v,"x-3deye-datepicker__day--selected":o===D}),onClick:s?void 0:()=>{if(i){const t=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()));return e(dn(t,r,n))}const t=new Date(a.getFullYear(),a.getMonth(),a.getDate(),l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds());return e(dn(t,r,n))},children:i?a.getUTCDate():a.getDate()},o)}))]})]})})})),fn={hour:"numeric",minute:"numeric"},vn=me(((e,t,r,n=!0)=>{const i={...fn,second:n?"numeric":void 0,hour12:r||void 0,hourCycle:r?void 0:"h23",timeZone:t?"UTC":void 0};return new Intl.DateTimeFormat(e,i)})),yn=me(((e,t)=>{const r=new Intl.DateTimeFormat(e,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(new Date("1969-01-01T16:20:00Z")).find((({type:e})=>"dayPeriod"===e))?.value??"PM";return(e,n)=>{const i=e.match(/(?<hours>\d{0,2}):(?<minutes>\d{0,2})(:(?<seconds>\d{0,2}))?/);if(null===i)return new Date(NaN);let{hours:o,minutes:a,seconds:l}=i.groups;o=o.padStart(2,"0"),+o<12&&e.toLowerCase().includes(r.toLowerCase())&&(o=(+o+12).toString()),a=a.padStart(2,"0"),l=l?.padStart(2,"0")??"00";const s=new Date(n);return t?(s.setUTCHours(+o),s.setUTCMinutes(+a),s.setUTCSeconds(+l)):(s.setHours(+o),s.setMinutes(+a),s.setSeconds(+l)),s}}));function bn(e,t){const r=t?new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())):new Date(e.getFullYear(),e.getMonth(),e.getDate()),n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),24);return{hoursInDay:t?24:Math.round((+n-+r)/36e5),startOfTheDay:r}}const Cn=b((({date:e,onChange:t,hour12:r=!1,utc:n=!1})=>{const i=x(null),o=x(null),a=x(null),l=x(null),s=x(!0),[c,d]=C(vn(ve.language,n,r).format(e));T((()=>{e&&s.current&&(s.current=!1,i.current?.children[n?e.getUTCHours():e.getHours()].scrollIntoView(),o.current?.children[n?e.getUTCMinutes():e.getMinutes()].scrollIntoView(),a.current?.children[n?e.getUTCSeconds():e.getSeconds()].scrollIntoView())}));w((()=>{document.activeElement!==l.current&&d(vn(ve.language,n,r).format(e))}),[e]);const{hoursInDay:h,startOfTheDay:u}=bn(e,n);return g("div",{className:"x-3deye-timepicker",style:{display:"grid",gridTemplateRows:"3rem auto 1fr",gridTemplateColumns:"1fr 1fr 1fr"},children:[m("div",{style:{gridColumnStart:1,gridColumnEnd:4,display:"flex",alignItems:"center"},children:m("input",{ref:l,style:{height:32,margin:2},type:"text",value:c,onChange:r=>{const i=yn(ve.language,n)(r.target.value,e);var o;(o=i)instanceof Date&&!isNaN(o.getTime())&&(s.current=!0,t(i)),d(r.target.value)},onBlur:()=>{d(vn(ve.language,n,r).format(e))}})}),m("div",{ref:i,className:"x-3deye-timepicker__column",children:Array.from({length:h},((r,i)=>{const o=new Date(u.getTime()+36e5*i);return m("div",{className:V({selected:o.getUTCDate()===e.getUTCDate()&&o.getUTCHours()===e.getUTCHours()}),onClick:()=>{const r=n?e.getUTCMinutes():e.getMinutes(),i=n?e.getUTCSeconds():e.getSeconds();t(new Date(+o+60*r*1e3+1e3*i+e.getMilliseconds()))},children:m("div",{className:"x-3deye-timepicker__value",children:o[n?"getUTCHours":"getHours"]().toString().padStart(2,"0")})},i)}))}),m("div",{ref:o,className:"x-3deye-timepicker__column",children:Array.from({length:60},((r,i)=>m("div",{className:V({selected:i===e.getMinutes()}),onClick:()=>{const r=i,o=n?e.getUTCSeconds():e.getSeconds(),a=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours())+6e4*r+1e3*o);t(a)},children:m("div",{className:"x-3deye-timepicker__value",children:i.toString().padStart(2,"0")})},i)))}),m("div",{ref:a,className:"x-3deye-timepicker__column",children:Array.from({length:60},((r,i)=>m("div",{className:V({selected:i===e.getSeconds()}),onClick:()=>{const r=n?e.getUTCMinutes():e.getMinutes(),o=i,a=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours())+6e4*r+1e3*o);t(a)},children:m("div",{className:"x-3deye-timepicker__value",children:i.toString().padStart(2,"0")})},i)))})]})}));Cn.displayName="TimePicker";const xn=b((({date:e,onChange:t,utc:r=!1,hour12:n=!1})=>{const i=x(null),o=x(!0);T((()=>{e&&o.current&&(o.current=!1,i.current?.children[r?e.getUTCHours():e.getHours()].scrollIntoView({block:"center"}))}));const a=e||new Date,{hoursInDay:l,startOfTheDay:s}=bn(a,r);return m("div",{className:"x-3deye-timepicker x-3deye-timepicker--alt",children:m("div",{ref:i,className:"x-3deye-timepicker__column",children:Array.from({length:l},((i,o)=>{const a=new Date(s.getTime()+60*o*60*1e3);return m("div",{className:V({selected:!!e&&(a.getUTCDate()===e.getUTCDate()&&a.getUTCHours()===e.getUTCHours())}),onClick:()=>{t(a)},children:m("div",{className:"x-3deye-timepicker__value",children:vn(ve.language,r,n,!1).format(a)})},o)}))})})}));xn.displayName="TimePickerShort";const wn={day:"2-digit",month:"short",weekday:"short",hour:"2-digit",minute:"numeric"},Tn=Array.from({length:3}),Dn=e=>m("svg",{viewBox:"0 0 100 100",...e,children:Tn.map(((e,t)=>m("circle",{fill:"currentColor",stroke:"none",cx:20*t+6,cy:"50",r:"6",children:m("animate",{attributeName:"opacity",dur:"1s",values:"0;1;0",repeatCount:"indefinite",begin:.1*(t+1)})},t)))}),kn=D({reportError:(e,t)=>{}});class Nn extends k{static contextType=kn;state={hasError:!1};componentDidCatch(e,t){this.setState({hasError:!0}),this.context?.reportError(e,t),console.error(e),console.log(t)}render(){if(!this.state.hasError)return this.props.children;const{style:e,children:t,...r}=this.props;return g("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r,children:[m("h1",{children:"Oops. Something went wrong"}),m("div",{children:"We've been notified about this problem"}),m(Tr,{onClick:()=>this.setState({hasError:!1}),children:"retry"})]})}}const Mn=v.createContext(null),In=v.forwardRef((({className:e,children:t,title:r,...n},i)=>{const o=v.useContext(Mn);if(!o)return;const{refs:a,isNested:l,isOpen:s,hasFocusInside:c,item:d,parent:h,setHasFocusInside:u,getReferenceProps:p}=o;return g(Tr,{ref:W([a.setReference,d.ref,i]),tabIndex:l?h?.activeIndex===d.index?0:-1:void 0,role:l?"menuitem":void 0,"data-open":s?"":void 0,"data-nested":l?"":void 0,"data-focus-inside":c?"":void 0,className:V(e,{"menu-item":l,"menu-button":!l}),title:s?null:r,...p(h?.getItemProps({...n,onFocus(e){n.onFocus?.(e),u(!1),h.setHasFocusInside(!0)}})),children:[t,l&&m(Hr,{style:{marginLeft:"auto"},"aria-hidden":!0,size:20})]})}));In.displayName="MenuButton";const _n=v.forwardRef((({label:e,disabled:t,className:r,children:n,...i},o)=>{const a=v.useContext(Mn),l=Y({label:t?null:e}),s=q();if(!a)return null;const c=l.index===a.activeIndex;return m(Tr,{...i,ref:W([l.ref,o]),type:"button",role:"menuitem",className:V(r,"menu-item"),tabIndex:c?0:-1,disabled:t,...a.getItemProps({onClick(e){i.onClick?.(e),s?.events.emit("click")},onFocus(e){i.onFocus?.(e),a.setHasFocusInside(!0)}}),children:e||n})}));_n.displayName="MenuItem";const Ln=({opened:e,onOpenChange:t,children:r,target:n,placement:i,className:o,style:a,autoDismiss:l=!0,initialFocus:s,withArrow:c=!1})=>{const d=x(null),{x:h,y:u,refs:p,strategy:v,context:y,middlewareData:b,placement:C,update:w}=Z({open:e,onOpenChange:t,middleware:[G(5),Q(),X(),J({element:d})],placement:i,whileElementsMounted:(e,t,r)=>K(e,t,(()=>{0!==y.elements.domReference?.getBoundingClientRect().width?r():y.onOpenChange(!1)}),{animationFrame:!0})}),{getReferenceProps:T,getFloatingProps:D}=ee([te(y),re(y,{ancestorScroll:!0,enabled:l})]),k=N((e=>{d.current=e,w()}),[w]),M={top:"bottom",right:"left",bottom:"top",left:"right"}[C?.split("-")[0]??"top"]||"top",_=g("div",{...D({className:V("x-3deye-popover-container",o),ref:p.setFloating,style:{...a,position:v,top:u??0,left:h??0}}),children:[c&&m(Wn,{ref:k,width:24,height:8,placement:M,style:{position:"absolute",left:b.arrow?.x,top:b.arrow?.y,[M]:-7}}),r]});return g(f,{children:[I(n,T({ref:p.setReference,...n.props})),g(ne,{id:"x-3deye-floating-ui-root",children:[l&&e&&m(ie,{context:y,modal:!1,order:["reference","content"],returnFocus:!1,initialFocus:s,children:_}),!l&&e&&_]})]})},Sn=({size:e=48})=>g("svg",{role:"graphics-symbol",width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid",children:[m("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(0 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(30 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(60 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(90 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(120 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(150 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(180 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(210 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(240 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(270 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(300 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})}),m("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(330 50 50) translate(0 -30)",children:m("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})})]});Sn.displayName="Preloader";const Fn=(e,t,r,n)=>vr(Math.floor((e-t)/r*n),0,n-1),zn=D({value:null,onPointerDown:yr,setCurrentValue:yr,state:{currentIdx:0,currentValue:null,options:[]}});class Un{currentIdx=0;options=[];get currentValue(){return this.options[this.currentIdx]}constructor(e=0){this.currentIdx=e,P(this,{currentIdx:E,options:E.ref,currentValue:U,setCurrentIdx:H,setOptions:H})}setCurrentIdx=e=>{this.currentIdx=e};setOptions=e=>{this.options=e}}var On=j(v.forwardRef((({value:e,onChange:t,children:r,style:n},i)=>{const[o,a]=C(!1),l=x(null),s=_.map(r,(e=>e?.props.value))||[],c=$((()=>new Un(s.indexOf(e))));c.setOptions(s);const d=_.count(r);w((()=>{c.setCurrentIdx(s.indexOf(e))}),[e]),w((()=>{if(!o)return;const e=l.current?.getBoundingClientRect();if(!e)return;const r=({clientX:t})=>{c.setCurrentIdx(Fn(t,e.left,e.width,d))},n=()=>{a(!1),t(s[c.currentIdx])};return document.addEventListener("pointermove",r),document.addEventListener("pointerup",n),()=>{document.removeEventListener("pointermove",r),document.removeEventListener("pointerup",n)}}),[o,d]);return m(zn.Provider,{value:{value:e,state:c,onPointerDown:e=>{const t=l.current;if(!t)return;const{left:r,width:n}=t.getBoundingClientRect(),i=Fn(e.clientX,r,n,d);i!==c.currentIdx&&c.setCurrentIdx(i),a(!0)},setCurrentValue:e=>{c.setCurrentIdx(s.indexOf(e))}},children:m("div",{className:"segmented-control-wrapper",style:n,ref:i,children:g("div",{role:"radiogroup",ref:l,className:"segmented-control",style:{"--indicator-offset":100*c.currentIdx+"%"},children:[m("div",{"aria-hidden":!0,className:V("segmented-control-indicator",{active:o}),style:{width:100/s.length+"%"},children:m("div",{className:"segmented-control-indicator-inner"})}),r]})})})})));const Pn=j(y((({value:e,children:t},r)=>{const n=L(zn);return m("button",{ref:r,role:"radio","aria-checked":n.state.currentValue===e,tabIndex:0,className:V("segmented-control-button",{current:n.state.currentValue===e}),onPointerDown:n.onPointerDown,onClick:()=>n.setCurrentValue(e),children:t})})));Pn.displayName="SegmentedControlOption";var En=Pn;const Hn=y((({active:e,children:t,className:r,style:n,...i},o)=>{const a=oe();return m("div",{ref:o,id:a,className:V("x-3deye-select-option",r),role:"option","aria-selected":e,style:{background:e?"rgb(213, 237, 255)":"none",...n},...i,children:t})})),Bn=({className:e,style:t,children:r,onCloseClick:n,...i})=>g("div",{className:V("x-3deye-select-value",e),style:t,...i,children:[r,m("button",{className:"close-button",type:"button",onClick:n,children:m(Ar,{size:12})})]}),An=(e,t,r)=>m(Bn,{...r,children:t.label},e),Rn=(e,t,r,n)=>m(Hn,{active:r,...n,children:t.label},e),jn=({options:e,values:t,inputId:r,inputValue:n,onMenuClose:i,onChange:o,onInputChange:a,onKeyDown:l,isLoading:s,placeholder:c,hideDropdownIcon:d,renderOption:h=Rn,renderValue:u=An,keyExtractor:p=e=>e.value})=>{const[v,y]=C(!1),[b,T]=C(""),D=n??b,[k,N]=C(null),M=x([]),I=x(null),{refs:_,floatingStyles:L,context:S}=Z({whileElementsMounted:K,open:v,onOpenChange:y,middleware:[Q({padding:10}),G({mainAxis:5}),ae({apply({rects:e,availableHeight:t,elements:r}){Object.assign(r.floating.style,{width:`${e.reference.width}px`,maxHeight:`${Math.min(300,t)}px`})},padding:10})]}),F=te(S,{role:"listbox"}),z=re(S),U=le(S,{listRef:M,activeIndex:k,onNavigate:N,virtual:!0,loop:!0}),{getReferenceProps:O,getFloatingProps:P,getItemProps:E}=ee([F,z,U]);const H=e?.filter((e=>{const r=p(e);return!t.some((e=>p(e)===r))&&e.label.toLowerCase().includes(D.toLowerCase().trim())}));return w((()=>{v||(T(""),i?.())}),[v,i]),g(f,{children:[g("div",{className:V("x-3deye-select-container",{"x-3deye-select-container--open":v}),ref:_.setReference,onPointerDownCapture:e=>{const t=e.target;"BUTTON"!==t.tagName&&null===t.closest("button")&&(e.preventDefault(),e.stopPropagation(),y((e=>!e)),I.current?.focus())},children:[g("div",{className:"x-3deye-multi-select-body",children:[t.map((e=>u(p(e),e,{onCloseClick:r=>{r.stopPropagation(),o(t.filter((t=>t!==e)),{action:"remove",open:v,option:e}),I.current?.focus()}}))),g("div",{className:"x-3deye-select","data-value":D,children:[t.length||D?null:m("div",{className:"x-3deye-select-placeholder",children:c}),m("input",{ref:I,size:3,id:r||void 0,...O({onChange:function(e){const t=e.target.value;T(t),a?.(t),t?(y(!0),N(0)):y(!1)},value:D,placeholder:"","aria-autocomplete":"list",onKeyDown(e){if(l?.(e),"Enter"===e.key&&null!=k&&H?.[k])return T(""),o(t.concat(H[k]),{open:v,action:"add",option:H[k]}),void N(Math.max(k-1,0));if("Backspace"!==e.key);else if(""===D&&t.length){const e=t.at(-1);if(!e)return;o(t.slice(0,t.length-1),{open:v,action:"remove",option:e})}}})})]})]}),g("div",{className:"x-3deye-select-indicators",style:{marginLeft:"auto",display:"flex",paddingRight:8,alignItems:"center"},children:[s?m(Dn,{style:{width:24}}):t.length?m(Tr,{className:"x-3deye-button--icon",onClick:()=>{o([],{open:v,action:"clear"})},children:m(Ar,{size:16})}):null,d?null:m(Pr,{size:24})]})]}),m(ne,{id:"x-3deye-floating-ui-root",children:v&&H?m(ie,{context:S,initialFocus:-1,visuallyHiddenDismiss:!0,children:m("div",{className:"x-3deye-select-menu",...P({ref:_.setFloating,style:{...L,color:"black",overflowY:"auto"}}),children:H.length?H.map(((e,r)=>h(p(e),e,k===r,{...E({ref(e){M.current[r]=e},onClick(r){r.stopPropagation(),T(""),o([...t,e],{open:v,action:"add",option:e}),I.current?.focus()}})}))):m("div",{style:{padding:10,textAlign:"center",fontSize:"0.875rem",color:"#666"},children:s?ve.t("select.loading"):ve.t("select.noOptions")})})}):null})]})},$n=e=>Math.round(e),Vn=y((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:i=!1,labelFormat:o=e=>`${e}`,style:a},l)=>{const s=x(null),c=x(null),[d,h]=C(!1),[u,p]=C(e);w((()=>{if(!d)return;const e=s.current;if(!e)return;let i=0,o=0;const a=e.getBoundingClientRect();if(!a||!a.width||!a.height)return void h(!1);const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(i=vr(e-a.x,0,a.width),l=i/a.width*100,c.current.style.transform=`translateX(${i}px)`):(o=a.height-vr(r-a.y,0,a.height),l=o/a.height*100,c.current.style.transform=`translateY(${-o}px)`),p(l),t?.($n(l))},u=({clientX:e,clientY:i})=>{if(h(!1),!c.current)return;const o="horizontal"===n?vr(e-a.x,0,a.width)/a.width*100:100*(1-vr(i-a.y,0,a.height)/a.height);c.current.style.transform="",p(o),t?.($n(o)),r?.($n(o))},m=()=>{if(h(!1),!c.current)return;const e="horizontal"===n?i/a.width*100:o/a.height*100;c.current.style.transform="",t?.($n(e)),r?.($n(e))};return document.addEventListener("pointercancel",m),document.addEventListener("pointermove",l),document.addEventListener("pointerup",u),()=>{document.removeEventListener("pointercancel",m),document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",u)}}),[d,n,t,r]);const f=N((e=>{if(!s.current||i)return;const{clientX:r,clientY:o}=e;e.preventDefault(),h(!0);const a=s.current.getBoundingClientRect();if(!a)return;if(!c.current)return;let l=0;if("horizontal"===n){const e=vr(r-a.x,0,a.width);l=e/a.width*100,c.current.style.transform=`translateX(${e}px)`}else{const e=a.height-vr(o-a.y,0,a.height);l=e/a.height*100,c.current.style.transform=`translateY(${-e}px)`}p(l),t?.($n(l))}),[i]),v=N((n=>{if(i)return;let o=null;"ArrowLeft"===n.code?o=Math.max(e-1,0):"ArrowRight"===n.code?o=Math.min(e+1,100):"ArrowDown"===n.code?o=Math.max(e-1,0):"ArrowUp"===n.code&&(o=Math.min(e+1,100)),null!==o&&(n.stopPropagation(),n.preventDefault(),t?.(o),r?.(o))}),[e,t,r,i]);return g("div",{ref:de(l,s),tabIndex:0,onKeyDown:v,className:V("x-3deye-slider",n,{disabled:i}),onPointerDown:f,style:a,children:[m("div",{className:"x-3deye-slider__track",children:m("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${d?u:e}%`:void 0,height:"vertical"===n?`${d?u:e}%`:void 0}})}),m("div",{ref:c,className:V("x-3deye-slider__thumb",{active:d}),style:{touchAction:"none",userSelect:"none",position:"absolute",left:"horizontal"===n?d?0:`${e}%`:"auto",bottom:"vertical"===n?d?0:`${e}%`:"auto"},children:null!==o&&m("div",{className:"x-3deye-slider__label "+(d?"open":""),children:o(d?$n(u):e)})})]})}));Vn.displayName="Slider";const Wn=v.forwardRef((function({width:e,height:t,placement:r="top",style:n},i){const o=[0,"top"===r?t:0],a=[e,o[1]],l=[e/2,t-o[1]],s=[e/4,t*("top"===r?3:1)/4],c=[.325*e,t-o[1]],d=[e-c[0],c[1]],h=[e-s[0],s[1]],u=e=>e.join(","),p=`M ${u(o)} C ${u(s)} ${u(c)} ${u(l)} ${u(d)} ${u(h)} ${u(a)}`;return g("svg",{ref:i,role:"graphics-symbol",className:"tip",style:n,width:e,height:t,fill:"var(--tip-background, #fff)",children:[m("path",{className:"tip-body",d:`${p} Z`}),m("path",{className:"tip-border",d:p,stroke:"var(--tip-border, transparent)",strokeWidth:1})]})}));var Yn=({children:e,label:t,placement:r="bottom",disabled:n})=>{const[i,o]=C(!1),{x:a,y:l,refs:s,strategy:c,context:d}=Z({placement:r,open:i,onOpenChange:o,middleware:[G(5),Q(),X({padding:8})],whileElementsMounted:(e,t,r)=>K(e,t,r,{animationFrame:!0})}),{getReferenceProps:h,getFloatingProps:u}=ee([se(d,{enabled:!n}),te(d,{role:"tooltip"}),re(d,{referencePress:!0})]);return g(f,{children:[I(e,h({ref:de(s.setReference,e.ref),...e.props})),m(ne,{id:"x-3deye-floating-ui-root",children:i&&m("div",{...u({ref:s.setFloating,className:"x-3deye-tooltip",style:{position:c,top:l??0,left:a??0}}),children:t})})]})};function qn({count:e,overscan:t=1,itemSize:r,horizontal:n=!1,spacing:i=0}){const[o,a]=C(),[l,s]=C(0),[c,d]=C({width:0,height:0}),h=N((e=>{a(e||void 0)}),[]);w((()=>{if(!o)return;const e=()=>{s(n?o.scrollLeft:o.scrollTop)};return o.addEventListener("scroll",e,{passive:!0,capture:!0}),()=>{o.removeEventListener("scroll",e)}}),[o,n]),w((()=>{if(!o)return;const e=new ResizeObserver((e=>{for(const t of e)t.contentBoxSize?d({width:t.contentBoxSize[0].inlineSize,height:t.contentBoxSize[0].blockSize}):d({width:t.contentRect.width,height:t.contentRect.height})}));return e.observe(o),()=>{e.disconnect()}}),[o]),w((()=>{if(!o)return;const e=o[n?"scrollLeft":"scrollTop"];e!==l&&s(e)}));return{parentRef:h,getItems:()=>{const a=[];if(!o)return a;const{height:s,width:c}=o.getBoundingClientRect(),d=Math.max(0,Math.floor(l/(r+i))-t),h=Math.ceil((n?c:s)/(r+i))+2*t;for(let t=d;t<Math.min(e,d+h);t++)a.push({idx:t,start:t*(r+i),size:r});return a},getTotalSize:()=>r*e+Math.max(e-1,0)*i}}const Zn=j((({getter:e,setter:t})=>{const[r,n]=C(0),i=x(null),o=Math.floor(100*e());return w((()=>A(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),g("div",{ref:i,style:{paddingLeft:8,paddingRight:8,marginTop:5,marginBottom:10},children:[g("div",{style:{display:"flex",justifyContent:"space-between"},children:[m("div",{style:{textTransform:"uppercase"},children:ve.t("confidence")}),g("div",{style:{fontSize:"1.1em"},children:[o,"%"]})]}),m("div",{style:{padding:"0 10px"},children:m(Vn,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})})]})}));Zn.displayName="ProbabilitySlider";const Gn=j((({from:e,to:t})=>{const{account:{preferences:{utc:r,hour12:n}}}=L(ye);return m(f,{children:Ie(e,t,{locale:ve.language,utc:r,hour12:n})})}));Gn.displayName="DisplayPeriod";class Qn{from=null;to=null;probabilityThreshold=.5;cameras=[];detectedObjects=[];colors=new Set;regions=null;eventTypes=[];sortDirection="DESC";updated$=new p;get regionsWkt(){return this.regions?this.regions.map((e=>this.regionToWktPolygon(e))):[]}constructor(){P(this,{from:E,to:E,probabilityThreshold:E,cameras:E.struct,detectedObjects:E.struct,regions:E.ref,eventTypes:E.struct,sortDirection:E,colors:E.ref,filterJson:U}),A((()=>({from:this.from?+this.from:void 0,to:this.to?+this.to:void 0,sortDirection:this.sortDirection,filter:this.filterJson,cameraFilters:this.cameras,eventTypes:this.eventTypes,regions:this.regions})),(()=>this.updated$.next(null)))}apply(e){let t=e;const{from:r,to:n}=this;if(r&&(t=t.filter((e=>e.startTime>=r))),n&&(t=t.filter((e=>e.startTime<=n))),this.cameras.length&&(t=t.filter((e=>this.cameras.includes(e.cameraId)))),this.eventTypes.length){const e=this.eventTypes.map((e=>Ce[e]));t=t.filter((t=>e.includes(t.type)))}return 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)&&"Colors"in e&&e.Colors?.some((e=>this.colors.has(e.Color))):this.detectedObjects.includes(e.Type))}))))),!this.detectedObjects.length&&this.colors.size&&(t=t.filter((e=>e.detectedObjects.some((e=>{const{probabilityThreshold:t}=this;return!(null!==t&&e.Probability<t)&&("Colors"in e&&e.Colors?.some((e=>this.colors.has(e.Color))))}))))),t}get filterJson(){const{probabilityThreshold:e}=this;if(null===e)return null;const t={And:[]};return this.detectedObjects.length&&t.And.push({Or:this.detectedObjects.map((e=>({Type:e})))}),this.colors.size&&t.And.push({Or:[...this.colors].map((e=>({ObjectColors:[e]})))}),t.And.push({Or:[{Probability:e}]}),JSON.stringify(t)}regionToWktPolygon(e){return e.length?"POLYGON (("+e.concat(e[0]).map((({x:e,y:t})=>`${e} ${t}`)).join(", ")+"))":"POLYGON (())"}}class Xn extends br{cameraFilters=[];objectFilters=[];eventTypeFilters=[];date=null;setDate=e=>{this.date=e};clearDate=()=>{this.date=null,this.applyFilters()};resetDate=()=>{this.loaderFilters.from||this.loaderFilters.to||(this.date=null,this.sortDirection="DESC"),this.loaderFilters.from&&(this.date=this.loaderFilters.from,this.sortDirection="ASC"),this.loaderFilters.to&&(this.date=this.loaderFilters.to,this.sortDirection="DESC")};sortDirection="DESC";probabilityThreshold=.5;colors=new Set;disposables=[];loader;loaderFilters;get someAnalyticsFilterSelected(){return!!this.objectFilters.length||!!this.colors.size}get filters(){return this.objectFilters.concat(this.eventTypeFilters,this.cameraFilters)}constructor(e){super(),P(this,{cameraFilters:E.ref,objectFilters:E.ref,date:E,setDate:H,clearDate:H,resetDate:H,sortDirection:E,probabilityThreshold:E,setProbabilityThreshold:H,colors:E.ref,someAnalyticsFilterSelected:U,filters:U,setFilters:H,load:H,toggleColor:H,clearColors:H,applyFilters:H,toggleSorting:H});const t=new Qn;this.loaderFilters=t;const r=(e=>(t,r)=>t.cameras.GetSensorEventsPage({sensorIds:e.cameras,sensorType:"camera",sensorEventTypes:e.eventTypes,startTime:e.from??void 0,endTime:e.to??void 0,isDescending:"DESC"===e.sortDirection,rowsLimit:10,pageToken:r},e.filterJson,e.regionsWkt))(t);this.loader=new Cr(e,t,r),B((()=>{this.loader.loading=!0,this.loaderFilters.probabilityThreshold=null}))}toggleSorting=()=>{this.sortDirection="ASC"===this.sortDirection?"DESC":"ASC",null===this.date&&(this.date=ke(function(e){const t=e.getMinutes(),r=e.getSeconds(),n=e.getMilliseconds();return new Date(e.getTime()-60*t*1e3-1e3*r-n)}(new Date),1))};load(){this.loader.load()}applyFilters=()=>{this.loaderFilters.cameras=this.cameraFilters.map((e=>e.value)),this.loaderFilters.detectedObjects=this.objectFilters.map((e=>e.value)),this.loaderFilters.colors=this.colors,this.loaderFilters.probabilityThreshold=this.objectFilters.length||this.colors.size?this.probabilityThreshold:null,this.loaderFilters.eventTypes=this.eventTypeFilters.map((e=>e.value)),this.date?"ASC"===this.sortDirection?(this.loaderFilters.sortDirection="ASC",this.loaderFilters.to=null,this.loaderFilters.from=this.date):(this.loaderFilters.sortDirection="DESC",this.loaderFilters.from=null,this.loaderFilters.to=this.date??void 0):(this.loaderFilters.sortDirection="DESC",this.loaderFilters.from=null,this.loaderFilters.to=null)};setFilters(e){this.cameraFilters=e?e.filter((e=>"camera"===e.type)):[],this.eventTypeFilters=e?e.filter((e=>"eventType"===e.type)):[],this.objectFilters=e?e.filter((e=>"detectedObject"===e.type)):[]}getProbabilityThreshold=()=>this.probabilityThreshold;setProbabilityThreshold=e=>{this.probabilityThreshold=e,this.applyFilters()};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.loader.initWith(this.api)}dispose(){for(const e of this.disposables)e instanceof i?e.closed||e.unsubscribe():e();this.loader.dispose()}}const Jn=Dr({viewBox:"0 96 960 960",svg:m(f,{children:m("path",{d:"m513 988-57-18 14-42q3-9 4-17.6 1-8.6 1-17.2 0-17.2-3.912-32.473Q467.176 845.455 456 828q-15.938-26.26-22.969-48.63Q426 757 425 727.844q0-11.844 2.5-27.344Q430 685 434 672l13-42 57 18-14 42q-3 9-4 19t-1 19q0 19 4 32t15 30q15.97 25.948 23.485 49.974Q535 864 535 892.933q0 13.067-2.5 26.567T526 946l-13 42Zm-176 0-57-18 14-42q3-9 4-17.049t1-17.707q0-18.244-4-34.744T280 827q-15.03-21.658-23.015-46.612Q249 755.433 249 728.125 249 714 251 700t7-28l13-42 57 18-14 42q-3 9.771-4 20.086-1 10.314-1 17.914 0 21.065 5.5 36.033Q320 779 328 791q15 22 23 48.5t8 52.802Q359 905 356.5 919t-6.5 27l-13 42Zm348 0-57-18 14-42q3-9 4-17.6 1-8.6 1-17.2 0-17.2-4.5-34.7Q638 841 628 827q-15-21-23-47t-8-52.047q0-13.953 2-27.794 2-13.841 7-28.159l13-42 57 18-14 42q-4 11-4.5 19.438-.5 8.437-.5 18.562 0 18.491 4.471 32.632Q665.941 774.772 676 790q16 23 23.5 48.887 7.5 25.886 7.5 53.69 0 13.423-2.5 26.923Q702 933 698 946l-13 42ZM180 336h600v-60H180v60Zm139 120h322l18-60H301l18 60Zm0 60q-19.5 0-35.25-11.625T262 474l-25-78h-57q-24.75 0-42.375-17.625T120 336V216h720v120q0 25-17.625 42.5T780 396h-57l-30 81q-6.932 17.25-22.338 28.125Q655.257 516 636 516H319ZM180 336v-60 60Z"})})});Jn.displayName="DetectorSmokeIcon";var Kn=Jn;const ei=({data:e})=>{const t=16;return"eventType"===e.type&&e.value===Ce.Loitering?m(en,{size:16}):"camera"===e.type?m(Fr,{size:t}):"Luggage"===e.value?m(rn,{size:t}):"Car"===e.value?m(Ur,{size:t}):"Person"===e.value?m(jr,{size:t}):"Bicycle"===e.value?m(Ir,{size:t}):"Boat"===e.value?m(Lr,{size:t}):"Animal"===e.value?m(on,{size:t}):"LicensePlate"===e.value?m(Jr,{size:t}):"Smoke"===e.value?m(Kn,{size:t}):"Fire"===e.value?m(Zr,{size:t}):m(Qr,{size:t})},ti=(e,t,r,n)=>g(Hn,{style:{color:"detectedObject"===t.type?t.color:"black",display:"camera"===t.type?"flex":"inline-flex",gap:4},...n,active:r,children:["camera"!==t.type?m(ei,{data:t}):null,t.label]},e),ri=(e,t,r)=>g(Bn,{style:{"--color":"color"in t&&t.color?t.color:void 0,color:"color"in t&&t.color?"white":void 0,"--background-color":"color"in t&&t.color?"rgba(255, 255, 255, 0.7)":void 0},...r,children:[m(ei,{data:t}),t.label]},e),ni=j((({camerasOnly:e,store:t})=>{const{cameras:r,eventSchema:n}=L(ye),i=(()=>{if(!n)return[];if(e)return r.data.map((e=>({type:"camera",value:e.id,label:e.name})));const t=[{value:Ce.Loitering,label:ve.t("eventTypes.Loitering").toLowerCase(),type:"eventType"}];return[].concat(n.foundObjectTypesForSelect.map((e=>({...e,label:ve.t(`analytics.${e.label}`)}))),t,r.data.map((e=>({type:"camera",value:e.id,label:e.name}))))})();return m(jn,{onChange:(e,r)=>{t.setFilters(e),r.open||"remove"!==r.action&&"clear"!==r.action||t.applyFilters()},onMenuClose:()=>{t.applyFilters()},options:i,renderOption:ti,values:t.filters,renderValue:ri,keyExtractor:e=>`${e.type}:${e.value}`,placeholder:g(f,{children:[m(Yr,{size:16})," ",ve.t("filter")]})})}));ni.displayName="EventGridSelect";const ii=j((({store:e})=>{const{date:t,setDate:r,clearDate:n,resetDate:i,sortDirection:o,toggleSorting:a,applyFilters:l}=e,{account:s}=L(ye),{utc:c,hour12:d,startOfWeek:h}=s.preferences,[u,p]=C(!1),f=M((()=>((e,t,r,n=!0)=>{const i={...wn,second:n?"numeric":void 0,hour12:r||void 0,hourCycle:r?void 0:"h23",timeZone:t?"UTC":void 0,timeZoneName:t?"short":void 0};return new Intl.DateTimeFormat(e,i)})(ve.language,c,d)),[ve.language,c,d]),v=g("div",{style:{flex:1,display:"flex",position:"relative"},children:[g(Tr,{className:"date-button",style:{flex:1,borderRadius:0,textTransform:"uppercase",flexDirection:"row"},onClick:()=>p(!u),children:[g("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[t?m("label",{children:"ASC"===o?ve.t("eventSearchFilter.after"):ve.t("eventSearchFilter.before")}):null,m("span",{children:t?f.format(t):ve.t("eventSearchFilter.recentEvents")})]}),m(Pr,{})]}),t?m(Tr,{className:"x-3deye-button--icon",style:{position:"absolute",right:32},onClick:n,children:m(Ar,{size:16})}):null]});return w((()=>{u||i()}),[u,i]),m("div",{className:"event-grid-datepicker",children:m("div",{style:{position:"relative"},children:m(Ln,{target:v,opened:u,onOpenChange:p,withArrow:!0,className:"popover-datetimepicker",children:g("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[g(On,{value:o,onChange:a,children:[m(En,{value:"DESC",children:ve.t("eventSearchFilter.before")}),m(En,{value:"ASC",children:ve.t("eventSearchFilter.after")})]}),g("div",{style:{display:"flex",gap:"0.5rem"},children:[m(gn,{date:t,onChange:r,utc:c,startOfWeek:h}),m(xn,{date:t,onChange:r,utc:c,hour12:d})]}),m(Tr,{onClick:()=>{l(),p(!1)},variant:"filled",fullWidth:!0,children:ve.t("button.ok")})]})})})})}));ii.displayName="EventGridDatepicker";const oi=j((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:i})=>{const o=x(null),{ref:a,menuContext:l}=function(){const[e,t]=C(!1),[r,n]=C(),i=N((e=>{n(e||void 0)}),[]),[o]=C((()=>new Set)),[a]=C((()=>new Set)),l=M((()=>({subscribe:e=>(o.add(e),()=>o.delete(e)),onOpenChange:e=>(a.add(e),()=>a.delete(e)),setOpened:e=>{t(e);for(const t of a)t(e)}})),[]);return w((()=>{if(r)return r.addEventListener("contextmenu",e),()=>{r.removeEventListener("contextmenu",e)};function e(e){e.preventDefault();for(const t of o)t(e)}}),[r]),{ref:i,menuContext:l,opened:e}}();return g("div",{ref:de(o,a),onDragStart:t=>{if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",`${e.id}`),t.dataTransfer.setData("x-3deye/camera",`${e.cameraId}`),t.dataTransfer.setData("x-3deye/starttime",e.startTime.toISOString()),t.dataTransfer.dropEffect="move";const r=o.current?.querySelector("img");if(r){const{x:e,y:n}=r.getBoundingClientRect();t.dataTransfer.setDragImage(r,t.clientX-e,t.clientY-n)}},className:"event-list-item",onClick:()=>r?.(e),onAuxClick:t=>n?.(t,e),draggable:!0,children:[t,i&&m(i,{ctx:l,data:e})]})}));oi.displayName="EventListItem";const ai=j((({data:e})=>{if("Temperature"!==e.type)return null;const t=JSON.parse(e.raw.data??"null"),r=Number.isInteger(t)?Number(t):t.t;return g("div",{className:"event-list-item__temperature",children:[m(ln,{}),g("span",{children:[(r-273.15).toFixed(1),"°C"]})," / ",g("span",{children:[(9*r/5-459.67).toFixed(1)," °F"]})]})}));ai.displayName="Temperature";var li=ai;const si=j((({data:e,cameraNameHidden:t})=>{const r=L(ye),{cameras:n}=r,i=n.loaded&&n.camerasById.get(e.cameraId)?.name||"...";return g("div",{className:"event-list-item-caption",children:[m("div",{className:"event-list-item__time",children:m(Gn,{from:e.startTime,to:e.endTime})}),t?null:g(f,{children:[m("div",{children:e.type}),m("div",{className:"event-list-item__camera-name",title:i,children:i})]}),+e.endTime-+e.startTime>0&&m("div",{className:"event-list-item__duration",children:fr(+e.endTime-+e.startTime,ve.t)}),m(li,{data:e})]})}));si.displayName="EventListItemCaption";var ci=j((({url:e,noPreview:t,width:r})=>g(f,{children:[e?m("img",{style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e},e):null,m(ce,{radius:r}),t?m("div",{className:"no-preview-overlay"}):null]})));const di=({className:e,style:t,box:{Top:r,Left:n,Right:i,Bottom:o}})=>m(f,{children:m("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-o)+"%",right:100*(1-i)+"%",...t}})});function hi({style:e}){return g("div",{className:"frame",style:e,children:[m("div",{className:"corner-highlight-tl"}),m("div",{className:"corner-highlight-tr"}),m("div",{className:"corner-highlight-br"}),m("div",{className:"corner-highlight-bl"})]})}di.displayName="LicensePlateLpr";const ui=b((({value:e})=>e?m(f,{children:e.split("").map(((e,t)=>(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57})(e)?m("span",{className:"digit",children:e},`d${t}${e}`):m("span",{className:"char",children:e},`${t}${e}`)))}):null));ui.displayName="LicensePlateNumber";const pi=({detectedObject:e,height:t,width:r,url:n,thumbWidth:i,thumbHeight:o})=>{const{Type:a,Box:{Top:l,Left:s,Right:c,Bottom:d},Probability:h,Value:u}=e,p=x(null);T((()=>{if(!p.current)return;const e=p.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,i=l*t-e.height-4;i<0&&(i=d*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),p.current.style.top=`${i}px`,p.current.style.left=`${n}px`}));const v={top:2};s>=1-c?v.left=2:v.right=2;const y=100/i/(c-s);return g(f,{children:[g("div",{ref:p,className:"event-list-item__license-plate-label trigger",title:`${a.toLowerCase()} ${Math.floor(100*h)}%`,children:[m("div",{style:{padding:4},children:m(ui,{value:u})}),m("div",{className:"event-list-item__license-plate-label__caption",children:`${Math.floor(100*h)}%`})]}),m(di,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),g("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:i*(c-s)*y,height:o*(d-l)*y+16,position:"absolute",...v},children:[m("img",{style:{width:i*y,height:o*y,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),m("div",{className:"plate-number",children:m(ui,{value:u})}),m(hi,{style:{height:o*(d-l)*y}})]})]})};function mi(e,t,r,n){return e.Top<-n&&(e.Bottom=e.Bottom-e.Top+n,e.Top=-n),e.Left<-n&&(e.Right=e.Right-e.Left+n,e.Left=-n),e.Right+n>t&&(e.Left=e.Left-(e.Right-t)+n,e.Right=t-n),e.Bottom+n>r&&(e.Top=e.Top-(e.Bottom-r)+n,e.Bottom=r-n),e}function gi({Top:e,Left:t,Bottom:r,Right:n},i,o,a,l){const s=l*e,c=l*r;return s>o?[0,-1]:c>o?[0,1]:a*t>i?[-1,0]:a*n>i?[1,0]:[0,s>c?1:-1]}function fi(e,t){return{Top:e.Top+t[1],Left:e.Left+t[0],Bottom:e.Bottom+t[1],Right:e.Right+t[0]}}pi.displayName="LicensePlateHighlight";const vi=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:i,thumbHeight:o,width:a,height:l})=>{const{Top:s,Left:c,Right:d,Bottom:h}=t,u=100/i/(d-c),p={top:2},v=x(null);return T((()=>{if(!v.current)return;const{width:e,height:r}=v.current.getBoundingClientRect(),n=gi(t,e,r,a,l);n[0]=n[0]*(e+(d-c)*a)/2,n[1]=n[1]*(r+(h-s)*l)/2;const i=mi(fi({Top:(s+h)/2*l-r/2,Left:(c+d)/2*a-e/2,Bottom:(s+h)/2*l+r/2,Right:(c+d)/2*a+e/2},n),a,l,0);v.current.style.top=`${i.Top+2*Math.sign(n[1])}px`,v.current.style.left=`${i.Left+2*Math.sign(n[0])}px`})),c>=1-d?p.left=2:p.right=2,g(f,{children:[g("div",{ref:v,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`,children:[m("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"},children:e}),g("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"},children:[Math.floor(100*r),"%"]})]}),m(di,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),g("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:i*(d-c)*u,height:o*(h-s)*u,...p},children:[m("img",{style:{width:i*u,height:o*u,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),m(hi,{})]})]})};function yi({Top:e,Left:t,Bottom:r,Right:n}){return[(t+n)/2,(e+r)/2]}function bi(e,t){const[r,n]=yi(e),[i,o]=yi(t);return[i-r,o-n]}function Ci(e,t){return!(e.Left>t.Right||e.Top>t.Bottom||e.Right<t.Left||e.Bottom<t.Top)}function xi([e,t]){const r=Math.sqrt(e*e+t*t);return 0===r?[0,0]:[e/r,t/r]}vi.displayName="FaceHighlight";const wi=j((({data:e,width:t,height:r})=>{const n=x(null),{eventSchema:i}=L(ye);return T((()=>{if(!n.current)return;const i=[],o=[];for(let a=0;a<e.length;a++){const l=n.current.children[2*a+1],s=e[a].Box;i.push({Top:s.Top*r,Left:s.Left*t,Bottom:s.Bottom*r,Right:s.Right*t});const[c,d]=yi(i[a]),{width:h,height:u}=l.getBoundingClientRect(),p=gi(s,h,u,t,r);o.push(fi({Top:d-u/2-4,Left:c-h/2-4,Bottom:d+u/2+4,Right:c+h/2+4},p))}let a=!0,l=0;for(;a;){if(a=!1,l++>1e3){console.warn("Reached max iterations for label positioning");break}for(let t=0;t<e.length;t++){const r=o[t],n=[0,0];for(let l=0;l<e.length;l++){const e=i[l],s=o[l];if(Ci(r,e)){const t=bi(e,r);n[0]=n[0]+t[0],n[1]=n[1]+t[1],a=!0}if(l!==t&&Ci(r,s)){const e=bi(s,r);n[0]=n[0]+e[0],n[1]=n[1]+e[1],a=!0}}[n[0],n[1]]=xi(n),r.Top+=n[1],r.Left+=n[0],r.Bottom+=n[1],r.Right+=n[0]}}for(let i=0;i<e.length;i++){const e=n.current.children[2*i+1],{Top:a,Left:l}=mi(o[i],t,r,4);e.style.top=`${a+4}px`,e.style.left=`${l+4}px`}}),[e,t,r]),m("div",{ref:n,children:e.map(((e,t)=>g(v.Fragment,{children:[m(di,{box:e.Box,style:{outline:`2px solid ${i.colorsByFoundObjectType.get(e.Type)??""}`}}),g("div",{className:"event-list-item__detected-object-label",title:`${e.Type.toLowerCase()} ${Math.floor(100*e.Probability)}%`,children:[m("div",{style:{padding:4,lineHeight:"24px"},children:"Car"===e.Type&&"BodyType"in e&&e.BodyType?e.BodyType.toLowerCase():e.Type.toLowerCase()}),g("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:i.colorsByFoundObjectType.get(e.Type)},children:[Math.floor(100*e.Probability),"%"]})]})]},t)))})}));wi.displayName="DetectedObjects";var Ti=wi;const Di=j((({data:e,width:t,height:r,cameraNameHidden:n,onClick:i,onAuxClick:o,menuComponent:a})=>{const l=L(ye),{eventSchema:s}=l,[c,d]=function(e){const[t,r]=C(null),n=L(ye),{cameras:i,thumbnails:o}=n;w((()=>{if(e.thumbnailUrl)return void r(null);const t=o.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{r(e||null)}));return()=>t.unsubscribe()}),[e.id]);let a="",l=!1;return e.thumbnailUrl?a=e.thumbnailUrl:null===t&&i.loaded?(a=i.camerasById.get(e.cameraId)?.imageUrl||"",l=!0):t&&(a=t.url),[a,l]}(e);let h=[],u=null,p=null;if(e.detectedObjects.length){const{thumbnailWidth:n,thumbnailHeight:i}=e;h=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)),u=e.detectedObjects.filter((e=>"LicensePlate"===e.Type)).map(((e,o)=>m(pi,{detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:i,url:c},o)))}if(e.faces){const{thumbnailWidth:n,thumbnailHeight:i}=e;p=e.faces.map(((e,o)=>m(vi,{face:e,url:c,thumbWidth:n,thumbHeight:i,width:t,height:r},o)))}return m(oi,{onClick:i,onAuxClick:o,data:e,width:t,height:r,menuComponent:a,children:g("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0},children:[m(ci,{url:c,noPreview:d,width:t}),m(Ti,{data:h,width:t,height:r}),u,p,e.acknowledged?m("div",{className:"acknowledged-overlay",children:ve.t("event.acknowledged")}):null,m(si,{data:e,cameraNameHidden:n})]})})}));Di.displayName="EventItem";const ki=j((({columnIndex:e,rowIndex:t,style:r,store:n,columnCount:i,eventRenderer:o})=>{const a=t*i+e,l=n.data[a];return a===n.data.length?n.error?m("div",{style:r,children:m("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"},children:g("div",{style:{textAlign:"center"},children:[m("div",{children:"Couldn't fetch more data"}),m(Tr,{onClick:n.loadMore,children:"Retry"})]})})}):n.pageInfo?.haveMore?m("div",{style:r,children:m("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"},children:m(Sn,{size:32})})}):m("div",{style:r}):!l&&n.pageInfo?.haveMore?m("div",{style:r}):m("div",l?{style:r,children:m(Nn,{children:o({data:l,width:r.width,height:r.height})})}:{style:r})})),Ni=j((({store:e,scrollWidth:t,onClick:r})=>e.pendingData.length?m("div",{style:{position:"absolute",top:0,left:0,right:t,pointerEvents:"none",textAlign:"center",padding:8},children:m(Tr,{className:"x-3deye-button--overlay",style:{background:"rgba(0, 0, 0, 0.75)",padding:"8px 16px",backdropFilter:"blur(2px)",borderRadius:32,pointerEvents:"auto"},onClick:r,children:ve.t("showEvents",{count:e.pendingData.length})})}):null)),Mi=j((({store:e,width:t,height:r,captionHeight:n=0,columnsCount:i=0,minColumnWidth:o,aspectRatio:a=16/9,onEventClick:l,onEventAuxClick:s,eventRenderer:c})=>{const d=x(null),h=()=>{d.current&&(e.setLiveUpdateMode("auto"),d.current.scrollTop=0)};if(w((()=>A((()=>e.loading||!e.data.length),(e=>e&&h()))),[]),e.error&&!e.data.length)return m("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"},children:g("div",{style:{textAlign:"center"},children:[m("div",{children:"Couldn't fetch data"}),m(Tr,{onClick:e.reload,children:"Retry"})]})});if(e.loading)return m("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"},children:m(Sn,{})});if(!e.data.length)return m("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"},children:ve.t("noEventsFound")});return m(Ii,{...{store:e,width:t,columnsCount:i,minColumnWidth:o,aspectRatio:a,captionHeight:n,height:r,onEventClick:l,onEventAuxClick:s,eventRenderer:c,containerRef:d,resetScroll:h}})}));Mi.displayName="EventGrid";const Ii=j((({store:e,width:t,height:r,captionHeight:n=0,columnsCount:i=0,minColumnWidth:o=320,aspectRatio:a,containerRef:l,onEventClick:s,onEventAuxClick:c,eventRenderer:d=({data:e,width:t,height:r})=>m(Di,{data:e.data,cameraNameHidden:!1,onClick:s,onAuxClick:c,width:t,height:r}),resetScroll:h})=>{const u=Math.floor(t/o)||1,p=t/u/a+n,f=u*Math.floor(r/p)>=e.data.length?0:gr(),v=Math.min(i,e.data.length)||Math.max(1,Math.floor((t-f)/o));let y=Math.ceil(e.data.length/v);const b=(t-f-2*(v-1))/v,C=b/a+n;e.pageInfo?.haveMore&&y*v===e.data.length&&y++;const{parentRef:x,getItems:T,getTotalSize:D}=qn({count:y,overscan:5,itemSize:C,spacing:2}),{parentRef:k,getItems:N,getTotalSize:M}=qn({count:v,overscan:5,itemSize:b,horizontal:!0,spacing:2}),I=T(),_=N();w((()=>{e.error||e.pageInfo?.haveMore&&(e.loading||I.length&&I.at(-1).idx+1===y&&e.loadMore())}),[e.error,e.pageInfo?.haveMore,I]);const L=I.flatMap((({idx:t,size:r,start:n})=>_.map((({idx:i,size:o,start:a})=>{const l=t*v+i;return l>e.data.length?null:l!==e.data.length||e.pageInfo?.haveMore?m(ki,{columnIndex:i,rowIndex:t,columnCount:v,style:{position:"absolute",top:0,left:0,height:r,width:o,transform:`translate(${a}px, ${n}px)`,display:"flex"},store:e,eventRenderer:d},e.data[l]?`${e.data[l].data.id}-${e.data[l].objectIdx}`:"loading"):null}))));return g("div",{style:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},children:[m("div",{ref:de(l,x,k),style:{width:t,height:r,overflow:"auto"},onScroll:t=>{const{scrollTop:r}=t.target;"disabled"!==e.liveUpdateMode&&e.setLiveUpdateMode(r>=1||e.pendingData.length?"manual":"auto")},children:m("div",{style:{position:"relative",height:D(),width:M()},children:L})}),m(Ni,{store:e,scrollWidth:f,onClick:()=>{e.flushUpdates(),h()}})]})})),_i=({onEventClick:e,style:t,...r})=>{const n=L(S)??F,[i,o]=C(),{ref:a,width:l,height:s}=(e=>{const{ref:t,width:r,height:n}=z(),[i,o]=C(0);return w((()=>{o((e=>e+1))}),e),{ref:t,width:r,height:n,fix:i}})([i]);return w((()=>(i?.dispose(),R((()=>n.initialized),(()=>{const e=new Xn(n.events);e.initWith(n.api),e.load(),o(e)})))),[n]),m(ye.Provider,{value:n,children:i?g("div",{style:{display:"flex",flexDirection:"column",textAlign:"left",...t},...r,children:[m("div",{style:{padding:10},children:m(ni,{store:i})}),m(ii,{store:i}),i.someAnalyticsFilterSelected&&g(f,{children:[m(Zn,{getter:i.getProbabilityThreshold,setter:i.setProbabilityThreshold}),m(cn,{value:i.colors,toggle:i.toggleColor,clear:i.clearColors})]}),m("div",{ref:a,style:{flex:1,display:"flex"},children:m(Mi,{minColumnWidth:Number.POSITIVE_INFINITY,store:i.loader,width:l,height:s,eventRenderer:({data:t,width:r,height:n})=>m(Di,{data:t.data,cameraNameHidden:!1,onClick:e,width:r,height:n})})})]}):null})};_i.displayName="EventList";var Li=_i;(e=>{if(e&&Object.assign(fe,e),ve.isInitialized){if(fe.resources)for(const e of Object.keys(fe.resources))ve.addResourceBundle(e,"translation",fe.resources[e].translation,!0);else console.warn("i18n is already initialized");return t(ve.t)}r(ve.init(fe))})({resources:{en:{translation:ge}}});export{Xn as AllEventsStore,Li as default};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3deye-toolkit/react-event-list",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"module": "dist/react-event-list.js",
|
|
5
5
|
"types": "dist/react-event-list.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@3deye-toolkit/core": "0.0.
|
|
10
|
+
"@3deye-toolkit/core": "0.0.7",
|
|
11
11
|
"@floating-ui/react": "^0.25.4",
|
|
12
12
|
"@mantine/hooks": "^6.0.21",
|
|
13
13
|
"@seznam/compose-react-refs": "^1.0.6",
|