import React from 'react';
import * as ReactDOMClient from 'react-dom/client';
import { createPortal, flushSync } from 'react-dom';
import { useNavigate, useLocation, useParams, useSearchParams } from 'react-router-dom';
import { toPng } from 'html-to-image';

window.React = React;
window.ReactDOM = { ...ReactDOMClient, createPortal, flushSync };

for (const k of Object.keys(React)) {
  if (typeof window[k] === 'undefined') window[k] = React[k];
}

window.htmlToImage = { toPng };
window.useNavigate = useNavigate;
window.useLocation = useLocation;
window.useParams = useParams;
window.useSearchParams = useSearchParams;
