import { useEffect, useRef } from 'react';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import {
api,
setStreamToken,
getStreamToken,
setMediaToken,
getMediaToken,
withStreamToken,
withMediaToken,
} from '../api/client';
import { useAuth } from '../contexts/AuthContext';
/** True for the three live-camera routes, which take the camera stream token.
* Everything else under /api/v1/ that a browser loads as an element src is
* media and takes the media token (#3025). */
export function isCameraUrl(src: string): boolean {
return src.includes('/camera/');
}
/**
* Walks the DOM and updates every
/