import React, {
useState, useEffect, useRef, useCallback,
} from 'react';
import {
Grid, IconButton, Paper, Slider, Toolbar, Tooltip, Typography,
} from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import SettingsIcon from '@mui/icons-material/Settings';
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
import PauseIcon from '@mui/icons-material/Pause';
import FastForwardIcon from '@mui/icons-material/FastForward';
import FastRewindIcon from '@mui/icons-material/FastRewind';
import { useNavigate } from 'react-router-dom';
import { useSelector } from 'react-redux';
import Map from '../map/core/Map';
import MapReplayPath from '../map/MapReplayPath';
import MapPositions from '../map/MapPositions';
import { formatTime } from '../common/util/formatter';
import ReportFilter from '../reports/components/ReportFilter';
import { useTranslation } from '../common/components/LocalizationProvider';
import { useCatch } from '../reactHelper';
const useStyles = makeStyles((theme) => ({
root: {
height: '100%',
},
sidebar: {
display: 'flex',
flexDirection: 'column',
position: 'absolute',
zIndex: 3,
left: 0,
top: 0,
margin: theme.spacing(1.5),
width: theme.dimensions.drawerWidthDesktop,
[theme.breakpoints.down('md')]: {
width: '100%',
margin: 0,
},
},
title: {
flexGrow: 1,
},
slider: {
width: '100%',
},
controls: {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
},
formControlLabel: {
height: '100%',
width: '100%',
paddingRight: theme.spacing(1),
justifyContent: 'space-between',
alignItems: 'center',
},
content: {
display: 'flex',
flexDirection: 'column',
padding: theme.spacing(2),
[theme.breakpoints.down('md')]: {
margin: theme.spacing(1),
},
[theme.breakpoints.up('md')]: {
marginTop: theme.spacing(1),
},
},
}));
const TimeLabel = ({ children, open, value }) => (