import { atom, useAtom } from "jotai";
import { atomWithStorage } from "jotai/utils";
import { useEffect } from "react";
import { lazy } from "react";
import { DengiCaching } from "./trash/dengiCashingSystem";
import { ifstyle } from "./trash/helpers";
import { LoginPage } from "./pages/LoginPage";
import { DX4App } from "./pages/DX4AppPage";
export const API_BASE_URL = "http://192.168.3.10:8321/api.php";
const classIDAtom = atomWithStorage("class-id", "");
const adminAtom = atomWithStorage("admin-id", "");
const pickmeModeAtom = atomWithStorage("pickmeMode", false);
const EditorPage = lazy(() => import("./pages/editor"));
const TestPage = lazy(() => import("./pages/test"));
const dengi_cash = new DengiCaching();
// KATAMAZ DENGI ROUTER 4 PRO MAX ULTIMATE
// 💀💀
// PROS - vrode raboatat,
// too simple, lightweight, stupidly fast
// (beacause you basicly download entire site, lol)
// CONS - shit
function firstPathSegment(path) {
const m = path.match(/^\/?([^/]+)/);
return m ? m[1] : "";
}
const secondPathSegment = (p) => p.replace(/^\/?[^/]+/, "").replace(/^\/+/, "");
const routeAtom = atom("/");
const basePageProps = {
// atoms
classIDAtom,
adminAtom,
routeAtom,
// fucntions
setsetRoute,
secondPathSegment,
ifstyle,
// constants
API_BASE_URL,
// caching
dengi_cash,
// etc
pickmeModeAtom, // <3
};
const pages = {
"/":