import * as JSX from "./jsx";
import * as user from "./user";

import PaymentSuccess from "./payment-success";
import FirstLanding from "./first-landing";
import Tutorial from "./support-tutorial"
import Terminal from "./terminal";
import Support from "./support";
import Upgrade from "./upgrade";
import Models from "./support-models";
import Login from "./login";
import Home from "./home";
import ToS from "./support-tos";
import Api from "./support-api";

JSX.addRoute( "/payment-success", () => <PaymentSuccess /> );
JSX.addRoute( "/first-landing", () => <FirstLanding /> );
JSX.addRoute( "/terminal", () => <Terminal /> );
JSX.addRoute( "/tutorial", () => <Tutorial /> );
JSX.addRoute( "/support", () => <Support /> );
JSX.addRoute( "/upgrade", () => <Upgrade /> );
JSX.addRoute( "/models", () => <Models /> );
JSX.addRoute( "/login", () => <Login /> );
JSX.addRoute( "/tos", () => <ToS /> );
JSX.addRoute( "/api", () => <Api /> );
JSX.addRoute( "/", () => <Home /> );

window.onpopstate = JSX.onPopState;
JSX.onPreNavigate( user.onNavigate );

const url = new URL( window.location.href );
JSX.navigateParams( url.pathname, url.searchParams.entries() );
