import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Dialog, DialogClose, DialogContent, DialogTitle, } from "../../components/ui/dialog";
import { useImperativeHandle, useState, forwardRef, useEffect } from "react";
import { buildDate, version } from "../../revision";
import { useLicense } from "../../licensing";
import { ParheliaIcon } from "../ui/ParheliaIcon";
import { X } from "lucide-react";
export const AboutDialog = forwardRef(function AboutDialog(props, ref) {
    const [visible, setVisible] = useState(false);
    const license = useLicense();
    const licenseeCompanyName = license.licenseStatus?.companyName?.trim();
    const showLicenseRows = !license.licenseStatus?.licensingDisabled;
    const licenseLabel = license.isLoading
        ? "Checking"
        : license.isLicensed
            ? license.licenseType === "trial"
                ? license.daysRemaining != null
                    ? `Trial (${license.daysRemaining}d)`
                    : "Trial"
                : "Licensed"
            : "Unlicensed";
    useImperativeHandle(ref, () => ({
        onClose: (result) => {
            setVisible(false);
            props.onClose(result);
        },
    }));
    useEffect(() => {
        setVisible(true);
    }, []);
    return (_jsx(Dialog, { open: visible, onOpenChange: (open) => {
            if (!open) {
                setVisible(false);
                props.onClose(null);
            }
        }, children: _jsxs(DialogContent, { className: "border-border-default/70 text-neutral-grey-100 overflow-hidden rounded-[18px] bg-white p-0 shadow-2xl sm:max-w-[430px]", overlayClassName: "bg-neutral-grey-100/45 backdrop-blur-md", showCloseButton: false, children: [_jsx(DialogTitle, { className: "sr-only", children: "About Parhelia" }), _jsx(DialogClose, { asChild: true, children: _jsx("button", { type: "button", "aria-label": "Close", "data-testid": "dialog-close", className: "text-neutral-grey-50 hover:text-neutral-grey-100 focus-visible:ring-ring/40 absolute top-7 right-7 z-50 inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded transition-colors outline-none focus-visible:ring-[3px]", children: _jsx(X, { className: "h-5 w-5", strokeWidth: 1, "aria-hidden": "true" }) }) }), _jsxs("div", { className: "flex min-h-[525px] flex-col items-center px-12 pt-16 pb-10 text-center", children: [_jsx("div", { className: "mb-11 flex justify-center", children: _jsx(ParheliaIcon, { size: 108, animated: false }) }), _jsxs("div", { className: "mb-10 grid w-full max-w-[245px] grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-3 text-left text-sm leading-none", children: [_jsx("span", { className: "text-neutral-grey-100 text-right font-medium", children: "Version" }), _jsx("span", { className: "text-neutral-grey-50 min-w-0 wrap-break-word tabular-nums", children: version }), _jsx("span", { className: "text-neutral-grey-100 text-right font-medium", children: "Build Date" }), _jsx("span", { className: "text-neutral-grey-50 min-w-0 wrap-break-word tabular-nums", children: buildDate }), showLicenseRows && (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-neutral-grey-100 text-right font-medium", children: "License" }), _jsx("span", { className: "text-neutral-grey-50 min-w-0 wrap-break-word", children: licenseLabel }), licenseeCompanyName && (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-neutral-grey-100 text-right font-medium", children: "Licensee" }), _jsx("span", { className: "text-neutral-grey-50 min-w-0 wrap-break-word", children: licenseeCompanyName })] }))] }))] }), _jsxs("div", { className: "mt-auto space-y-5", children: [_jsx("p", { className: "text-neutral-grey-50 mx-auto max-w-[290px] text-sm leading-[1.28] font-medium", children: "Built with passion by the Parhelia team at Canvas Reply. Focusing on the future of AI-driven content management." }), _jsxs("div", { className: "text-neutral-grey-50 mx-auto max-w-[255px] text-sm leading-[1.28] font-medium", children: ["\u00A9 ", new Date().getFullYear(), " Canvas Reply GmbH. All rights reserved."] })] })] })] }) }));
});
//# sourceMappingURL=AboutDialog.js.map