import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { cn } from "../lib/utils";
import Controls from "../windowControls";
export default function CreateScreen({ children, className, }) {
    return (_jsx("div", { className: cn("bg-background flex h-dvh w-screen flex-col items-center justify-center pt-[var(--ui-safe-area-top)] pr-[var(--ui-safe-area-right)] pb-[var(--ui-safe-area-bottom)] pl-[var(--ui-safe-area-left)]", className), "data-tauri-drag-region": true, children: _jsxs(_Fragment, { children: [_jsx(Controls, { className: "fixed top-[max(0.4375rem,var(--ui-safe-area-top))] right-[max(0.475rem,var(--ui-safe-area-right))] ring-foreground/15" }), children] }) }));
}
import { Button } from "../cmp/button";
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "../cmp/alert-dialog";
import { useIsMobile } from "../lib/utils";
export function ClearStorageButton({ className }) {
    const isMobile = useIsMobile();
    return (_jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { render: _jsx(Button, { variant: "destructive", className: cn(isMobile ? "w-full" : "", className), children: "Clear storage" }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Are you sure you want to clear storage?" }), _jsx(AlertDialogDescription, { children: "This action cannot be undone. It will clear all your settings and credentials." })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogAction, { onClick: async () => {
                                    localStorage.clear();
                                    for (const db of await indexedDB.databases()) {
                                        indexedDB.deleteDatabase(db.name);
                                    }
                                    location.reload();
                                }, children: "Continue" }), _jsx(AlertDialogCancel, { children: "Cancel" })] })] })] }));
}
export function StorageDestoryer() {
    const isMobile = useIsMobile();
    return (_jsx("div", { className: cn("fixed bottom-0 p-5 pr-[max(1.25rem,var(--ui-safe-area-right))] pb-[max(1.25rem,var(--ui-safe-area-bottom))] pl-[max(1.25rem,var(--ui-safe-area-left))]", isMobile ? "w-full" : "right-0"), children: _jsx(ClearStorageButton, {}) }));
}
